diff --git a/app/dist/assets/data-grid-overlay-editor-BHYotFjA.js b/app/dist/assets/data-grid-overlay-editor-DpnMYOBr.js similarity index 98% rename from app/dist/assets/data-grid-overlay-editor-BHYotFjA.js rename to app/dist/assets/data-grid-overlay-editor-DpnMYOBr.js index aeec00d..1579d4e 100644 --- a/app/dist/assets/data-grid-overlay-editor-BHYotFjA.js +++ b/app/dist/assets/data-grid-overlay-editor-DpnMYOBr.js @@ -1 +1 @@ -import{s as $,r,i as w,a as z,b as J,c as Q,T as U,C as Z,m as ee}from"./index-3IqDs7ii.js";const te=()=>t=>t.targetX,re=()=>t=>t.targetY,ne=()=>t=>t.targetWidth,ie=()=>t=>t.targetHeight,se=()=>t=>t.targetY+10,ae=()=>t=>Math.max(0,(t.targetHeight-28)/2),oe=$("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[re(),"px"],"d19meir1-1":[te(),"px"],"d19meir1-2":[ne(),"px"],"d19meir1-3":[ie(),"px"],"d19meir1-4":[se(),"px"],"d19meir1-5":[ae(),"px"]}});function de(){const[t,s]=r.useState();return[t??void 0,s]}function le(){const[t,s]=de(),[i,y]=r.useState(0),[m,x]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const a=new IntersectionObserver(o=>{o.length!==0&&x(o[0].isIntersecting)},{threshold:1});return a.observe(t),()=>a.disconnect()},[t]),r.useEffect(()=>{if(m||t===void 0)return;let a;const o=()=>{const{right:S}=t.getBoundingClientRect();y(p=>Math.min(p+window.innerWidth-S-10,0)),a=requestAnimationFrame(o)};return a=requestAnimationFrame(o),()=>{a!==void 0&&cancelAnimationFrame(a)}},[t,m]);const O=r.useMemo(()=>({transform:`translateX(${i}px)`}),[i]);return{ref:s,style:O}}const ce=t=>{const{target:s,content:i,onFinishEditing:y,forceEditMode:m,initialValue:x,imageEditorOverride:O,markdownDivCreateNode:a,highlight:o,className:S,theme:p,id:H,cell:v,bloom:c,validateCell:d,getCellRenderer:F,provideEditor:h,isOutsideClick:X}=t,[l,A]=r.useState(m?i:void 0),k=r.useRef(l??i);k.current=l??i;const[E,R]=r.useState(()=>d===void 0?!0:!(w(i)&&(d==null?void 0:d(v,i,k.current))===!1)),f=r.useCallback((e,n)=>{y(E?e:void 0,n)},[E,y]),K=r.useCallback(e=>{if(d!==void 0&&e!==void 0&&w(e)){const n=d(v,e,k.current);n===!1?R(!1):(typeof n=="object"&&(e=n),R(!0))}A(e)},[v,d]),C=r.useRef(!1),g=r.useRef(void 0),W=r.useCallback(()=>{f(l,[0,0]),C.current=!0},[l,f]),Y=r.useCallback((e,n)=>{f(e,n??g.current??[0,0]),C.current=!0},[f]),j=r.useCallback(async e=>{let n=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),g.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),g.current=[0,1],n=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),g.current=[e.shiftKey?-1:1,0],n=!0),window.setTimeout(()=>{!C.current&&g.current!==void 0&&(f(n?l:void 0,g.current),C.current=!0)},0)},[f,l]),D=l??i,[u,q]=r.useMemo(()=>{var n,G;if(z(i))return[];const e=h==null?void 0:h(i);return e!==void 0?[e,!1]:[(G=(n=F(i))==null?void 0:n.provideEditor)==null?void 0:G.call(n,i),!1]},[i,F,h]),{ref:B,style:L}=le();let P=!0,M,_=!0,b;if(u!==void 0){P=u.disablePadding!==!0,_=u.disableStyling!==!0;const e=J(u);e&&(b=u.styleOverride);const n=e?u.editor:u;M=r.createElement(n,{isHighlighted:o,onChange:K,value:D,initialValue:x,onFinishedEditing:Y,validatedSelection:w(D)?D.selectionRange:void 0,forceEditMode:m,target:s,imageEditorOverride:O,markdownDivCreateNode:a,isValid:E,theme:p})}b={...b,...L};const N=document.getElementById("portal");if(N===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `
` as the last child of your ``.'),null;let I=_?"gdg-style":"gdg-unstyle";E||(I+=" gdg-invalid"),P&&(I+=" gdg-pad");const T=(c==null?void 0:c[0])??1,V=(c==null?void 0:c[1])??1;return Q.createPortal(r.createElement(U.Provider,{value:p},r.createElement(Z,{style:ee(p),className:S,onClickOutside:W,isOutsideClick:X},r.createElement(oe,{ref:B,id:H,className:I,style:b,as:q===!0?"label":void 0,targetX:s.x-T,targetY:s.y-V,targetWidth:s.width+T*2,targetHeight:s.height+V*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:j},M)))),N)};export{ce as default}; +import{s as $,r,i as w,a as z,b as J,c as Q,T as U,C as Z,m as ee}from"./index-DtDByObO.js";const te=()=>t=>t.targetX,re=()=>t=>t.targetY,ne=()=>t=>t.targetWidth,ie=()=>t=>t.targetHeight,se=()=>t=>t.targetY+10,ae=()=>t=>Math.max(0,(t.targetHeight-28)/2),oe=$("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[re(),"px"],"d19meir1-1":[te(),"px"],"d19meir1-2":[ne(),"px"],"d19meir1-3":[ie(),"px"],"d19meir1-4":[se(),"px"],"d19meir1-5":[ae(),"px"]}});function de(){const[t,s]=r.useState();return[t??void 0,s]}function le(){const[t,s]=de(),[i,y]=r.useState(0),[m,x]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const a=new IntersectionObserver(o=>{o.length!==0&&x(o[0].isIntersecting)},{threshold:1});return a.observe(t),()=>a.disconnect()},[t]),r.useEffect(()=>{if(m||t===void 0)return;let a;const o=()=>{const{right:S}=t.getBoundingClientRect();y(p=>Math.min(p+window.innerWidth-S-10,0)),a=requestAnimationFrame(o)};return a=requestAnimationFrame(o),()=>{a!==void 0&&cancelAnimationFrame(a)}},[t,m]);const O=r.useMemo(()=>({transform:`translateX(${i}px)`}),[i]);return{ref:s,style:O}}const ce=t=>{const{target:s,content:i,onFinishEditing:y,forceEditMode:m,initialValue:x,imageEditorOverride:O,markdownDivCreateNode:a,highlight:o,className:S,theme:p,id:H,cell:v,bloom:c,validateCell:d,getCellRenderer:F,provideEditor:h,isOutsideClick:X}=t,[l,A]=r.useState(m?i:void 0),k=r.useRef(l??i);k.current=l??i;const[E,R]=r.useState(()=>d===void 0?!0:!(w(i)&&(d==null?void 0:d(v,i,k.current))===!1)),f=r.useCallback((e,n)=>{y(E?e:void 0,n)},[E,y]),K=r.useCallback(e=>{if(d!==void 0&&e!==void 0&&w(e)){const n=d(v,e,k.current);n===!1?R(!1):(typeof n=="object"&&(e=n),R(!0))}A(e)},[v,d]),C=r.useRef(!1),g=r.useRef(void 0),W=r.useCallback(()=>{f(l,[0,0]),C.current=!0},[l,f]),Y=r.useCallback((e,n)=>{f(e,n??g.current??[0,0]),C.current=!0},[f]),j=r.useCallback(async e=>{let n=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),g.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),g.current=[0,1],n=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),g.current=[e.shiftKey?-1:1,0],n=!0),window.setTimeout(()=>{!C.current&&g.current!==void 0&&(f(n?l:void 0,g.current),C.current=!0)},0)},[f,l]),D=l??i,[u,q]=r.useMemo(()=>{var n,G;if(z(i))return[];const e=h==null?void 0:h(i);return e!==void 0?[e,!1]:[(G=(n=F(i))==null?void 0:n.provideEditor)==null?void 0:G.call(n,i),!1]},[i,F,h]),{ref:B,style:L}=le();let P=!0,M,_=!0,b;if(u!==void 0){P=u.disablePadding!==!0,_=u.disableStyling!==!0;const e=J(u);e&&(b=u.styleOverride);const n=e?u.editor:u;M=r.createElement(n,{isHighlighted:o,onChange:K,value:D,initialValue:x,onFinishedEditing:Y,validatedSelection:w(D)?D.selectionRange:void 0,forceEditMode:m,target:s,imageEditorOverride:O,markdownDivCreateNode:a,isValid:E,theme:p})}b={...b,...L};const N=document.getElementById("portal");if(N===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `
` as the last child of your ``.'),null;let I=_?"gdg-style":"gdg-unstyle";E||(I+=" gdg-invalid"),P&&(I+=" gdg-pad");const T=(c==null?void 0:c[0])??1,V=(c==null?void 0:c[1])??1;return Q.createPortal(r.createElement(U.Provider,{value:p},r.createElement(Z,{style:ee(p),className:S,onClickOutside:W,isOutsideClick:X},r.createElement(oe,{ref:B,id:H,className:I,style:b,as:q===!0?"label":void 0,targetX:s.x-T,targetY:s.y-V,targetWidth:s.width+T*2,targetHeight:s.height+V*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:j},M)))),N)};export{ce as default}; diff --git a/app/dist/assets/index-3IqDs7ii.js b/app/dist/assets/index-3IqDs7ii.js deleted file mode 100644 index d4e9a64..0000000 --- a/app/dist/assets/index-3IqDs7ii.js +++ /dev/null @@ -1,281 +0,0 @@ -var wR=Object.defineProperty;var bR=(t,e,n)=>e in t?wR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var bt=(t,e,n)=>bR(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var no=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ii(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var IS={exports:{}},Vh={},DS={exports:{}},Tt={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var _c=Symbol.for("react.element"),xR=Symbol.for("react.portal"),kR=Symbol.for("react.fragment"),SR=Symbol.for("react.strict_mode"),CR=Symbol.for("react.profiler"),TR=Symbol.for("react.provider"),ER=Symbol.for("react.context"),AR=Symbol.for("react.forward_ref"),MR=Symbol.for("react.suspense"),RR=Symbol.for("react.memo"),OR=Symbol.for("react.lazy"),Ww=Symbol.iterator;function PR(t){return t===null||typeof t!="object"?null:(t=Ww&&t[Ww]||t["@@iterator"],typeof t=="function"?t:null)}var _S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},NS=Object.assign,LS={};function Ba(t,e,n){this.props=t,this.context=e,this.refs=LS,this.updater=n||_S}Ba.prototype.isReactComponent={};Ba.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Ba.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function FS(){}FS.prototype=Ba.prototype;function Py(t,e,n){this.props=t,this.context=e,this.refs=LS,this.updater=n||_S}var Iy=Py.prototype=new FS;Iy.constructor=Py;NS(Iy,Ba.prototype);Iy.isPureReactComponent=!0;var Vw=Array.isArray,BS=Object.prototype.hasOwnProperty,Dy={current:null},zS={key:!0,ref:!0,__self:!0,__source:!0};function $S(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)BS.call(e,r)&&!zS.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,L=j[A];if(0>>1;Ai(B,U))cei(we,B)?(j[A]=we,j[ce]=U,A=ce):(j[A]=B,j[H]=U,A=H);else if(cei(we,U))j[A]=we,j[ce]=U,A=ce;else break e}}return Y}function i(j,Y){var U=j.sortIndex-Y.sortIndex;return U!==0?U:j.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,f=null,d=3,h=!1,p=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(j){for(var Y=n(u);Y!==null;){if(Y.callback===null)r(u);else if(Y.startTime<=j)r(u),Y.sortIndex=Y.expirationTime,e(a,Y);else break;Y=n(u)}}function k(j){if(m=!1,y(j),!p)if(n(a)!==null)p=!0,Q(x);else{var Y=n(u);Y!==null&&te(k,Y.startTime-j)}}function x(j,Y){p=!1,m&&(m=!1,v(E),E=-1),h=!0;var U=d;try{for(y(Y),f=n(a);f!==null&&(!(f.expirationTime>Y)||j&&!_());){var A=f.callback;if(typeof A=="function"){f.callback=null,d=f.priorityLevel;var L=A(f.expirationTime<=Y);Y=t.unstable_now(),typeof L=="function"?f.callback=L:f===n(a)&&r(a),y(Y)}else r(a);f=n(a)}if(f!==null)var I=!0;else{var H=n(u);H!==null&&te(k,H.startTime-Y),I=!1}return I}finally{f=null,d=U,h=!1}}var C=!1,T=null,E=-1,M=5,P=-1;function _(){return!(t.unstable_now()-Pj||125A?(j.sortIndex=U,e(u,j),n(a)===null&&j===n(u)&&(m?(v(E),E=-1):m=!0,te(k,U-A))):(j.sortIndex=L,e(a,j),p||h||(p=!0,Q(x))),j},t.unstable_shouldYield=_,t.unstable_wrapCallback=function(j){var Y=d;return function(){var U=d;d=Y;try{return j.apply(this,arguments)}finally{d=U}}}})(US);VS.exports=US;var jR=VS.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var WR=w,zr=jR;function ue(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cm=Object.prototype.hasOwnProperty,VR=/^[: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]*$/,Kw={},Xw={};function UR(t){return Cm.call(Xw,t)?!0:Cm.call(Kw,t)?!1:VR.test(t)?Xw[t]=!0:(Kw[t]=!0,!1)}function KR(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 XR(t,e,n,r){if(e===null||typeof e>"u"||KR(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 hr(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Vn[t]=new hr(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Vn[e]=new hr(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Vn[t]=new hr(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Vn[t]=new hr(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){Vn[t]=new hr(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Vn[t]=new hr(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Vn[t]=new hr(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Vn[t]=new hr(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Vn[t]=new hr(t,5,!1,t.toLowerCase(),null,!1,!1)});var Ny=/[\-:]([a-z])/g;function Ly(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(Ny,Ly);Vn[e]=new hr(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(Ny,Ly);Vn[e]=new hr(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(Ny,Ly);Vn[e]=new hr(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Vn[t]=new hr(t,1,!1,t.toLowerCase(),null,!1,!1)});Vn.xlinkHref=new hr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Vn[t]=new hr(t,1,!1,t.toLowerCase(),null,!0,!0)});function Fy(t,e,n,r){var i=Vn.hasOwnProperty(e)?Vn[e]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var a=` -`+i[o].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{ng=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Ou(t):""}function GR(t){switch(t.tag){case 5:return Ou(t.type);case 16:return Ou("Lazy");case 13:return Ou("Suspense");case 19:return Ou("SuspenseList");case 0:case 2:case 15:return t=rg(t.type,!1),t;case 11:return t=rg(t.type.render,!1),t;case 1:return t=rg(t.type,!0),t;default:return""}}function Mm(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 Vl:return"Fragment";case Wl:return"Portal";case Tm:return"Profiler";case By:return"StrictMode";case Em:return"Suspense";case Am:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case GS:return(t.displayName||"Context")+".Consumer";case XS:return(t._context.displayName||"Context")+".Provider";case zy:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case $y:return e=t.displayName||null,e!==null?e:Mm(t.type)||"Memo";case Gs:e=t._payload,t=t._init;try{return Mm(t(e))}catch{}}return null}function YR(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Mm(e);case 8:return e===By?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function vo(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function qS(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function qR(t){var e=qS(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 i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Tf(t){t._valueTracker||(t._valueTracker=qR(t))}function QS(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=qS(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Bd(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 Rm(t,e){var n=e.checked;return fn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Yw(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=vo(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 JS(t,e){e=e.checked,e!=null&&Fy(t,"checked",e,!1)}function Om(t,e){JS(t,e);var n=vo(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")?Pm(t,e.type,n):e.hasOwnProperty("defaultValue")&&Pm(t,e.type,vo(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function qw(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 Pm(t,e,n){(e!=="number"||Bd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Pu=Array.isArray;function la(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Ef.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function lc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Bu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},QR=["Webkit","ms","Moz","O"];Object.keys(Bu).forEach(function(t){QR.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Bu[e]=Bu[t]})});function nC(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Bu.hasOwnProperty(t)&&Bu[t]?(""+e).trim():e+"px"}function rC(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=nC(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var JR=fn({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 _m(t,e){if(e){if(JR[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ue(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ue(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ue(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ue(62))}}function Nm(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Lm=null;function Hy(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Fm=null,aa=null,ua=null;function Zw(t){if(t=Fc(t)){if(typeof Fm!="function")throw Error(ue(280));var e=t.stateNode;e&&(e=Yh(e),Fm(t.stateNode,t.type,e))}}function iC(t){aa?ua?ua.push(t):ua=[t]:aa=t}function sC(){if(aa){var t=aa,e=ua;if(ua=aa=null,Zw(t),e)for(t=0;t>>=0,t===0?32:31-(uO(t)/cO|0)|0}var Af=64,Mf=4194304;function Iu(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function jd(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Iu(l):(s&=o,s!==0&&(r=Iu(s)))}else o=n&~i,o!==0?r=Iu(o):s!==0&&(r=Iu(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Nc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Mi(e),t[e]=n}function pO(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=$u),a1=" ",u1=!1;function TC(t,e){switch(t){case"keyup":return jO.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function EC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ul=!1;function VO(t,e){switch(t){case"compositionend":return EC(e);case"keypress":return e.which!==32?null:(u1=!0,a1);case"textInput":return t=e.data,t===a1&&u1?null:t;default:return null}}function UO(t,e){if(Ul)return t==="compositionend"||!Yy&&TC(t,e)?(t=SC(),xd=Ky=ro=null,Ul=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=h1(n)}}function OC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?OC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function PC(){for(var t=window,e=Bd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Bd(t.document)}return e}function qy(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function eP(t){var e=PC(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&OC(n.ownerDocument.documentElement,n)){if(r!==null&&qy(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=p1(n,s);var o=p1(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Kl=null,Wm=null,ju=null,Vm=!1;function g1(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vm||Kl==null||Kl!==Bd(r)||(r=Kl,"selectionStart"in r&&qy(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}),ju&&hc(ju,r)||(ju=r,r=Ud(Wm,"onSelect"),0Yl||(t.current=qm[Yl],qm[Yl]=null,Yl--)}function Qt(t,e){Yl++,qm[Yl]=t.current,t.current=e}var wo={},nr=Eo(wo),xr=Eo(!1),nl=wo;function ba(t,e){var n=t.type.contextTypes;if(!n)return wo;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function kr(t){return t=t.childContextTypes,t!=null}function Xd(){rn(xr),rn(nr)}function k1(t,e,n){if(nr.current!==wo)throw Error(ue(168));Qt(nr,e),Qt(xr,n)}function $C(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(ue(108,YR(t)||"Unknown",i));return fn({},n,r)}function Gd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||wo,nl=nr.current,Qt(nr,t),Qt(xr,xr.current),!0}function S1(t,e,n){var r=t.stateNode;if(!r)throw Error(ue(169));n?(t=$C(t,e,nl),r.__reactInternalMemoizedMergedChildContext=t,rn(xr),rn(nr),Qt(nr,t)):rn(xr),Qt(xr,n)}var ms=null,qh=!1,yg=!1;function HC(t){ms===null?ms=[t]:ms.push(t)}function dP(t){qh=!0,HC(t)}function Ao(){if(!yg&&ms!==null){yg=!0;var t=0,e=$t;try{var n=ms;for($t=1;t>=o,i-=o,xs=1<<32-Mi(e)+i|n<E?(M=T,T=null):M=T.sibling;var P=d(v,T,y[E],k);if(P===null){T===null&&(T=M);break}t&&T&&P.alternate===null&&e(v,T),g=s(P,g,E),C===null?x=P:C.sibling=P,C=P,T=M}if(E===y.length)return n(v,T),an&&$o(v,E),x;if(T===null){for(;EE?(M=T,T=null):M=T.sibling;var _=d(v,T,P.value,k);if(_===null){T===null&&(T=M);break}t&&T&&_.alternate===null&&e(v,T),g=s(_,g,E),C===null?x=_:C.sibling=_,C=_,T=M}if(P.done)return n(v,T),an&&$o(v,E),x;if(T===null){for(;!P.done;E++,P=y.next())P=f(v,P.value,k),P!==null&&(g=s(P,g,E),C===null?x=P:C.sibling=P,C=P);return an&&$o(v,E),x}for(T=r(v,T);!P.done;E++,P=y.next())P=h(T,v,E,P.value,k),P!==null&&(t&&P.alternate!==null&&T.delete(P.key===null?E:P.key),g=s(P,g,E),C===null?x=P:C.sibling=P,C=P);return t&&T.forEach(function(O){return e(v,O)}),an&&$o(v,E),x}function b(v,g,y,k){if(typeof y=="object"&&y!==null&&y.type===Vl&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Cf:e:{for(var x=y.key,C=g;C!==null;){if(C.key===x){if(x=y.type,x===Vl){if(C.tag===7){n(v,C.sibling),g=i(C,y.props.children),g.return=v,v=g;break e}}else if(C.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Gs&&E1(x)===C.type){n(v,C.sibling),g=i(C,y.props),g.ref=hu(v,C,y),g.return=v,v=g;break e}n(v,C);break}else e(v,C);C=C.sibling}y.type===Vl?(g=el(y.props.children,v.mode,k,y.key),g.return=v,v=g):(k=Rd(y.type,y.key,y.props,null,v.mode,k),k.ref=hu(v,g,y),k.return=v,v=k)}return o(v);case Wl:e:{for(C=y.key;g!==null;){if(g.key===C)if(g.tag===4&&g.stateNode.containerInfo===y.containerInfo&&g.stateNode.implementation===y.implementation){n(v,g.sibling),g=i(g,y.children||[]),g.return=v,v=g;break e}else{n(v,g);break}else e(v,g);g=g.sibling}g=Tg(y,v.mode,k),g.return=v,v=g}return o(v);case Gs:return C=y._init,b(v,g,C(y._payload),k)}if(Pu(y))return p(v,g,y,k);if(au(y))return m(v,g,y,k);Nf(v,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,g!==null&&g.tag===6?(n(v,g.sibling),g=i(g,y),g.return=v,v=g):(n(v,g),g=Cg(y,v.mode,k),g.return=v,v=g),o(v)):n(v,g)}return b}var ka=UC(!0),KC=UC(!1),Qd=Eo(null),Jd=null,Jl=null,ev=null;function tv(){ev=Jl=Jd=null}function nv(t){var e=Qd.current;rn(Qd),t._currentValue=e}function Zm(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function fa(t,e){Jd=t,ev=Jl=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(wr=!0),t.firstContext=null)}function ii(t){var e=t._currentValue;if(ev!==t)if(t={context:t,memoizedValue:e,next:null},Jl===null){if(Jd===null)throw Error(ue(308));Jl=t,Jd.dependencies={lanes:0,firstContext:t}}else Jl=Jl.next=t;return e}var Yo=null;function rv(t){Yo===null?Yo=[t]:Yo.push(t)}function XC(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,rv(e)):(n.next=i.next,i.next=n),e.interleaved=n,Ms(t,r)}function Ms(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}var Ys=!1;function iv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function GC(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 Cs(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ho(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,It&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Ms(t,n)}return i=r.interleaved,i===null?(e.next=e,rv(r)):(e.next=i.next,i.next=e),r.interleaved=e,Ms(t,n)}function Sd(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Wy(t,n)}}function A1(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Zd(t,e,n,r){var i=t.updateQueue;Ys=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?s=u:o.next=u,o=a;var c=t.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(s!==null){var f=i.baseState;o=0,c=u=a=null,l=s;do{var d=l.lane,h=l.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,m=l;switch(d=e,h=n,m.tag){case 1:if(p=m.payload,typeof p=="function"){f=p.call(h,f,d);break e}f=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,d=typeof p=="function"?p.call(h,f,d):p,d==null)break e;f=fn({},f,d);break e;case 2:Ys=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,d=i.effects,d===null?i.effects=[l]:d.push(l))}else h={eventTime:h,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=f):c=c.next=h,o|=d;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;d=l,l=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(!0);if(c===null&&(a=f),i.baseState=a,i.firstBaseUpdate=u,i.lastBaseUpdate=c,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);sl|=o,t.lanes=o,t.memoizedState=f}}function M1(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=wg.transition;wg.transition={};try{t(!1),e()}finally{$t=n,wg.transition=r}}function f2(){return si().memoizedState}function mP(t,e,n){var r=go(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},d2(t))h2(e,n);else if(n=XC(t,e,n,r),n!==null){var i=ur();Ri(n,t,r,i),p2(n,e,r)}}function yP(t,e,n){var r=go(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(d2(t))h2(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Oi(l,o)){var a=e.interleaved;a===null?(i.next=i,rv(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=XC(t,e,i,r),n!==null&&(i=ur(),Ri(n,t,r,i),p2(n,e,r))}}function d2(t){var e=t.alternate;return t===cn||e!==null&&e===cn}function h2(t,e){Wu=th=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function p2(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Wy(t,n)}}var nh={readContext:ii,useCallback:Yn,useContext:Yn,useEffect:Yn,useImperativeHandle:Yn,useInsertionEffect:Yn,useLayoutEffect:Yn,useMemo:Yn,useReducer:Yn,useRef:Yn,useState:Yn,useDebugValue:Yn,useDeferredValue:Yn,useTransition:Yn,useMutableSource:Yn,useSyncExternalStore:Yn,useId:Yn,unstable_isNewReconciler:!1},vP={readContext:ii,useCallback:function(t,e){return Ui().memoizedState=[t,e===void 0?null:e],t},useContext:ii,useEffect:O1,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Td(4194308,4,o2.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Td(4194308,4,t,e)},useInsertionEffect:function(t,e){return Td(4,2,t,e)},useMemo:function(t,e){var n=Ui();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ui();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=mP.bind(null,cn,t),[r.memoizedState,t]},useRef:function(t){var e=Ui();return t={current:t},e.memoizedState=t},useState:R1,useDebugValue:dv,useDeferredValue:function(t){return Ui().memoizedState=t},useTransition:function(){var t=R1(!1),e=t[0];return t=gP.bind(null,t[1]),Ui().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=cn,i=Ui();if(an){if(n===void 0)throw Error(ue(407));n=n()}else{if(n=e(),Ln===null)throw Error(ue(349));il&30||JC(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,O1(e2.bind(null,r,s,t),[t]),r.flags|=2048,xc(9,ZC.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Ui(),e=Ln.identifierPrefix;if(an){var n=ks,r=xs;n=(r&~(1<<32-Mi(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=wc++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Ki]=e,t[mc]=r,C2(t,e,!1,!1),e.stateNode=t;e:{switch(o=Nm(n,r),n){case"dialog":tn("cancel",t),tn("close",t),i=r;break;case"iframe":case"object":case"embed":tn("load",t),i=r;break;case"video":case"audio":for(i=0;iTa&&(e.flags|=128,r=!0,pu(s,!1),e.lanes=4194304)}else{if(!r)if(t=eh(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),pu(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!an)return qn(e),null}else 2*Sn()-s.renderingStartTime>Ta&&n!==1073741824&&(e.flags|=128,r=!0,pu(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Sn(),e.sibling=null,n=un.current,Qt(un,r?n&1|2:n&1),e):(qn(e),null);case 22:case 23:return vv(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Pr&1073741824&&(qn(e),e.subtreeFlags&6&&(e.flags|=8192)):qn(e),null;case 24:return null;case 25:return null}throw Error(ue(156,e.tag))}function EP(t,e){switch(Jy(e),e.tag){case 1:return kr(e.type)&&Xd(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Sa(),rn(xr),rn(nr),lv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return ov(e),null;case 13:if(rn(un),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ue(340));xa()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return rn(un),null;case 4:return Sa(),null;case 10:return nv(e.type._context),null;case 22:case 23:return vv(),null;case 24:return null;default:return null}}var Ff=!1,er=!1,AP=typeof WeakSet=="function"?WeakSet:Set,Re=null;function Zl(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){pn(t,e,r)}else n.current=null}function a0(t,e,n){try{n()}catch(r){pn(t,e,r)}}var H1=!1;function MP(t,e){if(Um=Wd,t=PC(),qy(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,f=t,d=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(a=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===t)break t;if(d===n&&++u===i&&(l=o),d===s&&++c===r&&(a=o),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Km={focusedElem:t,selectionRange:n},Wd=!1,Re=e;Re!==null;)if(e=Re,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Re=t;else for(;Re!==null;){e=Re;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,b=p.memoizedState,v=e.stateNode,g=v.getSnapshotBeforeUpdate(e.elementType===e.type?m:vi(e.type,m),b);v.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var y=e.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ue(163))}}catch(k){pn(e,e.return,k)}if(t=e.sibling,t!==null){t.return=e.return,Re=t;break}Re=e.return}return p=H1,H1=!1,p}function Vu(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&a0(e,n,s)}i=i.next}while(i!==r)}}function Zh(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function u0(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function A2(t){var e=t.alternate;e!==null&&(t.alternate=null,A2(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ki],delete e[mc],delete e[Ym],delete e[cP],delete e[fP])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function M2(t){return t.tag===5||t.tag===3||t.tag===4}function j1(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||M2(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function c0(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Kd));else if(r!==4&&(t=t.child,t!==null))for(c0(t,e,n),t=t.sibling;t!==null;)c0(t,e,n),t=t.sibling}function f0(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(f0(t,e,n),t=t.sibling;t!==null;)f0(t,e,n),t=t.sibling}var zn=null,wi=!1;function $s(t,e,n){for(n=n.child;n!==null;)R2(t,e,n),n=n.sibling}function R2(t,e,n){if(ts&&typeof ts.onCommitFiberUnmount=="function")try{ts.onCommitFiberUnmount(Uh,n)}catch{}switch(n.tag){case 5:er||Zl(n,e);case 6:var r=zn,i=wi;zn=null,$s(t,e,n),zn=r,wi=i,zn!==null&&(wi?(t=zn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):zn.removeChild(n.stateNode));break;case 18:zn!==null&&(wi?(t=zn,n=n.stateNode,t.nodeType===8?mg(t.parentNode,n):t.nodeType===1&&mg(t,n),fc(t)):mg(zn,n.stateNode));break;case 4:r=zn,i=wi,zn=n.stateNode.containerInfo,wi=!0,$s(t,e,n),zn=r,wi=i;break;case 0:case 11:case 14:case 15:if(!er&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&a0(n,e,o),i=i.next}while(i!==r)}$s(t,e,n);break;case 1:if(!er&&(Zl(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){pn(n,e,l)}$s(t,e,n);break;case 21:$s(t,e,n);break;case 22:n.mode&1?(er=(r=er)||n.memoizedState!==null,$s(t,e,n),er=r):$s(t,e,n);break;default:$s(t,e,n)}}function W1(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new AP),e.forEach(function(r){var i=FP.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function gi(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Sn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*OP(r/1960))-r,10t?16:t,io===null)var r=!1;else{if(t=io,io=null,sh=0,It&6)throw Error(ue(331));var i=It;for(It|=4,Re=t.current;Re!==null;){var s=Re,o=s.child;if(Re.flags&16){var l=s.deletions;if(l!==null){for(var a=0;aSn()-mv?Zo(t,0):gv|=n),Sr(t,e)}function F2(t,e){e===0&&(t.mode&1?(e=Mf,Mf<<=1,!(Mf&130023424)&&(Mf=4194304)):e=1);var n=ur();t=Ms(t,e),t!==null&&(Nc(t,e,n),Sr(t,n))}function LP(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),F2(t,n)}function FP(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ue(314))}r!==null&&r.delete(e),F2(t,n)}var B2;B2=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||xr.current)wr=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return wr=!1,CP(t,e,n);wr=!!(t.flags&131072)}else wr=!1,an&&e.flags&1048576&&jC(e,qd,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Ed(t,e),t=e.pendingProps;var i=ba(e,nr.current);fa(e,n),i=uv(null,e,r,t,i,n);var s=cv();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,kr(r)?(s=!0,Gd(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,iv(e),i.updater=Jh,e.stateNode=i,i._reactInternals=e,t0(e,r,t,n),e=i0(null,e,r,!0,s,n)):(e.tag=0,an&&s&&Qy(e),lr(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Ed(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=zP(r),t=vi(r,t),i){case 0:e=r0(null,e,r,t,n);break e;case 1:e=B1(null,e,r,t,n);break e;case 11:e=L1(null,e,r,t,n);break e;case 14:e=F1(null,e,r,vi(r.type,t),n);break e}throw Error(ue(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:vi(r,i),r0(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:vi(r,i),B1(t,e,r,i,n);case 3:e:{if(x2(e),t===null)throw Error(ue(387));r=e.pendingProps,s=e.memoizedState,i=s.element,GC(t,e),Zd(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Ca(Error(ue(423)),e),e=z1(t,e,r,n,i);break e}else if(r!==i){i=Ca(Error(ue(424)),e),e=z1(t,e,r,n,i);break e}else for(Fr=fo(e.stateNode.containerInfo.firstChild),Br=e,an=!0,bi=null,n=KC(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(xa(),r===i){e=Rs(t,e,n);break e}lr(t,e,r,n)}e=e.child}return e;case 5:return YC(e),t===null&&Jm(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Xm(r,i)?o=null:s!==null&&Xm(r,s)&&(e.flags|=32),b2(t,e),lr(t,e,o,n),e.child;case 6:return t===null&&Jm(e),null;case 13:return k2(t,e,n);case 4:return sv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ka(e,null,r,n):lr(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:vi(r,i),L1(t,e,r,i,n);case 7:return lr(t,e,e.pendingProps,n),e.child;case 8:return lr(t,e,e.pendingProps.children,n),e.child;case 12:return lr(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Qt(Qd,r._currentValue),r._currentValue=o,s!==null)if(Oi(s.value,o)){if(s.children===i.children&&!xr.current){e=Rs(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=Cs(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Zm(s.return,n,e),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ue(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Zm(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}lr(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,fa(e,n),i=ii(i),r=r(i),e.flags|=1,lr(t,e,r,n),e.child;case 14:return r=e.type,i=vi(r,e.pendingProps),i=vi(r.type,i),F1(t,e,r,i,n);case 15:return v2(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:vi(r,i),Ed(t,e),e.tag=1,kr(r)?(t=!0,Gd(e)):t=!1,fa(e,n),g2(e,r,i),t0(e,r,i,n),i0(null,e,r,!0,t,n);case 19:return S2(t,e,n);case 22:return w2(t,e,n)}throw Error(ue(156,e.tag))};function z2(t,e){return dC(t,e)}function BP(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(t,e,n,r){return new BP(t,e,n,r)}function bv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function zP(t){if(typeof t=="function")return bv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===zy)return 11;if(t===$y)return 14}return 2}function mo(t,e){var n=t.alternate;return n===null?(n=qr(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Rd(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")bv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Vl:return el(n.children,i,s,e);case By:o=8,i|=8;break;case Tm:return t=qr(12,n,e,i|2),t.elementType=Tm,t.lanes=s,t;case Em:return t=qr(13,n,e,i),t.elementType=Em,t.lanes=s,t;case Am:return t=qr(19,n,e,i),t.elementType=Am,t.lanes=s,t;case YS:return tp(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case XS:o=10;break e;case GS:o=9;break e;case zy:o=11;break e;case $y:o=14;break e;case Gs:o=16,r=null;break e}throw Error(ue(130,t==null?t:typeof t,""))}return e=qr(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function el(t,e,n,r){return t=qr(7,t,r,e),t.lanes=n,t}function tp(t,e,n,r){return t=qr(22,t,r,e),t.elementType=YS,t.lanes=n,t.stateNode={isHidden:!1},t}function Cg(t,e,n){return t=qr(6,t,null,e),t.lanes=n,t}function Tg(t,e,n){return e=qr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function $P(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sg(0),this.expirationTimes=sg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function xv(t,e,n,r,i,s,o,l,a){return t=new $P(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=qr(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},iv(s),t}function HP(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(W2)}catch(t){console.error(t)}}W2(),WS.exports=$r;var KP=WS.exports,V2,Q1=KP;V2=Q1.createRoot,Q1.hydrateRoot;function U2(){return""}function XP(){return/^G-[A-Z0-9]+$/.test(U2())}function GP(){const t=window.gtag;typeof t=="function"&&XP()&&t("config",U2(),{send_page_view:!1})}function YP(){var t,e;(t=window.gtag)==null||t.call(window,"event","page_view",{page_path:window.location.pathname,page_location:window.location.href}),(e=window.plausible)==null||e.call(window,"pageview")}function qP(){var t,e;(t=window.gtag)==null||t.call(window,"event","permalink_view"),(e=window.plausible)==null||e.call(window,"Permalink View")}function QP(){var t,e;(t=window.gtag)==null||t.call(window,"event","changelog_open"),(e=window.plausible)==null||e.call(window,"Changelog Open")}function JP(t){var e,n;(e=window.gtag)==null||e.call(window,"event","changelog_vote",{...t}),(n=window.plausible)==null||n.call(window,"Changelog Vote",{props:{...t}})}function ZP(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Tv(t,e){var n,r;(n=window.gtag)==null||n.call(window,"event",t,{...e}),(r=window.plausible)==null||r.call(window,ZP(t),{props:{...e}})}function eI(t){Tv("conversion",t)}function $f(t){Tv("export",t)}function tI(t){Tv("feedback",t)}function nI(t){return new TextEncoder().encode(t).length}function rI(t){return t<10*1024?"<10KB":t<100*1024?"10-100KB":t<1024*1024?"100KB-1MB":">1MB"}function iI(t){let e=2166136261;for(let n=0;n>>0).toString(36)}function sI(t={}){const e=t.settleMs??2e3,n=t.minWindowMs??2e3,r=t.now??(()=>Date.now()),i=t.isValid??(()=>!0);let s=null,o,l=null,a=0;function u(f){if(f.text.trim()==="")return!1;const d=nI(f.text),h=`${f.direction}:${f.input}:${d}:${iI(f.text)}`;if(h===l||!i(f.direction,f.text))return!1;const p=r();return p-a{o=void 0,s&&u(s)},e)}return{edit(f,d){s={direction:f,input:"paste",text:d},c()},discrete(f,d,h){s={direction:f,input:d,text:h},c(),u(s)},cancel(){s=null,l=null,o&&(clearTimeout(o),o=void 0)}}}/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const K2=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oI=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lI=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const J1=t=>{const e=lI(t);return e.charAt(0).toUpperCase()+e.slice(1)};/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var Eg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aI=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},uI=w.createContext({}),cI=()=>w.useContext(uI),fI=w.forwardRef(({color:t,size:e,strokeWidth:n,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...l},a)=>{const{size:u=24,strokeWidth:c=2,absoluteStrokeWidth:f=!1,color:d="currentColor",className:h=""}=cI()??{},p=r??f?Number(n??c)*24/Number(e??u):n??c;return w.createElement("svg",{ref:a,...Eg,width:e??u??Eg.width,height:e??u??Eg.height,stroke:t??d,strokeWidth:p,className:K2("lucide",h,i),...!s&&!aI(l)&&{"aria-hidden":"true"},...l},[...o.map(([m,b])=>w.createElement(m,b)),...Array.isArray(s)?s:[s]])});/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _n=(t,e)=>{const n=w.forwardRef(({className:r,...i},s)=>w.createElement(fI,{ref:s,iconNode:e,className:K2(`lucide-${oI(J1(t))}`,`lucide-${t}`,r),...i}));return n.displayName=J1(t),n};/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dI=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],hI=_n("arrow-left-right",dI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pI=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],Z1=_n("braces",pI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gI=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],mI=_n("clipboard",gI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yI=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ev=_n("copy",yI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vI=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],X2=_n("download",vI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wI=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],G2=_n("file-up",wI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bI=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],xI=_n("moon",bI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kI=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],SI=_n("redo-2",kI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],TI=_n("rotate-ccw-clock",CI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],eb=_n("rotate-ccw",EI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],MI=_n("search",AI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RI=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],OI=_n("sparkles",RI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PI=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],II=_n("sun",PI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DI=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],_I=_n("table",DI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NI=[["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}],["path",{d:"M17 14V2",key:"8ymqnk"}]],LI=_n("thumbs-down",NI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FI=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],BI=_n("thumbs-up",FI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zI=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],m0=_n("trash",zI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $I=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],HI=_n("undo-2",$I);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Y2=_n("x",jI);function q2(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=KI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const l=o.split(Av);return l[0]===""&&l.length!==1&&l.shift(),Q2(l,e)||UI(o)},getConflictingClassGroupIds:(o,l)=>{const a=n[o]||[];return l&&r[o]?[...a,...r[o]]:a}}},Q2=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?Q2(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Av);return(o=e.validators.find(({validator:l})=>l(s)))==null?void 0:o.classGroupId},tb=/^\[(.+)\]$/,UI=t=>{if(tb.test(t)){const e=tb.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},KI=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return GI(Object.entries(t.classGroups),n).forEach(([s,o])=>{y0(o,r,s,e)}),r},y0=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:nb(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(XI(i)){y0(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{y0(o,nb(e,s),n,r)})})},nb=(t,e)=>{let n=t;return e.split(Av).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},XI=t=>t.isThemeGetter,GI=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[e+o,l])):s);return[n,i]}):t,YI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},J2="!",qI=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=l=>{const a=[];let u=0,c=0,f;for(let b=0;bc?f-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:o}):o},QI=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},JI=t=>({cache:YI(t.cacheSize),parseClassName:qI(t),...VI(t)}),ZI=/\s+/,eD=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(ZI);let l="";for(let a=o.length-1;a>=0;a-=1){const u=o[a],{modifiers:c,hasImportantModifier:f,baseClassName:d,maybePostfixModifierPosition:h}=n(u);let p=!!h,m=r(p?d.substring(0,h):d);if(!m){if(!p){l=u+(l.length>0?" "+l:l);continue}if(m=r(d),!m){l=u+(l.length>0?" "+l:l);continue}p=!1}const b=QI(c).join(":"),v=f?b+J2:b,g=v+m;if(s.includes(g))continue;s.push(g);const y=i(m,p);for(let k=0;k0?" "+l:l)}return l};function tD(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(c),t());return n=JI(u),r=n.cache.get,i=n.cache.set,s=l,l(a)}function l(a){const u=r(a);if(u)return u;const c=eD(a,n);return i(a,c),c}return function(){return s(tD.apply(null,arguments))}}const en=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},eT=/^\[(?:([a-z-]+):)?(.+)\]$/i,rD=/^\d+\/\d+$/,iD=new Set(["px","full","screen"]),sD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oD=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,lD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,aD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hs=t=>ha(t)||iD.has(t)||rD.test(t),Hs=t=>Ha(t,"length",yD),ha=t=>!!t&&!Number.isNaN(Number(t)),Ag=t=>Ha(t,"number",ha),mu=t=>!!t&&Number.isInteger(Number(t)),cD=t=>t.endsWith("%")&&ha(t.slice(0,-1)),pt=t=>eT.test(t),js=t=>sD.test(t),fD=new Set(["length","size","percentage"]),dD=t=>Ha(t,fD,tT),hD=t=>Ha(t,"position",tT),pD=new Set(["image","url"]),gD=t=>Ha(t,pD,wD),mD=t=>Ha(t,"",vD),yu=()=>!0,Ha=(t,e,n)=>{const r=eT.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},yD=t=>oD.test(t)&&!lD.test(t),tT=()=>!1,vD=t=>aD.test(t),wD=t=>uD.test(t),bD=()=>{const t=en("colors"),e=en("spacing"),n=en("blur"),r=en("brightness"),i=en("borderColor"),s=en("borderRadius"),o=en("borderSpacing"),l=en("borderWidth"),a=en("contrast"),u=en("grayscale"),c=en("hueRotate"),f=en("invert"),d=en("gap"),h=en("gradientColorStops"),p=en("gradientColorStopPositions"),m=en("inset"),b=en("margin"),v=en("opacity"),g=en("padding"),y=en("saturate"),k=en("scale"),x=en("sepia"),C=en("skew"),T=en("space"),E=en("translate"),M=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto",pt,e],O=()=>[pt,e],N=()=>["",hs,Hs],D=()=>["auto",ha,pt],oe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Q=()=>["solid","dashed","dotted","double","none"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],j=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",pt],U=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>[ha,pt];return{cacheSize:500,separator:":",theme:{colors:[yu],spacing:[hs,Hs],blur:["none","",js,pt],brightness:A(),borderColor:[t],borderRadius:["none","","full",js,pt],borderSpacing:O(),borderWidth:N(),contrast:A(),grayscale:Y(),hueRotate:A(),invert:Y(),gap:O(),gradientColorStops:[t],gradientColorStopPositions:[cD,Hs],inset:_(),margin:_(),opacity:A(),padding:O(),saturate:A(),scale:A(),sepia:Y(),skew:A(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",pt]}],container:["container"],columns:[{columns:[js]}],"break-after":[{"break-after":U()}],"break-before":[{"break-before":U()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...oe(),pt]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",mu,pt]}],basis:[{basis:_()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",pt]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",mu,pt]}],"grid-cols":[{"grid-cols":[yu]}],"col-start-end":[{col:["auto",{span:["full",mu,pt]},pt]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[yu]}],"row-start-end":[{row:["auto",{span:[mu,pt]},pt]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",pt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",pt]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...j()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...j(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...j(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",pt,e]}],"min-w":[{"min-w":[pt,e,"min","max","fit"]}],"max-w":[{"max-w":[pt,e,"none","full","min","max","fit","prose",{screen:[js]},js]}],h:[{h:[pt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[pt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[pt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[pt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",js,Hs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ag]}],"font-family":[{font:[yu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",pt]}],"line-clamp":[{"line-clamp":["none",ha,Ag]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",hs,pt]}],"list-image":[{"list-image":["none",pt]}],"list-style-type":[{list:["none","disc","decimal",pt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",hs,Hs]}],"underline-offset":[{"underline-offset":["auto",hs,pt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...oe(),hD]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",dD]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},gD]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...Q(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:Q()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...Q()]}],"outline-offset":[{"outline-offset":[hs,pt]}],"outline-w":[{outline:[hs,Hs]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[hs,Hs]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",js,mD]}],"shadow-color":[{shadow:[yu]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...te(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",js,pt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",pt]}],duration:[{duration:A()}],ease:[{ease:["linear","in","out","in-out",pt]}],delay:[{delay:A()}],animate:[{animate:["none","spin","ping","pulse","bounce",pt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[mu,pt]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",pt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",pt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[hs,Hs,Ag]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},xD=nD(bD);function Ci(...t){return xD(WI(t))}function Mg(t){return t==="csv2json"?"CSV → JSON":"JSON → CSV"}function kD({flipped:t}){return R.jsx(hI,{size:18,strokeWidth:2,"aria-hidden":"true",className:Ci("transition-transform duration-300",t&&"rotate-180")})}function SD({direction:t,onFlip:e}){return R.jsxs("button",{type:"button","data-testid":"divider-switch",onClick:e,onMouseDown:n=>n.stopPropagation(),onDoubleClick:n=>n.stopPropagation(),title:`Switch direction (currently ${Mg(t)})`,"aria-label":`Switch conversion direction (currently ${Mg(t)})`,className:"flex h-9 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-background px-3 text-xs font-medium text-muted-foreground shadow-sm transition-colors hover:border-muted-foreground/50 hover:text-foreground",children:[R.jsx(kD,{flipped:t==="json2csv"}),R.jsx("span",{"data-testid":"divider-switch-label",children:Mg(t)})]})}const nT=[{question:"How does it work?",answer:"Paste CSV or JSON into the left pane and the conversion runs as you type — no upload, no submit button. Flip the direction with the switch between the panes to convert JSON back to CSV, then copy the result or download it as a file. The converter understands quoted fields, embedded separators, and Unicode."},{question:"What do the options do?",answer:"Separator picks the delimiter — auto-detect covers comma, semicolon, and tab. Parse numbers is on by default with smart semantics — plain numbers like 5 or 19.99 become real JSON numbers, while leading-zero values like 00721 and very long IDs stay strings; uncheck it to keep numeric cells as strings — booleans, null, and containers still convert while Parse JSON is on. Parse JSON converts null, true, false, [] and {} cells into real JSON values instead of strings. Transpose flips rows and columns; Hash output makes the first column the object key; Minify removes indentation from JSON output. On the JSON to CSV side, Flatten explodes nested arrays into extra rows with dotted keys."},{question:"TSV vs CSV — what changes?",answer:"Only the delimiter: TSV separates cells with tabs, CSV with commas. Anything you can paste from Excel or Google Sheets is tab-separated, and auto-detect picks that up — or choose Tab in the separator menu. Quoting rules only apply to comma and semicolon output; TSV rarely needs them."},{question:"Does my data ever leave the browser?",answer:"No. The conversion runs entirely in your browser — nothing is uploaded, nothing is stored, nothing is logged. Files you open are read locally in the page, there is no account and no server processing. The site's analytics never see your data: Plausible counts visits cookieless, and the Google tag is a standard conversion-measurement tag that uses the page URL, referrer, and a first-party conversion cookie to measure ad performance. Your files and converted output never leave the browser. When you send feedback, we store your vote and anything you choose to write — nothing else."}],CD={"@context":"https://schema.org","@type":"FAQPage",mainEntity:nT.map(t=>({"@type":"Question",name:t.question,acceptedAnswer:{"@type":"Answer",text:t.answer}}))};function TD(){const[t,e]=w.useState(!1),n=w.useId();return R.jsxs("section",{"data-testid":"faq","aria-label":"How it works and frequently asked questions",className:"flex-shrink-0 border-t border-border bg-panel px-4",children:[R.jsxs("button",{type:"button","data-testid":"faq-toggle","aria-expanded":t,"aria-controls":n,onClick:()=>e(r=>!r),className:"flex w-full cursor-pointer items-center gap-1.5 py-2 text-[12.5px] text-muted-foreground hover:text-foreground",children:[R.jsx("span",{"aria-hidden":"true",className:"w-3 text-center",children:t?"▾":"▸"}),"How it works & FAQ"]}),R.jsx("div",{id:n,"data-testid":"faq-content",hidden:!t,className:"max-w-3xl pb-4 text-[13px] leading-relaxed text-muted-foreground",children:nT.map(r=>R.jsxs("div",{className:"mb-3 last:mb-0",children:[R.jsx("h2",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[0.1em] text-foreground",children:r.question}),R.jsx("p",{children:r.answer})]},r.question))}),R.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(CD)}})]})}const ED="https://github.com/FlatFilers/csvjson-app/discussions/163";function AD(){return R.jsx("div",{"data-testid":"feedback-banner",className:"flex flex-shrink-0 items-center justify-center border-b border-border bg-muted px-4 py-1.5 text-sm text-muted-foreground",children:R.jsxs("p",{className:"text-center",children:["Enjoy a cleaner, simpler CSVJSON."," ",R.jsx("a",{"data-testid":"feedback-link",href:ED,target:"_blank",rel:"noopener noreferrer",className:"rounded-sm font-medium text-foreground underline decoration-border underline-offset-2 transition-colors hover:decoration-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:"Leave feedback or ask for features here"}),"."]})})}const rT="csvjson:feedback.v1",MD=[{value:"wrong_output",label:"The conversion is wrong"},{value:"hard_to_use",label:"Hard to use"},{value:"missing_feature",label:"Missing a feature"},{value:"slower",label:"Slower than the old site"},{value:"looks_worse",label:"Looks worse"},{value:"other",label:"Other"}];function RD(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.clientId=="string"&&e.clientId.length<=64&&(e.vote===1||e.vote===-1)&&(typeof e.reasonCode=="string"||e.reasonCode===null)&&(typeof e.reasonText=="string"||e.reasonText===null)&&typeof e.pending=="boolean"}function rb(){try{const t=window.localStorage.getItem(rT);if(t===null)return null;const e=JSON.parse(t);return RD(e)?e:null}catch{return null}}function ib(t){try{window.localStorage.setItem(rT,JSON.stringify(t))}catch{}}function sb(){var n,r,i;if(typeof((n=globalThis.crypto)==null?void 0:n.randomUUID)=="function")return globalThis.crypto.randomUUID();const t=(i=(r=globalThis.crypto)==null?void 0:r.getRandomValues)==null?void 0:i.call(r,new Uint8Array(16));if(t===void 0)throw new Error("no secure randomness available");t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function OD(t){const e=window.location.pathname;return t.vote===1?{clientId:t.clientId,vote:1,path:e}:{clientId:t.clientId,vote:-1,reasonCode:t.reasonCode,reasonText:t.reasonText,path:e}}async function PD(t){try{return(await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(OD(t))})).ok?"ok":"failed"}catch{return"failed"}}function ob(t){return["flex h-7 w-7 cursor-pointer items-center justify-center rounded-md transition-colors",t?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" ")}function ID(){const[t,e]=w.useState(rb),[n,r]=w.useState(!1),[i,s]=w.useState(null),[o,l]=w.useState(""),[a,u]=w.useState(!1),[c,f]=w.useState(!1),d=w.useRef(null),h=w.useRef(0),p=w.useCallback((x,C)=>{const T={...x,pending:C==="failed"};ib(T),e(T),C==="ok"?tI({vote:x.vote,with_reason:x.reasonCode!==null}):u(!1)},[]),m=w.useCallback((x,C)=>{const T=++h.current;C&&f(!0),PD(x).then(E=>{h.current===T&&(p(x,E),E==="ok"&&u(!0))}).finally(()=>{C&&h.current===T&&f(!1)})},[p]),b=x=>{const C={...x,pending:!0};ib(C),e(C),m(C,!0)},v=w.useRef(!1);w.useEffect(()=>{if(v.current)return;v.current=!0;const x=rb();x!=null&&x.pending&&m(x,!1)},[m]),w.useEffect(()=>{if(!a)return;const x=setTimeout(()=>u(!1),3e3);return()=>clearTimeout(x)},[a]),w.useEffect(()=>{if(!n)return;const x=T=>{T.key==="Escape"&&r(!1)},C=T=>{const E=d.current;E===null||!(T.target instanceof Node)||E.contains(T.target)||r(!1)};return document.addEventListener("keydown",x),document.addEventListener("mousedown",C),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",C)}},[n]);const g=()=>{if((t==null?void 0:t.vote)===1&&!t.pending){u(!0);return}b({clientId:(t==null?void 0:t.clientId)??sb(),vote:1,reasonCode:null,reasonText:null})},y=()=>{if(n){r(!1);return}s(null),l(""),r(!0)},k=()=>{if(i===null)return;const x=o.trim();b({clientId:(t==null?void 0:t.clientId)??sb(),vote:-1,reasonCode:i,reasonText:x===""?null:x}),r(!1)};return R.jsxs("div",{"data-testid":"feedback-vote",ref:d,className:"relative flex items-center gap-1",children:[R.jsx("button",{type:"button","data-testid":"feedback-up",onClick:g,"aria-pressed":(t==null?void 0:t.vote)===1,"aria-label":"Helpful — send an upvote",title:"Helpful",className:ob((t==null?void 0:t.vote)===1),children:R.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[R.jsx("path",{d:"M7 10v12"}),R.jsx("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]})}),R.jsx("button",{type:"button","data-testid":"feedback-down",onClick:y,"aria-pressed":(t==null?void 0:t.vote)===-1,"aria-haspopup":"dialog","aria-expanded":n,"aria-label":"Not helpful — send a downvote",title:"Not helpful",className:ob((t==null?void 0:t.vote)===-1),children:R.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[R.jsx("path",{d:"M17 14V2"}),R.jsx("path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"})]})}),a&&R.jsx("span",{"data-testid":"feedback-thanks",className:"text-xs text-muted-foreground",children:"Thanks for the feedback!"}),(t==null?void 0:t.pending)&&!c&&R.jsx("span",{"data-testid":"feedback-pending",role:"status",className:"max-w-44 text-right text-xs text-muted-foreground sm:max-w-none",children:"Feedback couldn't send — your vote is kept on this device and will send automatically once the service is back."}),n&&R.jsxs("div",{"data-testid":"feedback-popover",role:"dialog","aria-label":"What went wrong?",className:"absolute right-0 top-9 z-50 w-72 rounded-md border border-border bg-panel p-3 shadow-md",children:[R.jsx("p",{className:"mb-2 text-xs font-medium text-foreground",children:"What went wrong?"}),R.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:MD.map(x=>R.jsx("button",{type:"button","data-testid":`feedback-reason-${x.value}`,"aria-pressed":i===x.value,onClick:()=>s(x.value),className:["cursor-pointer rounded-sm border px-2 py-0.5 text-xs transition-colors",i===x.value?"border-foreground bg-foreground text-panel":"border-border text-muted-foreground hover:border-foreground hover:text-foreground"].join(" "),children:x.label},x.value))}),R.jsx("textarea",{"data-testid":"feedback-text",value:o,maxLength:500,rows:2,onChange:x=>l(x.target.value),placeholder:"Anything more? (optional)",className:"mb-2 w-full resize-none rounded-sm border border-border bg-panel px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/60 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"}),R.jsxs("div",{className:"flex items-center justify-end gap-2",children:[R.jsxs("span",{className:"text-[10px] text-muted-foreground/70",children:[o.length,"/500"]}),R.jsx("button",{type:"button","data-testid":"feedback-submit",onClick:k,disabled:i===null,className:"cursor-pointer rounded-sm border border-border px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:"Send"})]})]})]})}function iT(t="This should not happen"){throw new Error(t)}function _r(t,e="Assertion failed"){if(!t)return iT(e)}function Sc(t,e){return iT(e??"Hell froze over")}function DD(t,e){try{return t()}catch{return e}}const lb=Object.prototype.hasOwnProperty;function Ea(t,e){let n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Ea(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(lb.call(t,n)&&++r&&!lb.call(e,n)||!(n in e)||!Ea(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var _D=Object.prototype,ND=_D.hasOwnProperty;function LD(t,e){return t!=null&&ND.call(t,e)}var FD=LD,BD=Array.isArray,os=BD,zD=typeof no=="object"&&no&&no.Object===Object&&no,sT=zD,$D=sT,HD=typeof self=="object"&&self&&self.Object===Object&&self,jD=$D||HD||Function("return this")(),ls=jD,WD=ls,VD=WD.Symbol,zc=VD,ab=zc,oT=Object.prototype,UD=oT.hasOwnProperty,KD=oT.toString,vu=ab?ab.toStringTag:void 0;function XD(t){var e=UD.call(t,vu),n=t[vu];try{t[vu]=void 0;var r=!0}catch{}var i=KD.call(t);return r&&(e?t[vu]=n:delete t[vu]),i}var GD=XD,YD=Object.prototype,qD=YD.toString;function QD(t){return qD.call(t)}var JD=QD,ub=zc,ZD=GD,e_=JD,t_="[object Null]",n_="[object Undefined]",cb=ub?ub.toStringTag:void 0;function r_(t){return t==null?t===void 0?n_:t_:cb&&cb in Object(t)?ZD(t):e_(t)}var $c=r_;function i_(t){return t!=null&&typeof t=="object"}var Hc=i_,s_=$c,o_=Hc,l_="[object Symbol]";function a_(t){return typeof t=="symbol"||o_(t)&&s_(t)==l_}var op=a_,u_=os,c_=op,f_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,d_=/^\w*$/;function h_(t,e){if(u_(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||c_(t)?!0:d_.test(t)||!f_.test(t)||e!=null&&t in Object(e)}var Mv=h_;function p_(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var pl=p_,g_=$c,m_=pl,y_="[object AsyncFunction]",v_="[object Function]",w_="[object GeneratorFunction]",b_="[object Proxy]";function x_(t){if(!m_(t))return!1;var e=g_(t);return e==v_||e==w_||e==y_||e==b_}var lT=x_,k_=ls,S_=k_["__core-js_shared__"],C_=S_,Rg=C_,fb=function(){var t=/[^.]+$/.exec(Rg&&Rg.keys&&Rg.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function T_(t){return!!fb&&fb in t}var E_=T_,A_=Function.prototype,M_=A_.toString;function R_(t){if(t!=null){try{return M_.call(t)}catch{}try{return t+""}catch{}}return""}var aT=R_,O_=lT,P_=E_,I_=pl,D_=aT,__=/[\\^$.*+?()[\]{}|]/g,N_=/^\[object .+?Constructor\]$/,L_=Function.prototype,F_=Object.prototype,B_=L_.toString,z_=F_.hasOwnProperty,$_=RegExp("^"+B_.call(z_).replace(__,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function H_(t){if(!I_(t)||P_(t))return!1;var e=O_(t)?$_:N_;return e.test(D_(t))}var j_=H_;function W_(t,e){return t==null?void 0:t[e]}var V_=W_,U_=j_,K_=V_;function X_(t,e){var n=K_(t,e);return U_(n)?n:void 0}var gl=X_,G_=gl,Y_=G_(Object,"create"),lp=Y_,db=lp;function q_(){this.__data__=db?db(null):{},this.size=0}var Q_=q_;function J_(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Z_=J_,eN=lp,tN="__lodash_hash_undefined__",nN=Object.prototype,rN=nN.hasOwnProperty;function iN(t){var e=this.__data__;if(eN){var n=e[t];return n===tN?void 0:n}return rN.call(e,t)?e[t]:void 0}var sN=iN,oN=lp,lN=Object.prototype,aN=lN.hasOwnProperty;function uN(t){var e=this.__data__;return oN?e[t]!==void 0:aN.call(e,t)}var cN=uN,fN=lp,dN="__lodash_hash_undefined__";function hN(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=fN&&e===void 0?dN:e,this}var pN=hN,gN=Q_,mN=Z_,yN=sN,vN=cN,wN=pN;function ja(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var LN=NN,FN=ap;function BN(t,e){var n=this.__data__,r=FN(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var zN=BN,$N=kN,HN=ON,jN=DN,WN=LN,VN=zN;function Wa(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=n3}var Nv=r3,i3=op;function s3(t){if(typeof t=="string"||i3(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var fp=s3,o3=fT,l3=Dv,a3=os,u3=_v,c3=Nv,f3=fp;function d3(t,e,n){e=o3(e,t);for(var r=-1,i=e.length,s=!1;++r[r[0]+e,r[1]+e]);return new gs(n)}add(e){const n=typeof e=="number"?[e,e+1]:e,r=w3([...this.items,n]);return new gs(r)}remove(e){const n=[...this.items],r=typeof e=="number"?e:e[0],i=typeof e=="number"?e+1:e[1];for(const[s,o]of n.entries()){const[l,a]=o;if(l<=i&&r<=a){const u=[];l=r&&ebb??(bb=new gs([]))),bt(gs,"fromSingleSelection",e=>gs.empty().add(e));let Ot=gs;function b3(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var x3=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Og=b3(function(t){return x3.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),k3=function(){const e=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];e.forEach(s=>{(s?s.split(" "):[]).forEach(l=>{if(l.startsWith("atm_")){const[,a]=l.split("_");n[a]=l}else r.push(l)})});const i=[];for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(n[s]);return i.push(...r),i.join(" ")},xb=k3,S3=t=>t.toUpperCase()===t,C3=t=>e=>t.indexOf(e)===-1,pT=(t,e)=>{const n={};return Object.keys(t).filter(C3(e)).forEach(r=>{n[r]=t[r]}),n};function T3(t,e,n){const r=pT(e,n);if(!t){const i=typeof Og=="function"?{default:Og}:Og;Object.keys(r).forEach(s=>{i.default(s)||delete r[s]})}return r}var E3=(t,e)=>{};function A3(t){let e="";return n=>{const r=(s,o)=>{const{as:l=t,class:a=e}=s,u=n.propsAsIs===void 0?!(typeof l=="string"&&l.indexOf("-")===-1&&!S3(l[0])):n.propsAsIs,c=T3(u,s,["as","class"]);c.ref=o,c.className=n.atomic?xb(n.class,c.className||a):xb(c.className||a,n.class);const{vars:f}=n;if(f){const d={};for(const m in f){const b=f[m],v=b[0],g=b[1]||"",y=typeof v=="function"?v(s):v;E3(y,n.name),d[`--${m}`]=`${y}${g}`}const h=c.style||{},p=Object.keys(h);p.length>0&&p.forEach(m=>{d[m]=h[m]}),c.style=d}return t.__linaria&&t!==l?(c.as=l,Pn.createElement(t,c)):Pn.createElement(l,c)},i=Pn.forwardRef?Pn.forwardRef(r):s=>{const o=pT(s,["innerRef"]);return r(o,s.innerRef)};return i.displayName=n.name,i.__linaria={className:n.class||e,extends:t},i}}var jr=A3;const M3=jr("div")({name:"ImageOverlayEditorStyle",class:"gdg-i2iowwq",propsAsIs:!1});var gT={},dp={},Fv={},Pg={},Ig={exports:{}},Dg,kb;function R3(){if(kb)return Dg;kb=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Dg=t,Dg}var _g,Sb;function O3(){if(Sb)return _g;Sb=1;var t=R3();function e(){}function n(){}return n.resetWarningCache=e,_g=function(){function r(o,l,a,u,c,f){if(f!==t){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:e};return s.PropTypes=s,s},_g}var Cb;function P3(){return Cb||(Cb=1,Ig.exports=O3()()),Ig.exports}var Tb;function I3(){return Tb||(Tb=1,function(t){(function(e,n){n(t,w,P3())})(no,function(e,n,r){Object.defineProperty(e,"__esModule",{value:!0}),e.setHasSupportToCaptureOption=p;var i=o(n),s=o(r);function o(g){return g&&g.__esModule?g:{default:g}}var l=Object.assign||function(g){for(var y=1;y=0||Object.prototype.hasOwnProperty.call(g,x)&&(k[x]=g[x]);return k}function u(g,y){if(!(g instanceof y))throw new TypeError("Cannot call a class as a function")}var c=function(){function g(y,k){for(var x=0;x0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return h?g:g.capture}function b(g){if("touches"in g){var y=g.touches[0],k=y.pageX,x=y.pageY;return{x:k,y:x}}var C=g.screenX,T=g.screenY;return{x:C,y:T}}var v=function(g){d(y,g);function y(){var k;u(this,y);for(var x=arguments.length,C=Array(x),T=0;TC&&this.props.onSwipeRight(1,x),this.movePosition.deltaY<-C?this.props.onSwipeUp(1,x):this.movePosition.deltaY>C&&this.props.onSwipeDown(1,x)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(x){this.swiper=x,this.props.innerRef(x)}},{key:"render",value:function(){var x=this.props;x.tagName;var C=x.className,T=x.style,E=x.children;x.allowMouseEvents,x.onSwipeUp,x.onSwipeDown,x.onSwipeLeft,x.onSwipeRight,x.onSwipeStart,x.onSwipeMove,x.onSwipeEnd,x.innerRef,x.tolerance;var M=a(x,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return i.default.createElement(this.props.tagName,l({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:C,style:T},M),E)}}]),y}(n.Component);v.displayName="ReactSwipe",v.propTypes={tagName:s.default.string,className:s.default.string,style:s.default.object,children:s.default.node,allowMouseEvents:s.default.bool,onSwipeUp:s.default.func,onSwipeDown:s.default.func,onSwipeLeft:s.default.func,onSwipeRight:s.default.func,onSwipeStart:s.default.func,onSwipeMove:s.default.func,onSwipeEnd:s.default.func,innerRef:s.default.func,tolerance:s.default.number.isRequired},v.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},e.default=v})}(Pg)),Pg}(function(t){(function(e,n){n(t,I3())})(no,function(e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=i(n);function i(s){return s&&s.__esModule?s:{default:s}}e.default=r.default})})(Fv);var jc={},mT={exports:{}};/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var s="",o=0;o"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function ch(t){return ch=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},ch(t)}function Qn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var q3=function(e){return e.hasOwnProperty("key")},Bv=function(t){K3(n,t);var e=X3(n);function n(r){var i;return W3(this,n),i=e.call(this,r),Qn(or(i),"itemsWrapperRef",void 0),Qn(or(i),"itemsListRef",void 0),Qn(or(i),"thumbsRef",void 0),Qn(or(i),"setItemsWrapperRef",function(s){i.itemsWrapperRef=s}),Qn(or(i),"setItemsListRef",function(s){i.itemsListRef=s}),Qn(or(i),"setThumbsRef",function(s,o){i.thumbsRef||(i.thumbsRef=[]),i.thumbsRef[o]=s}),Qn(or(i),"updateSizes",function(){if(!(!i.props.children||!i.itemsWrapperRef||!i.thumbsRef)){var s=mi.Children.count(i.props.children),o=i.itemsWrapperRef.clientWidth,l=i.props.thumbWidth?i.props.thumbWidth:(0,$3.outerWidth)(i.thumbsRef[0]),a=Math.floor(o/l),u=a0&&(o=0),u===f&&o<0&&(o=0);var d=i.itemsWrapperRef.clientWidth,h=u+100/(d/o);return i.itemsListRef&&["WebkitTransform","MozTransform","MsTransform","OTransform","transform","msTransform"].forEach(function(p){i.itemsListRef.style[p]=(0,Eb.default)(h,"%",i.props.axis)}),!0}),Qn(or(i),"slideRight",function(s){i.moveTo(i.state.firstItem-(typeof s=="number"?s:1))}),Qn(or(i),"slideLeft",function(s){i.moveTo(i.state.firstItem+(typeof s=="number"?s:1))}),Qn(or(i),"moveTo",function(s){s=s<0?0:s,s=s>=i.state.lastPosition?i.state.lastPosition:s,i.setState({firstItem:s})}),i.state={selectedItem:r.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},i}return U3(n,[{key:"componentDidMount",value:function(){this.setupThumbs()}},{key:"componentDidUpdate",value:function(i){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==i.children&&this.updateSizes()}},{key:"componentWillUnmount",value:function(){this.destroyThumbs()}},{key:"setupThumbs",value:function(){(0,jf.default)().addEventListener("resize",this.updateSizes),(0,jf.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.updateSizes()}},{key:"destroyThumbs",value:function(){(0,jf.default)().removeEventListener("resize",this.updateSizes),(0,jf.default)().removeEventListener("DOMContentLoaded",this.updateSizes)}},{key:"getFirstItem",value:function(i){var s=i;return i>=this.state.lastPosition&&(s=this.state.lastPosition),i1,o=this.state.showArrows&&this.state.firstItem>0,l=this.state.showArrows&&this.state.firstItemo);if(l)return s<0?e.centerMode&&e.centerSlidePercentage&&e.axis==="horizontal"?r.itemListStyle=(0,Qi.setPosition)(-(o+2)*e.centerSlidePercentage-(100-e.centerSlidePercentage)/2,e.axis):r.itemListStyle=(0,Qi.setPosition)(-(o+2)*100,e.axis):s>o&&(r.itemListStyle=(0,Qi.setPosition)(0,e.axis)),r;var a=(0,Qi.getPosition)(i,e),u=(0,oF.default)(a,"%",e.axis),c=e.transitionTime+"ms";return r.itemListStyle={WebkitTransform:u,msTransform:u,OTransform:u,transform:u},n.swiping||(r.itemListStyle=Vo(Vo({},r.itemListStyle),{},{WebkitTransitionDuration:c,MozTransitionDuration:c,OTransitionDuration:c,transitionDuration:c,msTransitionDuration:c})),r};qi.slideAnimationHandler=uF;var cF=function(e,n,r,i){var s={},o=n.axis==="horizontal",l=vT.Children.count(n.children),a=0,u=(0,Qi.getPosition)(r.selectedItem,n),c=n.infiniteLoop?(0,Qi.getPosition)(l-1,n)-100:(0,Qi.getPosition)(l-1,n),f=o?e.x:e.y,d=f;u===a&&f>0&&(d=0),u===c&&f<0&&(d=0);var h=u+100/(r.itemSize/d),p=Math.abs(f)>n.swipeScrollTolerance;return n.infiniteLoop&&p&&(r.selectedItem===0&&h>-100?h-=l*100:r.selectedItem===l-1&&h<-l*100&&(h+=l*100)),(!n.preventMovementUntilSwipeScrollTolerance||p||r.swipeMovementStarted)&&(r.swipeMovementStarted||i({swipeMovementStarted:!0}),s.itemListStyle=(0,Qi.setPosition)(h,n.axis)),p&&!r.cancelClick&&i({cancelClick:!0}),s};qi.slideSwipeAnimationHandler=cF;var fF=function(e,n){var r=(0,Qi.getPosition)(n.selectedItem,e),i=(0,Qi.setPosition)(r,e.axis);return{itemListStyle:i}};qi.slideStopSwipingHandler=fF;var dF=function(e,n){var r=e.transitionTime+"ms",i="ease-in-out",s={position:"absolute",display:"block",zIndex:-2,minHeight:"100%",opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:i,msTransitionTimingFunction:i,MozTransitionTimingFunction:i,WebkitTransitionTimingFunction:i,OTransitionTimingFunction:i};return n.swiping||(s=Vo(Vo({},s),{},{WebkitTransitionDuration:r,MozTransitionDuration:r,OTransitionDuration:r,transitionDuration:r,msTransitionDuration:r})),{slideStyle:s,selectedStyle:Vo(Vo({},s),{},{opacity:1,position:"relative"}),prevStyle:Vo({},s)}};qi.fadeAnimationHandler=dF;Object.defineProperty(dp,"__esModule",{value:!0});dp.default=void 0;var Bt=gF(w),hF=Uc(Fv),ys=Uc(jc),pF=Uc(Wc),Wf=Uc(gp),Vf=Uc(Vc),Nu=Lr,fh=qi;function Uc(t){return t&&t.__esModule?t:{default:t}}function wT(){if(typeof WeakMap!="function")return null;var t=new WeakMap;return wT=function(){return t},t}function gF(t){if(t&&t.__esModule)return t;if(t===null||Gu(t)!=="object"&&typeof t!="function")return{default:t};var e=wT();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=r?Object.getOwnPropertyDescriptor(t,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=t[i]}return n.default=t,e&&e.set(t,n),n}function Gu(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Gu=function(n){return typeof n}:Gu=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Gu(t)}function x0(){return x0=Object.assign||function(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function dh(t){return dh=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},dh(t)}function xt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var zv=function(t){wF(n,t);var e=bF(n);function n(r){var i;mF(this,n),i=e.call(this,r),xt(St(i),"thumbsRef",void 0),xt(St(i),"carouselWrapperRef",void 0),xt(St(i),"listRef",void 0),xt(St(i),"itemsRef",void 0),xt(St(i),"timer",void 0),xt(St(i),"animationHandler",void 0),xt(St(i),"setThumbsRef",function(o){i.thumbsRef=o}),xt(St(i),"setCarouselWrapperRef",function(o){i.carouselWrapperRef=o}),xt(St(i),"setListRef",function(o){i.listRef=o}),xt(St(i),"setItemsRef",function(o,l){i.itemsRef||(i.itemsRef=[]),i.itemsRef[l]=o}),xt(St(i),"autoPlay",function(){Bt.Children.count(i.props.children)<=1||(i.clearAutoPlay(),i.props.autoPlay&&(i.timer=setTimeout(function(){i.increment()},i.props.interval)))}),xt(St(i),"clearAutoPlay",function(){i.timer&&clearTimeout(i.timer)}),xt(St(i),"resetAutoPlay",function(){i.clearAutoPlay(),i.autoPlay()}),xt(St(i),"stopOnHover",function(){i.setState({isMouseEntered:!0},i.clearAutoPlay)}),xt(St(i),"startOnLeave",function(){i.setState({isMouseEntered:!1},i.autoPlay)}),xt(St(i),"isFocusWithinTheCarousel",function(){return i.carouselWrapperRef?!!((0,Wf.default)().activeElement===i.carouselWrapperRef||i.carouselWrapperRef.contains((0,Wf.default)().activeElement)):!1}),xt(St(i),"navigateWithKeyboard",function(o){if(i.isFocusWithinTheCarousel()){var l=i.props.axis,a=l==="horizontal",u={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},c=a?u.ArrowRight:u.ArrowDown,f=a?u.ArrowLeft:u.ArrowUp;c===o.keyCode?i.increment():f===o.keyCode&&i.decrement()}}),xt(St(i),"updateSizes",function(){if(!(!i.state.initialized||!i.itemsRef||i.itemsRef.length===0)){var o=i.props.axis==="horizontal",l=i.itemsRef[0];if(l){var a=o?l.clientWidth:l.clientHeight;i.setState({itemSize:a}),i.thumbsRef&&i.thumbsRef.updateSizes()}}}),xt(St(i),"setMountState",function(){i.setState({hasMount:!0}),i.updateSizes()}),xt(St(i),"handleClickItem",function(o,l){if(Bt.Children.count(i.props.children)!==0){if(i.state.cancelClick){i.setState({cancelClick:!1});return}i.props.onClickItem(o,l),o!==i.state.selectedItem&&i.setState({selectedItem:o})}}),xt(St(i),"handleOnChange",function(o,l){Bt.Children.count(i.props.children)<=1||i.props.onChange(o,l)}),xt(St(i),"handleClickThumb",function(o,l){i.props.onClickThumb(o,l),i.moveTo(o)}),xt(St(i),"onSwipeStart",function(o){i.setState({swiping:!0}),i.props.onSwipeStart(o)}),xt(St(i),"onSwipeEnd",function(o){i.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),i.props.onSwipeEnd(o),i.clearAutoPlay(),i.state.autoPlay&&i.autoPlay()}),xt(St(i),"onSwipeMove",function(o,l){i.props.onSwipeMove(l);var a=i.props.swipeAnimationHandler(o,i.props,i.state,i.setState.bind(St(i)));return i.setState(yi({},a)),!!Object.keys(a).length}),xt(St(i),"decrement",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;i.moveTo(i.state.selectedItem-(typeof o=="number"?o:1))}),xt(St(i),"increment",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;i.moveTo(i.state.selectedItem+(typeof o=="number"?o:1))}),xt(St(i),"moveTo",function(o){if(typeof o=="number"){var l=Bt.Children.count(i.props.children)-1;o<0&&(o=i.props.infiniteLoop?l:0),o>l&&(o=i.props.infiniteLoop?0:l),i.selectItem({selectedItem:o}),i.state.autoPlay&&i.state.isMouseEntered===!1&&i.resetAutoPlay()}}),xt(St(i),"onClickNext",function(){i.increment(1)}),xt(St(i),"onClickPrev",function(){i.decrement(1)}),xt(St(i),"onSwipeForward",function(){i.increment(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),xt(St(i),"onSwipeBackwards",function(){i.decrement(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),xt(St(i),"changeItem",function(o){return function(l){(!(0,Nu.isKeyboardEvent)(l)||l.key==="Enter")&&i.moveTo(o)}}),xt(St(i),"selectItem",function(o){i.setState(yi({previousItem:i.state.selectedItem},o),function(){i.setState(i.animationHandler(i.props,i.state))}),i.handleOnChange(o.selectedItem,Bt.Children.toArray(i.props.children)[o.selectedItem])}),xt(St(i),"getInitialImage",function(){var o=i.props.selectedItem,l=i.itemsRef&&i.itemsRef[o],a=l&&l.getElementsByTagName("img")||[];return a[0]}),xt(St(i),"getVariableItemHeight",function(o){var l=i.itemsRef&&i.itemsRef[o];if(i.state.hasMount&&l&&l.children.length){var a=l.children[0].getElementsByTagName("img")||[];if(a.length>0){var u=a[0];if(!u.complete){var c=function h(){i.forceUpdate(),u.removeEventListener("load",h)};u.addEventListener("load",c)}}var f=a[0]||l.children[0],d=f.clientHeight;return d>0?d:null}return null});var s={initialized:!1,previousItem:r.selectedItem,selectedItem:r.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:r.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return i.animationHandler=typeof r.animationHandler=="function"&&r.animationHandler||r.animationHandler==="fade"&&fh.fadeAnimationHandler||fh.slideAnimationHandler,i.state=yi(yi({},s),i.animationHandler(r,s)),i}return vF(n,[{key:"componentDidMount",value:function(){this.props.children&&this.setupCarousel()}},{key:"componentDidUpdate",value:function(i,s){!i.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!i.autoFocus&&this.props.autoFocus&&this.forceFocus(),s.swiping&&!this.state.swiping&&this.setState(yi({},this.props.stopSwipingHandler(this.props,this.state))),(i.selectedItem!==this.props.selectedItem||i.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),i.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:"componentWillUnmount",value:function(){this.destroyCarousel()}},{key:"setupCarousel",value:function(){var i=this;this.bindEvents(),this.state.autoPlay&&Bt.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var s=i.getInitialImage();s&&!s.complete?s.addEventListener("load",i.setMountState):i.setMountState()})}},{key:"destroyCarousel",value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:"setupAutoPlay",value:function(){this.autoPlay();var i=this.carouselWrapperRef;this.props.stopOnHover&&i&&(i.addEventListener("mouseenter",this.stopOnHover),i.addEventListener("mouseleave",this.startOnLeave))}},{key:"destroyAutoPlay",value:function(){this.clearAutoPlay();var i=this.carouselWrapperRef;this.props.stopOnHover&&i&&(i.removeEventListener("mouseenter",this.stopOnHover),i.removeEventListener("mouseleave",this.startOnLeave))}},{key:"bindEvents",value:function(){(0,Vf.default)().addEventListener("resize",this.updateSizes),(0,Vf.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.props.useKeyboardArrows&&(0,Wf.default)().addEventListener("keydown",this.navigateWithKeyboard)}},{key:"unbindEvents",value:function(){(0,Vf.default)().removeEventListener("resize",this.updateSizes),(0,Vf.default)().removeEventListener("DOMContentLoaded",this.updateSizes);var i=this.getInitialImage();i&&i.removeEventListener("load",this.setMountState),this.props.useKeyboardArrows&&(0,Wf.default)().removeEventListener("keydown",this.navigateWithKeyboard)}},{key:"forceFocus",value:function(){var i;(i=this.carouselWrapperRef)===null||i===void 0||i.focus()}},{key:"renderItems",value:function(i){var s=this;return this.props.children?Bt.Children.map(this.props.children,function(o,l){var a=l===s.state.selectedItem,u=l===s.state.previousItem,c=a&&s.state.selectedStyle||u&&s.state.prevStyle||s.state.slideStyle||{};s.props.centerMode&&s.props.axis==="horizontal"&&(c=yi(yi({},c),{},{minWidth:s.props.centerSlidePercentage+"%"})),s.state.swiping&&s.state.swipeMovementStarted&&(c=yi(yi({},c),{},{pointerEvents:"none"}));var f={ref:function(h){return s.setItemsRef(h,l)},key:"itemKey"+l+(i?"clone":""),className:ys.default.ITEM(!0,l===s.state.selectedItem,l===s.state.previousItem),onClick:s.handleClickItem.bind(s,l,o),style:c};return Bt.default.createElement("li",f,s.props.renderItem(o,{isSelected:l===s.state.selectedItem,isPrevious:l===s.state.previousItem}))}):[]}},{key:"renderControls",value:function(){var i=this,s=this.props,o=s.showIndicators,l=s.labels,a=s.renderIndicator,u=s.children;return o?Bt.default.createElement("ul",{className:"control-dots"},Bt.Children.map(u,function(c,f){return a&&a(i.changeItem(f),f===i.state.selectedItem,f,l.item)})):null}},{key:"renderStatus",value:function(){return this.props.showStatus?Bt.default.createElement("p",{className:"carousel-status"},this.props.statusFormatter(this.state.selectedItem+1,Bt.Children.count(this.props.children))):null}},{key:"renderThumbs",value:function(){return!this.props.showThumbs||!this.props.children||Bt.Children.count(this.props.children)===0?null:Bt.default.createElement(pF.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:"render",value:function(){var i=this;if(!this.props.children||Bt.Children.count(this.props.children)===0)return null;var s=this.props.swipeable&&Bt.Children.count(this.props.children)>1,o=this.props.axis==="horizontal",l=this.props.showArrows&&Bt.Children.count(this.props.children)>1,a=l&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,u=l&&(this.state.selectedItem=e||T<0||f&&E>=s}function v(){var C=Ng();if(b(C))return g(C);l=setTimeout(v,m(C))}function g(C){return l=void 0,d&&r?h(C):(r=i=void 0,o)}function y(){l!==void 0&&clearTimeout(l),u=0,r=a=i=l=void 0}function k(){return l===void 0?o:g(Ng())}function x(){var C=Ng(),T=b(C);if(r=arguments,i=this,a=C,T){if(l===void 0)return p(a);if(f)return clearTimeout(l),l=setTimeout(v,e),h(a)}return l===void 0&&(l=setTimeout(v,e)),o}return x.cancel=y,x.flush=k,x}var bT=UF;const xT=Ii(bT);function $n(t,e,n,r,i=!1){const s=w.useRef();s.current=e,w.useEffect(()=>{if(n===null||n.addEventListener===void 0)return;const o=n,l=a=>{var u;(u=s.current)==null||u.call(o,a)};return o.addEventListener(t,l,{passive:r,capture:i}),()=>{o.removeEventListener(t,l,{capture:i})}},[t,n,r,i])}function Ll(t,e){return t===void 0?void 0:e}const KF=Math.PI;function Ib(t){return t*KF/180}const kT=(t,e,n)=>({x1:t-n/2,y1:e-n/2,x2:t+n/2,y2:e+n/2}),ST=(t,e,n,r,i)=>{switch(t){case"left":return Math.floor(e)+r+i/2;case"center":return Math.floor(e+n/2);case"right":return Math.floor(e+n)-r-i/2}},CT=(t,e,n)=>Math.min(t,e-n*2),TT=(t,e,n)=>n.x1<=t&&t<=n.x2&&n.y1<=e&&e<=n.y2,Hv=t=>{const e=t.fgColor??"currentColor";return w.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},w.createElement("path",{d:"M12.7073 7.05029C7.87391 11.8837 10.4544 9.30322 6.03024 13.7273C5.77392 13.9836 5.58981 14.3071 5.50189 14.6587L4.52521 18.5655C4.38789 19.1148 4.88543 19.6123 5.43472 19.475L9.34146 18.4983C9.69313 18.4104 10.0143 18.2286 10.2706 17.9722L16.9499 11.2929",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",vectorEffect:"non-scaling-stroke"}),w.createElement("path",{d:"M20.4854 4.92901L19.0712 3.5148C18.2901 2.73375 17.0238 2.73375 16.2428 3.5148L14.475 5.28257C15.5326 7.71912 16.4736 8.6278 18.7176 9.52521L20.4854 7.75744C21.2665 6.97639 21.2665 5.71006 20.4854 4.92901Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",vectorEffect:"non-scaling-stroke"}))},XF=t=>{const e=t.fgColor??"currentColor";return w.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},w.createElement("path",{d:"M19 6L10.3802 17L5.34071 11.8758",vectorEffect:"non-scaling-stroke",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))};function GF(t,e,n){const[r,i]=w.useState(t),s=w.useRef(!0);w.useEffect(()=>()=>{s.current=!1},[]);const o=w.useRef(xT(l=>{s.current&&i(l)},n));return w.useLayoutEffect(()=>{s.current&&o.current(()=>t())},e),r}const YF="֑-߿יִ-﷽ﹰ-ﻼ",qF="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",QF=new RegExp("^[^"+qF+"]*["+YF+"]");function jv(t){return QF.test(t)?"rtl":"not-rtl"}let Uf;function S0(){if(typeof document>"u")return 0;if(Uf!==void 0)return Uf;const t=document.createElement("p");t.style.width="100%",t.style.height="200px";const e=document.createElement("div");e.id="testScrollbar",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.append(t),document.body.append(e);const n=t.offsetWidth;e.style.overflow="scroll";let r=t.offsetWidth;return n===r&&(r=e.clientWidth),e.remove(),Uf=n-r,Uf}const Bo=Symbol();function JF(t){const e=w.useRef([Bo,t]);e.current[1]!==t&&(e.current[0]=t),e.current[1]=t;const[n,r]=w.useState(t),[,i]=w.useState(),s=w.useCallback(l=>{const a=e.current[0];a!==Bo&&(l=typeof l=="function"?l(a):l,l===a)||(a!==Bo&&i({}),r(u=>typeof l=="function"?l(a===Bo?u:a):l),e.current[0]=Bo)},[]),o=w.useCallback(()=>{e.current[0]=Bo,i({})},[]);return[e.current[0]===Bo?n:e.current[0],s,o]}function ET(t){if(t.length===0)return"";let e=0,n=0;for(const r of t){if(n+=r.length,n>1e4)break;e++}return t.slice(0,e).join(", ")}function ZF(t){const e=w.useRef(t);return Ea(t,e.current)||(e.current=t),e.current}const e4=t=>{const{urls:e,canWrite:n,onEditClick:r,renderImage:i}=t,s=e.filter(l=>l!=="");if(s.length===0)return null;const o=s.length>1;return w.createElement(M3,{"data-testid":"GDG-default-image-overlay-editor"},w.createElement(gT.Carousel,{showArrows:o,showThumbs:!1,swipeable:o,emulateTouch:o,infiniteLoop:o},s.map(l=>{const a=(i==null?void 0:i(l))??w.createElement("img",{draggable:!1,src:l});return w.createElement("div",{className:"gdg-centering-container",key:l},a)})),n&&r&&w.createElement("button",{className:"gdg-edit-icon",onClick:r},w.createElement(Hv,null)))};function AT(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let ml=AT();function t4(t){ml=t}const MT=/[&<>"']/,n4=new RegExp(MT.source,"g"),RT=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,r4=new RegExp(RT.source,"g"),i4={"&":"&","<":"<",">":">",'"':""","'":"'"},Db=t=>i4[t];function Jn(t,e){if(e){if(MT.test(t))return t.replace(n4,Db)}else if(RT.test(t))return t.replace(r4,Db);return t}const s4=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function OT(t){return t.replace(s4,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const o4=/(^|[^\[])\^/g;function Gt(t,e){t=typeof t=="string"?t:t.source,e=e||"";const n={replace:(r,i)=>(i=i.source||i,i=i.replace(o4,"$1"),t=t.replace(r,i),n),getRegex:()=>new RegExp(t,e)};return n}const l4=/[^\w:]/g,a4=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _b(t,e,n){if(t){let r;try{r=decodeURIComponent(OT(n)).replace(l4,"").toLowerCase()}catch{return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}e&&!a4.test(n)&&(n=d4(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch{return null}return n}const Kf={},u4=/^[^:]+:\/*[^/]*$/,c4=/^([^:]+:)[\s\S]*$/,f4=/^([^:]+:\/*[^/]*)[\s\S]*$/;function d4(t,e){Kf[" "+t]||(u4.test(t)?Kf[" "+t]=t+"/":Kf[" "+t]=Od(t,"/",!0)),t=Kf[" "+t];const n=t.indexOf(":")===-1;return e.substring(0,2)==="//"?n?e:t.replace(c4,"$1")+e:e.charAt(0)==="/"?n?e:t.replace(f4,"$1")+e:t+e}const hh={exec:function(){}};function Nb(t,e){const n=t.replace(/\|/g,(s,o,l)=>{let a=!1,u=o;for(;--u>=0&&l[u]==="\\";)a=!a;return a?"|":" |"}),r=n.split(/ \|/);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),r.length>e)r.splice(e);else for(;r.length1;)e&1&&(n+=t),e>>=1,t+=t;return n+t}function Fb(t,e,n,r){const i=e.href,s=e.title?Jn(e.title):null,o=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){r.state.inLink=!0;const l={type:"link",raw:n,href:i,title:s,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,l}return{type:"image",raw:n,href:i,title:s,text:Jn(o)}}function g4(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null)return e;const r=n[1];return e.split(` -`).map(i=>{const s=i.match(/^\s+/);if(s===null)return i;const[o]=s;return o.length>=r.length?i.slice(r.length):i}).join(` -`)}class Wv{constructor(e){this.options=e||ml}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Od(r,` -`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],i=g4(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline._escapes,"$1"):n[2],text:i}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(/#$/.test(r)){const i=Od(r,"#");(this.options.pedantic||!i||/ $/.test(i))&&(r=i.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:n[0]}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){const r=n[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(r);return this.lexer.state.top=i,{type:"blockquote",raw:n[0],tokens:s,text:r}}}list(e){let n=this.rules.block.list.exec(e);if(n){let r,i,s,o,l,a,u,c,f,d,h,p,m=n[1].trim();const b=m.length>1,v={type:"list",raw:"",ordered:b,start:b?+m.slice(0,-1):"",loose:!1,items:[]};m=b?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=b?m:"[*+-]");const g=new RegExp(`^( {0,3}${m})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;e&&(p=!1,!(!(n=g.exec(e))||this.rules.block.hr.test(e)));){if(r=n[0],e=e.substring(r.length),c=n[2].split(` -`,1)[0].replace(/^\t+/,k=>" ".repeat(3*k.length)),f=e.split(` -`,1)[0],this.options.pedantic?(o=2,h=c.trimLeft()):(o=n[2].search(/[^ ]/),o=o>4?1:o,h=c.slice(o),o+=n[1].length),a=!1,!c&&/^ *$/.test(f)&&(r+=f+` -`,e=e.substring(f.length+1),p=!0),!p){const k=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),x=new RegExp(`^ {0,${Math.min(3,o-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),C=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:\`\`\`|~~~)`),T=new RegExp(`^ {0,${Math.min(3,o-1)}}#`);for(;e&&(d=e.split(` -`,1)[0],f=d,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(C.test(f)||T.test(f)||k.test(f)||x.test(e)));){if(f.search(/[^ ]/)>=o||!f.trim())h+=` -`+f.slice(o);else{if(a||c.search(/[^ ]/)>=4||C.test(c)||T.test(c)||x.test(c))break;h+=` -`+f}!a&&!f.trim()&&(a=!0),r+=d+` -`,e=e.substring(d.length+1),c=f.slice(o)}}v.loose||(u?v.loose=!0:/\n *\n *$/.test(r)&&(u=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(h),i&&(s=i[0]!=="[ ] ",h=h.replace(/^\[[ xX]\] +/,""))),v.items.push({type:"list_item",raw:r,task:!!i,checked:s,loose:!1,text:h}),v.raw+=r}v.items[v.items.length-1].raw=r.trimRight(),v.items[v.items.length-1].text=h.trimRight(),v.raw=v.raw.trimRight();const y=v.items.length;for(l=0;lC.type==="space"),x=k.length>0&&k.some(C=>/\n.*\n/.test(C.raw));v.loose=x}if(v.loose)for(l=0;l$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline._escapes,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:i,title:s}}}table(e){const n=this.rules.block.table.exec(e);if(n){const r={type:"table",header:Nb(n[1]).map(i=>({text:i})),align:n[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(` -`):[]};if(r.header.length===r.align.length){r.raw=n[0];let i=r.align.length,s,o,l,a;for(s=0;s({text:u}));for(i=r.header.length,o=0;o/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):Jn(n[0]):n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&/^$/.test(r))return;const o=Od(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{const o=h4(n[2],"()");if(o>-1){const a=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,a).trim(),n[3]=""}}let i=n[2],s="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);o&&(i=o[1],s=o[3])}else s=n[3]?n[3].slice(1,-1):"";return i=i.trim(),/^$/.test(r)?i=i.slice(1):i=i.slice(1,-1)),Fb(n,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let i=(r[2]||r[1]).replace(/\s+/g," ");if(i=n[i.toLowerCase()],!i){const s=r[0].charAt(0);return{type:"text",raw:s,text:s}}return Fb(r,i,r[0],this.lexer)}}emStrong(e,n,r=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i||i[3]&&r.match(/[\p{L}\p{N}]/u))return;const s=i[1]||i[2]||"";if(!s||s&&(r===""||this.rules.inline.punctuation.exec(r))){const o=i[0].length-1;let l,a,u=o,c=0;const f=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(f.lastIndex=0,n=n.slice(-1*e.length+o);(i=f.exec(n))!=null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(a=l.length,i[3]||i[4]){u+=a;continue}else if((i[5]||i[6])&&o%3&&!((o+a)%3)){c+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u+c);const d=e.slice(0,o+i.index+(i[0].length-l.length)+a);if(Math.min(o,a)%2){const p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}const h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(/\n/g," ");const i=/[^ ]/.test(r),s=/^ /.test(r)&&/ $/.test(r);return i&&s&&(r=r.substring(1,r.length-1)),r=Jn(r,!0),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e,n){const r=this.rules.inline.autolink.exec(e);if(r){let i,s;return r[2]==="@"?(i=Jn(this.options.mangle?n(r[1]):r[1]),s="mailto:"+i):(i=Jn(r[1]),s=i),{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(e,n){let r;if(r=this.rules.inline.url.exec(e)){let i,s;if(r[2]==="@")i=Jn(this.options.mangle?n(r[0]):r[0]),s="mailto:"+i;else{let o;do o=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0];while(o!==r[0]);i=Jn(r[0]),r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e,n){const r=this.rules.inline.text.exec(e);if(r){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):Jn(r[0]):r[0]:i=Jn(this.options.smartypants?n(r[0]):r[0]),{type:"text",raw:r[0],text:i}}}}const Ge={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:hh,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};Ge._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;Ge._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;Ge.def=Gt(Ge.def).replace("label",Ge._label).replace("title",Ge._title).getRegex();Ge.bullet=/(?:[*+-]|\d{1,9}[.)])/;Ge.listItemStart=Gt(/^( *)(bull) */).replace("bull",Ge.bullet).getRegex();Ge.list=Gt(Ge.list).replace(/bull/g,Ge.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Ge.def.source+")").getRegex();Ge._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";Ge._comment=/|$)/;Ge.html=Gt(Ge.html,"i").replace("comment",Ge._comment).replace("tag",Ge._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();Ge.paragraph=Gt(Ge._paragraph).replace("hr",Ge.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ge._tag).getRegex();Ge.blockquote=Gt(Ge.blockquote).replace("paragraph",Ge.paragraph).getRegex();Ge.normal={...Ge};Ge.gfm={...Ge.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};Ge.gfm.table=Gt(Ge.gfm.table).replace("hr",Ge.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ge._tag).getRegex();Ge.gfm.paragraph=Gt(Ge._paragraph).replace("hr",Ge.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Ge.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ge._tag).getRegex();Ge.pedantic={...Ge.normal,html:Gt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ge._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:hh,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Gt(Ge.normal._paragraph).replace("hr",Ge.hr).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",Ge.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const Oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:hh,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:hh,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";Oe.punctuation=Gt(Oe.punctuation).replace(/punctuation/g,Oe._punctuation).getRegex();Oe.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;Oe.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;Oe._comment=Gt(Ge._comment).replace("(?:-->|$)","-->").getRegex();Oe.emStrong.lDelim=Gt(Oe.emStrong.lDelim).replace(/punct/g,Oe._punctuation).getRegex();Oe.emStrong.rDelimAst=Gt(Oe.emStrong.rDelimAst,"g").replace(/punct/g,Oe._punctuation).getRegex();Oe.emStrong.rDelimUnd=Gt(Oe.emStrong.rDelimUnd,"g").replace(/punct/g,Oe._punctuation).getRegex();Oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;Oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;Oe._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;Oe.autolink=Gt(Oe.autolink).replace("scheme",Oe._scheme).replace("email",Oe._email).getRegex();Oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;Oe.tag=Gt(Oe.tag).replace("comment",Oe._comment).replace("attribute",Oe._attribute).getRegex();Oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;Oe._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;Oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;Oe.link=Gt(Oe.link).replace("label",Oe._label).replace("href",Oe._href).replace("title",Oe._title).getRegex();Oe.reflink=Gt(Oe.reflink).replace("label",Oe._label).replace("ref",Ge._label).getRegex();Oe.nolink=Gt(Oe.nolink).replace("ref",Ge._label).getRegex();Oe.reflinkSearch=Gt(Oe.reflinkSearch,"g").replace("reflink",Oe.reflink).replace("nolink",Oe.nolink).getRegex();Oe.normal={...Oe};Oe.pedantic={...Oe.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Gt(/^!?\[(label)\]\((.*?)\)/).replace("label",Oe._label).getRegex(),reflink:Gt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Oe._label).getRegex()};Oe.gfm={...Oe.normal,escape:Gt(Oe.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(r="x"+r.toString(16)),e+="&#"+r+";";return e}class bo{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ml,this.options.tokenizer=this.options.tokenizer||new Wv,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:Ge.normal,inline:Oe.normal};this.options.pedantic?(n.block=Ge.pedantic,n.inline=Oe.pedantic):this.options.gfm&&(n.block=Ge.gfm,this.options.breaks?n.inline=Oe.breaks:n.inline=Oe.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ge,inline:Oe}}static lex(e,n){return new bo(n).lex(e)}static lexInline(e,n){return new bo(n).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,` -`),this.blockTokens(e,this.tokens);let n;for(;n=this.inlineQueue.shift();)this.inlineTokens(n.src,n.tokens);return this.tokens}blockTokens(e,n=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(l,a,u)=>a+" ".repeat(u.length));let r,i,s,o;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(r=l.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length),r.raw.length===1&&n.length>0?n[n.length-1].raw+=` -`:n.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=` -`+r.raw,i.text+=` -`+r.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=` -`+r.raw,i.text+=` -`+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(s=e,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const a=e.slice(1);let u;this.options.extensions.startBlock.forEach(function(c){u=c.call({lexer:this},a),typeof u=="number"&&u>=0&&(l=Math.min(l,u))}),l<1/0&&l>=0&&(s=e.substring(0,l+1))}if(this.state.top&&(r=this.tokenizer.paragraph(s))){i=n[n.length-1],o&&i.type==="paragraph"?(i.raw+=` -`+r.raw,i.text+=` -`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r),o=s.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&i.type==="text"?(i.raw+=` -`+r.raw,i.text+=` -`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r,i,s,o=e,l,a,u;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)c.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+Lb("a",l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+Lb("a",l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.escapedEmSt.exec(o))!=null;)o=o.slice(0,l.index+l[0].length-2)+"++"+o.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(a||(u=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(r=c.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&r.type==="text"&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length),i=n[n.length-1],i&&r.type==="text"&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(e,o,u)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(e,Bb)){e=e.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e,Bb))){e=e.substring(r.raw.length),n.push(r);continue}if(s=e,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const f=e.slice(1);let d;this.options.extensions.startInline.forEach(function(h){d=h.call({lexer:this},f),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(s=e.substring(0,c+1))}if(r=this.tokenizer.inlineText(s,m4)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(u=r.raw.slice(-1)),a=!0,i=n[n.length-1],i&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return n}}class Vv{constructor(e){this.options=e||ml}code(e,n,r){const i=(n||"").match(/\S*/)[0];if(this.options.highlight){const s=this.options.highlight(e,i);s!=null&&s!==e&&(r=!0,e=s)}return e=e.replace(/\n$/,"")+` -`,i?'
'+(r?e:Jn(e,!0))+`
-`:"
"+(r?e:Jn(e,!0))+`
-`}blockquote(e){return`
-${e}
-`}html(e){return e}heading(e,n,r,i){if(this.options.headerIds){const s=this.options.headerPrefix+i.slug(r);return`${e} -`}return`${e} -`}hr(){return this.options.xhtml?`
-`:`
-`}list(e,n,r){const i=n?"ol":"ul",s=n&&r!==1?' start="'+r+'"':"";return"<"+i+s+`> -`+e+" -`}listitem(e){return`
  • ${e}
  • -`}checkbox(e){return" "}paragraph(e){return`

    ${e}

    -`}table(e,n){return n&&(n=`${n}`),` - -`+e+` -`+n+`
    -`}tablerow(e){return` -${e} -`}tablecell(e,n){const r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+e+` -`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return this.options.xhtml?"
    ":"
    "}del(e){return`${e}`}link(e,n,r){if(e=_b(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i='",i}image(e,n,r){if(e=_b(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i=`${r}":">",i}text(e){return e}}class PT{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,n,r){return""+r}image(e,n,r){return""+r}br(){return""}}class IT{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,n){let r=e,i=0;if(this.seen.hasOwnProperty(r)){i=this.seen[e];do i++,r=e+"-"+i;while(this.seen.hasOwnProperty(r))}return n||(this.seen[e]=i,this.seen[r]=0),r}slug(e,n={}){const r=this.serialize(e);return this.getNextSafeSlug(r,n.dryrun)}}let Kc=class C0{constructor(e){this.options=e||ml,this.options.renderer=this.options.renderer||new Vv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new PT,this.slugger=new IT}static parse(e,n){return new C0(n).parse(e)}static parseInline(e,n){return new C0(n).parseInline(e)}parse(e,n=!0){let r="",i,s,o,l,a,u,c,f,d,h,p,m,b,v,g,y,k,x,C;const T=e.length;for(i=0;i0&&g.tokens[0].type==="paragraph"?(g.tokens[0].text=x+" "+g.tokens[0].text,g.tokens[0].tokens&&g.tokens[0].tokens.length>0&&g.tokens[0].tokens[0].type==="text"&&(g.tokens[0].tokens[0].text=x+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:x}):v+=x),v+=this.parse(g.tokens,b),d+=this.renderer.listitem(v,k,y);r+=this.renderer.list(d,p,m);continue}case"html":{r+=this.renderer.html(h.text);continue}case"paragraph":{r+=this.renderer.paragraph(this.parseInline(h.tokens));continue}case"text":{for(d=h.tokens?this.parseInline(h.tokens):h.text;i+1{if(r.message+=` -Please report this to https://github.com/markedjs/marked.`,t){const i="

    An error occurred:

    "+Jn(r.message+"",!0)+"
    ";if(e)return Promise.resolve(i);if(n){n(null,i);return}return i}if(e)return Promise.reject(r);if(n){n(r);return}throw r}}function DT(t,e){return(n,r,i)=>{typeof r=="function"&&(i=r,r=null);const s={...r};r={...Qe.defaults,...s};const o=y4(r.silent,r.async,i);if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(p4(r),r.hooks&&(r.hooks.options=r),i){const l=r.highlight;let a;try{r.hooks&&(n=r.hooks.preprocess(n)),a=t(n,r)}catch(f){return o(f)}const u=function(f){let d;if(!f)try{r.walkTokens&&Qe.walkTokens(a,r.walkTokens),d=e(a,r),r.hooks&&(d=r.hooks.postprocess(d))}catch(h){f=h}return r.highlight=l,f?o(f):i(null,d)};if(!l||l.length<3||(delete r.highlight,!a.length))return u();let c=0;Qe.walkTokens(a,function(f){f.type==="code"&&(c++,setTimeout(()=>{l(f.text,f.lang,function(d,h){if(d)return u(d);h!=null&&h!==f.text&&(f.text=h,f.escaped=!0),c--,c===0&&u()})},0))}),c===0&&u();return}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(l=>t(l,r)).then(l=>r.walkTokens?Promise.all(Qe.walkTokens(l,r.walkTokens)).then(()=>l):l).then(l=>e(l,r)).then(l=>r.hooks?r.hooks.postprocess(l):l).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));const l=t(n,r);r.walkTokens&&Qe.walkTokens(l,r.walkTokens);let a=e(l,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(l){return o(l)}}}function Qe(t,e,n){return DT(bo.lex,Kc.parse)(t,e,n)}Qe.options=Qe.setOptions=function(t){return Qe.defaults={...Qe.defaults,...t},t4(Qe.defaults),Qe};Qe.getDefaults=AT;Qe.defaults=ml;Qe.use=function(...t){const e=Qe.defaults.extensions||{renderers:{},childTokens:{}};t.forEach(n=>{const r={...n};if(r.async=Qe.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if(i.tokenizer){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");e[i.level]?e[i.level].unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=Qe.defaults.renderer||new Vv;for(const s in n.renderer){const o=i[s];i[s]=(...l)=>{let a=n.renderer[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.renderer=i}if(n.tokenizer){const i=Qe.defaults.tokenizer||new Wv;for(const s in n.tokenizer){const o=i[s];i[s]=(...l)=>{let a=n.tokenizer[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.tokenizer=i}if(n.hooks){const i=Qe.defaults.hooks||new ph;for(const s in n.hooks){const o=i[s];ph.passThroughHooks.has(s)?i[s]=l=>{if(Qe.defaults.async)return Promise.resolve(n.hooks[s].call(i,l)).then(u=>o.call(i,u));const a=n.hooks[s].call(i,l);return o.call(i,a)}:i[s]=(...l)=>{let a=n.hooks[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.hooks=i}if(n.walkTokens){const i=Qe.defaults.walkTokens;r.walkTokens=function(s){let o=[];return o.push(n.walkTokens.call(this,s)),i&&(o=o.concat(i.call(this,s))),o}}Qe.setOptions(r)})};Qe.walkTokens=function(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(Qe,r)),r.type){case"table":{for(const i of r.header)n=n.concat(Qe.walkTokens(i.tokens,e));for(const i of r.rows)for(const s of i)n=n.concat(Qe.walkTokens(s.tokens,e));break}case"list":{n=n.concat(Qe.walkTokens(r.items,e));break}default:Qe.defaults.extensions&&Qe.defaults.extensions.childTokens&&Qe.defaults.extensions.childTokens[r.type]?Qe.defaults.extensions.childTokens[r.type].forEach(function(i){n=n.concat(Qe.walkTokens(r[i],e))}):r.tokens&&(n=n.concat(Qe.walkTokens(r.tokens,e)))}return n};Qe.parseInline=DT(bo.lexInline,Kc.parseInline);Qe.Parser=Kc;Qe.parser=Kc.parse;Qe.Renderer=Vv;Qe.TextRenderer=PT;Qe.Lexer=bo;Qe.lexer=bo.lex;Qe.Tokenizer=Wv;Qe.Slugger=IT;Qe.Hooks=ph;Qe.parse=Qe;Qe.options;Qe.setOptions;Qe.use;Qe.walkTokens;Qe.parseInline;Kc.parse;bo.lex;const v4=jr("div")({name:"MarkdownContainer",class:"gdg-mnuv029",propsAsIs:!1});class w4 extends Pn.PureComponent{constructor(){super(...arguments);bt(this,"targetElement",null);bt(this,"containerRefHook",n=>{this.targetElement=n,this.renderMarkdownIntoDiv()})}renderMarkdownIntoDiv(){const{targetElement:n,props:r}=this;if(n===null)return;const{contents:i,createNode:s}=r,o=Qe(i),l=document.createRange();l.selectNodeContents(n),l.deleteContents();let a=s==null?void 0:s(o);if(a===void 0){const c=document.createElement("template");c.innerHTML=o,a=c.content}n.append(a);const u=n.getElementsByTagName("a");for(const c of u)c.target="_blank",c.rel="noreferrer noopener"}render(){return this.renderMarkdownIntoDiv(),Pn.createElement(v4,{ref:this.containerRefHook})}}const b4=jr("textarea")({name:"InputBox",class:"gdg-izpuzkl",propsAsIs:!1}),x4=jr("div")({name:"ShadowBox",class:"gdg-s69h75o",propsAsIs:!1}),k4=jr("div")({name:"GrowingEntryStyle",class:"gdg-g1y0xocz",propsAsIs:!1});let zb=0;const mp=t=>{const{placeholder:e,value:n,onKeyDown:r,highlight:i,altNewline:s,validatedSelection:o,...l}=t,{onChange:a,className:u}=l,c=w.useRef(null),f=n??"";_r(a!==void 0,"GrowingEntry must be a controlled input area");const[d]=w.useState(()=>"input-box-"+(zb=(zb+1)%1e7));w.useEffect(()=>{const p=c.current;if(p===null||p.disabled)return;const m=f.toString().length;p.focus(),p.setSelectionRange(i?0:m,m)},[]),w.useLayoutEffect(()=>{var p;if(o!==void 0){const m=typeof o=="number"?[o,null]:o;(p=c.current)==null||p.setSelectionRange(m[0],m[1])}},[o]);const h=w.useCallback(p=>{p.key==="Enter"&&p.shiftKey&&s===!0||r==null||r(p)},[s,r]);return w.createElement(k4,{className:"gdg-growing-entry"},w.createElement(x4,{className:u},f+` -`),w.createElement(b4,{...l,className:(u??"")+" gdg-input",id:d,ref:c,onKeyDown:h,value:f,placeholder:e,dir:"auto"}))},Lg={};let Vs=null;function S4(){const t=document.createElement("div");return t.style.opacity="0",t.style.pointerEvents="none",t.style.position="fixed",document.body.append(t),t}function T0(t){const e=t.toLowerCase().trim();if(Lg[e]!==void 0)return Lg[e];Vs=Vs||S4(),Vs.style.color="#000",Vs.style.color=e;const n=getComputedStyle(Vs).color;Vs.style.color="#fff",Vs.style.color=e;const r=getComputedStyle(Vs).color;if(r!==n)return[0,0,0,1];let i=r.replace(/[^\d.,]/g,"").split(",").map(Number.parseFloat);return i.length<4&&i.push(1),i=i.map(s=>Number.isNaN(s)?0:s),Lg[e]=i,i}function ll(t,e){const[n,r,i]=T0(t);return`rgba(${n}, ${r}, ${i}, ${e})`}const $b=new Map;function Hb(t,e){const n=`${t}-${e}`,r=$b.get(n);if(r!==void 0)return r;const i=Nr(t,e);return $b.set(n,i),i}function Nr(t,e){if(e===void 0)return t;const[n,r,i,s]=T0(t);if(s===1)return t;const[o,l,a,u]=T0(e),c=s+u*(1-s),f=(s*n+u*o*(1-s))/c,d=(s*r+u*l*(1-s))/c,h=(s*i+u*a*(1-s))/c;return`rgba(${f}, ${d}, ${h}, ${c})`}var Hl=new Map,na=new Map,E0=new Map;function C4(){Hl.clear(),E0.clear(),na.clear()}function T4(t,e,n,r,i){var s,o,l;let a=0,u={};for(let f of t)a+=(s=n.get(f))!=null?s:i,u[f]=((o=u[f])!=null?o:0)+1;let c=e-a;for(let f of Object.keys(u)){let d=u[f],h=(l=n.get(f))!=null?l:i,p=h*d/a,m=c*p*r/d,b=h+m;n.set(f,b)}}function E4(t,e){var n;let r=new Map,i=0;for(let u of"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-+=?"){let c=t.measureText(u).width;r.set(u,c),i+=c}let s=i/r.size,o=3,l=(e/s+o)/(o+1),a=r.keys();for(let u of a)r.set(u,((n=r.get(u))!=null?n:s)*l);return r}function Yu(t,e,n,r){var i,s;let o=na.get(n);if(r&&o!==void 0&&o.count>2e4){let u=E0.get(n);if(u===void 0&&(u=E4(t,o.size),E0.set(n,u)),o.count>5e5){let f=0;for(let d of e)f+=(i=u.get(d))!=null?i:o.size;return f*1.01}let c=t.measureText(e);return T4(e,c.width,u,Math.max(.05,1-o.count/2e5),o.size),na.set(n,{count:o.count+e.length,size:o.size}),c.width}let l=t.measureText(e),a=l.width/e.length;if(((s=o==null?void 0:o.count)!=null?s:0)>2e4)return l.width;if(o===void 0)na.set(n,{count:e.length,size:a});else{let u=a-o.size,c=e.length/(o.count+e.length),f=o.size+u*c;na.set(n,{count:o.count+e.length,size:f})}return l.width}function A4(t,e,n,r,i,s,o,l){if(e.length<=1)return e.length;if(in;){let c=e.lastIndexOf(" ",a-1);c>0?a=c:a--,u=Yu(t,e.slice(0,Math.max(0,a)),r,o)}if(e[a]!==" "){let c=0;c=e.lastIndexOf(" ",a),c>0&&(a=c)}return a}function M4(t,e,n,r,i,s){let o=`${e}_${n}_${r}px`,l=Hl.get(o);if(l!==void 0)return l;if(r<=0)return[];let a=[],u=e.split(` -`),c=na.get(n),f=c===void 0?e.length:r/c.size*1.5,d=i&&c!==void 0&&c.count>2e4;for(let h of u){let p=Yu(t,h.slice(0,Math.max(0,f)),n,d),m=Math.min(h.length,f);if(p<=r)a.push(h);else{for(;p>r;){let b=A4(t,h,r,n,p,m,d),v=h.slice(0,Math.max(0,b));h=h.slice(v.length),a.push(v),p=Yu(t,h.slice(0,Math.max(0,f)),n,d),m=Math.min(h.length,f)}p>0&&a.push(h)}}return a=a.map((h,p)=>p===0?h.trimEnd():h.trim()),Hl.set(o,a),Hl.size>500&&Hl.delete(Hl.keys().next().value),a}function R4(t,e){return Pn.useMemo(()=>t.map((n,r)=>({group:n.group,grow:n.grow,hasMenu:n.hasMenu,icon:n.icon,id:n.id,menuIcon:n.menuIcon,overlayIcon:n.overlayIcon,sourceIndex:r,sticky:r=s.x&&n=s.y&&r=e.span[0]&&n.current.cell[0]<=e.span[1]}function _T(t,e){const[n,r]=t;return n>=e.x&&n=e.y&&ro)return!1;if(e.span===void 0)return l>=r&&l<=i;const[u,c]=e.span;return u>=r&&u<=i||c>=r&&u<=i||ui}function I4(t,e,n,r){let i=0;if(n.current===void 0)return i;const s=n.current.range;(r||s.height*s.width>1)&&jb(t,e,s)&&i++;for(const o of n.current.rangeStack)jb(t,e,o)&&i++;return i}function LT(t,e){let n=t;if(e!==void 0){let r=[...t];const i=n[e.src];e.src>e.dest?(r.splice(e.src,1),r.splice(e.dest,0,i)):(r.splice(e.dest+1,0,i),r.splice(e.src,1)),r=r.map((s,o)=>({...s,sticky:t[o].sticky})),n=r}return n}function Aa(t,e){let n=0;const r=LT(t,e);for(let i=0;i0)for(const u of o)n-=u.width;let l=e,a=i??0;for(;a<=n&&l=f)return m}const d=s-u,h=t-(a??0);if(typeof o=="number"){const p=Math.floor((h-c)/o)+l;return p>=d?void 0:p}else{let p=c;for(let m=l;m"u";async function L4(){var t;N4||((t=document==null?void 0:document.fonts)==null?void 0:t.ready)===void 0||(await document.fonts.ready,Pd=0,Qu={},C4())}L4();function FT(t,e,n,r){return`${t}_${r??(e==null?void 0:e.font)}_${n}`}function Xc(t,e,n,r="middle"){const i=FT(t,e,r,n);let s=Qu[i];return s===void 0&&(s=e.measureText(t),Qu[i]=s,Pd++),Pd>1e4&&(Qu={},Pd=0),s}function F4(t,e){const n=FT(t,void 0,"middle",e);return Qu[n]}function Is(t,e){return typeof e!="string"&&(e=e.baseFontFull),B4(t,e)}function Wb(t,e){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";t.save(),t.textBaseline=e;const r=t.measureText(n);return t.restore(),r}const Vb=[];function B4(t,e){for(const s of Vb)if(s.key===e)return s.val;const n=Wb(t,"alphabetic"),i=-(Wb(t,"middle").actualBoundingBoxDescent-n.actualBoundingBoxDescent)+n.actualBoundingBoxAscent/2;return Vb.push({key:e,val:i}),i}function z4(t,e,n,r,i,s){const{ctx:o,rect:l,theme:a}=t;let u=Number.MAX_SAFE_INTEGER;const c=500;if(e!==void 0&&(u=n-e,un&&(t=t.slice(0,n)),t}function H4(t,e,n,r,i,s,o,l,a,u){const c=l.baseFontFull,f=M4(t,e,c,i-l.cellHorizontalPadding*2,u??!1),d=zT(t,c),h=l.lineHeight*d,p=d+h*(f.length-1),m=p+l.cellVerticalPadding>s;m&&(t.save(),t.rect(n,r,i,s),t.clip());const b=r+s/2-p/2;let v=Math.max(r+l.cellVerticalPadding,b);for(const g of f)if(BT(t,g,n,v,i,d,o,l,a),v+=h,v>r+s)break;m&&t.restore()}function ws(t,e,n,r,i){const{ctx:s,rect:o,theme:l}=t,{x:a,y:u,width:c,height:f}=o;r=r??!1,r||(e=$4(e,c));const d=Is(s,l),h=jv(e)==="rtl";if(n===void 0&&h&&(n="right"),h&&(s.direction="rtl"),e.length>0){let p=!1;n==="right"?(s.textAlign="right",p=!0):n!==void 0&&n!=="left"&&(s.textAlign=n,p=!0),r?H4(s,e,a,u,c,f,d,l,n,i):BT(s,e,a,u,c,f,d,l,n),p&&(s.textAlign="start"),h&&(s.direction="inherit")}}function rs(t,e,n,r,i,s){typeof s=="number"&&(s={tl:s,tr:s,br:s,bl:s}),s={tl:Math.max(0,Math.min(s.tl,i/2,r/2)),tr:Math.max(0,Math.min(s.tr,i/2,r/2)),bl:Math.max(0,Math.min(s.bl,i/2,r/2)),br:Math.max(0,Math.min(s.br,i/2,r/2))},t.moveTo(e+s.tl,n),t.arcTo(e+r,n,e+r,n+s.tr,s.tr),t.arcTo(e+r,n+i,e+r-s.br,n+i,s.br),t.arcTo(e,n+i,e,n+i-s.bl,s.bl),t.arcTo(e,n,e+s.tl,n,s.tl)}function j4(t,e,n){t.arc(e,n-1.25*3.5,1.25,0,2*Math.PI,!1),t.arc(e,n,1.25,0,2*Math.PI,!1),t.arc(e,n+1.25*3.5,1.25,0,2*Math.PI,!1)}function W4(t,e,n){const r=function(l,a){const u=a.x-l.x,c=a.y-l.y,f=Math.sqrt(u*u+c*c),d=u/f,h=c/f;return{x:u,y:a.y-l.y,len:f,nx:d,ny:h,ang:Math.atan2(h,d)}};let i;const s=e.length;let o=e[s-1];for(let l=0;l1?1:d),m=1,b=!1;h<0?p<0?p=Math.PI+p:(p=Math.PI-p,m=-1,b=!0):p>0&&(m=-1,b=!0),i=a.radius!==void 0?a.radius:n;const v=p/2;let g=Math.abs(Math.cos(v)*i/Math.sin(v)),y;g>Math.min(c.len/2,f.len/2)?(g=Math.min(c.len/2,f.len/2),y=Math.abs(g*Math.sin(v)/Math.cos(v))):y=i;let k=a.x+f.nx*g,x=a.y+f.ny*g;k+=-f.ny*y*m,x+=f.nx*y*m,t.arc(k,x,y,c.ang+Math.PI/2*m,f.ang-Math.PI/2*m,b),o=a,a=u}t.closePath()}function M0(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p){const m={x:0,y:s+u,width:0,height:0};if(t>=h.length||e>=c||e<-2||t<0)return m;const b=s-i;if(t>=f){const v=o>t?-1:1,g=Aa(h);m.x+=g+a;for(let y=o;y!==t;y+=v)m.x+=h[v===1?y:y-1].width*v}else for(let v=0;v0&&Cc(h[v-1].group,g)&&h[v-1].sticky===y;){const x=h[v-1];m.x-=x.width,m.width+=x.width,v--}let k=t;for(;k+1n&&(m.width=n-m.x)}}else if(e>=c-d){let v=c-e;for(m.y=r;v>0;){const g=e+v-1;m.height=typeof p=="number"?p:p(g),m.y-=m.height,v--}m.height+=1}else{const v=l>e?-1:1;if(typeof p=="number"){const g=e-l;m.y+=g*p}else for(let g=l;g!==e;g+=v)m.y+=p(g)*v;m.height=(typeof p=="number"?p:p(e))+1}return m}const Uv=1<<21;function ki(t,e){return(e+2)*Uv+t}function $T(t){return t%Uv}function Kv(t){return Math.floor(t/Uv)-2}function Xv(t){const e=$T(t),n=Kv(t);return[e,n]}class HT{constructor(){bt(this,"visibleWindow",{x:0,y:0,width:0,height:0});bt(this,"freezeCols",0);bt(this,"freezeRows",[]);bt(this,"isInWindow",e=>{const n=$T(e),r=Kv(e),i=this.visibleWindow,s=n>=i.x&&n<=i.x+i.width||n=i.y&&r<=i.y+i.height||this.freezeRows.includes(r);return s&&o})}setWindow(e,n,r){this.visibleWindow.x===e.x&&this.visibleWindow.y===e.y&&this.visibleWindow.width===e.width&&this.visibleWindow.height===e.height&&this.freezeCols===n&&Ea(this.freezeRows,r)||(this.visibleWindow=e,this.freezeCols=n,this.freezeRows=r,this.clearOutOfWindow())}}class V4 extends HT{constructor(){super(...arguments);bt(this,"cache",new Map);bt(this,"setValue",(n,r)=>{this.cache.set(ki(n[0],n[1]),r)});bt(this,"getValue",n=>this.cache.get(ki(n[0],n[1])));bt(this,"clearOutOfWindow",()=>{for(const[n]of this.cache.entries())this.isInWindow(n)||this.cache.delete(n)})}}class Ju{constructor(e=[]){bt(this,"cells");this.cells=new Set(e.map(n=>ki(n[0],n[1])))}add(e){this.cells.add(ki(e[0],e[1]))}has(e){return e===void 0?!1:this.cells.has(ki(e[0],e[1]))}remove(e){this.cells.delete(ki(e[0],e[1]))}clear(){this.cells.clear()}get size(){return this.cells.size}hasHeader(){for(const e of this.cells)if(Kv(e)<0)return!0;return!1}hasItemInRectangle(e){for(let n=e.y;n{const h=X4(t,d[r],e,a);return u=Math.max(u,h),h});if(c.length>5&&l){u=0;let d=0;for(const p of c)d+=p;const h=d/c.length;for(let p=0;p=h*2?c[p]=0:u=Math.max(u,c[p])}u=Math.max(u,t.measureText(n.title).width+16+(n.icon===void 0?0:28));const f=Math.max(Math.ceil(s),Math.min(Math.floor(o),Math.ceil(u)));return{...n,width:f}}function G4(t,e,n,r,i,s,o,l,a){const u=w.useRef(e),c=w.useRef(n),f=w.useRef(o);u.current=e,c.current=n,f.current=o;const[d,h]=w.useMemo(()=>{if(typeof window>"u")return[null,null];const g=document.createElement("canvas");return g.style.display="none",g.style.opacity="0",g.style.position="fixed",[g,g.getContext("2d",{alpha:!1})]},[]);w.useLayoutEffect(()=>(d&&document.documentElement.append(d),()=>{d==null||d.remove()}),[d]);const p=w.useRef({}),m=w.useRef(),[b,v]=w.useState();return w.useLayoutEffect(()=>{const g=c.current;if(g===void 0||t.every(Hf))return;let y=Math.max(1,10-Math.floor(t.length/1e4)),k=0;y1&&(y--,k=1);const x={x:0,y:0,width:t.length,height:Math.min(u.current,y)},C={x:0,y:u.current-1,width:t.length,height:1};(async()=>{const E=g(x,a.signal),M=k>0?g(C,a.signal):void 0;let P;typeof E=="object"?P=E:P=await wb(E),M!==void 0&&(typeof M=="object"?P=[...P,...M]:P=[...P,...await wb(M)]),m.current=t,v(P)})()},[a.signal,t]),w.useMemo(()=>{let y=t.every(Hf)?t:h===null?t.map(T=>Hf(T)?T:{...T,width:R0}):(h.font=f.current.baseFontFull,t.map((T,E)=>{if(Hf(T))return T;if(p.current[T.id]!==void 0)return{...T,width:p.current[T.id]};if(b===void 0||m.current!==t||T.id===void 0)return{...T,width:R0};const M=VT(h,o,T,E,b,i,s,!0,l);return p.current[T.id]=M.width,M})),k=0,x=0;const C=[];for(const[T,E]of y.entries())k+=E.width,E.grow!==void 0&&E.grow>0&&(x+=E.grow,C.push(T));if(k0){const T=[...y],E=r-k;let M=E;for(let P=0;P0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(a=>{if(a=q4(a),a in Ub)return;Ub[a]=!0;const u=a.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${c}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Y4,u||(f.as="script"),f.crossOrigin="",f.href=a,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,h)=>{f.addEventListener("load",d),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${a}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};function Q4(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}var J4=Q4,Z4=J4,Fg=$v;function eB(t,e,n){return n===void 0&&(n=e,e=void 0),n!==void 0&&(n=Fg(n),n=n===n?n:0),e!==void 0&&(e=Fg(e),e=e===e?e:0),Z4(Fg(t),e,n)}var tB=eB;const xi=Ii(tB);var nB="__lodash_hash_undefined__";function rB(t){return this.__data__.set(t,nB),this}var iB=rB;function sB(t){return this.__data__.has(t)}var oB=sB,lB=Pv,aB=iB,uB=oB;function gh(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new lB;++e-1}var SB=kB;function CB(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=VB){var u=e?null:jB(t);if(u)return WB(u);o=!1,i=HB,a=new BB}else a=e?[]:l;e:for(;++r0&&n(l)?e>1?qT(l,e-1,n,r,i):nz(i,l):r||(i[i.length]=l)}return i}var iz=qT,sz=iz;function oz(t){var e=t==null?0:t.length;return e?sz(t,1):[]}var lz=oz;const Gb=Ii(lz);var az=Math.ceil,uz=Math.max;function cz(t,e,n,r){for(var i=-1,s=uz(az((e-t)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=t,t+=n;return o}var fz=cz,dz=lT,hz=Nv;function pz(t){return t!=null&&hz(t.length)&&!dz(t)}var Yv=pz,gz=Rv,mz=Yv,yz=_v,vz=pl;function wz(t,e,n){if(!vz(n))return!1;var r=typeof e;return(r=="number"?mz(n)&&yz(e,n.length):r=="string"&&e in n)?gz(n[e],t):!1}var bz=wz,xz=$v,Yb=1/0,kz=17976931348623157e292;function Sz(t){if(!t)return t===0?t:0;if(t=xz(t),t===Yb||t===-Yb){var e=t<0?-1:1;return e*kz}return t===t?t:0}var Cz=Sz,Tz=fz,Ez=bz,zg=Cz;function Az(t){return function(e,n,r){return r&&typeof r!="number"&&Ez(e,n,r)&&(n=r=void 0),e=zg(e),n===void 0?(n=e,e=0):n=zg(n),r=r===void 0?e{m.drawImage(b,0,0,f,f)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else a<1&&(r.globalAlpha=a),r.drawImage(h,0,0,f,f,i,s,o,o),a<1&&(r.globalAlpha=1)}}function QT(t){if(t.length===0)return;let e;for(const n of t)e=Math.min(e??n.y,n.y)}function yp(t,e,n,r,i,s,o,l,a){l=l??e;let u=e,c=t;const f=r-s;let d=!1;for(;ul&&a(u,c,h,!1,o&&c===r-1)===!0){d=!0;break}u+=h,c++}if(!d){u=n;for(let h=0;h!h.sticky))==null?void 0:d.sourceIndex)??0;if(a>f){const h=Math.max(l,f);let p=e,m=r;for(let b=s.sourceIndex-1;b>=h;b--)p-=o[b].width,m+=o[b].width;for(let b=s.sourceIndex+1;b<=a;b++)m+=o[b].width;c={x:p,y:n,width:m,height:i}}if(f>l){const h=Math.min(a,f-1);let p=e,m=r;for(let b=s.sourceIndex-1;b>=l;b--)p-=o[b].width,m+=o[b].width;for(let b=s.sourceIndex+1;b<=h;b++)m+=o[b].width;u={x:p,y:n,width:m,height:i}}return[u,c]}function _z(t,e,n,r){if(r==="any")return eE(t,{x:e,y:n,width:1,height:1});if(r==="vertical"&&(e=t.x),r==="horizontal"&&(n=t.y),_T([e,n],t))return;const i=e-t.x,s=t.x+t.width-e,o=n-t.y+1,l=t.y+t.height-n,a=Math.min(r==="vertical"?Number.MAX_SAFE_INTEGER:i,r==="vertical"?Number.MAX_SAFE_INTEGER:s,r==="horizontal"?Number.MAX_SAFE_INTEGER:o,r==="horizontal"?Number.MAX_SAFE_INTEGER:l);return a===l?{x:t.x,y:t.y+t.height,width:t.width,height:n-t.y-t.height+1}:a===o?{x:t.x,y:n,width:t.width,height:t.y-n}:a===s?{x:t.x+t.width,y:t.y,width:e-t.x-t.width+1,height:t.height}:{x:e,y:t.y,width:t.x-e,height:t.height}}function mh(t,e,n,r,i,s,o,l){return t<=i+o&&i<=t+n&&e<=s+l&&s<=e+r}function vp(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function eE(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y),i=Math.max(t.x+t.width,e.x+e.width)-n,s=Math.max(t.y+t.height,e.y+e.height)-r;return{x:n,y:r,width:i,height:s}}function Nz(t,e){return t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height}function Lz(t,e,n,r){if(t.x>e||t.y>n||t.x<0&&t.y<0&&t.x+t.width>e&&t.y+t.height>n)return;if(t.x>=0&&t.y>=0&&t.x+t.width<=e&&t.y+t.height<=n)return t;const i=-4,s=-4,o=e+4,l=n+4,a=i-t.x,u=t.x+t.width-o,c=s-t.y,f=t.y+t.height-l,d=a>0?t.x+Math.floor(a/r)*r:t.x,h=u>0?t.x+t.width-Math.floor(u/r)*r:t.x+t.width,p=c>0?t.y+Math.floor(c/r)*r:t.y,m=f>0?t.y+t.height-Math.floor(f/r)*r:t.y+t.height;return{x:d,y:p,width:h-d,height:m-p}}function Fz(t,e,n,r,i){const[s,o,l,a]=e,[u,c,f,d]=i,{x:h,y:p,width:m,height:b}=t,v=[];if(m<=0||b<=0)return v;const g=h+m,y=p+b,k=hl,T=p+b>a,E=h>=s&&hs&&g<=l||hl,M=p>=o&&po&&y<=a||pa;if(E&&M){const _=Math.max(h,s),O=Math.max(p,o),N=Math.min(g,l),D=Math.min(y,a);v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:u,y:c,width:f-u+1,height:d-c+1}})}if(k&&x){const _=h,O=p,N=Math.min(g,s),D=Math.min(y,o);v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:0,y:0,width:u+1,height:c+1}})}if(x&&E){const _=Math.max(h,s),O=p,N=Math.min(g,l),D=Math.min(y,o);v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:u,y:0,width:f-u+1,height:c+1}})}if(x&&C){const _=Math.max(h,l),O=p,N=g,D=Math.min(y,o);v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:f,y:0,width:n-f+1,height:c+1}})}if(k&&M){const _=h,O=Math.max(p,o),N=Math.min(g,s),D=Math.min(y,a);v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:0,y:c,width:u+1,height:d-c+1}})}if(C&&M){const _=Math.max(h,l),O=Math.max(p,o),N=g,D=Math.min(y,a);v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:f,y:c,width:n-f+1,height:d-c+1}})}if(k&&T){const _=h,O=Math.max(p,a),N=Math.min(g,s),D=y;v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:0,y:d,width:u+1,height:r-d+1}})}if(T&&E){const _=Math.max(h,s),O=Math.max(p,a),N=Math.min(g,l),D=y;v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:u,y:d,width:f-u+1,height:r-d+1}})}if(C&&T){const _=Math.max(h,l),O=Math.max(p,a),N=g,D=y;v.push({rect:{x:_,y:O,width:N-_,height:D-O},clip:{x:f,y:d,width:n-f+1,height:r-d+1}})}return v}const Bz={kind:Se.Loading,allowOverlay:!1};function qb(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,v,g,y,k,x,C,T,E,M,P,_,O,N,D,oe,Q,te,j){let Y=(y==null?void 0:y.size)??Number.MAX_SAFE_INTEGER;const U=performance.now();let A=N.baseFontFull;t.font=A;const L={ctx:t},I=[0,0],H=b>0?yl(a,b,u):0;let B,ce;const we=QT(g);return Mo(e,l,s,o,i,(fe,De,Ze,rt,ct)=>{const ot=Math.max(0,rt-De),Ne=De+ot,Ye=i+1,jt=fe.width-ot,Pe=r-i-1;if(g.length>0){let ft=!1;for(let vt=0;vt{t.save(),t.beginPath(),t.rect(Ne,Ye,jt,Pe),t.clip()},He=k.columns.hasIndex(fe.sourceIndex),Le=f(fe.group??"").overrideTheme,it=fe.themeOverride===void 0&&Le===void 0?N:yo(N,Le,fe.themeOverride),je=it.baseFontFull;je!==A&&(A=je,t.font=je),pe();let yt;return yp(ct,Ze,r,a,u,b,v,we,(ft,vt,he,st,lt)=>{var Nt,Mt,Un;if(vt<0||(I[0]=fe.sourceIndex,I[1]=vt,y!==void 0&&!y.has(I)))return;if(g.length>0){let ut=!1;for(let Vt=0;VtFe.span!==void 0&&ut>=Fe.span[0]&&ut<=Fe.span[1]);ye&&!p&&m?de=0:ye&&m&&(de=Math.max(de,1)),dt&&de++,ye||(ne&&de++,He&&!lt&&de++);const _e=Fe.kind===Se.Protected?ee.bgCellMedium:ee.bgCell;let Ke;if((st||_e!==N.bgCell)&&(Ke=Nr(_e,Ke)),de>0||Je){Je&&(Ke=Nr(ee.bgHeader,Ke));for(let ut=0;utj&&!dn){const ut=ee.baseFontFull;ut!==A&&(t.font=ut,A=ut),yt=tE(t,Fe,fe.sourceIndex,vt,Ie,Et,et,ft,wt,he,de>0,ee,Ke??ee.bgCell,T,E,(Wt==null?void 0:Wt.hoverAmount)??0,P,O,U,_,yt,D,oe,Q,te)}return me&&t.restore(),Fe.style==="faded"&&(t.globalAlpha=1),Y--,Jt&&(t.restore(),(Un=yt==null?void 0:yt.deprep)==null||Un.call(yt,L),yt=void 0,pe(),A=je,t.font=je),Y<=0}),t.restore(),Y<=0}),B}const wu=[0,0],bu={x:0,y:0,width:0,height:0},$g=[void 0,()=>{}];let O0=!1;function zz(){O0=!0}function tE(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,v,g,y,k,x,C,T,E){var oe,Q;let M,P;b!==void 0&&b[0][0]===n&&b[0][1]===r&&(M=b[1][0],P=b[1][1]);let _;wu[0]=n,wu[1]=r,bu.x=o,bu.y=l,bu.width=a,bu.height=u,$g[0]=C.getValue(wu),$g[1]=te=>C.setValue(wu,te),O0=!1;const O={ctx:t,theme:f,col:n,row:r,cell:e,rect:bu,highlighted:c,cellFillColor:d,hoverAmount:m,frameTime:g,hoverX:M,drawState:$g,hoverY:P,imageLoader:h,spriteManager:p,hyperWrapping:v,overrideCursor:M!==void 0?E:void 0,requestAnimationFrame:zz},N=z4(O,e.lastUpdated,g,k,i,s),D=T(e);if(D!==void 0){(k==null?void 0:k.renderer)!==D&&((oe=k==null?void 0:k.deprep)==null||oe.call(k,O),k=void 0);const te=(Q=D.drawPrep)==null?void 0:Q.call(D,O,k);y!==void 0&&!ta(O.cell)?y(O,()=>D.draw(O,e)):D.draw(O,e),_=te===void 0?void 0:{deprep:te==null?void 0:te.deprep,fillStyle:te==null?void 0:te.fillStyle,font:te==null?void 0:te.font,renderer:D}}return(N||O0)&&(x==null||x(wu)),_}function qv(t,e,n,r,i,s,o,l,a=-20,u=-20,c=32,f="center",d="square"){const h=Math.floor(i+o/2),p=d==="circle"?1e4:e.roundingRadius??4;let m=CT(c,o,e.cellVerticalPadding),b=m/2;const v=ST(f,r,s,e.cellHorizontalPadding,m),g=kT(v,h,m),y=TT(r+a,i+u,g);switch(n){case!0:{t.beginPath(),rs(t,v-m/2,h-m/2,m,m,p),d==="circle"&&(b*=.8,m*=.8),t.fillStyle=l?e.accentColor:e.textMedium,t.fill(),t.beginPath(),t.moveTo(v-b+m/4.23,h-b+m/1.97),t.lineTo(v-b+m/2.42,h-b+m/1.44),t.lineTo(v-b+m/1.29,h-b+m/3.25),t.strokeStyle=e.bgCell,t.lineJoin="round",t.lineCap="round",t.lineWidth=1.9,t.stroke();break}case ah:case!1:{t.beginPath(),rs(t,v-m/2+.5,h-m/2+.5,m-1,m-1,p),t.lineWidth=1,t.strokeStyle=y?e.textDark:e.textMedium,t.stroke();break}case Lv:{t.beginPath(),rs(t,v-m/2,h-m/2,m,m,p),t.fillStyle=y?e.textMedium:e.textLight,t.fill(),d==="circle"&&(b*=.8,m*=.8),t.beginPath(),t.moveTo(v-m/3,h),t.lineTo(v+m/3,h),t.strokeStyle=e.bgCell,t.lineCap="round",t.lineWidth=1.9,t.stroke();break}default:Sc()}}function $z(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,v,g){const y=o+l;if(y<=0)return;t.fillStyle=f.bgHeader,t.fillRect(0,0,i,y);const[k,x]=(r==null?void 0:r[0])??[],C=f.headerFontFull;t.font=C,Mo(e,0,s,0,y,(T,E,M,P)=>{var L;if(b!==void 0&&!b.has([T.sourceIndex,-1]))return;const _=Math.max(0,P-E);t.save(),t.beginPath(),t.rect(E+_,l,T.width-_,o),t.clip();const O=m(T.group??"").overrideTheme,N=T.themeOverride===void 0&&O===void 0?f:yo(f,O,T.themeOverride);N.bgHeader!==f.bgHeader&&(t.fillStyle=N.bgHeader,t.fill()),N!==f&&(t.font=N.baseFontFull);const D=c.columns.hasIndex(T.sourceIndex),oe=a!==void 0||u,Q=!oe&&x===-1&&k===T.sourceIndex,te=oe?0:((L=h.find(I=>I.item[0]===T.sourceIndex&&I.item[1]===-1))==null?void 0:L.hoverAmount)??0,j=(c==null?void 0:c.current)!==void 0&&c.current.cell[0]===T.sourceIndex,Y=D?N.accentColor:j?N.bgHeaderHasFocus:N.bgHeader,U=n?l:0,A=T.sourceIndex===0?0:1;D?(t.fillStyle=Y,t.fillRect(E+A,U,T.width-A,o)):(j||te>0)&&(t.beginPath(),t.rect(E+A,U,T.width-A,o),j&&(t.fillStyle=N.bgHeaderHasFocus,t.fill()),te>0&&(t.globalAlpha=te,t.fillStyle=N.bgHeaderHovered,t.fill(),t.globalAlpha=1)),iE(t,E,U,T.width,o,T,D,N,Q,j,te,d,v,g),t.restore()}),n&&Hz(t,e,i,s,l,r,f,d,h,p,m,b)}function Hz(t,e,n,r,i,s,o,l,a,u,c,f){const[h,p]=(s==null?void 0:s[0])??[];let m=0;JT(e,n,r,i,(b,v,g,y,k,x)=>{if(f!==void 0&&!f.hasItemInRectangle({x:b[0],y:-2,width:b[1]-b[0]+1,height:1}))return;t.save(),t.beginPath(),t.rect(g,y,k,x),t.clip();const C=c(v),T=(C==null?void 0:C.overrideTheme)===void 0?o:yo(o,C.overrideTheme),E=p===-2&&h!==void 0&&h>=b[0]&&h<=b[1],M=E?T.bgHeaderHovered:T.bgHeader;if(M!==o.bgHeader&&(t.fillStyle=M,t.fill()),t.fillStyle=T.textGroupHeader??T.textHeader,C!==void 0){let P=g;if(C.icon!==void 0&&(l.drawSprite(C.icon,"normal",t,P+8,(i-20)/2,20,T),P+=26),t.fillText(C.name,P+8,i/2+Is(t,o.headerFontFull)),C.actions!==void 0&&E){const _=rE({x:g,y,width:k,height:x},C.actions);t.beginPath();const O=_[0].x-10,N=g+k-O;t.rect(O,0,N,i);const D=t.createLinearGradient(O,0,O+N,0),oe=ll(M,0);D.addColorStop(0,oe),D.addColorStop(10/N,M),D.addColorStop(1,M),t.fillStyle=D,t.fill(),t.globalAlpha=.6;const[Q,te]=(s==null?void 0:s[1])??[-1,-1];for(let j=0;j35){const k=d?35:r-35,x=d?35*.7:r-35*.7,C=k/r,T=x/r,E=t.createLinearGradient(e,0,e+r,0),M=ll(m,0);E.addColorStop(d?1:0,m),E.addColorStop(C,m),E.addColorStop(T,M),E.addColorStop(d?0:1,M),t.fillStyle=E}else t.fillStyle=m;if(d&&(t.textAlign="right"),t.fillText(s.title,g,n+i/2+Is(t,l.headerFontFull)),d&&(t.textAlign="left"),b&&s.hasMenu===!0)if(s.menuIcon===void 0||s.menuIcon===uh.Triangle){t.beginPath();const y=h.x+h.width/2-5.5,k=h.y+h.height/2-3;W4(t,[{x:y,y:k},{x:y+11,y:k},{x:y+5.5,y:k+6}],1),t.fillStyle=m,t.fill()}else if(s.menuIcon===uh.Dots){t.beginPath();const y=h.x+h.width/2,k=h.y+h.height/2;j4(t,y,k),t.fillStyle=m,t.fill()}else{const y=h.x+(h.width-l.headerIconSize)/2,k=h.y+(h.height-l.headerIconSize)/2;c.drawSprite(s.menuIcon,"normal",t,y,k,l.headerIconSize,l)}}function iE(t,e,n,r,i,s,o,l,a,u,c,f,d,h){const p=jv(s.title)==="rtl",m=nE(e,n,r,i,p);d!==void 0?d({ctx:t,theme:l,rect:{x:e,y:n,width:r,height:i},column:s,columnIndex:s.sourceIndex,isSelected:o,hoverAmount:c,isHovered:a,hasSelectedCell:u,spriteManager:f,menuBounds:m},()=>Qb(t,e,n,r,i,s,o,l,a,c,f,h,p,m)):Qb(t,e,n,r,i,s,o,l,a,c,f,h,p,m)}var jz=gl,Wz=function(){try{var t=jz(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Vz=Wz,Jb=Vz;function Uz(t,e,n){e=="__proto__"&&Jb?Jb(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var Kz=Uz;function Xz(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++il))return!1;var u=s.get(t),c=s.get(e);if(u&&c)return u==e&&c==t;var f=-1,d=!0,h=n&eH?new q5:void 0;for(s.set(t,e),s.set(e,t);++f{if(k!==e[e.length-1])return;x+=k.width;const M=Math.max(x,T);M>r||(t.save(),t.beginPath(),t.rect(M,s+1,1e4,i-s-1),t.clip(),yp(E,C,i,u,c,p,m,y,(P,_,O,N)=>{if(!N&&b.length>0&&!b.some(j=>mh(x,P,1e4,O,j.x,j.y,j.width,j.height)))return;const D=d.hasIndex(_),oe=h.hasIndex(_);t.beginPath();const Q=f==null?void 0:f(_),te=Q===void 0?g:yo(g,Q);te.bgCell!==g.bgCell&&(t.fillStyle=te.bgCell,t.fillRect(x,P,1e4,O)),oe&&(t.fillStyle=te.bgHeader,t.fillRect(x,P,1e4,O)),D&&(t.fillStyle=te.accentLight,t.fillRect(x,P,1e4,O))}),t.restore())})}function U8(t,e,n,r,i,s,o,l,a){let u=!1;for(const p of e)if(!p.sticky){u=o(p.sourceIndex);break}const c=a.horizontalBorderColor??a.borderColor,f=a.borderColor,d=u?Aa(e):0;let h;if(d!==0&&(h=Hb(f,a.bgCell),t.beginPath(),t.moveTo(d+.5,0),t.lineTo(d+.5,r),t.strokeStyle=h,t.stroke()),i>0){const p=f===c&&h!==void 0?h:Hb(c,a.bgCell),m=yl(s,i,l);t.beginPath(),t.moveTo(0,r-m+.5),t.lineTo(n,r-m+.5),t.strokeStyle=p,t.stroke()}}const gE=(t,e,n)=>{let r=0,i=e,s=0,o=n;if(t!==void 0&&t.length>0){r=Number.MAX_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;for(const l of t)r=Math.min(r,l.x-1),i=Math.max(i,l.x+l.width+1),s=Math.min(s,l.y-1),o=Math.max(o,l.y+l.height+1)}return{minX:r,maxX:i,minY:s,maxY:o}};function K8(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p){var O;const m=p.bgCell,{minX:b,maxX:v,minY:g,maxY:y}=gE(l,s,o),k=[],x=o-yl(h,d,u);let C=a,T=n,E=0;for(;C+i=g&&N<=y-1){const oe=c==null?void 0:c(T),Q=oe==null?void 0:oe.bgCell;Q!==void 0&&Q!==m&&T>=h-d&&k.push({x:b,y:N,w:v-b,h:D,color:Q})}C+=D,T0)for(let N=0;N=b&&oe<=v&&f(N+1)&&k.push({x:oe,y:E,w:D.width,h:P,color:Q}),M+=D.width}if(k.length===0)return;let _;t.beginPath();for(let N=k.length-1;N>=0;N--){const D=k[N];_===void 0?_=D.color:D.color!==_&&(t.fillStyle=_,t.fill(),t.beginPath(),_=D.color),t.rect(D.x,D.y,D.w,D.h)}_!==void 0&&(t.fillStyle=_,t.fill()),t.beginPath()}function vx(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,v=!1){if(a!==void 0){t.beginPath(),t.save(),t.rect(0,0,s,o);for(const O of a)t.rect(O.x+1,O.y+1,O.width-1,O.height-1);t.clip("evenodd")}const g=b.horizontalBorderColor??b.borderColor,y=b.borderColor,{minX:k,maxX:x,minY:C,maxY:T}=gE(l,s,o),E=[];t.beginPath();let M=.5;for(let O=0;O=k&&D<=x&&h(O+1)&&E.push({x1:D,y1:Math.max(u,C),x2:D,y2:Math.min(o,T),color:y})}let P=o+.5;for(let O=m-p;O=C&&oe<=T-1){const Q=d==null?void 0:d(N);E.push({x1:k,y1:oe,x2:x,y2:oe,color:(Q==null?void 0:Q.horizontalBorderColor)??(Q==null?void 0:Q.borderColor)??g})}O+=f(N),N++}}const _=W8(E,O=>O.color);for(const O of Object.keys(_)){t.strokeStyle=O;for(const N of _[O])t.moveTo(N.x1,N.y1),t.lineTo(N.x2,N.y2);t.stroke(),t.beginPath()}a!==void 0&&t.restore()}function X8(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,v,g){const y=[];t.imageSmoothingEnabled=!1;const k=Math.min(i.cellYOffset,o),x=Math.max(i.cellYOffset,o);let C=0;if(typeof v=="number")C+=(x-k)*v;else for(let D=k;Di.cellYOffset&&(C=-C),C+=a-i.translateY;const T=Math.min(i.cellXOffset,s),E=Math.max(i.cellXOffset,s);let M=0;for(let D=T;Di.cellXOffset&&(M=-M),M+=l-i.translateX;const P=Aa(b);if(M!==0&&C!==0)return{regions:[]};const _=u>0?yl(d,u,v):0,O=c-P-Math.abs(M),N=f-h-_-Math.abs(C)-1;if(O>150&&N>150){const D={sx:0,sy:0,sw:c*p,sh:f*p,dx:0,dy:0,dw:c*p,dh:f*p};if(C>0?(D.sy=(h+1)*p,D.sh=N*p,D.dy=(C+h+1)*p,D.dh=N*p,y.push({x:0,y:h,width:c,height:C+1})):C<0&&(D.sy=(-C+h+1)*p,D.sh=N*p,D.dy=(h+1)*p,D.dh=N*p,y.push({x:0,y:f+C-_,width:c,height:-C+_})),M>0?(D.sx=P*p,D.sw=O*p,D.dx=(M+P)*p,D.dw=O*p,y.push({x:P-1,y:0,width:M+2,height:f})):M<0&&(D.sx=(P-M)*p,D.sw=O*p,D.dx=P*p,D.dw=O*p,y.push({x:c+M,y:0,width:-M,height:f})),t.setTransform(1,0,0,1,0,0),g){if(P>0&&M!==0&&C===0&&(r===void 0||(n==null?void 0:n[1])!==!1)){const oe=P*p,Q=f*p;t.drawImage(e,0,0,oe,Q,0,0,oe,Q)}if(_>0&&M===0&&C!==0&&(r===void 0||(n==null?void 0:n[0])!==!1)){const oe=(f-_)*p,Q=c*p,te=_*p;t.drawImage(e,0,oe,Q,te,0,oe,Q,te)}}t.drawImage(e,D.sx,D.sy,D.sw,D.sh,D.dx,D.dy,D.dw,D.dh),t.scale(p,p)}return t.imageSmoothingEnabled=!0,{regions:y}}function G8(t,e,n,r,i,s,o,l,a,u){const c=[];return e!==t.cellXOffset||n!==t.cellYOffset||r!==t.translateX||i!==t.translateY||Mo(a,n,r,i,l,(f,d,h,p)=>{if(f.sourceIndex===u){const m=Math.max(d,p)+1;return c.push({x:m,y:0,width:s-m,height:o}),!0}}),c}function Y8(t,e){if(e===void 0||t.width!==e.width||t.height!==e.height||t.theme!==e.theme||t.headerHeight!==e.headerHeight||t.rowHeight!==e.rowHeight||t.rows!==e.rows||t.freezeColumns!==e.freezeColumns||t.getRowThemeOverride!==e.getRowThemeOverride||t.isFocused!==e.isFocused||t.isResizing!==e.isResizing||t.verticalBorder!==e.verticalBorder||t.getCellContent!==e.getCellContent||t.highlightRegions!==e.highlightRegions||t.selection!==e.selection||t.dragAndDropState!==e.dragAndDropState||t.prelightCells!==e.prelightCells||t.touchMode!==e.touchMode||t.maxScaleFactor!==e.maxScaleFactor)return!1;if(t.mappedColumns!==e.mappedColumns){if(t.mappedColumns.length>100||t.mappedColumns.length!==e.mappedColumns.length)return!1;let n;for(let r=0;rT.style!=="no-outline");if(b===void 0||b.length===0)return;const v=Aa(l),g=yl(h,d,f),y=[a,0,l.length,h-d],k=[v,0,e,n-g],x=b.map(T=>{const E=T.range,M=T.style??"dashed";return Fz(E,y,e,n,k).map(P=>{const _=P.rect,O=M0(_.x,_.y,e,n,c,u+c,r,i,s,o,h,a,d,l,f),N=_.width===1&&_.height===1?O:M0(_.x+_.width-1,_.y+_.height-1,e,n,c,u+c,r,i,s,o,h,a,d,l,f);return _.x+_.width>=l.length&&(N.width-=1),_.y+_.height>=h&&(N.height-=1),{color:T.color,style:M,clip:P.clip,rect:Lz({x:O.x,y:O.y,width:N.x+N.width-O.x,height:N.y+N.height-O.y},e,n,8)}})}),C=()=>{t.lineWidth=1;let T=!1;for(const E of x)for(const M of E)if((M==null?void 0:M.rect)!==void 0&&mh(0,0,e,n,M.rect.x,M.rect.y,M.rect.width,M.rect.height)){const P=T,_=!Nz(M.clip,M.rect);_&&(t.save(),t.rect(M.clip.x,M.clip.y,M.clip.width,M.clip.height),t.clip()),M.style==="dashed"&&!T?(t.setLineDash([5,3]),T=!0):(M.style==="solid"||M.style==="solid-outline")&&T&&(t.setLineDash([]),T=!1),t.strokeStyle=M.style==="solid-outline"?Nr(Nr(M.color,m.borderColor),m.bgCell):ll(M.color,1),t.strokeRect(M.rect.x+.5,M.rect.y+.5,M.rect.width-1,M.rect.height-1),_&&(t.restore(),T=P)}T&&t.setLineDash([])};return C(),C}function bx(t,e,n,r,i){t.beginPath(),t.moveTo(e,n),t.lineTo(e,r),t.lineWidth=2,t.strokeStyle=i,t.stroke(),t.globalAlpha=1}function Wg(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b){if(c.current===void 0)return;const v=c.current.range,g=c.current.cell,y=[v.x+v.width-1,v.y+v.height-1];if(g[1]>=b&&y[1]>=b||!o.some(D=>D.sourceIndex===g[0]||D.sourceIndex===y[0]))return;const[x,C]=c.current.cell,T=d(c.current.cell),E=T.span??[x,x],M=C>=b-h,P=h>0&&!M?yl(b,h,f)-1:0,_=y[1];let O;if(Mo(o,r,i,s,u,(D,oe,Q,te,j)=>{if(D.sticky&&x>D.sourceIndex)return;const Y=D.sourceIndexE[1],A=D.sourceIndex===y[0];if(!(!A&&(Y||U)))return yp(j,Q,n,b,f,h,p,void 0,(L,I,H)=>{if(I!==C&&I!==_)return;let B=oe,ce=D.width;if(T.span!==void 0){const fe=ZT(T.span,oe,L,D.width,H,D,l),De=D.sticky?fe[0]:fe[1];De!==void 0&&(B=De.x,ce=De.width)}return I===_&&A&&m&&(O=()=>{var fe;te>B&&!D.sticky&&(t.beginPath(),t.rect(te,0,e-te,n),t.clip()),t.beginPath(),t.rect(B+ce-4,L+H-4,4,4),t.fillStyle=((fe=D.themeOverride)==null?void 0:fe.accentColor)??a.accentColor,t.fill()}),O!==void 0}),O!==void 0}),O===void 0)return;const N=()=>{t.save(),t.beginPath(),t.rect(0,u,e,n-u-P),t.clip(),O==null||O(),t.restore()};return N(),N}function q8(t,e,n,r,i,s,o,l,a){a===void 0||a.size===0||(t.beginPath(),JT(e,n,s,r,(u,c,f,d,h,p)=>{a.hasItemInRectangle({x:u[0],y:-2,width:u[1]-u[0]+1,height:1})&&t.rect(f,d,h,p)}),Mo(e,l,s,o,i,(u,c,f,d)=>{const h=Math.max(0,d-c),p=c+h+1,m=u.width-h-1;a.has([u.sourceIndex,-1])&&t.rect(p,r,m,i-r)}),t.clip())}function Q8(t,e,n,r,i,s,o,l,a,u){let c=0;return Mo(t,s,r,i,n,(f,d,h,p,m)=>(yp(m,h,e,o,l,a,u,void 0,(b,v,g,y)=>{y||(c=Math.max(v,c))}),!0)),c}function xx(t,e){var me;const{canvasCtx:n,headerCanvasCtx:r,width:i,height:s,cellXOffset:o,cellYOffset:l,translateX:a,translateY:u,mappedColumns:c,enableGroups:f,freezeColumns:d,dragAndDropState:h,theme:p,drawFocus:m,headerHeight:b,groupHeaderHeight:v,disabledRows:g,rowHeight:y,verticalBorder:k,overrideCursor:x,isResizing:C,selection:T,fillHandle:E,freezeTrailingRows:M,rows:P,getCellContent:_,getGroupDetails:O,getRowThemeOverride:N,isFocused:D,drawHeaderCallback:oe,prelightCells:Q,drawCellCallback:te,highlightRegions:j,resizeCol:Y,imageLoader:U,lastBlitData:A,hoverValues:L,hyperWrapping:I,hoverInfo:H,spriteManager:B,maxScaleFactor:ce,hasAppendRow:we,touchMode:fe,enqueue:De,renderStateProvider:Ze,getCellRenderer:rt,renderStrategy:ct,bufferACtx:ot,bufferBCtx:Ne,damage:Ye,minimumCellWidth:jt}=t;if(i===0||s===0)return;const Pe=ct==="double-buffer",pe=Math.min(ce,Math.ceil(window.devicePixelRatio??1)),He=ct!=="direct"&&Y8(t,e),Le=n.canvas;(Le.width!==i*pe||Le.height!==s*pe)&&(Le.width=i*pe,Le.height=s*pe,Le.style.width=i+"px",Le.style.height=s+"px");const it=r.canvas,je=f?v+b:b,yt=je+1;(it.width!==i*pe||it.height!==yt*pe)&&(it.width=i*pe,it.height=yt*pe,it.style.width=i+"px",it.style.height=yt+"px");const ft=ot.canvas,vt=Ne.canvas;Pe&&(ft.width!==i*pe||ft.height!==s*pe)&&(ft.width=i*pe,ft.height=s*pe,A.current!==void 0&&(A.current.aBufferScroll=void 0)),Pe&&(vt.width!==i*pe||vt.height!==s*pe)&&(vt.width=i*pe,vt.height=s*pe,A.current!==void 0&&(A.current.bBufferScroll=void 0));const he=A.current;if(He===!0&&o===(he==null?void 0:he.cellXOffset)&&l===(he==null?void 0:he.cellYOffset)&&a===(he==null?void 0:he.translateX)&&u===(he==null?void 0:he.translateY))return;let st=null;Pe&&(st=n);const lt=r;let ne;Pe?Ye!==void 0?ne=(he==null?void 0:he.lastBuffer)==="b"?Ne:ot:ne=(he==null?void 0:he.lastBuffer)==="b"?ot:Ne:ne=n;const Je=ne.canvas,Fe=Pe?Je===ft?vt:ft:Le,et=typeof y=="number"?()=>y:y;lt.save(),ne.save(),lt.beginPath(),ne.beginPath(),lt.textBaseline="middle",ne.textBaseline="middle",pe!==1&&(lt.scale(pe,pe),ne.scale(pe,pe));const wt=A0(c,o,i,h,a);let Jt=[];const dn=m&&((me=T.current)==null?void 0:me.cell[1])===l&&u===0;let G=!1;if(j!==void 0){for(const Ie of j)if(Ie.style!=="no-outline"&&Ie.range.y===l&&u===0){G=!0;break}}const be=()=>{$z(lt,wt,f,H,i,a,b,v,h,C,T,p,B,L,k,O,Ye,oe,fe),vx(lt,wt,l,a,u,i,s,void 0,void 0,v,je,et,N,k,M,P,p,!0),lt.beginPath(),lt.moveTo(0,yt-.5),lt.lineTo(i,yt-.5),lt.strokeStyle=Nr(p.headerBottomBorderColor??p.horizontalBorderColor??p.borderColor,p.bgHeader),lt.stroke(),G&&wx(lt,i,s,o,l,a,u,c,d,b,v,y,M,P,j,p),dn&&Wg(lt,i,s,l,a,u,wt,c,p,je,T,et,_,M,we,E,P)};if(Ye!==void 0){const Ie=wt[wt.length-1].sourceIndex+1,Et=Ye.hasItemInRegion([{x:o,y:-2,width:Ie,height:2},{x:o,y:l,width:Ie,height:300},{x:0,y:l,width:d,height:300},{x:0,y:-2,width:d,height:2},{x:o,y:P-M,width:Ie,height:M,when:M>0}]),Wt=Nt=>{qb(Nt,wt,c,s,je,a,u,l,P,et,_,O,N,g,D,m,M,we,Jt,Ye,T,Q,j,U,B,L,H,te,I,p,De,Ze,rt,x,jt);const Mt=T.current;E&&m&&Mt!==void 0&&Ye.has(NT(Mt.range))&&Wg(Nt,i,s,l,a,u,wt,c,p,je,T,et,_,M,we,E,P)};Et&&(Wt(ne),st!==null&&(st.save(),st.scale(pe,pe),st.textBaseline="middle",Wt(st),st.restore()),Ye.hasHeader()&&(q8(lt,wt,i,v,je,a,u,l,Ye),be())),ne.restore(),lt.restore();return}if((He!==!0||o!==(he==null?void 0:he.cellXOffset)||a!==(he==null?void 0:he.translateX)||dn!==(he==null?void 0:he.mustDrawFocusOnHeader)||G!==(he==null?void 0:he.mustDrawHighlightRingsOnHeader))&&be(),He===!0){_r(Fe!==void 0&&he!==void 0);const{regions:Ie}=X8(ne,Fe,Fe===ft?he.aBufferScroll:he.bBufferScroll,Fe===ft?he.bBufferScroll:he.aBufferScroll,he,o,l,a,u,M,i,s,P,je,pe,c,wt,y,Pe);Jt=Ie}else He!==!1&&(_r(he!==void 0),Jt=G8(he,o,l,a,u,i,s,je,wt,He));U8(ne,wt,i,s,M,P,k,et,p);const ee=wx(ne,i,s,o,l,a,u,c,d,b,v,y,M,P,j,p),ye=m?Wg(ne,i,s,l,a,u,wt,c,p,je,T,et,_,M,we,E,P):void 0;if(ne.fillStyle=p.bgCell,Jt.length>0){ne.beginPath();for(const Ie of Jt)ne.rect(Ie.x,Ie.y,Ie.width,Ie.height);ne.clip(),ne.fill(),ne.beginPath()}else ne.fillRect(0,0,i,s);const de=qb(ne,wt,c,s,je,a,u,l,P,et,_,O,N,g,D,m,M,we,Jt,Ye,T,Q,j,U,B,L,H,te,I,p,De,Ze,rt,x,jt);V8(ne,wt,c,i,s,je,a,u,l,P,et,N,T.rows,g,M,we,Jt,Ye,p),K8(ne,wt,l,a,u,i,s,Jt,je,et,N,k,M,P,p),vx(ne,wt,l,a,u,i,s,Jt,de,v,je,et,N,k,M,P,p),ee==null||ee(),ye==null||ye(),C&&Mo(wt,0,a,0,je,(Ie,Et)=>Ie.sourceIndex===Y?(bx(lt,Et+Ie.width,0,je+1,Nr(p.resizeIndicatorColor??p.accentLight,p.bgHeader)),bx(ne,Et+Ie.width,je,s,Nr(p.resizeIndicatorColor??p.accentLight,p.bgCell)),!0):!1),st!==null&&(st.fillStyle=p.bgCell,st.fillRect(0,0,i,s),st.drawImage(ne.canvas,0,0));const dt=Q8(wt,s,je,a,u,l,P,et,M,we);U==null||U.setWindow({x:o,y:l,width:wt.length,height:dt-l},d,Array.from({length:M},(Ie,Et)=>P-1-Et));const _e=he!==void 0&&(o!==he.cellXOffset||a!==he.translateX),Ke=he!==void 0&&(l!==he.cellYOffset||u!==he.translateY);A.current={cellXOffset:o,cellYOffset:l,translateX:a,translateY:u,mustDrawFocusOnHeader:dn,mustDrawHighlightRingsOnHeader:G,lastBuffer:Pe?Je===ft?"a":"b":void 0,aBufferScroll:Je===ft?[_e,Ke]:he==null?void 0:he.aBufferScroll,bBufferScroll:Je===vt?[_e,Ke]:he==null?void 0:he.bBufferScroll},ne.restore(),lt.restore()}const J8=80;function Z8(t){const e=t-1;return e*e*e+1}class eW{constructor(e){bt(this,"callback");bt(this,"currentHoveredItem");bt(this,"leavingItems",[]);bt(this,"lastAnimationTime");bt(this,"addToLeavingItems",e=>{this.leavingItems.some(r=>qu(r.item,e.item))||this.leavingItems.push(e)});bt(this,"removeFromLeavingItems",e=>{const n=this.leavingItems.find(r=>qu(r.item,e));return this.leavingItems=this.leavingItems.filter(r=>r!==n),(n==null?void 0:n.hoverAmount)??0});bt(this,"cleanUpLeavingElements",()=>{this.leavingItems=this.leavingItems.filter(e=>e.hoverAmount>0)});bt(this,"shouldStep",()=>{const e=this.leavingItems.length>0,n=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return e||n});bt(this,"getAnimatingItems",()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(e=>({...e,hoverAmount:Z8(e.hoverAmount)})));bt(this,"step",e=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=e;else{const r=(e-this.lastAnimationTime)/J8;for(const s of this.leavingItems)s.hoverAmount=xi(s.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=xi(this.currentHoveredItem.hoverAmount+r,0,1));const i=this.getAnimatingItems();this.callback(i),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=e,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0});bt(this,"setHovered",e=>{var n;if(!qu((n=this.currentHoveredItem)==null?void 0:n.item,e)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),e!==void 0){const r=this.removeFromLeavingItems(e);this.currentHoveredItem={item:e,hoverAmount:r}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}});this.callback=e}}class tW{constructor(e){bt(this,"fn");bt(this,"val");this.fn=e}get value(){return this.val??(this.val=this.fn())}}function Jv(t){return new tW(t)}const nW=Jv(()=>window.navigator.userAgent.includes("Firefox")),wh=Jv(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),bh=Jv(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function rW(t){const e=w.useRef([]),n=w.useRef(0),r=w.useRef(t);r.current=t;const i=w.useCallback(()=>{const s=()=>window.requestAnimationFrame(o),o=()=>{const l=e.current.map(Xv);e.current=[],r.current(new Ju(l)),e.current.length>0?n.current++:n.current=0};window.requestAnimationFrame(n.current>600?s:o)},[]);return w.useCallback(s=>{e.current.length===0&&i();const o=ki(s[0],s[1]);e.current.includes(o)||e.current.push(o)},[i])}const Xs="header",Dr="group-header",xh="out-of-bounds";var ra;(function(t){t[t.Start=-2]="Start",t[t.StartPadding=-1]="StartPadding",t[t.Center=0]="Center",t[t.EndPadding=1]="EndPadding",t[t.End=2]="End"})(ra||(ra={}));function mE(t,e){return t===e?!0:(t==null?void 0:t.kind)==="out-of-bounds"?(t==null?void 0:t.kind)===(e==null?void 0:e.kind)&&(t==null?void 0:t.location[0])===(e==null?void 0:e.location[0])&&(t==null?void 0:t.location[1])===(e==null?void 0:e.location[1])&&(t==null?void 0:t.region[0])===(e==null?void 0:e.region[0])&&(t==null?void 0:t.region[1])===(e==null?void 0:e.region[1]):(t==null?void 0:t.kind)===(e==null?void 0:e.kind)&&(t==null?void 0:t.location[0])===(e==null?void 0:e.location[0])&&(t==null?void 0:t.location[1])===(e==null?void 0:e.location[1])}const kx=6,iW=(t,e)=>{if(t.kind===Se.Custom)return t.copyData;const n=e==null?void 0:e(t);return(n==null?void 0:n.getAccessibilityString(t))??""},sW=(t,e)=>{const{width:n,height:r,accessibilityHeight:i,columns:s,cellXOffset:o,cellYOffset:l,headerHeight:a,fillHandle:u=!1,groupHeaderHeight:c,rowHeight:f,rows:d,getCellContent:h,getRowThemeOverride:p,onHeaderMenuClick:m,enableGroups:b,isFilling:v,onCanvasFocused:g,onCanvasBlur:y,isFocused:k,selection:x,freezeColumns:C,onContextMenu:T,freezeTrailingRows:E,fixedShadowX:M=!0,fixedShadowY:P=!0,drawFocusRing:_,onMouseDown:O,onMouseUp:N,onMouseMoveRaw:D,onMouseMove:oe,onItemHovered:Q,dragAndDropState:te,firstColAccessible:j,onKeyDown:Y,onKeyUp:U,highlightRegions:A,canvasRef:L,onDragStart:I,onDragEnd:H,eventTargetRef:B,isResizing:ce,resizeColumn:we,isDragging:fe,isDraggable:De=!1,allowResize:Ze,disabledRows:rt,hasAppendRow:ct,getGroupDetails:ot,theme:Ne,prelightCells:Ye,headerIcons:jt,verticalBorder:Pe,drawCell:pe,drawHeader:He,onCellFocused:Le,onDragOverCell:it,onDrop:je,onDragLeave:yt,imageWindowLoader:ft,smoothScrollX:vt=!1,smoothScrollY:he=!1,experimental:st,getCellRenderer:lt}=t,ne=t.translateX??0,Je=t.translateY??0,Fe=Math.max(C,Math.min(s.length-1,o)),et=w.useRef(null),wt=ft,Jt=w.useRef(),[dn,G]=w.useState(!1),be=w.useRef([]),ee=w.useRef(),[ye,de]=w.useState(),[dt,_e]=w.useState(),Ke=w.useRef(null),[me,Ie]=w.useState(),[Et,Wt]=w.useState(!1),Nt=w.useRef(Et);Nt.current=Et;const Mt=w.useMemo(()=>new Dz(jt,()=>{Ni.current=void 0,Po.current()}),[jt]),Un=b?c+a:a,ut=w.useRef(-1),Vt=((st==null?void 0:st.enableFirefoxRescaling)??!1)&&nW.value,Lt=((st==null?void 0:st.enableSafariRescaling)??!1)&&wh.value;w.useLayoutEffect(()=>{window.devicePixelRatio===1||!Vt&&!Lt||(ut.current!==-1&&G(!0),window.clearTimeout(ut.current),ut.current=window.setTimeout(()=>{G(!1),ut.current=-1},200))},[l,Fe,ne,Je,Vt,Lt]);const Ut=R4(s,C),Fn=M?Aa(Ut,te):0,Zt=w.useCallback(($,ie,xe)=>{const ge=$.getBoundingClientRect();if(ie>=Ut.length||xe>=d)return;const le=ge.width/n,Ae=M0(ie,xe,n,r,c,Un,Fe,l,ne,Je,d,C,E,Ut,f);return le!==1&&(Ae.x*=le,Ae.y*=le,Ae.width*=le,Ae.height*=le),Ae.x+=ge.x,Ae.y+=ge.y,Ae},[n,r,c,Un,Fe,l,ne,Je,d,C,E,Ut,f]),Mn=w.useCallback(($,ie,xe,ge)=>{const le=$.getBoundingClientRect(),Ae=le.width/n,tt=(ie-le.left)/Ae,nt=(xe-le.top)/Ae,Te=5,Dt=A0(Ut,Fe,n,void 0,ne);let Be=0,Ft=0;ge instanceof MouseEvent&&(Be=ge.button,Ft=ge.buttons);const at=D4(tt,Dt,ne),kt=_4(nt,r,b,a,c,d,f,l,Je,E),vn=(ge==null?void 0:ge.shiftKey)===!0,ht=(ge==null?void 0:ge.ctrlKey)===!0,hn=(ge==null?void 0:ge.metaKey)===!0,Vr=ge!==void 0&&!(ge instanceof MouseEvent)||(ge==null?void 0:ge.pointerType)==="touch",ln=[tt<0?-1:nn||nt>r){const Rt=tt>n?1:tt<0?-1:0,wn=nt>r?1:nt<0?-1:0;let Mr=Rt*2,Li=wn*2;Rt===0&&(Mr=at===-1?ra.EndPadding:ra.Center),wn===0&&(Li=kt===void 0?ra.EndPadding:ra.Center);let fi=!1;if(at===-1&&kt===-1){const Do=Zt($,Ut.length-1,-1);_r(Do!==void 0),fi=ien&&ttr&&nt=0?(wn=!0,Rt=Zt($,Mr,kt),_r(Rt!==void 0),Ar={kind:b&&kt===-2?Dr:Xs,location:[Mr,kt],bounds:Rt,group:Ut[Mr].group??"",isEdge:wn,shiftKey:vn,ctrlKey:ht,metaKey:hn,isTouch:Vr,localEventX:ie-Rt.x,localEventY:xe-Rt.y,button:Be,buttons:Ft,scrollEdge:ln}):Ar={kind:b&&kt===-2?Dr:Xs,group:Ut[at].group??"",location:[at,kt],bounds:Rt,isEdge:wn,shiftKey:vn,ctrlKey:ht,metaKey:hn,isTouch:Vr,localEventX:ie-Rt.x,localEventY:xe-Rt.y,button:Be,buttons:Ft,scrollEdge:ln}}else{const Rt=Zt($,at,kt);_r(Rt!==void 0);const wn=Rt!==void 0&&Rt.x+Rt.width-ie{}),Ds=w.useRef(ye);Ds.current=ye;const[us,cs]=w.useMemo(()=>{const $=document.createElement("canvas"),ie=document.createElement("canvas");return $.style.display="none",$.style.opacity="0",$.style.position="fixed",ie.style.display="none",ie.style.opacity="0",ie.style.position="fixed",[$.getContext("2d",{alpha:!1}),ie.getContext("2d",{alpha:!1})]},[]);w.useLayoutEffect(()=>{if(!(us===null||cs===null))return document.documentElement.append(us.canvas),document.documentElement.append(cs.canvas),()=>{us.canvas.remove(),cs.canvas.remove()}},[us,cs]);const vl=w.useMemo(()=>new V4,[]),tf=Vt&&dn?1:Lt&&dn?2:5,nf=(st==null?void 0:st.disableMinimumCellWidth)===!0?1:10,Ni=w.useRef(),wl=w.useRef(null),bl=w.useRef(null),xl=w.useCallback(()=>{var tt;const $=et.current,ie=Ke.current;if($===null||ie===null||(wl.current===null&&(wl.current=$.getContext("2d",{alpha:!1}),$.width=0,$.height=0),bl.current===null&&(bl.current=ie.getContext("2d",{alpha:!1}),ie.width=0,ie.height=0),wl.current===null||bl.current===null||us===null||cs===null))return;let xe=!1;const ge=nt=>{xe=!0,Ie(nt)},le=Ni.current,Ae={headerCanvasCtx:bl.current,canvasCtx:wl.current,bufferACtx:us,bufferBCtx:cs,width:n,height:r,cellXOffset:Fe,cellYOffset:l,translateX:Math.round(ne),translateY:Math.round(Je),mappedColumns:Ut,enableGroups:b,freezeColumns:C,dragAndDropState:te,theme:Ne,headerHeight:a,groupHeaderHeight:c,disabledRows:rt??Ot.empty(),rowHeight:f,verticalBorder:Pe,isResizing:ce,resizeCol:we,isFocused:k,selection:x,fillHandle:u,drawCellCallback:pe,hasAppendRow:ct,overrideCursor:ge,maxScaleFactor:tf,freezeTrailingRows:E,rows:d,drawFocus:_,getCellContent:h,getGroupDetails:ot??(nt=>({name:nt})),getRowThemeOverride:p,drawHeaderCallback:He,prelightCells:Ye,highlightRegions:A,imageLoader:wt,lastBlitData:ee,damage:Jt.current,hoverValues:be.current,hoverInfo:Ds.current,spriteManager:Mt,scrolling:dn,hyperWrapping:(st==null?void 0:st.hyperWrapping)??!1,touchMode:Et,enqueue:ef.current,renderStateProvider:vl,renderStrategy:(st==null?void 0:st.renderStrategy)??(wh.value?"double-buffer":"single-buffer"),getCellRenderer:lt,minimumCellWidth:nf};Ae.damage===void 0?(Ni.current=Ae,xx(Ae,le)):xx(Ae,void 0),!xe&&(Ae.damage===void 0||Ae.damage.has((tt=Ds==null?void 0:Ds.current)==null?void 0:tt[0]))&&Ie(void 0)},[us,cs,n,r,Fe,l,ne,Je,Ut,b,C,te,Ne,a,c,rt,f,Pe,ce,ct,we,k,x,u,E,d,_,tf,h,ot,p,pe,He,Ye,A,wt,Mt,dn,st==null?void 0:st.hyperWrapping,st==null?void 0:st.renderStrategy,Et,vl,lt,nf]),Po=w.useRef(xl);w.useLayoutEffect(()=>{xl(),Po.current=xl},[xl]),w.useLayoutEffect(()=>{(async()=>{var ie;((ie=document==null?void 0:document.fonts)==null?void 0:ie.ready)!==void 0&&(await document.fonts.ready,Ni.current=void 0,Po.current())})()},[]);const _s=w.useCallback($=>{Jt.current=$,Po.current(),Jt.current=void 0},[]),rf=rW(_s);ef.current=rf;const sf=w.useCallback($=>{_s(new Ju($.map(ie=>ie.cell)))},[_s]);wt.setCallback(_s);const[Dp,_p]=w.useState(!1),[kl,fs]=sn??[],Np=kl!==void 0&&fs===-1,Lp=kl!==void 0&&fs===-2;let of=!1,Sl=!1,Tn=me;if(Tn===void 0&&kl!==void 0&&fs!==void 0&&fs>-1&&fs({contain:"strict",display:"block",cursor:lf}),[lf]),qa=w.useRef("default"),Ns=B==null?void 0:B.current;Ns!=null&&qa.current!==Cl.cursor&&(Ns.style.cursor=qa.current=Cl.cursor);const Tr=w.useCallback(($,ie,xe,ge)=>{if(ot===void 0)return;const le=ot($);if(le.actions!==void 0){const Ae=rE(ie,le.actions);for(const[tt,nt]of Ae.entries())if(vp(nt,xe+ie.x,ge+nt.y))return le.actions[tt]}},[ot]),ai=w.useCallback(($,ie,xe,ge)=>{const le=s[ie];if(!fe&&!ce&&le.hasMenu===!0&&!(dt??!1)){const Ae=Zt($,ie,-1);_r(Ae!==void 0);const tt=nE(Ae.x,Ae.y,Ae.width,Ae.height,jv(le.title)==="rtl");if(xe>tt.x&&xett.y&&ge{const ie=et.current,xe=B==null?void 0:B.current;if(ie===null||$.target!==ie&&$.target!==xe)return;Ja.current=!0;let ge,le;if($ instanceof MouseEvent?(ge=$.clientX,le=$.clientY):(ge=$.touches[0].clientX,le=$.touches[0].clientY),$.target===xe&&xe!==null){const tt=xe.getBoundingClientRect();if(ge>tt.right||le>tt.bottom)return}const Ae=Mn(ie,ge,le,$);Ls.current=Ae.location,Ae.isTouch&&(Qa.current=Date.now()),Nt.current!==Ae.isTouch&&Wt(Ae.isTouch),!(Ae.kind===Xs&&ai(ie,Ae.location[0],ge,le)!==void 0)&&(Ae.kind===Dr&&Tr(Ae.group,Ae.bounds,Ae.localEventX,Ae.localEventY)!==void 0||(O==null||O(Ae),!Ae.isTouch&&De!==!0&&De!==Ae.kind&&Ae.button<3&&Ae.button!==1&&$.preventDefault()))},[B,De,Mn,Tr,ai,O]);$n("touchstart",ir,window,!1),$n("mousedown",ir,window,!1);const Tl=w.useRef(0),Za=w.useCallback($=>{var Ft,at;const ie=Tl.current;Tl.current=Date.now();const xe=et.current;if(Ja.current=!1,N===void 0||xe===null)return;const ge=B==null?void 0:B.current,le=$.target!==xe&&$.target!==ge;let Ae,tt,nt=!0;if($ instanceof MouseEvent){if(Ae=$.clientX,tt=$.clientY,nt=$.button<3,$.pointerType==="touch")return}else Ae=$.changedTouches[0].clientX,tt=$.changedTouches[0].clientY;let Te=Mn(xe,Ae,tt,$);Te.isTouch&&Qa.current!==0&&Date.now()-Qa.current>500&&(Te={...Te,isLongTouch:!0}),ie!==0&&Date.now()-ie<(Te.isTouch?1e3:500)&&(Te={...Te,isDoubleClick:!0}),Nt.current!==Te.isTouch&&Wt(Te.isTouch),!le&&$.cancelable&&nt&&$.preventDefault();const[Dt]=Te.location,Be=ai(xe,Dt,Ae,tt);if(Te.kind===Xs&&Be!==void 0){(Te.button!==0||((Ft=Ls.current)==null?void 0:Ft[0])!==Dt||((at=Ls.current)==null?void 0:at[1])!==-1)&&N(Te,!0);return}else if(Te.kind===Dr){const kt=Tr(Te.group,Te.bounds,Te.localEventX,Te.localEventY);if(kt!==void 0){Te.button===0&&kt.onClick(Te);return}}N(Te,le)},[N,B,Mn,ai,Tr]);$n("mouseup",Za,window,!1),$n("touchend",Za,window,!1);const af=w.useCallback($=>{var Be,Ft;const ie=et.current;if(ie===null)return;const xe=B==null?void 0:B.current,ge=$.target!==ie&&$.target!==xe;let le,Ae,tt=!0;$ instanceof MouseEvent?(le=$.clientX,Ae=$.clientY,tt=$.button<3):(le=$.changedTouches[0].clientX,Ae=$.changedTouches[0].clientY);const nt=Mn(ie,le,Ae,$);Nt.current!==nt.isTouch&&Wt(nt.isTouch),!ge&&$.cancelable&&tt&&$.preventDefault();const[Te]=nt.location,Dt=ai(ie,Te,le,Ae);if(nt.kind===Xs&&Dt!==void 0)nt.button===0&&((Be=Ls.current)==null?void 0:Be[0])===Te&&((Ft=Ls.current)==null?void 0:Ft[1])===-1&&(m==null||m(Te,Dt));else if(nt.kind===Dr){const at=Tr(nt.group,nt.bounds,nt.localEventX,nt.localEventY);at!==void 0&&nt.button===0&&at.onClick(nt)}},[B,Mn,ai,m,Tr]);$n("click",af,window,!1);const Fp=w.useCallback($=>{const ie=et.current,xe=B==null?void 0:B.current;if(ie===null||$.target!==ie&&$.target!==xe||T===void 0)return;const ge=Mn(ie,$.clientX,$.clientY,$);T(ge,()=>{$.cancelable&&$.preventDefault()})},[B,Mn,T]);$n("contextmenu",Fp,(B==null?void 0:B.current)??null,!1);const uf=w.useCallback($=>{Jt.current=new Ju($.map(ie=>ie.item)),be.current=$,Po.current(),Jt.current=void 0},[]),ui=w.useMemo(()=>new eW(uf),[uf]),ds=w.useRef(ui);ds.current=ui,w.useLayoutEffect(()=>{const $=ds.current;if(sn===void 0||sn[1]<0){$.setHovered(sn);return}const ie=h(sn,!0),xe=lt(ie),ge=xe===void 0&&ie.kind===Se.Custom||(xe==null?void 0:xe.needsHover)!==void 0&&(typeof xe.needsHover=="boolean"?xe.needsHover:xe.needsHover(ie));$.setHovered(ge?sn:void 0)},[h,lt,sn]);const Er=w.useRef(),K=w.useCallback($=>{var nt;const ie=et.current;if(ie===null)return;const xe=B==null?void 0:B.current,ge=$.target!==ie&&$.target!==xe,le=Mn(ie,$.clientX,$.clientY,$);if(le.kind!=="out-of-bounds"&&ge&&!Ja.current&&!le.isTouch)return;const Ae=(Te,Dt)=>{de(Be=>Be===Te||(Be==null?void 0:Be[0][0])===(Te==null?void 0:Te[0][0])&&(Be==null?void 0:Be[0][1])===(Te==null?void 0:Te[0][1])&&((Be==null?void 0:Be[1][0])===(Te==null?void 0:Te[1][0])&&(Be==null?void 0:Be[1][1])===(Te==null?void 0:Te[1][1])||!Dt)?Be:Te)};if(!mE(le,Er.current))Ie(void 0),Q==null||Q(le),Ae(le.kind===xh?void 0:[le.location,[le.localEventX,le.localEventY]],!0),Er.current=le;else if(le.kind==="cell"||le.kind===Xs||le.kind===Dr){let Te=!1,Dt=!0;if(le.kind==="cell"){const Ft=h(le.location);Dt=((nt=lt(Ft))==null?void 0:nt.needsHoverPosition)??Ft.kind===Se.Custom,Te=Dt}else le.kind===Dr&&(Te=!0);const Be=[le.location,[le.localEventX,le.localEventY]];Ae(Be,Dt),Ds.current=Be,Te&&_s(new Ju([le.location]))}const tt=le.location[0]>=(j?0:1);_e(le.kind===Xs&&le.isEdge&&tt&&Ze===!0),_p(le.kind==="cell"&&le.isFillHandle),D==null||D($),oe(le)},[B,Mn,j,Ze,D,oe,Q,h,lt,_s]);$n("mousemove",K,window,!0);const on=w.useCallback($=>{const ie=et.current;if(ie===null)return;let xe,ge;x.current!==void 0&&(xe=Zt(ie,x.current.cell[0],x.current.cell[1]),ge=x.current.cell),Y==null||Y({bounds:xe,stopPropagation:()=>$.stopPropagation(),preventDefault:()=>$.preventDefault(),cancel:()=>{},ctrlKey:$.ctrlKey,metaKey:$.metaKey,shiftKey:$.shiftKey,altKey:$.altKey,key:$.key,keyCode:$.keyCode,rawEvent:$,location:ge})},[Y,x,Zt]),Io=w.useCallback($=>{const ie=et.current;if(ie===null)return;let xe,ge;x.current!==void 0&&(xe=Zt(ie,x.current.cell[0],x.current.cell[1]),ge=x.current.cell),U==null||U({bounds:xe,stopPropagation:()=>$.stopPropagation(),preventDefault:()=>$.preventDefault(),cancel:()=>{},ctrlKey:$.ctrlKey,metaKey:$.metaKey,shiftKey:$.shiftKey,altKey:$.altKey,key:$.key,keyCode:$.keyCode,rawEvent:$,location:ge})},[U,x,Zt]),Bp=w.useCallback($=>{et.current=$,L!==void 0&&(L.current=$)},[L]),cf=w.useCallback($=>{const ie=et.current;if(ie===null||De===!1||ce){$.preventDefault();return}let xe,ge;const le=Mn(ie,$.clientX,$.clientY);if(De!==!0&&le.kind!==De){$.preventDefault();return}const Ae=(Ft,at)=>{xe=Ft,ge=at};let tt,nt,Te;const Dt=(Ft,at,kt)=>{tt=Ft,nt=at,Te=kt};let Be=!1;if(I==null||I({...le,setData:Ae,setDragImage:Dt,preventDefault:()=>Be=!0,defaultPrevented:()=>Be}),!Be&&xe!==void 0&&ge!==void 0&&$.dataTransfer!==null)if($.dataTransfer.setData(xe,ge),$.dataTransfer.effectAllowed="copyLink",tt!==void 0&&nt!==void 0&&Te!==void 0)$.dataTransfer.setDragImage(tt,nt,Te);else{const[Ft,at]=le.location;if(at!==void 0){const kt=document.createElement("canvas"),vn=Zt(ie,Ft,at);_r(vn!==void 0);const ht=Math.ceil(window.devicePixelRatio??1);kt.width=vn.width*ht,kt.height=vn.height*ht;const hn=kt.getContext("2d");hn!==null&&(hn.scale(ht,ht),hn.textBaseline="middle",at===-1?(hn.font=Ne.headerFontFull,hn.fillStyle=Ne.bgHeader,hn.fillRect(0,0,kt.width,kt.height),iE(hn,0,0,vn.width,vn.height,Ut[Ft],!1,Ne,!1,!1,0,Mt,He,!1)):(hn.font=Ne.baseFontFull,hn.fillStyle=Ne.bgCell,hn.fillRect(0,0,kt.width,kt.height),tE(hn,h([Ft,at]),0,at,!1,!1,0,0,vn.width,vn.height,!1,Ne,Ne.bgCell,wt,Mt,1,void 0,!1,0,void 0,void 0,void 0,vl,lt,()=>{}))),kt.style.left="-100%",kt.style.position="absolute",kt.style.width=`${vn.width}px`,kt.style.height=`${vn.height}px`,document.body.append(kt),$.dataTransfer.setDragImage(kt,vn.width/2,vn.height/2),window.setTimeout(()=>{kt.remove()},0)}}else $.preventDefault()},[De,ce,Mn,I,Zt,Ne,Ut,Mt,He,h,wt,vl,lt]);$n("dragstart",cf,(B==null?void 0:B.current)??null,!1,!1);const eu=w.useRef(),zp=w.useCallback($=>{const ie=et.current;if(je!==void 0&&$.preventDefault(),ie===null||it===void 0)return;const xe=Mn(ie,$.clientX,$.clientY),[ge,le]=xe.location,Ae=ge-(j?0:1),[tt,nt]=eu.current??[];(tt!==Ae||nt!==le)&&(eu.current=[Ae,le],it([Ae,le],$.dataTransfer))},[j,Mn,it,je]);$n("dragover",zp,(B==null?void 0:B.current)??null,!1,!1);const Ew=w.useCallback(()=>{eu.current=void 0,H==null||H()},[H]);$n("dragend",Ew,(B==null?void 0:B.current)??null,!1,!1);const q=w.useCallback($=>{const ie=et.current;if(ie===null||je===void 0)return;$.preventDefault();const xe=Mn(ie,$.clientX,$.clientY),[ge,le]=xe.location,Ae=ge-(j?0:1);je([Ae,le],$.dataTransfer)},[j,Mn,je]);$n("drop",q,(B==null?void 0:B.current)??null,!1,!1);const Kn=w.useCallback(()=>{yt==null||yt()},[yt]);$n("dragleave",Kn,(B==null?void 0:B.current)??null,!1,!1);const En=w.useRef(x);En.current=x;const El=w.useRef(null),tu=w.useCallback($=>{var ie;et.current===null||!et.current.contains(document.activeElement)||($===null&&En.current.current!==void 0?(ie=L==null?void 0:L.current)==null||ie.focus({preventScroll:!0}):$!==null&&$.focus({preventScroll:!0}),El.current=$)},[L]);w.useImperativeHandle(e,()=>({focus:()=>{var ie;const $=El.current;$===null||!document.contains($)?(ie=L==null?void 0:L.current)==null||ie.focus({preventScroll:!0}):$.focus({preventScroll:!0})},getBounds:($,ie)=>{if(!(L===void 0||L.current===null))return Zt(L.current,$??0,ie??-1)},damage:sf}),[L,sf,Zt]);const Fs=w.useRef(),pr=GF(()=>{var nt,Te,Dt;if(n<50||(st==null?void 0:st.disableAccessibilityTree)===!0)return null;let $=A0(Ut,Fe,n,te,ne);const ie=j?0:-1;!j&&((nt=$[0])==null?void 0:nt.sourceIndex)===0&&($=$.slice(1));const[xe,ge]=((Te=x.current)==null?void 0:Te.cell)??[],le=(Dt=x.current)==null?void 0:Dt.range,Ae=$.map(Be=>Be.sourceIndex),tt=Uo(l,Math.min(d,l+i));return xe!==void 0&&ge!==void 0&&!(Ae.includes(xe)&&tt.includes(ge))&&tu(null),w.createElement("table",{key:"access-tree",role:"grid","aria-rowcount":d+1,"aria-multiselectable":"true","aria-colcount":Ut.length+ie},w.createElement("thead",{role:"rowgroup"},w.createElement("tr",{role:"row","aria-rowindex":1},$.map(Be=>w.createElement("th",{role:"columnheader","aria-selected":x.columns.hasIndex(Be.sourceIndex),"aria-colindex":Be.sourceIndex+1+ie,tabIndex:-1,onFocus:Ft=>{if(Ft.target!==El.current)return Le==null?void 0:Le([Be.sourceIndex,-1])},key:Be.sourceIndex},Be.title)))),w.createElement("tbody",{role:"rowgroup"},tt.map(Be=>w.createElement("tr",{role:"row","aria-selected":x.rows.hasIndex(Be),key:Be,"aria-rowindex":Be+2},$.map(Ft=>{const at=Ft.sourceIndex,kt=ki(at,Be),vn=xe===at&&ge===Be,ht=le!==void 0&&at>=le.x&&at=le.y&&Be{const Ar=L==null?void 0:L.current;if(Ar!=null)return Y==null?void 0:Y({bounds:Zt(Ar,at,Be),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:Vr})},onFocusCapture:Ar=>{var Rt,wn;if(!(Ar.target===El.current||((Rt=Fs.current)==null?void 0:Rt[0])===at&&((wn=Fs.current)==null?void 0:wn[1])===Be))return Fs.current=Vr,Le==null?void 0:Le(Vr)},ref:vn?tu:void 0,tabIndex:-1},iW(ln,lt))})))))},[n,Ut,Fe,te,ne,d,l,i,x,tu,h,L,Y,Zt,Le],200),ci=C===0||!M?0:Fe>C?1:xi(-ne/100,0,1),$p=-l*32+Je,Al=P?xi(-$p/100,0,1):0,Hp=w.useMemo(()=>{if(!ci&&!Al)return null;const $={position:"absolute",top:0,left:Fn,width:n-Fn,height:r,opacity:ci,pointerEvents:"none",transition:vt?void 0:"opacity 0.2s",boxShadow:"inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)"},ie={position:"absolute",top:Un,left:0,width:n,height:r,opacity:Al,pointerEvents:"none",transition:he?void 0:"opacity 0.2s",boxShadow:"inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)"};return w.createElement(w.Fragment,null,ci>0&&w.createElement("div",{id:"shadow-x",style:$}),Al>0&&w.createElement("div",{id:"shadow-y",style:ie}))},[ci,Al,Fn,n,vt,Un,r,he]),jp=w.useMemo(()=>({position:"absolute",top:0,left:0}),[]);return w.createElement(w.Fragment,null,w.createElement("canvas",{"data-testid":"data-grid-canvas",tabIndex:0,onKeyDown:on,onKeyUp:Io,onFocus:g,onBlur:y,ref:Bp,style:Cl},pr),w.createElement("canvas",{ref:Ke,style:jp}),Hp)},oW=w.memo(w.forwardRef(sW));function xu(t,e,n,r){return xi(Math.round(e-(t.growOffset??0)),Math.ceil(n),Math.floor(r))}const lW=t=>{const[e,n]=w.useState(),[r,i]=w.useState(),[s,o]=w.useState(),[l,a]=w.useState(),[u,c]=w.useState(!1),[f,d]=w.useState(),[h,p]=w.useState(),[m,b]=w.useState(),[v,g]=w.useState(!1),[y,k]=w.useState(),{onHeaderMenuClick:x,getCellContent:C,onColumnMoved:T,onColumnResize:E,onColumnResizeStart:M,onColumnResizeEnd:P,gridRef:_,maxColumnWidth:O,minColumnWidth:N,onRowMoved:D,lockColumns:oe,onColumnProposeMove:Q,onMouseDown:te,onMouseUp:j,onItemHovered:Y,onDragStart:U,canvasRef:A}=t,L=(E??P??M)!==void 0,{columns:I,selection:H}=t,B=H.columns,ce=w.useCallback(Pe=>{const[pe,He]=Pe.location;s!==void 0&&l!==pe&&pe>=oe?(c(!0),a(pe)):h!==void 0&&He!==void 0?(g(!0),b(Math.max(0,He))):r===void 0&&!u&&!v&&(Y==null||Y(Pe))},[s,h,l,Y,oe,r,u,v]),we=T!==void 0,fe=w.useCallback(Pe=>{var pe;if(Pe.button===0){const[He,Le]=Pe.location;if(Pe.kind==="out-of-bounds"&&Pe.isEdge&&L){const it=(pe=_==null?void 0:_.current)==null?void 0:pe.getBounds(I.length-1,-1);it!==void 0&&(n(it.x),i(I.length-1))}else if(Pe.kind==="header"&&He>=oe){const it=A==null?void 0:A.current;if(Pe.isEdge&&L&&it){n(Pe.bounds.x),i(He);const yt=it.getBoundingClientRect().width/it.offsetWidth,ft=Pe.bounds.width/yt;M==null||M(I[He],ft,He,ft+(I[He].growOffset??0))}else Pe.kind==="header"&&we&&(d(Pe.bounds.x),o(He))}else Pe.kind==="cell"&&oe>0&&He===0&&Le!==void 0&&D!==void 0&&(k(Pe.bounds.y),p(Le))}te==null||te(Pe)},[te,L,oe,D,_,I,we,M,A]),De=w.useCallback((Pe,pe)=>{u||v||x==null||x(Pe,pe)},[u,v,x]),Ze=w.useRef(-1),rt=w.useCallback(()=>{Ze.current=-1,p(void 0),b(void 0),k(void 0),g(!1),o(void 0),a(void 0),d(void 0),c(!1),i(void 0),n(void 0)},[]),ct=w.useCallback((Pe,pe)=>{if(Pe.button===0){if(r!==void 0){if((B==null?void 0:B.hasIndex(r))===!0)for(const Le of B){if(Le===r)continue;const it=I[Le],je=xu(it,Ze.current,N,O);E==null||E(it,je,Le,je+(it.growOffset??0))}const He=xu(I[r],Ze.current,N,O);if(P==null||P(I[r],He,r,He+(I[r].growOffset??0)),B.hasIndex(r))for(const Le of B){if(Le===r)continue;const it=I[Le],je=xu(it,Ze.current,N,O);P==null||P(it,je,Le,je+(it.growOffset??0))}}rt(),s!==void 0&&l!==void 0&&(T==null||T(s,l)),h!==void 0&&m!==void 0&&(D==null||D(h,m))}j==null||j(Pe,pe)},[j,r,s,l,h,m,B,P,I,N,O,E,T,D,rt]),ot=w.useMemo(()=>{if(!(s===void 0||l===void 0)&&s!==l&&(Q==null?void 0:Q(s,l))!==!1)return{src:s,dest:l}},[s,l,Q]),Ne=w.useCallback(Pe=>{const pe=A==null?void 0:A.current;if(s!==void 0&&f!==void 0)Math.abs(Pe.clientX-f)>20&&c(!0);else if(h!==void 0&&y!==void 0)Math.abs(Pe.clientY-y)>20&&g(!0);else if(r!==void 0&&e!==void 0&&pe){const Le=pe.getBoundingClientRect().width/pe.offsetWidth,it=(Pe.clientX-e)/Le,je=I[r],yt=xu(je,it,N,O);if(E==null||E(je,yt,r,yt+(je.growOffset??0)),Ze.current=it,(B==null?void 0:B.first())===r)for(const ft of B){if(ft===r)continue;const vt=I[ft],he=xu(vt,Ze.current,N,O);E==null||E(vt,he,ft,he+(vt.growOffset??0))}}},[s,f,h,y,r,e,I,N,O,E,B,A]),Ye=w.useCallback((Pe,pe)=>{if(h===void 0||m===void 0)return C(Pe,pe);let[He,Le]=Pe;return Le===m?Le=h:(Le>m&&(Le-=1),Le>=h&&(Le+=1)),C([He,Le],pe)},[h,m,C]),jt=w.useCallback(Pe=>{U==null||U(Pe),Pe.defaultPrevented()||rt()},[rt,U]);return w.createElement(oW,{accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,drawCell:t.drawCell,enableGroups:t.enableGroups,eventTargetRef:t.eventTargetRef,experimental:t.experimental,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,headerIcons:t.headerIcons,height:t.height,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,resizeColumn:r,isDraggable:t.isDraggable,isFilling:t.isFilling,isFocused:t.isFocused,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDrop:t.onDrop,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,width:t.width,getCellContent:Ye,isResizing:r!==void 0,onHeaderMenuClick:De,isDragging:u,onItemHovered:ce,onDragStart:jt,onMouseDown:fe,allowResize:L,onMouseUp:ct,dragAndDropState:ot,onMouseMoveRaw:Ne,ref:_})};function aW(t){const e=w.useRef(null),[n,r]=w.useState({width:t==null?void 0:t[0],height:t==null?void 0:t[1]});return w.useLayoutEffect(()=>{const i=o=>{for(const l of o){const{width:a,height:u}=l&&l.contentRect||{};r(c=>c.width===a&&c.height===u?c:{width:a,height:u})}},s=new window.ResizeObserver(i);return e.current&&s.observe(e.current,void 0),()=>{s.disconnect()}},[e.current]),{ref:e,...n}}const uW=(t,e,n)=>{const r=w.useRef(null),i=w.useRef(null),s=w.useRef(null),o=w.useRef(0),l=w.useRef(e);l.current=e;const a=n.current;w.useEffect(()=>{const u=()=>{var d,h;if(i.current===!1&&a!==null){const p=[a.scrollLeft,a.scrollTop];if(((d=s.current)==null?void 0:d[0])===p[0]&&((h=s.current)==null?void 0:h[1])===p[1])if(o.current>10){s.current=null,i.current=null;return}else o.current++;else o.current=0,l.current(p[0],p[1]),s.current=p;r.current=window.setTimeout(u,8.333333333333334)}},c=()=>{i.current=!0,s.current=null,r.current!==null&&(window.clearTimeout(r.current),r.current=null)},f=d=>{d.touches.length===0&&(i.current=!1,o.current=0,r.current=window.setTimeout(u,8.333333333333334))};if(t&&a!==null){const d=a;return d.addEventListener("touchstart",c),d.addEventListener("touchend",f),()=>{d.removeEventListener("touchstart",c),d.removeEventListener("touchend",f),r.current!==null&&window.clearTimeout(r.current)}}},[t,a])},cW=()=>t=>t.isSafari?"scroll":"auto",fW=jr("div")({name:"ScrollRegionStyle",class:"gdg-s1dgczr6",propsAsIs:!1,vars:{"s1dgczr6-0":[cW()]}});function dW(t){const[e,n]=w.useState(!1),r=typeof window>"u"?null:window,i=w.useRef(0);return $n("touchstart",w.useCallback(()=>{window.clearTimeout(i.current),n(!0)},[]),r,!0,!1),$n("touchend",w.useCallback(s=>{s.touches.length===0&&(i.current=window.setTimeout(()=>n(!1),t))},[t]),r,!0,!1),e}const hW=t=>{var I,H;const{children:e,clientHeight:n,scrollHeight:r,scrollWidth:i,update:s,draggable:o,className:l,preventDiagonalScrolling:a=!1,paddingBottom:u=0,paddingRight:c=0,rightElement:f,rightElementProps:d,kineticScrollPerfHack:h=!1,scrollRef:p,initialSize:m}=t,b=[],v=(d==null?void 0:d.sticky)??!1,g=(d==null?void 0:d.fill)??!1,y=w.useRef(0),k=w.useRef(0),x=w.useRef(null),C=typeof window>"u"?1:window.devicePixelRatio,T=w.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),E=w.useRef(null),M=dW(200),[P,_]=w.useState(!0),O=w.useRef(0);w.useLayoutEffect(()=>{if(!P||M||T.current.lockDirection===void 0)return;const B=x.current;if(B===null)return;const[ce,we]=T.current.lockDirection;ce!==void 0?B.scrollLeft=ce:we!==void 0&&(B.scrollTop=we),T.current.lockDirection=void 0},[M,P]);const N=w.useCallback((B,ce)=>{var pe;const we=x.current;if(we===null)return;ce=ce??we.scrollTop,B=B??we.scrollLeft;const fe=T.current.scrollTop,De=T.current.scrollLeft,Ze=B-De,rt=ce-fe;M&&Ze!==0&&rt!==0&&(Math.abs(Ze)>3||Math.abs(rt)>3)&&a&&T.current.lockDirection===void 0&&(T.current.lockDirection=Math.abs(Ze)0&&(Math.abs(jt)>2e3||Ye===0||Ye===Pe)&&r>we.scrollHeight+5){const He=Ye/Pe,Le=(r-Ne)*He;y.current=Le-Ye}ct!==void 0&&(window.clearTimeout(O.current),_(!1),O.current=window.setTimeout(()=>_(!0),200)),s({x:B,y:Ye+y.current,width:ot-c,height:Ne-u,paddingRight:((pe=E.current)==null?void 0:pe.clientWidth)??0})},[u,c,r,s,a,M]);uW(h&&wh.value,N,x);const D=w.useRef(N);D.current=N;const oe=w.useRef(),Q=w.useRef(!1);w.useLayoutEffect(()=>{Q.current?N():Q.current=!0},[N,u,c]);const te=w.useCallback(B=>{x.current=B,p!==void 0&&(p.current=B)},[p]);let j=0,Y=0;for(b.push(w.createElement("div",{key:j++,style:{width:i,height:0}}));YD.current(),0),oe.current={width:A,height:L}),(A??0)===0||(L??0)===0?w.createElement("div",{ref:U}):w.createElement("div",{ref:U},w.createElement(fW,{isSafari:wh.value},w.createElement("div",{className:"dvn-underlay"},e),w.createElement("div",{ref:te,style:oe.current,draggable:o,onDragStart:B=>{o||(B.stopPropagation(),B.preventDefault())},className:"dvn-scroller "+(l??""),onScroll:()=>N()},w.createElement("div",{className:"dvn-scroll-inner"+(f===void 0?" dvn-hidden":"")},w.createElement("div",{className:"dvn-stack"},b),f!==void 0&&w.createElement(w.Fragment,null,!g&&w.createElement("div",{className:"dvn-spacer"}),w.createElement("div",{ref:E,style:{height:L,maxHeight:n-Math.ceil(C%1),position:"sticky",top:0,paddingLeft:1,marginBottom:-40,marginRight:c,flexGrow:g?1:void 0,right:v?c??0:void 0,pointerEvents:"auto"}},f))))))},pW=t=>{const{columns:e,rows:n,rowHeight:r,headerHeight:i,groupHeaderHeight:s,enableGroups:o,freezeColumns:l,experimental:a,nonGrowWidth:u,clientSize:c,className:f,onVisibleRegionChanged:d,scrollRef:h,preventDiagonalScrolling:p,rightElement:m,rightElementProps:b,overscrollX:v,overscrollY:g,initialSize:y,smoothScrollX:k=!1,smoothScrollY:x=!1,isDraggable:C}=t,{paddingRight:T,paddingBottom:E}=a??{},[M,P]=c,_=w.useRef(),O=w.useRef(),N=w.useRef(),D=w.useRef(),oe=u+Math.max(0,v??0);let Q=o?i+s:i;if(typeof r=="number")Q+=n*r;else for(let U=0;U{var rt,ct;if(te.current===void 0)return;const U={...te.current};let A=0,L=U.x<0?-U.x:0,I=0,H=0;U.x=U.x<0?0:U.x;let B=0;for(let ot=0;ot=Ne+ot.width)A+=ot.width,H++,I++;else if(U.x>Ne)A+=ot.width,k?L+=Ne-U.x:H++,I++;else if(U.x+U.width>Ne)A+=ot.width,I++;else break}let ce=0,we=0,fe=0;if(typeof r=="number")x?(we=Math.floor(U.y/r),ce=we*r-U.y):we=Math.ceil(U.y/r),fe=Math.ceil(U.height/r)+we,ce<0&&fe++;else{let ot=0;for(let Ne=0;Ne=ot+Ye)ot+=Ye,we++,fe++;else if(U.y>jt)ot+=Ye,x?ce+=jt-U.y:we++,fe++;else if(U.y+U.height>Ye/2+ot)ot+=Ye,fe++;else break}}const De={x:H,y:we,width:I-H,height:fe-we},Ze=_.current;(Ze===void 0||Ze.y!==De.y||Ze.x!==De.x||Ze.height!==De.height||Ze.width!==De.width||O.current!==L||N.current!==ce||U.width!==((rt=D.current)==null?void 0:rt[0])||U.height!==((ct=D.current)==null?void 0:ct[1]))&&(d==null||d({x:H,y:we,width:I-H,height:fe-we},U.width,U.height,U.paddingRight??0,L,ce),_.current=De,O.current=L,N.current=ce,D.current=[U.width,U.height])},[e,r,n,d,l,k,x]),Y=w.useCallback(U=>{te.current=U,j()},[j]);return w.useEffect(()=>{j()},[j]),w.createElement(hW,{scrollRef:h,className:f,kineticScrollPerfHack:a==null?void 0:a.kineticScrollPerfHack,preventDiagonalScrolling:p,draggable:C===!0||typeof C=="string",scrollWidth:oe+(T??0),scrollHeight:Q+(E??0),clientHeight:P,rightElement:m,paddingBottom:E,paddingRight:T,rightElementProps:b,update:Y,initialSize:y},w.createElement(lW,{eventTargetRef:h,width:M,height:P,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,onColumnProposeMove:t.onColumnProposeMove,verticalBorder:t.verticalBorder,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,drawCell:t.drawCell,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}))},gW=jr("div")({name:"SearchWrapper",class:"gdg-seveqep",propsAsIs:!1}),mW=w.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},w.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 244l144-144 144 144M256 120v292"})),yW=w.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},w.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})),vW=w.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},w.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368L144 144M368 144L144 368"})),wW=10,bW=t=>{const{canvasRef:e,cellYOffset:n,rows:r,columns:i,searchInputRef:s,searchValue:o,searchResults:l,onSearchValueChange:a,getCellsForSelection:u,onSearchResultsChanged:c,showSearch:f=!1,onSearchClose:d}=t,[h]=w.useState(()=>"search-box-"+Math.round(Math.random()*1e3)),[p,m]=w.useState(""),b=o??p,v=w.useCallback(A=>{m(A),a==null||a(A)},[a]),[g,y]=w.useState(),k=w.useRef(g);k.current=g,w.useEffect(()=>{l!==void 0&&(l.length>0?y(A=>({rowsSearched:r,results:l.length,selectedIndex:(A==null?void 0:A.selectedIndex)??-1})):y(void 0))},[r,l]);const x=w.useRef();x.current===void 0&&(x.current=new AbortController);const C=w.useRef(),[T,E]=w.useState([]),M=l??T,P=w.useCallback(()=>{C.current!==void 0&&(window.cancelAnimationFrame(C.current),C.current=void 0,x.current.abort())},[]),_=w.useRef(n);_.current=n;const O=w.useCallback(A=>{const L=new RegExp(A.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i");let I=_.current,H=Math.min(10,r),B=0;y(void 0),E([]);const ce=[],we=async()=>{var Pe;if(u===void 0)return;const fe=performance.now(),De=r-B;let Ze=u({x:0,y:I,width:i.length,height:Math.min(H,De,r-I)},x.current.signal);typeof Ze=="function"&&(Ze=await Ze());let rt=!1;for(const[pe,He]of Ze.entries())for(const[Le,it]of He.entries()){let je;switch(it.kind){case Se.Text:case Se.Number:je=it.displayData;break;case Se.Uri:case Se.Markdown:je=it.data;break;case Se.Boolean:je=typeof it.data=="boolean"?it.data.toString():void 0;break;case Se.Image:case Se.Bubble:je=it.data.join("🐳");break;case Se.Custom:je=it.copyData;break}je!==void 0&&L.test(je)&&(ce.push([Le,pe+I]),rt=!0)}const ct=performance.now();rt&&E([...ce]),B+=Ze.length,_r(B<=r);const ot=((Pe=k.current)==null?void 0:Pe.selectedIndex)??-1;y({results:ce.length,rowsSearched:B,selectedIndex:ot}),c==null||c(ce,ot),I+H>=r?I=0:I+=H;const Ne=ct-fe,Ye=Math.max(Ne,1),jt=wW/Ye;H=Math.ceil(H*jt),B{var A;d==null||d(),y(void 0),E([]),c==null||c([],-1),P(),(A=e==null?void 0:e.current)==null||A.focus()},[P,e,d,c]),D=w.useCallback(A=>{v(A.target.value),l===void 0&&(A.target.value===""?(y(void 0),E([]),P()):O(A.target.value))},[O,P,v,l]);w.useEffect(()=>{f&&s.current!==null&&(v(""),s.current.focus({preventScroll:!0}))},[f,s,v]);const oe=w.useCallback(A=>{var I;if((I=A==null?void 0:A.stopPropagation)==null||I.call(A),g===void 0)return;const L=(g.selectedIndex+1)%g.results;y({...g,selectedIndex:L}),c==null||c(M,L)},[g,c,M]),Q=w.useCallback(A=>{var I;if((I=A==null?void 0:A.stopPropagation)==null||I.call(A),g===void 0)return;let L=(g.selectedIndex-1)%g.results;L<0&&(L+=g.results),y({...g,selectedIndex:L}),c==null||c(M,L)},[c,M,g]),te=w.useCallback(A=>{(A.ctrlKey||A.metaKey)&&A.nativeEvent.code==="KeyF"||A.key==="Escape"?(N(),A.stopPropagation(),A.preventDefault()):A.key==="Enter"&&(A.shiftKey?Q():oe())},[N,oe,Q]);w.useEffect(()=>()=>{P()},[P]);const[j,Y]=w.useState(!1);w.useEffect(()=>{if(f)Y(!0);else{const A=setTimeout(()=>Y(!1),150);return()=>clearTimeout(A)}},[f]);const U=w.useMemo(()=>{if(!f&&!j)return null;let A;g!==void 0&&(A=g.results>=1e3?"over 1000":`${g.results} result${g.results!==1?"s":""}`,g.selectedIndex>=0&&(A=`${g.selectedIndex+1} of ${A}`));const L=B=>{B.stopPropagation()},H={width:`${Math.floor(((g==null?void 0:g.rowsSearched)??0)/r*100)}%`};return w.createElement(gW,{className:f?"":"out",onMouseDown:L,onMouseMove:L,onMouseUp:L,onClick:L},w.createElement("div",{className:"gdg-search-bar-inner"},w.createElement("input",{id:h,"aria-hidden":!f,"data-testid":"search-input",ref:s,onChange:D,value:b,tabIndex:f?void 0:-1,onKeyDownCapture:te}),w.createElement("button",{"aria-label":"Previous Result","aria-hidden":!f,tabIndex:f?void 0:-1,onClick:Q,disabled:((g==null?void 0:g.results)??0)===0},mW),w.createElement("button",{"aria-label":"Next Result","aria-hidden":!f,tabIndex:f?void 0:-1,onClick:oe,disabled:((g==null?void 0:g.results)??0)===0},yW),d!==void 0&&w.createElement("button",{"aria-label":"Close Search","aria-hidden":!f,"data-testid":"search-close-button",tabIndex:f?void 0:-1,onClick:N},vW)),g!==void 0?w.createElement(w.Fragment,null,w.createElement("div",{className:"gdg-search-status"},w.createElement("div",{"data-testid":"search-result-area"},A)),w.createElement("div",{className:"gdg-search-progress",style:H})):w.createElement("div",{className:"gdg-search-status"},w.createElement("label",{htmlFor:h},"Type to search")))},[f,j,g,r,h,s,D,b,te,Q,oe,d,N]);return w.createElement(w.Fragment,null,w.createElement(pW,{prelightCells:M,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,className:t.className,clientSize:t.clientSize,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,nonGrowWidth:t.nonGrowWidth,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,initialSize:t.initialSize,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,onVisibleRegionChanged:t.onVisibleRegionChanged,overscrollX:t.overscrollX,overscrollY:t.overscrollY,preventDiagonalScrolling:t.preventDiagonalScrolling,rightElement:t.rightElement,rightElementProps:t.rightElementProps,rowHeight:t.rowHeight,rows:t.rows,scrollRef:t.scrollRef,selection:t.selection,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,onColumnProposeMove:t.onColumnProposeMove,drawFocusRing:t.drawFocusRing,drawCell:t.drawCell,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}),U)};class xW extends w.PureComponent{constructor(){super(...arguments);bt(this,"wrapperRef",w.createRef());bt(this,"clickOutside",n=>{if(!(this.props.isOutsideClick&&!this.props.isOutsideClick(n))&&this.wrapperRef.current!==null&&!this.wrapperRef.current.contains(n.target)){let r=n.target;for(;r!==null;){if(r.classList.contains("click-outside-ignore"))return;r=r.parentElement}this.props.onClickOutside()}})}componentDidMount(){document.addEventListener("touchend",this.clickOutside,!0),document.addEventListener("mousedown",this.clickOutside,!0),document.addEventListener("contextmenu",this.clickOutside,!0)}componentWillUnmount(){document.removeEventListener("touchend",this.clickOutside,!0),document.removeEventListener("mousedown",this.clickOutside,!0),document.removeEventListener("contextmenu",this.clickOutside,!0)}render(){const{onClickOutside:n,isOutsideClick:r,...i}=this.props;return w.createElement("div",{...i,ref:this.wrapperRef},this.props.children)}}const kW=()=>t=>Math.max(16,t.targetHeight-10),SW=jr("input")({name:"RenameInput",class:"gdg-r17m35ur",propsAsIs:!1,vars:{"r17m35ur-0":[kW(),"px"]}}),CW=t=>{const{bounds:e,group:n,onClose:r,canvasBounds:i,onFinish:s}=t,[o,l]=Pn.useState(n);return Pn.createElement(xW,{style:{position:"absolute",left:e.x-i.left+1,top:e.y-i.top,width:e.width-2,height:e.height},className:"gdg-c1tqibwd",onClickOutside:r},Pn.createElement(SW,{targetHeight:e.height,"data-testid":"group-rename-input",value:o,onBlur:r,onFocus:a=>a.target.setSelectionRange(0,o.length),onChange:a=>l(a.target.value),onKeyDown:a=>{a.key==="Enter"?s(o):a.key==="Escape"&&r()},autoFocus:!0}))};function TW(t,e){return t===void 0?!1:t.length>1&&t.startsWith("_")?Number.parseInt(t.slice(1))===e.keyCode:t.length===1&&t>="a"&&t<="z"?t.toUpperCase().codePointAt(0)===e.keyCode:t===e.key}function gt(t,e,n){const r=yE(t,e);return r&&(n.didMatch=!0),r}function yE(t,e){if(t.length===0)return!1;if(t.includes("|")){const a=t.split("|");for(const u of a)if(yE(u,e))return!0;return!1}let n=!1,r=!1,i=!1,s=!1;const o=t.split("+"),l=o.pop();if(!TW(l,e))return!1;if(o[0]==="any")return!0;for(const a of o)switch(a){case"ctrl":n=!0;break;case"shift":r=!0;break;case"alt":i=!0;break;case"meta":s=!0;break;case"primary":bh.value?s=!0:n=!0;break}return e.altKey===i&&e.ctrlKey===n&&e.shiftKey===r&&e.metaKey===s}function EW(t,e,n,r,i,s){const o=Pn.useCallback((u,c,f,d)=>{var g;(s==="cell"||s==="multi-cell")&&u!==void 0&&(u={...u,range:{x:u.cell[0],y:u.cell[1],width:1,height:1}});const h=n==="mixed"&&(f||d==="drag"),p=r==="mixed"&&h,m=i==="mixed"&&h;let b={current:u===void 0?void 0:{...u,rangeStack:d==="drag"?((g=t.current)==null?void 0:g.rangeStack)??[]:[]},columns:p?t.columns:Ot.empty(),rows:m?t.rows:Ot.empty()};f&&(s==="multi-rect"||s==="multi-cell")&&b.current!==void 0&&t.current!==void 0&&(b={...b,current:{...b.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),e(b,c)},[r,t,n,s,i,e]),l=Pn.useCallback((u,c,f)=>{u=u??t.rows,c!==void 0&&(u=u.add(c));let d;if(i==="exclusive"&&u.length>0)d={current:void 0,columns:Ot.empty(),rows:u};else{const h=f&&n==="mixed",p=f&&r==="mixed";d={current:h?t.current:void 0,columns:p?t.columns:Ot.empty(),rows:u}}e(d,!1)},[r,t,n,i,e]),a=Pn.useCallback((u,c,f)=>{u=u??t.columns,c!==void 0&&(u=u.add(c));let d;if(r==="exclusive"&&u.length>0)d={current:void 0,rows:Ot.empty(),columns:u};else{const h=f&&n==="mixed",p=f&&i==="mixed";d={current:h?t.current:void 0,rows:p?t.rows:Ot.empty(),columns:u}}e(d,!1)},[r,t,n,i,e]);return[o,l,a]}function AW(t,e,n,r,i){const s=w.useCallback(u=>{if(t===!0){const c=[];for(let f=u.y;f=i?d.push({kind:Se.Loading,allowOverlay:!1}):d.push(e([h,f]));c.push(d)}return c}return(t==null?void 0:t(u,r.signal))??[]},[r.signal,e,t,i]),o=t!==void 0?s:void 0,l=w.useCallback(u=>{if(o===void 0)return[];const c={...u,x:u.x-n};if(c.x<0){c.x=0,c.width--;const f=o(c,r.signal);return typeof f=="function"?async()=>(await f()).map(d=>[{kind:Se.Loading,allowOverlay:!1},...d]):f.map(d=>[{kind:Se.Loading,allowOverlay:!1},...d])}return o(c,r.signal)},[r.signal,o,n]);return[t!==void 0?l:void 0,o]}function MW(t){if(t.copyData!==void 0)return{formatted:t.copyData,rawValue:t.copyData,format:"string"};switch(t.kind){case Se.Boolean:return{formatted:t.data===!0?"TRUE":t.data===!1?"FALSE":t.data===Lv?"INDETERMINATE":"",rawValue:t.data,format:"boolean"};case Se.Custom:return{formatted:t.copyData,rawValue:t.copyData,format:"string"};case Se.Image:case Se.Bubble:return{formatted:t.data,rawValue:t.data,format:"string-array"};case Se.Drilldown:return{formatted:t.data.map(e=>e.text),rawValue:t.data.map(e=>e.text),format:"string-array"};case Se.Text:return{formatted:t.displayData??t.data,rawValue:t.data,format:"string"};case Se.Uri:return{formatted:t.displayData??t.data,rawValue:t.data,format:"url"};case Se.Markdown:case Se.RowID:return{formatted:t.data,rawValue:t.data,format:"string"};case Se.Number:return{formatted:t.displayData,rawValue:t.data,format:"number"};case Se.Loading:return{formatted:"#LOADING",rawValue:"",format:"string"};case Se.Protected:return{formatted:"************",rawValue:"",format:"string"};default:Sc()}}function RW(t,e){return t.map((r,i)=>{const s=e[i];return r.map(o=>o.span!==void 0&&o.span[0]!==s?{formatted:"",rawValue:"",format:"string"}:MW(o))})}function Sx(t,e){return(e?/[\t\n",]/:/[\t\n"]/).test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}function OW(t){var n;const e=[];for(const r of t){const i=[];for(const s of r)s.format==="url"?i.push(((n=s.rawValue)==null?void 0:n.toString())??""):s.format==="string-array"?i.push(s.formatted.map(o=>Sx(o,!0)).join(",")):i.push(Sx(s.formatted,!1));e.push(i.join(" "))}return e.join(` -`)}function Vg(t){return t.replace(/\t/g," ").replace(/ {2,}/g,e=>" ".repeat(e.length))}function Cx(t){return'"'+t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")+'"'}function PW(t){return t.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function IW(t){var n;const e=[];e.push('',"");for(const r of t){e.push("");for(const i of r){const s=`gdg-format="${i.format}"`;i.format==="url"?e.push(``):i.format==="string-array"?e.push(``):e.push(``)}e.push("")}return e.push("
    ${Vg(i.formatted)}
      ${i.formatted.map((o,l)=>`
    1. `+Vg(o)+"
    2. ").join("")}
    ${Vg(i.formatted)}
    "),e.join("")}function DW(t,e){const n=RW(t,e),r=OW(n),i=IW(n);return{textPlain:r,textHtml:i}}function Tx(t){var o;const e=document.createElement("html");e.innerHTML=t.replace(/ /g," ");const n=e.querySelector("table");if(n===null)return;const r=[n],i=[];let s;for(;r.length>0;){const l=r.pop();if(l===void 0)break;if(l instanceof HTMLTableElement||l.nodeName==="TBODY")r.push(...[...l.children].reverse());else if(l instanceof HTMLTableRowElement)s!==void 0&&i.push(s),s=[],r.push(...[...l.children].reverse());else if(l instanceof HTMLTableCellElement){const a=l.cloneNode(!0),c=a.children.length===1&&a.children[0].nodeName==="P"?a.children[0]:null,f=(c==null?void 0:c.children.length)===1&&c.children[0].nodeName==="FONT",d=a.querySelectorAll("br");for(const m of d)m.replaceWith(` -`);const h=a.getAttribute("gdg-raw-value"),p=a.getAttribute("gdg-format")??"string";if(a.querySelector("a")!==null)s==null||s.push({rawValue:((o=a.querySelector("a"))==null?void 0:o.getAttribute("href"))??"",formatted:a.textContent??"",format:p});else if(a.querySelector("ol")!==null){const m=a.querySelectorAll("li");s==null||s.push({rawValue:[...m].map(b=>b.getAttribute("gdg-raw-value")??""),formatted:[...m].map(b=>b.textContent??""),format:"string-array"})}else if(h!==null)s==null||s.push({rawValue:PW(h),formatted:a.textContent??"",format:p});else{let m=a.textContent??"";f&&(m=m.replace(/\n(?!\n)/g,"")),s==null||s.push({rawValue:m??"",formatted:m??"",format:p})}}}return s!==void 0&&i.push(s),i}function _W(t,e,n,r,i){var l;const s=t;if(r==="allowPartial"||t.current===void 0||e===void 0)return t;let o=!1;do{if((t==null?void 0:t.current)===void 0)break;const a=(l=t.current)==null?void 0:l.range,u=[];if(a.width>2){const d=e({x:a.x,y:a.y,width:1,height:a.height},i.signal);if(typeof d=="function")return s;u.push(...d);const h=e({x:a.x+a.width-1,y:a.y,width:1,height:a.height},i.signal);if(typeof h=="function")return s;u.push(...h)}else{const d=e({x:a.x,y:a.y,width:a.width,height:a.height},i.signal);if(typeof d=="function")return s;u.push(...d)}let c=a.x-n,f=a.x+a.width-1-n;for(const d of u)for(const h of d)h.span!==void 0&&(c=Math.min(h.span[0],c),f=Math.max(h.span[1],f));c===a.x-n&&f===a.x+a.width-1-n?o=!0:t={current:{cell:t.current.cell??[0,0],range:{x:c+n,y:a.y,width:f-c+1,height:a.height},rangeStack:t.current.rangeStack},columns:t.columns,rows:t.rows}}while(!o);return t}function Ex(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1).replace(/""/g,'"')),t}function NW(t){let e;(function(l){l[l.None=0]="None",l[l.inString=1]="inString",l[l.inStringPostQuote=2]="inStringPostQuote"})(e||(e={}));const n=[];let r=[],i=0,s=e.None;t=t.replace(/\r\n/g,` -`);let o=0;for(const l of t){switch(s){case e.None:l===" "||l===` -`?(r.push(t.slice(i,o)),i=o+1,l===` -`&&(n.push(r),r=[])):l==='"'&&(s=e.inString);break;case e.inString:l==='"'&&(s=e.inStringPostQuote);break;case e.inStringPostQuote:l==='"'?s=e.inString:((l===" "||l===` -`)&&(r.push(Ex(t.slice(i,o))),i=o+1,l===` -`&&(n.push(r),r=[])),s=e.None);break}o++}return il.map(a=>({rawValue:a,formatted:a,format:"string"})))}function Ax(t,e,n){var l;const r=DW(t,e),i=a=>{var u;(u=window.navigator.clipboard)==null||u.writeText(a)},s=(a,u)=>{var c;return((c=window.navigator.clipboard)==null?void 0:c.write)===void 0?!1:(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([a],{type:"text/plain"}),"text/html":new Blob([u],{type:"text/html"})})]),!0)},o=(a,u)=>{var c,f;try{if(n===void 0||n.clipboardData===null)throw new Error("No clipboard data");(c=n==null?void 0:n.clipboardData)==null||c.setData("text/plain",a),(f=n==null?void 0:n.clipboardData)==null||f.setData("text/html",u)}catch{s(a,u)||i(a)}};((l=window.navigator.clipboard)==null?void 0:l.write)!==void 0||(n==null?void 0:n.clipboardData)!==void 0?o(r.textPlain,r.textHtml):i(r.textPlain),n==null||n.preventDefault()}function vE(t){return t!==!0}function Mx(t){return typeof t=="string"?t:`${t}px`}const LW=()=>t=>t.innerWidth,FW=()=>t=>t.innerHeight,BW=jr("div")({name:"Wrapper",class:"gdg-wmyidgi",propsAsIs:!1,vars:{"wmyidgi-0":[LW()],"wmyidgi-1":[FW()]}}),zW=t=>{const{inWidth:e,inHeight:n,children:r,...i}=t;return w.createElement(BW,{innerHeight:Mx(n),innerWidth:Mx(e),...i},r)},$W=2,HW=1300;function jW(t,e,n){const r=Pn.useRef(0),[i,s]=t??[0,0];Pn.useEffect(()=>{if(i===0&&s===0){r.current=0;return}let o=!1,l=0;const a=u=>{var c;if(!o){if(l===0)l=u;else{const f=u-l;r.current=Math.min(1,r.current+f/HW);const d=r.current**1.618*f*$W;(c=e.current)==null||c.scrollBy(i*d,s*d),l=u,n==null||n()}window.requestAnimationFrame(a)}};return window.requestAnimationFrame(a),()=>{o=!0}},[e,i,s,n])}function WW({rowHeight:t,headerHeight:e,groupHeaderHeight:n,theme:r,overscrollX:i,overscrollY:s,scaleToRem:o,remSize:l}){const[a,u,c,f,d,h]=Pn.useMemo(()=>{if(!o||l===16)return[t,e,n,r,i,s];const p=l/16,m=t,b=WT();return[typeof m=="number"?m*p:v=>Math.ceil(m(v)*p),Math.ceil(e*p),Math.ceil(n*p),{...r,headerIconSize:((r==null?void 0:r.headerIconSize)??b.headerIconSize)*p,cellHorizontalPadding:((r==null?void 0:r.cellHorizontalPadding)??b.cellHorizontalPadding)*p,cellVerticalPadding:((r==null?void 0:r.cellVerticalPadding)??b.cellVerticalPadding)*p},Math.ceil((i??0)*p),Math.ceil((s??0)*p)]},[n,e,i,s,l,t,o,r]);return{rowHeight:a,headerHeight:u,groupHeaderHeight:c,theme:f,overscrollX:d,overscrollY:h}}const Us={downFill:!1,rightFill:!1,clear:!0,closeOverlay:!0,acceptOverlayDown:!0,acceptOverlayUp:!0,acceptOverlayLeft:!0,acceptOverlayRight:!0,copy:!0,paste:!0,cut:!0,search:!1,delete:!0,activateCell:!0,scrollToSelectedCell:!0,goToFirstCell:!0,goToFirstColumn:!0,goToFirstRow:!0,goToLastCell:!0,goToLastColumn:!0,goToLastRow:!0,goToNextPage:!0,goToPreviousPage:!0,selectToFirstCell:!0,selectToFirstColumn:!0,selectToFirstRow:!0,selectToLastCell:!0,selectToLastColumn:!0,selectToLastRow:!0,selectAll:!0,selectRow:!0,selectColumn:!0,goUpCell:!0,goRightCell:!0,goDownCell:!0,goLeftCell:!0,goUpCellRetainSelection:!0,goRightCellRetainSelection:!0,goDownCellRetainSelection:!0,goLeftCellRetainSelection:!0,selectGrowUp:!0,selectGrowRight:!0,selectGrowDown:!0,selectGrowLeft:!0};function mt(t,e){return t===!0?e:t===!1?"":t}function Rx(t){const e=bh.value;return{activateCell:mt(t.activateCell," |Enter|shift+Enter"),clear:mt(t.clear,"any+Escape"),closeOverlay:mt(t.closeOverlay,"any+Escape"),acceptOverlayDown:mt(t.acceptOverlayDown,"Enter"),acceptOverlayUp:mt(t.acceptOverlayUp,"shift+Enter"),acceptOverlayLeft:mt(t.acceptOverlayLeft,"shift+Tab"),acceptOverlayRight:mt(t.acceptOverlayRight,"Tab"),copy:t.copy,cut:t.cut,delete:mt(t.delete,e?"Backspace|Delete":"Delete"),downFill:mt(t.downFill,"primary+_68"),scrollToSelectedCell:mt(t.scrollToSelectedCell,"primary+Enter"),goDownCell:mt(t.goDownCell,"ArrowDown"),goDownCellRetainSelection:mt(t.goDownCellRetainSelection,"alt+ArrowDown"),goLeftCell:mt(t.goLeftCell,"ArrowLeft|shift+Tab"),goLeftCellRetainSelection:mt(t.goLeftCellRetainSelection,"alt+ArrowLeft"),goRightCell:mt(t.goRightCell,"ArrowRight|Tab"),goRightCellRetainSelection:mt(t.goRightCellRetainSelection,"alt+ArrowRight"),goUpCell:mt(t.goUpCell,"ArrowUp"),goUpCellRetainSelection:mt(t.goUpCellRetainSelection,"alt+ArrowUp"),goToFirstCell:mt(t.goToFirstCell,"primary+Home"),goToFirstColumn:mt(t.goToFirstColumn,"Home|primary+ArrowLeft"),goToFirstRow:mt(t.goToFirstRow,"primary+ArrowUp"),goToLastCell:mt(t.goToLastCell,"primary+End"),goToLastColumn:mt(t.goToLastColumn,"End|primary+ArrowRight"),goToLastRow:mt(t.goToLastRow,"primary+ArrowDown"),goToNextPage:mt(t.goToNextPage,"PageDown"),goToPreviousPage:mt(t.goToPreviousPage,"PageUp"),paste:t.paste,rightFill:mt(t.rightFill,"primary+_82"),search:mt(t.search,"primary+f"),selectAll:mt(t.selectAll,"primary+a"),selectColumn:mt(t.selectColumn,"ctrl+ "),selectGrowDown:mt(t.selectGrowDown,"shift+ArrowDown"),selectGrowLeft:mt(t.selectGrowLeft,"shift+ArrowLeft"),selectGrowRight:mt(t.selectGrowRight,"shift+ArrowRight"),selectGrowUp:mt(t.selectGrowUp,"shift+ArrowUp"),selectRow:mt(t.selectRow,"shift+ "),selectToFirstCell:mt(t.selectToFirstCell,"primary+shift+Home"),selectToFirstColumn:mt(t.selectToFirstColumn,"primary+shift+ArrowLeft"),selectToFirstRow:mt(t.selectToFirstRow,"primary+shift+ArrowUp"),selectToLastCell:mt(t.selectToLastCell,"primary+shift+End"),selectToLastColumn:mt(t.selectToLastColumn,"primary+shift+ArrowRight"),selectToLastRow:mt(t.selectToLastRow,"primary+shift+ArrowDown")}}function VW(t){const e=ZF(t);return Pn.useMemo(()=>{if(e===void 0)return Rx(Us);const n={...e,goToNextPage:(e==null?void 0:e.goToNextPage)??(e==null?void 0:e.pageDown)??Us.goToNextPage,goToPreviousPage:(e==null?void 0:e.goToPreviousPage)??(e==null?void 0:e.pageUp)??Us.goToPreviousPage,goToFirstCell:(e==null?void 0:e.goToFirstCell)??(e==null?void 0:e.first)??Us.goToFirstCell,goToLastCell:(e==null?void 0:e.goToLastCell)??(e==null?void 0:e.last)??Us.goToLastCell,selectToFirstCell:(e==null?void 0:e.selectToFirstCell)??(e==null?void 0:e.first)??Us.selectToFirstCell,selectToLastCell:(e==null?void 0:e.selectToLastCell)??(e==null?void 0:e.last)??Us.selectToLastCell};return Rx({...Us,...n})},[e])}const UW=w.lazy(async()=>await UT(()=>import("./data-grid-overlay-editor-BHYotFjA.js"),[]));let KW=0;function XW(t){return qB(Gb(Gb(t).filter(e=>e.span!==void 0).map(e=>{var n,r;return Uo((((n=e.span)==null?void 0:n[0])??0)+1,(((r=e.span)==null?void 0:r[1])??0)+1)})))}function Gf(t,e){return t===void 0||e===0||t.columns.length===0&&t.current===void 0?t:{current:t.current===void 0?void 0:{cell:[t.current.cell[0]+e,t.current.cell[1]],range:{...t.current.range,x:t.current.range.x+e},rangeStack:t.current.rangeStack.map(n=>({...n,x:n.x+e}))},rows:t.rows,columns:t.columns.offset(e)}}const Ug={kind:Se.Loading,allowOverlay:!1},Yf={columns:Ot.empty(),rows:Ot.empty(),current:void 0},GW=(t,e)=>{var $w,Hw,jw;const[n,r]=w.useState(Yf),[i,s]=w.useState(),o=w.useRef(null),l=w.useRef(null),[a,u]=w.useState(),c=w.useRef(null),f=w.useRef(),d=typeof window>"u"?null:window,{imageEditorOverride:h,getRowThemeOverride:p,markdownDivCreateNode:m,width:b,height:v,columns:g,rows:y,getCellContent:k,onCellClicked:x,onCellActivated:C,onFillPattern:T,onFinishedEditing:E,coercePasteValue:M,drawHeader:P,drawCell:_,editorBloom:O,onHeaderClicked:N,onColumnProposeMove:D,spanRangeBehavior:oe="default",onGroupHeaderClicked:Q,onCellContextMenu:te,className:j,onHeaderContextMenu:Y,getCellsForSelection:U,onGroupHeaderContextMenu:A,onGroupHeaderRenamed:L,onCellEdited:I,onCellsEdited:H,onSearchResultsChanged:B,searchResults:ce,onSearchValueChange:we,searchValue:fe,onKeyDown:De,onKeyUp:Ze,keybindings:rt,editOnType:ct=!0,onRowAppended:ot,onColumnMoved:Ne,validateCell:Ye,highlightRegions:jt,rangeSelect:Pe="rect",columnSelect:pe="multi",rowSelect:He="multi",rangeSelectionBlending:Le="exclusive",columnSelectionBlending:it="exclusive",rowSelectionBlending:je="exclusive",onDelete:yt,onDragStart:ft,onMouseMove:vt,onPaste:he,copyHeaders:st=!1,freezeColumns:lt=0,cellActivationBehavior:ne="second-click",rowSelectionMode:Je="auto",onHeaderMenuClick:Fe,getGroupDetails:et,onSearchClose:wt,onItemHovered:Jt,onSelectionCleared:dn,showSearch:G,onVisibleRegionChanged:be,gridSelection:ee,onGridSelectionChange:ye,minColumnWidth:de=50,maxColumnWidth:dt=500,maxColumnAutoWidth:_e,provideEditor:Ke,trailingRowOptions:me,freezeTrailingRows:Ie=0,allowedFillDirections:Et="orthogonal",scrollOffsetX:Wt,scrollOffsetY:Nt,verticalBorder:Mt,onDragOverCell:Un,onDrop:ut,onColumnResize:Vt,onColumnResizeEnd:Lt,onColumnResizeStart:Ut,customRenderers:Fn,fillHandle:Zt,drawFocusRing:Mn=!0,experimental:sn,fixedShadowX:ef,fixedShadowY:Ds,headerIcons:us,imageWindowLoader:cs,initialSize:vl,isDraggable:tf,onDragLeave:nf,onRowMoved:Ni,overscrollX:wl,overscrollY:bl,preventDiagonalScrolling:xl,rightElement:Po,rightElementProps:_s,trapFocus:rf=!1,smoothScrollX:sf,smoothScrollY:Dp,scaleToRem:_p=!1,rowHeight:kl=34,headerHeight:fs=36,groupHeaderHeight:Np=fs,theme:Lp,isOutsideClick:of,renderers:Sl}=t,Tn=typeof t.rowMarkers=="string"?void 0:t.rowMarkers,Wr=(Tn==null?void 0:Tn.kind)??t.rowMarkers??"none",lf=(Tn==null?void 0:Tn.width)??t.rowMarkerWidth,Cl=(Tn==null?void 0:Tn.startIndex)??t.rowMarkerStartIndex??1,qa=(Tn==null?void 0:Tn.theme)??t.rowMarkerTheme,Ns=(Tn==null?void 0:Tn.checkboxStyle)??"square",Tr=Math.max(de,20),ai=Math.max(dt,Tr),Qa=Math.max(_e??ai,Tr),Ls=w.useMemo(()=>typeof window>"u"?{fontSize:"16px"}:window.getComputedStyle(document.documentElement),[]),Ja=w.useMemo(()=>Number.parseFloat(Ls.fontSize),[Ls]),{rowHeight:ir,headerHeight:Tl,groupHeaderHeight:Za,theme:af,overscrollX:Fp,overscrollY:uf}=WW({groupHeaderHeight:Np,headerHeight:fs,overscrollX:wl,overscrollY:bl,remSize:Ja,rowHeight:kl,scaleToRem:_p,theme:Lp}),ui=VW(rt),ds=lf??(y>1e4?48:y>1e3?44:y>100?36:32),Er=Wr!=="none",K=Er?1:0,on=ot!==void 0,Io=(me==null?void 0:me.sticky)===!0,[Bp,cf]=w.useState(!1),eu=G??Bp,zp=w.useCallback(()=>{wt!==void 0?wt():cf(!1)},[wt]),q=w.useMemo(()=>ee===void 0?void 0:Gf(ee,K),[ee,K])??n,Kn=w.useRef();Kn.current===void 0&&(Kn.current=new AbortController),w.useEffect(()=>()=>Kn==null?void 0:Kn.current.abort(),[]);const[En,El]=AW(U,k,K,Kn.current,y),tu=w.useCallback((S,z,F)=>{if(Ye===void 0)return!0;const W=[S[0]-K,S[1]];return Ye==null?void 0:Ye(W,z,F)},[K,Ye]),Fs=w.useRef(ee),pr=w.useCallback((S,z)=>{z&&(S=_W(S,En,K,oe,Kn.current)),ye!==void 0?(Fs.current=Gf(S,-K),ye(Fs.current)):r(S)},[ye,En,K,oe]),ci=Ll(Vt,w.useCallback((S,z,F,W)=>{Vt==null||Vt(g[F-K],z,F-K,W)},[Vt,K,g])),$p=Ll(Lt,w.useCallback((S,z,F,W)=>{Lt==null||Lt(g[F-K],z,F-K,W)},[Lt,K,g])),Al=Ll(Ut,w.useCallback((S,z,F,W)=>{Ut==null||Ut(g[F-K],z,F-K,W)},[Ut,K,g])),Hp=Ll(P,w.useCallback((S,z)=>(P==null?void 0:P({...S,columnIndex:S.columnIndex-K},z))??!1,[P,K])),jp=Ll(_,w.useCallback((S,z)=>(_==null?void 0:_({...S,col:S.col-K},z))??!1,[_,K])),$=w.useCallback(S=>{if(yt!==void 0){const z=yt(Gf(S,-K));return typeof z=="boolean"?z:Gf(z,K)}return!0},[yt,K]),[ie,xe,ge]=EW(q,pr,Le,it,je,Pe),le=w.useMemo(()=>yo(WT(),af),[af]),[Ae,tt]=w.useState([0,0,0]),nt=w.useMemo(()=>{if(Sl===void 0)return{};const S={};for(const z of Sl)S[z.kind]=z;return S},[Sl]),Te=w.useCallback(S=>S.kind!==Se.Custom?nt[S.kind]:Fn==null?void 0:Fn.find(z=>z.isMatch(S)),[Fn,nt]);let{sizedColumns:Dt,nonGrowWidth:Be}=G4(g,y,El,Ae[0]-(K===0?0:ds)-Ae[2],Tr,Qa,le,Te,Kn.current);Wr!=="none"&&(Be+=ds);const Ft=w.useMemo(()=>Dt.some(S=>S.group!==void 0),[Dt]),at=Ft?Tl+Za:Tl,kt=q.rows.length,vn=Wr==="none"?void 0:kt===0?!1:kt===y?!0:void 0,ht=w.useMemo(()=>Wr==="none"?Dt:[{title:"",width:ds,icon:void 0,hasMenu:!1,style:"normal",themeOverride:qa,rowMarker:Ns,rowMarkerChecked:vn},...Dt],[Wr,Dt,ds,qa,Ns,vn]),[hn,Vr]=w.useMemo(()=>[Nt!==void 0&&typeof ir=="number"?Math.floor(Nt/ir):0,Nt!==void 0&&typeof ir=="number"?-(Nt%ir):0],[Nt,ir]),ln=w.useRef({height:1,width:1,x:0,y:0}),Ar=w.useMemo(()=>({x:ln.current.x,y:hn,width:ln.current.width??1,height:ln.current.height??1,ty:Vr}),[Vr,hn]),Rt=w.useRef(!1),[wn,Mr,Li]=JF(Ar);ln.current=wn;const fi=(wn.height??1)>1;w.useLayoutEffect(()=>{if(Nt!==void 0&&c.current!==null&&fi){if(c.current.scrollTop===Nt)return;c.current.scrollTop=Nt,c.current.scrollTop!==Nt&&Li(),Rt.current=!0}},[Nt,fi,Li]);const Ml=(wn.width??1)>1;w.useLayoutEffect(()=>{if(Wt!==void 0&&c.current!==null&&Ml){if(c.current.scrollLeft===Wt)return;c.current.scrollLeft=Wt,c.current.scrollLeft!==Wt&&Li(),Rt.current=!0}},[Wt,Ml,Li]);const Do=wn.x+K,ff=wn.y,gr=w.useRef(null),sr=w.useCallback(S=>{var z;S===!0?(z=gr.current)==null||z.focus():window.requestAnimationFrame(()=>{var F;(F=gr.current)==null||F.focus()})},[]),Xn=on?y+1:y,Ur=w.useCallback(S=>{const z=K===0?S:S.map(W=>({...W,location:[W.location[0]-K,W.location[1]]})),F=H==null?void 0:H(z);if(F!==!0)for(const W of z)I==null||I(W.location,W.value);return F},[I,H,K]),[_o,Wp]=w.useState(),df=q.current!==void 0&&q.current.range.width*q.current.range.height>1?q.current.range:void 0,Rl=Mn?($w=q.current)==null?void 0:$w.cell:void 0,hf=Rl==null?void 0:Rl[0],pf=Rl==null?void 0:Rl[1],UM=w.useMemo(()=>{if((jt===void 0||jt.length===0)&&(df??hf??pf??_o)===void 0)return;const S=[];if(jt!==void 0)for(const z of jt){const F=ht.length-z.range.x-K;F>0&&S.push({color:z.color,range:{...z.range,x:z.range.x+K,width:Math.min(F,z.range.width)},style:z.style})}return _o!==void 0&&S.push({color:ll(le.accentColor,0),range:_o,style:"dashed"}),df!==void 0&&S.push({color:ll(le.accentColor,.5),range:df,style:"solid-outline"}),hf!==void 0&&pf!==void 0&&S.push({color:le.accentColor,range:{x:hf,y:pf,width:1,height:1},style:"solid-outline"}),S.length>0?S:void 0},[_o,df,hf,pf,jt,ht.length,le.accentColor,K]),Aw=w.useRef(ht);Aw.current=ht;const Rr=w.useCallback(([S,z],F=!1)=>{var Z,X,J,se,re,Ce,Me;const W=on&&z===Xn-1;if(S===0&&Er)return W?Ug:{kind:Qr.Marker,allowOverlay:!1,checkboxStyle:Ns,checked:(q==null?void 0:q.rows.hasIndex(z))===!0,markerKind:Wr==="clickable-number"?"number":Wr,row:Cl+z,drawHandle:Ni!==void 0,cursor:Wr==="clickable-number"?"pointer":void 0};if(W){const We=S===K?(me==null?void 0:me.hint)??"":"",Xe=Aw.current[S];if(((Z=Xe==null?void 0:Xe.trailingRowOptions)==null?void 0:Z.disabled)===!0)return Ug;{const At=((X=Xe==null?void 0:Xe.trailingRowOptions)==null?void 0:X.hint)??We,qe=((J=Xe==null?void 0:Xe.trailingRowOptions)==null?void 0:J.addIcon)??(me==null?void 0:me.addIcon);return{kind:Qr.NewRow,hint:At,allowOverlay:!1,icon:qe}}}else{const ke=S-K;if(F||(sn==null?void 0:sn.strict)===!0){const Xe=ln.current,At=Xe.x>ke||ke>Xe.x+Xe.width||Xe.y>z||z>Xe.y+Xe.height||z>=Up.current,qe=ke===((re=(se=Xe.extras)==null?void 0:se.selected)==null?void 0:re[0])&&z===((Ce=Xe.extras)==null?void 0:Ce.selected[1]);let $e=!1;if(((Me=Xe.extras)==null?void 0:Me.freezeRegions)!==void 0){for(const Yt of Xe.extras.freezeRegions)if(vp(Yt,ke,z)){$e=!0;break}}if(At&&!qe&&!$e)return Ug}let We=k([ke,z]);return K!==0&&We.span!==void 0&&(We={...We,span:[We.span[0]+K,We.span[1]+K]}),We}},[on,Xn,Er,Ns,q==null?void 0:q.rows,Wr,Cl,Ni,K,me==null?void 0:me.hint,me==null?void 0:me.addIcon,sn==null?void 0:sn.strict,k]),Vp=w.useCallback(S=>{let z=(et==null?void 0:et(S))??{name:S};return L!==void 0&&S!==""&&(z={icon:z.icon,name:z.name,overrideTheme:z.overrideTheme,actions:[...z.actions??[],{title:"Rename",icon:"renameIcon",onClick:F=>Xp({group:z.name,bounds:F.bounds})}]}),z},[et,L]),gf=w.useCallback(S=>{var J;const[z,F]=S.cell,W=ht[z],V=(W==null?void 0:W.group)!==void 0?(J=Vp(W.group))==null?void 0:J.overrideTheme:void 0,Z=W==null?void 0:W.themeOverride,X=p==null?void 0:p(F);s({...S,theme:yo(le,V,Z,X,S.content.themeOverride)})},[p,ht,Vp,le]),Ol=w.useCallback((S,z,F)=>{var X;if(q.current===void 0)return;const[W,V]=q.current.cell,Z=Rr([W,V]);if(Z.kind!==Se.Boolean&&Z.allowOverlay){let J=Z;if(F!==void 0)switch(J.kind){case Se.Number:{const se=DD(()=>F==="-"?-0:Number.parseFloat(F),0);J={...J,data:Number.isNaN(se)?0:se};break}case Se.Text:case Se.Markdown:case Se.Uri:J={...J,data:F};break}gf({target:S,content:J,initialValue:F,cell:[W,V],highlight:F===void 0,forceEditMode:F!==void 0})}else Z.kind===Se.Boolean&&z&&Z.readonly!==!0&&(Ur([{location:q.current.cell,value:{...Z,data:vE(Z.data)}}]),(X=gr.current)==null||X.damage([{cell:q.current.cell}]))},[Rr,q,Ur,gf]),Mw=w.useCallback((S,z)=>{var V;const F=(V=gr.current)==null?void 0:V.getBounds(S,z);if(F===void 0||c.current===null)return;const W=Rr([S,z]);W.allowOverlay&&gf({target:F,content:W,initialValue:void 0,highlight:!0,cell:[S,z],forceEditMode:!0})},[Rr,gf]),bn=w.useCallback((S,z,F="both",W=0,V=0,Z=void 0)=>{if(c.current!==null){const X=gr.current,J=l.current,se=typeof S!="number"?S.unit==="cell"?S.amount:void 0:S,re=typeof z!="number"?z.unit==="cell"?z.amount:void 0:z,Ce=typeof S!="number"&&S.unit==="px"?S.amount:void 0,Me=typeof z!="number"&&z.unit==="px"?z.amount:void 0;if(X!==null&&J!==null){let ke={x:0,y:0,width:0,height:0},We=0,Xe=0;if((se!==void 0||re!==void 0)&&(ke=X.getBounds((se??0)+K,re??0)??ke,ke.width===0||ke.height===0))return;const At=J.getBoundingClientRect(),qe=At.width/J.offsetWidth;if(Ce!==void 0&&(ke={...ke,x:Ce-At.left-c.current.scrollLeft,width:1}),Me!==void 0&&(ke={...ke,y:Me+At.top-c.current.scrollTop,height:1}),ke!==void 0){const $e={x:ke.x-W,y:ke.y-V,width:ke.width+2*W,height:ke.height+2*V};let Yt=0;for(let Zp=0;Zp0&&(Gn=yl(Xn,xn,ir));let hi=Yt*qe+At.left+K*ds*qe,Bi=At.right,pi=At.top+at*qe,zi=At.bottom-Gn*qe;const xf=ke.width+W*2;switch(Z==null?void 0:Z.hAlign){case"start":Bi=hi+xf;break;case"end":hi=Bi-xf;break;case"center":hi=Math.floor((hi+Bi)/2)-xf/2,Bi=hi+xf;break}const kf=ke.height+V*2;switch(Z==null?void 0:Z.vAlign){case"start":zi=pi+kf;break;case"end":pi=zi-kf;break;case"center":pi=Math.floor((pi+zi)/2)-kf/2,zi=pi+kf;break}hi>$e.x?We=$e.x-hi:Bi<$e.x+$e.width&&(We=$e.x+$e.width-Bi),pi>$e.y?Xe=$e.y-pi:zi<$e.y+$e.height&&(Xe=$e.y+$e.height-zi),F==="vertical"||typeof S=="number"&&S=Xn-xn)&&(Xe=0),(We!==0||Xe!==0)&&(qe!==1&&(We/=qe,Xe/=qe),c.current.scrollTo(We+c.current.scrollLeft,Xe+c.current.scrollTop))}}}},[K,Ie,ds,at,lt,Dt,Xn,Io,ir]),Rw=w.useRef(Mw),Ow=w.useRef(k),Up=w.useRef(y);Rw.current=Mw,Ow.current=k,Up.current=y;const Pl=w.useCallback(async(S,z=!0)=>{var se;const F=ht[S];if(((se=F==null?void 0:F.trailingRowOptions)==null?void 0:se.disabled)===!0)return;const W=ot==null?void 0:ot();let V,Z=!0;W!==void 0&&(V=await W,V==="top"&&(Z=!1),typeof V=="number"&&(Z=!1));let X=0;const J=()=>{if(Up.current<=y){X<500&&window.setTimeout(J,X),X=50+X*2;return}const re=typeof V=="number"?V:Z?y:0;bf.current(S-K,re),ie({cell:[S,re],range:{x:S,y:re,width:1,height:1}},!1,!1,"edit");const Ce=Ow.current([S-K,re]);Ce.allowOverlay&&_u(Ce)&&Ce.readonly!==!0&&z&&window.setTimeout(()=>{Rw.current(S,re)},0)};J()},[ht,ot,K,y,ie]),mf=w.useCallback(S=>{var F,W;const z=((W=(F=Dt[S])==null?void 0:F.trailingRowOptions)==null?void 0:W.targetColumn)??(me==null?void 0:me.targetColumn);if(typeof z=="number")return z+(Er?1:0);if(typeof z=="object"){const V=g.indexOf(z);if(V>=0)return V+(Er?1:0)}},[Dt,g,Er,me==null?void 0:me.targetColumn]),Bs=w.useRef(),Il=w.useRef(),nu=w.useCallback((S,z)=>{var V;const[F,W]=z;return yo(le,(V=ht[F])==null?void 0:V.themeOverride,p==null?void 0:p(W),S.themeOverride)},[p,ht,le]),ru=w.useCallback(S=>{var Ce,Me,ke;const z=bh.value?S.metaKey:S.ctrlKey,F=z&&He==="multi",W=z&&pe==="multi",[V,Z]=S.location,X=q.columns,J=q.rows,[se,re]=((Ce=q.current)==null?void 0:Ce.cell)??[];if(S.kind==="cell"){if(Il.current=void 0,No.current=[V,Z],V===0&&Er){if(on===!0&&Z===y||Wr==="number"||He==="none")return;const We=Rr(S.location);if(We.kind!==Qr.Marker)return;if(Ni!==void 0){const qe=Te(We);_r((qe==null?void 0:qe.kind)===Qr.Marker);const $e=(Me=qe==null?void 0:qe.onClick)==null?void 0:Me.call(qe,{...S,cell:We,posX:S.localEventX,posY:S.localEventY,bounds:S.bounds,theme:nu(We,S.location),preventDefault:()=>{}});if($e===void 0||$e.checked===We.checked)return}s(void 0),sr();const Xe=J.hasIndex(Z),At=Bs.current;if(He==="multi"&&(S.shiftKey||S.isLongTouch===!0)&&At!==void 0&&J.hasIndex(At)){const qe=[Math.min(At,Z),Math.max(At,Z)+1];F||Je==="multi"?xe(void 0,qe,!0):xe(Ot.fromSingleSelection(qe),void 0,F)}else F||S.isTouch||Je==="multi"?Xe?xe(J.remove(Z),void 0,!0):(xe(void 0,Z,!0),Bs.current=Z):Xe&&J.length===1?xe(Ot.empty(),void 0,z):(xe(Ot.fromSingleSelection(Z),void 0,z),Bs.current=Z)}else if(V>=K&&on&&Z===y){const We=mf(V);Pl(We??V)}else if(se!==V||re!==Z){const We=Rr(S.location),Xe=Te(We);if((Xe==null?void 0:Xe.onSelect)!==void 0){let $e=!1;if(Xe.onSelect({...S,cell:We,posX:S.localEventX,posY:S.localEventY,bounds:S.bounds,preventDefault:()=>$e=!0,theme:nu(We,S.location)}),$e)return}const At=Io&&Z===y,qe=Io&&q!==void 0&&((ke=q.current)==null?void 0:ke.cell[1])===y;if((S.shiftKey||S.isLongTouch===!0)&&se!==void 0&&re!==void 0&&q.current!==void 0&&!qe){if(At)return;const $e=Math.min(V,se),Yt=Math.max(V,se),Gn=Math.min(Z,re),xn=Math.max(Z,re);ie({...q.current,range:{x:$e,y:Gn,width:Yt-$e+1,height:xn-Gn+1}},!0,z,"click"),Bs.current=void 0,sr()}else ie({cell:[V,Z],range:{x:V,y:Z,width:1,height:1}},!0,z,"click"),Bs.current=void 0,s(void 0),sr()}}else if(S.kind==="header")if(No.current=[V,Z],s(void 0),Er&&V===0)Bs.current=void 0,Il.current=void 0,He==="multi"&&(J.length!==y?xe(Ot.fromSingleSelection([0,y]),void 0,z):xe(Ot.empty(),void 0,z),sr());else{const We=Il.current;if(pe==="multi"&&(S.shiftKey||S.isLongTouch===!0)&&We!==void 0&&X.hasIndex(We)){const Xe=[Math.min(We,V),Math.max(We,V)+1];W?ge(void 0,Xe,z):ge(Ot.fromSingleSelection(Xe),void 0,z)}else W?(X.hasIndex(V)?ge(X.remove(V),void 0,z):ge(void 0,V,z),Il.current=V):pe!=="none"&&(ge(Ot.fromSingleSelection(V),void 0,z),Il.current=V);Bs.current=void 0,sr()}else S.kind===Dr?No.current=[V,Z]:S.kind===xh&&!S.isMaybeScrollbar&&(pr(Yf,!1),s(void 0),sr(),dn==null||dn(),Bs.current=void 0,Il.current=void 0)},[Pl,pe,sr,Te,mf,Rr,q,Er,Io,dn,Ni,K,Wr,He,Je,y,ie,pr,ge,xe,on,nu]),iu=w.useRef(!1),No=w.useRef(),Pw=w.useRef(wn),Kr=w.useRef(),KM=w.useCallback(S=>{if(Dl.current=!1,Pw.current=ln.current,S.button!==0&&S.button!==1){Kr.current=void 0;return}const z=performance.now();Kr.current={button:S.button,time:z,location:S.location},(S==null?void 0:S.kind)==="header"&&(iu.current=!0);const F=S.kind==="cell"&&S.isFillHandle;!F&&S.kind!=="cell"&&S.isEdge||(u({previousSelection:q,fillHandle:F}),No.current=void 0,!S.isTouch&&S.button===0&&!F?ru(S):!S.isTouch&&S.button===1&&(No.current=S.location))},[q,ru]),[Kp,Xp]=w.useState(),Iw=w.useCallback(S=>{if(S.kind!==Dr||pe!=="multi")return;const z=bh.value?S.metaKey:S.ctrlKey,[F]=S.location,W=q.columns;if(F=K&&Cc(V.group,ht[J].group);J--)Z--;for(let J=F+1;J{if(En!==void 0&&ci!==void 0){const z=ln.current.y,F=ln.current.height;let W=En({x:S,y:z,width:1,height:Math.min(F,y-z)},Kn.current.signal);typeof W!="object"&&(W=await W());const V=Dt[S-K],X=document.createElement("canvas").getContext("2d",{alpha:!1});if(X!==null){X.font=le.baseFontFull;const J=VT(X,le,V,0,W,Tr,ai,!1,Te);ci==null||ci(V,J.width,S,J.width)}}},[Dt,En,ai,le,Tr,ci,K,y,Te]),[XM,Gp]=w.useState(),_l=w.useCallback(async(S,z)=>{var J,se;const F=(J=S.current)==null?void 0:J.range;if(F===void 0||En===void 0||z.current===void 0)return;const W=z.current.range;if(T!==void 0){let re=!1;if(T({fillDestination:{...W,x:W.x-K},patternSource:{...F,x:F.x-K},preventDefault:()=>re=!0}),re)return}let V=En(F,Kn.current.signal);typeof V!="object"&&(V=await V());const Z=V,X=[];for(let re=0;re({cell:re.location})))},[En,Ur,T,K]),Dw=w.useCallback(()=>{if(q.current===void 0||q.current.range.width<=1)return;const S={...q,current:{...q.current,range:{...q.current.range,width:1}}};_l(S,q)},[_l,q]),_w=w.useCallback(()=>{if(q.current===void 0||q.current.range.height<=1)return;const S={...q,current:{...q.current,range:{...q.current.range,height:1}}};_l(S,q)},[_l,q]),GM=w.useCallback((S,z)=>{var Ce,Me;const F=a;if(u(void 0),Wp(void 0),Gp(void 0),iu.current=!1,z)return;if((F==null?void 0:F.fillHandle)===!0&&q.current!==void 0&&((Ce=F.previousSelection)==null?void 0:Ce.current)!==void 0){if(_o===void 0)return;const ke={...q,current:{...q.current,range:eE(F.previousSelection.current.range,_o)}};_l(F.previousSelection,ke),pr(ke,!0);return}const[W,V]=S.location,[Z,X]=No.current??[],J=()=>{Dl.current=!0},se=ke=>{var Xe,At,qe;const We=ke.isTouch||Z===W&&X===V;if(We&&(x==null||x([W-K,V],{...ke,preventDefault:J})),ke.button===1)return!Dl.current;if(!Dl.current){const $e=Rr(S.location),Yt=Te($e);if(Yt!==void 0&&Yt.onClick!==void 0&&We){const xn=Yt.onClick({...ke,cell:$e,posX:ke.localEventX,posY:ke.localEventY,bounds:ke.bounds,theme:nu($e,S.location),preventDefault:J});xn!==void 0&&!ta(xn)&&$l(xn)&&(Ur([{location:ke.location,value:xn}]),(Xe=gr.current)==null||Xe.damage([{cell:ke.location}]))}if(Dl.current||q.current===void 0)return!1;let Gn=!1;switch($e.activationBehaviorOverride??ne){case"double-click":case"second-click":{if(((qe=(At=F==null?void 0:F.previousSelection)==null?void 0:At.current)==null?void 0:qe.cell)===void 0)break;const[xn,hi]=q.current.cell,[Bi,pi]=F.previousSelection.current.cell;Gn=W===xn&&W===Bi&&V===hi&&V===pi&&(ke.isDoubleClick===!0||ne==="second-click");break}case"single-click":{Gn=!0;break}}if(Gn)return C==null||C([W-K,V]),Ol(ke.bounds,!1),!0}return!1},re=S.location[0]-K;if(S.isTouch){const ke=ln.current,We=Pw.current;if(ke.x!==We.x||ke.y!==We.y)return;if(S.isLongTouch===!0){if(S.kind==="cell"&&qu((Me=q.current)==null?void 0:Me.cell,S.location)){te==null||te([re,S.location[1]],{...S,preventDefault:J});return}else if(S.kind==="header"&&q.columns.hasIndex(W)){Y==null||Y(re,{...S,preventDefault:J});return}else if(S.kind===Dr){if(re<0)return;A==null||A(re,{...S,preventDefault:J});return}}S.kind==="cell"?se(S)||ru(S):S.kind===Dr?Q==null||Q(re,{...S,preventDefault:J}):(S.kind===Xs&&(N==null||N(re,{...S,preventDefault:J})),ru(S));return}if(S.kind==="header"){if(re<0)return;S.isEdge?S.isDoubleClick===!0&&yf(W):S.button===0&&W===Z&&V===X&&(N==null||N(re,{...S,preventDefault:J}))}if(S.kind===Dr){if(re<0)return;S.button===0&&W===Z&&V===X&&(Q==null||Q(re,{...S,preventDefault:J}),Dl.current||Iw(S))}S.kind==="cell"&&(S.button===0||S.button===1)&&se(S),No.current=void 0},[a,q,K,_o,_l,pr,x,Rr,Te,ne,nu,Ur,C,Ol,te,Y,A,ru,Q,N,yf,Iw]),YM=w.useCallback(S=>{const z={...S,location:[S.location[0]-K,S.location[1]]};vt==null||vt(z),a!==void 0&&S.buttons===0&&(u(void 0),Wp(void 0),Gp(void 0),iu.current=!1),Gp(F=>{var W;return iu.current?[S.scrollEdge[0],0]:S.scrollEdge[0]===(F==null?void 0:F[0])&&S.scrollEdge[1]===F[1]?F:a===void 0||(((W=Kr.current)==null?void 0:W.location[0])??0){Fe==null||Fe(S-K,z)},[Fe,K]),Fi=(Hw=q==null?void 0:q.current)==null?void 0:Hw.cell,QM=w.useCallback((S,z,F,W,V,Z)=>{Rt.current=!1;let X=Fi;X!==void 0&&(X=[X[0]-K,X[1]]);const J=lt===0?void 0:{x:0,y:S.y,width:lt,height:S.height},se=[];J!==void 0&&se.push(J),Ie>0&&(se.push({x:S.x-K,y:y-Ie,width:S.width,height:Ie}),lt>0&&se.push({x:0,y:y-Ie,width:lt,height:Ie}));const re={x:S.x-K,y:S.y,width:S.width,height:on&&S.y+S.height>=y?S.height-1:S.height,tx:V,ty:Z,extras:{selected:X,freezeRegion:J,freezeRegions:se}};ln.current=re,Mr(re),tt([z,F,W]),be==null||be(re,re.tx,re.ty,re.extras)},[Fi,K,on,y,lt,Ie,Mr,be]),JM=Ll(Ne,w.useCallback((S,z)=>{Ne==null||Ne(S-K,z-K),pe!=="none"&&ge(Ot.fromSingleSelection(z),void 0,!0)},[pe,Ne,K,ge])),Yp=w.useRef(!1),ZM=w.useCallback(S=>{if(S.location[0]===0&&K>0){S.preventDefault();return}ft==null||ft({...S,location:[S.location[0]-K,S.location[1]]}),S.defaultPrevented()||(Yp.current=!0),u(void 0)},[ft,K]),eR=w.useCallback(()=>{Yp.current=!1},[]),qp=w.useRef(),Qp=w.useCallback(S=>{var z,F,W;if(!mE(S,qp.current)&&(qp.current=S,!(((z=Kr==null?void 0:Kr.current)==null?void 0:z.button)!==void 0&&Kr.current.button>=1))){if(S.buttons!==0&&a!==void 0&&((F=Kr.current)==null?void 0:F.location[0])===0&&S.location[0]===0&&K===1&&He==="multi"&&a.previousSelection&&!a.previousSelection.rows.hasIndex(Kr.current.location[1])&&q.rows.hasIndex(Kr.current.location[1])){const V=Math.min(Kr.current.location[1],S.location[1]),Z=Math.max(Kr.current.location[1],S.location[1])+1;xe(Ot.fromSingleSelection([V,Z]),void 0,!1)}if(S.buttons!==0&&a!==void 0&&q.current!==void 0&&!Yp.current&&!iu.current&&(Pe==="rect"||Pe==="multi-rect")){const[V,Z]=q.current.cell;let[X,J]=S.location;if(J<0&&(J=ln.current.y),a.fillHandle===!0&&((W=a.previousSelection)==null?void 0:W.current)!==void 0){const se=a.previousSelection.current.range;J=Math.min(J,on?y-1:y);const re=_z(se,X,J,Et);Wp(re)}else{if(on&&Z===y)return;if(on&&J===y)if(S.kind===xh)J--;else return;X=Math.max(X,K);const Ce=X-V,Me=J-Z,ke={x:Ce>=0?V:X,y:Me>=0?Z:J,width:Math.abs(Ce)+1,height:Math.abs(Me)+1};ie({...q.current,range:ke},!0,!1,"drag")}}Jt==null||Jt({...S,location:[S.location[0]-K,S.location[1]]})}},[Et,a,K,He,q,Pe,Jt,xe,on,y,ie]),tR=w.useCallback(()=>{var X,J;const S=qp.current;if(S===void 0)return;const[z,F]=S.scrollEdge;let[W,V]=S.location;const Z=ln.current;z===-1?W=((J=(X=Z.extras)==null?void 0:X.freezeRegion)==null?void 0:J.x)??Z.x:z===1&&(W=Z.x+Z.width),F===-1?V=Math.max(0,Z.y):F===1&&(V=Math.min(y-1,Z.y+Z.height)),W=xi(W,0,ht.length-1),V=xi(V,0,y-1),Qp({...S,location:[W,V]})},[ht.length,Qp,y]);jW(XM,c,tR);const di=w.useCallback(S=>{if(q.current===void 0)return;const[z,F]=S,[W,V]=q.current.cell,Z=q.current.range;let X=Z.x,J=Z.x+Z.width,se=Z.y,re=Z.y+Z.height;if(F!==0)switch(F){case 2:{re=y,se=V,bn(0,re,"vertical");break}case-2:{se=0,re=V+1,bn(0,se,"vertical");break}case 1:{seV+1?(re--,bn(0,re,"vertical")):(se=Math.max(0,se-1),bn(0,se,"vertical"));break}default:Sc()}if(z!==0)if(z===2)J=ht.length,X=W,bn(J-1-K,0,"horizontal");else if(z===-2)X=K,J=W+1,bn(X-K,0,"horizontal");else{let Ce=[];if(En!==void 0){const Me=En({x:X,y:se,width:J-X-K,height:re-se},Kn.current.signal);typeof Me=="object"&&(Ce=XW(Me))}if(z===1){let Me=!1;if(X0){const ke=Uo(X+1,W+1).find(We=>!Ce.includes(We-K));ke!==void 0&&(X=ke,Me=!0)}else X++,Me=!0;Me&&bn(X,0,"horizontal")}Me||(J=Math.min(ht.length,J+1),bn(J-1-K,0,"horizontal"))}else if(z===-1){let Me=!1;if(J>W+1){if(Ce.length>0){const ke=Uo(J-1,W,-1).find(We=>!Ce.includes(We-K));ke!==void 0&&(J=ke,Me=!0)}else J--,Me=!0;Me&&bn(J-K,0,"horizontal")}Me||(X=Math.max(K,X-1),bn(X-K,0,"horizontal"))}else Sc()}ie({cell:q.current.cell,range:{x:X,y:se,width:J-X,height:re-se}},!0,!1,"keyboard-select")},[En,q,ht.length,K,y,bn,ie]),zs=w.useCallback((S,z,F,W)=>{const V=Xn-(F?0:1);if(S=xi(S,K,Dt.length-1+K),z=xi(z,0,V),S===(Fi==null?void 0:Fi[0])&&z===(Fi==null?void 0:Fi[1]))return!1;if(W&&q.current!==void 0){const Z=[...q.current.rangeStack];(q.current.range.width>1||q.current.range.height>1)&&Z.push(q.current.range),pr({...q,current:{cell:[S,z],range:{x:S,y:z,width:1,height:1},rangeStack:Z}},!0)}else ie({cell:[S,z],range:{x:S,y:z,width:1,height:1}},!0,!1,"keyboard-nav");return f.current!==void 0&&f.current[0]===S&&f.current[1]===z&&(f.current=void 0),bn(S-K,z),!0},[Xn,K,Dt.length,Fi,q,bn,pr,ie]),nR=w.useCallback((S,z)=>{(i==null?void 0:i.cell)!==void 0&&S!==void 0&&$l(S)&&(Ur([{location:i.cell,value:S}]),window.requestAnimationFrame(()=>{var V;(V=gr.current)==null||V.damage([{cell:i.cell}])})),sr(!0),s(void 0);const[F,W]=z;if(q.current!==void 0&&(F!==0||W!==0)){const V=q.current.cell[1]===Xn-1&&S!==void 0;zs(xi(q.current.cell[0]+F,0,ht.length-1),xi(q.current.cell[1]+W,0,Xn-1),V,!1)}E==null||E(S,z)},[i==null?void 0:i.cell,sr,q,E,Ur,Xn,zs,ht.length]),rR=w.useMemo(()=>`gdg-overlay-${KW++}`,[]),Lo=w.useCallback(S=>{var F,W,V,Z;sr();const z=[];for(let X=S.x;X({cell:X.location})))},[sr,k,Te,Ur,K]),su=i!==void 0,Nw=w.useCallback(S=>{var We,Xe;const z=()=>{S.stopPropagation(),S.preventDefault()},F={didMatch:!1},{bounds:W}=S,V=q.columns,Z=q.rows,X=ui;if(!su&>(X.clear,S,F))pr(Yf,!1),dn==null||dn();else if(!su&>(X.selectAll,S,F))pr({columns:Ot.empty(),rows:Ot.empty(),current:{cell:((We=q.current)==null?void 0:We.cell)??[K,0],range:{x:K,y:0,width:g.length,height:y},rangeStack:[]}},!1);else if(gt(X.search,S,F))(Xe=o==null?void 0:o.current)==null||Xe.focus({preventScroll:!0}),cf(!0);else if(gt(X.delete,S,F)){const At=($==null?void 0:$(q))??!0;if(At!==!1){const qe=At===!0?q:At;if(qe.current!==void 0){Lo(qe.current.range);for(const $e of qe.current.rangeStack)Lo($e)}for(const $e of qe.rows)Lo({x:K,y:$e,width:g.length,height:1});for(const $e of qe.columns)Lo({x:$e,y:0,width:1,height:y})}}if(F.didMatch)return z(),!0;if(q.current===void 0)return!1;let[J,se]=q.current.cell,re=!1,Ce=!1;gt(X.scrollToSelectedCell,S,F)?bf.current(J-K,se):pe!=="none"&>(X.selectColumn,S,F)?V.hasIndex(J)?ge(V.remove(J),void 0,!0):pe==="single"?ge(Ot.fromSingleSelection(J),void 0,!0):ge(void 0,J,!0):He!=="none"&>(X.selectRow,S,F)?Z.hasIndex(se)?xe(Z.remove(se),void 0,!0):He==="single"?xe(Ot.fromSingleSelection(se),void 0,!0):xe(void 0,se,!0):!su&&W!==void 0&>(X.activateCell,S,F)?se===y&&on?window.setTimeout(()=>{const At=mf(J);Pl(At??J)},0):(C==null||C([J-K,se]),Ol(W,!0)):q.current.range.height>1&>(X.downFill,S,F)?_w():q.current.range.width>1&>(X.rightFill,S,F)?Dw():gt(X.goToNextPage,S,F)?se+=Math.max(1,ln.current.height-4):gt(X.goToPreviousPage,S,F)?se-=Math.max(1,ln.current.height-4):gt(X.goToFirstCell,S,F)?(s(void 0),se=0,J=0):gt(X.goToLastCell,S,F)?(s(void 0),se=Number.MAX_SAFE_INTEGER,J=Number.MAX_SAFE_INTEGER):gt(X.selectToFirstCell,S,F)?(s(void 0),di([-2,-2])):gt(X.selectToLastCell,S,F)?(s(void 0),di([2,2])):su?(gt(X.closeOverlay,S,F)&&s(void 0),gt(X.acceptOverlayDown,S,F)&&(s(void 0),se++),gt(X.acceptOverlayUp,S,F)&&(s(void 0),se--),gt(X.acceptOverlayLeft,S,F)&&(s(void 0),J--),gt(X.acceptOverlayRight,S,F)&&(s(void 0),J++)):(gt(X.goDownCell,S,F)?se+=1:gt(X.goUpCell,S,F)?se-=1:gt(X.goRightCell,S,F)?J+=1:gt(X.goLeftCell,S,F)?J-=1:gt(X.goDownCellRetainSelection,S,F)?(se+=1,re=!0):gt(X.goUpCellRetainSelection,S,F)?(se-=1,re=!0):gt(X.goRightCellRetainSelection,S,F)?(J+=1,re=!0):gt(X.goLeftCellRetainSelection,S,F)?(J-=1,re=!0):gt(X.goToLastRow,S,F)?se=y-1:gt(X.goToFirstRow,S,F)?se=Number.MIN_SAFE_INTEGER:gt(X.goToLastColumn,S,F)?J=Number.MAX_SAFE_INTEGER:gt(X.goToFirstColumn,S,F)?J=Number.MIN_SAFE_INTEGER:(Pe==="rect"||Pe==="multi-rect")&&(gt(X.selectGrowDown,S,F)?di([0,1]):gt(X.selectGrowUp,S,F)?di([0,-1]):gt(X.selectGrowRight,S,F)?di([1,0]):gt(X.selectGrowLeft,S,F)?di([-1,0]):gt(X.selectToLastRow,S,F)?di([0,2]):gt(X.selectToFirstRow,S,F)?di([0,-2]):gt(X.selectToLastColumn,S,F)?di([2,0]):gt(X.selectToFirstColumn,S,F)&&di([-2,0])),Ce=F.didMatch);const Me=zs(J,se,!1,re),ke=F.didMatch;return ke&&(Me||!Ce||rf)&&z(),ke},[su,q,ui,pe,He,Pe,K,y,zs,pr,dn,g.length,$,rf,Lo,ge,xe,on,mf,Pl,C,Ol,_w,Dw,di]),ou=w.useCallback(S=>{let z=!1;if(De!==void 0&&De({...S,cancel:()=>{z=!0}}),z||Nw(S)||q.current===void 0)return;const[F,W]=q.current.cell,V=ln.current;if(ct&&!S.metaKey&&!S.ctrlKey&&q.current!==void 0&&S.key.length===1&&/[ -~]/g.test(S.key)&&S.bounds!==void 0&&_u(k([F-K,Math.max(0,Math.min(W,y-1))]))){if((!on||W!==y)&&(V.y>W||W>V.y+V.height||V.x>F||F>V.x+V.width))return;Ol(S.bounds,!0,S.key),S.stopPropagation(),S.preventDefault()}},[ct,De,Nw,q,k,K,y,on,Ol]),iR=w.useCallback((S,z)=>{const F=S.location[0]-K;if(S.kind==="header"&&(Y==null||Y(F,{...S,preventDefault:z})),S.kind===Dr){if(F<0)return;A==null||A(F,{...S,preventDefault:z})}if(S.kind==="cell"){const[W,V]=S.location;te==null||te([F,V],{...S,preventDefault:z}),O4(q,S.location)||zs(W,V,!1,!1)}},[q,te,A,Y,K,zs]),Jp=w.useCallback(async S=>{var X,J,se;if(!ui.paste)return;function z(re,Ce,Me,ke){var Xe,At;const We=typeof Me=="object"?(Me==null?void 0:Me.join(` -`))??"":(Me==null?void 0:Me.toString())??"";if(!ta(re)&&_u(re)&&re.readonly!==!0){const qe=M==null?void 0:M(We,re);if(qe!==void 0&&$l(qe))return{location:Ce,value:qe};const $e=Te(re);if($e===void 0)return;if($e.kind===Se.Custom){_r(re.kind===Se.Custom);const Yt=(Xe=$e.onPaste)==null?void 0:Xe.call($e,We,re.data);return Yt===void 0?void 0:{location:Ce,value:{...re,data:Yt}}}else{const Yt=(At=$e.onPaste)==null?void 0:At.call($e,We,re,{formatted:ke,formattedString:typeof ke=="string"?ke:ke==null?void 0:ke.join(` -`),rawValue:Me});return Yt===void 0?void 0:(_r(Yt.kind===re.kind),{location:Ce,value:Yt})}}}const F=q.columns,W=q.rows,V=((X=c.current)==null?void 0:X.contains(document.activeElement))===!0||((J=l.current)==null?void 0:J.contains(document.activeElement))===!0;let Z;if(q.current!==void 0?Z=[q.current.range.x,q.current.range.y]:F.length===1?Z=[F.first()??0,0]:W.length===1&&(Z=[K,W.first()??0]),V&&Z!==void 0){let re,Ce;const Me="text/plain",ke="text/html";if(navigator.clipboard.read!==void 0){const qe=await navigator.clipboard.read();for(const $e of qe){if($e.types.includes(ke)){const Gn=await(await $e.getType(ke)).text(),xn=Tx(Gn);if(xn!==void 0){re=xn;break}}$e.types.includes(Me)&&(Ce=await(await $e.getType(Me)).text())}}else if(navigator.clipboard.readText!==void 0)Ce=await navigator.clipboard.readText();else if(S!==void 0&&(S==null?void 0:S.clipboardData)!==null){if(S.clipboardData.types.includes(ke)){const qe=S.clipboardData.getData(ke);re=Tx(qe)}re===void 0&&S.clipboardData.types.includes(Me)&&(Ce=S.clipboardData.getData(Me))}else return;const[We,Xe]=Z,At=[];do{if(he===void 0){const qe=Rr(Z),$e=Ce??(re==null?void 0:re.map(Gn=>Gn.map(xn=>xn.rawValue).join(" ")).join(" "))??"",Yt=z(qe,Z,$e,void 0);Yt!==void 0&&At.push(Yt);break}if(re===void 0){if(Ce===void 0)return;re=NW(Ce)}if(he===!1||typeof he=="function"&&(he==null?void 0:he([Z[0]-K,Z[1]],re.map(qe=>qe.map($e=>{var Yt;return((Yt=$e.rawValue)==null?void 0:Yt.toString())??""}))))!==!0)return;for(const[qe,$e]of re.entries()){if(qe+Xe>=y)break;for(const[Yt,Gn]of $e.entries()){const xn=[Yt+We,qe+Xe],[hi,Bi]=xn;if(hi>=ht.length||Bi>=Xn)continue;const pi=Rr(xn),zi=z(pi,xn,Gn.rawValue,Gn.formatted);zi!==void 0&&At.push(zi)}}}while(!1);Ur(At),(se=gr.current)==null||se.damage(At.map(qe=>({cell:qe.location})))}},[M,Te,Rr,q,ui.paste,ht.length,Ur,Xn,he,K,y]);$n("paste",Jp,d,!1,!0);const lu=w.useCallback(async(S,z)=>{var X,J;if(!ui.copy)return;const F=z===!0||((X=c.current)==null?void 0:X.contains(document.activeElement))===!0||((J=l.current)==null?void 0:J.contains(document.activeElement))===!0,W=q.columns,V=q.rows,Z=(se,re)=>{if(!st)Ax(se,re,S);else{const Ce=re.map(Me=>({kind:Se.Text,data:g[Me].title,displayData:g[Me].title,allowOverlay:!1}));Ax([Ce,...se],re,S)}};if(F&&En!==void 0){if(q.current!==void 0){let se=En(q.current.range,Kn.current.signal);typeof se!="object"&&(se=await se()),Z(se,Uo(q.current.range.x-K,q.current.range.x+q.current.range.width-K))}else if(V!==void 0&&V.length>0){const re=[...V].map(Ce=>{const Me=En({x:K,y:Ce,width:g.length,height:1},Kn.current.signal);return typeof Me=="object"?Me[0]:Me().then(ke=>ke[0])});if(re.some(Ce=>Ce instanceof Promise)){const Ce=await Promise.all(re);Z(Ce,Uo(g.length))}else Z(re,Uo(g.length))}else if(W.length>0){const se=[],re=[];for(const Ce of W){let Me=En({x:Ce,y:0,width:1,height:y},Kn.current.signal);typeof Me!="object"&&(Me=await Me()),se.push(Me),re.push(Ce-K)}if(se.length===1)Z(se[0],re);else{const Ce=se.reduce((Me,ke)=>Me.map((We,Xe)=>[...We,...ke[Xe]]));Z(Ce,re)}}}},[g,En,q,ui.copy,K,y,st]);$n("copy",lu,d,!1,!1);const sR=w.useCallback(async S=>{var F,W;if(!(!ui.cut||!(((F=c.current)==null?void 0:F.contains(document.activeElement))===!0||((W=l.current)==null?void 0:W.contains(document.activeElement))===!0))&&(await lu(S),q.current!==void 0)){let V={current:{cell:q.current.cell,range:q.current.range,rangeStack:[]},rows:Ot.empty(),columns:Ot.empty()};const Z=$==null?void 0:$(V);if(Z===!1||(V=Z===!0?V:Z,V.current===void 0))return;Lo(V.current.range)}},[Lo,q,ui.cut,lu,$]);$n("cut",sR,d,!1,!1);const oR=w.useCallback((S,z)=>{if(B!==void 0){K!==0&&(S=S.map(V=>[V[0]-K,V[1]])),B(S,z);return}if(S.length===0||z===-1)return;const[F,W]=S[z];f.current!==void 0&&f.current[0]===F&&f.current[1]===W||(f.current=[F,W],zs(F,W,!1,!1))},[B,K,zs]),[vf,wf]=((jw=ee==null?void 0:ee.current)==null?void 0:jw.cell)??[],bf=w.useRef(bn);bf.current=bn,w.useLayoutEffect(()=>{var S,z,F,W;!Rt.current&&vf!==void 0&&wf!==void 0&&(vf!==((z=(S=Fs.current)==null?void 0:S.current)==null?void 0:z.cell[0])||wf!==((W=(F=Fs.current)==null?void 0:F.current)==null?void 0:W.cell[1]))&&bf.current(vf,wf),Rt.current=!1},[vf,wf]);const Lw=q.current!==void 0&&(q.current.cell[0]>=ht.length||q.current.cell[1]>=Xn);w.useLayoutEffect(()=>{Lw&&pr(Yf,!1)},[Lw,pr]);const lR=w.useMemo(()=>on===!0&&(me==null?void 0:me.tint)===!0?Ot.fromSingleSelection(Xn-1):Ot.empty(),[Xn,on,me==null?void 0:me.tint]),aR=w.useCallback(S=>typeof Mt=="boolean"?Mt:(Mt==null?void 0:Mt(S-K))??!0,[K,Mt]),uR=w.useMemo(()=>{if(Kp===void 0||l.current===null)return null;const{bounds:S,group:z}=Kp,F=l.current.getBoundingClientRect();return w.createElement(CW,{bounds:S,group:z,canvasBounds:F,onClose:()=>Xp(void 0),onFinish:W=>{Xp(void 0),L==null||L(z,W)}})},[L,Kp]),cR=Math.min(ht.length,lt+(Er?1:0));w.useImperativeHandle(e,()=>({appendRow:(S,z)=>Pl(S+K,z),updateCells:S=>{var z;return K!==0&&(S=S.map(F=>({cell:[F.cell[0]+K,F.cell[1]]}))),(z=gr.current)==null?void 0:z.damage(S)},getBounds:(S,z)=>{var F;if(!((l==null?void 0:l.current)===null||(c==null?void 0:c.current)===null)){if(S===void 0&&z===void 0){const W=l.current.getBoundingClientRect(),V=W.width/c.current.clientWidth;return{x:W.x-c.current.scrollLeft*V,y:W.y-c.current.scrollTop*V,width:c.current.scrollWidth*V,height:c.current.scrollHeight*V}}return(F=gr.current)==null?void 0:F.getBounds((S??0)+K,z)}},focus:()=>{var S;return(S=gr.current)==null?void 0:S.focus()},emit:async S=>{switch(S){case"delete":ou({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!1,key:"Delete",keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-right":ou({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"r",keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-down":ou({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"d",keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"copy":await lu(void 0,!0);break;case"paste":await Jp();break}},scrollTo:bn,remeasureColumns:S=>{for(const z of S)yf(z+K)}}),[Pl,yf,lu,ou,Jp,K,bn]);const[Fw,Bw]=Fi??[],fR=w.useCallback(S=>{const[z,F]=S;if(F===-1){pe!=="none"&&(ge(Ot.fromSingleSelection(z),void 0,!1),sr());return}Fw===z&&Bw===F||(ie({cell:S,range:{x:z,y:F,width:1,height:1}},!0,!1,"keyboard-nav"),bn(z,F))},[pe,sr,bn,Fw,Bw,ie,ge]),[dR,hR]=w.useState(!1),zw=w.useRef(xT(S=>{hR(S)},5)),pR=w.useCallback(()=>{zw.current(!0),q.current===void 0&&q.columns.length===0&&q.rows.length===0&&a===void 0&&ie({cell:[K,ff],range:{x:K,y:ff,width:1,height:1}},!0,!1,"keyboard-select")},[ff,q,a,K,ie]),gR=w.useCallback(()=>{zw.current(!1)},[]),[mR,yR]=w.useMemo(()=>{let S;const z=(sn==null?void 0:sn.scrollbarWidthOverride)??S0(),F=y+(on?1:0);if(typeof ir=="number")S=at+F*ir;else{let V=0;const Z=Math.min(F,10);for(let X=0;XZ.width+V,0)+z;return[`${Math.min(1e5,W)}px`,`${Math.min(1e5,S)}px`]},[ht,sn==null?void 0:sn.scrollbarWidthOverride,ir,y,on,at]),vR=w.useMemo(()=>U4(le),[le]);return w.createElement(K4.Provider,{value:le},w.createElement(zW,{style:vR,className:j,inWidth:b??mR,inHeight:v??yR},w.createElement(bW,{fillHandle:Zt,drawFocusRing:Mn,experimental:sn,fixedShadowX:ef,fixedShadowY:Ds,getRowThemeOverride:p,headerIcons:us,imageWindowLoader:cs,initialSize:vl,isDraggable:tf,onDragLeave:nf,onRowMoved:Ni,overscrollX:Fp,overscrollY:uf,preventDiagonalScrolling:xl,rightElement:Po,rightElementProps:_s,smoothScrollX:sf,smoothScrollY:Dp,className:j,enableGroups:Ft,onCanvasFocused:pR,onCanvasBlur:gR,canvasRef:l,onContextMenu:iR,theme:le,cellXOffset:Do,cellYOffset:ff,accessibilityHeight:wn.height,onDragEnd:eR,columns:ht,nonGrowWidth:Be,drawHeader:Hp,onColumnProposeMove:D,drawCell:jp,disabledRows:lR,freezeColumns:cR,lockColumns:K,firstColAccessible:K===0,getCellContent:Rr,minColumnWidth:Tr,maxColumnWidth:ai,searchInputRef:o,showSearch:eu,onSearchClose:zp,highlightRegions:UM,getCellsForSelection:En,getGroupDetails:Vp,headerHeight:Tl,isFocused:dR,groupHeaderHeight:Ft?Za:0,freezeTrailingRows:Ie+(on&&(me==null?void 0:me.sticky)===!0?1:0),hasAppendRow:on,onColumnResize:ci,onColumnResizeEnd:$p,onColumnResizeStart:Al,onCellFocused:fR,onColumnMoved:JM,onDragStart:ZM,onHeaderMenuClick:qM,onItemHovered:Qp,isFilling:(a==null?void 0:a.fillHandle)===!0,onMouseMove:YM,onKeyDown:ou,onKeyUp:Ze,onMouseDown:KM,onMouseUp:GM,onDragOverCell:Un,onDrop:ut,onSearchResultsChanged:oR,onVisibleRegionChanged:QM,clientSize:Ae,rowHeight:ir,searchResults:ce,searchValue:fe,onSearchValueChange:we,rows:Xn,scrollRef:c,selection:q,translateX:wn.tx,translateY:wn.ty,verticalBorder:aR,gridRef:gr,getCellRenderer:Te}),uR,i!==void 0&&w.createElement(w.Suspense,{fallback:null},w.createElement(UW,{...i,validateCell:tu,bloom:O,id:rR,getCellRenderer:Te,className:(sn==null?void 0:sn.isSubGrid)===!0?"click-outside-ignore":void 0,provideEditor:Ke,imageEditorOverride:h,onFinishEditing:nR,markdownDivCreateNode:m,isOutsideClick:of}))))},YW=w.forwardRef(GW),Ox=20,qW={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??"false"},kind:Se.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:t=>QW(t,t.cell.data,v0(t.cell),t.cell.maxSize??Ox),onDelete:t=>({...t,data:!1}),onClick:t=>{const{cell:e,posX:n,posY:r,bounds:i,theme:s}=t,{width:o,height:l,x:a,y:u}=i,c=e.maxSize??Ox,f=Math.floor(i.y+l/2),d=CT(c,l,s.cellVerticalPadding),h=ST(e.contentAlign??"center",a,o,s.cellHorizontalPadding,d),p=kT(h,f,d),m=TT(a+n,u+r,p);if(v0(e)&&m)return{...e,data:vE(e.data)}},onPaste:(t,e)=>{let n=ah;return t.toLowerCase()==="true"?n=!0:t.toLowerCase()==="false"?n=!1:t.toLowerCase()==="indeterminate"&&(n=Lv),n===e.data?void 0:{...e,data:n}}};function QW(t,e,n,r){if(!n&&e===ah)return;const{ctx:i,hoverAmount:s,theme:o,rect:l,highlighted:a,hoverX:u,hoverY:c,cell:{contentAlign:f}}=t,{x:d,y:h,width:p,height:m}=l,b=.35;let v=n?1-b+b*s:.4;e===ah&&(v*=s),v!==0&&(i.globalAlpha=v,qv(i,o,e,d,h,p,m,a,u,c,r,f),i.globalAlpha=1)}const JW=jr("div")({name:"BubblesOverlayEditorStyle",class:"gdg-b1ygi5by",propsAsIs:!1}),ZW=t=>{const{bubbles:e}=t;return w.createElement(JW,null,e.map((n,r)=>w.createElement("div",{key:r,className:"boe-bubble"},n)),w.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},e6={getAccessibilityString:t=>ET(t.data),kind:Se.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,e,n)=>e.data.reduce((r,i)=>t.measureText(i).width+r+20,0)+2*n.cellHorizontalPadding-4,draw:t=>n6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return w.createElement(ZW,{bubbles:e.data})},onPaste:()=>{}},t6=4;function n6(t,e){const{rect:n,theme:r,ctx:i,highlighted:s}=t,{x:o,y:l,width:a,height:u}=n,c=20,f=8,d=t6;let h=o+r.cellHorizontalPadding;const p=[];for(const m of e){if(h>o+a)break;const b=Xc(m,i,r.baseFontFull).width;p.push({x:h,width:b}),h+=b+f*2+d}i.beginPath();for(const m of p)rs(i,m.x,l+(u-c)/2,m.width+f*2,c,r.roundingRadius??c/2);i.fillStyle=s?r.bgBubbleSelected:r.bgBubble,i.fill();for(const[m,b]of p.entries())i.beginPath(),i.fillStyle=r.textBubble,i.fillText(e[m],b.x+f,l+u/2+Is(i,r))}const r6=jr("div")({name:"DrilldownOverlayEditorStyle",class:"gdg-d4zsq0x",propsAsIs:!1}),i6=t=>{const{drilldowns:e}=t;return w.createElement(r6,null,e.map((n,r)=>w.createElement("div",{key:r,className:"doe-bubble"},n.img!==void 0&&w.createElement("img",{src:n.img}),w.createElement("div",null,n.text))))},s6={getAccessibilityString:t=>ET(t.data.map(e=>e.text)),kind:Se.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,e,n)=>e.data.reduce((r,i)=>t.measureText(i.text).width+r+20+(i.img!==void 0?18:0),0)+2*n.cellHorizontalPadding-4,draw:t=>a6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return w.createElement(i6,{drilldowns:e.data})},onPaste:()=>{}},o6=4,Kg={};function l6(t,e,n,r){const i=Math.ceil(window.devicePixelRatio),s=5,o=n-s*2,l=4,a=n*i,u=r+s,c=r*3,f=(c+s*2)*i,d=`${t},${e},${i},${n}`;if(Kg[d]!==void 0)return{el:Kg[d],height:a,width:f,middleWidth:l*i,sideWidth:u*i,padding:s*i,dpr:i};const h=document.createElement("canvas"),p=h.getContext("2d");return p===null?null:(h.width=f,h.height=a,p.scale(i,i),Kg[d]=h,p.beginPath(),rs(p,s,s,c,o,r),p.shadowColor="rgba(24, 25, 34, 0.4)",p.shadowBlur=1,p.fillStyle=t,p.fill(),p.shadowColor="rgba(24, 25, 34, 0.3)",p.shadowOffsetY=1,p.shadowBlur=5,p.fillStyle=t,p.fill(),p.shadowOffsetY=0,p.shadowBlur=0,p.shadowBlur=0,p.beginPath(),rs(p,s+.5,s+.5,c,o,r),p.strokeStyle=e,p.lineWidth=1,p.stroke(),{el:h,height:a,width:f,sideWidth:u*i,middleWidth:r*i,padding:s*i,dpr:i})}function a6(t,e){const{rect:n,theme:r,ctx:i,imageLoader:s,col:o,row:l}=t,{x:a,width:u}=n,c=r.baseFontFull,f=zT(i,c),d=Math.min(n.height,Math.max(16,Math.ceil(f*r.lineHeight)*2)),h=Math.floor(n.y+(n.height-d)/2),p=d-10,m=8,b=o6;let v=a+r.cellHorizontalPadding;const g=r.roundingRadius??6,y=l6(r.bgCell,r.drilldownBorder,d,g),k=[];for(const x of e){if(v>a+u)break;const T=Xc(x.text,i,c).width;let E=0;x.img!==void 0&&s.loadOrGetImage(x.img,o,l)!==void 0&&(E=p-8+4);const M=T+E+m*2;k.push({x:v,width:M}),v+=M+b}if(y!==null){const{el:x,height:C,middleWidth:T,sideWidth:E,width:M,dpr:P,padding:_}=y,O=E/P,N=_/P;for(const D of k){const oe=Math.floor(D.x),Q=Math.floor(D.width),te=Q-(O-N)*2;i.imageSmoothingEnabled=!1,i.drawImage(x,0,0,E,C,oe-N,h,O,d),te>0&&i.drawImage(x,E,0,T,C,oe+(O-N),h,te,d),i.drawImage(x,M-E,0,E,C,oe+Q-(O-N),h,O,d),i.imageSmoothingEnabled=!0}}i.beginPath();for(const[x,C]of k.entries()){const T=e[x];let E=C.x+m;if(T.img!==void 0){const M=s.loadOrGetImage(T.img,o,l);if(M!==void 0){const P=p-8;let _=0,O=0,N=M.width,D=M.height;N>D?(_+=(N-D)/2,N=D):D>N&&(O+=(D-N)/2,D=N),i.beginPath(),rs(i,E,h+d/2-P/2,P,P,r.roundingRadius??3),i.save(),i.clip(),i.drawImage(M,_,O,N,D,E,h+d/2-P/2,P,P),i.restore(),E+=P+4}}i.beginPath(),i.fillStyle=r.textBubble,i.fillText(T.text,E,h+d/2+Is(i,r))}}const u6={getAccessibilityString:t=>t.data.join(", "),kind:Se.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>c6(t,t.cell.displayData??t.cell.data,t.cell.rounding??t.theme.roundingRadius??4,t.cell.contentAlign),measure:(t,e)=>e.data.length*50,onDelete:t=>({...t,data:[]}),provideEditor:()=>t=>{const{value:e,onFinishedEditing:n,imageEditorOverride:r}=t,i=r??e4;return w.createElement(i,{urls:e.data,canWrite:e.readonly!==!1,onCancel:n,onChange:s=>{n({...e,data:[s]})}})},onPaste:(t,e)=>{t=t.trim();const r=t.split(",").map(i=>{try{return new URL(i),i}catch{return}}).filter(i=>i!==void 0);if(!(r.length===e.data.length&&r.every((i,s)=>i===e.data[s])))return{...e,data:r}}},Xg=4;function c6(t,e,n,r){const{rect:i,col:s,row:o,theme:l,ctx:a,imageLoader:u}=t,{x:c,y:f,height:d,width:h}=i,p=d-l.cellVerticalPadding*2,m=[];let b=0;for(let g=0;g0&&(a.beginPath(),rs(a,v,f+l.cellVerticalPadding,y,p,n),a.save(),a.clip()),a.drawImage(g,v,f+l.cellVerticalPadding,y,p),n>0&&a.restore(),v+=y+Xg}}function f6(t,e){let n=t*49632+e*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}const d6={getAccessibilityString:()=>"",kind:Se.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:t=>{const{cell:e,col:n,row:r,ctx:i,rect:s,theme:o}=t;if(e.skeletonWidth===void 0||e.skeletonWidth===0)return;let l=e.skeletonWidth;e.skeletonWidthVariability!==void 0&&e.skeletonWidthVariability>0&&(l+=Math.round(f6(n,r)*e.skeletonWidthVariability));const a=o.cellHorizontalPadding,u=e.skeletonHeight??Math.min(18,s.height-2*o.cellVerticalPadding);rs(i,s.x+a,s.y+(s.height-u)/2,l,u,o.roundingRadius??3),i.fillStyle=ll(o.textDark,.1),i.fill()},onPaste:()=>{}},h6=()=>t=>t.targetWidth,Px=jr("div")({name:"MarkdownOverlayEditorStyle",class:"gdg-m1pnx84e",propsAsIs:!1,vars:{"m1pnx84e-0":[h6(),"px"]}}),p6=t=>{const{value:e,onChange:n,forceEditMode:r,createNode:i,targetRect:s,onFinish:o,validatedSelection:l}=t,a=e.data,u=e.readonly===!0,[c,f]=w.useState(a===""||r),d=w.useCallback(()=>{f(p=>!p)},[]),h=a?"gdg-ml-6":"";return c?w.createElement(Px,{targetWidth:s.width-20},w.createElement(mp,{autoFocus:!0,highlight:!1,validatedSelection:l,value:a,onKeyDown:p=>{p.key==="Enter"&&p.stopPropagation()},onChange:n}),w.createElement("div",{className:`gdg-edit-icon gdg-checkmark-hover ${h}`,onClick:()=>o(e)},w.createElement(XF,null))):w.createElement(Px,{targetWidth:s.width},w.createElement(w4,{contents:a,createNode:i}),!u&&w.createElement(w.Fragment,null,w.createElement("div",{className:"spacer"}),w.createElement("div",{className:`gdg-edit-icon gdg-edit-hover ${h}`,onClick:d},w.createElement(Hv,null))),w.createElement("textarea",{className:"gdg-md-edit-textarea gdg-input",autoFocus:!0}))},g6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:Gc,measure:(t,e,n)=>{const r=e.data.split(` -`)[0];return t.measureText(r).width+2*n.cellHorizontalPadding},draw:t=>ws(t,t.cell.data,t.cell.contentAlign),onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{const{onChange:e,value:n,target:r,onFinishedEditing:i,markdownDivCreateNode:s,forceEditMode:o,validatedSelection:l}=t;return w.createElement(p6,{onFinish:i,targetRect:r,value:n,validatedSelection:l,onChange:a=>e({...n,data:a.target.value}),forceEditMode:o,createNode:s})},onPaste:(t,e)=>t===e.data?void 0:{...e,data:t}},m6={getAccessibilityString:t=>t.row.toString(),kind:Qr.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:y6,measure:()=>44,draw:t=>w6(t,t.cell.row,t.cell.checked,t.cell.markerKind,t.cell.drawHandle,t.cell.checkboxStyle),onClick:t=>{const{bounds:e,cell:n,posX:r,posY:i}=t,{width:s,height:o}=e,l=n.drawHandle?7+(s-7)/2:s/2,a=o/2;if(Math.abs(r-l)<=10&&Math.abs(i-a)<=10)return{...n,checked:!n.checked}},onPaste:()=>{}};function y6(t,e){const{ctx:n,theme:r}=t,i=r.markerFontFull,s=e??{};return(s==null?void 0:s.font)!==i&&(n.font=i,s.font=i),s.deprep=v6,n.textAlign="center",s}function v6(t){const{ctx:e}=t;e.textAlign="start"}function w6(t,e,n,r,i,s){const{ctx:o,rect:l,hoverAmount:a,theme:u}=t,{x:c,y:f,width:d,height:h}=l,p=n?1:r==="checkbox-visible"?.6+.4*a:a;if(r!=="number"&&p>0){o.globalAlpha=p;const m=7*(n?a:1);if(qv(o,u,n,i?c+m:c,f,i?d-m:d,h,!0,void 0,void 0,18,"center",s),i){o.globalAlpha=a,o.beginPath();for(const b of[3,6])for(const v of[-5,-1,3])o.rect(c+b,f+h/2+v,2,2);o.fillStyle=u.textLight,o.fill(),o.beginPath()}o.globalAlpha=1}if(r==="number"||r==="both"&&!n){const m=e.toString(),b=u.markerFontFull,v=c+d/2;r==="both"&&a!==0&&(o.globalAlpha=1-a),o.fillStyle=u.textLight,o.font=b,o.fillText(m,v,f+h/2+Is(o,b)),a!==0&&(o.globalAlpha=1)}}const b6={getAccessibilityString:()=>"",kind:Qr.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>x6(t,t.cell.hint,t.cell.icon),onPaste:()=>{}};function x6(t,e,n){const{ctx:r,rect:i,hoverAmount:s,theme:o,spriteManager:l}=t,{x:a,y:u,width:c,height:f}=i;r.beginPath(),r.globalAlpha=s,r.rect(a+1,u+1,c,f-2),r.fillStyle=o.bgHeaderHovered,r.fill(),r.globalAlpha=1,r.beginPath();const d=e!=="";let h=0;if(n!==void 0){const m=f-8,b=a+8/2,v=u+8/2;l.drawSprite(n,"normal",r,b,v,m,o,d?1:s),h=m}else{h=24;const p=12,m=d?p:s*p,b=d?0:(1-s)*p*.5,v=o.cellHorizontalPadding+4;m>0&&(r.moveTo(a+v+b,u+f/2),r.lineTo(a+v+b+m,u+f/2),r.moveTo(a+v+b+m*.5,u+f/2-m*.5),r.lineTo(a+v+b+m*.5,u+f/2+m*.5),r.lineWidth=2,r.strokeStyle=o.bgIconHeader,r.lineCap="round",r.stroke())}r.fillStyle=o.textMedium,r.fillText(e,h+a+o.cellHorizontalPadding+.5,u+f/2+Is(r,o)),r.beginPath()}const k6=w.lazy(async()=>await UT(()=>import("./number-overlay-editor-CVkV7bZk.js"),[])),S6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Gc,draw:t=>ws(t,t.cell.displayData,t.cell.contentAlign),measure:(t,e,n)=>t.measureText(e.displayData).width+n.cellHorizontalPadding*2,onDelete:t=>({...t,data:void 0}),provideEditor:()=>t=>{const{isHighlighted:e,onChange:n,value:r,validatedSelection:i}=t;return w.createElement(w.Suspense,{fallback:null},w.createElement(k6,{highlight:e,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:i,onChange:s=>n({...r,data:Number.isNaN(s.floatValue??0)?0:s.floatValue})}))},onPaste:(t,e,n)=>{const r=typeof n.rawValue=="number"?n.rawValue:Number.parseFloat(typeof n.rawValue=="string"?n.rawValue:t);if(!(Number.isNaN(r)||e.data===r))return{...e,data:r,displayData:n.formattedString??e.displayData}}},C6={getAccessibilityString:()=>"",measure:()=>108,kind:Se.Protected,needsHover:!1,needsHoverPosition:!1,draw:T6,onPaste:()=>{}};function T6(t){const{ctx:e,theme:n,rect:r}=t,{x:i,y:s,height:o}=r;e.beginPath();const l=2.5;let a=i+n.cellHorizontalPadding+l;const u=s+o/2,c=Math.cos(Ib(30))*l,f=Math.sin(Ib(30))*l;for(let d=0;d<12;d++)e.moveTo(a,u-l),e.lineTo(a,u+l),e.moveTo(a+c,u-f),e.lineTo(a-c,u+f),e.moveTo(a-c,u-f),e.lineTo(a+c,u+f),a+=8;e.lineWidth=1.1,e.lineCap="square",e.strokeStyle=n.textLight,e.stroke()}const E6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(t,e)=>Gc(t,e,t.theme.textLight),draw:t=>ws(t,t.cell.data,t.cell.contentAlign),measure:(t,e,n)=>t.measureText(e.data).width+n.cellHorizontalPadding*2,provideEditor:()=>t=>{const{isHighlighted:e,onChange:n,value:r,validatedSelection:i}=t;return Pn.createElement(mp,{highlight:e,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:i,onChange:s=>n({...r,data:s.target.value})})},onPaste:()=>{}},A6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.Text,needsHover:t=>t.hoverEffect===!0,needsHoverPosition:!1,drawPrep:Gc,useLabel:!0,draw:t=>{const{cell:e,hoverAmount:n,hyperWrapping:r,ctx:i,rect:s,theme:o,overrideCursor:l}=t,{displayData:a,contentAlign:u,hoverEffect:c,allowWrapping:f}=e;if(c===!0&&n>0){i.textBaseline="alphabetic";const d=o.cellHorizontalPadding,h=o.cellVerticalPadding,p=Xc(a,i,o.baseFontFull,"alphabetic"),m=s.height-h,b=Math.min(m,p.actualBoundingBoxAscent*2.5);i.beginPath(),rs(i,s.x+d/2,s.y+(s.height-b)/2+1,p.width+d*3,b-1,o.roundingRadius??4),i.globalAlpha=n,i.fillStyle=ll(o.textDark,.1),i.fill(),i.globalAlpha=1,i.fillStyle=o.textDark,i.textBaseline="middle",l==null||l("text")}ws(t,a,u,f,r)},measure:(t,e,n)=>{const r=e.displayData.split(` -`,e.allowWrapping===!0?void 0:1);let i=0;for(const s of r)i=Math.max(i,t.measureText(s).width);return i+2*n.cellHorizontalPadding},onDelete:t=>({...t,data:""}),provideEditor:t=>({disablePadding:t.allowWrapping===!0,editor:e=>{const{isHighlighted:n,onChange:r,value:i,validatedSelection:s}=e;return w.createElement(mp,{style:t.allowWrapping===!0?{padding:"3px 8.5px"}:void 0,highlight:n,autoFocus:i.readonly!==!0,disabled:i.readonly===!0,altNewline:!0,value:i.data,validatedSelection:s,onChange:o=>r({...i,data:o.target.value})})}}),onPaste:(t,e,n)=>t===e.data?void 0:{...e,data:t,displayData:n.formattedString??e.displayData}},M6=jr("div")({name:"UriOverlayEditorStyle",class:"gdg-u1rrojo",propsAsIs:!1}),R6=t=>{const{uri:e,onChange:n,forceEditMode:r,readonly:i,validatedSelection:s,preview:o}=t,[l,a]=w.useState(!i&&(e===""||r)),u=w.useCallback(()=>{a(!0)},[]);return l?w.createElement(mp,{validatedSelection:s,highlight:!0,autoFocus:!0,value:e,onChange:n}):w.createElement(M6,null,w.createElement("a",{className:"gdg-link-area",href:e,target:"_blank",rel:"noopener noreferrer"},o),!i&&w.createElement("div",{className:"gdg-edit-icon",onClick:u},w.createElement(Hv,null)),w.createElement("textarea",{className:"gdg-input",autoFocus:!0}))};function Ix(t,e,n,r){let i=n.cellHorizontalPadding;const s=e.height/2-t.actualBoundingBoxAscent/2,o=t.width,l=t.actualBoundingBoxAscent;return r==="right"?i=e.width-o-n.cellHorizontalPadding:r==="center"&&(i=e.width/2-o/2),{x:i,y:s,width:o,height:l}}const O6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.Uri,needsHover:t=>t.hoverEffect===!0,needsHoverPosition:!0,useLabel:!0,drawPrep:Gc,draw:t=>{const{cell:e,theme:n,overrideCursor:r,hoverX:i,hoverY:s,rect:o,ctx:l}=t,a=e.displayData??e.data,u=e.hoverEffect===!0;if(r!==void 0&&u&&i!==void 0&&s!==void 0){const c=Xc(a,l,n.baseFontFull),f=Ix(c,o,n,e.contentAlign),{x:d,y:h,width:p,height:m}=f;if(i>=d-4&&i<=d-4+p+8&&s>=h-4&&s<=h-4+m+8){const b=Is(l,n.baseFontFull);r("pointer");const v=5,g=h-b;l.beginPath(),l.moveTo(o.x+d,Math.floor(o.y+g+m+v)+.5),l.lineTo(o.x+d+p,Math.floor(o.y+g+m+v)+.5),l.strokeStyle=n.linkColor,l.stroke(),l.save(),l.fillStyle=t.cellFillColor,ws({...t,rect:{...o,x:o.x-1}},a,e.contentAlign),ws({...t,rect:{...o,x:o.x-2}},a,e.contentAlign),ws({...t,rect:{...o,x:o.x+1}},a,e.contentAlign),ws({...t,rect:{...o,x:o.x+2}},a,e.contentAlign),l.restore()}}l.fillStyle=u?n.linkColor:n.textDark,ws(t,a,e.contentAlign)},onClick:t=>{const{cell:e,bounds:n,posX:r,posY:i,theme:s}=t,o=e.displayData??e.data;if(e.hoverEffect!==!0||e.onClickUri===void 0)return;const l=F4(o,s.baseFontFull);if(l===void 0)return;const a=Ix(l,n,s,e.contentAlign);vp({x:a.x-4,y:a.y-4,width:a.width+8,height:a.height+8},r,i)&&e.onClickUri(t)},measure:(t,e,n)=>t.measureText(e.displayData??e.data).width+n.cellHorizontalPadding*2,onDelete:t=>({...t,data:""}),provideEditor:t=>e=>{const{onChange:n,value:r,forceEditMode:i,validatedSelection:s}=e;return w.createElement(R6,{forceEditMode:r.readonly!==!0&&(i||t.hoverEffect===!0&&t.onClickUri!==void 0),uri:r.data,preview:r.displayData??r.data,validatedSelection:s,readonly:r.readonly===!0,onChange:o=>n({...r,data:o.target.value})})},onPaste:(t,e,n)=>t===e.data?void 0:{...e,data:t,displayData:n.formattedString??e.displayData}},P6=[m6,b6,qW,e6,s6,u6,d6,g6,S6,C6,E6,A6,O6];var I6=bT,D6=pl,_6="Expected a function";function N6(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(_6);return D6(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),I6(t,e,{leading:r,maxWait:e,trailing:i})}var L6=N6;const F6=Ii(L6),Gg=[];class B6 extends HT{constructor(){super(...arguments);bt(this,"imageLoaded",()=>{});bt(this,"loadedLocations",[]);bt(this,"cache",{});bt(this,"sendLoaded",F6(()=>{this.imageLoaded(new Ju(this.loadedLocations)),this.loadedLocations=[]},20));bt(this,"clearOutOfWindow",()=>{const n=Object.keys(this.cache);for(const r of n){const i=this.cache[r];let s=!1;for(let o=0;o{a||(a=!0,Gg.length<12?Gg.unshift(l):o||(l.src=""))}},c=new Promise(f=>l.addEventListener("load",()=>f(null)));requestAnimationFrame(async()=>{try{l.src=n,await c,await l.decode();const f=this.cache[s];if(f!==void 0&&!a){f.img=l;for(const d of f.cells)this.loadedLocations.push(Xv(d));o=!0,this.sendLoaded()}}catch{u.cancel()}}),this.cache[s]=u}loadOrGetImage(n,r,i){const s=n,o=this.cache[s];if(o!==void 0){const l=ki(r,i);return o.cells.includes(l)||o.cells.push(l),o.img}else this.loadImage(n,r,i,s)}}const Yg="\uFEFF";function z6(t){const e={",":0,";":0," ":0};let n=",",r=-1,i=0,s=!1;for(let o=0;or&&(n=o,r=e[o]);return n}function $6(t,e,n){if(t[e]==='"'){let i="",s=e+1;for(;;){if(s>=t.length)return[i,s];const o=t[s];if(o==='"')if(t[s+1]==='"')i+='"',s+=2;else{for(s++;s=r.length)break;if(r[g]===s){c=g+1,f=!0;continue}c=r[g]==="\r"&&r[g+1]===` -`?g+2:g+1,o.push(a),l.push({start:u+i,end:g+i}),a=[]}a.length>0?(o.push(a),l.push({start:u+i,end:r.length+i})):o.length===0&&a.length===0&&r.length>0&&(o.push([""]),l.push({start:0+i,end:r.length+i}));const d=o.length>0?o[0]:[],h=d.length,p=o.slice(1),m=p.map(v=>v.length),b=p.map(v=>v.length===h?v:v.length>h?v.slice(0,h):[...v,...Array(h-v.length).fill("")]);return{headers:d,rows:b,delimiter:s,rowWidths:m,rowSpans:l.slice(1)}}function wp(t,e=","){const n=r=>r.includes('"')?`"${r.replaceAll('"','""')}"`:r.includes(e)||r.includes(` -`)||r.includes("\r")?`"${r}"`:r;return t.map(n).join(e)}function qg(t,e,n=","){return[t,...e].map(r=>wp(r,n)).join(` -`)}function Zv(t,e){return Yc(t,e).headers}function H6(t){const e=/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/,n=Array.from({length:t.headers.length},()=>!0),r=Array.from({length:t.headers.length},()=>!1);for(const i of t.rows)for(let s=0;si&&r[s])}function wE(t,e){let n="",r=0;for(const{start:i,end:s,replacement:o}of e)n+=t.slice(r,i)+o,r=s;return n+t.slice(r)}function j6(t,e){return t[e]==="\r"?t[e+1]===` -`?2:1:t[e]===` -`?1:0}function Dx(t,e){return t[e-2]==="\r"&&t[e-1]===` -`?2:t[e-1]==="\r"||t[e-1]===` -`?1:0}const _x="\uFEFF";function bE(t,e){const n=t.startsWith(_x)?_x.length:0,r=e.rowSpans[0];if(r!==void 0)return{start:n,end:r.start-Dx(t,r.start)};const i=t.slice(n);return{start:n,end:n+i.length-Dx(t,t.length)}}function Qg(t,e,n){const r=[...new Set(n)].flatMap(i=>{const s=e.rowSpans[i];return s===void 0?[]:[s]}).sort((i,s)=>i.start-s.start).map(i=>({start:i.start,end:i.end+j6(t,i.end),replacement:""}));return r.length===0?t:wE(t,r)}function Nx(t,e,n){const r=new Set([...n].filter(o=>o>=0&&ou!r.has(c));s.push({start:o.start,end:o.end,replacement:wp(a,e.delimiter)})}return wE(t,s)}function W6(t,e,n,r){if(!t||n<0||n>=e.headers.length)return t;const i=bE(t,e),s=Zv(t.slice(i.start,i.end),e.delimiter);if(n>=s.length||s[n]===r)return t;const o=s.map((a,u)=>u===n?r:a),l=wp(o,e.delimiter);return t.slice(0,i.start)+l+t.slice(i.end)}const L0=50;function Bl(t=""){return{past:[],present:t,future:[]}}function V6(t,e,n=L0){if(e===t.present)return t;if(t.present===""&&t.past.length===0&&t.future.length===0)return{past:[],present:e,future:[]};const r=[...t.past,t.present];return{past:r.length>n?r.slice(r.length-n):r,present:e,future:[]}}function U6(t){if(t.past.length===0)return t;const e=t.past[t.past.length-1];return{past:t.past.slice(0,t.past.length-1),present:e,future:[t.present,...t.future]}}function K6(t){if(t.future.length===0)return t;const[e,...n]=t.future,r=[...t.past,t.present];return{past:r.length>L0?r.slice(r.length-L0):r,present:e,future:n}}function X6(t){if(t.altKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.key.toLowerCase();return e==="z"?t.shiftKey?"redo":"undo":e==="y"&&!t.shiftKey?"redo":null}const Lx=/^[+-]?\d{16,}$/;function G6(t,e){const n=Array.from({length:t.length},(i,s)=>s);if(e==="")return n;const r=e.toLowerCase();return n.filter(i=>{const s=t[i];for(let o=0;o{var c,f;const a=((c=e[o])==null?void 0:c[n])??"",u=((f=e[l])==null?void 0:f[n])??"";if(i){const d=a===""?NaN:Number(a),h=u===""?NaN:Number(u),p=Number.isNaN(d),m=Number.isNaN(h);if(p||m)return p&&m?0:p?1:-1;if(Lx.test(a)&&Lx.test(u)){const b=BigInt(a),v=BigInt(u);return s*(bv?1:0)}return s*(d-h)}return s*a.localeCompare(u)})}const q6=` - -`;function qf(t,e){return Math.max(0,Math.min(t,e))}function Fx(t,e,n,r){const i=t.headers.length,s=[];for(const a of n.ranges){const u=qf(a.x,r+i),c=qf(a.x+a.width,r+i);if(c<=r)continue;const f=u-r,d=c-r;if(d<=f)continue;const h=qf(a.y,e.length),p=qf(a.y+a.height,e.length);if(p<=h)continue;const m=t.headers.slice(f,d),b=[];for(let v=h;vy[f+x]??""))}b.length!==0&&s.push(qg(m,b,t.delimiter))}if(s.length>0)return s.join(q6);const o=[...n.rows].filter(a=>a>=0&&ae[a]).filter(a=>a!==void 0);if(o.length>0)return qg(t.headers,o.map(a=>t.rows[a]??[]),t.delimiter);const l=[...n.columns].filter(a=>a>=r&&a0){const a=l.map(c=>t.headers[c-r]),u=e.map(c=>{const f=t.rows[c]??[];return l.map(d=>f[d-r]??"")});return qg(a,u,t.delimiter)}return null}const Bx=24,Jg=26,zx=110,Zg=40,Q6=12,Bn=1,$x='ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',Hx='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';function jx(t){if(!(t instanceof HTMLElement))return!1;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||t.isContentEditable}const ku="inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px] font-medium text-foreground hover:bg-muted outline-none focus-visible:ring-3 focus-visible:ring-ring/50";function J6(t){return t?{accentColor:"hsl(0 0% 98%)",accentFg:"hsl(240 10% 3.9%)",accentLight:"hsla(240, 4.9%, 70%, 0.18)",textDark:"hsl(0 0% 98%)",textMedium:"hsl(240 5% 64.9%)",textLight:"hsla(240, 5%, 64.9%, 0.4)",textBubble:"hsl(0 0% 98%)",textHeader:"hsl(240 5% 64.9%)",textHeaderSelected:"hsl(0 0% 98%)",bgCell:"hsl(240 6% 7%)",bgCellMedium:"hsl(240 6% 7%)",bgHeader:"hsl(240 6% 7%)",bgHeaderHasFocus:"hsl(240 3.7% 15.9%)",bgHeaderHovered:"hsl(240 3.7% 15.9%)",bgBubble:"hsl(240 3.7% 15.9%)",bgBubbleSelected:"hsl(240 6% 7%)",bgSearchResult:"hsl(240 3.7% 15.9%)",borderColor:"hsl(240 3.7% 15.9%)",horizontalBorderColor:"hsla(240, 3.7%, 15.9%, 0.6)",headerBottomBorderColor:"hsl(240 3.7% 15.9%)",linkColor:"hsl(0 0% 98%)",cellHorizontalPadding:8,cellVerticalPadding:3,headerFontStyle:"600 11px",baseFontStyle:"12px",editorFontSize:"12px",fontFamily:Hx,lineHeight:1}:{accentColor:"hsl(240 10% 3.9%)",accentFg:"hsl(0 0% 100%)",accentLight:"hsla(240, 4.8%, 45%, 0.14)",textDark:"hsl(240 10% 3.9%)",textMedium:"hsl(240 3.8% 46.1%)",textLight:"hsla(240, 3.8%, 46.1%, 0.4)",textBubble:"hsl(240 10% 3.9%)",textHeader:"hsl(240 3.8% 46.1%)",textHeaderSelected:"hsl(240 10% 3.9%)",bgCell:"hsl(0 0% 100%)",bgCellMedium:"hsl(0 0% 100%)",bgHeader:"hsl(0 0% 100%)",bgHeaderHasFocus:"hsl(240 4.8% 95.9%)",bgHeaderHovered:"hsl(240 4.8% 95.9%)",bgBubble:"hsl(240 4.8% 95.9%)",bgBubbleSelected:"hsl(0 0% 100%)",bgSearchResult:"hsl(48 96% 89%)",borderColor:"hsl(240 5.9% 90%)",horizontalBorderColor:"hsla(240, 5.9%, 90%, 0.6)",headerBottomBorderColor:"hsl(240 5.9% 90%)",linkColor:"hsl(240 10% 3.9%)",cellHorizontalPadding:8,cellVerticalPadding:3,headerFontStyle:"600 11px",baseFontStyle:"12px",editorFontSize:"12px",fontFamily:Hx,lineHeight:1}}function Z6(t){return t?"hsla(45, 96%, 65%, 0.3)":"hsl(48 96% 89%)"}function xE({text:t,delimiter:e,testId:n="csv-table",dark:r=!1,onCellCommit:i,onUndo:s,onRedo:o}){const l=w.useRef(null),a=w.useRef(null),u=w.useRef(null),[c,f]=w.useState(""),[d,h]=w.useState(""),[p,m]=w.useState(null),b=w.useRef(p);b.current=p;const v=w.useRef(null),[g,y]=w.useState(null),[k,x]=w.useState(""),C=w.useRef(null),[T,E]=w.useState(void 0),[M,P]=w.useState(()=>new Set),_=w.useRef(M),[O,N]=w.useState(0),D=i!==void 0,oe=w.useMemo(()=>J6(r),[r]),Q=Z6(r),te=r?"hsl(240 3.7% 15.9%)":"hsl(240 4.8% 95.9%)",j=w.useRef();j.current===void 0&&(j.current=new B6);const Y=w.useMemo(()=>Yc(t,e),[t,e]),U=w.useMemo(()=>H6(Y),[Y]),A=Y.headers.length,L=w.useRef({text:t,table:Y});L.current={text:t,table:Y};const I=w.useRef(T);I.current=T,w.useEffect(()=>{const G=window.setTimeout(()=>h(c),150);return()=>window.clearTimeout(G)},[c]);const H=w.useMemo(()=>{const G=G6(Y.rows,d);return p?Y6(G,Y.rows,p.col,p.dir,U[p.col]??!1):G},[Y,d,p,U]),B=w.useRef(H);B.current=H,w.useEffect(()=>{const G=a.current;if(!G||typeof ResizeObserver>"u")return;const be=new ResizeObserver(()=>N(G.clientWidth));return be.observe(G),N(G.clientWidth),()=>be.disconnect()},[]);const ce=Math.max(zx,Math.floor((O-Zg)/Math.max(1,A)));w.useEffect(()=>{P(G=>{let be=!1;const ee=new Set;for(const ye of G)ye{E(G=>{if(!G||G.rows.length===0)return G;const be=[];for(const ye of _.current){const de=H.indexOf(ye);de!==-1&&be.push(de)}be.sort((ye,de)=>ye-de);const ee=be.reduce((ye,de)=>ye.add(de),Ot.empty());return ee.equals(G.rows)?G:{...G,rows:ee}})},[H]),w.useEffect(()=>{m(G=>G!==null&&G.col>=A?null:G),y(G=>G!==null&&G.col>=A?null:G)},[A]);const we=d!=="",fe=Y.rows.length,De=Jg+Math.min(H.length,Q6)*Bx,Ze=()=>{f(""),h("")},rt=w.useCallback((G,be)=>{var ye;if(G0||dt.height>0)?{x:Math.max(0,_e.x-dt.left),y:Math.max(0,_e.y-dt.top),width:_e.width,height:_e.height}:_e??{x:Zg+ee*ce,y:0,width:ce,height:Jg};x(de),y({col:ee,bounds:Ke});return}v.current=b.current,y(null),m(de=>!de||de.col!==ee?{col:ee,dir:"asc"}:de.dir==="asc"?{col:ee,dir:"desc"}:null)},[D,ce]),ct=w.useCallback(()=>{if(!g)return;const{col:G}=g;if(y(null),!i)return;const{text:be,table:ee}=L.current,ye=W6(be,ee,G,k);ye!==be&&i(ye)},[g,k,i]),ot=w.useCallback(()=>{y(null)},[]);w.useEffect(()=>{if(!g)return;const G=C.current;G&&(G.focus(),G.select())},[g]);const Ne=w.useCallback((G,be)=>{const ee=B.current,ye=ee[be];if(ye===void 0)return;const de=_.current,dt=u.current;let _e;if(G.shiftKey&&dt!==null&&dt!==ye){const me=ee.indexOf(dt),Ie=ee.indexOf(ye),Et=me===-1?Ie:me,[Wt,Nt]=Et<=Ie?[Et,Ie]:[Ie,Et];_e=G.metaKey||G.ctrlKey?new Set(de):new Set;for(let Mt=Wt;Mt<=Nt;Mt++){const Un=ee[Mt];Un!==void 0&&_e.add(Un)}}else G.metaKey||G.ctrlKey?(_e=new Set(de),_e.has(ye)?_e.delete(ye):_e.add(ye)):_e=new Set([ye]);u.current=ye,_.current=_e,P(_e);const Ke=[..._e].map(me=>ee.indexOf(me)).filter(me=>me!==-1).sort((me,Ie)=>me-Ie);E(me=>({current:me==null?void 0:me.current,columns:(me==null?void 0:me.columns)??Ot.empty(),rows:Ke.reduce((Ie,Et)=>Ie.add(Et),Ot.empty())}))},[]),Ye=w.useCallback(()=>{u.current=null,_.current=new Set,P(new Set),E(void 0)},[]),jt=w.useCallback(G=>{const be=new Set;for(const ee of G.rows){const ye=B.current[ee];ye!==void 0&&be.add(ye)}_.current=be,P(be),E(G)},[]),Pe=w.useCallback(()=>{Ye()},[Ye]),pe=w.useMemo(()=>H.filter(G=>M.has(G)),[H,M]),He=w.useMemo(()=>[...(T==null?void 0:T.columns)??[]].filter(G=>G>=Bn).map(G=>G-Bn),[T]),Le=He.length,it=pe.length>0||Le>0,je=()=>{var ee;const G=I.current,be=Fx(L.current.table,B.current,{ranges:G!=null&&G.current?[G.current.range,...G.current.rangeStack]:[],columns:G?[...G.columns]:[],rows:G?[...G.rows]:[]},Bn);be!==null&&((ee=navigator.clipboard)==null||ee.writeText(be).catch(()=>{}))};w.useEffect(()=>{const G=be=>{var _e;const ee=l.current;if(!ee||!ee.contains(document.activeElement))return;const ye=document.activeElement;if(ye&&(ye.tagName==="INPUT"||ye.tagName==="TEXTAREA"||ye.isContentEditable))return;const de=I.current,dt=Fx(L.current.table,B.current,{ranges:de!=null&&de.current?[de.current.range,...de.current.rangeStack]:[],columns:de?[...de.columns]:[],rows:de?[...de.rows]:[]},Bn);dt!==null&&(be.preventDefault(),be.stopImmediatePropagation(),(_e=be.clipboardData)==null||_e.setData("text/plain",dt))};return window.addEventListener("copy",G,{capture:!0}),()=>window.removeEventListener("copy",G,{capture:!0})},[]),w.useEffect(()=>{if(!s&&!o)return;const G=be=>{const ee=l.current;if(!ee)return;const ye=be.target instanceof Node&&ee.contains(be.target),de=document.activeElement instanceof Node&&ee.contains(document.activeElement);if(!ye&&!de||jx(be.target)||jx(document.activeElement))return;const dt=X6(be);dt==="undo"&&s?(be.preventDefault(),s()):dt==="redo"&&o&&(be.preventDefault(),o())};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[s,o]);const yt=w.useCallback(G=>{var ee;const be=l.current!==null&&document.activeElement instanceof Node&&l.current.contains(document.activeElement);Ye(),i==null||i(G),be&&((ee=a.current)==null||ee.focus({preventScroll:!0}))},[Ye,i]),ft=A>0&&He.length>=A,vt=()=>{!D||pe.length===0||yt(Qg(L.current.text,L.current.table,pe))},he=()=>{!D||ft||He.length===0||yt(Nx(L.current.text,L.current.table,He))},st=w.useCallback(G=>{if(!i)return!1;const{text:ee,table:ye}=L.current,de=B.current;if(G.rows.length>0){const Ke=[...G.rows].map(me=>de[me]).filter(me=>me!==void 0);if(Ke.length>0)return yt(Qg(ee,ye,Ke)),!1}if(G.columns.length>0){const Ke=[...G.columns].filter(me=>me>=Bn&&meme-Bn);return Ke.length>0&&Ke.length0&&yt(Qg(ee,ye,_e)),!1},[yt,i]),lt=w.useCallback(G=>{const be=i;if(!be)return!1;const{text:ee,table:ye}=L.current,de=B.current,dt=[...G].sort((me,Ie)=>me.location[1]-Ie.location[1]);let _e=ee,Ke=0;for(const{location:me,value:Ie}of dt){const Et=me[0]-Bn,Wt=me[1];if(Et<0||Ie.kind!==Se.Text)continue;const Nt=de[Wt],Mt=Nt===void 0?void 0:ye.rowSpans[Nt];if(!Mt)continue;const Un=_e.slice(Mt.start+Ke,Mt.end+Ke),ut=Zv(Un,ye.delimiter);for(;ut.length<=Et;)ut.push("");const Vt=Ie.data??"";if(ut[Et]===Vt)continue;ut[Et]=Vt;const Lt=wp(ut,ye.delimiter);_e=_e.slice(0,Mt.start+Ke)+Lt+_e.slice(Mt.end+Ke),Ke+=Lt.length-(Mt.end-Mt.start)}return _e!==ee&&be(_e),!0},[i]),ne=w.useCallback(G=>{var dt;const[be,ee]=G,ye=B.current[ee];if(be{const be=[];for(let ee=G.y;ee{G[0]>=Bn||Ne(be,G[1])},[Ne]),et=w.useMemo(()=>{const G={title:"#",id:"__gutter",width:Zg,themeOverride:{baseFontStyle:`11px ${$x}`,textDark:"hsla(240, 3.8%, 46.1%, 0.4)"}},be=Y.headers.map((ee,ye)=>({title:ee.toUpperCase(),id:`c${ye}`,width:ce,themeOverride:U[ye]?{baseFontStyle:`12px ${$x}`}:void 0}));return[G,...be]},[Y.headers,U,ce]),wt=w.useCallback((G,be)=>{const{ctx:ee,columnIndex:ye,rect:de,theme:dt,isSelected:_e}=G;ee.save();try{if(ee.letterSpacing="0.5px",_e&&(ee.fillStyle=dt.bgHeaderHovered,ee.fillRect(de.x,de.y,de.width,de.height),ee.fillStyle=dt.accentColor,ee.fillRect(de.x,de.y+de.height-2,de.width,2)),ye{const{ctx:ee,cell:ye,rect:de,col:dt,theme:_e}=G,Ke=dt-Bn;if(Ke>=0&&we&&ye.kind===Se.Text){const me=e9(ye.data,d);if(me!==null){ee.save();try{const Ie=`${_e.baseFontStyle} ${_e.fontFamily}`;ee.font=Ie;let Et=de.x+_e.cellHorizontalPadding;const Wt=de.y+de.height/2+Is(ee,Ie);for(const Nt of me){const Mt=ee.measureText(Nt.text).width;Nt.hit&&Mt>0&&(ee.fillStyle=Q,ee.fillRect(Et-1,Wt-7,Mt+2,14)),Et+=Mt}}finally{ee.restore()}}}if(be(),Ke>=0&&ye.kind===Se.Text&&ye.data===""){ee.save();try{ee.font=`${_e.baseFontStyle} ${_e.fontFamily}`,ee.fillStyle=_e.textLight,ee.fillText("—",de.x+_e.cellHorizontalPadding,de.y+de.height/2+.5)}finally{ee.restore()}}},[we,d,Q]),dn=w.useCallback(G=>{const be=B.current[G];return be!==void 0&&_.current.has(be)?{bgCell:te,bgCellMedium:te}:void 0},[te]);return A===0?R.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:"No columns detected."}):R.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",ref:l,children:[R.jsxs("div",{"data-testid":`${n}-toolbar`,className:"flex flex-none flex-wrap items-center gap-1.5 border-b border-border bg-panel px-2 py-1",children:[R.jsxs("div",{className:"relative min-w-32 flex-1 sm:max-w-64",children:[R.jsx(MI,{"aria-hidden":"true",className:"pointer-events-none absolute left-1.5 top-1/2 size-3 -translate-y-1/2 text-muted-foreground/60"}),R.jsx("input",{type:"text","data-testid":`${n}-search`,"aria-label":"Search rows",value:c,onChange:G=>f(G.target.value),onKeyDown:G=>{G.key==="Escape"&&Ze()},placeholder:"Search…",className:"h-6 w-full rounded-md border border-border bg-background pl-6 pr-6 text-xs text-foreground outline-none placeholder:text-muted-foreground/50 focus-visible:ring-3 focus-visible:ring-ring/50"}),c!==""&&R.jsx("button",{type:"button","data-testid":`${n}-clear-search`,"aria-label":"Clear search",onClick:Ze,className:"absolute right-1 top-1/2 -translate-y-1/2 cursor-pointer rounded p-0.5 text-muted-foreground/60 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:R.jsx(Y2,{"aria-hidden":"true",className:"size-3"})})]}),R.jsx("span",{"data-testid":`${n}-count`,role:"status",className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium tabular-nums text-muted-foreground",children:we?`${H.length.toLocaleString()} of ${fe.toLocaleString()}`:`${fe.toLocaleString()} rows`}),it&&R.jsxs("span",{className:"flex items-center gap-1.5",children:[R.jsx("span",{"data-testid":`${n}-selected-count`,className:"text-[11px] font-medium tabular-nums text-muted-foreground",children:pe.length>0?`${pe.length.toLocaleString()} selected`:`${Le.toLocaleString()} ${Le===1?"column":"columns"} selected`}),R.jsxs("button",{type:"button","data-testid":`${n}-copy`,onClick:je,className:ku,children:[R.jsx(Ev,{"aria-hidden":"true",className:"size-3"}),"Copy as CSV"]}),D&&pe.length>0&&R.jsxs("button",{type:"button","data-testid":`${n}-delete-rows`,onClick:vt,title:`Deletes the ${pe.length} selected ${pe.length===1?"row":"rows"} from the source CSV`,className:ku,children:[R.jsx(m0,{"aria-hidden":"true",className:"size-3"}),"Delete ",pe.length.toLocaleString()," ",pe.length===1?"row":"rows"]}),D&&Le>0&&R.jsxs("button",{type:"button","data-testid":`${n}-delete-columns`,onClick:he,disabled:ft,title:ft?"At least one column must remain — the converter needs a column to detect":`Deletes the ${Le} selected ${Le===1?"column":"columns"} from the source CSV`,className:`${ku} disabled:cursor-not-allowed disabled:opacity-50`,children:[R.jsx(m0,{"aria-hidden":"true",className:"size-3"}),"Delete ",Le.toLocaleString()," ",Le===1?"column":"columns"]}),R.jsx("button",{type:"button","data-testid":`${n}-clear-selection`,onClick:Ye,className:ku,children:"Clear"})]})]}),R.jsxs("div",{ref:a,"data-testid":n,role:"grid",tabIndex:-1,"aria-rowcount":H.length+1,className:"relative min-h-0 flex-1 outline-none",style:{minHeight:De},children:[R.jsx("div",{className:"absolute inset-0",children:R.jsx(YW,{imageWindowLoader:j.current,renderers:P6,columns:et,rows:H.length,getCellContent:ne,getCellsForSelection:Je,onCellsEdited:D?lt:void 0,onDelete:D?st:void 0,onCellClicked:Fe,onHeaderClicked:rt,onGridSelectionChange:jt,onSelectionCleared:Pe,gridSelection:T,rangeSelect:"multi-rect",columnSelect:"multi",rowSelect:"multi",rowHeight:Bx,headerHeight:Jg,freezeColumns:Bn,fillHandle:D,onPaste:D?()=>!0:!1,keybindings:{search:!1},theme:oe,drawHeader:wt,drawCell:Jt,getRowThemeOverride:dn,minColumnWidth:zx,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:!1})}),g!==null&&R.jsx("input",{ref:C,type:"text","data-testid":"csv-header-rename-input","aria-label":`Rename column ${Y.headers[g.col]??""}`,value:k,onChange:G=>x(G.target.value),onBlur:ct,onKeyDown:G=>{G.key==="Enter"?(G.preventDefault(),G.stopPropagation(),ct()):G.key==="Escape"&&(G.preventDefault(),G.stopPropagation(),ot())},style:{left:g.bounds.x,top:g.bounds.y,width:Math.max(60,g.bounds.width),height:g.bounds.height},className:"absolute z-20 border border-ring bg-background px-2 font-mono text-[11px] font-semibold tracking-wider text-foreground outline-none ring-2 ring-ring/50"}),we&&H.length===0&&R.jsxs("div",{"data-testid":`${n}-empty-filter`,className:"absolute inset-x-0 top-0 z-10 flex flex-col items-center gap-2 p-6 text-sm text-muted-foreground",children:[R.jsxs("span",{children:["No rows matching “",d,"”."]}),R.jsx("button",{type:"button",onClick:Ze,className:ku,children:"Show all rows"})]}),D&&!we&&H.length===0&&R.jsx("div",{"data-testid":`${n}-empty-rows`,className:"absolute inset-x-0 top-0 z-10 flex flex-col items-center gap-2 p-6 text-sm text-muted-foreground",children:R.jsx("span",{children:"No rows. Paste or upload data to start over."})})]})]})}function e9(t,e){if(e===""||t==="")return null;const n=e.toLowerCase();if(!t.toLowerCase().includes(n))return null;const r=[],i=t.toLowerCase();let s=0;for(;;){const o=i.indexOf(n,s);if(o===-1)break;o>s&&r.push({text:t.slice(s,o),hit:!1}),r.push({text:t.slice(o,o+n.length),hit:!0}),s=o+n.length}return s"u"?void 0:navigator),s=w.useRef(null);w.useEffect(()=>{var l;(l=s.current)==null||l.focus()},[]);const o=t==="CSV";return R.jsx("div",{"data-testid":"dropzone",className:"flex flex-1 flex-col items-center justify-center p-3",children:R.jsxs("div",{className:"flex w-full max-w-sm flex-col items-center gap-3",children:[R.jsx("div",{"aria-hidden":"true",className:"flex size-11 items-center justify-center rounded-xl border border-border bg-muted/50 text-muted-foreground",children:R.jsx(mI,{className:"size-5"})}),R.jsxs("p",{className:"text-sm font-medium text-foreground",children:["Paste ",o?"CSV or TSV":"JSON"," here"]}),R.jsx("textarea",{ref:s,"data-testid":"paste-field",rows:1,"aria-label":`Paste ${o?"CSV or TSV":"JSON"} data — or press ${i} to paste anywhere on this page`,placeholder:o?"Paste CSV or TSV text here":"Paste JSON here",spellCheck:!1,onChange:l=>{const a=l.currentTarget;a.rows=i9(a.value),e(a.value)},className:"min-h-11 w-full resize-none rounded-md border border-border bg-background px-3 py-2.5 font-mono text-[12.5px] leading-relaxed text-foreground transition-colors placeholder:text-muted-foreground focus:outline-none focus-visible:border-sky-600 dark:focus-visible:border-sky-400"}),R.jsxs("p",{className:"text-center text-[13px] leading-relaxed text-muted-foreground",children:["or drag & drop a file anywhere in this pane — you can also paste anywhere on the page (",R.jsx("kbd",{"data-testid":"paste-shortcut",className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground",children:i}),")"]}),R.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[R.jsxs("button",{type:"button","data-testid":"choose-file",onClick:n,className:"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-3.5",children:[R.jsx(G2,{"aria-hidden":"true"}),"Choose file"]}),R.jsxs("button",{type:"button","data-testid":"try-example",onClick:r,className:"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-3.5",children:[R.jsx(OI,{"aria-hidden":"true"}),"Try an example"]})]})]})})}let F0=[],kE=[];(()=>{let t="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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=kE[r])e=r+1;else return!0;if(e==n)return!1}}function Wx(t){return t>=127462&&t<=127487}const Vx=8205;function l9(t,e,n=!0,r=!0){return(n?SE:a9)(t,e,r)}function SE(t,e,n){if(e==t.length)return e;e&&CE(t.charCodeAt(e))&&TE(t.charCodeAt(e-1))&&e--;let r=em(t,e);for(e+=Ux(r);e=0&&Wx(em(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function a9(t,e,n){for(;e>1;){let r=SE(t,e-2,n);if(r=56320&&t<57344}function TE(t){return t>=55296&&t<56320}function Ux(t){return t<65536?1:2}class Pt{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){[e,n]=Ma(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Xi.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Ma(this,e,n);let r=[];return this.decompose(e,n,r,0),Xi.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),i=new Zu(this),s=new Zu(e);for(let o=n,l=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new Zu(this,e)}iterRange(e,n=this.length){return new EE(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new AE(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]?Pt.empty:e.length<=32?new kn(e):Xi.from(kn.split(e,[]))}}class kn extends Pt{constructor(e,n=u9(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],l=i+o.length;if((n?r:l)>=e)return new c9(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new kn(Kx(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=Id(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new kn(l,o.length+s.length));else{let a=l.length>>1;r.push(new kn(l.slice(0,a)),new kn(l.slice(a)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof kn))return super.replace(e,n,r);[e,n]=Ma(this,e,n);let i=Id(this.text,Id(r.text,Kx(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new kn(i,s):Xi.from(kn.split(i,[]),s)}sliceString(e,n=this.length,r=` -`){[e,n]=Ma(this,e,n);let i="";for(let s=0,o=0;s<=n&&oe&&o&&(i+=r),es&&(i+=l.slice(Math.max(0,e-s),n-s)),s=a+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new kn(r,i)),r=[],i=-1);return i>-1&&n.push(new kn(r,i)),n}}class Xi extends Pt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],l=i+o.length,a=r+o.lines-1;if((n?a:l)>=e)return o.lineInner(e,n,r,i);i=l+1,r=a+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s=o){let u=i&((o<=e?1:0)|(a>=n?2:0));o>=e&&a<=n&&!u?r.push(l):l.decompose(e-o,n-o,r,u)}o=a+1}}replace(e,n,r){if([e,n]=Ma(this,e,n),r.lines=s&&n<=l){let a=o.replace(e-s,n-s,r),u=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>u>>6){let c=this.children.slice();return c[i]=a,new Xi(c,this.length-(n-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` -`){[e,n]=Ma(this,e,n);let i="";for(let s=0,o=0;se&&s&&(i+=r),eo&&(i+=l.sliceString(e-o,n-o,r)),o=a+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Xi))return 0;let r=0,[i,s,o,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==l)return r;let a=this.children[i],u=e.children[s];if(a!=u)return r+a.scanIdentical(u,n);r+=a.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let h of e)r+=h.lines;if(r<32){let h=[];for(let p of e)p.flatten(h);return new kn(h,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,u=-1,c=[];function f(h){let p;if(h.lines>s&&h instanceof Xi)for(let m of h.children)f(m);else h.lines>o&&(a>o||!a)?(d(),l.push(h)):h instanceof kn&&a&&(p=c[c.length-1])instanceof kn&&h.lines+p.lines<=32?(a+=h.lines,u+=h.length+1,c[c.length-1]=new kn(p.text.concat(h.text),p.length+1+h.length)):(a+h.lines>i&&d(),a+=h.lines,u+=h.length+1,c.push(h))}function d(){a!=0&&(l.push(c.length==1?c[0]:Xi.from(c,u)),u=-1,a=c.length=0)}for(let h of e)f(h);return d(),l.length==1?l[0]:new Xi(l,n)}}Pt.empty=new kn([""],0);function u9(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Id(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s=n&&(a>r&&(l=l.slice(0,r-i)),i0?1:(e instanceof kn?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,l=i instanceof kn?i.text.length:i.children.length;if(o==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(i instanceof kn){let a=i.text[o+(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=i.children[o+(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 kn?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)}}class EE{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Zu(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:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.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!=""}}class AE{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Pt.prototype[Symbol.iterator]=function(){return this.iter()},Zu.prototype[Symbol.iterator]=EE.prototype[Symbol.iterator]=AE.prototype[Symbol.iterator]=function(){return this});class c9{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Ma(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function tr(t,e,n=!0,r=!0){return l9(t,e,n,r)}function f9(t){return t>=56320&&t<57344}function d9(t){return t>=55296&&t<56320}function h9(t,e){let n=t.charCodeAt(e);if(!d9(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return f9(r)?(n-55296<<10)+(r-56320)+65536:n}function p9(t){return t<65536?1:2}const B0=/\r\n?|\n/;var yr=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(yr||(yr={}));class is{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return s+(e-i);s+=l}else{if(r!=yr.Simple&&u>=e&&(r==yr.TrackDel&&ie||r==yr.TrackBefore&&ie))return null;if(u>e||u==e&&n<0&&!l)return e==i||n<0?s:s+a;s+=a}i=u}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r=0&&i<=n&&l>=e)return in?"cover":!0;i=l}return!1}toString(){let e="";for(let n=0;n=0?":"+i:"")}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 is(e)}static create(e){return new is(e)}}class On extends is{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 z0(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return $0(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i=0){n[i]=l,n[i+1]=o;let a=i>>1;for(;r.length0&&so(r,n,s.text),s.forward(c),l+=c}let u=e[o++];for(;l>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!i.length)return;od||f<0||d>n)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${n})`);let p=h?typeof h=="string"?Pt.of(h.split(r||B0)):h:Pt.empty,m=p.length;if(f==d&&m==0)return;fo&&Zn(i,f-o,-1),Zn(i,d-f,m),so(s,i,p),o=d}}return u(e),a(!l),l}static empty(e){return new On(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;il&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function so(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(i,u,s,c,f),i=u,s=c}}}function $0(t,e,n,r=!1){let i=[],s=r?[]:null,o=new Tc(t),l=new Tc(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);Zn(i,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let u=0,c=o.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.lena||o.ins>=0&&o.len>a)&&(l||r.length>u),s.forward2(a),o.forward(a)}}}}class Tc{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Pt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Pt.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)}}class eo{constructor(e,n,r,i){this.from=e,this.to=n,this.flags=r,this.goalColumn=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new eo(r,i,this.flags,this.goalColumn)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return ae.range(e,n,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return ae.range(this.anchor,i,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!this.empty||this.assoc==e.assoc)}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 ae.range(e.anchor,e.head)}static create(e,n,r,i){return new eo(e,n,r,i)}}class ae{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:ae.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.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 ae(e.ranges.map(n=>eo.fromJSON(n)),e.main)}static single(e,n=e){return new ae([ae.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,i=0;ii.from-s.from),n=e.indexOf(r);for(let i=1;is.head?ae.range(a,l):ae.range(l,a))}}return new ae(e,n)}}function RE(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let ew=0;class ze{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=ew++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ze(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:tw),!!e.static,e.enables)}of(e){return new Dd([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dd(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dd(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function tw(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Dd{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=ew++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>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[o]=r(f),1},update(f,d){if(a&&d.docChanged||u&&(d.docChanged||d.selection)||H0(f,c)){let h=r(f);if(l?!Xx(h,f.values[o],i):!i(h,f.values[o]))return f.values[o]=h,1}return 0},reconfigure:(f,d)=>{let h,p=d.config.address[s];if(p!=null){let m=Sh(d,p);if(this.dependencies.every(b=>b instanceof ze?d.facet(b)===f.facet(b):b instanceof as?d.field(b,!1)==f.field(b,!1):!0)||(l?Xx(h=r(f),m,i):i(h=r(f),m)))return f.values[o]=m,0}else h=r(f);return f.values[o]=h,1}}}get extension(){return this}}function Xx(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[a.id]),i=n.map(a=>a.type),s=r.filter(a=>!(a&1)),o=t[e.id]>>1;function l(a){let u=[];for(let c=0;cr===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Qf).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,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(Qf),o=i.facet(Qf),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(r.values[n]=l.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Qf.of({field:this,create:e})]}get extension(){return this}}const Ko={lowest:4,low:3,default:2,high:1,highest:0};function Su(t){return e=>new OE(e,t)}const nw={highest:Su(Ko.highest),high:Su(Ko.high),default:Su(Ko.default),low:Su(Ko.low),lowest:Su(Ko.lowest)};class OE{constructor(e,n){this.inner=e,this.prec=n}get extension(){return this}}class Ra{of(e){return new j0(this,e)}reconfigure(e){return Ra.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class j0{constructor(e,n){this.compartment=e,this.inner=n}get extension(){return this}}class kh{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let d of m9(e,n,o))d instanceof as?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let l=Object.create(null),a=[],u=[];for(let d of i)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 s){let h=s[d],p=h[0].facet,m=c&&c[d]||[];if(h.every(b=>b.type==0))if(l[p.id]=a.length<<1|1,tw(m,h))a.push(r.facet(p));else{let b=p.combine(h.map(v=>v.value));a.push(r&&p.compare(b,r.facet(p))?r.facet(p):b)}else{for(let b of h)b.type==0?(l[b.id]=a.length<<1|1,a.push(b.value)):(l[b.id]=u.length<<1,u.push(v=>b.dynamicSlot(v)));l[p.id]=u.length<<1,u.push(b=>g9(b,p,h))}}let f=u.map(d=>d(l));return new kh(e,o,f,l,a,s)}}function m9(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let u=r[a].indexOf(o);u>-1&&r[a].splice(u,1),o instanceof j0&&n.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof j0){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof OE)s(o.inner,o.prec);else if(o instanceof as)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Dd)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,Ko.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(u==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(t,Ko.default),r.reduce((o,l)=>o.concat(l))}function ec(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 i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function Sh(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const PE=ze.define(),W0=ze.define({combine:t=>t.some(e=>e),static:!0}),IE=ze.define({combine:t=>t.length?t[0]:void 0,static:!0}),DE=ze.define(),_E=ze.define(),NE=ze.define(),LE=ze.define({combine:t=>t.length?t[0]:!1});class Ro{constructor(e,n){this.type=e,this.value=n}static define(){return new y9}}class y9{of(e){return new Ro(this,e)}}class v9{constructor(e){this.map=e}of(e){return new Xt(this,e)}}class Xt{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 Xt(this.type,n)}is(e){return this.type==e}static define(e={}){return new v9(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}Xt.reconfigure=Xt.define();Xt.appendConfig=Xt.define();class Dn{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&RE(r,n.newLength),s.some(l=>l.type==Dn.time)||(this.annotations=s.concat(Dn.time.of(Date.now())))}static create(e,n,r,i,s,o){return new Dn(e,n,r,i,s,o)}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(Dn.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Dn.time=Ro.define();Dn.userEvent=Ro.define();Dn.addToHistory=Ro.define();Dn.remote=Ro.define();function w9(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r=t[r]))s=t[r++],o=t[r++];else if(i=0;i--){let s=r[i](t);s instanceof Dn?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Dn?t=s[0]:t=BE(e,pa(s),!1)}return t}function x9(t){let e=t.startState,n=e.facet(NE),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=FE(r,V0(e,s,t.changes.newLength),!0))}return r==t?t:Dn.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const k9=[];function pa(t){return t==null?k9:Array.isArray(t)?t:[t]}var Ss=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ss||(Ss={}));const S9=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let U0;try{U0=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function C9(t){if(U0)return U0.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||S9.test(n)))return!0}return!1}function T9(t){return e=>{if(!/\S/.test(e))return Ss.Space;if(C9(e))return Ss.Word;for(let n=0;n-1)return Ss.Word;return Ss.Other}}class _t{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;li.set(u,a)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(Xt.reconfigure)?(n=null,r=l.value):l.is(Xt.appendConfig)&&(n=null,r=pa(r).concat(l.value));let s;n?s=e.startState.values.slice():(n=kh.resolve(r,i,this),s=new _t(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,u)=>u.reconfigure(a,this),null).values);let o=e.startState.facet(W0)?e.newSelection:e.newSelection.asSingle();new _t(n,e.newDoc,o,s,(l,a)=>a.update(l,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:ae.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=pa(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return _t.create({doc:e.doc,selection:ae.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=kh.resolve(e.extensions||[],new Map),r=e.doc instanceof Pt?e.doc:Pt.of((e.doc||"").split(n.staticFacet(_t.lineSeparator)||B0)),i=e.selection?e.selection instanceof ae?e.selection:ae.single(e.selection.anchor,e.selection.head):ae.single(0);return RE(i,r.length),n.staticFacet(W0)||(i=i.asSingle()),new _t(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(_t.tabSize)}get lineBreak(){return this.facet(_t.lineSeparator)||` -`}get readOnly(){return this.facet(LE)}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,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(PE))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return T9(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=tr(n,o,!1);if(s(n.slice(a,o))!=Ss.Word)break;o=a}for(;lt.length?t[0]:4});_t.lineSeparator=IE;_t.readOnly=LE;_t.phrases=ze.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});_t.languageData=PE;_t.changeFilter=DE;_t.transactionFilter=_E;_t.transactionExtender=NE;Ra.reconfigure=Xt.define();function zE(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class al{eq(e){return this==e}range(e,n=e){return K0.create(e,n,this)}}al.prototype.startSide=al.prototype.endSide=0;al.prototype.point=!1;al.prototype.mapMode=yr.TrackDel;function rw(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let K0=class $E{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new $E(e,n,r)}};function X0(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class iw{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,l=s.length;;){if(o==l)return o;let a=o+l>>1,u=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-n;if(a==o)return u>=0?o:l;u>=0?l=a:o=a+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sh||d==h&&u.startSide>0&&u.endSide<=0)continue;(h-d||u.endSide-u.startSide)<0||(o<0&&(o=d),u.point&&(l=Math.max(l,h-d)),r.push(u),i.push(d-o),s.push(h-o))}return{mapped:r.length?new iw(i,s,r,l):null,pos:o}}}class zt{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new zt(e,n,r,i)}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:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(X0)),this.isEmpty)return n.length?zt.of(n):this;let l=new HE(this,null,-1).goto(0),a=0,u=[],c=new Oa;for(;l.value||a=0){let f=n[a++];c.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Ec.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Ec.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=Gx(o,l,r),u=new Cu(o,a,s),c=new Cu(l,a,s);r.iterGaps((f,d,h)=>Yx(u,f,c,d,h,i)),r.empty&&r.length==0&&Yx(u,0,c,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),o=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Gx(s,o),a=new Cu(s,l,0).goto(r),u=new Cu(o,l,0).goto(r);for(;;){if(a.to!=u.to||!G0(a.active,u.active)||a.point&&(!u.point||!rw(a.point,u.point)))return!1;if(a.to>i)return!0;a.next(),u.next()}}static spans(e,n,r,i,s=-1){let o=new Cu(e,null,s).goto(n),l=n,a=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(i.span(l,u,o.active,a),a=o.openEnd(u));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,n=!1){let r=new Oa;for(let i of e instanceof K0?[e]:n?E9(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return zt.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=zt.empty;i=i.nextLayer)n=new zt(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}zt.empty=new zt([],[],null,-1);function E9(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(X0);e=r}return t}zt.empty.nextLayer=zt.empty;class Oa{finishChunk(e){this.chunks.push(new iw(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 Oa)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<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(zt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=zt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Gx(t,e,n){let r=new Map;for(let s of t)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new HE(o,n,r,s));return i.length==1?i[0]:new Ec(i)}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--)tm(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--)tm(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(),tm(this.heap,0)}}}function tm(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class Cu{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=Ec.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){Jf(this.active,e),Jf(this.activeTo,e),Jf(this.activeRank,e),this.minActive=qx(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;Zf(this.active,n,r),Zf(this.activeTo,n,i),Zf(this.activeRank,n,s),e&&Zf(e,n,this.cursor.from),this.minActive=qx(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&Jf(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[i]=0&&!(this.activeRank[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 Yx(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,l=r,a=r-e,u=!!s.boundChange;for(let c=!1;;){let f=t.to+a-n.to,d=f||t.endSide-n.endSide,h=d<0?t.to+a:n.to,p=Math.min(h,o);if(t.point||n.point?(t.point&&n.point&&rw(t.point,n.point)&&G0(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,p,t.point,n.point),c=!1):(c&&s.boundChange(l),p>l&&!G0(t.active,n.active)&&s.compareRange(l,p,t.active,n.active),u&&po)break;l=h,d<=0&&t.next(),d>=0&&n.next()}}function G0(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function qx(t,e){let n=-1,r=1e9;for(let i=0;i=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=tr(t,i)}return t.length}const Y0="ͼ",Qx=typeof Symbol>"u"?"__"+Y0:Symbol.for(Y0),q0=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Jx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class xo{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let h in l){let p=l[h];if(/&/.test(h))s(h.split(/,\s*/).map(m=>o.map(b=>m.replace(/&/,b))).reduce((m,b)=>m.concat(b)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(i(h),p,c,d)}else p!=null&&c.push(h.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||d)&&a.push((r&&!f&&!u?o.map(r):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=Jx[Qx]||1;return Jx[Qx]=e+1,Y0+e.toString(36)}static mount(e,n,r){let i=e[q0],s=r&&r.nonce;i?s&&i.setNonce(s):i=new M9(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let Zx=new Map;class M9{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Zx.get(r);if(s)return e[q0]=s;this.sheet=new i.CSSStyleSheet,Zx.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[q0]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),r)for(let u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},R9=typeof navigator<"u"&&/Mac/.test(navigator.platform),O9=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var jn=0;jn<10;jn++)ko[48+jn]=ko[96+jn]=String(jn);for(var jn=1;jn<=24;jn++)ko[jn+111]="F"+jn;for(var jn=65;jn<=90;jn++)ko[jn]=String.fromCharCode(jn+32),Ac[jn]=String.fromCharCode(jn);for(var nm in ko)Ac.hasOwnProperty(nm)||(Ac[nm]=ko[nm]);function P9(t){var e=R9&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||O9&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ac:ko)[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 Gi(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e2);var Ee={mac:nk||/Mac/.test(ar.platform),windows:/Win/.test(ar.platform),linux:/Linux|X11/.test(ar.platform),ie:xp,ie_version:WE?Q0.documentMode||6:Z0?+Z0[1]:J0?+J0[1]:0,gecko:ek,gecko_version:ek?+(/Firefox\/(\d+)/.exec(ar.userAgent)||[0,0])[1]:0,chrome:!!rm,chrome_version:rm?+rm[1]:0,ios:nk,android:/Android\b/.test(ar.userAgent),webkit:tk,webkit_version:tk?+(/\bAppleWebKit\/(\d+)/.exec(ar.userAgent)||[0,0])[1]:0,safari:ey,safari_version:ey?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ar.userAgent)||[0,0])[1]:0,tabSize:Q0.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function sw(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}const Ch=Object.create(null);function ow(t,e,n){if(t==e)return!0;t||(t=Ch),e||(e=Ch);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function I9(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function rk(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function D9(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new ul(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=VE(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new ul(e,r,i,n,e.widget||null,!0)}static line(e){return new Qc(e)}static set(e,n=!1){return zt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ht.none=zt.empty;class qc extends Ht{constructor(e){let{start:n,end:r}=VE(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?sw(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Ch}eq(e){return this==e||e instanceof qc&&this.tagName==e.tagName&&ow(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}qc.prototype.point=!1;class Qc extends Ht{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Qc&&this.spec.class==e.spec.class&&ow(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)}}Qc.prototype.mapMode=yr.TrackBefore;Qc.prototype.point=!0;class ul extends Ht{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?yr.TrackBefore:yr.TrackAfter:yr.TrackDel}get type(){return this.startSide!=this.endSide?ni.WidgetRange:this.startSide<=0?ni.WidgetBefore:ni.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ul&&_9(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)}}ul.prototype.point=!0;function VE(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function _9(t,e){return t==e||!!(t&&e&&t.compare(e))}function ga(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class Mc extends al{constructor(e,n,r){super(),this.tagName=e,this.attributes=n,this.rank=r}eq(e){return e==this||e instanceof Mc&&this.tagName==e.tagName&&ow(this.attributes,e.attributes)}static create(e){return new Mc(e.tagName,e.attributes||Ch,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return zt.of(e,n)}}Mc.prototype.startSide=Mc.prototype.endSide=-1;function Rc(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function ty(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function tc(t,e){if(!e.anchorNode)return!1;try{return ty(t,e.anchorNode)}catch{return!1}}function nc(t){return t.nodeType==3?Pc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function rc(t,e,n,r){return n?ik(t,e,n,r,-1)||ik(t,e,n,r,1):!1}function So(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Th(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function ik(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Os(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=So(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?Os(t):0}else return!1}}function Os(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Oc(t,e){let{left:n,right:r}=t;if(n==r)return t;let i=e?n:r;return{left:i,right:i,top:t.top,bottom:t.bottom}}function N9(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function UE(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function L9(t,e,n,r,i,s,o,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,p=1,m=1;if(h)d=N9(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 g=c.getBoundingClientRect();({scaleX:p,scaleY:m}=UE(c,g)),d={left:g.left,right:g.left+c.clientWidth*p,top:g.top,bottom:g.top+c.clientHeight*m}}let b=0,v=0;if(i=="nearest")e.top0&&e.bottom>d.bottom+v&&(v=e.bottom-d.bottom+o)):e.bottom>d.bottom-o&&(v=e.bottom-d.bottom+o,n<0&&e.top-v0&&e.right>d.right+b&&(b=e.right-d.right+s)):e.right>d.right-s&&(b=e.right-d.right+s,n<0&&e.leftd.bottom||e.leftd.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function KE(t,e=!0){let n=t.ownerDocument,r=null,i=null;for(let s=t.parentNode;s&&!(s==n.body||(!e||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class F9{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?Os(n):0),r,Math.min(e.focusOffset,r?Os(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}function XE(t){let e=[];for(let n=t;n;n=n.nodeType==11?n.host:n.parentNode)n.nodeType==1&&e.push({node:n,left:n.scrollLeft,top:n.scrollTop});return e}function GE(t,e=!0){for(let{node:n,left:r,top:i}of t)e&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}let Wo=null;Ee.safari&&Ee.safari_version>=26&&(Wo=!1);function YE(t){if(t.setActive)return t.setActive();if(Wo)return t.focus(Wo);let e=XE(t);t.focus(Wo==null?{get preventScroll(){return Wo={preventScroll:!0},!0}}:void 0),Wo||(Wo=!1,GE(e))}let sk;function Pc(t,e,n=e){let r=sk||(sk=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function ma(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function B9(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function z9(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,Os(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=Os(n))}else{if(n==t)return!0;r=So(n),n=n.parentNode}}function qE(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function QE(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=Os(n)}else if(n.parentNode&&!Th(n))r=So(n),n=n.parentNode;else return null}}function JE(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r=n){if(l.level==r)return o;(s<0||(i!=0?i<0?l.fromn:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function tA(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;m-=3)if(Hi[m+1]==-h){let b=Hi[m+2],v=b&2?i:b&4?b&1?s:i:0;v&&(Kt[f]=Kt[Hi[m]]=v),l=m;break}}else{if(Hi.length==189)break;Hi[l++]=f,Hi[l++]=d,Hi[l++]=a}else if((p=Kt[f])==2||p==1){let m=p==i;a=m?0:1;for(let b=l-3;b>=0;b-=3){let v=Hi[b+2];if(v&2)break;if(m)Hi[b+2]|=2;else{if(v&4)break;Hi[b+2]|=4}}}}}function U9(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,l=ia;)p==b&&(p=n[--m].from,b=m?n[m-1].to:t),Kt[--p]=h;a=c}else s=u,a++}}}function ry(t,e,n,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,u=0;aa&&o.push(new Ji(a,m.from,h));let b=m.direction==cl!=!(h%2);iy(t,b?r+1:r,i,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==n||(c?Kt[p]!=l:Kt[p]==l))break;p++}d?ry(t,a,p,r+1,i,d,o):ae;){let c=!0,f=!1;if(!u||a>s[u-1].to){let m=Kt[a-1];m!=l&&(c=!1,f=m==16)}let d=!c&&l==1?[]:null,h=c?r:r+1,p=a;e:for(;;)if(u&&p==s[u-1].to){if(f)break e;let m=s[--u];if(!c)for(let b=m.from,v=u;;){if(b==e)break e;if(v&&s[v-1].to==b)b=s[--v].from;else{if(Kt[b-1]==l)break e;break}}if(d)d.push(m);else{m.toKt.length;)Kt[Kt.length]=256;let r=[],i=e==cl?0:1;return iy(t,i,i,n,0,t.length,r),r}function nA(t){return[new Ji(0,t,0)]}let rA="";function X9(t,e,n,r,i){var s;let o=r.head-t.from,l=Ji.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],u=a.side(i,n);if(o==u){let d=l+=i?1:-1;if(d<0||d>=e.length)return null;a=e[l=d],o=a.side(!i,n),u=a.side(i,n)}let c=tr(t.text,o,a.forward(i,n));(ca.to)&&(c=u),rA=t.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return f&&c==u&&f.level+(i?0:1)t.some(e=>e)}),Y9=ze.define({combine:t=>t.some(e=>e)}),fA=ze.define();class ya{constructor(e,n,r,i,s,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new ya(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ya(ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ed=Xt.define({map:(t,e)=>t.map(e)}),dA=Xt.define();function Jr(t,e,n){let r=t.facet(lA);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))}const bs=ze.define({combine:t=>t.length?t[0]:!0});let q9=0;const ia=ze.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let a=[];return o&&a.push(kp.of(u=>{let c=u.plugin(l);return c?o(c):Ht.none})),s&&a.push(s(l)),a})}static fromClass(e,n){return oi.define((r,i)=>new e(r,i),n)}}class im{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}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(Jr(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.plugin.create(e,this.spec.arg)}catch(n){Jr(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){Jr(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const hA=ze.define(),cw=ze.define(),kp=ze.define(),pA=ze.define(),fw=ze.define(),Jc=ze.define(),gA=ze.define();function ok(t,e){let n=t.state.facet(gA);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return zt.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let u=s-e.from,c=o-e.from,f=i;for(let d=l.length-1;d>=0;d--,a--){let h=l[d].spec.bidiIsolate,p;if(h==null&&(h=G9(e.text,u,c)),a>0&&f.length&&(p=f[f.length-1]).to==u&&p.direction==h)p.to=c,f=p.inner;else{let m={from:u,to:c,direction:h,inner:[]};f.push(m),f=m.inner}}}}),i}const mA=ze.define();function dw(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(mA)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const Lu=ze.define();class Zr{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new Zr(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 i=e[n-1];if(!(i.fromA>r.toA)){if(i.toAi.push(new Zr(s,o,l,a))),this.changedRanges=i}static create(e,n,r){return new Eh(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>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}}const Q9=[];class yn{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Q9}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&I9(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n,r){return null}domPosFor(e,n){let r=So(this.dom),i=this.length?e>0:n>0;return new Ti(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Cp)return e;return null}static get(e){return e.cmTile}}class Sp extends yn{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,i,s=(e==null?void 0:e.node)==n?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;i&&i!=l.dom;)i=lk(i);else n.insertBefore(l.dom,i);r=l.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=lk(i);this.length=o}}function lk(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Cp extends Sp{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=yn.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let o=r.children[i++];if(o instanceof Ts)n.push(i),r=o,i=0;else{let l=s+o.length,a=e(o,s);if(a!==void 0)return a;s=l+o.breakAfter}}}resolveBlock(e,n){let r,i=-1,s,o=-1;if(this.blockTiles((l,a)=>{let u=a+l.length;if(e>=a&&e<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(r=void 0)}(ae||e==a&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=e-a)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Ts extends Sp{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new Ts(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Pa extends Sp{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new Pa(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,r){let i=null,s=-1,o=null,l=-1;function a(c,f){for(let d=0,h=0;d=f&&(p.isComposite()?a(p,f-h):(!o||o.isHidden&&(n>0&&!(o.flags&32)||r&&Z9(o,p)))&&(m>f||p.flags&32&&n<=1)?(o=p,l=f-h):(h=-1)&&(i=p,s=f-h)),h=m}}a(this,e);let u=(n<0?i:o)||i||o;return u?{tile:u,offset:u==i?s:l}:null}coordsIn(e,n,r){let i=this.resolveInline(e,n,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),n,r):J9(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Ti(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:n);let o=r.tile.parent,l=!1;for(let a of o.children){if(l)return new Ti(a.dom,0);a==r.tile&&(l=!0)}}return new Ti(this.dom,0)}}function J9(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=nc(e);return n[n.length-1]||null}function Z9(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.topi&&(e=i);let s=e,o=e,l=0;e==0&&n<0||e==i&&n>=0?Ee.chrome||Ee.gecko||(e?(s--,l=1):o=0)?0:a.length-1];return Ee.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(a,c=>c.width)||u),r==null?u:Oc(u,(l?l>0:n<0)==r)}static of(e,n){let r=new Qo(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class fl extends yn{constructor(e,n,r,i){super(e,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return Oc(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?s.length-1:0;o=s[a],!(e>0?a==0:a==s.length-1||o.top0==r)}}class eV{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:o,parents:l}=this;for(;e||n>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!l.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=l.pop(),s++}else{let a=i.children[s],u=a.breakAfter;(n>0?a.length<=e:a.length=0;l--){let a=n.marks[l],u=i.lastChild;if(u instanceof vr&&u.mark.eq(a.mark))u.dom!=a.dom&&u.setDOM(sm(a.dom)),i=u;else{if(this.cache.reused.get(a)){let f=yn.get(a.dom);f&&f.setDOM(sm(a.dom))}let c=vr.of(a.mark,a.dom);i.append(c),i=c}this.cache.reused.set(a,2)}let s=yn.get(e.text);s&&this.cache.reused.set(s,2);let o=new Qo(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=yA);let i=Pa.start(e,n||((r=this.cache.find(Pa))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],l;if(n>0&&(l=i.lastChild)&&l instanceof vr&&l.mark.eq(o))i=l,n--;else{let a=vr.of(o,(r=this.cache.find(vr,u=>u.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(a),i=a,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!ak(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Ee.ios&&ak(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(om,0,32)||new fl(om.toDOM(),0,om,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let n=e.rank*102+e.value.rank,r=new tV(e.from,e.to,e.value,n),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.fromo.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(Ah,void 0,1);return r&&(r.flags=n),r||new Ah(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class rV{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=i;let l=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,l)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const Mh=[fl,Pa,Qo,vr,Ah,Ts,Cp];for(let t=0;t[]),this.index=Mh.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let l=0;l{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,o=0;;){let l=oi){let u=a-i;this.preserve(u,!o,!l),i=a,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let u=a>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof vr&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof vr&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,i=this.builder,s=-1,o=zt.spans(this.decorations,e,n,{point:(l,a,u,c,f,d)=>{if(u instanceof ul){if(this.disallowBlockEffectsFor[d]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=c.length,f>c.length)i.continueWidget(a-l);else{let h=u.widget||(u.block?Ia.block:Ia.inline),p=oV(u),m=this.cache.findWidget(h,a-l,p)||fl.of(h,this.view,a-l,p);u.block?(u.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(m)):(i.ensureLine(r),i.addInlineWidget(m,c,f))}r=null}else r=lV(r,u);a>l&&this.text.skip(a-l)},span:(l,a,u,c)=>{for(let f=l;f-1&&(this.openWidget=o>s),this.openWidget||i.addLineStartIfNotCovered(r),this.openMarks=o}forward(e,n,r=1){n-e<=10?this.old.advance(n-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=yn.get(i);if(i==this.view.contentDOM)break;s instanceof vr?n.push(s):s!=null&&s.isLine()?r=s:s instanceof Ts||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new Pa(i,yA):r||n.push(vr.of(new qc({tagName:i.nodeName.toLowerCase(),attributes:D9(i)}),i)))}return{line:r,marks:n}}}function ak(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function oV(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const yA={class:"cm-line"};function lV(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&sw(n,t),r&&(t.class+=" "+r)),t}function aV(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof vr&&e.push(r.mark)}return e}function sm(t){let e=yn.get(t);return e&&e.setDOM(t.cloneNode()),t}class Ia extends Ga{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}}Ia.inline=new Ia("span");Ia.block=new Ia("div");const om=new class extends Ga{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class uk{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ht.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Cp(e,e.contentDOM),this.updateInner([new Zr(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!yV(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?cV(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;r=new Zr(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Ee.ie||Ee.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=hV(o,this.decorations,e.changes);a.length&&(r=Zr.extendWithRanges(r,a));let u=gV(l,this.blockWrappers,e.changes);return u.length&&(r=Zr.extendWithRanges(r,u)),s&&!r.some(c=>c.fromA<=s.range.fromA&&c.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,l=new sV(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&yn.get(n.text)&&l.cache.reused.set(yn.get(n.text),2),this.tile=l.run(e,n),oy(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Ee.chrome||Ee.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to-1)&&tc(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,u,c;if(a.empty?c=u=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),u=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),Ee.gecko&&a.empty&&!this.hasComposition&&uV(u)){let d=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(d,u.node.childNodes[u.offset]||null)),u=c=new Ti(d,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!rc(u.node,u.offset,f.anchorNode,f.anchorOffset)||!rc(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{Ee.android&&Ee.chrome&&r.contains(f.focusNode)&&mV(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let d=Rc(this.view.root);if(d)if(a.empty){if(Ee.gecko){let h=fV(u.node,u.offset);if(h&&h!=3){let p=(h==1?QE:JE)(u.node,u.offset);p&&(u=new Ti(p.node,p.offset))}}d.collapse(u.node,u.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(u.node,u.offset);try{d.extend(c.node,c.offset)}catch{}}else{let h=document.createRange();a.anchor>a.head&&([u,c]=[c,u]),h.setEnd(c.node,c.offset),h.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(h)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,c)),this.impreciseAnchor=u.precise?null:new Ti(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new Ti(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&rc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Rc(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.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,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(i,s)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let o=Os(e)==0?0:n==0?-1:1;for(;;){let l=e.parentNode;if(l==r.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!yn.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,l=i;;o++){let a=r.children[o];if(a.dom==s)return l;l+=a.length+a.breakAfter}}else return r.isText()?e==r.dom?i+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(i,n):r.domIn(i,n)}inlineDOMNearPos(e,n){let r,i=-1,s=!1,o,l=-1,a=!1;return this.tile.blockTiles((u,c)=>{if(u.isWidget()){if(u.flags&32&&c>=e)return!0;u.flags&16&&(s=!0)}else{let f=c+u.length;if(c<=e&&(r=u,i=e-c,s=f=e&&!o&&(o=u,l=e-c,a=c>e),c>e&&o)return!0}}),!r&&!o?this.domAtPos(e,n):(s&&o?r=null:a&&r&&(o=null),r&&n<0||!o?r.domIn(i,n):o.domIn(l,n))}coordsAt(e,n,r){let{tile:i,offset:s}=this.tile.resolveBlock(e,n);return i.isWidget()?i.widget instanceof lm?null:i.coordsInWidget(s,n,!0):i.coordsIn(s,n,r)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function i(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let a=i(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(s.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==mn.LTR,u=0,c=(f,d,h)=>{for(let p=0;pi);p++){let m=f.children[p],b=d+m.length,v=m.dom.getBoundingClientRect(),{height:g}=v;if(h&&!p&&(u+=v.top-h.top),m instanceof Ts)b>r&&c(m,d,v);else if(d>=r&&(u>0&&n.push(-u),n.push(g+u),u=0,o)){let y=m.dom.lastChild,k=y?nc(y):[];if(k.length){let x=k[k.length-1],C=a?x.right-v.left:v.right-x.left;C>l&&(l=C,this.minWidth=s,this.minWidthFrom=d,this.minWidthTo=b)}}h&&p==f.children.length-1&&(u+=h.bottom-v.bottom),d=b+m.breakAfter}};return c(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?mn.RTL:mn.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let c=nc(u.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=nc(n.firstChild)[0];r=n.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Ht.replace({widget:new lm(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Ht.set(e)}updateDeco(){let e=1,n=this.view.state.facet(kp).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(fw).map((s,o)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(zt.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(fA))try{if(u(this.view,e.range,e))return!0}catch(c){Jr(this.view.state,c,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=dw(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(L9(this.view.scrollDOM,o,n.head1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottomr.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){oy(this.tile)}}function oy(t,e){let n=e==null?void 0:e.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)oy(r,e)}}function uV(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")}function vA(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=QE(n.focusNode,n.focusOffset),i=JE(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=yn.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let a=yn.get(r.node);!a||a.isText()&&a.text!=r.node.nodeValue||(s=i)}}if(t.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function cV(t,e,n){let r=vA(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let a=e.invertedDesc;return{range:new Zr(a.mapPos(s),a.mapPos(o),s,o),text:i}}function fV(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}class lm extends Ga{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function vV(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return ae.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,l=s;n<0?o=tr(i.text,s,!1):l=tr(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let u=tr(i.text,o,!1);if(r(i.text.slice(u,o))!=a)break;o=u}for(;lt.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((i-n.top-(t.defaultLineHeight-l)*.5)/l);s+=a*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+A9(o,s,t.state.tabSize)}function bV(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.toe)return s;(!i||s.type==ni.Text&&(i.type!=s.type||(n<0?s.frome)))&&(i=s)}}return i||r}return r}function xV(t,e,n,r){let i=bV(t,e.head,e.assoc||-1),s=!r||i.type!=ni.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),l=t.textDirectionAt(i.from),a=t.posAtCoords({x:n==(l==mn.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return ae.cursor(a,n?-1:1)}return ae.cursor(n?i.to:i.from,n?-1:1)}function ck(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let l=e,a=null;;){let u=X9(i,s,o,l,n),c=rA;if(!u){if(i.number==(n?t.state.doc.lines:1))return l;c=` -`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),u=t.visualLineSide(i,!n)}if(a){if(!a(c))return l}else{if(!r)return u;a=r(c)}l=u}}function kV(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Ss.Space&&(i=o),i==o}}function SV(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return ae.cursor(i,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(i,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),c=t.documentTop;if(u)o==null&&(o=u.left-a.left),l=s<0?u.top:u.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(i-p.from))),l=(s<0?p.top:p.bottom)+c}let f=a.left+o,d=t.viewState.heightOracle.textHeight>>1,h=r??d;for(let p=0;;p+=d){let m=l+(h+p)*s,b=ly(t,{x:f,y:m},!1,s);if(n?m>a.bottom:ml:g{if(e>s&&ei(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:ae.cursor(r,rt.viewState.docHeight)return new Yi(t.state.doc.length,-1);if(u=t.elementAtHeight(a),r==null)break;if(u.type==ni.Text){if(r<0?u.tot.viewport.to)break;let d=t.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(d&&(r<0?d.top<=a+s:d.bottom>=a+s))break}let f=t.viewState.heightOracle.textHeight/2;a=r>0?u.bottom+f:u.top-f}if(t.viewport.from>=u.to||t.viewport.to<=u.from){if(n)return null;if(u.type==ni.Text){let f=wV(t,i,u,o,l);return new Yi(f,f==u.from?1:-1)}}if(u.type!=ni.Text)return a<(u.top+u.bottom)/2?new Yi(u.from,1):new Yi(u.to,-1);let c=t.docView.lineAt(u.from,2);return(!c||c.length!=u.length)&&(c=t.docView.lineAt(u.from,-2)),new CV(t,o,l,t.textDirectionAt(u.from)).scanTile(c,u.from)}class CV{constructor(e,n,r,i){this.view=e,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from>1;t:if(o.has(m)){for(let g=1;g=s&&(y-=p),!o.has(y)){m=y;break t}}break e}o.add(m);let b=n(m),v=0;if(b)for(let g=0;g1))if(y.bottomthis.y)(!u||u.top>y.top)&&(u=y),v=-1;else{let k=y.left>this.x?this.x-y.left:y.right(p+p+m)/3)return this.y=a.bottom-1,this.scan(e,n,!0);if(u&&u.top<(p+m+m)/3)return this.y=u.top+1,this.scan(e,n,!0)}let h=(l?this.dirAt(e[c],1):this.baseDir)==mn.LTR;return{i:c,after:this.x>(d.left+d.right)/2==h}}scanText(e,n){let r=[];for(let s=0;s{let o=r[s]-n,l=r[s+1]-n;return Pc(e.dom,o,l).getClientRects()});return i.after?new Yi(r[i.i+1],-1):new Yi(r[i.i],1)}scanTile(e,n){if(!e.length)return new Yi(n,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let r=[n];for(let l=0,a=n;l{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Pc(a.dom,0,a.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new Yi(r[i.i+1],-1):new Yi(o,1)}}const jl="￿";class TV{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(_t.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=jl}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=yn.get(i),l=i.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let a=yn.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:Th(i))||Th(l)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!AV(l,n)&&this.lineBreak(),i=l}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,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){let n=yn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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+(EV(e,r.node,r.offset)?n:0))}}function EV(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,l=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=bA(e.docView.tile,n,r,0))){let a=s||o?[]:OV(e),u=new TV(a,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=PV(a,this.bounds.from)}else{let a=e.observer.selectionRange,u=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!ty(e.contentDOM,a.focusNode)?l.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!ty(e.contentDOM,a.anchorNode)?l.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),f=e.viewport;if((Ee.ios||Ee.chrome)&&u!=c&&Math.min(u,c)<=l.main.from&&Math.max(u,c)>=l.main.to&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(ae.range(c,u));else if(e.lineWrapping&&c==u&&!(l.main.empty&&l.main.head==u)&&e.inputState.lastTouchTime>Date.now()-100){let d=e.coordsAtPos(u,-1),h=0;d&&(h=e.inputState.lastTouchY<=d.bottom?-1:1),this.newSel=ae.create([ae.cursor(u,h)])}else this.newSel=ae.single(c,u)}}}function bA(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,l=-1;for(let a=0,u=r,c=r;an)return bA(f,e,n,u);if(d>=e&&i==-1&&(i=a,s=u),u>n&&f.dom.parentNode==t.dom){o=a,l=c;break}c=d,u=d+f.breakAfter}return{from:s,to:l<0?r+t.length:l,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function xA(t,e){let n,{newSel:r}=e,{state:i}=t,s=i.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,u=s.from,c=null;(o===8||Ee.android&&e.text.length=l&&s.to<=a&&(e.typeOver||f!=e.text)&&f.slice(0,s.from-l)==e.text.slice(0,s.from-l)&&f.slice(s.to-l)==e.text.slice(d=e.text.length-(f.length-(s.to-l)))?n={from:s.from,to:s.to,insert:Pt.of(e.text.slice(s.from-l,d).split(jl))}:(h=kA(f,e.text,u-l,c))&&(Ee.chrome&&o==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==jl+jl&&h.toB--,n={from:l+h.from,to:l+h.toA,insert:Pt.of(e.text.slice(h.from,h.toB).split(jl))})}else r&&(!t.hasFocus&&i.facet(bs)||Rh(r,s))&&(r=null);if(!n&&!r)return!1;if((Ee.mac||Ee.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=ae.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Pt.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:i.toText(t.inputState.insertingText)}:Ee.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=ae.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Pt.of([" "])}),n)return hw(t,n,r,o);if(r&&!Rh(r,s)){let l=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=wA(i.facet(Jc).map(u=>u(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:a}),!0}else return!1}function hw(t,e,n,r=-1){if(Ee.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(Ee.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ma(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.lengthi.head)&&ma(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&ma(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=RV(t,e,n));return t.state.facet(aA).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function RV(t,e,n){let r,i=t.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.froms.to){let a=e.fromf(t)),u,a);e.from==c&&(o=c)}if(o>-1)r={changes:e,selection:ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.frome.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+u))}else{let a=i.changes(e),u=n&&n.main.to<=a.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),f,d=n&&vA(t,n.main.head);if(d){let p=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-p}}else f=t.state.doc.lineAt(s.head);let h=s.to-e.to;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:u||p.map(a)};let m=p.to-h,b=m-c.length;if(t.state.sliceDoc(b,m)!=c||m>=f.from&&b<=f.to)return{range:p};let v=i.changes({from:b,to:m,insert:e.insert}),g=p.to-s.to;return{changes:v,range:u?ae.range(Math.max(0,u.anchor+g),Math.max(0,u.head+g)):p.map(v)}})}else r={changes:a,selection:u&&i.selection.replaceRange(u)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:l,scrollIntoView:!0})}function kA(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o=o?s-n:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-n:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function OV(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new fk(n,r)),(i!=n||s!=r)&&e.push(new fk(i,s))),e}function PV(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?ae.single(n+e,r+e):null}function Rh(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class IV{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Ee.safari&&e.contentDOM.addEventListener("input",()=>null),Ee.gecko&&GV(e.contentDOM.ownerDocument)}handleEvent(e){!HV(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=_V(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&CA.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ee.android&&Ee.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Ee.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(SA.some(n=>n.keyCode==e.keyCode)&&!e.ctrlKey||NV.indexOf(e.key)>-1&&e.ctrlKey)){let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&Ee.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&DV(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Ee.safari&&!Ee.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function DV(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function dk(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){Jr(n.state,i)}}}function _V(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&n(l).handlers.push(dk(r.value,a))}if(o)for(let l in o){let a=o[l];a&&n(l).observers.push(dk(r.value,a))}}for(let r in Pi)n(r).handlers.push(Pi[r]);for(let r in fr)n(r).observers.push(fr[r]);return e}const SA=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],NV="dthko",CA=[16,17,18,20,91,92,224,225],td=6;function nd(t){return Math.max(0,t)*.7+8}function LV(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class FV{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=KE(e.contentDOM),this.atoms=e.state.facet(Jc).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(_t.allowMultipleSelections)&&BV(e,n),this.dragging=$V(e,n)&&AA(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&LV(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=dw(this.view);e.clientX-a.left<=i+td?n=-nd(i-e.clientX):e.clientX+a.right>=o-td&&(n=nd(e.clientX-o)),e.clientY-a.top<=s+td?r=-nd(s-e.clientY):e.clientY+a.bottom>=l-td&&(r=nd(e.clientY-l)),this.setScrollSpeed(n,r)}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=this.view.inputState.draggedContent=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(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=wA(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function BV(t,e){let n=t.state.facet(iA);return n.length?n[0](e):Ee.mac?e.metaKey:e.ctrlKey}function zV(t,e){let n=t.state.facet(sA);return n.length?n[0](e):Ee.mac?!e.altKey:!e.ctrlKey}function $V(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Rc(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function HV(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=yn.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Pi=Object.create(null),fr=Object.create(null),TA=Ee.ie&&Ee.ie_version<15||Ee.ios&&Ee.webkit_version<604;function jV(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(),EA(t,n.value)},50)}function Tp(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function EA(t,e){e=Tp(t.state,aw,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(ay!=null&&n.selection.ranges.every(a=>a.empty)&&ay==s.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((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:f},range:ae.cursor(u.from+f.length)}})}else o?r=n.changeByRange(a=>{let u=s.line(i++);return{changes:{from:a.from,to:a.to,insert:u.text},range:ae.cursor(a.from+u.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}fr.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,Ee.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};fr.wheel=fr.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};Pi.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);fr.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};fr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};fr.touchend=(t,e)=>{t.inputState.touchActive=!1};Pi.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(oA))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=VV(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new FV(t,e,n,r)),r&&t.observer.ignore(()=>{YE(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function hk(t,e,n,r){if(r==1)return ae.cursor(e,n);if(r==2)return vV(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return lDate.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(gk+1)%3:1}function VV(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=AA(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,l){let a=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,c=hk(t,a.pos,a.assoc,r);if(n.pos!=a.pos&&!o){let f=hk(t,n.pos,n.assoc,r),d=Math.min(f.from,c.from),h=Math.max(f.to,c.to);c=d1&&(u=UV(i,a.pos))?u:l?i.addRange(c):ae.create([c])}}}function UV(t,e){for(let n=0;n=e)return ae.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}Pi.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=ae.undirectionalRange(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Tp(t.state,uw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Pi.dragend=t=>(t.inputState.draggedContent=null,!1);function yk(t,e,n,r){if(n=Tp(t.state,aw,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&zV(t,e)?{from:s.from,to:s.to}:null,l={from:i,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Pi.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&yk(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return yk(t,e,r,!0),!0}return!1};Pi.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=TA?null:e.clipboardData;return n?(EA(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(jV(t),!1)};function KV(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 XV(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:Tp(t,uw,e.join(t.lineBreak)),ranges:n,linewise:r}}let ay=null;Pi.copy=Pi.cut=(t,e)=>{if(!tc(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=XV(t.state);if(!n&&!i)return!1;ay=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=TA?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(KV(t,n),!1)};const MA=Ro.define();function RA(t,e){let n=[];for(let r of t.facet(uA)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:MA.of(!0)}):null}function OA(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=RA(t.state,e);n?t.dispatch(n):t.update([])}},10)}fr.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),OA(t)};fr.blur=t=>{t.observer.clearSelectionRange(),OA(t)};fr.compositionstart=fr.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};fr.compositionend=t=>{t.observer.editContext||(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,Ee.chrome&&Ee.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};fr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Pi.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=t.posAtDOM(l.startContainer,l.startOffset),u=t.posAtDOM(l.endContainer,l.endOffset);return hw(t,{from:a,to:u,insert:t.state.toText(s)},null),!0}}let i;if(Ee.chrome&&Ee.android&&(i=SA.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Ee.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Ee.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>fr.compositionend(t,e),20),!1};const vk=new Set;function GV(t){vk.has(t)||(vk.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const wk=["pre-wrap","normal","pre-line","break-spaces"];let Da=!1;function bk(){Da=!1}class YV{constructor(e){this.lineWrapping=e,this.doc=Pt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}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)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return wk.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,a=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let u=0;u0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>_d&&(Da=!0),this.height=e)}replace(e,n,r){return cr.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:c,toB:f}=i[l],d=s.lineAt(a,qt.ByPosNoHeight,r.setDoc(n),0,0),h=d.to>=u?d:s.lineAt(u,qt.ByPosNoHeight,r,0,0);for(f+=h.to-u,u=h.to;l>0&&d.from<=i[l-1].toA;)a=i[l-1].fromA,c=i[l-1].fromB,l--,as*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,i-=l.size}else if(s>i*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,s-=l.size}else break;else if(i=s&&o(this.lineAt(0,qt.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ir extends PA{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Si(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Ir||i instanceof Hn&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Hn?i=new Ir(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):cr.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(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:""})`}}class Hn extends cr{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+(e0){let s=r[r.length-1];s instanceof Hn?r[r.length-1]=new Hn(s.length+i):r.push(null,new Hn(i-1))}if(e>0){let s=r[0];s instanceof Hn?r[0]=new Hn(e+s.length):r.unshift(new Hn(e-1),null)}return cr.of(r)}decomposeLeft(e,n){n.push(new Hn(e-1),null)}decomposeRight(e,n){n.push(null,new Hn(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],l=Math.max(n,i.from),a=-1;for(i.from>n&&o.push(new Hn(i.from-n-1).updateHeight(e,n));l<=s&&i.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=i.heights[i.index++],d=0;f<0&&(d=-f,f=i.heights[i.index++]),a==-1?a=f:Math.abs(f-a)>=_d&&(a=-2);let h=new Ir(c,f,d);h.outdated=!1,o.push(h),l+=c+1}l<=s&&o.push(null,new Hn(s-l).updateHeight(e,l));let u=cr.of(o);return(a<0||Math.abs(u.height-this.height)>=_d||Math.abs(a-this.heightMetrics(e,n).perLine)>=_d)&&(Da=!0),Oh(this,u)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class JV extends cr{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,i){let s=r+this.left.height;return el))return u;let c=n==qt.ByPosNoHeight?qt.ByPosNoHeight:qt.ByPos;return a?u.join(this.right.lineAt(l,c,r,o,l)):this.left.lineAt(l,c,r,i,s).join(u)}forEachLine(e,n,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,n,r,l,a,o);else{let u=this.lineAt(a,qt.ByPos,r,i,s);e=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,a,o)}}replace(e,n,r){let i=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of r)s.push(l);if(e>0&&xk(s,o-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e2*n.size||n.size>2*e.size?cr.of(this.break?[e,null,n]:[e,n]):(this.left=Oh(this.left,e),this.right=Oh(this.right,n),this.setHeight(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,i){let{left:s,right:o}=this,l=n+s.length+this.break,a=null;return i&&i.from<=n+s.length&&i.more?a=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function xk(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof Hn&&(r=t[e+1])instanceof Hn&&t.splice(e-1,3,new Hn(n.length+1+r.length))}const ZV=5;class pw{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),i=this.nodes[this.nodes.length-1];i instanceof Ir?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ir(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=ZV)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Ir(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new Hn(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 Ir)return e;let n=new Ir(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.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 Ir)&&!this.isCovered?this.nodes.push(new Ir(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let d=c.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),l=Math.max(l,d.top),a=Math.min(u==t.parentNode?i.innerHeight: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:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function rU(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function iU(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class um{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new YV(r),this.stateDeco=Ck(n),this.heightMap=cr.empty().applyChanges(this.stateDeco,Pt.empty,this.heightOracle.setDoc(n.doc),[new Zr(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ht.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new rd(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Sk:new gw(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Fu(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=Ck(this.state);let i=e.changedRanges,s=Zr.extendWithRanges(i,eU(r,this.stateDeco,e?e.changes:On.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);bk(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Da)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(u||!e.changes.empty||e.flags&2)&&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(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Y9)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?mn.RTL:mn.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,c=0;if(l.width&&l.height){let{scaleX:x,scaleY:C}=UE(n,l);(x>.005&&Math.abs(this.scaleX-x)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=x,this.scaleY=C,u|=16,o=a=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let h=KE(this.view.contentDOM,!1).y;h!=this.scrollParent&&(this.scrollParent=h,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=qE(this.scrollParent||e.win);let m=(this.printing?iU:nU)(n,this.paddingTop),b=m.top-this.pixelViewport.top,v=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(a=!0)),!this.inView&&!this.scrollTarget&&!rU(e.dom))return 0;let y=l.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),a){let x=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(x)&&(o=!0),o||i.lineWrapping&&Math.abs(y-this.contentDOMWidth)>i.charWidth){let{lineHeight:C,charWidth:T,textHeight:E}=e.docView.measureTextSize();o=C>0&&i.refresh(s,C,T,E,Math.max(5,y/T),x),o&&(e.docView.minWidth=0,u|=16)}b>0&&v>0?c=Math.max(b,v):b<0&&v<0&&(c=Math.min(b,v)),bk();for(let C of this.viewports){let T=C.from==this.viewport.from?x:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?cr.empty().applyChanges(this.stateDeco,Pt.empty,this.heightOracle,[new Zr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new qV(C.from,T))}Da&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return k&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]: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)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new rd(i.lineAt(o-r*1e3,qt.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,qt.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(ua.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(u,qt.ByPos,s,0,0),d;n.y=="center"?d=(f.top+f.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s>1,o=i<<1;if(this.defaultTextDirection!=mn.LTR&&!r)return[];let l=[],a=(c,f,d,h)=>{if(f-cc&&vv.from>=d.from&&v.to<=d.to&&Math.abs(v.from-c)v.fromg));if(!b){if(fy.from<=f&&y.to>=f)){let y=n.moveToLineBoundary(ae.cursor(f),!1,!0).head;y>c&&(f=y)}let v=this.gapSize(d,c,f,h),g=r||v<2e6?v:2e6;b=new um(c,f,v,g)}l.push(b)},u=c=>{if(c.length2e6)for(let C of e)C.from>=c.from&&C.fromc.from&&a(c.from,h,c,f),pn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];zt.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Fu(this.heightMap.lineAt(e,qt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Fu(this.heightMap.lineAt(this.scaler.fromDOM(e),qt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}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 Fu(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}}class rd{constructor(e,n){this.from=e,this.to=n}}function oU(t,e,n){let r=[],i=t,s=0;return zt.spans(n,t,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],l=o-s;if(r<=l)return s+r;r-=l}}function sd(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function lU(t,e){for(let n of t)if(e(n))return n}const Sk={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function Ck(t){let e=t.facet(kp).filter(r=>typeof r!="function"),n=t.facet(fw).filter(r=>typeof r!="function");return n.length&&e.push(zt.join(n)),e}class gw{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let u=n.lineAt(l,qt.ByPos,e,0,0).top,c=n.lineAt(a,qt.ByPos,e,0,0).bottom;return i+=c-u,{from:l,to:a,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Fu(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Si(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>Fu(i,e)):t._content)}const od=ze.define({combine:t=>t.join(" ")}),uy=ze.define({combine:t=>t.indexOf(!0)>-1}),cy=xo.newName(),IA=xo.newName(),DA=xo.newName(),_A={"&light":"."+IA,"&dark":"."+DA};function fy(t,e,n){return new xo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const aU=fy("."+cy,{"&":{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,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",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":{userSelect:"none",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:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&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",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&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,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".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",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,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"}},_A),uU={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},cm=Ee.ie&&Ee.ie_version<=11;class cU{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new F9,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.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Ee.ie&&Ee.ie_version<=11||Ee.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()}),window.EditContext&&Ee.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ee.chrome&&Ee.chrome_version<126)&&(this.editContext=new dU(e),e.state.facet(bs)&&(e.contentDOM.editContext=this.editContext.editContext)),cm&&(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),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){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.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(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,i=this.selectionRange;if(r.state.facet(bs)?r.root.activeElement!=this.dom:!tc(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Ee.ie&&Ee.ie_version<=11||Ee.android&&Ee.chrome)&&!r.state.selection.main.empty&&i.focusNode&&rc(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Rc(e.root);if(!n)return!1;let r=Ee.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&fU(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=tc(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&ma(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{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,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&tc(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new MV(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=xA(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!Rh(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=Tk(n,e.previousSibling||e.target.previousSibling,-1),i=Tk(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):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),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):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),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(bs)!=e.state.facet(bs)&&(e.view.contentDOM.editContext=e.state.facet(bs)?this.editContext.editContext:null))}destroy(){var e,n,r;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();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),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Tk(t,e,n){for(;e;){let r=yn.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function Ek(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return rc(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function fU(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Ek(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Ek(t,n):null}class dU{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,l=this.toEditorPos(r.updateRangeStart),a=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let u=a-l>r.text.length;l==this.from&&sthis.to&&(a=s);let c=kA(e.state.sliceDoc(l,a),r.text,(u?i.from:i.to)-l,u?"end":null);if(!c){let d=ae.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Rh(d,i)||e.dispatch({selection:d,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:Pt.of(r.text.slice(c.from,c.toB).split(` -`))};if((Ee.mac||Ee.android)&&f.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:Pt.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let d=this.to-this.from+(f.to-f.from+f.insert.length);hw(e,f,ae.single(this.toEditorPos(r.selectionStart,d),this.toEditorPos(r.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);o{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=Rc(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,u)=>{if(r)return;let c=u.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(u)){i=this.pendingContextChange=null,n+=c,this.to+=c;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=c,this.to+=c;else if(sthis.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=c}n+=c}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ue{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&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||B9(e.parent)||document,this.viewState=new kk(this,e.state||_t.create(e)),e.scrollTo&&e.scrollTo.is(ed)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ia).map(i=>new im(i));for(let i of this.plugins)i.update(this);this.observer=new cU(this),this.inputState=new IV(this),this.inputState.ensureHandlers(this.plugins),this.docView=new uk(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof Dn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(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,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(d=>d.annotation(MA))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=RA(s,o),a||(l=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(_t.phrases)!=this.state.facet(_t.phrases))return this.setState(s);i=Eh.create(this,s,e),i.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,{x:p,y:m}=this.state.facet(Ue.cursorScrollMargin);f=new ya(h.empty?h:ae.cursor(h.head,h.head>h.anchor?-1:1),"nearest","nearest",m,p)}for(let h of d.effects)h.is(ed)&&(f=h.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=Ph.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Lu)!=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(i.startState.facet(od)!=i.state.facet(od)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(sy))try{d(i)}catch(h){Jr(this.state,h,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!xA(this,c)&&u.force&&ma(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 kk(this,e),this.plugins=e.facet(ia).map(r=>new im(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new uk(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(ia),r=e.state.facet(ia);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new im(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(qE(r||this.win))s=-1,o=this.viewState.heightMap.height;else{let h=this.viewState.scrollAnchorAt(i);s=h.from,o=h.top}this.updateState=1;let a=this.viewState.measure();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(p){return Jr(this.state,p),Ak}}),f=Eh.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),d&&this.docViewUpdate());for(let h=0;h1||p<-1)&&!(Ee.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+p,r?s<0?r.scrollTop=r.scrollHeight:r.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(sy))l(n)}get themeClasses(){return cy+" "+(this.state.facet(uy)?DA:IA)+" "+this.state.facet(od)}updateAttrs(){let e=Mk(this,hA,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(bs)?"true":"false",class:"cm-content",style:`${Ee.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Mk(this,cw,n);let r=this.observer.ignore(()=>{let i=rk(this.contentDOM,this.contentAttrs,n),s=rk(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(Ue.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Lu);let e=this.state.facet(Ue.cspNonce);xo.mount(this.root,this.styleModules.concat(aU).reverse(),e?{nonce:e}:void 0)}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;nr.plugin==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}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}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 am(this,e,ck(this,e,n,r))}moveByGroup(e,n){return am(this,e,ck(this,e,n,r=>kV(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return ae.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return xV(this,e,n,r)}moveVertically(e,n,r){return am(this,e,SV(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=ly(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),ly(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),s=i[Ji.find(i,e-r.from,-1,n)];return this.docView.coordsAt(e,n,s.dir==mn.RTL)}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(cA)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>hU)return nA(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||tA(s.isolates,r=ok(this,e))))return s.order;r||(r=ok(this,e));let i=K9(e.text,n,r);return this.bidiCache.push(new Ph(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ee.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{YE(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(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){var r,i,s,o;return ed.of(new ya(typeof e=="number"?ae.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return ed.of(new ya(ae.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return oi.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return oi.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=xo.newName(),i=[od.of(r),Lu.of(fy(`.${r}`,e))];return n&&n.dark&&i.push(uy.of(!0)),i}static baseTheme(e){return nw.lowest(Lu.of(fy("."+cy,e,_A)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&yn.get(r)||yn.get(e);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}Ue.styleModule=Lu;Ue.inputHandler=aA;Ue.clipboardInputFilter=aw;Ue.clipboardOutputFilter=uw;Ue.scrollHandler=fA;Ue.focusChangeEffect=uA;Ue.perLineTextDirection=cA;Ue.exceptionSink=lA;Ue.updateListener=sy;Ue.editable=bs;Ue.mouseSelectionStyle=oA;Ue.dragMovesSelection=sA;Ue.clickAddsSelectionRange=iA;Ue.decorations=kp;Ue.blockWrappers=pA;Ue.outerDecorations=fw;Ue.atomicRanges=Jc;Ue.bidiIsolatedRanges=gA;Ue.cursorScrollMargin=ze.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}});Ue.scrollMargins=mA;Ue.darkTheme=uy;Ue.cspNonce=ze.define({combine:t=>t.length?t[0]:""});Ue.contentAttributes=cw;Ue.editorAttributes=hA;Ue.lineWrapping=Ue.contentAttributes.of({class:"cm-lineWrapping"});Ue.announce=Xt.define();const hU=4096,Ak={};class Ph{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:mn.LTR;for(let s=Math.max(0,e.length-10);s=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&sw(o,n)}return n}const pU=Ee.mac?"mac":Ee.windows?"win":Ee.linux?"linux":"key";function gU(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;ar.concat(i),[]))),n}let to=null;const vU=4e3;function wU(t,e=pU){let n=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,u,c)=>{var f,d;let h=n[o]||(n[o]=Object.create(null)),p=l.split(/ (?!$)/).map(v=>gU(v,e));for(let v=1;v{let k=to={view:y,prefix:g,scope:o};return setTimeout(()=>{to==k&&(to=null)},vU),!0}]})}let m=p.join(" ");i(m,!1);let b=h[m]||(h[m]={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&&b.run.push(a),u&&(b.preventDefault=!0),c&&(b.stopPropagation=!0)};for(let o of t){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let d in c)c[d].run.push(h=>f(h,dy))}let a=o[e]||o.key;if(a)for(let u of l)s(u,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return n}let dy=null;function bU(t,e,n,r){dy=e;let i=P9(e),s=h9(i,0),o=p9(s)==i.length&&i!=" ",l="",a=!1,u=!1,c=!1;to&&to.view==n&&to.scope==r&&(l=to.prefix+" ",CA.indexOf(e.keyCode)<0&&(u=!0,to=null));let f=new Set,d=b=>{if(b){for(let v of b.run)if(!f.has(v)&&(f.add(v),v(n)))return b.stopPropagation&&(c=!0),!0;b.preventDefault&&(b.stopPropagation&&(c=!0),u=!0)}return!1},h=t[r],p,m;return h&&(d(h[l+ld(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ee.windows&&e.ctrlKey&&e.altKey)&&!(Ee.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=ko[e.keyCode])&&p!=i?(d(h[l+ld(p,e,!0)])||e.shiftKey&&(m=Ac[e.keyCode])!=i&&m!=p&&d(h[l+ld(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&d(h[l+ld(i,e,!0)])&&(a=!0),!a&&d(h._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),dy=null,a}class xU extends Ga{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?nc(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=Oc(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function kU(t){let e=oi.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Ht.set([Ht.widget({widget:new xU(t),side:1}).range(0)]):Ht.none}get decorations(){return this.view.state.doc.length?Ht.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ue.contentAttributes.of({"aria-placeholder":t})]:e}const ad="-10000px";class LA{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=n?[]:null;for(let a=0;an[u]=a),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function SU(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const fm=ze.define({combine:t=>{var e,n,r;return{position:Ee.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||SU}}}),Ok=new WeakMap,FA=oi.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(fm);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new LA(t,BA,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(fm);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=ad,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Ee.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=dw(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(fm).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||f.rightMath.min(n.right,r.right)+.1)){c.style.top=ad;continue}let h=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=h?7:0,m=d.right-d.left,b=(e=Ok.get(u))!==null&&e!==void 0?e:d.bottom-d.top,v=u.offset||TU,g=this.view.textDirection==mn.LTR,y=d.width>r.right-r.left?g?r.left:r.right-d.width:g?Math.max(r.left,Math.min(f.left-(h?14:0)+v.x,r.right-m)):Math.min(Math.max(r.left,f.left-m+(h?14:0)-v.x),r.right-m),k=this.above[l];!a.strictSide&&(k?f.top-b-p-v.yr.bottom)&&k==r.bottom-f.bottom>f.top-r.top&&(k=this.above[l]=!k);let x=(k?f.top-r.top:r.bottom-f.bottom)-p;if(xy&&E.topC&&(C=k?E.top-b-2-p:E.bottom+p+2);if(this.position=="absolute"?(c.style.top=(C-t.parent.top)/s+"px",Pk(c,(y-t.parent.left)/i)):(c.style.top=C/s+"px",Pk(c,y/i)),h){let E=f.left+(g?v.x:-v.x)-(y+14-7);h.style.left=E/i+"px"}u.overlap!==!0&&o.push({left:y,top:C,right:T,bottom:C+b}),c.classList.toggle("cm-tooltip-above",k),c.classList.toggle("cm-tooltip-below",!k),u.positioned&&u.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ad}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Pk(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const CU=Ue.baseTheme({".cm-tooltip":{zIndex:500,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"}}}),TU={x:0,y:0},BA=ze.define({enables:[FA,CU]}),Ih=ze.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ep{static create(e){return new Ep(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new LA(e,Ih,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const EU=BA.compute([Ih],t=>{let e=t.facet(Ih);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ep.create,above:e[0].above,arrow:e.some(n=>n.arrow)}}),AU=ze.define();class MU{constructor(e,n,r,i,s,o){this.view=e,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||n.xo.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),a=l&&l.dir==mn.RTL?-1:1;s=n.x{if(l&&!(Array.isArray(l)&&!l.length)){let a=Array.isArray(l)?l:[l];i&&this.locked.set(a,i),e.dispatch({effects:this.setHover.of(a)})}};if(s&&"then"in s){let l=this.pending={pos:n};s.then(a=>{this.pending==l&&(this.pending=null,o(a))},a=>Jr(e.state,a,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(FA),n=e?e.manager.tooltips.findIndex(r=>r.create==Ep.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&!this.locked.has(i)&&s&&!RU(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!OU(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const ud=4;function RU(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return e.clientX>=n-ud&&e.clientX<=r+ud&&e.clientY>=i-ud&&e.clientY<=s+ud}function OU(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.righti||Math.min(o.bottom,l)=e&&a<=n}function PU(t,e={}){let n=Xt.define(),r=new WeakMap,i=as.define({create(){return[]},update(o,l){let a=r.get(o);if(o.length&&(e.hideOnChange&&(l.docChanged||l.selection)?o=[]:a&&a(l)?o=[]:e.hideOn&&(o=o.filter(u=>!e.hideOn(l,u)))),l.docChanged&&o.length){let u=[];for(let c of o){let f=l.changes.mapPos(c.pos,-1,yr.TrackDel);if(f!=null){let d=Object.assign(Object.create(null),c);d.pos=f,d.end!=null&&(d.end=l.changes.mapPos(d.end)),u.push(d)}}o=u}for(let u of l.effects)u.is(n)&&(o=u.value,a=void 0),(u.is(IU)&&!u.value||u.value==i)&&(o=[]);return o.length&&a&&r.set(o,a),o},provide:o=>Ih.from(o)});const s=oi.define(o=>new MU(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,AU.of(s),EU]}}const IU=Xt.define(),Ik=ze.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}}),DU=oi.fromClass(class{constructor(t){this.input=t.state.facet(hy),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Ik);this.top=new cd(t,!0,e.topContainer),this.bottom=new cd(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Ik);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new cd(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new cd(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(hy);if(n!=this.input){let r=n.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let u=this.specs.indexOf(a),c;u<0?(c=a(t.view),l.push(c)):(c=this.panels[u],c.update&&c.update(t)),i.push(c),(c.top?s:o).push(c)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ue.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class cd{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Dk(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Dk(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Dk(t){let e=t.nextSibling;return t.remove(),e}const hy=ze.define({enables:DU});class _a extends al{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}_a.prototype.elementClass="";_a.prototype.toDOM=void 0;_a.prototype.mapMode=yr.TrackBefore;_a.prototype.startSide=_a.prototype.endSide=-1;_a.prototype.point=!0;const zA=1024;let _U=0;class dm{constructor(e,n){this.from=e,this.to=n}}class Ct{constructor(e={}){this.id=_U++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Cr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Ct.closedBy=new Ct({deserialize:t=>t.split(" ")});Ct.openedBy=new Ct({deserialize:t=>t.split(" ")});Ct.group=new Ct({deserialize:t=>t.split(" ")});Ct.isolate=new Ct({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ct.contextHash=new Ct({perNode:!0});Ct.lookAhead=new Ct({perNode:!0});Ct.mounted=new Ct({perNode:!0});class sc{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[Ct.mounted.id]}}const NU=Object.create(null);class Cr{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):NU,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Cr(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}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(Ct.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 i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(Ct.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Cr.none=new Cr("",Object.create(null),0,8);class mw{constructor(e){this.types=e;for(let n=0;n0;for(let a=this.cursor(o|gn.IncludeAnonymous);;){let u=!1;if(a.from<=s&&a.to>=i&&(!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:ww(Cr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Cn(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Cn(Cr.none,n,r,i)))}static build(e){return zU(e)}}Cn.empty=new Cn(Cr.none,[],[],0);class yw{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 yw(this.buffer,this.index)}}class Co{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Cr.none}toString(){let e=[];for(let n=0;n0));a=o[a+3]);return l}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let l=e,a=0;l=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ic(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?l.length:-1;e!=u;e+=n){let c=l[e],f=a[e]+o.from,d;if(!(!(s&gn.EnterBracketed&&c instanceof Cn&&(d=sc.get(c))&&!d.overlay&&d.bracketed&&r>=f&&r<=f+c.length)&&!$A(i,r,f,f+c.length))){if(c instanceof Co){if(s&gn.ExcludeBuffers)continue;let h=c.findChild(0,c.buffer.length,n,r-f,i);if(h>-1)return new oo(new LU(o,c,e,f),null,h)}else if(s&gn.IncludeAnonymous||!c.type.isAnonymous||vw(c)){let h;if(!(s&gn.IgnoreMounts)&&(h=sc.get(c))&&!h.overlay)return new ri(h.tree,f,e,o);let p=new ri(c,f,e,o);return s&gn.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?c.children.length-1:0,n,r,i,s)}}}if(s&gn.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))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)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&gn.IgnoreOverlays)&&(i=sc.get(this._tree))&&i.overlay){let s=e-this.from,o=r&gn.EnterBracketed&&i.bracketed;for(let{from:l,to:a}of i.overlay)if((n>0||o?l<=s:l=s:a>s))return new ri(i.tree,i.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}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Nk(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function py(t,e,n=e.length-1){for(let r=t;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}class LU{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class oo extends HA{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){super(),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:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new oo(this.context,this,s)}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)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&gn.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new oo(this.context,this,s)}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 oo(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 oo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new Cn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function jA(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;sn.from||o.to=e){let l=new ri(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Ic(l,e,n,!1))}}return i?jA(i):r}class gy{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~gn.EnterBracketed,e instanceof ri)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:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof ri?(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:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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&gn.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&gn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&gn.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 i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}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:i}=this;if(i){if(e>0){if(this.index-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let l=r._tree.children[s];if(this.mode&gn.IncludeAnonymous||l instanceof Co||!l.type.isAnonymous||vw(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=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i=0;s--){if(s<0)return py(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function vw(t){return t.children.some(e=>e instanceof Co||!e.type.isAnonymous||vw(e))}function zU(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=zA,reused:s=[],minRepeatType:o=r.types.length}=t,l=Array.isArray(n)?new yw(n,n.length):n,a=r.types,u=0,c=0;function f(x,C,T,E,M,P){let{id:_,start:O,end:N,size:D}=l,oe=c,Q=u;if(D<0)if(l.next(),D==-1){let A=s[_];T.push(A),E.push(O-x);return}else if(D==-3){u=_;return}else if(D==-4){c=_;return}else throw new RangeError(`Unrecognized record size: ${D}`);let te=a[_],j,Y,U=O-x;if(N-O<=i&&(Y=b(l.pos-C,M))){let A=new Uint16Array(Y.size-Y.skip),L=l.pos-Y.size,I=A.length;for(;l.pos>L;)I=v(Y.start,A,I);j=new Co(A,N-Y.start,r),U=Y.start-x}else{let A=l.pos-D;l.next();let L=[],I=[],H=_>=o?_:-1,B=0,ce=N;for(;l.pos>A;)H>=0&&l.id==H&&l.size>=0?(l.end<=ce-i&&(p(L,I,O,B,l.end,ce,H,oe,Q),B=L.length,ce=l.end),l.next()):P>2500?d(O,A,L,I):f(O,A,L,I,H,P+1);if(H>=0&&B>0&&B-1&&B>0){let we=h(te,Q);j=ww(te,L,I,0,L.length,0,N-O,we,we)}else j=m(te,L,I,N-O,oe-N,Q)}T.push(j),E.push(U)}function d(x,C,T,E){let M=[],P=0,_=-1;for(;l.pos>C;){let{id:O,start:N,end:D,size:oe}=l;if(oe>4)l.next();else{if(_>-1&&N<_)break;_<0&&(_=D-i),M.push(O,N,D),P++,l.next()}}if(P){let O=new Uint16Array(P*4),N=M[M.length-2];for(let D=M.length-3,oe=0;D>=0;D-=3)O[oe++]=M[D],O[oe++]=M[D+1]-N,O[oe++]=M[D+2]-N,O[oe++]=oe;T.push(new Co(O,M[2]-N,r)),E.push(N-x)}}function h(x,C){return(T,E,M)=>{let P=0,_=T.length-1,O,N;if(_>=0&&(O=T[_])instanceof Cn){if(!_&&O.type==x&&O.length==M)return O;(N=O.prop(Ct.lookAhead))&&(P=E[_]+O.length+N)}return m(x,T,E,M,P,C)}}function p(x,C,T,E,M,P,_,O,N){let D=[],oe=[];for(;x.length>E;)D.push(x.pop()),oe.push(C.pop()+T-M);x.push(m(r.types[_],D,oe,P-M,O-P,N)),C.push(M-T)}function m(x,C,T,E,M,P,_){if(P){let O=[Ct.contextHash,P];_=_?[O].concat(_):[O]}if(M>25){let O=[Ct.lookAhead,M];_=_?[O].concat(_):[O]}return new Cn(x,C,T,E,_)}function b(x,C){let T=l.fork(),E=0,M=0,P=0,_=T.end-i,O={size:0,start:0,skip:0};e:for(let N=T.pos-x;T.pos>N;){let D=T.size;if(T.id==C&&D>=0){O.size=E,O.start=M,O.skip=P,P+=4,E+=4,T.next();continue}let oe=T.pos-D;if(D<0||oe=o?4:0,te=T.start;for(T.next();T.pos>oe;){if(T.size<0)if(T.size==-3||T.size==-4)Q+=4;else break e;else T.id>=o&&(Q+=4);T.next()}M=te,E+=D,P+=Q}return(C<0||E==x)&&(O.size=E,O.start=M,O.skip=P),O.size>4?O:void 0}function v(x,C,T){let{id:E,start:M,end:P,size:_}=l;if(l.next(),_>=0&&E4){let N=l.pos-(_-4);for(;l.pos>N;)T=v(x,C,T)}C[--T]=O,C[--T]=P-x,C[--T]=M-x,C[--T]=E}else _==-3?u=E:_==-4&&(c=E);return T}let g=[],y=[];for(;l.pos>0;)f(t.start||0,t.bufferStart||0,g,y,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:g.length?y[0]+g[0].length:0;return new Cn(a[t.topID],g.reverse(),y.reverse(),k)}const Lk=new WeakMap;function Nd(t,e){if(!t.isAnonymous||e instanceof Co||e.type!=t)return 1;let n=Lk.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Cn)){n=1;break}n+=Nd(t,r)}Lk.set(e,n)}return n}function ww(t,e,n,r,i,s,o,l,a){let u=0;for(let p=r;p=c)break;C+=T}if(y==k+1){if(C>c){let T=p[k];h(T.children,T.positions,0,T.children.length,m[k]+g);continue}f.push(p[k])}else{let T=m[y-1]+p[y-1].length-x;f.push(ww(t,p,m,k,y,x,T,null,a))}d.push(x+g-s)}}return h(e,n,r,i,0),(l||a)(f,d,o)}class tl{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new tl(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,u=0;;l++){let c=l=r)for(;o&&o.from=d.from||f<=d.to||u){let h=Math.max(d.from,a)-u,p=Math.min(d.to,f)-u;d=h>=p?null:new tl(h,p,d.tree,d.offset+u,l>0,!!c)}if(d&&i.push(d),o.to>f)break;o=snew dm(i.from,i.to)):[new dm(0,0)]:[new dm(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class $U{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)}}new Ct({perNode:!0});let HU=0;class Yr{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=HU++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Yr&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new Yr(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new Dh(e);return r=>r.modified.indexOf(n)>-1?r:Dh.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let jU=0;class Dh{constructor(e){this.name=e,this.instances=[],this.id=jU++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&WU(n,l.modified));if(r)return r;let i=[],s=new Yr(e.name,i,e,n);for(let l of n)l.instances.push(s);let o=VU(n);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(Dh.get(l,a));return s}}function WU(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function VU(t){let e=[[]];for(let n=0;nr.length-n.length)}function VA(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,l=i;for(let f=0;;){if(l=="..."&&f>0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let h=i[f++];if(f==i.length&&h=="!"){o=0;break}if(h!="/")throw new RangeError("Invalid path: "+i);l=i.slice(f)}let a=s.length-1,u=s[a];if(!u)throw new RangeError("Invalid path: "+i);let c=new Dc(r,o,a>0?s.slice(0,a):null);e[u]=c.sort(e[u])}}return UA.add(e)}const UA=new Ct({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new Dc(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class Dc{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=i;for(let l of s)for(let a of l.set){let u=n[a.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function UU(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function KU(t,e,n,r=0,i=t.length){let s=new XU(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class XU{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,i,s){let{type:o,from:l,to:a}=e;if(l>=r||a<=n)return;o.isTop&&(s=this.highlighters.filter(h=>!h.scope||h.scope(o)));let u=i,c=GU(e)||Dc.empty,f=UU(s,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,l),u),c.opaque)return;let d=e.tree&&e.tree.prop(Ct.mounted);if(d&&d.overlay){let h=e.node.enter(d.overlay[0].from+l,1),p=this.highlighters.filter(b=>!b.scope||b.scope(d.tree.type)),m=e.firstChild();for(let b=0,v=l;;b++){let g=b=y||!e.nextSibling())););if(!g||y>r)break;v=g.to+l,v>n&&(this.highlightRange(h.cursor(),Math.max(n,g.from+l),Math.min(r,v),"",p),this.startSpan(Math.min(r,v),u))}m&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}}function GU(t){let e=t.type.prop(UA);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const ve=Yr.define,dd=ve(),qs=ve(),Fk=ve(qs),Bk=ve(qs),Qs=ve(),hd=ve(Qs),hm=ve(Qs),Vi=ve(),zo=ve(Vi),ji=ve(),Wi=ve(),my=ve(),Tu=ve(my),pd=ve(),Ve={comment:dd,lineComment:ve(dd),blockComment:ve(dd),docComment:ve(dd),name:qs,variableName:ve(qs),typeName:Fk,tagName:ve(Fk),propertyName:Bk,attributeName:ve(Bk),className:ve(qs),labelName:ve(qs),namespace:ve(qs),macroName:ve(qs),literal:Qs,string:hd,docString:ve(hd),character:ve(hd),attributeValue:ve(hd),number:hm,integer:ve(hm),float:ve(hm),bool:ve(Qs),regexp:ve(Qs),escape:ve(Qs),color:ve(Qs),url:ve(Qs),keyword:ji,self:ve(ji),null:ve(ji),atom:ve(ji),unit:ve(ji),modifier:ve(ji),operatorKeyword:ve(ji),controlKeyword:ve(ji),definitionKeyword:ve(ji),moduleKeyword:ve(ji),operator:Wi,derefOperator:ve(Wi),arithmeticOperator:ve(Wi),logicOperator:ve(Wi),bitwiseOperator:ve(Wi),compareOperator:ve(Wi),updateOperator:ve(Wi),definitionOperator:ve(Wi),typeOperator:ve(Wi),controlOperator:ve(Wi),punctuation:my,separator:ve(my),bracket:Tu,angleBracket:ve(Tu),squareBracket:ve(Tu),paren:ve(Tu),brace:ve(Tu),content:Vi,heading:zo,heading1:ve(zo),heading2:ve(zo),heading3:ve(zo),heading4:ve(zo),heading5:ve(zo),heading6:ve(zo),contentSeparator:ve(Vi),list:ve(Vi),quote:ve(Vi),emphasis:ve(Vi),strong:ve(Vi),link:ve(Vi),monospace:ve(Vi),strikethrough:ve(Vi),inserted:ve(),deleted:ve(),changed:ve(),invalid:ve(),meta:pd,documentMeta:ve(pd),annotation:ve(pd),processingInstruction:ve(pd),definition:Yr.defineModifier("definition"),constant:Yr.defineModifier("constant"),function:Yr.defineModifier("function"),standard:Yr.defineModifier("standard"),local:Yr.defineModifier("local"),special:Yr.defineModifier("special")};for(let t in Ve){let e=Ve[t];e instanceof Yr&&(e.name=t)}KA([{tag:Ve.link,class:"tok-link"},{tag:Ve.heading,class:"tok-heading"},{tag:Ve.emphasis,class:"tok-emphasis"},{tag:Ve.strong,class:"tok-strong"},{tag:Ve.keyword,class:"tok-keyword"},{tag:Ve.atom,class:"tok-atom"},{tag:Ve.bool,class:"tok-bool"},{tag:Ve.url,class:"tok-url"},{tag:Ve.labelName,class:"tok-labelName"},{tag:Ve.inserted,class:"tok-inserted"},{tag:Ve.deleted,class:"tok-deleted"},{tag:Ve.literal,class:"tok-literal"},{tag:Ve.string,class:"tok-string"},{tag:Ve.number,class:"tok-number"},{tag:[Ve.regexp,Ve.escape,Ve.special(Ve.string)],class:"tok-string2"},{tag:Ve.variableName,class:"tok-variableName"},{tag:Ve.local(Ve.variableName),class:"tok-variableName tok-local"},{tag:Ve.definition(Ve.variableName),class:"tok-variableName tok-definition"},{tag:Ve.special(Ve.variableName),class:"tok-variableName2"},{tag:Ve.definition(Ve.propertyName),class:"tok-propertyName tok-definition"},{tag:Ve.typeName,class:"tok-typeName"},{tag:Ve.namespace,class:"tok-namespace"},{tag:Ve.className,class:"tok-className"},{tag:Ve.macroName,class:"tok-macroName"},{tag:Ve.propertyName,class:"tok-propertyName"},{tag:Ve.operator,class:"tok-operator"},{tag:Ve.comment,class:"tok-comment"},{tag:Ve.meta,class:"tok-meta"},{tag:Ve.invalid,class:"tok-invalid"},{tag:Ve.punctuation,class:"tok-punctuation"}]);var pm;const sa=new Ct;function YU(t){return ze.define({combine:t?e=>e.concat(t):void 0})}const qU=new Ct;class Ei{constructor(e,n,r=[],i=""){this.data=e,this.name=i,_t.prototype.hasOwnProperty("tree")||Object.defineProperty(_t.prototype,"tree",{get(){return ss(this)}}),this.parser=n,this.extension=[La.of(this),_t.languageData.of((s,o,l)=>{let a=zk(s,o,l),u=a.type.prop(sa);if(!u)return[];let c=s.facet(u),f=a.type.prop(qU);if(f){let d=a.resolve(o-a.from,l);for(let h of f)if(h.test(d,s)){let p=s.facet(h.facet);return h.type=="replace"?p:p.concat(c)}}return c})].concat(r)}isActiveAt(e,n,r=-1){return zk(e,n,r).type.prop(sa)==this.data}findRegions(e){let n=e.facet(La);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(sa)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(Ct.mounted);if(l){if(l.tree.prop(sa)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?n:void 0)]}),e.name)}configure(e,n){return new _h(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ss(t){let e=t.field(Ei.state,!1);return e?e.tree:Cn.empty}class QU{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=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Eu=null;class Nh{constructor(e,n,r=[],i,s,o,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Nh(e,n,[],Cn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new QU(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Cn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=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(tl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Eu;Eu=this;try{return e()}finally{Eu=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=$k(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,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=tl.applyChanges(r,a),i=Cn.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.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);ce.from&&(this.fragments=$k(this.fragments,i,s),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 WA{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=Eu;if(a){for(let u of i)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Cn(Cr.none,[],[],o-s)},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 Eu}}function $k(t,e,n){return tl.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Na{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 Na(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Nh.create(e.facet(La).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Na(r)}}Ei.state=as.define({create:Na.init,update(t,e){for(let n of e.effects)if(n.is(Ei.setState))return n.value;return e.startState.facet(La)!=e.state.facet(La)?Na.init(e.state):t.apply(e)}});let XA=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(XA=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const gm=typeof navigator<"u"&&(!((pm=navigator.scheduling)===null||pm===void 0)&&pm.isInputPending)?()=>navigator.scheduling.isInputPending():null,JU=oi.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(Ei.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Ei.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=XA(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,a=s.context.work(()=>gm&&gm()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ei.setState.of(new Na(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Jr(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()}}}),La=ze.define({combine(t){return t.length?t[0]:null},enables:t=>[Ei.state,JU,Ue.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class ZU{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const e7=ze.define(),bw=ze.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 Lh(t){let e=t.facet(bw);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Fh(t,e){let n="",r=t.tabSize,i=t.facet(bw)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s=e?t7(t,n,e):null}class Ap{constructor(e,n={}){this.state=e,this.options=n,this.unit=Lh(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return bp(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const YA=new Ct;function t7(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.fromr.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return qA(r,t,n)}function qA(t,e,n){for(let r=t;r;r=r.next){let i=r7(r.node);if(i)return i(xw.create(e,n,r))}return 0}function n7(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function r7(t){let e=t.type.prop(YA);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Ct.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>l7(o,!0,1,void 0,s&&!n7(o)?i.from:void 0)}return t.parent==null?i7:null}function i7(){return 0}class xw extends Ap{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new xw(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(s7(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return qA(this.context.next,this.base,this.pos)}}function s7(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function o7(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function l7(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==t.pos+o,a=o7(t);return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}function Hk({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const a7=new Ct;function u7(t){let e=t.firstChild,n=t.lastChild;return e&&e.tol.prop(sa)==o.data:o?l=>l==o:void 0,this.style=KA(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new xo(r):null,this.themeType=n.themeType}static define(e,n){return new Mp(e,n||{})}}const yy=ze.define(),c7=ze.define({combine(t){return t.length?[t[0]]:null}});function mm(t){let e=t.facet(yy);return e.length?e:t.facet(c7)}function jk(t,e){let n=[d7],r;return t instanceof Mp&&(t.module&&n.push(Ue.styleModule.of(t.module)),r=t.themeType),r?n.push(yy.computeN([Ue.darkTheme],i=>i.facet(Ue.darkTheme)==(r=="dark")?[t]:[])):n.push(yy.of(t)),n}class f7{constructor(e){this.markCache=Object.create(null),this.tree=ss(e.state),this.decorations=this.buildDeco(e,mm(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=ss(e.state),r=mm(e.state),i=r!=mm(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return Ht.none;let r=new Oa;for(let{from:i,to:s}of e.visibleRanges)KU(this.tree,n,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=Ht.mark({class:a})))},i,s);return r.finish()}}const d7=nw.high(oi.fromClass(f7,{decorations:t=>t.decorations})),h7=1e4,p7="()[]{}",g7=new Ct;function vy(t,e,n){let r=t.prop(e<0?Ct.openedBy:Ct.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function wy(t){let e=t.type.prop(g7);return e?e(t.node):t}function oa(t,e,n,r={}){let i=r.maxScanDistance||h7,s=r.brackets||p7,o=ss(t),l=o.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=vy(a.type,n,s);if(u&&a.from0?e>=c.from&&ec.from&&e<=c.to))return m7(t,e,n,a,c,u,s)}}return y7(t,e,n,o,l.type,i,s)}function m7(t,e,n,r,i,s,o){let l=r.parent,a={from:i.from,to:i.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&&s.indexOf(c.type.name)>-1&&c.from0)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<=s;){let h=c.value;n<0&&(d+=h.length);let p=e+d*n;for(let m=n>0?0:h.length-1,b=n>0?h.length:-1;m!=b;m+=n){let v=o.indexOf(h[m]);if(!(v<0||r.resolveInner(p+m,1).type!=i))if(v%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:p+m,to:p+m+1},matched:v>>1==a>>1};f--}}n>0&&(d+=h.length)}return c.done?{start:u,matched:!1}:null}const v7=Object.create(null),Wk=[Cr.none],Vk=[],Uk=Object.create(null),w7=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"]])w7[t]=b7(v7,e);function ym(t,e){Vk.indexOf(t)>-1||(Vk.push(t),console.warn(e))}function b7(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let u of l.split(".")){let c=t[u]||Ve[u];c?typeof c=="function"?a.length?a=a.map(c):ym(u,`Modifier ${u} used at start of tag`):a.length?ym(u,`Tag ${u} used as modifier`):a=Array.isArray(c)?c:[c]:ym(u,`Unknown highlighting tag ${u}`)}for(let u of a)n.push(u)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=Uk[i];if(s)return s.id;let o=Uk[i]=Cr.define({id:Wk.length,name:r,props:[VA({[r]:n})]});return Wk.push(o),o.id}mn.RTL,mn.LTR;const x7=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Sw(t.state,n.from);return r.line?k7(t):r.block?C7(t):!1};function kw(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const k7=kw(A7,0),S7=kw(QA,0),C7=kw((t,e)=>QA(t,e,E7(e)),0);function Sw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Au=50;function T7(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-Au,r),o=t.sliceDoc(i,i+Au),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-e.length,u)==e&&o.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let c,f;i-r<=2*Au?c=f=t.sliceDoc(r,i):(c=t.sliceDoc(r,r+Au),f=t.sliceDoc(i-Au,i));let d=/^\s*/.exec(c)[0].length,h=/\s*$/.exec(f)[0].length,p=f.length-h-n.length;return c.slice(d,d+e.length)==e&&f.slice(p,p+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(c.charAt(d+e.length))?1:0},close:{pos:i-h-n.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function E7(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function QA(t,e,n=e.selection.ranges){let r=n.map(s=>Sw(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>T7(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,l;oi&&(s==o||o>f.from)){i=f.from;let d=/^\s*/.exec(f.text)[0].length,h=d==f.length,p=f.text.slice(d,d+u.length)==u?d:-1;ds.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of r)(f||!c)&&s.push({from:l.from+u,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let u=o.from+l,c=u+a.length;o.text[c-o.from]==" "&&c++,s.push({from:u,to:c})}return{changes:s}}return null}const by=Ro.define(),M7=Ro.define(),R7=ze.define(),JA=ze.define({combine(t){return zE(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),ZA=as.define({create(){return Zi.empty},update(t,e){let n=e.state.facet(JA),r=e.annotation(by);if(r){let a=br.fromTransaction(e,r.selection),u=r.side,c=u==0?t.undone:t.done;return a?c=Bh(c,c.length,n.minDepth,a):c=nM(c,e.startState.selection),new Zi(u==0?r.rest:c,u==0?c:r.rest)}let i=e.annotation(M7);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Dn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=br.fromTransaction(e),o=e.annotation(Dn.time),l=e.annotation(Dn.userEvent);return s?t=t.addChanges(s,o,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,n.newGroupDelay)),(i=="full"||i=="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 Zi(t.done.map(br.fromJSON),t.undone.map(br.fromJSON))}});function O7(t={}){return[ZA,JA.of(t),Ue.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?eM:e.inputType=="historyRedo"?xy:null;return r?(e.preventDefault(),r(n)):!1}})]}function Rp(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(ZA,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const eM=Rp(0,!1),xy=Rp(1,!1),P7=Rp(0,!0),I7=Rp(1,!0);class br{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new br(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(i=>i.toJSON())}}static fromJSON(e){return new br(e.changes&&On.fromJSON(e.changes),[],e.mapped&&is.fromJSON(e.mapped),e.startSelection&&ae.fromJSON(e.startSelection),e.selectionsAfter.map(ae.fromJSON))}static fromTransaction(e,n){let r=ei;for(let i of e.startState.facet(R7)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new br(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ei)}static selection(e){return new br(void 0,ei,void 0,void 0,e)}}function Bh(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function D7(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a=u&&o<=c&&(r=!0)}}),r}function _7(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function tM(t,e){return t.length?e.length?t.concat(e):t:e}const ei=[],N7=200;function nM(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-N7));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Bh(t,t.length-1,1e9,n.setSelAfter(r)))}else return[br.selection([e])]}function L7(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 vm(t,e){if(!t.length)return t;let n=t.length,r=ei;for(;n;){let i=F7(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[br.selection(r)]:ei}function F7(t,e,n){let r=tM(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ei,n);if(!t.changes)return br.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new br(i,Xt.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const B7=/^(input\.type|delete)($|\.)/;class Zi{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Zi(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||B7.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Op(n,e))}function rr(t){return t.textDirectionAt(t.state.selection.main.head)==mn.LTR}const iM=t=>rM(t,!rr(t)),sM=t=>rM(t,rr(t));function oM(t,e){return _i(t,n=>n.empty?t.moveByGroup(n,e):Op(n,e))}const $7=t=>oM(t,!rr(t)),H7=t=>oM(t,rr(t));function j7(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 Pp(t,e,n){let r=ss(t).resolveInner(e.head),i=n?Ct.closedBy:Ct.openedBy;for(let a=e.head;;){let u=n?r.childAfter(a):r.childBefore(a);if(!u)break;j7(t,u,i)?r=u:a=n?u.to:u.from}let s=r.type.prop(i),o,l;return s&&(o=n?oa(t,r.from,1):oa(t,r.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?r.to:r.from,ae.cursor(l,n?-1:1)}const W7=t=>_i(t,e=>Pp(t.state,e,!rr(t))),V7=t=>_i(t,e=>Pp(t.state,e,rr(t)));function lM(t,e){return _i(t,n=>{if(!n.empty)return Op(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const aM=t=>lM(t,!1),uM=t=>lM(t,!0);function cM(t){let e=t.scrollDOM.clientHeighto.empty?t.moveVertically(o,e,n.height):Op(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>a&&o.bottomfM(t,!1),ky=t=>fM(t,!0);function Oo(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=ae.cursor(r.from+s))}return i}const U7=t=>_i(t,e=>Oo(t,e,!0)),K7=t=>_i(t,e=>Oo(t,e,!1)),X7=t=>_i(t,e=>Oo(t,e,!rr(t))),G7=t=>_i(t,e=>Oo(t,e,rr(t))),Y7=t=>_i(t,e=>ae.cursor(t.lineBlockAt(e.head).from,1)),q7=t=>_i(t,e=>ae.cursor(t.lineBlockAt(e.head).to,-1));function Q7(t,e,n){let r=!1,i=Ya(t.selection,s=>{let o=oa(t,s.head,-1)||oa(t,s.head,1)||s.head>0&&oa(t,s.head-1,1)||s.headQ7(t,e);function li(t,e,n){let r=Ya(t.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=ae.range(i.head,i.anchor));let s=n(i);return ae.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(Di(t.state,r)),!0)}function dM(t,e){return li(t,e,n=>t.moveByChar(n,e))}const hM=t=>dM(t,!rr(t)),pM=t=>dM(t,rr(t));function gM(t,e){return li(t,e,n=>t.moveByGroup(n,e))}const Z7=t=>gM(t,!rr(t)),eK=t=>gM(t,rr(t)),tK=t=>{let e=!rr(t);return li(t,e,n=>Pp(t.state,n,e))},nK=t=>{let e=rr(t);return li(t,e,n=>Pp(t.state,n,e))};function mM(t,e){return li(t,e,n=>t.moveVertically(n,e))}const yM=t=>mM(t,!1),vM=t=>mM(t,!0);function wM(t,e){return li(t,e,n=>t.moveVertically(n,e,cM(t).height))}const Xk=t=>wM(t,!1),Gk=t=>wM(t,!0),rK=t=>li(t,!0,e=>Oo(t,e,!0)),iK=t=>li(t,!1,e=>Oo(t,e,!1)),sK=t=>{let e=!rr(t);return li(t,e,n=>Oo(t,n,e))},oK=t=>{let e=rr(t);return li(t,e,n=>Oo(t,n,e))},lK=t=>li(t,!1,e=>ae.cursor(t.lineBlockAt(e.head).from)),aK=t=>li(t,!0,e=>ae.cursor(t.lineBlockAt(e.head).to)),Yk=({state:t,dispatch:e})=>(e(Di(t,{anchor:0})),!0),qk=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.doc.length})),!0),Qk=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.selection.main.anchor,head:0})),!0),Jk=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),uK=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),cK=({state:t,dispatch:e})=>{let n=Ip(t).map(({from:r,to:i})=>ae.undirectionalRange(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:ae.create(n),userEvent:"select"})),!0},fK=({state:t,dispatch:e})=>{let n=Ya(t.selection,r=>{let i=ss(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&o.next)return ae.undirectionalRange(l.from,l.to)}return r});return n.eq(t.selection)?!1:(e(Di(t,n)),!0)};function bM(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to0)for(let l=s;;){let a=t.moveVertically(l,e);if(a.heado.to){i.some(u=>u.head==a.head)||i.push(a);break}else{if(a.head==l.head)break;l=a}}}return i.length==r.ranges.length?!1:(t.dispatch(Di(n,ae.create(i,i.length-1))),!0)}const dK=t=>bM(t,!1),hK=t=>bM(t,!0),pK=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=ae.create([n.main]):n.main.empty||(r=ae.create([ae.cursor(n.main.head)])),r?(e(Di(t,r)),!0):!1};function Zc(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);ao&&(n="delete.forward",a=gd(t,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=gd(t,o,!1),l=gd(t,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:ae.cursor(o,oi(t)))r.between(e,e,(i,s)=>{ie&&(e=n?s:i)});return e}const xM=(t,e,n)=>Zc(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),l,a;if(n&&!e&&i>o.from&&ixM(t,!1,!0),kM=t=>xM(t,!0,!1),SM=(t,e)=>Zc(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=tr(s.text,r-s.from,e)+s.from,u=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),c=o(u);if(l!=null&&c!=l)break;(u!=" "||r!=n.head)&&(l=c),r=a}return r}),CM=t=>SM(t,!1),gK=t=>SM(t,!0),mK=t=>Zc(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headZc(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),vK=t=>Zc(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Pt.of(["",""])},range:ae.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},bK=({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 i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:tr(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:tr(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(o,i))},range:ae.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Ip(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function TM(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of Ip(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let a of s.ranges)i.push(ae.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let a of s.ranges)i.push(ae.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:ae.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const xK=({state:t,dispatch:e})=>TM(t,e,!1),kK=({state:t,dispatch:e})=>TM(t,e,!0);function EM(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of Ip(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const SK=({state:t,dispatch:e})=>EM(t,e,!1),CK=({state:t,dispatch:e})=>EM(t,e,!0),TK=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Ip(e).map(({from:i,to:s})=>(i>0?i--:s{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),l=t.coordsAtPos(i.head,i.assoc||1);l&&(s=o.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function EK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ss(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(Ct.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const Zk=AM(!1),AK=AM(!0);function AM(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!t&&s==o&&EK(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new Ap(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=GA(u,s);for(c==null&&(c=bp(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));ol.from&&s{let i=[];for(let o=r.from;o<=r.to;){let l=t.doc.lineAt(o);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),o=l.to+1}let s=t.changes(i);return{changes:i,range:ae.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const MK=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Ap(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=Cw(t,(s,o,l)=>{let a=GA(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let u=/^\s*/.exec(s.text)[0],c=Fh(t,a);(u!=c||l.fromt.readOnly?!1:(e(t.update(Cw(t,(n,r)=>{r.push({from:n.from,insert:t.facet(bw)})}),{userEvent:"input.indent"})),!0),RM=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Cw(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=bp(i,t.tabSize),o=0,l=Fh(t,Math.max(0,s-Lh(t)));for(;o(t.setTabFocusMode(),!0),OK=[{key:"Ctrl-b",run:iM,shift:hM,preventDefault:!0},{key:"Ctrl-f",run:sM,shift:pM},{key:"Ctrl-p",run:aM,shift:yM},{key:"Ctrl-n",run:uM,shift:vM},{key:"Ctrl-a",run:Y7,shift:lK},{key:"Ctrl-e",run:q7,shift:aK},{key:"Ctrl-d",run:kM},{key:"Ctrl-h",run:Sy},{key:"Ctrl-k",run:mK},{key:"Ctrl-Alt-h",run:CM},{key:"Ctrl-o",run:wK},{key:"Ctrl-t",run:bK},{key:"Ctrl-v",run:ky}],PK=[{key:"ArrowLeft",run:iM,shift:hM,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:$7,shift:Z7,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:X7,shift:sK,preventDefault:!0},{key:"ArrowRight",run:sM,shift:pM,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:H7,shift:eK,preventDefault:!0},{mac:"Cmd-ArrowRight",run:G7,shift:oK,preventDefault:!0},{key:"ArrowUp",run:aM,shift:yM,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Yk,shift:Qk},{mac:"Ctrl-ArrowUp",run:Kk,shift:Xk},{key:"ArrowDown",run:uM,shift:vM,preventDefault:!0},{mac:"Cmd-ArrowDown",run:qk,shift:Jk},{mac:"Ctrl-ArrowDown",run:ky,shift:Gk},{key:"PageUp",run:Kk,shift:Xk},{key:"PageDown",run:ky,shift:Gk},{key:"Home",run:K7,shift:iK,preventDefault:!0},{key:"Mod-Home",run:Yk,shift:Qk},{key:"End",run:U7,shift:rK,preventDefault:!0},{key:"Mod-End",run:qk,shift:Jk},{key:"Enter",run:Zk,shift:Zk},{key:"Mod-a",run:uK},{key:"Backspace",run:Sy,shift:Sy,preventDefault:!0},{key:"Delete",run:kM,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:CM,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:gK,preventDefault:!0},{mac:"Mod-Backspace",run:yK,preventDefault:!0},{mac:"Mod-Delete",run:vK,preventDefault:!0}].concat(OK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),IK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:W7,shift:tK},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:V7,shift:nK},{key:"Alt-ArrowUp",run:xK},{key:"Shift-Alt-ArrowUp",run:SK},{key:"Alt-ArrowDown",run:kK},{key:"Shift-Alt-ArrowDown",run:CK},{key:"Mod-Alt-ArrowUp",run:dK},{key:"Mod-Alt-ArrowDown",run:hK},{key:"Escape",run:pK},{key:"Mod-Enter",run:AK},{key:"Alt-l",mac:"Ctrl-l",run:cK},{key:"Mod-i",run:fK,preventDefault:!0},{key:"Mod-[",run:RM},{key:"Mod-]",run:MM},{key:"Mod-Alt-\\",run:MK},{key:"Shift-Mod-k",run:TK},{key:"Shift-Mod-\\",run:J7},{key:"Mod-/",run:x7},{key:"Alt-A",mac:"Ctrl-A",run:S7},{key:"Ctrl-m",mac:"Shift-Alt-m",run:RK}].concat(PK),DK={key:"Tab",run:MM,shift:RM};var eS={};class zh{constructor(e,n,r,i,s,o,l,a,u,c=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=u,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new zh(e,[],n,r,r,0,[],0,i?new tS(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(i,u)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==r)return;if(this.buffer[o-2]>=n){this.buffer[o-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>r;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;this.pos=i;let l=o.stateFlag(s,1);!l&&(i>r||n<=o.maxNode)&&(this.reducePos=i),this.pushState(s,l?r:Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(n&&e.buffer[n-4]==0&&(n-=4);n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new zh(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new _K(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;sa&1&&l==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,u=this.stack.length-l*3;if(u>=0&&e.getGoto(this.stack[u],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n0&&this.emitLookAhead()}}class tS{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class _K{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class $h{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new $h(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}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]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $h(this.stack,this.pos,this.index)}}function md(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Ld{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const nS=new Ld;class NK{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=nS,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;sr.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=nS,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class va{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;LK(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}va.prototype.contextual=va.prototype.fallback=va.prototype.extend=!1;va.prototype.fallback=va.prototype.extend=!1;function LK(t,e,n,r,i,s){let o=0,l=1<0){let p=t[h];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||FK(p,e.token.value,i,s))){e.acceptToken(p);break}}let c=e.next,f=0,d=t[o+2];if(e.next<0&&d>f&&t[u+d*3-3]==65535){o=t[u+d*3-1];continue e}for(;f>1,p=u+h+(h<<1),m=t[p],b=t[p+1]||65536;if(c=b)f=h+1;else{o=t[p+2],e.advance();continue e}}break}}function rS(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function FK(t,e,n,r){let i=rS(n,r,e);return i<0||rS(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class BK{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?iS(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?iS(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof Cn){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class zK{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ld)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let u=0;uf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let d=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!c.extend&&(r=f,n>d))break}}for(;this.actions.length>n;)this.actions.pop();return a&&e.setLookAhead(a),!r&&e.pos==this.stream.end&&(r=new Ld,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Ld,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;se.bufferLength*4?new BK(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)r.push(l);else{if(this.advanceStack(l,r,e))continue;{i||(i=[],s=[]),i.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=i&&jK(i);if(o)return Or&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Or&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return Or&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,l)=>l.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,c=u?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(d>-1&&f.length&&(!u||(f.prop(Ct.contextHash)||0)==c))return e.useNode(f,d),Or&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof Cn)||f.children.length==0||f.positions[0]>0)break;let h=f.children[0];if(h instanceof Cn&&f.positions[0]==0)f=h;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),Or&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let u=0;ui?n.push(p):r.push(p)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return sS(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Or&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),d=c;for(let h=0;h<10&&f.forceReduce()&&(Or&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));h++)Or&&(d=this.stackID(f)+" -> ");for(let h of l.recoverByInsert(a))Or&&console.log(c+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,r);this.stream.end>l.pos?(u==l.pos&&(u++,a=0),l.recoverByDelete(a,u),Or&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),sS(l,r)):(!i||i.scoree.topRules[l][1]),i=[];for(let l=0;l=0)s(c,a,l[u++]);else{let f=l[u+-c];for(let d=-c;d>0;d--)s(l[u++],a,f);u++}}}this.nodeSet=new mw(n.map((l,a)=>Cr.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:i[a],top:r.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=zA;let o=md(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new va(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new $K(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],l=o&1,a=i[s++];if(l&&r)return a;for(let u=s+(o>>1);s0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vs(this.data,s+2);else break;i=n(vs(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=vs(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Hh.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=oS(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;sr)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const WK=VA({String:Ve.string,Number:Ve.number,"True False":Ve.bool,PropertyName:Ve.propertyName,Null:Ve.null,", :":Ve.separator,"[ ]":Ve.squareBracket,"{ }":Ve.brace}),VK=Hh.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[WK],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),UK=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=KK(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function KK(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const XK=_h.define({name:"json",parser:VK.configure({props:[YA.add({Object:Hk({except:/^\s*\}/}),Array:Hk({except:/^\s*\]/})}),a7.add({"Object Array":u7})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function GK(){return new ZU(XK)}class lS{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Xo{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(es).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((h,p)=>h.from-p.from||h.to-p.to),o=new Oa,l=[],a=0,u=r.doc.iter(),c=0,f=r.doc.length;for(let h=0;;){let p=h==s.length?null:s[h];if(!p&&!l.length)break;let m,b;if(l.length)m=a,b=l.reduce((y,k)=>Math.min(y,k.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;b=p.to,l.push(p),h++}for(;hy.from||y.to==m))l.push(y),h++,b=Math.min(y.to,b);else{b=Math.min(y.from,b);break}}b=Math.min(b,f);let v=!1;if(l.some(y=>y.from==m&&(y.to==b||b==f))&&(v=m==b,!v&&b-m<10)){let y=m-(c+u.value.length);y>0&&(u.next(y),c=m);for(let k=m;;){if(k>=b){v=!0;break}if(!u.lineBreak&&c+u.value.length>k)break;k=c+u.value.length,c+=u.value.length,u.next()}}let g=aX(l);if(v)o.add(m,m,Ht.widget({widget:new iX(g),diagnostics:l.slice()}));else{let y=l.reduce((k,x)=>x.markClass?k+" "+x.markClass:k,"");o.add(m,b,Ht.mark({class:"cm-lintRange cm-lintRange-"+g+y,diagnostics:l.slice(),inclusiveEnd:l.some(k=>k.to>b)}))}if(a=b,a==f)break;for(let y=0;y{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new lS(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new lS(r.from,s,r.diagnostic)}}),r}function YK(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(es).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(Tw))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function qK(t,e){return t.field(Ai,!1)?e:e.concat(Xt.appendConfig.of(_M))}function QK(t,e){return{effects:qK(t,[Tw.of(e)])}}const Tw=Xt.define(),OM=Xt.define(),PM=Xt.define(),Ai=as.define({create(){return new Xo(Ht.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=Fa(n,t.selected.diagnostic,s)||Fa(n,null,s)}!n.size&&i&&e.state.facet(es).autoPanel&&(i=null),t=new Xo(n,i,r)}for(let n of e.effects)if(n.is(Tw)){let r=e.state.facet(es).autoPanel?n.value.length?jh.open:null:t.panel;t=Xo.init(n.value,r,e.state)}else n.is(OM)?t=new Xo(t.diagnostics,n.value?jh.open:null,t.selected):n.is(PM)&&(t=new Xo(t.diagnostics,t.panel,n.value));return t},provide:t=>[hy.from(t,e=>e.panel),Ue.decorations.from(t,e=>e.diagnostics)]}),JK=Ht.mark({class:"cm-lintRange cm-lintRange-active"});function ZK(t,e,n){let{diagnostics:r}=t.state.field(Ai),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,u,{spec:c})=>{if(e>=a&&e<=u&&(a==u||(e>a||n>0)&&(eDM(t,n,!1)))}const aS=t=>{let e=t.state.field(Ai,!1);return!e||!e.panel?!1:(t.dispatch({effects:OM.of(!1)}),!0)},tX=oi.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(es);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let t=Date.now();if(tPromise.resolve(r(this.view))),r=>{this.view.state.doc==e.doc&&this.view.dispatch(QK(this.view.state,r.reduce((i,s)=>i.concat(s))))},r=>{Jr(this.view.state,r)})}}update(t){let e=t.state.facet(es);(t.docChanged||e!=t.startState.facet(es)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function nX(t,e,n){let r=[],i=-1;for(let s of t)s.then(o=>{r.push(o),clearTimeout(i),r.length==t.length?e(r):i=setTimeout(()=>e(r),200)},n)}const es=ze.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...zE(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:uS,tooltipFilter:uS,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function uS(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function rX(t,e={}){return[es.of({source:t,config:e}),tX,_M]}function IM(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;rs.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function DM(t,e,n){var r;let i=n?IM(e.actions):[];return Gi("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Gi("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=h=>{if(h.preventDefault(),l)return;l=!0;let p=Fa(t.state.field(Ai).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:u}=s,c=i[o]?u.indexOf(i[o]):-1,f=c<0?u:[u.slice(0,c),Gi("u",u.slice(c,c+1)),u.slice(c+1)],d=s.markClass?" "+s.markClass:"";return Gi("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:a,onmousedown:a,"aria-label":` Action: ${u}${c<0?"":` (access key "${i[o]})"`}.`},f)}),e.source&&Gi("div",{class:"cm-diagnosticSource"},e.source))}class iX extends Ga{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Gi("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class cS{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=DM(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class jh{constructor(e){this.view=e,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)aS(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=IM(s.actions);for(let l=0;l{for(let s=0;saS(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ai).selected;if(!e)return-1;for(let n=0;n{for(let c of u.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,d;for(let h=r;hr&&(this.items.splice(r,f-r),i=!0)),n&&d.diagnostic==n.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),s=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),r++}});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let u=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ai),r=Fa(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:PM.of(r)})}static open(e){return new jh(e)}}function sX(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function yd(t){return sX(``,'width="6" height="3"')}const oX=Ue.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:yd("#f11")},".cm-lintRange-warning":{backgroundImage:yd("orange")},".cm-lintRange-info":{backgroundImage:yd("#999")},".cm-lintRange-hint":{backgroundImage:yd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function lX(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function aX(t){let e="hint",n=1;for(let r of t){let i=lX(r.severity);i>n&&(n=i,e=r.severity)}return e}const uX=PU(ZK,{hideOn:YK}),_M=[Ai,Ue.decorations.compute([Ai],t=>{let{selected:e,panel:n}=t.field(Ai);return!e||!n||e.from==e.to?Ht.none:Ht.set([JK.range(e.from,e.to)])}),uX,oX],cX=512*1024,fX=t=>t.state.doc.length>cX?[]:UK()(t);function fS(t){return Mp.define([{tag:Ve.propertyName,color:t?"#7dd3fc":"#0369a1"},{tag:Ve.string,color:t?"#86efac":"#15803d"},{tag:Ve.number,color:t?"#fcd34d":"#b45309"},{tag:Ve.bool,color:t?"#d8b4fe":"#7e22ce"},{tag:Ve.null,color:t?"#a1a1aa":"#71717a"}])}const dX=Ue.theme({"&":{height:"100%",fontSize:"13px",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.5rem",overflow:"auto"},".cm-gutters":{display:"none"},".cm-activeLine":{backgroundColor:"transparent"},".cm-content":{caretColor:"currentColor",fontFamily:"inherit",letterSpacing:"-0.025em"},".cm-placeholder":{color:"var(--color-muted-foreground)"}});function NM({value:t,onChange:e,editable:n,dark:r,placeholder:i,testId:s="json-editor",className:o,onReady:l}){const a=w.useRef(null),u=w.useRef(null),c=w.useRef(e);c.current=e;const f=w.useRef(r),d=w.useRef(null),h=w.useRef(null),p=n??e!==void 0,m=w.useRef(p),b=w.useRef(!1),v=w.useCallback(g=>g?[Ue.updateListener.of(y=>{var k;y.docChanged&&!b.current&&((k=c.current)==null||k.call(c,y.state.doc.toString()))}),rX(fX,{delay:300})]:[_t.readOnly.of(!0),Ue.editable.of(!1)],[]);return w.useEffect(()=>{const g=a.current;if(!g)return;const y=new Ra,k=new Ra,x=_t.create({doc:t,extensions:[GK(),Ue.lineWrapping,O7(),NA.of([...IK,...z7,DK]),dX,y.of(jk(fS(r))),k.of(v(p)),...i?[kU(i)]:[]]}),C=new Ue({state:x,parent:g});return d.current=y,h.current=k,l==null||l(C),u.current=C,()=>{C.destroy(),u.current=null}},[]),w.useEffect(()=>{const g=u.current;if(g&&g.state.doc.toString()!==t){b.current=!0;try{g.dispatch({changes:{from:0,to:g.state.doc.length,insert:t}})}finally{b.current=!1}}},[t]),w.useEffect(()=>{const g=u.current,y=h.current;!g||!y||p!==m.current&&(m.current=p,g.dispatch({effects:y.reconfigure(v(p))}))},[p,v]),w.useEffect(()=>{const g=u.current;if(!g||r===f.current)return;f.current=r;const y=d.current;y&&g.dispatch({effects:y.reconfigure(jk(fS(r)))})},[r]),R.jsx("div",{"data-testid":s,className:Ci("min-h-0 flex-1 overflow-hidden px-5 py-4 font-mono",o),ref:a})}function LM({title:t,meta:e,actions:n,status:r,children:i}){return R.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[R.jsxs("div",{className:"flex min-h-[42px] flex-shrink-0 flex-wrap items-center justify-between gap-3 border-b border-border px-3 py-2 pl-5 max-md:gap-2 md:h-12 md:py-0",children:[R.jsxs("div",{className:"flex items-center gap-3",children:[R.jsx("span",{className:"font-mono text-[11px] font-semibold tracking-[0.18em] text-muted-foreground",children:t}),e?R.jsx("span",{"data-testid":"pane-meta",className:"text-xs tabular-nums text-muted-foreground/70",children:e}):null]}),R.jsx("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5 max-md:gap-1",children:n})]}),R.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i}),r?R.jsxs("div",{"data-testid":"pane-status",className:r.kind==="error"?"flex-shrink-0 px-3.5 pb-2 text-xs text-destructive":"flex-shrink-0 whitespace-pre-line px-3.5 pb-2 text-xs text-muted-foreground",role:"status",children:[r.message,r.action]}):null]})}const Jo="inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[13px] font-medium text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:size-3.5";var Cy={exports:{}};(function(t,e){(function(){var n="We could not detect the separator.",r="Empty CSV. Please provide something.",i="Could not detect header. Ensure first row cotains your column headers.",s=[",",";"," "],o=!0,l={",":"comma",";":"semicolon"," ":"tab","|":"pipe"};function a(h){var p={},m;return s.forEach(function(b,v){var g=new RegExp(b,"g");p[b]=(h.match(g)||[]).length,m=!m||p[b]>p[m]?b:m}),m}function u(){var h=[].slice.call(arguments),p=h.reduce(function(m,b){return m.length>b.length?m:b},[]);return p.map(function(m,b){return h.map(function(v){return v[b]})})}function c(h){for(var p={},m=0;m=0;m--){var b=h[m];p[b]>0&&(b=b+"__"+p[b]--),v.unshift(b)}return v}function f(h,p){if(p||(p={}),h.length==0)throw r;var m=p.separator||a(h);if(!m)throw n;var b=[];try{o=p.trim!==!1;var b=d.parse(h,l[m])}catch(O){var v=h.lastIndexOf(` -`,O.offset),g=h.indexOf(` -`,O.offset),y=h.substring(v>=-1?v:0,g>-1?g:h.length);throw O.message+" On line "+O.line+" and column "+O.column+`. -`+y}p.transpose&&(b=u.apply(this,b));var k=b.shift();if(k.length==0)throw i;k=k.map(function(O){return O.trim()}),k=c(k);for(var x=p.hash?{}:[],C=0;Cy&&(y=g,k=[]),k.push(A))}function C(){var A,L,I,H;return I=g,H=g,A=function(B){return Q=","}()?"":null,A!==null?(L=P(),L!==null?A=[A,L]:(A=null,g=H)):(A=null,g=H),A!==null&&(A=function(B,ce){return ce}(I,A[1])),A===null&&(g=I),A}function T(){var A,L,I,H;return I=g,H=g,A=function(B){return Q=";"}()?"":null,A!==null?(L=P(),L!==null?A=[A,L]:(A=null,g=H)):(A=null,g=H),A!==null&&(A=function(B,ce){return ce}(I,A[1])),A===null&&(g=I),A}function E(){var A,L,I,H;return I=g,H=g,A=function(B){return Q="|"}()?"":null,A!==null?(L=P(),L!==null?A=[A,L]:(A=null,g=H)):(A=null,g=H),A!==null&&(A=function(B,ce){return ce}(I,A[1])),A===null&&(g=I),A}function M(){var A,L,I,H;return I=g,H=g,A=function(B){return Q=" "}()?"":null,A!==null?(L=P(),L!==null?A=[A,L]:(A=null,g=H)):(A=null,g=H),A!==null&&(A=function(B,ce){return ce}(I,A[1])),A===null&&(g=I),A}function P(){var A,L,I,H,B,ce,we,fe,De;for(ce=g,we=g,A=[],/^[\n\r]/.test(m.charAt(g))?(L=m.charAt(g),g++):(L=null,x("[\\n\\r]"));L!==null;)A.push(L),/^[\n\r]/.test(m.charAt(g))?(L=m.charAt(g),g++):(L=null,x("[\\n\\r]"));if(A!==null)if(L=_(),L!==null){if(I=[],fe=g,De=g,/^[\n\r]/.test(m.charAt(g))?(B=m.charAt(g),g++):(B=null,x("[\\n\\r]")),B!==null)for(H=[];B!==null;)H.push(B),/^[\n\r]/.test(m.charAt(g))?(B=m.charAt(g),g++):(B=null,x("[\\n\\r]"));else H=null;for(H!==null?(B=_(),B!==null?H=[H,B]:(H=null,g=De)):(H=null,g=De),H!==null&&(H=function(Ze,rt){return rt}(fe,H[1])),H===null&&(g=fe);H!==null;){if(I.push(H),fe=g,De=g,/^[\n\r]/.test(m.charAt(g))?(B=m.charAt(g),g++):(B=null,x("[\\n\\r]")),B!==null)for(H=[];B!==null;)H.push(B),/^[\n\r]/.test(m.charAt(g))?(B=m.charAt(g),g++):(B=null,x("[\\n\\r]"));else H=null;H!==null?(B=_(),B!==null?H=[H,B]:(H=null,g=De)):(H=null,g=De),H!==null&&(H=function(Ze,rt){return rt}(fe,H[1])),H===null&&(g=fe)}if(I!==null){for(H=[],/^[\n\r]/.test(m.charAt(g))?(B=m.charAt(g),g++):(B=null,x("[\\n\\r]"));B!==null;)H.push(B),/^[\n\r]/.test(m.charAt(g))?(B=m.charAt(g),g++):(B=null,x("[\\n\\r]"));H!==null?A=[A,L,I,H]:(A=null,g=we)}else A=null,g=we}else A=null,g=we;else A=null,g=we;return A!==null&&(A=function(Ze,rt,ct){return ct.unshift(rt),ct}(ce,A[1],A[2])),A===null&&(g=ce),A}function _(){var A,L,I,H,B,ce,we,fe,De;if(ce=g,we=g,A=O(),A!==null){for(L=[],fe=g,De=g,m.length>g?(I=m.charAt(g),g++):(I=null,x("any character")),I!==null?(H=function(Ze,rt){return rt==Q}(g,I)?"":null,H!==null?(B=O(),B!==null?I=[I,H,B]:(I=null,g=De)):(I=null,g=De)):(I=null,g=De),I!==null&&(I=function(Ze,rt,ct){return ct}(fe,I[0],I[2])),I===null&&(g=fe);I!==null;)L.push(I),fe=g,De=g,m.length>g?(I=m.charAt(g),g++):(I=null,x("any character")),I!==null?(H=function(Ze,rt){return rt==Q}(g,I)?"":null,H!==null?(B=O(),B!==null?I=[I,H,B]:(I=null,g=De)):(I=null,g=De)):(I=null,g=De),I!==null&&(I=function(Ze,rt,ct){return ct}(fe,I[0],I[2])),I===null&&(g=fe);L!==null?(I=function(Ze,rt,ct){return!!rt||ct.length}(g,A,L)?"":null,I!==null?A=[A,L,I]:(A=null,g=we)):(A=null,g=we)}else A=null,g=we;return A!==null&&(A=function(Ze,rt,ct){return ct.unshift(rt),ct}(ce,A[0],A[1])),A===null&&(g=ce),A}function O(){var A,L,I,H,B,ce;if(H=g,B=g,m.charCodeAt(g)===34?(A='"',g++):(A=null,x('"\\""')),A!==null){for(L=[],I=N();I!==null;)L.push(I),I=N();L!==null?(m.charCodeAt(g)===34?(I='"',g++):(I=null,x('"\\""')),I!==null?A=[A,L,I]:(A=null,g=B)):(A=null,g=B)}else A=null,g=B;if(A!==null&&(A=function(we,fe){return fe.join("")}(H,A[1])),A===null&&(g=H),A===null){for(H=g,A=[],B=g,ce=g,/^[^\n\r]/.test(m.charAt(g))?(L=m.charAt(g),g++):(L=null,x("[^\\n\\r]")),L!==null?(I=function(we,fe){return fe!=Q}(g,L)?"":null,I!==null?L=[L,I]:(L=null,g=ce)):(L=null,g=ce),L!==null&&(L=function(we,fe){return fe}(B,L[0])),L===null&&(g=B);L!==null;)A.push(L),B=g,ce=g,/^[^\n\r]/.test(m.charAt(g))?(L=m.charAt(g),g++):(L=null,x("[^\\n\\r]")),L!==null?(I=function(we,fe){return fe!=Q}(g,L)?"":null,I!==null?L=[L,I]:(L=null,g=ce)):(L=null,g=ce),L!==null&&(L=function(we,fe){return fe}(B,L[0])),L===null&&(g=B);A!==null&&(A=function(we,fe){return(o?fe.join("").trim():fe.join("")).replace(/(^")|("$)/g,"")}(H,A)),A===null&&(g=H)}return A}function N(){var A,L,I,H;return I=g,H=g,m.charCodeAt(g)===34?(A='"',g++):(A=null,x('"\\""')),A!==null?(m.charCodeAt(g)===34?(L='"',g++):(L=null,x('"\\""')),L!==null?A=[A,L]:(A=null,g=H)):(A=null,g=H),A!==null&&(A=function(B){return'"'}()),A===null&&(g=I),A===null&&(/^[^"]/.test(m.charAt(g))?(A=m.charAt(g),g++):(A=null,x('[^"]'))),A}function D(A){A.sort();for(var L=null,I=[],H=0;H{if(!lo(n))return n;const r={};for(const[i,s]of Object.entries(n))Array.isArray(s)&&s.length>0&&s.every(SX)?r[i]=s.join(", "):Array.isArray(s)?r[i]=s.map(e):r[i]=s;return r};return Array.isArray(t)?t.map(e):lo(t)?e(t):t}function TX(t,e){if(e.parseJSON){const n=kX(t);if(n.ok&&typeof n.value!="number")return n.value}return e.parseNumbers?xX(t):t}function EX(t,e){const n=i=>{const s={};for(const o of Object.keys(i)){const l=i[o];if(typeof l!="string"){s[o]=l;continue}const a=TX(l,e);if(!(e.emptyFields==="skip"&&a==="")){if(e.nullLiterals==="null"&&a==="NULL"){s[o]=null;continue}s[o]=a}}return s};if(Array.isArray(t))return t.map(i=>lo(i)?n(i):i);const r={};for(const[i,s]of Object.entries(t))r[i]=lo(s)?n(s):s;return r}const AX=/^([^.[\]]+)(?:\.(0|[1-9]\d*)|\[(0|[1-9]\d*)\])(?:\.(.+))?$/;function BM(t){const e=AX.exec(t);if(!e)return null;const n=e[1],r=e[2],i=e[3],s=e[4],o=Number(r??i);return Number.isSafeInteger(o)?{column:t,prefix:n,index:o,notation:r!==void 0?"dot":"bracket",...s!==void 0?{subKey:s}:{}}:null}function Ey(t){const e=new Set(t),n=new Map;for(const i of t){const s=BM(i);if(!s)continue;const o=n.get(s.prefix);o?o.push(s):n.set(s.prefix,[s])}const r=[];for(const[i,s]of n.entries()){if(e.has(i))continue;const o=s[0].subKey!==void 0,l=s[0].notation;if(s.some(h=>h.subKey!==void 0!==o||h.notation!==l))continue;const a=new Set;let u=!1;for(const h of s){const p=`${h.index}:${h.subKey??""}`;if(a.has(p)){u=!0;break}a.add(p)}if(u)continue;const c=Array.from(new Set(s.map(h=>h.index))).sort((h,p)=>h-p);if(c.length<2)continue;const f=c[0];f!==0&&f!==1||!c.every((h,p)=>h===f+p)||r.push({prefix:i,indices:c,columns:s.map(h=>h.column)})}return r}function hS(t,e){return t===void 0||t===""||e==="skip"&&t===null}function pS(t,e,n,r){const i=new Map,s=new Set,o=new Map;for(const a of n)if(a.columns.length!==0){i.set(a.columns[0],a);for(const u of a.columns)s.add(u);o.set(a.prefix,a.columns.map(u=>BM(u)).filter(u=>u!==null))}const l={};for(const a of e){const u=i.get(a);if(u){const c=o.get(u.prefix)??[];if(c.some(d=>d.subKey!==void 0)){const d=new Map;for(const p of c){const m=d.get(p.index);m?m.push(p):d.set(p.index,[p])}const h=[];for(const p of u.indices){const m=d.get(p)??[],b={};for(const v of m){if(!v.subKey)continue;const g=t[v.column];hS(g,r)||(b[v.subKey]=g)}Object.keys(b).length>0&&h.push(b)}if(h.length===0&&r==="skip")continue;l[u.prefix]=h}else{const d=new Map;for(const p of c)d.set(p.index,p.column);const h=[];for(const p of u.indices){const m=d.get(p);if(!m)continue;const b=t[m];hS(b,r)||h.push(b)}if(h.length===0&&r==="skip")continue;l[u.prefix]=h}continue}s.has(a)||Object.prototype.hasOwnProperty.call(t,a)&&(l[a]=t[a])}return l}function MX(t,e,n){if(Array.isArray(t)&&Array.isArray(e)){const r=t[0];if(!lo(r))return e;const i=Object.keys(r),s=Ey(i);return s.length===0?e:e.map(o=>lo(o)?pS(o,i,s,n):o)}if(!Array.isArray(t)&&!Array.isArray(e)){const r=Object.values(t)[0];if(!lo(r))return e;const i=Object.keys(r),s=Ey(i);if(s.length===0)return e;const o={};for(const[l,a]of Object.entries(e))o[l]=lo(a)?pS(a,i,s,n):a;return o}return e}function gS(t,e={}){const n={parseNumbers:e.parseNumbers??!0,parseJSON:e.parseJSON??!1,emptyFields:e.emptyFields??"keep",nullLiterals:e.nullLiterals??"string"},r=t.startsWith(dS)?t.slice(dS.length):t;try{const i=pX(r,{...e,parseNumbers:!1,parseJSON:!1,trim:!1}),s=EX(i,n);return e.collapseIndexedArrays!==!1&&!e.transpose?MX(i,s,n.emptyFields):s}catch(i){throw new Error(FM(i))}}function RX(t,e={}){try{const n=e.flatten?CX(t):t;return mX(n,e)}catch(n){const r=FM(n);throw wX.some(i=>r.startsWith(i))?new yX(vX(r,e.flatten??!1)):new Error(r)}}function OX(t,e={}){return JSON.stringify(t,null,e.minify?void 0:2)}const zM={separator:"auto",parseNumbers:!0,parseJSON:!0,emptyFields:"keep",nullLiterals:"string",transpose:!1,hash:!1,minify:!1,flatten:!1,collapseIndexedArrays:!0},mS=["data","items","results","records","rows"];function yS(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function PX(t){const e=t.trim();if(e===""||!e.startsWith("{"))return[];let n;try{n=JSON.parse(e)}catch{return[]}if(!yS(n))return[];const r=Object.keys(n),i=new Set(mS),s=[...mS.filter(l=>r.includes(l)),...r.filter(l=>!i.has(l))],o=[];for(const l of s){const a=n[l];Array.isArray(a)&&a.length>0&&a.every(u=>yS(u))&&o.push({key:l,rowCount:a.length,unwrappedJson:JSON.stringify(a,null,2)})}return o}function $M(t){const e=t.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0);if(e.length<2)return null;const n=[];for(const r of e)try{const i=JSON.parse(r);if(typeof i!="object"||i===null)return null;n.push(i)}catch{return null}return n}function IX(t){const e=t.trim();if(e==="")return null;let n;try{n=JSON.parse(e)}catch{const i=$M(e);if(i===null)return null;n=i}const r=JSON.stringify(n,null,2);return e===r?{label:"Minify",nextInput:JSON.stringify(n)}:{label:"Format",nextInput:r}}function DX(t){const e=n=>{const r=new Set;for(const i of n)i&&typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).forEach(s=>r.add(s));return r};if(Array.isArray(t))return{rows:t.length,cols:e(t).size};if(t&&typeof t=="object"){const n=Object.values(t);return{rows:n.length,cols:e(n).size}}return{rows:0,cols:0}}const vS=t=>t==="auto"?void 0:t;function _X(t){let e=!1,n=1;for(let r=0;r0;return i.rowWidths.forEach((o,l)=>{if(s&&l===i.rowWidths.length-1)return;const a=i.rows[l];o===1&&a[0]===""||o!==i.headers.length&&n.push(o0?{warnings:u}:{}}}let r;try{r=JSON.parse(e)}catch(l){const a=$M(e);if(a!==null)r=a;else return{ok:!1,error:`Invalid JSON — ${l instanceof Error?l.message:String(l)}`}}const i=vS(n.separator),s=RX(r,{separator:i,flatten:n.flatten}),o=Yc(s,i);return{ok:!0,text:s,rows:o.rows.length,cols:o.headers.length}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}}function FX(){return R.jsx("svg",{"data-testid":"reading-spinner",className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-label":"Reading file",children:R.jsx("path",{d:"M21 12a9 9 0 1 1-6.2-8.56",strokeLinecap:"round"})})}function Ru({label:t,testId:e,onClick:n,disabled:r,Icon:i}){return R.jsxs("button",{type:"button","data-testid":e,disabled:r,onClick:n,title:t,className:Jo,children:[i?R.jsx(i,{"aria-hidden":"true"}):null,t]})}function BX({format:t,input:e,onInputChange:n,onFile:r,onTryExample:i,onClear:s,onCopy:o,onDownload:l,filename:a,reading:u,meta:c,error:f,notice:d,dark:h,delimiter:p,onCellCommit:m,canUndo:b=!1,canRedo:v=!1,onUndo:g,onRedo:y,collapseIndexedArrays:k=!0,onToggleCollapseIndexedArrays:x}){const[C,T]=w.useState(!1),[E,M]=w.useState(!1),P=w.useRef(0),_=w.useRef(null),O=e.trim()==="",N=t==="CSV",D=w.useMemo(()=>{if(!N||O)return[];const I=Yc(e,p);return Ey(I.headers.map(H=>H.trim()))},[N,O,e,p]),oe=w.useMemo(()=>N||O?[]:PX(e),[N,O,e]),Q=w.useMemo(()=>N||O?null:IX(e),[N,O,e]),te=I=>{var H;I.preventDefault(),Array.from(((H=I.dataTransfer)==null?void 0:H.types)??[]).includes("Files")&&(P.current++,M(!0))},j=()=>{P.current=Math.max(0,P.current-1),P.current===0&&M(!1)},Y=I=>{var B,ce;I.preventDefault(),P.current=0,M(!1);const H=(ce=(B=I.dataTransfer)==null?void 0:B.files)==null?void 0:ce[0];H&&r(H,"drop")},U=I=>{var B;if(!O||I.defaultPrevented||I.target instanceof HTMLTextAreaElement||I.target instanceof HTMLInputElement)return;const H=(B=I.clipboardData)==null?void 0:B.getData("text/plain");H&&(I.preventDefault(),n(H))},A=N?R.jsxs("span",{"data-testid":"view-mode",role:"group","aria-label":"View mode",className:"inline-flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[R.jsxs("button",{type:"button","data-testid":"view-table","aria-pressed":!C,onClick:()=>T(!1),className:Ci("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2.5 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50",C?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:[R.jsx(_I,{"aria-hidden":"true",className:"size-3.5"}),"Table"]}),R.jsxs("button",{type:"button","data-testid":"raw-toggle","aria-pressed":C,onClick:()=>T(!0),className:Ci("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2.5 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50",C?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[R.jsx(Z1,{"aria-hidden":"true",className:"size-3.5"}),"Raw"]})]}):null,L=u&&a?R.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[R.jsx(FX,{})," ",a]}):a?c?`${a} · ${c}`:a:c;return R.jsx("div",{"data-testid":"input-pane",onDragEnter:te,onDragOver:I=>I.preventDefault(),onDragLeave:j,onDrop:Y,onPaste:U,"data-drag-over":E||void 0,className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:R.jsxs(LM,{title:t,meta:L,actions:R.jsxs(R.Fragment,{children:[A,N&&(b||v)?R.jsxs(R.Fragment,{children:[R.jsx("button",{type:"button","data-testid":"csv-undo-button","aria-label":"Undo",title:"Undo",disabled:!b,onClick:()=>g==null?void 0:g(),className:Jo,children:R.jsx(HI,{"aria-hidden":"true"})}),R.jsx("button",{type:"button","data-testid":"csv-redo-button","aria-label":"Redo",title:"Redo",disabled:!v,onClick:()=>y==null?void 0:y(),className:Jo,children:R.jsx(SI,{"aria-hidden":"true"})})]}):null,Q?R.jsx(Ru,{label:Q.label,testId:"json-format-toggle",onClick:()=>n(Q.nextInput),Icon:Z1}):null,R.jsx("input",{ref:_,type:"file","data-testid":"file-input",accept:N?".csv,.tsv,.txt,text/csv,text/tab-separated-values":".json,.txt,application/json",className:"hidden",onChange:I=>{var B;const H=(B=I.target.files)==null?void 0:B[0];H&&r(H,"picker"),I.target.value=""}}),R.jsx(Ru,{label:"Upload",testId:"upload",onClick:()=>{var I;return(I=_.current)==null?void 0:I.click()},Icon:G2}),R.jsx(Ru,{label:"Copy",testId:"copy-input",onClick:o,Icon:Ev}),R.jsx(Ru,{label:"Clear",testId:"clear-input",onClick:s,disabled:O,Icon:m0}),R.jsx(Ru,{label:"Download",testId:"download-input",onClick:l,disabled:O,Icon:X2})]}),status:f?{kind:"error",message:f}:d?{kind:"notice",message:d}:null,children:[O?R.jsx(s9,{format:t,onIngest:n,onBrowse:()=>{var I;return(I=_.current)==null?void 0:I.click()},onTryExample:i}):N?R.jsxs(R.Fragment,{children:[D.length>0?R.jsxs("div",{"data-testid":"csv-indexed-array-bar",className:"flex flex-shrink-0 flex-wrap items-center justify-between gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5",children:[R.jsx("span",{className:"text-xs text-muted-foreground",children:`Indexed columns (${D.map(I=>`${I.prefix}[${I.indices.length}]`).join(", ")}):`}),R.jsx("button",{type:"button","data-testid":"csv-indexed-array-pill","aria-pressed":k,onClick:()=>x==null?void 0:x(),className:Ci("inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 font-mono text-xs font-medium shadow-2xs transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",k?"border-border bg-background text-foreground hover:bg-muted":"border-border bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground"),children:k?"Arrays: .0, .1 → []":"Keep flat keys (.0, .1)"})]}):null,C?R.jsx("textarea",{"data-testid":"input-editor",value:e,onChange:I=>n(I.target.value),spellCheck:!1,className:"min-h-0 flex-1 resize-none bg-transparent px-5 py-4 font-mono text-[13px] leading-6 tracking-tight focus:outline-none"}):R.jsx(xE,{text:e,delimiter:p,testId:"input-table",dark:h,onCellCommit:m,onUndo:g,onRedo:y})]}):R.jsxs(R.Fragment,{children:[oe.length>0?R.jsxs("div",{"data-testid":"json-unwrap-bar",className:"flex flex-shrink-0 flex-wrap items-center gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5",children:[R.jsx("span",{className:"text-xs text-muted-foreground",children:"Nested array detected:"}),oe.map(I=>R.jsx("button",{type:"button","data-testid":`json-unwrap-pill-${I.key}`,onClick:()=>n(I.unwrappedJson),className:"inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-2 py-0.5 font-mono text-xs font-medium text-foreground shadow-2xs transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:`Unwrap .${I.key} (${I.rowCount} ${I.rowCount===1?"row":"rows"})`},I.key))]}):null,R.jsx(NM,{value:e,onChange:n,dark:h,testId:"input-editor"})]}),E?R.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-3 z-10 flex items-center justify-center rounded-xl border-2 border-dashed border-primary/50 bg-background/80 backdrop-blur-sm",children:R.jsx("p",{className:"text-sm font-medium text-foreground",children:"Drop file to import"})}):null]})})}const zX=/\.(csv|tsv|txt|json|ndjson|md|log)$/i;function $X(t){return t.type.startsWith("text/")||t.type==="application/json"?!0:zX.test(t.name)}const HX=[{value:"utf-8",label:"UTF-8"},{value:"windows-1252",label:"Windows-1252"}];async function wS(t,e){const n=new TextDecoder(e,{fatal:!1}),r=t.stream().getReader();let i="";try{for(;;){const{done:s,value:o}=await r.read();if(s)break;i+=n.decode(o,{stream:!0})}}finally{r.releaseLock()}return i+n.decode()}const jX=[{value:"auto",label:"Auto-detect"},{value:",",label:"Comma"},{value:";",label:"Semicolon"},{value:" ",label:"Tab"},{value:"|",label:"Pipe"}];function bS(){return R.jsx("div",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"})}function xS(){return"h-7 cursor-pointer appearance-none rounded-md border border-border bg-background py-0 pl-2.5 pr-6 text-[13px] font-medium text-foreground transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50"}function kS(){return R.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:R.jsx("path",{d:"m4 6 4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"})})}function SS({children:t}){return R.jsx("span",{className:"font-mono text-[11px] font-semibold tracking-[0.14em] whitespace-nowrap text-muted-foreground/70 uppercase",children:t})}function Ks({label:t,checked:e,onChange:n,hint:r}){return R.jsxs("span",{className:"inline-flex items-center gap-1",children:[R.jsxs("label",{className:"flex cursor-pointer items-center gap-2 whitespace-nowrap text-[13px] text-muted-foreground transition-colors hover:text-foreground",children:[R.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":t,onClick:()=>n(!e),className:"flex h-6 shrink-0 cursor-pointer items-center rounded-full outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:R.jsx("span",{className:Ci("relative inline-flex h-[18px] w-8 items-center rounded-full border transition-colors",e?"border-primary bg-primary":"border-border bg-muted"),children:R.jsx("span",{className:Ci("pointer-events-none inline-block size-3 rounded-full bg-background shadow-sm transition-transform",e?"translate-x-[15px]":"translate-x-[2px]")})})}),R.jsx("span",{className:"select-none",children:t})]}),r?R.jsx(Ay,{text:r}):null]})}function Ay({text:t}){const e=w.useId(),[n,r]=w.useState(!1);return R.jsxs("span",{className:"relative inline-flex items-center",children:[R.jsx("button",{type:"button","aria-label":"What does this option do?","aria-expanded":n,"aria-describedby":e,title:"What does this option do?",onClick:()=>r(i=>!i),className:"flex h-4 w-4 cursor-pointer items-center justify-center rounded-full border border-border text-[9px] font-semibold leading-none text-muted-foreground hover:text-foreground",children:"i"}),R.jsx("span",{"data-hint":!0,id:e,hidden:!n,className:"ml-1 text-muted-foreground",children:t})]})}function WX({direction:t,options:e,onChange:n,notice:r,uploadEncoding:i,onUploadEncodingChange:s}){const o=t==="csv2json";return R.jsxs("div",{"data-testid":"options-row",className:"flex flex-shrink-0 flex-wrap items-center gap-5 border-t border-border bg-panel px-5 py-2.5 text-[13px] text-muted-foreground",children:[R.jsxs("span",{className:"inline-flex items-center gap-2",children:[R.jsxs("label",{className:"flex items-center gap-2",children:[R.jsx(SS,{children:"Separator"}),R.jsxs("span",{className:"relative inline-flex",children:[R.jsx("select",{"data-testid":"opt-separator",value:e.separator,onChange:l=>n({separator:l.target.value}),className:xS(),children:jX.map(l=>R.jsx("option",{value:l.value,children:l.label},l.value))}),R.jsx(kS,{})]})]}),R.jsx(Ay,{text:"Auto-detect is conservative — it only picks comma, semicolon, or tab. Pipe never auto-detects because normal prose is full of pipes, so pipe-separated text must be selected explicitly."})]}),i&&s?R.jsxs(R.Fragment,{children:[R.jsx(bS,{}),R.jsxs("span",{className:"inline-flex items-center gap-2",children:[R.jsxs("label",{className:"flex items-center gap-2",children:[R.jsx(SS,{children:"Encoding"}),R.jsxs("span",{className:"relative inline-flex",children:[R.jsx("select",{"data-testid":"opt-encoding",value:i,onChange:l=>s(l.target.value),className:xS(),children:HX.map(l=>R.jsx("option",{value:l.value,children:l.label},l.value))}),R.jsx(kS,{})]})]}),R.jsx(Ay,{text:"Applies to file uploads and drops only — pasted or typed text is always read as UTF-8. Switch to Windows-1252 for CSVs saved by legacy Excel to fix mangled accents like ü and ö."})]})]}):null,R.jsx(bS,{}),o?R.jsxs(R.Fragment,{children:[R.jsx(Ks,{label:"Parse numbers",checked:e.parseNumbers,onChange:l=>n({parseNumbers:l}),hint:"On by default — plain numbers like 5 or 19.99 become real JSON numbers; leading-zero values like 00721 and very long IDs stay strings. Uncheck to keep numeric cells as strings — booleans, null, and containers still convert while Parse JSON is on."}),R.jsx(Ks,{label:"Parse JSON",checked:e.parseJSON,onChange:l=>n({parseJSON:l}),hint:"Turns null, true, false, [] and {} into real JSON values instead of strings."}),R.jsx(Ks,{label:"Skip empty fields",checked:e.emptyFields==="skip",onChange:l=>n({emptyFields:l?"skip":"keep"}),hint:'Empty cells are dropped from the output instead of becoming "" — a column that is empty in every row disappears from the output and the counts.'}),R.jsx(Ks,{label:"NULL as null",checked:e.nullLiterals==="null",onChange:l=>n({nullLiterals:l?"null":"string"}),hint:"The string NULL becomes JSON null. Matching is exact and case-sensitive — SQL exports write uppercase NULL; Null and nULL are untouched, and lowercase null already converts when Parse JSON is on."}),R.jsx(Ks,{label:"Transpose",checked:e.transpose,onChange:l=>n({transpose:l}),hint:"Flip rows and columns — the first column becomes the header row."}),R.jsx(Ks,{label:"Hash output",checked:e.hash,onChange:l=>n({hash:l}),hint:"The first column becomes the object key instead of a field."}),R.jsx(Ks,{label:"Minify",checked:e.minify,onChange:l=>n({minify:l}),hint:"Remove indentation from the JSON output. Data is untouched."})]}):R.jsx(Ks,{label:"Flatten nested arrays",checked:e.flatten,onChange:l=>n({flatten:l}),hint:"Explode nested arrays into extra rows with dotted keys — needed when the JSON isn't a flat table."}),R.jsx("div",{className:"flex-1"}),r?R.jsx("span",{"data-testid":"options-notice",className:"text-muted-foreground",children:r}):null]})}const VX=3;function UX(t){const e=t.slice(0,VX),n=t.length-e.length;return(n>0?[...e,`+${n} more`]:e).join(` -`)}function KX({format:t,inputEmpty:e,outputText:n,error:r,meta:i,staleNotice:s,warnings:o,edited:l,editable:a,delimiter:u,dark:c,onCopy:f,onDownload:d,onOutputChange:h,onRevert:p,onDiscardReconvert:m}){const b=t==="JSON";return R.jsx("div",{"data-testid":"output-pane","data-surface":"output",className:"flex min-h-0 min-w-0 flex-1 flex-col bg-muted/30",children:R.jsx(LM,{title:t,meta:e?null:l?R.jsxs("span",{className:"flex items-center gap-1.5",children:[R.jsx("span",{"data-testid":"edited-badge",role:"status","aria-label":"Output edited",className:"rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-amber-700 dark:bg-amber-400/15 dark:text-amber-400",children:"Edited"}),R.jsxs("button",{type:"button","data-testid":"revert-output",onClick:p,className:Jo,children:[R.jsx(eb,{"aria-hidden":"true"}),"Revert"]})]}):s?R.jsx("span",{"data-testid":"stale-notice",className:"text-xs text-amber-600 dark:text-amber-400",children:s}):i,actions:R.jsxs(R.Fragment,{children:[R.jsxs("button",{type:"button","data-testid":"copy-output",onClick:f,disabled:!n,className:Jo,children:[R.jsx(Ev,{"aria-hidden":"true"}),"Copy"]}),R.jsxs("button",{type:"button","data-testid":"download-output",onClick:d,disabled:!n,className:Jo,children:[R.jsx(X2,{"aria-hidden":"true"}),"Download"]})]}),status:l?{kind:"notice",message:"Output edited — CSV and option changes aren't applied.",action:m?R.jsxs("button",{type:"button","data-testid":"discard-reconvert",onClick:m,className:Jo+" ml-2",children:[R.jsx(eb,{"aria-hidden":"true"}),"Discard edits & reconvert"]}):void 0}:r?{kind:"error",message:r}:o&&o.length>0?{kind:"notice",message:UX(o)}:null,children:e?R.jsxs("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:["Your ",t," appears here."]}):n?b?R.jsx(NM,{value:n,editable:a,onChange:h,dark:c,testId:"output-view"}):R.jsx(xE,{text:n,delimiter:u,testId:"output-table",dark:c}):R.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:"Resolve the error to see output."})})})}function XX({phase:t,message:e,onRetry:n}){return t==="loading"?R.jsx("div",{role:"status","aria-busy":"true","data-testid":"permalink-loading",className:"mx-4 mt-3 rounded-md border border-border bg-muted px-4 py-2 text-sm text-muted-foreground",children:"Loading shared data…"}):t==="not-found"?R.jsxs("div",{role:"alert","data-testid":"permalink-notice",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-2 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[R.jsx("span",{children:"This data doesn't exist (or was deleted)."}),R.jsx("a",{href:"/",className:"font-medium underline underline-offset-2",children:"Go to the converter"})]}):t==="unsupported"?R.jsxs("div",{role:"alert","data-testid":"permalink-unsupported",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-2 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[R.jsx("span",{children:"This link's saved data can't be shown in the new converter."}),R.jsx("a",{href:"/",className:"font-medium underline underline-offset-2",children:"Go to the converter"})]}):R.jsxs("div",{role:"alert","data-testid":"permalink-notice",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-3 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[R.jsx("span",{children:e||"Couldn't load this data."}),R.jsx("button",{type:"button","data-testid":"permalink-retry",onClick:n,className:"rounded-md border border-border bg-background px-2 py-1 text-sm font-medium hover:bg-accent",children:"Retry"})]})}const My=20,Ry=80,CS=50;function bm(t){return Math.min(Ry,Math.max(My,t))}function GX({layout:t,split:e,onSplitChange:n,left:r,right:i,children:s}){const o=w.useRef(null),[l,a]=w.useState(!1),u=t==="stacked";w.useEffect(()=>{if(!l)return;const f=h=>{var b;const p=(b=o.current)==null?void 0:b.getBoundingClientRect();if(!p||p.width===0||p.height===0)return;const m=u?(h.clientY-p.top)/p.height:(h.clientX-p.left)/p.width;n(bm(m*100))},d=()=>a(!1);return window.addEventListener("pointermove",f),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d),()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d)}},[l,u,n]);const c=f=>{const d=f.shiftKey?5:1;switch(f.key){case"ArrowLeft":case"ArrowUp":f.preventDefault(),n(bm(e-d));break;case"ArrowRight":case"ArrowDown":f.preventDefault(),n(bm(e+d));break;case"Home":f.preventDefault(),n(My);break;case"End":f.preventDefault(),n(Ry);break;case"Enter":case" ":f.preventDefault(),n(CS);break}};return R.jsxs("div",{ref:o,className:Ci("relative flex min-h-0 flex-1","flex-col md:flex-row",l&&"select-none"),children:[R.jsx("div",{"data-testid":"pane-left",style:{"--split":`${e}%`},className:Ci("flex min-h-0 min-w-0 flex-col border-border bg-panel","h-[var(--split)] border-b","md:h-auto md:w-[var(--split)] md:border-b-0 md:border-r"),children:r}),R.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-panel",children:i}),R.jsxs("div",{"data-testid":"seam",role:"separator",tabIndex:0,"aria-orientation":u?"horizontal":"vertical","aria-valuenow":Math.round(e),"aria-valuemin":My,"aria-valuemax":Ry,"aria-label":"Resize panes",title:"Drag to resize · double-click to reset",onPointerDown:f=>{var d,h;f.target instanceof Element&&f.target.closest("button")||(f.preventDefault(),(h=(d=f.currentTarget).setPointerCapture)==null||h.call(d,f.pointerId),a(!0))},onPointerUp:()=>a(!1),onDoubleClick:()=>n(CS),onKeyDown:c,style:{"--split":`${e}%`,touchAction:"none"},className:Ci("absolute z-10","top-[var(--split)] left-0 right-0 h-0 cursor-row-resize","md:top-0 md:right-auto md:bottom-0 md:left-[var(--split)] md:h-auto md:w-0 md:cursor-col-resize"),children:[R.jsx("div",{className:Ci("absolute","left-0 right-0 -top-1.5 h-3","md:top-0 md:right-auto md:bottom-0 md:-left-1.5 md:h-auto md:w-3")}),s?R.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:s}):null]})]})}function YX({theme:t}){return t==="dark"?R.jsx(II,{size:15,strokeWidth:2,"aria-hidden":"true"}):R.jsx(xI,{size:15,strokeWidth:2,"aria-hidden":"true"})}function qX({theme:t,onToggleTheme:e,slot:n}){return R.jsxs("header",{"data-testid":"topbar",className:"relative flex h-14 flex-shrink-0 items-center gap-3 border-b border-border bg-panel px-5",children:[R.jsxs("div",{className:"flex items-baseline gap-2",children:[R.jsx("span",{className:"text-[15px] font-semibold tracking-tight text-foreground whitespace-nowrap",children:"csvjson"}),R.jsx("span",{className:"hidden text-[13px] font-medium text-muted-foreground sm:inline",children:"CSV → JSON converter"})]}),R.jsx("div",{className:"flex-1"}),R.jsx("div",{"data-testid":"topbar-slot",children:n}),R.jsx("button",{type:"button","data-testid":"theme-toggle",onClick:e,"aria-label":t==="dark"?"Switch to light mode":"Switch to dark mode",title:t==="dark"?"Switch to light mode":"Switch to dark mode",className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border bg-panel text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:R.jsx(YX,{theme:t})})]})}function QX(t){return[...t].sort((e,n)=>n.id-e.id)}const HM=[{id:12,date:"2026-10-15",tag:"improvement",title:"Table undo, header rename, and smarter JSON input",summary:"Undo or redo CSV table edits, double-click any column header to rename it in place, and collapse .0, .1 indexed columns into JSON arrays. JSON → CSV now formats or minifies JSON in one click, unwraps nested record arrays, parses JSONL, and previews pipe-delimited output accurately."},{id:11,date:"2026-10-03",tag:"improvement",title:"The switch names the direction",summary:"The ⇄ switch now labels the active conversion, and legacy /json2csv links land you in JSON → CSV mode again — it never left."},{id:10,date:"2026-09-08",tag:"new",title:"Delete rows and columns from the table",summary:"Select rows or columns in the input table and delete them by button or the Delete key — the raw CSV updates and reconverts in place, with at least one column always kept. Selected column headers are also readable again in both themes."},{id:9,date:"2026-09-08",tag:"new",title:"Spreadsheet-grade data table",summary:"The rebuilt data table adds drag-to-select ranges, Shift+Arrow range extension, fill, and spreadsheet-style cell editing — with copy/paste always producing clean CSV."},{id:8,date:"2026-09-07",tag:"new",title:"Search, sort, and select in the data table",summary:"The CSV table now has a search bar with a live row count, click-to-sort columns, and row selection with copy-as-CSV — on both the input and output tables."},{id:7,date:"2026-09-07",tag:"fix",title:"No more layout flash on load",summary:"The converter now renders side-by-side immediately on desktop, instead of stacking the panes and snapping into columns as the page loads."},{id:6,date:"2026-09-07",tag:"new",title:"Introducing the changelog",summary:"This changelog keeps you posted on what's new — recent updates appear here with an unseen dot when you come back. Feel free to vote on what you find useful."},{id:5,date:"2026-09-05",tag:"improvement",title:"Icons match the design",summary:"Action buttons, view toggle, and the empty state now use the same crisp icon set as the rest of the interface."},{id:4,date:"2026-09-05",tag:"new",title:"Edit the JSON output in place",summary:"The output pane is now an editor. Hand edits survive until you reconvert; revert and discard keep you safe."},{id:3,date:"2026-09-05",tag:"fix",title:"Pastes land where they belong",summary:"Paste anywhere on the page and your data routes to the input — including pastes over the read-only output pane."},{id:2,date:"2026-09-04",tag:"improvement",title:"A calmer empty state",summary:"Empty panes now open on a compact paste field with a Choose file button, so starting is obvious on any screen."},{id:1,date:"2026-09-04",tag:"improvement",title:"Smarter number handling",summary:"Numbers convert sensibly out of the box: leading-zero values like 00721 and very long IDs stay strings so nothing gets silently mangled."}],JX=864e5;function TS(t){return Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}function ZX(t,e=Date.now()){const n=new Date(`${t}T00:00:00Z`),r=new Date(e),i=Math.round((TS(r)-TS(n))/JX);if(i<=0)return"today";if(i===1)return"yesterday";if(i<7)return`${i} days ago`;const s=n.toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"});return n.getUTCFullYear()===r.getUTCFullYear()?s:`${s}, ${n.getUTCFullYear()}`}const jM="csvjson:changelog.v1",Fd=Math.max(...HM.map(t=>t.id),0),eG=QX(HM);function tG(t){if(typeof t!="object"||t===null)return!1;const e=t;if(e.lastSeenId!==null&&typeof e.lastSeenId!="number"||typeof e.votes!="object"||e.votes===null)return!1;for(const[n,r]of Object.entries(e.votes))if(!/^\d+$/.test(n)||r!==1&&r!==-1)return!1;return!(e.clientId!==void 0&&!nG(e.clientId)||e.pendingIds!==void 0&&(!Array.isArray(e.pendingIds)||e.pendingIds.some(n=>typeof n!="number"||!Number.isInteger(n)||n<1)))}function nG(t){return typeof t=="string"&&/^[0-9a-fA-F-]{8,64}$/.test(t)}function WM(t){return t===void 0?[]:[...new Set(t)].filter(e=>e>=1&&e<=Fd).sort((e,n)=>e-n)}function ES(t,e,n){const r=WM(t.pendingIds),i=n?[...new Set([...r,e])].sort((s,o)=>s-o):r.filter(s=>s!==e);return{...t,pendingIds:i}}function rG(){try{const t=window.localStorage.getItem(jM);if(t===null)return{lastSeenId:null,votes:{}};const e=JSON.parse(t);return tG(e)?{...e,pendingIds:WM(e.pendingIds)}:{lastSeenId:null,votes:{}}}catch{return{lastSeenId:null,votes:{}}}}function iG(t){try{window.localStorage.setItem(jM,JSON.stringify(t))}catch{}}function sG(){var n,r,i;if(typeof((n=globalThis.crypto)==null?void 0:n.randomUUID)=="function")return globalThis.crypto.randomUUID();const t=(i=(r=globalThis.crypto)==null?void 0:r.getRandomValues)==null?void 0:i.call(r,new Uint8Array(16));if(t===void 0)throw new Error("no secure randomness available");t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}async function oG(t,e,n){try{return(await fetch("/api/changelog-vote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:t,entryId:e,vote:n})})).ok?"ok":"failed"}catch{return"failed"}}function AS(t){return["flex h-6 w-7 cursor-pointer items-center justify-center rounded-md transition-colors",t?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" ")}function lG({entry:t,vote:e,queued:n,inFlight:r,onVote:i}){return R.jsxs("article",{className:"px-3 py-2.5","data-testid":`changelog-entry-${t.id}`,children:[R.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[t.tag!==void 0&&R.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:t.tag}),R.jsx("span",{className:"text-[11px] text-muted-foreground",children:ZX(t.date)})]}),R.jsx("h3",{className:"text-xs font-semibold text-foreground",children:t.title}),R.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-muted-foreground",children:t.summary}),R.jsxs("div",{className:"mt-1.5 flex gap-1",children:[R.jsx("button",{type:"button","data-testid":`changelog-up-${t.id}`,onClick:()=>i(t.id,1),"aria-pressed":e===1,"aria-label":`Upvote: ${t.title}`,title:"Good change",className:AS(e===1),children:R.jsx(BI,{size:13,strokeWidth:2,"aria-hidden":"true"})}),R.jsx("button",{type:"button","data-testid":`changelog-down-${t.id}`,onClick:()=>i(t.id,-1),"aria-pressed":e===-1,"aria-label":`Downvote: ${t.title}`,title:"Not for me",className:AS(e===-1),children:R.jsx(LI,{size:13,strokeWidth:2,"aria-hidden":"true"})})]}),n&&!r&&R.jsx("p",{"data-testid":`changelog-queued-${t.id}`,role:"status",className:"mt-1.5 rounded-sm border border-dashed border-border px-2 py-1 text-[11px] text-muted-foreground",children:"Vote queued — it will retry on your next interaction."})]})}function aG(){const[t,e]=w.useState(rG),[n,r]=w.useState(!1),i=w.useRef(t),s=w.useCallback(x=>{iG(x),i.current=x,e(x)},[]),[o,l]=w.useState(()=>new Set),a=w.useRef(new Set),u=w.useRef(null),c=w.useRef(null),f=w.useRef(new Map),d=t.lastSeenId!==null&&Fd>t.lastSeenId,h=w.useCallback((x,C)=>{l(T=>{const E=new Set(T);return C?E.add(x):E.delete(x),E})},[]),p=w.useCallback((x,C,T,E)=>{const M=(f.current.get(x)??0)+1;f.current.set(x,M),a.current.add(x),E&&h(x,!0),oG(T,x,C).then(P=>{f.current.get(x)===M&&(a.current.delete(x),P==="ok"&&(JP({entry_id:x,vote:C}),s(ES(i.current,x,!1))),E&&h(x,!1))})},[s,h]),m=w.useCallback(x=>{const{clientId:C,pendingIds:T,votes:E}=i.current,M=T??[];if(M.length!==0&&C!==void 0)for(const P of M){if(P===x||a.current.has(P))continue;const _=E[P];_!==void 0&&p(P,_,C,!1)}},[p]),b=(x,C)=>{if(t.votes[x]===C){m();return}const T=t.clientId??sG();s(ES({...t,votes:{...t.votes,[x]:C},clientId:T},x,!0)),p(x,C,T,!0),m(x)},v=()=>{r(!0),QP(),t.lastSeenId!==Fd&&s({...t,lastSeenId:Fd}),m()},g=w.useCallback(()=>{r(!1)},[]),y=w.useRef(!1);w.useEffect(()=>{var x;y.current&&!n&&((x=c.current)==null||x.focus()),y.current=n},[n]);const k=w.useRef(!1);return w.useEffect(()=>{k.current||(k.current=!0,m())},[m]),w.useEffect(()=>{if(!n)return;const x=T=>{T.key==="Escape"&&g()},C=T=>{const E=u.current;E===null||!(T.target instanceof Node)||E.contains(T.target)||g()};return document.addEventListener("keydown",x),document.addEventListener("click",C),()=>{document.removeEventListener("keydown",x),document.removeEventListener("click",C)}},[n,g]),R.jsxs("div",{"data-testid":"changelog",ref:u,className:"relative max-sm:static",children:[R.jsxs("button",{type:"button","data-testid":"changelog-toggle",ref:c,onClick:()=>n?g():v(),"aria-expanded":n,"aria-haspopup":"dialog","aria-label":"Changelog",title:"What's new",className:"relative inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border bg-panel text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[R.jsx(TI,{size:15,strokeWidth:2,"aria-hidden":"true"}),d&&R.jsx("span",{"data-testid":"changelog-dot","aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-foreground"})]}),n&&R.jsxs("div",{"data-testid":"changelog-popout",role:"dialog","aria-label":"Changelog",className:"absolute right-0 top-9 z-50 w-80 rounded-md border border-border bg-panel shadow-md max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto",children:[R.jsxs("div",{className:"flex items-center justify-between border-b border-border py-1.5 pl-3 pr-1.5",children:[R.jsx("span",{className:"text-xs font-semibold tracking-tight text-foreground",children:"What's new"}),R.jsx("button",{type:"button","data-testid":"changelog-close",onClick:g,"aria-label":"Close changelog",className:"flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:R.jsx(Y2,{size:14,strokeWidth:2,"aria-hidden":"true"})})]}),R.jsx("div",{className:"max-h-96 divide-y divide-border overflow-y-auto",children:eG.map(x=>{var C;return R.jsx(lG,{entry:x,vote:t.votes[x.id],queued:((C=t.pendingIds)==null?void 0:C.includes(x.id))??!1,inFlight:o.has(x.id),onVote:b},x.id)})})]})]})}function uG(t,e){const[n,r]=w.useState(t);return w.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function cG(t){const[e,n]=w.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(t).matches);return w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const r=window.matchMedia(t),i=s=>n(s.matches);return n(r.matches),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[t]),e}const fG={},dG=["csv2json","json2csv","json_validator","json_beautifier","sql2json","csvjson2json","datajanitor"],hG=["csv2json","json2csv","csvjson2json"];function pG(t){return hG.includes(t)}const gG=/^[0-9a-f]{32}$/i,mG=/^\/([a-z0-9_]+)\/([0-9a-f]{32})\/?$/i,xm=fG,yG=((xm==null?void 0:xm.VITE_S3_DATA_URL)??"https://csvjson.s3.us-east-2.amazonaws.com/data/").replace(/\/*$/,"/");function vG(t){const e=mG.exec(t);if(!e)return null;const n=e[1].toLowerCase();return dG.includes(n)?{tool:n,id:e[2].toLowerCase()}:null}class Oy extends Error{constructor(){super("This data doesn't exist (or was deleted)"),this.name="PermalinkNotFoundError"}}class km extends Error{constructor(e,n){super(e,n),this.name="PermalinkFetchError"}}const Sm={csv:(t,e)=>{t.direction="csv2json",t.input=Wh(e)},json:(t,e)=>{t.input=Wh(e),t.direction="json2csv"},parseNumbers:(t,e)=>{const n=zl(e);n!==void 0&&(t.options.parseNumbers=n)},parseJSON:(t,e)=>{const n=zl(e);n!==void 0&&(t.options.parseJSON=n)},transpose:(t,e)=>{const n=zl(e);n!==void 0&&(t.options.transpose=n)},"output-array":(t,e)=>{const n=zl(e);n!==void 0&&(t.options.hash=!n)},"output-hash":(t,e)=>{const n=zl(e);n!==void 0&&(t.options.hash=n)},flatten:(t,e)=>{const n=zl(e);n!==void 0&&(t.options.flatten=n)},output_csvjson_variant:()=>{}};function Wh(t){return typeof t=="string"?t:typeof t=="number"?String(t):""}function MS(t){return typeof t=="string"&&t.trim()!==""}function zl(t){if(t===!0||t==="true")return!0;if(t===!1||t==="false")return!1}function wG(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string"||typeof e=="boolean")}function bG(t){var i;if(!wG(t))return null;const e=MS(t.csv),n=MS(t.json);if(!e&&!n)return null;const r={direction:e?"csv2json":"json2csv",input:"",options:{}};for(const[s,o]of Object.entries(t))(i=Sm[s])==null||i.call(Sm,r,o);return r.input=Wh(e?t.csv:t.json),r}async function xG(t){if(!gG.test(t))throw new Oy;let e;try{e=await fetch(`${yG}${t}`,{mode:"cors"})}catch(r){throw new km("Network error while loading this data",{cause:r})}if(e.status===403||e.status===404)throw new Oy;if(!e.ok)throw new km(`Unexpected response while loading this data (HTTP ${e.status})`);let n;try{const r=await e.text();if(r.trim()==="")throw new Error("empty body");n=JSON.parse(r)}catch{throw new km("Stored data for this link is malformed")}return n}function kG(t){const e=w.useMemo(()=>t&&pG(t.tool)?t.id:null,[t]),[n,r]=w.useState(0),[i,s]=w.useState(e?"loading":"idle"),[o,l]=w.useState(null),[a,u]=w.useState("");return w.useEffect(()=>{if(!e)return;let c=!1;return xG(e).then(f=>{if(c)return;const d=bG(f);d?(l(d),s("hydrated")):s("unsupported")}).catch(f=>{c||(f instanceof Oy?s("not-found"):(u(f instanceof Error?f.message:"Couldn't load this data"),s("error")))}),()=>{c=!0}},[e,n]),{phase:i,hydrated:o,message:a,retry:()=>{i==="error"&&(s("loading"),r(c=>c+1))}}}async function RS(t){try{if(typeof navigator<"u"&&navigator.clipboard)return await navigator.clipboard.writeText(t),!0}catch{}try{const e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();const n=document.execCommand("copy");return e.remove(),n}catch{return!1}}const SG="\uFEFF";function CG(t,e){return e?SG+t:t}function TG(t,e,n){const r=CG(t,n);return new Blob([r],{type:`${e};charset=utf-8`})}const EG=new Set(["csv","tsv","json","txt"]);function AG(t){let e=t;for(;;){const n=e.lastIndexOf(".");if(n<=0)break;if(n===e.length-1){e=e.slice(0,n);continue}if(!EG.has(e.slice(n+1).toLowerCase()))break;e=e.slice(0,n)}return e}function MG(t,e){const n=e==="csv2json"?"json":"csv";return t?`${AG(t)}.${n}`:`data.${n}`}function OS(t,e,{mime:n="text/plain",bom:r=!1}={}){const i=TG(t,n,r),s=URL.createObjectURL(i),o=document.createElement("a");return o.href=s,o.download=e,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(s),0),e}function RG(t){if(!(t instanceof HTMLElement))return!1;if(t.isContentEditable)return!0;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"?!0:t.closest('[contenteditable="true"]')!==null}const OG=`album,year,US_peak_chart_post -The White Stripes,1999, -De Stijl,2000, -White Blood Cells,2001,61 -Elephant,2003,6 -Get Behind Me Satan,2005,3 -Icky Thump,2007,2`,PG=`[ - { - "album": "Elephant", - "year": 2003, - "label": "XL Recordings" - }, - { - "album": "Icky Thump", - "year": 2007, - "label": "XL Recordings" - } -]`,VM="csvjson-theme";function IG(){try{const t=localStorage.getItem(VM);return t==="dark"||t==="light"?t:null}catch{return null}}function DG(){try{if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return"light"}function _G(){return IG()??DG()}function NG(t){try{localStorage.setItem(VM,t)}catch{}}function LG(t){return new URLSearchParams(t).get("direction")==="json2csv"?"json2csv":"csv2json"}const PS=2*1024*1024,FG=150,BG=1e3,zG=2e3,$G=2e3;function HG(t,e){return t===0?null:e>0?`${t} rows · ${e} cols`:`${t} rows`}function jG(t){try{return JSON.parse(t),!0}catch{return!1}}function WG(){const[t,e]=w.useState(_G);w.useEffect(()=>{document.documentElement.classList.toggle("dark",t==="dark")},[t]);const n=()=>e(ne=>{const Je=ne==="dark"?"light":"dark";return NG(Je),Je}),[r,i]=w.useState(()=>typeof window>"u"?"csv2json":LG(window.location.search)),[s,o]=w.useState(()=>Bl("")),l=s.present,[a,u]=w.useState(zM),[c,f]=w.useState(50),[d,h]=w.useState(null),[p,m]=w.useState(!1),[b,v]=w.useState(null),[g,y]=w.useState("utf-8"),k=w.useRef({direction:r,options:a,input:l,resultOk:!0}),x=w.useRef(null);x.current||(x.current=sI({settleMs:zG,minWindowMs:$G,isValid:(ne,Je)=>{const Fe=k.current;return Je===Fe.input?Fe.resultOk:Mu(ne==="csv_to_json"?"csv2json":"json2csv",Je,Fe.options).ok}}));const C=x.current,E=cG("(min-width: 48rem)")?"side-by-side":"stacked",M=r==="csv2json",P=M?"CSV":"JSON",_=M?"JSON":"CSV",O=l.trim()==="",N=l.length>PS?BG:FG,D=uG(l,O?0:N),oe=w.useMemo(()=>typeof window>"u"?null:vG(window.location.pathname),[]),Q=kG(oe),te=w.useMemo(()=>Mu(r,D,a),[r,D,a]);k.current={direction:r,options:a,input:l,resultOk:te.ok};const[j,Y]=w.useState(null);w.useEffect(()=>{D.trim()!==""&&te.ok&&Y(te.text)},[te,D]);const[U,A]=w.useState(!1),[L,I]=w.useState(null),H=U?L:j,B=M&&!O&&H!==null&&(U||te.ok),ce=w.useCallback(ne=>{if(ne===j){A(!1),I(null);return}A(!0),I(ne)},[j]),we=w.useCallback(()=>{const ne=Mu(r,l,a);ne.ok&&Y(ne.text),A(!1),I(null)},[r,l,a]),fe=w.useCallback(ne=>{o(Je=>M?V6(Je,ne):Bl(ne))},[M]),De=M&&s.past.length>0,Ze=M&&s.future.length>0,rt=w.useCallback(()=>{if(!M||s.past.length===0)return;const ne=U6(s);v(null),o(ne),C.edit("csv_to_json",ne.present)},[M,s,C]),ct=w.useCallback(()=>{if(!M||s.future.length===0)return;const ne=K6(s);v(null),o(ne),C.edit("csv_to_json",ne.present)},[M,s,C]),ot=()=>{if(U){const ne=L??"";o(Je=>Bl(jG(ne)?ne:Je.present)),i(Je=>Je==="csv2json"?"json2csv":"csv2json"),A(!1),I(null);return}if(i(ne=>ne==="csv2json"?"json2csv":"csv2json"),O)o(Bl(""));else{const ne=Mu(r,l,a);o(Bl(ne.ok?ne.text:l))}},Ne=Q.hydrated;w.useEffect(()=>{if(Ne===null)return;const ne={...k.current.options,...Ne.options};k.current={direction:Ne.direction,options:ne,input:Ne.input,resultOk:Mu(Ne.direction,Ne.input,ne).ok},i(Ne.direction),o(Bl(Ne.input)),u(Je=>({...Je,...Ne.options})),A(!1),I(null),qP(),C.discrete(Ne.direction==="csv2json"?"csv_to_json":"json_to_csv","permalink",Ne.input)},[Ne,C]);const Ye=w.useRef(null),jt=async(ne,Je)=>{if(!$X(ne)){v(`Can't read "${ne.name}" as text — drop a ${M?".csv / .tsv":".json"} file.`);return}v(null),m(!0);try{const Fe=await wS(ne,g);Ye.current={file:ne,source:Je,text:Fe},fe(Fe),h(ne.name),m(!1),C.discrete(M?"csv_to_json":"json_to_csv",Je==="drop"?"drag":"file",Fe)}catch{m(!1),v(`Couldn't read "${ne.name}".`)}},Pe=async ne=>{const Je=g;y(ne);const Fe=Ye.current;if(!(!Fe||l!==Fe.text)){m(!0);try{const et=await wS(Fe.file,ne);Ye.current={...Fe,text:et},o(wt=>({...wt,present:et})),m(!1),C.discrete(M?"csv_to_json":"json_to_csv",Fe.source==="drop"?"drag":"file",et)}catch{m(!1),y(Je),v(`Couldn't read "${Fe.file.name}".`)}}},pe=w.useCallback(ne=>{v(null),fe(ne),C.edit(M?"csv_to_json":"json_to_csv",ne)},[fe,M,C]);w.useEffect(()=>{const ne=Je=>{var et;const Fe=(et=Je.clipboardData)==null?void 0:et.getData("text/plain");!Fe||RG(Je.target)||(Je.preventDefault(),Je.stopPropagation(),h(null),pe(Fe))};return document.addEventListener("paste",ne,!0),()=>document.removeEventListener("paste",ne,!0)},[pe]);const He=te.ok?HG(te.rows,te.cols):null,Le=!te.ok&&j?"Last valid result — input has errors":null,it=te.ok&&te.warnings&&te.warnings.length>0?te.warnings:null,je=l.length>PS,yt=()=>{$f({via:"copy",format:M?"csv":"json"}),RS(l)},ft=()=>{$f({via:"copy",format:M?"json":"csv"});const ne=U?L:j;ne&&RS(ne)},vt=()=>{$f({via:"download",format:M?"csv":"json"}),OS(l,d??(M?"data.csv":"data.json"),{mime:M?"text/csv":"application/json",bom:M})},he=()=>{$f({via:"download",format:M?"json":"csv"}),OS((U?L:j)??"",MG(d,M?"csv2json":"json2csv"),{mime:M?"application/json":"text/csv",bom:!M})},st=R.jsx(BX,{format:P,input:l,onInputChange:pe,onCellCommit:pe,onFile:jt,onTryExample:()=>{v(null);const ne=M?OG:PG;fe(ne),C.edit(M?"csv_to_json":"json_to_csv",ne)},onClear:()=>{fe(""),h(null),A(!1),I(null),C.cancel()},onCopy:yt,onDownload:vt,canUndo:De,canRedo:Ze,onUndo:rt,onRedo:ct,collapseIndexedArrays:a.collapseIndexedArrays??!0,onToggleCollapseIndexedArrays:()=>u(ne=>({...ne,collapseIndexedArrays:!(ne.collapseIndexedArrays??!0)})),filename:d,reading:p,meta:He,error:null,notice:b,delimiter:a.separator==="auto"?void 0:a.separator,dark:t==="dark"}),lt=R.jsx(KX,{format:_,inputEmpty:O,outputText:H,error:te.ok?null:te.error,meta:He,staleNotice:Le,warnings:it,edited:U,editable:B,delimiter:a.separator==="auto"?void 0:a.separator,dark:t==="dark",onCopy:ft,onDownload:he,onOutputChange:ce,onRevert:we,onDiscardReconvert:we});return R.jsxs("div",{className:"flex min-h-svh flex-col bg-background text-foreground",children:[R.jsx("h1",{className:"sr-only",children:"CSV to JSON and JSON to CSV converter"}),R.jsxs("div",{className:"flex h-svh min-h-0 flex-col",children:[R.jsx(AD,{}),R.jsx(qX,{theme:t,onToggleTheme:n,slot:R.jsxs("div",{className:"flex items-center gap-1",children:[R.jsx(aG,{}),R.jsx(ID,{})]})}),oe&&(Q.phase==="loading"||Q.phase==="not-found"||Q.phase==="unsupported"||Q.phase==="error")?R.jsx(XX,{phase:Q.phase,message:Q.phase==="error"?Q.message:void 0,onRetry:Q.retry}):null,R.jsx(GX,{layout:E,split:c,onSplitChange:f,left:st,right:lt,children:R.jsx(SD,{direction:r,onFlip:ot})}),R.jsx(WX,{direction:r,options:a,onChange:ne=>u(Je=>({...Je,...ne})),uploadEncoding:g,onUploadEncodingChange:Pe,notice:je?"Large file — converting on pause":null})]}),R.jsx(TD,{})]})}V2(document.getElementById("root")).render(R.jsx(w.StrictMode,{children:R.jsx(WG,{})}));document.getElementById("root").removeAttribute("inert");GP();YP();export{xW as C,Pn as R,K4 as T,ta as a,v3 as b,KP as c,$l as i,U4 as m,w as r,jr as s}; diff --git a/app/dist/assets/index-9s9lwYSO.css b/app/dist/assets/index-9s9lwYSO.css new file mode 100644 index 0000000..f07e22a --- /dev/null +++ b/app/dist/assets/index-9s9lwYSO.css @@ -0,0 +1 @@ +/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--color-amber-100:oklch(96.2% .059 95.617);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-600:oklch(58.8% .158 241.966);--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-muted-foreground:hsl(var(--muted-foreground))}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-3{inset:calc(var(--spacing) * 3)}.inset-x-0{inset-inline:0}.-top-1\.5{top:calc(var(--spacing) * -1.5)}.top-0{top:0}.top-1{top:var(--spacing)}.top-1\/2{top:50%}.top-9{top:calc(var(--spacing) * 9)}.top-\[var\(--split\)\]{top:var(--split)}.right-0{right:0}.right-1{right:var(--spacing)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.left-0{left:0}.left-1\.5{left:calc(var(--spacing) * 1.5)}.left-1\/2{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.row-0{grid-row:0}.row-10{grid-row:10}.row-59{grid-row:59}.row-60{grid-row:60}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-11{width:calc(var(--spacing) * 11);height:calc(var(--spacing) * 11)}.h-0{height:0}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-\[18px\]{height:18px}.h-\[var\(--split\)\]{height:var(--split)}.h-svh{height:100svh}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-0{min-height:0}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-\[42px\]{min-height:42px}.min-h-svh{min-height:100svh}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.max-w-44{max-width:calc(var(--spacing) * 44)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-32{min-width:calc(var(--spacing) * 32)}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[2px\]{--tw-translate-x:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[15px\]{--tw-translate-x:15px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.resize{resize:both}.resize-none{resize:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:hsl(var(--border))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[7px\]{border-radius:7px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-border{border-color:hsl(var(--border))}.border-foreground{border-color:hsl(var(--foreground))}.border-primary,.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-ring{border-color:hsl(var(--ring))}.bg-amber-100{background-color:var(--color-amber-100)}.bg-background,.bg-background\/80{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/80{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.bg-border{background-color:hsl(var(--border))}.bg-foreground{background-color:hsl(var(--foreground))}.bg-muted,.bg-muted\/30{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,hsl(var(--muted)) 30%,transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,hsl(var(--muted)) 40%,transparent)}}.bg-muted\/50{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,hsl(var(--muted)) 50%,transparent)}}.bg-muted\/60{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/60{background-color:color-mix(in oklab,hsl(var(--muted)) 60%,transparent)}}.bg-panel{background-color:hsl(var(--panel))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-3{padding:calc(var(--spacing) * 3)}.p-6{padding:calc(var(--spacing) * 6)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0{padding-block:0}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-px{padding-block:1px}.pr-1\.5{padding-right:calc(var(--spacing) * 1.5)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SF Mono,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.font-sans{font-family:var(--font-sans)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12\.5px\]{font-size:12.5px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.1em\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-\[0\.18em\]{--tw-tracking:.18em;letter-spacing:.18em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-destructive{color:hsl(var(--destructive))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground,.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-panel{color:hsl(var(--panel))}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.decoration-border{-webkit-text-decoration-color:hsl(var(--border));text-decoration-color:hsl(var(--border))}.underline-offset-2{text-underline-offset:2px}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xs{--tw-shadow:0 1px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-ring\/50{--tw-ring-color:hsl(var(--ring))}@supports (color:color-mix(in lab,red,red)){.ring-ring\/50{--tw-ring-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:text-muted-foreground::placeholder,.placeholder\:text-muted-foreground\/50::placeholder{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-muted-foreground\/50::placeholder{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.placeholder\:text-muted-foreground\/60::placeholder{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-muted-foreground\/60::placeholder{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.last\:mb-0:last-child{margin-bottom:0}@media (hover:hover){.hover\:border-foreground:hover{border-color:hsl(var(--foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.hover\:border-muted-foreground\/50:hover{border-color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:decoration-foreground:hover{-webkit-text-decoration-color:hsl(var(--foreground));text-decoration-color:hsl(var(--foreground))}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:border-sky-600:focus-visible{border-color:var(--color-sky-600)}.focus-visible\:ring-3:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:hsl(var(--ring))}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-1:focus-visible{outline-offset:1px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-ring:focus-visible{outline-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media not all and (min-width:48rem){.max-md\:gap-1{gap:var(--spacing)}.max-md\:gap-2{gap:calc(var(--spacing) * 2)}}@media not all and (min-width:40rem){.max-sm\:static{position:static}.max-sm\:inset-x-2{inset-inline:calc(var(--spacing) * 2)}.max-sm\:top-14{top:calc(var(--spacing) * 14)}.max-sm\:w-auto{width:auto}}@media (min-width:40rem){.sm\:inline{display:inline}.sm\:max-w-64{max-width:calc(var(--spacing) * 64)}.sm\:max-w-none{max-width:none}}@media (min-width:48rem){.md\:top-0{top:0}.md\:right-auto{right:auto}.md\:bottom-0{bottom:0}.md\:-left-1\.5{left:calc(var(--spacing) * -1.5)}.md\:left-\[var\(--split\)\]{left:var(--split)}.md\:h-12{height:calc(var(--spacing) * 12)}.md\:h-auto{height:auto}.md\:w-0{width:0}.md\:w-3{width:calc(var(--spacing) * 3)}.md\:w-\[var\(--split\)\]{width:var(--split)}.md\:cursor-col-resize{cursor:col-resize}.md\:flex-row{flex-direction:row}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.md\:py-0{padding-block:0}}.dark\:bg-amber-400\/15:is(.dark *){background-color:#fcbb0026}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-400\/15:is(.dark *){background-color:color-mix(in oklab,var(--color-amber-400) 15%,transparent)}}.dark\:text-amber-400:is(.dark *){color:var(--color-amber-400)}.dark\:focus-visible\:border-sky-400:is(.dark *):focus-visible{border-color:var(--color-sky-400)}.\[\&_svg\]\:size-3\.5 svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}}:root{--panel:0 0% 100%;--background:0 0% 100%;--foreground:240 10% 3.9%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--border:240 5.9% 90%;--primary:240 5.9% 10%;--primary-foreground:0 0% 98%;--secondary:240 4.8% 95.9%;--secondary-foreground:240 5.9% 10%;--accent:240 4.8% 95.9%;--accent-foreground:240 5.9% 10%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--ring:240 5% 64.9%;--radius:.625rem}.dark{--background:240 10% 3.9%;--panel:240 6% 7%;--foreground:0 0% 98%;--muted:240 3.7% 15.9%;--muted-foreground:240 5% 64.9%;--border:240 3.7% 15.9%;--primary:0 0% 98%;--primary-foreground:240 5.9% 10%;--secondary:240 3.7% 15.9%;--secondary-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--ring:240 4.9% 83.9%}body{background-color:var(--color-background);color:var(--color-foreground)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}.gdg-mnuv029{word-break:break-word;-webkit-touch-callout:default;padding-top:6px}.gdg-mnuv029>*{margin:0}.gdg-mnuv029 *:last-child{margin-bottom:0}.gdg-mnuv029 p img{width:100%}.gdg-d19meir1{position:absolute;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;overflow:hidden;box-sizing:border-box;--overlay-top:var(--d19meir1-0);left:var(--d19meir1-1);top:var(--d19meir1-0);min-width:var(--d19meir1-2);min-height:var(--d19meir1-3);width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;max-height:calc(100vh - var(--d19meir1-4));font-family:var(--gdg-font-family);font-size:var(--gdg-editor-font-size);text-align:start}@-webkit-keyframes glide_fade_in-gdg-d19meir1{0%{opacity:0%}to{opacity:100%}}@keyframes glide_fade_in-gdg-d19meir1{0%{opacity:0%}to{opacity:100%}}.gdg-d19meir1.gdg-style{border-radius:2px;background-color:var(--gdg-bg-cell);box-shadow:0 0 0 1px var(--gdg-accent-color),0 0 1px #3e415666,0 6px 12px #3e415626;-webkit-animation:glide_fade_in-gdg-d19meir1 60ms 1;animation:glide_fade_in-gdg-d19meir1 60ms 1}.gdg-d19meir1.gdg-pad{padding:var(--d19meir1-5) 8.5px 3px}.gdg-d19meir1 .gdg-clip-region{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;overflow-y:auto;overflow-x:hidden;border-radius:2px;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.gdg-d19meir1 .gdg-clip-region .gdg-growing-entry{height:100%}.gdg-d19meir1 .gdg-clip-region input.gdg-input{width:100%;border:none;border-width:0;outline:none}.gdg-d19meir1 .gdg-clip-region textarea.gdg-input{border:none;border-width:0;outline:none}.gdg-b1ygi5by{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-top:auto;margin-bottom:auto}.gdg-b1ygi5by .boe-bubble{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:var(--gdg-rounding-radius,10px);padding:0 8px;height:20px;background-color:var(--gdg-bg-bubble);color:var(--gdg-text-dark);margin:2px}.gdg-b1ygi5by textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-n15fjm3e{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin:6px 0 3px;color:var(--gdg-text-dark)}.gdg-n15fjm3e>input{font-size:var(--gdg-editor-font-size);padding:0;font-family:var(--gdg-font-family);color:var(--gdg-text-dark);background-color:var(--gdg-bg-cell)}.gdg-d4zsq0x{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.gdg-d4zsq0x .doe-bubble{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 8px;height:24px;background-color:var(--gdg-bg-cell);color:var(--gdg-text-dark);margin:2px;border-radius:var(--gdg-rounding-radius,6px);box-shadow:0 0 1px #3e415666,0 1px 3px #3e415666}.gdg-d4zsq0x .doe-bubble img{height:16px;object-fit:contain;margin-right:4px}.gdg-d4zsq0x textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-i2iowwq{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%}.gdg-i2iowwq .gdg-centering-container{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%}.gdg-i2iowwq .gdg-centering-container img,.gdg-i2iowwq .gdg-centering-container canvas{max-height:calc(100vh - var(--overlay-top) - 20px);object-fit:contain;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.gdg-i2iowwq .gdg-centering-container canvas{max-width:380px}.gdg-i2iowwq .gdg-edit-icon{position:absolute;top:12px;right:0;width:48px;height:48px;color:var(--gdg-accent-color);cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.gdg-i2iowwq .gdg-edit-icon>*{width:24px;height:24px}.gdg-i2iowwq textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-u1rrojo{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-height:21px}.gdg-u1rrojo .gdg-link-area{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;cursor:pointer;margin-right:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gdg-link-color);-webkit-text-decoration:underline!important;text-decoration:underline!important}.gdg-u1rrojo .gdg-edit-icon{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:32px;color:var(--gdg-accent-color);cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.gdg-u1rrojo .gdg-edit-icon>*{width:24px;height:24px}.gdg-u1rrojo textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-m1pnx84e{min-width:var(--m1pnx84e-0);width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;position:relative;color:var(--gdg-text-dark)}.gdg-m1pnx84e .gdg-g1y0xocz{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;min-width:0}.gdg-m1pnx84e .gdg-spacer{-webkit-flex:1;-ms-flex:1;flex:1}.gdg-m1pnx84e .gdg-edit-icon{position:relative;cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--gdg-accent-color);padding:0;height:24px;width:24px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:all "0.125s ease";transition:all "0.125s ease";border-radius:6px}.gdg-m1pnx84e .gdg-edit-icon>*{width:16px;height:16px}.gdg-m1pnx84e .gdg-edit-hover:hover{background-color:var(--gdg-accent-light);-webkit-transition:background-color .15s;transition:background-color .15s}.gdg-m1pnx84e .gdg-checkmark-hover:hover{color:#fff;background-color:var(--gdg-accent-color)}.gdg-m1pnx84e .gdg-md-edit-textarea{position:relative;top:0;left:0;width:0px;height:0px;margin-top:25px;opacity:0;padding:0}.gdg-m1pnx84e .gdg-ml-6{margin-left:6px}.gdg-s1dgczr6 .dvn-scroller{overflow:var(--s1dgczr6-0);-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);transform:translateZ(0)}.gdg-s1dgczr6 .dvn-hidden{visibility:hidden}.gdg-s1dgczr6 .dvn-scroll-inner{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;pointer-events:none}.gdg-s1dgczr6 .dvn-scroll-inner>*{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.gdg-s1dgczr6 .dvn-scroll-inner .dvn-spacer{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.gdg-s1dgczr6 .dvn-scroll-inner .dvn-stack{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.gdg-s1dgczr6 .dvn-underlay>*{position:absolute;left:0;top:0}.gdg-s1dgczr6 canvas{outline:none}.gdg-s1dgczr6 canvas *{height:0}.gdg-izpuzkl{position:absolute;left:0;right:0;top:0;bottom:0;width:100%;height:100%;border-radius:0;resize:none;white-space:pre-wrap;min-width:100%;overflow:hidden;border:0;background-color:transparent;font-size:var(--gdg-editor-font-size);line-height:16px;font-family:var(--gdg-font-family);-webkit-text-fill-color:var(--gdg-text-dark);color:var(--gdg-text-dark);padding:0;margin:0}.gdg-izpuzkl::-webkit-input-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl::-moz-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl:-ms-input-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl::placeholder{color:var(--gdg-text-light)}.gdg-invalid .gdg-izpuzkl{-webkit-text-decoration:underline;text-decoration:underline;-webkit-text-decoration-color:#d60606;text-decoration-color:#d60606}.gdg-s69h75o{visibility:hidden;white-space:pre-wrap;word-wrap:break-word;width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:100%;min-width:100%;font-size:var(--gdg-editor-font-size);line-height:16px;font-family:var(--gdg-font-family);color:var(--gdg-text-dark);padding:0 0 2px;margin:0}.gdg-g1y0xocz{position:relative;margin-top:6px}.gdg-seveqep{position:absolute;top:4px;right:20px;background-color:var(--gdg-bg-cell);color:var(--gdg-text-dark);padding:8px;border:1px solid var(--gdg-border-color);border-radius:6px;font-size:var(--gdg-editor-font-size);-webkit-animation:gdg-search-fadein-gdg-seveqep .15s forwards;animation:gdg-search-fadein-gdg-seveqep .15s forwards}.gdg-seveqep.out{-webkit-animation:gdg-search-fadeout-gdg-seveqep .15s forwards;animation:gdg-search-fadeout-gdg-seveqep .15s forwards}.gdg-seveqep .gdg-search-bar-inner{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.gdg-seveqep .gdg-search-status{padding-top:4px;font-size:11px}.gdg-seveqep .gdg-search-progress{position:absolute;height:4px;left:0;bottom:0;background-color:var(--gdg-text-light)}.gdg-seveqep input{width:220px;color:var(--gdg-textDark);background-color:var(--gdg-bg-cell);border:none;border-width:0;outline:none}.gdg-seveqep button{width:24px;height:24px;padding:0;border:none;outline:none;background:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;color:var(--gdg-text-medium)}.gdg-seveqep button:hover{color:var(--gdg-text-dark)}.gdg-seveqep button .button-icon{width:16px;height:16px}.gdg-seveqep button:disabled{opacity:.4;pointer-events:none}@-webkit-keyframes gdg-search-fadeout-gdg-seveqep{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}to{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}}@keyframes gdg-search-fadeout-gdg-seveqep{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}to{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}}@-webkit-keyframes gdg-search-fadein-gdg-seveqep{0%{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}to{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}}@keyframes gdg-search-fadein-gdg-seveqep{0%{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}to{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}}.gdg-wmyidgi{position:relative;min-width:10px;min-height:10px;max-width:100%;max-height:100%;width:var(--wmyidgi-0);height:var(--wmyidgi-1);overflow:hidden;overflow:clip;direction:ltr}.gdg-wmyidgi>:first-child{position:absolute;left:0;top:0;width:100%;height:100%}.gdg-r17m35ur{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;border:none;outline:none;background-color:var(--gdg-bg-header-has-focus);border-radius:9px;padding:0 8px;box-shadow:0 0 0 1px var(--gdg-border-color);color:var(--gdg-text-group-header);min-height:var(--r17m35ur-0);font:var(--gdg-header-font-style) var(--gdg-font-family)}.gdg-c1tqibwd{padding:0 8px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--gdg-bg-header)} diff --git a/app/dist/assets/index-DtDByObO.js b/app/dist/assets/index-DtDByObO.js new file mode 100644 index 0000000..8b17991 --- /dev/null +++ b/app/dist/assets/index-DtDByObO.js @@ -0,0 +1,284 @@ +var kR=Object.defineProperty;var SR=(t,e,n)=>e in t?kR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var bt=(t,e,n)=>SR(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var no=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ii(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _S={exports:{}},Vh={},NS={exports:{}},Tt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var _c=Symbol.for("react.element"),CR=Symbol.for("react.portal"),TR=Symbol.for("react.fragment"),ER=Symbol.for("react.strict_mode"),AR=Symbol.for("react.profiler"),MR=Symbol.for("react.provider"),RR=Symbol.for("react.context"),OR=Symbol.for("react.forward_ref"),PR=Symbol.for("react.suspense"),IR=Symbol.for("react.memo"),DR=Symbol.for("react.lazy"),Ww=Symbol.iterator;function _R(t){return t===null||typeof t!="object"?null:(t=Ww&&t[Ww]||t["@@iterator"],typeof t=="function"?t:null)}var LS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},FS=Object.assign,BS={};function Ba(t,e,n){this.props=t,this.context=e,this.refs=BS,this.updater=n||LS}Ba.prototype.isReactComponent={};Ba.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Ba.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function zS(){}zS.prototype=Ba.prototype;function Py(t,e,n){this.props=t,this.context=e,this.refs=BS,this.updater=n||LS}var Iy=Py.prototype=new zS;Iy.constructor=Py;FS(Iy,Ba.prototype);Iy.isPureReactComponent=!0;var Vw=Array.isArray,$S=Object.prototype.hasOwnProperty,Dy={current:null},jS={key:!0,ref:!0,__self:!0,__source:!0};function HS(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)$S.call(e,r)&&!jS.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,L=H[O];if(0>>1;Oi($,R))uei(ce,$)?(H[O]=ce,H[ue]=R,O=ue):(H[O]=$,H[W]=R,O=W);else if(uei(ce,R))H[O]=ce,H[ue]=R,O=ue;else break e}}return Y}function i(H,Y){var R=H.sortIndex-Y.sortIndex;return R!==0?R:H.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,f=null,d=3,h=!1,p=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(H){for(var Y=n(u);Y!==null;){if(Y.callback===null)r(u);else if(Y.startTime<=H)r(u),Y.sortIndex=Y.expirationTime,e(a,Y);else break;Y=n(u)}}function k(H){if(m=!1,w(H),!p)if(n(a)!==null)p=!0,ne(x);else{var Y=n(u);Y!==null&&ie(k,Y.startTime-H)}}function x(H,Y){p=!1,m&&(m=!1,g(E),E=-1),h=!0;var R=d;try{for(w(Y),f=n(a);f!==null&&(!(f.expirationTime>Y)||H&&!_());){var O=f.callback;if(typeof O=="function"){f.callback=null,d=f.priorityLevel;var L=O(f.expirationTime<=Y);Y=t.unstable_now(),typeof L=="function"?f.callback=L:f===n(a)&&r(a),w(Y)}else r(a);f=n(a)}if(f!==null)var F=!0;else{var W=n(u);W!==null&&ie(k,W.startTime-Y),F=!1}return F}finally{f=null,d=R,h=!1}}var S=!1,T=null,E=-1,A=5,I=-1;function _(){return!(t.unstable_now()-IH||125O?(H.sortIndex=R,e(u,H),n(a)===null&&H===n(u)&&(m?(g(E),E=-1):m=!0,ie(k,R-O))):(H.sortIndex=L,e(a,H),p||h||(p=!0,ne(x))),H},t.unstable_shouldYield=_,t.unstable_wrapCallback=function(H){var Y=d;return function(){var R=d;d=Y;try{return H.apply(this,arguments)}finally{d=R}}}})(XS);KS.exports=XS;var UR=KS.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var KR=v,zr=UR;function ae(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cm=Object.prototype.hasOwnProperty,XR=/^[: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]*$/,Kw={},Xw={};function GR(t){return Cm.call(Xw,t)?!0:Cm.call(Kw,t)?!1:XR.test(t)?Xw[t]=!0:(Kw[t]=!0,!1)}function YR(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 qR(t,e,n,r){if(e===null||typeof e>"u"||YR(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 hr(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Vn[t]=new hr(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Vn[e]=new hr(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Vn[t]=new hr(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Vn[t]=new hr(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){Vn[t]=new hr(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Vn[t]=new hr(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Vn[t]=new hr(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Vn[t]=new hr(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Vn[t]=new hr(t,5,!1,t.toLowerCase(),null,!1,!1)});var Ny=/[\-:]([a-z])/g;function Ly(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(Ny,Ly);Vn[e]=new hr(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(Ny,Ly);Vn[e]=new hr(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(Ny,Ly);Vn[e]=new hr(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Vn[t]=new hr(t,1,!1,t.toLowerCase(),null,!1,!1)});Vn.xlinkHref=new hr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Vn[t]=new hr(t,1,!1,t.toLowerCase(),null,!0,!0)});function Fy(t,e,n,r){var i=Vn.hasOwnProperty(e)?Vn[e]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var a=` +`+i[o].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{ng=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Ou(t):""}function QR(t){switch(t.tag){case 5:return Ou(t.type);case 16:return Ou("Lazy");case 13:return Ou("Suspense");case 19:return Ou("SuspenseList");case 0:case 2:case 15:return t=rg(t.type,!1),t;case 11:return t=rg(t.type.render,!1),t;case 1:return t=rg(t.type,!0),t;default:return""}}function Mm(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 Ul:return"Fragment";case Vl:return"Portal";case Tm:return"Profiler";case By:return"StrictMode";case Em:return"Suspense";case Am:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case qS:return(t.displayName||"Context")+".Consumer";case YS:return(t._context.displayName||"Context")+".Provider";case zy:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case $y:return e=t.displayName||null,e!==null?e:Mm(t.type)||"Memo";case Gs:e=t._payload,t=t._init;try{return Mm(t(e))}catch{}}return null}function JR(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Mm(e);case 8:return e===By?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function vo(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function JS(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function ZR(t){var e=JS(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 i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Tf(t){t._valueTracker||(t._valueTracker=ZR(t))}function ZS(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=JS(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Bd(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 Rm(t,e){var n=e.checked;return dn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Yw(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=vo(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 eC(t,e){e=e.checked,e!=null&&Fy(t,"checked",e,!1)}function Om(t,e){eC(t,e);var n=vo(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")?Pm(t,e.type,n):e.hasOwnProperty("defaultValue")&&Pm(t,e.type,vo(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function qw(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 Pm(t,e,n){(e!=="number"||Bd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Pu=Array.isArray;function aa(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Ef.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function lc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Bu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},eO=["Webkit","ms","Moz","O"];Object.keys(Bu).forEach(function(t){eO.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Bu[e]=Bu[t]})});function iC(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Bu.hasOwnProperty(t)&&Bu[t]?(""+e).trim():e+"px"}function sC(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=iC(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var tO=dn({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 _m(t,e){if(e){if(tO[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ae(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ae(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ae(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ae(62))}}function Nm(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Lm=null;function jy(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Fm=null,ua=null,ca=null;function Zw(t){if(t=Fc(t)){if(typeof Fm!="function")throw Error(ae(280));var e=t.stateNode;e&&(e=Yh(e),Fm(t.stateNode,t.type,e))}}function oC(t){ua?ca?ca.push(t):ca=[t]:ua=t}function lC(){if(ua){var t=ua,e=ca;if(ca=ua=null,Zw(t),e)for(t=0;t>>=0,t===0?32:31-(dO(t)/hO|0)|0}var Af=64,Mf=4194304;function Iu(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Hd(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Iu(l):(s&=o,s!==0&&(r=Iu(s)))}else o=n&~i,o!==0?r=Iu(o):s!==0&&(r=Iu(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Nc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Mi(e),t[e]=n}function yO(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=$u),a1=" ",u1=!1;function AC(t,e){switch(t){case"keyup":return UO.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function MC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Kl=!1;function XO(t,e){switch(t){case"compositionend":return MC(e);case"keypress":return e.which!==32?null:(u1=!0,a1);case"textInput":return t=e.data,t===a1&&u1?null:t;default:return null}}function GO(t,e){if(Kl)return t==="compositionend"||!Yy&&AC(t,e)?(t=TC(),xd=Ky=ro=null,Kl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=h1(n)}}function IC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?IC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function DC(){for(var t=window,e=Bd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Bd(t.document)}return e}function qy(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function rP(t){var e=DC(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&IC(n.ownerDocument.documentElement,n)){if(r!==null&&qy(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=p1(n,s);var o=p1(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Xl=null,Wm=null,Hu=null,Vm=!1;function g1(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vm||Xl==null||Xl!==Bd(r)||(r=Xl,"selectionStart"in r&&qy(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}),Hu&&hc(Hu,r)||(Hu=r,r=Ud(Wm,"onSelect"),0ql||(t.current=qm[ql],qm[ql]=null,ql--)}function Jt(t,e){ql++,qm[ql]=t.current,t.current=e}var wo={},nr=Eo(wo),xr=Eo(!1),rl=wo;function xa(t,e){var n=t.type.contextTypes;if(!n)return wo;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function kr(t){return t=t.childContextTypes,t!=null}function Xd(){rn(xr),rn(nr)}function k1(t,e,n){if(nr.current!==wo)throw Error(ae(168));Jt(nr,e),Jt(xr,n)}function HC(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(ae(108,JR(t)||"Unknown",i));return dn({},n,r)}function Gd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||wo,rl=nr.current,Jt(nr,t),Jt(xr,xr.current),!0}function S1(t,e,n){var r=t.stateNode;if(!r)throw Error(ae(169));n?(t=HC(t,e,rl),r.__reactInternalMemoizedMergedChildContext=t,rn(xr),rn(nr),Jt(nr,t)):rn(xr),Jt(xr,n)}var ms=null,qh=!1,yg=!1;function WC(t){ms===null?ms=[t]:ms.push(t)}function gP(t){qh=!0,WC(t)}function Ao(){if(!yg&&ms!==null){yg=!0;var t=0,e=jt;try{var n=ms;for(jt=1;t>=o,i-=o,xs=1<<32-Mi(e)+i|n<E?(A=T,T=null):A=T.sibling;var I=d(g,T,w[E],k);if(I===null){T===null&&(T=A);break}t&&T&&I.alternate===null&&e(g,T),y=s(I,y,E),S===null?x=I:S.sibling=I,S=I,T=A}if(E===w.length)return n(g,T),un&&$o(g,E),x;if(T===null){for(;EE?(A=T,T=null):A=T.sibling;var _=d(g,T,I.value,k);if(_===null){T===null&&(T=A);break}t&&T&&_.alternate===null&&e(g,T),y=s(_,y,E),S===null?x=_:S.sibling=_,S=_,T=A}if(I.done)return n(g,T),un&&$o(g,E),x;if(T===null){for(;!I.done;E++,I=w.next())I=f(g,I.value,k),I!==null&&(y=s(I,y,E),S===null?x=I:S.sibling=I,S=I);return un&&$o(g,E),x}for(T=r(g,T);!I.done;E++,I=w.next())I=h(T,g,E,I.value,k),I!==null&&(t&&I.alternate!==null&&T.delete(I.key===null?E:I.key),y=s(I,y,E),S===null?x=I:S.sibling=I,S=I);return t&&T.forEach(function(P){return e(g,P)}),un&&$o(g,E),x}function b(g,y,w,k){if(typeof w=="object"&&w!==null&&w.type===Ul&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Cf:e:{for(var x=w.key,S=y;S!==null;){if(S.key===x){if(x=w.type,x===Ul){if(S.tag===7){n(g,S.sibling),y=i(S,w.props.children),y.return=g,g=y;break e}}else if(S.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Gs&&E1(x)===S.type){n(g,S.sibling),y=i(S,w.props),y.ref=hu(g,S,w),y.return=g,g=y;break e}n(g,S);break}else e(g,S);S=S.sibling}w.type===Ul?(y=el(w.props.children,g.mode,k,w.key),y.return=g,g=y):(k=Rd(w.type,w.key,w.props,null,g.mode,k),k.ref=hu(g,y,w),k.return=g,g=k)}return o(g);case Vl:e:{for(S=w.key;y!==null;){if(y.key===S)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(g,y.sibling),y=i(y,w.children||[]),y.return=g,g=y;break e}else{n(g,y);break}else e(g,y);y=y.sibling}y=Tg(w,g.mode,k),y.return=g,g=y}return o(g);case Gs:return S=w._init,b(g,y,S(w._payload),k)}if(Pu(w))return p(g,y,w,k);if(au(w))return m(g,y,w,k);Nf(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(g,y.sibling),y=i(y,w),y.return=g,g=y):(n(g,y),y=Cg(w,g.mode,k),y.return=g,g=y),o(g)):n(g,y)}return b}var Sa=XC(!0),GC=XC(!1),Qd=Eo(null),Jd=null,Zl=null,ev=null;function tv(){ev=Zl=Jd=null}function nv(t){var e=Qd.current;rn(Qd),t._currentValue=e}function Zm(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function da(t,e){Jd=t,ev=Zl=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(wr=!0),t.firstContext=null)}function ii(t){var e=t._currentValue;if(ev!==t)if(t={context:t,memoizedValue:e,next:null},Zl===null){if(Jd===null)throw Error(ae(308));Zl=t,Jd.dependencies={lanes:0,firstContext:t}}else Zl=Zl.next=t;return e}var Yo=null;function rv(t){Yo===null?Yo=[t]:Yo.push(t)}function YC(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,rv(e)):(n.next=i.next,i.next=n),e.interleaved=n,Ms(t,r)}function Ms(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}var Ys=!1;function iv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qC(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 Cs(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ho(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,It&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Ms(t,n)}return i=r.interleaved,i===null?(e.next=e,rv(r)):(e.next=i.next,i.next=e),r.interleaved=e,Ms(t,n)}function Sd(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Wy(t,n)}}function A1(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Zd(t,e,n,r){var i=t.updateQueue;Ys=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?s=u:o.next=u,o=a;var c=t.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(s!==null){var f=i.baseState;o=0,c=u=a=null,l=s;do{var d=l.lane,h=l.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,m=l;switch(d=e,h=n,m.tag){case 1:if(p=m.payload,typeof p=="function"){f=p.call(h,f,d);break e}f=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,d=typeof p=="function"?p.call(h,f,d):p,d==null)break e;f=dn({},f,d);break e;case 2:Ys=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,d=i.effects,d===null?i.effects=[l]:d.push(l))}else h={eventTime:h,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=f):c=c.next=h,o|=d;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;d=l,l=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(!0);if(c===null&&(a=f),i.baseState=a,i.firstBaseUpdate=u,i.lastBaseUpdate=c,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);ol|=o,t.lanes=o,t.memoizedState=f}}function M1(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=wg.transition;wg.transition={};try{t(!1),e()}finally{jt=n,wg.transition=r}}function h2(){return si().memoizedState}function wP(t,e,n){var r=go(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},p2(t))g2(e,n);else if(n=YC(t,e,n,r),n!==null){var i=ur();Ri(n,t,r,i),m2(n,e,r)}}function bP(t,e,n){var r=go(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(p2(t))g2(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Oi(l,o)){var a=e.interleaved;a===null?(i.next=i,rv(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=YC(t,e,i,r),n!==null&&(i=ur(),Ri(n,t,r,i),m2(n,e,r))}}function p2(t){var e=t.alternate;return t===fn||e!==null&&e===fn}function g2(t,e){Wu=th=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function m2(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Wy(t,n)}}var nh={readContext:ii,useCallback:Yn,useContext:Yn,useEffect:Yn,useImperativeHandle:Yn,useInsertionEffect:Yn,useLayoutEffect:Yn,useMemo:Yn,useReducer:Yn,useRef:Yn,useState:Yn,useDebugValue:Yn,useDeferredValue:Yn,useTransition:Yn,useMutableSource:Yn,useSyncExternalStore:Yn,useId:Yn,unstable_isNewReconciler:!1},xP={readContext:ii,useCallback:function(t,e){return Ui().memoizedState=[t,e===void 0?null:e],t},useContext:ii,useEffect:O1,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Td(4194308,4,a2.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Td(4194308,4,t,e)},useInsertionEffect:function(t,e){return Td(4,2,t,e)},useMemo:function(t,e){var n=Ui();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ui();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=wP.bind(null,fn,t),[r.memoizedState,t]},useRef:function(t){var e=Ui();return t={current:t},e.memoizedState=t},useState:R1,useDebugValue:dv,useDeferredValue:function(t){return Ui().memoizedState=t},useTransition:function(){var t=R1(!1),e=t[0];return t=vP.bind(null,t[1]),Ui().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=fn,i=Ui();if(un){if(n===void 0)throw Error(ae(407));n=n()}else{if(n=e(),Ln===null)throw Error(ae(349));sl&30||e2(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,O1(n2.bind(null,r,s,t),[t]),r.flags|=2048,xc(9,t2.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Ui(),e=Ln.identifierPrefix;if(un){var n=ks,r=xs;n=(r&~(1<<32-Mi(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=wc++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Ki]=e,t[mc]=r,E2(t,e,!1,!1),e.stateNode=t;e:{switch(o=Nm(n,r),n){case"dialog":tn("cancel",t),tn("close",t),i=r;break;case"iframe":case"object":case"embed":tn("load",t),i=r;break;case"video":case"audio":for(i=0;iEa&&(e.flags|=128,r=!0,pu(s,!1),e.lanes=4194304)}else{if(!r)if(t=eh(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),pu(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!un)return qn(e),null}else 2*Sn()-s.renderingStartTime>Ea&&n!==1073741824&&(e.flags|=128,r=!0,pu(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Sn(),e.sibling=null,n=cn.current,Jt(cn,r?n&1|2:n&1),e):(qn(e),null);case 22:case 23:return vv(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Pr&1073741824&&(qn(e),e.subtreeFlags&6&&(e.flags|=8192)):qn(e),null;case 24:return null;case 25:return null}throw Error(ae(156,e.tag))}function RP(t,e){switch(Jy(e),e.tag){case 1:return kr(e.type)&&Xd(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ca(),rn(xr),rn(nr),lv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return ov(e),null;case 13:if(rn(cn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ae(340));ka()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return rn(cn),null;case 4:return Ca(),null;case 10:return nv(e.type._context),null;case 22:case 23:return vv(),null;case 24:return null;default:return null}}var Ff=!1,er=!1,OP=typeof WeakSet=="function"?WeakSet:Set,Re=null;function ea(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){pn(t,e,r)}else n.current=null}function a0(t,e,n){try{n()}catch(r){pn(t,e,r)}}var j1=!1;function PP(t,e){if(Um=Wd,t=DC(),qy(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,f=t,d=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(a=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===t)break t;if(d===n&&++u===i&&(l=o),d===s&&++c===r&&(a=o),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Km={focusedElem:t,selectionRange:n},Wd=!1,Re=e;Re!==null;)if(e=Re,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Re=t;else for(;Re!==null;){e=Re;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,b=p.memoizedState,g=e.stateNode,y=g.getSnapshotBeforeUpdate(e.elementType===e.type?m:vi(e.type,m),b);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ae(163))}}catch(k){pn(e,e.return,k)}if(t=e.sibling,t!==null){t.return=e.return,Re=t;break}Re=e.return}return p=j1,j1=!1,p}function Vu(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&a0(e,n,s)}i=i.next}while(i!==r)}}function Zh(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function u0(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function R2(t){var e=t.alternate;e!==null&&(t.alternate=null,R2(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ki],delete e[mc],delete e[Ym],delete e[hP],delete e[pP])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function O2(t){return t.tag===5||t.tag===3||t.tag===4}function H1(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||O2(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function c0(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Kd));else if(r!==4&&(t=t.child,t!==null))for(c0(t,e,n),t=t.sibling;t!==null;)c0(t,e,n),t=t.sibling}function f0(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(f0(t,e,n),t=t.sibling;t!==null;)f0(t,e,n),t=t.sibling}var zn=null,wi=!1;function $s(t,e,n){for(n=n.child;n!==null;)P2(t,e,n),n=n.sibling}function P2(t,e,n){if(ts&&typeof ts.onCommitFiberUnmount=="function")try{ts.onCommitFiberUnmount(Uh,n)}catch{}switch(n.tag){case 5:er||ea(n,e);case 6:var r=zn,i=wi;zn=null,$s(t,e,n),zn=r,wi=i,zn!==null&&(wi?(t=zn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):zn.removeChild(n.stateNode));break;case 18:zn!==null&&(wi?(t=zn,n=n.stateNode,t.nodeType===8?mg(t.parentNode,n):t.nodeType===1&&mg(t,n),fc(t)):mg(zn,n.stateNode));break;case 4:r=zn,i=wi,zn=n.stateNode.containerInfo,wi=!0,$s(t,e,n),zn=r,wi=i;break;case 0:case 11:case 14:case 15:if(!er&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&a0(n,e,o),i=i.next}while(i!==r)}$s(t,e,n);break;case 1:if(!er&&(ea(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){pn(n,e,l)}$s(t,e,n);break;case 21:$s(t,e,n);break;case 22:n.mode&1?(er=(r=er)||n.memoizedState!==null,$s(t,e,n),er=r):$s(t,e,n);break;default:$s(t,e,n)}}function W1(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new OP),e.forEach(function(r){var i=$P.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function gi(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Sn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*DP(r/1960))-r,10t?16:t,io===null)var r=!1;else{if(t=io,io=null,sh=0,It&6)throw Error(ae(331));var i=It;for(It|=4,Re=t.current;Re!==null;){var s=Re,o=s.child;if(Re.flags&16){var l=s.deletions;if(l!==null){for(var a=0;aSn()-mv?Zo(t,0):gv|=n),Sr(t,e)}function z2(t,e){e===0&&(t.mode&1?(e=Mf,Mf<<=1,!(Mf&130023424)&&(Mf=4194304)):e=1);var n=ur();t=Ms(t,e),t!==null&&(Nc(t,e,n),Sr(t,n))}function zP(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),z2(t,n)}function $P(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ae(314))}r!==null&&r.delete(e),z2(t,n)}var $2;$2=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||xr.current)wr=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return wr=!1,AP(t,e,n);wr=!!(t.flags&131072)}else wr=!1,un&&e.flags&1048576&&VC(e,qd,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Ed(t,e),t=e.pendingProps;var i=xa(e,nr.current);da(e,n),i=uv(null,e,r,t,i,n);var s=cv();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,kr(r)?(s=!0,Gd(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,iv(e),i.updater=Jh,e.stateNode=i,i._reactInternals=e,t0(e,r,t,n),e=i0(null,e,r,!0,s,n)):(e.tag=0,un&&s&&Qy(e),lr(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Ed(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=HP(r),t=vi(r,t),i){case 0:e=r0(null,e,r,t,n);break e;case 1:e=B1(null,e,r,t,n);break e;case 11:e=L1(null,e,r,t,n);break e;case 14:e=F1(null,e,r,vi(r.type,t),n);break e}throw Error(ae(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:vi(r,i),r0(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:vi(r,i),B1(t,e,r,i,n);case 3:e:{if(S2(e),t===null)throw Error(ae(387));r=e.pendingProps,s=e.memoizedState,i=s.element,qC(t,e),Zd(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Ta(Error(ae(423)),e),e=z1(t,e,r,n,i);break e}else if(r!==i){i=Ta(Error(ae(424)),e),e=z1(t,e,r,n,i);break e}else for(Fr=fo(e.stateNode.containerInfo.firstChild),Br=e,un=!0,bi=null,n=GC(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ka(),r===i){e=Rs(t,e,n);break e}lr(t,e,r,n)}e=e.child}return e;case 5:return QC(e),t===null&&Jm(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Xm(r,i)?o=null:s!==null&&Xm(r,s)&&(e.flags|=32),k2(t,e),lr(t,e,o,n),e.child;case 6:return t===null&&Jm(e),null;case 13:return C2(t,e,n);case 4:return sv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Sa(e,null,r,n):lr(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:vi(r,i),L1(t,e,r,i,n);case 7:return lr(t,e,e.pendingProps,n),e.child;case 8:return lr(t,e,e.pendingProps.children,n),e.child;case 12:return lr(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Jt(Qd,r._currentValue),r._currentValue=o,s!==null)if(Oi(s.value,o)){if(s.children===i.children&&!xr.current){e=Rs(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=Cs(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Zm(s.return,n,e),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ae(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Zm(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}lr(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,da(e,n),i=ii(i),r=r(i),e.flags|=1,lr(t,e,r,n),e.child;case 14:return r=e.type,i=vi(r,e.pendingProps),i=vi(r.type,i),F1(t,e,r,i,n);case 15:return b2(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:vi(r,i),Ed(t,e),e.tag=1,kr(r)?(t=!0,Gd(e)):t=!1,da(e,n),y2(e,r,i),t0(e,r,i,n),i0(null,e,r,!0,t,n);case 19:return T2(t,e,n);case 22:return x2(t,e,n)}throw Error(ae(156,e.tag))};function j2(t,e){return pC(t,e)}function jP(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(t,e,n,r){return new jP(t,e,n,r)}function bv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function HP(t){if(typeof t=="function")return bv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===zy)return 11;if(t===$y)return 14}return 2}function mo(t,e){var n=t.alternate;return n===null?(n=qr(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Rd(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")bv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Ul:return el(n.children,i,s,e);case By:o=8,i|=8;break;case Tm:return t=qr(12,n,e,i|2),t.elementType=Tm,t.lanes=s,t;case Em:return t=qr(13,n,e,i),t.elementType=Em,t.lanes=s,t;case Am:return t=qr(19,n,e,i),t.elementType=Am,t.lanes=s,t;case QS:return tp(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case YS:o=10;break e;case qS:o=9;break e;case zy:o=11;break e;case $y:o=14;break e;case Gs:o=16,r=null;break e}throw Error(ae(130,t==null?t:typeof t,""))}return e=qr(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function el(t,e,n,r){return t=qr(7,t,r,e),t.lanes=n,t}function tp(t,e,n,r){return t=qr(22,t,r,e),t.elementType=QS,t.lanes=n,t.stateNode={isHidden:!1},t}function Cg(t,e,n){return t=qr(6,t,null,e),t.lanes=n,t}function Tg(t,e,n){return e=qr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function WP(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sg(0),this.expirationTimes=sg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function xv(t,e,n,r,i,s,o,l,a){return t=new WP(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=qr(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},iv(s),t}function VP(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U2)}catch(t){console.error(t)}}U2(),US.exports=$r;var YP=US.exports,K2,Q1=YP;K2=Q1.createRoot,Q1.hydrateRoot;function X2(){return""}function qP(){return/^G-[A-Z0-9]+$/.test(X2())}function QP(){const t=window.gtag;typeof t=="function"&&qP()&&t("config",X2(),{send_page_view:!1})}function JP(){var t,e;(t=window.gtag)==null||t.call(window,"event","page_view",{page_path:window.location.pathname,page_location:window.location.href}),(e=window.plausible)==null||e.call(window,"pageview")}function ZP(){var t,e;(t=window.gtag)==null||t.call(window,"event","permalink_view"),(e=window.plausible)==null||e.call(window,"Permalink View")}function eI(){var t,e;(t=window.gtag)==null||t.call(window,"event","changelog_open"),(e=window.plausible)==null||e.call(window,"Changelog Open")}function tI(t){var e,n;(e=window.gtag)==null||e.call(window,"event","changelog_vote",{...t}),(n=window.plausible)==null||n.call(window,"Changelog Vote",{props:{...t}})}function nI(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Tv(t,e){var n,r;(n=window.gtag)==null||n.call(window,"event",t,{...e}),(r=window.plausible)==null||r.call(window,nI(t),{props:{...e}})}function rI(t){Tv("conversion",t)}function $f(t){Tv("export",t)}function iI(t){Tv("feedback",t)}function sI(t){return new TextEncoder().encode(t).length}function oI(t){return t<10*1024?"<10KB":t<100*1024?"10-100KB":t<1024*1024?"100KB-1MB":">1MB"}function lI(t){let e=2166136261;for(let n=0;n>>0).toString(36)}function aI(t={}){const e=t.settleMs??2e3,n=t.minWindowMs??2e3,r=t.now??(()=>Date.now()),i=t.isValid??(()=>!0);let s=null,o,l=null,a=0;function u(f){if(f.text.trim()==="")return!1;const d=sI(f.text),h=`${f.direction}:${f.input}:${d}:${lI(f.text)}`;if(h===l||!i(f.direction,f.text))return!1;const p=r();return p-a{o=void 0,s&&u(s)},e)}return{edit(f,d){s={direction:f,input:"paste",text:d},c()},discrete(f,d,h){s={direction:f,input:d,text:h},c(),u(s)},cancel(){s=null,l=null,o&&(clearTimeout(o),o=void 0)}}}/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G2=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uI=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cI=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J1=t=>{const e=cI(t);return e.charAt(0).toUpperCase()+e.slice(1)};/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var Eg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fI=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},dI=v.createContext({}),hI=()=>v.useContext(dI),pI=v.forwardRef(({color:t,size:e,strokeWidth:n,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...l},a)=>{const{size:u=24,strokeWidth:c=2,absoluteStrokeWidth:f=!1,color:d="currentColor",className:h=""}=hI()??{},p=r??f?Number(n??c)*24/Number(e??u):n??c;return v.createElement("svg",{ref:a,...Eg,width:e??u??Eg.width,height:e??u??Eg.height,stroke:t??d,strokeWidth:p,className:G2("lucide",h,i),...!s&&!fI(l)&&{"aria-hidden":"true"},...l},[...o.map(([m,b])=>v.createElement(m,b)),...Array.isArray(s)?s:[s]])});/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _n=(t,e)=>{const n=v.forwardRef(({className:r,...i},s)=>v.createElement(pI,{ref:s,iconNode:e,className:G2(`lucide-${uI(J1(t))}`,`lucide-${t}`,r),...i}));return n.displayName=J1(t),n};/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gI=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],mI=_n("arrow-left-right",gI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yI=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],Z1=_n("braces",yI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vI=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],wI=_n("clipboard",vI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bI=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ev=_n("copy",bI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xI=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Y2=_n("download",xI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kI=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],q2=_n("file-up",kI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SI=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],CI=_n("moon",SI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TI=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],EI=_n("redo-2",TI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],MI=_n("rotate-ccw-clock",AI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],eb=_n("rotate-ccw",RI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],PI=_n("search",OI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const II=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],DI=_n("sparkles",II);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _I=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],NI=_n("sun",_I);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LI=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],FI=_n("table",LI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BI=[["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}],["path",{d:"M17 14V2",key:"8ymqnk"}]],zI=_n("thumbs-down",BI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $I=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],jI=_n("thumbs-up",$I);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HI=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],m0=_n("trash",HI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WI=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],VI=_n("undo-2",WI);/** + * @license lucide-react v1.41.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Q2=_n("x",UI);function J2(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=YI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const l=o.split(Av);return l[0]===""&&l.length!==1&&l.shift(),Z2(l,e)||GI(o)},getConflictingClassGroupIds:(o,l)=>{const a=n[o]||[];return l&&r[o]?[...a,...r[o]]:a}}},Z2=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?Z2(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Av);return(o=e.validators.find(({validator:l})=>l(s)))==null?void 0:o.classGroupId},tb=/^\[(.+)\]$/,GI=t=>{if(tb.test(t)){const e=tb.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},YI=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return QI(Object.entries(t.classGroups),n).forEach(([s,o])=>{y0(o,r,s,e)}),r},y0=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:nb(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(qI(i)){y0(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{y0(o,nb(e,s),n,r)})})},nb=(t,e)=>{let n=t;return e.split(Av).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},qI=t=>t.isThemeGetter,QI=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[e+o,l])):s);return[n,i]}):t,JI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},eT="!",ZI=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=l=>{const a=[];let u=0,c=0,f;for(let b=0;bc?f-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:o}):o},eD=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},tD=t=>({cache:JI(t.cacheSize),parseClassName:ZI(t),...XI(t)}),nD=/\s+/,rD=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(nD);let l="";for(let a=o.length-1;a>=0;a-=1){const u=o[a],{modifiers:c,hasImportantModifier:f,baseClassName:d,maybePostfixModifierPosition:h}=n(u);let p=!!h,m=r(p?d.substring(0,h):d);if(!m){if(!p){l=u+(l.length>0?" "+l:l);continue}if(m=r(d),!m){l=u+(l.length>0?" "+l:l);continue}p=!1}const b=eD(c).join(":"),g=f?b+eT:b,y=g+m;if(s.includes(y))continue;s.push(y);const w=i(m,p);for(let k=0;k0?" "+l:l)}return l};function iD(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(c),t());return n=tD(u),r=n.cache.get,i=n.cache.set,s=l,l(a)}function l(a){const u=r(a);if(u)return u;const c=rD(a,n);return i(a,c),c}return function(){return s(iD.apply(null,arguments))}}const en=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},nT=/^\[(?:([a-z-]+):)?(.+)\]$/i,oD=/^\d+\/\d+$/,lD=new Set(["px","full","screen"]),aD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uD=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hs=t=>pa(t)||lD.has(t)||oD.test(t),js=t=>ja(t,"length",bD),pa=t=>!!t&&!Number.isNaN(Number(t)),Ag=t=>ja(t,"number",pa),mu=t=>!!t&&Number.isInteger(Number(t)),hD=t=>t.endsWith("%")&&pa(t.slice(0,-1)),gt=t=>nT.test(t),Hs=t=>aD.test(t),pD=new Set(["length","size","percentage"]),gD=t=>ja(t,pD,rT),mD=t=>ja(t,"position",rT),yD=new Set(["image","url"]),vD=t=>ja(t,yD,kD),wD=t=>ja(t,"",xD),yu=()=>!0,ja=(t,e,n)=>{const r=nT.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},bD=t=>uD.test(t)&&!cD.test(t),rT=()=>!1,xD=t=>fD.test(t),kD=t=>dD.test(t),SD=()=>{const t=en("colors"),e=en("spacing"),n=en("blur"),r=en("brightness"),i=en("borderColor"),s=en("borderRadius"),o=en("borderSpacing"),l=en("borderWidth"),a=en("contrast"),u=en("grayscale"),c=en("hueRotate"),f=en("invert"),d=en("gap"),h=en("gradientColorStops"),p=en("gradientColorStopPositions"),m=en("inset"),b=en("margin"),g=en("opacity"),y=en("padding"),w=en("saturate"),k=en("scale"),x=en("sepia"),S=en("skew"),T=en("space"),E=en("translate"),A=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto",gt,e],P=()=>[gt,e],N=()=>["",hs,js],D=()=>["auto",pa,gt],ee=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ne=()=>["solid","dashed","dotted","double","none"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",gt],R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],O=()=>[pa,gt];return{cacheSize:500,separator:":",theme:{colors:[yu],spacing:[hs,js],blur:["none","",Hs,gt],brightness:O(),borderColor:[t],borderRadius:["none","","full",Hs,gt],borderSpacing:P(),borderWidth:N(),contrast:O(),grayscale:Y(),hueRotate:O(),invert:Y(),gap:P(),gradientColorStops:[t],gradientColorStopPositions:[hD,js],inset:_(),margin:_(),opacity:O(),padding:P(),saturate:O(),scale:O(),sepia:Y(),skew:O(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",gt]}],container:["container"],columns:[{columns:[Hs]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ee(),gt]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",mu,gt]}],basis:[{basis:_()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",gt]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",mu,gt]}],"grid-cols":[{"grid-cols":[yu]}],"col-start-end":[{col:["auto",{span:["full",mu,gt]},gt]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[yu]}],"row-start-end":[{row:["auto",{span:[mu,gt]},gt]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",gt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",gt]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",gt,e]}],"min-w":[{"min-w":[gt,e,"min","max","fit"]}],"max-w":[{"max-w":[gt,e,"none","full","min","max","fit","prose",{screen:[Hs]},Hs]}],h:[{h:[gt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[gt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[gt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[gt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Hs,js]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ag]}],"font-family":[{font:[yu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",gt]}],"line-clamp":[{"line-clamp":["none",pa,Ag]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",hs,gt]}],"list-image":[{"list-image":["none",gt]}],"list-style-type":[{list:["none","disc","decimal",gt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",hs,js]}],"underline-offset":[{"underline-offset":["auto",hs,gt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",gt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ee(),mD]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",gD]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},vD]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...ne(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:ne()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ne()]}],"outline-offset":[{"outline-offset":[hs,gt]}],"outline-w":[{outline:[hs,js]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[hs,js]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Hs,wD]}],"shadow-color":[{shadow:[yu]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...ie(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ie()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",Hs,gt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",gt]}],duration:[{duration:O()}],ease:[{ease:["linear","in","out","in-out",gt]}],delay:[{delay:O()}],animate:[{animate:["none","spin","ping","pulse","bounce",gt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[mu,gt]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",gt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",gt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[hs,js,Ag]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},CD=sD(SD);function Ci(...t){return CD(KI(t))}function Mg(t){return t==="csv2json"?"CSV → JSON":"JSON → CSV"}function TD({flipped:t}){return M.jsx(mI,{size:18,strokeWidth:2,"aria-hidden":"true",className:Ci("transition-transform duration-300",t&&"rotate-180")})}function ED({direction:t,onFlip:e}){return M.jsxs("button",{type:"button","data-testid":"divider-switch",onClick:e,onMouseDown:n=>n.stopPropagation(),onDoubleClick:n=>n.stopPropagation(),title:`Switch direction (currently ${Mg(t)})`,"aria-label":`Switch conversion direction (currently ${Mg(t)})`,className:"flex h-9 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-background px-3 text-xs font-medium text-muted-foreground shadow-sm transition-colors hover:border-muted-foreground/50 hover:text-foreground",children:[M.jsx(TD,{flipped:t==="json2csv"}),M.jsx("span",{"data-testid":"divider-switch-label",children:Mg(t)})]})}const iT=[{question:"How does it work?",answer:"Paste CSV or JSON into the left pane and the conversion runs as you type — no upload, no submit button. Flip the direction with the switch between the panes to convert JSON back to CSV, then copy the result or download it as a file. The converter understands quoted fields, embedded separators, and Unicode."},{question:"What do the options do?",answer:"Separator picks the delimiter — auto-detect covers comma, semicolon, and tab. Parse numbers is on by default with smart semantics — plain numbers like 5 or 19.99 become real JSON numbers, while leading-zero values like 00721 and very long IDs stay strings; uncheck it to keep numeric cells as strings — booleans, null, and containers still convert while Parse JSON is on. Parse JSON converts null, true, false, [] and {} cells into real JSON values instead of strings. Transpose flips rows and columns; Hash output makes the first column the object key; Minify removes indentation from JSON output. On the JSON to CSV side, Flatten explodes nested arrays into extra rows with dotted keys."},{question:"TSV vs CSV — what changes?",answer:"Only the delimiter: TSV separates cells with tabs, CSV with commas. Anything you can paste from Excel or Google Sheets is tab-separated, and auto-detect picks that up — or choose Tab in the separator menu. Quoting rules only apply to comma and semicolon output; TSV rarely needs them."},{question:"Does my data ever leave the browser?",answer:"No. The conversion runs entirely in your browser — nothing is uploaded, nothing is stored, nothing is logged. Files you open are read locally in the page, there is no account and no server processing. The site's analytics never see your data: Plausible counts visits cookieless, and the Google tag is a standard conversion-measurement tag that uses the page URL, referrer, and a first-party conversion cookie to measure ad performance. Your files and converted output never leave the browser. When you send feedback, we store your vote and anything you choose to write — nothing else."}],AD={"@context":"https://schema.org","@type":"FAQPage",mainEntity:iT.map(t=>({"@type":"Question",name:t.question,acceptedAnswer:{"@type":"Answer",text:t.answer}}))};function MD(){const[t,e]=v.useState(!1),n=v.useId();return M.jsxs("section",{"data-testid":"faq","aria-label":"How it works and frequently asked questions",className:"flex-shrink-0 border-t border-border bg-panel px-4",children:[M.jsxs("button",{type:"button","data-testid":"faq-toggle","aria-expanded":t,"aria-controls":n,onClick:()=>e(r=>!r),className:"flex w-full cursor-pointer items-center gap-1.5 py-2 text-[12.5px] text-muted-foreground hover:text-foreground",children:[M.jsx("span",{"aria-hidden":"true",className:"w-3 text-center",children:t?"▾":"▸"}),"How it works & FAQ"]}),M.jsx("div",{id:n,"data-testid":"faq-content",hidden:!t,className:"max-w-3xl pb-4 text-[13px] leading-relaxed text-muted-foreground",children:iT.map(r=>M.jsxs("div",{className:"mb-3 last:mb-0",children:[M.jsx("h2",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[0.1em] text-foreground",children:r.question}),M.jsx("p",{children:r.answer})]},r.question))}),M.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(AD)}})]})}const RD="https://github.com/FlatFilers/csvjson-app/discussions/163";function OD(){return M.jsx("div",{"data-testid":"feedback-banner",className:"flex flex-shrink-0 items-center justify-center border-b border-border bg-muted px-4 py-1.5 text-sm text-muted-foreground",children:M.jsxs("p",{className:"text-center",children:["Enjoy a cleaner, simpler CSVJSON."," ",M.jsx("a",{"data-testid":"feedback-link",href:RD,target:"_blank",rel:"noopener noreferrer",className:"rounded-sm font-medium text-foreground underline decoration-border underline-offset-2 transition-colors hover:decoration-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:"Leave feedback or ask for features here"}),"."]})})}const sT="csvjson:feedback.v1",PD=[{value:"wrong_output",label:"The conversion is wrong"},{value:"hard_to_use",label:"Hard to use"},{value:"missing_feature",label:"Missing a feature"},{value:"slower",label:"Slower than the old site"},{value:"looks_worse",label:"Looks worse"},{value:"other",label:"Other"}];function ID(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.clientId=="string"&&e.clientId.length<=64&&(e.vote===1||e.vote===-1)&&(typeof e.reasonCode=="string"||e.reasonCode===null)&&(typeof e.reasonText=="string"||e.reasonText===null)&&typeof e.pending=="boolean"}function rb(){try{const t=window.localStorage.getItem(sT);if(t===null)return null;const e=JSON.parse(t);return ID(e)?e:null}catch{return null}}function ib(t){try{window.localStorage.setItem(sT,JSON.stringify(t))}catch{}}function sb(){var n,r,i;if(typeof((n=globalThis.crypto)==null?void 0:n.randomUUID)=="function")return globalThis.crypto.randomUUID();const t=(i=(r=globalThis.crypto)==null?void 0:r.getRandomValues)==null?void 0:i.call(r,new Uint8Array(16));if(t===void 0)throw new Error("no secure randomness available");t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function DD(t){const e=window.location.pathname;return t.vote===1?{clientId:t.clientId,vote:1,path:e}:{clientId:t.clientId,vote:-1,reasonCode:t.reasonCode,reasonText:t.reasonText,path:e}}async function _D(t){try{return(await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(DD(t))})).ok?"ok":"failed"}catch{return"failed"}}function ob(t){return["flex h-7 w-7 cursor-pointer items-center justify-center rounded-md transition-colors",t?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" ")}function ND(){const[t,e]=v.useState(rb),[n,r]=v.useState(!1),[i,s]=v.useState(null),[o,l]=v.useState(""),[a,u]=v.useState(!1),[c,f]=v.useState(!1),d=v.useRef(null),h=v.useRef(0),p=v.useCallback((x,S)=>{const T={...x,pending:S==="failed"};ib(T),e(T),S==="ok"?iI({vote:x.vote,with_reason:x.reasonCode!==null}):u(!1)},[]),m=v.useCallback((x,S)=>{const T=++h.current;S&&f(!0),_D(x).then(E=>{h.current===T&&(p(x,E),E==="ok"&&u(!0))}).finally(()=>{S&&h.current===T&&f(!1)})},[p]),b=x=>{const S={...x,pending:!0};ib(S),e(S),m(S,!0)},g=v.useRef(!1);v.useEffect(()=>{if(g.current)return;g.current=!0;const x=rb();x!=null&&x.pending&&m(x,!1)},[m]),v.useEffect(()=>{if(!a)return;const x=setTimeout(()=>u(!1),3e3);return()=>clearTimeout(x)},[a]),v.useEffect(()=>{if(!n)return;const x=T=>{T.key==="Escape"&&r(!1)},S=T=>{const E=d.current;E===null||!(T.target instanceof Node)||E.contains(T.target)||r(!1)};return document.addEventListener("keydown",x),document.addEventListener("mousedown",S),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",S)}},[n]);const y=()=>{if((t==null?void 0:t.vote)===1&&!t.pending){u(!0);return}b({clientId:(t==null?void 0:t.clientId)??sb(),vote:1,reasonCode:null,reasonText:null})},w=()=>{if(n){r(!1);return}s(null),l(""),r(!0)},k=()=>{if(i===null)return;const x=o.trim();b({clientId:(t==null?void 0:t.clientId)??sb(),vote:-1,reasonCode:i,reasonText:x===""?null:x}),r(!1)};return M.jsxs("div",{"data-testid":"feedback-vote",ref:d,className:"relative flex items-center gap-1",children:[M.jsx("button",{type:"button","data-testid":"feedback-up",onClick:y,"aria-pressed":(t==null?void 0:t.vote)===1,"aria-label":"Helpful — send an upvote",title:"Helpful",className:ob((t==null?void 0:t.vote)===1),children:M.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[M.jsx("path",{d:"M7 10v12"}),M.jsx("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]})}),M.jsx("button",{type:"button","data-testid":"feedback-down",onClick:w,"aria-pressed":(t==null?void 0:t.vote)===-1,"aria-haspopup":"dialog","aria-expanded":n,"aria-label":"Not helpful — send a downvote",title:"Not helpful",className:ob((t==null?void 0:t.vote)===-1),children:M.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[M.jsx("path",{d:"M17 14V2"}),M.jsx("path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"})]})}),a&&M.jsx("span",{"data-testid":"feedback-thanks",className:"text-xs text-muted-foreground",children:"Thanks for the feedback!"}),(t==null?void 0:t.pending)&&!c&&M.jsx("span",{"data-testid":"feedback-pending",role:"status",className:"max-w-44 text-right text-xs text-muted-foreground sm:max-w-none",children:"Feedback couldn't send — your vote is kept on this device and will send automatically once the service is back."}),n&&M.jsxs("div",{"data-testid":"feedback-popover",role:"dialog","aria-label":"What went wrong?",className:"absolute right-0 top-9 z-50 w-72 rounded-md border border-border bg-panel p-3 shadow-md",children:[M.jsx("p",{className:"mb-2 text-xs font-medium text-foreground",children:"What went wrong?"}),M.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:PD.map(x=>M.jsx("button",{type:"button","data-testid":`feedback-reason-${x.value}`,"aria-pressed":i===x.value,onClick:()=>s(x.value),className:["cursor-pointer rounded-sm border px-2 py-0.5 text-xs transition-colors",i===x.value?"border-foreground bg-foreground text-panel":"border-border text-muted-foreground hover:border-foreground hover:text-foreground"].join(" "),children:x.label},x.value))}),M.jsx("textarea",{"data-testid":"feedback-text",value:o,maxLength:500,rows:2,onChange:x=>l(x.target.value),placeholder:"Anything more? (optional)",className:"mb-2 w-full resize-none rounded-sm border border-border bg-panel px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/60 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"}),M.jsxs("div",{className:"flex items-center justify-end gap-2",children:[M.jsxs("span",{className:"text-[10px] text-muted-foreground/70",children:[o.length,"/500"]}),M.jsx("button",{type:"button","data-testid":"feedback-submit",onClick:k,disabled:i===null,className:"cursor-pointer rounded-sm border border-border px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:"Send"})]})]})]})}function oT(t="This should not happen"){throw new Error(t)}function _r(t,e="Assertion failed"){if(!t)return oT(e)}function Sc(t,e){return oT(e??"Hell froze over")}function LD(t,e){try{return t()}catch{return e}}const lb=Object.prototype.hasOwnProperty;function Aa(t,e){let n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Aa(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(lb.call(t,n)&&++r&&!lb.call(e,n)||!(n in e)||!Aa(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var FD=Object.prototype,BD=FD.hasOwnProperty;function zD(t,e){return t!=null&&BD.call(t,e)}var $D=zD,jD=Array.isArray,os=jD,HD=typeof no=="object"&&no&&no.Object===Object&&no,lT=HD,WD=lT,VD=typeof self=="object"&&self&&self.Object===Object&&self,UD=WD||VD||Function("return this")(),ls=UD,KD=ls,XD=KD.Symbol,zc=XD,ab=zc,aT=Object.prototype,GD=aT.hasOwnProperty,YD=aT.toString,vu=ab?ab.toStringTag:void 0;function qD(t){var e=GD.call(t,vu),n=t[vu];try{t[vu]=void 0;var r=!0}catch{}var i=YD.call(t);return r&&(e?t[vu]=n:delete t[vu]),i}var QD=qD,JD=Object.prototype,ZD=JD.toString;function e_(t){return ZD.call(t)}var t_=e_,ub=zc,n_=QD,r_=t_,i_="[object Null]",s_="[object Undefined]",cb=ub?ub.toStringTag:void 0;function o_(t){return t==null?t===void 0?s_:i_:cb&&cb in Object(t)?n_(t):r_(t)}var $c=o_;function l_(t){return t!=null&&typeof t=="object"}var jc=l_,a_=$c,u_=jc,c_="[object Symbol]";function f_(t){return typeof t=="symbol"||u_(t)&&a_(t)==c_}var op=f_,d_=os,h_=op,p_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,g_=/^\w*$/;function m_(t,e){if(d_(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||h_(t)?!0:g_.test(t)||!p_.test(t)||e!=null&&t in Object(e)}var Mv=m_;function y_(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var gl=y_,v_=$c,w_=gl,b_="[object AsyncFunction]",x_="[object Function]",k_="[object GeneratorFunction]",S_="[object Proxy]";function C_(t){if(!w_(t))return!1;var e=v_(t);return e==x_||e==k_||e==b_||e==S_}var uT=C_,T_=ls,E_=T_["__core-js_shared__"],A_=E_,Rg=A_,fb=function(){var t=/[^.]+$/.exec(Rg&&Rg.keys&&Rg.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function M_(t){return!!fb&&fb in t}var R_=M_,O_=Function.prototype,P_=O_.toString;function I_(t){if(t!=null){try{return P_.call(t)}catch{}try{return t+""}catch{}}return""}var cT=I_,D_=uT,__=R_,N_=gl,L_=cT,F_=/[\\^$.*+?()[\]{}|]/g,B_=/^\[object .+?Constructor\]$/,z_=Function.prototype,$_=Object.prototype,j_=z_.toString,H_=$_.hasOwnProperty,W_=RegExp("^"+j_.call(H_).replace(F_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function V_(t){if(!N_(t)||__(t))return!1;var e=D_(t)?W_:B_;return e.test(L_(t))}var U_=V_;function K_(t,e){return t==null?void 0:t[e]}var X_=K_,G_=U_,Y_=X_;function q_(t,e){var n=Y_(t,e);return G_(n)?n:void 0}var ml=q_,Q_=ml,J_=Q_(Object,"create"),lp=J_,db=lp;function Z_(){this.__data__=db?db(null):{},this.size=0}var eN=Z_;function tN(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var nN=tN,rN=lp,iN="__lodash_hash_undefined__",sN=Object.prototype,oN=sN.hasOwnProperty;function lN(t){var e=this.__data__;if(rN){var n=e[t];return n===iN?void 0:n}return oN.call(e,t)?e[t]:void 0}var aN=lN,uN=lp,cN=Object.prototype,fN=cN.hasOwnProperty;function dN(t){var e=this.__data__;return uN?e[t]!==void 0:fN.call(e,t)}var hN=dN,pN=lp,gN="__lodash_hash_undefined__";function mN(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=pN&&e===void 0?gN:e,this}var yN=mN,vN=eN,wN=nN,bN=aN,xN=hN,kN=yN;function Ha(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var zN=BN,$N=ap;function jN(t,e){var n=this.__data__,r=$N(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var HN=jN,WN=TN,VN=DN,UN=LN,KN=zN,XN=HN;function Wa(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=s3}var Nv=o3,l3=op;function a3(t){if(typeof t=="string"||l3(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var fp=a3,u3=hT,c3=Dv,f3=os,d3=_v,h3=Nv,p3=fp;function g3(t,e,n){e=u3(e,t);for(var r=-1,i=e.length,s=!1;++r[r[0]+e,r[1]+e]);return new gs(n)}add(e){const n=typeof e=="number"?[e,e+1]:e,r=k3([...this.items,n]);return new gs(r)}remove(e){const n=[...this.items],r=typeof e=="number"?e:e[0],i=typeof e=="number"?e+1:e[1];for(const[s,o]of n.entries()){const[l,a]=o;if(l<=i&&r<=a){const u=[];l=r&&ebb??(bb=new gs([]))),bt(gs,"fromSingleSelection",e=>gs.empty().add(e));let Ot=gs;function S3(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var C3=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Og=S3(function(t){return C3.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),T3=function(){const e=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];e.forEach(s=>{(s?s.split(" "):[]).forEach(l=>{if(l.startsWith("atm_")){const[,a]=l.split("_");n[a]=l}else r.push(l)})});const i=[];for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(n[s]);return i.push(...r),i.join(" ")},xb=T3,E3=t=>t.toUpperCase()===t,A3=t=>e=>t.indexOf(e)===-1,mT=(t,e)=>{const n={};return Object.keys(t).filter(A3(e)).forEach(r=>{n[r]=t[r]}),n};function M3(t,e,n){const r=mT(e,n);if(!t){const i=typeof Og=="function"?{default:Og}:Og;Object.keys(r).forEach(s=>{i.default(s)||delete r[s]})}return r}var R3=(t,e)=>{};function O3(t){let e="";return n=>{const r=(s,o)=>{const{as:l=t,class:a=e}=s,u=n.propsAsIs===void 0?!(typeof l=="string"&&l.indexOf("-")===-1&&!E3(l[0])):n.propsAsIs,c=M3(u,s,["as","class"]);c.ref=o,c.className=n.atomic?xb(n.class,c.className||a):xb(c.className||a,n.class);const{vars:f}=n;if(f){const d={};for(const m in f){const b=f[m],g=b[0],y=b[1]||"",w=typeof g=="function"?g(s):g;R3(w,n.name),d[`--${m}`]=`${w}${y}`}const h=c.style||{},p=Object.keys(h);p.length>0&&p.forEach(m=>{d[m]=h[m]}),c.style=d}return t.__linaria&&t!==l?(c.as=l,Pn.createElement(t,c)):Pn.createElement(l,c)},i=Pn.forwardRef?Pn.forwardRef(r):s=>{const o=mT(s,["innerRef"]);return r(o,s.innerRef)};return i.displayName=n.name,i.__linaria={className:n.class||e,extends:t},i}}var Hr=O3;const P3=Hr("div")({name:"ImageOverlayEditorStyle",class:"gdg-i2iowwq",propsAsIs:!1});var yT={},dp={},Fv={},Pg={},Ig={exports:{}},Dg,kb;function I3(){if(kb)return Dg;kb=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Dg=t,Dg}var _g,Sb;function D3(){if(Sb)return _g;Sb=1;var t=I3();function e(){}function n(){}return n.resetWarningCache=e,_g=function(){function r(o,l,a,u,c,f){if(f!==t){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:e};return s.PropTypes=s,s},_g}var Cb;function _3(){return Cb||(Cb=1,Ig.exports=D3()()),Ig.exports}var Tb;function N3(){return Tb||(Tb=1,function(t){(function(e,n){n(t,v,_3())})(no,function(e,n,r){Object.defineProperty(e,"__esModule",{value:!0}),e.setHasSupportToCaptureOption=p;var i=o(n),s=o(r);function o(y){return y&&y.__esModule?y:{default:y}}var l=Object.assign||function(y){for(var w=1;w=0||Object.prototype.hasOwnProperty.call(y,x)&&(k[x]=y[x]);return k}function u(y,w){if(!(y instanceof w))throw new TypeError("Cannot call a class as a function")}var c=function(){function y(w,k){for(var x=0;x0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return h?y:y.capture}function b(y){if("touches"in y){var w=y.touches[0],k=w.pageX,x=w.pageY;return{x:k,y:x}}var S=y.screenX,T=y.screenY;return{x:S,y:T}}var g=function(y){d(w,y);function w(){var k;u(this,w);for(var x=arguments.length,S=Array(x),T=0;TS&&this.props.onSwipeRight(1,x),this.movePosition.deltaY<-S?this.props.onSwipeUp(1,x):this.movePosition.deltaY>S&&this.props.onSwipeDown(1,x)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(x){this.swiper=x,this.props.innerRef(x)}},{key:"render",value:function(){var x=this.props;x.tagName;var S=x.className,T=x.style,E=x.children;x.allowMouseEvents,x.onSwipeUp,x.onSwipeDown,x.onSwipeLeft,x.onSwipeRight,x.onSwipeStart,x.onSwipeMove,x.onSwipeEnd,x.innerRef,x.tolerance;var A=a(x,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return i.default.createElement(this.props.tagName,l({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:S,style:T},A),E)}}]),w}(n.Component);g.displayName="ReactSwipe",g.propTypes={tagName:s.default.string,className:s.default.string,style:s.default.object,children:s.default.node,allowMouseEvents:s.default.bool,onSwipeUp:s.default.func,onSwipeDown:s.default.func,onSwipeLeft:s.default.func,onSwipeRight:s.default.func,onSwipeStart:s.default.func,onSwipeMove:s.default.func,onSwipeEnd:s.default.func,innerRef:s.default.func,tolerance:s.default.number.isRequired},g.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},e.default=g})}(Pg)),Pg}(function(t){(function(e,n){n(t,N3())})(no,function(e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=i(n);function i(s){return s&&s.__esModule?s:{default:s}}e.default=r.default})})(Fv);var Hc={},vT={exports:{}};/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var s="",o=0;o"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function ch(t){return ch=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},ch(t)}function Qn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Z3=function(e){return e.hasOwnProperty("key")},Bv=function(t){Y3(n,t);var e=q3(n);function n(r){var i;return K3(this,n),i=e.call(this,r),Qn(or(i),"itemsWrapperRef",void 0),Qn(or(i),"itemsListRef",void 0),Qn(or(i),"thumbsRef",void 0),Qn(or(i),"setItemsWrapperRef",function(s){i.itemsWrapperRef=s}),Qn(or(i),"setItemsListRef",function(s){i.itemsListRef=s}),Qn(or(i),"setThumbsRef",function(s,o){i.thumbsRef||(i.thumbsRef=[]),i.thumbsRef[o]=s}),Qn(or(i),"updateSizes",function(){if(!(!i.props.children||!i.itemsWrapperRef||!i.thumbsRef)){var s=mi.Children.count(i.props.children),o=i.itemsWrapperRef.clientWidth,l=i.props.thumbWidth?i.props.thumbWidth:(0,W3.outerWidth)(i.thumbsRef[0]),a=Math.floor(o/l),u=a0&&(o=0),u===f&&o<0&&(o=0);var d=i.itemsWrapperRef.clientWidth,h=u+100/(d/o);return i.itemsListRef&&["WebkitTransform","MozTransform","MsTransform","OTransform","transform","msTransform"].forEach(function(p){i.itemsListRef.style[p]=(0,Eb.default)(h,"%",i.props.axis)}),!0}),Qn(or(i),"slideRight",function(s){i.moveTo(i.state.firstItem-(typeof s=="number"?s:1))}),Qn(or(i),"slideLeft",function(s){i.moveTo(i.state.firstItem+(typeof s=="number"?s:1))}),Qn(or(i),"moveTo",function(s){s=s<0?0:s,s=s>=i.state.lastPosition?i.state.lastPosition:s,i.setState({firstItem:s})}),i.state={selectedItem:r.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},i}return G3(n,[{key:"componentDidMount",value:function(){this.setupThumbs()}},{key:"componentDidUpdate",value:function(i){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==i.children&&this.updateSizes()}},{key:"componentWillUnmount",value:function(){this.destroyThumbs()}},{key:"setupThumbs",value:function(){(0,Hf.default)().addEventListener("resize",this.updateSizes),(0,Hf.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.updateSizes()}},{key:"destroyThumbs",value:function(){(0,Hf.default)().removeEventListener("resize",this.updateSizes),(0,Hf.default)().removeEventListener("DOMContentLoaded",this.updateSizes)}},{key:"getFirstItem",value:function(i){var s=i;return i>=this.state.lastPosition&&(s=this.state.lastPosition),i1,o=this.state.showArrows&&this.state.firstItem>0,l=this.state.showArrows&&this.state.firstItemo);if(l)return s<0?e.centerMode&&e.centerSlidePercentage&&e.axis==="horizontal"?r.itemListStyle=(0,Qi.setPosition)(-(o+2)*e.centerSlidePercentage-(100-e.centerSlidePercentage)/2,e.axis):r.itemListStyle=(0,Qi.setPosition)(-(o+2)*100,e.axis):s>o&&(r.itemListStyle=(0,Qi.setPosition)(0,e.axis)),r;var a=(0,Qi.getPosition)(i,e),u=(0,uF.default)(a,"%",e.axis),c=e.transitionTime+"ms";return r.itemListStyle={WebkitTransform:u,msTransform:u,OTransform:u,transform:u},n.swiping||(r.itemListStyle=Vo(Vo({},r.itemListStyle),{},{WebkitTransitionDuration:c,MozTransitionDuration:c,OTransitionDuration:c,transitionDuration:c,msTransitionDuration:c})),r};qi.slideAnimationHandler=dF;var hF=function(e,n,r,i){var s={},o=n.axis==="horizontal",l=bT.Children.count(n.children),a=0,u=(0,Qi.getPosition)(r.selectedItem,n),c=n.infiniteLoop?(0,Qi.getPosition)(l-1,n)-100:(0,Qi.getPosition)(l-1,n),f=o?e.x:e.y,d=f;u===a&&f>0&&(d=0),u===c&&f<0&&(d=0);var h=u+100/(r.itemSize/d),p=Math.abs(f)>n.swipeScrollTolerance;return n.infiniteLoop&&p&&(r.selectedItem===0&&h>-100?h-=l*100:r.selectedItem===l-1&&h<-l*100&&(h+=l*100)),(!n.preventMovementUntilSwipeScrollTolerance||p||r.swipeMovementStarted)&&(r.swipeMovementStarted||i({swipeMovementStarted:!0}),s.itemListStyle=(0,Qi.setPosition)(h,n.axis)),p&&!r.cancelClick&&i({cancelClick:!0}),s};qi.slideSwipeAnimationHandler=hF;var pF=function(e,n){var r=(0,Qi.getPosition)(n.selectedItem,e),i=(0,Qi.setPosition)(r,e.axis);return{itemListStyle:i}};qi.slideStopSwipingHandler=pF;var gF=function(e,n){var r=e.transitionTime+"ms",i="ease-in-out",s={position:"absolute",display:"block",zIndex:-2,minHeight:"100%",opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:i,msTransitionTimingFunction:i,MozTransitionTimingFunction:i,WebkitTransitionTimingFunction:i,OTransitionTimingFunction:i};return n.swiping||(s=Vo(Vo({},s),{},{WebkitTransitionDuration:r,MozTransitionDuration:r,OTransitionDuration:r,transitionDuration:r,msTransitionDuration:r})),{slideStyle:s,selectedStyle:Vo(Vo({},s),{},{opacity:1,position:"relative"}),prevStyle:Vo({},s)}};qi.fadeAnimationHandler=gF;Object.defineProperty(dp,"__esModule",{value:!0});dp.default=void 0;var zt=vF(v),mF=Uc(Fv),ys=Uc(Hc),yF=Uc(Wc),Wf=Uc(gp),Vf=Uc(Vc),Nu=Lr,fh=qi;function Uc(t){return t&&t.__esModule?t:{default:t}}function xT(){if(typeof WeakMap!="function")return null;var t=new WeakMap;return xT=function(){return t},t}function vF(t){if(t&&t.__esModule)return t;if(t===null||Gu(t)!=="object"&&typeof t!="function")return{default:t};var e=xT();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=r?Object.getOwnPropertyDescriptor(t,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=t[i]}return n.default=t,e&&e.set(t,n),n}function Gu(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Gu=function(n){return typeof n}:Gu=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Gu(t)}function x0(){return x0=Object.assign||function(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function dh(t){return dh=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},dh(t)}function xt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var zv=function(t){kF(n,t);var e=SF(n);function n(r){var i;wF(this,n),i=e.call(this,r),xt(St(i),"thumbsRef",void 0),xt(St(i),"carouselWrapperRef",void 0),xt(St(i),"listRef",void 0),xt(St(i),"itemsRef",void 0),xt(St(i),"timer",void 0),xt(St(i),"animationHandler",void 0),xt(St(i),"setThumbsRef",function(o){i.thumbsRef=o}),xt(St(i),"setCarouselWrapperRef",function(o){i.carouselWrapperRef=o}),xt(St(i),"setListRef",function(o){i.listRef=o}),xt(St(i),"setItemsRef",function(o,l){i.itemsRef||(i.itemsRef=[]),i.itemsRef[l]=o}),xt(St(i),"autoPlay",function(){zt.Children.count(i.props.children)<=1||(i.clearAutoPlay(),i.props.autoPlay&&(i.timer=setTimeout(function(){i.increment()},i.props.interval)))}),xt(St(i),"clearAutoPlay",function(){i.timer&&clearTimeout(i.timer)}),xt(St(i),"resetAutoPlay",function(){i.clearAutoPlay(),i.autoPlay()}),xt(St(i),"stopOnHover",function(){i.setState({isMouseEntered:!0},i.clearAutoPlay)}),xt(St(i),"startOnLeave",function(){i.setState({isMouseEntered:!1},i.autoPlay)}),xt(St(i),"isFocusWithinTheCarousel",function(){return i.carouselWrapperRef?!!((0,Wf.default)().activeElement===i.carouselWrapperRef||i.carouselWrapperRef.contains((0,Wf.default)().activeElement)):!1}),xt(St(i),"navigateWithKeyboard",function(o){if(i.isFocusWithinTheCarousel()){var l=i.props.axis,a=l==="horizontal",u={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},c=a?u.ArrowRight:u.ArrowDown,f=a?u.ArrowLeft:u.ArrowUp;c===o.keyCode?i.increment():f===o.keyCode&&i.decrement()}}),xt(St(i),"updateSizes",function(){if(!(!i.state.initialized||!i.itemsRef||i.itemsRef.length===0)){var o=i.props.axis==="horizontal",l=i.itemsRef[0];if(l){var a=o?l.clientWidth:l.clientHeight;i.setState({itemSize:a}),i.thumbsRef&&i.thumbsRef.updateSizes()}}}),xt(St(i),"setMountState",function(){i.setState({hasMount:!0}),i.updateSizes()}),xt(St(i),"handleClickItem",function(o,l){if(zt.Children.count(i.props.children)!==0){if(i.state.cancelClick){i.setState({cancelClick:!1});return}i.props.onClickItem(o,l),o!==i.state.selectedItem&&i.setState({selectedItem:o})}}),xt(St(i),"handleOnChange",function(o,l){zt.Children.count(i.props.children)<=1||i.props.onChange(o,l)}),xt(St(i),"handleClickThumb",function(o,l){i.props.onClickThumb(o,l),i.moveTo(o)}),xt(St(i),"onSwipeStart",function(o){i.setState({swiping:!0}),i.props.onSwipeStart(o)}),xt(St(i),"onSwipeEnd",function(o){i.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),i.props.onSwipeEnd(o),i.clearAutoPlay(),i.state.autoPlay&&i.autoPlay()}),xt(St(i),"onSwipeMove",function(o,l){i.props.onSwipeMove(l);var a=i.props.swipeAnimationHandler(o,i.props,i.state,i.setState.bind(St(i)));return i.setState(yi({},a)),!!Object.keys(a).length}),xt(St(i),"decrement",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;i.moveTo(i.state.selectedItem-(typeof o=="number"?o:1))}),xt(St(i),"increment",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;i.moveTo(i.state.selectedItem+(typeof o=="number"?o:1))}),xt(St(i),"moveTo",function(o){if(typeof o=="number"){var l=zt.Children.count(i.props.children)-1;o<0&&(o=i.props.infiniteLoop?l:0),o>l&&(o=i.props.infiniteLoop?0:l),i.selectItem({selectedItem:o}),i.state.autoPlay&&i.state.isMouseEntered===!1&&i.resetAutoPlay()}}),xt(St(i),"onClickNext",function(){i.increment(1)}),xt(St(i),"onClickPrev",function(){i.decrement(1)}),xt(St(i),"onSwipeForward",function(){i.increment(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),xt(St(i),"onSwipeBackwards",function(){i.decrement(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),xt(St(i),"changeItem",function(o){return function(l){(!(0,Nu.isKeyboardEvent)(l)||l.key==="Enter")&&i.moveTo(o)}}),xt(St(i),"selectItem",function(o){i.setState(yi({previousItem:i.state.selectedItem},o),function(){i.setState(i.animationHandler(i.props,i.state))}),i.handleOnChange(o.selectedItem,zt.Children.toArray(i.props.children)[o.selectedItem])}),xt(St(i),"getInitialImage",function(){var o=i.props.selectedItem,l=i.itemsRef&&i.itemsRef[o],a=l&&l.getElementsByTagName("img")||[];return a[0]}),xt(St(i),"getVariableItemHeight",function(o){var l=i.itemsRef&&i.itemsRef[o];if(i.state.hasMount&&l&&l.children.length){var a=l.children[0].getElementsByTagName("img")||[];if(a.length>0){var u=a[0];if(!u.complete){var c=function h(){i.forceUpdate(),u.removeEventListener("load",h)};u.addEventListener("load",c)}}var f=a[0]||l.children[0],d=f.clientHeight;return d>0?d:null}return null});var s={initialized:!1,previousItem:r.selectedItem,selectedItem:r.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:r.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return i.animationHandler=typeof r.animationHandler=="function"&&r.animationHandler||r.animationHandler==="fade"&&fh.fadeAnimationHandler||fh.slideAnimationHandler,i.state=yi(yi({},s),i.animationHandler(r,s)),i}return xF(n,[{key:"componentDidMount",value:function(){this.props.children&&this.setupCarousel()}},{key:"componentDidUpdate",value:function(i,s){!i.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!i.autoFocus&&this.props.autoFocus&&this.forceFocus(),s.swiping&&!this.state.swiping&&this.setState(yi({},this.props.stopSwipingHandler(this.props,this.state))),(i.selectedItem!==this.props.selectedItem||i.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),i.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:"componentWillUnmount",value:function(){this.destroyCarousel()}},{key:"setupCarousel",value:function(){var i=this;this.bindEvents(),this.state.autoPlay&&zt.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var s=i.getInitialImage();s&&!s.complete?s.addEventListener("load",i.setMountState):i.setMountState()})}},{key:"destroyCarousel",value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:"setupAutoPlay",value:function(){this.autoPlay();var i=this.carouselWrapperRef;this.props.stopOnHover&&i&&(i.addEventListener("mouseenter",this.stopOnHover),i.addEventListener("mouseleave",this.startOnLeave))}},{key:"destroyAutoPlay",value:function(){this.clearAutoPlay();var i=this.carouselWrapperRef;this.props.stopOnHover&&i&&(i.removeEventListener("mouseenter",this.stopOnHover),i.removeEventListener("mouseleave",this.startOnLeave))}},{key:"bindEvents",value:function(){(0,Vf.default)().addEventListener("resize",this.updateSizes),(0,Vf.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.props.useKeyboardArrows&&(0,Wf.default)().addEventListener("keydown",this.navigateWithKeyboard)}},{key:"unbindEvents",value:function(){(0,Vf.default)().removeEventListener("resize",this.updateSizes),(0,Vf.default)().removeEventListener("DOMContentLoaded",this.updateSizes);var i=this.getInitialImage();i&&i.removeEventListener("load",this.setMountState),this.props.useKeyboardArrows&&(0,Wf.default)().removeEventListener("keydown",this.navigateWithKeyboard)}},{key:"forceFocus",value:function(){var i;(i=this.carouselWrapperRef)===null||i===void 0||i.focus()}},{key:"renderItems",value:function(i){var s=this;return this.props.children?zt.Children.map(this.props.children,function(o,l){var a=l===s.state.selectedItem,u=l===s.state.previousItem,c=a&&s.state.selectedStyle||u&&s.state.prevStyle||s.state.slideStyle||{};s.props.centerMode&&s.props.axis==="horizontal"&&(c=yi(yi({},c),{},{minWidth:s.props.centerSlidePercentage+"%"})),s.state.swiping&&s.state.swipeMovementStarted&&(c=yi(yi({},c),{},{pointerEvents:"none"}));var f={ref:function(h){return s.setItemsRef(h,l)},key:"itemKey"+l+(i?"clone":""),className:ys.default.ITEM(!0,l===s.state.selectedItem,l===s.state.previousItem),onClick:s.handleClickItem.bind(s,l,o),style:c};return zt.default.createElement("li",f,s.props.renderItem(o,{isSelected:l===s.state.selectedItem,isPrevious:l===s.state.previousItem}))}):[]}},{key:"renderControls",value:function(){var i=this,s=this.props,o=s.showIndicators,l=s.labels,a=s.renderIndicator,u=s.children;return o?zt.default.createElement("ul",{className:"control-dots"},zt.Children.map(u,function(c,f){return a&&a(i.changeItem(f),f===i.state.selectedItem,f,l.item)})):null}},{key:"renderStatus",value:function(){return this.props.showStatus?zt.default.createElement("p",{className:"carousel-status"},this.props.statusFormatter(this.state.selectedItem+1,zt.Children.count(this.props.children))):null}},{key:"renderThumbs",value:function(){return!this.props.showThumbs||!this.props.children||zt.Children.count(this.props.children)===0?null:zt.default.createElement(yF.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:"render",value:function(){var i=this;if(!this.props.children||zt.Children.count(this.props.children)===0)return null;var s=this.props.swipeable&&zt.Children.count(this.props.children)>1,o=this.props.axis==="horizontal",l=this.props.showArrows&&zt.Children.count(this.props.children)>1,a=l&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,u=l&&(this.state.selectedItem=e||T<0||f&&E>=s}function g(){var S=Ng();if(b(S))return y(S);l=setTimeout(g,m(S))}function y(S){return l=void 0,d&&r?h(S):(r=i=void 0,o)}function w(){l!==void 0&&clearTimeout(l),u=0,r=a=i=l=void 0}function k(){return l===void 0?o:y(Ng())}function x(){var S=Ng(),T=b(S);if(r=arguments,i=this,a=S,T){if(l===void 0)return p(a);if(f)return clearTimeout(l),l=setTimeout(g,e),h(a)}return l===void 0&&(l=setTimeout(g,e)),o}return x.cancel=w,x.flush=k,x}var kT=GF;const ST=Ii(kT);function $n(t,e,n,r,i=!1){const s=v.useRef();s.current=e,v.useEffect(()=>{if(n===null||n.addEventListener===void 0)return;const o=n,l=a=>{var u;(u=s.current)==null||u.call(o,a)};return o.addEventListener(t,l,{passive:r,capture:i}),()=>{o.removeEventListener(t,l,{capture:i})}},[t,n,r,i])}function Fl(t,e){return t===void 0?void 0:e}const YF=Math.PI;function Ib(t){return t*YF/180}const CT=(t,e,n)=>({x1:t-n/2,y1:e-n/2,x2:t+n/2,y2:e+n/2}),TT=(t,e,n,r,i)=>{switch(t){case"left":return Math.floor(e)+r+i/2;case"center":return Math.floor(e+n/2);case"right":return Math.floor(e+n)-r-i/2}},ET=(t,e,n)=>Math.min(t,e-n*2),AT=(t,e,n)=>n.x1<=t&&t<=n.x2&&n.y1<=e&&e<=n.y2,jv=t=>{const e=t.fgColor??"currentColor";return v.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.7073 7.05029C7.87391 11.8837 10.4544 9.30322 6.03024 13.7273C5.77392 13.9836 5.58981 14.3071 5.50189 14.6587L4.52521 18.5655C4.38789 19.1148 4.88543 19.6123 5.43472 19.475L9.34146 18.4983C9.69313 18.4104 10.0143 18.2286 10.2706 17.9722L16.9499 11.2929",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",vectorEffect:"non-scaling-stroke"}),v.createElement("path",{d:"M20.4854 4.92901L19.0712 3.5148C18.2901 2.73375 17.0238 2.73375 16.2428 3.5148L14.475 5.28257C15.5326 7.71912 16.4736 8.6278 18.7176 9.52521L20.4854 7.75744C21.2665 6.97639 21.2665 5.71006 20.4854 4.92901Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",vectorEffect:"non-scaling-stroke"}))},qF=t=>{const e=t.fgColor??"currentColor";return v.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M19 6L10.3802 17L5.34071 11.8758",vectorEffect:"non-scaling-stroke",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))};function QF(t,e,n){const[r,i]=v.useState(t),s=v.useRef(!0);v.useEffect(()=>()=>{s.current=!1},[]);const o=v.useRef(ST(l=>{s.current&&i(l)},n));return v.useLayoutEffect(()=>{s.current&&o.current(()=>t())},e),r}const JF="֑-߿יִ-﷽ﹰ-ﻼ",ZF="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",e4=new RegExp("^[^"+ZF+"]*["+JF+"]");function Hv(t){return e4.test(t)?"rtl":"not-rtl"}let Uf;function S0(){if(typeof document>"u")return 0;if(Uf!==void 0)return Uf;const t=document.createElement("p");t.style.width="100%",t.style.height="200px";const e=document.createElement("div");e.id="testScrollbar",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.append(t),document.body.append(e);const n=t.offsetWidth;e.style.overflow="scroll";let r=t.offsetWidth;return n===r&&(r=e.clientWidth),e.remove(),Uf=n-r,Uf}const Bo=Symbol();function t4(t){const e=v.useRef([Bo,t]);e.current[1]!==t&&(e.current[0]=t),e.current[1]=t;const[n,r]=v.useState(t),[,i]=v.useState(),s=v.useCallback(l=>{const a=e.current[0];a!==Bo&&(l=typeof l=="function"?l(a):l,l===a)||(a!==Bo&&i({}),r(u=>typeof l=="function"?l(a===Bo?u:a):l),e.current[0]=Bo)},[]),o=v.useCallback(()=>{e.current[0]=Bo,i({})},[]);return[e.current[0]===Bo?n:e.current[0],s,o]}function MT(t){if(t.length===0)return"";let e=0,n=0;for(const r of t){if(n+=r.length,n>1e4)break;e++}return t.slice(0,e).join(", ")}function n4(t){const e=v.useRef(t);return Aa(t,e.current)||(e.current=t),e.current}const r4=t=>{const{urls:e,canWrite:n,onEditClick:r,renderImage:i}=t,s=e.filter(l=>l!=="");if(s.length===0)return null;const o=s.length>1;return v.createElement(P3,{"data-testid":"GDG-default-image-overlay-editor"},v.createElement(yT.Carousel,{showArrows:o,showThumbs:!1,swipeable:o,emulateTouch:o,infiniteLoop:o},s.map(l=>{const a=(i==null?void 0:i(l))??v.createElement("img",{draggable:!1,src:l});return v.createElement("div",{className:"gdg-centering-container",key:l},a)})),n&&r&&v.createElement("button",{className:"gdg-edit-icon",onClick:r},v.createElement(jv,null)))};function RT(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let yl=RT();function i4(t){yl=t}const OT=/[&<>"']/,s4=new RegExp(OT.source,"g"),PT=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,o4=new RegExp(PT.source,"g"),l4={"&":"&","<":"<",">":">",'"':""","'":"'"},Db=t=>l4[t];function Jn(t,e){if(e){if(OT.test(t))return t.replace(s4,Db)}else if(PT.test(t))return t.replace(o4,Db);return t}const a4=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function IT(t){return t.replace(a4,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const u4=/(^|[^\[])\^/g;function Yt(t,e){t=typeof t=="string"?t:t.source,e=e||"";const n={replace:(r,i)=>(i=i.source||i,i=i.replace(u4,"$1"),t=t.replace(r,i),n),getRegex:()=>new RegExp(t,e)};return n}const c4=/[^\w:]/g,f4=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _b(t,e,n){if(t){let r;try{r=decodeURIComponent(IT(n)).replace(c4,"").toLowerCase()}catch{return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}e&&!f4.test(n)&&(n=g4(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch{return null}return n}const Kf={},d4=/^[^:]+:\/*[^/]*$/,h4=/^([^:]+:)[\s\S]*$/,p4=/^([^:]+:\/*[^/]*)[\s\S]*$/;function g4(t,e){Kf[" "+t]||(d4.test(t)?Kf[" "+t]=t+"/":Kf[" "+t]=Od(t,"/",!0)),t=Kf[" "+t];const n=t.indexOf(":")===-1;return e.substring(0,2)==="//"?n?e:t.replace(h4,"$1")+e:e.charAt(0)==="/"?n?e:t.replace(p4,"$1")+e:t+e}const hh={exec:function(){}};function Nb(t,e){const n=t.replace(/\|/g,(s,o,l)=>{let a=!1,u=o;for(;--u>=0&&l[u]==="\\";)a=!a;return a?"|":" |"}),r=n.split(/ \|/);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),r.length>e)r.splice(e);else for(;r.length1;)e&1&&(n+=t),e>>=1,t+=t;return n+t}function Fb(t,e,n,r){const i=e.href,s=e.title?Jn(e.title):null,o=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){r.state.inLink=!0;const l={type:"link",raw:n,href:i,title:s,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,l}return{type:"image",raw:n,href:i,title:s,text:Jn(o)}}function v4(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null)return e;const r=n[1];return e.split(` +`).map(i=>{const s=i.match(/^\s+/);if(s===null)return i;const[o]=s;return o.length>=r.length?i.slice(r.length):i}).join(` +`)}class Wv{constructor(e){this.options=e||yl}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Od(r,` +`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],i=v4(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline._escapes,"$1"):n[2],text:i}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(/#$/.test(r)){const i=Od(r,"#");(this.options.pedantic||!i||/ $/.test(i))&&(r=i.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:n[0]}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){const r=n[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(r);return this.lexer.state.top=i,{type:"blockquote",raw:n[0],tokens:s,text:r}}}list(e){let n=this.rules.block.list.exec(e);if(n){let r,i,s,o,l,a,u,c,f,d,h,p,m=n[1].trim();const b=m.length>1,g={type:"list",raw:"",ordered:b,start:b?+m.slice(0,-1):"",loose:!1,items:[]};m=b?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=b?m:"[*+-]");const y=new RegExp(`^( {0,3}${m})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;e&&(p=!1,!(!(n=y.exec(e))||this.rules.block.hr.test(e)));){if(r=n[0],e=e.substring(r.length),c=n[2].split(` +`,1)[0].replace(/^\t+/,k=>" ".repeat(3*k.length)),f=e.split(` +`,1)[0],this.options.pedantic?(o=2,h=c.trimLeft()):(o=n[2].search(/[^ ]/),o=o>4?1:o,h=c.slice(o),o+=n[1].length),a=!1,!c&&/^ *$/.test(f)&&(r+=f+` +`,e=e.substring(f.length+1),p=!0),!p){const k=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),x=new RegExp(`^ {0,${Math.min(3,o-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),S=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:\`\`\`|~~~)`),T=new RegExp(`^ {0,${Math.min(3,o-1)}}#`);for(;e&&(d=e.split(` +`,1)[0],f=d,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(S.test(f)||T.test(f)||k.test(f)||x.test(e)));){if(f.search(/[^ ]/)>=o||!f.trim())h+=` +`+f.slice(o);else{if(a||c.search(/[^ ]/)>=4||S.test(c)||T.test(c)||x.test(c))break;h+=` +`+f}!a&&!f.trim()&&(a=!0),r+=d+` +`,e=e.substring(d.length+1),c=f.slice(o)}}g.loose||(u?g.loose=!0:/\n *\n *$/.test(r)&&(u=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(h),i&&(s=i[0]!=="[ ] ",h=h.replace(/^\[[ xX]\] +/,""))),g.items.push({type:"list_item",raw:r,task:!!i,checked:s,loose:!1,text:h}),g.raw+=r}g.items[g.items.length-1].raw=r.trimRight(),g.items[g.items.length-1].text=h.trimRight(),g.raw=g.raw.trimRight();const w=g.items.length;for(l=0;lS.type==="space"),x=k.length>0&&k.some(S=>/\n.*\n/.test(S.raw));g.loose=x}if(g.loose)for(l=0;l$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline._escapes,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:i,title:s}}}table(e){const n=this.rules.block.table.exec(e);if(n){const r={type:"table",header:Nb(n[1]).map(i=>({text:i})),align:n[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(` +`):[]};if(r.header.length===r.align.length){r.raw=n[0];let i=r.align.length,s,o,l,a;for(s=0;s({text:u}));for(i=r.header.length,o=0;o/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):Jn(n[0]):n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&/^$/.test(r))return;const o=Od(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{const o=m4(n[2],"()");if(o>-1){const a=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,a).trim(),n[3]=""}}let i=n[2],s="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);o&&(i=o[1],s=o[3])}else s=n[3]?n[3].slice(1,-1):"";return i=i.trim(),/^$/.test(r)?i=i.slice(1):i=i.slice(1,-1)),Fb(n,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let i=(r[2]||r[1]).replace(/\s+/g," ");if(i=n[i.toLowerCase()],!i){const s=r[0].charAt(0);return{type:"text",raw:s,text:s}}return Fb(r,i,r[0],this.lexer)}}emStrong(e,n,r=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i||i[3]&&r.match(/[\p{L}\p{N}]/u))return;const s=i[1]||i[2]||"";if(!s||s&&(r===""||this.rules.inline.punctuation.exec(r))){const o=i[0].length-1;let l,a,u=o,c=0;const f=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(f.lastIndex=0,n=n.slice(-1*e.length+o);(i=f.exec(n))!=null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(a=l.length,i[3]||i[4]){u+=a;continue}else if((i[5]||i[6])&&o%3&&!((o+a)%3)){c+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u+c);const d=e.slice(0,o+i.index+(i[0].length-l.length)+a);if(Math.min(o,a)%2){const p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}const h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(/\n/g," ");const i=/[^ ]/.test(r),s=/^ /.test(r)&&/ $/.test(r);return i&&s&&(r=r.substring(1,r.length-1)),r=Jn(r,!0),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e,n){const r=this.rules.inline.autolink.exec(e);if(r){let i,s;return r[2]==="@"?(i=Jn(this.options.mangle?n(r[1]):r[1]),s="mailto:"+i):(i=Jn(r[1]),s=i),{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(e,n){let r;if(r=this.rules.inline.url.exec(e)){let i,s;if(r[2]==="@")i=Jn(this.options.mangle?n(r[0]):r[0]),s="mailto:"+i;else{let o;do o=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0];while(o!==r[0]);i=Jn(r[0]),r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e,n){const r=this.rules.inline.text.exec(e);if(r){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):Jn(r[0]):r[0]:i=Jn(this.options.smartypants?n(r[0]):r[0]),{type:"text",raw:r[0],text:i}}}}const Xe={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:hh,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};Xe._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;Xe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;Xe.def=Yt(Xe.def).replace("label",Xe._label).replace("title",Xe._title).getRegex();Xe.bullet=/(?:[*+-]|\d{1,9}[.)])/;Xe.listItemStart=Yt(/^( *)(bull) */).replace("bull",Xe.bullet).getRegex();Xe.list=Yt(Xe.list).replace(/bull/g,Xe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Xe.def.source+")").getRegex();Xe._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";Xe._comment=/|$)/;Xe.html=Yt(Xe.html,"i").replace("comment",Xe._comment).replace("tag",Xe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();Xe.paragraph=Yt(Xe._paragraph).replace("hr",Xe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Xe._tag).getRegex();Xe.blockquote=Yt(Xe.blockquote).replace("paragraph",Xe.paragraph).getRegex();Xe.normal={...Xe};Xe.gfm={...Xe.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};Xe.gfm.table=Yt(Xe.gfm.table).replace("hr",Xe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Xe._tag).getRegex();Xe.gfm.paragraph=Yt(Xe._paragraph).replace("hr",Xe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Xe.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Xe._tag).getRegex();Xe.pedantic={...Xe.normal,html:Yt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Xe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:hh,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Yt(Xe.normal._paragraph).replace("hr",Xe.hr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",Xe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const Oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:hh,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:hh,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";Oe.punctuation=Yt(Oe.punctuation).replace(/punctuation/g,Oe._punctuation).getRegex();Oe.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;Oe.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;Oe._comment=Yt(Xe._comment).replace("(?:-->|$)","-->").getRegex();Oe.emStrong.lDelim=Yt(Oe.emStrong.lDelim).replace(/punct/g,Oe._punctuation).getRegex();Oe.emStrong.rDelimAst=Yt(Oe.emStrong.rDelimAst,"g").replace(/punct/g,Oe._punctuation).getRegex();Oe.emStrong.rDelimUnd=Yt(Oe.emStrong.rDelimUnd,"g").replace(/punct/g,Oe._punctuation).getRegex();Oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;Oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;Oe._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;Oe.autolink=Yt(Oe.autolink).replace("scheme",Oe._scheme).replace("email",Oe._email).getRegex();Oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;Oe.tag=Yt(Oe.tag).replace("comment",Oe._comment).replace("attribute",Oe._attribute).getRegex();Oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;Oe._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;Oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;Oe.link=Yt(Oe.link).replace("label",Oe._label).replace("href",Oe._href).replace("title",Oe._title).getRegex();Oe.reflink=Yt(Oe.reflink).replace("label",Oe._label).replace("ref",Xe._label).getRegex();Oe.nolink=Yt(Oe.nolink).replace("ref",Xe._label).getRegex();Oe.reflinkSearch=Yt(Oe.reflinkSearch,"g").replace("reflink",Oe.reflink).replace("nolink",Oe.nolink).getRegex();Oe.normal={...Oe};Oe.pedantic={...Oe.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Yt(/^!?\[(label)\]\((.*?)\)/).replace("label",Oe._label).getRegex(),reflink:Yt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Oe._label).getRegex()};Oe.gfm={...Oe.normal,escape:Yt(Oe.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(r="x"+r.toString(16)),e+="&#"+r+";";return e}class bo{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||yl,this.options.tokenizer=this.options.tokenizer||new Wv,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:Xe.normal,inline:Oe.normal};this.options.pedantic?(n.block=Xe.pedantic,n.inline=Oe.pedantic):this.options.gfm&&(n.block=Xe.gfm,this.options.breaks?n.inline=Oe.breaks:n.inline=Oe.gfm),this.tokenizer.rules=n}static get rules(){return{block:Xe,inline:Oe}}static lex(e,n){return new bo(n).lex(e)}static lexInline(e,n){return new bo(n).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,` +`),this.blockTokens(e,this.tokens);let n;for(;n=this.inlineQueue.shift();)this.inlineTokens(n.src,n.tokens);return this.tokens}blockTokens(e,n=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(l,a,u)=>a+" ".repeat(u.length));let r,i,s,o;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(r=l.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length),r.raw.length===1&&n.length>0?n[n.length-1].raw+=` +`:n.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=` +`+r.raw,i.text+=` +`+r.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=` +`+r.raw,i.text+=` +`+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(s=e,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const a=e.slice(1);let u;this.options.extensions.startBlock.forEach(function(c){u=c.call({lexer:this},a),typeof u=="number"&&u>=0&&(l=Math.min(l,u))}),l<1/0&&l>=0&&(s=e.substring(0,l+1))}if(this.state.top&&(r=this.tokenizer.paragraph(s))){i=n[n.length-1],o&&i.type==="paragraph"?(i.raw+=` +`+r.raw,i.text+=` +`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r),o=s.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&i.type==="text"?(i.raw+=` +`+r.raw,i.text+=` +`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r,i,s,o=e,l,a,u;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)c.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+Lb("a",l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+Lb("a",l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.escapedEmSt.exec(o))!=null;)o=o.slice(0,l.index+l[0].length-2)+"++"+o.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(a||(u=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(r=c.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&r.type==="text"&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length),i=n[n.length-1],i&&r.type==="text"&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(e,o,u)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(e,Bb)){e=e.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e,Bb))){e=e.substring(r.raw.length),n.push(r);continue}if(s=e,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const f=e.slice(1);let d;this.options.extensions.startInline.forEach(function(h){d=h.call({lexer:this},f),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(s=e.substring(0,c+1))}if(r=this.tokenizer.inlineText(s,w4)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(u=r.raw.slice(-1)),a=!0,i=n[n.length-1],i&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return n}}class Vv{constructor(e){this.options=e||yl}code(e,n,r){const i=(n||"").match(/\S*/)[0];if(this.options.highlight){const s=this.options.highlight(e,i);s!=null&&s!==e&&(r=!0,e=s)}return e=e.replace(/\n$/,"")+` +`,i?'
    '+(r?e:Jn(e,!0))+`
    +`:"
    "+(r?e:Jn(e,!0))+`
    +`}blockquote(e){return`
    +${e}
    +`}html(e){return e}heading(e,n,r,i){if(this.options.headerIds){const s=this.options.headerPrefix+i.slug(r);return`${e} +`}return`${e} +`}hr(){return this.options.xhtml?`
    +`:`
    +`}list(e,n,r){const i=n?"ol":"ul",s=n&&r!==1?' start="'+r+'"':"";return"<"+i+s+`> +`+e+" +`}listitem(e){return`
  • ${e}
  • +`}checkbox(e){return" "}paragraph(e){return`

    ${e}

    +`}table(e,n){return n&&(n=`${n}`),` + +`+e+` +`+n+`
    +`}tablerow(e){return` +${e} +`}tablecell(e,n){const r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+e+` +`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return this.options.xhtml?"
    ":"
    "}del(e){return`${e}`}link(e,n,r){if(e=_b(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i='
    ",i}image(e,n,r){if(e=_b(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i=`${r}":">",i}text(e){return e}}class DT{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,n,r){return""+r}image(e,n,r){return""+r}br(){return""}}class _T{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,n){let r=e,i=0;if(this.seen.hasOwnProperty(r)){i=this.seen[e];do i++,r=e+"-"+i;while(this.seen.hasOwnProperty(r))}return n||(this.seen[e]=i,this.seen[r]=0),r}slug(e,n={}){const r=this.serialize(e);return this.getNextSafeSlug(r,n.dryrun)}}let Kc=class C0{constructor(e){this.options=e||yl,this.options.renderer=this.options.renderer||new Vv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new DT,this.slugger=new _T}static parse(e,n){return new C0(n).parse(e)}static parseInline(e,n){return new C0(n).parseInline(e)}parse(e,n=!0){let r="",i,s,o,l,a,u,c,f,d,h,p,m,b,g,y,w,k,x,S;const T=e.length;for(i=0;i0&&y.tokens[0].type==="paragraph"?(y.tokens[0].text=x+" "+y.tokens[0].text,y.tokens[0].tokens&&y.tokens[0].tokens.length>0&&y.tokens[0].tokens[0].type==="text"&&(y.tokens[0].tokens[0].text=x+" "+y.tokens[0].tokens[0].text)):y.tokens.unshift({type:"text",text:x}):g+=x),g+=this.parse(y.tokens,b),d+=this.renderer.listitem(g,k,w);r+=this.renderer.list(d,p,m);continue}case"html":{r+=this.renderer.html(h.text);continue}case"paragraph":{r+=this.renderer.paragraph(this.parseInline(h.tokens));continue}case"text":{for(d=h.tokens?this.parseInline(h.tokens):h.text;i+1{if(r.message+=` +Please report this to https://github.com/markedjs/marked.`,t){const i="

    An error occurred:

    "+Jn(r.message+"",!0)+"
    ";if(e)return Promise.resolve(i);if(n){n(null,i);return}return i}if(e)return Promise.reject(r);if(n){n(r);return}throw r}}function NT(t,e){return(n,r,i)=>{typeof r=="function"&&(i=r,r=null);const s={...r};r={...qe.defaults,...s};const o=b4(r.silent,r.async,i);if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(y4(r),r.hooks&&(r.hooks.options=r),i){const l=r.highlight;let a;try{r.hooks&&(n=r.hooks.preprocess(n)),a=t(n,r)}catch(f){return o(f)}const u=function(f){let d;if(!f)try{r.walkTokens&&qe.walkTokens(a,r.walkTokens),d=e(a,r),r.hooks&&(d=r.hooks.postprocess(d))}catch(h){f=h}return r.highlight=l,f?o(f):i(null,d)};if(!l||l.length<3||(delete r.highlight,!a.length))return u();let c=0;qe.walkTokens(a,function(f){f.type==="code"&&(c++,setTimeout(()=>{l(f.text,f.lang,function(d,h){if(d)return u(d);h!=null&&h!==f.text&&(f.text=h,f.escaped=!0),c--,c===0&&u()})},0))}),c===0&&u();return}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(l=>t(l,r)).then(l=>r.walkTokens?Promise.all(qe.walkTokens(l,r.walkTokens)).then(()=>l):l).then(l=>e(l,r)).then(l=>r.hooks?r.hooks.postprocess(l):l).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));const l=t(n,r);r.walkTokens&&qe.walkTokens(l,r.walkTokens);let a=e(l,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(l){return o(l)}}}function qe(t,e,n){return NT(bo.lex,Kc.parse)(t,e,n)}qe.options=qe.setOptions=function(t){return qe.defaults={...qe.defaults,...t},i4(qe.defaults),qe};qe.getDefaults=RT;qe.defaults=yl;qe.use=function(...t){const e=qe.defaults.extensions||{renderers:{},childTokens:{}};t.forEach(n=>{const r={...n};if(r.async=qe.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if(i.tokenizer){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");e[i.level]?e[i.level].unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=qe.defaults.renderer||new Vv;for(const s in n.renderer){const o=i[s];i[s]=(...l)=>{let a=n.renderer[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.renderer=i}if(n.tokenizer){const i=qe.defaults.tokenizer||new Wv;for(const s in n.tokenizer){const o=i[s];i[s]=(...l)=>{let a=n.tokenizer[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.tokenizer=i}if(n.hooks){const i=qe.defaults.hooks||new ph;for(const s in n.hooks){const o=i[s];ph.passThroughHooks.has(s)?i[s]=l=>{if(qe.defaults.async)return Promise.resolve(n.hooks[s].call(i,l)).then(u=>o.call(i,u));const a=n.hooks[s].call(i,l);return o.call(i,a)}:i[s]=(...l)=>{let a=n.hooks[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.hooks=i}if(n.walkTokens){const i=qe.defaults.walkTokens;r.walkTokens=function(s){let o=[];return o.push(n.walkTokens.call(this,s)),i&&(o=o.concat(i.call(this,s))),o}}qe.setOptions(r)})};qe.walkTokens=function(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(qe,r)),r.type){case"table":{for(const i of r.header)n=n.concat(qe.walkTokens(i.tokens,e));for(const i of r.rows)for(const s of i)n=n.concat(qe.walkTokens(s.tokens,e));break}case"list":{n=n.concat(qe.walkTokens(r.items,e));break}default:qe.defaults.extensions&&qe.defaults.extensions.childTokens&&qe.defaults.extensions.childTokens[r.type]?qe.defaults.extensions.childTokens[r.type].forEach(function(i){n=n.concat(qe.walkTokens(r[i],e))}):r.tokens&&(n=n.concat(qe.walkTokens(r.tokens,e)))}return n};qe.parseInline=NT(bo.lexInline,Kc.parseInline);qe.Parser=Kc;qe.parser=Kc.parse;qe.Renderer=Vv;qe.TextRenderer=DT;qe.Lexer=bo;qe.lexer=bo.lex;qe.Tokenizer=Wv;qe.Slugger=_T;qe.Hooks=ph;qe.parse=qe;qe.options;qe.setOptions;qe.use;qe.walkTokens;qe.parseInline;Kc.parse;bo.lex;const x4=Hr("div")({name:"MarkdownContainer",class:"gdg-mnuv029",propsAsIs:!1});class k4 extends Pn.PureComponent{constructor(){super(...arguments);bt(this,"targetElement",null);bt(this,"containerRefHook",n=>{this.targetElement=n,this.renderMarkdownIntoDiv()})}renderMarkdownIntoDiv(){const{targetElement:n,props:r}=this;if(n===null)return;const{contents:i,createNode:s}=r,o=qe(i),l=document.createRange();l.selectNodeContents(n),l.deleteContents();let a=s==null?void 0:s(o);if(a===void 0){const c=document.createElement("template");c.innerHTML=o,a=c.content}n.append(a);const u=n.getElementsByTagName("a");for(const c of u)c.target="_blank",c.rel="noreferrer noopener"}render(){return this.renderMarkdownIntoDiv(),Pn.createElement(x4,{ref:this.containerRefHook})}}const S4=Hr("textarea")({name:"InputBox",class:"gdg-izpuzkl",propsAsIs:!1}),C4=Hr("div")({name:"ShadowBox",class:"gdg-s69h75o",propsAsIs:!1}),T4=Hr("div")({name:"GrowingEntryStyle",class:"gdg-g1y0xocz",propsAsIs:!1});let zb=0;const mp=t=>{const{placeholder:e,value:n,onKeyDown:r,highlight:i,altNewline:s,validatedSelection:o,...l}=t,{onChange:a,className:u}=l,c=v.useRef(null),f=n??"";_r(a!==void 0,"GrowingEntry must be a controlled input area");const[d]=v.useState(()=>"input-box-"+(zb=(zb+1)%1e7));v.useEffect(()=>{const p=c.current;if(p===null||p.disabled)return;const m=f.toString().length;p.focus(),p.setSelectionRange(i?0:m,m)},[]),v.useLayoutEffect(()=>{var p;if(o!==void 0){const m=typeof o=="number"?[o,null]:o;(p=c.current)==null||p.setSelectionRange(m[0],m[1])}},[o]);const h=v.useCallback(p=>{p.key==="Enter"&&p.shiftKey&&s===!0||r==null||r(p)},[s,r]);return v.createElement(T4,{className:"gdg-growing-entry"},v.createElement(C4,{className:u},f+` +`),v.createElement(S4,{...l,className:(u??"")+" gdg-input",id:d,ref:c,onKeyDown:h,value:f,placeholder:e,dir:"auto"}))},Lg={};let Vs=null;function E4(){const t=document.createElement("div");return t.style.opacity="0",t.style.pointerEvents="none",t.style.position="fixed",document.body.append(t),t}function T0(t){const e=t.toLowerCase().trim();if(Lg[e]!==void 0)return Lg[e];Vs=Vs||E4(),Vs.style.color="#000",Vs.style.color=e;const n=getComputedStyle(Vs).color;Vs.style.color="#fff",Vs.style.color=e;const r=getComputedStyle(Vs).color;if(r!==n)return[0,0,0,1];let i=r.replace(/[^\d.,]/g,"").split(",").map(Number.parseFloat);return i.length<4&&i.push(1),i=i.map(s=>Number.isNaN(s)?0:s),Lg[e]=i,i}function al(t,e){const[n,r,i]=T0(t);return`rgba(${n}, ${r}, ${i}, ${e})`}const $b=new Map;function jb(t,e){const n=`${t}-${e}`,r=$b.get(n);if(r!==void 0)return r;const i=Nr(t,e);return $b.set(n,i),i}function Nr(t,e){if(e===void 0)return t;const[n,r,i,s]=T0(t);if(s===1)return t;const[o,l,a,u]=T0(e),c=s+u*(1-s),f=(s*n+u*o*(1-s))/c,d=(s*r+u*l*(1-s))/c,h=(s*i+u*a*(1-s))/c;return`rgba(${f}, ${d}, ${h}, ${c})`}var Hl=new Map,ra=new Map,E0=new Map;function A4(){Hl.clear(),E0.clear(),ra.clear()}function M4(t,e,n,r,i){var s,o,l;let a=0,u={};for(let f of t)a+=(s=n.get(f))!=null?s:i,u[f]=((o=u[f])!=null?o:0)+1;let c=e-a;for(let f of Object.keys(u)){let d=u[f],h=(l=n.get(f))!=null?l:i,p=h*d/a,m=c*p*r/d,b=h+m;n.set(f,b)}}function R4(t,e){var n;let r=new Map,i=0;for(let u of"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-+=?"){let c=t.measureText(u).width;r.set(u,c),i+=c}let s=i/r.size,o=3,l=(e/s+o)/(o+1),a=r.keys();for(let u of a)r.set(u,((n=r.get(u))!=null?n:s)*l);return r}function Yu(t,e,n,r){var i,s;let o=ra.get(n);if(r&&o!==void 0&&o.count>2e4){let u=E0.get(n);if(u===void 0&&(u=R4(t,o.size),E0.set(n,u)),o.count>5e5){let f=0;for(let d of e)f+=(i=u.get(d))!=null?i:o.size;return f*1.01}let c=t.measureText(e);return M4(e,c.width,u,Math.max(.05,1-o.count/2e5),o.size),ra.set(n,{count:o.count+e.length,size:o.size}),c.width}let l=t.measureText(e),a=l.width/e.length;if(((s=o==null?void 0:o.count)!=null?s:0)>2e4)return l.width;if(o===void 0)ra.set(n,{count:e.length,size:a});else{let u=a-o.size,c=e.length/(o.count+e.length),f=o.size+u*c;ra.set(n,{count:o.count+e.length,size:f})}return l.width}function O4(t,e,n,r,i,s,o,l){if(e.length<=1)return e.length;if(in;){let c=e.lastIndexOf(" ",a-1);c>0?a=c:a--,u=Yu(t,e.slice(0,Math.max(0,a)),r,o)}if(e[a]!==" "){let c=0;c=e.lastIndexOf(" ",a),c>0&&(a=c)}return a}function P4(t,e,n,r,i,s){let o=`${e}_${n}_${r}px`,l=Hl.get(o);if(l!==void 0)return l;if(r<=0)return[];let a=[],u=e.split(` +`),c=ra.get(n),f=c===void 0?e.length:r/c.size*1.5,d=i&&c!==void 0&&c.count>2e4;for(let h of u){let p=Yu(t,h.slice(0,Math.max(0,f)),n,d),m=Math.min(h.length,f);if(p<=r)a.push(h);else{for(;p>r;){let b=O4(t,h,r,n,p,m,d),g=h.slice(0,Math.max(0,b));h=h.slice(g.length),a.push(g),p=Yu(t,h.slice(0,Math.max(0,f)),n,d),m=Math.min(h.length,f)}p>0&&a.push(h)}}return a=a.map((h,p)=>p===0?h.trimEnd():h.trim()),Hl.set(o,a),Hl.size>500&&Hl.delete(Hl.keys().next().value),a}function I4(t,e){return Pn.useMemo(()=>t.map((n,r)=>({group:n.group,grow:n.grow,hasMenu:n.hasMenu,icon:n.icon,id:n.id,menuIcon:n.menuIcon,overlayIcon:n.overlayIcon,sourceIndex:r,sticky:r=s.x&&n=s.y&&r=e.span[0]&&n.current.cell[0]<=e.span[1]}function LT(t,e){const[n,r]=t;return n>=e.x&&n=e.y&&ro)return!1;if(e.span===void 0)return l>=r&&l<=i;const[u,c]=e.span;return u>=r&&u<=i||c>=r&&u<=i||ui}function N4(t,e,n,r){let i=0;if(n.current===void 0)return i;const s=n.current.range;(r||s.height*s.width>1)&&Hb(t,e,s)&&i++;for(const o of n.current.rangeStack)Hb(t,e,o)&&i++;return i}function BT(t,e){let n=t;if(e!==void 0){let r=[...t];const i=n[e.src];e.src>e.dest?(r.splice(e.src,1),r.splice(e.dest,0,i)):(r.splice(e.dest+1,0,i),r.splice(e.src,1)),r=r.map((s,o)=>({...s,sticky:t[o].sticky})),n=r}return n}function Ma(t,e){let n=0;const r=BT(t,e);for(let i=0;i0)for(const u of o)n-=u.width;let l=e,a=i??0;for(;a<=n&&l=f)return m}const d=s-u,h=t-(a??0);if(typeof o=="number"){const p=Math.floor((h-c)/o)+l;return p>=d?void 0:p}else{let p=c;for(let m=l;m"u";async function z4(){var t;B4||((t=document==null?void 0:document.fonts)==null?void 0:t.ready)===void 0||(await document.fonts.ready,Pd=0,Qu={},A4())}z4();function zT(t,e,n,r){return`${t}_${r??(e==null?void 0:e.font)}_${n}`}function Xc(t,e,n,r="middle"){const i=zT(t,e,r,n);let s=Qu[i];return s===void 0&&(s=e.measureText(t),Qu[i]=s,Pd++),Pd>1e4&&(Qu={},Pd=0),s}function $4(t,e){const n=zT(t,void 0,"middle",e);return Qu[n]}function Is(t,e){return typeof e!="string"&&(e=e.baseFontFull),j4(t,e)}function Wb(t,e){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";t.save(),t.textBaseline=e;const r=t.measureText(n);return t.restore(),r}const Vb=[];function j4(t,e){for(const s of Vb)if(s.key===e)return s.val;const n=Wb(t,"alphabetic"),i=-(Wb(t,"middle").actualBoundingBoxDescent-n.actualBoundingBoxDescent)+n.actualBoundingBoxAscent/2;return Vb.push({key:e,val:i}),i}function H4(t,e,n,r,i,s){const{ctx:o,rect:l,theme:a}=t;let u=Number.MAX_SAFE_INTEGER;const c=500;if(e!==void 0&&(u=n-e,un&&(t=t.slice(0,n)),t}function V4(t,e,n,r,i,s,o,l,a,u){const c=l.baseFontFull,f=P4(t,e,c,i-l.cellHorizontalPadding*2,u??!1),d=jT(t,c),h=l.lineHeight*d,p=d+h*(f.length-1),m=p+l.cellVerticalPadding>s;m&&(t.save(),t.rect(n,r,i,s),t.clip());const b=r+s/2-p/2;let g=Math.max(r+l.cellVerticalPadding,b);for(const y of f)if($T(t,y,n,g,i,d,o,l,a),g+=h,g>r+s)break;m&&t.restore()}function ws(t,e,n,r,i){const{ctx:s,rect:o,theme:l}=t,{x:a,y:u,width:c,height:f}=o;r=r??!1,r||(e=W4(e,c));const d=Is(s,l),h=Hv(e)==="rtl";if(n===void 0&&h&&(n="right"),h&&(s.direction="rtl"),e.length>0){let p=!1;n==="right"?(s.textAlign="right",p=!0):n!==void 0&&n!=="left"&&(s.textAlign=n,p=!0),r?V4(s,e,a,u,c,f,d,l,n,i):$T(s,e,a,u,c,f,d,l,n),p&&(s.textAlign="start"),h&&(s.direction="inherit")}}function rs(t,e,n,r,i,s){typeof s=="number"&&(s={tl:s,tr:s,br:s,bl:s}),s={tl:Math.max(0,Math.min(s.tl,i/2,r/2)),tr:Math.max(0,Math.min(s.tr,i/2,r/2)),bl:Math.max(0,Math.min(s.bl,i/2,r/2)),br:Math.max(0,Math.min(s.br,i/2,r/2))},t.moveTo(e+s.tl,n),t.arcTo(e+r,n,e+r,n+s.tr,s.tr),t.arcTo(e+r,n+i,e+r-s.br,n+i,s.br),t.arcTo(e,n+i,e,n+i-s.bl,s.bl),t.arcTo(e,n,e+s.tl,n,s.tl)}function U4(t,e,n){t.arc(e,n-1.25*3.5,1.25,0,2*Math.PI,!1),t.arc(e,n,1.25,0,2*Math.PI,!1),t.arc(e,n+1.25*3.5,1.25,0,2*Math.PI,!1)}function K4(t,e,n){const r=function(l,a){const u=a.x-l.x,c=a.y-l.y,f=Math.sqrt(u*u+c*c),d=u/f,h=c/f;return{x:u,y:a.y-l.y,len:f,nx:d,ny:h,ang:Math.atan2(h,d)}};let i;const s=e.length;let o=e[s-1];for(let l=0;l1?1:d),m=1,b=!1;h<0?p<0?p=Math.PI+p:(p=Math.PI-p,m=-1,b=!0):p>0&&(m=-1,b=!0),i=a.radius!==void 0?a.radius:n;const g=p/2;let y=Math.abs(Math.cos(g)*i/Math.sin(g)),w;y>Math.min(c.len/2,f.len/2)?(y=Math.min(c.len/2,f.len/2),w=Math.abs(y*Math.sin(g)/Math.cos(g))):w=i;let k=a.x+f.nx*y,x=a.y+f.ny*y;k+=-f.ny*w*m,x+=f.nx*w*m,t.arc(k,x,w,c.ang+Math.PI/2*m,f.ang-Math.PI/2*m,b),o=a,a=u}t.closePath()}function M0(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p){const m={x:0,y:s+u,width:0,height:0};if(t>=h.length||e>=c||e<-2||t<0)return m;const b=s-i;if(t>=f){const g=o>t?-1:1,y=Ma(h);m.x+=y+a;for(let w=o;w!==t;w+=g)m.x+=h[g===1?w:w-1].width*g}else for(let g=0;g0&&Cc(h[g-1].group,y)&&h[g-1].sticky===w;){const x=h[g-1];m.x-=x.width,m.width+=x.width,g--}let k=t;for(;k+1n&&(m.width=n-m.x)}}else if(e>=c-d){let g=c-e;for(m.y=r;g>0;){const y=e+g-1;m.height=typeof p=="number"?p:p(y),m.y-=m.height,g--}m.height+=1}else{const g=l>e?-1:1;if(typeof p=="number"){const y=e-l;m.y+=y*p}else for(let y=l;y!==e;y+=g)m.y+=p(y)*g;m.height=(typeof p=="number"?p:p(e))+1}return m}const Uv=1<<21;function ki(t,e){return(e+2)*Uv+t}function HT(t){return t%Uv}function Kv(t){return Math.floor(t/Uv)-2}function Xv(t){const e=HT(t),n=Kv(t);return[e,n]}class WT{constructor(){bt(this,"visibleWindow",{x:0,y:0,width:0,height:0});bt(this,"freezeCols",0);bt(this,"freezeRows",[]);bt(this,"isInWindow",e=>{const n=HT(e),r=Kv(e),i=this.visibleWindow,s=n>=i.x&&n<=i.x+i.width||n=i.y&&r<=i.y+i.height||this.freezeRows.includes(r);return s&&o})}setWindow(e,n,r){this.visibleWindow.x===e.x&&this.visibleWindow.y===e.y&&this.visibleWindow.width===e.width&&this.visibleWindow.height===e.height&&this.freezeCols===n&&Aa(this.freezeRows,r)||(this.visibleWindow=e,this.freezeCols=n,this.freezeRows=r,this.clearOutOfWindow())}}class X4 extends WT{constructor(){super(...arguments);bt(this,"cache",new Map);bt(this,"setValue",(n,r)=>{this.cache.set(ki(n[0],n[1]),r)});bt(this,"getValue",n=>this.cache.get(ki(n[0],n[1])));bt(this,"clearOutOfWindow",()=>{for(const[n]of this.cache.entries())this.isInWindow(n)||this.cache.delete(n)})}}class Ju{constructor(e=[]){bt(this,"cells");this.cells=new Set(e.map(n=>ki(n[0],n[1])))}add(e){this.cells.add(ki(e[0],e[1]))}has(e){return e===void 0?!1:this.cells.has(ki(e[0],e[1]))}remove(e){this.cells.delete(ki(e[0],e[1]))}clear(){this.cells.clear()}get size(){return this.cells.size}hasHeader(){for(const e of this.cells)if(Kv(e)<0)return!0;return!1}hasItemInRectangle(e){for(let n=e.y;n{const h=q4(t,d[r],e,a);return u=Math.max(u,h),h});if(c.length>5&&l){u=0;let d=0;for(const p of c)d+=p;const h=d/c.length;for(let p=0;p=h*2?c[p]=0:u=Math.max(u,c[p])}u=Math.max(u,t.measureText(n.title).width+16+(n.icon===void 0?0:28));const f=Math.max(Math.ceil(s),Math.min(Math.floor(o),Math.ceil(u)));return{...n,width:f}}function Q4(t,e,n,r,i,s,o,l,a){const u=v.useRef(e),c=v.useRef(n),f=v.useRef(o);u.current=e,c.current=n,f.current=o;const[d,h]=v.useMemo(()=>{if(typeof window>"u")return[null,null];const y=document.createElement("canvas");return y.style.display="none",y.style.opacity="0",y.style.position="fixed",[y,y.getContext("2d",{alpha:!1})]},[]);v.useLayoutEffect(()=>(d&&document.documentElement.append(d),()=>{d==null||d.remove()}),[d]);const p=v.useRef({}),m=v.useRef(),[b,g]=v.useState();return v.useLayoutEffect(()=>{const y=c.current;if(y===void 0||t.every(jf))return;let w=Math.max(1,10-Math.floor(t.length/1e4)),k=0;w1&&(w--,k=1);const x={x:0,y:0,width:t.length,height:Math.min(u.current,w)},S={x:0,y:u.current-1,width:t.length,height:1};(async()=>{const E=y(x,a.signal),A=k>0?y(S,a.signal):void 0;let I;typeof E=="object"?I=E:I=await wb(E),A!==void 0&&(typeof A=="object"?I=[...I,...A]:I=[...I,...await wb(A)]),m.current=t,g(I)})()},[a.signal,t]),v.useMemo(()=>{let w=t.every(jf)?t:h===null?t.map(T=>jf(T)?T:{...T,width:R0}):(h.font=f.current.baseFontFull,t.map((T,E)=>{if(jf(T))return T;if(p.current[T.id]!==void 0)return{...T,width:p.current[T.id]};if(b===void 0||m.current!==t||T.id===void 0)return{...T,width:R0};const A=KT(h,o,T,E,b,i,s,!0,l);return p.current[T.id]=A.width,A})),k=0,x=0;const S=[];for(const[T,E]of w.entries())k+=E.width,E.grow!==void 0&&E.grow>0&&(x+=E.grow,S.push(T));if(k0){const T=[...w],E=r-k;let A=E;for(let I=0;I0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(a=>{if(a=Z4(a),a in Ub)return;Ub[a]=!0;const u=a.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${c}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":J4,u||(f.as="script"),f.crossOrigin="",f.href=a,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,h)=>{f.addEventListener("load",d),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${a}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};function eB(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}var tB=eB,nB=tB,Fg=$v;function rB(t,e,n){return n===void 0&&(n=e,e=void 0),n!==void 0&&(n=Fg(n),n=n===n?n:0),e!==void 0&&(e=Fg(e),e=e===e?e:0),nB(Fg(t),e,n)}var iB=rB;const xi=Ii(iB);var sB="__lodash_hash_undefined__";function oB(t){return this.__data__.set(t,sB),this}var lB=oB;function aB(t){return this.__data__.has(t)}var uB=aB,cB=Pv,fB=lB,dB=uB;function gh(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new cB;++e-1}var EB=TB;function AB(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=XB){var u=e?null:UB(t);if(u)return KB(u);o=!1,i=VB,a=new jB}else a=e?[]:l;e:for(;++r0&&n(l)?e>1?JT(l,e-1,n,r,i):sz(i,l):r||(i[i.length]=l)}return i}var lz=JT,az=lz;function uz(t){var e=t==null?0:t.length;return e?az(t,1):[]}var cz=uz;const Gb=Ii(cz);var fz=Math.ceil,dz=Math.max;function hz(t,e,n,r){for(var i=-1,s=dz(fz((e-t)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=t,t+=n;return o}var pz=hz,gz=uT,mz=Nv;function yz(t){return t!=null&&mz(t.length)&&!gz(t)}var Yv=yz,vz=Rv,wz=Yv,bz=_v,xz=gl;function kz(t,e,n){if(!xz(n))return!1;var r=typeof e;return(r=="number"?wz(n)&&bz(e,n.length):r=="string"&&e in n)?vz(n[e],t):!1}var Sz=kz,Cz=$v,Yb=1/0,Tz=17976931348623157e292;function Ez(t){if(!t)return t===0?t:0;if(t=Cz(t),t===Yb||t===-Yb){var e=t<0?-1:1;return e*Tz}return t===t?t:0}var Az=Ez,Mz=pz,Rz=Sz,zg=Az;function Oz(t){return function(e,n,r){return r&&typeof r!="number"&&Rz(e,n,r)&&(n=r=void 0),e=zg(e),n===void 0?(n=e,e=0):n=zg(n),r=r===void 0?e{m.drawImage(b,0,0,f,f)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else a<1&&(r.globalAlpha=a),r.drawImage(h,0,0,f,f,i,s,o,o),a<1&&(r.globalAlpha=1)}}function ZT(t){if(t.length===0)return;let e;for(const n of t)e=Math.min(e??n.y,n.y)}function yp(t,e,n,r,i,s,o,l,a){l=l??e;let u=e,c=t;const f=r-s;let d=!1;for(;ul&&a(u,c,h,!1,o&&c===r-1)===!0){d=!0;break}u+=h,c++}if(!d){u=n;for(let h=0;h!h.sticky))==null?void 0:d.sourceIndex)??0;if(a>f){const h=Math.max(l,f);let p=e,m=r;for(let b=s.sourceIndex-1;b>=h;b--)p-=o[b].width,m+=o[b].width;for(let b=s.sourceIndex+1;b<=a;b++)m+=o[b].width;c={x:p,y:n,width:m,height:i}}if(f>l){const h=Math.min(a,f-1);let p=e,m=r;for(let b=s.sourceIndex-1;b>=l;b--)p-=o[b].width,m+=o[b].width;for(let b=s.sourceIndex+1;b<=h;b++)m+=o[b].width;u={x:p,y:n,width:m,height:i}}return[u,c]}function Fz(t,e,n,r){if(r==="any")return nE(t,{x:e,y:n,width:1,height:1});if(r==="vertical"&&(e=t.x),r==="horizontal"&&(n=t.y),LT([e,n],t))return;const i=e-t.x,s=t.x+t.width-e,o=n-t.y+1,l=t.y+t.height-n,a=Math.min(r==="vertical"?Number.MAX_SAFE_INTEGER:i,r==="vertical"?Number.MAX_SAFE_INTEGER:s,r==="horizontal"?Number.MAX_SAFE_INTEGER:o,r==="horizontal"?Number.MAX_SAFE_INTEGER:l);return a===l?{x:t.x,y:t.y+t.height,width:t.width,height:n-t.y-t.height+1}:a===o?{x:t.x,y:n,width:t.width,height:t.y-n}:a===s?{x:t.x+t.width,y:t.y,width:e-t.x-t.width+1,height:t.height}:{x:e,y:t.y,width:t.x-e,height:t.height}}function mh(t,e,n,r,i,s,o,l){return t<=i+o&&i<=t+n&&e<=s+l&&s<=e+r}function vp(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function nE(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y),i=Math.max(t.x+t.width,e.x+e.width)-n,s=Math.max(t.y+t.height,e.y+e.height)-r;return{x:n,y:r,width:i,height:s}}function Bz(t,e){return t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height}function zz(t,e,n,r){if(t.x>e||t.y>n||t.x<0&&t.y<0&&t.x+t.width>e&&t.y+t.height>n)return;if(t.x>=0&&t.y>=0&&t.x+t.width<=e&&t.y+t.height<=n)return t;const i=-4,s=-4,o=e+4,l=n+4,a=i-t.x,u=t.x+t.width-o,c=s-t.y,f=t.y+t.height-l,d=a>0?t.x+Math.floor(a/r)*r:t.x,h=u>0?t.x+t.width-Math.floor(u/r)*r:t.x+t.width,p=c>0?t.y+Math.floor(c/r)*r:t.y,m=f>0?t.y+t.height-Math.floor(f/r)*r:t.y+t.height;return{x:d,y:p,width:h-d,height:m-p}}function $z(t,e,n,r,i){const[s,o,l,a]=e,[u,c,f,d]=i,{x:h,y:p,width:m,height:b}=t,g=[];if(m<=0||b<=0)return g;const y=h+m,w=p+b,k=hl,T=p+b>a,E=h>=s&&hs&&y<=l||hl,A=p>=o&&po&&w<=a||pa;if(E&&A){const _=Math.max(h,s),P=Math.max(p,o),N=Math.min(y,l),D=Math.min(w,a);g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:u,y:c,width:f-u+1,height:d-c+1}})}if(k&&x){const _=h,P=p,N=Math.min(y,s),D=Math.min(w,o);g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:0,y:0,width:u+1,height:c+1}})}if(x&&E){const _=Math.max(h,s),P=p,N=Math.min(y,l),D=Math.min(w,o);g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:u,y:0,width:f-u+1,height:c+1}})}if(x&&S){const _=Math.max(h,l),P=p,N=y,D=Math.min(w,o);g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:f,y:0,width:n-f+1,height:c+1}})}if(k&&A){const _=h,P=Math.max(p,o),N=Math.min(y,s),D=Math.min(w,a);g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:0,y:c,width:u+1,height:d-c+1}})}if(S&&A){const _=Math.max(h,l),P=Math.max(p,o),N=y,D=Math.min(w,a);g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:f,y:c,width:n-f+1,height:d-c+1}})}if(k&&T){const _=h,P=Math.max(p,a),N=Math.min(y,s),D=w;g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:0,y:d,width:u+1,height:r-d+1}})}if(T&&E){const _=Math.max(h,s),P=Math.max(p,a),N=Math.min(y,l),D=w;g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:u,y:d,width:f-u+1,height:r-d+1}})}if(S&&T){const _=Math.max(h,l),P=Math.max(p,a),N=y,D=w;g.push({rect:{x:_,y:P,width:N-_,height:D-P},clip:{x:f,y:d,width:n-f+1,height:r-d+1}})}return g}const jz={kind:Se.Loading,allowOverlay:!1};function qb(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,g,y,w,k,x,S,T,E,A,I,_,P,N,D,ee,ne,ie,H){let Y=(w==null?void 0:w.size)??Number.MAX_SAFE_INTEGER;const R=performance.now();let O=N.baseFontFull;t.font=O;const L={ctx:t},F=[0,0],W=b>0?vl(a,b,u):0;let $,ue;const ce=ZT(y);return Mo(e,l,s,o,i,(be,Ge,$e,at,_t)=>{const Qe=Math.max(0,at-Ge),it=Ge+Qe,Je=i+1,Wt=be.width-Qe,Pe=r-i-1;if(y.length>0){let ut=!1;for(let vt=0;vt{t.save(),t.beginPath(),t.rect(it,Je,Wt,Pe),t.clip()},Ie=k.columns.hasIndex(be.sourceIndex),Le=f(be.group??"").overrideTheme,nt=be.themeOverride===void 0&&Le===void 0?N:yo(N,Le,be.themeOverride),_e=nt.baseFontFull;_e!==O&&(O=_e,t.font=_e),me();let ft;return yp(_t,$e,r,a,u,b,g,ce,(ut,vt,he,rt,st)=>{var Lt,Mt,Un;if(vt<0||(F[0]=be.sourceIndex,F[1]=vt,w!==void 0&&!w.has(F)))return;if(y.length>0){let lt=!1;for(let Ut=0;Utwt.span!==void 0&<>=wt.span[0]&<<=wt.span[1]);ve&&!p&&m?de=0:ve&&m&&(de=Math.max(de,1)),ht&&de++,ve||(Ve&&de++,Ie&&!st&&de++);const Ne=wt.kind===Se.Protected?J.bgCellMedium:J.bgCell;let Ue;if((rt||Ne!==N.bgCell)&&(Ue=Nr(Ne,Ue)),de>0||sn){sn&&(Ue=Nr(J.bgHeader,Ue));for(let lt=0;ltH&&!Ze){const lt=J.baseFontFull;lt!==O&&(t.font=lt,O=lt),ft=rE(t,wt,be.sourceIndex,vt,De,Et,ct,ut,dt,he,de>0,J,Ue??J.bgCell,T,E,(Vt==null?void 0:Vt.hoverAmount)??0,I,P,R,_,ft,D,ee,ne,ie)}return ye&&t.restore(),wt.style==="faded"&&(t.globalAlpha=1),Y--,fe&&(t.restore(),(Un=ft==null?void 0:ft.deprep)==null||Un.call(ft,L),ft=void 0,me(),O=_e,t.font=_e),Y<=0}),t.restore(),Y<=0}),$}const wu=[0,0],bu={x:0,y:0,width:0,height:0},$g=[void 0,()=>{}];let O0=!1;function Hz(){O0=!0}function rE(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,g,y,w,k,x,S,T,E){var ee,ne;let A,I;b!==void 0&&b[0][0]===n&&b[0][1]===r&&(A=b[1][0],I=b[1][1]);let _;wu[0]=n,wu[1]=r,bu.x=o,bu.y=l,bu.width=a,bu.height=u,$g[0]=S.getValue(wu),$g[1]=ie=>S.setValue(wu,ie),O0=!1;const P={ctx:t,theme:f,col:n,row:r,cell:e,rect:bu,highlighted:c,cellFillColor:d,hoverAmount:m,frameTime:y,hoverX:A,drawState:$g,hoverY:I,imageLoader:h,spriteManager:p,hyperWrapping:g,overrideCursor:A!==void 0?E:void 0,requestAnimationFrame:Hz},N=H4(P,e.lastUpdated,y,k,i,s),D=T(e);if(D!==void 0){(k==null?void 0:k.renderer)!==D&&((ee=k==null?void 0:k.deprep)==null||ee.call(k,P),k=void 0);const ie=(ne=D.drawPrep)==null?void 0:ne.call(D,P,k);w!==void 0&&!na(P.cell)?w(P,()=>D.draw(P,e)):D.draw(P,e),_=ie===void 0?void 0:{deprep:ie==null?void 0:ie.deprep,fillStyle:ie==null?void 0:ie.fillStyle,font:ie==null?void 0:ie.font,renderer:D}}return(N||O0)&&(x==null||x(wu)),_}function qv(t,e,n,r,i,s,o,l,a=-20,u=-20,c=32,f="center",d="square"){const h=Math.floor(i+o/2),p=d==="circle"?1e4:e.roundingRadius??4;let m=ET(c,o,e.cellVerticalPadding),b=m/2;const g=TT(f,r,s,e.cellHorizontalPadding,m),y=CT(g,h,m),w=AT(r+a,i+u,y);switch(n){case!0:{t.beginPath(),rs(t,g-m/2,h-m/2,m,m,p),d==="circle"&&(b*=.8,m*=.8),t.fillStyle=l?e.accentColor:e.textMedium,t.fill(),t.beginPath(),t.moveTo(g-b+m/4.23,h-b+m/1.97),t.lineTo(g-b+m/2.42,h-b+m/1.44),t.lineTo(g-b+m/1.29,h-b+m/3.25),t.strokeStyle=e.bgCell,t.lineJoin="round",t.lineCap="round",t.lineWidth=1.9,t.stroke();break}case ah:case!1:{t.beginPath(),rs(t,g-m/2+.5,h-m/2+.5,m-1,m-1,p),t.lineWidth=1,t.strokeStyle=w?e.textDark:e.textMedium,t.stroke();break}case Lv:{t.beginPath(),rs(t,g-m/2,h-m/2,m,m,p),t.fillStyle=w?e.textMedium:e.textLight,t.fill(),d==="circle"&&(b*=.8,m*=.8),t.beginPath(),t.moveTo(g-m/3,h),t.lineTo(g+m/3,h),t.strokeStyle=e.bgCell,t.lineCap="round",t.lineWidth=1.9,t.stroke();break}default:Sc()}}function Wz(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,g,y){const w=o+l;if(w<=0)return;t.fillStyle=f.bgHeader,t.fillRect(0,0,i,w);const[k,x]=(r==null?void 0:r[0])??[],S=f.headerFontFull;t.font=S,Mo(e,0,s,0,w,(T,E,A,I)=>{var L;if(b!==void 0&&!b.has([T.sourceIndex,-1]))return;const _=Math.max(0,I-E);t.save(),t.beginPath(),t.rect(E+_,l,T.width-_,o),t.clip();const P=m(T.group??"").overrideTheme,N=T.themeOverride===void 0&&P===void 0?f:yo(f,P,T.themeOverride);N.bgHeader!==f.bgHeader&&(t.fillStyle=N.bgHeader,t.fill()),N!==f&&(t.font=N.baseFontFull);const D=c.columns.hasIndex(T.sourceIndex),ee=a!==void 0||u,ne=!ee&&x===-1&&k===T.sourceIndex,ie=ee?0:((L=h.find(F=>F.item[0]===T.sourceIndex&&F.item[1]===-1))==null?void 0:L.hoverAmount)??0,H=(c==null?void 0:c.current)!==void 0&&c.current.cell[0]===T.sourceIndex,Y=D?N.accentColor:H?N.bgHeaderHasFocus:N.bgHeader,R=n?l:0,O=T.sourceIndex===0?0:1;D?(t.fillStyle=Y,t.fillRect(E+O,R,T.width-O,o)):(H||ie>0)&&(t.beginPath(),t.rect(E+O,R,T.width-O,o),H&&(t.fillStyle=N.bgHeaderHasFocus,t.fill()),ie>0&&(t.globalAlpha=ie,t.fillStyle=N.bgHeaderHovered,t.fill(),t.globalAlpha=1)),oE(t,E,R,T.width,o,T,D,N,ne,H,ie,d,g,y),t.restore()}),n&&Vz(t,e,i,s,l,r,f,d,h,p,m,b)}function Vz(t,e,n,r,i,s,o,l,a,u,c,f){const[h,p]=(s==null?void 0:s[0])??[];let m=0;eE(e,n,r,i,(b,g,y,w,k,x)=>{if(f!==void 0&&!f.hasItemInRectangle({x:b[0],y:-2,width:b[1]-b[0]+1,height:1}))return;t.save(),t.beginPath(),t.rect(y,w,k,x),t.clip();const S=c(g),T=(S==null?void 0:S.overrideTheme)===void 0?o:yo(o,S.overrideTheme),E=p===-2&&h!==void 0&&h>=b[0]&&h<=b[1],A=E?T.bgHeaderHovered:T.bgHeader;if(A!==o.bgHeader&&(t.fillStyle=A,t.fill()),t.fillStyle=T.textGroupHeader??T.textHeader,S!==void 0){let I=y;if(S.icon!==void 0&&(l.drawSprite(S.icon,"normal",t,I+8,(i-20)/2,20,T),I+=26),t.fillText(S.name,I+8,i/2+Is(t,o.headerFontFull)),S.actions!==void 0&&E){const _=sE({x:y,y:w,width:k,height:x},S.actions);t.beginPath();const P=_[0].x-10,N=y+k-P;t.rect(P,0,N,i);const D=t.createLinearGradient(P,0,P+N,0),ee=al(A,0);D.addColorStop(0,ee),D.addColorStop(10/N,A),D.addColorStop(1,A),t.fillStyle=D,t.fill(),t.globalAlpha=.6;const[ne,ie]=(s==null?void 0:s[1])??[-1,-1];for(let H=0;H35){const k=d?35:r-35,x=d?35*.7:r-35*.7,S=k/r,T=x/r,E=t.createLinearGradient(e,0,e+r,0),A=al(m,0);E.addColorStop(d?1:0,m),E.addColorStop(S,m),E.addColorStop(T,A),E.addColorStop(d?0:1,A),t.fillStyle=E}else t.fillStyle=m;if(d&&(t.textAlign="right"),t.fillText(s.title,y,n+i/2+Is(t,l.headerFontFull)),d&&(t.textAlign="left"),b&&s.hasMenu===!0)if(s.menuIcon===void 0||s.menuIcon===uh.Triangle){t.beginPath();const w=h.x+h.width/2-5.5,k=h.y+h.height/2-3;K4(t,[{x:w,y:k},{x:w+11,y:k},{x:w+5.5,y:k+6}],1),t.fillStyle=m,t.fill()}else if(s.menuIcon===uh.Dots){t.beginPath();const w=h.x+h.width/2,k=h.y+h.height/2;U4(t,w,k),t.fillStyle=m,t.fill()}else{const w=h.x+(h.width-l.headerIconSize)/2,k=h.y+(h.height-l.headerIconSize)/2;c.drawSprite(s.menuIcon,"normal",t,w,k,l.headerIconSize,l)}}function oE(t,e,n,r,i,s,o,l,a,u,c,f,d,h){const p=Hv(s.title)==="rtl",m=iE(e,n,r,i,p);d!==void 0?d({ctx:t,theme:l,rect:{x:e,y:n,width:r,height:i},column:s,columnIndex:s.sourceIndex,isSelected:o,hoverAmount:c,isHovered:a,hasSelectedCell:u,spriteManager:f,menuBounds:m},()=>Qb(t,e,n,r,i,s,o,l,a,c,f,h,p,m)):Qb(t,e,n,r,i,s,o,l,a,c,f,h,p,m)}var Uz=ml,Kz=function(){try{var t=Uz(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Xz=Kz,Jb=Xz;function Gz(t,e,n){e=="__proto__"&&Jb?Jb(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var Yz=Gz;function qz(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++il))return!1;var u=s.get(t),c=s.get(e);if(u&&c)return u==e&&c==t;var f=-1,d=!0,h=n&rj?new Z5:void 0;for(s.set(t,e),s.set(e,t);++f{if(k!==e[e.length-1])return;x+=k.width;const A=Math.max(x,T);A>r||(t.save(),t.beginPath(),t.rect(A,s+1,1e4,i-s-1),t.clip(),yp(E,S,i,u,c,p,m,w,(I,_,P,N)=>{if(!N&&b.length>0&&!b.some(H=>mh(x,I,1e4,P,H.x,H.y,H.width,H.height)))return;const D=d.hasIndex(_),ee=h.hasIndex(_);t.beginPath();const ne=f==null?void 0:f(_),ie=ne===void 0?y:yo(y,ne);ie.bgCell!==y.bgCell&&(t.fillStyle=ie.bgCell,t.fillRect(x,I,1e4,P)),ee&&(t.fillStyle=ie.bgHeader,t.fillRect(x,I,1e4,P)),D&&(t.fillStyle=ie.accentLight,t.fillRect(x,I,1e4,P))}),t.restore())})}function G8(t,e,n,r,i,s,o,l,a){let u=!1;for(const p of e)if(!p.sticky){u=o(p.sourceIndex);break}const c=a.horizontalBorderColor??a.borderColor,f=a.borderColor,d=u?Ma(e):0;let h;if(d!==0&&(h=jb(f,a.bgCell),t.beginPath(),t.moveTo(d+.5,0),t.lineTo(d+.5,r),t.strokeStyle=h,t.stroke()),i>0){const p=f===c&&h!==void 0?h:jb(c,a.bgCell),m=vl(s,i,l);t.beginPath(),t.moveTo(0,r-m+.5),t.lineTo(n,r-m+.5),t.strokeStyle=p,t.stroke()}}const yE=(t,e,n)=>{let r=0,i=e,s=0,o=n;if(t!==void 0&&t.length>0){r=Number.MAX_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;for(const l of t)r=Math.min(r,l.x-1),i=Math.max(i,l.x+l.width+1),s=Math.min(s,l.y-1),o=Math.max(o,l.y+l.height+1)}return{minX:r,maxX:i,minY:s,maxY:o}};function Y8(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p){var P;const m=p.bgCell,{minX:b,maxX:g,minY:y,maxY:w}=yE(l,s,o),k=[],x=o-vl(h,d,u);let S=a,T=n,E=0;for(;S+i=y&&N<=w-1){const ee=c==null?void 0:c(T),ne=ee==null?void 0:ee.bgCell;ne!==void 0&&ne!==m&&T>=h-d&&k.push({x:b,y:N,w:g-b,h:D,color:ne})}S+=D,T0)for(let N=0;N=b&&ee<=g&&f(N+1)&&k.push({x:ee,y:E,w:D.width,h:I,color:ne}),A+=D.width}if(k.length===0)return;let _;t.beginPath();for(let N=k.length-1;N>=0;N--){const D=k[N];_===void 0?_=D.color:D.color!==_&&(t.fillStyle=_,t.fill(),t.beginPath(),_=D.color),t.rect(D.x,D.y,D.w,D.h)}_!==void 0&&(t.fillStyle=_,t.fill()),t.beginPath()}function vx(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,g=!1){if(a!==void 0){t.beginPath(),t.save(),t.rect(0,0,s,o);for(const P of a)t.rect(P.x+1,P.y+1,P.width-1,P.height-1);t.clip("evenodd")}const y=b.horizontalBorderColor??b.borderColor,w=b.borderColor,{minX:k,maxX:x,minY:S,maxY:T}=yE(l,s,o),E=[];t.beginPath();let A=.5;for(let P=0;P=k&&D<=x&&h(P+1)&&E.push({x1:D,y1:Math.max(u,S),x2:D,y2:Math.min(o,T),color:w})}let I=o+.5;for(let P=m-p;P=S&&ee<=T-1){const ne=d==null?void 0:d(N);E.push({x1:k,y1:ee,x2:x,y2:ee,color:(ne==null?void 0:ne.horizontalBorderColor)??(ne==null?void 0:ne.borderColor)??y})}P+=f(N),N++}}const _=K8(E,P=>P.color);for(const P of Object.keys(_)){t.strokeStyle=P;for(const N of _[P])t.moveTo(N.x1,N.y1),t.lineTo(N.x2,N.y2);t.stroke(),t.beginPath()}a!==void 0&&t.restore()}function q8(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b,g,y){const w=[];t.imageSmoothingEnabled=!1;const k=Math.min(i.cellYOffset,o),x=Math.max(i.cellYOffset,o);let S=0;if(typeof g=="number")S+=(x-k)*g;else for(let D=k;Di.cellYOffset&&(S=-S),S+=a-i.translateY;const T=Math.min(i.cellXOffset,s),E=Math.max(i.cellXOffset,s);let A=0;for(let D=T;Di.cellXOffset&&(A=-A),A+=l-i.translateX;const I=Ma(b);if(A!==0&&S!==0)return{regions:[]};const _=u>0?vl(d,u,g):0,P=c-I-Math.abs(A),N=f-h-_-Math.abs(S)-1;if(P>150&&N>150){const D={sx:0,sy:0,sw:c*p,sh:f*p,dx:0,dy:0,dw:c*p,dh:f*p};if(S>0?(D.sy=(h+1)*p,D.sh=N*p,D.dy=(S+h+1)*p,D.dh=N*p,w.push({x:0,y:h,width:c,height:S+1})):S<0&&(D.sy=(-S+h+1)*p,D.sh=N*p,D.dy=(h+1)*p,D.dh=N*p,w.push({x:0,y:f+S-_,width:c,height:-S+_})),A>0?(D.sx=I*p,D.sw=P*p,D.dx=(A+I)*p,D.dw=P*p,w.push({x:I-1,y:0,width:A+2,height:f})):A<0&&(D.sx=(I-A)*p,D.sw=P*p,D.dx=I*p,D.dw=P*p,w.push({x:c+A,y:0,width:-A,height:f})),t.setTransform(1,0,0,1,0,0),y){if(I>0&&A!==0&&S===0&&(r===void 0||(n==null?void 0:n[1])!==!1)){const ee=I*p,ne=f*p;t.drawImage(e,0,0,ee,ne,0,0,ee,ne)}if(_>0&&A===0&&S!==0&&(r===void 0||(n==null?void 0:n[0])!==!1)){const ee=(f-_)*p,ne=c*p,ie=_*p;t.drawImage(e,0,ee,ne,ie,0,ee,ne,ie)}}t.drawImage(e,D.sx,D.sy,D.sw,D.sh,D.dx,D.dy,D.dw,D.dh),t.scale(p,p)}return t.imageSmoothingEnabled=!0,{regions:w}}function Q8(t,e,n,r,i,s,o,l,a,u){const c=[];return e!==t.cellXOffset||n!==t.cellYOffset||r!==t.translateX||i!==t.translateY||Mo(a,n,r,i,l,(f,d,h,p)=>{if(f.sourceIndex===u){const m=Math.max(d,p)+1;return c.push({x:m,y:0,width:s-m,height:o}),!0}}),c}function J8(t,e){if(e===void 0||t.width!==e.width||t.height!==e.height||t.theme!==e.theme||t.headerHeight!==e.headerHeight||t.rowHeight!==e.rowHeight||t.rows!==e.rows||t.freezeColumns!==e.freezeColumns||t.getRowThemeOverride!==e.getRowThemeOverride||t.isFocused!==e.isFocused||t.isResizing!==e.isResizing||t.verticalBorder!==e.verticalBorder||t.getCellContent!==e.getCellContent||t.highlightRegions!==e.highlightRegions||t.selection!==e.selection||t.dragAndDropState!==e.dragAndDropState||t.prelightCells!==e.prelightCells||t.touchMode!==e.touchMode||t.maxScaleFactor!==e.maxScaleFactor)return!1;if(t.mappedColumns!==e.mappedColumns){if(t.mappedColumns.length>100||t.mappedColumns.length!==e.mappedColumns.length)return!1;let n;for(let r=0;rT.style!=="no-outline");if(b===void 0||b.length===0)return;const g=Ma(l),y=vl(h,d,f),w=[a,0,l.length,h-d],k=[g,0,e,n-y],x=b.map(T=>{const E=T.range,A=T.style??"dashed";return $z(E,w,e,n,k).map(I=>{const _=I.rect,P=M0(_.x,_.y,e,n,c,u+c,r,i,s,o,h,a,d,l,f),N=_.width===1&&_.height===1?P:M0(_.x+_.width-1,_.y+_.height-1,e,n,c,u+c,r,i,s,o,h,a,d,l,f);return _.x+_.width>=l.length&&(N.width-=1),_.y+_.height>=h&&(N.height-=1),{color:T.color,style:A,clip:I.clip,rect:zz({x:P.x,y:P.y,width:N.x+N.width-P.x,height:N.y+N.height-P.y},e,n,8)}})}),S=()=>{t.lineWidth=1;let T=!1;for(const E of x)for(const A of E)if((A==null?void 0:A.rect)!==void 0&&mh(0,0,e,n,A.rect.x,A.rect.y,A.rect.width,A.rect.height)){const I=T,_=!Bz(A.clip,A.rect);_&&(t.save(),t.rect(A.clip.x,A.clip.y,A.clip.width,A.clip.height),t.clip()),A.style==="dashed"&&!T?(t.setLineDash([5,3]),T=!0):(A.style==="solid"||A.style==="solid-outline")&&T&&(t.setLineDash([]),T=!1),t.strokeStyle=A.style==="solid-outline"?Nr(Nr(A.color,m.borderColor),m.bgCell):al(A.color,1),t.strokeRect(A.rect.x+.5,A.rect.y+.5,A.rect.width-1,A.rect.height-1),_&&(t.restore(),T=I)}T&&t.setLineDash([])};return S(),S}function bx(t,e,n,r,i){t.beginPath(),t.moveTo(e,n),t.lineTo(e,r),t.lineWidth=2,t.strokeStyle=i,t.stroke(),t.globalAlpha=1}function Wg(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,b){if(c.current===void 0)return;const g=c.current.range,y=c.current.cell,w=[g.x+g.width-1,g.y+g.height-1];if(y[1]>=b&&w[1]>=b||!o.some(D=>D.sourceIndex===y[0]||D.sourceIndex===w[0]))return;const[x,S]=c.current.cell,T=d(c.current.cell),E=T.span??[x,x],A=S>=b-h,I=h>0&&!A?vl(b,h,f)-1:0,_=w[1];let P;if(Mo(o,r,i,s,u,(D,ee,ne,ie,H)=>{if(D.sticky&&x>D.sourceIndex)return;const Y=D.sourceIndexE[1],O=D.sourceIndex===w[0];if(!(!O&&(Y||R)))return yp(H,ne,n,b,f,h,p,void 0,(L,F,W)=>{if(F!==S&&F!==_)return;let $=ee,ue=D.width;if(T.span!==void 0){const be=tE(T.span,ee,L,D.width,W,D,l),Ge=D.sticky?be[0]:be[1];Ge!==void 0&&($=Ge.x,ue=Ge.width)}return F===_&&O&&m&&(P=()=>{var be;ie>$&&!D.sticky&&(t.beginPath(),t.rect(ie,0,e-ie,n),t.clip()),t.beginPath(),t.rect($+ue-4,L+W-4,4,4),t.fillStyle=((be=D.themeOverride)==null?void 0:be.accentColor)??a.accentColor,t.fill()}),P!==void 0}),P!==void 0}),P===void 0)return;const N=()=>{t.save(),t.beginPath(),t.rect(0,u,e,n-u-I),t.clip(),P==null||P(),t.restore()};return N(),N}function Z8(t,e,n,r,i,s,o,l,a){a===void 0||a.size===0||(t.beginPath(),eE(e,n,s,r,(u,c,f,d,h,p)=>{a.hasItemInRectangle({x:u[0],y:-2,width:u[1]-u[0]+1,height:1})&&t.rect(f,d,h,p)}),Mo(e,l,s,o,i,(u,c,f,d)=>{const h=Math.max(0,d-c),p=c+h+1,m=u.width-h-1;a.has([u.sourceIndex,-1])&&t.rect(p,r,m,i-r)}),t.clip())}function eW(t,e,n,r,i,s,o,l,a,u){let c=0;return Mo(t,s,r,i,n,(f,d,h,p,m)=>(yp(m,h,e,o,l,a,u,void 0,(b,g,y,w)=>{w||(c=Math.max(g,c))}),!0)),c}function xx(t,e){var ye;const{canvasCtx:n,headerCanvasCtx:r,width:i,height:s,cellXOffset:o,cellYOffset:l,translateX:a,translateY:u,mappedColumns:c,enableGroups:f,freezeColumns:d,dragAndDropState:h,theme:p,drawFocus:m,headerHeight:b,groupHeaderHeight:g,disabledRows:y,rowHeight:w,verticalBorder:k,overrideCursor:x,isResizing:S,selection:T,fillHandle:E,freezeTrailingRows:A,rows:I,getCellContent:_,getGroupDetails:P,getRowThemeOverride:N,isFocused:D,drawHeaderCallback:ee,prelightCells:ne,drawCellCallback:ie,highlightRegions:H,resizeCol:Y,imageLoader:R,lastBlitData:O,hoverValues:L,hyperWrapping:F,hoverInfo:W,spriteManager:$,maxScaleFactor:ue,hasAppendRow:ce,touchMode:be,enqueue:Ge,renderStateProvider:$e,getCellRenderer:at,renderStrategy:_t,bufferACtx:Qe,bufferBCtx:it,damage:Je,minimumCellWidth:Wt}=t;if(i===0||s===0)return;const Pe=_t==="double-buffer",me=Math.min(ue,Math.ceil(window.devicePixelRatio??1)),Ie=_t!=="direct"&&J8(t,e),Le=n.canvas;(Le.width!==i*me||Le.height!==s*me)&&(Le.width=i*me,Le.height=s*me,Le.style.width=i+"px",Le.style.height=s+"px");const nt=r.canvas,_e=f?g+b:b,ft=_e+1;(nt.width!==i*me||nt.height!==ft*me)&&(nt.width=i*me,nt.height=ft*me,nt.style.width=i+"px",nt.style.height=ft+"px");const ut=Qe.canvas,vt=it.canvas;Pe&&(ut.width!==i*me||ut.height!==s*me)&&(ut.width=i*me,ut.height=s*me,O.current!==void 0&&(O.current.aBufferScroll=void 0)),Pe&&(vt.width!==i*me||vt.height!==s*me)&&(vt.width=i*me,vt.height=s*me,O.current!==void 0&&(O.current.bBufferScroll=void 0));const he=O.current;if(Ie===!0&&o===(he==null?void 0:he.cellXOffset)&&l===(he==null?void 0:he.cellYOffset)&&a===(he==null?void 0:he.translateX)&&u===(he==null?void 0:he.translateY))return;let rt=null;Pe&&(rt=n);const st=r;let Ve;Pe?Je!==void 0?Ve=(he==null?void 0:he.lastBuffer)==="b"?it:Qe:Ve=(he==null?void 0:he.lastBuffer)==="b"?Qe:it:Ve=n;const sn=Ve.canvas,wt=Pe?sn===ut?vt:ut:Le,ct=typeof w=="number"?()=>w:w;st.save(),Ve.save(),st.beginPath(),Ve.beginPath(),st.textBaseline="middle",Ve.textBaseline="middle",me!==1&&(st.scale(me,me),Ve.scale(me,me));const dt=A0(c,o,i,h,a);let fe=[];const Ze=m&&((ye=T.current)==null?void 0:ye.cell[1])===l&&u===0;let V=!1;if(H!==void 0){for(const De of H)if(De.style!=="no-outline"&&De.range.y===l&&u===0){V=!0;break}}const pe=()=>{Wz(st,dt,f,W,i,a,b,g,h,S,T,p,$,L,k,P,Je,ee,be),vx(st,dt,l,a,u,i,s,void 0,void 0,g,_e,ct,N,k,A,I,p,!0),st.beginPath(),st.moveTo(0,ft-.5),st.lineTo(i,ft-.5),st.strokeStyle=Nr(p.headerBottomBorderColor??p.horizontalBorderColor??p.borderColor,p.bgHeader),st.stroke(),V&&wx(st,i,s,o,l,a,u,c,d,b,g,w,A,I,H,p),Ze&&Wg(st,i,s,l,a,u,dt,c,p,_e,T,ct,_,A,ce,E,I)};if(Je!==void 0){const De=dt[dt.length-1].sourceIndex+1,Et=Je.hasItemInRegion([{x:o,y:-2,width:De,height:2},{x:o,y:l,width:De,height:300},{x:0,y:l,width:d,height:300},{x:0,y:-2,width:d,height:2},{x:o,y:I-A,width:De,height:A,when:A>0}]),Vt=Lt=>{qb(Lt,dt,c,s,_e,a,u,l,I,ct,_,P,N,y,D,m,A,ce,fe,Je,T,ne,H,R,$,L,W,ie,F,p,Ge,$e,at,x,Wt);const Mt=T.current;E&&m&&Mt!==void 0&&Je.has(FT(Mt.range))&&Wg(Lt,i,s,l,a,u,dt,c,p,_e,T,ct,_,A,ce,E,I)};Et&&(Vt(Ve),rt!==null&&(rt.save(),rt.scale(me,me),rt.textBaseline="middle",Vt(rt),rt.restore()),Je.hasHeader()&&(Z8(st,dt,i,g,_e,a,u,l,Je),pe())),Ve.restore(),st.restore();return}if((Ie!==!0||o!==(he==null?void 0:he.cellXOffset)||a!==(he==null?void 0:he.translateX)||Ze!==(he==null?void 0:he.mustDrawFocusOnHeader)||V!==(he==null?void 0:he.mustDrawHighlightRingsOnHeader))&&pe(),Ie===!0){_r(wt!==void 0&&he!==void 0);const{regions:De}=q8(Ve,wt,wt===ut?he.aBufferScroll:he.bBufferScroll,wt===ut?he.bBufferScroll:he.aBufferScroll,he,o,l,a,u,A,i,s,I,_e,me,c,dt,w,Pe);fe=De}else Ie!==!1&&(_r(he!==void 0),fe=Q8(he,o,l,a,u,i,s,_e,dt,Ie));G8(Ve,dt,i,s,A,I,k,ct,p);const J=wx(Ve,i,s,o,l,a,u,c,d,b,g,w,A,I,H,p),ve=m?Wg(Ve,i,s,l,a,u,dt,c,p,_e,T,ct,_,A,ce,E,I):void 0;if(Ve.fillStyle=p.bgCell,fe.length>0){Ve.beginPath();for(const De of fe)Ve.rect(De.x,De.y,De.width,De.height);Ve.clip(),Ve.fill(),Ve.beginPath()}else Ve.fillRect(0,0,i,s);const de=qb(Ve,dt,c,s,_e,a,u,l,I,ct,_,P,N,y,D,m,A,ce,fe,Je,T,ne,H,R,$,L,W,ie,F,p,Ge,$e,at,x,Wt);X8(Ve,dt,c,i,s,_e,a,u,l,I,ct,N,T.rows,y,A,ce,fe,Je,p),Y8(Ve,dt,l,a,u,i,s,fe,_e,ct,N,k,A,I,p),vx(Ve,dt,l,a,u,i,s,fe,de,g,_e,ct,N,k,A,I,p),J==null||J(),ve==null||ve(),S&&Mo(dt,0,a,0,_e,(De,Et)=>De.sourceIndex===Y?(bx(st,Et+De.width,0,_e+1,Nr(p.resizeIndicatorColor??p.accentLight,p.bgHeader)),bx(Ve,Et+De.width,_e,s,Nr(p.resizeIndicatorColor??p.accentLight,p.bgCell)),!0):!1),rt!==null&&(rt.fillStyle=p.bgCell,rt.fillRect(0,0,i,s),rt.drawImage(Ve.canvas,0,0));const ht=eW(dt,s,_e,a,u,l,I,ct,A,ce);R==null||R.setWindow({x:o,y:l,width:dt.length,height:ht-l},d,Array.from({length:A},(De,Et)=>I-1-Et));const Ne=he!==void 0&&(o!==he.cellXOffset||a!==he.translateX),Ue=he!==void 0&&(l!==he.cellYOffset||u!==he.translateY);O.current={cellXOffset:o,cellYOffset:l,translateX:a,translateY:u,mustDrawFocusOnHeader:Ze,mustDrawHighlightRingsOnHeader:V,lastBuffer:Pe?sn===ut?"a":"b":void 0,aBufferScroll:sn===ut?[Ne,Ue]:he==null?void 0:he.aBufferScroll,bBufferScroll:sn===vt?[Ne,Ue]:he==null?void 0:he.bBufferScroll},Ve.restore(),st.restore()}const tW=80;function nW(t){const e=t-1;return e*e*e+1}class rW{constructor(e){bt(this,"callback");bt(this,"currentHoveredItem");bt(this,"leavingItems",[]);bt(this,"lastAnimationTime");bt(this,"addToLeavingItems",e=>{this.leavingItems.some(r=>qu(r.item,e.item))||this.leavingItems.push(e)});bt(this,"removeFromLeavingItems",e=>{const n=this.leavingItems.find(r=>qu(r.item,e));return this.leavingItems=this.leavingItems.filter(r=>r!==n),(n==null?void 0:n.hoverAmount)??0});bt(this,"cleanUpLeavingElements",()=>{this.leavingItems=this.leavingItems.filter(e=>e.hoverAmount>0)});bt(this,"shouldStep",()=>{const e=this.leavingItems.length>0,n=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return e||n});bt(this,"getAnimatingItems",()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(e=>({...e,hoverAmount:nW(e.hoverAmount)})));bt(this,"step",e=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=e;else{const r=(e-this.lastAnimationTime)/tW;for(const s of this.leavingItems)s.hoverAmount=xi(s.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=xi(this.currentHoveredItem.hoverAmount+r,0,1));const i=this.getAnimatingItems();this.callback(i),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=e,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0});bt(this,"setHovered",e=>{var n;if(!qu((n=this.currentHoveredItem)==null?void 0:n.item,e)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),e!==void 0){const r=this.removeFromLeavingItems(e);this.currentHoveredItem={item:e,hoverAmount:r}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}});this.callback=e}}class iW{constructor(e){bt(this,"fn");bt(this,"val");this.fn=e}get value(){return this.val??(this.val=this.fn())}}function Jv(t){return new iW(t)}const sW=Jv(()=>window.navigator.userAgent.includes("Firefox")),wh=Jv(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),bh=Jv(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function oW(t){const e=v.useRef([]),n=v.useRef(0),r=v.useRef(t);r.current=t;const i=v.useCallback(()=>{const s=()=>window.requestAnimationFrame(o),o=()=>{const l=e.current.map(Xv);e.current=[],r.current(new Ju(l)),e.current.length>0?n.current++:n.current=0};window.requestAnimationFrame(n.current>600?s:o)},[]);return v.useCallback(s=>{e.current.length===0&&i();const o=ki(s[0],s[1]);e.current.includes(o)||e.current.push(o)},[i])}const Xs="header",Dr="group-header",xh="out-of-bounds";var ia;(function(t){t[t.Start=-2]="Start",t[t.StartPadding=-1]="StartPadding",t[t.Center=0]="Center",t[t.EndPadding=1]="EndPadding",t[t.End=2]="End"})(ia||(ia={}));function vE(t,e){return t===e?!0:(t==null?void 0:t.kind)==="out-of-bounds"?(t==null?void 0:t.kind)===(e==null?void 0:e.kind)&&(t==null?void 0:t.location[0])===(e==null?void 0:e.location[0])&&(t==null?void 0:t.location[1])===(e==null?void 0:e.location[1])&&(t==null?void 0:t.region[0])===(e==null?void 0:e.region[0])&&(t==null?void 0:t.region[1])===(e==null?void 0:e.region[1]):(t==null?void 0:t.kind)===(e==null?void 0:e.kind)&&(t==null?void 0:t.location[0])===(e==null?void 0:e.location[0])&&(t==null?void 0:t.location[1])===(e==null?void 0:e.location[1])}const kx=6,lW=(t,e)=>{if(t.kind===Se.Custom)return t.copyData;const n=e==null?void 0:e(t);return(n==null?void 0:n.getAccessibilityString(t))??""},aW=(t,e)=>{const{width:n,height:r,accessibilityHeight:i,columns:s,cellXOffset:o,cellYOffset:l,headerHeight:a,fillHandle:u=!1,groupHeaderHeight:c,rowHeight:f,rows:d,getCellContent:h,getRowThemeOverride:p,onHeaderMenuClick:m,enableGroups:b,isFilling:g,onCanvasFocused:y,onCanvasBlur:w,isFocused:k,selection:x,freezeColumns:S,onContextMenu:T,freezeTrailingRows:E,fixedShadowX:A=!0,fixedShadowY:I=!0,drawFocusRing:_,onMouseDown:P,onMouseUp:N,onMouseMoveRaw:D,onMouseMove:ee,onItemHovered:ne,dragAndDropState:ie,firstColAccessible:H,onKeyDown:Y,onKeyUp:R,highlightRegions:O,canvasRef:L,onDragStart:F,onDragEnd:W,eventTargetRef:$,isResizing:ue,resizeColumn:ce,isDragging:be,isDraggable:Ge=!1,allowResize:$e,disabledRows:at,hasAppendRow:_t,getGroupDetails:Qe,theme:it,prelightCells:Je,headerIcons:Wt,verticalBorder:Pe,drawCell:me,drawHeader:Ie,onCellFocused:Le,onDragOverCell:nt,onDrop:_e,onDragLeave:ft,imageWindowLoader:ut,smoothScrollX:vt=!1,smoothScrollY:he=!1,experimental:rt,getCellRenderer:st}=t,Ve=t.translateX??0,sn=t.translateY??0,wt=Math.max(S,Math.min(s.length-1,o)),ct=v.useRef(null),dt=ut,fe=v.useRef(),[Ze,V]=v.useState(!1),pe=v.useRef([]),J=v.useRef(),[ve,de]=v.useState(),[ht,Ne]=v.useState(),Ue=v.useRef(null),[ye,De]=v.useState(),[Et,Vt]=v.useState(!1),Lt=v.useRef(Et);Lt.current=Et;const Mt=v.useMemo(()=>new Lz(Wt,()=>{Ni.current=void 0,Po.current()}),[Wt]),Un=b?c+a:a,lt=v.useRef(-1),Ut=((rt==null?void 0:rt.enableFirefoxRescaling)??!1)&&sW.value,Ft=((rt==null?void 0:rt.enableSafariRescaling)??!1)&&wh.value;v.useLayoutEffect(()=>{window.devicePixelRatio===1||!Ut&&!Ft||(lt.current!==-1&&V(!0),window.clearTimeout(lt.current),lt.current=window.setTimeout(()=>{V(!1),lt.current=-1},200))},[l,wt,Ve,sn,Ut,Ft]);const Kt=I4(s,S),Fn=A?Ma(Kt,ie):0,Zt=v.useCallback((j,re,xe)=>{const ge=j.getBoundingClientRect();if(re>=Kt.length||xe>=d)return;const oe=ge.width/n,Ae=M0(re,xe,n,r,c,Un,wt,l,Ve,sn,d,S,E,Kt,f);return oe!==1&&(Ae.x*=oe,Ae.y*=oe,Ae.width*=oe,Ae.height*=oe),Ae.x+=ge.x,Ae.y+=ge.y,Ae},[n,r,c,Un,wt,l,Ve,sn,d,S,E,Kt,f]),Mn=v.useCallback((j,re,xe,ge)=>{const oe=j.getBoundingClientRect(),Ae=oe.width/n,et=(re-oe.left)/Ae,tt=(xe-oe.top)/Ae,Te=5,Dt=A0(Kt,wt,n,void 0,Ve);let Fe=0,Bt=0;ge instanceof MouseEvent&&(Fe=ge.button,Bt=ge.buttons);const ot=L4(et,Dt,Ve),kt=F4(tt,r,b,a,c,d,f,l,sn,E),vn=(ge==null?void 0:ge.shiftKey)===!0,pt=(ge==null?void 0:ge.ctrlKey)===!0,hn=(ge==null?void 0:ge.metaKey)===!0,Vr=ge!==void 0&&!(ge instanceof MouseEvent)||(ge==null?void 0:ge.pointerType)==="touch",an=[et<0?-1:nn||tt>r){const Rt=et>n?1:et<0?-1:0,wn=tt>r?1:tt<0?-1:0;let Mr=Rt*2,Li=wn*2;Rt===0&&(Mr=ot===-1?ia.EndPadding:ia.Center),wn===0&&(Li=kt===void 0?ia.EndPadding:ia.Center);let fi=!1;if(ot===-1&&kt===-1){const Do=Zt(j,Kt.length-1,-1);_r(Do!==void 0),fi=ren&&etr&&tt=0?(wn=!0,Rt=Zt(j,Mr,kt),_r(Rt!==void 0),Ar={kind:b&&kt===-2?Dr:Xs,location:[Mr,kt],bounds:Rt,group:Kt[Mr].group??"",isEdge:wn,shiftKey:vn,ctrlKey:pt,metaKey:hn,isTouch:Vr,localEventX:re-Rt.x,localEventY:xe-Rt.y,button:Fe,buttons:Bt,scrollEdge:an}):Ar={kind:b&&kt===-2?Dr:Xs,group:Kt[ot].group??"",location:[ot,kt],bounds:Rt,isEdge:wn,shiftKey:vn,ctrlKey:pt,metaKey:hn,isTouch:Vr,localEventX:re-Rt.x,localEventY:xe-Rt.y,button:Fe,buttons:Bt,scrollEdge:an}}else{const Rt=Zt(j,ot,kt);_r(Rt!==void 0);const wn=Rt!==void 0&&Rt.x+Rt.width-re{}),Ds=v.useRef(ve);Ds.current=ve;const[us,cs]=v.useMemo(()=>{const j=document.createElement("canvas"),re=document.createElement("canvas");return j.style.display="none",j.style.opacity="0",j.style.position="fixed",re.style.display="none",re.style.opacity="0",re.style.position="fixed",[j.getContext("2d",{alpha:!1}),re.getContext("2d",{alpha:!1})]},[]);v.useLayoutEffect(()=>{if(!(us===null||cs===null))return document.documentElement.append(us.canvas),document.documentElement.append(cs.canvas),()=>{us.canvas.remove(),cs.canvas.remove()}},[us,cs]);const wl=v.useMemo(()=>new X4,[]),tf=Ut&&Ze?1:Ft&&Ze?2:5,nf=(rt==null?void 0:rt.disableMinimumCellWidth)===!0?1:10,Ni=v.useRef(),bl=v.useRef(null),xl=v.useRef(null),kl=v.useCallback(()=>{var et;const j=ct.current,re=Ue.current;if(j===null||re===null||(bl.current===null&&(bl.current=j.getContext("2d",{alpha:!1}),j.width=0,j.height=0),xl.current===null&&(xl.current=re.getContext("2d",{alpha:!1}),re.width=0,re.height=0),bl.current===null||xl.current===null||us===null||cs===null))return;let xe=!1;const ge=tt=>{xe=!0,De(tt)},oe=Ni.current,Ae={headerCanvasCtx:xl.current,canvasCtx:bl.current,bufferACtx:us,bufferBCtx:cs,width:n,height:r,cellXOffset:wt,cellYOffset:l,translateX:Math.round(Ve),translateY:Math.round(sn),mappedColumns:Kt,enableGroups:b,freezeColumns:S,dragAndDropState:ie,theme:it,headerHeight:a,groupHeaderHeight:c,disabledRows:at??Ot.empty(),rowHeight:f,verticalBorder:Pe,isResizing:ue,resizeCol:ce,isFocused:k,selection:x,fillHandle:u,drawCellCallback:me,hasAppendRow:_t,overrideCursor:ge,maxScaleFactor:tf,freezeTrailingRows:E,rows:d,drawFocus:_,getCellContent:h,getGroupDetails:Qe??(tt=>({name:tt})),getRowThemeOverride:p,drawHeaderCallback:Ie,prelightCells:Je,highlightRegions:O,imageLoader:dt,lastBlitData:J,damage:fe.current,hoverValues:pe.current,hoverInfo:Ds.current,spriteManager:Mt,scrolling:Ze,hyperWrapping:(rt==null?void 0:rt.hyperWrapping)??!1,touchMode:Et,enqueue:ef.current,renderStateProvider:wl,renderStrategy:(rt==null?void 0:rt.renderStrategy)??(wh.value?"double-buffer":"single-buffer"),getCellRenderer:st,minimumCellWidth:nf};Ae.damage===void 0?(Ni.current=Ae,xx(Ae,oe)):xx(Ae,void 0),!xe&&(Ae.damage===void 0||Ae.damage.has((et=Ds==null?void 0:Ds.current)==null?void 0:et[0]))&&De(void 0)},[us,cs,n,r,wt,l,Ve,sn,Kt,b,S,ie,it,a,c,at,f,Pe,ue,_t,ce,k,x,u,E,d,_,tf,h,Qe,p,me,Ie,Je,O,dt,Mt,Ze,rt==null?void 0:rt.hyperWrapping,rt==null?void 0:rt.renderStrategy,Et,wl,st,nf]),Po=v.useRef(kl);v.useLayoutEffect(()=>{kl(),Po.current=kl},[kl]),v.useLayoutEffect(()=>{(async()=>{var re;((re=document==null?void 0:document.fonts)==null?void 0:re.ready)!==void 0&&(await document.fonts.ready,Ni.current=void 0,Po.current())})()},[]);const _s=v.useCallback(j=>{fe.current=j,Po.current(),fe.current=void 0},[]),rf=oW(_s);ef.current=rf;const sf=v.useCallback(j=>{_s(new Ju(j.map(re=>re.cell)))},[_s]);dt.setCallback(_s);const[Dp,_p]=v.useState(!1),[Sl,fs]=on??[],Np=Sl!==void 0&&fs===-1,Lp=Sl!==void 0&&fs===-2;let of=!1,Cl=!1,Tn=ye;if(Tn===void 0&&Sl!==void 0&&fs!==void 0&&fs>-1&&fs({contain:"strict",display:"block",cursor:lf}),[lf]),qa=v.useRef("default"),Ns=$==null?void 0:$.current;Ns!=null&&qa.current!==Tl.cursor&&(Ns.style.cursor=qa.current=Tl.cursor);const Tr=v.useCallback((j,re,xe,ge)=>{if(Qe===void 0)return;const oe=Qe(j);if(oe.actions!==void 0){const Ae=sE(re,oe.actions);for(const[et,tt]of Ae.entries())if(vp(tt,xe+re.x,ge+tt.y))return oe.actions[et]}},[Qe]),ai=v.useCallback((j,re,xe,ge)=>{const oe=s[re];if(!be&&!ue&&oe.hasMenu===!0&&!(ht??!1)){const Ae=Zt(j,re,-1);_r(Ae!==void 0);const et=iE(Ae.x,Ae.y,Ae.width,Ae.height,Hv(oe.title)==="rtl");if(xe>et.x&&xeet.y&&ge{const re=ct.current,xe=$==null?void 0:$.current;if(re===null||j.target!==re&&j.target!==xe)return;Ja.current=!0;let ge,oe;if(j instanceof MouseEvent?(ge=j.clientX,oe=j.clientY):(ge=j.touches[0].clientX,oe=j.touches[0].clientY),j.target===xe&&xe!==null){const et=xe.getBoundingClientRect();if(ge>et.right||oe>et.bottom)return}const Ae=Mn(re,ge,oe,j);Ls.current=Ae.location,Ae.isTouch&&(Qa.current=Date.now()),Lt.current!==Ae.isTouch&&Vt(Ae.isTouch),!(Ae.kind===Xs&&ai(re,Ae.location[0],ge,oe)!==void 0)&&(Ae.kind===Dr&&Tr(Ae.group,Ae.bounds,Ae.localEventX,Ae.localEventY)!==void 0||(P==null||P(Ae),!Ae.isTouch&&Ge!==!0&&Ge!==Ae.kind&&Ae.button<3&&Ae.button!==1&&j.preventDefault()))},[$,Ge,Mn,Tr,ai,P]);$n("touchstart",ir,window,!1),$n("mousedown",ir,window,!1);const El=v.useRef(0),Za=v.useCallback(j=>{var Bt,ot;const re=El.current;El.current=Date.now();const xe=ct.current;if(Ja.current=!1,N===void 0||xe===null)return;const ge=$==null?void 0:$.current,oe=j.target!==xe&&j.target!==ge;let Ae,et,tt=!0;if(j instanceof MouseEvent){if(Ae=j.clientX,et=j.clientY,tt=j.button<3,j.pointerType==="touch")return}else Ae=j.changedTouches[0].clientX,et=j.changedTouches[0].clientY;let Te=Mn(xe,Ae,et,j);Te.isTouch&&Qa.current!==0&&Date.now()-Qa.current>500&&(Te={...Te,isLongTouch:!0}),re!==0&&Date.now()-re<(Te.isTouch?1e3:500)&&(Te={...Te,isDoubleClick:!0}),Lt.current!==Te.isTouch&&Vt(Te.isTouch),!oe&&j.cancelable&&tt&&j.preventDefault();const[Dt]=Te.location,Fe=ai(xe,Dt,Ae,et);if(Te.kind===Xs&&Fe!==void 0){(Te.button!==0||((Bt=Ls.current)==null?void 0:Bt[0])!==Dt||((ot=Ls.current)==null?void 0:ot[1])!==-1)&&N(Te,!0);return}else if(Te.kind===Dr){const kt=Tr(Te.group,Te.bounds,Te.localEventX,Te.localEventY);if(kt!==void 0){Te.button===0&&kt.onClick(Te);return}}N(Te,oe)},[N,$,Mn,ai,Tr]);$n("mouseup",Za,window,!1),$n("touchend",Za,window,!1);const af=v.useCallback(j=>{var Fe,Bt;const re=ct.current;if(re===null)return;const xe=$==null?void 0:$.current,ge=j.target!==re&&j.target!==xe;let oe,Ae,et=!0;j instanceof MouseEvent?(oe=j.clientX,Ae=j.clientY,et=j.button<3):(oe=j.changedTouches[0].clientX,Ae=j.changedTouches[0].clientY);const tt=Mn(re,oe,Ae,j);Lt.current!==tt.isTouch&&Vt(tt.isTouch),!ge&&j.cancelable&&et&&j.preventDefault();const[Te]=tt.location,Dt=ai(re,Te,oe,Ae);if(tt.kind===Xs&&Dt!==void 0)tt.button===0&&((Fe=Ls.current)==null?void 0:Fe[0])===Te&&((Bt=Ls.current)==null?void 0:Bt[1])===-1&&(m==null||m(Te,Dt));else if(tt.kind===Dr){const ot=Tr(tt.group,tt.bounds,tt.localEventX,tt.localEventY);ot!==void 0&&tt.button===0&&ot.onClick(tt)}},[$,Mn,ai,m,Tr]);$n("click",af,window,!1);const Fp=v.useCallback(j=>{const re=ct.current,xe=$==null?void 0:$.current;if(re===null||j.target!==re&&j.target!==xe||T===void 0)return;const ge=Mn(re,j.clientX,j.clientY,j);T(ge,()=>{j.cancelable&&j.preventDefault()})},[$,Mn,T]);$n("contextmenu",Fp,($==null?void 0:$.current)??null,!1);const uf=v.useCallback(j=>{fe.current=new Ju(j.map(re=>re.item)),pe.current=j,Po.current(),fe.current=void 0},[]),ui=v.useMemo(()=>new rW(uf),[uf]),ds=v.useRef(ui);ds.current=ui,v.useLayoutEffect(()=>{const j=ds.current;if(on===void 0||on[1]<0){j.setHovered(on);return}const re=h(on,!0),xe=st(re),ge=xe===void 0&&re.kind===Se.Custom||(xe==null?void 0:xe.needsHover)!==void 0&&(typeof xe.needsHover=="boolean"?xe.needsHover:xe.needsHover(re));j.setHovered(ge?on:void 0)},[h,st,on]);const Er=v.useRef(),X=v.useCallback(j=>{var tt;const re=ct.current;if(re===null)return;const xe=$==null?void 0:$.current,ge=j.target!==re&&j.target!==xe,oe=Mn(re,j.clientX,j.clientY,j);if(oe.kind!=="out-of-bounds"&&ge&&!Ja.current&&!oe.isTouch)return;const Ae=(Te,Dt)=>{de(Fe=>Fe===Te||(Fe==null?void 0:Fe[0][0])===(Te==null?void 0:Te[0][0])&&(Fe==null?void 0:Fe[0][1])===(Te==null?void 0:Te[0][1])&&((Fe==null?void 0:Fe[1][0])===(Te==null?void 0:Te[1][0])&&(Fe==null?void 0:Fe[1][1])===(Te==null?void 0:Te[1][1])||!Dt)?Fe:Te)};if(!vE(oe,Er.current))De(void 0),ne==null||ne(oe),Ae(oe.kind===xh?void 0:[oe.location,[oe.localEventX,oe.localEventY]],!0),Er.current=oe;else if(oe.kind==="cell"||oe.kind===Xs||oe.kind===Dr){let Te=!1,Dt=!0;if(oe.kind==="cell"){const Bt=h(oe.location);Dt=((tt=st(Bt))==null?void 0:tt.needsHoverPosition)??Bt.kind===Se.Custom,Te=Dt}else oe.kind===Dr&&(Te=!0);const Fe=[oe.location,[oe.localEventX,oe.localEventY]];Ae(Fe,Dt),Ds.current=Fe,Te&&_s(new Ju([oe.location]))}const et=oe.location[0]>=(H?0:1);Ne(oe.kind===Xs&&oe.isEdge&&et&&$e===!0),_p(oe.kind==="cell"&&oe.isFillHandle),D==null||D(j),ee(oe)},[$,Mn,H,$e,D,ee,ne,h,st,_s]);$n("mousemove",X,window,!0);const ln=v.useCallback(j=>{const re=ct.current;if(re===null)return;let xe,ge;x.current!==void 0&&(xe=Zt(re,x.current.cell[0],x.current.cell[1]),ge=x.current.cell),Y==null||Y({bounds:xe,stopPropagation:()=>j.stopPropagation(),preventDefault:()=>j.preventDefault(),cancel:()=>{},ctrlKey:j.ctrlKey,metaKey:j.metaKey,shiftKey:j.shiftKey,altKey:j.altKey,key:j.key,keyCode:j.keyCode,rawEvent:j,location:ge})},[Y,x,Zt]),Io=v.useCallback(j=>{const re=ct.current;if(re===null)return;let xe,ge;x.current!==void 0&&(xe=Zt(re,x.current.cell[0],x.current.cell[1]),ge=x.current.cell),R==null||R({bounds:xe,stopPropagation:()=>j.stopPropagation(),preventDefault:()=>j.preventDefault(),cancel:()=>{},ctrlKey:j.ctrlKey,metaKey:j.metaKey,shiftKey:j.shiftKey,altKey:j.altKey,key:j.key,keyCode:j.keyCode,rawEvent:j,location:ge})},[R,x,Zt]),Bp=v.useCallback(j=>{ct.current=j,L!==void 0&&(L.current=j)},[L]),cf=v.useCallback(j=>{const re=ct.current;if(re===null||Ge===!1||ue){j.preventDefault();return}let xe,ge;const oe=Mn(re,j.clientX,j.clientY);if(Ge!==!0&&oe.kind!==Ge){j.preventDefault();return}const Ae=(Bt,ot)=>{xe=Bt,ge=ot};let et,tt,Te;const Dt=(Bt,ot,kt)=>{et=Bt,tt=ot,Te=kt};let Fe=!1;if(F==null||F({...oe,setData:Ae,setDragImage:Dt,preventDefault:()=>Fe=!0,defaultPrevented:()=>Fe}),!Fe&&xe!==void 0&&ge!==void 0&&j.dataTransfer!==null)if(j.dataTransfer.setData(xe,ge),j.dataTransfer.effectAllowed="copyLink",et!==void 0&&tt!==void 0&&Te!==void 0)j.dataTransfer.setDragImage(et,tt,Te);else{const[Bt,ot]=oe.location;if(ot!==void 0){const kt=document.createElement("canvas"),vn=Zt(re,Bt,ot);_r(vn!==void 0);const pt=Math.ceil(window.devicePixelRatio??1);kt.width=vn.width*pt,kt.height=vn.height*pt;const hn=kt.getContext("2d");hn!==null&&(hn.scale(pt,pt),hn.textBaseline="middle",ot===-1?(hn.font=it.headerFontFull,hn.fillStyle=it.bgHeader,hn.fillRect(0,0,kt.width,kt.height),oE(hn,0,0,vn.width,vn.height,Kt[Bt],!1,it,!1,!1,0,Mt,Ie,!1)):(hn.font=it.baseFontFull,hn.fillStyle=it.bgCell,hn.fillRect(0,0,kt.width,kt.height),rE(hn,h([Bt,ot]),0,ot,!1,!1,0,0,vn.width,vn.height,!1,it,it.bgCell,dt,Mt,1,void 0,!1,0,void 0,void 0,void 0,wl,st,()=>{}))),kt.style.left="-100%",kt.style.position="absolute",kt.style.width=`${vn.width}px`,kt.style.height=`${vn.height}px`,document.body.append(kt),j.dataTransfer.setDragImage(kt,vn.width/2,vn.height/2),window.setTimeout(()=>{kt.remove()},0)}}else j.preventDefault()},[Ge,ue,Mn,F,Zt,it,Kt,Mt,Ie,h,dt,wl,st]);$n("dragstart",cf,($==null?void 0:$.current)??null,!1,!1);const eu=v.useRef(),zp=v.useCallback(j=>{const re=ct.current;if(_e!==void 0&&j.preventDefault(),re===null||nt===void 0)return;const xe=Mn(re,j.clientX,j.clientY),[ge,oe]=xe.location,Ae=ge-(H?0:1),[et,tt]=eu.current??[];(et!==Ae||tt!==oe)&&(eu.current=[Ae,oe],nt([Ae,oe],j.dataTransfer))},[H,Mn,nt,_e]);$n("dragover",zp,($==null?void 0:$.current)??null,!1,!1);const Ew=v.useCallback(()=>{eu.current=void 0,W==null||W()},[W]);$n("dragend",Ew,($==null?void 0:$.current)??null,!1,!1);const q=v.useCallback(j=>{const re=ct.current;if(re===null||_e===void 0)return;j.preventDefault();const xe=Mn(re,j.clientX,j.clientY),[ge,oe]=xe.location,Ae=ge-(H?0:1);_e([Ae,oe],j.dataTransfer)},[H,Mn,_e]);$n("drop",q,($==null?void 0:$.current)??null,!1,!1);const Kn=v.useCallback(()=>{ft==null||ft()},[ft]);$n("dragleave",Kn,($==null?void 0:$.current)??null,!1,!1);const En=v.useRef(x);En.current=x;const Al=v.useRef(null),tu=v.useCallback(j=>{var re;ct.current===null||!ct.current.contains(document.activeElement)||(j===null&&En.current.current!==void 0?(re=L==null?void 0:L.current)==null||re.focus({preventScroll:!0}):j!==null&&j.focus({preventScroll:!0}),Al.current=j)},[L]);v.useImperativeHandle(e,()=>({focus:()=>{var re;const j=Al.current;j===null||!document.contains(j)?(re=L==null?void 0:L.current)==null||re.focus({preventScroll:!0}):j.focus({preventScroll:!0})},getBounds:(j,re)=>{if(!(L===void 0||L.current===null))return Zt(L.current,j??0,re??-1)},damage:sf}),[L,sf,Zt]);const Fs=v.useRef(),pr=QF(()=>{var tt,Te,Dt;if(n<50||(rt==null?void 0:rt.disableAccessibilityTree)===!0)return null;let j=A0(Kt,wt,n,ie,Ve);const re=H?0:-1;!H&&((tt=j[0])==null?void 0:tt.sourceIndex)===0&&(j=j.slice(1));const[xe,ge]=((Te=x.current)==null?void 0:Te.cell)??[],oe=(Dt=x.current)==null?void 0:Dt.range,Ae=j.map(Fe=>Fe.sourceIndex),et=Uo(l,Math.min(d,l+i));return xe!==void 0&&ge!==void 0&&!(Ae.includes(xe)&&et.includes(ge))&&tu(null),v.createElement("table",{key:"access-tree",role:"grid","aria-rowcount":d+1,"aria-multiselectable":"true","aria-colcount":Kt.length+re},v.createElement("thead",{role:"rowgroup"},v.createElement("tr",{role:"row","aria-rowindex":1},j.map(Fe=>v.createElement("th",{role:"columnheader","aria-selected":x.columns.hasIndex(Fe.sourceIndex),"aria-colindex":Fe.sourceIndex+1+re,tabIndex:-1,onFocus:Bt=>{if(Bt.target!==Al.current)return Le==null?void 0:Le([Fe.sourceIndex,-1])},key:Fe.sourceIndex},Fe.title)))),v.createElement("tbody",{role:"rowgroup"},et.map(Fe=>v.createElement("tr",{role:"row","aria-selected":x.rows.hasIndex(Fe),key:Fe,"aria-rowindex":Fe+2},j.map(Bt=>{const ot=Bt.sourceIndex,kt=ki(ot,Fe),vn=xe===ot&&ge===Fe,pt=oe!==void 0&&ot>=oe.x&&ot=oe.y&&Fe{const Ar=L==null?void 0:L.current;if(Ar!=null)return Y==null?void 0:Y({bounds:Zt(Ar,ot,Fe),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:Vr})},onFocusCapture:Ar=>{var Rt,wn;if(!(Ar.target===Al.current||((Rt=Fs.current)==null?void 0:Rt[0])===ot&&((wn=Fs.current)==null?void 0:wn[1])===Fe))return Fs.current=Vr,Le==null?void 0:Le(Vr)},ref:vn?tu:void 0,tabIndex:-1},lW(an,st))})))))},[n,Kt,wt,ie,Ve,d,l,i,x,tu,h,L,Y,Zt,Le],200),ci=S===0||!A?0:wt>S?1:xi(-Ve/100,0,1),$p=-l*32+sn,Ml=I?xi(-$p/100,0,1):0,jp=v.useMemo(()=>{if(!ci&&!Ml)return null;const j={position:"absolute",top:0,left:Fn,width:n-Fn,height:r,opacity:ci,pointerEvents:"none",transition:vt?void 0:"opacity 0.2s",boxShadow:"inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)"},re={position:"absolute",top:Un,left:0,width:n,height:r,opacity:Ml,pointerEvents:"none",transition:he?void 0:"opacity 0.2s",boxShadow:"inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)"};return v.createElement(v.Fragment,null,ci>0&&v.createElement("div",{id:"shadow-x",style:j}),Ml>0&&v.createElement("div",{id:"shadow-y",style:re}))},[ci,Ml,Fn,n,vt,Un,r,he]),Hp=v.useMemo(()=>({position:"absolute",top:0,left:0}),[]);return v.createElement(v.Fragment,null,v.createElement("canvas",{"data-testid":"data-grid-canvas",tabIndex:0,onKeyDown:ln,onKeyUp:Io,onFocus:y,onBlur:w,ref:Bp,style:Tl},pr),v.createElement("canvas",{ref:Ue,style:Hp}),jp)},uW=v.memo(v.forwardRef(aW));function xu(t,e,n,r){return xi(Math.round(e-(t.growOffset??0)),Math.ceil(n),Math.floor(r))}const cW=t=>{const[e,n]=v.useState(),[r,i]=v.useState(),[s,o]=v.useState(),[l,a]=v.useState(),[u,c]=v.useState(!1),[f,d]=v.useState(),[h,p]=v.useState(),[m,b]=v.useState(),[g,y]=v.useState(!1),[w,k]=v.useState(),{onHeaderMenuClick:x,getCellContent:S,onColumnMoved:T,onColumnResize:E,onColumnResizeStart:A,onColumnResizeEnd:I,gridRef:_,maxColumnWidth:P,minColumnWidth:N,onRowMoved:D,lockColumns:ee,onColumnProposeMove:ne,onMouseDown:ie,onMouseUp:H,onItemHovered:Y,onDragStart:R,canvasRef:O}=t,L=(E??I??A)!==void 0,{columns:F,selection:W}=t,$=W.columns,ue=v.useCallback(Pe=>{const[me,Ie]=Pe.location;s!==void 0&&l!==me&&me>=ee?(c(!0),a(me)):h!==void 0&&Ie!==void 0?(y(!0),b(Math.max(0,Ie))):r===void 0&&!u&&!g&&(Y==null||Y(Pe))},[s,h,l,Y,ee,r,u,g]),ce=T!==void 0,be=v.useCallback(Pe=>{var me;if(Pe.button===0){const[Ie,Le]=Pe.location;if(Pe.kind==="out-of-bounds"&&Pe.isEdge&&L){const nt=(me=_==null?void 0:_.current)==null?void 0:me.getBounds(F.length-1,-1);nt!==void 0&&(n(nt.x),i(F.length-1))}else if(Pe.kind==="header"&&Ie>=ee){const nt=O==null?void 0:O.current;if(Pe.isEdge&&L&&nt){n(Pe.bounds.x),i(Ie);const ft=nt.getBoundingClientRect().width/nt.offsetWidth,ut=Pe.bounds.width/ft;A==null||A(F[Ie],ut,Ie,ut+(F[Ie].growOffset??0))}else Pe.kind==="header"&&ce&&(d(Pe.bounds.x),o(Ie))}else Pe.kind==="cell"&&ee>0&&Ie===0&&Le!==void 0&&D!==void 0&&(k(Pe.bounds.y),p(Le))}ie==null||ie(Pe)},[ie,L,ee,D,_,F,ce,A,O]),Ge=v.useCallback((Pe,me)=>{u||g||x==null||x(Pe,me)},[u,g,x]),$e=v.useRef(-1),at=v.useCallback(()=>{$e.current=-1,p(void 0),b(void 0),k(void 0),y(!1),o(void 0),a(void 0),d(void 0),c(!1),i(void 0),n(void 0)},[]),_t=v.useCallback((Pe,me)=>{if(Pe.button===0){if(r!==void 0){if(($==null?void 0:$.hasIndex(r))===!0)for(const Le of $){if(Le===r)continue;const nt=F[Le],_e=xu(nt,$e.current,N,P);E==null||E(nt,_e,Le,_e+(nt.growOffset??0))}const Ie=xu(F[r],$e.current,N,P);if(I==null||I(F[r],Ie,r,Ie+(F[r].growOffset??0)),$.hasIndex(r))for(const Le of $){if(Le===r)continue;const nt=F[Le],_e=xu(nt,$e.current,N,P);I==null||I(nt,_e,Le,_e+(nt.growOffset??0))}}at(),s!==void 0&&l!==void 0&&(T==null||T(s,l)),h!==void 0&&m!==void 0&&(D==null||D(h,m))}H==null||H(Pe,me)},[H,r,s,l,h,m,$,I,F,N,P,E,T,D,at]),Qe=v.useMemo(()=>{if(!(s===void 0||l===void 0)&&s!==l&&(ne==null?void 0:ne(s,l))!==!1)return{src:s,dest:l}},[s,l,ne]),it=v.useCallback(Pe=>{const me=O==null?void 0:O.current;if(s!==void 0&&f!==void 0)Math.abs(Pe.clientX-f)>20&&c(!0);else if(h!==void 0&&w!==void 0)Math.abs(Pe.clientY-w)>20&&y(!0);else if(r!==void 0&&e!==void 0&&me){const Le=me.getBoundingClientRect().width/me.offsetWidth,nt=(Pe.clientX-e)/Le,_e=F[r],ft=xu(_e,nt,N,P);if(E==null||E(_e,ft,r,ft+(_e.growOffset??0)),$e.current=nt,($==null?void 0:$.first())===r)for(const ut of $){if(ut===r)continue;const vt=F[ut],he=xu(vt,$e.current,N,P);E==null||E(vt,he,ut,he+(vt.growOffset??0))}}},[s,f,h,w,r,e,F,N,P,E,$,O]),Je=v.useCallback((Pe,me)=>{if(h===void 0||m===void 0)return S(Pe,me);let[Ie,Le]=Pe;return Le===m?Le=h:(Le>m&&(Le-=1),Le>=h&&(Le+=1)),S([Ie,Le],me)},[h,m,S]),Wt=v.useCallback(Pe=>{R==null||R(Pe),Pe.defaultPrevented()||at()},[at,R]);return v.createElement(uW,{accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,drawCell:t.drawCell,enableGroups:t.enableGroups,eventTargetRef:t.eventTargetRef,experimental:t.experimental,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,headerIcons:t.headerIcons,height:t.height,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,resizeColumn:r,isDraggable:t.isDraggable,isFilling:t.isFilling,isFocused:t.isFocused,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDrop:t.onDrop,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,width:t.width,getCellContent:Je,isResizing:r!==void 0,onHeaderMenuClick:Ge,isDragging:u,onItemHovered:ue,onDragStart:Wt,onMouseDown:be,allowResize:L,onMouseUp:_t,dragAndDropState:Qe,onMouseMoveRaw:it,ref:_})};function fW(t){const e=v.useRef(null),[n,r]=v.useState({width:t==null?void 0:t[0],height:t==null?void 0:t[1]});return v.useLayoutEffect(()=>{const i=o=>{for(const l of o){const{width:a,height:u}=l&&l.contentRect||{};r(c=>c.width===a&&c.height===u?c:{width:a,height:u})}},s=new window.ResizeObserver(i);return e.current&&s.observe(e.current,void 0),()=>{s.disconnect()}},[e.current]),{ref:e,...n}}const dW=(t,e,n)=>{const r=v.useRef(null),i=v.useRef(null),s=v.useRef(null),o=v.useRef(0),l=v.useRef(e);l.current=e;const a=n.current;v.useEffect(()=>{const u=()=>{var d,h;if(i.current===!1&&a!==null){const p=[a.scrollLeft,a.scrollTop];if(((d=s.current)==null?void 0:d[0])===p[0]&&((h=s.current)==null?void 0:h[1])===p[1])if(o.current>10){s.current=null,i.current=null;return}else o.current++;else o.current=0,l.current(p[0],p[1]),s.current=p;r.current=window.setTimeout(u,8.333333333333334)}},c=()=>{i.current=!0,s.current=null,r.current!==null&&(window.clearTimeout(r.current),r.current=null)},f=d=>{d.touches.length===0&&(i.current=!1,o.current=0,r.current=window.setTimeout(u,8.333333333333334))};if(t&&a!==null){const d=a;return d.addEventListener("touchstart",c),d.addEventListener("touchend",f),()=>{d.removeEventListener("touchstart",c),d.removeEventListener("touchend",f),r.current!==null&&window.clearTimeout(r.current)}}},[t,a])},hW=()=>t=>t.isSafari?"scroll":"auto",pW=Hr("div")({name:"ScrollRegionStyle",class:"gdg-s1dgczr6",propsAsIs:!1,vars:{"s1dgczr6-0":[hW()]}});function gW(t){const[e,n]=v.useState(!1),r=typeof window>"u"?null:window,i=v.useRef(0);return $n("touchstart",v.useCallback(()=>{window.clearTimeout(i.current),n(!0)},[]),r,!0,!1),$n("touchend",v.useCallback(s=>{s.touches.length===0&&(i.current=window.setTimeout(()=>n(!1),t))},[t]),r,!0,!1),e}const mW=t=>{var F,W;const{children:e,clientHeight:n,scrollHeight:r,scrollWidth:i,update:s,draggable:o,className:l,preventDiagonalScrolling:a=!1,paddingBottom:u=0,paddingRight:c=0,rightElement:f,rightElementProps:d,kineticScrollPerfHack:h=!1,scrollRef:p,initialSize:m}=t,b=[],g=(d==null?void 0:d.sticky)??!1,y=(d==null?void 0:d.fill)??!1,w=v.useRef(0),k=v.useRef(0),x=v.useRef(null),S=typeof window>"u"?1:window.devicePixelRatio,T=v.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),E=v.useRef(null),A=gW(200),[I,_]=v.useState(!0),P=v.useRef(0);v.useLayoutEffect(()=>{if(!I||A||T.current.lockDirection===void 0)return;const $=x.current;if($===null)return;const[ue,ce]=T.current.lockDirection;ue!==void 0?$.scrollLeft=ue:ce!==void 0&&($.scrollTop=ce),T.current.lockDirection=void 0},[A,I]);const N=v.useCallback(($,ue)=>{var me;const ce=x.current;if(ce===null)return;ue=ue??ce.scrollTop,$=$??ce.scrollLeft;const be=T.current.scrollTop,Ge=T.current.scrollLeft,$e=$-Ge,at=ue-be;A&&$e!==0&&at!==0&&(Math.abs($e)>3||Math.abs(at)>3)&&a&&T.current.lockDirection===void 0&&(T.current.lockDirection=Math.abs($e)0&&(Math.abs(Wt)>2e3||Je===0||Je===Pe)&&r>ce.scrollHeight+5){const Ie=Je/Pe,Le=(r-it)*Ie;w.current=Le-Je}_t!==void 0&&(window.clearTimeout(P.current),_(!1),P.current=window.setTimeout(()=>_(!0),200)),s({x:$,y:Je+w.current,width:Qe-c,height:it-u,paddingRight:((me=E.current)==null?void 0:me.clientWidth)??0})},[u,c,r,s,a,A]);dW(h&&wh.value,N,x);const D=v.useRef(N);D.current=N;const ee=v.useRef(),ne=v.useRef(!1);v.useLayoutEffect(()=>{ne.current?N():ne.current=!0},[N,u,c]);const ie=v.useCallback($=>{x.current=$,p!==void 0&&(p.current=$)},[p]);let H=0,Y=0;for(b.push(v.createElement("div",{key:H++,style:{width:i,height:0}}));YD.current(),0),ee.current={width:O,height:L}),(O??0)===0||(L??0)===0?v.createElement("div",{ref:R}):v.createElement("div",{ref:R},v.createElement(pW,{isSafari:wh.value},v.createElement("div",{className:"dvn-underlay"},e),v.createElement("div",{ref:ie,style:ee.current,draggable:o,onDragStart:$=>{o||($.stopPropagation(),$.preventDefault())},className:"dvn-scroller "+(l??""),onScroll:()=>N()},v.createElement("div",{className:"dvn-scroll-inner"+(f===void 0?" dvn-hidden":"")},v.createElement("div",{className:"dvn-stack"},b),f!==void 0&&v.createElement(v.Fragment,null,!y&&v.createElement("div",{className:"dvn-spacer"}),v.createElement("div",{ref:E,style:{height:L,maxHeight:n-Math.ceil(S%1),position:"sticky",top:0,paddingLeft:1,marginBottom:-40,marginRight:c,flexGrow:y?1:void 0,right:g?c??0:void 0,pointerEvents:"auto"}},f))))))},yW=t=>{const{columns:e,rows:n,rowHeight:r,headerHeight:i,groupHeaderHeight:s,enableGroups:o,freezeColumns:l,experimental:a,nonGrowWidth:u,clientSize:c,className:f,onVisibleRegionChanged:d,scrollRef:h,preventDiagonalScrolling:p,rightElement:m,rightElementProps:b,overscrollX:g,overscrollY:y,initialSize:w,smoothScrollX:k=!1,smoothScrollY:x=!1,isDraggable:S}=t,{paddingRight:T,paddingBottom:E}=a??{},[A,I]=c,_=v.useRef(),P=v.useRef(),N=v.useRef(),D=v.useRef(),ee=u+Math.max(0,g??0);let ne=o?i+s:i;if(typeof r=="number")ne+=n*r;else for(let R=0;R{var at,_t;if(ie.current===void 0)return;const R={...ie.current};let O=0,L=R.x<0?-R.x:0,F=0,W=0;R.x=R.x<0?0:R.x;let $=0;for(let Qe=0;Qe=it+Qe.width)O+=Qe.width,W++,F++;else if(R.x>it)O+=Qe.width,k?L+=it-R.x:W++,F++;else if(R.x+R.width>it)O+=Qe.width,F++;else break}let ue=0,ce=0,be=0;if(typeof r=="number")x?(ce=Math.floor(R.y/r),ue=ce*r-R.y):ce=Math.ceil(R.y/r),be=Math.ceil(R.height/r)+ce,ue<0&&be++;else{let Qe=0;for(let it=0;it=Qe+Je)Qe+=Je,ce++,be++;else if(R.y>Wt)Qe+=Je,x?ue+=Wt-R.y:ce++,be++;else if(R.y+R.height>Je/2+Qe)Qe+=Je,be++;else break}}const Ge={x:W,y:ce,width:F-W,height:be-ce},$e=_.current;($e===void 0||$e.y!==Ge.y||$e.x!==Ge.x||$e.height!==Ge.height||$e.width!==Ge.width||P.current!==L||N.current!==ue||R.width!==((at=D.current)==null?void 0:at[0])||R.height!==((_t=D.current)==null?void 0:_t[1]))&&(d==null||d({x:W,y:ce,width:F-W,height:be-ce},R.width,R.height,R.paddingRight??0,L,ue),_.current=Ge,P.current=L,N.current=ue,D.current=[R.width,R.height])},[e,r,n,d,l,k,x]),Y=v.useCallback(R=>{ie.current=R,H()},[H]);return v.useEffect(()=>{H()},[H]),v.createElement(mW,{scrollRef:h,className:f,kineticScrollPerfHack:a==null?void 0:a.kineticScrollPerfHack,preventDiagonalScrolling:p,draggable:S===!0||typeof S=="string",scrollWidth:ee+(T??0),scrollHeight:ne+(E??0),clientHeight:I,rightElement:m,paddingBottom:E,paddingRight:T,rightElementProps:b,update:Y,initialSize:w},v.createElement(cW,{eventTargetRef:h,width:A,height:I,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,onColumnProposeMove:t.onColumnProposeMove,verticalBorder:t.verticalBorder,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,drawCell:t.drawCell,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}))},vW=Hr("div")({name:"SearchWrapper",class:"gdg-seveqep",propsAsIs:!1}),wW=v.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},v.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 244l144-144 144 144M256 120v292"})),bW=v.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},v.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})),xW=v.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},v.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368L144 144M368 144L144 368"})),kW=10,SW=t=>{const{canvasRef:e,cellYOffset:n,rows:r,columns:i,searchInputRef:s,searchValue:o,searchResults:l,onSearchValueChange:a,getCellsForSelection:u,onSearchResultsChanged:c,showSearch:f=!1,onSearchClose:d}=t,[h]=v.useState(()=>"search-box-"+Math.round(Math.random()*1e3)),[p,m]=v.useState(""),b=o??p,g=v.useCallback(O=>{m(O),a==null||a(O)},[a]),[y,w]=v.useState(),k=v.useRef(y);k.current=y,v.useEffect(()=>{l!==void 0&&(l.length>0?w(O=>({rowsSearched:r,results:l.length,selectedIndex:(O==null?void 0:O.selectedIndex)??-1})):w(void 0))},[r,l]);const x=v.useRef();x.current===void 0&&(x.current=new AbortController);const S=v.useRef(),[T,E]=v.useState([]),A=l??T,I=v.useCallback(()=>{S.current!==void 0&&(window.cancelAnimationFrame(S.current),S.current=void 0,x.current.abort())},[]),_=v.useRef(n);_.current=n;const P=v.useCallback(O=>{const L=new RegExp(O.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i");let F=_.current,W=Math.min(10,r),$=0;w(void 0),E([]);const ue=[],ce=async()=>{var Pe;if(u===void 0)return;const be=performance.now(),Ge=r-$;let $e=u({x:0,y:F,width:i.length,height:Math.min(W,Ge,r-F)},x.current.signal);typeof $e=="function"&&($e=await $e());let at=!1;for(const[me,Ie]of $e.entries())for(const[Le,nt]of Ie.entries()){let _e;switch(nt.kind){case Se.Text:case Se.Number:_e=nt.displayData;break;case Se.Uri:case Se.Markdown:_e=nt.data;break;case Se.Boolean:_e=typeof nt.data=="boolean"?nt.data.toString():void 0;break;case Se.Image:case Se.Bubble:_e=nt.data.join("🐳");break;case Se.Custom:_e=nt.copyData;break}_e!==void 0&&L.test(_e)&&(ue.push([Le,me+F]),at=!0)}const _t=performance.now();at&&E([...ue]),$+=$e.length,_r($<=r);const Qe=((Pe=k.current)==null?void 0:Pe.selectedIndex)??-1;w({results:ue.length,rowsSearched:$,selectedIndex:Qe}),c==null||c(ue,Qe),F+W>=r?F=0:F+=W;const it=_t-be,Je=Math.max(it,1),Wt=kW/Je;W=Math.ceil(W*Wt),${var O;d==null||d(),w(void 0),E([]),c==null||c([],-1),I(),(O=e==null?void 0:e.current)==null||O.focus()},[I,e,d,c]),D=v.useCallback(O=>{g(O.target.value),l===void 0&&(O.target.value===""?(w(void 0),E([]),I()):P(O.target.value))},[P,I,g,l]);v.useEffect(()=>{f&&s.current!==null&&(g(""),s.current.focus({preventScroll:!0}))},[f,s,g]);const ee=v.useCallback(O=>{var F;if((F=O==null?void 0:O.stopPropagation)==null||F.call(O),y===void 0)return;const L=(y.selectedIndex+1)%y.results;w({...y,selectedIndex:L}),c==null||c(A,L)},[y,c,A]),ne=v.useCallback(O=>{var F;if((F=O==null?void 0:O.stopPropagation)==null||F.call(O),y===void 0)return;let L=(y.selectedIndex-1)%y.results;L<0&&(L+=y.results),w({...y,selectedIndex:L}),c==null||c(A,L)},[c,A,y]),ie=v.useCallback(O=>{(O.ctrlKey||O.metaKey)&&O.nativeEvent.code==="KeyF"||O.key==="Escape"?(N(),O.stopPropagation(),O.preventDefault()):O.key==="Enter"&&(O.shiftKey?ne():ee())},[N,ee,ne]);v.useEffect(()=>()=>{I()},[I]);const[H,Y]=v.useState(!1);v.useEffect(()=>{if(f)Y(!0);else{const O=setTimeout(()=>Y(!1),150);return()=>clearTimeout(O)}},[f]);const R=v.useMemo(()=>{if(!f&&!H)return null;let O;y!==void 0&&(O=y.results>=1e3?"over 1000":`${y.results} result${y.results!==1?"s":""}`,y.selectedIndex>=0&&(O=`${y.selectedIndex+1} of ${O}`));const L=$=>{$.stopPropagation()},W={width:`${Math.floor(((y==null?void 0:y.rowsSearched)??0)/r*100)}%`};return v.createElement(vW,{className:f?"":"out",onMouseDown:L,onMouseMove:L,onMouseUp:L,onClick:L},v.createElement("div",{className:"gdg-search-bar-inner"},v.createElement("input",{id:h,"aria-hidden":!f,"data-testid":"search-input",ref:s,onChange:D,value:b,tabIndex:f?void 0:-1,onKeyDownCapture:ie}),v.createElement("button",{"aria-label":"Previous Result","aria-hidden":!f,tabIndex:f?void 0:-1,onClick:ne,disabled:((y==null?void 0:y.results)??0)===0},wW),v.createElement("button",{"aria-label":"Next Result","aria-hidden":!f,tabIndex:f?void 0:-1,onClick:ee,disabled:((y==null?void 0:y.results)??0)===0},bW),d!==void 0&&v.createElement("button",{"aria-label":"Close Search","aria-hidden":!f,"data-testid":"search-close-button",tabIndex:f?void 0:-1,onClick:N},xW)),y!==void 0?v.createElement(v.Fragment,null,v.createElement("div",{className:"gdg-search-status"},v.createElement("div",{"data-testid":"search-result-area"},O)),v.createElement("div",{className:"gdg-search-progress",style:W})):v.createElement("div",{className:"gdg-search-status"},v.createElement("label",{htmlFor:h},"Type to search")))},[f,H,y,r,h,s,D,b,ie,ne,ee,d,N]);return v.createElement(v.Fragment,null,v.createElement(yW,{prelightCells:A,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,className:t.className,clientSize:t.clientSize,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,nonGrowWidth:t.nonGrowWidth,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,initialSize:t.initialSize,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,onVisibleRegionChanged:t.onVisibleRegionChanged,overscrollX:t.overscrollX,overscrollY:t.overscrollY,preventDiagonalScrolling:t.preventDiagonalScrolling,rightElement:t.rightElement,rightElementProps:t.rightElementProps,rowHeight:t.rowHeight,rows:t.rows,scrollRef:t.scrollRef,selection:t.selection,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,onColumnProposeMove:t.onColumnProposeMove,drawFocusRing:t.drawFocusRing,drawCell:t.drawCell,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}),R)};class CW extends v.PureComponent{constructor(){super(...arguments);bt(this,"wrapperRef",v.createRef());bt(this,"clickOutside",n=>{if(!(this.props.isOutsideClick&&!this.props.isOutsideClick(n))&&this.wrapperRef.current!==null&&!this.wrapperRef.current.contains(n.target)){let r=n.target;for(;r!==null;){if(r.classList.contains("click-outside-ignore"))return;r=r.parentElement}this.props.onClickOutside()}})}componentDidMount(){document.addEventListener("touchend",this.clickOutside,!0),document.addEventListener("mousedown",this.clickOutside,!0),document.addEventListener("contextmenu",this.clickOutside,!0)}componentWillUnmount(){document.removeEventListener("touchend",this.clickOutside,!0),document.removeEventListener("mousedown",this.clickOutside,!0),document.removeEventListener("contextmenu",this.clickOutside,!0)}render(){const{onClickOutside:n,isOutsideClick:r,...i}=this.props;return v.createElement("div",{...i,ref:this.wrapperRef},this.props.children)}}const TW=()=>t=>Math.max(16,t.targetHeight-10),EW=Hr("input")({name:"RenameInput",class:"gdg-r17m35ur",propsAsIs:!1,vars:{"r17m35ur-0":[TW(),"px"]}}),AW=t=>{const{bounds:e,group:n,onClose:r,canvasBounds:i,onFinish:s}=t,[o,l]=Pn.useState(n);return Pn.createElement(CW,{style:{position:"absolute",left:e.x-i.left+1,top:e.y-i.top,width:e.width-2,height:e.height},className:"gdg-c1tqibwd",onClickOutside:r},Pn.createElement(EW,{targetHeight:e.height,"data-testid":"group-rename-input",value:o,onBlur:r,onFocus:a=>a.target.setSelectionRange(0,o.length),onChange:a=>l(a.target.value),onKeyDown:a=>{a.key==="Enter"?s(o):a.key==="Escape"&&r()},autoFocus:!0}))};function MW(t,e){return t===void 0?!1:t.length>1&&t.startsWith("_")?Number.parseInt(t.slice(1))===e.keyCode:t.length===1&&t>="a"&&t<="z"?t.toUpperCase().codePointAt(0)===e.keyCode:t===e.key}function mt(t,e,n){const r=wE(t,e);return r&&(n.didMatch=!0),r}function wE(t,e){if(t.length===0)return!1;if(t.includes("|")){const a=t.split("|");for(const u of a)if(wE(u,e))return!0;return!1}let n=!1,r=!1,i=!1,s=!1;const o=t.split("+"),l=o.pop();if(!MW(l,e))return!1;if(o[0]==="any")return!0;for(const a of o)switch(a){case"ctrl":n=!0;break;case"shift":r=!0;break;case"alt":i=!0;break;case"meta":s=!0;break;case"primary":bh.value?s=!0:n=!0;break}return e.altKey===i&&e.ctrlKey===n&&e.shiftKey===r&&e.metaKey===s}function RW(t,e,n,r,i,s){const o=Pn.useCallback((u,c,f,d)=>{var y;(s==="cell"||s==="multi-cell")&&u!==void 0&&(u={...u,range:{x:u.cell[0],y:u.cell[1],width:1,height:1}});const h=n==="mixed"&&(f||d==="drag"),p=r==="mixed"&&h,m=i==="mixed"&&h;let b={current:u===void 0?void 0:{...u,rangeStack:d==="drag"?((y=t.current)==null?void 0:y.rangeStack)??[]:[]},columns:p?t.columns:Ot.empty(),rows:m?t.rows:Ot.empty()};f&&(s==="multi-rect"||s==="multi-cell")&&b.current!==void 0&&t.current!==void 0&&(b={...b,current:{...b.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),e(b,c)},[r,t,n,s,i,e]),l=Pn.useCallback((u,c,f)=>{u=u??t.rows,c!==void 0&&(u=u.add(c));let d;if(i==="exclusive"&&u.length>0)d={current:void 0,columns:Ot.empty(),rows:u};else{const h=f&&n==="mixed",p=f&&r==="mixed";d={current:h?t.current:void 0,columns:p?t.columns:Ot.empty(),rows:u}}e(d,!1)},[r,t,n,i,e]),a=Pn.useCallback((u,c,f)=>{u=u??t.columns,c!==void 0&&(u=u.add(c));let d;if(r==="exclusive"&&u.length>0)d={current:void 0,rows:Ot.empty(),columns:u};else{const h=f&&n==="mixed",p=f&&i==="mixed";d={current:h?t.current:void 0,rows:p?t.rows:Ot.empty(),columns:u}}e(d,!1)},[r,t,n,i,e]);return[o,l,a]}function OW(t,e,n,r,i){const s=v.useCallback(u=>{if(t===!0){const c=[];for(let f=u.y;f=i?d.push({kind:Se.Loading,allowOverlay:!1}):d.push(e([h,f]));c.push(d)}return c}return(t==null?void 0:t(u,r.signal))??[]},[r.signal,e,t,i]),o=t!==void 0?s:void 0,l=v.useCallback(u=>{if(o===void 0)return[];const c={...u,x:u.x-n};if(c.x<0){c.x=0,c.width--;const f=o(c,r.signal);return typeof f=="function"?async()=>(await f()).map(d=>[{kind:Se.Loading,allowOverlay:!1},...d]):f.map(d=>[{kind:Se.Loading,allowOverlay:!1},...d])}return o(c,r.signal)},[r.signal,o,n]);return[t!==void 0?l:void 0,o]}function PW(t){if(t.copyData!==void 0)return{formatted:t.copyData,rawValue:t.copyData,format:"string"};switch(t.kind){case Se.Boolean:return{formatted:t.data===!0?"TRUE":t.data===!1?"FALSE":t.data===Lv?"INDETERMINATE":"",rawValue:t.data,format:"boolean"};case Se.Custom:return{formatted:t.copyData,rawValue:t.copyData,format:"string"};case Se.Image:case Se.Bubble:return{formatted:t.data,rawValue:t.data,format:"string-array"};case Se.Drilldown:return{formatted:t.data.map(e=>e.text),rawValue:t.data.map(e=>e.text),format:"string-array"};case Se.Text:return{formatted:t.displayData??t.data,rawValue:t.data,format:"string"};case Se.Uri:return{formatted:t.displayData??t.data,rawValue:t.data,format:"url"};case Se.Markdown:case Se.RowID:return{formatted:t.data,rawValue:t.data,format:"string"};case Se.Number:return{formatted:t.displayData,rawValue:t.data,format:"number"};case Se.Loading:return{formatted:"#LOADING",rawValue:"",format:"string"};case Se.Protected:return{formatted:"************",rawValue:"",format:"string"};default:Sc()}}function IW(t,e){return t.map((r,i)=>{const s=e[i];return r.map(o=>o.span!==void 0&&o.span[0]!==s?{formatted:"",rawValue:"",format:"string"}:PW(o))})}function Sx(t,e){return(e?/[\t\n",]/:/[\t\n"]/).test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}function DW(t){var n;const e=[];for(const r of t){const i=[];for(const s of r)s.format==="url"?i.push(((n=s.rawValue)==null?void 0:n.toString())??""):s.format==="string-array"?i.push(s.formatted.map(o=>Sx(o,!0)).join(",")):i.push(Sx(s.formatted,!1));e.push(i.join(" "))}return e.join(` +`)}function Vg(t){return t.replace(/\t/g," ").replace(/ {2,}/g,e=>" ".repeat(e.length))}function Cx(t){return'"'+t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")+'"'}function _W(t){return t.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function NW(t){var n;const e=[];e.push('',"");for(const r of t){e.push("");for(const i of r){const s=`gdg-format="${i.format}"`;i.format==="url"?e.push(``):i.format==="string-array"?e.push(``):e.push(``)}e.push("")}return e.push("
    ${Vg(i.formatted)}
      ${i.formatted.map((o,l)=>`
    1. `+Vg(o)+"
    2. ").join("")}
    ${Vg(i.formatted)}
    "),e.join("")}function LW(t,e){const n=IW(t,e),r=DW(n),i=NW(n);return{textPlain:r,textHtml:i}}function Tx(t){var o;const e=document.createElement("html");e.innerHTML=t.replace(/ /g," ");const n=e.querySelector("table");if(n===null)return;const r=[n],i=[];let s;for(;r.length>0;){const l=r.pop();if(l===void 0)break;if(l instanceof HTMLTableElement||l.nodeName==="TBODY")r.push(...[...l.children].reverse());else if(l instanceof HTMLTableRowElement)s!==void 0&&i.push(s),s=[],r.push(...[...l.children].reverse());else if(l instanceof HTMLTableCellElement){const a=l.cloneNode(!0),c=a.children.length===1&&a.children[0].nodeName==="P"?a.children[0]:null,f=(c==null?void 0:c.children.length)===1&&c.children[0].nodeName==="FONT",d=a.querySelectorAll("br");for(const m of d)m.replaceWith(` +`);const h=a.getAttribute("gdg-raw-value"),p=a.getAttribute("gdg-format")??"string";if(a.querySelector("a")!==null)s==null||s.push({rawValue:((o=a.querySelector("a"))==null?void 0:o.getAttribute("href"))??"",formatted:a.textContent??"",format:p});else if(a.querySelector("ol")!==null){const m=a.querySelectorAll("li");s==null||s.push({rawValue:[...m].map(b=>b.getAttribute("gdg-raw-value")??""),formatted:[...m].map(b=>b.textContent??""),format:"string-array"})}else if(h!==null)s==null||s.push({rawValue:_W(h),formatted:a.textContent??"",format:p});else{let m=a.textContent??"";f&&(m=m.replace(/\n(?!\n)/g,"")),s==null||s.push({rawValue:m??"",formatted:m??"",format:p})}}}return s!==void 0&&i.push(s),i}function FW(t,e,n,r,i){var l;const s=t;if(r==="allowPartial"||t.current===void 0||e===void 0)return t;let o=!1;do{if((t==null?void 0:t.current)===void 0)break;const a=(l=t.current)==null?void 0:l.range,u=[];if(a.width>2){const d=e({x:a.x,y:a.y,width:1,height:a.height},i.signal);if(typeof d=="function")return s;u.push(...d);const h=e({x:a.x+a.width-1,y:a.y,width:1,height:a.height},i.signal);if(typeof h=="function")return s;u.push(...h)}else{const d=e({x:a.x,y:a.y,width:a.width,height:a.height},i.signal);if(typeof d=="function")return s;u.push(...d)}let c=a.x-n,f=a.x+a.width-1-n;for(const d of u)for(const h of d)h.span!==void 0&&(c=Math.min(h.span[0],c),f=Math.max(h.span[1],f));c===a.x-n&&f===a.x+a.width-1-n?o=!0:t={current:{cell:t.current.cell??[0,0],range:{x:c+n,y:a.y,width:f-c+1,height:a.height},rangeStack:t.current.rangeStack},columns:t.columns,rows:t.rows}}while(!o);return t}function Ex(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1).replace(/""/g,'"')),t}function BW(t){let e;(function(l){l[l.None=0]="None",l[l.inString=1]="inString",l[l.inStringPostQuote=2]="inStringPostQuote"})(e||(e={}));const n=[];let r=[],i=0,s=e.None;t=t.replace(/\r\n/g,` +`);let o=0;for(const l of t){switch(s){case e.None:l===" "||l===` +`?(r.push(t.slice(i,o)),i=o+1,l===` +`&&(n.push(r),r=[])):l==='"'&&(s=e.inString);break;case e.inString:l==='"'&&(s=e.inStringPostQuote);break;case e.inStringPostQuote:l==='"'?s=e.inString:((l===" "||l===` +`)&&(r.push(Ex(t.slice(i,o))),i=o+1,l===` +`&&(n.push(r),r=[])),s=e.None);break}o++}return il.map(a=>({rawValue:a,formatted:a,format:"string"})))}function Ax(t,e,n){var l;const r=LW(t,e),i=a=>{var u;(u=window.navigator.clipboard)==null||u.writeText(a)},s=(a,u)=>{var c;return((c=window.navigator.clipboard)==null?void 0:c.write)===void 0?!1:(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([a],{type:"text/plain"}),"text/html":new Blob([u],{type:"text/html"})})]),!0)},o=(a,u)=>{var c,f;try{if(n===void 0||n.clipboardData===null)throw new Error("No clipboard data");(c=n==null?void 0:n.clipboardData)==null||c.setData("text/plain",a),(f=n==null?void 0:n.clipboardData)==null||f.setData("text/html",u)}catch{s(a,u)||i(a)}};((l=window.navigator.clipboard)==null?void 0:l.write)!==void 0||(n==null?void 0:n.clipboardData)!==void 0?o(r.textPlain,r.textHtml):i(r.textPlain),n==null||n.preventDefault()}function bE(t){return t!==!0}function Mx(t){return typeof t=="string"?t:`${t}px`}const zW=()=>t=>t.innerWidth,$W=()=>t=>t.innerHeight,jW=Hr("div")({name:"Wrapper",class:"gdg-wmyidgi",propsAsIs:!1,vars:{"wmyidgi-0":[zW()],"wmyidgi-1":[$W()]}}),HW=t=>{const{inWidth:e,inHeight:n,children:r,...i}=t;return v.createElement(jW,{innerHeight:Mx(n),innerWidth:Mx(e),...i},r)},WW=2,VW=1300;function UW(t,e,n){const r=Pn.useRef(0),[i,s]=t??[0,0];Pn.useEffect(()=>{if(i===0&&s===0){r.current=0;return}let o=!1,l=0;const a=u=>{var c;if(!o){if(l===0)l=u;else{const f=u-l;r.current=Math.min(1,r.current+f/VW);const d=r.current**1.618*f*WW;(c=e.current)==null||c.scrollBy(i*d,s*d),l=u,n==null||n()}window.requestAnimationFrame(a)}};return window.requestAnimationFrame(a),()=>{o=!0}},[e,i,s,n])}function KW({rowHeight:t,headerHeight:e,groupHeaderHeight:n,theme:r,overscrollX:i,overscrollY:s,scaleToRem:o,remSize:l}){const[a,u,c,f,d,h]=Pn.useMemo(()=>{if(!o||l===16)return[t,e,n,r,i,s];const p=l/16,m=t,b=UT();return[typeof m=="number"?m*p:g=>Math.ceil(m(g)*p),Math.ceil(e*p),Math.ceil(n*p),{...r,headerIconSize:((r==null?void 0:r.headerIconSize)??b.headerIconSize)*p,cellHorizontalPadding:((r==null?void 0:r.cellHorizontalPadding)??b.cellHorizontalPadding)*p,cellVerticalPadding:((r==null?void 0:r.cellVerticalPadding)??b.cellVerticalPadding)*p},Math.ceil((i??0)*p),Math.ceil((s??0)*p)]},[n,e,i,s,l,t,o,r]);return{rowHeight:a,headerHeight:u,groupHeaderHeight:c,theme:f,overscrollX:d,overscrollY:h}}const Us={downFill:!1,rightFill:!1,clear:!0,closeOverlay:!0,acceptOverlayDown:!0,acceptOverlayUp:!0,acceptOverlayLeft:!0,acceptOverlayRight:!0,copy:!0,paste:!0,cut:!0,search:!1,delete:!0,activateCell:!0,scrollToSelectedCell:!0,goToFirstCell:!0,goToFirstColumn:!0,goToFirstRow:!0,goToLastCell:!0,goToLastColumn:!0,goToLastRow:!0,goToNextPage:!0,goToPreviousPage:!0,selectToFirstCell:!0,selectToFirstColumn:!0,selectToFirstRow:!0,selectToLastCell:!0,selectToLastColumn:!0,selectToLastRow:!0,selectAll:!0,selectRow:!0,selectColumn:!0,goUpCell:!0,goRightCell:!0,goDownCell:!0,goLeftCell:!0,goUpCellRetainSelection:!0,goRightCellRetainSelection:!0,goDownCellRetainSelection:!0,goLeftCellRetainSelection:!0,selectGrowUp:!0,selectGrowRight:!0,selectGrowDown:!0,selectGrowLeft:!0};function yt(t,e){return t===!0?e:t===!1?"":t}function Rx(t){const e=bh.value;return{activateCell:yt(t.activateCell," |Enter|shift+Enter"),clear:yt(t.clear,"any+Escape"),closeOverlay:yt(t.closeOverlay,"any+Escape"),acceptOverlayDown:yt(t.acceptOverlayDown,"Enter"),acceptOverlayUp:yt(t.acceptOverlayUp,"shift+Enter"),acceptOverlayLeft:yt(t.acceptOverlayLeft,"shift+Tab"),acceptOverlayRight:yt(t.acceptOverlayRight,"Tab"),copy:t.copy,cut:t.cut,delete:yt(t.delete,e?"Backspace|Delete":"Delete"),downFill:yt(t.downFill,"primary+_68"),scrollToSelectedCell:yt(t.scrollToSelectedCell,"primary+Enter"),goDownCell:yt(t.goDownCell,"ArrowDown"),goDownCellRetainSelection:yt(t.goDownCellRetainSelection,"alt+ArrowDown"),goLeftCell:yt(t.goLeftCell,"ArrowLeft|shift+Tab"),goLeftCellRetainSelection:yt(t.goLeftCellRetainSelection,"alt+ArrowLeft"),goRightCell:yt(t.goRightCell,"ArrowRight|Tab"),goRightCellRetainSelection:yt(t.goRightCellRetainSelection,"alt+ArrowRight"),goUpCell:yt(t.goUpCell,"ArrowUp"),goUpCellRetainSelection:yt(t.goUpCellRetainSelection,"alt+ArrowUp"),goToFirstCell:yt(t.goToFirstCell,"primary+Home"),goToFirstColumn:yt(t.goToFirstColumn,"Home|primary+ArrowLeft"),goToFirstRow:yt(t.goToFirstRow,"primary+ArrowUp"),goToLastCell:yt(t.goToLastCell,"primary+End"),goToLastColumn:yt(t.goToLastColumn,"End|primary+ArrowRight"),goToLastRow:yt(t.goToLastRow,"primary+ArrowDown"),goToNextPage:yt(t.goToNextPage,"PageDown"),goToPreviousPage:yt(t.goToPreviousPage,"PageUp"),paste:t.paste,rightFill:yt(t.rightFill,"primary+_82"),search:yt(t.search,"primary+f"),selectAll:yt(t.selectAll,"primary+a"),selectColumn:yt(t.selectColumn,"ctrl+ "),selectGrowDown:yt(t.selectGrowDown,"shift+ArrowDown"),selectGrowLeft:yt(t.selectGrowLeft,"shift+ArrowLeft"),selectGrowRight:yt(t.selectGrowRight,"shift+ArrowRight"),selectGrowUp:yt(t.selectGrowUp,"shift+ArrowUp"),selectRow:yt(t.selectRow,"shift+ "),selectToFirstCell:yt(t.selectToFirstCell,"primary+shift+Home"),selectToFirstColumn:yt(t.selectToFirstColumn,"primary+shift+ArrowLeft"),selectToFirstRow:yt(t.selectToFirstRow,"primary+shift+ArrowUp"),selectToLastCell:yt(t.selectToLastCell,"primary+shift+End"),selectToLastColumn:yt(t.selectToLastColumn,"primary+shift+ArrowRight"),selectToLastRow:yt(t.selectToLastRow,"primary+shift+ArrowDown")}}function XW(t){const e=n4(t);return Pn.useMemo(()=>{if(e===void 0)return Rx(Us);const n={...e,goToNextPage:(e==null?void 0:e.goToNextPage)??(e==null?void 0:e.pageDown)??Us.goToNextPage,goToPreviousPage:(e==null?void 0:e.goToPreviousPage)??(e==null?void 0:e.pageUp)??Us.goToPreviousPage,goToFirstCell:(e==null?void 0:e.goToFirstCell)??(e==null?void 0:e.first)??Us.goToFirstCell,goToLastCell:(e==null?void 0:e.goToLastCell)??(e==null?void 0:e.last)??Us.goToLastCell,selectToFirstCell:(e==null?void 0:e.selectToFirstCell)??(e==null?void 0:e.first)??Us.selectToFirstCell,selectToLastCell:(e==null?void 0:e.selectToLastCell)??(e==null?void 0:e.last)??Us.selectToLastCell};return Rx({...Us,...n})},[e])}const GW=v.lazy(async()=>await XT(()=>import("./data-grid-overlay-editor-DpnMYOBr.js"),[]));let YW=0;function qW(t){return ZB(Gb(Gb(t).filter(e=>e.span!==void 0).map(e=>{var n,r;return Uo((((n=e.span)==null?void 0:n[0])??0)+1,(((r=e.span)==null?void 0:r[1])??0)+1)})))}function Gf(t,e){return t===void 0||e===0||t.columns.length===0&&t.current===void 0?t:{current:t.current===void 0?void 0:{cell:[t.current.cell[0]+e,t.current.cell[1]],range:{...t.current.range,x:t.current.range.x+e},rangeStack:t.current.rangeStack.map(n=>({...n,x:n.x+e}))},rows:t.rows,columns:t.columns.offset(e)}}const Ug={kind:Se.Loading,allowOverlay:!1},Yf={columns:Ot.empty(),rows:Ot.empty(),current:void 0},QW=(t,e)=>{var $w,jw,Hw;const[n,r]=v.useState(Yf),[i,s]=v.useState(),o=v.useRef(null),l=v.useRef(null),[a,u]=v.useState(),c=v.useRef(null),f=v.useRef(),d=typeof window>"u"?null:window,{imageEditorOverride:h,getRowThemeOverride:p,markdownDivCreateNode:m,width:b,height:g,columns:y,rows:w,getCellContent:k,onCellClicked:x,onCellActivated:S,onFillPattern:T,onFinishedEditing:E,coercePasteValue:A,drawHeader:I,drawCell:_,editorBloom:P,onHeaderClicked:N,onColumnProposeMove:D,spanRangeBehavior:ee="default",onGroupHeaderClicked:ne,onCellContextMenu:ie,className:H,onHeaderContextMenu:Y,getCellsForSelection:R,onGroupHeaderContextMenu:O,onGroupHeaderRenamed:L,onCellEdited:F,onCellsEdited:W,onSearchResultsChanged:$,searchResults:ue,onSearchValueChange:ce,searchValue:be,onKeyDown:Ge,onKeyUp:$e,keybindings:at,editOnType:_t=!0,onRowAppended:Qe,onColumnMoved:it,validateCell:Je,highlightRegions:Wt,rangeSelect:Pe="rect",columnSelect:me="multi",rowSelect:Ie="multi",rangeSelectionBlending:Le="exclusive",columnSelectionBlending:nt="exclusive",rowSelectionBlending:_e="exclusive",onDelete:ft,onDragStart:ut,onMouseMove:vt,onPaste:he,copyHeaders:rt=!1,freezeColumns:st=0,cellActivationBehavior:Ve="second-click",rowSelectionMode:sn="auto",onHeaderMenuClick:wt,getGroupDetails:ct,onSearchClose:dt,onItemHovered:fe,onSelectionCleared:Ze,showSearch:V,onVisibleRegionChanged:pe,gridSelection:J,onGridSelectionChange:ve,minColumnWidth:de=50,maxColumnWidth:ht=500,maxColumnAutoWidth:Ne,provideEditor:Ue,trailingRowOptions:ye,freezeTrailingRows:De=0,allowedFillDirections:Et="orthogonal",scrollOffsetX:Vt,scrollOffsetY:Lt,verticalBorder:Mt,onDragOverCell:Un,onDrop:lt,onColumnResize:Ut,onColumnResizeEnd:Ft,onColumnResizeStart:Kt,customRenderers:Fn,fillHandle:Zt,drawFocusRing:Mn=!0,experimental:on,fixedShadowX:ef,fixedShadowY:Ds,headerIcons:us,imageWindowLoader:cs,initialSize:wl,isDraggable:tf,onDragLeave:nf,onRowMoved:Ni,overscrollX:bl,overscrollY:xl,preventDiagonalScrolling:kl,rightElement:Po,rightElementProps:_s,trapFocus:rf=!1,smoothScrollX:sf,smoothScrollY:Dp,scaleToRem:_p=!1,rowHeight:Sl=34,headerHeight:fs=36,groupHeaderHeight:Np=fs,theme:Lp,isOutsideClick:of,renderers:Cl}=t,Tn=typeof t.rowMarkers=="string"?void 0:t.rowMarkers,Wr=(Tn==null?void 0:Tn.kind)??t.rowMarkers??"none",lf=(Tn==null?void 0:Tn.width)??t.rowMarkerWidth,Tl=(Tn==null?void 0:Tn.startIndex)??t.rowMarkerStartIndex??1,qa=(Tn==null?void 0:Tn.theme)??t.rowMarkerTheme,Ns=(Tn==null?void 0:Tn.checkboxStyle)??"square",Tr=Math.max(de,20),ai=Math.max(ht,Tr),Qa=Math.max(Ne??ai,Tr),Ls=v.useMemo(()=>typeof window>"u"?{fontSize:"16px"}:window.getComputedStyle(document.documentElement),[]),Ja=v.useMemo(()=>Number.parseFloat(Ls.fontSize),[Ls]),{rowHeight:ir,headerHeight:El,groupHeaderHeight:Za,theme:af,overscrollX:Fp,overscrollY:uf}=KW({groupHeaderHeight:Np,headerHeight:fs,overscrollX:bl,overscrollY:xl,remSize:Ja,rowHeight:Sl,scaleToRem:_p,theme:Lp}),ui=XW(at),ds=lf??(w>1e4?48:w>1e3?44:w>100?36:32),Er=Wr!=="none",X=Er?1:0,ln=Qe!==void 0,Io=(ye==null?void 0:ye.sticky)===!0,[Bp,cf]=v.useState(!1),eu=V??Bp,zp=v.useCallback(()=>{dt!==void 0?dt():cf(!1)},[dt]),q=v.useMemo(()=>J===void 0?void 0:Gf(J,X),[J,X])??n,Kn=v.useRef();Kn.current===void 0&&(Kn.current=new AbortController),v.useEffect(()=>()=>Kn==null?void 0:Kn.current.abort(),[]);const[En,Al]=OW(R,k,X,Kn.current,w),tu=v.useCallback((C,z,B)=>{if(Je===void 0)return!0;const U=[C[0]-X,C[1]];return Je==null?void 0:Je(U,z,B)},[X,Je]),Fs=v.useRef(J),pr=v.useCallback((C,z)=>{z&&(C=FW(C,En,X,ee,Kn.current)),ve!==void 0?(Fs.current=Gf(C,-X),ve(Fs.current)):r(C)},[ve,En,X,ee]),ci=Fl(Ut,v.useCallback((C,z,B,U)=>{Ut==null||Ut(y[B-X],z,B-X,U)},[Ut,X,y])),$p=Fl(Ft,v.useCallback((C,z,B,U)=>{Ft==null||Ft(y[B-X],z,B-X,U)},[Ft,X,y])),Ml=Fl(Kt,v.useCallback((C,z,B,U)=>{Kt==null||Kt(y[B-X],z,B-X,U)},[Kt,X,y])),jp=Fl(I,v.useCallback((C,z)=>(I==null?void 0:I({...C,columnIndex:C.columnIndex-X},z))??!1,[I,X])),Hp=Fl(_,v.useCallback((C,z)=>(_==null?void 0:_({...C,col:C.col-X},z))??!1,[_,X])),j=v.useCallback(C=>{if(ft!==void 0){const z=ft(Gf(C,-X));return typeof z=="boolean"?z:Gf(z,X)}return!0},[ft,X]),[re,xe,ge]=RW(q,pr,Le,nt,_e,Pe),oe=v.useMemo(()=>yo(UT(),af),[af]),[Ae,et]=v.useState([0,0,0]),tt=v.useMemo(()=>{if(Cl===void 0)return{};const C={};for(const z of Cl)C[z.kind]=z;return C},[Cl]),Te=v.useCallback(C=>C.kind!==Se.Custom?tt[C.kind]:Fn==null?void 0:Fn.find(z=>z.isMatch(C)),[Fn,tt]);let{sizedColumns:Dt,nonGrowWidth:Fe}=Q4(y,w,Al,Ae[0]-(X===0?0:ds)-Ae[2],Tr,Qa,oe,Te,Kn.current);Wr!=="none"&&(Fe+=ds);const Bt=v.useMemo(()=>Dt.some(C=>C.group!==void 0),[Dt]),ot=Bt?El+Za:El,kt=q.rows.length,vn=Wr==="none"?void 0:kt===0?!1:kt===w?!0:void 0,pt=v.useMemo(()=>Wr==="none"?Dt:[{title:"",width:ds,icon:void 0,hasMenu:!1,style:"normal",themeOverride:qa,rowMarker:Ns,rowMarkerChecked:vn},...Dt],[Wr,Dt,ds,qa,Ns,vn]),[hn,Vr]=v.useMemo(()=>[Lt!==void 0&&typeof ir=="number"?Math.floor(Lt/ir):0,Lt!==void 0&&typeof ir=="number"?-(Lt%ir):0],[Lt,ir]),an=v.useRef({height:1,width:1,x:0,y:0}),Ar=v.useMemo(()=>({x:an.current.x,y:hn,width:an.current.width??1,height:an.current.height??1,ty:Vr}),[Vr,hn]),Rt=v.useRef(!1),[wn,Mr,Li]=t4(Ar);an.current=wn;const fi=(wn.height??1)>1;v.useLayoutEffect(()=>{if(Lt!==void 0&&c.current!==null&&fi){if(c.current.scrollTop===Lt)return;c.current.scrollTop=Lt,c.current.scrollTop!==Lt&&Li(),Rt.current=!0}},[Lt,fi,Li]);const Rl=(wn.width??1)>1;v.useLayoutEffect(()=>{if(Vt!==void 0&&c.current!==null&&Rl){if(c.current.scrollLeft===Vt)return;c.current.scrollLeft=Vt,c.current.scrollLeft!==Vt&&Li(),Rt.current=!0}},[Vt,Rl,Li]);const Do=wn.x+X,ff=wn.y,gr=v.useRef(null),sr=v.useCallback(C=>{var z;C===!0?(z=gr.current)==null||z.focus():window.requestAnimationFrame(()=>{var B;(B=gr.current)==null||B.focus()})},[]),Xn=ln?w+1:w,Ur=v.useCallback(C=>{const z=X===0?C:C.map(U=>({...U,location:[U.location[0]-X,U.location[1]]})),B=W==null?void 0:W(z);if(B!==!0)for(const U of z)F==null||F(U.location,U.value);return B},[F,W,X]),[_o,Wp]=v.useState(),df=q.current!==void 0&&q.current.range.width*q.current.range.height>1?q.current.range:void 0,Ol=Mn?($w=q.current)==null?void 0:$w.cell:void 0,hf=Ol==null?void 0:Ol[0],pf=Ol==null?void 0:Ol[1],GM=v.useMemo(()=>{if((Wt===void 0||Wt.length===0)&&(df??hf??pf??_o)===void 0)return;const C=[];if(Wt!==void 0)for(const z of Wt){const B=pt.length-z.range.x-X;B>0&&C.push({color:z.color,range:{...z.range,x:z.range.x+X,width:Math.min(B,z.range.width)},style:z.style})}return _o!==void 0&&C.push({color:al(oe.accentColor,0),range:_o,style:"dashed"}),df!==void 0&&C.push({color:al(oe.accentColor,.5),range:df,style:"solid-outline"}),hf!==void 0&&pf!==void 0&&C.push({color:oe.accentColor,range:{x:hf,y:pf,width:1,height:1},style:"solid-outline"}),C.length>0?C:void 0},[_o,df,hf,pf,Wt,pt.length,oe.accentColor,X]),Aw=v.useRef(pt);Aw.current=pt;const Rr=v.useCallback(([C,z],B=!1)=>{var Z,G,Q,se,te,Ce,Me;const U=ln&&z===Xn-1;if(C===0&&Er)return U?Ug:{kind:Qr.Marker,allowOverlay:!1,checkboxStyle:Ns,checked:(q==null?void 0:q.rows.hasIndex(z))===!0,markerKind:Wr==="clickable-number"?"number":Wr,row:Tl+z,drawHandle:Ni!==void 0,cursor:Wr==="clickable-number"?"pointer":void 0};if(U){const je=C===X?(ye==null?void 0:ye.hint)??"":"",Ke=Aw.current[C];if(((Z=Ke==null?void 0:Ke.trailingRowOptions)==null?void 0:Z.disabled)===!0)return Ug;{const At=((G=Ke==null?void 0:Ke.trailingRowOptions)==null?void 0:G.hint)??je,Ye=((Q=Ke==null?void 0:Ke.trailingRowOptions)==null?void 0:Q.addIcon)??(ye==null?void 0:ye.addIcon);return{kind:Qr.NewRow,hint:At,allowOverlay:!1,icon:Ye}}}else{const ke=C-X;if(B||(on==null?void 0:on.strict)===!0){const Ke=an.current,At=Ke.x>ke||ke>Ke.x+Ke.width||Ke.y>z||z>Ke.y+Ke.height||z>=Up.current,Ye=ke===((te=(se=Ke.extras)==null?void 0:se.selected)==null?void 0:te[0])&&z===((Ce=Ke.extras)==null?void 0:Ce.selected[1]);let ze=!1;if(((Me=Ke.extras)==null?void 0:Me.freezeRegions)!==void 0){for(const qt of Ke.extras.freezeRegions)if(vp(qt,ke,z)){ze=!0;break}}if(At&&!Ye&&!ze)return Ug}let je=k([ke,z]);return X!==0&&je.span!==void 0&&(je={...je,span:[je.span[0]+X,je.span[1]+X]}),je}},[ln,Xn,Er,Ns,q==null?void 0:q.rows,Wr,Tl,Ni,X,ye==null?void 0:ye.hint,ye==null?void 0:ye.addIcon,on==null?void 0:on.strict,k]),Vp=v.useCallback(C=>{let z=(ct==null?void 0:ct(C))??{name:C};return L!==void 0&&C!==""&&(z={icon:z.icon,name:z.name,overrideTheme:z.overrideTheme,actions:[...z.actions??[],{title:"Rename",icon:"renameIcon",onClick:B=>Xp({group:z.name,bounds:B.bounds})}]}),z},[ct,L]),gf=v.useCallback(C=>{var Q;const[z,B]=C.cell,U=pt[z],K=(U==null?void 0:U.group)!==void 0?(Q=Vp(U.group))==null?void 0:Q.overrideTheme:void 0,Z=U==null?void 0:U.themeOverride,G=p==null?void 0:p(B);s({...C,theme:yo(oe,K,Z,G,C.content.themeOverride)})},[p,pt,Vp,oe]),Pl=v.useCallback((C,z,B)=>{var G;if(q.current===void 0)return;const[U,K]=q.current.cell,Z=Rr([U,K]);if(Z.kind!==Se.Boolean&&Z.allowOverlay){let Q=Z;if(B!==void 0)switch(Q.kind){case Se.Number:{const se=LD(()=>B==="-"?-0:Number.parseFloat(B),0);Q={...Q,data:Number.isNaN(se)?0:se};break}case Se.Text:case Se.Markdown:case Se.Uri:Q={...Q,data:B};break}gf({target:C,content:Q,initialValue:B,cell:[U,K],highlight:B===void 0,forceEditMode:B!==void 0})}else Z.kind===Se.Boolean&&z&&Z.readonly!==!0&&(Ur([{location:q.current.cell,value:{...Z,data:bE(Z.data)}}]),(G=gr.current)==null||G.damage([{cell:q.current.cell}]))},[Rr,q,Ur,gf]),Mw=v.useCallback((C,z)=>{var K;const B=(K=gr.current)==null?void 0:K.getBounds(C,z);if(B===void 0||c.current===null)return;const U=Rr([C,z]);U.allowOverlay&&gf({target:B,content:U,initialValue:void 0,highlight:!0,cell:[C,z],forceEditMode:!0})},[Rr,gf]),bn=v.useCallback((C,z,B="both",U=0,K=0,Z=void 0)=>{if(c.current!==null){const G=gr.current,Q=l.current,se=typeof C!="number"?C.unit==="cell"?C.amount:void 0:C,te=typeof z!="number"?z.unit==="cell"?z.amount:void 0:z,Ce=typeof C!="number"&&C.unit==="px"?C.amount:void 0,Me=typeof z!="number"&&z.unit==="px"?z.amount:void 0;if(G!==null&&Q!==null){let ke={x:0,y:0,width:0,height:0},je=0,Ke=0;if((se!==void 0||te!==void 0)&&(ke=G.getBounds((se??0)+X,te??0)??ke,ke.width===0||ke.height===0))return;const At=Q.getBoundingClientRect(),Ye=At.width/Q.offsetWidth;if(Ce!==void 0&&(ke={...ke,x:Ce-At.left-c.current.scrollLeft,width:1}),Me!==void 0&&(ke={...ke,y:Me+At.top-c.current.scrollTop,height:1}),ke!==void 0){const ze={x:ke.x-U,y:ke.y-K,width:ke.width+2*U,height:ke.height+2*K};let qt=0;for(let Zp=0;Zp0&&(Gn=vl(Xn,xn,ir));let hi=qt*Ye+At.left+X*ds*Ye,Bi=At.right,pi=At.top+ot*Ye,zi=At.bottom-Gn*Ye;const xf=ke.width+U*2;switch(Z==null?void 0:Z.hAlign){case"start":Bi=hi+xf;break;case"end":hi=Bi-xf;break;case"center":hi=Math.floor((hi+Bi)/2)-xf/2,Bi=hi+xf;break}const kf=ke.height+K*2;switch(Z==null?void 0:Z.vAlign){case"start":zi=pi+kf;break;case"end":pi=zi-kf;break;case"center":pi=Math.floor((pi+zi)/2)-kf/2,zi=pi+kf;break}hi>ze.x?je=ze.x-hi:Bize.y?Ke=ze.y-pi:zi=Xn-xn)&&(Ke=0),(je!==0||Ke!==0)&&(Ye!==1&&(je/=Ye,Ke/=Ye),c.current.scrollTo(je+c.current.scrollLeft,Ke+c.current.scrollTop))}}}},[X,De,ds,ot,st,Dt,Xn,Io,ir]),Rw=v.useRef(Mw),Ow=v.useRef(k),Up=v.useRef(w);Rw.current=Mw,Ow.current=k,Up.current=w;const Il=v.useCallback(async(C,z=!0)=>{var se;const B=pt[C];if(((se=B==null?void 0:B.trailingRowOptions)==null?void 0:se.disabled)===!0)return;const U=Qe==null?void 0:Qe();let K,Z=!0;U!==void 0&&(K=await U,K==="top"&&(Z=!1),typeof K=="number"&&(Z=!1));let G=0;const Q=()=>{if(Up.current<=w){G<500&&window.setTimeout(Q,G),G=50+G*2;return}const te=typeof K=="number"?K:Z?w:0;bf.current(C-X,te),re({cell:[C,te],range:{x:C,y:te,width:1,height:1}},!1,!1,"edit");const Ce=Ow.current([C-X,te]);Ce.allowOverlay&&_u(Ce)&&Ce.readonly!==!0&&z&&window.setTimeout(()=>{Rw.current(C,te)},0)};Q()},[pt,Qe,X,w,re]),mf=v.useCallback(C=>{var B,U;const z=((U=(B=Dt[C])==null?void 0:B.trailingRowOptions)==null?void 0:U.targetColumn)??(ye==null?void 0:ye.targetColumn);if(typeof z=="number")return z+(Er?1:0);if(typeof z=="object"){const K=y.indexOf(z);if(K>=0)return K+(Er?1:0)}},[Dt,y,Er,ye==null?void 0:ye.targetColumn]),Bs=v.useRef(),Dl=v.useRef(),nu=v.useCallback((C,z)=>{var K;const[B,U]=z;return yo(oe,(K=pt[B])==null?void 0:K.themeOverride,p==null?void 0:p(U),C.themeOverride)},[p,pt,oe]),ru=v.useCallback(C=>{var Ce,Me,ke;const z=bh.value?C.metaKey:C.ctrlKey,B=z&&Ie==="multi",U=z&&me==="multi",[K,Z]=C.location,G=q.columns,Q=q.rows,[se,te]=((Ce=q.current)==null?void 0:Ce.cell)??[];if(C.kind==="cell"){if(Dl.current=void 0,No.current=[K,Z],K===0&&Er){if(ln===!0&&Z===w||Wr==="number"||Ie==="none")return;const je=Rr(C.location);if(je.kind!==Qr.Marker)return;if(Ni!==void 0){const Ye=Te(je);_r((Ye==null?void 0:Ye.kind)===Qr.Marker);const ze=(Me=Ye==null?void 0:Ye.onClick)==null?void 0:Me.call(Ye,{...C,cell:je,posX:C.localEventX,posY:C.localEventY,bounds:C.bounds,theme:nu(je,C.location),preventDefault:()=>{}});if(ze===void 0||ze.checked===je.checked)return}s(void 0),sr();const Ke=Q.hasIndex(Z),At=Bs.current;if(Ie==="multi"&&(C.shiftKey||C.isLongTouch===!0)&&At!==void 0&&Q.hasIndex(At)){const Ye=[Math.min(At,Z),Math.max(At,Z)+1];B||sn==="multi"?xe(void 0,Ye,!0):xe(Ot.fromSingleSelection(Ye),void 0,B)}else B||C.isTouch||sn==="multi"?Ke?xe(Q.remove(Z),void 0,!0):(xe(void 0,Z,!0),Bs.current=Z):Ke&&Q.length===1?xe(Ot.empty(),void 0,z):(xe(Ot.fromSingleSelection(Z),void 0,z),Bs.current=Z)}else if(K>=X&&ln&&Z===w){const je=mf(K);Il(je??K)}else if(se!==K||te!==Z){const je=Rr(C.location),Ke=Te(je);if((Ke==null?void 0:Ke.onSelect)!==void 0){let ze=!1;if(Ke.onSelect({...C,cell:je,posX:C.localEventX,posY:C.localEventY,bounds:C.bounds,preventDefault:()=>ze=!0,theme:nu(je,C.location)}),ze)return}const At=Io&&Z===w,Ye=Io&&q!==void 0&&((ke=q.current)==null?void 0:ke.cell[1])===w;if((C.shiftKey||C.isLongTouch===!0)&&se!==void 0&&te!==void 0&&q.current!==void 0&&!Ye){if(At)return;const ze=Math.min(K,se),qt=Math.max(K,se),Gn=Math.min(Z,te),xn=Math.max(Z,te);re({...q.current,range:{x:ze,y:Gn,width:qt-ze+1,height:xn-Gn+1}},!0,z,"click"),Bs.current=void 0,sr()}else re({cell:[K,Z],range:{x:K,y:Z,width:1,height:1}},!0,z,"click"),Bs.current=void 0,s(void 0),sr()}}else if(C.kind==="header")if(No.current=[K,Z],s(void 0),Er&&K===0)Bs.current=void 0,Dl.current=void 0,Ie==="multi"&&(Q.length!==w?xe(Ot.fromSingleSelection([0,w]),void 0,z):xe(Ot.empty(),void 0,z),sr());else{const je=Dl.current;if(me==="multi"&&(C.shiftKey||C.isLongTouch===!0)&&je!==void 0&&G.hasIndex(je)){const Ke=[Math.min(je,K),Math.max(je,K)+1];U?ge(void 0,Ke,z):ge(Ot.fromSingleSelection(Ke),void 0,z)}else U?(G.hasIndex(K)?ge(G.remove(K),void 0,z):ge(void 0,K,z),Dl.current=K):me!=="none"&&(ge(Ot.fromSingleSelection(K),void 0,z),Dl.current=K);Bs.current=void 0,sr()}else C.kind===Dr?No.current=[K,Z]:C.kind===xh&&!C.isMaybeScrollbar&&(pr(Yf,!1),s(void 0),sr(),Ze==null||Ze(),Bs.current=void 0,Dl.current=void 0)},[Il,me,sr,Te,mf,Rr,q,Er,Io,Ze,Ni,X,Wr,Ie,sn,w,re,pr,ge,xe,ln,nu]),iu=v.useRef(!1),No=v.useRef(),Pw=v.useRef(wn),Kr=v.useRef(),YM=v.useCallback(C=>{if(_l.current=!1,Pw.current=an.current,C.button!==0&&C.button!==1){Kr.current=void 0;return}const z=performance.now();Kr.current={button:C.button,time:z,location:C.location},(C==null?void 0:C.kind)==="header"&&(iu.current=!0);const B=C.kind==="cell"&&C.isFillHandle;!B&&C.kind!=="cell"&&C.isEdge||(u({previousSelection:q,fillHandle:B}),No.current=void 0,!C.isTouch&&C.button===0&&!B?ru(C):!C.isTouch&&C.button===1&&(No.current=C.location))},[q,ru]),[Kp,Xp]=v.useState(),Iw=v.useCallback(C=>{if(C.kind!==Dr||me!=="multi")return;const z=bh.value?C.metaKey:C.ctrlKey,[B]=C.location,U=q.columns;if(B=X&&Cc(K.group,pt[Q].group);Q--)Z--;for(let Q=B+1;Q{if(En!==void 0&&ci!==void 0){const z=an.current.y,B=an.current.height;let U=En({x:C,y:z,width:1,height:Math.min(B,w-z)},Kn.current.signal);typeof U!="object"&&(U=await U());const K=Dt[C-X],G=document.createElement("canvas").getContext("2d",{alpha:!1});if(G!==null){G.font=oe.baseFontFull;const Q=KT(G,oe,K,0,U,Tr,ai,!1,Te);ci==null||ci(K,Q.width,C,Q.width)}}},[Dt,En,ai,oe,Tr,ci,X,w,Te]),[qM,Gp]=v.useState(),Nl=v.useCallback(async(C,z)=>{var Q,se;const B=(Q=C.current)==null?void 0:Q.range;if(B===void 0||En===void 0||z.current===void 0)return;const U=z.current.range;if(T!==void 0){let te=!1;if(T({fillDestination:{...U,x:U.x-X},patternSource:{...B,x:B.x-X},preventDefault:()=>te=!0}),te)return}let K=En(B,Kn.current.signal);typeof K!="object"&&(K=await K());const Z=K,G=[];for(let te=0;te({cell:te.location})))},[En,Ur,T,X]),Dw=v.useCallback(()=>{if(q.current===void 0||q.current.range.width<=1)return;const C={...q,current:{...q.current,range:{...q.current.range,width:1}}};Nl(C,q)},[Nl,q]),_w=v.useCallback(()=>{if(q.current===void 0||q.current.range.height<=1)return;const C={...q,current:{...q.current,range:{...q.current.range,height:1}}};Nl(C,q)},[Nl,q]),QM=v.useCallback((C,z)=>{var Ce,Me;const B=a;if(u(void 0),Wp(void 0),Gp(void 0),iu.current=!1,z)return;if((B==null?void 0:B.fillHandle)===!0&&q.current!==void 0&&((Ce=B.previousSelection)==null?void 0:Ce.current)!==void 0){if(_o===void 0)return;const ke={...q,current:{...q.current,range:nE(B.previousSelection.current.range,_o)}};Nl(B.previousSelection,ke),pr(ke,!0);return}const[U,K]=C.location,[Z,G]=No.current??[],Q=()=>{_l.current=!0},se=ke=>{var Ke,At,Ye;const je=ke.isTouch||Z===U&&G===K;if(je&&(x==null||x([U-X,K],{...ke,preventDefault:Q})),ke.button===1)return!_l.current;if(!_l.current){const ze=Rr(C.location),qt=Te(ze);if(qt!==void 0&&qt.onClick!==void 0&&je){const xn=qt.onClick({...ke,cell:ze,posX:ke.localEventX,posY:ke.localEventY,bounds:ke.bounds,theme:nu(ze,C.location),preventDefault:Q});xn!==void 0&&!na(xn)&&jl(xn)&&(Ur([{location:ke.location,value:xn}]),(Ke=gr.current)==null||Ke.damage([{cell:ke.location}]))}if(_l.current||q.current===void 0)return!1;let Gn=!1;switch(ze.activationBehaviorOverride??Ve){case"double-click":case"second-click":{if(((Ye=(At=B==null?void 0:B.previousSelection)==null?void 0:At.current)==null?void 0:Ye.cell)===void 0)break;const[xn,hi]=q.current.cell,[Bi,pi]=B.previousSelection.current.cell;Gn=U===xn&&U===Bi&&K===hi&&K===pi&&(ke.isDoubleClick===!0||Ve==="second-click");break}case"single-click":{Gn=!0;break}}if(Gn)return S==null||S([U-X,K]),Pl(ke.bounds,!1),!0}return!1},te=C.location[0]-X;if(C.isTouch){const ke=an.current,je=Pw.current;if(ke.x!==je.x||ke.y!==je.y)return;if(C.isLongTouch===!0){if(C.kind==="cell"&&qu((Me=q.current)==null?void 0:Me.cell,C.location)){ie==null||ie([te,C.location[1]],{...C,preventDefault:Q});return}else if(C.kind==="header"&&q.columns.hasIndex(U)){Y==null||Y(te,{...C,preventDefault:Q});return}else if(C.kind===Dr){if(te<0)return;O==null||O(te,{...C,preventDefault:Q});return}}C.kind==="cell"?se(C)||ru(C):C.kind===Dr?ne==null||ne(te,{...C,preventDefault:Q}):(C.kind===Xs&&(N==null||N(te,{...C,preventDefault:Q})),ru(C));return}if(C.kind==="header"){if(te<0)return;C.isEdge?C.isDoubleClick===!0&&yf(U):C.button===0&&U===Z&&K===G&&(N==null||N(te,{...C,preventDefault:Q}))}if(C.kind===Dr){if(te<0)return;C.button===0&&U===Z&&K===G&&(ne==null||ne(te,{...C,preventDefault:Q}),_l.current||Iw(C))}C.kind==="cell"&&(C.button===0||C.button===1)&&se(C),No.current=void 0},[a,q,X,_o,Nl,pr,x,Rr,Te,Ve,nu,Ur,S,Pl,ie,Y,O,ru,ne,N,yf,Iw]),JM=v.useCallback(C=>{const z={...C,location:[C.location[0]-X,C.location[1]]};vt==null||vt(z),a!==void 0&&C.buttons===0&&(u(void 0),Wp(void 0),Gp(void 0),iu.current=!1),Gp(B=>{var U;return iu.current?[C.scrollEdge[0],0]:C.scrollEdge[0]===(B==null?void 0:B[0])&&C.scrollEdge[1]===B[1]?B:a===void 0||(((U=Kr.current)==null?void 0:U.location[0])??0){wt==null||wt(C-X,z)},[wt,X]),Fi=(jw=q==null?void 0:q.current)==null?void 0:jw.cell,eR=v.useCallback((C,z,B,U,K,Z)=>{Rt.current=!1;let G=Fi;G!==void 0&&(G=[G[0]-X,G[1]]);const Q=st===0?void 0:{x:0,y:C.y,width:st,height:C.height},se=[];Q!==void 0&&se.push(Q),De>0&&(se.push({x:C.x-X,y:w-De,width:C.width,height:De}),st>0&&se.push({x:0,y:w-De,width:st,height:De}));const te={x:C.x-X,y:C.y,width:C.width,height:ln&&C.y+C.height>=w?C.height-1:C.height,tx:K,ty:Z,extras:{selected:G,freezeRegion:Q,freezeRegions:se}};an.current=te,Mr(te),et([z,B,U]),pe==null||pe(te,te.tx,te.ty,te.extras)},[Fi,X,ln,w,st,De,Mr,pe]),tR=Fl(it,v.useCallback((C,z)=>{it==null||it(C-X,z-X),me!=="none"&&ge(Ot.fromSingleSelection(z),void 0,!0)},[me,it,X,ge])),Yp=v.useRef(!1),nR=v.useCallback(C=>{if(C.location[0]===0&&X>0){C.preventDefault();return}ut==null||ut({...C,location:[C.location[0]-X,C.location[1]]}),C.defaultPrevented()||(Yp.current=!0),u(void 0)},[ut,X]),rR=v.useCallback(()=>{Yp.current=!1},[]),qp=v.useRef(),Qp=v.useCallback(C=>{var z,B,U;if(!vE(C,qp.current)&&(qp.current=C,!(((z=Kr==null?void 0:Kr.current)==null?void 0:z.button)!==void 0&&Kr.current.button>=1))){if(C.buttons!==0&&a!==void 0&&((B=Kr.current)==null?void 0:B.location[0])===0&&C.location[0]===0&&X===1&&Ie==="multi"&&a.previousSelection&&!a.previousSelection.rows.hasIndex(Kr.current.location[1])&&q.rows.hasIndex(Kr.current.location[1])){const K=Math.min(Kr.current.location[1],C.location[1]),Z=Math.max(Kr.current.location[1],C.location[1])+1;xe(Ot.fromSingleSelection([K,Z]),void 0,!1)}if(C.buttons!==0&&a!==void 0&&q.current!==void 0&&!Yp.current&&!iu.current&&(Pe==="rect"||Pe==="multi-rect")){const[K,Z]=q.current.cell;let[G,Q]=C.location;if(Q<0&&(Q=an.current.y),a.fillHandle===!0&&((U=a.previousSelection)==null?void 0:U.current)!==void 0){const se=a.previousSelection.current.range;Q=Math.min(Q,ln?w-1:w);const te=Fz(se,G,Q,Et);Wp(te)}else{if(ln&&Z===w)return;if(ln&&Q===w)if(C.kind===xh)Q--;else return;G=Math.max(G,X);const Ce=G-K,Me=Q-Z,ke={x:Ce>=0?K:G,y:Me>=0?Z:Q,width:Math.abs(Ce)+1,height:Math.abs(Me)+1};re({...q.current,range:ke},!0,!1,"drag")}}fe==null||fe({...C,location:[C.location[0]-X,C.location[1]]})}},[Et,a,X,Ie,q,Pe,fe,xe,ln,w,re]),iR=v.useCallback(()=>{var G,Q;const C=qp.current;if(C===void 0)return;const[z,B]=C.scrollEdge;let[U,K]=C.location;const Z=an.current;z===-1?U=((Q=(G=Z.extras)==null?void 0:G.freezeRegion)==null?void 0:Q.x)??Z.x:z===1&&(U=Z.x+Z.width),B===-1?K=Math.max(0,Z.y):B===1&&(K=Math.min(w-1,Z.y+Z.height)),U=xi(U,0,pt.length-1),K=xi(K,0,w-1),Qp({...C,location:[U,K]})},[pt.length,Qp,w]);UW(qM,c,iR);const di=v.useCallback(C=>{if(q.current===void 0)return;const[z,B]=C,[U,K]=q.current.cell,Z=q.current.range;let G=Z.x,Q=Z.x+Z.width,se=Z.y,te=Z.y+Z.height;if(B!==0)switch(B){case 2:{te=w,se=K,bn(0,te,"vertical");break}case-2:{se=0,te=K+1,bn(0,se,"vertical");break}case 1:{seK+1?(te--,bn(0,te,"vertical")):(se=Math.max(0,se-1),bn(0,se,"vertical"));break}default:Sc()}if(z!==0)if(z===2)Q=pt.length,G=U,bn(Q-1-X,0,"horizontal");else if(z===-2)G=X,Q=U+1,bn(G-X,0,"horizontal");else{let Ce=[];if(En!==void 0){const Me=En({x:G,y:se,width:Q-G-X,height:te-se},Kn.current.signal);typeof Me=="object"&&(Ce=qW(Me))}if(z===1){let Me=!1;if(G0){const ke=Uo(G+1,U+1).find(je=>!Ce.includes(je-X));ke!==void 0&&(G=ke,Me=!0)}else G++,Me=!0;Me&&bn(G,0,"horizontal")}Me||(Q=Math.min(pt.length,Q+1),bn(Q-1-X,0,"horizontal"))}else if(z===-1){let Me=!1;if(Q>U+1){if(Ce.length>0){const ke=Uo(Q-1,U,-1).find(je=>!Ce.includes(je-X));ke!==void 0&&(Q=ke,Me=!0)}else Q--,Me=!0;Me&&bn(Q-X,0,"horizontal")}Me||(G=Math.max(X,G-1),bn(G-X,0,"horizontal"))}else Sc()}re({cell:q.current.cell,range:{x:G,y:se,width:Q-G,height:te-se}},!0,!1,"keyboard-select")},[En,q,pt.length,X,w,bn,re]),zs=v.useCallback((C,z,B,U)=>{const K=Xn-(B?0:1);if(C=xi(C,X,Dt.length-1+X),z=xi(z,0,K),C===(Fi==null?void 0:Fi[0])&&z===(Fi==null?void 0:Fi[1]))return!1;if(U&&q.current!==void 0){const Z=[...q.current.rangeStack];(q.current.range.width>1||q.current.range.height>1)&&Z.push(q.current.range),pr({...q,current:{cell:[C,z],range:{x:C,y:z,width:1,height:1},rangeStack:Z}},!0)}else re({cell:[C,z],range:{x:C,y:z,width:1,height:1}},!0,!1,"keyboard-nav");return f.current!==void 0&&f.current[0]===C&&f.current[1]===z&&(f.current=void 0),bn(C-X,z),!0},[Xn,X,Dt.length,Fi,q,bn,pr,re]),sR=v.useCallback((C,z)=>{(i==null?void 0:i.cell)!==void 0&&C!==void 0&&jl(C)&&(Ur([{location:i.cell,value:C}]),window.requestAnimationFrame(()=>{var K;(K=gr.current)==null||K.damage([{cell:i.cell}])})),sr(!0),s(void 0);const[B,U]=z;if(q.current!==void 0&&(B!==0||U!==0)){const K=q.current.cell[1]===Xn-1&&C!==void 0;zs(xi(q.current.cell[0]+B,0,pt.length-1),xi(q.current.cell[1]+U,0,Xn-1),K,!1)}E==null||E(C,z)},[i==null?void 0:i.cell,sr,q,E,Ur,Xn,zs,pt.length]),oR=v.useMemo(()=>`gdg-overlay-${YW++}`,[]),Lo=v.useCallback(C=>{var B,U,K,Z;sr();const z=[];for(let G=C.x;G({cell:G.location})))},[sr,k,Te,Ur,X]),su=i!==void 0,Nw=v.useCallback(C=>{var je,Ke;const z=()=>{C.stopPropagation(),C.preventDefault()},B={didMatch:!1},{bounds:U}=C,K=q.columns,Z=q.rows,G=ui;if(!su&&mt(G.clear,C,B))pr(Yf,!1),Ze==null||Ze();else if(!su&&mt(G.selectAll,C,B))pr({columns:Ot.empty(),rows:Ot.empty(),current:{cell:((je=q.current)==null?void 0:je.cell)??[X,0],range:{x:X,y:0,width:y.length,height:w},rangeStack:[]}},!1);else if(mt(G.search,C,B))(Ke=o==null?void 0:o.current)==null||Ke.focus({preventScroll:!0}),cf(!0);else if(mt(G.delete,C,B)){const At=(j==null?void 0:j(q))??!0;if(At!==!1){const Ye=At===!0?q:At;if(Ye.current!==void 0){Lo(Ye.current.range);for(const ze of Ye.current.rangeStack)Lo(ze)}for(const ze of Ye.rows)Lo({x:X,y:ze,width:y.length,height:1});for(const ze of Ye.columns)Lo({x:ze,y:0,width:1,height:w})}}if(B.didMatch)return z(),!0;if(q.current===void 0)return!1;let[Q,se]=q.current.cell,te=!1,Ce=!1;mt(G.scrollToSelectedCell,C,B)?bf.current(Q-X,se):me!=="none"&&mt(G.selectColumn,C,B)?K.hasIndex(Q)?ge(K.remove(Q),void 0,!0):me==="single"?ge(Ot.fromSingleSelection(Q),void 0,!0):ge(void 0,Q,!0):Ie!=="none"&&mt(G.selectRow,C,B)?Z.hasIndex(se)?xe(Z.remove(se),void 0,!0):Ie==="single"?xe(Ot.fromSingleSelection(se),void 0,!0):xe(void 0,se,!0):!su&&U!==void 0&&mt(G.activateCell,C,B)?se===w&&ln?window.setTimeout(()=>{const At=mf(Q);Il(At??Q)},0):(S==null||S([Q-X,se]),Pl(U,!0)):q.current.range.height>1&&mt(G.downFill,C,B)?_w():q.current.range.width>1&&mt(G.rightFill,C,B)?Dw():mt(G.goToNextPage,C,B)?se+=Math.max(1,an.current.height-4):mt(G.goToPreviousPage,C,B)?se-=Math.max(1,an.current.height-4):mt(G.goToFirstCell,C,B)?(s(void 0),se=0,Q=0):mt(G.goToLastCell,C,B)?(s(void 0),se=Number.MAX_SAFE_INTEGER,Q=Number.MAX_SAFE_INTEGER):mt(G.selectToFirstCell,C,B)?(s(void 0),di([-2,-2])):mt(G.selectToLastCell,C,B)?(s(void 0),di([2,2])):su?(mt(G.closeOverlay,C,B)&&s(void 0),mt(G.acceptOverlayDown,C,B)&&(s(void 0),se++),mt(G.acceptOverlayUp,C,B)&&(s(void 0),se--),mt(G.acceptOverlayLeft,C,B)&&(s(void 0),Q--),mt(G.acceptOverlayRight,C,B)&&(s(void 0),Q++)):(mt(G.goDownCell,C,B)?se+=1:mt(G.goUpCell,C,B)?se-=1:mt(G.goRightCell,C,B)?Q+=1:mt(G.goLeftCell,C,B)?Q-=1:mt(G.goDownCellRetainSelection,C,B)?(se+=1,te=!0):mt(G.goUpCellRetainSelection,C,B)?(se-=1,te=!0):mt(G.goRightCellRetainSelection,C,B)?(Q+=1,te=!0):mt(G.goLeftCellRetainSelection,C,B)?(Q-=1,te=!0):mt(G.goToLastRow,C,B)?se=w-1:mt(G.goToFirstRow,C,B)?se=Number.MIN_SAFE_INTEGER:mt(G.goToLastColumn,C,B)?Q=Number.MAX_SAFE_INTEGER:mt(G.goToFirstColumn,C,B)?Q=Number.MIN_SAFE_INTEGER:(Pe==="rect"||Pe==="multi-rect")&&(mt(G.selectGrowDown,C,B)?di([0,1]):mt(G.selectGrowUp,C,B)?di([0,-1]):mt(G.selectGrowRight,C,B)?di([1,0]):mt(G.selectGrowLeft,C,B)?di([-1,0]):mt(G.selectToLastRow,C,B)?di([0,2]):mt(G.selectToFirstRow,C,B)?di([0,-2]):mt(G.selectToLastColumn,C,B)?di([2,0]):mt(G.selectToFirstColumn,C,B)&&di([-2,0])),Ce=B.didMatch);const Me=zs(Q,se,!1,te),ke=B.didMatch;return ke&&(Me||!Ce||rf)&&z(),ke},[su,q,ui,me,Ie,Pe,X,w,zs,pr,Ze,y.length,j,rf,Lo,ge,xe,ln,mf,Il,S,Pl,_w,Dw,di]),ou=v.useCallback(C=>{let z=!1;if(Ge!==void 0&&Ge({...C,cancel:()=>{z=!0}}),z||Nw(C)||q.current===void 0)return;const[B,U]=q.current.cell,K=an.current;if(_t&&!C.metaKey&&!C.ctrlKey&&q.current!==void 0&&C.key.length===1&&/[ -~]/g.test(C.key)&&C.bounds!==void 0&&_u(k([B-X,Math.max(0,Math.min(U,w-1))]))){if((!ln||U!==w)&&(K.y>U||U>K.y+K.height||K.x>B||B>K.x+K.width))return;Pl(C.bounds,!0,C.key),C.stopPropagation(),C.preventDefault()}},[_t,Ge,Nw,q,k,X,w,ln,Pl]),lR=v.useCallback((C,z)=>{const B=C.location[0]-X;if(C.kind==="header"&&(Y==null||Y(B,{...C,preventDefault:z})),C.kind===Dr){if(B<0)return;O==null||O(B,{...C,preventDefault:z})}if(C.kind==="cell"){const[U,K]=C.location;ie==null||ie([B,K],{...C,preventDefault:z}),D4(q,C.location)||zs(U,K,!1,!1)}},[q,ie,O,Y,X,zs]),Jp=v.useCallback(async C=>{var G,Q,se;if(!ui.paste)return;function z(te,Ce,Me,ke){var Ke,At;const je=typeof Me=="object"?(Me==null?void 0:Me.join(` +`))??"":(Me==null?void 0:Me.toString())??"";if(!na(te)&&_u(te)&&te.readonly!==!0){const Ye=A==null?void 0:A(je,te);if(Ye!==void 0&&jl(Ye))return{location:Ce,value:Ye};const ze=Te(te);if(ze===void 0)return;if(ze.kind===Se.Custom){_r(te.kind===Se.Custom);const qt=(Ke=ze.onPaste)==null?void 0:Ke.call(ze,je,te.data);return qt===void 0?void 0:{location:Ce,value:{...te,data:qt}}}else{const qt=(At=ze.onPaste)==null?void 0:At.call(ze,je,te,{formatted:ke,formattedString:typeof ke=="string"?ke:ke==null?void 0:ke.join(` +`),rawValue:Me});return qt===void 0?void 0:(_r(qt.kind===te.kind),{location:Ce,value:qt})}}}const B=q.columns,U=q.rows,K=((G=c.current)==null?void 0:G.contains(document.activeElement))===!0||((Q=l.current)==null?void 0:Q.contains(document.activeElement))===!0;let Z;if(q.current!==void 0?Z=[q.current.range.x,q.current.range.y]:B.length===1?Z=[B.first()??0,0]:U.length===1&&(Z=[X,U.first()??0]),K&&Z!==void 0){let te,Ce;const Me="text/plain",ke="text/html";if(navigator.clipboard.read!==void 0){const Ye=await navigator.clipboard.read();for(const ze of Ye){if(ze.types.includes(ke)){const Gn=await(await ze.getType(ke)).text(),xn=Tx(Gn);if(xn!==void 0){te=xn;break}}ze.types.includes(Me)&&(Ce=await(await ze.getType(Me)).text())}}else if(navigator.clipboard.readText!==void 0)Ce=await navigator.clipboard.readText();else if(C!==void 0&&(C==null?void 0:C.clipboardData)!==null){if(C.clipboardData.types.includes(ke)){const Ye=C.clipboardData.getData(ke);te=Tx(Ye)}te===void 0&&C.clipboardData.types.includes(Me)&&(Ce=C.clipboardData.getData(Me))}else return;const[je,Ke]=Z,At=[];do{if(he===void 0){const Ye=Rr(Z),ze=Ce??(te==null?void 0:te.map(Gn=>Gn.map(xn=>xn.rawValue).join(" ")).join(" "))??"",qt=z(Ye,Z,ze,void 0);qt!==void 0&&At.push(qt);break}if(te===void 0){if(Ce===void 0)return;te=BW(Ce)}if(he===!1||typeof he=="function"&&(he==null?void 0:he([Z[0]-X,Z[1]],te.map(Ye=>Ye.map(ze=>{var qt;return((qt=ze.rawValue)==null?void 0:qt.toString())??""}))))!==!0)return;for(const[Ye,ze]of te.entries()){if(Ye+Ke>=w)break;for(const[qt,Gn]of ze.entries()){const xn=[qt+je,Ye+Ke],[hi,Bi]=xn;if(hi>=pt.length||Bi>=Xn)continue;const pi=Rr(xn),zi=z(pi,xn,Gn.rawValue,Gn.formatted);zi!==void 0&&At.push(zi)}}}while(!1);Ur(At),(se=gr.current)==null||se.damage(At.map(Ye=>({cell:Ye.location})))}},[A,Te,Rr,q,ui.paste,pt.length,Ur,Xn,he,X,w]);$n("paste",Jp,d,!1,!0);const lu=v.useCallback(async(C,z)=>{var G,Q;if(!ui.copy)return;const B=z===!0||((G=c.current)==null?void 0:G.contains(document.activeElement))===!0||((Q=l.current)==null?void 0:Q.contains(document.activeElement))===!0,U=q.columns,K=q.rows,Z=(se,te)=>{if(!rt)Ax(se,te,C);else{const Ce=te.map(Me=>({kind:Se.Text,data:y[Me].title,displayData:y[Me].title,allowOverlay:!1}));Ax([Ce,...se],te,C)}};if(B&&En!==void 0){if(q.current!==void 0){let se=En(q.current.range,Kn.current.signal);typeof se!="object"&&(se=await se()),Z(se,Uo(q.current.range.x-X,q.current.range.x+q.current.range.width-X))}else if(K!==void 0&&K.length>0){const te=[...K].map(Ce=>{const Me=En({x:X,y:Ce,width:y.length,height:1},Kn.current.signal);return typeof Me=="object"?Me[0]:Me().then(ke=>ke[0])});if(te.some(Ce=>Ce instanceof Promise)){const Ce=await Promise.all(te);Z(Ce,Uo(y.length))}else Z(te,Uo(y.length))}else if(U.length>0){const se=[],te=[];for(const Ce of U){let Me=En({x:Ce,y:0,width:1,height:w},Kn.current.signal);typeof Me!="object"&&(Me=await Me()),se.push(Me),te.push(Ce-X)}if(se.length===1)Z(se[0],te);else{const Ce=se.reduce((Me,ke)=>Me.map((je,Ke)=>[...je,...ke[Ke]]));Z(Ce,te)}}}},[y,En,q,ui.copy,X,w,rt]);$n("copy",lu,d,!1,!1);const aR=v.useCallback(async C=>{var B,U;if(!(!ui.cut||!(((B=c.current)==null?void 0:B.contains(document.activeElement))===!0||((U=l.current)==null?void 0:U.contains(document.activeElement))===!0))&&(await lu(C),q.current!==void 0)){let K={current:{cell:q.current.cell,range:q.current.range,rangeStack:[]},rows:Ot.empty(),columns:Ot.empty()};const Z=j==null?void 0:j(K);if(Z===!1||(K=Z===!0?K:Z,K.current===void 0))return;Lo(K.current.range)}},[Lo,q,ui.cut,lu,j]);$n("cut",aR,d,!1,!1);const uR=v.useCallback((C,z)=>{if($!==void 0){X!==0&&(C=C.map(K=>[K[0]-X,K[1]])),$(C,z);return}if(C.length===0||z===-1)return;const[B,U]=C[z];f.current!==void 0&&f.current[0]===B&&f.current[1]===U||(f.current=[B,U],zs(B,U,!1,!1))},[$,X,zs]),[vf,wf]=((Hw=J==null?void 0:J.current)==null?void 0:Hw.cell)??[],bf=v.useRef(bn);bf.current=bn,v.useLayoutEffect(()=>{var C,z,B,U;!Rt.current&&vf!==void 0&&wf!==void 0&&(vf!==((z=(C=Fs.current)==null?void 0:C.current)==null?void 0:z.cell[0])||wf!==((U=(B=Fs.current)==null?void 0:B.current)==null?void 0:U.cell[1]))&&bf.current(vf,wf),Rt.current=!1},[vf,wf]);const Lw=q.current!==void 0&&(q.current.cell[0]>=pt.length||q.current.cell[1]>=Xn);v.useLayoutEffect(()=>{Lw&&pr(Yf,!1)},[Lw,pr]);const cR=v.useMemo(()=>ln===!0&&(ye==null?void 0:ye.tint)===!0?Ot.fromSingleSelection(Xn-1):Ot.empty(),[Xn,ln,ye==null?void 0:ye.tint]),fR=v.useCallback(C=>typeof Mt=="boolean"?Mt:(Mt==null?void 0:Mt(C-X))??!0,[X,Mt]),dR=v.useMemo(()=>{if(Kp===void 0||l.current===null)return null;const{bounds:C,group:z}=Kp,B=l.current.getBoundingClientRect();return v.createElement(AW,{bounds:C,group:z,canvasBounds:B,onClose:()=>Xp(void 0),onFinish:U=>{Xp(void 0),L==null||L(z,U)}})},[L,Kp]),hR=Math.min(pt.length,st+(Er?1:0));v.useImperativeHandle(e,()=>({appendRow:(C,z)=>Il(C+X,z),updateCells:C=>{var z;return X!==0&&(C=C.map(B=>({cell:[B.cell[0]+X,B.cell[1]]}))),(z=gr.current)==null?void 0:z.damage(C)},getBounds:(C,z)=>{var B;if(!((l==null?void 0:l.current)===null||(c==null?void 0:c.current)===null)){if(C===void 0&&z===void 0){const U=l.current.getBoundingClientRect(),K=U.width/c.current.clientWidth;return{x:U.x-c.current.scrollLeft*K,y:U.y-c.current.scrollTop*K,width:c.current.scrollWidth*K,height:c.current.scrollHeight*K}}return(B=gr.current)==null?void 0:B.getBounds((C??0)+X,z)}},focus:()=>{var C;return(C=gr.current)==null?void 0:C.focus()},emit:async C=>{switch(C){case"delete":ou({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!1,key:"Delete",keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-right":ou({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"r",keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-down":ou({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"d",keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"copy":await lu(void 0,!0);break;case"paste":await Jp();break}},scrollTo:bn,remeasureColumns:C=>{for(const z of C)yf(z+X)}}),[Il,yf,lu,ou,Jp,X,bn]);const[Fw,Bw]=Fi??[],pR=v.useCallback(C=>{const[z,B]=C;if(B===-1){me!=="none"&&(ge(Ot.fromSingleSelection(z),void 0,!1),sr());return}Fw===z&&Bw===B||(re({cell:C,range:{x:z,y:B,width:1,height:1}},!0,!1,"keyboard-nav"),bn(z,B))},[me,sr,bn,Fw,Bw,re,ge]),[gR,mR]=v.useState(!1),zw=v.useRef(ST(C=>{mR(C)},5)),yR=v.useCallback(()=>{zw.current(!0),q.current===void 0&&q.columns.length===0&&q.rows.length===0&&a===void 0&&re({cell:[X,ff],range:{x:X,y:ff,width:1,height:1}},!0,!1,"keyboard-select")},[ff,q,a,X,re]),vR=v.useCallback(()=>{zw.current(!1)},[]),[wR,bR]=v.useMemo(()=>{let C;const z=(on==null?void 0:on.scrollbarWidthOverride)??S0(),B=w+(ln?1:0);if(typeof ir=="number")C=ot+B*ir;else{let K=0;const Z=Math.min(B,10);for(let G=0;GZ.width+K,0)+z;return[`${Math.min(1e5,U)}px`,`${Math.min(1e5,C)}px`]},[pt,on==null?void 0:on.scrollbarWidthOverride,ir,w,ln,ot]),xR=v.useMemo(()=>G4(oe),[oe]);return v.createElement(Y4.Provider,{value:oe},v.createElement(HW,{style:xR,className:H,inWidth:b??wR,inHeight:g??bR},v.createElement(SW,{fillHandle:Zt,drawFocusRing:Mn,experimental:on,fixedShadowX:ef,fixedShadowY:Ds,getRowThemeOverride:p,headerIcons:us,imageWindowLoader:cs,initialSize:wl,isDraggable:tf,onDragLeave:nf,onRowMoved:Ni,overscrollX:Fp,overscrollY:uf,preventDiagonalScrolling:kl,rightElement:Po,rightElementProps:_s,smoothScrollX:sf,smoothScrollY:Dp,className:H,enableGroups:Bt,onCanvasFocused:yR,onCanvasBlur:vR,canvasRef:l,onContextMenu:lR,theme:oe,cellXOffset:Do,cellYOffset:ff,accessibilityHeight:wn.height,onDragEnd:rR,columns:pt,nonGrowWidth:Fe,drawHeader:jp,onColumnProposeMove:D,drawCell:Hp,disabledRows:cR,freezeColumns:hR,lockColumns:X,firstColAccessible:X===0,getCellContent:Rr,minColumnWidth:Tr,maxColumnWidth:ai,searchInputRef:o,showSearch:eu,onSearchClose:zp,highlightRegions:GM,getCellsForSelection:En,getGroupDetails:Vp,headerHeight:El,isFocused:gR,groupHeaderHeight:Bt?Za:0,freezeTrailingRows:De+(ln&&(ye==null?void 0:ye.sticky)===!0?1:0),hasAppendRow:ln,onColumnResize:ci,onColumnResizeEnd:$p,onColumnResizeStart:Ml,onCellFocused:pR,onColumnMoved:tR,onDragStart:nR,onHeaderMenuClick:ZM,onItemHovered:Qp,isFilling:(a==null?void 0:a.fillHandle)===!0,onMouseMove:JM,onKeyDown:ou,onKeyUp:$e,onMouseDown:YM,onMouseUp:QM,onDragOverCell:Un,onDrop:lt,onSearchResultsChanged:uR,onVisibleRegionChanged:eR,clientSize:Ae,rowHeight:ir,searchResults:ue,searchValue:be,onSearchValueChange:ce,rows:Xn,scrollRef:c,selection:q,translateX:wn.tx,translateY:wn.ty,verticalBorder:fR,gridRef:gr,getCellRenderer:Te}),dR,i!==void 0&&v.createElement(v.Suspense,{fallback:null},v.createElement(GW,{...i,validateCell:tu,bloom:P,id:oR,getCellRenderer:Te,className:(on==null?void 0:on.isSubGrid)===!0?"click-outside-ignore":void 0,provideEditor:Ue,imageEditorOverride:h,onFinishEditing:sR,markdownDivCreateNode:m,isOutsideClick:of}))))},JW=v.forwardRef(QW),Ox=20,ZW={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??"false"},kind:Se.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:t=>e6(t,t.cell.data,v0(t.cell),t.cell.maxSize??Ox),onDelete:t=>({...t,data:!1}),onClick:t=>{const{cell:e,posX:n,posY:r,bounds:i,theme:s}=t,{width:o,height:l,x:a,y:u}=i,c=e.maxSize??Ox,f=Math.floor(i.y+l/2),d=ET(c,l,s.cellVerticalPadding),h=TT(e.contentAlign??"center",a,o,s.cellHorizontalPadding,d),p=CT(h,f,d),m=AT(a+n,u+r,p);if(v0(e)&&m)return{...e,data:bE(e.data)}},onPaste:(t,e)=>{let n=ah;return t.toLowerCase()==="true"?n=!0:t.toLowerCase()==="false"?n=!1:t.toLowerCase()==="indeterminate"&&(n=Lv),n===e.data?void 0:{...e,data:n}}};function e6(t,e,n,r){if(!n&&e===ah)return;const{ctx:i,hoverAmount:s,theme:o,rect:l,highlighted:a,hoverX:u,hoverY:c,cell:{contentAlign:f}}=t,{x:d,y:h,width:p,height:m}=l,b=.35;let g=n?1-b+b*s:.4;e===ah&&(g*=s),g!==0&&(i.globalAlpha=g,qv(i,o,e,d,h,p,m,a,u,c,r,f),i.globalAlpha=1)}const t6=Hr("div")({name:"BubblesOverlayEditorStyle",class:"gdg-b1ygi5by",propsAsIs:!1}),n6=t=>{const{bubbles:e}=t;return v.createElement(t6,null,e.map((n,r)=>v.createElement("div",{key:r,className:"boe-bubble"},n)),v.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},r6={getAccessibilityString:t=>MT(t.data),kind:Se.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,e,n)=>e.data.reduce((r,i)=>t.measureText(i).width+r+20,0)+2*n.cellHorizontalPadding-4,draw:t=>s6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return v.createElement(n6,{bubbles:e.data})},onPaste:()=>{}},i6=4;function s6(t,e){const{rect:n,theme:r,ctx:i,highlighted:s}=t,{x:o,y:l,width:a,height:u}=n,c=20,f=8,d=i6;let h=o+r.cellHorizontalPadding;const p=[];for(const m of e){if(h>o+a)break;const b=Xc(m,i,r.baseFontFull).width;p.push({x:h,width:b}),h+=b+f*2+d}i.beginPath();for(const m of p)rs(i,m.x,l+(u-c)/2,m.width+f*2,c,r.roundingRadius??c/2);i.fillStyle=s?r.bgBubbleSelected:r.bgBubble,i.fill();for(const[m,b]of p.entries())i.beginPath(),i.fillStyle=r.textBubble,i.fillText(e[m],b.x+f,l+u/2+Is(i,r))}const o6=Hr("div")({name:"DrilldownOverlayEditorStyle",class:"gdg-d4zsq0x",propsAsIs:!1}),l6=t=>{const{drilldowns:e}=t;return v.createElement(o6,null,e.map((n,r)=>v.createElement("div",{key:r,className:"doe-bubble"},n.img!==void 0&&v.createElement("img",{src:n.img}),v.createElement("div",null,n.text))))},a6={getAccessibilityString:t=>MT(t.data.map(e=>e.text)),kind:Se.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,e,n)=>e.data.reduce((r,i)=>t.measureText(i.text).width+r+20+(i.img!==void 0?18:0),0)+2*n.cellHorizontalPadding-4,draw:t=>f6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return v.createElement(l6,{drilldowns:e.data})},onPaste:()=>{}},u6=4,Kg={};function c6(t,e,n,r){const i=Math.ceil(window.devicePixelRatio),s=5,o=n-s*2,l=4,a=n*i,u=r+s,c=r*3,f=(c+s*2)*i,d=`${t},${e},${i},${n}`;if(Kg[d]!==void 0)return{el:Kg[d],height:a,width:f,middleWidth:l*i,sideWidth:u*i,padding:s*i,dpr:i};const h=document.createElement("canvas"),p=h.getContext("2d");return p===null?null:(h.width=f,h.height=a,p.scale(i,i),Kg[d]=h,p.beginPath(),rs(p,s,s,c,o,r),p.shadowColor="rgba(24, 25, 34, 0.4)",p.shadowBlur=1,p.fillStyle=t,p.fill(),p.shadowColor="rgba(24, 25, 34, 0.3)",p.shadowOffsetY=1,p.shadowBlur=5,p.fillStyle=t,p.fill(),p.shadowOffsetY=0,p.shadowBlur=0,p.shadowBlur=0,p.beginPath(),rs(p,s+.5,s+.5,c,o,r),p.strokeStyle=e,p.lineWidth=1,p.stroke(),{el:h,height:a,width:f,sideWidth:u*i,middleWidth:r*i,padding:s*i,dpr:i})}function f6(t,e){const{rect:n,theme:r,ctx:i,imageLoader:s,col:o,row:l}=t,{x:a,width:u}=n,c=r.baseFontFull,f=jT(i,c),d=Math.min(n.height,Math.max(16,Math.ceil(f*r.lineHeight)*2)),h=Math.floor(n.y+(n.height-d)/2),p=d-10,m=8,b=u6;let g=a+r.cellHorizontalPadding;const y=r.roundingRadius??6,w=c6(r.bgCell,r.drilldownBorder,d,y),k=[];for(const x of e){if(g>a+u)break;const T=Xc(x.text,i,c).width;let E=0;x.img!==void 0&&s.loadOrGetImage(x.img,o,l)!==void 0&&(E=p-8+4);const A=T+E+m*2;k.push({x:g,width:A}),g+=A+b}if(w!==null){const{el:x,height:S,middleWidth:T,sideWidth:E,width:A,dpr:I,padding:_}=w,P=E/I,N=_/I;for(const D of k){const ee=Math.floor(D.x),ne=Math.floor(D.width),ie=ne-(P-N)*2;i.imageSmoothingEnabled=!1,i.drawImage(x,0,0,E,S,ee-N,h,P,d),ie>0&&i.drawImage(x,E,0,T,S,ee+(P-N),h,ie,d),i.drawImage(x,A-E,0,E,S,ee+ne-(P-N),h,P,d),i.imageSmoothingEnabled=!0}}i.beginPath();for(const[x,S]of k.entries()){const T=e[x];let E=S.x+m;if(T.img!==void 0){const A=s.loadOrGetImage(T.img,o,l);if(A!==void 0){const I=p-8;let _=0,P=0,N=A.width,D=A.height;N>D?(_+=(N-D)/2,N=D):D>N&&(P+=(D-N)/2,D=N),i.beginPath(),rs(i,E,h+d/2-I/2,I,I,r.roundingRadius??3),i.save(),i.clip(),i.drawImage(A,_,P,N,D,E,h+d/2-I/2,I,I),i.restore(),E+=I+4}}i.beginPath(),i.fillStyle=r.textBubble,i.fillText(T.text,E,h+d/2+Is(i,r))}}const d6={getAccessibilityString:t=>t.data.join(", "),kind:Se.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>h6(t,t.cell.displayData??t.cell.data,t.cell.rounding??t.theme.roundingRadius??4,t.cell.contentAlign),measure:(t,e)=>e.data.length*50,onDelete:t=>({...t,data:[]}),provideEditor:()=>t=>{const{value:e,onFinishedEditing:n,imageEditorOverride:r}=t,i=r??r4;return v.createElement(i,{urls:e.data,canWrite:e.readonly!==!1,onCancel:n,onChange:s=>{n({...e,data:[s]})}})},onPaste:(t,e)=>{t=t.trim();const r=t.split(",").map(i=>{try{return new URL(i),i}catch{return}}).filter(i=>i!==void 0);if(!(r.length===e.data.length&&r.every((i,s)=>i===e.data[s])))return{...e,data:r}}},Xg=4;function h6(t,e,n,r){const{rect:i,col:s,row:o,theme:l,ctx:a,imageLoader:u}=t,{x:c,y:f,height:d,width:h}=i,p=d-l.cellVerticalPadding*2,m=[];let b=0;for(let y=0;y0&&(a.beginPath(),rs(a,g,f+l.cellVerticalPadding,w,p,n),a.save(),a.clip()),a.drawImage(y,g,f+l.cellVerticalPadding,w,p),n>0&&a.restore(),g+=w+Xg}}function p6(t,e){let n=t*49632+e*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}const g6={getAccessibilityString:()=>"",kind:Se.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:t=>{const{cell:e,col:n,row:r,ctx:i,rect:s,theme:o}=t;if(e.skeletonWidth===void 0||e.skeletonWidth===0)return;let l=e.skeletonWidth;e.skeletonWidthVariability!==void 0&&e.skeletonWidthVariability>0&&(l+=Math.round(p6(n,r)*e.skeletonWidthVariability));const a=o.cellHorizontalPadding,u=e.skeletonHeight??Math.min(18,s.height-2*o.cellVerticalPadding);rs(i,s.x+a,s.y+(s.height-u)/2,l,u,o.roundingRadius??3),i.fillStyle=al(o.textDark,.1),i.fill()},onPaste:()=>{}},m6=()=>t=>t.targetWidth,Px=Hr("div")({name:"MarkdownOverlayEditorStyle",class:"gdg-m1pnx84e",propsAsIs:!1,vars:{"m1pnx84e-0":[m6(),"px"]}}),y6=t=>{const{value:e,onChange:n,forceEditMode:r,createNode:i,targetRect:s,onFinish:o,validatedSelection:l}=t,a=e.data,u=e.readonly===!0,[c,f]=v.useState(a===""||r),d=v.useCallback(()=>{f(p=>!p)},[]),h=a?"gdg-ml-6":"";return c?v.createElement(Px,{targetWidth:s.width-20},v.createElement(mp,{autoFocus:!0,highlight:!1,validatedSelection:l,value:a,onKeyDown:p=>{p.key==="Enter"&&p.stopPropagation()},onChange:n}),v.createElement("div",{className:`gdg-edit-icon gdg-checkmark-hover ${h}`,onClick:()=>o(e)},v.createElement(qF,null))):v.createElement(Px,{targetWidth:s.width},v.createElement(k4,{contents:a,createNode:i}),!u&&v.createElement(v.Fragment,null,v.createElement("div",{className:"spacer"}),v.createElement("div",{className:`gdg-edit-icon gdg-edit-hover ${h}`,onClick:d},v.createElement(jv,null))),v.createElement("textarea",{className:"gdg-md-edit-textarea gdg-input",autoFocus:!0}))},v6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:Gc,measure:(t,e,n)=>{const r=e.data.split(` +`)[0];return t.measureText(r).width+2*n.cellHorizontalPadding},draw:t=>ws(t,t.cell.data,t.cell.contentAlign),onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{const{onChange:e,value:n,target:r,onFinishedEditing:i,markdownDivCreateNode:s,forceEditMode:o,validatedSelection:l}=t;return v.createElement(y6,{onFinish:i,targetRect:r,value:n,validatedSelection:l,onChange:a=>e({...n,data:a.target.value}),forceEditMode:o,createNode:s})},onPaste:(t,e)=>t===e.data?void 0:{...e,data:t}},w6={getAccessibilityString:t=>t.row.toString(),kind:Qr.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:b6,measure:()=>44,draw:t=>k6(t,t.cell.row,t.cell.checked,t.cell.markerKind,t.cell.drawHandle,t.cell.checkboxStyle),onClick:t=>{const{bounds:e,cell:n,posX:r,posY:i}=t,{width:s,height:o}=e,l=n.drawHandle?7+(s-7)/2:s/2,a=o/2;if(Math.abs(r-l)<=10&&Math.abs(i-a)<=10)return{...n,checked:!n.checked}},onPaste:()=>{}};function b6(t,e){const{ctx:n,theme:r}=t,i=r.markerFontFull,s=e??{};return(s==null?void 0:s.font)!==i&&(n.font=i,s.font=i),s.deprep=x6,n.textAlign="center",s}function x6(t){const{ctx:e}=t;e.textAlign="start"}function k6(t,e,n,r,i,s){const{ctx:o,rect:l,hoverAmount:a,theme:u}=t,{x:c,y:f,width:d,height:h}=l,p=n?1:r==="checkbox-visible"?.6+.4*a:a;if(r!=="number"&&p>0){o.globalAlpha=p;const m=7*(n?a:1);if(qv(o,u,n,i?c+m:c,f,i?d-m:d,h,!0,void 0,void 0,18,"center",s),i){o.globalAlpha=a,o.beginPath();for(const b of[3,6])for(const g of[-5,-1,3])o.rect(c+b,f+h/2+g,2,2);o.fillStyle=u.textLight,o.fill(),o.beginPath()}o.globalAlpha=1}if(r==="number"||r==="both"&&!n){const m=e.toString(),b=u.markerFontFull,g=c+d/2;r==="both"&&a!==0&&(o.globalAlpha=1-a),o.fillStyle=u.textLight,o.font=b,o.fillText(m,g,f+h/2+Is(o,b)),a!==0&&(o.globalAlpha=1)}}const S6={getAccessibilityString:()=>"",kind:Qr.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>C6(t,t.cell.hint,t.cell.icon),onPaste:()=>{}};function C6(t,e,n){const{ctx:r,rect:i,hoverAmount:s,theme:o,spriteManager:l}=t,{x:a,y:u,width:c,height:f}=i;r.beginPath(),r.globalAlpha=s,r.rect(a+1,u+1,c,f-2),r.fillStyle=o.bgHeaderHovered,r.fill(),r.globalAlpha=1,r.beginPath();const d=e!=="";let h=0;if(n!==void 0){const m=f-8,b=a+8/2,g=u+8/2;l.drawSprite(n,"normal",r,b,g,m,o,d?1:s),h=m}else{h=24;const p=12,m=d?p:s*p,b=d?0:(1-s)*p*.5,g=o.cellHorizontalPadding+4;m>0&&(r.moveTo(a+g+b,u+f/2),r.lineTo(a+g+b+m,u+f/2),r.moveTo(a+g+b+m*.5,u+f/2-m*.5),r.lineTo(a+g+b+m*.5,u+f/2+m*.5),r.lineWidth=2,r.strokeStyle=o.bgIconHeader,r.lineCap="round",r.stroke())}r.fillStyle=o.textMedium,r.fillText(e,h+a+o.cellHorizontalPadding+.5,u+f/2+Is(r,o)),r.beginPath()}const T6=v.lazy(async()=>await XT(()=>import("./number-overlay-editor-DN6llsFj.js"),[])),E6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Gc,draw:t=>ws(t,t.cell.displayData,t.cell.contentAlign),measure:(t,e,n)=>t.measureText(e.displayData).width+n.cellHorizontalPadding*2,onDelete:t=>({...t,data:void 0}),provideEditor:()=>t=>{const{isHighlighted:e,onChange:n,value:r,validatedSelection:i}=t;return v.createElement(v.Suspense,{fallback:null},v.createElement(T6,{highlight:e,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:i,onChange:s=>n({...r,data:Number.isNaN(s.floatValue??0)?0:s.floatValue})}))},onPaste:(t,e,n)=>{const r=typeof n.rawValue=="number"?n.rawValue:Number.parseFloat(typeof n.rawValue=="string"?n.rawValue:t);if(!(Number.isNaN(r)||e.data===r))return{...e,data:r,displayData:n.formattedString??e.displayData}}},A6={getAccessibilityString:()=>"",measure:()=>108,kind:Se.Protected,needsHover:!1,needsHoverPosition:!1,draw:M6,onPaste:()=>{}};function M6(t){const{ctx:e,theme:n,rect:r}=t,{x:i,y:s,height:o}=r;e.beginPath();const l=2.5;let a=i+n.cellHorizontalPadding+l;const u=s+o/2,c=Math.cos(Ib(30))*l,f=Math.sin(Ib(30))*l;for(let d=0;d<12;d++)e.moveTo(a,u-l),e.lineTo(a,u+l),e.moveTo(a+c,u-f),e.lineTo(a-c,u+f),e.moveTo(a-c,u-f),e.lineTo(a+c,u+f),a+=8;e.lineWidth=1.1,e.lineCap="square",e.strokeStyle=n.textLight,e.stroke()}const R6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(t,e)=>Gc(t,e,t.theme.textLight),draw:t=>ws(t,t.cell.data,t.cell.contentAlign),measure:(t,e,n)=>t.measureText(e.data).width+n.cellHorizontalPadding*2,provideEditor:()=>t=>{const{isHighlighted:e,onChange:n,value:r,validatedSelection:i}=t;return Pn.createElement(mp,{highlight:e,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:i,onChange:s=>n({...r,data:s.target.value})})},onPaste:()=>{}},O6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.Text,needsHover:t=>t.hoverEffect===!0,needsHoverPosition:!1,drawPrep:Gc,useLabel:!0,draw:t=>{const{cell:e,hoverAmount:n,hyperWrapping:r,ctx:i,rect:s,theme:o,overrideCursor:l}=t,{displayData:a,contentAlign:u,hoverEffect:c,allowWrapping:f}=e;if(c===!0&&n>0){i.textBaseline="alphabetic";const d=o.cellHorizontalPadding,h=o.cellVerticalPadding,p=Xc(a,i,o.baseFontFull,"alphabetic"),m=s.height-h,b=Math.min(m,p.actualBoundingBoxAscent*2.5);i.beginPath(),rs(i,s.x+d/2,s.y+(s.height-b)/2+1,p.width+d*3,b-1,o.roundingRadius??4),i.globalAlpha=n,i.fillStyle=al(o.textDark,.1),i.fill(),i.globalAlpha=1,i.fillStyle=o.textDark,i.textBaseline="middle",l==null||l("text")}ws(t,a,u,f,r)},measure:(t,e,n)=>{const r=e.displayData.split(` +`,e.allowWrapping===!0?void 0:1);let i=0;for(const s of r)i=Math.max(i,t.measureText(s).width);return i+2*n.cellHorizontalPadding},onDelete:t=>({...t,data:""}),provideEditor:t=>({disablePadding:t.allowWrapping===!0,editor:e=>{const{isHighlighted:n,onChange:r,value:i,validatedSelection:s}=e;return v.createElement(mp,{style:t.allowWrapping===!0?{padding:"3px 8.5px"}:void 0,highlight:n,autoFocus:i.readonly!==!0,disabled:i.readonly===!0,altNewline:!0,value:i.data,validatedSelection:s,onChange:o=>r({...i,data:o.target.value})})}}),onPaste:(t,e,n)=>t===e.data?void 0:{...e,data:t,displayData:n.formattedString??e.displayData}},P6=Hr("div")({name:"UriOverlayEditorStyle",class:"gdg-u1rrojo",propsAsIs:!1}),I6=t=>{const{uri:e,onChange:n,forceEditMode:r,readonly:i,validatedSelection:s,preview:o}=t,[l,a]=v.useState(!i&&(e===""||r)),u=v.useCallback(()=>{a(!0)},[]);return l?v.createElement(mp,{validatedSelection:s,highlight:!0,autoFocus:!0,value:e,onChange:n}):v.createElement(P6,null,v.createElement("a",{className:"gdg-link-area",href:e,target:"_blank",rel:"noopener noreferrer"},o),!i&&v.createElement("div",{className:"gdg-edit-icon",onClick:u},v.createElement(jv,null)),v.createElement("textarea",{className:"gdg-input",autoFocus:!0}))};function Ix(t,e,n,r){let i=n.cellHorizontalPadding;const s=e.height/2-t.actualBoundingBoxAscent/2,o=t.width,l=t.actualBoundingBoxAscent;return r==="right"?i=e.width-o-n.cellHorizontalPadding:r==="center"&&(i=e.width/2-o/2),{x:i,y:s,width:o,height:l}}const D6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Se.Uri,needsHover:t=>t.hoverEffect===!0,needsHoverPosition:!0,useLabel:!0,drawPrep:Gc,draw:t=>{const{cell:e,theme:n,overrideCursor:r,hoverX:i,hoverY:s,rect:o,ctx:l}=t,a=e.displayData??e.data,u=e.hoverEffect===!0;if(r!==void 0&&u&&i!==void 0&&s!==void 0){const c=Xc(a,l,n.baseFontFull),f=Ix(c,o,n,e.contentAlign),{x:d,y:h,width:p,height:m}=f;if(i>=d-4&&i<=d-4+p+8&&s>=h-4&&s<=h-4+m+8){const b=Is(l,n.baseFontFull);r("pointer");const g=5,y=h-b;l.beginPath(),l.moveTo(o.x+d,Math.floor(o.y+y+m+g)+.5),l.lineTo(o.x+d+p,Math.floor(o.y+y+m+g)+.5),l.strokeStyle=n.linkColor,l.stroke(),l.save(),l.fillStyle=t.cellFillColor,ws({...t,rect:{...o,x:o.x-1}},a,e.contentAlign),ws({...t,rect:{...o,x:o.x-2}},a,e.contentAlign),ws({...t,rect:{...o,x:o.x+1}},a,e.contentAlign),ws({...t,rect:{...o,x:o.x+2}},a,e.contentAlign),l.restore()}}l.fillStyle=u?n.linkColor:n.textDark,ws(t,a,e.contentAlign)},onClick:t=>{const{cell:e,bounds:n,posX:r,posY:i,theme:s}=t,o=e.displayData??e.data;if(e.hoverEffect!==!0||e.onClickUri===void 0)return;const l=$4(o,s.baseFontFull);if(l===void 0)return;const a=Ix(l,n,s,e.contentAlign);vp({x:a.x-4,y:a.y-4,width:a.width+8,height:a.height+8},r,i)&&e.onClickUri(t)},measure:(t,e,n)=>t.measureText(e.displayData??e.data).width+n.cellHorizontalPadding*2,onDelete:t=>({...t,data:""}),provideEditor:t=>e=>{const{onChange:n,value:r,forceEditMode:i,validatedSelection:s}=e;return v.createElement(I6,{forceEditMode:r.readonly!==!0&&(i||t.hoverEffect===!0&&t.onClickUri!==void 0),uri:r.data,preview:r.displayData??r.data,validatedSelection:s,readonly:r.readonly===!0,onChange:o=>n({...r,data:o.target.value})})},onPaste:(t,e,n)=>t===e.data?void 0:{...e,data:t,displayData:n.formattedString??e.displayData}},_6=[w6,S6,ZW,r6,a6,d6,g6,v6,E6,A6,R6,O6,D6];var N6=kT,L6=gl,F6="Expected a function";function B6(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(F6);return L6(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),N6(t,e,{leading:r,maxWait:e,trailing:i})}var z6=B6;const $6=Ii(z6),Gg=[];class j6 extends WT{constructor(){super(...arguments);bt(this,"imageLoaded",()=>{});bt(this,"loadedLocations",[]);bt(this,"cache",{});bt(this,"sendLoaded",$6(()=>{this.imageLoaded(new Ju(this.loadedLocations)),this.loadedLocations=[]},20));bt(this,"clearOutOfWindow",()=>{const n=Object.keys(this.cache);for(const r of n){const i=this.cache[r];let s=!1;for(let o=0;o{a||(a=!0,Gg.length<12?Gg.unshift(l):o||(l.src=""))}},c=new Promise(f=>l.addEventListener("load",()=>f(null)));requestAnimationFrame(async()=>{try{l.src=n,await c,await l.decode();const f=this.cache[s];if(f!==void 0&&!a){f.img=l;for(const d of f.cells)this.loadedLocations.push(Xv(d));o=!0,this.sendLoaded()}}catch{u.cancel()}}),this.cache[s]=u}loadOrGetImage(n,r,i){const s=n,o=this.cache[s];if(o!==void 0){const l=ki(r,i);return o.cells.includes(l)||o.cells.push(l),o.img}else this.loadImage(n,r,i,s)}}const Yg="\uFEFF";function H6(t){const e={",":0,";":0," ":0};let n=",",r=-1,i=0,s=!1;for(let o=0;or&&(n=o,r=e[o]);return n}function W6(t,e,n){if(t[e]==='"'){let i="",s=e+1;for(;;){if(s>=t.length)return[i,s];const o=t[s];if(o==='"')if(t[s+1]==='"')i+='"',s+=2;else{for(s++;s=r.length)break;if(r[y]===s){c=y+1,f=!0;continue}c=r[y]==="\r"&&r[y+1]===` +`?y+2:y+1,o.push(a),l.push({start:u+i,end:y+i}),a=[]}a.length>0?(o.push(a),l.push({start:u+i,end:r.length+i})):o.length===0&&a.length===0&&r.length>0&&(o.push([""]),l.push({start:0+i,end:r.length+i}));const d=o.length>0?o[0]:[],h=d.length,p=o.slice(1),m=p.map(g=>g.length),b=p.map(g=>g.length===h?g:g.length>h?g.slice(0,h):[...g,...Array(h-g.length).fill("")]);return{headers:d,rows:b,delimiter:s,rowWidths:m,rowSpans:l.slice(1)}}function wp(t,e=","){const n=r=>r.includes('"')?`"${r.replaceAll('"','""')}"`:r.includes(e)||r.includes(` +`)||r.includes("\r")?`"${r}"`:r;return t.map(n).join(e)}function qg(t,e,n=","){return[t,...e].map(r=>wp(r,n)).join(` +`)}function Zv(t,e){return Yc(t,e).headers}function V6(t){const e=/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/,n=Array.from({length:t.headers.length},()=>!0),r=Array.from({length:t.headers.length},()=>!1);for(const i of t.rows)for(let s=0;si&&r[s])}function xE(t,e){let n="",r=0;for(const{start:i,end:s,replacement:o}of e)n+=t.slice(r,i)+o,r=s;return n+t.slice(r)}function U6(t,e){return t[e]==="\r"?t[e+1]===` +`?2:1:t[e]===` +`?1:0}function Dx(t,e){return t[e-2]==="\r"&&t[e-1]===` +`?2:t[e-1]==="\r"||t[e-1]===` +`?1:0}const _x="\uFEFF";function kE(t,e){const n=t.startsWith(_x)?_x.length:0,r=e.rowSpans[0];if(r!==void 0)return{start:n,end:r.start-Dx(t,r.start)};const i=t.slice(n);return{start:n,end:n+i.length-Dx(t,t.length)}}function Qg(t,e,n){const r=[...new Set(n)].flatMap(i=>{const s=e.rowSpans[i];return s===void 0?[]:[s]}).sort((i,s)=>i.start-s.start).map(i=>({start:i.start,end:i.end+U6(t,i.end),replacement:""}));return r.length===0?t:xE(t,r)}function Nx(t,e,n){const r=new Set([...n].filter(o=>o>=0&&ou!r.has(c));s.push({start:o.start,end:o.end,replacement:wp(a,e.delimiter)})}return xE(t,s)}function K6(t,e,n,r){if(!t||n<0||n>=e.headers.length)return t;const i=kE(t,e),s=Zv(t.slice(i.start,i.end),e.delimiter);if(n>=s.length||s[n]===r)return t;const o=s.map((a,u)=>u===n?r:a),l=wp(o,e.delimiter);return t.slice(0,i.start)+l+t.slice(i.end)}const L0=50;function zl(t=""){return{past:[],present:t,future:[]}}function X6(t,e,n=L0){if(e===t.present)return t;if(t.present===""&&t.past.length===0&&t.future.length===0)return{past:[],present:e,future:[]};const r=[...t.past,t.present];return{past:r.length>n?r.slice(r.length-n):r,present:e,future:[]}}function G6(t){if(t.past.length===0)return t;const e=t.past[t.past.length-1];return{past:t.past.slice(0,t.past.length-1),present:e,future:[t.present,...t.future]}}function Y6(t){if(t.future.length===0)return t;const[e,...n]=t.future,r=[...t.past,t.present];return{past:r.length>L0?r.slice(r.length-L0):r,present:e,future:n}}function q6(t){if(t.altKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.key.toLowerCase();return e==="z"?t.shiftKey?"redo":"undo":e==="y"&&!t.shiftKey?"redo":null}const Lx=/^[+-]?\d{16,}$/;function Q6(t,e){const n=Array.from({length:t.length},(i,s)=>s);if(e==="")return n;const r=e.toLowerCase();return n.filter(i=>{const s=t[i];for(let o=0;o{var c,f;const a=((c=e[o])==null?void 0:c[n])??"",u=((f=e[l])==null?void 0:f[n])??"";if(i){const d=a===""?NaN:Number(a),h=u===""?NaN:Number(u),p=Number.isNaN(d),m=Number.isNaN(h);if(p||m)return p&&m?0:p?1:-1;if(Lx.test(a)&&Lx.test(u)){const b=BigInt(a),g=BigInt(u);return s*(bg?1:0)}return s*(d-h)}return s*a.localeCompare(u)})}const Z6=` + +`;function qf(t,e){return Math.max(0,Math.min(t,e))}function Fx(t,e,n,r){const i=t.headers.length,s=[];for(const a of n.ranges){const u=qf(a.x,r+i),c=qf(a.x+a.width,r+i);if(c<=r)continue;const f=u-r,d=c-r;if(d<=f)continue;const h=qf(a.y,e.length),p=qf(a.y+a.height,e.length);if(p<=h)continue;const m=t.headers.slice(f,d),b=[];for(let g=h;gw[f+x]??""))}b.length!==0&&s.push(qg(m,b,t.delimiter))}if(s.length>0)return s.join(Z6);const o=[...n.rows].filter(a=>a>=0&&ae[a]).filter(a=>a!==void 0);if(o.length>0)return qg(t.headers,o.map(a=>t.rows[a]??[]),t.delimiter);const l=[...n.columns].filter(a=>a>=r&&a0){const a=l.map(c=>t.headers[c-r]),u=e.map(c=>{const f=t.rows[c]??[];return l.map(d=>f[d-r]??"")});return qg(a,u,t.delimiter)}return null}const Bx=24,Jg=26,zx=110,Zg=40,e9=12,Bn=1,$x='ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',jx='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';function Hx(t){if(!(t instanceof HTMLElement))return!1;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||t.isContentEditable}const ku="inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px] font-medium text-foreground hover:bg-muted outline-none focus-visible:ring-3 focus-visible:ring-ring/50";function t9(t){return t?{accentColor:"hsl(0 0% 98%)",accentFg:"hsl(240 10% 3.9%)",accentLight:"hsla(240, 4.9%, 70%, 0.18)",textDark:"hsl(0 0% 98%)",textMedium:"hsl(240 5% 64.9%)",textLight:"hsla(240, 5%, 64.9%, 0.4)",textBubble:"hsl(0 0% 98%)",textHeader:"hsl(240 5% 64.9%)",textHeaderSelected:"hsl(0 0% 98%)",bgCell:"hsl(240 6% 7%)",bgCellMedium:"hsl(240 6% 7%)",bgHeader:"hsl(240 6% 7%)",bgHeaderHasFocus:"hsl(240 3.7% 15.9%)",bgHeaderHovered:"hsl(240 3.7% 15.9%)",bgBubble:"hsl(240 3.7% 15.9%)",bgBubbleSelected:"hsl(240 6% 7%)",bgSearchResult:"hsl(240 3.7% 15.9%)",borderColor:"hsl(240 3.7% 15.9%)",horizontalBorderColor:"hsla(240, 3.7%, 15.9%, 0.6)",headerBottomBorderColor:"hsl(240 3.7% 15.9%)",linkColor:"hsl(0 0% 98%)",cellHorizontalPadding:8,cellVerticalPadding:3,headerFontStyle:"600 11px",baseFontStyle:"12px",editorFontSize:"12px",fontFamily:jx,lineHeight:1}:{accentColor:"hsl(240 10% 3.9%)",accentFg:"hsl(0 0% 100%)",accentLight:"hsla(240, 4.8%, 45%, 0.14)",textDark:"hsl(240 10% 3.9%)",textMedium:"hsl(240 3.8% 46.1%)",textLight:"hsla(240, 3.8%, 46.1%, 0.4)",textBubble:"hsl(240 10% 3.9%)",textHeader:"hsl(240 3.8% 46.1%)",textHeaderSelected:"hsl(240 10% 3.9%)",bgCell:"hsl(0 0% 100%)",bgCellMedium:"hsl(0 0% 100%)",bgHeader:"hsl(0 0% 100%)",bgHeaderHasFocus:"hsl(240 4.8% 95.9%)",bgHeaderHovered:"hsl(240 4.8% 95.9%)",bgBubble:"hsl(240 4.8% 95.9%)",bgBubbleSelected:"hsl(0 0% 100%)",bgSearchResult:"hsl(48 96% 89%)",borderColor:"hsl(240 5.9% 90%)",horizontalBorderColor:"hsla(240, 5.9%, 90%, 0.6)",headerBottomBorderColor:"hsl(240 5.9% 90%)",linkColor:"hsl(240 10% 3.9%)",cellHorizontalPadding:8,cellVerticalPadding:3,headerFontStyle:"600 11px",baseFontStyle:"12px",editorFontSize:"12px",fontFamily:jx,lineHeight:1}}function n9(t){return t?"hsla(45, 96%, 65%, 0.3)":"hsl(48 96% 89%)"}function SE({text:t,delimiter:e,testId:n="csv-table",dark:r=!1,onCellCommit:i,onUndo:s,onRedo:o}){const l=v.useRef(null),a=v.useRef(null),u=v.useRef(null),[c,f]=v.useState(""),[d,h]=v.useState(""),[p,m]=v.useState(null),b=v.useRef(p);b.current=p;const g=v.useRef(null),[y,w]=v.useState(null),[k,x]=v.useState(""),S=v.useRef(null),[T,E]=v.useState(void 0),[A,I]=v.useState(()=>new Set),_=v.useRef(A),[P,N]=v.useState(0),D=i!==void 0,ee=v.useMemo(()=>t9(r),[r]),ne=n9(r),ie=r?"hsl(240 3.7% 15.9%)":"hsl(240 4.8% 95.9%)",H=v.useRef();H.current===void 0&&(H.current=new j6);const Y=v.useMemo(()=>Yc(t,e),[t,e]),R=v.useMemo(()=>V6(Y),[Y]),O=Y.headers.length,L=v.useRef({text:t,table:Y});L.current={text:t,table:Y};const F=v.useRef(T);F.current=T,v.useEffect(()=>{const V=window.setTimeout(()=>h(c),150);return()=>window.clearTimeout(V)},[c]);const W=v.useMemo(()=>{const V=Q6(Y.rows,d);return p?J6(V,Y.rows,p.col,p.dir,R[p.col]??!1):V},[Y,d,p,R]),$=v.useRef(W);$.current=W,v.useEffect(()=>{const V=a.current;if(!V||typeof ResizeObserver>"u")return;const pe=new ResizeObserver(()=>N(V.clientWidth));return pe.observe(V),N(V.clientWidth),()=>pe.disconnect()},[]);const ue=Math.max(zx,Math.floor((P-Zg)/Math.max(1,O)));v.useEffect(()=>{I(V=>{let pe=!1;const J=new Set;for(const ve of V)ve{E(V=>{if(!V||V.rows.length===0)return V;const pe=[];for(const ve of _.current){const de=W.indexOf(ve);de!==-1&&pe.push(de)}pe.sort((ve,de)=>ve-de);const J=pe.reduce((ve,de)=>ve.add(de),Ot.empty());return J.equals(V.rows)?V:{...V,rows:J}})},[W]),v.useEffect(()=>{m(V=>V!==null&&V.col>=O?null:V),w(V=>V!==null&&V.col>=O?null:V)},[O]);const ce=d!=="",be=Y.rows.length,Ge=Jg+Math.min(W.length,e9)*Bx,$e=()=>{f(""),h("")},at=v.useCallback((V,pe)=>{var ve;if(V0||ht.height>0)?{x:Math.max(0,Ne.x-ht.left),y:Math.max(0,Ne.y-ht.top),width:Ne.width,height:Ne.height}:Ne??{x:Zg+J*ue,y:0,width:ue,height:Jg};x(de),w({col:J,bounds:Ue});return}g.current=b.current,w(null),m(de=>!de||de.col!==J?{col:J,dir:"asc"}:de.dir==="asc"?{col:J,dir:"desc"}:null)},[D,ue]),_t=v.useCallback(()=>{if(!y)return;const{col:V}=y;if(w(null),!i)return;const{text:pe,table:J}=L.current,ve=K6(pe,J,V,k);ve!==pe&&i(ve)},[y,k,i]),Qe=v.useCallback(()=>{w(null)},[]);v.useEffect(()=>{if(!y)return;const V=S.current;V&&(V.focus(),V.select())},[y]);const it=v.useCallback((V,pe)=>{const J=$.current,ve=J[pe];if(ve===void 0)return;const de=_.current,ht=u.current;let Ne;if(V.shiftKey&&ht!==null&&ht!==ve){const ye=J.indexOf(ht),De=J.indexOf(ve),Et=ye===-1?De:ye,[Vt,Lt]=Et<=De?[Et,De]:[De,Et];Ne=V.metaKey||V.ctrlKey?new Set(de):new Set;for(let Mt=Vt;Mt<=Lt;Mt++){const Un=J[Mt];Un!==void 0&&Ne.add(Un)}}else V.metaKey||V.ctrlKey?(Ne=new Set(de),Ne.has(ve)?Ne.delete(ve):Ne.add(ve)):Ne=new Set([ve]);u.current=ve,_.current=Ne,I(Ne);const Ue=[...Ne].map(ye=>J.indexOf(ye)).filter(ye=>ye!==-1).sort((ye,De)=>ye-De);E(ye=>({current:ye==null?void 0:ye.current,columns:(ye==null?void 0:ye.columns)??Ot.empty(),rows:Ue.reduce((De,Et)=>De.add(Et),Ot.empty())}))},[]),Je=v.useCallback(()=>{u.current=null,_.current=new Set,I(new Set),E(void 0)},[]),Wt=v.useCallback(V=>{const pe=new Set;for(const J of V.rows){const ve=$.current[J];ve!==void 0&&pe.add(ve)}_.current=pe,I(pe),E(V)},[]),Pe=v.useCallback(()=>{Je()},[Je]),me=v.useMemo(()=>W.filter(V=>A.has(V)),[W,A]),Ie=v.useMemo(()=>[...(T==null?void 0:T.columns)??[]].filter(V=>V>=Bn).map(V=>V-Bn),[T]),Le=Ie.length,nt=me.length>0||Le>0,_e=()=>{var J;const V=F.current,pe=Fx(L.current.table,$.current,{ranges:V!=null&&V.current?[V.current.range,...V.current.rangeStack]:[],columns:V?[...V.columns]:[],rows:V?[...V.rows]:[]},Bn);pe!==null&&((J=navigator.clipboard)==null||J.writeText(pe).catch(()=>{}))};v.useEffect(()=>{const V=pe=>{var Ne;const J=l.current;if(!J||!J.contains(document.activeElement))return;const ve=document.activeElement;if(ve&&(ve.tagName==="INPUT"||ve.tagName==="TEXTAREA"||ve.isContentEditable))return;const de=F.current,ht=Fx(L.current.table,$.current,{ranges:de!=null&&de.current?[de.current.range,...de.current.rangeStack]:[],columns:de?[...de.columns]:[],rows:de?[...de.rows]:[]},Bn);ht!==null&&(pe.preventDefault(),pe.stopImmediatePropagation(),(Ne=pe.clipboardData)==null||Ne.setData("text/plain",ht))};return window.addEventListener("copy",V,{capture:!0}),()=>window.removeEventListener("copy",V,{capture:!0})},[]),v.useEffect(()=>{if(!s&&!o)return;const V=pe=>{const J=l.current;if(!J)return;const ve=pe.target instanceof Node&&J.contains(pe.target),de=document.activeElement instanceof Node&&J.contains(document.activeElement);if(!ve&&!de||Hx(pe.target)||Hx(document.activeElement))return;const ht=q6(pe);ht==="undo"&&s?(pe.preventDefault(),s()):ht==="redo"&&o&&(pe.preventDefault(),o())};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[s,o]);const ft=v.useCallback(V=>{var J;const pe=l.current!==null&&document.activeElement instanceof Node&&l.current.contains(document.activeElement);Je(),i==null||i(V),pe&&((J=a.current)==null||J.focus({preventScroll:!0}))},[Je,i]),ut=O>0&&Ie.length>=O,vt=()=>{!D||me.length===0||ft(Qg(L.current.text,L.current.table,me))},he=()=>{!D||ut||Ie.length===0||ft(Nx(L.current.text,L.current.table,Ie))},rt=v.useCallback(V=>{if(!i)return!1;const{text:J,table:ve}=L.current,de=$.current;if(V.rows.length>0){const Ue=[...V.rows].map(ye=>de[ye]).filter(ye=>ye!==void 0);if(Ue.length>0)return ft(Qg(J,ve,Ue)),!1}if(V.columns.length>0){const Ue=[...V.columns].filter(ye=>ye>=Bn&&yeye-Bn);return Ue.length>0&&Ue.length0&&ft(Qg(J,ve,Ne)),!1},[ft,i]),st=v.useCallback(V=>{const pe=i;if(!pe)return!1;const{text:J,table:ve}=L.current,de=$.current,ht=[...V].sort((ye,De)=>ye.location[1]-De.location[1]);let Ne=J,Ue=0;for(const{location:ye,value:De}of ht){const Et=ye[0]-Bn,Vt=ye[1];if(Et<0||De.kind!==Se.Text)continue;const Lt=de[Vt],Mt=Lt===void 0?void 0:ve.rowSpans[Lt];if(!Mt)continue;const Un=Ne.slice(Mt.start+Ue,Mt.end+Ue),lt=Zv(Un,ve.delimiter);for(;lt.length<=Et;)lt.push("");const Ut=De.data??"";if(lt[Et]===Ut)continue;lt[Et]=Ut;const Ft=wp(lt,ve.delimiter);Ne=Ne.slice(0,Mt.start+Ue)+Ft+Ne.slice(Mt.end+Ue),Ue+=Ft.length-(Mt.end-Mt.start)}return Ne!==J&&pe(Ne),!0},[i]),Ve=v.useCallback(V=>{var ht;const[pe,J]=V,ve=$.current[J];if(pe{const pe=[];for(let J=V.y;J{V[0]>=Bn||it(pe,V[1])},[it]),ct=v.useMemo(()=>{const V={title:"#",id:"__gutter",width:Zg,themeOverride:{baseFontStyle:`11px ${$x}`,textDark:"hsla(240, 3.8%, 46.1%, 0.4)"}},pe=Y.headers.map((J,ve)=>({title:J.toUpperCase(),id:`c${ve}`,width:ue,themeOverride:R[ve]?{baseFontStyle:`12px ${$x}`}:void 0}));return[V,...pe]},[Y.headers,R,ue]),dt=v.useCallback((V,pe)=>{const{ctx:J,columnIndex:ve,rect:de,theme:ht,isSelected:Ne}=V;J.save();try{if(J.letterSpacing="0.5px",Ne&&(J.fillStyle=ht.bgHeaderHovered,J.fillRect(de.x,de.y,de.width,de.height),J.fillStyle=ht.accentColor,J.fillRect(de.x,de.y+de.height-2,de.width,2)),ve{const{ctx:J,cell:ve,rect:de,col:ht,theme:Ne}=V,Ue=ht-Bn;if(Ue>=0&&ce&&ve.kind===Se.Text){const ye=r9(ve.data,d);if(ye!==null){J.save();try{const De=`${Ne.baseFontStyle} ${Ne.fontFamily}`;J.font=De;let Et=de.x+Ne.cellHorizontalPadding;const Vt=de.y+de.height/2+Is(J,De);for(const Lt of ye){const Mt=J.measureText(Lt.text).width;Lt.hit&&Mt>0&&(J.fillStyle=ne,J.fillRect(Et-1,Vt-7,Mt+2,14)),Et+=Mt}}finally{J.restore()}}}if(pe(),Ue>=0&&ve.kind===Se.Text&&ve.data===""){J.save();try{J.font=`${Ne.baseFontStyle} ${Ne.fontFamily}`,J.fillStyle=Ne.textLight,J.fillText("—",de.x+Ne.cellHorizontalPadding,de.y+de.height/2+.5)}finally{J.restore()}}},[ce,d,ne]),Ze=v.useCallback(V=>{const pe=$.current[V];return pe!==void 0&&_.current.has(pe)?{bgCell:ie,bgCellMedium:ie}:void 0},[ie]);return O===0?M.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:"No columns detected."}):M.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",ref:l,children:[M.jsxs("div",{"data-testid":`${n}-toolbar`,className:"flex flex-none flex-wrap items-center gap-1.5 border-b border-border bg-panel px-2 py-1",children:[M.jsxs("div",{className:"relative min-w-32 flex-1 sm:max-w-64",children:[M.jsx(PI,{"aria-hidden":"true",className:"pointer-events-none absolute left-1.5 top-1/2 size-3 -translate-y-1/2 text-muted-foreground/60"}),M.jsx("input",{type:"text","data-testid":`${n}-search`,"aria-label":"Search rows",value:c,onChange:V=>f(V.target.value),onKeyDown:V=>{V.key==="Escape"&&$e()},placeholder:"Search…",className:"h-6 w-full rounded-md border border-border bg-background pl-6 pr-6 text-xs text-foreground outline-none placeholder:text-muted-foreground/50 focus-visible:ring-3 focus-visible:ring-ring/50"}),c!==""&&M.jsx("button",{type:"button","data-testid":`${n}-clear-search`,"aria-label":"Clear search",onClick:$e,className:"absolute right-1 top-1/2 -translate-y-1/2 cursor-pointer rounded p-0.5 text-muted-foreground/60 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:M.jsx(Q2,{"aria-hidden":"true",className:"size-3"})})]}),M.jsx("span",{"data-testid":`${n}-count`,role:"status",className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium tabular-nums text-muted-foreground",children:ce?`${W.length.toLocaleString()} of ${be.toLocaleString()}`:`${be.toLocaleString()} rows`}),nt&&M.jsxs("span",{className:"flex items-center gap-1.5",children:[M.jsx("span",{"data-testid":`${n}-selected-count`,className:"text-[11px] font-medium tabular-nums text-muted-foreground",children:me.length>0?`${me.length.toLocaleString()} selected`:`${Le.toLocaleString()} ${Le===1?"column":"columns"} selected`}),M.jsxs("button",{type:"button","data-testid":`${n}-copy`,onClick:_e,className:ku,children:[M.jsx(Ev,{"aria-hidden":"true",className:"size-3"}),"Copy as CSV"]}),D&&me.length>0&&M.jsxs("button",{type:"button","data-testid":`${n}-delete-rows`,onClick:vt,title:`Deletes the ${me.length} selected ${me.length===1?"row":"rows"} from the source CSV`,className:ku,children:[M.jsx(m0,{"aria-hidden":"true",className:"size-3"}),"Delete ",me.length.toLocaleString()," ",me.length===1?"row":"rows"]}),D&&Le>0&&M.jsxs("button",{type:"button","data-testid":`${n}-delete-columns`,onClick:he,disabled:ut,title:ut?"At least one column must remain — the converter needs a column to detect":`Deletes the ${Le} selected ${Le===1?"column":"columns"} from the source CSV`,className:`${ku} disabled:cursor-not-allowed disabled:opacity-50`,children:[M.jsx(m0,{"aria-hidden":"true",className:"size-3"}),"Delete ",Le.toLocaleString()," ",Le===1?"column":"columns"]}),M.jsx("button",{type:"button","data-testid":`${n}-clear-selection`,onClick:Je,className:ku,children:"Clear"})]})]}),M.jsxs("div",{ref:a,"data-testid":n,role:"grid",tabIndex:-1,"aria-rowcount":W.length+1,className:"relative min-h-0 flex-1 outline-none",style:{minHeight:Ge},children:[M.jsx("div",{className:"absolute inset-0",children:M.jsx(JW,{imageWindowLoader:H.current,renderers:_6,columns:ct,rows:W.length,getCellContent:Ve,getCellsForSelection:sn,onCellsEdited:D?st:void 0,onDelete:D?rt:void 0,onCellClicked:wt,onHeaderClicked:at,onGridSelectionChange:Wt,onSelectionCleared:Pe,gridSelection:T,rangeSelect:"multi-rect",columnSelect:"multi",rowSelect:"multi",rowHeight:Bx,headerHeight:Jg,freezeColumns:Bn,fillHandle:D,onPaste:D?()=>!0:!1,keybindings:{search:!1},theme:ee,drawHeader:dt,drawCell:fe,getRowThemeOverride:Ze,minColumnWidth:zx,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:!1})}),y!==null&&M.jsx("input",{ref:S,type:"text","data-testid":"csv-header-rename-input","aria-label":`Rename column ${Y.headers[y.col]??""}`,value:k,onChange:V=>x(V.target.value),onBlur:_t,onKeyDown:V=>{V.key==="Enter"?(V.preventDefault(),V.stopPropagation(),_t()):V.key==="Escape"&&(V.preventDefault(),V.stopPropagation(),Qe())},style:{left:y.bounds.x,top:y.bounds.y,width:Math.max(60,y.bounds.width),height:y.bounds.height},className:"absolute z-20 border border-ring bg-background px-2 font-mono text-[11px] font-semibold tracking-wider text-foreground outline-none ring-2 ring-ring/50"}),ce&&W.length===0&&M.jsxs("div",{"data-testid":`${n}-empty-filter`,className:"absolute inset-x-0 top-0 z-10 flex flex-col items-center gap-2 p-6 text-sm text-muted-foreground",children:[M.jsxs("span",{children:["No rows matching “",d,"”."]}),M.jsx("button",{type:"button",onClick:$e,className:ku,children:"Show all rows"})]}),D&&!ce&&W.length===0&&M.jsx("div",{"data-testid":`${n}-empty-rows`,className:"absolute inset-x-0 top-0 z-10 flex flex-col items-center gap-2 p-6 text-sm text-muted-foreground",children:M.jsx("span",{children:"No rows. Paste or upload data to start over."})})]})]})}function r9(t,e){if(e===""||t==="")return null;const n=e.toLowerCase();if(!t.toLowerCase().includes(n))return null;const r=[],i=t.toLowerCase();let s=0;for(;;){const o=i.indexOf(n,s);if(o===-1)break;o>s&&r.push({text:t.slice(s,o),hit:!1}),r.push({text:t.slice(o,o+n.length),hit:!0}),s=o+n.length}return s"u"?void 0:navigator),s=v.useRef(null);v.useEffect(()=>{var l;(l=s.current)==null||l.focus()},[]);const o=t==="CSV";return M.jsx("div",{"data-testid":"dropzone",className:"flex flex-1 flex-col items-center justify-center p-3",children:M.jsxs("div",{className:"flex w-full max-w-sm flex-col items-center gap-3",children:[M.jsx("div",{"aria-hidden":"true",className:"flex size-11 items-center justify-center rounded-xl border border-border bg-muted/50 text-muted-foreground",children:M.jsx(wI,{className:"size-5"})}),M.jsxs("p",{className:"text-sm font-medium text-foreground",children:["Paste ",o?"CSV or TSV":"JSON"," here"]}),M.jsx("textarea",{ref:s,"data-testid":"paste-field",rows:1,"aria-label":`Paste ${o?"CSV or TSV":"JSON"} data — or press ${i} to paste anywhere on this page`,placeholder:o?"Paste CSV or TSV text here":"Paste JSON here",spellCheck:!1,onChange:l=>{const a=l.currentTarget;a.rows=l9(a.value),e(a.value)},className:"min-h-11 w-full resize-none rounded-md border border-border bg-background px-3 py-2.5 font-mono text-[12.5px] leading-relaxed text-foreground transition-colors placeholder:text-muted-foreground focus:outline-none focus-visible:border-sky-600 dark:focus-visible:border-sky-400"}),M.jsxs("p",{className:"text-center text-[13px] leading-relaxed text-muted-foreground",children:["or drag & drop a file anywhere in this pane — you can also paste anywhere on the page (",M.jsx("kbd",{"data-testid":"paste-shortcut",className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground",children:i}),")"]}),M.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[M.jsxs("button",{type:"button","data-testid":"choose-file",onClick:n,className:"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-3.5",children:[M.jsx(q2,{"aria-hidden":"true"}),"Choose file"]}),M.jsxs("button",{type:"button","data-testid":"try-example",onClick:r,className:"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-3.5",children:[M.jsx(DI,{"aria-hidden":"true"}),"Try an example"]})]})]})})}let F0=[],CE=[];(()=>{let t="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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=CE[r])e=r+1;else return!0;if(e==n)return!1}}function Wx(t){return t>=127462&&t<=127487}const Vx=8205;function c9(t,e,n=!0,r=!0){return(n?TE:f9)(t,e,r)}function TE(t,e,n){if(e==t.length)return e;e&&EE(t.charCodeAt(e))&&AE(t.charCodeAt(e-1))&&e--;let r=em(t,e);for(e+=Ux(r);e=0&&Wx(em(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function f9(t,e,n){for(;e>1;){let r=TE(t,e-2,n);if(r=56320&&t<57344}function AE(t){return t>=55296&&t<56320}function Ux(t){return t<65536?1:2}class Pt{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){[e,n]=Ra(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Xi.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Ra(this,e,n);let r=[];return this.decompose(e,n,r,0),Xi.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),i=new Zu(this),s=new Zu(e);for(let o=n,l=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new Zu(this,e)}iterRange(e,n=this.length){return new ME(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new RE(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]?Pt.empty:e.length<=32?new kn(e):Xi.from(kn.split(e,[]))}}class kn extends Pt{constructor(e,n=d9(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],l=i+o.length;if((n?r:l)>=e)return new h9(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new kn(Kx(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=Id(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new kn(l,o.length+s.length));else{let a=l.length>>1;r.push(new kn(l.slice(0,a)),new kn(l.slice(a)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof kn))return super.replace(e,n,r);[e,n]=Ra(this,e,n);let i=Id(this.text,Id(r.text,Kx(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new kn(i,s):Xi.from(kn.split(i,[]),s)}sliceString(e,n=this.length,r=` +`){[e,n]=Ra(this,e,n);let i="";for(let s=0,o=0;s<=n&&oe&&o&&(i+=r),es&&(i+=l.slice(Math.max(0,e-s),n-s)),s=a+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new kn(r,i)),r=[],i=-1);return i>-1&&n.push(new kn(r,i)),n}}class Xi extends Pt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],l=i+o.length,a=r+o.lines-1;if((n?a:l)>=e)return o.lineInner(e,n,r,i);i=l+1,r=a+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s=o){let u=i&((o<=e?1:0)|(a>=n?2:0));o>=e&&a<=n&&!u?r.push(l):l.decompose(e-o,n-o,r,u)}o=a+1}}replace(e,n,r){if([e,n]=Ra(this,e,n),r.lines=s&&n<=l){let a=o.replace(e-s,n-s,r),u=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>u>>6){let c=this.children.slice();return c[i]=a,new Xi(c,this.length-(n-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` +`){[e,n]=Ra(this,e,n);let i="";for(let s=0,o=0;se&&s&&(i+=r),eo&&(i+=l.sliceString(e-o,n-o,r)),o=a+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Xi))return 0;let r=0,[i,s,o,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==l)return r;let a=this.children[i],u=e.children[s];if(a!=u)return r+a.scanIdentical(u,n);r+=a.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let h of e)r+=h.lines;if(r<32){let h=[];for(let p of e)p.flatten(h);return new kn(h,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,u=-1,c=[];function f(h){let p;if(h.lines>s&&h instanceof Xi)for(let m of h.children)f(m);else h.lines>o&&(a>o||!a)?(d(),l.push(h)):h instanceof kn&&a&&(p=c[c.length-1])instanceof kn&&h.lines+p.lines<=32?(a+=h.lines,u+=h.length+1,c[c.length-1]=new kn(p.text.concat(h.text),p.length+1+h.length)):(a+h.lines>i&&d(),a+=h.lines,u+=h.length+1,c.push(h))}function d(){a!=0&&(l.push(c.length==1?c[0]:Xi.from(c,u)),u=-1,a=c.length=0)}for(let h of e)f(h);return d(),l.length==1?l[0]:new Xi(l,n)}}Pt.empty=new kn([""],0);function d9(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Id(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s=n&&(a>r&&(l=l.slice(0,r-i)),i0?1:(e instanceof kn?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,l=i instanceof kn?i.text.length:i.children.length;if(o==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(i instanceof kn){let a=i.text[o+(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=i.children[o+(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 kn?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)}}class ME{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Zu(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:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.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!=""}}class RE{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Pt.prototype[Symbol.iterator]=function(){return this.iter()},Zu.prototype[Symbol.iterator]=ME.prototype[Symbol.iterator]=RE.prototype[Symbol.iterator]=function(){return this});class h9{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Ra(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function tr(t,e,n=!0,r=!0){return c9(t,e,n,r)}function p9(t){return t>=56320&&t<57344}function g9(t){return t>=55296&&t<56320}function m9(t,e){let n=t.charCodeAt(e);if(!g9(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return p9(r)?(n-55296<<10)+(r-56320)+65536:n}function y9(t){return t<65536?1:2}const B0=/\r\n?|\n/;var yr=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(yr||(yr={}));class is{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return s+(e-i);s+=l}else{if(r!=yr.Simple&&u>=e&&(r==yr.TrackDel&&ie||r==yr.TrackBefore&&ie))return null;if(u>e||u==e&&n<0&&!l)return e==i||n<0?s:s+a;s+=a}i=u}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r=0&&i<=n&&l>=e)return in?"cover":!0;i=l}return!1}toString(){let e="";for(let n=0;n=0?":"+i:"")}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 is(e)}static create(e){return new is(e)}}class On extends is{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 z0(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return $0(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i=0){n[i]=l,n[i+1]=o;let a=i>>1;for(;r.length0&&so(r,n,s.text),s.forward(c),l+=c}let u=e[o++];for(;l>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!i.length)return;od||f<0||d>n)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${n})`);let p=h?typeof h=="string"?Pt.of(h.split(r||B0)):h:Pt.empty,m=p.length;if(f==d&&m==0)return;fo&&Zn(i,f-o,-1),Zn(i,d-f,m),so(s,i,p),o=d}}return u(e),a(!l),l}static empty(e){return new On(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;il&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function so(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(i,u,s,c,f),i=u,s=c}}}function $0(t,e,n,r=!1){let i=[],s=r?[]:null,o=new Tc(t),l=new Tc(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);Zn(i,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let u=0,c=o.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.lena||o.ins>=0&&o.len>a)&&(l||r.length>u),s.forward2(a),o.forward(a)}}}}class Tc{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Pt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Pt.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)}}class eo{constructor(e,n,r,i){this.from=e,this.to=n,this.flags=r,this.goalColumn=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new eo(r,i,this.flags,this.goalColumn)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return le.range(e,n,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return le.range(this.anchor,i,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!this.empty||this.assoc==e.assoc)}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 le.range(e.anchor,e.head)}static create(e,n,r,i){return new eo(e,n,r,i)}}class le{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:le.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.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 le(e.ranges.map(n=>eo.fromJSON(n)),e.main)}static single(e,n=e){return new le([le.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,i=0;ii.from-s.from),n=e.indexOf(r);for(let i=1;is.head?le.range(a,l):le.range(l,a))}}return new le(e,n)}}function PE(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let ew=0;class Be{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=ew++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Be(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:tw),!!e.static,e.enables)}of(e){return new Dd([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dd(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dd(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function tw(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Dd{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=ew++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>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[o]=r(f),1},update(f,d){if(a&&d.docChanged||u&&(d.docChanged||d.selection)||j0(f,c)){let h=r(f);if(l?!Xx(h,f.values[o],i):!i(h,f.values[o]))return f.values[o]=h,1}return 0},reconfigure:(f,d)=>{let h,p=d.config.address[s];if(p!=null){let m=Sh(d,p);if(this.dependencies.every(b=>b instanceof Be?d.facet(b)===f.facet(b):b instanceof as?d.field(b,!1)==f.field(b,!1):!0)||(l?Xx(h=r(f),m,i):i(h=r(f),m)))return f.values[o]=m,0}else h=r(f);return f.values[o]=h,1}}}get extension(){return this}}function Xx(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[a.id]),i=n.map(a=>a.type),s=r.filter(a=>!(a&1)),o=t[e.id]>>1;function l(a){let u=[];for(let c=0;cr===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Qf).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,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(Qf),o=i.facet(Qf),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(r.values[n]=l.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Qf.of({field:this,create:e})]}get extension(){return this}}const Ko={lowest:4,low:3,default:2,high:1,highest:0};function Su(t){return e=>new IE(e,t)}const nw={highest:Su(Ko.highest),high:Su(Ko.high),default:Su(Ko.default),low:Su(Ko.low),lowest:Su(Ko.lowest)};class IE{constructor(e,n){this.inner=e,this.prec=n}get extension(){return this}}class tl{of(e){return new H0(this,e)}reconfigure(e){return tl.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class H0{constructor(e,n){this.compartment=e,this.inner=n}get extension(){return this}}class kh{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let d of w9(e,n,o))d instanceof as?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let l=Object.create(null),a=[],u=[];for(let d of i)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 s){let h=s[d],p=h[0].facet,m=c&&c[d]||[];if(h.every(b=>b.type==0))if(l[p.id]=a.length<<1|1,tw(m,h))a.push(r.facet(p));else{let b=p.combine(h.map(g=>g.value));a.push(r&&p.compare(b,r.facet(p))?r.facet(p):b)}else{for(let b of h)b.type==0?(l[b.id]=a.length<<1|1,a.push(b.value)):(l[b.id]=u.length<<1,u.push(g=>b.dynamicSlot(g)));l[p.id]=u.length<<1,u.push(b=>v9(b,p,h))}}let f=u.map(d=>d(l));return new kh(e,o,f,l,a,s)}}function w9(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let u=r[a].indexOf(o);u>-1&&r[a].splice(u,1),o instanceof H0&&n.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof H0){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof IE)s(o.inner,o.prec);else if(o instanceof as)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Dd)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,Ko.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(u==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(t,Ko.default),r.reduce((o,l)=>o.concat(l))}function ec(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 i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function Sh(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const DE=Be.define(),W0=Be.define({combine:t=>t.some(e=>e),static:!0}),_E=Be.define({combine:t=>t.length?t[0]:void 0,static:!0}),NE=Be.define(),LE=Be.define(),FE=Be.define(),BE=Be.define({combine:t=>t.length?t[0]:!1});class Ro{constructor(e,n){this.type=e,this.value=n}static define(){return new b9}}class b9{of(e){return new Ro(this,e)}}class x9{constructor(e){this.map=e}of(e){return new Gt(this,e)}}class Gt{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 Gt(this.type,n)}is(e){return this.type==e}static define(e={}){return new x9(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}Gt.reconfigure=Gt.define();Gt.appendConfig=Gt.define();class Dn{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&PE(r,n.newLength),s.some(l=>l.type==Dn.time)||(this.annotations=s.concat(Dn.time.of(Date.now())))}static create(e,n,r,i,s,o){return new Dn(e,n,r,i,s,o)}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(Dn.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Dn.time=Ro.define();Dn.userEvent=Ro.define();Dn.addToHistory=Ro.define();Dn.remote=Ro.define();function k9(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r=t[r]))s=t[r++],o=t[r++];else if(i=0;i--){let s=r[i](t);s instanceof Dn?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Dn?t=s[0]:t=$E(e,ga(s),!1)}return t}function C9(t){let e=t.startState,n=e.facet(FE),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=zE(r,V0(e,s,t.changes.newLength),!0))}return r==t?t:Dn.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const T9=[];function ga(t){return t==null?T9:Array.isArray(t)?t:[t]}var Ss=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ss||(Ss={}));const E9=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let U0;try{U0=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function A9(t){if(U0)return U0.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||E9.test(n)))return!0}return!1}function M9(t){return e=>{if(!/\S/.test(e))return Ss.Space;if(A9(e))return Ss.Word;for(let n=0;n-1)return Ss.Word;return Ss.Other}}class Nt{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;li.set(u,a)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(Gt.reconfigure)?(n=null,r=l.value):l.is(Gt.appendConfig)&&(n=null,r=ga(r).concat(l.value));let s;n?s=e.startState.values.slice():(n=kh.resolve(r,i,this),s=new Nt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,u)=>u.reconfigure(a,this),null).values);let o=e.startState.facet(W0)?e.newSelection:e.newSelection.asSingle();new Nt(n,e.newDoc,o,s,(l,a)=>a.update(l,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:le.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=ga(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return Nt.create({doc:e.doc,selection:le.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=kh.resolve(e.extensions||[],new Map),r=e.doc instanceof Pt?e.doc:Pt.of((e.doc||"").split(n.staticFacet(Nt.lineSeparator)||B0)),i=e.selection?e.selection instanceof le?e.selection:le.single(e.selection.anchor,e.selection.head):le.single(0);return PE(i,r.length),n.staticFacet(W0)||(i=i.asSingle()),new Nt(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Nt.tabSize)}get lineBreak(){return this.facet(Nt.lineSeparator)||` +`}get readOnly(){return this.facet(BE)}phrase(e,...n){for(let r of this.facet(Nt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(DE))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return M9(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=tr(n,o,!1);if(s(n.slice(a,o))!=Ss.Word)break;o=a}for(;lt.length?t[0]:4});Nt.lineSeparator=_E;Nt.readOnly=BE;Nt.phrases=Be.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});Nt.languageData=DE;Nt.changeFilter=NE;Nt.transactionFilter=LE;Nt.transactionExtender=FE;tl.reconfigure=Gt.define();function jE(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class ul{eq(e){return this==e}range(e,n=e){return K0.create(e,n,this)}}ul.prototype.startSide=ul.prototype.endSide=0;ul.prototype.point=!1;ul.prototype.mapMode=yr.TrackDel;function rw(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let K0=class HE{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new HE(e,n,r)}};function X0(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class iw{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,l=s.length;;){if(o==l)return o;let a=o+l>>1,u=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-n;if(a==o)return u>=0?o:l;u>=0?l=a:o=a+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sh||d==h&&u.startSide>0&&u.endSide<=0)continue;(h-d||u.endSide-u.startSide)<0||(o<0&&(o=d),u.point&&(l=Math.max(l,h-d)),r.push(u),i.push(d-o),s.push(h-o))}return{mapped:r.length?new iw(i,s,r,l):null,pos:o}}}class $t{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new $t(e,n,r,i)}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:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(X0)),this.isEmpty)return n.length?$t.of(n):this;let l=new WE(this,null,-1).goto(0),a=0,u=[],c=new Oa;for(;l.value||a=0){let f=n[a++];c.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Ec.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Ec.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=Gx(o,l,r),u=new Cu(o,a,s),c=new Cu(l,a,s);r.iterGaps((f,d,h)=>Yx(u,f,c,d,h,i)),r.empty&&r.length==0&&Yx(u,0,c,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),o=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Gx(s,o),a=new Cu(s,l,0).goto(r),u=new Cu(o,l,0).goto(r);for(;;){if(a.to!=u.to||!G0(a.active,u.active)||a.point&&(!u.point||!rw(a.point,u.point)))return!1;if(a.to>i)return!0;a.next(),u.next()}}static spans(e,n,r,i,s=-1){let o=new Cu(e,null,s).goto(n),l=n,a=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(i.span(l,u,o.active,a),a=o.openEnd(u));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,n=!1){let r=new Oa;for(let i of e instanceof K0?[e]:n?R9(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return $t.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=$t.empty;i=i.nextLayer)n=new $t(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}$t.empty=new $t([],[],null,-1);function R9(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(X0);e=r}return t}$t.empty.nextLayer=$t.empty;class Oa{finishChunk(e){this.chunks.push(new iw(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 Oa)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<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($t.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=$t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Gx(t,e,n){let r=new Map;for(let s of t)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new WE(o,n,r,s));return i.length==1?i[0]:new Ec(i)}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--)tm(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--)tm(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(),tm(this.heap,0)}}}function tm(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class Cu{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=Ec.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){Jf(this.active,e),Jf(this.activeTo,e),Jf(this.activeRank,e),this.minActive=qx(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;Zf(this.active,n,r),Zf(this.activeTo,n,i),Zf(this.activeRank,n,s),e&&Zf(e,n,this.cursor.from),this.minActive=qx(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&Jf(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[i]=0&&!(this.activeRank[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 Yx(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,l=r,a=r-e,u=!!s.boundChange;for(let c=!1;;){let f=t.to+a-n.to,d=f||t.endSide-n.endSide,h=d<0?t.to+a:n.to,p=Math.min(h,o);if(t.point||n.point?(t.point&&n.point&&rw(t.point,n.point)&&G0(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,p,t.point,n.point),c=!1):(c&&s.boundChange(l),p>l&&!G0(t.active,n.active)&&s.compareRange(l,p,t.active,n.active),u&&po)break;l=h,d<=0&&t.next(),d>=0&&n.next()}}function G0(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function qx(t,e){let n=-1,r=1e9;for(let i=0;i=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=tr(t,i)}return t.length}const Y0="ͼ",Qx=typeof Symbol>"u"?"__"+Y0:Symbol.for(Y0),q0=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Jx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class xo{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let h in l){let p=l[h];if(/&/.test(h))s(h.split(/,\s*/).map(m=>o.map(b=>m.replace(/&/,b))).reduce((m,b)=>m.concat(b)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(i(h),p,c,d)}else p!=null&&c.push(h.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||d)&&a.push((r&&!f&&!u?o.map(r):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=Jx[Qx]||1;return Jx[Qx]=e+1,Y0+e.toString(36)}static mount(e,n,r){let i=e[q0],s=r&&r.nonce;i?s&&i.setNonce(s):i=new P9(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let Zx=new Map;class P9{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Zx.get(r);if(s)return e[q0]=s;this.sheet=new i.CSSStyleSheet,Zx.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[q0]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),r)for(let u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},I9=typeof navigator<"u"&&/Mac/.test(navigator.platform),D9=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hn=0;Hn<10;Hn++)ko[48+Hn]=ko[96+Hn]=String(Hn);for(var Hn=1;Hn<=24;Hn++)ko[Hn+111]="F"+Hn;for(var Hn=65;Hn<=90;Hn++)ko[Hn]=String.fromCharCode(Hn+32),Ac[Hn]=String.fromCharCode(Hn);for(var nm in ko)Ac.hasOwnProperty(nm)||(Ac[nm]=ko[nm]);function _9(t){var e=I9&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||D9&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ac:ko)[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 Gi(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e2);var Ee={mac:nk||/Mac/.test(ar.platform),windows:/Win/.test(ar.platform),linux:/Linux|X11/.test(ar.platform),ie:xp,ie_version:UE?Q0.documentMode||6:Z0?+Z0[1]:J0?+J0[1]:0,gecko:ek,gecko_version:ek?+(/Firefox\/(\d+)/.exec(ar.userAgent)||[0,0])[1]:0,chrome:!!rm,chrome_version:rm?+rm[1]:0,ios:nk,android:/Android\b/.test(ar.userAgent),webkit:tk,webkit_version:tk?+(/\bAppleWebKit\/(\d+)/.exec(ar.userAgent)||[0,0])[1]:0,safari:ey,safari_version:ey?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ar.userAgent)||[0,0])[1]:0,tabSize:Q0.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function sw(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}const Ch=Object.create(null);function ow(t,e,n){if(t==e)return!0;t||(t=Ch),e||(e=Ch);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function N9(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function rk(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function L9(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new cl(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=KE(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new cl(e,r,i,n,e.widget||null,!0)}static line(e){return new Qc(e)}static set(e,n=!1){return $t.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ht.none=$t.empty;class qc extends Ht{constructor(e){let{start:n,end:r}=KE(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?sw(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Ch}eq(e){return this==e||e instanceof qc&&this.tagName==e.tagName&&ow(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}qc.prototype.point=!1;class Qc extends Ht{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Qc&&this.spec.class==e.spec.class&&ow(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)}}Qc.prototype.mapMode=yr.TrackBefore;Qc.prototype.point=!0;class cl extends Ht{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?yr.TrackBefore:yr.TrackAfter:yr.TrackDel}get type(){return this.startSide!=this.endSide?ni.WidgetRange:this.startSide<=0?ni.WidgetBefore:ni.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof cl&&F9(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)}}cl.prototype.point=!0;function KE(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function F9(t,e){return t==e||!!(t&&e&&t.compare(e))}function ma(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class Mc extends ul{constructor(e,n,r){super(),this.tagName=e,this.attributes=n,this.rank=r}eq(e){return e==this||e instanceof Mc&&this.tagName==e.tagName&&ow(this.attributes,e.attributes)}static create(e){return new Mc(e.tagName,e.attributes||Ch,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return $t.of(e,n)}}Mc.prototype.startSide=Mc.prototype.endSide=-1;function Rc(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function ty(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function tc(t,e){if(!e.anchorNode)return!1;try{return ty(t,e.anchorNode)}catch{return!1}}function nc(t){return t.nodeType==3?Pc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function rc(t,e,n,r){return n?ik(t,e,n,r,-1)||ik(t,e,n,r,1):!1}function So(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Th(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function ik(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Os(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=So(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?Os(t):0}else return!1}}function Os(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Oc(t,e){let{left:n,right:r}=t;if(n==r)return t;let i=e?n:r;return{left:i,right:i,top:t.top,bottom:t.bottom}}function B9(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function XE(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function z9(t,e,n,r,i,s,o,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,p=1,m=1;if(h)d=B9(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 y=c.getBoundingClientRect();({scaleX:p,scaleY:m}=XE(c,y)),d={left:y.left,right:y.left+c.clientWidth*p,top:y.top,bottom:y.top+c.clientHeight*m}}let b=0,g=0;if(i=="nearest")e.top0&&e.bottom>d.bottom+g&&(g=e.bottom-d.bottom+o)):e.bottom>d.bottom-o&&(g=e.bottom-d.bottom+o,n<0&&e.top-g0&&e.right>d.right+b&&(b=e.right-d.right+s)):e.right>d.right-s&&(b=e.right-d.right+s,n<0&&e.leftd.bottom||e.leftd.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function GE(t,e=!0){let n=t.ownerDocument,r=null,i=null;for(let s=t.parentNode;s&&!(s==n.body||(!e||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class $9{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?Os(n):0),r,Math.min(e.focusOffset,r?Os(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}function YE(t){let e=[];for(let n=t;n;n=n.nodeType==11?n.host:n.parentNode)n.nodeType==1&&e.push({node:n,left:n.scrollLeft,top:n.scrollTop});return e}function qE(t,e=!0){for(let{node:n,left:r,top:i}of t)e&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}let Wo=null;Ee.safari&&Ee.safari_version>=26&&(Wo=!1);function QE(t){if(t.setActive)return t.setActive();if(Wo)return t.focus(Wo);let e=YE(t);t.focus(Wo==null?{get preventScroll(){return Wo={preventScroll:!0},!0}}:void 0),Wo||(Wo=!1,qE(e))}let sk;function Pc(t,e,n=e){let r=sk||(sk=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function ya(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function j9(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function H9(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,Os(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=Os(n))}else{if(n==t)return!0;r=So(n),n=n.parentNode}}function JE(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function ZE(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=Os(n)}else if(n.parentNode&&!Th(n))r=So(n),n=n.parentNode;else return null}}function eA(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r=n){if(l.level==r)return o;(s<0||(i!=0?i<0?l.fromn:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function rA(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;m-=3)if(ji[m+1]==-h){let b=ji[m+2],g=b&2?i:b&4?b&1?s:i:0;g&&(Xt[f]=Xt[ji[m]]=g),l=m;break}}else{if(ji.length==189)break;ji[l++]=f,ji[l++]=d,ji[l++]=a}else if((p=Xt[f])==2||p==1){let m=p==i;a=m?0:1;for(let b=l-3;b>=0;b-=3){let g=ji[b+2];if(g&2)break;if(m)ji[b+2]|=2;else{if(g&4)break;ji[b+2]|=4}}}}}function G9(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,l=ia;)p==b&&(p=n[--m].from,b=m?n[m-1].to:t),Xt[--p]=h;a=c}else s=u,a++}}}function ry(t,e,n,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,u=0;aa&&o.push(new Ji(a,m.from,h));let b=m.direction==fl!=!(h%2);iy(t,b?r+1:r,i,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==n||(c?Xt[p]!=l:Xt[p]==l))break;p++}d?ry(t,a,p,r+1,i,d,o):ae;){let c=!0,f=!1;if(!u||a>s[u-1].to){let m=Xt[a-1];m!=l&&(c=!1,f=m==16)}let d=!c&&l==1?[]:null,h=c?r:r+1,p=a;e:for(;;)if(u&&p==s[u-1].to){if(f)break e;let m=s[--u];if(!c)for(let b=m.from,g=u;;){if(b==e)break e;if(g&&s[g-1].to==b)b=s[--g].from;else{if(Xt[b-1]==l)break e;break}}if(d)d.push(m);else{m.toXt.length;)Xt[Xt.length]=256;let r=[],i=e==fl?0:1;return iy(t,i,i,n,0,t.length,r),r}function iA(t){return[new Ji(0,t,0)]}let sA="";function q9(t,e,n,r,i){var s;let o=r.head-t.from,l=Ji.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],u=a.side(i,n);if(o==u){let d=l+=i?1:-1;if(d<0||d>=e.length)return null;a=e[l=d],o=a.side(!i,n),u=a.side(i,n)}let c=tr(t.text,o,a.forward(i,n));(ca.to)&&(c=u),sA=t.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return f&&c==u&&f.level+(i?0:1)t.some(e=>e)}),J9=Be.define({combine:t=>t.some(e=>e)}),hA=Be.define();class va{constructor(e,n,r,i,s,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new va(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new va(le.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ed=Gt.define({map:(t,e)=>t.map(e)}),pA=Gt.define();function Jr(t,e,n){let r=t.facet(uA);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))}const bs=Be.define({combine:t=>t.length?t[0]:!0});let Z9=0;const sa=Be.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let a=[];return o&&a.push(kp.of(u=>{let c=u.plugin(l);return c?o(c):Ht.none})),s&&a.push(s(l)),a})}static fromClass(e,n){return oi.define((r,i)=>new e(r,i),n)}}class im{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}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(Jr(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.plugin.create(e,this.spec.arg)}catch(n){Jr(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){Jr(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const gA=Be.define(),cw=Be.define(),kp=Be.define(),mA=Be.define(),fw=Be.define(),Jc=Be.define(),yA=Be.define();function ok(t,e){let n=t.state.facet(yA);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return $t.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let u=s-e.from,c=o-e.from,f=i;for(let d=l.length-1;d>=0;d--,a--){let h=l[d].spec.bidiIsolate,p;if(h==null&&(h=Q9(e.text,u,c)),a>0&&f.length&&(p=f[f.length-1]).to==u&&p.direction==h)p.to=c,f=p.inner;else{let m={from:u,to:c,direction:h,inner:[]};f.push(m),f=m.inner}}}}),i}const vA=Be.define();function dw(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(vA)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const Lu=Be.define();class Zr{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new Zr(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 i=e[n-1];if(!(i.fromA>r.toA)){if(i.toAi.push(new Zr(s,o,l,a))),this.changedRanges=i}static create(e,n,r){return new Eh(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>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}}const eV=[];class yn{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return eV}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&N9(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n,r){return null}domPosFor(e,n){let r=So(this.dom),i=this.length?e>0:n>0;return new Ti(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Cp)return e;return null}static get(e){return e.cmTile}}class Sp extends yn{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,i,s=(e==null?void 0:e.node)==n?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;i&&i!=l.dom;)i=lk(i);else n.insertBefore(l.dom,i);r=l.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=lk(i);this.length=o}}function lk(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Cp extends Sp{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=yn.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let o=r.children[i++];if(o instanceof Ts)n.push(i),r=o,i=0;else{let l=s+o.length,a=e(o,s);if(a!==void 0)return a;s=l+o.breakAfter}}}resolveBlock(e,n){let r,i=-1,s,o=-1;if(this.blockTiles((l,a)=>{let u=a+l.length;if(e>=a&&e<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(r=void 0)}(ae||e==a&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=e-a)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Ts extends Sp{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new Ts(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Pa extends Sp{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new Pa(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,r){let i=null,s=-1,o=null,l=-1;function a(c,f){for(let d=0,h=0;d=f&&(p.isComposite()?a(p,f-h):(!o||o.isHidden&&(n>0&&!(o.flags&32)||r&&nV(o,p)))&&(m>f||p.flags&32&&n<=1)?(o=p,l=f-h):(h=-1)&&(i=p,s=f-h)),h=m}}a(this,e);let u=(n<0?i:o)||i||o;return u?{tile:u,offset:u==i?s:l}:null}coordsIn(e,n,r){let i=this.resolveInline(e,n,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),n,r):tV(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Ti(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:n);let o=r.tile.parent,l=!1;for(let a of o.children){if(l)return new Ti(a.dom,0);a==r.tile&&(l=!0)}}return new Ti(this.dom,0)}}function tV(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=nc(e);return n[n.length-1]||null}function nV(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.topi&&(e=i);let s=e,o=e,l=0;e==0&&n<0||e==i&&n>=0?Ee.chrome||Ee.gecko||(e?(s--,l=1):o=0)?0:a.length-1];return Ee.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(a,c=>c.width)||u),r==null?u:Oc(u,(l?l>0:n<0)==r)}static of(e,n){let r=new Qo(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class dl extends yn{constructor(e,n,r,i){super(e,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return Oc(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?s.length-1:0;o=s[a],!(e>0?a==0:a==s.length-1||o.top0==r)}}class rV{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:o,parents:l}=this;for(;e||n>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!l.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=l.pop(),s++}else{let a=i.children[s],u=a.breakAfter;(n>0?a.length<=e:a.length=0;l--){let a=n.marks[l],u=i.lastChild;if(u instanceof vr&&u.mark.eq(a.mark))u.dom!=a.dom&&u.setDOM(sm(a.dom)),i=u;else{if(this.cache.reused.get(a)){let f=yn.get(a.dom);f&&f.setDOM(sm(a.dom))}let c=vr.of(a.mark,a.dom);i.append(c),i=c}this.cache.reused.set(a,2)}let s=yn.get(e.text);s&&this.cache.reused.set(s,2);let o=new Qo(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=wA);let i=Pa.start(e,n||((r=this.cache.find(Pa))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],l;if(n>0&&(l=i.lastChild)&&l instanceof vr&&l.mark.eq(o))i=l,n--;else{let a=vr.of(o,(r=this.cache.find(vr,u=>u.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(a),i=a,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!ak(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Ee.ios&&ak(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(om,0,32)||new dl(om.toDOM(),0,om,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let n=e.rank*102+e.value.rank,r=new iV(e.from,e.to,e.value,n),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.fromo.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(Ah,void 0,1);return r&&(r.flags=n),r||new Ah(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class oV{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=i;let l=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,l)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const Mh=[dl,Pa,Qo,vr,Ah,Ts,Cp];for(let t=0;t[]),this.index=Mh.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let l=0;l{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,o=0;;){let l=oi){let u=a-i;this.preserve(u,!o,!l),i=a,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let u=a>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof vr&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof vr&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,i=this.builder,s=-1,o=$t.spans(this.decorations,e,n,{point:(l,a,u,c,f,d)=>{if(u instanceof cl){if(this.disallowBlockEffectsFor[d]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=c.length,f>c.length)i.continueWidget(a-l);else{let h=u.widget||(u.block?Ia.block:Ia.inline),p=uV(u),m=this.cache.findWidget(h,a-l,p)||dl.of(h,this.view,a-l,p);u.block?(u.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(m)):(i.ensureLine(r),i.addInlineWidget(m,c,f))}r=null}else r=cV(r,u);a>l&&this.text.skip(a-l)},span:(l,a,u,c)=>{for(let f=l;f-1&&(this.openWidget=o>s),this.openWidget||i.addLineStartIfNotCovered(r),this.openMarks=o}forward(e,n,r=1){n-e<=10?this.old.advance(n-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=yn.get(i);if(i==this.view.contentDOM)break;s instanceof vr?n.push(s):s!=null&&s.isLine()?r=s:s instanceof Ts||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new Pa(i,wA):r||n.push(vr.of(new qc({tagName:i.nodeName.toLowerCase(),attributes:L9(i)}),i)))}return{line:r,marks:n}}}function ak(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function uV(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const wA={class:"cm-line"};function cV(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&sw(n,t),r&&(t.class+=" "+r)),t}function fV(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof vr&&e.push(r.mark)}return e}function sm(t){let e=yn.get(t);return e&&e.setDOM(t.cloneNode()),t}class Ia extends Ga{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}}Ia.inline=new Ia("span");Ia.block=new Ia("div");const om=new class extends Ga{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class uk{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ht.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Cp(e,e.contentDOM),this.updateInner([new Zr(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!bV(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?hV(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;r=new Zr(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Ee.ie||Ee.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=mV(o,this.decorations,e.changes);a.length&&(r=Zr.extendWithRanges(r,a));let u=vV(l,this.blockWrappers,e.changes);return u.length&&(r=Zr.extendWithRanges(r,u)),s&&!r.some(c=>c.fromA<=s.range.fromA&&c.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,l=new aV(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&yn.get(n.text)&&l.cache.reused.set(yn.get(n.text),2),this.tile=l.run(e,n),oy(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Ee.chrome||Ee.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to-1)&&tc(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,u,c;if(a.empty?c=u=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),u=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),Ee.gecko&&a.empty&&!this.hasComposition&&dV(u)){let d=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(d,u.node.childNodes[u.offset]||null)),u=c=new Ti(d,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!rc(u.node,u.offset,f.anchorNode,f.anchorOffset)||!rc(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{Ee.android&&Ee.chrome&&r.contains(f.focusNode)&&wV(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let d=Rc(this.view.root);if(d)if(a.empty){if(Ee.gecko){let h=pV(u.node,u.offset);if(h&&h!=3){let p=(h==1?ZE:eA)(u.node,u.offset);p&&(u=new Ti(p.node,p.offset))}}d.collapse(u.node,u.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(u.node,u.offset);try{d.extend(c.node,c.offset)}catch{}}else{let h=document.createRange();a.anchor>a.head&&([u,c]=[c,u]),h.setEnd(c.node,c.offset),h.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(h)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,c)),this.impreciseAnchor=u.precise?null:new Ti(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new Ti(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&rc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Rc(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.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,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(i,s)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let o=Os(e)==0?0:n==0?-1:1;for(;;){let l=e.parentNode;if(l==r.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!yn.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,l=i;;o++){let a=r.children[o];if(a.dom==s)return l;l+=a.length+a.breakAfter}}else return r.isText()?e==r.dom?i+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(i,n):r.domIn(i,n)}inlineDOMNearPos(e,n){let r,i=-1,s=!1,o,l=-1,a=!1;return this.tile.blockTiles((u,c)=>{if(u.isWidget()){if(u.flags&32&&c>=e)return!0;u.flags&16&&(s=!0)}else{let f=c+u.length;if(c<=e&&(r=u,i=e-c,s=f=e&&!o&&(o=u,l=e-c,a=c>e),c>e&&o)return!0}}),!r&&!o?this.domAtPos(e,n):(s&&o?r=null:a&&r&&(o=null),r&&n<0||!o?r.domIn(i,n):o.domIn(l,n))}coordsAt(e,n,r){let{tile:i,offset:s}=this.tile.resolveBlock(e,n);return i.isWidget()?i.widget instanceof lm?null:i.coordsInWidget(s,n,!0):i.coordsIn(s,n,r)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function i(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let a=i(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(s.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==mn.LTR,u=0,c=(f,d,h)=>{for(let p=0;pi);p++){let m=f.children[p],b=d+m.length,g=m.dom.getBoundingClientRect(),{height:y}=g;if(h&&!p&&(u+=g.top-h.top),m instanceof Ts)b>r&&c(m,d,g);else if(d>=r&&(u>0&&n.push(-u),n.push(y+u),u=0,o)){let w=m.dom.lastChild,k=w?nc(w):[];if(k.length){let x=k[k.length-1],S=a?x.right-g.left:g.right-x.left;S>l&&(l=S,this.minWidth=s,this.minWidthFrom=d,this.minWidthTo=b)}}h&&p==f.children.length-1&&(u+=h.bottom-g.bottom),d=b+m.breakAfter}};return c(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?mn.RTL:mn.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let c=nc(u.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=nc(n.firstChild)[0];r=n.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Ht.replace({widget:new lm(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Ht.set(e)}updateDeco(){let e=1,n=this.view.state.facet(kp).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(fw).map((s,o)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push($t.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(hA))try{if(u(this.view,e.range,e))return!0}catch(c){Jr(this.view.state,c,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=dw(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(z9(this.view.scrollDOM,o,n.head1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottomr.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){oy(this.tile)}}function oy(t,e){let n=e==null?void 0:e.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)oy(r,e)}}function dV(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")}function bA(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=ZE(n.focusNode,n.focusOffset),i=eA(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=yn.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let a=yn.get(r.node);!a||a.isText()&&a.text!=r.node.nodeValue||(s=i)}}if(t.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function hV(t,e,n){let r=bA(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let a=e.invertedDesc;return{range:new Zr(a.mapPos(s),a.mapPos(o),s,o),text:i}}function pV(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}class lm extends Ga{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function xV(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return le.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,l=s;n<0?o=tr(i.text,s,!1):l=tr(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let u=tr(i.text,o,!1);if(r(i.text.slice(u,o))!=a)break;o=u}for(;lt.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((i-n.top-(t.defaultLineHeight-l)*.5)/l);s+=a*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+O9(o,s,t.state.tabSize)}function SV(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.toe)return s;(!i||s.type==ni.Text&&(i.type!=s.type||(n<0?s.frome)))&&(i=s)}}return i||r}return r}function CV(t,e,n,r){let i=SV(t,e.head,e.assoc||-1),s=!r||i.type!=ni.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),l=t.textDirectionAt(i.from),a=t.posAtCoords({x:n==(l==mn.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return le.cursor(a,n?-1:1)}return le.cursor(n?i.to:i.from,n?-1:1)}function ck(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let l=e,a=null;;){let u=q9(i,s,o,l,n),c=sA;if(!u){if(i.number==(n?t.state.doc.lines:1))return l;c=` +`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),u=t.visualLineSide(i,!n)}if(a){if(!a(c))return l}else{if(!r)return u;a=r(c)}l=u}}function TV(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Ss.Space&&(i=o),i==o}}function EV(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return le.cursor(i,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(i,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),c=t.documentTop;if(u)o==null&&(o=u.left-a.left),l=s<0?u.top:u.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(i-p.from))),l=(s<0?p.top:p.bottom)+c}let f=a.left+o,d=t.viewState.heightOracle.textHeight>>1,h=r??d;for(let p=0;;p+=d){let m=l+(h+p)*s,b=ly(t,{x:f,y:m},!1,s);if(n?m>a.bottom:ml:y{if(e>s&&ei(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:le.cursor(r,rt.viewState.docHeight)return new Yi(t.state.doc.length,-1);if(u=t.elementAtHeight(a),r==null)break;if(u.type==ni.Text){if(r<0?u.tot.viewport.to)break;let d=t.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(d&&(r<0?d.top<=a+s:d.bottom>=a+s))break}let f=t.viewState.heightOracle.textHeight/2;a=r>0?u.bottom+f:u.top-f}if(t.viewport.from>=u.to||t.viewport.to<=u.from){if(n)return null;if(u.type==ni.Text){let f=kV(t,i,u,o,l);return new Yi(f,f==u.from?1:-1)}}if(u.type!=ni.Text)return a<(u.top+u.bottom)/2?new Yi(u.from,1):new Yi(u.to,-1);let c=t.docView.lineAt(u.from,2);return(!c||c.length!=u.length)&&(c=t.docView.lineAt(u.from,-2)),new AV(t,o,l,t.textDirectionAt(u.from)).scanTile(c,u.from)}class AV{constructor(e,n,r,i){this.view=e,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from>1;t:if(o.has(m)){for(let y=1;y=s&&(w-=p),!o.has(w)){m=w;break t}}break e}o.add(m);let b=n(m),g=0;if(b)for(let y=0;y1))if(w.bottomthis.y)(!u||u.top>w.top)&&(u=w),g=-1;else{let k=w.left>this.x?this.x-w.left:w.right(p+p+m)/3)return this.y=a.bottom-1,this.scan(e,n,!0);if(u&&u.top<(p+m+m)/3)return this.y=u.top+1,this.scan(e,n,!0)}let h=(l?this.dirAt(e[c],1):this.baseDir)==mn.LTR;return{i:c,after:this.x>(d.left+d.right)/2==h}}scanText(e,n){let r=[];for(let s=0;s{let o=r[s]-n,l=r[s+1]-n;return Pc(e.dom,o,l).getClientRects()});return i.after?new Yi(r[i.i+1],-1):new Yi(r[i.i],1)}scanTile(e,n){if(!e.length)return new Yi(n,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let r=[n];for(let l=0,a=n;l{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Pc(a.dom,0,a.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new Yi(r[i.i+1],-1):new Yi(o,1)}}const Wl="￿";class MV{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(Nt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Wl}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=yn.get(i),l=i.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let a=yn.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:Th(i))||Th(l)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!OV(l,n)&&this.lineBreak(),i=l}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,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){let n=yn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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+(RV(e,r.node,r.offset)?n:0))}}function RV(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,l=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=kA(e.docView.tile,n,r,0))){let a=s||o?[]:DV(e),u=new MV(a,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=_V(a,this.bounds.from)}else{let a=e.observer.selectionRange,u=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!ty(e.contentDOM,a.focusNode)?l.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!ty(e.contentDOM,a.anchorNode)?l.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),f=e.viewport;if((Ee.ios||Ee.chrome)&&u!=c&&Math.min(u,c)<=l.main.from&&Math.max(u,c)>=l.main.to&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(le.range(c,u));else if(e.lineWrapping&&c==u&&!(l.main.empty&&l.main.head==u)&&e.inputState.lastTouchTime>Date.now()-100){let d=e.coordsAtPos(u,-1),h=0;d&&(h=e.inputState.lastTouchY<=d.bottom?-1:1),this.newSel=le.create([le.cursor(u,h)])}else this.newSel=le.single(c,u)}}}function kA(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,l=-1;for(let a=0,u=r,c=r;an)return kA(f,e,n,u);if(d>=e&&i==-1&&(i=a,s=u),u>n&&f.dom.parentNode==t.dom){o=a,l=c;break}c=d,u=d+f.breakAfter}return{from:s,to:l<0?r+t.length:l,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function SA(t,e){let n,{newSel:r}=e,{state:i}=t,s=i.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,u=s.from,c=null;(o===8||Ee.android&&e.text.length=l&&s.to<=a&&(e.typeOver||f!=e.text)&&f.slice(0,s.from-l)==e.text.slice(0,s.from-l)&&f.slice(s.to-l)==e.text.slice(d=e.text.length-(f.length-(s.to-l)))?n={from:s.from,to:s.to,insert:Pt.of(e.text.slice(s.from-l,d).split(Wl))}:(h=CA(f,e.text,u-l,c))&&(Ee.chrome&&o==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==Wl+Wl&&h.toB--,n={from:l+h.from,to:l+h.toA,insert:Pt.of(e.text.slice(h.from,h.toB).split(Wl))})}else r&&(!t.hasFocus&&i.facet(bs)||Rh(r,s))&&(r=null);if(!n&&!r)return!1;if((Ee.mac||Ee.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=le.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Pt.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:i.toText(t.inputState.insertingText)}:Ee.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&t.lineWrapping&&(r&&(r=le.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Pt.of([" "])}),n)return hw(t,n,r,o);if(r&&!Rh(r,s)){let l=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=xA(i.facet(Jc).map(u=>u(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:a}),!0}else return!1}function hw(t,e,n,r=-1){if(Ee.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(Ee.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ya(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.lengthi.head)&&ya(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&ya(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=IV(t,e,n));return t.state.facet(cA).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function IV(t,e,n){let r,i=t.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.froms.to){let a=e.fromf(t)),u,a);e.from==c&&(o=c)}if(o>-1)r={changes:e,selection:le.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.frome.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+u))}else{let a=i.changes(e),u=n&&n.main.to<=a.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),f,d=n&&bA(t,n.main.head);if(d){let p=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-p}}else f=t.state.doc.lineAt(s.head);let h=s.to-e.to;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:u||p.map(a)};let m=p.to-h,b=m-c.length;if(t.state.sliceDoc(b,m)!=c||m>=f.from&&b<=f.to)return{range:p};let g=i.changes({from:b,to:m,insert:e.insert}),y=p.to-s.to;return{changes:g,range:u?le.range(Math.max(0,u.anchor+y),Math.max(0,u.head+y)):p.map(g)}})}else r={changes:a,selection:u&&i.selection.replaceRange(u)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:l,scrollIntoView:!0})}function CA(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o=o?s-n:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-n:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function DV(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new fk(n,r)),(i!=n||s!=r)&&e.push(new fk(i,s))),e}function _V(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?le.single(n+e,r+e):null}function Rh(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class NV{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Ee.safari&&e.contentDOM.addEventListener("input",()=>null),Ee.gecko&&QV(e.contentDOM.ownerDocument)}handleEvent(e){!VV(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=FV(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&EA.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ee.android&&Ee.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Ee.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(TA.some(n=>n.keyCode==e.keyCode)&&!e.ctrlKey||BV.indexOf(e.key)>-1&&e.ctrlKey)){let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&Ee.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&LV(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Ee.safari&&!Ee.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function LV(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function dk(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){Jr(n.state,i)}}}function FV(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&n(l).handlers.push(dk(r.value,a))}if(o)for(let l in o){let a=o[l];a&&n(l).observers.push(dk(r.value,a))}}for(let r in Pi)n(r).handlers.push(Pi[r]);for(let r in fr)n(r).observers.push(fr[r]);return e}const TA=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],BV="dthko",EA=[16,17,18,20,91,92,224,225],td=6;function nd(t){return Math.max(0,t)*.7+8}function zV(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class $V{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=GE(e.contentDOM),this.atoms=e.state.facet(Jc).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Nt.allowMultipleSelections)&&jV(e,n),this.dragging=WV(e,n)&&RA(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&zV(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=dw(this.view);e.clientX-a.left<=i+td?n=-nd(i-e.clientX):e.clientX+a.right>=o-td&&(n=nd(e.clientX-o)),e.clientY-a.top<=s+td?r=-nd(s-e.clientY):e.clientY+a.bottom>=l-td&&(r=nd(e.clientY-l)),this.setScrollSpeed(n,r)}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=this.view.inputState.draggedContent=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(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=xA(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function jV(t,e){let n=t.state.facet(oA);return n.length?n[0](e):Ee.mac?e.metaKey:e.ctrlKey}function HV(t,e){let n=t.state.facet(lA);return n.length?n[0](e):Ee.mac?!e.altKey:!e.ctrlKey}function WV(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Rc(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function VV(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=yn.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Pi=Object.create(null),fr=Object.create(null),AA=Ee.ie&&Ee.ie_version<15||Ee.ios&&Ee.webkit_version<604;function UV(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(),MA(t,n.value)},50)}function Tp(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function MA(t,e){e=Tp(t.state,aw,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(ay!=null&&n.selection.ranges.every(a=>a.empty)&&ay==s.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((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:f},range:le.cursor(u.from+f.length)}})}else o?r=n.changeByRange(a=>{let u=s.line(i++);return{changes:{from:a.from,to:a.to,insert:u.text},range:le.cursor(a.from+u.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}fr.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,Ee.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};fr.wheel=fr.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};Pi.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);fr.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};fr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};fr.touchend=(t,e)=>{t.inputState.touchActive=!1};Pi.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(aA))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=XV(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new $V(t,e,n,r)),r&&t.observer.ignore(()=>{QE(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function hk(t,e,n,r){if(r==1)return le.cursor(e,n);if(r==2)return xV(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return lDate.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(gk+1)%3:1}function XV(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=RA(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,l){let a=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,c=hk(t,a.pos,a.assoc,r);if(n.pos!=a.pos&&!o){let f=hk(t,n.pos,n.assoc,r),d=Math.min(f.from,c.from),h=Math.max(f.to,c.to);c=d1&&(u=GV(i,a.pos))?u:l?i.addRange(c):le.create([c])}}}function GV(t,e){for(let n=0;n=e)return le.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}Pi.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=le.undirectionalRange(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Tp(t.state,uw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Pi.dragend=t=>(t.inputState.draggedContent=null,!1);function yk(t,e,n,r){if(n=Tp(t.state,aw,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&HV(t,e)?{from:s.from,to:s.to}:null,l={from:i,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Pi.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&yk(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return yk(t,e,r,!0),!0}return!1};Pi.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=AA?null:e.clipboardData;return n?(MA(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(UV(t),!1)};function YV(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 qV(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:Tp(t,uw,e.join(t.lineBreak)),ranges:n,linewise:r}}let ay=null;Pi.copy=Pi.cut=(t,e)=>{if(!tc(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=qV(t.state);if(!n&&!i)return!1;ay=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=AA?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(YV(t,n),!1)};const OA=Ro.define();function PA(t,e){let n=[];for(let r of t.facet(fA)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:OA.of(!0)}):null}function IA(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=PA(t.state,e);n?t.dispatch(n):t.update([])}},10)}fr.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),IA(t)};fr.blur=t=>{t.observer.clearSelectionRange(),IA(t)};fr.compositionstart=fr.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};fr.compositionend=t=>{t.observer.editContext||(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,Ee.chrome&&Ee.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};fr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Pi.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=t.posAtDOM(l.startContainer,l.startOffset),u=t.posAtDOM(l.endContainer,l.endOffset);return hw(t,{from:a,to:u,insert:t.state.toText(s)},null),!0}}let i;if(Ee.chrome&&Ee.android&&(i=TA.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Ee.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Ee.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>fr.compositionend(t,e),20),!1};const vk=new Set;function QV(t){vk.has(t)||(vk.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const wk=["pre-wrap","normal","pre-line","break-spaces"];let Da=!1;function bk(){Da=!1}class JV{constructor(e){this.lineWrapping=e,this.doc=Pt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}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)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return wk.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,a=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let u=0;u0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>_d&&(Da=!0),this.height=e)}replace(e,n,r){return cr.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:c,toB:f}=i[l],d=s.lineAt(a,Qt.ByPosNoHeight,r.setDoc(n),0,0),h=d.to>=u?d:s.lineAt(u,Qt.ByPosNoHeight,r,0,0);for(f+=h.to-u,u=h.to;l>0&&d.from<=i[l-1].toA;)a=i[l-1].fromA,c=i[l-1].fromB,l--,as*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,i-=l.size}else if(s>i*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,s-=l.size}else break;else if(i=s&&o(this.lineAt(0,Qt.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ir extends DA{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Si(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Ir||i instanceof jn&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof jn?i=new Ir(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):cr.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(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:""})`}}class jn extends cr{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+(e0){let s=r[r.length-1];s instanceof jn?r[r.length-1]=new jn(s.length+i):r.push(null,new jn(i-1))}if(e>0){let s=r[0];s instanceof jn?r[0]=new jn(e+s.length):r.unshift(new jn(e-1),null)}return cr.of(r)}decomposeLeft(e,n){n.push(new jn(e-1),null)}decomposeRight(e,n){n.push(null,new jn(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],l=Math.max(n,i.from),a=-1;for(i.from>n&&o.push(new jn(i.from-n-1).updateHeight(e,n));l<=s&&i.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=i.heights[i.index++],d=0;f<0&&(d=-f,f=i.heights[i.index++]),a==-1?a=f:Math.abs(f-a)>=_d&&(a=-2);let h=new Ir(c,f,d);h.outdated=!1,o.push(h),l+=c+1}l<=s&&o.push(null,new jn(s-l).updateHeight(e,l));let u=cr.of(o);return(a<0||Math.abs(u.height-this.height)>=_d||Math.abs(a-this.heightMetrics(e,n).perLine)>=_d)&&(Da=!0),Oh(this,u)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class tU extends cr{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,i){let s=r+this.left.height;return el))return u;let c=n==Qt.ByPosNoHeight?Qt.ByPosNoHeight:Qt.ByPos;return a?u.join(this.right.lineAt(l,c,r,o,l)):this.left.lineAt(l,c,r,i,s).join(u)}forEachLine(e,n,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,n,r,l,a,o);else{let u=this.lineAt(a,Qt.ByPos,r,i,s);e=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,a,o)}}replace(e,n,r){let i=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of r)s.push(l);if(e>0&&xk(s,o-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e2*n.size||n.size>2*e.size?cr.of(this.break?[e,null,n]:[e,n]):(this.left=Oh(this.left,e),this.right=Oh(this.right,n),this.setHeight(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,i){let{left:s,right:o}=this,l=n+s.length+this.break,a=null;return i&&i.from<=n+s.length&&i.more?a=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function xk(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof jn&&(r=t[e+1])instanceof jn&&t.splice(e-1,3,new jn(n.length+1+r.length))}const nU=5;class pw{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),i=this.nodes[this.nodes.length-1];i instanceof Ir?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ir(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=nU)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Ir(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new jn(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 Ir)return e;let n=new Ir(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.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 Ir)&&!this.isCovered?this.nodes.push(new Ir(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let d=c.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),l=Math.max(l,d.top),a=Math.min(u==t.parentNode?i.innerHeight: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:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function oU(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function lU(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class um{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new JV(r),this.stateDeco=Ck(n),this.heightMap=cr.empty().applyChanges(this.stateDeco,Pt.empty,this.heightOracle.setDoc(n.doc),[new Zr(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ht.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new rd(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Sk:new gw(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Fu(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=Ck(this.state);let i=e.changedRanges,s=Zr.extendWithRanges(i,rU(r,this.stateDeco,e?e.changes:On.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);bk(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Da)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(u||!e.changes.empty||e.flags&2)&&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(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(J9)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?mn.RTL:mn.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,c=0;if(l.width&&l.height){let{scaleX:x,scaleY:S}=XE(n,l);(x>.005&&Math.abs(this.scaleX-x)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=x,this.scaleY=S,u|=16,o=a=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let h=GE(this.view.contentDOM,!1).y;h!=this.scrollParent&&(this.scrollParent=h,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=JE(this.scrollParent||e.win);let m=(this.printing?lU:sU)(n,this.paddingTop),b=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget&&!oU(e.dom))return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),a){let x=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(x)&&(o=!0),o||i.lineWrapping&&Math.abs(w-this.contentDOMWidth)>i.charWidth){let{lineHeight:S,charWidth:T,textHeight:E}=e.docView.measureTextSize();o=S>0&&i.refresh(s,S,T,E,Math.max(5,w/T),x),o&&(e.docView.minWidth=0,u|=16)}b>0&&g>0?c=Math.max(b,g):b<0&&g<0&&(c=Math.min(b,g)),bk();for(let S of this.viewports){let T=S.from==this.viewport.from?x:e.docView.measureVisibleLineHeights(S);this.heightMap=(o?cr.empty().applyChanges(this.stateDeco,Pt.empty,this.heightOracle,[new Zr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new ZV(S.from,T))}Da&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return k&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]: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)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new rd(i.lineAt(o-r*1e3,Qt.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,Qt.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(ua.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(u,Qt.ByPos,s,0,0),d;n.y=="center"?d=(f.top+f.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s>1,o=i<<1;if(this.defaultTextDirection!=mn.LTR&&!r)return[];let l=[],a=(c,f,d,h)=>{if(f-cc&&gg.from>=d.from&&g.to<=d.to&&Math.abs(g.from-c)g.fromy));if(!b){if(fw.from<=f&&w.to>=f)){let w=n.moveToLineBoundary(le.cursor(f),!1,!0).head;w>c&&(f=w)}let g=this.gapSize(d,c,f,h),y=r||g<2e6?g:2e6;b=new um(c,f,g,y)}l.push(b)},u=c=>{if(c.length2e6)for(let S of e)S.from>=c.from&&S.fromc.from&&a(c.from,h,c,f),pn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];$t.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Fu(this.heightMap.lineAt(e,Qt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Fu(this.heightMap.lineAt(this.scaler.fromDOM(e),Qt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}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 Fu(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}}class rd{constructor(e,n){this.from=e,this.to=n}}function uU(t,e,n){let r=[],i=t,s=0;return $t.spans(n,t,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],l=o-s;if(r<=l)return s+r;r-=l}}function sd(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function cU(t,e){for(let n of t)if(e(n))return n}const Sk={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function Ck(t){let e=t.facet(kp).filter(r=>typeof r!="function"),n=t.facet(fw).filter(r=>typeof r!="function");return n.length&&e.push($t.join(n)),e}class gw{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let u=n.lineAt(l,Qt.ByPos,e,0,0).top,c=n.lineAt(a,Qt.ByPos,e,0,0).bottom;return i+=c-u,{from:l,to:a,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Fu(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Si(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>Fu(i,e)):t._content)}const od=Be.define({combine:t=>t.join(" ")}),uy=Be.define({combine:t=>t.indexOf(!0)>-1}),cy=xo.newName(),_A=xo.newName(),NA=xo.newName(),LA={"&light":"."+_A,"&dark":"."+NA};function fy(t,e,n){return new xo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const fU=fy("."+cy,{"&":{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,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",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":{userSelect:"none",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:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&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",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&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,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".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",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,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"}},LA),dU={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},cm=Ee.ie&&Ee.ie_version<=11;class hU{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new $9,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.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Ee.ie&&Ee.ie_version<=11||Ee.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()}),window.EditContext&&Ee.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ee.chrome&&Ee.chrome_version<126)&&(this.editContext=new gU(e),e.state.facet(bs)&&(e.contentDOM.editContext=this.editContext.editContext)),cm&&(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),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){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.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(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,i=this.selectionRange;if(r.state.facet(bs)?r.root.activeElement!=this.dom:!tc(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Ee.ie&&Ee.ie_version<=11||Ee.android&&Ee.chrome)&&!r.state.selection.main.empty&&i.focusNode&&rc(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Rc(e.root);if(!n)return!1;let r=Ee.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&pU(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=tc(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&ya(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{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,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&tc(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new PV(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=SA(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!Rh(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=Tk(n,e.previousSibling||e.target.previousSibling,-1),i=Tk(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):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),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):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),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(bs)!=e.state.facet(bs)&&(e.view.contentDOM.editContext=e.state.facet(bs)?this.editContext.editContext:null))}destroy(){var e,n,r;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();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),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Tk(t,e,n){for(;e;){let r=yn.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function Ek(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return rc(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function pU(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Ek(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Ek(t,n):null}class gU{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,l=this.toEditorPos(r.updateRangeStart),a=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let u=a-l>r.text.length;l==this.from&&sthis.to&&(a=s);let c=CA(e.state.sliceDoc(l,a),r.text,(u?i.from:i.to)-l,u?"end":null);if(!c){let d=le.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Rh(d,i)||e.dispatch({selection:d,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:Pt.of(r.text.slice(c.from,c.toB).split(` +`))};if((Ee.mac||Ee.android)&&f.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:Pt.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let d=this.to-this.from+(f.to-f.from+f.insert.length);hw(e,f,le.single(this.toEditorPos(r.selectionStart,d),this.toEditorPos(r.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);o{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=Rc(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,u)=>{if(r)return;let c=u.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(u)){i=this.pendingContextChange=null,n+=c,this.to+=c;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=c,this.to+=c;else if(sthis.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=c}n+=c}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class We{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&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||j9(e.parent)||document,this.viewState=new kk(this,e.state||Nt.create(e)),e.scrollTo&&e.scrollTo.is(ed)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(sa).map(i=>new im(i));for(let i of this.plugins)i.update(this);this.observer=new hU(this),this.inputState=new NV(this),this.inputState.ensureHandlers(this.plugins),this.docView=new uk(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof Dn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(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,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(d=>d.annotation(OA))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=PA(s,o),a||(l=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(Nt.phrases)!=this.state.facet(Nt.phrases))return this.setState(s);i=Eh.create(this,s,e),i.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,{x:p,y:m}=this.state.facet(We.cursorScrollMargin);f=new va(h.empty?h:le.cursor(h.head,h.head>h.anchor?-1:1),"nearest","nearest",m,p)}for(let h of d.effects)h.is(ed)&&(f=h.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=Ph.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Lu)!=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(i.startState.facet(od)!=i.state.facet(od)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(sy))try{d(i)}catch(h){Jr(this.state,h,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!SA(this,c)&&u.force&&ya(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 kk(this,e),this.plugins=e.facet(sa).map(r=>new im(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new uk(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(sa),r=e.state.facet(sa);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new im(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(JE(r||this.win))s=-1,o=this.viewState.heightMap.height;else{let h=this.viewState.scrollAnchorAt(i);s=h.from,o=h.top}this.updateState=1;let a=this.viewState.measure();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(p){return Jr(this.state,p),Ak}}),f=Eh.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),d&&this.docViewUpdate());for(let h=0;h1||p<-1)&&!(Ee.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+p,r?s<0?r.scrollTop=r.scrollHeight:r.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(sy))l(n)}get themeClasses(){return cy+" "+(this.state.facet(uy)?NA:_A)+" "+this.state.facet(od)}updateAttrs(){let e=Mk(this,gA,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(bs)?"true":"false",class:"cm-content",style:`${Ee.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Mk(this,cw,n);let r=this.observer.ignore(()=>{let i=rk(this.contentDOM,this.contentAttrs,n),s=rk(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(We.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Lu);let e=this.state.facet(We.cspNonce);xo.mount(this.root,this.styleModules.concat(fU).reverse(),e?{nonce:e}:void 0)}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;nr.plugin==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}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}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 am(this,e,ck(this,e,n,r))}moveByGroup(e,n){return am(this,e,ck(this,e,n,r=>TV(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return le.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return CV(this,e,n,r)}moveVertically(e,n,r){return am(this,e,EV(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=ly(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),ly(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),s=i[Ji.find(i,e-r.from,-1,n)];return this.docView.coordsAt(e,n,s.dir==mn.RTL)}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(dA)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>mU)return iA(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||rA(s.isolates,r=ok(this,e))))return s.order;r||(r=ok(this,e));let i=Y9(e.text,n,r);return this.bidiCache.push(new Ph(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ee.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{QE(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(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){var r,i,s,o;return ed.of(new va(typeof e=="number"?le.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return ed.of(new va(le.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return oi.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return oi.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=xo.newName(),i=[od.of(r),Lu.of(fy(`.${r}`,e))];return n&&n.dark&&i.push(uy.of(!0)),i}static baseTheme(e){return nw.lowest(Lu.of(fy("."+cy,e,LA)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&yn.get(r)||yn.get(e);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}We.styleModule=Lu;We.inputHandler=cA;We.clipboardInputFilter=aw;We.clipboardOutputFilter=uw;We.scrollHandler=hA;We.focusChangeEffect=fA;We.perLineTextDirection=dA;We.exceptionSink=uA;We.updateListener=sy;We.editable=bs;We.mouseSelectionStyle=aA;We.dragMovesSelection=lA;We.clickAddsSelectionRange=oA;We.decorations=kp;We.blockWrappers=mA;We.outerDecorations=fw;We.atomicRanges=Jc;We.bidiIsolatedRanges=yA;We.cursorScrollMargin=Be.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}});We.scrollMargins=vA;We.darkTheme=uy;We.cspNonce=Be.define({combine:t=>t.length?t[0]:""});We.contentAttributes=cw;We.editorAttributes=gA;We.lineWrapping=We.contentAttributes.of({class:"cm-lineWrapping"});We.announce=Gt.define();const mU=4096,Ak={};class Ph{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:mn.LTR;for(let s=Math.max(0,e.length-10);s=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&sw(o,n)}return n}const yU=Ee.mac?"mac":Ee.windows?"win":Ee.linux?"linux":"key";function vU(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;ar.concat(i),[]))),n}let to=null;const xU=4e3;function kU(t,e=yU){let n=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,u,c)=>{var f,d;let h=n[o]||(n[o]=Object.create(null)),p=l.split(/ (?!$)/).map(g=>vU(g,e));for(let g=1;g{let k=to={view:w,prefix:y,scope:o};return setTimeout(()=>{to==k&&(to=null)},xU),!0}]})}let m=p.join(" ");i(m,!1);let b=h[m]||(h[m]={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&&b.run.push(a),u&&(b.preventDefault=!0),c&&(b.stopPropagation=!0)};for(let o of t){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let d in c)c[d].run.push(h=>f(h,dy))}let a=o[e]||o.key;if(a)for(let u of l)s(u,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return n}let dy=null;function SU(t,e,n,r){dy=e;let i=_9(e),s=m9(i,0),o=y9(s)==i.length&&i!=" ",l="",a=!1,u=!1,c=!1;to&&to.view==n&&to.scope==r&&(l=to.prefix+" ",EA.indexOf(e.keyCode)<0&&(u=!0,to=null));let f=new Set,d=b=>{if(b){for(let g of b.run)if(!f.has(g)&&(f.add(g),g(n)))return b.stopPropagation&&(c=!0),!0;b.preventDefault&&(b.stopPropagation&&(c=!0),u=!0)}return!1},h=t[r],p,m;return h&&(d(h[l+ld(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ee.windows&&e.ctrlKey&&e.altKey)&&!(Ee.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=ko[e.keyCode])&&p!=i?(d(h[l+ld(p,e,!0)])||e.shiftKey&&(m=Ac[e.keyCode])!=i&&m!=p&&d(h[l+ld(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&d(h[l+ld(i,e,!0)])&&(a=!0),!a&&d(h._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),dy=null,a}class CU extends Ga{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?nc(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=Oc(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function TU(t){let e=oi.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Ht.set([Ht.widget({widget:new CU(t),side:1}).range(0)]):Ht.none}get decorations(){return this.view.state.doc.length?Ht.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,We.contentAttributes.of({"aria-placeholder":t})]:e}const ad="-10000px";class BA{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=n?[]:null;for(let a=0;an[u]=a),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function EU(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const fm=Be.define({combine:t=>{var e,n,r;return{position:Ee.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||EU}}}),Ok=new WeakMap,zA=oi.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(fm);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new BA(t,$A,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(fm);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=ad,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Ee.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=dw(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(fm).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||f.rightMath.min(n.right,r.right)+.1)){c.style.top=ad;continue}let h=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=h?7:0,m=d.right-d.left,b=(e=Ok.get(u))!==null&&e!==void 0?e:d.bottom-d.top,g=u.offset||MU,y=this.view.textDirection==mn.LTR,w=d.width>r.right-r.left?y?r.left:r.right-d.width:y?Math.max(r.left,Math.min(f.left-(h?14:0)+g.x,r.right-m)):Math.min(Math.max(r.left,f.left-m+(h?14:0)-g.x),r.right-m),k=this.above[l];!a.strictSide&&(k?f.top-b-p-g.yr.bottom)&&k==r.bottom-f.bottom>f.top-r.top&&(k=this.above[l]=!k);let x=(k?f.top-r.top:r.bottom-f.bottom)-p;if(xw&&E.topS&&(S=k?E.top-b-2-p:E.bottom+p+2);if(this.position=="absolute"?(c.style.top=(S-t.parent.top)/s+"px",Pk(c,(w-t.parent.left)/i)):(c.style.top=S/s+"px",Pk(c,w/i)),h){let E=f.left+(y?g.x:-g.x)-(w+14-7);h.style.left=E/i+"px"}u.overlap!==!0&&o.push({left:w,top:S,right:T,bottom:S+b}),c.classList.toggle("cm-tooltip-above",k),c.classList.toggle("cm-tooltip-below",!k),u.positioned&&u.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ad}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Pk(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const AU=We.baseTheme({".cm-tooltip":{zIndex:500,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"}}}),MU={x:0,y:0},$A=Be.define({enables:[zA,AU]}),Ih=Be.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ep{static create(e){return new Ep(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new BA(e,Ih,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const RU=$A.compute([Ih],t=>{let e=t.facet(Ih);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ep.create,above:e[0].above,arrow:e.some(n=>n.arrow)}}),OU=Be.define();class PU{constructor(e,n,r,i,s,o){this.view=e,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||n.xo.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),a=l&&l.dir==mn.RTL?-1:1;s=n.x{if(l&&!(Array.isArray(l)&&!l.length)){let a=Array.isArray(l)?l:[l];i&&this.locked.set(a,i),e.dispatch({effects:this.setHover.of(a)})}};if(s&&"then"in s){let l=this.pending={pos:n};s.then(a=>{this.pending==l&&(this.pending=null,o(a))},a=>Jr(e.state,a,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(zA),n=e?e.manager.tooltips.findIndex(r=>r.create==Ep.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&!this.locked.has(i)&&s&&!IU(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!DU(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const ud=4;function IU(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return e.clientX>=n-ud&&e.clientX<=r+ud&&e.clientY>=i-ud&&e.clientY<=s+ud}function DU(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.righti||Math.min(o.bottom,l)=e&&a<=n}function _U(t,e={}){let n=Gt.define(),r=new WeakMap,i=as.define({create(){return[]},update(o,l){let a=r.get(o);if(o.length&&(e.hideOnChange&&(l.docChanged||l.selection)?o=[]:a&&a(l)?o=[]:e.hideOn&&(o=o.filter(u=>!e.hideOn(l,u)))),l.docChanged&&o.length){let u=[];for(let c of o){let f=l.changes.mapPos(c.pos,-1,yr.TrackDel);if(f!=null){let d=Object.assign(Object.create(null),c);d.pos=f,d.end!=null&&(d.end=l.changes.mapPos(d.end)),u.push(d)}}o=u}for(let u of l.effects)u.is(n)&&(o=u.value,a=void 0),(u.is(NU)&&!u.value||u.value==i)&&(o=[]);return o.length&&a&&r.set(o,a),o},provide:o=>Ih.from(o)});const s=oi.define(o=>new PU(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,OU.of(s),RU]}}const NU=Gt.define(),Ik=Be.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}}),LU=oi.fromClass(class{constructor(t){this.input=t.state.facet(hy),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Ik);this.top=new cd(t,!0,e.topContainer),this.bottom=new cd(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Ik);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new cd(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new cd(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(hy);if(n!=this.input){let r=n.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let u=this.specs.indexOf(a),c;u<0?(c=a(t.view),l.push(c)):(c=this.panels[u],c.update&&c.update(t)),i.push(c),(c.top?s:o).push(c)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>We.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class cd{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Dk(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Dk(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Dk(t){let e=t.nextSibling;return t.remove(),e}const hy=Be.define({enables:LU});class _a extends ul{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}_a.prototype.elementClass="";_a.prototype.toDOM=void 0;_a.prototype.mapMode=yr.TrackBefore;_a.prototype.startSide=_a.prototype.endSide=-1;_a.prototype.point=!0;const jA=1024;let FU=0;class dm{constructor(e,n){this.from=e,this.to=n}}class Ct{constructor(e={}){this.id=FU++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Cr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Ct.closedBy=new Ct({deserialize:t=>t.split(" ")});Ct.openedBy=new Ct({deserialize:t=>t.split(" ")});Ct.group=new Ct({deserialize:t=>t.split(" ")});Ct.isolate=new Ct({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ct.contextHash=new Ct({perNode:!0});Ct.lookAhead=new Ct({perNode:!0});Ct.mounted=new Ct({perNode:!0});class sc{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[Ct.mounted.id]}}const BU=Object.create(null);class Cr{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):BU,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Cr(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}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(Ct.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 i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(Ct.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Cr.none=new Cr("",Object.create(null),0,8);class mw{constructor(e){this.types=e;for(let n=0;n0;for(let a=this.cursor(o|gn.IncludeAnonymous);;){let u=!1;if(a.from<=s&&a.to>=i&&(!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:ww(Cr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Cn(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Cn(Cr.none,n,r,i)))}static build(e){return HU(e)}}Cn.empty=new Cn(Cr.none,[],[],0);class yw{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 yw(this.buffer,this.index)}}class Co{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Cr.none}toString(){let e=[];for(let n=0;n0));a=o[a+3]);return l}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let l=e,a=0;l=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ic(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?l.length:-1;e!=u;e+=n){let c=l[e],f=a[e]+o.from,d;if(!(!(s&gn.EnterBracketed&&c instanceof Cn&&(d=sc.get(c))&&!d.overlay&&d.bracketed&&r>=f&&r<=f+c.length)&&!HA(i,r,f,f+c.length))){if(c instanceof Co){if(s&gn.ExcludeBuffers)continue;let h=c.findChild(0,c.buffer.length,n,r-f,i);if(h>-1)return new oo(new zU(o,c,e,f),null,h)}else if(s&gn.IncludeAnonymous||!c.type.isAnonymous||vw(c)){let h;if(!(s&gn.IgnoreMounts)&&(h=sc.get(c))&&!h.overlay)return new ri(h.tree,f,e,o);let p=new ri(c,f,e,o);return s&gn.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?c.children.length-1:0,n,r,i,s)}}}if(s&gn.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))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)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&gn.IgnoreOverlays)&&(i=sc.get(this._tree))&&i.overlay){let s=e-this.from,o=r&gn.EnterBracketed&&i.bracketed;for(let{from:l,to:a}of i.overlay)if((n>0||o?l<=s:l=s:a>s))return new ri(i.tree,i.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}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Nk(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function py(t,e,n=e.length-1){for(let r=t;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}class zU{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class oo extends WA{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){super(),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:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new oo(this.context,this,s)}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)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&gn.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new oo(this.context,this,s)}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 oo(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 oo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new Cn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function VA(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;sn.from||o.to=e){let l=new ri(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Ic(l,e,n,!1))}}return i?VA(i):r}class gy{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~gn.EnterBracketed,e instanceof ri)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:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof ri?(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:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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&gn.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&gn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&gn.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 i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}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:i}=this;if(i){if(e>0){if(this.index-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let l=r._tree.children[s];if(this.mode&gn.IncludeAnonymous||l instanceof Co||!l.type.isAnonymous||vw(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=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i=0;s--){if(s<0)return py(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function vw(t){return t.children.some(e=>e instanceof Co||!e.type.isAnonymous||vw(e))}function HU(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=jA,reused:s=[],minRepeatType:o=r.types.length}=t,l=Array.isArray(n)?new yw(n,n.length):n,a=r.types,u=0,c=0;function f(x,S,T,E,A,I){let{id:_,start:P,end:N,size:D}=l,ee=c,ne=u;if(D<0)if(l.next(),D==-1){let O=s[_];T.push(O),E.push(P-x);return}else if(D==-3){u=_;return}else if(D==-4){c=_;return}else throw new RangeError(`Unrecognized record size: ${D}`);let ie=a[_],H,Y,R=P-x;if(N-P<=i&&(Y=b(l.pos-S,A))){let O=new Uint16Array(Y.size-Y.skip),L=l.pos-Y.size,F=O.length;for(;l.pos>L;)F=g(Y.start,O,F);H=new Co(O,N-Y.start,r),R=Y.start-x}else{let O=l.pos-D;l.next();let L=[],F=[],W=_>=o?_:-1,$=0,ue=N;for(;l.pos>O;)W>=0&&l.id==W&&l.size>=0?(l.end<=ue-i&&(p(L,F,P,$,l.end,ue,W,ee,ne),$=L.length,ue=l.end),l.next()):I>2500?d(P,O,L,F):f(P,O,L,F,W,I+1);if(W>=0&&$>0&&$-1&&$>0){let ce=h(ie,ne);H=ww(ie,L,F,0,L.length,0,N-P,ce,ce)}else H=m(ie,L,F,N-P,ee-N,ne)}T.push(H),E.push(R)}function d(x,S,T,E){let A=[],I=0,_=-1;for(;l.pos>S;){let{id:P,start:N,end:D,size:ee}=l;if(ee>4)l.next();else{if(_>-1&&N<_)break;_<0&&(_=D-i),A.push(P,N,D),I++,l.next()}}if(I){let P=new Uint16Array(I*4),N=A[A.length-2];for(let D=A.length-3,ee=0;D>=0;D-=3)P[ee++]=A[D],P[ee++]=A[D+1]-N,P[ee++]=A[D+2]-N,P[ee++]=ee;T.push(new Co(P,A[2]-N,r)),E.push(N-x)}}function h(x,S){return(T,E,A)=>{let I=0,_=T.length-1,P,N;if(_>=0&&(P=T[_])instanceof Cn){if(!_&&P.type==x&&P.length==A)return P;(N=P.prop(Ct.lookAhead))&&(I=E[_]+P.length+N)}return m(x,T,E,A,I,S)}}function p(x,S,T,E,A,I,_,P,N){let D=[],ee=[];for(;x.length>E;)D.push(x.pop()),ee.push(S.pop()+T-A);x.push(m(r.types[_],D,ee,I-A,P-I,N)),S.push(A-T)}function m(x,S,T,E,A,I,_){if(I){let P=[Ct.contextHash,I];_=_?[P].concat(_):[P]}if(A>25){let P=[Ct.lookAhead,A];_=_?[P].concat(_):[P]}return new Cn(x,S,T,E,_)}function b(x,S){let T=l.fork(),E=0,A=0,I=0,_=T.end-i,P={size:0,start:0,skip:0};e:for(let N=T.pos-x;T.pos>N;){let D=T.size;if(T.id==S&&D>=0){P.size=E,P.start=A,P.skip=I,I+=4,E+=4,T.next();continue}let ee=T.pos-D;if(D<0||ee=o?4:0,ie=T.start;for(T.next();T.pos>ee;){if(T.size<0)if(T.size==-3||T.size==-4)ne+=4;else break e;else T.id>=o&&(ne+=4);T.next()}A=ie,E+=D,I+=ne}return(S<0||E==x)&&(P.size=E,P.start=A,P.skip=I),P.size>4?P:void 0}function g(x,S,T){let{id:E,start:A,end:I,size:_}=l;if(l.next(),_>=0&&E4){let N=l.pos-(_-4);for(;l.pos>N;)T=g(x,S,T)}S[--T]=P,S[--T]=I-x,S[--T]=A-x,S[--T]=E}else _==-3?u=E:_==-4&&(c=E);return T}let y=[],w=[];for(;l.pos>0;)f(t.start||0,t.bufferStart||0,y,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:y.length?w[0]+y[0].length:0;return new Cn(a[t.topID],y.reverse(),w.reverse(),k)}const Lk=new WeakMap;function Nd(t,e){if(!t.isAnonymous||e instanceof Co||e.type!=t)return 1;let n=Lk.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Cn)){n=1;break}n+=Nd(t,r)}Lk.set(e,n)}return n}function ww(t,e,n,r,i,s,o,l,a){let u=0;for(let p=r;p=c)break;S+=T}if(w==k+1){if(S>c){let T=p[k];h(T.children,T.positions,0,T.children.length,m[k]+y);continue}f.push(p[k])}else{let T=m[w-1]+p[w-1].length-x;f.push(ww(t,p,m,k,w,x,T,null,a))}d.push(x+y-s)}}return h(e,n,r,i,0),(l||a)(f,d,o)}class nl{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new nl(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,u=0;;l++){let c=l=r)for(;o&&o.from=d.from||f<=d.to||u){let h=Math.max(d.from,a)-u,p=Math.min(d.to,f)-u;d=h>=p?null:new nl(h,p,d.tree,d.offset+u,l>0,!!c)}if(d&&i.push(d),o.to>f)break;o=snew dm(i.from,i.to)):[new dm(0,0)]:[new dm(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class WU{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)}}new Ct({perNode:!0});let VU=0;class Yr{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=VU++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Yr&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new Yr(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new Dh(e);return r=>r.modified.indexOf(n)>-1?r:Dh.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let UU=0;class Dh{constructor(e){this.name=e,this.instances=[],this.id=UU++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&KU(n,l.modified));if(r)return r;let i=[],s=new Yr(e.name,i,e,n);for(let l of n)l.instances.push(s);let o=XU(n);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(Dh.get(l,a));return s}}function KU(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function XU(t){let e=[[]];for(let n=0;nr.length-n.length)}function KA(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,l=i;for(let f=0;;){if(l=="..."&&f>0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let h=i[f++];if(f==i.length&&h=="!"){o=0;break}if(h!="/")throw new RangeError("Invalid path: "+i);l=i.slice(f)}let a=s.length-1,u=s[a];if(!u)throw new RangeError("Invalid path: "+i);let c=new Dc(r,o,a>0?s.slice(0,a):null);e[u]=c.sort(e[u])}}return XA.add(e)}const XA=new Ct({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new Dc(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class Dc{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=i;for(let l of s)for(let a of l.set){let u=n[a.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function GU(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function YU(t,e,n,r=0,i=t.length){let s=new qU(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class qU{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,i,s){let{type:o,from:l,to:a}=e;if(l>=r||a<=n)return;o.isTop&&(s=this.highlighters.filter(h=>!h.scope||h.scope(o)));let u=i,c=QU(e)||Dc.empty,f=GU(s,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,l),u),c.opaque)return;let d=e.tree&&e.tree.prop(Ct.mounted);if(d&&d.overlay){let h=e.node.enter(d.overlay[0].from+l,1),p=this.highlighters.filter(b=>!b.scope||b.scope(d.tree.type)),m=e.firstChild();for(let b=0,g=l;;b++){let y=b=w||!e.nextSibling())););if(!y||w>r)break;g=y.to+l,g>n&&(this.highlightRange(h.cursor(),Math.max(n,y.from+l),Math.min(r,g),"",p),this.startSpan(Math.min(r,g),u))}m&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}}function QU(t){let e=t.type.prop(XA);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const we=Yr.define,dd=we(),qs=we(),Fk=we(qs),Bk=we(qs),Qs=we(),hd=we(Qs),hm=we(Qs),Vi=we(),zo=we(Vi),Hi=we(),Wi=we(),my=we(),Tu=we(my),pd=we(),He={comment:dd,lineComment:we(dd),blockComment:we(dd),docComment:we(dd),name:qs,variableName:we(qs),typeName:Fk,tagName:we(Fk),propertyName:Bk,attributeName:we(Bk),className:we(qs),labelName:we(qs),namespace:we(qs),macroName:we(qs),literal:Qs,string:hd,docString:we(hd),character:we(hd),attributeValue:we(hd),number:hm,integer:we(hm),float:we(hm),bool:we(Qs),regexp:we(Qs),escape:we(Qs),color:we(Qs),url:we(Qs),keyword:Hi,self:we(Hi),null:we(Hi),atom:we(Hi),unit:we(Hi),modifier:we(Hi),operatorKeyword:we(Hi),controlKeyword:we(Hi),definitionKeyword:we(Hi),moduleKeyword:we(Hi),operator:Wi,derefOperator:we(Wi),arithmeticOperator:we(Wi),logicOperator:we(Wi),bitwiseOperator:we(Wi),compareOperator:we(Wi),updateOperator:we(Wi),definitionOperator:we(Wi),typeOperator:we(Wi),controlOperator:we(Wi),punctuation:my,separator:we(my),bracket:Tu,angleBracket:we(Tu),squareBracket:we(Tu),paren:we(Tu),brace:we(Tu),content:Vi,heading:zo,heading1:we(zo),heading2:we(zo),heading3:we(zo),heading4:we(zo),heading5:we(zo),heading6:we(zo),contentSeparator:we(Vi),list:we(Vi),quote:we(Vi),emphasis:we(Vi),strong:we(Vi),link:we(Vi),monospace:we(Vi),strikethrough:we(Vi),inserted:we(),deleted:we(),changed:we(),invalid:we(),meta:pd,documentMeta:we(pd),annotation:we(pd),processingInstruction:we(pd),definition:Yr.defineModifier("definition"),constant:Yr.defineModifier("constant"),function:Yr.defineModifier("function"),standard:Yr.defineModifier("standard"),local:Yr.defineModifier("local"),special:Yr.defineModifier("special")};for(let t in He){let e=He[t];e instanceof Yr&&(e.name=t)}GA([{tag:He.link,class:"tok-link"},{tag:He.heading,class:"tok-heading"},{tag:He.emphasis,class:"tok-emphasis"},{tag:He.strong,class:"tok-strong"},{tag:He.keyword,class:"tok-keyword"},{tag:He.atom,class:"tok-atom"},{tag:He.bool,class:"tok-bool"},{tag:He.url,class:"tok-url"},{tag:He.labelName,class:"tok-labelName"},{tag:He.inserted,class:"tok-inserted"},{tag:He.deleted,class:"tok-deleted"},{tag:He.literal,class:"tok-literal"},{tag:He.string,class:"tok-string"},{tag:He.number,class:"tok-number"},{tag:[He.regexp,He.escape,He.special(He.string)],class:"tok-string2"},{tag:He.variableName,class:"tok-variableName"},{tag:He.local(He.variableName),class:"tok-variableName tok-local"},{tag:He.definition(He.variableName),class:"tok-variableName tok-definition"},{tag:He.special(He.variableName),class:"tok-variableName2"},{tag:He.definition(He.propertyName),class:"tok-propertyName tok-definition"},{tag:He.typeName,class:"tok-typeName"},{tag:He.namespace,class:"tok-namespace"},{tag:He.className,class:"tok-className"},{tag:He.macroName,class:"tok-macroName"},{tag:He.propertyName,class:"tok-propertyName"},{tag:He.operator,class:"tok-operator"},{tag:He.comment,class:"tok-comment"},{tag:He.meta,class:"tok-meta"},{tag:He.invalid,class:"tok-invalid"},{tag:He.punctuation,class:"tok-punctuation"}]);var pm;const oa=new Ct;function JU(t){return Be.define({combine:t?e=>e.concat(t):void 0})}const ZU=new Ct;class Ei{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Nt.prototype.hasOwnProperty("tree")||Object.defineProperty(Nt.prototype,"tree",{get(){return ss(this)}}),this.parser=n,this.extension=[La.of(this),Nt.languageData.of((s,o,l)=>{let a=zk(s,o,l),u=a.type.prop(oa);if(!u)return[];let c=s.facet(u),f=a.type.prop(ZU);if(f){let d=a.resolve(o-a.from,l);for(let h of f)if(h.test(d,s)){let p=s.facet(h.facet);return h.type=="replace"?p:p.concat(c)}}return c})].concat(r)}isActiveAt(e,n,r=-1){return zk(e,n,r).type.prop(oa)==this.data}findRegions(e){let n=e.facet(La);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(oa)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(Ct.mounted);if(l){if(l.tree.prop(oa)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?n:void 0)]}),e.name)}configure(e,n){return new _h(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ss(t){let e=t.field(Ei.state,!1);return e?e.tree:Cn.empty}class e7{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=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Eu=null;class Nh{constructor(e,n,r=[],i,s,o,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Nh(e,n,[],Cn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new e7(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Cn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=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(nl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Eu;Eu=this;try{return e()}finally{Eu=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=$k(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,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=nl.applyChanges(r,a),i=Cn.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.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);ce.from&&(this.fragments=$k(this.fragments,i,s),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 UA{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=Eu;if(a){for(let u of i)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Cn(Cr.none,[],[],o-s)},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 Eu}}function $k(t,e,n){return nl.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Na{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 Na(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Nh.create(e.facet(La).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Na(r)}}Ei.state=as.define({create:Na.init,update(t,e){for(let n of e.effects)if(n.is(Ei.setState))return n.value;return e.startState.facet(La)!=e.state.facet(La)?Na.init(e.state):t.apply(e)}});let YA=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(YA=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const gm=typeof navigator<"u"&&(!((pm=navigator.scheduling)===null||pm===void 0)&&pm.isInputPending)?()=>navigator.scheduling.isInputPending():null,t7=oi.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(Ei.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Ei.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=YA(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,a=s.context.work(()=>gm&&gm()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ei.setState.of(new Na(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Jr(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()}}}),La=Be.define({combine(t){return t.length?t[0]:null},enables:t=>[Ei.state,t7,We.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class n7{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const r7=Be.define(),bw=Be.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 Lh(t){let e=t.facet(bw);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Fh(t,e){let n="",r=t.tabSize,i=t.facet(bw)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s=e?i7(t,n,e):null}class Ap{constructor(e,n={}){this.state=e,this.options=n,this.unit=Lh(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return bp(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const QA=new Ct;function i7(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.fromr.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return JA(r,t,n)}function JA(t,e,n){for(let r=t;r;r=r.next){let i=o7(r.node);if(i)return i(xw.create(e,n,r))}return 0}function s7(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function o7(t){let e=t.type.prop(QA);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Ct.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>c7(o,!0,1,void 0,s&&!s7(o)?i.from:void 0)}return t.parent==null?l7:null}function l7(){return 0}class xw extends Ap{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new xw(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(a7(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return JA(this.context.next,this.base,this.pos)}}function a7(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function u7(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function c7(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==t.pos+o,a=u7(t);return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}function jk({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const f7=new Ct;function d7(t){let e=t.firstChild,n=t.lastChild;return e&&e.tol.prop(oa)==o.data:o?l=>l==o:void 0,this.style=GA(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new xo(r):null,this.themeType=n.themeType}static define(e,n){return new Mp(e,n||{})}}const yy=Be.define(),h7=Be.define({combine(t){return t.length?[t[0]]:null}});function mm(t){let e=t.facet(yy);return e.length?e:t.facet(h7)}function Hk(t,e){let n=[g7],r;return t instanceof Mp&&(t.module&&n.push(We.styleModule.of(t.module)),r=t.themeType),r?n.push(yy.computeN([We.darkTheme],i=>i.facet(We.darkTheme)==(r=="dark")?[t]:[])):n.push(yy.of(t)),n}class p7{constructor(e){this.markCache=Object.create(null),this.tree=ss(e.state),this.decorations=this.buildDeco(e,mm(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=ss(e.state),r=mm(e.state),i=r!=mm(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return Ht.none;let r=new Oa;for(let{from:i,to:s}of e.visibleRanges)YU(this.tree,n,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=Ht.mark({class:a})))},i,s);return r.finish()}}const g7=nw.high(oi.fromClass(p7,{decorations:t=>t.decorations})),m7=1e4,y7="()[]{}",v7=new Ct;function vy(t,e,n){let r=t.prop(e<0?Ct.openedBy:Ct.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function wy(t){let e=t.type.prop(v7);return e?e(t.node):t}function la(t,e,n,r={}){let i=r.maxScanDistance||m7,s=r.brackets||y7,o=ss(t),l=o.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=vy(a.type,n,s);if(u&&a.from0?e>=c.from&&ec.from&&e<=c.to))return w7(t,e,n,a,c,u,s)}}return b7(t,e,n,o,l.type,i,s)}function w7(t,e,n,r,i,s,o){let l=r.parent,a={from:i.from,to:i.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&&s.indexOf(c.type.name)>-1&&c.from0)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<=s;){let h=c.value;n<0&&(d+=h.length);let p=e+d*n;for(let m=n>0?0:h.length-1,b=n>0?h.length:-1;m!=b;m+=n){let g=o.indexOf(h[m]);if(!(g<0||r.resolveInner(p+m,1).type!=i))if(g%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:p+m,to:p+m+1},matched:g>>1==a>>1};f--}}n>0&&(d+=h.length)}return c.done?{start:u,matched:!1}:null}const x7=Object.create(null),Wk=[Cr.none],Vk=[],Uk=Object.create(null),k7=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"]])k7[t]=S7(x7,e);function ym(t,e){Vk.indexOf(t)>-1||(Vk.push(t),console.warn(e))}function S7(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let u of l.split(".")){let c=t[u]||He[u];c?typeof c=="function"?a.length?a=a.map(c):ym(u,`Modifier ${u} used at start of tag`):a.length?ym(u,`Tag ${u} used as modifier`):a=Array.isArray(c)?c:[c]:ym(u,`Unknown highlighting tag ${u}`)}for(let u of a)n.push(u)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=Uk[i];if(s)return s.id;let o=Uk[i]=Cr.define({id:Wk.length,name:r,props:[KA({[r]:n})]});return Wk.push(o),o.id}mn.RTL,mn.LTR;const C7=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Sw(t.state,n.from);return r.line?T7(t):r.block?A7(t):!1};function kw(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const T7=kw(O7,0),E7=kw(ZA,0),A7=kw((t,e)=>ZA(t,e,R7(e)),0);function Sw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Au=50;function M7(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-Au,r),o=t.sliceDoc(i,i+Au),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-e.length,u)==e&&o.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let c,f;i-r<=2*Au?c=f=t.sliceDoc(r,i):(c=t.sliceDoc(r,r+Au),f=t.sliceDoc(i-Au,i));let d=/^\s*/.exec(c)[0].length,h=/\s*$/.exec(f)[0].length,p=f.length-h-n.length;return c.slice(d,d+e.length)==e&&f.slice(p,p+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(c.charAt(d+e.length))?1:0},close:{pos:i-h-n.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function R7(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function ZA(t,e,n=e.selection.ranges){let r=n.map(s=>Sw(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>M7(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,l;oi&&(s==o||o>f.from)){i=f.from;let d=/^\s*/.exec(f.text)[0].length,h=d==f.length,p=f.text.slice(d,d+u.length)==u?d:-1;ds.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of r)(f||!c)&&s.push({from:l.from+u,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let u=o.from+l,c=u+a.length;o.text[c-o.from]==" "&&c++,s.push({from:u,to:c})}return{changes:s}}return null}const by=Ro.define(),P7=Ro.define(),I7=Be.define(),eM=Be.define({combine(t){return jE(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),tM=as.define({create(){return Zi.empty},update(t,e){let n=e.state.facet(eM),r=e.annotation(by);if(r){let a=br.fromTransaction(e,r.selection),u=r.side,c=u==0?t.undone:t.done;return a?c=Bh(c,c.length,n.minDepth,a):c=iM(c,e.startState.selection),new Zi(u==0?r.rest:c,u==0?c:r.rest)}let i=e.annotation(P7);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Dn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=br.fromTransaction(e),o=e.annotation(Dn.time),l=e.annotation(Dn.userEvent);return s?t=t.addChanges(s,o,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,n.newGroupDelay)),(i=="full"||i=="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 Zi(t.done.map(br.fromJSON),t.undone.map(br.fromJSON))}});function D7(t={}){return[tM,eM.of(t),We.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?nM:e.inputType=="historyRedo"?xy:null;return r?(e.preventDefault(),r(n)):!1}})]}function Rp(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(tM,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const nM=Rp(0,!1),xy=Rp(1,!1),_7=Rp(0,!0),N7=Rp(1,!0);class br{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new br(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(i=>i.toJSON())}}static fromJSON(e){return new br(e.changes&&On.fromJSON(e.changes),[],e.mapped&&is.fromJSON(e.mapped),e.startSelection&&le.fromJSON(e.startSelection),e.selectionsAfter.map(le.fromJSON))}static fromTransaction(e,n){let r=ei;for(let i of e.startState.facet(I7)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new br(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ei)}static selection(e){return new br(void 0,ei,void 0,void 0,e)}}function Bh(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function L7(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a=u&&o<=c&&(r=!0)}}),r}function F7(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function rM(t,e){return t.length?e.length?t.concat(e):t:e}const ei=[],B7=200;function iM(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-B7));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Bh(t,t.length-1,1e9,n.setSelAfter(r)))}else return[br.selection([e])]}function z7(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 vm(t,e){if(!t.length)return t;let n=t.length,r=ei;for(;n;){let i=$7(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[br.selection(r)]:ei}function $7(t,e,n){let r=rM(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ei,n);if(!t.changes)return br.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new br(i,Gt.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const j7=/^(input\.type|delete)($|\.)/;class Zi{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Zi(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||j7.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Op(n,e))}function rr(t){return t.textDirectionAt(t.state.selection.main.head)==mn.LTR}const oM=t=>sM(t,!rr(t)),lM=t=>sM(t,rr(t));function aM(t,e){return _i(t,n=>n.empty?t.moveByGroup(n,e):Op(n,e))}const W7=t=>aM(t,!rr(t)),V7=t=>aM(t,rr(t));function U7(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 Pp(t,e,n){let r=ss(t).resolveInner(e.head),i=n?Ct.closedBy:Ct.openedBy;for(let a=e.head;;){let u=n?r.childAfter(a):r.childBefore(a);if(!u)break;U7(t,u,i)?r=u:a=n?u.to:u.from}let s=r.type.prop(i),o,l;return s&&(o=n?la(t,r.from,1):la(t,r.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?r.to:r.from,le.cursor(l,n?-1:1)}const K7=t=>_i(t,e=>Pp(t.state,e,!rr(t))),X7=t=>_i(t,e=>Pp(t.state,e,rr(t)));function uM(t,e){return _i(t,n=>{if(!n.empty)return Op(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const cM=t=>uM(t,!1),fM=t=>uM(t,!0);function dM(t){let e=t.scrollDOM.clientHeighto.empty?t.moveVertically(o,e,n.height):Op(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>a&&o.bottomhM(t,!1),ky=t=>hM(t,!0);function Oo(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=le.cursor(r.from+s))}return i}const G7=t=>_i(t,e=>Oo(t,e,!0)),Y7=t=>_i(t,e=>Oo(t,e,!1)),q7=t=>_i(t,e=>Oo(t,e,!rr(t))),Q7=t=>_i(t,e=>Oo(t,e,rr(t))),J7=t=>_i(t,e=>le.cursor(t.lineBlockAt(e.head).from,1)),Z7=t=>_i(t,e=>le.cursor(t.lineBlockAt(e.head).to,-1));function eK(t,e,n){let r=!1,i=Ya(t.selection,s=>{let o=la(t,s.head,-1)||la(t,s.head,1)||s.head>0&&la(t,s.head-1,1)||s.headeK(t,e);function li(t,e,n){let r=Ya(t.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=le.range(i.head,i.anchor));let s=n(i);return le.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(Di(t.state,r)),!0)}function pM(t,e){return li(t,e,n=>t.moveByChar(n,e))}const gM=t=>pM(t,!rr(t)),mM=t=>pM(t,rr(t));function yM(t,e){return li(t,e,n=>t.moveByGroup(n,e))}const nK=t=>yM(t,!rr(t)),rK=t=>yM(t,rr(t)),iK=t=>{let e=!rr(t);return li(t,e,n=>Pp(t.state,n,e))},sK=t=>{let e=rr(t);return li(t,e,n=>Pp(t.state,n,e))};function vM(t,e){return li(t,e,n=>t.moveVertically(n,e))}const wM=t=>vM(t,!1),bM=t=>vM(t,!0);function xM(t,e){return li(t,e,n=>t.moveVertically(n,e,dM(t).height))}const Xk=t=>xM(t,!1),Gk=t=>xM(t,!0),oK=t=>li(t,!0,e=>Oo(t,e,!0)),lK=t=>li(t,!1,e=>Oo(t,e,!1)),aK=t=>{let e=!rr(t);return li(t,e,n=>Oo(t,n,e))},uK=t=>{let e=rr(t);return li(t,e,n=>Oo(t,n,e))},cK=t=>li(t,!1,e=>le.cursor(t.lineBlockAt(e.head).from)),fK=t=>li(t,!0,e=>le.cursor(t.lineBlockAt(e.head).to)),Yk=({state:t,dispatch:e})=>(e(Di(t,{anchor:0})),!0),qk=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.doc.length})),!0),Qk=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.selection.main.anchor,head:0})),!0),Jk=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),dK=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),hK=({state:t,dispatch:e})=>{let n=Ip(t).map(({from:r,to:i})=>le.undirectionalRange(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:le.create(n),userEvent:"select"})),!0},pK=({state:t,dispatch:e})=>{let n=Ya(t.selection,r=>{let i=ss(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&o.next)return le.undirectionalRange(l.from,l.to)}return r});return n.eq(t.selection)?!1:(e(Di(t,n)),!0)};function kM(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to0)for(let l=s;;){let a=t.moveVertically(l,e);if(a.heado.to){i.some(u=>u.head==a.head)||i.push(a);break}else{if(a.head==l.head)break;l=a}}}return i.length==r.ranges.length?!1:(t.dispatch(Di(n,le.create(i,i.length-1))),!0)}const gK=t=>kM(t,!1),mK=t=>kM(t,!0),yK=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=le.create([n.main]):n.main.empty||(r=le.create([le.cursor(n.main.head)])),r?(e(Di(t,r)),!0):!1};function Zc(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);ao&&(n="delete.forward",a=gd(t,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=gd(t,o,!1),l=gd(t,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:le.cursor(o,oi(t)))r.between(e,e,(i,s)=>{ie&&(e=n?s:i)});return e}const SM=(t,e,n)=>Zc(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),l,a;if(n&&!e&&i>o.from&&iSM(t,!1,!0),CM=t=>SM(t,!0,!1),TM=(t,e)=>Zc(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=tr(s.text,r-s.from,e)+s.from,u=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),c=o(u);if(l!=null&&c!=l)break;(u!=" "||r!=n.head)&&(l=c),r=a}return r}),EM=t=>TM(t,!1),vK=t=>TM(t,!0),wK=t=>Zc(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headZc(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),xK=t=>Zc(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Pt.of(["",""])},range:le.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},SK=({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 i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:tr(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:tr(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(o,i))},range:le.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Ip(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function AM(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of Ip(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let a of s.ranges)i.push(le.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let a of s.ranges)i.push(le.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:le.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const CK=({state:t,dispatch:e})=>AM(t,e,!1),TK=({state:t,dispatch:e})=>AM(t,e,!0);function MM(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of Ip(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const EK=({state:t,dispatch:e})=>MM(t,e,!1),AK=({state:t,dispatch:e})=>MM(t,e,!0),MK=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Ip(e).map(({from:i,to:s})=>(i>0?i--:s{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),l=t.coordsAtPos(i.head,i.assoc||1);l&&(s=o.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function RK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ss(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(Ct.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const Zk=RM(!1),OK=RM(!0);function RM(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!t&&s==o&&RK(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new Ap(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=qA(u,s);for(c==null&&(c=bp(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));ol.from&&s{let i=[];for(let o=r.from;o<=r.to;){let l=t.doc.lineAt(o);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),o=l.to+1}let s=t.changes(i);return{changes:i,range:le.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const PK=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Ap(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=Cw(t,(s,o,l)=>{let a=qA(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let u=/^\s*/.exec(s.text)[0],c=Fh(t,a);(u!=c||l.fromt.readOnly?!1:(e(t.update(Cw(t,(n,r)=>{r.push({from:n.from,insert:t.facet(bw)})}),{userEvent:"input.indent"})),!0),PM=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Cw(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=bp(i,t.tabSize),o=0,l=Fh(t,Math.max(0,s-Lh(t)));for(;o(t.setTabFocusMode(),!0),DK=[{key:"Ctrl-b",run:oM,shift:gM,preventDefault:!0},{key:"Ctrl-f",run:lM,shift:mM},{key:"Ctrl-p",run:cM,shift:wM},{key:"Ctrl-n",run:fM,shift:bM},{key:"Ctrl-a",run:J7,shift:cK},{key:"Ctrl-e",run:Z7,shift:fK},{key:"Ctrl-d",run:CM},{key:"Ctrl-h",run:Sy},{key:"Ctrl-k",run:wK},{key:"Ctrl-Alt-h",run:EM},{key:"Ctrl-o",run:kK},{key:"Ctrl-t",run:SK},{key:"Ctrl-v",run:ky}],_K=[{key:"ArrowLeft",run:oM,shift:gM,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:W7,shift:nK,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:q7,shift:aK,preventDefault:!0},{key:"ArrowRight",run:lM,shift:mM,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:V7,shift:rK,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Q7,shift:uK,preventDefault:!0},{key:"ArrowUp",run:cM,shift:wM,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Yk,shift:Qk},{mac:"Ctrl-ArrowUp",run:Kk,shift:Xk},{key:"ArrowDown",run:fM,shift:bM,preventDefault:!0},{mac:"Cmd-ArrowDown",run:qk,shift:Jk},{mac:"Ctrl-ArrowDown",run:ky,shift:Gk},{key:"PageUp",run:Kk,shift:Xk},{key:"PageDown",run:ky,shift:Gk},{key:"Home",run:Y7,shift:lK,preventDefault:!0},{key:"Mod-Home",run:Yk,shift:Qk},{key:"End",run:G7,shift:oK,preventDefault:!0},{key:"Mod-End",run:qk,shift:Jk},{key:"Enter",run:Zk,shift:Zk},{key:"Mod-a",run:dK},{key:"Backspace",run:Sy,shift:Sy,preventDefault:!0},{key:"Delete",run:CM,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:EM,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:vK,preventDefault:!0},{mac:"Mod-Backspace",run:bK,preventDefault:!0},{mac:"Mod-Delete",run:xK,preventDefault:!0}].concat(DK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),NK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:K7,shift:iK},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:X7,shift:sK},{key:"Alt-ArrowUp",run:CK},{key:"Shift-Alt-ArrowUp",run:EK},{key:"Alt-ArrowDown",run:TK},{key:"Shift-Alt-ArrowDown",run:AK},{key:"Mod-Alt-ArrowUp",run:gK},{key:"Mod-Alt-ArrowDown",run:mK},{key:"Escape",run:yK},{key:"Mod-Enter",run:OK},{key:"Alt-l",mac:"Ctrl-l",run:hK},{key:"Mod-i",run:pK,preventDefault:!0},{key:"Mod-[",run:PM},{key:"Mod-]",run:OM},{key:"Mod-Alt-\\",run:PK},{key:"Shift-Mod-k",run:MK},{key:"Shift-Mod-\\",run:tK},{key:"Mod-/",run:C7},{key:"Alt-A",mac:"Ctrl-A",run:E7},{key:"Ctrl-m",mac:"Shift-Alt-m",run:IK}].concat(_K),LK={key:"Tab",run:OM,shift:PM};var eS={};class zh{constructor(e,n,r,i,s,o,l,a,u,c=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=u,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new zh(e,[],n,r,r,0,[],0,i?new tS(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(i,u)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==r)return;if(this.buffer[o-2]>=n){this.buffer[o-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>r;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;this.pos=i;let l=o.stateFlag(s,1);!l&&(i>r||n<=o.maxNode)&&(this.reducePos=i),this.pushState(s,l?r:Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(n&&e.buffer[n-4]==0&&(n-=4);n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new zh(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new FK(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;sa&1&&l==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,u=this.stack.length-l*3;if(u>=0&&e.getGoto(this.stack[u],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n0&&this.emitLookAhead()}}class tS{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class FK{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class $h{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new $h(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}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]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $h(this.stack,this.pos,this.index)}}function md(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Ld{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const nS=new Ld;class BK{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=nS,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;sr.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=nS,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class wa{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;zK(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}wa.prototype.contextual=wa.prototype.fallback=wa.prototype.extend=!1;wa.prototype.fallback=wa.prototype.extend=!1;function zK(t,e,n,r,i,s){let o=0,l=1<0){let p=t[h];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||$K(p,e.token.value,i,s))){e.acceptToken(p);break}}let c=e.next,f=0,d=t[o+2];if(e.next<0&&d>f&&t[u+d*3-3]==65535){o=t[u+d*3-1];continue e}for(;f>1,p=u+h+(h<<1),m=t[p],b=t[p+1]||65536;if(c=b)f=h+1;else{o=t[p+2],e.advance();continue e}}break}}function rS(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function $K(t,e,n,r){let i=rS(n,r,e);return i<0||rS(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class jK{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?iS(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?iS(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof Cn){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class HK{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ld)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let u=0;uf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let d=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!c.extend&&(r=f,n>d))break}}for(;this.actions.length>n;)this.actions.pop();return a&&e.setLookAhead(a),!r&&e.pos==this.stream.end&&(r=new Ld,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Ld,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;se.bufferLength*4?new jK(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)r.push(l);else{if(this.advanceStack(l,r,e))continue;{i||(i=[],s=[]),i.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=i&&UK(i);if(o)return Or&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Or&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return Or&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,l)=>l.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,c=u?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(d>-1&&f.length&&(!u||(f.prop(Ct.contextHash)||0)==c))return e.useNode(f,d),Or&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof Cn)||f.children.length==0||f.positions[0]>0)break;let h=f.children[0];if(h instanceof Cn&&f.positions[0]==0)f=h;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),Or&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let u=0;ui?n.push(p):r.push(p)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return sS(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Or&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),d=c;for(let h=0;h<10&&f.forceReduce()&&(Or&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));h++)Or&&(d=this.stackID(f)+" -> ");for(let h of l.recoverByInsert(a))Or&&console.log(c+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,r);this.stream.end>l.pos?(u==l.pos&&(u++,a=0),l.recoverByDelete(a,u),Or&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),sS(l,r)):(!i||i.scoree.topRules[l][1]),i=[];for(let l=0;l=0)s(c,a,l[u++]);else{let f=l[u+-c];for(let d=-c;d>0;d--)s(l[u++],a,f);u++}}}this.nodeSet=new mw(n.map((l,a)=>Cr.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:i[a],top:r.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=jA;let o=md(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new wa(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new WK(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],l=o&1,a=i[s++];if(l&&r)return a;for(let u=s+(o>>1);s0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vs(this.data,s+2);else break;i=n(vs(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=vs(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(jh.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=oS(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;sr)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const KK=KA({String:He.string,Number:He.number,"True False":He.bool,PropertyName:He.propertyName,Null:He.null,", :":He.separator,"[ ]":He.squareBracket,"{ }":He.brace}),XK=jh.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[KK],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),GK=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=YK(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function YK(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const qK=_h.define({name:"json",parser:XK.configure({props:[QA.add({Object:jk({except:/^\s*\}/}),Array:jk({except:/^\s*\]/})}),f7.add({"Object Array":d7})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function lS(){return new n7(qK)}class aS{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Xo{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(es).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((h,p)=>h.from-p.from||h.to-p.to),o=new Oa,l=[],a=0,u=r.doc.iter(),c=0,f=r.doc.length;for(let h=0;;){let p=h==s.length?null:s[h];if(!p&&!l.length)break;let m,b;if(l.length)m=a,b=l.reduce((w,k)=>Math.min(w,k.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;b=p.to,l.push(p),h++}for(;hw.from||w.to==m))l.push(w),h++,b=Math.min(w.to,b);else{b=Math.min(w.from,b);break}}b=Math.min(b,f);let g=!1;if(l.some(w=>w.from==m&&(w.to==b||b==f))&&(g=m==b,!g&&b-m<10)){let w=m-(c+u.value.length);w>0&&(u.next(w),c=m);for(let k=m;;){if(k>=b){g=!0;break}if(!u.lineBreak&&c+u.value.length>k)break;k=c+u.value.length,c+=u.value.length,u.next()}}let y=cX(l);if(g)o.add(m,m,Ht.widget({widget:new oX(y),diagnostics:l.slice()}));else{let w=l.reduce((k,x)=>x.markClass?k+" "+x.markClass:k,"");o.add(m,b,Ht.mark({class:"cm-lintRange cm-lintRange-"+y+w,diagnostics:l.slice(),inclusiveEnd:l.some(k=>k.to>b)}))}if(a=b,a==f)break;for(let w=0;w{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new aS(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new aS(r.from,s,r.diagnostic)}}),r}function QK(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(es).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(Tw))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function JK(t,e){return t.field(Ai,!1)?e:e.concat(Gt.appendConfig.of(LM))}function ZK(t,e){return{effects:JK(t,[Tw.of(e)])}}const Tw=Gt.define(),IM=Gt.define(),DM=Gt.define(),Ai=as.define({create(){return new Xo(Ht.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=Fa(n,t.selected.diagnostic,s)||Fa(n,null,s)}!n.size&&i&&e.state.facet(es).autoPanel&&(i=null),t=new Xo(n,i,r)}for(let n of e.effects)if(n.is(Tw)){let r=e.state.facet(es).autoPanel?n.value.length?Hh.open:null:t.panel;t=Xo.init(n.value,r,e.state)}else n.is(IM)?t=new Xo(t.diagnostics,n.value?Hh.open:null,t.selected):n.is(DM)&&(t=new Xo(t.diagnostics,t.panel,n.value));return t},provide:t=>[hy.from(t,e=>e.panel),We.decorations.from(t,e=>e.diagnostics)]}),eX=Ht.mark({class:"cm-lintRange cm-lintRange-active"});function tX(t,e,n){let{diagnostics:r}=t.state.field(Ai),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,u,{spec:c})=>{if(e>=a&&e<=u&&(a==u||(e>a||n>0)&&(eNM(t,n,!1)))}const uS=t=>{let e=t.state.field(Ai,!1);return!e||!e.panel?!1:(t.dispatch({effects:IM.of(!1)}),!0)},rX=oi.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(es);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let t=Date.now();if(tPromise.resolve(r(this.view))),r=>{this.view.state.doc==e.doc&&this.view.dispatch(ZK(this.view.state,r.reduce((i,s)=>i.concat(s))))},r=>{Jr(this.view.state,r)})}}update(t){let e=t.state.facet(es);(t.docChanged||e!=t.startState.facet(es)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function iX(t,e,n){let r=[],i=-1;for(let s of t)s.then(o=>{r.push(o),clearTimeout(i),r.length==t.length?e(r):i=setTimeout(()=>e(r),200)},n)}const es=Be.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...jE(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:cS,tooltipFilter:cS,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function cS(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function sX(t,e={}){return[es.of({source:t,config:e}),rX,LM]}function _M(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;rs.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function NM(t,e,n){var r;let i=n?_M(e.actions):[];return Gi("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Gi("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=h=>{if(h.preventDefault(),l)return;l=!0;let p=Fa(t.state.field(Ai).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:u}=s,c=i[o]?u.indexOf(i[o]):-1,f=c<0?u:[u.slice(0,c),Gi("u",u.slice(c,c+1)),u.slice(c+1)],d=s.markClass?" "+s.markClass:"";return Gi("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:a,onmousedown:a,"aria-label":` Action: ${u}${c<0?"":` (access key "${i[o]})"`}.`},f)}),e.source&&Gi("div",{class:"cm-diagnosticSource"},e.source))}class oX extends Ga{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Gi("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class fS{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=NM(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Hh{constructor(e){this.view=e,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)uS(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=_M(s.actions);for(let l=0;l{for(let s=0;suS(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ai).selected;if(!e)return-1;for(let n=0;n{for(let c of u.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,d;for(let h=r;hr&&(this.items.splice(r,f-r),i=!0)),n&&d.diagnostic==n.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),s=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),r++}});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let u=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ai),r=Fa(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:DM.of(r)})}static open(e){return new Hh(e)}}function lX(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function yd(t){return lX(``,'width="6" height="3"')}const aX=We.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:yd("#f11")},".cm-lintRange-warning":{backgroundImage:yd("orange")},".cm-lintRange-info":{backgroundImage:yd("#999")},".cm-lintRange-hint":{backgroundImage:yd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function uX(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function cX(t){let e="hint",n=1;for(let r of t){let i=uX(r.severity);i>n&&(n=i,e=r.severity)}return e}const fX=_U(tX,{hideOn:QK}),LM=[Ai,We.decorations.compute([Ai],t=>{let{selected:e,panel:n}=t.field(Ai);return!e||!n||e.from==e.to?Ht.none:Ht.set([eX.range(e.from,e.to)])}),fX,aX],dX=512*1024,dS=512*1024,FM=2e6;function hX(t,e){if(t.length<=e)return t;const n=t.lastIndexOf(` +`,e);return n>e*.5?t.slice(0,n):t.slice(0,e)}const pX=t=>t.state.doc.length>dX?[]:GK()(t);function hS(t){return Mp.define([{tag:He.propertyName,color:t?"#7dd3fc":"#0369a1"},{tag:He.string,color:t?"#86efac":"#15803d"},{tag:He.number,color:t?"#fcd34d":"#b45309"},{tag:He.bool,color:t?"#d8b4fe":"#7e22ce"},{tag:He.null,color:t?"#a1a1aa":"#71717a"}])}const gX=We.theme({"&":{height:"100%",fontSize:"13px",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.5rem",overflow:"auto"},".cm-gutters":{display:"none"},".cm-activeLine":{backgroundColor:"transparent"},".cm-content":{caretColor:"currentColor",fontFamily:"inherit",letterSpacing:"-0.025em"},".cm-placeholder":{color:"var(--color-muted-foreground)"}});function BM({value:t,onChange:e,editable:n,dark:r,placeholder:i,testId:s="json-editor",className:o,onReady:l}){const a=v.useRef(null),u=v.useRef(null),c=v.useRef(e);c.current=e;const f=v.useRef(r),d=v.useRef(null),h=v.useRef(null),p=v.useRef(null),m=n??e!==void 0,b=v.useRef(m),g=t.length>dS,y=v.useRef(g),w=!m&&t.length>FM,k=w?hX(t,dS):t,x=v.useRef(!1),S=v.useCallback((T,E)=>T?[We.updateListener.of(A=>{var I;A.docChanged&&!x.current&&((I=c.current)==null||I.call(c,A.state.doc.toString()))}),...E?[]:[sX(pX,{delay:300})]]:[Nt.readOnly.of(!0),We.editable.of(!1)],[]);return v.useEffect(()=>{const T=a.current;if(!T)return;const E=new tl,A=new tl,I=new tl,_=Nt.create({doc:k,extensions:[I.of(g?[]:lS()),We.lineWrapping,D7(),FA.of([...NK,...H7,LK]),gX,E.of(Hk(hS(r))),A.of(S(m,g)),...i?[TU(i)]:[]]}),P=new We({state:_,parent:T});return d.current=E,h.current=A,p.current=I,l==null||l(P),u.current=P,()=>{P.destroy(),u.current=null}},[]),v.useEffect(()=>{const T=u.current;if(!T)return;const E=p.current,A=h.current,I=[];g!==y.current&&(y.current=g,E&&I.push(E.reconfigure(g?[]:lS())),A&&I.push(A.reconfigure(S(m,g))));const _=T.state.doc.toString();if(!(_===k&&I.length===0)){x.current=!0;try{T.dispatch({..._!==k?{changes:{from:0,to:T.state.doc.length,insert:k}}:{},...I.length>0?{effects:I}:{}})}finally{x.current=!1}}},[k,g,m,S]),v.useEffect(()=>{const T=u.current,E=h.current;!T||!E||m!==b.current&&(b.current=m,T.dispatch({effects:E.reconfigure(S(m,g))}))},[m,g,S]),v.useEffect(()=>{const T=u.current;if(!T||r===f.current)return;f.current=r;const E=d.current;E&&T.dispatch({effects:E.reconfigure(Hk(hS(r)))})},[r]),M.jsxs("div",{"data-testid":s,className:Ci("flex min-h-0 flex-1 flex-col overflow-hidden font-mono",o),children:[w?M.jsx("div",{"data-testid":"large-output-preview-banner",role:"status",className:"border-b border-border bg-muted/40 px-5 py-1.5 font-sans text-xs text-muted-foreground",children:"Showing first 512 KB preview in editor — Copy and Download include the full output"}):null,M.jsx("div",{ref:a,className:"min-h-0 flex-1 overflow-hidden px-5 py-4"})]})}function zM({title:t,meta:e,actions:n,status:r,children:i}){return M.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[M.jsxs("div",{className:"flex min-h-[42px] flex-shrink-0 flex-wrap items-center justify-between gap-3 border-b border-border px-3 py-2 pl-5 max-md:gap-2 md:h-12 md:py-0",children:[M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsx("span",{className:"font-mono text-[11px] font-semibold tracking-[0.18em] text-muted-foreground",children:t}),e?M.jsx("span",{"data-testid":"pane-meta",className:"text-xs tabular-nums text-muted-foreground/70",children:e}):null]}),M.jsx("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5 max-md:gap-1",children:n})]}),M.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i}),r?M.jsxs("div",{"data-testid":"pane-status",className:r.kind==="error"?"flex-shrink-0 px-3.5 pb-2 text-xs text-destructive":"flex-shrink-0 whitespace-pre-line px-3.5 pb-2 text-xs text-muted-foreground",role:"status",children:[r.message,r.action]}):null]})}const Jo="inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[13px] font-medium text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:size-3.5";var Cy={exports:{}};(function(t,e){(function(){var n="We could not detect the separator.",r="Empty CSV. Please provide something.",i="Could not detect header. Ensure first row cotains your column headers.",s=[",",";"," "],o=!0,l={",":"comma",";":"semicolon"," ":"tab","|":"pipe"};function a(d){var h={},p;return s.forEach(function(m,b){var g=new RegExp(m,"g");h[m]=(d.match(g)||[]).length,p=!p||h[m]>h[p]?m:p}),p}function u(d){for(var h={},p=0;p=0;p--){var m=d[p];h[m]>0&&(m=m+"__"+h[m]--),b.unshift(m)}return b}function c(d,h){if(h||(h={}),d.length==0)throw r;var p=h.separator||a(d);if(!p)throw n;var m=[];try{o=h.trim!==!1;var m=f.parse(d,l[p])}catch(ie){var b=d.lastIndexOf(` +`,ie.offset),g=d.indexOf(` +`,ie.offset),y=d.substring(b>=-1?b:0,g>-1?g:d.length);throw ie.message+" On line "+ie.line+" and column "+ie.column+`. +`+y}if(h.transpose){for(var w=0,k=0;kw&&(w=m[k].length);for(var x=new Array(w),S=0;Sy&&(y=g,w=[]),w.push(R))}function x(){var R,O,L,F;return L=g,F=g,R=function(W){return ee=","}()?"":null,R!==null?(O=A(),O!==null?R=[R,O]:(R=null,g=F)):(R=null,g=F),R!==null&&(R=function(W,$){return $}(L,R[1])),R===null&&(g=L),R}function S(){var R,O,L,F;return L=g,F=g,R=function(W){return ee=";"}()?"":null,R!==null?(O=A(),O!==null?R=[R,O]:(R=null,g=F)):(R=null,g=F),R!==null&&(R=function(W,$){return $}(L,R[1])),R===null&&(g=L),R}function T(){var R,O,L,F;return L=g,F=g,R=function(W){return ee="|"}()?"":null,R!==null?(O=A(),O!==null?R=[R,O]:(R=null,g=F)):(R=null,g=F),R!==null&&(R=function(W,$){return $}(L,R[1])),R===null&&(g=L),R}function E(){var R,O,L,F;return L=g,F=g,R=function(W){return ee=" "}()?"":null,R!==null?(O=A(),O!==null?R=[R,O]:(R=null,g=F)):(R=null,g=F),R!==null&&(R=function(W,$){return $}(L,R[1])),R===null&&(g=L),R}function A(){var R,O,L,F,W,$,ue,ce,be;for($=g,ue=g,R=[],/^[\n\r]/.test(p.charAt(g))?(O=p.charAt(g),g++):(O=null,k("[\\n\\r]"));O!==null;)R.push(O),/^[\n\r]/.test(p.charAt(g))?(O=p.charAt(g),g++):(O=null,k("[\\n\\r]"));if(R!==null)if(O=I(),O!==null){if(L=[],ce=g,be=g,/^[\n\r]/.test(p.charAt(g))?(W=p.charAt(g),g++):(W=null,k("[\\n\\r]")),W!==null)for(F=[];W!==null;)F.push(W),/^[\n\r]/.test(p.charAt(g))?(W=p.charAt(g),g++):(W=null,k("[\\n\\r]"));else F=null;for(F!==null?(W=I(),W!==null?F=[F,W]:(F=null,g=be)):(F=null,g=be),F!==null&&(F=function(Ge,$e){return $e}(ce,F[1])),F===null&&(g=ce);F!==null;){if(L.push(F),ce=g,be=g,/^[\n\r]/.test(p.charAt(g))?(W=p.charAt(g),g++):(W=null,k("[\\n\\r]")),W!==null)for(F=[];W!==null;)F.push(W),/^[\n\r]/.test(p.charAt(g))?(W=p.charAt(g),g++):(W=null,k("[\\n\\r]"));else F=null;F!==null?(W=I(),W!==null?F=[F,W]:(F=null,g=be)):(F=null,g=be),F!==null&&(F=function(Ge,$e){return $e}(ce,F[1])),F===null&&(g=ce)}if(L!==null){for(F=[],/^[\n\r]/.test(p.charAt(g))?(W=p.charAt(g),g++):(W=null,k("[\\n\\r]"));W!==null;)F.push(W),/^[\n\r]/.test(p.charAt(g))?(W=p.charAt(g),g++):(W=null,k("[\\n\\r]"));F!==null?R=[R,O,L,F]:(R=null,g=ue)}else R=null,g=ue}else R=null,g=ue;else R=null,g=ue;return R!==null&&(R=function(Ge,$e,at){return at.unshift($e),at}($,R[1],R[2])),R===null&&(g=$),R}function I(){var R,O,L,F,W,$,ue,ce,be;if($=g,ue=g,R=_(),R!==null){for(O=[],ce=g,be=g,p.length>g?(L=p.charAt(g),g++):(L=null,k("any character")),L!==null?(F=function(Ge,$e){return $e==ee}(g,L)?"":null,F!==null?(W=_(),W!==null?L=[L,F,W]:(L=null,g=be)):(L=null,g=be)):(L=null,g=be),L!==null&&(L=function(Ge,$e,at){return at}(ce,L[0],L[2])),L===null&&(g=ce);L!==null;)O.push(L),ce=g,be=g,p.length>g?(L=p.charAt(g),g++):(L=null,k("any character")),L!==null?(F=function(Ge,$e){return $e==ee}(g,L)?"":null,F!==null?(W=_(),W!==null?L=[L,F,W]:(L=null,g=be)):(L=null,g=be)):(L=null,g=be),L!==null&&(L=function(Ge,$e,at){return at}(ce,L[0],L[2])),L===null&&(g=ce);O!==null?(L=function(Ge,$e,at){return!!$e||at.length}(g,R,O)?"":null,L!==null?R=[R,O,L]:(R=null,g=ue)):(R=null,g=ue)}else R=null,g=ue;return R!==null&&(R=function(Ge,$e,at){return at.unshift($e),at}($,R[0],R[1])),R===null&&(g=$),R}function _(){var R,O,L,F,W,$;if(F=g,W=g,p.charCodeAt(g)===34?(R='"',g++):(R=null,k('"\\""')),R!==null){for(O=[],L=P();L!==null;)O.push(L),L=P();O!==null?(p.charCodeAt(g)===34?(L='"',g++):(L=null,k('"\\""')),L!==null?R=[R,O,L]:(R=null,g=W)):(R=null,g=W)}else R=null,g=W;if(R!==null&&(R=function(ue,ce){return ce.join("")}(F,R[1])),R===null&&(g=F),R===null){for(F=g,R=[],W=g,$=g,/^[^\n\r]/.test(p.charAt(g))?(O=p.charAt(g),g++):(O=null,k("[^\\n\\r]")),O!==null?(L=function(ue,ce){return ce!=ee}(g,O)?"":null,L!==null?O=[O,L]:(O=null,g=$)):(O=null,g=$),O!==null&&(O=function(ue,ce){return ce}(W,O[0])),O===null&&(g=W);O!==null;)R.push(O),W=g,$=g,/^[^\n\r]/.test(p.charAt(g))?(O=p.charAt(g),g++):(O=null,k("[^\\n\\r]")),O!==null?(L=function(ue,ce){return ce!=ee}(g,O)?"":null,L!==null?O=[O,L]:(O=null,g=$)):(O=null,g=$),O!==null&&(O=function(ue,ce){return ce}(W,O[0])),O===null&&(g=W);R!==null&&(R=function(ue,ce){return(o?ce.join("").trim():ce.join("")).replace(/(^")|("$)/g,"")}(F,R)),R===null&&(g=F)}return R}function P(){var R,O,L,F;return L=g,F=g,p.charCodeAt(g)===34?(R='"',g++):(R=null,k('"\\""')),R!==null?(p.charCodeAt(g)===34?(O='"',g++):(O=null,k('"\\""')),O!==null?R=[R,O]:(R=null,g=F)):(R=null,g=F),R!==null&&(R=function(W){return'"'}()),R===null&&(g=L),R===null&&(/^[^"]/.test(p.charAt(g))?(R=p.charAt(g),g++):(R=null,k('[^"]'))),R}function N(R){R.sort();for(var O=null,L=[],F=0;F=2)try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}return{ok:!1}}function lo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function EX(t){return t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function AX(t){const e=n=>{if(!lo(n))return n;const r={};for(const[i,s]of Object.entries(n))Array.isArray(s)&&s.length>0&&s.every(EX)?r[i]=s.join(", "):Array.isArray(s)?r[i]=s.map(e):r[i]=s;return r};return Array.isArray(t)?t.map(e):lo(t)?e(t):t}function MX(t,e){if(e.parseJSON){const n=TX(t);if(n.ok&&typeof n.value!="number")return n.value}return e.parseNumbers?CX(t):t}function RX(t,e){const n=i=>{const s={};for(const o of Object.keys(i)){const l=i[o];if(typeof l!="string"){s[o]=l;continue}const a=MX(l,e);if(!(e.emptyFields==="skip"&&a==="")){if(e.nullLiterals==="null"&&a==="NULL"){s[o]=null;continue}s[o]=a}}return s};if(Array.isArray(t))return t.map(i=>lo(i)?n(i):i);const r={};for(const[i,s]of Object.entries(t))r[i]=lo(s)?n(s):s;return r}const OX=/^([^.[\]]+)(?:\.(0|[1-9]\d*)|\[(0|[1-9]\d*)\])(?:\.(.+))?$/;function jM(t){const e=OX.exec(t);if(!e)return null;const n=e[1],r=e[2],i=e[3],s=e[4],o=Number(r??i);return Number.isSafeInteger(o)?{column:t,prefix:n,index:o,notation:r!==void 0?"dot":"bracket",...s!==void 0?{subKey:s}:{}}:null}function Ey(t){const e=new Set(t),n=new Map;for(const i of t){const s=jM(i);if(!s)continue;const o=n.get(s.prefix);o?o.push(s):n.set(s.prefix,[s])}const r=[];for(const[i,s]of n.entries()){if(e.has(i))continue;const o=s[0].subKey!==void 0,l=s[0].notation;if(s.some(h=>h.subKey!==void 0!==o||h.notation!==l))continue;const a=new Set;let u=!1;for(const h of s){const p=`${h.index}:${h.subKey??""}`;if(a.has(p)){u=!0;break}a.add(p)}if(u)continue;const c=Array.from(new Set(s.map(h=>h.index))).sort((h,p)=>h-p);if(c.length<2)continue;const f=c[0];f!==0&&f!==1||!c.every((h,p)=>h===f+p)||r.push({prefix:i,indices:c,columns:s.map(h=>h.column)})}return r}function gS(t,e){return t===void 0||t===""||e==="skip"&&t===null}function mS(t,e,n,r){const i=new Map,s=new Set,o=new Map;for(const a of n)if(a.columns.length!==0){i.set(a.columns[0],a);for(const u of a.columns)s.add(u);o.set(a.prefix,a.columns.map(u=>jM(u)).filter(u=>u!==null))}const l={};for(const a of e){const u=i.get(a);if(u){const c=o.get(u.prefix)??[];if(c.some(d=>d.subKey!==void 0)){const d=new Map;for(const p of c){const m=d.get(p.index);m?m.push(p):d.set(p.index,[p])}const h=[];for(const p of u.indices){const m=d.get(p)??[],b={};for(const g of m){if(!g.subKey)continue;const y=t[g.column];gS(y,r)||(b[g.subKey]=y)}Object.keys(b).length>0&&h.push(b)}if(h.length===0&&r==="skip")continue;l[u.prefix]=h}else{const d=new Map;for(const p of c)d.set(p.index,p.column);const h=[];for(const p of u.indices){const m=d.get(p);if(!m)continue;const b=t[m];gS(b,r)||h.push(b)}if(h.length===0&&r==="skip")continue;l[u.prefix]=h}continue}s.has(a)||Object.prototype.hasOwnProperty.call(t,a)&&(l[a]=t[a])}return l}function PX(t,e,n){if(Array.isArray(t)&&Array.isArray(e)){const r=t[0];if(!lo(r))return e;const i=Object.keys(r),s=Ey(i);return s.length===0?e:e.map(o=>lo(o)?mS(o,i,s,n):o)}if(!Array.isArray(t)&&!Array.isArray(e)){const r=Object.values(t)[0];if(!lo(r))return e;const i=Object.keys(r),s=Ey(i);if(s.length===0)return e;const o={};for(const[l,a]of Object.entries(e))o[l]=lo(a)?mS(a,i,s,n):a;return o}return e}function yS(t,e={}){const n={parseNumbers:e.parseNumbers??!0,parseJSON:e.parseJSON??!1,emptyFields:e.emptyFields??"keep",nullLiterals:e.nullLiterals??"string"},r=t.startsWith(pS)?t.slice(pS.length):t;try{const i=yX(r,{...e,parseNumbers:!1,parseJSON:!1,trim:!1}),s=RX(i,n);return e.collapseIndexedArrays!==!1&&!e.transpose?PX(i,s,n.emptyFields):s}catch(i){throw new Error($M(i))}}function IX(t,e={}){try{const n=e.flatten?AX(t):t;return wX(n,e)}catch(n){const r=$M(n);throw kX.some(i=>r.startsWith(i))?new bX(xX(r,e.flatten??!1)):new Error(r)}}function DX(t,e={}){return JSON.stringify(t,null,e.minify?void 0:2)}const HM={separator:"auto",parseNumbers:!0,parseJSON:!0,emptyFields:"keep",nullLiterals:"string",transpose:!1,hash:!1,minify:!1,flatten:!1,collapseIndexedArrays:!0},vS=["data","items","results","records","rows"];function wS(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function _X(t){const e=t.trim();if(e===""||!e.startsWith("{"))return[];let n;try{n=JSON.parse(e)}catch{return[]}if(!wS(n))return[];const r=Object.keys(n),i=new Set(vS),s=[...vS.filter(l=>r.includes(l)),...r.filter(l=>!i.has(l))],o=[];for(const l of s){const a=n[l];Array.isArray(a)&&a.length>0&&a.every(u=>wS(u))&&o.push({key:l,rowCount:a.length,unwrappedJson:JSON.stringify(a,null,2)})}return o}function WM(t){const e=t.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0);if(e.length<2)return null;const n=[];for(const r of e)try{const i=JSON.parse(r);if(typeof i!="object"||i===null)return null;n.push(i)}catch{return null}return n}function NX(t){const e=t.trim();if(e==="")return null;let n;try{n=JSON.parse(e)}catch{const i=WM(e);if(i===null)return null;n=i}const r=JSON.stringify(n,null,2);return e===r?{label:"Minify",nextInput:JSON.stringify(n)}:{label:"Format",nextInput:r}}function LX(t){const e=n=>{const r=new Set;for(const i of n)i&&typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).forEach(s=>r.add(s));return r};if(Array.isArray(t))return{rows:t.length,cols:e(t).size};if(t&&typeof t=="object"){const n=Object.values(t);return{rows:n.length,cols:e(n).size}}return{rows:0,cols:0}}const bS=t=>t==="auto"?void 0:t;function FX(t){let e=!1,n=1;for(let r=0;r0;return i.rowWidths.forEach((o,l)=>{if(s&&l===i.rowWidths.length-1)return;const a=i.rows[l];o===1&&a[0]===""||o!==i.headers.length&&n.push(o0?{warnings:u}:{}}}let r;try{r=JSON.parse(e)}catch(l){const a=WM(e);if(a!==null)r=a;else return{ok:!1,error:`Invalid JSON — ${l instanceof Error?l.message:String(l)}`}}const i=bS(n.separator),s=IX(r,{separator:i,flatten:n.flatten}),o=Yc(s,i);return{ok:!0,text:s,rows:o.rows.length,cols:o.headers.length}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}}function $X(){return M.jsx("svg",{"data-testid":"reading-spinner",className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-label":"Reading file",children:M.jsx("path",{d:"M21 12a9 9 0 1 1-6.2-8.56",strokeLinecap:"round"})})}function Ru({label:t,testId:e,onClick:n,disabled:r,Icon:i}){return M.jsxs("button",{type:"button","data-testid":e,disabled:r,onClick:n,title:t,className:Jo,children:[i?M.jsx(i,{"aria-hidden":"true"}):null,t]})}function jX(t){const e=Math.min(t.length,65536);let n=!1,r=0;for(let i=0;i=3))return t.slice(0,i+1)}return t.slice(0,e)}function HX({format:t,input:e,onInputChange:n,onFile:r,onTryExample:i,onClear:s,onCopy:o,onDownload:l,filename:a,reading:u,meta:c,error:f,notice:d,dark:h,delimiter:p,onCellCommit:m,canUndo:b=!1,canRedo:g=!1,onUndo:y,onRedo:w,collapseIndexedArrays:k=!0,onToggleCollapseIndexedArrays:x}){const[S,T]=v.useState(!1),[E,A]=v.useState(!1),I=v.useRef(0),_=v.useRef(null),P=e.trim()==="",N=t==="CSV",D=v.useMemo(()=>{if(!N||P)return[];const F=jX(e),W=Yc(F,p);return Ey(W.headers.map($=>$.trim()))},[N,P,e,p]),ee=v.useMemo(()=>N||P?[]:_X(e),[N,P,e]),ne=v.useMemo(()=>N||P?null:NX(e),[N,P,e]),ie=F=>{var W;F.preventDefault(),Array.from(((W=F.dataTransfer)==null?void 0:W.types)??[]).includes("Files")&&(I.current++,A(!0))},H=()=>{I.current=Math.max(0,I.current-1),I.current===0&&A(!1)},Y=F=>{var $,ue;F.preventDefault(),I.current=0,A(!1);const W=(ue=($=F.dataTransfer)==null?void 0:$.files)==null?void 0:ue[0];W&&r(W,"drop")},R=F=>{var $;if(!P||F.defaultPrevented||F.target instanceof HTMLTextAreaElement||F.target instanceof HTMLInputElement)return;const W=($=F.clipboardData)==null?void 0:$.getData("text/plain");W&&(F.preventDefault(),n(W))},O=N?M.jsxs("span",{"data-testid":"view-mode",role:"group","aria-label":"View mode",className:"inline-flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[M.jsxs("button",{type:"button","data-testid":"view-table","aria-pressed":!S,onClick:()=>T(!1),className:Ci("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2.5 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50",S?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:[M.jsx(FI,{"aria-hidden":"true",className:"size-3.5"}),"Table"]}),M.jsxs("button",{type:"button","data-testid":"raw-toggle","aria-pressed":S,onClick:()=>T(!0),className:Ci("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2.5 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50",S?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[M.jsx(Z1,{"aria-hidden":"true",className:"size-3.5"}),"Raw"]})]}):null,L=u&&a?M.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[M.jsx($X,{})," ",a]}):a?c?`${a} · ${c}`:a:c;return M.jsx("div",{"data-testid":"input-pane",onDragEnter:ie,onDragOver:F=>F.preventDefault(),onDragLeave:H,onDrop:Y,onPaste:R,"data-drag-over":E||void 0,className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:M.jsxs(zM,{title:t,meta:L,actions:M.jsxs(M.Fragment,{children:[O,N&&(b||g)?M.jsxs(M.Fragment,{children:[M.jsx("button",{type:"button","data-testid":"csv-undo-button","aria-label":"Undo",title:"Undo",disabled:!b,onClick:()=>y==null?void 0:y(),className:Jo,children:M.jsx(VI,{"aria-hidden":"true"})}),M.jsx("button",{type:"button","data-testid":"csv-redo-button","aria-label":"Redo",title:"Redo",disabled:!g,onClick:()=>w==null?void 0:w(),className:Jo,children:M.jsx(EI,{"aria-hidden":"true"})})]}):null,ne?M.jsx(Ru,{label:ne.label,testId:"json-format-toggle",onClick:()=>n(ne.nextInput),Icon:Z1}):null,M.jsx("input",{ref:_,type:"file","data-testid":"file-input",accept:N?".csv,.tsv,.txt,text/csv,text/tab-separated-values":".json,.txt,application/json",className:"hidden",onChange:F=>{var $;const W=($=F.target.files)==null?void 0:$[0];W&&r(W,"picker"),F.target.value=""}}),M.jsx(Ru,{label:"Upload",testId:"upload",onClick:()=>{var F;return(F=_.current)==null?void 0:F.click()},Icon:q2}),M.jsx(Ru,{label:"Copy",testId:"copy-input",onClick:o,Icon:Ev}),M.jsx(Ru,{label:"Clear",testId:"clear-input",onClick:s,disabled:P,Icon:m0}),M.jsx(Ru,{label:"Download",testId:"download-input",onClick:l,disabled:P,Icon:Y2})]}),status:f?{kind:"error",message:f}:d?{kind:"notice",message:d}:null,children:[P?M.jsx(a9,{format:t,onIngest:n,onBrowse:()=>{var F;return(F=_.current)==null?void 0:F.click()},onTryExample:i}):N?M.jsxs(M.Fragment,{children:[D.length>0?M.jsxs("div",{"data-testid":"csv-indexed-array-bar",className:"flex flex-shrink-0 flex-wrap items-center justify-between gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5",children:[M.jsx("span",{className:"text-xs text-muted-foreground",children:`Indexed columns (${D.map(F=>`${F.prefix}[${F.indices.length}]`).join(", ")}):`}),M.jsx("button",{type:"button","data-testid":"csv-indexed-array-pill","aria-pressed":k,onClick:()=>x==null?void 0:x(),className:Ci("inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 font-mono text-xs font-medium shadow-2xs transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",k?"border-border bg-background text-foreground hover:bg-muted":"border-border bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground"),children:k?"Arrays: .0, .1 → []":"Keep flat keys (.0, .1)"})]}):null,S?M.jsx("textarea",{"data-testid":"input-editor",value:e,onChange:F=>n(F.target.value),spellCheck:!1,className:"min-h-0 flex-1 resize-none bg-transparent px-5 py-4 font-mono text-[13px] leading-6 tracking-tight focus:outline-none"}):M.jsx(SE,{text:e,delimiter:p,testId:"input-table",dark:h,onCellCommit:m,onUndo:y,onRedo:w})]}):M.jsxs(M.Fragment,{children:[ee.length>0?M.jsxs("div",{"data-testid":"json-unwrap-bar",className:"flex flex-shrink-0 flex-wrap items-center gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5",children:[M.jsx("span",{className:"text-xs text-muted-foreground",children:"Nested array detected:"}),ee.map(F=>M.jsx("button",{type:"button","data-testid":`json-unwrap-pill-${F.key}`,onClick:()=>n(F.unwrappedJson),className:"inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-2 py-0.5 font-mono text-xs font-medium text-foreground shadow-2xs transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:`Unwrap .${F.key} (${F.rowCount} ${F.rowCount===1?"row":"rows"})`},F.key))]}):null,M.jsx(BM,{value:e,onChange:n,dark:h,testId:"input-editor"})]}),E?M.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-3 z-10 flex items-center justify-center rounded-xl border-2 border-dashed border-primary/50 bg-background/80 backdrop-blur-sm",children:M.jsx("p",{className:"text-sm font-medium text-foreground",children:"Drop file to import"})}):null]})})}const WX=/\.(csv|tsv|txt|json|ndjson|md|log)$/i;function VX(t){return t.type.startsWith("text/")||t.type==="application/json"?!0:WX.test(t.name)}const UX=[{value:"utf-8",label:"UTF-8"},{value:"windows-1252",label:"Windows-1252"}];async function xS(t,e){const n=t.stream().getReader();let r="";try{const i=[];let s=0;for(;s<2;){const{done:u,value:c}=await n.read();if(u)break;c&&c.byteLength>0&&(i.push(c),s+=c.byteLength)}let o=null;if(i.length===1)o=i[0];else if(i.length>1){o=new Uint8Array(s);let u=0;for(const c of i)o.set(c,u),u+=c.byteLength}let l=e;e==="utf-8"&&o&&o.byteLength>=2&&(o[0]===255&&o[1]===254?l="utf-16le":o[0]===254&&o[1]===255&&(l="utf-16be"));const a=new TextDecoder(l,{fatal:!1});for(o&&(r+=a.decode(o,{stream:!0}));;){const{done:u,value:c}=await n.read();if(u)break;r+=a.decode(c,{stream:!0})}return r+a.decode()}finally{n.releaseLock()}}const KX=[{value:"auto",label:"Auto-detect"},{value:",",label:"Comma"},{value:";",label:"Semicolon"},{value:" ",label:"Tab"},{value:"|",label:"Pipe"}];function kS(){return M.jsx("div",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"})}function SS(){return"h-7 cursor-pointer appearance-none rounded-md border border-border bg-background py-0 pl-2.5 pr-6 text-[13px] font-medium text-foreground transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50"}function CS(){return M.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:M.jsx("path",{d:"m4 6 4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"})})}function TS({children:t}){return M.jsx("span",{className:"font-mono text-[11px] font-semibold tracking-[0.14em] whitespace-nowrap text-muted-foreground/70 uppercase",children:t})}function Ks({label:t,checked:e,onChange:n,hint:r}){return M.jsxs("span",{className:"inline-flex items-center gap-1",children:[M.jsxs("label",{className:"flex cursor-pointer items-center gap-2 whitespace-nowrap text-[13px] text-muted-foreground transition-colors hover:text-foreground",children:[M.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":t,onClick:()=>n(!e),className:"flex h-6 shrink-0 cursor-pointer items-center rounded-full outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:M.jsx("span",{className:Ci("relative inline-flex h-[18px] w-8 items-center rounded-full border transition-colors",e?"border-primary bg-primary":"border-border bg-muted"),children:M.jsx("span",{className:Ci("pointer-events-none inline-block size-3 rounded-full bg-background shadow-sm transition-transform",e?"translate-x-[15px]":"translate-x-[2px]")})})}),M.jsx("span",{className:"select-none",children:t})]}),r?M.jsx(Ay,{text:r}):null]})}function Ay({text:t}){const e=v.useId(),[n,r]=v.useState(!1);return M.jsxs("span",{className:"relative inline-flex items-center",children:[M.jsx("button",{type:"button","aria-label":"What does this option do?","aria-expanded":n,"aria-describedby":e,title:"What does this option do?",onClick:()=>r(i=>!i),className:"flex h-4 w-4 cursor-pointer items-center justify-center rounded-full border border-border text-[9px] font-semibold leading-none text-muted-foreground hover:text-foreground",children:"i"}),M.jsx("span",{"data-hint":!0,id:e,hidden:!n,className:"ml-1 text-muted-foreground",children:t})]})}function XX({direction:t,options:e,onChange:n,notice:r,uploadEncoding:i,onUploadEncodingChange:s}){const o=t==="csv2json";return M.jsxs("div",{"data-testid":"options-row",className:"flex flex-shrink-0 flex-wrap items-center gap-5 border-t border-border bg-panel px-5 py-2.5 text-[13px] text-muted-foreground",children:[M.jsxs("span",{className:"inline-flex items-center gap-2",children:[M.jsxs("label",{className:"flex items-center gap-2",children:[M.jsx(TS,{children:"Separator"}),M.jsxs("span",{className:"relative inline-flex",children:[M.jsx("select",{"data-testid":"opt-separator",value:e.separator,onChange:l=>n({separator:l.target.value}),className:SS(),children:KX.map(l=>M.jsx("option",{value:l.value,children:l.label},l.value))}),M.jsx(CS,{})]})]}),M.jsx(Ay,{text:"Auto-detect is conservative — it only picks comma, semicolon, or tab. Pipe never auto-detects because normal prose is full of pipes, so pipe-separated text must be selected explicitly."})]}),i&&s?M.jsxs(M.Fragment,{children:[M.jsx(kS,{}),M.jsxs("span",{className:"inline-flex items-center gap-2",children:[M.jsxs("label",{className:"flex items-center gap-2",children:[M.jsx(TS,{children:"Encoding"}),M.jsxs("span",{className:"relative inline-flex",children:[M.jsx("select",{"data-testid":"opt-encoding",value:i,onChange:l=>s(l.target.value),className:SS(),children:UX.map(l=>M.jsx("option",{value:l.value,children:l.label},l.value))}),M.jsx(CS,{})]})]}),M.jsx(Ay,{text:"Applies to file uploads and drops only — pasted or typed text is always read as UTF-8. Switch to Windows-1252 for CSVs saved by legacy Excel to fix mangled accents like ü and ö."})]})]}):null,M.jsx(kS,{}),o?M.jsxs(M.Fragment,{children:[M.jsx(Ks,{label:"Parse numbers",checked:e.parseNumbers,onChange:l=>n({parseNumbers:l}),hint:"On by default — plain numbers like 5 or 19.99 become real JSON numbers; leading-zero values like 00721 and very long IDs stay strings. Uncheck to keep numeric cells as strings — booleans, null, and containers still convert while Parse JSON is on."}),M.jsx(Ks,{label:"Parse JSON",checked:e.parseJSON,onChange:l=>n({parseJSON:l}),hint:"Turns null, true, false, [] and {} into real JSON values instead of strings."}),M.jsx(Ks,{label:"Skip empty fields",checked:e.emptyFields==="skip",onChange:l=>n({emptyFields:l?"skip":"keep"}),hint:'Empty cells are dropped from the output instead of becoming "" — a column that is empty in every row disappears from the output and the counts.'}),M.jsx(Ks,{label:"NULL as null",checked:e.nullLiterals==="null",onChange:l=>n({nullLiterals:l?"null":"string"}),hint:"The string NULL becomes JSON null. Matching is exact and case-sensitive — SQL exports write uppercase NULL; Null and nULL are untouched, and lowercase null already converts when Parse JSON is on."}),M.jsx(Ks,{label:"Transpose",checked:e.transpose,onChange:l=>n({transpose:l}),hint:"Flip rows and columns — the first column becomes the header row."}),M.jsx(Ks,{label:"Hash output",checked:e.hash,onChange:l=>n({hash:l}),hint:"The first column becomes the object key instead of a field."}),M.jsx(Ks,{label:"Minify",checked:e.minify,onChange:l=>n({minify:l}),hint:"Remove indentation from the JSON output. Data is untouched."})]}):M.jsx(Ks,{label:"Flatten nested arrays",checked:e.flatten,onChange:l=>n({flatten:l}),hint:"Explode nested arrays into extra rows with dotted keys — needed when the JSON isn't a flat table."}),M.jsx("div",{className:"flex-1"}),r?M.jsx("span",{"data-testid":"options-notice",className:"text-muted-foreground",children:r}):null]})}const GX=3;function YX(t){const e=t.slice(0,GX),n=t.length-e.length;return(n>0?[...e,`+${n} more`]:e).join(` +`)}function qX({format:t,inputEmpty:e,outputText:n,error:r,meta:i,staleNotice:s,warnings:o,edited:l,editable:a,delimiter:u,dark:c,onCopy:f,onDownload:d,onOutputChange:h,onRevert:p,onDiscardReconvert:m}){const b=t==="JSON";return M.jsx("div",{"data-testid":"output-pane","data-surface":"output",className:"flex min-h-0 min-w-0 flex-1 flex-col bg-muted/30",children:M.jsx(zM,{title:t,meta:e?null:l?M.jsxs("span",{className:"flex items-center gap-1.5",children:[M.jsx("span",{"data-testid":"edited-badge",role:"status","aria-label":"Output edited",className:"rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-amber-700 dark:bg-amber-400/15 dark:text-amber-400",children:"Edited"}),M.jsxs("button",{type:"button","data-testid":"revert-output",onClick:p,className:Jo,children:[M.jsx(eb,{"aria-hidden":"true"}),"Revert"]})]}):s?M.jsx("span",{"data-testid":"stale-notice",className:"text-xs text-amber-600 dark:text-amber-400",children:s}):i,actions:M.jsxs(M.Fragment,{children:[M.jsxs("button",{type:"button","data-testid":"copy-output",onClick:f,disabled:!n,className:Jo,children:[M.jsx(Ev,{"aria-hidden":"true"}),"Copy"]}),M.jsxs("button",{type:"button","data-testid":"download-output",onClick:d,disabled:!n,className:Jo,children:[M.jsx(Y2,{"aria-hidden":"true"}),"Download"]})]}),status:l?{kind:"notice",message:"Output edited — CSV and option changes aren't applied.",action:m?M.jsxs("button",{type:"button","data-testid":"discard-reconvert",onClick:m,className:Jo+" ml-2",children:[M.jsx(eb,{"aria-hidden":"true"}),"Discard edits & reconvert"]}):void 0}:r?{kind:"error",message:r}:o&&o.length>0?{kind:"notice",message:YX(o)}:null,children:e?M.jsxs("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:["Your ",t," appears here."]}):n?b?M.jsx(BM,{value:n,editable:a&&n.length<=FM,onChange:h,dark:c,testId:"output-view"}):M.jsx(SE,{text:n,delimiter:u,testId:"output-table",dark:c}):r?M.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:"Resolve the error to see output."}):M.jsx("div",{"data-testid":"output-converting-placeholder",className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:"Converting…"})})})}function QX({phase:t,message:e,onRetry:n}){return t==="loading"?M.jsx("div",{role:"status","aria-busy":"true","data-testid":"permalink-loading",className:"mx-4 mt-3 rounded-md border border-border bg-muted px-4 py-2 text-sm text-muted-foreground",children:"Loading shared data…"}):t==="not-found"?M.jsxs("div",{role:"alert","data-testid":"permalink-notice",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-2 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[M.jsx("span",{children:"This data doesn't exist (or was deleted)."}),M.jsx("a",{href:"/",className:"font-medium underline underline-offset-2",children:"Go to the converter"})]}):t==="unsupported"?M.jsxs("div",{role:"alert","data-testid":"permalink-unsupported",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-2 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[M.jsx("span",{children:"This link's saved data can't be shown in the new converter."}),M.jsx("a",{href:"/",className:"font-medium underline underline-offset-2",children:"Go to the converter"})]}):M.jsxs("div",{role:"alert","data-testid":"permalink-notice",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-3 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[M.jsx("span",{children:e||"Couldn't load this data."}),M.jsx("button",{type:"button","data-testid":"permalink-retry",onClick:n,className:"rounded-md border border-border bg-background px-2 py-1 text-sm font-medium hover:bg-accent",children:"Retry"})]})}const My=20,Ry=80,ES=50;function bm(t){return Math.min(Ry,Math.max(My,t))}function JX({layout:t,split:e,onSplitChange:n,left:r,right:i,children:s}){const o=v.useRef(null),[l,a]=v.useState(!1),u=t==="stacked";v.useEffect(()=>{if(!l)return;const f=h=>{var b;const p=(b=o.current)==null?void 0:b.getBoundingClientRect();if(!p||p.width===0||p.height===0)return;const m=u?(h.clientY-p.top)/p.height:(h.clientX-p.left)/p.width;n(bm(m*100))},d=()=>a(!1);return window.addEventListener("pointermove",f),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d),()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d)}},[l,u,n]);const c=f=>{const d=f.shiftKey?5:1;switch(f.key){case"ArrowLeft":case"ArrowUp":f.preventDefault(),n(bm(e-d));break;case"ArrowRight":case"ArrowDown":f.preventDefault(),n(bm(e+d));break;case"Home":f.preventDefault(),n(My);break;case"End":f.preventDefault(),n(Ry);break;case"Enter":case" ":f.preventDefault(),n(ES);break}};return M.jsxs("div",{ref:o,className:Ci("relative flex min-h-0 flex-1","flex-col md:flex-row",l&&"select-none"),children:[M.jsx("div",{"data-testid":"pane-left",style:{"--split":`${e}%`},className:Ci("flex min-h-0 min-w-0 flex-col border-border bg-panel","h-[var(--split)] border-b","md:h-auto md:w-[var(--split)] md:border-b-0 md:border-r"),children:r}),M.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-panel",children:i}),M.jsxs("div",{"data-testid":"seam",role:"separator",tabIndex:0,"aria-orientation":u?"horizontal":"vertical","aria-valuenow":Math.round(e),"aria-valuemin":My,"aria-valuemax":Ry,"aria-label":"Resize panes",title:"Drag to resize · double-click to reset",onPointerDown:f=>{var d,h;f.target instanceof Element&&f.target.closest("button")||(f.preventDefault(),(h=(d=f.currentTarget).setPointerCapture)==null||h.call(d,f.pointerId),a(!0))},onPointerUp:()=>a(!1),onDoubleClick:()=>n(ES),onKeyDown:c,style:{"--split":`${e}%`,touchAction:"none"},className:Ci("absolute z-10","top-[var(--split)] left-0 right-0 h-0 cursor-row-resize","md:top-0 md:right-auto md:bottom-0 md:left-[var(--split)] md:h-auto md:w-0 md:cursor-col-resize"),children:[M.jsx("div",{className:Ci("absolute","left-0 right-0 -top-1.5 h-3","md:top-0 md:right-auto md:bottom-0 md:-left-1.5 md:h-auto md:w-3")}),s?M.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:s}):null]})]})}function ZX({theme:t}){return t==="dark"?M.jsx(NI,{size:15,strokeWidth:2,"aria-hidden":"true"}):M.jsx(CI,{size:15,strokeWidth:2,"aria-hidden":"true"})}function eG({theme:t,onToggleTheme:e,slot:n}){return M.jsxs("header",{"data-testid":"topbar",className:"relative flex h-14 flex-shrink-0 items-center gap-3 border-b border-border bg-panel px-5",children:[M.jsxs("div",{className:"flex items-baseline gap-2",children:[M.jsx("span",{className:"text-[15px] font-semibold tracking-tight text-foreground whitespace-nowrap",children:"csvjson"}),M.jsx("span",{className:"hidden text-[13px] font-medium text-muted-foreground sm:inline",children:"CSV → JSON converter"})]}),M.jsx("div",{className:"flex-1"}),M.jsx("div",{"data-testid":"topbar-slot",children:n}),M.jsx("button",{type:"button","data-testid":"theme-toggle",onClick:e,"aria-label":t==="dark"?"Switch to light mode":"Switch to dark mode",title:t==="dark"?"Switch to light mode":"Switch to dark mode",className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border bg-panel text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:M.jsx(ZX,{theme:t})})]})}function tG(t){return[...t].sort((e,n)=>n.id-e.id)}const VM=[{id:13,date:"2026-10-15",tag:"fix",title:"Faster large CSV uploads without page freezes",summary:"Uploading large CSV files now converts in a single pass without freezing the tab or flashing a false error state, previews multi-megabyte JSON outputs smoothly while keeping full Copy and Download, and decodes UTF-16 CSV exports automatically."},{id:12,date:"2026-10-15",tag:"improvement",title:"Table undo, header rename, and smarter JSON input",summary:"Undo or redo CSV table edits, double-click any column header to rename it in place, and collapse .0, .1 indexed columns into JSON arrays. JSON → CSV now formats or minifies JSON in one click, unwraps nested record arrays, parses JSONL, and previews pipe-delimited output accurately."},{id:11,date:"2026-10-03",tag:"improvement",title:"The switch names the direction",summary:"The ⇄ switch now labels the active conversion, and legacy /json2csv links land you in JSON → CSV mode again — it never left."},{id:10,date:"2026-09-08",tag:"new",title:"Delete rows and columns from the table",summary:"Select rows or columns in the input table and delete them by button or the Delete key — the raw CSV updates and reconverts in place, with at least one column always kept. Selected column headers are also readable again in both themes."},{id:9,date:"2026-09-08",tag:"new",title:"Spreadsheet-grade data table",summary:"The rebuilt data table adds drag-to-select ranges, Shift+Arrow range extension, fill, and spreadsheet-style cell editing — with copy/paste always producing clean CSV."},{id:8,date:"2026-09-07",tag:"new",title:"Search, sort, and select in the data table",summary:"The CSV table now has a search bar with a live row count, click-to-sort columns, and row selection with copy-as-CSV — on both the input and output tables."},{id:7,date:"2026-09-07",tag:"fix",title:"No more layout flash on load",summary:"The converter now renders side-by-side immediately on desktop, instead of stacking the panes and snapping into columns as the page loads."},{id:6,date:"2026-09-07",tag:"new",title:"Introducing the changelog",summary:"This changelog keeps you posted on what's new — recent updates appear here with an unseen dot when you come back. Feel free to vote on what you find useful."},{id:5,date:"2026-09-05",tag:"improvement",title:"Icons match the design",summary:"Action buttons, view toggle, and the empty state now use the same crisp icon set as the rest of the interface."},{id:4,date:"2026-09-05",tag:"new",title:"Edit the JSON output in place",summary:"The output pane is now an editor. Hand edits survive until you reconvert; revert and discard keep you safe."},{id:3,date:"2026-09-05",tag:"fix",title:"Pastes land where they belong",summary:"Paste anywhere on the page and your data routes to the input — including pastes over the read-only output pane."},{id:2,date:"2026-09-04",tag:"improvement",title:"A calmer empty state",summary:"Empty panes now open on a compact paste field with a Choose file button, so starting is obvious on any screen."},{id:1,date:"2026-09-04",tag:"improvement",title:"Smarter number handling",summary:"Numbers convert sensibly out of the box: leading-zero values like 00721 and very long IDs stay strings so nothing gets silently mangled."}],nG=864e5;function AS(t){return Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}function rG(t,e=Date.now()){const n=new Date(`${t}T00:00:00Z`),r=new Date(e),i=Math.round((AS(r)-AS(n))/nG);if(i<=0)return"today";if(i===1)return"yesterday";if(i<7)return`${i} days ago`;const s=n.toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"});return n.getUTCFullYear()===r.getUTCFullYear()?s:`${s}, ${n.getUTCFullYear()}`}const UM="csvjson:changelog.v1",Fd=Math.max(...VM.map(t=>t.id),0),iG=tG(VM);function sG(t){if(typeof t!="object"||t===null)return!1;const e=t;if(e.lastSeenId!==null&&typeof e.lastSeenId!="number"||typeof e.votes!="object"||e.votes===null)return!1;for(const[n,r]of Object.entries(e.votes))if(!/^\d+$/.test(n)||r!==1&&r!==-1)return!1;return!(e.clientId!==void 0&&!oG(e.clientId)||e.pendingIds!==void 0&&(!Array.isArray(e.pendingIds)||e.pendingIds.some(n=>typeof n!="number"||!Number.isInteger(n)||n<1)))}function oG(t){return typeof t=="string"&&/^[0-9a-fA-F-]{8,64}$/.test(t)}function KM(t){return t===void 0?[]:[...new Set(t)].filter(e=>e>=1&&e<=Fd).sort((e,n)=>e-n)}function MS(t,e,n){const r=KM(t.pendingIds),i=n?[...new Set([...r,e])].sort((s,o)=>s-o):r.filter(s=>s!==e);return{...t,pendingIds:i}}function lG(){try{const t=window.localStorage.getItem(UM);if(t===null)return{lastSeenId:null,votes:{}};const e=JSON.parse(t);return sG(e)?{...e,pendingIds:KM(e.pendingIds)}:{lastSeenId:null,votes:{}}}catch{return{lastSeenId:null,votes:{}}}}function aG(t){try{window.localStorage.setItem(UM,JSON.stringify(t))}catch{}}function uG(){var n,r,i;if(typeof((n=globalThis.crypto)==null?void 0:n.randomUUID)=="function")return globalThis.crypto.randomUUID();const t=(i=(r=globalThis.crypto)==null?void 0:r.getRandomValues)==null?void 0:i.call(r,new Uint8Array(16));if(t===void 0)throw new Error("no secure randomness available");t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}async function cG(t,e,n){try{return(await fetch("/api/changelog-vote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:t,entryId:e,vote:n})})).ok?"ok":"failed"}catch{return"failed"}}function RS(t){return["flex h-6 w-7 cursor-pointer items-center justify-center rounded-md transition-colors",t?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" ")}function fG({entry:t,vote:e,queued:n,inFlight:r,onVote:i}){return M.jsxs("article",{className:"px-3 py-2.5","data-testid":`changelog-entry-${t.id}`,children:[M.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[t.tag!==void 0&&M.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:t.tag}),M.jsx("span",{className:"text-[11px] text-muted-foreground",children:rG(t.date)})]}),M.jsx("h3",{className:"text-xs font-semibold text-foreground",children:t.title}),M.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-muted-foreground",children:t.summary}),M.jsxs("div",{className:"mt-1.5 flex gap-1",children:[M.jsx("button",{type:"button","data-testid":`changelog-up-${t.id}`,onClick:()=>i(t.id,1),"aria-pressed":e===1,"aria-label":`Upvote: ${t.title}`,title:"Good change",className:RS(e===1),children:M.jsx(jI,{size:13,strokeWidth:2,"aria-hidden":"true"})}),M.jsx("button",{type:"button","data-testid":`changelog-down-${t.id}`,onClick:()=>i(t.id,-1),"aria-pressed":e===-1,"aria-label":`Downvote: ${t.title}`,title:"Not for me",className:RS(e===-1),children:M.jsx(zI,{size:13,strokeWidth:2,"aria-hidden":"true"})})]}),n&&!r&&M.jsx("p",{"data-testid":`changelog-queued-${t.id}`,role:"status",className:"mt-1.5 rounded-sm border border-dashed border-border px-2 py-1 text-[11px] text-muted-foreground",children:"Vote queued — it will retry on your next interaction."})]})}function dG(){const[t,e]=v.useState(lG),[n,r]=v.useState(!1),i=v.useRef(t),s=v.useCallback(x=>{aG(x),i.current=x,e(x)},[]),[o,l]=v.useState(()=>new Set),a=v.useRef(new Set),u=v.useRef(null),c=v.useRef(null),f=v.useRef(new Map),d=t.lastSeenId!==null&&Fd>t.lastSeenId,h=v.useCallback((x,S)=>{l(T=>{const E=new Set(T);return S?E.add(x):E.delete(x),E})},[]),p=v.useCallback((x,S,T,E)=>{const A=(f.current.get(x)??0)+1;f.current.set(x,A),a.current.add(x),E&&h(x,!0),cG(T,x,S).then(I=>{f.current.get(x)===A&&(a.current.delete(x),I==="ok"&&(tI({entry_id:x,vote:S}),s(MS(i.current,x,!1))),E&&h(x,!1))})},[s,h]),m=v.useCallback(x=>{const{clientId:S,pendingIds:T,votes:E}=i.current,A=T??[];if(A.length!==0&&S!==void 0)for(const I of A){if(I===x||a.current.has(I))continue;const _=E[I];_!==void 0&&p(I,_,S,!1)}},[p]),b=(x,S)=>{if(t.votes[x]===S){m();return}const T=t.clientId??uG();s(MS({...t,votes:{...t.votes,[x]:S},clientId:T},x,!0)),p(x,S,T,!0),m(x)},g=()=>{r(!0),eI(),t.lastSeenId!==Fd&&s({...t,lastSeenId:Fd}),m()},y=v.useCallback(()=>{r(!1)},[]),w=v.useRef(!1);v.useEffect(()=>{var x;w.current&&!n&&((x=c.current)==null||x.focus()),w.current=n},[n]);const k=v.useRef(!1);return v.useEffect(()=>{k.current||(k.current=!0,m())},[m]),v.useEffect(()=>{if(!n)return;const x=T=>{T.key==="Escape"&&y()},S=T=>{const E=u.current;E===null||!(T.target instanceof Node)||E.contains(T.target)||y()};return document.addEventListener("keydown",x),document.addEventListener("click",S),()=>{document.removeEventListener("keydown",x),document.removeEventListener("click",S)}},[n,y]),M.jsxs("div",{"data-testid":"changelog",ref:u,className:"relative max-sm:static",children:[M.jsxs("button",{type:"button","data-testid":"changelog-toggle",ref:c,onClick:()=>n?y():g(),"aria-expanded":n,"aria-haspopup":"dialog","aria-label":"Changelog",title:"What's new",className:"relative inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border bg-panel text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[M.jsx(MI,{size:15,strokeWidth:2,"aria-hidden":"true"}),d&&M.jsx("span",{"data-testid":"changelog-dot","aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-foreground"})]}),n&&M.jsxs("div",{"data-testid":"changelog-popout",role:"dialog","aria-label":"Changelog",className:"absolute right-0 top-9 z-50 w-80 rounded-md border border-border bg-panel shadow-md max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto",children:[M.jsxs("div",{className:"flex items-center justify-between border-b border-border py-1.5 pl-3 pr-1.5",children:[M.jsx("span",{className:"text-xs font-semibold tracking-tight text-foreground",children:"What's new"}),M.jsx("button",{type:"button","data-testid":"changelog-close",onClick:y,"aria-label":"Close changelog",className:"flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:M.jsx(Q2,{size:14,strokeWidth:2,"aria-hidden":"true"})})]}),M.jsx("div",{className:"max-h-96 divide-y divide-border overflow-y-auto",children:iG.map(x=>{var S;return M.jsx(fG,{entry:x,vote:t.votes[x.id],queued:((S=t.pendingIds)==null?void 0:S.includes(x.id))??!1,inFlight:o.has(x.id),onVote:b},x.id)})})]})]})}function hG(t,e){const[n,r]=v.useState(t);return v.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function pG(t){const[e,n]=v.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(t).matches);return v.useEffect(()=>{if(typeof window.matchMedia!="function")return;const r=window.matchMedia(t),i=s=>n(s.matches);return n(r.matches),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[t]),e}const gG={},mG=["csv2json","json2csv","json_validator","json_beautifier","sql2json","csvjson2json","datajanitor"],yG=["csv2json","json2csv","csvjson2json"];function vG(t){return yG.includes(t)}const wG=/^[0-9a-f]{32}$/i,bG=/^\/([a-z0-9_]+)\/([0-9a-f]{32})\/?$/i,xm=gG,xG=((xm==null?void 0:xm.VITE_S3_DATA_URL)??"https://csvjson.s3.us-east-2.amazonaws.com/data/").replace(/\/*$/,"/");function kG(t){const e=bG.exec(t);if(!e)return null;const n=e[1].toLowerCase();return mG.includes(n)?{tool:n,id:e[2].toLowerCase()}:null}class Oy extends Error{constructor(){super("This data doesn't exist (or was deleted)"),this.name="PermalinkNotFoundError"}}class km extends Error{constructor(e,n){super(e,n),this.name="PermalinkFetchError"}}const Sm={csv:(t,e)=>{t.direction="csv2json",t.input=Wh(e)},json:(t,e)=>{t.input=Wh(e),t.direction="json2csv"},parseNumbers:(t,e)=>{const n=$l(e);n!==void 0&&(t.options.parseNumbers=n)},parseJSON:(t,e)=>{const n=$l(e);n!==void 0&&(t.options.parseJSON=n)},transpose:(t,e)=>{const n=$l(e);n!==void 0&&(t.options.transpose=n)},"output-array":(t,e)=>{const n=$l(e);n!==void 0&&(t.options.hash=!n)},"output-hash":(t,e)=>{const n=$l(e);n!==void 0&&(t.options.hash=n)},flatten:(t,e)=>{const n=$l(e);n!==void 0&&(t.options.flatten=n)},output_csvjson_variant:()=>{}};function Wh(t){return typeof t=="string"?t:typeof t=="number"?String(t):""}function OS(t){return typeof t=="string"&&t.trim()!==""}function $l(t){if(t===!0||t==="true")return!0;if(t===!1||t==="false")return!1}function SG(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string"||typeof e=="boolean")}function CG(t){var i;if(!SG(t))return null;const e=OS(t.csv),n=OS(t.json);if(!e&&!n)return null;const r={direction:e?"csv2json":"json2csv",input:"",options:{}};for(const[s,o]of Object.entries(t))(i=Sm[s])==null||i.call(Sm,r,o);return r.input=Wh(e?t.csv:t.json),r}async function TG(t){if(!wG.test(t))throw new Oy;let e;try{e=await fetch(`${xG}${t}`,{mode:"cors"})}catch(r){throw new km("Network error while loading this data",{cause:r})}if(e.status===403||e.status===404)throw new Oy;if(!e.ok)throw new km(`Unexpected response while loading this data (HTTP ${e.status})`);let n;try{const r=await e.text();if(r.trim()==="")throw new Error("empty body");n=JSON.parse(r)}catch{throw new km("Stored data for this link is malformed")}return n}function EG(t){const e=v.useMemo(()=>t&&vG(t.tool)?t.id:null,[t]),[n,r]=v.useState(0),[i,s]=v.useState(e?"loading":"idle"),[o,l]=v.useState(null),[a,u]=v.useState("");return v.useEffect(()=>{if(!e)return;let c=!1;return TG(e).then(f=>{if(c)return;const d=CG(f);d?(l(d),s("hydrated")):s("unsupported")}).catch(f=>{c||(f instanceof Oy?s("not-found"):(u(f instanceof Error?f.message:"Couldn't load this data"),s("error")))}),()=>{c=!0}},[e,n]),{phase:i,hydrated:o,message:a,retry:()=>{i==="error"&&(s("loading"),r(c=>c+1))}}}async function PS(t){try{if(typeof navigator<"u"&&navigator.clipboard)return await navigator.clipboard.writeText(t),!0}catch{}try{const e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();const n=document.execCommand("copy");return e.remove(),n}catch{return!1}}const AG="\uFEFF";function MG(t,e){return e?AG+t:t}function RG(t,e,n){const r=MG(t,n);return new Blob([r],{type:`${e};charset=utf-8`})}const OG=new Set(["csv","tsv","json","txt"]);function PG(t){let e=t;for(;;){const n=e.lastIndexOf(".");if(n<=0)break;if(n===e.length-1){e=e.slice(0,n);continue}if(!OG.has(e.slice(n+1).toLowerCase()))break;e=e.slice(0,n)}return e}function IG(t,e){const n=e==="csv2json"?"json":"csv";return t?`${PG(t)}.${n}`:`data.${n}`}function IS(t,e,{mime:n="text/plain",bom:r=!1}={}){const i=RG(t,n,r),s=URL.createObjectURL(i),o=document.createElement("a");return o.href=s,o.download=e,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(s),0),e}function DG(t){if(!(t instanceof HTMLElement))return!1;if(t.isContentEditable)return!0;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"?!0:t.closest('[contenteditable="true"]')!==null}const _G=`album,year,US_peak_chart_post +The White Stripes,1999, +De Stijl,2000, +White Blood Cells,2001,61 +Elephant,2003,6 +Get Behind Me Satan,2005,3 +Icky Thump,2007,2`,NG=`[ + { + "album": "Elephant", + "year": 2003, + "label": "XL Recordings" + }, + { + "album": "Icky Thump", + "year": 2007, + "label": "XL Recordings" + } +]`,XM="csvjson-theme";function LG(){try{const t=localStorage.getItem(XM);return t==="dark"||t==="light"?t:null}catch{return null}}function FG(){try{if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return"light"}function BG(){return LG()??FG()}function zG(t){try{localStorage.setItem(XM,t)}catch{}}function $G(t){return new URLSearchParams(t).get("direction")==="json2csv"?"json2csv":"csv2json"}const DS=2*1024*1024,jG=150,HG=1e3,WG=2e3,VG=2e3;function UG(t,e){return t===0?null:e>0?`${t} rows · ${e} cols`:`${t} rows`}function KG(t){try{return JSON.parse(t),!0}catch{return!1}}function XG(){var dt;const[t,e]=v.useState(BG);v.useEffect(()=>{document.documentElement.classList.toggle("dark",t==="dark")},[t]);const n=()=>e(fe=>{const Ze=fe==="dark"?"light":"dark";return zG(Ze),Ze}),[r,i]=v.useState(()=>typeof window>"u"?"csv2json":$G(window.location.search)),[s,o]=v.useState(()=>zl("")),l=s.present,[a,u]=v.useState(HM),[c,f]=v.useState(50),[d,h]=v.useState(null),[p,m]=v.useState(!1),[b,g]=v.useState(null),[y,w]=v.useState("utf-8"),k=v.useRef({direction:r,options:a,input:l,resultOk:!0}),x=v.useRef(null);x.current||(x.current=aI({settleMs:WG,minWindowMs:VG,isValid:(fe,Ze)=>{const V=k.current;return Ze===V.input?V.resultOk:Mu(fe==="csv_to_json"?"csv2json":"json2csv",Ze,V.options).ok}}));const S=x.current,E=pG("(min-width: 48rem)")?"side-by-side":"stacked",A=r==="csv2json",I=A?"CSV":"JSON",_=A?"JSON":"CSV",P=l.trim()==="",N=l.length>DS?HG:jG,D=hG(l,P?0:N),ee=v.useRef(null),ne=v.useRef(null),H=l!==""&&((dt=ee.current)==null?void 0:dt.text)===l?l:D,Y=v.useMemo(()=>typeof window>"u"?null:kG(window.location.pathname),[]),R=EG(Y),O=v.useMemo(()=>Mu(r,H,a),[r,H,a]);k.current={direction:r,options:a,input:H,resultOk:O.ok},v.useEffect(()=>{const fe=ne.current;!fe||fe.text!==H||(ne.current=null,S.discrete(fe.direction,fe.via,fe.text))},[H,O,S]);const[L,F]=v.useState(null);v.useEffect(()=>{H.trim()!==""&&O.ok&&F(O.text)},[O,H]);const W=H.trim()!==""&&O.ok?O.text:L,[$,ue]=v.useState(!1),[ce,be]=v.useState(null),Ge=$?ce:W,$e=A&&!P&&Ge!==null&&($||O.ok),at=v.useCallback(fe=>{if(fe===W){ue(!1),be(null);return}ue(!0),be(fe)},[W]),_t=v.useCallback(()=>{const fe=Mu(r,l,a);fe.ok&&F(fe.text),ue(!1),be(null)},[r,l,a]),Qe=v.useCallback(fe=>{o(Ze=>A?X6(Ze,fe):zl(fe))},[A]),it=A&&s.past.length>0,Je=A&&s.future.length>0,Wt=v.useCallback(()=>{if(!A||s.past.length===0)return;const fe=G6(s);g(null),o(fe),S.edit("csv_to_json",fe.present)},[A,s,S]),Pe=v.useCallback(()=>{if(!A||s.future.length===0)return;const fe=Y6(s);g(null),o(fe),S.edit("csv_to_json",fe.present)},[A,s,S]),me=()=>{if($){const fe=ce??"";o(Ze=>zl(KG(fe)?fe:Ze.present)),i(Ze=>Ze==="csv2json"?"json2csv":"csv2json"),ue(!1),be(null);return}if(i(fe=>fe==="csv2json"?"json2csv":"csv2json"),P)o(zl(""));else{const fe=Mu(r,l,a);o(zl(fe.ok?fe.text:l))}},Ie=R.hydrated;v.useEffect(()=>{if(Ie===null)return;const fe={...k.current.options,...Ie.options};k.current={direction:Ie.direction,options:fe,input:Ie.input,resultOk:Mu(Ie.direction,Ie.input,fe).ok},i(Ie.direction),o(zl(Ie.input)),u(Ze=>({...Ze,...Ie.options})),ue(!1),be(null),ZP(),S.discrete(Ie.direction==="csv2json"?"csv_to_json":"json_to_csv","permalink",Ie.input)},[Ie,S]);const Le=async(fe,Ze)=>{if(!VX(fe)){g(`Can't read "${fe.name}" as text — drop a ${A?".csv / .tsv":".json"} file.`);return}g(null),m(!0);try{const V=await xS(fe,y);ee.current={file:fe,source:Ze,text:V},ne.current={direction:A?"csv_to_json":"json_to_csv",via:Ze==="drop"?"drag":"file",text:V},Qe(V),h(fe.name),m(!1)}catch{m(!1),g(`Couldn't read "${fe.name}".`)}},nt=async fe=>{const Ze=y;w(fe);const V=ee.current;if(!(!V||l!==V.text)){m(!0);try{const pe=await xS(V.file,fe);ee.current={...V,text:pe},ne.current={direction:A?"csv_to_json":"json_to_csv",via:V.source==="drop"?"drag":"file",text:pe},o(J=>({...J,present:pe})),m(!1)}catch{m(!1),w(Ze),g(`Couldn't read "${V.file.name}".`)}}},_e=v.useCallback(fe=>{g(null),Qe(fe),S.edit(A?"csv_to_json":"json_to_csv",fe)},[Qe,A,S]);v.useEffect(()=>{const fe=Ze=>{var pe;const V=(pe=Ze.clipboardData)==null?void 0:pe.getData("text/plain");!V||DG(Ze.target)||(Ze.preventDefault(),Ze.stopPropagation(),h(null),_e(V))};return document.addEventListener("paste",fe,!0),()=>document.removeEventListener("paste",fe,!0)},[_e]);const ft=O.ok?UG(O.rows,O.cols):null,ut=!O.ok&&L?"Last valid result — input has errors":null,vt=O.ok&&O.warnings&&O.warnings.length>0?O.warnings:null,he=l.length>DS,rt=()=>{$f({via:"copy",format:A?"csv":"json"}),PS(l)},st=()=>{$f({via:"copy",format:A?"json":"csv"});const fe=$?ce:L;fe&&PS(fe)},Ve=()=>{$f({via:"download",format:A?"csv":"json"}),IS(l,d??(A?"data.csv":"data.json"),{mime:A?"text/csv":"application/json",bom:A})},sn=()=>{$f({via:"download",format:A?"json":"csv"}),IS(($?ce:L)??"",IG(d,A?"csv2json":"json2csv"),{mime:A?"application/json":"text/csv",bom:!A})},wt=M.jsx(HX,{format:I,input:l,onInputChange:_e,onCellCommit:_e,onFile:Le,onTryExample:()=>{g(null);const fe=A?_G:NG;Qe(fe),S.edit(A?"csv_to_json":"json_to_csv",fe)},onClear:()=>{Qe(""),h(null),ue(!1),be(null),S.cancel()},onCopy:rt,onDownload:Ve,canUndo:it,canRedo:Je,onUndo:Wt,onRedo:Pe,collapseIndexedArrays:a.collapseIndexedArrays??!0,onToggleCollapseIndexedArrays:()=>u(fe=>({...fe,collapseIndexedArrays:!(fe.collapseIndexedArrays??!0)})),filename:d,reading:p,meta:ft,error:null,notice:b,delimiter:a.separator==="auto"?void 0:a.separator,dark:t==="dark"}),ct=M.jsx(qX,{format:_,inputEmpty:P,outputText:Ge,error:O.ok?null:O.error,meta:ft,staleNotice:ut,warnings:vt,edited:$,editable:$e,delimiter:a.separator==="auto"?void 0:a.separator,dark:t==="dark",onCopy:st,onDownload:sn,onOutputChange:at,onRevert:_t,onDiscardReconvert:_t});return M.jsxs("div",{className:"flex min-h-svh flex-col bg-background text-foreground",children:[M.jsx("h1",{className:"sr-only",children:"CSV to JSON and JSON to CSV converter"}),M.jsxs("div",{className:"flex h-svh min-h-0 flex-col",children:[M.jsx(OD,{}),M.jsx(eG,{theme:t,onToggleTheme:n,slot:M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx(dG,{}),M.jsx(ND,{})]})}),Y&&(R.phase==="loading"||R.phase==="not-found"||R.phase==="unsupported"||R.phase==="error")?M.jsx(QX,{phase:R.phase,message:R.phase==="error"?R.message:void 0,onRetry:R.retry}):null,M.jsx(JX,{layout:E,split:c,onSplitChange:f,left:wt,right:ct,children:M.jsx(ED,{direction:r,onFlip:me})}),M.jsx(XX,{direction:r,options:a,onChange:fe=>u(Ze=>({...Ze,...fe})),uploadEncoding:y,onUploadEncodingChange:nt,notice:he?"Large file — converting on pause":null})]}),M.jsx(MD,{})]})}K2(document.getElementById("root")).render(M.jsx(v.StrictMode,{children:M.jsx(XG,{})}));document.getElementById("root").removeAttribute("inert");QP();JP();export{CW as C,Pn as R,Y4 as T,na as a,x3 as b,YP as c,jl as i,G4 as m,v as r,Hr as s}; diff --git a/app/dist/assets/index-GG3btOr8.css b/app/dist/assets/index-GG3btOr8.css deleted file mode 100644 index ca25082..0000000 --- a/app/dist/assets/index-GG3btOr8.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--color-amber-100:oklch(96.2% .059 95.617);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-600:oklch(58.8% .158 241.966);--spacing:.25rem;--container-sm:24rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-muted-foreground:hsl(var(--muted-foreground))}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-3{inset:calc(var(--spacing) * 3)}.inset-x-0{inset-inline:0}.-top-1\.5{top:calc(var(--spacing) * -1.5)}.top-0{top:0}.top-1{top:var(--spacing)}.top-1\/2{top:50%}.top-9{top:calc(var(--spacing) * 9)}.top-\[var\(--split\)\]{top:var(--split)}.right-0{right:0}.right-1{right:var(--spacing)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.left-0{left:0}.left-1\.5{left:calc(var(--spacing) * 1.5)}.left-1\/2{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.row-0{grid-row:0}.row-10{grid-row:10}.row-59{grid-row:59}.row-60{grid-row:60}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-11{width:calc(var(--spacing) * 11);height:calc(var(--spacing) * 11)}.h-0{height:0}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-\[18px\]{height:18px}.h-\[var\(--split\)\]{height:var(--split)}.h-svh{height:100svh}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-0{min-height:0}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-\[42px\]{min-height:42px}.min-h-svh{min-height:100svh}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.max-w-44{max-width:calc(var(--spacing) * 44)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-32{min-width:calc(var(--spacing) * 32)}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[2px\]{--tw-translate-x:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[15px\]{--tw-translate-x:15px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.resize{resize:both}.resize-none{resize:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:hsl(var(--border))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[7px\]{border-radius:7px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-border{border-color:hsl(var(--border))}.border-foreground{border-color:hsl(var(--foreground))}.border-primary,.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-ring{border-color:hsl(var(--ring))}.bg-amber-100{background-color:var(--color-amber-100)}.bg-background,.bg-background\/80{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/80{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.bg-border{background-color:hsl(var(--border))}.bg-foreground{background-color:hsl(var(--foreground))}.bg-muted,.bg-muted\/30{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,hsl(var(--muted)) 30%,transparent)}}.bg-muted\/50{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,hsl(var(--muted)) 50%,transparent)}}.bg-muted\/60{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/60{background-color:color-mix(in oklab,hsl(var(--muted)) 60%,transparent)}}.bg-panel{background-color:hsl(var(--panel))}.bg-primary{background-color:hsl(var(--primary))}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-3{padding:calc(var(--spacing) * 3)}.p-6{padding:calc(var(--spacing) * 6)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0{padding-block:0}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-px{padding-block:1px}.pr-1\.5{padding-right:calc(var(--spacing) * 1.5)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SF Mono,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12\.5px\]{font-size:12.5px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.1em\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-\[0\.18em\]{--tw-tracking:.18em;letter-spacing:.18em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-destructive{color:hsl(var(--destructive))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground,.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-panel{color:hsl(var(--panel))}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.decoration-border{-webkit-text-decoration-color:hsl(var(--border));text-decoration-color:hsl(var(--border))}.underline-offset-2{text-underline-offset:2px}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xs{--tw-shadow:0 1px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-ring\/50{--tw-ring-color:hsl(var(--ring))}@supports (color:color-mix(in lab,red,red)){.ring-ring\/50{--tw-ring-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:text-muted-foreground::placeholder,.placeholder\:text-muted-foreground\/50::placeholder{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-muted-foreground\/50::placeholder{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.placeholder\:text-muted-foreground\/60::placeholder{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-muted-foreground\/60::placeholder{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.last\:mb-0:last-child{margin-bottom:0}@media (hover:hover){.hover\:border-foreground:hover{border-color:hsl(var(--foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.hover\:border-muted-foreground\/50:hover{border-color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:decoration-foreground:hover{-webkit-text-decoration-color:hsl(var(--foreground));text-decoration-color:hsl(var(--foreground))}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:border-sky-600:focus-visible{border-color:var(--color-sky-600)}.focus-visible\:ring-3:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:hsl(var(--ring))}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-1:focus-visible{outline-offset:1px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-ring:focus-visible{outline-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media not all and (min-width:48rem){.max-md\:gap-1{gap:var(--spacing)}.max-md\:gap-2{gap:calc(var(--spacing) * 2)}}@media not all and (min-width:40rem){.max-sm\:static{position:static}.max-sm\:inset-x-2{inset-inline:calc(var(--spacing) * 2)}.max-sm\:top-14{top:calc(var(--spacing) * 14)}.max-sm\:w-auto{width:auto}}@media (min-width:40rem){.sm\:inline{display:inline}.sm\:max-w-64{max-width:calc(var(--spacing) * 64)}.sm\:max-w-none{max-width:none}}@media (min-width:48rem){.md\:top-0{top:0}.md\:right-auto{right:auto}.md\:bottom-0{bottom:0}.md\:-left-1\.5{left:calc(var(--spacing) * -1.5)}.md\:left-\[var\(--split\)\]{left:var(--split)}.md\:h-12{height:calc(var(--spacing) * 12)}.md\:h-auto{height:auto}.md\:w-0{width:0}.md\:w-3{width:calc(var(--spacing) * 3)}.md\:w-\[var\(--split\)\]{width:var(--split)}.md\:cursor-col-resize{cursor:col-resize}.md\:flex-row{flex-direction:row}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.md\:py-0{padding-block:0}}.dark\:bg-amber-400\/15:is(.dark *){background-color:#fcbb0026}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-400\/15:is(.dark *){background-color:color-mix(in oklab,var(--color-amber-400) 15%,transparent)}}.dark\:text-amber-400:is(.dark *){color:var(--color-amber-400)}.dark\:focus-visible\:border-sky-400:is(.dark *):focus-visible{border-color:var(--color-sky-400)}.\[\&_svg\]\:size-3\.5 svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}}:root{--panel:0 0% 100%;--background:0 0% 100%;--foreground:240 10% 3.9%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--border:240 5.9% 90%;--primary:240 5.9% 10%;--primary-foreground:0 0% 98%;--secondary:240 4.8% 95.9%;--secondary-foreground:240 5.9% 10%;--accent:240 4.8% 95.9%;--accent-foreground:240 5.9% 10%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--ring:240 5% 64.9%;--radius:.625rem}.dark{--background:240 10% 3.9%;--panel:240 6% 7%;--foreground:0 0% 98%;--muted:240 3.7% 15.9%;--muted-foreground:240 5% 64.9%;--border:240 3.7% 15.9%;--primary:0 0% 98%;--primary-foreground:240 5.9% 10%;--secondary:240 3.7% 15.9%;--secondary-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--ring:240 4.9% 83.9%}body{background-color:var(--color-background);color:var(--color-foreground)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}.gdg-mnuv029{word-break:break-word;-webkit-touch-callout:default;padding-top:6px}.gdg-mnuv029>*{margin:0}.gdg-mnuv029 *:last-child{margin-bottom:0}.gdg-mnuv029 p img{width:100%}.gdg-d19meir1{position:absolute;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;overflow:hidden;box-sizing:border-box;--overlay-top:var(--d19meir1-0);left:var(--d19meir1-1);top:var(--d19meir1-0);min-width:var(--d19meir1-2);min-height:var(--d19meir1-3);width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;max-height:calc(100vh - var(--d19meir1-4));font-family:var(--gdg-font-family);font-size:var(--gdg-editor-font-size);text-align:start}@-webkit-keyframes glide_fade_in-gdg-d19meir1{0%{opacity:0%}to{opacity:100%}}@keyframes glide_fade_in-gdg-d19meir1{0%{opacity:0%}to{opacity:100%}}.gdg-d19meir1.gdg-style{border-radius:2px;background-color:var(--gdg-bg-cell);box-shadow:0 0 0 1px var(--gdg-accent-color),0 0 1px #3e415666,0 6px 12px #3e415626;-webkit-animation:glide_fade_in-gdg-d19meir1 60ms 1;animation:glide_fade_in-gdg-d19meir1 60ms 1}.gdg-d19meir1.gdg-pad{padding:var(--d19meir1-5) 8.5px 3px}.gdg-d19meir1 .gdg-clip-region{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;overflow-y:auto;overflow-x:hidden;border-radius:2px;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.gdg-d19meir1 .gdg-clip-region .gdg-growing-entry{height:100%}.gdg-d19meir1 .gdg-clip-region input.gdg-input{width:100%;border:none;border-width:0;outline:none}.gdg-d19meir1 .gdg-clip-region textarea.gdg-input{border:none;border-width:0;outline:none}.gdg-b1ygi5by{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-top:auto;margin-bottom:auto}.gdg-b1ygi5by .boe-bubble{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:var(--gdg-rounding-radius,10px);padding:0 8px;height:20px;background-color:var(--gdg-bg-bubble);color:var(--gdg-text-dark);margin:2px}.gdg-b1ygi5by textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-n15fjm3e{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin:6px 0 3px;color:var(--gdg-text-dark)}.gdg-n15fjm3e>input{font-size:var(--gdg-editor-font-size);padding:0;font-family:var(--gdg-font-family);color:var(--gdg-text-dark);background-color:var(--gdg-bg-cell)}.gdg-d4zsq0x{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.gdg-d4zsq0x .doe-bubble{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 8px;height:24px;background-color:var(--gdg-bg-cell);color:var(--gdg-text-dark);margin:2px;border-radius:var(--gdg-rounding-radius,6px);box-shadow:0 0 1px #3e415666,0 1px 3px #3e415666}.gdg-d4zsq0x .doe-bubble img{height:16px;object-fit:contain;margin-right:4px}.gdg-d4zsq0x textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-i2iowwq{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%}.gdg-i2iowwq .gdg-centering-container{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%}.gdg-i2iowwq .gdg-centering-container img,.gdg-i2iowwq .gdg-centering-container canvas{max-height:calc(100vh - var(--overlay-top) - 20px);object-fit:contain;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.gdg-i2iowwq .gdg-centering-container canvas{max-width:380px}.gdg-i2iowwq .gdg-edit-icon{position:absolute;top:12px;right:0;width:48px;height:48px;color:var(--gdg-accent-color);cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.gdg-i2iowwq .gdg-edit-icon>*{width:24px;height:24px}.gdg-i2iowwq textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-u1rrojo{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-height:21px}.gdg-u1rrojo .gdg-link-area{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;cursor:pointer;margin-right:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gdg-link-color);-webkit-text-decoration:underline!important;text-decoration:underline!important}.gdg-u1rrojo .gdg-edit-icon{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:32px;color:var(--gdg-accent-color);cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.gdg-u1rrojo .gdg-edit-icon>*{width:24px;height:24px}.gdg-u1rrojo textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-m1pnx84e{min-width:var(--m1pnx84e-0);width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;position:relative;color:var(--gdg-text-dark)}.gdg-m1pnx84e .gdg-g1y0xocz{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;min-width:0}.gdg-m1pnx84e .gdg-spacer{-webkit-flex:1;-ms-flex:1;flex:1}.gdg-m1pnx84e .gdg-edit-icon{position:relative;cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--gdg-accent-color);padding:0;height:24px;width:24px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:all "0.125s ease";transition:all "0.125s ease";border-radius:6px}.gdg-m1pnx84e .gdg-edit-icon>*{width:16px;height:16px}.gdg-m1pnx84e .gdg-edit-hover:hover{background-color:var(--gdg-accent-light);-webkit-transition:background-color .15s;transition:background-color .15s}.gdg-m1pnx84e .gdg-checkmark-hover:hover{color:#fff;background-color:var(--gdg-accent-color)}.gdg-m1pnx84e .gdg-md-edit-textarea{position:relative;top:0;left:0;width:0px;height:0px;margin-top:25px;opacity:0;padding:0}.gdg-m1pnx84e .gdg-ml-6{margin-left:6px}.gdg-s1dgczr6 .dvn-scroller{overflow:var(--s1dgczr6-0);-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);transform:translateZ(0)}.gdg-s1dgczr6 .dvn-hidden{visibility:hidden}.gdg-s1dgczr6 .dvn-scroll-inner{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;pointer-events:none}.gdg-s1dgczr6 .dvn-scroll-inner>*{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.gdg-s1dgczr6 .dvn-scroll-inner .dvn-spacer{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.gdg-s1dgczr6 .dvn-scroll-inner .dvn-stack{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.gdg-s1dgczr6 .dvn-underlay>*{position:absolute;left:0;top:0}.gdg-s1dgczr6 canvas{outline:none}.gdg-s1dgczr6 canvas *{height:0}.gdg-izpuzkl{position:absolute;left:0;right:0;top:0;bottom:0;width:100%;height:100%;border-radius:0;resize:none;white-space:pre-wrap;min-width:100%;overflow:hidden;border:0;background-color:transparent;font-size:var(--gdg-editor-font-size);line-height:16px;font-family:var(--gdg-font-family);-webkit-text-fill-color:var(--gdg-text-dark);color:var(--gdg-text-dark);padding:0;margin:0}.gdg-izpuzkl::-webkit-input-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl::-moz-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl:-ms-input-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl::placeholder{color:var(--gdg-text-light)}.gdg-invalid .gdg-izpuzkl{-webkit-text-decoration:underline;text-decoration:underline;-webkit-text-decoration-color:#d60606;text-decoration-color:#d60606}.gdg-s69h75o{visibility:hidden;white-space:pre-wrap;word-wrap:break-word;width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:100%;min-width:100%;font-size:var(--gdg-editor-font-size);line-height:16px;font-family:var(--gdg-font-family);color:var(--gdg-text-dark);padding:0 0 2px;margin:0}.gdg-g1y0xocz{position:relative;margin-top:6px}.gdg-seveqep{position:absolute;top:4px;right:20px;background-color:var(--gdg-bg-cell);color:var(--gdg-text-dark);padding:8px;border:1px solid var(--gdg-border-color);border-radius:6px;font-size:var(--gdg-editor-font-size);-webkit-animation:gdg-search-fadein-gdg-seveqep .15s forwards;animation:gdg-search-fadein-gdg-seveqep .15s forwards}.gdg-seveqep.out{-webkit-animation:gdg-search-fadeout-gdg-seveqep .15s forwards;animation:gdg-search-fadeout-gdg-seveqep .15s forwards}.gdg-seveqep .gdg-search-bar-inner{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.gdg-seveqep .gdg-search-status{padding-top:4px;font-size:11px}.gdg-seveqep .gdg-search-progress{position:absolute;height:4px;left:0;bottom:0;background-color:var(--gdg-text-light)}.gdg-seveqep input{width:220px;color:var(--gdg-textDark);background-color:var(--gdg-bg-cell);border:none;border-width:0;outline:none}.gdg-seveqep button{width:24px;height:24px;padding:0;border:none;outline:none;background:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;color:var(--gdg-text-medium)}.gdg-seveqep button:hover{color:var(--gdg-text-dark)}.gdg-seveqep button .button-icon{width:16px;height:16px}.gdg-seveqep button:disabled{opacity:.4;pointer-events:none}@-webkit-keyframes gdg-search-fadeout-gdg-seveqep{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}to{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}}@keyframes gdg-search-fadeout-gdg-seveqep{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}to{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}}@-webkit-keyframes gdg-search-fadein-gdg-seveqep{0%{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}to{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}}@keyframes gdg-search-fadein-gdg-seveqep{0%{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}to{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}}.gdg-wmyidgi{position:relative;min-width:10px;min-height:10px;max-width:100%;max-height:100%;width:var(--wmyidgi-0);height:var(--wmyidgi-1);overflow:hidden;overflow:clip;direction:ltr}.gdg-wmyidgi>:first-child{position:absolute;left:0;top:0;width:100%;height:100%}.gdg-r17m35ur{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;border:none;outline:none;background-color:var(--gdg-bg-header-has-focus);border-radius:9px;padding:0 8px;box-shadow:0 0 0 1px var(--gdg-border-color);color:var(--gdg-text-group-header);min-height:var(--r17m35ur-0);font:var(--gdg-header-font-style) var(--gdg-font-family)}.gdg-c1tqibwd{padding:0 8px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--gdg-bg-header)} diff --git a/app/dist/assets/number-overlay-editor-CVkV7bZk.js b/app/dist/assets/number-overlay-editor-DN6llsFj.js similarity index 99% rename from app/dist/assets/number-overlay-editor-CVkV7bZk.js rename to app/dist/assets/number-overlay-editor-DN6llsFj.js index 5daeb6b..1780044 100644 --- a/app/dist/assets/number-overlay-editor-CVkV7bZk.js +++ b/app/dist/assets/number-overlay-editor-DN6llsFj.js @@ -1,4 +1,4 @@ -import{s as Be,R as Y,r as O}from"./index-3IqDs7ii.js";const Fe=Be("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function pe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a=p?a=a+ge("0",f-p):a=(a.substring(0,f)||"0")+"."+a.substring(f),r+a}function me(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,f=a.afterDecimal,p=a.hasNegation,m=parseFloat("0."+(f||"0")),x=f.length<=t?"0."+f:m.toFixed(t),h=x.split("."),s=i;i&&Number(h[0])&&(s=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},h[0]));var S=be(h[1]||"",t,r),y=p?"-":"",l=n?".":"";return""+y+s+l+S}function J(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ne=_e(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&rr&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,f){f===void 0&&(f=$e);var p=a.findIndex(function(k){return k}),m=e.slice(0,p);!t&&!r.startsWith(m)&&(t=m,r=m+r,n=n+m.length);for(var x=r.length,h=e.length,s={},S=new Array(x),y=0;y0&&S[g]===-1;)g--;var F=g===-1||S[g]===-1?0:S[g]+1;return F>B?B:n-F=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;rP.length-f.length||HL||s>e.length-f.length)&&(W=s),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(l))||[]).join("");var U=e.indexOf(l);e=e.replace(new RegExp(ye(l),"g"),function(c,N){return N===U?".":""});var $=se(e,a),Q=$.beforeDecimal,te=$.afterDecimal,d=$.addNegation;return x.end-x.start=p?a=a+ge("0",f-p):a=(a.substring(0,f)||"0")+"."+a.substring(f),r+a}function me(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,f=a.afterDecimal,p=a.hasNegation,m=parseFloat("0."+(f||"0")),x=f.length<=t?"0."+f:m.toFixed(t),h=x.split("."),s=i;i&&Number(h[0])&&(s=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},h[0]));var S=be(h[1]||"",t,r),y=p?"-":"",l=n?".":"";return""+y+s+l+S}function J(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ne=_e(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&rr&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,f){f===void 0&&(f=$e);var p=a.findIndex(function(k){return k}),m=e.slice(0,p);!t&&!r.startsWith(m)&&(t=m,r=m+r,n=n+m.length);for(var x=r.length,h=e.length,s={},S=new Array(x),y=0;y0&&S[g]===-1;)g--;var F=g===-1||S[g]===-1?0:S[g]+1;return F>B?B:n-F=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;rP.length-f.length||HL||s>e.length-f.length)&&(W=s),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(l))||[]).join("");var U=e.indexOf(l);e=e.replace(new RegExp(ye(l),"g"),function(c,N){return N===U?".":""});var $=se(e,a),Q=$.beforeDecimal,te=$.afterDecimal,d=$.addNegation;return x.end-x.start - - + + diff --git a/app/scripts/patch-csv2json.mjs b/app/scripts/patch-csv2json.mjs index 356f589..5fbf81d 100644 --- a/app/scripts/patch-csv2json.mjs +++ b/app/scripts/patch-csv2json.mjs @@ -233,4 +233,37 @@ if (patched.includes(NAMES_TAB_WITH_PIPE)) { process.exit(1); } +// ------------------------------------------------ Stack-safe transpose (AC-7) +// `if (options.transpose) a = zip.apply(this, a);` spreads every row of `a` +// onto the JS call stack as a function argument, throwing `RangeError: Maximum +// call stack size exceeded` above ~125k rows. Replace with an iterative loop. +const TRANSPOSE_CALL = ` if (options.transpose) a = zip.apply(this, a);`; +const TRANSPOSE_SAFE = [ + ` if (options.transpose) {`, + ` var maxCols = 0;`, + ` for (var r = 0; r < a.length; r++) {`, + ` if (a[r].length > maxCols) maxCols = a[r].length;`, + ` }`, + ` var transposed = new Array(maxCols);`, + ` for (var c = 0; c < maxCols; c++) {`, + ` var col = new Array(a.length);`, + ` for (var r2 = 0; r2 < a.length; r2++) {`, + ` col[r2] = a[r2][c];`, + ` }`, + ` transposed[c] = col;`, + ` }`, + ` a = transposed;`, + ` }`, +].join("\r\n"); + +if (patched.includes(TRANSPOSE_SAFE)) { + console.log("patch-csv2json: transpose already stack-safe"); +} else if (patched.includes(TRANSPOSE_CALL)) { + patched = patched.split(TRANSPOSE_CALL).join(TRANSPOSE_SAFE); + console.log("patch-csv2json: replaced zip.apply transpose with iterative loop"); +} else { + console.error("patch-csv2json: transpose call not found - package changed upstream, investigate before shipping"); + process.exit(1); +} + if (patched !== source) writeFileSync(pkg, patched); diff --git a/app/src/App.test.tsx b/app/src/App.test.tsx index 974e3d8..53ff5de 100644 --- a/app/src/App.test.tsx +++ b/app/src/App.test.tsx @@ -16,8 +16,17 @@ vi.mock("@/lib/download", async (importOriginal) => ({ ...(await importOriginal()), downloadText: vi.fn(), })); +vi.mock("@/lib/convert", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + convertText: vi.fn(actual.convertText), + }; +}); import { copyText } from "@/lib/clipboard"; +import { convertText } from "@/lib/convert"; import { downloadText } from "@/lib/download"; +import { ErrorBoundary } from "./components/ErrorBoundary"; async function flip() { const user = userEvent.setup(); @@ -1050,5 +1059,150 @@ describe("contextual CSV indexed array toggle pill (feat/csv-indexed-arrays)", ( }); }); +function createStreamableFile( + name: string, + content: string, + type = "text/csv" +): File { + const bytes = new TextEncoder().encode(content); + const file = new File([bytes], name, { type }); + return Object.assign(file, { + stream: () => + new ReadableStream({ + start(controller) { + controller.enqueue(bytes); + controller.close(); + }, + }), + }) as unknown as File; +} + +describe("CSV upload responsiveness & blank-page resilience (AC-7 / art_cPIu3u6a)", () => { + it("runs convertText at most ONCE for an uploaded CSV file and renders output immediately without flashing 'Resolve the error to see output.'", async () => { + render(); + vi.mocked(convertText).mockClear(); + + const uploadedCsv = "id,album,year\n1,Elephant,2003\n2,De Stijl,2000"; + const file = createStreamableFile("albums.csv", uploadedCsv); + + fireEvent.change(screen.getByTestId("file-input"), { + target: { files: [file] }, + }); + + await waitFor(() => { + expect(screen.getByTestId("output-view").textContent).toContain( + '"Elephant"' + ); + }); + + // Must never display the false error placeholder when error is null + expect( + screen.queryByText("Resolve the error to see output.") + ).not.toBeInTheDocument(); + + // convertText must be invoked at most ONCE with the uploaded CSV text + const callsForUploadedCsv = vi + .mocked(convertText) + .mock.calls.filter(([, text]) => text === uploadedCsv); + expect(callsForUploadedCsv).toHaveLength(1); + }); + + it("shows 'Converting…' (output-converting-placeholder) instead of 'Resolve the error to see output.' while typing debounce is pending", () => { + render(); + + // Trigger a paste so input becomes non-empty synchronously while + // debouncedInput is still "" during the 150ms debounce window. + fireEvent.paste(screen.getByTestId("input-pane"), { + clipboardData: { getData: () => "name,score\nAda,100" }, + }); + + expect( + screen.getByTestId("output-converting-placeholder") + ).toHaveTextContent("Converting…"); + expect( + screen.queryByText("Resolve the error to see output.") + ).not.toBeInTheDocument(); + }); + + it("caps ultra-large JSON output preview in CodeMirror with large-output-preview-banner while Copy and Download preserve the full output", async () => { + render(); + + // Build a CSV whose pretty-printed JSON exceeds READONLY_PREVIEW_MAX_CHARS (2,000,000 chars) + const rowLine = + "100001,The White Stripes,Elephant,2003, XL Recordings ,Alternative Rock,true\n"; + const rowCount = 12_500; + const largeCsv = + "id,artist,album,year,label,genre,active\n" + rowLine.repeat(rowCount); + const file = createStreamableFile("catalog-large.csv", largeCsv); + + fireEvent.change(screen.getByTestId("file-input"), { + target: { files: [file] }, + }); + + const banner = await screen.findByTestId("large-output-preview-banner"); + expect(banner).toHaveTextContent( + /Showing first 512 KB preview in editor — Copy and Download include the full output/ + ); + + // Editor DOM stays capped around 512 KB while Copy & Download receive the full >2 MB JSON + const editorText = screen.getByTestId("output-view").textContent ?? ""; + expect(editorText.length).toBeLessThan(600 * 1024); + + vi.mocked(copyText).mockClear(); + fireEvent.click(screen.getByTestId("copy-output")); + const copiedText = vi.mocked(copyText).mock.lastCall?.[0] ?? ""; + expect(copiedText.length).toBeGreaterThan(2_000_000); + + vi.mocked(downloadText).mockClear(); + fireEvent.click(screen.getByTestId("download-output")); + const downloadedText = vi.mocked(downloadText).mock.lastCall?.[0] ?? ""; + expect(downloadedText).toBe(copiedText); + }); + + it("recovers from an unexpected pane render throw via ErrorBoundary instead of unmounting to a blank page", () => { + const consoleErrorSpy = vi + .spyOn(console, "error") + .mockImplementation(() => {}); + try { + let shouldThrow = true; + function BombPane() { + if (shouldThrow) { + throw new Error("Simulated canvas assertion failure"); + } + return
    Pane recovered cleanly
    ; + } + + const onReset = vi.fn(() => { + shouldThrow = false; + }); + + render( + + + + ); + + expect(screen.getByTestId("error-boundary-fallback")).toHaveTextContent( + "CSV input encountered a display error." + ); + expect(screen.getByTestId("error-boundary-fallback")).toHaveTextContent( + "Simulated canvas assertion failure" + ); + + fireEvent.click(screen.getByTestId("error-boundary-reset")); + expect(onReset).toHaveBeenCalledTimes(1); + expect(screen.getByTestId("recovered-pane")).toHaveTextContent( + "Pane recovered cleanly" + ); + } finally { + consoleErrorSpy.mockRestore(); + } + }); +}); + + diff --git a/app/src/App.tsx b/app/src/App.tsx index 679fba0..13a1219 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -158,6 +158,29 @@ export default function App() { input.length > LARGE_INPUT_CHARS ? LARGE_INPUT_DEBOUNCE_MS : DEBOUNCE_MS; const debouncedInput = useDebouncedValue(input, inputEmpty ? 0 : debounceMs); + // The upload still feeding the input — file, its ingest source, and the + // exact text its decode produced. The encoding select re-decodes the held + // file only while the input still IS that text: the mojibake-recovery + // flow (upload → mangled accents → switch label → fixed) works without a + // re-upload, while any edit, paste, flip, or clear quietly disarms it — + // a later encoding switch must never clobber text that moved on. + const uploadedRef = useRef<{ + file: File; + source: "picker" | "drop"; + text: string; + } | null>(null); + const pendingDiscreteEventRef = useRef<{ + direction: "csv_to_json" | "json_to_csv"; + via: "file" | "drag"; + text: string; + } | null>(null); + + // Discrete file uploads and encoding switches already have their complete + // payload — convert immediately instead of waiting for the typing pause + // debounce (which would leave `debouncedInput` empty for up to 1s). + const isDiscreteUploadInput = + input !== "" && uploadedRef.current?.text === input; + const effectiveInput = isDiscreteUploadInput ? input : debouncedInput; // Legacy permalinks: //<32-hex-id> hydrates the converter from the // S3 object, read-only. The URL is never rewritten; edits behave normally @@ -175,25 +198,34 @@ export default function App() { const permalink = useLegacyPermalink(permalinkPath); const result = useMemo( - () => convertText(direction, debouncedInput, options), - [direction, debouncedInput, options] + () => convertText(direction, effectiveInput, options), + [direction, effectiveInput, options] ); // Fire-time validity reads this; assigned after the memo so it always // holds the freshest state (see the tracker's isValid above). converterStateRef.current = { direction, options, - input, + input: effectiveInput, resultOk: result.ok, }; + useEffect(() => { + const pending = pendingDiscreteEventRef.current; + if (!pending || pending.text !== effectiveInput) return; + pendingDiscreteEventRef.current = null; + tracker.discrete(pending.direction, pending.via, pending.text); + }, [effectiveInput, result, tracker]); + // The last valid output survives parse failures (spec: States → Invalid // input, Direction flip rule). const [lastValidOutput, setLastValidOutput] = useState(null); useEffect(() => { - if (debouncedInput.trim() === "") return; + if (effectiveInput.trim() === "") return; if (result.ok) setLastValidOutput(result.text); - }, [result, debouncedInput]); + }, [result, effectiveInput]); + const currentValidOutput = + effectiveInput.trim() !== "" && result.ok ? result.text : lastValidOutput; // Editable output (edited-state machine, David-approved Option 2): the // first user modification freezes regeneration — input and option changes @@ -202,7 +234,7 @@ export default function App() { // reconvert, a valid flip, and paths that fully regenerate the output. const [outputEdited, setOutputEdited] = useState(false); const [editedOutput, setEditedOutput] = useState(null); - const displayedOutput = outputEdited ? editedOutput : lastValidOutput; + const displayedOutput = outputEdited ? editedOutput : currentValidOutput; // Editable window: CSV→JSON with a valid result — or an edited output, // which stays editable even after the input breaks (the freeze notice, // not a lockout, is the guard). Retained invalid-input results and the @@ -214,7 +246,7 @@ export default function App() { // that happen to land back on the derived text, which is not an edit. const handleOutputEdit = useCallback( (value: string) => { - if (value === lastValidOutput) { + if (value === currentValidOutput) { setOutputEdited(false); setEditedOutput(null); return; @@ -222,7 +254,7 @@ export default function App() { setOutputEdited(true); setEditedOutput(value); }, - [lastValidOutput] + [currentValidOutput] ); // Revert and Discard & reconvert both restore the derived output by @@ -330,18 +362,6 @@ export default function App() { ); }, [hydratedState, tracker]); - // The upload still feeding the input — file, its ingest source, and the - // exact text its decode produced. The encoding select re-decodes the held - // file only while the input still IS that text: the mojibake-recovery - // flow (upload → mangled accents → switch label → fixed) works without a - // re-upload, while any edit, paste, flip, or clear quietly disarms it — - // a later encoding switch must never clobber text that moved on. - const uploadedRef = useRef<{ - file: File; - source: "picker" | "drop"; - text: string; - } | null>(null); - // Upload decode — files never touch the network (spec: Input; the legacy // /upload endpoint is deleted). Bytes are decoded locally under the // selected label (spec B7 — issue #106); the utf-8 default is the exact @@ -358,16 +378,14 @@ export default function App() { try { const text = await decodeUpload(file, uploadEncoding); uploadedRef.current = { file, source, text }; + pendingDiscreteEventRef.current = { + direction: csvToJson ? "csv_to_json" : "json_to_csv", + via: source === "drop" ? "drag" : "file", + text, + }; commitInput(text); setFilename(file.name); setReading(false); - // A completed upload/drop is a discrete conversion input — fire - // immediately (the tracker still gates on a valid result + 2s window). - tracker.discrete( - csvToJson ? "csv_to_json" : "json_to_csv", - source === "drop" ? "drag" : "file", - text - ); } catch { setReading(false); setNotice(`Couldn't read "${file.name}".`); @@ -383,13 +401,13 @@ export default function App() { try { const text = await decodeUpload(uploaded.file, encoding); uploadedRef.current = { ...uploaded, text }; + pendingDiscreteEventRef.current = { + direction: csvToJson ? "csv_to_json" : "json_to_csv", + via: uploaded.source === "drop" ? "drag" : "file", + text, + }; setInputHistory((current) => ({ ...current, present: text })); setReading(false); - tracker.discrete( - csvToJson ? "csv_to_json" : "json_to_csv", - uploaded.source === "drop" ? "drag" : "file", - text - ); } catch { setReading(false); // The label must name the decode that produced the displayed text: diff --git a/app/src/changelog/entries.ts b/app/src/changelog/entries.ts index ee1d284..c540a99 100644 --- a/app/src/changelog/entries.ts +++ b/app/src/changelog/entries.ts @@ -34,6 +34,14 @@ export function newestFirst(entries: ChangelogEntry[]): ChangelogEntry[] { } export const changelogEntries: ChangelogEntry[] = [ + { + id: 13, + date: "2026-10-15", + tag: "fix", + title: "Faster large CSV uploads without page freezes", + summary: + "Uploading large CSV files now converts in a single pass without freezing the tab or flashing a false error state, previews multi-megabyte JSON outputs smoothly while keeping full Copy and Download, and decodes UTF-16 CSV exports automatically.", + }, { id: 12, date: "2026-10-15", diff --git a/app/src/components/ErrorBoundary.tsx b/app/src/components/ErrorBoundary.tsx new file mode 100644 index 0000000..ea933e4 --- /dev/null +++ b/app/src/components/ErrorBoundary.tsx @@ -0,0 +1,67 @@ +import { Component, type ErrorInfo, type ReactNode } from "react"; + +type ErrorBoundaryProps = { + children: ReactNode; + onReset?: () => void; + fallbackTitle?: string; +}; + +type ErrorBoundaryState = { + error: Error | null; +}; + +/** + * Isolates unexpected rendering or canvas assertion failures inside the + * converter workspace so a runtime throw in Glide Data Grid or CodeMirror + * renders a recoverable fallback instead of unmounting the React 19 root tree + * into a blank white page. + */ +export class ErrorBoundary extends Component< + ErrorBoundaryProps, + ErrorBoundaryState +> { + state: ErrorBoundaryState = { error: null }; + + static getDerivedStateFromError(error: Error): ErrorBoundaryState { + return { error }; + } + + componentDidCatch(error: Error, info: ErrorInfo): void { + console.error("Converter workspace error boundary caught:", error, info); + } + + private handleReset = () => { + this.setState({ error: null }); + this.props.onReset?.(); + }; + + render() { + if (this.state.error) { + return ( +
    +

    + {this.props.fallbackTitle ?? + "Something went wrong while rendering this view."} +

    +

    + {this.state.error.message} +

    + +
    + ); + } + + return this.props.children; + } +} diff --git a/app/src/components/InputPane.tsx b/app/src/components/InputPane.tsx index a429986..f231daf 100644 --- a/app/src/components/InputPane.tsx +++ b/app/src/components/InputPane.tsx @@ -96,6 +96,39 @@ function ActionButton({ ); } +/** + * Extract only the first CSV record (plus a tiny sample of subsequent lines so + * `detectSeparator` has context when `delimiter` is auto) without parsing + * tens of thousands of rows just to inspect column headers. + */ +function sliceFirstCsvRecord(csv: string): string { + const maxScan = Math.min(csv.length, 64 * 1024); + let inQuotes = false; + let recordsFound = 0; + for (let i = 0; i < maxScan; i += 1) { + const ch = csv[i]; + if (ch === '"') { + if (inQuotes && csv[i + 1] === '"') { + i += 1; + } else { + inQuotes = !inQuotes; + } + continue; + } + if (!inQuotes && (ch === "\n" || ch === "\r")) { + if (ch === "\r" && csv[i + 1] === "\n") { + i += 1; + } + recordsFound += 1; + // Keep up to 3 records so auto-separator detection still sees sample rows. + if (recordsFound >= 3) { + return csv.slice(0, i + 1); + } + } + } + return csv.slice(0, maxScan); +} + export function InputPane({ format, input, @@ -128,7 +161,8 @@ export function InputPane({ const isCsv = format === "CSV"; const indexedHeaderGroups = useMemo(() => { if (!isCsv || inputEmpty) return []; - const table = parseCsvTable(input, delimiter); + const headerSlice = sliceFirstCsvRecord(input); + const table = parseCsvTable(headerSlice, delimiter); return detectIndexedHeaderGroups(table.headers.map((h) => h.trim())); }, [isCsv, inputEmpty, input, delimiter]); const wrapperCandidates = useMemo( diff --git a/app/src/components/JsonCodeMirror.tsx b/app/src/components/JsonCodeMirror.tsx index 1bed46b..eb72adb 100644 --- a/app/src/components/JsonCodeMirror.tsx +++ b/app/src/components/JsonCodeMirror.tsx @@ -20,6 +20,29 @@ import { cn } from "@/lib/utils"; * editability tests. */ export const LINT_MAX_CHARS = 512 * 1024; +/** + * Above this size, skip the Lezer `json()` syntax parser so multi-megabyte + * JSON strings mount in plain-text virtualized mode without blocking the main + * thread for seconds. + */ +export const LARGE_DOC_MAX_CHARS = 512 * 1024; +/** + * Above this size in read-only output mode, cap the in-editor document + * preview to the first `LARGE_DOC_MAX_CHARS` characters (aligned to a line + * boundary) and display a notice banner while Copy and Download still export + * the complete output string. + */ +export const LARGE_OUTPUT_PREVIEW_MAX_CHARS = 2_000_000; + +function slicePreviewOnLineBoundary(text: string, maxChars: number): string { + if (text.length <= maxChars) return text; + const lastNewline = text.lastIndexOf("\n", maxChars); + if (lastNewline > maxChars * 0.5) { + return text.slice(0, lastNewline); + } + return text.slice(0, maxChars); +} + const sizeGatedJsonLinter = (view: EditorView): Diagnostic[] => view.state.doc.length > LINT_MAX_CHARS ? [] : jsonParseLinter()(view); @@ -97,8 +120,16 @@ export function JsonCodeMirror({ const darkRef = useRef(dark); const themeCompartmentRef = useRef(null); const editabilityCompartmentRef = useRef(null); + const languageCompartmentRef = useRef(null); const editableProp = editable ?? onChange !== undefined; const wasEditableRef = useRef(editableProp); + const isLargeDoc = value.length > LARGE_DOC_MAX_CHARS; + const wasLargeDocRef = useRef(isLargeDoc); + const isPreviewTruncated = + !editableProp && value.length > LARGE_OUTPUT_PREVIEW_MAX_CHARS; + const editorValue = isPreviewTruncated + ? slicePreviewOnLineBoundary(value, LARGE_DOC_MAX_CHARS) + : value; // True while the value-sync effect applies an external value: that // transaction must not echo back through the update listener as a user // edit — it would mark the output edited on every derived regeneration. @@ -107,7 +138,7 @@ export function JsonCodeMirror({ // One extension bundle per role; the compartment swaps it at runtime. // Stable identity: it only touches refs, and the effects below key on it. const editabilityExtensions = useCallback( - (canEdit: boolean): Extension[] => + (canEdit: boolean, largeDoc: boolean): Extension[] => canEdit ? [ EditorView.updateListener.of((update) => { @@ -115,7 +146,7 @@ export function JsonCodeMirror({ onChangeRef.current?.(update.state.doc.toString()); } }), - linter(sizeGatedJsonLinter, { delay: 300 }), + ...(largeDoc ? [] : [linter(sizeGatedJsonLinter, { delay: 300 })]), ] : [EditorState.readOnly.of(true), EditorView.editable.of(false)], [] @@ -126,23 +157,25 @@ export function JsonCodeMirror({ if (!host) return; const themeCompartment = new Compartment(); const editabilityCompartment = new Compartment(); + const languageCompartment = new Compartment(); const state = EditorState.create({ - doc: value, + doc: editorValue, extensions: [ - json(), + languageCompartment.of(isLargeDoc ? [] : json()), EditorView.lineWrapping, history(), keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab]), baseTheme, themeCompartment.of(syntaxHighlighting(jsonHighlight(dark))), - editabilityCompartment.of(editabilityExtensions(editableProp)), + editabilityCompartment.of(editabilityExtensions(editableProp, isLargeDoc)), ...(placeholder ? [cmPlaceholder(placeholder)] : []), ], }); const view = new EditorView({ state, parent: host }); themeCompartmentRef.current = themeCompartment; editabilityCompartmentRef.current = editabilityCompartment; + languageCompartmentRef.current = languageCompartment; onReady?.(view); viewRef.current = view; return () => { @@ -157,16 +190,36 @@ export function JsonCodeMirror({ useEffect(() => { const view = viewRef.current; if (!view) return; - if (view.state.doc.toString() === value) return; + const languageCompartment = languageCompartmentRef.current; + const editabilityCompartment = editabilityCompartmentRef.current; + const effects = []; + if (isLargeDoc !== wasLargeDocRef.current) { + wasLargeDocRef.current = isLargeDoc; + if (languageCompartment) { + effects.push(languageCompartment.reconfigure(isLargeDoc ? [] : json())); + } + if (editabilityCompartment) { + effects.push( + editabilityCompartment.reconfigure( + editabilityExtensions(editableProp, isLargeDoc) + ) + ); + } + } + const currentDoc = view.state.doc.toString(); + if (currentDoc === editorValue && effects.length === 0) return; applyingExternalRef.current = true; try { view.dispatch({ - changes: { from: 0, to: view.state.doc.length, insert: value }, + ...(currentDoc !== editorValue + ? { changes: { from: 0, to: view.state.doc.length, insert: editorValue } } + : {}), + ...(effects.length > 0 ? { effects } : {}), }); } finally { applyingExternalRef.current = false; } - }, [value]); + }, [editorValue, isLargeDoc, editableProp, editabilityExtensions]); // Runtime editability swap (output editor: editable on a valid result, // read-only for a retained invalid-input result). @@ -177,9 +230,11 @@ export function JsonCodeMirror({ if (editableProp === wasEditableRef.current) return; wasEditableRef.current = editableProp; view.dispatch({ - effects: compartment.reconfigure(editabilityExtensions(editableProp)), + effects: compartment.reconfigure( + editabilityExtensions(editableProp, isLargeDoc) + ), }); - }, [editableProp, editabilityExtensions]); + }, [editableProp, isLargeDoc, editabilityExtensions]); // Dark-mode token palette swap. useEffect(() => { @@ -197,9 +252,24 @@ export function JsonCodeMirror({ // font-mono consumes the --font-mono theme token (index.css): JSON must // render fixed-width in the editor AND the read-only output, in both // themes. The CodeMirror content inherits it (fontFamily: inherit). - // px-5 py-4 is the v0 text-surface padding (matches the raw textarea). - className={cn("min-h-0 flex-1 overflow-hidden px-5 py-4 font-mono", className)} - ref={hostRef} - /> + className={cn( + "flex min-h-0 flex-1 flex-col overflow-hidden font-mono", + className + )} + > + {isPreviewTruncated ? ( +
    + Showing first 512 KB preview in editor — Copy and Download include the full output +
    + ) : null} +
    +
    ); } diff --git a/app/src/components/OutputPane.tsx b/app/src/components/OutputPane.tsx index cf190f0..044642a 100644 --- a/app/src/components/OutputPane.tsx +++ b/app/src/components/OutputPane.tsx @@ -1,6 +1,9 @@ import { Copy, Download, RotateCcw } from "lucide-react"; import { CsvTable } from "@/components/CsvTable"; -import { JsonCodeMirror } from "@/components/JsonCodeMirror"; +import { + JsonCodeMirror, + LARGE_OUTPUT_PREVIEW_MAX_CHARS, +} from "@/components/JsonCodeMirror"; import { PaneShell } from "@/components/PaneShell"; import { actionButtonClass } from "@/components/pane-actions"; @@ -178,7 +181,9 @@ export function OutputPane({ isJson ? ( ) - ) : ( + ) : error ? (
    Resolve the error to see output.
    + ) : ( +
    + Converting… +
    )}

    CSV to JSON and JSON to CSV converter

    csvjson
    CSV

    Paste CSV or TSV here

    or drag & drop a file anywhere in this pane — you can also paste anywhere on the page (⌘V / Ctrl+V)

    JSON
    Your JSON appears here.
    diff --git a/app/src/lib/__tests__/convert.test.ts b/app/src/lib/__tests__/convert.test.ts index 76431bc..38e3d84 100644 --- a/app/src/lib/__tests__/convert.test.ts +++ b/app/src/lib/__tests__/convert.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from "vitest"; +import { describe, expect, it, vi } from "vitest"; import csv2json from "csvjson-csv2json"; import { convertText, @@ -1172,5 +1172,55 @@ describe("indexed CSV header array collapse (feat/csv-indexed-arrays)", () => { }); }); +describe("CSV upload performance & resilience guards (AC-7 / art_cPIu3u6a)", () => { + it("guards tryParseJsonLiteral by first/last character so plain cells, numbers, booleans, and null never invoke JSON.parse", () => { + const parseSpy = vi.spyOn(JSON, "parse"); + try { + const csv = [ + "id,name,date,active,empty,unfinished,obj,arr,quoted", + '1,Alice,2026-10-15,true,null,{not_json,"{""k"":1}","[1,2]","""hello"""', + ].join("\n"); + const out = csvToJson(csv, { parseNumbers: true, parseJSON: true }); + expect(out).toEqual([ + { + id: 1, + name: "Alice", + date: "2026-10-15", + active: true, + empty: null, + unfinished: "{not_json", + obj: { k: 1 }, + arr: [1, 2], + quoted: "hello", + }, + ]); + // Only the 3 bracketed/quoted JSON cells ("{\"k\":1}", "[1,2]", "\"hello\"") + // should reach JSON.parse — none of the scalar, boolean, null, or plain cells! + expect(parseSpy).toHaveBeenCalledTimes(3); + } finally { + parseSpy.mockRestore(); + } + }); + + it("transposes >130,000 rows without overflowing the V8 call stack (iterative transpose)", () => { + const rowCount = 130_000; + const lines = ["k,v"]; + for (let i = 0; i < rowCount; i += 1) { + lines.push(`r${i},${i}`); + } + const largeCsv = lines.join("\n"); + const transposed = csvToJson(largeCsv, { + transpose: true, + parseNumbers: false, + parseJSON: false, + }) as Array>; + expect(transposed).toHaveLength(1); + expect(transposed[0].k).toBe("v"); + expect(transposed[0].r0).toBe("0"); + expect(transposed[0][`r${rowCount - 1}`]).toBe(String(rowCount - 1)); + }); +}); + + diff --git a/app/src/lib/__tests__/files.test.ts b/app/src/lib/__tests__/files.test.ts index 45f4ab7..afa19fd 100644 --- a/app/src/lib/__tests__/files.test.ts +++ b/app/src/lib/__tests__/files.test.ts @@ -85,4 +85,33 @@ describe("decodeUpload (spec B7 — issue #106)", () => { decodeUpload(chunkFile([[0xef, 0xbb, 0xbf, 0x61], [0x2c, 0x62]]), "utf-8") ).resolves.toBe("a,b"); }); + + it("auto-detects UTF-16LE BOM (0xFF 0xFE) when utf-8 is selected and decodes without NUL bytes", async () => { + // UTF-16LE BOM (0xFF, 0xFE) + "id,name\n1,Jürgen" + const text = "id,name\n1,Jürgen"; + const utf16leBytes = [0xff, 0xfe]; + for (let i = 0; i < text.length; i += 1) { + const code = text.charCodeAt(i); + utf16leBytes.push(code & 0xff, (code >> 8) & 0xff); + } + const decoded = await decodeUpload( + chunkFile([[utf16leBytes[0]], utf16leBytes.slice(1)]), + "utf-8" + ); + expect(decoded).toBe(text); + expect(decoded).not.toContain("\u0000"); + }); + + it("auto-detects UTF-16BE BOM (0xFE 0xFF) when utf-8 is selected and decodes without NUL bytes", async () => { + // UTF-16BE BOM (0xFE, 0xFF) + "id,name\n1,Köln" + const text = "id,name\n1,Köln"; + const utf16beBytes = [0xfe, 0xff]; + for (let i = 0; i < text.length; i += 1) { + const code = text.charCodeAt(i); + utf16beBytes.push((code >> 8) & 0xff, code & 0xff); + } + const decoded = await decodeUpload(byteFile(utf16beBytes), "utf-8"); + expect(decoded).toBe(text); + expect(decoded).not.toContain("\u0000"); + }); }); diff --git a/app/src/lib/convert.ts b/app/src/lib/convert.ts index f6ed729..66dfcbb 100644 --- a/app/src/lib/convert.ts +++ b/app/src/lib/convert.ts @@ -146,11 +146,25 @@ function toSmartNumber(value: string): string | number { function tryParseJsonLiteral( value: string ): { ok: true; value: unknown } | { ok: false } { - try { - return { ok: true, value: JSON.parse(value) }; - } catch { - return { ok: false }; + const trimmed = value.trim(); + if (trimmed === "") return { ok: false }; + if (trimmed === "true") return { ok: true, value: true }; + if (trimmed === "false") return { ok: true, value: false }; + if (trimmed === "null") return { ok: true, value: null }; + const first = trimmed[0]; + const last = trimmed[trimmed.length - 1]; + if ( + (first === "{" && last === "}") || + (first === "[" && last === "]") || + (first === '"' && last === '"' && trimmed.length >= 2) + ) { + try { + return { ok: true, value: JSON.parse(trimmed) }; + } catch { + return { ok: false }; + } } + return { ok: false }; } function isRecord(value: unknown): value is Record { diff --git a/app/src/lib/files.ts b/app/src/lib/files.ts index 12155a7..72b394c 100644 --- a/app/src/lib/files.ts +++ b/app/src/lib/files.ts @@ -44,17 +44,52 @@ export async function decodeUpload( file: File, encoding: UploadEncoding ): Promise { - const decoder = new TextDecoder(encoding, { fatal: false }); const reader = file.stream().getReader(); let decoded = ""; try { + const initialChunks: Uint8Array[] = []; + let initialBytes = 0; + while (initialBytes < 2) { + const { done, value } = await reader.read(); + if (done) break; + if (value && value.byteLength > 0) { + initialChunks.push(value); + initialBytes += value.byteLength; + } + } + + let firstChunk: Uint8Array | null = null; + if (initialChunks.length === 1) { + firstChunk = initialChunks[0]; + } else if (initialChunks.length > 1) { + firstChunk = new Uint8Array(initialBytes); + let offset = 0; + for (const chunk of initialChunks) { + firstChunk.set(chunk, offset); + offset += chunk.byteLength; + } + } + + let effectiveEncoding: string = encoding; + if (encoding === "utf-8" && firstChunk && firstChunk.byteLength >= 2) { + if (firstChunk[0] === 0xff && firstChunk[1] === 0xfe) { + effectiveEncoding = "utf-16le"; + } else if (firstChunk[0] === 0xfe && firstChunk[1] === 0xff) { + effectiveEncoding = "utf-16be"; + } + } + + const decoder = new TextDecoder(effectiveEncoding, { fatal: false }); + if (firstChunk) { + decoded += decoder.decode(firstChunk, { stream: true }); + } for (;;) { const { done, value } = await reader.read(); if (done) break; decoded += decoder.decode(value, { stream: true }); } + return decoded + decoder.decode(); } finally { reader.releaseLock(); } - return decoded + decoder.decode(); }