diff --git a/app/dist/assets/data-grid-overlay-editor-7TbweYYO.js b/app/dist/assets/data-grid-overlay-editor-BAT754-f.js similarity index 98% rename from app/dist/assets/data-grid-overlay-editor-7TbweYYO.js rename to app/dist/assets/data-grid-overlay-editor-BAT754-f.js index 8691203..fea1b65 100644 --- a/app/dist/assets/data-grid-overlay-editor-7TbweYYO.js +++ b/app/dist/assets/data-grid-overlay-editor-BAT754-f.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-CRYEo6Tq.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-DIaInUm2.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-CS6iqiIw.css b/app/dist/assets/index-CS6iqiIw.css deleted file mode 100644 index 5a76573..0000000 --- a/app/dist/assets/index-CS6iqiIw.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-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-normal:400;--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-0{top:0}.top-1{top:var(--spacing)}.top-1\/2{top:50%}.top-9{top:calc(var(--spacing) * 9)}.right-0{right:0}.right-1{right:var(--spacing)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.left-1\.5{left:calc(var(--spacing) * 1.5)}.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-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.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-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.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-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-12{min-height:calc(var(--spacing) * 12)}.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-\[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-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2\.5{row-gap:calc(var(--spacing) * 2.5)}: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))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.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\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.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}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.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-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.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-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.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\:hidden{display:none}.max-md\:max-h-\[340px\]{max-height:340px}.max-md\:max-h-\[360px\]{max-height:360px}.max-md\:min-h-\[240px\]{min-height:240px}.max-md\:min-h-\[280px\]{min-height:280px}.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}.sm\:px-4{padding-inline:calc(var(--spacing) * 4)}.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media (min-width:48rem){.md\:absolute{position:absolute}.md\:inset-auto{inset:auto}.md\:top-0{top:0}.md\:top-1\/2{top:50%}.md\:right-auto{right:auto}.md\:bottom-0{bottom:0}.md\:-left-1\.5{left:calc(var(--spacing) * -1.5)}.md\:left-1\/2{left:50%}.md\:left-\[var\(--split\)\]{left:var(--split)}.md\:mt-0{margin-top:0}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.md\:size-11{width:calc(var(--spacing) * 11);height:calc(var(--spacing) * 11)}.md\:h-8{height:calc(var(--spacing) * 8)}.md\:h-12{height:calc(var(--spacing) * 12)}.md\:h-auto{height:auto}.md\:h-svh{height:100svh}.md\:min-h-0{min-height:0}.md\:min-h-12{min-height:calc(var(--spacing) * 12)}.md\:w-0{width:0}.md\:w-3{width:calc(var(--spacing) * 3)}.md\:w-\[var\(--split\)\]{width:var(--split)}.md\:flex-1{flex:1}.md\:-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:cursor-col-resize{cursor:col-resize}.md\:flex-row{flex-direction:row}.md\:flex-wrap{flex-wrap:wrap}.md\:items-center{align-items:center}.md\:gap-1{gap:var(--spacing)}.md\:gap-3{gap:calc(var(--spacing) * 3)}.md\:gap-x-3\.5{column-gap:calc(var(--spacing) * 3.5)}.md\:gap-y-2{row-gap:calc(var(--spacing) * 2)}.md\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.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\:bg-transparent{background-color:#0000}.md\:p-6{padding:calc(var(--spacing) * 6)}.md\:px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.md\:px-4{padding-inline:calc(var(--spacing) * 4)}.md\:px-16{padding-inline:calc(var(--spacing) * 16)}.md\:py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.md\:py-2{padding-block:calc(var(--spacing) * 2)}.md\:pt-0{padding-top:0}.md\:pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.md\:pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.md\:text-\[11px\]{font-size:11px}}@media (min-width:64rem){.lg\:inline{display:inline}.lg\:gap-3{gap:calc(var(--spacing) * 3)}.lg\:gap-x-3{column-gap:calc(var(--spacing) * 3)}.lg\:px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.lg\:pr-3{padding-right:calc(var(--spacing) * 3)}.lg\:pl-5{padding-left:calc(var(--spacing) * 5)}}@media (min-width:80rem){.xl\:block{display:block}.xl\:inline{display:inline}.xl\:gap-5{gap:calc(var(--spacing) * 5)}.xl\:px-5{padding-inline:calc(var(--spacing) * 5)}.xl\:py-2\.5{padding-block:calc(var(--spacing) * 2.5)}}.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-CRYEo6Tq.js b/app/dist/assets/index-DIaInUm2.js similarity index 83% rename from app/dist/assets/index-CRYEo6Tq.js rename to app/dist/assets/index-DIaInUm2.js index 5096ca1..8002bda 100644 --- a/app/dist/assets/index-CRYEo6Tq.js +++ b/app/dist/assets/index-DIaInUm2.js @@ -1,4 +1,4 @@ -var SR=Object.defineProperty;var CR=(t,e,n)=>e in t?SR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var xt=(t,e,n)=>CR(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={};/** +var CR=Object.defineProperty;var TR=(t,e,n)=>e in t?CR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var xt=(t,e,n)=>TR(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 * @@ -6,7 +6,7 @@ var SR=Object.defineProperty;var CR=(t,e,n)=>e in t?SR(t,e,{enumerable:!0,config * * 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"),TR=Symbol.for("react.portal"),ER=Symbol.for("react.fragment"),AR=Symbol.for("react.strict_mode"),MR=Symbol.for("react.profiler"),RR=Symbol.for("react.provider"),OR=Symbol.for("react.context"),PR=Symbol.for("react.forward_ref"),IR=Symbol.for("react.suspense"),DR=Symbol.for("react.memo"),_R=Symbol.for("react.lazy"),Ww=Symbol.iterator;function NR(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(1e in t?SR(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var $R=v,jR=Symbol.for("react.element"),HR=Symbol.for("react.fragment"),WR=Object.prototype.hasOwnProperty,VR=$R.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,UR={key:!0,ref:!0,__self:!0,__source:!0};function VS(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)WR.call(e,r)&&!UR.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:jR,type:t,key:s,ref:o,props:i,_owner:VR.current}}Vh.Fragment=HR;Vh.jsx=VS;Vh.jsxs=VS;_S.exports=Vh;var M=_S.exports,US={exports:{}},jr={},KS={exports:{}},XS={};/** + */var jR=v,HR=Symbol.for("react.element"),WR=Symbol.for("react.fragment"),VR=Object.prototype.hasOwnProperty,UR=jR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,KR={key:!0,ref:!0,__self:!0,__source:!0};function VS(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)VR.call(e,r)&&!KR.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:HR,type:t,key:s,ref:o,props:i,_owner:UR.current}}Vh.Fragment=WR;Vh.jsx=VS;Vh.jsxs=VS;_S.exports=Vh;var M=_S.exports,US={exports:{}},jr={},KS={exports:{}},XS={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var SR=Object.defineProperty;var CR=(t,e,n)=>e in t?SR(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(t){function e(W,Y){var R=W.length;W.push(Y);e:for(;0>>1,F=W[O];if(0>>1;Oi($,R))uei(ce,$)?(W[O]=ce,W[ue]=R,O=ue):(W[O]=$,W[H]=R,O=H);else if(uei(ce,R))W[O]=ce,W[ue]=R,O=ue;else break e}}return Y}function i(W,Y){var R=W.sortIndex-Y.sortIndex;return R!==0?R:W.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,x=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(W){for(var Y=n(u);Y!==null;){if(Y.callback===null)r(u);else if(Y.startTime<=W)r(u),Y.sortIndex=Y.expirationTime,e(a,Y);else break;Y=n(u)}}function k(W){if(m=!1,w(W),!p)if(n(a)!==null)p=!0,ne(b);else{var Y=n(u);Y!==null&&ie(k,Y.startTime-W)}}function b(W,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)||W&&!_());){var O=f.callback;if(typeof O=="function"){f.callback=null,d=f.priorityLevel;var F=O(f.expirationTime<=Y);Y=t.unstable_now(),typeof F=="function"?f.callback=F:f===n(a)&&r(a),w(Y)}else r(a);f=n(a)}if(f!==null)var L=!0;else{var H=n(u);H!==null&&ie(k,H.startTime-Y),L=!1}return L}finally{f=null,d=R,h=!1}}var S=!1,T=null,E=-1,A=5,I=-1;function _(){return!(t.unstable_now()-IW||125O?(W.sortIndex=R,e(u,W),n(a)===null&&W===n(u)&&(m?(g(E),E=-1):m=!0,ie(k,R-O))):(W.sortIndex=F,e(a,W),p||h||(p=!0,ne(b))),W},t.unstable_shouldYield=_,t.unstable_wrapCallback=function(W){var Y=d;return function(){var R=d;d=Y;try{return W.apply(this,arguments)}finally{d=R}}}})(XS);KS.exports=XS;var KR=KS.exports;/** + */(function(t){function e(W,q){var R=W.length;W.push(q);e:for(;0>>1,F=W[O];if(0>>1;Oi($,R))uei(ce,$)?(W[O]=ce,W[ue]=R,O=ue):(W[O]=$,W[H]=R,O=H);else if(uei(ce,R))W[O]=ce,W[ue]=R,O=ue;else break e}}return q}function i(W,q){var R=W.sortIndex-q.sortIndex;return R!==0?R:W.id-q.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,x=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(W){for(var q=n(u);q!==null;){if(q.callback===null)r(u);else if(q.startTime<=W)r(u),q.sortIndex=q.expirationTime,e(a,q);else break;q=n(u)}}function k(W){if(m=!1,w(W),!p)if(n(a)!==null)p=!0,ne(b);else{var q=n(u);q!==null&&ie(k,q.startTime-W)}}function b(W,q){p=!1,m&&(m=!1,g(E),E=-1),h=!0;var R=d;try{for(w(q),f=n(a);f!==null&&(!(f.expirationTime>q)||W&&!_());){var O=f.callback;if(typeof O=="function"){f.callback=null,d=f.priorityLevel;var F=O(f.expirationTime<=q);q=t.unstable_now(),typeof F=="function"?f.callback=F:f===n(a)&&r(a),w(q)}else r(a);f=n(a)}if(f!==null)var L=!0;else{var H=n(u);H!==null&&ie(k,H.startTime-q),L=!1}return L}finally{f=null,d=R,h=!1}}var S=!1,T=null,E=-1,A=5,I=-1;function _(){return!(t.unstable_now()-IW||125O?(W.sortIndex=R,e(u,W),n(a)===null&&W===n(u)&&(m?(g(E),E=-1):m=!0,ie(k,R-O))):(W.sortIndex=F,e(a,W),p||h||(p=!0,ne(b))),W},t.unstable_shouldYield=_,t.unstable_wrapCallback=function(W){var q=d;return function(){var R=d;d=q;try{return W.apply(this,arguments)}finally{d=R}}}})(XS);KS.exports=XS;var XR=KS.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var SR=Object.defineProperty;var CR=(t,e,n)=>e in t?SR(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var XR=v,$r=KR;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,GR=/^[: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 YR(t){return Cm.call(Xw,t)?!0:Cm.call(Kw,t)?!1:GR.test(t)?Xw[t]=!0:(Kw[t]=!0,!1)}function qR(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"||qR(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||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cm=Object.prototype.hasOwnProperty,qR=/^[: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 YR(t){return Cm.call(Xw,t)?!0:Cm.call(Kw,t)?!1:qR.test(t)?Xw[t]=!0:(Kw[t]=!0,!1)}function QR(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 JR(t,e,n,r){if(e===null||typeof e>"u"||QR(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 JR(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 ZR(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 eO(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=eO(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},tO=["Webkit","ms","Moz","O"];Object.keys(Bu).forEach(function(t){tO.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 nO=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(nO[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-(hO(t)/pO|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 vO(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 KO.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 GO(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 YO(t,e){if(Kl)return t==="compositionend"||!Yy&&AC(t,e)?(t=TC(),bd=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 iP(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),br=Eo(!1),rl=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(br),rn(nr)}function k1(t,e,n){if(nr.current!==wo)throw Error(ae(168));Jt(nr,e),Jt(br,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,ZR(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(br,br.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(br),rn(nr),Jt(nr,t)):rn(br),Jt(br,n)}var ms=null,qh=!1,yg=!1;function WC(t){ms===null?ms=[t]:ms.push(t)}function mP(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,bs=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?b=I:S.sibling=I,S=I,T=A}if(E===w.length)return n(g,T),un&&$o(g,E),b;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?b=_:S.sibling=_,S=_,T=A}if(I.done)return n(g,T),un&&$o(g,E),b;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?b=I:S.sibling=I,S=I);return un&&$o(g,E),b}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?b=I:S.sibling=I,S=I);return t&&T.forEach(function(P){return e(g,P)}),un&&$o(g,E),b}function x(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 b=w.key,S=y;S!==null;){if(S.key===b){if(b=w.type,b===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===b||typeof b=="object"&&b!==null&&b.$$typeof===Gs&&E1(b)===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,x(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 x}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 si(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 oi().memoizedState}function xP(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:si,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},kP={readContext:si,useCallback:function(t,e){return Ui().memoizedState=[t,e===void 0?null:e],t},useContext:si,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=xP.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=wP.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,bc(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=bs;n=(r&~(1<<32-Mi(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=wc++,0")&&(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 ZR(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 YS:return(t.displayName||"Context")+".Consumer";case qS: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 eO(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 tO(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=tO(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 qw(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 Yw(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},nO=["Webkit","ms","Moz","O"];Object.keys(Bu).forEach(function(t){nO.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 rO=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(rO[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=qh(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-(pO(t)/gO|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 wO(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 XO.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 qO(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 YO(t,e){if(Kl)return t==="compositionend"||!qy&&AC(t,e)?(t=TC(),bd=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 Yy(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 sP(t){var e=DC(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&IC(n.ownerDocument.documentElement,n)){if(r!==null&&Yy(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&&Yy(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"),0Yl||(t.current=Ym[Yl],Ym[Yl]=null,Yl--)}function Jt(t,e){Yl++,Ym[Yl]=t.current,t.current=e}var wo={},nr=Eo(wo),br=Eo(!1),rl=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(br),rn(nr)}function k1(t,e,n){if(nr.current!==wo)throw Error(ae(168));Jt(nr,e),Jt(br,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,eO(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(br,br.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(br),rn(nr),Jt(nr,t)):rn(br),Jt(br,n)}var ms=null,Yh=!1,yg=!1;function WC(t){ms===null?ms=[t]:ms.push(t)}function yP(t){Yh=!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,bs=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?b=I:S.sibling=I,S=I,T=A}if(E===w.length)return n(g,T),un&&$o(g,E),b;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?b=_:S.sibling=_,S=_,T=A}if(I.done)return n(g,T),un&&$o(g,E),b;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?b=I:S.sibling=I,S=I);return un&&$o(g,E),b}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?b=I:S.sibling=I,S=I);return t&&T.forEach(function(P){return e(g,P)}),un&&$o(g,E),b}function x(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 b=w.key,S=y;S!==null;){if(S.key===b){if(b=w.type,b===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===b||typeof b=="object"&&b!==null&&b.$$typeof===Gs&&E1(b)===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,x(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 x}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 si(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 qo=null;function rv(t){qo===null?qo=[t]:qo.push(t)}function qC(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 qs=!1;function iv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function YC(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;qs=!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:qs=!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 oi().memoizedState}function bP(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=qC(t,e,n,r),n!==null){var i=ur();Ri(n,t,r,i),m2(n,e,r)}}function kP(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=qC(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:si,useCallback:qn,useContext:qn,useEffect:qn,useImperativeHandle:qn,useInsertionEffect:qn,useLayoutEffect:qn,useMemo:qn,useReducer:qn,useRef:qn,useState:qn,useDebugValue:qn,useDeferredValue:qn,useTransition:qn,useMutableSource:qn,useSyncExternalStore:qn,useId:qn,unstable_isNewReconciler:!1},SP={readContext:si,useCallback:function(t,e){return Ui().memoizedState=[t,e===void 0?null:e],t},useContext:si,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=bP.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=xP.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,bc(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=bs;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 OP(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(br),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,PP=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 IP(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,x=p.memoizedState,g=e.stateNode,y=g.getSnapshotBeforeUpdate(e.elementType===e.type?m:wi(e.type,m),x);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[pP],delete e[gP])),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,xi=!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=xi;zn=null,$s(t,e,n),zn=r,xi=i,zn!==null&&(xi?(t=zn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):zn.removeChild(n.stateNode));break;case 18:zn!==null&&(xi?(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=xi,zn=n.stateNode.containerInfo,xi=!0,$s(t,e,n),zn=r,xi=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 PP),e.forEach(function(r){var i=jP.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function mi(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*_P(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 $P(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),z2(t,n)}function jP(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||br.current)wr=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return wr=!1,MP(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=ba(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=WP(r),t=wi(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,wi(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:wi(r,i),r0(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:wi(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),zr=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:wi(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&&!br.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=si(i),r=r(i),e.flags|=1,lr(t,e,r,n),e.child;case 14:return r=e.type,i=wi(r,e.pendingProps),i=wi(r.type,i),F1(t,e,r,i,n);case 15:return x2(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:wi(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 b2(t,e,n)}throw Error(ae(156,e.tag))};function j2(t,e){return pC(t,e)}function HP(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 HP(t,e,n,r)}function xv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function WP(t){if(typeof t=="function")return xv(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")xv(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 VP(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 bv(t,e,n,r,i,s,o,l,a){return t=new VP(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 UP(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=jr;var qP=US.exports,K2,Q1=qP;K2=Q1.createRoot,Q1.hydrateRoot;function X2(){return""}function QP(){return/^G-[A-Z0-9]+$/.test(X2())}function JP(){const t=window.gtag;typeof t=="function"&&QP()&&t("config",X2(),{send_page_view:!1})}function ZP(){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 eI(){var t,e;(t=window.gtag)==null||t.call(window,"event","permalink_view"),(e=window.plausible)==null||e.call(window,"Permalink View")}function tI(){var t,e;(t=window.gtag)==null||t.call(window,"event","changelog_open"),(e=window.plausible)==null||e.call(window,"Changelog Open")}function nI(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 rI(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,rI(t),{props:{...e}})}function iI(t){Tv("conversion",t)}function $f(t){Tv("export",t)}function sI(t){Tv("feedback",t)}function oI(t){return new TextEncoder().encode(t).length}function lI(t){return t<10*1024?"<10KB":t<100*1024?"10-100KB":t<1024*1024?"100KB-1MB":">1MB"}function aI(t){let e=2166136261;for(let n=0;n>>0).toString(36)}function uI(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=oI(f.text),h=`${f.direction}:${f.input}:${d}:${aI(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)}}}/** +`+s.stack}return{value:t,source:e,stack:i,digest:null}}function kg(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function n0(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var EP=typeof WeakMap=="function"?WeakMap:Map;function v2(t,e,n){n=Cs(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){ih||(ih=!0,d0=r),n0(t,e)},n}function w2(t,e,n){n=Cs(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){n0(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){n0(t,e),typeof r!="function"&&(po===null?po=new Set([this]):po.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function D1(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new EP;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=$P.bind(null,t,e,n),e.then(t,t))}function _1(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function N1(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Cs(-1,1),e.tag=2,ho(n,e,1))),n.lanes|=1),t)}var AP=Ps.ReactCurrentOwner,wr=!1;function lr(t,e,n,r){e.child=t===null?GC(e,null,n,r):Sa(e,t.child,n,r)}function L1(t,e,n,r,i){n=n.render;var s=e.ref;return da(e,i),r=uv(t,e,n,r,s,i),n=cv(),t!==null&&!wr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Rs(t,e,i)):(un&&n&&Qy(e),e.flags|=1,lr(t,e,r,i),e.child)}function F1(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!xv(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,x2(t,e,s,r,i)):(t=Rd(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:hc,n(o,r)&&t.ref===e.ref)return Rs(t,e,i)}return e.flags|=1,t=mo(s,r),t.ref=e.ref,t.return=e,e.child=t}function x2(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(hc(s,r)&&t.ref===e.ref)if(wr=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(wr=!0);else return e.lanes=t.lanes,Rs(t,e,i)}return r0(t,e,n,r,i)}function b2(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Jt(ta,Pr),Pr|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Jt(ta,Pr),Pr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Jt(ta,Pr),Pr|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,Jt(ta,Pr),Pr|=r;return lr(t,e,i,n),e.child}function k2(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function r0(t,e,n,r,i){var s=kr(n)?rl:nr.current;return s=ba(e,s),da(e,i),n=uv(t,e,n,r,s,i),r=cv(),t!==null&&!wr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Rs(t,e,i)):(un&&r&&Qy(e),e.flags|=1,lr(t,e,n,i),e.child)}function B1(t,e,n,r,i){if(kr(n)){var s=!0;Gd(e)}else s=!1;if(da(e,i),e.stateNode===null)Ed(t,e),y2(e,n,r),t0(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var a=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=si(u):(u=kr(n)?rl:nr.current,u=ba(e,u));var c=n.getDerivedStateFromProps,f=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==u)&&I1(e,o,r,u),qs=!1;var d=e.memoizedState;o.state=d,Zd(e,r,o,i),a=e.memoizedState,l!==r||d!==a||br.current||qs?(typeof c=="function"&&(e0(e,n,c,r),a=e.memoizedState),(l=qs||P1(e,n,l,r,d,a,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=a),o.props=r,o.state=a,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,YC(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:wi(e.type,l),o.props=u,f=e.pendingProps,d=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=si(a):(a=kr(n)?rl:nr.current,a=ba(e,a));var h=n.getDerivedStateFromProps;(c=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||d!==a)&&I1(e,o,r,a),qs=!1,d=e.memoizedState,o.state=d,Zd(e,r,o,i);var p=e.memoizedState;l!==f||d!==p||br.current||qs?(typeof h=="function"&&(e0(e,n,h,r),p=e.memoizedState),(u=qs||P1(e,n,u,r,d,p,a)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,a)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=a,r=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),r=!1)}return i0(t,e,n,r,s,i)}function i0(t,e,n,r,i,s){k2(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&S1(e,n,!1),Rs(t,e,s);r=e.stateNode,AP.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Sa(e,t.child,null,s),e.child=Sa(e,null,l,s)):lr(t,e,l,s),e.memoizedState=r.state,i&&S1(e,n,!0),e.child}function S2(t){var e=t.stateNode;e.pendingContext?k1(t,e.pendingContext,e.pendingContext!==e.context):e.context&&k1(t,e.context,!1),sv(t,e.containerInfo)}function z1(t,e,n,r,i){return ka(),Zy(i),e.flags|=256,lr(t,e,n,r),e.child}var s0={dehydrated:null,treeContext:null,retryLane:0};function o0(t){return{baseLanes:t,cachePool:null,transitions:null}}function C2(t,e,n){var r=e.pendingProps,i=cn.current,s=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(i&2)!==0),l?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Jt(cn,i&1),t===null)return Jm(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=tp(o,r,0,null),t=el(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=o0(n),e.memoizedState=s0,t):hv(e,o));if(i=t.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return MP(t,e,o,r,l,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,l=i.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=a,e.deletions=null):(r=mo(i,a),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=mo(l,s):(s=el(s,o,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=t.child.memoizedState,o=o===null?o0(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=s0,r}return s=t.child,t=s.sibling,r=mo(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function hv(t,e){return e=tp({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Lf(t,e,n,r){return r!==null&&Zy(r),Sa(e,t.child,null,n),t=hv(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function MP(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=kg(Error(ae(422))),Lf(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=tp({mode:"visible",children:r.children},i,0,null),s=el(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&Sa(e,t.child,null,o),e.child.memoizedState=o0(o),e.memoizedState=s0,s);if(!(e.mode&1))return Lf(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(ae(419)),r=kg(s,r,void 0),Lf(t,e,o,r)}if(l=(o&t.childLanes)!==0,wr||l){if(r=Ln,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Ms(t,i),Ri(r,t,i,-1))}return wv(),r=kg(Error(ae(421))),Lf(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=jP.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,Fr=fo(i.nextSibling),zr=e,un=!0,bi=null,t!==null&&(Gr[qr++]=bs,Gr[qr++]=ks,Gr[qr++]=il,bs=t.id,ks=t.overflow,il=e),e=hv(e,r.children),e.flags|=4096,e)}function $1(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Zm(t.return,e,n)}function Sg(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function T2(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(lr(t,e,r.children,n),r=cn.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&$1(t,n,e);else if(t.tag===19)$1(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Jt(cn,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&eh(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Sg(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&eh(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Sg(e,!0,n,null,s);break;case"together":Sg(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ed(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Rs(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ol|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(ae(153));if(e.child!==null){for(t=e.child,n=mo(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=mo(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function RP(t,e,n){switch(e.tag){case 3:S2(e),ka();break;case 5:QC(e);break;case 1:kr(e.type)&&Gd(e);break;case 4:sv(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Jt(Qd,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Jt(cn,cn.current&1),e.flags|=128,null):n&e.child.childLanes?C2(t,e,n):(Jt(cn,cn.current&1),t=Rs(t,e,n),t!==null?t.sibling:null);Jt(cn,cn.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return T2(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Jt(cn,cn.current),r)break;return null;case 22:case 23:return e.lanes=0,b2(t,e,n)}return Rs(t,e,n)}var E2,l0,A2,M2;E2=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};l0=function(){};A2=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Yo(ns.current);var s=null;switch(n){case"input":i=Rm(t,i),r=Rm(t,r),s=[];break;case"select":i=dn({},i,{value:void 0}),r=dn({},r,{value:void 0}),s=[];break;case"textarea":i=Im(t,i),r=Im(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Kd)}_m(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(oc.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var a=r[u];if(l=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(s||(s=[]),s.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(oc.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&tn("scroll",t),s||l===a||(s=[])):(s=s||[]).push(u,a))}n&&(s=s||[]).push("style",n);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};M2=function(t,e,n,r){n!==r&&(e.flags|=4)};function pu(t,e){if(!un)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Yn(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function OP(t,e,n){var r=e.pendingProps;switch(Jy(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yn(e),null;case 1:return kr(e.type)&&Xd(),Yn(e),null;case 3:return r=e.stateNode,Ca(),rn(br),rn(nr),lv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(_f(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,bi!==null&&(g0(bi),bi=null))),l0(t,e),Yn(e),null;case 5:ov(e);var i=Yo(vc.current);if(n=e.type,t!==null&&e.stateNode!=null)A2(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(ae(166));return Yn(e),null}if(t=Yo(ns.current),_f(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[Ki]=e,r[mc]=s,t=(e.mode&1)!==0,n){case"dialog":tn("cancel",r),tn("close",r);break;case"iframe":case"object":case"embed":tn("load",r);break;case"video":case"audio":for(i=0;i<\/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 Yn(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):(Yn(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&&(Yn(e),e.subtreeFlags&6&&(e.flags|=8192)):Yn(e),null;case 24:return null;case 25:return null}throw Error(ae(156,e.tag))}function PP(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(br),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,IP=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 DP(t,e){if(Um=Wd,t=DC(),Yy(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,x=p.memoizedState,g=e.stateNode,y=g.getSnapshotBeforeUpdate(e.elementType===e.type?m:wi(e.type,m),x);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[qm],delete e[gP],delete e[mP])),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,xi=!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=xi;zn=null,$s(t,e,n),zn=r,xi=i,zn!==null&&(xi?(t=zn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):zn.removeChild(n.stateNode));break;case 18:zn!==null&&(xi?(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=xi,zn=n.stateNode.containerInfo,xi=!0,$s(t,e,n),zn=r,xi=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 IP),e.forEach(function(r){var i=HP.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function mi(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*NP(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 jP(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),z2(t,n)}function HP(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||br.current)wr=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return wr=!1,RP(t,e,n);wr=!!(t.flags&131072)}else wr=!1,un&&e.flags&1048576&&VC(e,Yd,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);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=VP(r),t=wi(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,wi(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:wi(r,i),r0(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:wi(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,YC(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),zr=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:wi(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&&!br.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=si(i),r=r(i),e.flags|=1,lr(t,e,r,n),e.child;case 14:return r=e.type,i=wi(r,e.pendingProps),i=wi(r.type,i),F1(t,e,r,i,n);case 15:return x2(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:wi(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 b2(t,e,n)}throw Error(ae(156,e.tag))};function j2(t,e){return pC(t,e)}function WP(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 WP(t,e,n,r)}function xv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function VP(t){if(typeof t=="function")return xv(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")xv(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 qS:o=10;break e;case YS: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 UP(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 bv(t,e,n,r,i,s,o,l,a){return t=new UP(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 KP(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=jr;var QP=US.exports,K2,Q1=QP;K2=Q1.createRoot,Q1.hydrateRoot;function X2(){return""}function JP(){return/^G-[A-Z0-9]+$/.test(X2())}function ZP(){const t=window.gtag;typeof t=="function"&&JP()&&t("config",X2(),{send_page_view:!1})}function eI(){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 tI(){var t,e;(t=window.gtag)==null||t.call(window,"event","permalink_view"),(e=window.plausible)==null||e.call(window,"Permalink View")}function nI(){var t,e;(t=window.gtag)==null||t.call(window,"event","changelog_open"),(e=window.plausible)==null||e.call(window,"Changelog Open")}function rI(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 iI(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,iI(t),{props:{...e}})}function sI(t){Tv("conversion",t)}function $f(t){Tv("export",t)}function oI(t){Tv("feedback",t)}function lI(t){return new TextEncoder().encode(t).length}function aI(t){return t<10*1024?"<10KB":t<100*1024?"10-100KB":t<1024*1024?"100KB-1MB":">1MB"}function uI(t){let e=2166136261;for(let n=0;n>>0).toString(36)}function cI(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=lI(f.text),h=`${f.direction}:${f.input}:${d}:${uI(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. @@ -47,17 +47,17 @@ Error generating stack: `+s.message+` * * 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-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** + */const fI=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 fI=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/** + */const dI=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=fI(t);return e.charAt(0).toUpperCase()+e.slice(1)};/** + */const J1=t=>{const e=dI(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. @@ -67,119 +67,119 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dI=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},hI=v.createContext({}),pI=()=>v.useContext(hI),gI=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=""}=pI()??{},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&&!dI(l)&&{"aria-hidden":"true"},...l},[...o.map(([m,x])=>v.createElement(m,x)),...Array.isArray(s)?s:[s]])});/** + */const hI=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},pI=v.createContext({}),gI=()=>v.useContext(pI),mI=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=""}=gI()??{},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&&!hI(l)&&{"aria-hidden":"true"},...l},[...o.map(([m,x])=>v.createElement(m,x)),...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 Mn=(t,e)=>{const n=v.forwardRef(({className:r,...i},s)=>v.createElement(gI,{ref:s,iconNode:e,className:G2(`lucide-${cI(J1(t))}`,`lucide-${t}`,r),...i}));return n.displayName=J1(t),n};/** + */const Mn=(t,e)=>{const n=v.forwardRef(({className:r,...i},s)=>v.createElement(mI,{ref:s,iconNode:e,className:G2(`lucide-${fI(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 mI=[["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"}]],yI=Mn("arrow-left-right",mI);/** + */const yI=[["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"}]],vI=Mn("arrow-left-right",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:"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=Mn("braces",vI);/** + */const wI=[["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=Mn("braces",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 wI=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],xI=Mn("chevron-down",wI);/** + */const xI=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bI=Mn("chevron-down",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 bI=[["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"}]],kI=Mn("clipboard",bI);/** + */const kI=[["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"}]],SI=Mn("clipboard",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=[["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=Mn("copy",SI);/** + */const CI=[["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=Mn("copy",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 CI=[["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=Mn("download",CI);/** + */const TI=[["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"}]],q2=Mn("download",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 TI=[["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=Mn("file-up",TI);/** + */const EI=[["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"}]],Y2=Mn("file-up",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 EI=[["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"}]],AI=Mn("moon",EI);/** + */const AI=[["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"}]],MI=Mn("moon",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 MI=[["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"}]],RI=Mn("redo-2",MI);/** + */const RI=[["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"}]],OI=Mn("redo-2",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:"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"}]],PI=Mn("rotate-ccw-clock",OI);/** + */const PI=[["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"}]],II=Mn("rotate-ccw-clock",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 II=[["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"}]],ex=Mn("rotate-ccw",II);/** + */const DI=[["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"}]],ex=Mn("rotate-ccw",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 DI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_I=Mn("search",DI);/** + */const _I=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],NI=Mn("search",_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 NI=[["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"}]],LI=Mn("sparkles",NI);/** + */const LI=[["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"}]],FI=Mn("sparkles",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 FI=[["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"}]],BI=Mn("sun",FI);/** + */const BI=[["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"}]],zI=Mn("sun",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 zI=[["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=Mn("table",zI);/** + */const $I=[["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"}]],jI=Mn("table",$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:"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"}]],HI=Mn("thumbs-down",jI);/** + */const HI=[["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"}]],WI=Mn("thumbs-down",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:"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"}]],VI=Mn("thumbs-up",WI);/** + */const VI=[["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"}]],UI=Mn("thumbs-up",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 UI=[["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=Mn("trash",UI);/** + */const KI=[["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=Mn("trash",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 KI=[["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"}]],XI=Mn("undo-2",KI);/** + */const XI=[["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"}]],GI=Mn("undo-2",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 GI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Q2=Mn("x",GI);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=JI(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)||QI(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},tx=/^\[(.+)\]$/,QI=t=>{if(tx.test(t)){const e=tx.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},JI=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return eD(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:nx(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(ZI(i)){y0(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{y0(o,nx(e,s),n,r)})})},nx=(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},ZI=t=>t.isThemeGetter,eD=(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,tD=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="!",nD=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 x=0;xc?f-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:o}):o},rD=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},iD=t=>({cache:tD(t.cacheSize),parseClassName:nD(t),...qI(t)}),sD=/\s+/,oD=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(sD);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 x=rD(c).join(":"),g=f?x+eT:x,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 lD(){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=iD(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=oD(a,n);return i(a,c),c}return function(){return s(lD.apply(null,arguments))}}const en=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},nT=/^\[(?:([a-z-]+):)?(.+)\]$/i,uD=/^\d+\/\d+$/,cD=new Set(["px","full","screen"]),fD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dD=/\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$/,hD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hs=t=>pa(t)||cD.has(t)||uD.test(t),js=t=>ja(t,"length",SD),pa=t=>!!t&&!Number.isNaN(Number(t)),Ag=t=>ja(t,"number",pa),mu=t=>!!t&&Number.isInteger(Number(t)),mD=t=>t.endsWith("%")&&pa(t.slice(0,-1)),gt=t=>nT.test(t),Hs=t=>fD.test(t),yD=new Set(["length","size","percentage"]),vD=t=>ja(t,yD,rT),wD=t=>ja(t,"position",rT),xD=new Set(["image","url"]),bD=t=>ja(t,xD,TD),kD=t=>ja(t,"",CD),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},SD=t=>dD.test(t)&&!hD.test(t),rT=()=>!1,CD=t=>pD.test(t),TD=t=>gD.test(t),ED=()=>{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"),x=en("margin"),g=en("opacity"),y=en("padding"),w=en("saturate"),k=en("scale"),b=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"],W=()=>["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:[mD,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",...W()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...W(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...W(),"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:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"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(),wD]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",vD]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},bD]}],"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,kD]}],"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:[b]}],"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":[b]}],"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"]}}},AD=aD(ED);function Br(...t){return AD(YI(t))}function Mg(t){return t==="csv2json"?"CSV → JSON":"JSON → CSV"}function MD({flipped:t}){return M.jsx(yI,{size:18,strokeWidth:2,"aria-hidden":"true",className:Br("transition-transform duration-300",t&&"rotate-180")})}function RD({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 md:h-8 md:gap-1 md:px-2.5 md:text-[11px]",children:[M.jsx(MD,{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."}],OD={"@context":"https://schema.org","@type":"FAQPage",mainEntity:iT.map(t=>({"@type":"Question",name:t.question,acceptedAnswer:{"@type":"Answer",text:t.answer}}))};function PD(){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(OD)}})]})}const ID="https://github.com/FlatFilers/csvjson-app/discussions/163";function DD(){return M.jsx("div",{"data-testid":"feedback-banner",className:"flex flex-shrink-0 items-center justify-center border-b border-border bg-muted px-3 py-1.5 text-xs text-muted-foreground sm:px-4 sm:text-sm",children:M.jsxs("p",{className:"text-center",children:["Enjoy a cleaner, simpler CSVJSON."," ",M.jsx("a",{"data-testid":"feedback-link",href:ID,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",_D=[{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 ND(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 rx(){try{const t=window.localStorage.getItem(sT);if(t===null)return null;const e=JSON.parse(t);return ND(e)?e:null}catch{return null}}function ix(t){try{window.localStorage.setItem(sT,JSON.stringify(t))}catch{}}function sx(){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 LD(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 FD(t){try{return(await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(LD(t))})).ok?"ok":"failed"}catch{return"failed"}}function ox(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 BD(){const[t,e]=v.useState(rx),[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((b,S)=>{const T={...b,pending:S==="failed"};ix(T),e(T),S==="ok"?sI({vote:b.vote,with_reason:b.reasonCode!==null}):u(!1)},[]),m=v.useCallback((b,S)=>{const T=++h.current;S&&f(!0),FD(b).then(E=>{h.current===T&&(p(b,E),E==="ok"&&u(!0))}).finally(()=>{S&&h.current===T&&f(!1)})},[p]),x=b=>{const S={...b,pending:!0};ix(S),e(S),m(S,!0)},g=v.useRef(!1);v.useEffect(()=>{if(g.current)return;g.current=!0;const b=rx();b!=null&&b.pending&&m(b,!1)},[m]),v.useEffect(()=>{if(!a)return;const b=setTimeout(()=>u(!1),3e3);return()=>clearTimeout(b)},[a]),v.useEffect(()=>{if(!n)return;const b=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",b),document.addEventListener("mousedown",S),()=>{document.removeEventListener("keydown",b),document.removeEventListener("mousedown",S)}},[n]);const y=()=>{if((t==null?void 0:t.vote)===1&&!t.pending){u(!0);return}x({clientId:(t==null?void 0:t.clientId)??sx(),vote:1,reasonCode:null,reasonText:null})},w=()=>{if(n){r(!1);return}s(null),l(""),r(!0)},k=()=>{if(i===null)return;const b=o.trim();x({clientId:(t==null?void 0:t.clientId)??sx(),vote:-1,reasonCode:i,reasonText:b===""?null:b}),r(!1)};return M.jsxs("div",{"data-testid":"feedback-vote",ref:d,className:"relative flex items-center gap-1 max-sm:static",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:ox((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:ox((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 max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto",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:_D.map(b=>M.jsx("button",{type:"button","data-testid":`feedback-reason-${b.value}`,"aria-pressed":i===b.value,onClick:()=>s(b.value),className:["cursor-pointer rounded-sm border px-2 py-0.5 text-xs transition-colors",i===b.value?"border-foreground bg-foreground text-panel":"border-border text-muted-foreground hover:border-foreground hover:text-foreground"].join(" "),children:b.label},b.value))}),M.jsx("textarea",{"data-testid":"feedback-text",value:o,maxLength:500,rows:2,onChange:b=>l(b.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 zD(t,e){try{return t()}catch{return e}}const lx=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(lx.call(t,n)&&++r&&!lx.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 $D=Object.prototype,jD=$D.hasOwnProperty;function HD(t,e){return t!=null&&jD.call(t,e)}var WD=HD,VD=Array.isArray,os=VD,UD=typeof no=="object"&&no&&no.Object===Object&&no,lT=UD,KD=lT,XD=typeof self=="object"&&self&&self.Object===Object&&self,GD=KD||XD||Function("return this")(),ls=GD,YD=ls,qD=YD.Symbol,zc=qD,ax=zc,aT=Object.prototype,QD=aT.hasOwnProperty,JD=aT.toString,vu=ax?ax.toStringTag:void 0;function ZD(t){var e=QD.call(t,vu),n=t[vu];try{t[vu]=void 0;var r=!0}catch{}var i=JD.call(t);return r&&(e?t[vu]=n:delete t[vu]),i}var e_=ZD,t_=Object.prototype,n_=t_.toString;function r_(t){return n_.call(t)}var i_=r_,ux=zc,s_=e_,o_=i_,l_="[object Null]",a_="[object Undefined]",cx=ux?ux.toStringTag:void 0;function u_(t){return t==null?t===void 0?a_:l_:cx&&cx in Object(t)?s_(t):o_(t)}var $c=u_;function c_(t){return t!=null&&typeof t=="object"}var jc=c_,f_=$c,d_=jc,h_="[object Symbol]";function p_(t){return typeof t=="symbol"||d_(t)&&f_(t)==h_}var op=p_,g_=os,m_=op,y_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,v_=/^\w*$/;function w_(t,e){if(g_(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||m_(t)?!0:v_.test(t)||!y_.test(t)||e!=null&&t in Object(e)}var Mv=w_;function x_(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var gl=x_,b_=$c,k_=gl,S_="[object AsyncFunction]",C_="[object Function]",T_="[object GeneratorFunction]",E_="[object Proxy]";function A_(t){if(!k_(t))return!1;var e=b_(t);return e==C_||e==T_||e==S_||e==E_}var uT=A_,M_=ls,R_=M_["__core-js_shared__"],O_=R_,Rg=O_,fx=function(){var t=/[^.]+$/.exec(Rg&&Rg.keys&&Rg.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function P_(t){return!!fx&&fx in t}var I_=P_,D_=Function.prototype,__=D_.toString;function N_(t){if(t!=null){try{return __.call(t)}catch{}try{return t+""}catch{}}return""}var cT=N_,L_=uT,F_=I_,B_=gl,z_=cT,$_=/[\\^$.*+?()[\]{}|]/g,j_=/^\[object .+?Constructor\]$/,H_=Function.prototype,W_=Object.prototype,V_=H_.toString,U_=W_.hasOwnProperty,K_=RegExp("^"+V_.call(U_).replace($_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function X_(t){if(!B_(t)||F_(t))return!1;var e=L_(t)?K_:j_;return e.test(z_(t))}var G_=X_;function Y_(t,e){return t==null?void 0:t[e]}var q_=Y_,Q_=G_,J_=q_;function Z_(t,e){var n=J_(t,e);return Q_(n)?n:void 0}var ml=Z_,eN=ml,tN=eN(Object,"create"),lp=tN,dx=lp;function nN(){this.__data__=dx?dx(null):{},this.size=0}var rN=nN;function iN(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var sN=iN,oN=lp,lN="__lodash_hash_undefined__",aN=Object.prototype,uN=aN.hasOwnProperty;function cN(t){var e=this.__data__;if(oN){var n=e[t];return n===lN?void 0:n}return uN.call(e,t)?e[t]:void 0}var fN=cN,dN=lp,hN=Object.prototype,pN=hN.hasOwnProperty;function gN(t){var e=this.__data__;return dN?e[t]!==void 0:pN.call(e,t)}var mN=gN,yN=lp,vN="__lodash_hash_undefined__";function wN(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=yN&&e===void 0?vN:e,this}var xN=wN,bN=rN,kN=sN,SN=fN,CN=mN,TN=xN;function Ha(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var HN=jN,WN=ap;function VN(t,e){var n=this.__data__,r=WN(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var UN=VN,KN=MN,XN=LN,GN=zN,YN=HN,qN=UN;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<=a3}var Nv=u3,c3=op;function f3(t){if(typeof t=="string"||c3(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var fp=f3,d3=hT,h3=Dv,p3=os,g3=_v,m3=Nv,y3=fp;function v3(t,e,n){e=d3(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=T3([...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&&exx??(xx=new gs([]))),xt(gs,"fromSingleSelection",e=>gs.empty().add(e));let Ot=gs;function E3(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var A3=/^((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=E3(function(t){return A3.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),M3=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(" ")},bx=M3,R3=t=>t.toUpperCase()===t,O3=t=>e=>t.indexOf(e)===-1,mT=(t,e)=>{const n={};return Object.keys(t).filter(O3(e)).forEach(r=>{n[r]=t[r]}),n};function P3(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 I3=(t,e)=>{};function D3(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&&!R3(l[0])):n.propsAsIs,c=P3(u,s,["as","class"]);c.ref=o,c.className=n.atomic?bx(n.class,c.className||a):bx(c.className||a,n.class);const{vars:f}=n;if(f){const d={};for(const m in f){const x=f[m],g=x[0],y=x[1]||"",w=typeof g=="function"?g(s):g;I3(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,In.createElement(t,c)):In.createElement(l,c)},i=In.forwardRef?In.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 Wr=D3;const _3=Wr("div")({name:"ImageOverlayEditorStyle",class:"gdg-i2iowwq",propsAsIs:!1});var yT={},dp={},Fv={},Pg={},Ig={exports:{}},Dg,kx;function N3(){if(kx)return Dg;kx=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Dg=t,Dg}var _g,Sx;function L3(){if(Sx)return _g;Sx=1;var t=N3();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 Cx;function F3(){return Cx||(Cx=1,Ig.exports=L3()()),Ig.exports}var Tx;function B3(){return Tx||(Tx=1,function(t){(function(e,n){n(t,v,F3())})(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,b)&&(k[b]=y[b]);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 b=0;b0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return h?y:y.capture}function x(y){if("touches"in y){var w=y.touches[0],k=w.pageX,b=w.pageY;return{x:k,y:b}}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 b=arguments.length,S=Array(b),T=0;TS&&this.props.onSwipeRight(1,b),this.movePosition.deltaY<-S?this.props.onSwipeUp(1,b):this.movePosition.deltaY>S&&this.props.onSwipeDown(1,b)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(b){this.swiper=b,this.props.innerRef(b)}},{key:"render",value:function(){var b=this.props;b.tagName;var S=b.className,T=b.style,E=b.children;b.allowMouseEvents,b.onSwipeUp,b.onSwipeDown,b.onSwipeLeft,b.onSwipeRight,b.onSwipeStart,b.onSwipeMove,b.onSwipeEnd,b.innerRef,b.tolerance;var A=a(b,["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,B3())})(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:{}};/*! + */const qI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Q2=Mn("x",qI);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=ZI(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)||JI(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},tx=/^\[(.+)\]$/,JI=t=>{if(tx.test(t)){const e=tx.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},ZI=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return tD(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:nx(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(eD(i)){y0(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{y0(o,nx(e,s),n,r)})})},nx=(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},eD=t=>t.isThemeGetter,tD=(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,nD=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="!",rD=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 x=0;xc?f-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:o}):o},iD=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},sD=t=>({cache:nD(t.cacheSize),parseClassName:rD(t),...QI(t)}),oD=/\s+/,lD=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(oD);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 x=iD(c).join(":"),g=f?x+eT:x,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 aD(){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=sD(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=lD(a,n);return i(a,c),c}return function(){return s(aD.apply(null,arguments))}}const en=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},nT=/^\[(?:([a-z-]+):)?(.+)\]$/i,cD=/^\d+\/\d+$/,fD=new Set(["px","full","screen"]),dD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hD=/\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$/,pD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hs=t=>pa(t)||fD.has(t)||cD.test(t),js=t=>ja(t,"length",CD),pa=t=>!!t&&!Number.isNaN(Number(t)),Ag=t=>ja(t,"number",pa),mu=t=>!!t&&Number.isInteger(Number(t)),yD=t=>t.endsWith("%")&&pa(t.slice(0,-1)),gt=t=>nT.test(t),Hs=t=>dD.test(t),vD=new Set(["length","size","percentage"]),wD=t=>ja(t,vD,rT),xD=t=>ja(t,"position",rT),bD=new Set(["image","url"]),kD=t=>ja(t,bD,ED),SD=t=>ja(t,"",TD),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},CD=t=>hD.test(t)&&!pD.test(t),rT=()=>!1,TD=t=>gD.test(t),ED=t=>mD.test(t),AD=()=>{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"),x=en("margin"),g=en("opacity"),y=en("padding"),w=en("saturate"),k=en("scale"),b=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"],W=()=>["start","end","center","between","around","evenly","stretch"],q=()=>["","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:q(),hueRotate:O(),invert:q(),gap:P(),gradientColorStops:[t],gradientColorStopPositions:[yD,js],inset:_(),margin:_(),opacity:O(),padding:P(),saturate:O(),scale:O(),sepia:q(),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:q()}],shrink:[{shrink:q()}],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",...W()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...W(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...W(),"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:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"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(),xD]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",wD]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kD]}],"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,SD]}],"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:[b]}],"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":[b]}],"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"]}}},MD=uD(AD);function Br(...t){return MD(YI(t))}function Mg(t){return t==="csv2json"?"CSV → JSON":"JSON → CSV"}function RD({flipped:t}){return M.jsx(vI,{size:18,strokeWidth:2,"aria-hidden":"true",className:Br("transition-transform duration-300",t&&"rotate-180")})}function OD({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 md:h-8 md:gap-1 md:px-2.5 md:text-[11px]",children:[M.jsx(RD,{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."}],PD={"@context":"https://schema.org","@type":"FAQPage",mainEntity:iT.map(t=>({"@type":"Question",name:t.question,acceptedAnswer:{"@type":"Answer",text:t.answer}}))};function ID(){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(PD)}})]})}const DD="https://github.com/FlatFilers/csvjson-app/discussions/163";function _D(){return M.jsx("div",{"data-testid":"feedback-banner",className:"flex flex-shrink-0 items-center justify-center border-b border-border bg-muted px-3 py-1.5 text-xs text-muted-foreground sm:px-4 sm:text-sm",children:M.jsxs("p",{className:"text-center",children:["Enjoy a cleaner, simpler CSVJSON."," ",M.jsx("a",{"data-testid":"feedback-link",href:DD,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",ND=[{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 LD(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 rx(){try{const t=window.localStorage.getItem(sT);if(t===null)return null;const e=JSON.parse(t);return LD(e)?e:null}catch{return null}}function ix(t){try{window.localStorage.setItem(sT,JSON.stringify(t))}catch{}}function sx(){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 FD(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 BD(t){try{return(await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(FD(t))})).ok?"ok":"failed"}catch{return"failed"}}function ox(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 zD(){const[t,e]=v.useState(rx),[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((b,S)=>{const T={...b,pending:S==="failed"};ix(T),e(T),S==="ok"?oI({vote:b.vote,with_reason:b.reasonCode!==null}):u(!1)},[]),m=v.useCallback((b,S)=>{const T=++h.current;S&&f(!0),BD(b).then(E=>{h.current===T&&(p(b,E),E==="ok"&&u(!0))}).finally(()=>{S&&h.current===T&&f(!1)})},[p]),x=b=>{const S={...b,pending:!0};ix(S),e(S),m(S,!0)},g=v.useRef(!1);v.useEffect(()=>{if(g.current)return;g.current=!0;const b=rx();b!=null&&b.pending&&m(b,!1)},[m]),v.useEffect(()=>{if(!a)return;const b=setTimeout(()=>u(!1),3e3);return()=>clearTimeout(b)},[a]),v.useEffect(()=>{if(!n)return;const b=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",b),document.addEventListener("mousedown",S),()=>{document.removeEventListener("keydown",b),document.removeEventListener("mousedown",S)}},[n]);const y=()=>{if((t==null?void 0:t.vote)===1&&!t.pending){u(!0);return}x({clientId:(t==null?void 0:t.clientId)??sx(),vote:1,reasonCode:null,reasonText:null})},w=()=>{if(n){r(!1);return}s(null),l(""),r(!0)},k=()=>{if(i===null)return;const b=o.trim();x({clientId:(t==null?void 0:t.clientId)??sx(),vote:-1,reasonCode:i,reasonText:b===""?null:b}),r(!1)};return M.jsxs("div",{"data-testid":"feedback-vote",ref:d,className:"relative flex items-center gap-1 max-sm:static",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:ox((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:ox((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 max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto",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:ND.map(b=>M.jsx("button",{type:"button","data-testid":`feedback-reason-${b.value}`,"aria-pressed":i===b.value,onClick:()=>s(b.value),className:["cursor-pointer rounded-sm border px-2 py-0.5 text-xs transition-colors",i===b.value?"border-foreground bg-foreground text-panel":"border-border text-muted-foreground hover:border-foreground hover:text-foreground"].join(" "),children:b.label},b.value))}),M.jsx("textarea",{"data-testid":"feedback-text",value:o,maxLength:500,rows:2,onChange:b=>l(b.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 $D(t,e){try{return t()}catch{return e}}const lx=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(lx.call(t,n)&&++r&&!lx.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 jD=Object.prototype,HD=jD.hasOwnProperty;function WD(t,e){return t!=null&&HD.call(t,e)}var VD=WD,UD=Array.isArray,os=UD,KD=typeof no=="object"&&no&&no.Object===Object&&no,lT=KD,XD=lT,GD=typeof self=="object"&&self&&self.Object===Object&&self,qD=XD||GD||Function("return this")(),ls=qD,YD=ls,QD=YD.Symbol,zc=QD,ax=zc,aT=Object.prototype,JD=aT.hasOwnProperty,ZD=aT.toString,vu=ax?ax.toStringTag:void 0;function e_(t){var e=JD.call(t,vu),n=t[vu];try{t[vu]=void 0;var r=!0}catch{}var i=ZD.call(t);return r&&(e?t[vu]=n:delete t[vu]),i}var t_=e_,n_=Object.prototype,r_=n_.toString;function i_(t){return r_.call(t)}var s_=i_,ux=zc,o_=t_,l_=s_,a_="[object Null]",u_="[object Undefined]",cx=ux?ux.toStringTag:void 0;function c_(t){return t==null?t===void 0?u_:a_:cx&&cx in Object(t)?o_(t):l_(t)}var $c=c_;function f_(t){return t!=null&&typeof t=="object"}var jc=f_,d_=$c,h_=jc,p_="[object Symbol]";function g_(t){return typeof t=="symbol"||h_(t)&&d_(t)==p_}var op=g_,m_=os,y_=op,v_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,w_=/^\w*$/;function x_(t,e){if(m_(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||y_(t)?!0:w_.test(t)||!v_.test(t)||e!=null&&t in Object(e)}var Mv=x_;function b_(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var gl=b_,k_=$c,S_=gl,C_="[object AsyncFunction]",T_="[object Function]",E_="[object GeneratorFunction]",A_="[object Proxy]";function M_(t){if(!S_(t))return!1;var e=k_(t);return e==T_||e==E_||e==C_||e==A_}var uT=M_,R_=ls,O_=R_["__core-js_shared__"],P_=O_,Rg=P_,fx=function(){var t=/[^.]+$/.exec(Rg&&Rg.keys&&Rg.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function I_(t){return!!fx&&fx in t}var D_=I_,__=Function.prototype,N_=__.toString;function L_(t){if(t!=null){try{return N_.call(t)}catch{}try{return t+""}catch{}}return""}var cT=L_,F_=uT,B_=D_,z_=gl,$_=cT,j_=/[\\^$.*+?()[\]{}|]/g,H_=/^\[object .+?Constructor\]$/,W_=Function.prototype,V_=Object.prototype,U_=W_.toString,K_=V_.hasOwnProperty,X_=RegExp("^"+U_.call(K_).replace(j_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G_(t){if(!z_(t)||B_(t))return!1;var e=F_(t)?X_:H_;return e.test($_(t))}var q_=G_;function Y_(t,e){return t==null?void 0:t[e]}var Q_=Y_,J_=q_,Z_=Q_;function eN(t,e){var n=Z_(t,e);return J_(n)?n:void 0}var ml=eN,tN=ml,nN=tN(Object,"create"),lp=nN,dx=lp;function rN(){this.__data__=dx?dx(null):{},this.size=0}var iN=rN;function sN(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var oN=sN,lN=lp,aN="__lodash_hash_undefined__",uN=Object.prototype,cN=uN.hasOwnProperty;function fN(t){var e=this.__data__;if(lN){var n=e[t];return n===aN?void 0:n}return cN.call(e,t)?e[t]:void 0}var dN=fN,hN=lp,pN=Object.prototype,gN=pN.hasOwnProperty;function mN(t){var e=this.__data__;return hN?e[t]!==void 0:gN.call(e,t)}var yN=mN,vN=lp,wN="__lodash_hash_undefined__";function xN(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=vN&&e===void 0?wN:e,this}var bN=xN,kN=iN,SN=oN,CN=dN,TN=yN,EN=bN;function Ha(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var WN=HN,VN=ap;function UN(t,e){var n=this.__data__,r=VN(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var KN=UN,XN=RN,GN=FN,qN=$N,YN=WN,QN=KN;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<=u3}var Nv=c3,f3=op;function d3(t){if(typeof t=="string"||f3(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var fp=d3,h3=hT,p3=Dv,g3=os,m3=_v,y3=Nv,v3=fp;function w3(t,e,n){e=h3(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=E3([...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&&exx??(xx=new gs([]))),xt(gs,"fromSingleSelection",e=>gs.empty().add(e));let Ot=gs;function A3(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var M3=/^((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=A3(function(t){return M3.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),R3=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(" ")},bx=R3,O3=t=>t.toUpperCase()===t,P3=t=>e=>t.indexOf(e)===-1,mT=(t,e)=>{const n={};return Object.keys(t).filter(P3(e)).forEach(r=>{n[r]=t[r]}),n};function I3(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 D3=(t,e)=>{};function _3(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&&!O3(l[0])):n.propsAsIs,c=I3(u,s,["as","class"]);c.ref=o,c.className=n.atomic?bx(n.class,c.className||a):bx(c.className||a,n.class);const{vars:f}=n;if(f){const d={};for(const m in f){const x=f[m],g=x[0],y=x[1]||"",w=typeof g=="function"?g(s):g;D3(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,In.createElement(t,c)):In.createElement(l,c)},i=In.forwardRef?In.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 Wr=_3;const N3=Wr("div")({name:"ImageOverlayEditorStyle",class:"gdg-i2iowwq",propsAsIs:!1});var yT={},dp={},Fv={},Pg={},Ig={exports:{}},Dg,kx;function L3(){if(kx)return Dg;kx=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Dg=t,Dg}var _g,Sx;function F3(){if(Sx)return _g;Sx=1;var t=L3();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 Cx;function B3(){return Cx||(Cx=1,Ig.exports=F3()()),Ig.exports}var Tx;function z3(){return Tx||(Tx=1,function(t){(function(e,n){n(t,v,B3())})(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,b)&&(k[b]=y[b]);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 b=0;b0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return h?y:y.capture}function x(y){if("touches"in y){var w=y.touches[0],k=w.pageX,b=w.pageY;return{x:k,y:b}}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 b=arguments.length,S=Array(b),T=0;TS&&this.props.onSwipeRight(1,b),this.movePosition.deltaY<-S?this.props.onSwipeUp(1,b):this.movePosition.deltaY>S&&this.props.onSwipeDown(1,b)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(b){this.swiper=b,this.props.innerRef(b)}},{key:"render",value:function(){var b=this.props;b.tagName;var S=b.className,T=b.style,E=b.children;b.allowMouseEvents,b.onSwipeUp,b.onSwipeDown,b.onSwipeLeft,b.onSwipeRight,b.onSwipeStart,b.onSwipeMove,b.onSwipeEnd,b.innerRef,b.tolerance;var A=a(b,["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,z3())})(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 n4=function(e){return e.hasOwnProperty("key")},Bv=function(t){J3(n,t);var e=Z3(n);function n(r){var i;return Y3(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=yi.Children.count(i.props.children),o=i.itemsWrapperRef.clientWidth,l=i.props.thumbWidth?i.props.thumbWidth:(0,K3.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,Ex.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 Q3(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,d4.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=g4;var m4=function(e,n,r,i){var s={},o=n.axis==="horizontal",l=xT.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=m4;var y4=function(e,n){var r=(0,Qi.getPosition)(n.selectedItem,e),i=(0,Qi.setPosition)(r,e.axis);return{itemListStyle:i}};qi.slideStopSwipingHandler=y4;var v4=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=v4;Object.defineProperty(dp,"__esModule",{value:!0});dp.default=void 0;var zt=b4(v),w4=Uc(Fv),ys=Uc(Hc),x4=Uc(Wc),Wf=Uc(gp),Vf=Uc(Vc),Nu=Lr,fh=qi;function Uc(t){return t&&t.__esModule?t:{default:t}}function bT(){if(typeof WeakMap!="function")return null;var t=new WeakMap;return bT=function(){return t},t}function b4(t){if(t&&t.__esModule)return t;if(t===null||Gu(t)!=="object"&&typeof t!="function")return{default:t};var e=bT();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 b0(){return b0=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 bt(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){T4(n,t);var e=E4(n);function n(r){var i;k4(this,n),i=e.call(this,r),bt(St(i),"thumbsRef",void 0),bt(St(i),"carouselWrapperRef",void 0),bt(St(i),"listRef",void 0),bt(St(i),"itemsRef",void 0),bt(St(i),"timer",void 0),bt(St(i),"animationHandler",void 0),bt(St(i),"setThumbsRef",function(o){i.thumbsRef=o}),bt(St(i),"setCarouselWrapperRef",function(o){i.carouselWrapperRef=o}),bt(St(i),"setListRef",function(o){i.listRef=o}),bt(St(i),"setItemsRef",function(o,l){i.itemsRef||(i.itemsRef=[]),i.itemsRef[l]=o}),bt(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)))}),bt(St(i),"clearAutoPlay",function(){i.timer&&clearTimeout(i.timer)}),bt(St(i),"resetAutoPlay",function(){i.clearAutoPlay(),i.autoPlay()}),bt(St(i),"stopOnHover",function(){i.setState({isMouseEntered:!0},i.clearAutoPlay)}),bt(St(i),"startOnLeave",function(){i.setState({isMouseEntered:!1},i.autoPlay)}),bt(St(i),"isFocusWithinTheCarousel",function(){return i.carouselWrapperRef?!!((0,Wf.default)().activeElement===i.carouselWrapperRef||i.carouselWrapperRef.contains((0,Wf.default)().activeElement)):!1}),bt(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()}}),bt(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()}}}),bt(St(i),"setMountState",function(){i.setState({hasMount:!0}),i.updateSizes()}),bt(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})}}),bt(St(i),"handleOnChange",function(o,l){zt.Children.count(i.props.children)<=1||i.props.onChange(o,l)}),bt(St(i),"handleClickThumb",function(o,l){i.props.onClickThumb(o,l),i.moveTo(o)}),bt(St(i),"onSwipeStart",function(o){i.setState({swiping:!0}),i.props.onSwipeStart(o)}),bt(St(i),"onSwipeEnd",function(o){i.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),i.props.onSwipeEnd(o),i.clearAutoPlay(),i.state.autoPlay&&i.autoPlay()}),bt(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(vi({},a)),!!Object.keys(a).length}),bt(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))}),bt(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))}),bt(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()}}),bt(St(i),"onClickNext",function(){i.increment(1)}),bt(St(i),"onClickPrev",function(){i.decrement(1)}),bt(St(i),"onSwipeForward",function(){i.increment(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),bt(St(i),"onSwipeBackwards",function(){i.decrement(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),bt(St(i),"changeItem",function(o){return function(l){(!(0,Nu.isKeyboardEvent)(l)||l.key==="Enter")&&i.moveTo(o)}}),bt(St(i),"selectItem",function(o){i.setState(vi({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])}),bt(St(i),"getInitialImage",function(){var o=i.props.selectedItem,l=i.itemsRef&&i.itemsRef[o],a=l&&l.getElementsByTagName("img")||[];return a[0]}),bt(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=vi(vi({},s),i.animationHandler(r,s)),i}return C4(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(vi({},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=vi(vi({},c),{},{minWidth:s.props.centerSlidePercentage+"%"})),s.state.swiping&&s.state.swipeMovementStarted&&(c=vi(vi({},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(x4.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(x(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 b(){var S=Ng(),T=x(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 b.cancel=w,b.flush=k,b}var kT=Q4;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 J4=Math.PI;function Ix(t){return t*J4/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"}))},Z4=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 eF(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 tF="֑-߿יִ-﷽ﹰ-ﻼ",nF="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",rF=new RegExp("^[^"+nF+"]*["+tF+"]");function Hv(t){return rF.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 iF(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 sF(t){const e=v.useRef(t);return Aa(t,e.current)||(e.current=t),e.current}const oF=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(_3,{"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 lF(t){yl=t}const OT=/[&<>"']/,aF=new RegExp(OT.source,"g"),PT=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,uF=new RegExp(PT.source,"g"),cF={"&":"&","<":"<",">":">",'"':""","'":"'"},Dx=t=>cF[t];function Jn(t,e){if(e){if(OT.test(t))return t.replace(aF,Dx)}else if(PT.test(t))return t.replace(uF,Dx);return t}const fF=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function IT(t){return t.replace(fF,(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 dF=/(^|[^\[])\^/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(dF,"$1"),t=t.replace(r,i),n),getRegex:()=>new RegExp(t,e)};return n}const hF=/[^\w:]/g,pF=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _x(t,e,n){if(t){let r;try{r=decodeURIComponent(IT(n)).replace(hF,"").toLowerCase()}catch{return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}e&&!pF.test(n)&&(n=vF(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch{return null}return n}const Kf={},gF=/^[^:]+:\/*[^/]*$/,mF=/^([^:]+:)[\s\S]*$/,yF=/^([^:]+:\/*[^/]*)[\s\S]*$/;function vF(t,e){Kf[" "+t]||(gF.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(mF,"$1")+e:e.charAt(0)==="/"?n?e:t.replace(yF,"$1")+e:t+e}const hh={exec:function(){}};function Nx(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 Fx(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 bF(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null)return e;const r=n[1];return e.split(` +*/(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 r4=function(e){return e.hasOwnProperty("key")},Bv=function(t){Z3(n,t);var e=e4(n);function n(r){var i;return Y3(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=yi.Children.count(i.props.children),o=i.itemsWrapperRef.clientWidth,l=i.props.thumbWidth?i.props.thumbWidth:(0,X3.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,Ex.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 J3(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,h4.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};Yi.slideAnimationHandler=m4;var y4=function(e,n,r,i){var s={},o=n.axis==="horizontal",l=xT.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};Yi.slideSwipeAnimationHandler=y4;var v4=function(e,n){var r=(0,Qi.getPosition)(n.selectedItem,e),i=(0,Qi.setPosition)(r,e.axis);return{itemListStyle:i}};Yi.slideStopSwipingHandler=v4;var w4=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)}};Yi.fadeAnimationHandler=w4;Object.defineProperty(dp,"__esModule",{value:!0});dp.default=void 0;var zt=k4(v),x4=Uc(Fv),ys=Uc(Hc),b4=Uc(Wc),Wf=Uc(gp),Vf=Uc(Vc),Nu=Lr,fh=Yi;function Uc(t){return t&&t.__esModule?t:{default:t}}function bT(){if(typeof WeakMap!="function")return null;var t=new WeakMap;return bT=function(){return t},t}function k4(t){if(t&&t.__esModule)return t;if(t===null||Gu(t)!=="object"&&typeof t!="function")return{default:t};var e=bT();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 b0(){return b0=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 bt(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){E4(n,t);var e=A4(n);function n(r){var i;S4(this,n),i=e.call(this,r),bt(St(i),"thumbsRef",void 0),bt(St(i),"carouselWrapperRef",void 0),bt(St(i),"listRef",void 0),bt(St(i),"itemsRef",void 0),bt(St(i),"timer",void 0),bt(St(i),"animationHandler",void 0),bt(St(i),"setThumbsRef",function(o){i.thumbsRef=o}),bt(St(i),"setCarouselWrapperRef",function(o){i.carouselWrapperRef=o}),bt(St(i),"setListRef",function(o){i.listRef=o}),bt(St(i),"setItemsRef",function(o,l){i.itemsRef||(i.itemsRef=[]),i.itemsRef[l]=o}),bt(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)))}),bt(St(i),"clearAutoPlay",function(){i.timer&&clearTimeout(i.timer)}),bt(St(i),"resetAutoPlay",function(){i.clearAutoPlay(),i.autoPlay()}),bt(St(i),"stopOnHover",function(){i.setState({isMouseEntered:!0},i.clearAutoPlay)}),bt(St(i),"startOnLeave",function(){i.setState({isMouseEntered:!1},i.autoPlay)}),bt(St(i),"isFocusWithinTheCarousel",function(){return i.carouselWrapperRef?!!((0,Wf.default)().activeElement===i.carouselWrapperRef||i.carouselWrapperRef.contains((0,Wf.default)().activeElement)):!1}),bt(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()}}),bt(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()}}}),bt(St(i),"setMountState",function(){i.setState({hasMount:!0}),i.updateSizes()}),bt(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})}}),bt(St(i),"handleOnChange",function(o,l){zt.Children.count(i.props.children)<=1||i.props.onChange(o,l)}),bt(St(i),"handleClickThumb",function(o,l){i.props.onClickThumb(o,l),i.moveTo(o)}),bt(St(i),"onSwipeStart",function(o){i.setState({swiping:!0}),i.props.onSwipeStart(o)}),bt(St(i),"onSwipeEnd",function(o){i.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),i.props.onSwipeEnd(o),i.clearAutoPlay(),i.state.autoPlay&&i.autoPlay()}),bt(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(vi({},a)),!!Object.keys(a).length}),bt(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))}),bt(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))}),bt(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()}}),bt(St(i),"onClickNext",function(){i.increment(1)}),bt(St(i),"onClickPrev",function(){i.decrement(1)}),bt(St(i),"onSwipeForward",function(){i.increment(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),bt(St(i),"onSwipeBackwards",function(){i.decrement(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),bt(St(i),"changeItem",function(o){return function(l){(!(0,Nu.isKeyboardEvent)(l)||l.key==="Enter")&&i.moveTo(o)}}),bt(St(i),"selectItem",function(o){i.setState(vi({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])}),bt(St(i),"getInitialImage",function(){var o=i.props.selectedItem,l=i.itemsRef&&i.itemsRef[o],a=l&&l.getElementsByTagName("img")||[];return a[0]}),bt(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=vi(vi({},s),i.animationHandler(r,s)),i}return T4(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(vi({},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=vi(vi({},c),{},{minWidth:s.props.centerSlidePercentage+"%"})),s.state.swiping&&s.state.swipeMovementStarted&&(c=vi(vi({},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(b4.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(x(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 b(){var S=Ng(),T=x(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 b.cancel=w,b.flush=k,b}var kT=J4;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 Z4=Math.PI;function Ix(t){return t*Z4/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"}))},eF=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 tF(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 nF="֑-߿יִ-﷽ﹰ-ﻼ",rF="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",iF=new RegExp("^[^"+rF+"]*["+nF+"]");function Hv(t){return iF.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 sF(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 oF(t){const e=v.useRef(t);return Aa(t,e.current)||(e.current=t),e.current}const lF=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(N3,{"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 aF(t){yl=t}const OT=/[&<>"']/,uF=new RegExp(OT.source,"g"),PT=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,cF=new RegExp(PT.source,"g"),fF={"&":"&","<":"<",">":">",'"':""","'":"'"},Dx=t=>fF[t];function Jn(t,e){if(e){if(OT.test(t))return t.replace(uF,Dx)}else if(PT.test(t))return t.replace(cF,Dx);return t}const dF=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function IT(t){return t.replace(dF,(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 hF=/(^|[^\[])\^/g;function qt(t,e){t=typeof t=="string"?t:t.source,e=e||"";const n={replace:(r,i)=>(i=i.source||i,i=i.replace(hF,"$1"),t=t.replace(r,i),n),getRegex:()=>new RegExp(t,e)};return n}const pF=/[^\w:]/g,gF=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _x(t,e,n){if(t){let r;try{r=decodeURIComponent(IT(n)).replace(pF,"").toLowerCase()}catch{return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}e&&!gF.test(n)&&(n=wF(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch{return null}return n}const Kf={},mF=/^[^:]+:\/*[^/]*$/,yF=/^([^:]+:)[\s\S]*$/,vF=/^([^:]+:\/*[^/]*)[\s\S]*$/;function wF(t,e){Kf[" "+t]||(mF.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(yF,"$1")+e:e.charAt(0)==="/"?n?e:t.replace(vF,"$1")+e:t+e}const hh={exec:function(){}};function Nx(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 Fx(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 kF(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=bF(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 x=m.length>1,g={type:"list",raw:"",ordered:x,start:x?+m.slice(0,-1):"",loose:!1,items:[]};m=x?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=x?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(` +`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],i=kF(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 x=m.length>1,g={type:"list",raw:"",ordered:x,start:x?+m.slice(0,-1):"",loose:!1,items:[]};m=x?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=x?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|$))`),b=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(` @@ -188,8 +188,8 @@ Error generating stack: `+s.message+` `+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"),b=k.length>0&&k.some(S=>/\n.*\n/.test(S.raw));g.loose=b}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:Nx(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=wF(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)),Fx(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 Fx(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 xo{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 xo(n).lex(e)}static lexInline(e,n){return new xo(n).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,` +`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:Jn(n[1])}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&/^/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=xF(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)),Fx(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 Fx(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=qt(Xe.def).replace("label",Xe._label).replace("title",Xe._title).getRegex();Xe.bullet=/(?:[*+-]|\d{1,9}[.)])/;Xe.listItemStart=qt(/^( *)(bull) */).replace("bull",Xe.bullet).getRegex();Xe.list=qt(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=qt(Xe.html,"i").replace("comment",Xe._comment).replace("tag",Xe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();Xe.paragraph=qt(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=qt(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=qt(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=qt(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:qt(`^ *(?: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:qt(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=qt(Oe.punctuation).replace(/punctuation/g,Oe._punctuation).getRegex();Oe.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;Oe.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;Oe._comment=qt(Xe._comment).replace("(?:-->|$)","-->").getRegex();Oe.emStrong.lDelim=qt(Oe.emStrong.lDelim).replace(/punct/g,Oe._punctuation).getRegex();Oe.emStrong.rDelimAst=qt(Oe.emStrong.rDelimAst,"g").replace(/punct/g,Oe._punctuation).getRegex();Oe.emStrong.rDelimUnd=qt(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=qt(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=qt(Oe.tag).replace("comment",Oe._comment).replace("attribute",Oe._attribute).getRegex();Oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;Oe._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;Oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;Oe.link=qt(Oe.link).replace("label",Oe._label).replace("href",Oe._href).replace("title",Oe._title).getRegex();Oe.reflink=qt(Oe.reflink).replace("label",Oe._label).replace("ref",Xe._label).getRegex();Oe.nolink=qt(Oe.nolink).replace("ref",Xe._label).getRegex();Oe.reflinkSearch=qt(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:qt(/^!?\[(label)\]\((.*?)\)/).replace("label",Oe._label).getRegex(),reflink:qt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Oe._label).getRegex()};Oe.gfm={...Oe.normal,escape:qt(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 xo{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 xo(n).lex(e)}static lexInline(e,n){return new xo(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+=` @@ -199,7 +199,7 @@ Error generating stack: `+s.message+` `+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)+"["+Lx("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)+"["+Lx("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,Bx)){e=e.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e,Bx))){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,kF)){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$/,"")+` +`+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)+"["+Lx("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)+"["+Lx("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,Bx)){e=e.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e,Bx))){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,SF)){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`
@@ -220,56 +220,56 @@ ${e}
${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=_x(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i='
",i}image(e,n,r){if(e=_x(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,x,g,y,w,k,b,S;const T=e.length;for(i=0;i0&&y.tokens[0].type==="paragraph"?(y.tokens[0].text=b+" "+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=b+" "+y.tokens[0].tokens[0].text)):y.tokens.unshift({type:"text",text:b}):g+=b),g+=this.parse(y.tokens,x),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=SF(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(xF(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(xo.lex,Kc.parse)(t,e,n)}qe.options=qe.setOptions=function(t){return qe.defaults={...qe.defaults,...t},lF(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(xo.lexInline,Kc.parseInline);qe.Parser=Kc;qe.parser=Kc.parse;qe.Renderer=Vv;qe.TextRenderer=DT;qe.Lexer=xo;qe.lexer=xo.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;xo.lex;const CF=Wr("div")({name:"MarkdownContainer",class:"gdg-mnuv029",propsAsIs:!1});class TF extends In.PureComponent{constructor(){super(...arguments);xt(this,"targetElement",null);xt(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(),In.createElement(CF,{ref:this.containerRefHook})}}const EF=Wr("textarea")({name:"InputBox",class:"gdg-izpuzkl",propsAsIs:!1}),AF=Wr("div")({name:"ShadowBox",class:"gdg-s69h75o",propsAsIs:!1}),MF=Wr("div")({name:"GrowingEntryStyle",class:"gdg-g1y0xocz",propsAsIs:!1});let zx=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-"+(zx=(zx+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(MF,{className:"gdg-growing-entry"},v.createElement(AF,{className:u},f+` -`),v.createElement(EF,{...l,className:(u??"")+" gdg-input",id:d,ref:c,onKeyDown:h,value:f,placeholder:e,dir:"auto"}))},Lg={};let Vs=null;function RF(){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||RF(),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 $x=new Map;function jx(t,e){const n=`${t}-${e}`,r=$x.get(n);if(r!==void 0)return r;const i=Nr(t,e);return $x.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 OF(){Hl.clear(),E0.clear(),ra.clear()}function PF(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,x=h+m;n.set(f,x)}}function IF(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=IF(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 PF(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 DF(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 _F(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 x=DF(t,h,r,n,p,m,d),g=h.slice(0,Math.max(0,x));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 NF(t,e){return In.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 BF(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)&&Hx(t,e,s)&&i++;for(const o of n.current.rangeStack)Hx(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 HF(){var t;jF||((t=document==null?void 0:document.fonts)==null?void 0:t.ready)===void 0||(await document.fonts.ready,Pd=0,Qu={},OF())}HF();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 WF(t,e){const n=zT(t,void 0,"middle",e);return Qu[n]}function Is(t,e){return typeof e!="string"&&(e=e.baseFontFull),VF(t,e)}function Wx(t,e){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";t.save(),t.textBaseline=e;const r=t.measureText(n);return t.restore(),r}const Vx=[];function VF(t,e){for(const s of Vx)if(s.key===e)return s.val;const n=Wx(t,"alphabetic"),i=-(Wx(t,"middle").actualBoundingBoxDescent-n.actualBoundingBoxDescent)+n.actualBoundingBoxAscent/2;return Vx.push({key:e,val:i}),i}function UF(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 XF(t,e,n,r,i,s,o,l,a,u){const c=l.baseFontFull,f=_F(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 x=r+s/2-p/2;let g=Math.max(r+l.cellVerticalPadding,x);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=KF(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?XF(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 GF(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 YF(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,x=!1;h<0?p<0?p=Math.PI+p:(p=Math.PI-p,m=-1,x=!0):p>0&&(m=-1,x=!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,b=a.y+f.ny*y;k+=-f.ny*w*m,b+=f.nx*w*m,t.arc(k,b,w,c.ang+Math.PI/2*m,f.ang-Math.PI/2*m,x),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 x=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 b=h[g-1];m.x-=b.width,m.width+=b.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 Si(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(){xt(this,"visibleWindow",{x:0,y:0,width:0,height:0});xt(this,"freezeCols",0);xt(this,"freezeRows",[]);xt(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 qF extends WT{constructor(){super(...arguments);xt(this,"cache",new Map);xt(this,"setValue",(n,r)=>{this.cache.set(Si(n[0],n[1]),r)});xt(this,"getValue",n=>this.cache.get(Si(n[0],n[1])));xt(this,"clearOutOfWindow",()=>{for(const[n]of this.cache.entries())this.isInWindow(n)||this.cache.delete(n)})}}class Ju{constructor(e=[]){xt(this,"cells");this.cells=new Set(e.map(n=>Si(n[0],n[1])))}add(e){this.cells.add(Si(e[0],e[1]))}has(e){return e===void 0?!1:this.cells.has(Si(e[0],e[1]))}remove(e){this.cells.delete(Si(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=ZF(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 eB(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(),[x,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 b={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(b,a.signal),A=k>0?y(S,a.signal):void 0;let I;typeof E=="object"?I=E:I=await wx(E),A!==void 0&&(typeof A=="object"?I=[...I,...A]:I=[...I,...await wx(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(x===void 0||m.current!==t||T.id===void 0)return{...T,width:R0};const A=KT(h,o,T,E,x,i,s,!0,l);return p.current[T.id]=A.width,A})),k=0,b=0;const S=[];for(const[T,E]of w.entries())k+=E.width,E.grow!==void 0&&E.grow>0&&(b+=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=nB(a),a in Ux)return;Ux[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":tB,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 rB(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}var iB=rB,sB=iB,Fg=$v;function oB(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),sB(Fg(t),e,n)}var lB=oB;const ki=Ii(lB);var aB="__lodash_hash_undefined__";function uB(t){return this.__data__.set(t,aB),this}var cB=uB;function fB(t){return this.__data__.has(t)}var dB=fB,hB=Pv,pB=cB,gB=dB;function gh(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new hB;++e-1}var RB=MB;function OB(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=qB){var u=e?null:GB(t);if(u)return YB(u);o=!1,i=XB,a=new VB}else a=e?[]:l;e:for(;++r0&&n(l)?e>1?JT(l,e-1,n,r,i):az(i,l):r||(i[i.length]=l)}return i}var cz=JT,fz=cz;function dz(t){var e=t==null?0:t.length;return e?fz(t,1):[]}var hz=dz;const Gx=Ii(hz);var pz=Math.ceil,gz=Math.max;function mz(t,e,n,r){for(var i=-1,s=gz(pz((e-t)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=t,t+=n;return o}var yz=mz,vz=uT,wz=Nv;function xz(t){return t!=null&&wz(t.length)&&!vz(t)}var Yv=xz,bz=Rv,kz=Yv,Sz=_v,Cz=gl;function Tz(t,e,n){if(!Cz(n))return!1;var r=typeof e;return(r=="number"?kz(n)&&Sz(e,n.length):r=="string"&&e in n)?bz(n[e],t):!1}var Ez=Tz,Az=$v,Yx=1/0,Mz=17976931348623157e292;function Rz(t){if(!t)return t===0?t:0;if(t=Az(t),t===Yx||t===-Yx){var e=t<0?-1:1;return e*Mz}return t===t?t:0}var Oz=Rz,Pz=yz,Iz=Ez,zg=Oz;function Dz(t){return function(e,n,r){return r&&typeof r!="number"&&Iz(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(x,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 x=s.sourceIndex-1;x>=h;x--)p-=o[x].width,m+=o[x].width;for(let x=s.sourceIndex+1;x<=a;x++)m+=o[x].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 x=s.sourceIndex-1;x>=l;x--)p-=o[x].width,m+=o[x].width;for(let x=s.sourceIndex+1;x<=h;x++)m+=o[x].width;u={x:p,y:n,width:m,height:i}}return[u,c]}function $z(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 jz(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 Hz(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 Wz(t,e,n,r,i){const[s,o,l,a]=e,[u,c,f,d]=i,{x:h,y:p,width:m,height:x}=t,g=[];if(m<=0||x<=0)return g;const y=h+m,w=p+x,k=hl,T=p+x>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&&b){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(b&&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(b&&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 Vz={kind:Se.Loading,allowOverlay:!1};function qx(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,g,y,w,k,b,S,T,E,A,I,_,P,N,D,ee,ne,ie,W){let Y=(w==null?void 0:w.size)??Number.MAX_SAFE_INTEGER;const R=performance.now();let O=N.baseFontFull;t.font=O;const F={ctx:t},L=[0,0],H=x>0?vl(a,x,u):0;let $,ue;const ce=ZT(y);return Mo(e,l,s,o,i,(xe,Ge,$e,at,_t)=>{const Qe=Math.max(0,at-Ge),it=Ge+Qe,Je=i+1,Wt=xe.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(xe.sourceIndex),Le=f(xe.group??"").overrideTheme,nt=xe.themeOverride===void 0&&Le===void 0?N:yo(N,Le,xe.themeOverride),_e=nt.baseFontFull;_e!==O&&(O=_e,t.font=_e),me();let ft;return yp(_t,$e,r,a,u,x,g,ce,(ut,vt,he,rt,st)=>{var Lt,Mt,Un;if(vt<0||(L[0]=xe.sourceIndex,L[1]=vt,w!==void 0&&!w.has(L)))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;ltW&&!Ze){const lt=J.baseFontFull;lt!==O&&(t.font=lt,O=lt),ft=rE(t,wt,xe.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,F),ft=void 0,me(),O=_e,t.font=_e),Y<=0}),t.restore(),Y<=0}),$}const wu=[0,0],xu={x:0,y:0,width:0,height:0},$g=[void 0,()=>{}];let O0=!1;function Uz(){O0=!0}function rE(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,g,y,w,k,b,S,T,E){var ee,ne;let A,I;x!==void 0&&x[0][0]===n&&x[0][1]===r&&(A=x[1][0],I=x[1][1]);let _;wu[0]=n,wu[1]=r,xu.x=o,xu.y=l,xu.width=a,xu.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:xu,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:Uz},N=UF(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)&&(b==null||b(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),x=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"&&(x*=.8,m*=.8),t.fillStyle=l?e.accentColor:e.textMedium,t.fill(),t.beginPath(),t.moveTo(g-x+m/4.23,h-x+m/1.97),t.lineTo(g-x+m/2.42,h-x+m/1.44),t.lineTo(g-x+m/1.29,h-x+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"&&(x*=.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 Kz(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,g,y){const w=o+l;if(w<=0)return;t.fillStyle=f.bgHeader,t.fillRect(0,0,i,w);const[k,b]=(r==null?void 0:r[0])??[],S=f.headerFontFull;t.font=S,Mo(e,0,s,0,w,(T,E,A,I)=>{var F;if(x!==void 0&&!x.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&&b===-1&&k===T.sourceIndex,ie=ee?0:((F=h.find(L=>L.item[0]===T.sourceIndex&&L.item[1]===-1))==null?void 0:F.hoverAmount)??0,W=(c==null?void 0:c.current)!==void 0&&c.current.cell[0]===T.sourceIndex,Y=D?N.accentColor:W?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)):(W||ie>0)&&(t.beginPath(),t.rect(E+O,R,T.width-O,o),W&&(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,W,ie,d,g,y),t.restore()}),n&&Xz(t,e,i,s,l,r,f,d,h,p,m,x)}function Xz(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,(x,g,y,w,k,b)=>{if(f!==void 0&&!f.hasItemInRectangle({x:x[0],y:-2,width:x[1]-x[0]+1,height:1}))return;t.save(),t.beginPath(),t.rect(y,w,k,b),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>=x[0]&&h<=x[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:b},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 W=0;W35){const k=d?35:r-35,b=d?35*.7:r-35*.7,S=k/r,T=b/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"),x&&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;YF(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;GF(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},()=>Qx(t,e,n,r,i,s,o,l,a,c,f,h,p,m)):Qx(t,e,n,r,i,s,o,l,a,c,f,h,p,m)}var Gz=ml,Yz=function(){try{var t=Gz(Object,"defineProperty");return t({},"",{}),t}catch{}}(),qz=Yz,Jx=qz;function Qz(t,e,n){e=="__proto__"&&Jx?Jx(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var Jz=Qz;function Zz(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&oj?new nj:void 0;for(s.set(t,e),s.set(e,t);++f{if(k!==e[e.length-1])return;b+=k.width;const A=Math.max(b,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&&x.length>0&&!x.some(W=>mh(b,I,1e4,P,W.x,W.y,W.width,W.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(b,I,1e4,P)),ee&&(t.fillStyle=ie.bgHeader,t.fillRect(b,I,1e4,P)),D&&(t.fillStyle=ie.accentLight,t.fillRect(b,I,1e4,P))}),t.restore())})}function Q8(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=jx(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:jx(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 J8(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p){var P;const m=p.bgCell,{minX:x,maxX:g,minY:y,maxY:w}=yE(l,s,o),k=[],b=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,y:N,w:g-x,h:D,color:ne})}S+=D,T0)for(let N=0;N=x&&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 vb(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,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=x.horizontalBorderColor??x.borderColor,w=x.borderColor,{minX:k,maxX:b,minY:S,maxY:T}=yE(l,s,o),E=[];t.beginPath();let A=.5;for(let P=0;P=k&&D<=b&&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:b,y2:ee,color:(ne==null?void 0:ne.horizontalBorderColor)??(ne==null?void 0:ne.borderColor)??y})}P+=f(N),N++}}const _=Y8(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 Z8(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,g,y){const w=[];t.imageSmoothingEnabled=!1;const k=Math.min(i.cellYOffset,o),b=Math.max(i.cellYOffset,o);let S=0;if(typeof g=="number")S+=(b-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(x);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 eW(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 tW(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(x===void 0||x.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],b=x.map(T=>{const E=T.range,A=T.style??"dashed";return Wz(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:Hz({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 b)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,_=!jz(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 xb(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,x){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]>=x&&w[1]>=x||!o.some(D=>D.sourceIndex===y[0]||D.sourceIndex===w[0]))return;const[b,S]=c.current.cell,T=d(c.current.cell),E=T.span??[b,b],A=S>=x-h,I=h>0&&!A?vl(x,h,f)-1:0,_=w[1];let P;if(Mo(o,r,i,s,u,(D,ee,ne,ie,W)=>{if(D.sticky&&b>D.sourceIndex)return;const Y=D.sourceIndexE[1],O=D.sourceIndex===w[0];if(!(!O&&(Y||R)))return yp(W,ne,n,x,f,h,p,void 0,(F,L,H)=>{if(L!==S&&L!==_)return;let $=ee,ue=D.width;if(T.span!==void 0){const xe=tE(T.span,ee,F,D.width,H,D,l),Ge=D.sticky?xe[0]:xe[1];Ge!==void 0&&($=Ge.x,ue=Ge.width)}return L===_&&O&&m&&(P=()=>{var xe;ie>$&&!D.sticky&&(t.beginPath(),t.rect(ie,0,e-ie,n),t.clip()),t.beginPath(),t.rect($+ue-4,F+H-4,4,4),t.fillStyle=((xe=D.themeOverride)==null?void 0:xe.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 nW(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 rW(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,(x,g,y,w)=>{w||(c=Math.max(g,c))}),!0)),c}function bb(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:x,groupHeaderHeight:g,disabledRows:y,rowHeight:w,verticalBorder:k,overrideCursor:b,isResizing:S,selection:T,fillHandle:E,freezeTrailingRows:A,rows:I,getCellContent:_,getGroupDetails:P,getRowThemeOverride:N,isFocused:D,drawHeaderCallback:ee,prelightCells:ne,drawCellCallback:ie,highlightRegions:W,resizeCol:Y,imageLoader:R,lastBlitData:O,hoverValues:F,hyperWrapping:L,hoverInfo:H,spriteManager:$,maxScaleFactor:ue,hasAppendRow:ce,touchMode:xe,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"&&tW(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+x:x,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(W!==void 0){for(const De of W)if(De.style!=="no-outline"&&De.range.y===l&&u===0){V=!0;break}}const pe=()=>{Kz(st,dt,f,H,i,a,x,g,h,S,T,p,$,F,k,P,Je,ee,xe),vb(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&&wb(st,i,s,o,l,a,u,c,d,x,g,w,A,I,W,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=>{qx(Lt,dt,c,s,_e,a,u,l,I,ct,_,P,N,y,D,m,A,ce,fe,Je,T,ne,W,R,$,F,H,ie,L,p,Ge,$e,at,b,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()&&(nW(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}=Z8(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=eW(he,o,l,a,u,i,s,_e,dt,Ie));Q8(Ve,dt,i,s,A,I,k,ct,p);const J=wb(Ve,i,s,o,l,a,u,c,d,x,g,w,A,I,W,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=qx(Ve,dt,c,s,_e,a,u,l,I,ct,_,P,N,y,D,m,A,ce,fe,Je,T,ne,W,R,$,F,H,ie,L,p,Ge,$e,at,b,Wt);q8(Ve,dt,c,i,s,_e,a,u,l,I,ct,N,T.rows,y,A,ce,fe,Je,p),J8(Ve,dt,l,a,u,i,s,fe,_e,ct,N,k,A,I,p),vb(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?(xb(st,Et+De.width,0,_e+1,Nr(p.resizeIndicatorColor??p.accentLight,p.bgHeader)),xb(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=rW(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 iW=80;function sW(t){const e=t-1;return e*e*e+1}class oW{constructor(e){xt(this,"callback");xt(this,"currentHoveredItem");xt(this,"leavingItems",[]);xt(this,"lastAnimationTime");xt(this,"addToLeavingItems",e=>{this.leavingItems.some(r=>qu(r.item,e.item))||this.leavingItems.push(e)});xt(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});xt(this,"cleanUpLeavingElements",()=>{this.leavingItems=this.leavingItems.filter(e=>e.hoverAmount>0)});xt(this,"shouldStep",()=>{const e=this.leavingItems.length>0,n=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return e||n});xt(this,"getAnimatingItems",()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(e=>({...e,hoverAmount:sW(e.hoverAmount)})));xt(this,"step",e=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=e;else{const r=(e-this.lastAnimationTime)/iW;for(const s of this.leavingItems)s.hoverAmount=ki(s.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=ki(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});xt(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 lW{constructor(e){xt(this,"fn");xt(this,"val");this.fn=e}get value(){return this.val??(this.val=this.fn())}}function Jv(t){return new lW(t)}const aW=Jv(()=>window.navigator.userAgent.includes("Firefox")),wh=Jv(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),xh=Jv(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function uW(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=Si(s[0],s[1]);e.current.includes(o)||e.current.push(o)},[i])}const Xs="header",Dr="group-header",bh="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 kb=6,cW=(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))??""},fW=(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:x,isFilling:g,onCanvasFocused:y,onCanvasBlur:w,isFocused:k,selection:b,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:W,onKeyDown:Y,onKeyUp:R,highlightRegions:O,canvasRef:F,onDragStart:L,onDragEnd:H,eventTargetRef:$,isResizing:ue,resizeColumn:ce,isDragging:xe,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 zz(Wt,()=>{Ni.current=void 0,Po.current()}),[Wt]),Un=x?c+a:a,lt=v.useRef(-1),Ut=((rt==null?void 0:rt.enableFirefoxRescaling)??!1)&&aW.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=NF(s,S),Fn=A?Ma(Kt,ie):0,Zt=v.useCallback((j,re,be)=>{const ge=j.getBoundingClientRect();if(re>=Kt.length||be>=d)return;const oe=ge.width/n,Ae=M0(re,be,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]),Rn=v.useCallback((j,re,be,ge)=>{const oe=j.getBoundingClientRect(),Ae=oe.width/n,et=(re-oe.left)/Ae,tt=(be-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=zF(et,Dt,Ve),kt=$F(tt,r,x,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,Ur=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 di=!1;if(ot===-1&&kt===-1){const Do=Zt(j,Kt.length-1,-1);_r(Do!==void 0),di=ren&&etr&&tt=0?(wn=!0,Rt=Zt(j,Mr,kt),_r(Rt!==void 0),Ar={kind:x&&kt===-2?Dr:Xs,location:[Mr,kt],bounds:Rt,group:Kt[Mr].group??"",isEdge:wn,shiftKey:vn,ctrlKey:pt,metaKey:hn,isTouch:Ur,localEventX:re-Rt.x,localEventY:be-Rt.y,button:Fe,buttons:Bt,scrollEdge:an}):Ar={kind:x&&kt===-2?Dr:Xs,group:Kt[ot].group??"",location:[ot,kt],bounds:Rt,isEdge:wn,shiftKey:vn,ctrlKey:pt,metaKey:hn,isTouch:Ur,localEventX:re-Rt.x,localEventY:be-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 qF,[]),tf=Ut&&Ze?1:Ft&&Ze?2:5,nf=(rt==null?void 0:rt.disableMinimumCellWidth)===!0?1:10,Ni=v.useRef(),xl=v.useRef(null),bl=v.useRef(null),kl=v.useCallback(()=>{var et;const j=ct.current,re=Ue.current;if(j===null||re===null||(xl.current===null&&(xl.current=j.getContext("2d",{alpha:!1}),j.width=0,j.height=0),bl.current===null&&(bl.current=re.getContext("2d",{alpha:!1}),re.width=0,re.height=0),xl.current===null||bl.current===null||us===null||cs===null))return;let be=!1;const ge=tt=>{be=!0,De(tt)},oe=Ni.current,Ae={headerCanvasCtx:bl.current,canvasCtx:xl.current,bufferACtx:us,bufferBCtx:cs,width:n,height:r,cellXOffset:wt,cellYOffset:l,translateX:Math.round(Ve),translateY:Math.round(sn),mappedColumns:Kt,enableGroups:x,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:b,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,bb(Ae,oe)):bb(Ae,void 0),!be&&(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,x,S,ie,it,a,c,at,f,Pe,ue,_t,ce,k,b,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=uW(_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,be,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,be+re.x,ge+tt.y))return oe.actions[et]}},[Qe]),ui=v.useCallback((j,re,be,ge)=>{const oe=s[re];if(!xe&&!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(be>et.x&&beet.y&&ge{const re=ct.current,be=$==null?void 0:$.current;if(re===null||j.target!==re&&j.target!==be)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===be&&be!==null){const et=be.getBoundingClientRect();if(ge>et.right||oe>et.bottom)return}const Ae=Rn(re,ge,oe,j);Ls.current=Ae.location,Ae.isTouch&&(Qa.current=Date.now()),Lt.current!==Ae.isTouch&&Vt(Ae.isTouch),!(Ae.kind===Xs&&ui(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,Rn,Tr,ui,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 be=ct.current;if(Ja.current=!1,N===void 0||be===null)return;const ge=$==null?void 0:$.current,oe=j.target!==be&&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=Rn(be,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=ui(be,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,$,Rn,ui,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 be=$==null?void 0:$.current,ge=j.target!==re&&j.target!==be;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=Rn(re,oe,Ae,j);Lt.current!==tt.isTouch&&Vt(tt.isTouch),!ge&&j.cancelable&&et&&j.preventDefault();const[Te]=tt.location,Dt=ui(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)}},[$,Rn,ui,m,Tr]);$n("click",af,window,!1);const Fp=v.useCallback(j=>{const re=ct.current,be=$==null?void 0:$.current;if(re===null||j.target!==re&&j.target!==be||T===void 0)return;const ge=Rn(re,j.clientX,j.clientY,j);T(ge,()=>{j.cancelable&&j.preventDefault()})},[$,Rn,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},[]),ci=v.useMemo(()=>new oW(uf),[uf]),ds=v.useRef(ci);ds.current=ci,v.useLayoutEffect(()=>{const j=ds.current;if(on===void 0||on[1]<0){j.setHovered(on);return}const re=h(on,!0),be=st(re),ge=be===void 0&&re.kind===Se.Custom||(be==null?void 0:be.needsHover)!==void 0&&(typeof be.needsHover=="boolean"?be.needsHover:be.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 be=$==null?void 0:$.current,ge=j.target!==re&&j.target!==be,oe=Rn(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===bh?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]>=(W?0:1);Ne(oe.kind===Xs&&oe.isEdge&&et&&$e===!0),_p(oe.kind==="cell"&&oe.isFillHandle),D==null||D(j),ee(oe)},[$,Rn,W,$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 be,ge;b.current!==void 0&&(be=Zt(re,b.current.cell[0],b.current.cell[1]),ge=b.current.cell),Y==null||Y({bounds:be,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,b,Zt]),Io=v.useCallback(j=>{const re=ct.current;if(re===null)return;let be,ge;b.current!==void 0&&(be=Zt(re,b.current.cell[0],b.current.cell[1]),ge=b.current.cell),R==null||R({bounds:be,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,b,Zt]),Bp=v.useCallback(j=>{ct.current=j,F!==void 0&&(F.current=j)},[F]),cf=v.useCallback(j=>{const re=ct.current;if(re===null||Ge===!1||ue){j.preventDefault();return}let be,ge;const oe=Rn(re,j.clientX,j.clientY);if(Ge!==!0&&oe.kind!==Ge){j.preventDefault();return}const Ae=(Bt,ot)=>{be=Bt,ge=ot};let et,tt,Te;const Dt=(Bt,ot,kt)=>{et=Bt,tt=ot,Te=kt};let Fe=!1;if(L==null||L({...oe,setData:Ae,setDragImage:Dt,preventDefault:()=>Fe=!0,defaultPrevented:()=>Fe}),!Fe&&be!==void 0&&ge!==void 0&&j.dataTransfer!==null)if(j.dataTransfer.setData(be,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,Rn,L,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 be=Rn(re,j.clientX,j.clientY),[ge,oe]=be.location,Ae=ge-(W?0:1),[et,tt]=eu.current??[];(et!==Ae||tt!==oe)&&(eu.current=[Ae,oe],nt([Ae,oe],j.dataTransfer))},[W,Rn,nt,_e]);$n("dragover",zp,($==null?void 0:$.current)??null,!1,!1);const Ew=v.useCallback(()=>{eu.current=void 0,H==null||H()},[H]);$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 be=Rn(re,j.clientX,j.clientY),[ge,oe]=be.location,Ae=ge-(W?0:1);_e([Ae,oe],j.dataTransfer)},[W,Rn,_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(b);En.current=b;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=F==null?void 0:F.current)==null||re.focus({preventScroll:!0}):j!==null&&j.focus({preventScroll:!0}),Al.current=j)},[F]);v.useImperativeHandle(e,()=>({focus:()=>{var re;const j=Al.current;j===null||!document.contains(j)?(re=F==null?void 0:F.current)==null||re.focus({preventScroll:!0}):j.focus({preventScroll:!0})},getBounds:(j,re)=>{if(!(F===void 0||F.current===null))return Zt(F.current,j??0,re??-1)},damage:sf}),[F,sf,Zt]);const Fs=v.useRef(),pr=eF(()=>{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=W?0:-1;!W&&((tt=j[0])==null?void 0:tt.sourceIndex)===0&&(j=j.slice(1));const[be,ge]=((Te=b.current)==null?void 0:Te.cell)??[],oe=(Dt=b.current)==null?void 0:Dt.range,Ae=j.map(Fe=>Fe.sourceIndex),et=Uo(l,Math.min(d,l+i));return be!==void 0&&ge!==void 0&&!(Ae.includes(be)&&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":b.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":b.rows.hasIndex(Fe),key:Fe,"aria-rowindex":Fe+2},j.map(Bt=>{const ot=Bt.sourceIndex,kt=Si(ot,Fe),vn=be===ot&&ge===Fe,pt=oe!==void 0&&ot>=oe.x&&ot=oe.y&&Fe{const Ar=F==null?void 0:F.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:Ur})},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=Ur,Le==null?void 0:Le(Ur)},ref:vn?tu:void 0,tabIndex:-1},cW(an,st))})))))},[n,Kt,wt,ie,Ve,d,l,i,b,tu,h,F,Y,Zt,Le],200),fi=S===0||!A?0:wt>S?1:ki(-Ve/100,0,1),$p=-l*32+sn,Ml=I?ki(-$p/100,0,1):0,jp=v.useMemo(()=>{if(!fi&&!Ml)return null;const j={position:"absolute",top:0,left:Fn,width:n-Fn,height:r,opacity:fi,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,fi>0&&v.createElement("div",{id:"shadow-x",style:j}),Ml>0&&v.createElement("div",{id:"shadow-y",style:re}))},[fi,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)},dW=v.memo(v.forwardRef(fW));function bu(t,e,n,r){return ki(Math.round(e-(t.growOffset??0)),Math.ceil(n),Math.floor(r))}const hW=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,x]=v.useState(),[g,y]=v.useState(!1),[w,k]=v.useState(),{onHeaderMenuClick:b,getCellContent:S,onColumnMoved:T,onColumnResize:E,onColumnResizeStart:A,onColumnResizeEnd:I,gridRef:_,maxColumnWidth:P,minColumnWidth:N,onRowMoved:D,lockColumns:ee,onColumnProposeMove:ne,onMouseDown:ie,onMouseUp:W,onItemHovered:Y,onDragStart:R,canvasRef:O}=t,F=(E??I??A)!==void 0,{columns:L,selection:H}=t,$=H.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),x(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,xe=v.useCallback(Pe=>{var me;if(Pe.button===0){const[Ie,Le]=Pe.location;if(Pe.kind==="out-of-bounds"&&Pe.isEdge&&F){const nt=(me=_==null?void 0:_.current)==null?void 0:me.getBounds(L.length-1,-1);nt!==void 0&&(n(nt.x),i(L.length-1))}else if(Pe.kind==="header"&&Ie>=ee){const nt=O==null?void 0:O.current;if(Pe.isEdge&&F&&nt){n(Pe.bounds.x),i(Ie);const ft=nt.getBoundingClientRect().width/nt.offsetWidth,ut=Pe.bounds.width/ft;A==null||A(L[Ie],ut,Ie,ut+(L[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,F,ee,D,_,L,ce,A,O]),Ge=v.useCallback((Pe,me)=>{u||g||b==null||b(Pe,me)},[u,g,b]),$e=v.useRef(-1),at=v.useCallback(()=>{$e.current=-1,p(void 0),x(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=L[Le],_e=bu(nt,$e.current,N,P);E==null||E(nt,_e,Le,_e+(nt.growOffset??0))}const Ie=bu(L[r],$e.current,N,P);if(I==null||I(L[r],Ie,r,Ie+(L[r].growOffset??0)),$.hasIndex(r))for(const Le of $){if(Le===r)continue;const nt=L[Le],_e=bu(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))}W==null||W(Pe,me)},[W,r,s,l,h,m,$,I,L,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=L[r],ft=bu(_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=L[ut],he=bu(vt,$e.current,N,P);E==null||E(vt,he,ut,he+(vt.growOffset??0))}}},[s,f,h,w,r,e,L,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(dW,{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:xe,allowResize:F,onMouseUp:_t,dragAndDropState:Qe,onMouseMoveRaw:it,ref:_})};function pW(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 gW=(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])},mW=()=>t=>t.isSafari?"scroll":"auto",yW=Wr("div")({name:"ScrollRegionStyle",class:"gdg-s1dgczr6",propsAsIs:!1,vars:{"s1dgczr6-0":[mW()]}});function vW(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 wW=t=>{var L,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,x=[],g=(d==null?void 0:d.sticky)??!1,y=(d==null?void 0:d.fill)??!1,w=v.useRef(0),k=v.useRef(0),b=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=vW(200),[I,_]=v.useState(!0),P=v.useRef(0);v.useLayoutEffect(()=>{if(!I||A||T.current.lockDirection===void 0)return;const $=b.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=b.current;if(ce===null)return;ue=ue??ce.scrollTop,$=$??ce.scrollLeft;const xe=T.current.scrollTop,Ge=T.current.scrollLeft,$e=$-Ge,at=ue-xe;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]);gW(h&&wh.value,N,b);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($=>{b.current=$,p!==void 0&&(p.current=$)},[p]);let W=0,Y=0;for(x.push(v.createElement("div",{key:W++,style:{width:i,height:0}}));YD.current(),0),ee.current={width:O,height:F}),(O??0)===0||(F??0)===0?v.createElement("div",{ref:R}):v.createElement("div",{ref:R},v.createElement(yW,{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"},x),f!==void 0&&v.createElement(v.Fragment,null,!y&&v.createElement("div",{className:"dvn-spacer"}),v.createElement("div",{ref:E,style:{height:F,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))))))},xW=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:x,overscrollX:g,overscrollY:y,initialSize:w,smoothScrollX:k=!1,smoothScrollY:b=!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,F=R.x<0?-R.x:0,L=0,H=0;R.x=R.x<0?0:R.x;let $=0;for(let Qe=0;Qe=it+Qe.width)O+=Qe.width,H++,L++;else if(R.x>it)O+=Qe.width,k?F+=it-R.x:H++,L++;else if(R.x+R.width>it)O+=Qe.width,L++;else break}let ue=0,ce=0,xe=0;if(typeof r=="number")b?(ce=Math.floor(R.y/r),ue=ce*r-R.y):ce=Math.ceil(R.y/r),xe=Math.ceil(R.height/r)+ce,ue<0&&xe++;else{let Qe=0;for(let it=0;it=Qe+Je)Qe+=Je,ce++,xe++;else if(R.y>Wt)Qe+=Je,b?ue+=Wt-R.y:ce++,xe++;else if(R.y+R.height>Je/2+Qe)Qe+=Je,xe++;else break}}const Ge={x:H,y:ce,width:L-H,height:xe-ce},$e=_.current;($e===void 0||$e.y!==Ge.y||$e.x!==Ge.x||$e.height!==Ge.height||$e.width!==Ge.width||P.current!==F||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:H,y:ce,width:L-H,height:xe-ce},R.width,R.height,R.paddingRight??0,F,ue),_.current=Ge,P.current=F,N.current=ue,D.current=[R.width,R.height])},[e,r,n,d,l,k,b]),Y=v.useCallback(R=>{ie.current=R,W()},[W]);return v.useEffect(()=>{W()},[W]),v.createElement(wW,{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:x,update:Y,initialSize:w},v.createElement(hW,{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}))},bW=Wr("div")({name:"SearchWrapper",class:"gdg-seveqep",propsAsIs:!1}),kW=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"})),SW=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"})),CW=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"})),TW=10,EW=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(""),x=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 b=v.useRef();b.current===void 0&&(b.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,b.current.abort())},[]),_=v.useRef(n);_.current=n;const P=v.useCallback(O=>{const F=new RegExp(O.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i");let L=_.current,H=Math.min(10,r),$=0;w(void 0),E([]);const ue=[],ce=async()=>{var Pe;if(u===void 0)return;const xe=performance.now(),Ge=r-$;let $e=u({x:0,y:L,width:i.length,height:Math.min(H,Ge,r-L)},b.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&&F.test(_e)&&(ue.push([Le,me+L]),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),L+H>=r?L=0:L+=H;const it=_t-xe,Je=Math.max(it,1),Wt=TW/Je;H=Math.ceil(H*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 L;if((L=O==null?void 0:O.stopPropagation)==null||L.call(O),y===void 0)return;const F=(y.selectedIndex+1)%y.results;w({...y,selectedIndex:F}),c==null||c(A,F)},[y,c,A]),ne=v.useCallback(O=>{var L;if((L=O==null?void 0:O.stopPropagation)==null||L.call(O),y===void 0)return;let F=(y.selectedIndex-1)%y.results;F<0&&(F+=y.results),w({...y,selectedIndex:F}),c==null||c(A,F)},[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[W,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&&!W)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 F=$=>{$.stopPropagation()},H={width:`${Math.floor(((y==null?void 0:y.rowsSearched)??0)/r*100)}%`};return v.createElement(bW,{className:f?"":"out",onMouseDown:F,onMouseMove:F,onMouseUp:F,onClick:F},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:x,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},kW),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},SW),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},CW)),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:H})):v.createElement("div",{className:"gdg-search-status"},v.createElement("label",{htmlFor:h},"Type to search")))},[f,W,y,r,h,s,D,x,ie,ne,ee,d,N]);return v.createElement(v.Fragment,null,v.createElement(xW,{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 AW extends v.PureComponent{constructor(){super(...arguments);xt(this,"wrapperRef",v.createRef());xt(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 MW=()=>t=>Math.max(16,t.targetHeight-10),RW=Wr("input")({name:"RenameInput",class:"gdg-r17m35ur",propsAsIs:!1,vars:{"r17m35ur-0":[MW(),"px"]}}),OW=t=>{const{bounds:e,group:n,onClose:r,canvasBounds:i,onFinish:s}=t,[o,l]=In.useState(n);return In.createElement(AW,{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},In.createElement(RW,{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 PW(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(!PW(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":xh.value?s=!0:n=!0;break}return e.altKey===i&&e.ctrlKey===n&&e.shiftKey===r&&e.metaKey===s}function IW(t,e,n,r,i,s){const o=In.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 x={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")&&x.current!==void 0&&t.current!==void 0&&(x={...x,current:{...x.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),e(x,c)},[r,t,n,s,i,e]),l=In.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=In.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 DW(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 _W(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 NW(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"}:_W(o))})}function Sb(t,e){return(e?/[\t\n",]/:/[\t\n"]/).test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}function LW(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=>Sb(o,!0)).join(",")):i.push(Sb(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 Cb(t){return'"'+t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")+'"'}function FW(t){return t.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function BW(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 zW(t,e){const n=NW(t,e),r=LW(n),i=BW(n);return{textPlain:r,textHtml:i}}function Tb(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(x=>x.getAttribute("gdg-raw-value")??""),formatted:[...m].map(x=>x.textContent??""),format:"string-array"})}else if(h!==null)s==null||s.push({rawValue:FW(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 Eb(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1).replace(/""/g,'"')),t}function jW(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,` +`+(h.tokens?this.parseInline(h.tokens):h.text);r+=n?this.renderer.paragraph(d):d;continue}default:{const E='Token with "'+h.type+'" type was not found.';if(this.options.silent){console.error(E);return}else throw new Error(E)}}}return r}parseInline(e,n){n=n||this.renderer;let r="",i,s,o;const l=e.length;for(i=0;i{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={...Ye.defaults,...s};const o=CF(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(bF(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&&Ye.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;Ye.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(Ye.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&&Ye.walkTokens(l,r.walkTokens);let a=e(l,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(l){return o(l)}}}function Ye(t,e,n){return NT(xo.lex,Kc.parse)(t,e,n)}Ye.options=Ye.setOptions=function(t){return Ye.defaults={...Ye.defaults,...t},aF(Ye.defaults),Ye};Ye.getDefaults=RT;Ye.defaults=yl;Ye.use=function(...t){const e=Ye.defaults.extensions||{renderers:{},childTokens:{}};t.forEach(n=>{const r={...n};if(r.async=Ye.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=Ye.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=Ye.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=Ye.defaults.hooks||new ph;for(const s in n.hooks){const o=i[s];ph.passThroughHooks.has(s)?i[s]=l=>{if(Ye.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=Ye.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}}Ye.setOptions(r)})};Ye.walkTokens=function(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(Ye,r)),r.type){case"table":{for(const i of r.header)n=n.concat(Ye.walkTokens(i.tokens,e));for(const i of r.rows)for(const s of i)n=n.concat(Ye.walkTokens(s.tokens,e));break}case"list":{n=n.concat(Ye.walkTokens(r.items,e));break}default:Ye.defaults.extensions&&Ye.defaults.extensions.childTokens&&Ye.defaults.extensions.childTokens[r.type]?Ye.defaults.extensions.childTokens[r.type].forEach(function(i){n=n.concat(Ye.walkTokens(r[i],e))}):r.tokens&&(n=n.concat(Ye.walkTokens(r.tokens,e)))}return n};Ye.parseInline=NT(xo.lexInline,Kc.parseInline);Ye.Parser=Kc;Ye.parser=Kc.parse;Ye.Renderer=Vv;Ye.TextRenderer=DT;Ye.Lexer=xo;Ye.lexer=xo.lex;Ye.Tokenizer=Wv;Ye.Slugger=_T;Ye.Hooks=ph;Ye.parse=Ye;Ye.options;Ye.setOptions;Ye.use;Ye.walkTokens;Ye.parseInline;Kc.parse;xo.lex;const TF=Wr("div")({name:"MarkdownContainer",class:"gdg-mnuv029",propsAsIs:!1});class EF extends In.PureComponent{constructor(){super(...arguments);xt(this,"targetElement",null);xt(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=Ye(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(),In.createElement(TF,{ref:this.containerRefHook})}}const AF=Wr("textarea")({name:"InputBox",class:"gdg-izpuzkl",propsAsIs:!1}),MF=Wr("div")({name:"ShadowBox",class:"gdg-s69h75o",propsAsIs:!1}),RF=Wr("div")({name:"GrowingEntryStyle",class:"gdg-g1y0xocz",propsAsIs:!1});let zx=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-"+(zx=(zx+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(RF,{className:"gdg-growing-entry"},v.createElement(MF,{className:u},f+` +`),v.createElement(AF,{...l,className:(u??"")+" gdg-input",id:d,ref:c,onKeyDown:h,value:f,placeholder:e,dir:"auto"}))},Lg={};let Vs=null;function OF(){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||OF(),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 $x=new Map;function jx(t,e){const n=`${t}-${e}`,r=$x.get(n);if(r!==void 0)return r;const i=Nr(t,e);return $x.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 PF(){Hl.clear(),E0.clear(),ra.clear()}function IF(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,x=h+m;n.set(f,x)}}function DF(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 qu(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=DF(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 IF(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 _F(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=qu(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 NF(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=qu(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 x=_F(t,h,r,n,p,m,d),g=h.slice(0,Math.max(0,x));h=h.slice(g.length),a.push(g),p=qu(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 LF(t,e){return In.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 zF(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)&&Hx(t,e,s)&&i++;for(const o of n.current.rangeStack)Hx(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 WF(){var t;HF||((t=document==null?void 0:document.fonts)==null?void 0:t.ready)===void 0||(await document.fonts.ready,Pd=0,Qu={},PF())}WF();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 VF(t,e){const n=zT(t,void 0,"middle",e);return Qu[n]}function Is(t,e){return typeof e!="string"&&(e=e.baseFontFull),UF(t,e)}function Wx(t,e){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";t.save(),t.textBaseline=e;const r=t.measureText(n);return t.restore(),r}const Vx=[];function UF(t,e){for(const s of Vx)if(s.key===e)return s.val;const n=Wx(t,"alphabetic"),i=-(Wx(t,"middle").actualBoundingBoxDescent-n.actualBoundingBoxDescent)+n.actualBoundingBoxAscent/2;return Vx.push({key:e,val:i}),i}function KF(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 GF(t,e,n,r,i,s,o,l,a,u){const c=l.baseFontFull,f=NF(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 x=r+s/2-p/2;let g=Math.max(r+l.cellVerticalPadding,x);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=XF(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?GF(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 qF(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 YF(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,x=!1;h<0?p<0?p=Math.PI+p:(p=Math.PI-p,m=-1,x=!0):p>0&&(m=-1,x=!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,b=a.y+f.ny*y;k+=-f.ny*w*m,b+=f.nx*w*m,t.arc(k,b,w,c.ang+Math.PI/2*m,f.ang-Math.PI/2*m,x),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 x=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 b=h[g-1];m.x-=b.width,m.width+=b.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 Si(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(){xt(this,"visibleWindow",{x:0,y:0,width:0,height:0});xt(this,"freezeCols",0);xt(this,"freezeRows",[]);xt(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 QF extends WT{constructor(){super(...arguments);xt(this,"cache",new Map);xt(this,"setValue",(n,r)=>{this.cache.set(Si(n[0],n[1]),r)});xt(this,"getValue",n=>this.cache.get(Si(n[0],n[1])));xt(this,"clearOutOfWindow",()=>{for(const[n]of this.cache.entries())this.isInWindow(n)||this.cache.delete(n)})}}class Ju{constructor(e=[]){xt(this,"cells");this.cells=new Set(e.map(n=>Si(n[0],n[1])))}add(e){this.cells.add(Si(e[0],e[1]))}has(e){return e===void 0?!1:this.cells.has(Si(e[0],e[1]))}remove(e){this.cells.delete(Si(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=eB(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 tB(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(),[x,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 b={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(b,a.signal),A=k>0?y(S,a.signal):void 0;let I;typeof E=="object"?I=E:I=await wx(E),A!==void 0&&(typeof A=="object"?I=[...I,...A]:I=[...I,...await wx(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(x===void 0||m.current!==t||T.id===void 0)return{...T,width:R0};const A=KT(h,o,T,E,x,i,s,!0,l);return p.current[T.id]=A.width,A})),k=0,b=0;const S=[];for(const[T,E]of w.entries())k+=E.width,E.grow!==void 0&&E.grow>0&&(b+=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=rB(a),a in Ux)return;Ux[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":nB,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 iB(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}var sB=iB,oB=sB,Fg=$v;function lB(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),oB(Fg(t),e,n)}var aB=lB;const ki=Ii(aB);var uB="__lodash_hash_undefined__";function cB(t){return this.__data__.set(t,uB),this}var fB=cB;function dB(t){return this.__data__.has(t)}var hB=dB,pB=Pv,gB=fB,mB=hB;function gh(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new pB;++e-1}var OB=RB;function PB(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=QB){var u=e?null:qB(t);if(u)return YB(u);o=!1,i=GB,a=new UB}else a=e?[]:l;e:for(;++r0&&n(l)?e>1?JT(l,e-1,n,r,i):uz(i,l):r||(i[i.length]=l)}return i}var fz=JT,dz=fz;function hz(t){var e=t==null?0:t.length;return e?dz(t,1):[]}var pz=hz;const Gx=Ii(pz);var gz=Math.ceil,mz=Math.max;function yz(t,e,n,r){for(var i=-1,s=mz(gz((e-t)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=t,t+=n;return o}var vz=yz,wz=uT,xz=Nv;function bz(t){return t!=null&&xz(t.length)&&!wz(t)}var qv=bz,kz=Rv,Sz=qv,Cz=_v,Tz=gl;function Ez(t,e,n){if(!Tz(n))return!1;var r=typeof e;return(r=="number"?Sz(n)&&Cz(e,n.length):r=="string"&&e in n)?kz(n[e],t):!1}var Az=Ez,Mz=$v,qx=1/0,Rz=17976931348623157e292;function Oz(t){if(!t)return t===0?t:0;if(t=Mz(t),t===qx||t===-qx){var e=t<0?-1:1;return e*Rz}return t===t?t:0}var Pz=Oz,Iz=vz,Dz=Az,zg=Pz;function _z(t){return function(e,n,r){return r&&typeof r!="number"&&Dz(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(x,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 x=s.sourceIndex-1;x>=h;x--)p-=o[x].width,m+=o[x].width;for(let x=s.sourceIndex+1;x<=a;x++)m+=o[x].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 x=s.sourceIndex-1;x>=l;x--)p-=o[x].width,m+=o[x].width;for(let x=s.sourceIndex+1;x<=h;x++)m+=o[x].width;u={x:p,y:n,width:m,height:i}}return[u,c]}function jz(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 Hz(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 Wz(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 Vz(t,e,n,r,i){const[s,o,l,a]=e,[u,c,f,d]=i,{x:h,y:p,width:m,height:x}=t,g=[];if(m<=0||x<=0)return g;const y=h+m,w=p+x,k=hl,T=p+x>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&&b){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(b&&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(b&&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 Uz={kind:Se.Loading,allowOverlay:!1};function Yx(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,g,y,w,k,b,S,T,E,A,I,_,P,N,D,ee,ne,ie,W){let q=(w==null?void 0:w.size)??Number.MAX_SAFE_INTEGER;const R=performance.now();let O=N.baseFontFull;t.font=O;const F={ctx:t},L=[0,0],H=x>0?vl(a,x,u):0;let $,ue;const ce=ZT(y);return Mo(e,l,s,o,i,(xe,Ge,$e,at,_t)=>{const Qe=Math.max(0,at-Ge),it=Ge+Qe,Je=i+1,Wt=xe.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(xe.sourceIndex),Le=f(xe.group??"").overrideTheme,nt=xe.themeOverride===void 0&&Le===void 0?N:yo(N,Le,xe.themeOverride),_e=nt.baseFontFull;_e!==O&&(O=_e,t.font=_e),me();let ft;return yp(_t,$e,r,a,u,x,g,ce,(ut,vt,he,rt,st)=>{var Lt,Mt,Un;if(vt<0||(L[0]=xe.sourceIndex,L[1]=vt,w!==void 0&&!w.has(L)))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;ltW&&!Ze){const lt=J.baseFontFull;lt!==O&&(t.font=lt,O=lt),ft=rE(t,wt,xe.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),q--,fe&&(t.restore(),(Un=ft==null?void 0:ft.deprep)==null||Un.call(ft,F),ft=void 0,me(),O=_e,t.font=_e),q<=0}),t.restore(),q<=0}),$}const wu=[0,0],xu={x:0,y:0,width:0,height:0},$g=[void 0,()=>{}];let O0=!1;function Kz(){O0=!0}function rE(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,g,y,w,k,b,S,T,E){var ee,ne;let A,I;x!==void 0&&x[0][0]===n&&x[0][1]===r&&(A=x[1][0],I=x[1][1]);let _;wu[0]=n,wu[1]=r,xu.x=o,xu.y=l,xu.width=a,xu.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:xu,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:Kz},N=KF(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)&&(b==null||b(wu)),_}function Yv(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),x=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"&&(x*=.8,m*=.8),t.fillStyle=l?e.accentColor:e.textMedium,t.fill(),t.beginPath(),t.moveTo(g-x+m/4.23,h-x+m/1.97),t.lineTo(g-x+m/2.42,h-x+m/1.44),t.lineTo(g-x+m/1.29,h-x+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"&&(x*=.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 Xz(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,g,y){const w=o+l;if(w<=0)return;t.fillStyle=f.bgHeader,t.fillRect(0,0,i,w);const[k,b]=(r==null?void 0:r[0])??[],S=f.headerFontFull;t.font=S,Mo(e,0,s,0,w,(T,E,A,I)=>{var F;if(x!==void 0&&!x.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&&b===-1&&k===T.sourceIndex,ie=ee?0:((F=h.find(L=>L.item[0]===T.sourceIndex&&L.item[1]===-1))==null?void 0:F.hoverAmount)??0,W=(c==null?void 0:c.current)!==void 0&&c.current.cell[0]===T.sourceIndex,q=D?N.accentColor:W?N.bgHeaderHasFocus:N.bgHeader,R=n?l:0,O=T.sourceIndex===0?0:1;D?(t.fillStyle=q,t.fillRect(E+O,R,T.width-O,o)):(W||ie>0)&&(t.beginPath(),t.rect(E+O,R,T.width-O,o),W&&(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,W,ie,d,g,y),t.restore()}),n&&Gz(t,e,i,s,l,r,f,d,h,p,m,x)}function Gz(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,(x,g,y,w,k,b)=>{if(f!==void 0&&!f.hasItemInRectangle({x:x[0],y:-2,width:x[1]-x[0]+1,height:1}))return;t.save(),t.beginPath(),t.rect(y,w,k,b),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>=x[0]&&h<=x[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:b},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 W=0;W35){const k=d?35:r-35,b=d?35*.7:r-35*.7,S=k/r,T=b/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"),x&&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;YF(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;qF(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},()=>Qx(t,e,n,r,i,s,o,l,a,c,f,h,p,m)):Qx(t,e,n,r,i,s,o,l,a,c,f,h,p,m)}var qz=ml,Yz=function(){try{var t=qz(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Qz=Yz,Jx=Qz;function Jz(t,e,n){e=="__proto__"&&Jx?Jx(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var Zz=Jz;function e$(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&lj?new rj:void 0;for(s.set(t,e),s.set(e,t);++f{if(k!==e[e.length-1])return;b+=k.width;const A=Math.max(b,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&&x.length>0&&!x.some(W=>mh(b,I,1e4,P,W.x,W.y,W.width,W.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(b,I,1e4,P)),ee&&(t.fillStyle=ie.bgHeader,t.fillRect(b,I,1e4,P)),D&&(t.fillStyle=ie.accentLight,t.fillRect(b,I,1e4,P))}),t.restore())})}function J8(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=jx(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:jx(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 Z8(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p){var P;const m=p.bgCell,{minX:x,maxX:g,minY:y,maxY:w}=yE(l,s,o),k=[],b=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,y:N,w:g-x,h:D,color:ne})}S+=D,T0)for(let N=0;N=x&&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 vb(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,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=x.horizontalBorderColor??x.borderColor,w=x.borderColor,{minX:k,maxX:b,minY:S,maxY:T}=yE(l,s,o),E=[];t.beginPath();let A=.5;for(let P=0;P=k&&D<=b&&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:b,y2:ee,color:(ne==null?void 0:ne.horizontalBorderColor)??(ne==null?void 0:ne.borderColor)??y})}P+=f(N),N++}}const _=Y8(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 eW(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,m,x,g,y){const w=[];t.imageSmoothingEnabled=!1;const k=Math.min(i.cellYOffset,o),b=Math.max(i.cellYOffset,o);let S=0;if(typeof g=="number")S+=(b-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(x);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 tW(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 nW(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(x===void 0||x.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],b=x.map(T=>{const E=T.range,A=T.style??"dashed";return Vz(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:Wz({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 b)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,_=!Hz(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 xb(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,x){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]>=x&&w[1]>=x||!o.some(D=>D.sourceIndex===y[0]||D.sourceIndex===w[0]))return;const[b,S]=c.current.cell,T=d(c.current.cell),E=T.span??[b,b],A=S>=x-h,I=h>0&&!A?vl(x,h,f)-1:0,_=w[1];let P;if(Mo(o,r,i,s,u,(D,ee,ne,ie,W)=>{if(D.sticky&&b>D.sourceIndex)return;const q=D.sourceIndexE[1],O=D.sourceIndex===w[0];if(!(!O&&(q||R)))return yp(W,ne,n,x,f,h,p,void 0,(F,L,H)=>{if(L!==S&&L!==_)return;let $=ee,ue=D.width;if(T.span!==void 0){const xe=tE(T.span,ee,F,D.width,H,D,l),Ge=D.sticky?xe[0]:xe[1];Ge!==void 0&&($=Ge.x,ue=Ge.width)}return L===_&&O&&m&&(P=()=>{var xe;ie>$&&!D.sticky&&(t.beginPath(),t.rect(ie,0,e-ie,n),t.clip()),t.beginPath(),t.rect($+ue-4,F+H-4,4,4),t.fillStyle=((xe=D.themeOverride)==null?void 0:xe.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 rW(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 iW(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,(x,g,y,w)=>{w||(c=Math.max(g,c))}),!0)),c}function bb(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:x,groupHeaderHeight:g,disabledRows:y,rowHeight:w,verticalBorder:k,overrideCursor:b,isResizing:S,selection:T,fillHandle:E,freezeTrailingRows:A,rows:I,getCellContent:_,getGroupDetails:P,getRowThemeOverride:N,isFocused:D,drawHeaderCallback:ee,prelightCells:ne,drawCellCallback:ie,highlightRegions:W,resizeCol:q,imageLoader:R,lastBlitData:O,hoverValues:F,hyperWrapping:L,hoverInfo:H,spriteManager:$,maxScaleFactor:ue,hasAppendRow:ce,touchMode:xe,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"&&nW(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+x:x,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(W!==void 0){for(const De of W)if(De.style!=="no-outline"&&De.range.y===l&&u===0){V=!0;break}}const pe=()=>{Xz(st,dt,f,H,i,a,x,g,h,S,T,p,$,F,k,P,Je,ee,xe),vb(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&&wb(st,i,s,o,l,a,u,c,d,x,g,w,A,I,W,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=>{Yx(Lt,dt,c,s,_e,a,u,l,I,ct,_,P,N,y,D,m,A,ce,fe,Je,T,ne,W,R,$,F,H,ie,L,p,Ge,$e,at,b,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()&&(rW(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}=eW(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=tW(he,o,l,a,u,i,s,_e,dt,Ie));J8(Ve,dt,i,s,A,I,k,ct,p);const J=wb(Ve,i,s,o,l,a,u,c,d,x,g,w,A,I,W,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=Yx(Ve,dt,c,s,_e,a,u,l,I,ct,_,P,N,y,D,m,A,ce,fe,Je,T,ne,W,R,$,F,H,ie,L,p,Ge,$e,at,b,Wt);Q8(Ve,dt,c,i,s,_e,a,u,l,I,ct,N,T.rows,y,A,ce,fe,Je,p),Z8(Ve,dt,l,a,u,i,s,fe,_e,ct,N,k,A,I,p),vb(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===q?(xb(st,Et+De.width,0,_e+1,Nr(p.resizeIndicatorColor??p.accentLight,p.bgHeader)),xb(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=iW(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 sW=80;function oW(t){const e=t-1;return e*e*e+1}class lW{constructor(e){xt(this,"callback");xt(this,"currentHoveredItem");xt(this,"leavingItems",[]);xt(this,"lastAnimationTime");xt(this,"addToLeavingItems",e=>{this.leavingItems.some(r=>Yu(r.item,e.item))||this.leavingItems.push(e)});xt(this,"removeFromLeavingItems",e=>{const n=this.leavingItems.find(r=>Yu(r.item,e));return this.leavingItems=this.leavingItems.filter(r=>r!==n),(n==null?void 0:n.hoverAmount)??0});xt(this,"cleanUpLeavingElements",()=>{this.leavingItems=this.leavingItems.filter(e=>e.hoverAmount>0)});xt(this,"shouldStep",()=>{const e=this.leavingItems.length>0,n=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return e||n});xt(this,"getAnimatingItems",()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(e=>({...e,hoverAmount:oW(e.hoverAmount)})));xt(this,"step",e=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=e;else{const r=(e-this.lastAnimationTime)/sW;for(const s of this.leavingItems)s.hoverAmount=ki(s.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=ki(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});xt(this,"setHovered",e=>{var n;if(!Yu((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 aW{constructor(e){xt(this,"fn");xt(this,"val");this.fn=e}get value(){return this.val??(this.val=this.fn())}}function Jv(t){return new aW(t)}const uW=Jv(()=>window.navigator.userAgent.includes("Firefox")),wh=Jv(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),xh=Jv(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function cW(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=Si(s[0],s[1]);e.current.includes(o)||e.current.push(o)},[i])}const Xs="header",Dr="group-header",bh="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 kb=6,fW=(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))??""},dW=(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:x,isFilling:g,onCanvasFocused:y,onCanvasBlur:w,isFocused:k,selection:b,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:W,onKeyDown:q,onKeyUp:R,highlightRegions:O,canvasRef:F,onDragStart:L,onDragEnd:H,eventTargetRef:$,isResizing:ue,resizeColumn:ce,isDragging:xe,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 $z(Wt,()=>{Ni.current=void 0,Po.current()}),[Wt]),Un=x?c+a:a,lt=v.useRef(-1),Ut=((rt==null?void 0:rt.enableFirefoxRescaling)??!1)&&uW.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=LF(s,S),Fn=A?Ma(Kt,ie):0,Zt=v.useCallback((j,re,be)=>{const ge=j.getBoundingClientRect();if(re>=Kt.length||be>=d)return;const oe=ge.width/n,Ae=M0(re,be,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]),Rn=v.useCallback((j,re,be,ge)=>{const oe=j.getBoundingClientRect(),Ae=oe.width/n,et=(re-oe.left)/Ae,tt=(be-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=$F(et,Dt,Ve),kt=jF(tt,r,x,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,Ur=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 di=!1;if(ot===-1&&kt===-1){const Do=Zt(j,Kt.length-1,-1);_r(Do!==void 0),di=ren&&etr&&tt=0?(wn=!0,Rt=Zt(j,Mr,kt),_r(Rt!==void 0),Ar={kind:x&&kt===-2?Dr:Xs,location:[Mr,kt],bounds:Rt,group:Kt[Mr].group??"",isEdge:wn,shiftKey:vn,ctrlKey:pt,metaKey:hn,isTouch:Ur,localEventX:re-Rt.x,localEventY:be-Rt.y,button:Fe,buttons:Bt,scrollEdge:an}):Ar={kind:x&&kt===-2?Dr:Xs,group:Kt[ot].group??"",location:[ot,kt],bounds:Rt,isEdge:wn,shiftKey:vn,ctrlKey:pt,metaKey:hn,isTouch:Ur,localEventX:re-Rt.x,localEventY:be-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 QF,[]),tf=Ut&&Ze?1:Ft&&Ze?2:5,nf=(rt==null?void 0:rt.disableMinimumCellWidth)===!0?1:10,Ni=v.useRef(),xl=v.useRef(null),bl=v.useRef(null),kl=v.useCallback(()=>{var et;const j=ct.current,re=Ue.current;if(j===null||re===null||(xl.current===null&&(xl.current=j.getContext("2d",{alpha:!1}),j.width=0,j.height=0),bl.current===null&&(bl.current=re.getContext("2d",{alpha:!1}),re.width=0,re.height=0),xl.current===null||bl.current===null||us===null||cs===null))return;let be=!1;const ge=tt=>{be=!0,De(tt)},oe=Ni.current,Ae={headerCanvasCtx:bl.current,canvasCtx:xl.current,bufferACtx:us,bufferBCtx:cs,width:n,height:r,cellXOffset:wt,cellYOffset:l,translateX:Math.round(Ve),translateY:Math.round(sn),mappedColumns:Kt,enableGroups:x,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:b,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,bb(Ae,oe)):bb(Ae,void 0),!be&&(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,x,S,ie,it,a,c,at,f,Pe,ue,_t,ce,k,b,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=cW(_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]),Ya=v.useRef("default"),Ns=$==null?void 0:$.current;Ns!=null&&Ya.current!==Tl.cursor&&(Ns.style.cursor=Ya.current=Tl.cursor);const Tr=v.useCallback((j,re,be,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,be+re.x,ge+tt.y))return oe.actions[et]}},[Qe]),ui=v.useCallback((j,re,be,ge)=>{const oe=s[re];if(!xe&&!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(be>et.x&&beet.y&&ge{const re=ct.current,be=$==null?void 0:$.current;if(re===null||j.target!==re&&j.target!==be)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===be&&be!==null){const et=be.getBoundingClientRect();if(ge>et.right||oe>et.bottom)return}const Ae=Rn(re,ge,oe,j);Ls.current=Ae.location,Ae.isTouch&&(Qa.current=Date.now()),Lt.current!==Ae.isTouch&&Vt(Ae.isTouch),!(Ae.kind===Xs&&ui(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,Rn,Tr,ui,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 be=ct.current;if(Ja.current=!1,N===void 0||be===null)return;const ge=$==null?void 0:$.current,oe=j.target!==be&&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=Rn(be,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=ui(be,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,$,Rn,ui,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 be=$==null?void 0:$.current,ge=j.target!==re&&j.target!==be;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=Rn(re,oe,Ae,j);Lt.current!==tt.isTouch&&Vt(tt.isTouch),!ge&&j.cancelable&&et&&j.preventDefault();const[Te]=tt.location,Dt=ui(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)}},[$,Rn,ui,m,Tr]);$n("click",af,window,!1);const Fp=v.useCallback(j=>{const re=ct.current,be=$==null?void 0:$.current;if(re===null||j.target!==re&&j.target!==be||T===void 0)return;const ge=Rn(re,j.clientX,j.clientY,j);T(ge,()=>{j.cancelable&&j.preventDefault()})},[$,Rn,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},[]),ci=v.useMemo(()=>new lW(uf),[uf]),ds=v.useRef(ci);ds.current=ci,v.useLayoutEffect(()=>{const j=ds.current;if(on===void 0||on[1]<0){j.setHovered(on);return}const re=h(on,!0),be=st(re),ge=be===void 0&&re.kind===Se.Custom||(be==null?void 0:be.needsHover)!==void 0&&(typeof be.needsHover=="boolean"?be.needsHover:be.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 be=$==null?void 0:$.current,ge=j.target!==re&&j.target!==be,oe=Rn(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===bh?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]>=(W?0:1);Ne(oe.kind===Xs&&oe.isEdge&&et&&$e===!0),_p(oe.kind==="cell"&&oe.isFillHandle),D==null||D(j),ee(oe)},[$,Rn,W,$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 be,ge;b.current!==void 0&&(be=Zt(re,b.current.cell[0],b.current.cell[1]),ge=b.current.cell),q==null||q({bounds:be,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})},[q,b,Zt]),Io=v.useCallback(j=>{const re=ct.current;if(re===null)return;let be,ge;b.current!==void 0&&(be=Zt(re,b.current.cell[0],b.current.cell[1]),ge=b.current.cell),R==null||R({bounds:be,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,b,Zt]),Bp=v.useCallback(j=>{ct.current=j,F!==void 0&&(F.current=j)},[F]),cf=v.useCallback(j=>{const re=ct.current;if(re===null||Ge===!1||ue){j.preventDefault();return}let be,ge;const oe=Rn(re,j.clientX,j.clientY);if(Ge!==!0&&oe.kind!==Ge){j.preventDefault();return}const Ae=(Bt,ot)=>{be=Bt,ge=ot};let et,tt,Te;const Dt=(Bt,ot,kt)=>{et=Bt,tt=ot,Te=kt};let Fe=!1;if(L==null||L({...oe,setData:Ae,setDragImage:Dt,preventDefault:()=>Fe=!0,defaultPrevented:()=>Fe}),!Fe&&be!==void 0&&ge!==void 0&&j.dataTransfer!==null)if(j.dataTransfer.setData(be,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,Rn,L,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 be=Rn(re,j.clientX,j.clientY),[ge,oe]=be.location,Ae=ge-(W?0:1),[et,tt]=eu.current??[];(et!==Ae||tt!==oe)&&(eu.current=[Ae,oe],nt([Ae,oe],j.dataTransfer))},[W,Rn,nt,_e]);$n("dragover",zp,($==null?void 0:$.current)??null,!1,!1);const Ew=v.useCallback(()=>{eu.current=void 0,H==null||H()},[H]);$n("dragend",Ew,($==null?void 0:$.current)??null,!1,!1);const Y=v.useCallback(j=>{const re=ct.current;if(re===null||_e===void 0)return;j.preventDefault();const be=Rn(re,j.clientX,j.clientY),[ge,oe]=be.location,Ae=ge-(W?0:1);_e([Ae,oe],j.dataTransfer)},[W,Rn,_e]);$n("drop",Y,($==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(b);En.current=b;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=F==null?void 0:F.current)==null||re.focus({preventScroll:!0}):j!==null&&j.focus({preventScroll:!0}),Al.current=j)},[F]);v.useImperativeHandle(e,()=>({focus:()=>{var re;const j=Al.current;j===null||!document.contains(j)?(re=F==null?void 0:F.current)==null||re.focus({preventScroll:!0}):j.focus({preventScroll:!0})},getBounds:(j,re)=>{if(!(F===void 0||F.current===null))return Zt(F.current,j??0,re??-1)},damage:sf}),[F,sf,Zt]);const Fs=v.useRef(),pr=tF(()=>{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=W?0:-1;!W&&((tt=j[0])==null?void 0:tt.sourceIndex)===0&&(j=j.slice(1));const[be,ge]=((Te=b.current)==null?void 0:Te.cell)??[],oe=(Dt=b.current)==null?void 0:Dt.range,Ae=j.map(Fe=>Fe.sourceIndex),et=Uo(l,Math.min(d,l+i));return be!==void 0&&ge!==void 0&&!(Ae.includes(be)&&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":b.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":b.rows.hasIndex(Fe),key:Fe,"aria-rowindex":Fe+2},j.map(Bt=>{const ot=Bt.sourceIndex,kt=Si(ot,Fe),vn=be===ot&&ge===Fe,pt=oe!==void 0&&ot>=oe.x&&ot=oe.y&&Fe{const Ar=F==null?void 0:F.current;if(Ar!=null)return q==null?void 0:q({bounds:Zt(Ar,ot,Fe),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:Ur})},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=Ur,Le==null?void 0:Le(Ur)},ref:vn?tu:void 0,tabIndex:-1},fW(an,st))})))))},[n,Kt,wt,ie,Ve,d,l,i,b,tu,h,F,q,Zt,Le],200),fi=S===0||!A?0:wt>S?1:ki(-Ve/100,0,1),$p=-l*32+sn,Ml=I?ki(-$p/100,0,1):0,jp=v.useMemo(()=>{if(!fi&&!Ml)return null;const j={position:"absolute",top:0,left:Fn,width:n-Fn,height:r,opacity:fi,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,fi>0&&v.createElement("div",{id:"shadow-x",style:j}),Ml>0&&v.createElement("div",{id:"shadow-y",style:re}))},[fi,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)},hW=v.memo(v.forwardRef(dW));function bu(t,e,n,r){return ki(Math.round(e-(t.growOffset??0)),Math.ceil(n),Math.floor(r))}const pW=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,x]=v.useState(),[g,y]=v.useState(!1),[w,k]=v.useState(),{onHeaderMenuClick:b,getCellContent:S,onColumnMoved:T,onColumnResize:E,onColumnResizeStart:A,onColumnResizeEnd:I,gridRef:_,maxColumnWidth:P,minColumnWidth:N,onRowMoved:D,lockColumns:ee,onColumnProposeMove:ne,onMouseDown:ie,onMouseUp:W,onItemHovered:q,onDragStart:R,canvasRef:O}=t,F=(E??I??A)!==void 0,{columns:L,selection:H}=t,$=H.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),x(Math.max(0,Ie))):r===void 0&&!u&&!g&&(q==null||q(Pe))},[s,h,l,q,ee,r,u,g]),ce=T!==void 0,xe=v.useCallback(Pe=>{var me;if(Pe.button===0){const[Ie,Le]=Pe.location;if(Pe.kind==="out-of-bounds"&&Pe.isEdge&&F){const nt=(me=_==null?void 0:_.current)==null?void 0:me.getBounds(L.length-1,-1);nt!==void 0&&(n(nt.x),i(L.length-1))}else if(Pe.kind==="header"&&Ie>=ee){const nt=O==null?void 0:O.current;if(Pe.isEdge&&F&&nt){n(Pe.bounds.x),i(Ie);const ft=nt.getBoundingClientRect().width/nt.offsetWidth,ut=Pe.bounds.width/ft;A==null||A(L[Ie],ut,Ie,ut+(L[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,F,ee,D,_,L,ce,A,O]),Ge=v.useCallback((Pe,me)=>{u||g||b==null||b(Pe,me)},[u,g,b]),$e=v.useRef(-1),at=v.useCallback(()=>{$e.current=-1,p(void 0),x(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=L[Le],_e=bu(nt,$e.current,N,P);E==null||E(nt,_e,Le,_e+(nt.growOffset??0))}const Ie=bu(L[r],$e.current,N,P);if(I==null||I(L[r],Ie,r,Ie+(L[r].growOffset??0)),$.hasIndex(r))for(const Le of $){if(Le===r)continue;const nt=L[Le],_e=bu(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))}W==null||W(Pe,me)},[W,r,s,l,h,m,$,I,L,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=L[r],ft=bu(_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=L[ut],he=bu(vt,$e.current,N,P);E==null||E(vt,he,ut,he+(vt.growOffset??0))}}},[s,f,h,w,r,e,L,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(hW,{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:xe,allowResize:F,onMouseUp:_t,dragAndDropState:Qe,onMouseMoveRaw:it,ref:_})};function gW(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 mW=(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])},yW=()=>t=>t.isSafari?"scroll":"auto",vW=Wr("div")({name:"ScrollRegionStyle",class:"gdg-s1dgczr6",propsAsIs:!1,vars:{"s1dgczr6-0":[yW()]}});function wW(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 xW=t=>{var L,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,x=[],g=(d==null?void 0:d.sticky)??!1,y=(d==null?void 0:d.fill)??!1,w=v.useRef(0),k=v.useRef(0),b=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=wW(200),[I,_]=v.useState(!0),P=v.useRef(0);v.useLayoutEffect(()=>{if(!I||A||T.current.lockDirection===void 0)return;const $=b.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=b.current;if(ce===null)return;ue=ue??ce.scrollTop,$=$??ce.scrollLeft;const xe=T.current.scrollTop,Ge=T.current.scrollLeft,$e=$-Ge,at=ue-xe;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]);mW(h&&wh.value,N,b);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($=>{b.current=$,p!==void 0&&(p.current=$)},[p]);let W=0,q=0;for(x.push(v.createElement("div",{key:W++,style:{width:i,height:0}}));qD.current(),0),ee.current={width:O,height:F}),(O??0)===0||(F??0)===0?v.createElement("div",{ref:R}):v.createElement("div",{ref:R},v.createElement(vW,{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"},x),f!==void 0&&v.createElement(v.Fragment,null,!y&&v.createElement("div",{className:"dvn-spacer"}),v.createElement("div",{ref:E,style:{height:F,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))))))},bW=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:x,overscrollX:g,overscrollY:y,initialSize:w,smoothScrollX:k=!1,smoothScrollY:b=!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,F=R.x<0?-R.x:0,L=0,H=0;R.x=R.x<0?0:R.x;let $=0;for(let Qe=0;Qe=it+Qe.width)O+=Qe.width,H++,L++;else if(R.x>it)O+=Qe.width,k?F+=it-R.x:H++,L++;else if(R.x+R.width>it)O+=Qe.width,L++;else break}let ue=0,ce=0,xe=0;if(typeof r=="number")b?(ce=Math.floor(R.y/r),ue=ce*r-R.y):ce=Math.ceil(R.y/r),xe=Math.ceil(R.height/r)+ce,ue<0&&xe++;else{let Qe=0;for(let it=0;it=Qe+Je)Qe+=Je,ce++,xe++;else if(R.y>Wt)Qe+=Je,b?ue+=Wt-R.y:ce++,xe++;else if(R.y+R.height>Je/2+Qe)Qe+=Je,xe++;else break}}const Ge={x:H,y:ce,width:L-H,height:xe-ce},$e=_.current;($e===void 0||$e.y!==Ge.y||$e.x!==Ge.x||$e.height!==Ge.height||$e.width!==Ge.width||P.current!==F||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:H,y:ce,width:L-H,height:xe-ce},R.width,R.height,R.paddingRight??0,F,ue),_.current=Ge,P.current=F,N.current=ue,D.current=[R.width,R.height])},[e,r,n,d,l,k,b]),q=v.useCallback(R=>{ie.current=R,W()},[W]);return v.useEffect(()=>{W()},[W]),v.createElement(xW,{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:x,update:q,initialSize:w},v.createElement(pW,{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}))},kW=Wr("div")({name:"SearchWrapper",class:"gdg-seveqep",propsAsIs:!1}),SW=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"})),CW=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"})),TW=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"})),EW=10,AW=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(""),x=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 b=v.useRef();b.current===void 0&&(b.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,b.current.abort())},[]),_=v.useRef(n);_.current=n;const P=v.useCallback(O=>{const F=new RegExp(O.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i");let L=_.current,H=Math.min(10,r),$=0;w(void 0),E([]);const ue=[],ce=async()=>{var Pe;if(u===void 0)return;const xe=performance.now(),Ge=r-$;let $e=u({x:0,y:L,width:i.length,height:Math.min(H,Ge,r-L)},b.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&&F.test(_e)&&(ue.push([Le,me+L]),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),L+H>=r?L=0:L+=H;const it=_t-xe,Je=Math.max(it,1),Wt=EW/Je;H=Math.ceil(H*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 L;if((L=O==null?void 0:O.stopPropagation)==null||L.call(O),y===void 0)return;const F=(y.selectedIndex+1)%y.results;w({...y,selectedIndex:F}),c==null||c(A,F)},[y,c,A]),ne=v.useCallback(O=>{var L;if((L=O==null?void 0:O.stopPropagation)==null||L.call(O),y===void 0)return;let F=(y.selectedIndex-1)%y.results;F<0&&(F+=y.results),w({...y,selectedIndex:F}),c==null||c(A,F)},[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[W,q]=v.useState(!1);v.useEffect(()=>{if(f)q(!0);else{const O=setTimeout(()=>q(!1),150);return()=>clearTimeout(O)}},[f]);const R=v.useMemo(()=>{if(!f&&!W)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 F=$=>{$.stopPropagation()},H={width:`${Math.floor(((y==null?void 0:y.rowsSearched)??0)/r*100)}%`};return v.createElement(kW,{className:f?"":"out",onMouseDown:F,onMouseMove:F,onMouseUp:F,onClick:F},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:x,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},SW),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},CW),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},TW)),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:H})):v.createElement("div",{className:"gdg-search-status"},v.createElement("label",{htmlFor:h},"Type to search")))},[f,W,y,r,h,s,D,x,ie,ne,ee,d,N]);return v.createElement(v.Fragment,null,v.createElement(bW,{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 MW extends v.PureComponent{constructor(){super(...arguments);xt(this,"wrapperRef",v.createRef());xt(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 RW=()=>t=>Math.max(16,t.targetHeight-10),OW=Wr("input")({name:"RenameInput",class:"gdg-r17m35ur",propsAsIs:!1,vars:{"r17m35ur-0":[RW(),"px"]}}),PW=t=>{const{bounds:e,group:n,onClose:r,canvasBounds:i,onFinish:s}=t,[o,l]=In.useState(n);return In.createElement(MW,{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},In.createElement(OW,{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 IW(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(!IW(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":xh.value?s=!0:n=!0;break}return e.altKey===i&&e.ctrlKey===n&&e.shiftKey===r&&e.metaKey===s}function DW(t,e,n,r,i,s){const o=In.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 x={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")&&x.current!==void 0&&t.current!==void 0&&(x={...x,current:{...x.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),e(x,c)},[r,t,n,s,i,e]),l=In.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=In.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 _W(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 NW(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 LW(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"}:NW(o))})}function Sb(t,e){return(e?/[\t\n",]/:/[\t\n"]/).test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}function FW(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=>Sb(o,!0)).join(",")):i.push(Sb(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 Cb(t){return'"'+t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")+'"'}function BW(t){return t.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function zW(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 $W(t,e){const n=LW(t,e),r=FW(n),i=zW(n);return{textPlain:r,textHtml:i}}function Tb(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(x=>x.getAttribute("gdg-raw-value")??""),formatted:[...m].map(x=>x.textContent??""),format:"string-array"})}else if(h!==null)s==null||s.push({rawValue:BW(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 jW(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 Eb(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1).replace(/""/g,'"')),t}function HW(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(Eb(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 Ab(t,e,n){var l;const r=zW(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 xE(t){return t!==!0}function Mb(t){return typeof t=="string"?t:`${t}px`}const HW=()=>t=>t.innerWidth,WW=()=>t=>t.innerHeight,VW=Wr("div")({name:"Wrapper",class:"gdg-wmyidgi",propsAsIs:!1,vars:{"wmyidgi-0":[HW()],"wmyidgi-1":[WW()]}}),UW=t=>{const{inWidth:e,inHeight:n,children:r,...i}=t;return v.createElement(VW,{innerHeight:Mb(n),innerWidth:Mb(e),...i},r)},KW=2,XW=1300;function GW(t,e,n){const r=In.useRef(0),[i,s]=t??[0,0];In.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/XW);const d=r.current**1.618*f*KW;(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 YW({rowHeight:t,headerHeight:e,groupHeaderHeight:n,theme:r,overscrollX:i,overscrollY:s,scaleToRem:o,remSize:l}){const[a,u,c,f,d,h]=In.useMemo(()=>{if(!o||l===16)return[t,e,n,r,i,s];const p=l/16,m=t,x=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)??x.headerIconSize)*p,cellHorizontalPadding:((r==null?void 0:r.cellHorizontalPadding)??x.cellHorizontalPadding)*p,cellVerticalPadding:((r==null?void 0:r.cellVerticalPadding)??x.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 Rb(t){const e=xh.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 qW(t){const e=sF(t);return In.useMemo(()=>{if(e===void 0)return Rb(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 Rb({...Us,...n})},[e])}const QW=v.lazy(async()=>await XT(()=>import("./data-grid-overlay-editor-7TbweYYO.js"),[]));let JW=0;function ZW(t){return nz(Gx(Gx(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},e6=(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:x,height:g,columns:y,rows:w,getCellContent:k,onCellClicked:b,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:W,onHeaderContextMenu:Y,getCellsForSelection:R,onGroupHeaderContextMenu:O,onGroupHeaderRenamed:F,onCellEdited:L,onCellsEdited:H,onSearchResultsChanged:$,searchResults:ue,onSearchValueChange:ce,searchValue:xe,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:Rn=!0,experimental:on,fixedShadowX:ef,fixedShadowY:Ds,headerIcons:us,imageWindowLoader:cs,initialSize:wl,isDraggable:tf,onDragLeave:nf,onRowMoved:Ni,overscrollX:xl,overscrollY:bl,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,Vr=(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),ui=Math.max(ht,Tr),Qa=Math.max(Ne??ui,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}=YW({groupHeaderHeight:Np,headerHeight:fs,overscrollX:xl,overscrollY:bl,remSize:Ja,rowHeight:Sl,scaleToRem:_p,theme:Lp}),ci=qW(at),ds=lf??(w>1e4?48:w>1e3?44:w>100?36:32),Er=Vr!=="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]=DW(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=$W(C,En,X,ee,Kn.current)),ve!==void 0?(Fs.current=Gf(C,-X),ve(Fs.current)):r(C)},[ve,En,X,ee]),fi=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,be,ge]=IW(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}=eB(y,w,Al,Ae[0]-(X===0?0:ds)-Ae[2],Tr,Qa,oe,Te,Kn.current);Vr!=="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=Vr==="none"?void 0:kt===0?!1:kt===w?!0:void 0,pt=v.useMemo(()=>Vr==="none"?Dt:[{title:"",width:ds,icon:void 0,hasMenu:!1,style:"normal",themeOverride:qa,rowMarker:Ns,rowMarkerChecked:vn},...Dt],[Vr,Dt,ds,qa,Ns,vn]),[hn,Ur]=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:Ur}),[Ur,hn]),Rt=v.useRef(!1),[wn,Mr,Li]=iF(Ar);an.current=wn;const di=(wn.height??1)>1;v.useLayoutEffect(()=>{if(Lt!==void 0&&c.current!==null&&di){if(c.current.scrollTop===Lt)return;c.current.scrollTop=Lt,c.current.scrollTop!==Lt&&Li(),Rt.current=!0}},[Lt,di,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,Kr=v.useCallback(C=>{const z=X===0?C:C.map(U=>({...U,location:[U.location[0]-X,U.location[1]]})),B=H==null?void 0:H(z);if(B!==!0)for(const U of z)L==null||L(U.location,U.value);return B},[L,H,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=Rn?($w=q.current)==null?void 0:$w.cell:void 0,hf=Ol==null?void 0:Ol[0],pf=Ol==null?void 0:Ol[1],YM=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:Jr.Marker,allowOverlay:!1,checkboxStyle:Ns,checked:(q==null?void 0:q.rows.hasIndex(z))===!0,markerKind:Vr==="clickable-number"?"number":Vr,row:Tl+z,drawHandle:Ni!==void 0,cursor:Vr==="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:Jr.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,Vr,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 F!==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,F]),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=zD(()=>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&&(Kr([{location:q.current.cell,value:{...Z,data:xE(Z.data)}}]),(G=gr.current)==null||G.damage([{cell:q.current.cell}]))},[Rr,q,Kr,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]),xn=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,bn,ir));let pi=qt*Ye+At.left+X*ds*Ye,Bi=At.right,gi=At.top+ot*Ye,zi=At.bottom-Gn*Ye;const bf=ke.width+U*2;switch(Z==null?void 0:Z.hAlign){case"start":Bi=pi+bf;break;case"end":pi=Bi-bf;break;case"center":pi=Math.floor((pi+Bi)/2)-bf/2,Bi=pi+bf;break}const kf=ke.height+K*2;switch(Z==null?void 0:Z.vAlign){case"start":zi=gi+kf;break;case"end":gi=zi-kf;break;case"center":gi=Math.floor((gi+zi)/2)-kf/2,zi=gi+kf;break}pi>ze.x?je=ze.x-pi:Bize.y?Ke=ze.y-gi:zi=Xn-bn)&&(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;xf.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=xh.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||Vr==="number"||Ie==="none")return;const je=Rr(C.location);if(je.kind!==Jr.Marker)return;if(Ni!==void 0){const Ye=Te(je);_r((Ye==null?void 0:Ye.kind)===Jr.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"?be(void 0,Ye,!0):be(Ot.fromSingleSelection(Ye),void 0,B)}else B||C.isTouch||sn==="multi"?Ke?be(Q.remove(Z),void 0,!0):(be(void 0,Z,!0),Bs.current=Z):Ke&&Q.length===1?be(Ot.empty(),void 0,z):(be(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),bn=Math.max(Z,te);re({...q.current,range:{x:ze,y:Gn,width:qt-ze+1,height:bn-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?be(Ot.fromSingleSelection([0,w]),void 0,z):be(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===bh&&!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,Vr,Ie,sn,w,re,pr,ge,be,ln,nu]),iu=v.useRef(!1),No=v.useRef(),Pw=v.useRef(wn),Xr=v.useRef(),qM=v.useCallback(C=>{if(_l.current=!1,Pw.current=an.current,C.button!==0&&C.button!==1){Xr.current=void 0;return}const z=performance.now();Xr.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=xh.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&&fi!==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,ui,!1,Te);fi==null||fi(K,Q.width,C,Q.width)}}},[Dt,En,ui,oe,Tr,fi,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,Kr,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]),JM=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&&(b==null||b([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 bn=qt.onClick({...ke,cell:ze,posX:ke.localEventX,posY:ke.localEventY,bounds:ke.bounds,theme:nu(ze,C.location),preventDefault:Q});bn!==void 0&&!na(bn)&&jl(bn)&&(Kr([{location:ke.location,value:bn}]),(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[bn,pi]=q.current.cell,[Bi,gi]=B.previousSelection.current.cell;Gn=U===bn&&U===Bi&&K===pi&&K===gi&&(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,b,Rr,Te,Ve,nu,Kr,S,Pl,ie,Y,O,ru,ne,N,yf,Iw]),ZM=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=Xr.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,tR=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]),nR=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),rR=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]),iR=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=Xr==null?void 0:Xr.current)==null?void 0:z.button)!==void 0&&Xr.current.button>=1))){if(C.buttons!==0&&a!==void 0&&((B=Xr.current)==null?void 0:B.location[0])===0&&C.location[0]===0&&X===1&&Ie==="multi"&&a.previousSelection&&!a.previousSelection.rows.hasIndex(Xr.current.location[1])&&q.rows.hasIndex(Xr.current.location[1])){const K=Math.min(Xr.current.location[1],C.location[1]),Z=Math.max(Xr.current.location[1],C.location[1])+1;be(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=$z(se,G,Q,Et);Wp(te)}else{if(ln&&Z===w)return;if(ln&&Q===w)if(C.kind===bh)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,be,ln,w,re]),sR=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=ki(U,0,pt.length-1),K=ki(K,0,w-1),Qp({...C,location:[U,K]})},[pt.length,Qp,w]);GW(QM,c,sR);const hi=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,xn(0,te,"vertical");break}case-2:{se=0,te=K+1,xn(0,se,"vertical");break}case 1:{seK+1?(te--,xn(0,te,"vertical")):(se=Math.max(0,se-1),xn(0,se,"vertical"));break}default:Sc()}if(z!==0)if(z===2)Q=pt.length,G=U,xn(Q-1-X,0,"horizontal");else if(z===-2)G=X,Q=U+1,xn(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=ZW(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&&xn(G,0,"horizontal")}Me||(Q=Math.min(pt.length,Q+1),xn(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&&xn(Q-X,0,"horizontal")}Me||(G=Math.max(X,G-1),xn(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,xn,re]),zs=v.useCallback((C,z,B,U)=>{const K=Xn-(B?0:1);if(C=ki(C,X,Dt.length-1+X),z=ki(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),xn(C-X,z),!0},[Xn,X,Dt.length,Fi,q,xn,pr,re]),oR=v.useCallback((C,z)=>{(i==null?void 0:i.cell)!==void 0&&C!==void 0&&jl(C)&&(Kr([{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(ki(q.current.cell[0]+B,0,pt.length-1),ki(q.current.cell[1]+U,0,Xn-1),K,!1)}E==null||E(C,z)},[i==null?void 0:i.cell,sr,q,E,Kr,Xn,zs,pt.length]),lR=v.useMemo(()=>`gdg-overlay-${JW++}`,[]),Lo=v.useCallback(C=>{var B,U,K,Z;sr();const z=[];for(let G=C.x;G({cell:G.location})))},[sr,k,Te,Kr,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=ci;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)?xf.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)?be(Z.remove(se),void 0,!0):Ie==="single"?be(Ot.fromSingleSelection(se),void 0,!0):be(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),hi([-2,-2])):mt(G.selectToLastCell,C,B)?(s(void 0),hi([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)?hi([0,1]):mt(G.selectGrowUp,C,B)?hi([0,-1]):mt(G.selectGrowRight,C,B)?hi([1,0]):mt(G.selectGrowLeft,C,B)?hi([-1,0]):mt(G.selectToLastRow,C,B)?hi([0,2]):mt(G.selectToFirstRow,C,B)?hi([0,-2]):mt(G.selectToLastColumn,C,B)?hi([2,0]):mt(G.selectToFirstColumn,C,B)&&hi([-2,0])),Ce=B.didMatch);const Me=zs(Q,se,!1,te),ke=B.didMatch;return ke&&(Me||!Ce||rf)&&z(),ke},[su,q,ci,me,Ie,Pe,X,w,zs,pr,Ze,y.length,j,rf,Lo,ge,be,ln,mf,Il,S,Pl,_w,Dw,hi]),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]),aR=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}),LF(q,C.location)||zs(U,K,!1,!1)}},[q,ie,O,Y,X,zs]),Jp=v.useCallback(async C=>{var G,Q,se;if(!ci.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(),bn=Tb(Gn);if(bn!==void 0){te=bn;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=Tb(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(bn=>bn.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=jW(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 bn=[qt+je,Ye+Ke],[pi,Bi]=bn;if(pi>=pt.length||Bi>=Xn)continue;const gi=Rr(bn),zi=z(gi,bn,Gn.rawValue,Gn.formatted);zi!==void 0&&At.push(zi)}}}while(!1);Kr(At),(se=gr.current)==null||se.damage(At.map(Ye=>({cell:Ye.location})))}},[A,Te,Rr,q,ci.paste,pt.length,Kr,Xn,he,X,w]);$n("paste",Jp,d,!1,!0);const lu=v.useCallback(async(C,z)=>{var G,Q;if(!ci.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)Ab(se,te,C);else{const Ce=te.map(Me=>({kind:Se.Text,data:y[Me].title,displayData:y[Me].title,allowOverlay:!1}));Ab([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,ci.copy,X,w,rt]);$n("copy",lu,d,!1,!1);const uR=v.useCallback(async C=>{var B,U;if(!(!ci.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,ci.cut,lu,j]);$n("cut",uR,d,!1,!1);const cR=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)??[],xf=v.useRef(xn);xf.current=xn,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]))&&xf.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 fR=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]),dR=v.useCallback(C=>typeof Mt=="boolean"?Mt:(Mt==null?void 0:Mt(C-X))??!0,[X,Mt]),hR=v.useMemo(()=>{if(Kp===void 0||l.current===null)return null;const{bounds:C,group:z}=Kp,B=l.current.getBoundingClientRect();return v.createElement(OW,{bounds:C,group:z,canvasBounds:B,onClose:()=>Xp(void 0),onFinish:U=>{Xp(void 0),F==null||F(z,U)}})},[F,Kp]),pR=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:xn,remeasureColumns:C=>{for(const z of C)yf(z+X)}}),[Il,yf,lu,ou,Jp,X,xn]);const[Fw,Bw]=Fi??[],gR=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"),xn(z,B))},[me,sr,xn,Fw,Bw,re,ge]),[mR,yR]=v.useState(!1),zw=v.useRef(ST(C=>{yR(C)},5)),vR=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]),wR=v.useCallback(()=>{zw.current(!1)},[]),[xR,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]),kR=v.useMemo(()=>QF(oe),[oe]);return v.createElement(JF.Provider,{value:oe},v.createElement(UW,{style:kR,className:W,inWidth:x??xR,inHeight:g??bR},v.createElement(EW,{fillHandle:Zt,drawFocusRing:Rn,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:W,enableGroups:Bt,onCanvasFocused:vR,onCanvasBlur:wR,canvasRef:l,onContextMenu:aR,theme:oe,cellXOffset:Do,cellYOffset:ff,accessibilityHeight:wn.height,onDragEnd:iR,columns:pt,nonGrowWidth:Fe,drawHeader:jp,onColumnProposeMove:D,drawCell:Hp,disabledRows:fR,freezeColumns:pR,lockColumns:X,firstColAccessible:X===0,getCellContent:Rr,minColumnWidth:Tr,maxColumnWidth:ui,searchInputRef:o,showSearch:eu,onSearchClose:zp,highlightRegions:YM,getCellsForSelection:En,getGroupDetails:Vp,headerHeight:El,isFocused:mR,groupHeaderHeight:Bt?Za:0,freezeTrailingRows:De+(ln&&(ye==null?void 0:ye.sticky)===!0?1:0),hasAppendRow:ln,onColumnResize:fi,onColumnResizeEnd:$p,onColumnResizeStart:Ml,onCellFocused:gR,onColumnMoved:nR,onDragStart:rR,onHeaderMenuClick:eR,onItemHovered:Qp,isFilling:(a==null?void 0:a.fillHandle)===!0,onMouseMove:ZM,onKeyDown:ou,onKeyUp:$e,onMouseDown:qM,onMouseUp:JM,onDragOverCell:Un,onDrop:lt,onSearchResultsChanged:cR,onVisibleRegionChanged:tR,clientSize:Ae,rowHeight:ir,searchResults:ue,searchValue:xe,onSearchValueChange:ce,rows:Xn,scrollRef:c,selection:q,translateX:wn.tx,translateY:wn.ty,verticalBorder:dR,gridRef:gr,getCellRenderer:Te}),hR,i!==void 0&&v.createElement(v.Suspense,{fallback:null},v.createElement(QW,{...i,validateCell:tu,bloom:P,id:lR,getCellRenderer:Te,className:(on==null?void 0:on.isSubGrid)===!0?"click-outside-ignore":void 0,provideEditor:Ue,imageEditorOverride:h,onFinishEditing:oR,markdownDivCreateNode:m,isOutsideClick:of}))))},t6=v.forwardRef(e6),Ob=20,n6={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=>r6(t,t.cell.data,v0(t.cell),t.cell.maxSize??Ob),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??Ob,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:xE(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 r6(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,x=.35;let g=n?1-x+x*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 i6=Wr("div")({name:"BubblesOverlayEditorStyle",class:"gdg-b1ygi5by",propsAsIs:!1}),s6=t=>{const{bubbles:e}=t;return v.createElement(i6,null,e.map((n,r)=>v.createElement("div",{key:r,className:"boe-bubble"},n)),v.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},o6={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=>a6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return v.createElement(s6,{bubbles:e.data})},onPaste:()=>{}},l6=4;function a6(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=l6;let h=o+r.cellHorizontalPadding;const p=[];for(const m of e){if(h>o+a)break;const x=Xc(m,i,r.baseFontFull).width;p.push({x:h,width:x}),h+=x+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,x]of p.entries())i.beginPath(),i.fillStyle=r.textBubble,i.fillText(e[m],x.x+f,l+u/2+Is(i,r))}const u6=Wr("div")({name:"DrilldownOverlayEditorStyle",class:"gdg-d4zsq0x",propsAsIs:!1}),c6=t=>{const{drilldowns:e}=t;return v.createElement(u6,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))))},f6={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=>p6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return v.createElement(c6,{drilldowns:e.data})},onPaste:()=>{}},d6=4,Kg={};function h6(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 p6(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,x=d6;let g=a+r.cellHorizontalPadding;const y=r.roundingRadius??6,w=h6(r.bgCell,r.drilldownBorder,d,y),k=[];for(const b of e){if(g>a+u)break;const T=Xc(b.text,i,c).width;let E=0;b.img!==void 0&&s.loadOrGetImage(b.img,o,l)!==void 0&&(E=p-8+4);const A=T+E+m*2;k.push({x:g,width:A}),g+=A+x}if(w!==null){const{el:b,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(b,0,0,E,S,ee-N,h,P,d),ie>0&&i.drawImage(b,E,0,T,S,ee+(P-N),h,ie,d),i.drawImage(b,A-E,0,E,S,ee+ne-(P-N),h,P,d),i.imageSmoothingEnabled=!0}}i.beginPath();for(const[b,S]of k.entries()){const T=e[b];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 g6={getAccessibilityString:t=>t.data.join(", "),kind:Se.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>m6(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??oF;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 m6(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 x=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 y6(t,e){let n=t*49632+e*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}const v6={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(y6(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:()=>{}},w6=()=>t=>t.targetWidth,Pb=Wr("div")({name:"MarkdownOverlayEditorStyle",class:"gdg-m1pnx84e",propsAsIs:!1,vars:{"m1pnx84e-0":[w6(),"px"]}}),x6=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(Pb,{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(Z4,null))):v.createElement(Pb,{targetWidth:s.width},v.createElement(TF,{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}))},b6={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(x6,{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}},k6={getAccessibilityString:t=>t.row.toString(),kind:Jr.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:S6,measure:()=>44,draw:t=>T6(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 S6(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=C6,n.textAlign="center",s}function C6(t){const{ctx:e}=t;e.textAlign="start"}function T6(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 x of[3,6])for(const g of[-5,-1,3])o.rect(c+x,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(),x=u.markerFontFull,g=c+d/2;r==="both"&&a!==0&&(o.globalAlpha=1-a),o.fillStyle=u.textLight,o.font=x,o.fillText(m,g,f+h/2+Is(o,x)),a!==0&&(o.globalAlpha=1)}}const E6={getAccessibilityString:()=>"",kind:Jr.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>A6(t,t.cell.hint,t.cell.icon),onPaste:()=>{}};function A6(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,x=a+8/2,g=u+8/2;l.drawSprite(n,"normal",r,x,g,m,o,d?1:s),h=m}else{h=24;const p=12,m=d?p:s*p,x=d?0:(1-s)*p*.5,g=o.cellHorizontalPadding+4;m>0&&(r.moveTo(a+g+x,u+f/2),r.lineTo(a+g+x+m,u+f/2),r.moveTo(a+g+x+m*.5,u+f/2-m*.5),r.lineTo(a+g+x+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 M6=v.lazy(async()=>await XT(()=>import("./number-overlay-editor-BpbJ-7AH.js"),[])),R6={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(M6,{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}}},O6={getAccessibilityString:()=>"",measure:()=>108,kind:Se.Protected,needsHover:!1,needsHoverPosition:!1,draw:P6,onPaste:()=>{}};function P6(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(Ix(30))*l,f=Math.sin(Ix(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 I6={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 In.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:()=>{}},D6={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,x=Math.min(m,p.actualBoundingBoxAscent*2.5);i.beginPath(),rs(i,s.x+d/2,s.y+(s.height-x)/2+1,p.width+d*3,x-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}},_6=Wr("div")({name:"UriOverlayEditorStyle",class:"gdg-u1rrojo",propsAsIs:!1}),N6=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(_6,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 Ib(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 L6={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=Ib(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 x=Is(l,n.baseFontFull);r("pointer");const g=5,y=h-x;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=WF(o,s.baseFontFull);if(l===void 0)return;const a=Ib(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(N6,{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}},F6=[k6,E6,n6,o6,f6,g6,v6,b6,R6,O6,I6,D6,L6];var B6=kT,z6=gl,$6="Expected a function";function j6(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError($6);return z6(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),B6(t,e,{leading:r,maxWait:e,trailing:i})}var H6=j6;const W6=Ii(H6),Gg=[];class V6 extends WT{constructor(){super(...arguments);xt(this,"imageLoaded",()=>{});xt(this,"loadedLocations",[]);xt(this,"cache",{});xt(this,"sendLoaded",W6(()=>{this.imageLoaded(new Ju(this.loadedLocations)),this.loadedLocations=[]},20));xt(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=Si(r,i);return o.cells.includes(l)||o.cells.push(l),o.img}else this.loadImage(n,r,i,s)}}const Yg="\uFEFF";function U6(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 K6(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++;sl.map(a=>({rawValue:a,formatted:a,format:"string"})))}function Ab(t,e,n){var l;const r=$W(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 xE(t){return t!==!0}function Mb(t){return typeof t=="string"?t:`${t}px`}const WW=()=>t=>t.innerWidth,VW=()=>t=>t.innerHeight,UW=Wr("div")({name:"Wrapper",class:"gdg-wmyidgi",propsAsIs:!1,vars:{"wmyidgi-0":[WW()],"wmyidgi-1":[VW()]}}),KW=t=>{const{inWidth:e,inHeight:n,children:r,...i}=t;return v.createElement(UW,{innerHeight:Mb(n),innerWidth:Mb(e),...i},r)},XW=2,GW=1300;function qW(t,e,n){const r=In.useRef(0),[i,s]=t??[0,0];In.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/GW);const d=r.current**1.618*f*XW;(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 YW({rowHeight:t,headerHeight:e,groupHeaderHeight:n,theme:r,overscrollX:i,overscrollY:s,scaleToRem:o,remSize:l}){const[a,u,c,f,d,h]=In.useMemo(()=>{if(!o||l===16)return[t,e,n,r,i,s];const p=l/16,m=t,x=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)??x.headerIconSize)*p,cellHorizontalPadding:((r==null?void 0:r.cellHorizontalPadding)??x.cellHorizontalPadding)*p,cellVerticalPadding:((r==null?void 0:r.cellVerticalPadding)??x.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 Rb(t){const e=xh.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 QW(t){const e=oF(t);return In.useMemo(()=>{if(e===void 0)return Rb(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 Rb({...Us,...n})},[e])}const JW=v.lazy(async()=>await XT(()=>import("./data-grid-overlay-editor-BAT754-f.js"),[]));let ZW=0;function e6(t){return rz(Gx(Gx(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},qf={columns:Ot.empty(),rows:Ot.empty(),current:void 0},t6=(t,e)=>{var $w,jw,Hw;const[n,r]=v.useState(qf),[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:x,height:g,columns:y,rows:w,getCellContent:k,onCellClicked:b,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:W,onHeaderContextMenu:q,getCellsForSelection:R,onGroupHeaderContextMenu:O,onGroupHeaderRenamed:F,onCellEdited:L,onCellsEdited:H,onSearchResultsChanged:$,searchResults:ue,onSearchValueChange:ce,searchValue:xe,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:Rn=!0,experimental:on,fixedShadowX:ef,fixedShadowY:Ds,headerIcons:us,imageWindowLoader:cs,initialSize:wl,isDraggable:tf,onDragLeave:nf,onRowMoved:Ni,overscrollX:xl,overscrollY:bl,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,Vr=(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,Ya=(Tn==null?void 0:Tn.theme)??t.rowMarkerTheme,Ns=(Tn==null?void 0:Tn.checkboxStyle)??"square",Tr=Math.max(de,20),ui=Math.max(ht,Tr),Qa=Math.max(Ne??ui,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}=YW({groupHeaderHeight:Np,headerHeight:fs,overscrollX:xl,overscrollY:bl,remSize:Ja,rowHeight:Sl,scaleToRem:_p,theme:Lp}),ci=QW(at),ds=lf??(w>1e4?48:w>1e3?44:w>100?36:32),Er=Vr!=="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]),Y=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]=_W(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=jW(C,En,X,ee,Kn.current)),ve!==void 0?(Fs.current=Gf(C,-X),ve(Fs.current)):r(C)},[ve,En,X,ee]),fi=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,be,ge]=DW(Y,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}=tB(y,w,Al,Ae[0]-(X===0?0:ds)-Ae[2],Tr,Qa,oe,Te,Kn.current);Vr!=="none"&&(Fe+=ds);const Bt=v.useMemo(()=>Dt.some(C=>C.group!==void 0),[Dt]),ot=Bt?El+Za:El,kt=Y.rows.length,vn=Vr==="none"?void 0:kt===0?!1:kt===w?!0:void 0,pt=v.useMemo(()=>Vr==="none"?Dt:[{title:"",width:ds,icon:void 0,hasMenu:!1,style:"normal",themeOverride:Ya,rowMarker:Ns,rowMarkerChecked:vn},...Dt],[Vr,Dt,ds,Ya,Ns,vn]),[hn,Ur]=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:Ur}),[Ur,hn]),Rt=v.useRef(!1),[wn,Mr,Li]=sF(Ar);an.current=wn;const di=(wn.height??1)>1;v.useLayoutEffect(()=>{if(Lt!==void 0&&c.current!==null&&di){if(c.current.scrollTop===Lt)return;c.current.scrollTop=Lt,c.current.scrollTop!==Lt&&Li(),Rt.current=!0}},[Lt,di,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,Kr=v.useCallback(C=>{const z=X===0?C:C.map(U=>({...U,location:[U.location[0]-X,U.location[1]]})),B=H==null?void 0:H(z);if(B!==!0)for(const U of z)L==null||L(U.location,U.value);return B},[L,H,X]),[_o,Wp]=v.useState(),df=Y.current!==void 0&&Y.current.range.width*Y.current.range.height>1?Y.current.range:void 0,Ol=Rn?($w=Y.current)==null?void 0:$w.cell:void 0,hf=Ol==null?void 0:Ol[0],pf=Ol==null?void 0:Ol[1],YM=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:Jr.Marker,allowOverlay:!1,checkboxStyle:Ns,checked:(Y==null?void 0:Y.rows.hasIndex(z))===!0,markerKind:Vr==="clickable-number"?"number":Vr,row:Tl+z,drawHandle:Ni!==void 0,cursor:Vr==="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,qe=((Q=Ke==null?void 0:Ke.trailingRowOptions)==null?void 0:Q.addIcon)??(ye==null?void 0:ye.addIcon);return{kind:Jr.NewRow,hint:At,allowOverlay:!1,icon:qe}}}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,qe=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 Yt of Ke.extras.freezeRegions)if(vp(Yt,ke,z)){ze=!0;break}}if(At&&!qe&&!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,Y==null?void 0:Y.rows,Vr,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 F!==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,F]),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(Y.current===void 0)return;const[U,K]=Y.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=$D(()=>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&&(Kr([{location:Y.current.cell,value:{...Z,data:xE(Z.data)}}]),(G=gr.current)==null||G.damage([{cell:Y.current.cell}]))},[Rr,Y,Kr,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]),xn=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(),qe=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 Yt=0;for(let Zp=0;Zp0&&(Gn=vl(Xn,bn,ir));let pi=Yt*qe+At.left+X*ds*qe,Bi=At.right,gi=At.top+ot*qe,zi=At.bottom-Gn*qe;const bf=ke.width+U*2;switch(Z==null?void 0:Z.hAlign){case"start":Bi=pi+bf;break;case"end":pi=Bi-bf;break;case"center":pi=Math.floor((pi+Bi)/2)-bf/2,Bi=pi+bf;break}const kf=ke.height+K*2;switch(Z==null?void 0:Z.vAlign){case"start":zi=gi+kf;break;case"end":gi=zi-kf;break;case"center":gi=Math.floor((gi+zi)/2)-kf/2,zi=gi+kf;break}pi>ze.x?je=ze.x-pi:Bize.y?Ke=ze.y-gi:zi=Xn-bn)&&(Ke=0),(je!==0||Ke!==0)&&(qe!==1&&(je/=qe,Ke/=qe),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;xf.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=xh.value?C.metaKey:C.ctrlKey,B=z&&Ie==="multi",U=z&&me==="multi",[K,Z]=C.location,G=Y.columns,Q=Y.rows,[se,te]=((Ce=Y.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||Vr==="number"||Ie==="none")return;const je=Rr(C.location);if(je.kind!==Jr.Marker)return;if(Ni!==void 0){const qe=Te(je);_r((qe==null?void 0:qe.kind)===Jr.Marker);const ze=(Me=qe==null?void 0:qe.onClick)==null?void 0:Me.call(qe,{...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 qe=[Math.min(At,Z),Math.max(At,Z)+1];B||sn==="multi"?be(void 0,qe,!0):be(Ot.fromSingleSelection(qe),void 0,B)}else B||C.isTouch||sn==="multi"?Ke?be(Q.remove(Z),void 0,!0):(be(void 0,Z,!0),Bs.current=Z):Ke&&Q.length===1?be(Ot.empty(),void 0,z):(be(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,qe=Io&&Y!==void 0&&((ke=Y.current)==null?void 0:ke.cell[1])===w;if((C.shiftKey||C.isLongTouch===!0)&&se!==void 0&&te!==void 0&&Y.current!==void 0&&!qe){if(At)return;const ze=Math.min(K,se),Yt=Math.max(K,se),Gn=Math.min(Z,te),bn=Math.max(Z,te);re({...Y.current,range:{x:ze,y:Gn,width:Yt-ze+1,height:bn-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?be(Ot.fromSingleSelection([0,w]),void 0,z):be(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===bh&&!C.isMaybeScrollbar&&(pr(qf,!1),s(void 0),sr(),Ze==null||Ze(),Bs.current=void 0,Dl.current=void 0)},[Il,me,sr,Te,mf,Rr,Y,Er,Io,Ze,Ni,X,Vr,Ie,sn,w,re,pr,ge,be,ln,nu]),iu=v.useRef(!1),No=v.useRef(),Pw=v.useRef(wn),Xr=v.useRef(),QM=v.useCallback(C=>{if(_l.current=!1,Pw.current=an.current,C.button!==0&&C.button!==1){Xr.current=void 0;return}const z=performance.now();Xr.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:Y,fillHandle:B}),No.current=void 0,!C.isTouch&&C.button===0&&!B?ru(C):!C.isTouch&&C.button===1&&(No.current=C.location))},[Y,ru]),[Kp,Xp]=v.useState(),Iw=v.useCallback(C=>{if(C.kind!==Dr||me!=="multi")return;const z=xh.value?C.metaKey:C.ctrlKey,[B]=C.location,U=Y.columns;if(B=X&&Cc(K.group,pt[Q].group);Q--)Z--;for(let Q=B+1;Q{if(En!==void 0&&fi!==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,ui,!1,Te);fi==null||fi(K,Q.width,C,Q.width)}}},[Dt,En,ui,oe,Tr,fi,X,w,Te]),[JM,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,Kr,T,X]),Dw=v.useCallback(()=>{if(Y.current===void 0||Y.current.range.width<=1)return;const C={...Y,current:{...Y.current,range:{...Y.current.range,width:1}}};Nl(C,Y)},[Nl,Y]),_w=v.useCallback(()=>{if(Y.current===void 0||Y.current.range.height<=1)return;const C={...Y,current:{...Y.current,range:{...Y.current.range,height:1}}};Nl(C,Y)},[Nl,Y]),ZM=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&&Y.current!==void 0&&((Ce=B.previousSelection)==null?void 0:Ce.current)!==void 0){if(_o===void 0)return;const ke={...Y,current:{...Y.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,qe;const je=ke.isTouch||Z===U&&G===K;if(je&&(b==null||b([U-X,K],{...ke,preventDefault:Q})),ke.button===1)return!_l.current;if(!_l.current){const ze=Rr(C.location),Yt=Te(ze);if(Yt!==void 0&&Yt.onClick!==void 0&&je){const bn=Yt.onClick({...ke,cell:ze,posX:ke.localEventX,posY:ke.localEventY,bounds:ke.bounds,theme:nu(ze,C.location),preventDefault:Q});bn!==void 0&&!na(bn)&&jl(bn)&&(Kr([{location:ke.location,value:bn}]),(Ke=gr.current)==null||Ke.damage([{cell:ke.location}]))}if(_l.current||Y.current===void 0)return!1;let Gn=!1;switch(ze.activationBehaviorOverride??Ve){case"double-click":case"second-click":{if(((qe=(At=B==null?void 0:B.previousSelection)==null?void 0:At.current)==null?void 0:qe.cell)===void 0)break;const[bn,pi]=Y.current.cell,[Bi,gi]=B.previousSelection.current.cell;Gn=U===bn&&U===Bi&&K===pi&&K===gi&&(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"&&Yu((Me=Y.current)==null?void 0:Me.cell,C.location)){ie==null||ie([te,C.location[1]],{...C,preventDefault:Q});return}else if(C.kind==="header"&&Y.columns.hasIndex(U)){q==null||q(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,Y,X,_o,Nl,pr,b,Rr,Te,Ve,nu,Kr,S,Pl,ie,q,O,ru,ne,N,yf,Iw]),eR=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=Xr.current)==null?void 0:U.location[0])??0){wt==null||wt(C-X,z)},[wt,X]),Fi=(jw=Y==null?void 0:Y.current)==null?void 0:jw.cell,nR=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]),rR=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])),qp=v.useRef(!1),iR=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()||(qp.current=!0),u(void 0)},[ut,X]),sR=v.useCallback(()=>{qp.current=!1},[]),Yp=v.useRef(),Qp=v.useCallback(C=>{var z,B,U;if(!vE(C,Yp.current)&&(Yp.current=C,!(((z=Xr==null?void 0:Xr.current)==null?void 0:z.button)!==void 0&&Xr.current.button>=1))){if(C.buttons!==0&&a!==void 0&&((B=Xr.current)==null?void 0:B.location[0])===0&&C.location[0]===0&&X===1&&Ie==="multi"&&a.previousSelection&&!a.previousSelection.rows.hasIndex(Xr.current.location[1])&&Y.rows.hasIndex(Xr.current.location[1])){const K=Math.min(Xr.current.location[1],C.location[1]),Z=Math.max(Xr.current.location[1],C.location[1])+1;be(Ot.fromSingleSelection([K,Z]),void 0,!1)}if(C.buttons!==0&&a!==void 0&&Y.current!==void 0&&!qp.current&&!iu.current&&(Pe==="rect"||Pe==="multi-rect")){const[K,Z]=Y.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=jz(se,G,Q,Et);Wp(te)}else{if(ln&&Z===w)return;if(ln&&Q===w)if(C.kind===bh)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({...Y.current,range:ke},!0,!1,"drag")}}fe==null||fe({...C,location:[C.location[0]-X,C.location[1]]})}},[Et,a,X,Ie,Y,Pe,fe,be,ln,w,re]),oR=v.useCallback(()=>{var G,Q;const C=Yp.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=ki(U,0,pt.length-1),K=ki(K,0,w-1),Qp({...C,location:[U,K]})},[pt.length,Qp,w]);qW(JM,c,oR);const hi=v.useCallback(C=>{if(Y.current===void 0)return;const[z,B]=C,[U,K]=Y.current.cell,Z=Y.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,xn(0,te,"vertical");break}case-2:{se=0,te=K+1,xn(0,se,"vertical");break}case 1:{seK+1?(te--,xn(0,te,"vertical")):(se=Math.max(0,se-1),xn(0,se,"vertical"));break}default:Sc()}if(z!==0)if(z===2)Q=pt.length,G=U,xn(Q-1-X,0,"horizontal");else if(z===-2)G=X,Q=U+1,xn(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=e6(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&&xn(G,0,"horizontal")}Me||(Q=Math.min(pt.length,Q+1),xn(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&&xn(Q-X,0,"horizontal")}Me||(G=Math.max(X,G-1),xn(G-X,0,"horizontal"))}else Sc()}re({cell:Y.current.cell,range:{x:G,y:se,width:Q-G,height:te-se}},!0,!1,"keyboard-select")},[En,Y,pt.length,X,w,xn,re]),zs=v.useCallback((C,z,B,U)=>{const K=Xn-(B?0:1);if(C=ki(C,X,Dt.length-1+X),z=ki(z,0,K),C===(Fi==null?void 0:Fi[0])&&z===(Fi==null?void 0:Fi[1]))return!1;if(U&&Y.current!==void 0){const Z=[...Y.current.rangeStack];(Y.current.range.width>1||Y.current.range.height>1)&&Z.push(Y.current.range),pr({...Y,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),xn(C-X,z),!0},[Xn,X,Dt.length,Fi,Y,xn,pr,re]),lR=v.useCallback((C,z)=>{(i==null?void 0:i.cell)!==void 0&&C!==void 0&&jl(C)&&(Kr([{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(Y.current!==void 0&&(B!==0||U!==0)){const K=Y.current.cell[1]===Xn-1&&C!==void 0;zs(ki(Y.current.cell[0]+B,0,pt.length-1),ki(Y.current.cell[1]+U,0,Xn-1),K,!1)}E==null||E(C,z)},[i==null?void 0:i.cell,sr,Y,E,Kr,Xn,zs,pt.length]),aR=v.useMemo(()=>`gdg-overlay-${ZW++}`,[]),Lo=v.useCallback(C=>{var B,U,K,Z;sr();const z=[];for(let G=C.x;G({cell:G.location})))},[sr,k,Te,Kr,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=Y.columns,Z=Y.rows,G=ci;if(!su&&mt(G.clear,C,B))pr(qf,!1),Ze==null||Ze();else if(!su&&mt(G.selectAll,C,B))pr({columns:Ot.empty(),rows:Ot.empty(),current:{cell:((je=Y.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(Y))??!0;if(At!==!1){const qe=At===!0?Y:At;if(qe.current!==void 0){Lo(qe.current.range);for(const ze of qe.current.rangeStack)Lo(ze)}for(const ze of qe.rows)Lo({x:X,y:ze,width:y.length,height:1});for(const ze of qe.columns)Lo({x:ze,y:0,width:1,height:w})}}if(B.didMatch)return z(),!0;if(Y.current===void 0)return!1;let[Q,se]=Y.current.cell,te=!1,Ce=!1;mt(G.scrollToSelectedCell,C,B)?xf.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)?be(Z.remove(se),void 0,!0):Ie==="single"?be(Ot.fromSingleSelection(se),void 0,!0):be(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)):Y.current.range.height>1&&mt(G.downFill,C,B)?_w():Y.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),hi([-2,-2])):mt(G.selectToLastCell,C,B)?(s(void 0),hi([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)?hi([0,1]):mt(G.selectGrowUp,C,B)?hi([0,-1]):mt(G.selectGrowRight,C,B)?hi([1,0]):mt(G.selectGrowLeft,C,B)?hi([-1,0]):mt(G.selectToLastRow,C,B)?hi([0,2]):mt(G.selectToFirstRow,C,B)?hi([0,-2]):mt(G.selectToLastColumn,C,B)?hi([2,0]):mt(G.selectToFirstColumn,C,B)&&hi([-2,0])),Ce=B.didMatch);const Me=zs(Q,se,!1,te),ke=B.didMatch;return ke&&(Me||!Ce||rf)&&z(),ke},[su,Y,ci,me,Ie,Pe,X,w,zs,pr,Ze,y.length,j,rf,Lo,ge,be,ln,mf,Il,S,Pl,_w,Dw,hi]),ou=v.useCallback(C=>{let z=!1;if(Ge!==void 0&&Ge({...C,cancel:()=>{z=!0}}),z||Nw(C)||Y.current===void 0)return;const[B,U]=Y.current.cell,K=an.current;if(_t&&!C.metaKey&&!C.ctrlKey&&Y.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,Y,k,X,w,ln,Pl]),uR=v.useCallback((C,z)=>{const B=C.location[0]-X;if(C.kind==="header"&&(q==null||q(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}),FF(Y,C.location)||zs(U,K,!1,!1)}},[Y,ie,O,q,X,zs]),Jp=v.useCallback(async C=>{var G,Q,se;if(!ci.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 qe=A==null?void 0:A(je,te);if(qe!==void 0&&jl(qe))return{location:Ce,value:qe};const ze=Te(te);if(ze===void 0)return;if(ze.kind===Se.Custom){_r(te.kind===Se.Custom);const Yt=(Ke=ze.onPaste)==null?void 0:Ke.call(ze,je,te.data);return Yt===void 0?void 0:{location:Ce,value:{...te,data:Yt}}}else{const Yt=(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 Yt===void 0?void 0:(_r(Yt.kind===te.kind),{location:Ce,value:Yt})}}}const B=Y.columns,U=Y.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(Y.current!==void 0?Z=[Y.current.range.x,Y.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 qe=await navigator.clipboard.read();for(const ze of qe){if(ze.types.includes(ke)){const Gn=await(await ze.getType(ke)).text(),bn=Tb(Gn);if(bn!==void 0){te=bn;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 qe=C.clipboardData.getData(ke);te=Tb(qe)}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 qe=Rr(Z),ze=Ce??(te==null?void 0:te.map(Gn=>Gn.map(bn=>bn.rawValue).join(" ")).join(" "))??"",Yt=z(qe,Z,ze,void 0);Yt!==void 0&&At.push(Yt);break}if(te===void 0){if(Ce===void 0)return;te=HW(Ce)}if(he===!1||typeof he=="function"&&(he==null?void 0:he([Z[0]-X,Z[1]],te.map(qe=>qe.map(ze=>{var Yt;return((Yt=ze.rawValue)==null?void 0:Yt.toString())??""}))))!==!0)return;for(const[qe,ze]of te.entries()){if(qe+Ke>=w)break;for(const[Yt,Gn]of ze.entries()){const bn=[Yt+je,qe+Ke],[pi,Bi]=bn;if(pi>=pt.length||Bi>=Xn)continue;const gi=Rr(bn),zi=z(gi,bn,Gn.rawValue,Gn.formatted);zi!==void 0&&At.push(zi)}}}while(!1);Kr(At),(se=gr.current)==null||se.damage(At.map(qe=>({cell:qe.location})))}},[A,Te,Rr,Y,ci.paste,pt.length,Kr,Xn,he,X,w]);$n("paste",Jp,d,!1,!0);const lu=v.useCallback(async(C,z)=>{var G,Q;if(!ci.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=Y.columns,K=Y.rows,Z=(se,te)=>{if(!rt)Ab(se,te,C);else{const Ce=te.map(Me=>({kind:Se.Text,data:y[Me].title,displayData:y[Me].title,allowOverlay:!1}));Ab([Ce,...se],te,C)}};if(B&&En!==void 0){if(Y.current!==void 0){let se=En(Y.current.range,Kn.current.signal);typeof se!="object"&&(se=await se()),Z(se,Uo(Y.current.range.x-X,Y.current.range.x+Y.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,Y,ci.copy,X,w,rt]);$n("copy",lu,d,!1,!1);const cR=v.useCallback(async C=>{var B,U;if(!(!ci.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),Y.current!==void 0)){let K={current:{cell:Y.current.cell,range:Y.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,Y,ci.cut,lu,j]);$n("cut",cR,d,!1,!1);const fR=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)??[],xf=v.useRef(xn);xf.current=xn,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]))&&xf.current(vf,wf),Rt.current=!1},[vf,wf]);const Lw=Y.current!==void 0&&(Y.current.cell[0]>=pt.length||Y.current.cell[1]>=Xn);v.useLayoutEffect(()=>{Lw&&pr(qf,!1)},[Lw,pr]);const dR=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]),hR=v.useCallback(C=>typeof Mt=="boolean"?Mt:(Mt==null?void 0:Mt(C-X))??!0,[X,Mt]),pR=v.useMemo(()=>{if(Kp===void 0||l.current===null)return null;const{bounds:C,group:z}=Kp,B=l.current.getBoundingClientRect();return v.createElement(PW,{bounds:C,group:z,canvasBounds:B,onClose:()=>Xp(void 0),onFinish:U=>{Xp(void 0),F==null||F(z,U)}})},[F,Kp]),gR=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:xn,remeasureColumns:C=>{for(const z of C)yf(z+X)}}),[Il,yf,lu,ou,Jp,X,xn]);const[Fw,Bw]=Fi??[],mR=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"),xn(z,B))},[me,sr,xn,Fw,Bw,re,ge]),[yR,vR]=v.useState(!1),zw=v.useRef(ST(C=>{vR(C)},5)),wR=v.useCallback(()=>{zw.current(!0),Y.current===void 0&&Y.columns.length===0&&Y.rows.length===0&&a===void 0&&re({cell:[X,ff],range:{x:X,y:ff,width:1,height:1}},!0,!1,"keyboard-select")},[ff,Y,a,X,re]),xR=v.useCallback(()=>{zw.current(!1)},[]),[bR,kR]=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]),SR=v.useMemo(()=>JF(oe),[oe]);return v.createElement(ZF.Provider,{value:oe},v.createElement(KW,{style:SR,className:W,inWidth:x??bR,inHeight:g??kR},v.createElement(AW,{fillHandle:Zt,drawFocusRing:Rn,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:W,enableGroups:Bt,onCanvasFocused:wR,onCanvasBlur:xR,canvasRef:l,onContextMenu:uR,theme:oe,cellXOffset:Do,cellYOffset:ff,accessibilityHeight:wn.height,onDragEnd:sR,columns:pt,nonGrowWidth:Fe,drawHeader:jp,onColumnProposeMove:D,drawCell:Hp,disabledRows:dR,freezeColumns:gR,lockColumns:X,firstColAccessible:X===0,getCellContent:Rr,minColumnWidth:Tr,maxColumnWidth:ui,searchInputRef:o,showSearch:eu,onSearchClose:zp,highlightRegions:YM,getCellsForSelection:En,getGroupDetails:Vp,headerHeight:El,isFocused:yR,groupHeaderHeight:Bt?Za:0,freezeTrailingRows:De+(ln&&(ye==null?void 0:ye.sticky)===!0?1:0),hasAppendRow:ln,onColumnResize:fi,onColumnResizeEnd:$p,onColumnResizeStart:Ml,onCellFocused:mR,onColumnMoved:rR,onDragStart:iR,onHeaderMenuClick:tR,onItemHovered:Qp,isFilling:(a==null?void 0:a.fillHandle)===!0,onMouseMove:eR,onKeyDown:ou,onKeyUp:$e,onMouseDown:QM,onMouseUp:ZM,onDragOverCell:Un,onDrop:lt,onSearchResultsChanged:fR,onVisibleRegionChanged:nR,clientSize:Ae,rowHeight:ir,searchResults:ue,searchValue:xe,onSearchValueChange:ce,rows:Xn,scrollRef:c,selection:Y,translateX:wn.tx,translateY:wn.ty,verticalBorder:hR,gridRef:gr,getCellRenderer:Te}),pR,i!==void 0&&v.createElement(v.Suspense,{fallback:null},v.createElement(JW,{...i,validateCell:tu,bloom:P,id:aR,getCellRenderer:Te,className:(on==null?void 0:on.isSubGrid)===!0?"click-outside-ignore":void 0,provideEditor:Ue,imageEditorOverride:h,onFinishEditing:lR,markdownDivCreateNode:m,isOutsideClick:of}))))},n6=v.forwardRef(t6),Ob=20,r6={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=>i6(t,t.cell.data,v0(t.cell),t.cell.maxSize??Ob),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??Ob,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:xE(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 i6(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,x=.35;let g=n?1-x+x*s:.4;e===ah&&(g*=s),g!==0&&(i.globalAlpha=g,Yv(i,o,e,d,h,p,m,a,u,c,r,f),i.globalAlpha=1)}const s6=Wr("div")({name:"BubblesOverlayEditorStyle",class:"gdg-b1ygi5by",propsAsIs:!1}),o6=t=>{const{bubbles:e}=t;return v.createElement(s6,null,e.map((n,r)=>v.createElement("div",{key:r,className:"boe-bubble"},n)),v.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},l6={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=>u6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return v.createElement(o6,{bubbles:e.data})},onPaste:()=>{}},a6=4;function u6(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=a6;let h=o+r.cellHorizontalPadding;const p=[];for(const m of e){if(h>o+a)break;const x=Xc(m,i,r.baseFontFull).width;p.push({x:h,width:x}),h+=x+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,x]of p.entries())i.beginPath(),i.fillStyle=r.textBubble,i.fillText(e[m],x.x+f,l+u/2+Is(i,r))}const c6=Wr("div")({name:"DrilldownOverlayEditorStyle",class:"gdg-d4zsq0x",propsAsIs:!1}),f6=t=>{const{drilldowns:e}=t;return v.createElement(c6,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))))},d6={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=>g6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return v.createElement(f6,{drilldowns:e.data})},onPaste:()=>{}},h6=4,Kg={};function p6(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 g6(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,x=h6;let g=a+r.cellHorizontalPadding;const y=r.roundingRadius??6,w=p6(r.bgCell,r.drilldownBorder,d,y),k=[];for(const b of e){if(g>a+u)break;const T=Xc(b.text,i,c).width;let E=0;b.img!==void 0&&s.loadOrGetImage(b.img,o,l)!==void 0&&(E=p-8+4);const A=T+E+m*2;k.push({x:g,width:A}),g+=A+x}if(w!==null){const{el:b,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(b,0,0,E,S,ee-N,h,P,d),ie>0&&i.drawImage(b,E,0,T,S,ee+(P-N),h,ie,d),i.drawImage(b,A-E,0,E,S,ee+ne-(P-N),h,P,d),i.imageSmoothingEnabled=!0}}i.beginPath();for(const[b,S]of k.entries()){const T=e[b];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 m6={getAccessibilityString:t=>t.data.join(", "),kind:Se.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>y6(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??lF;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 y6(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 x=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 v6(t,e){let n=t*49632+e*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}const w6={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(v6(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:()=>{}},x6=()=>t=>t.targetWidth,Pb=Wr("div")({name:"MarkdownOverlayEditorStyle",class:"gdg-m1pnx84e",propsAsIs:!1,vars:{"m1pnx84e-0":[x6(),"px"]}}),b6=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(Pb,{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(eF,null))):v.createElement(Pb,{targetWidth:s.width},v.createElement(EF,{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}))},k6={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(b6,{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}},S6={getAccessibilityString:t=>t.row.toString(),kind:Jr.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:C6,measure:()=>44,draw:t=>E6(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 C6(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=T6,n.textAlign="center",s}function T6(t){const{ctx:e}=t;e.textAlign="start"}function E6(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(Yv(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 x of[3,6])for(const g of[-5,-1,3])o.rect(c+x,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(),x=u.markerFontFull,g=c+d/2;r==="both"&&a!==0&&(o.globalAlpha=1-a),o.fillStyle=u.textLight,o.font=x,o.fillText(m,g,f+h/2+Is(o,x)),a!==0&&(o.globalAlpha=1)}}const A6={getAccessibilityString:()=>"",kind:Jr.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>M6(t,t.cell.hint,t.cell.icon),onPaste:()=>{}};function M6(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,x=a+8/2,g=u+8/2;l.drawSprite(n,"normal",r,x,g,m,o,d?1:s),h=m}else{h=24;const p=12,m=d?p:s*p,x=d?0:(1-s)*p*.5,g=o.cellHorizontalPadding+4;m>0&&(r.moveTo(a+g+x,u+f/2),r.lineTo(a+g+x+m,u+f/2),r.moveTo(a+g+x+m*.5,u+f/2-m*.5),r.lineTo(a+g+x+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 R6=v.lazy(async()=>await XT(()=>import("./number-overlay-editor-Vq5g9w6Z.js"),[])),O6={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(R6,{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}}},P6={getAccessibilityString:()=>"",measure:()=>108,kind:Se.Protected,needsHover:!1,needsHoverPosition:!1,draw:I6,onPaste:()=>{}};function I6(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(Ix(30))*l,f=Math.sin(Ix(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 D6={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 In.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:()=>{}},_6={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,x=Math.min(m,p.actualBoundingBoxAscent*2.5);i.beginPath(),rs(i,s.x+d/2,s.y+(s.height-x)/2+1,p.width+d*3,x-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}},N6=Wr("div")({name:"UriOverlayEditorStyle",class:"gdg-u1rrojo",propsAsIs:!1}),L6=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(N6,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 Ib(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 F6={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=Ib(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 x=Is(l,n.baseFontFull);r("pointer");const g=5,y=h-x;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=VF(o,s.baseFontFull);if(l===void 0)return;const a=Ib(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(L6,{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}},B6=[S6,A6,r6,l6,d6,m6,w6,k6,O6,P6,D6,_6,F6];var z6=kT,$6=gl,j6="Expected a function";function H6(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(j6);return $6(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),z6(t,e,{leading:r,maxWait:e,trailing:i})}var W6=H6;const V6=Ii(W6),Gg=[];class U6 extends WT{constructor(){super(...arguments);xt(this,"imageLoaded",()=>{});xt(this,"loadedLocations",[]);xt(this,"cache",{});xt(this,"sendLoaded",V6(()=>{this.imageLoaded(new Ju(this.loadedLocations)),this.loadedLocations=[]},20));xt(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=Si(r,i);return o.cells.includes(l)||o.cells.push(l),o.img}else this.loadImage(n,r,i,s)}}const qg="\uFEFF";function K6(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 X6(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]===` +`&&t[r]!=="\r";)r++;return[t.slice(e,r),r]}function qc(t,e){const n=t.startsWith(qg),r=n?t.slice(qg.length):t,i=n?qg.length:0,s=e??K6(r),o=[],l=[];let a=[],u=0,c=0,f=!1;for(;c=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),x=p.map(g=>g.length===h?g:g.length>h?g.slice(0,h):[...g,...Array(h-g.length).fill("")]);return{headers:d,rows:x,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 X6(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 bE(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 G6(t,e){return t[e]==="\r"?t[e+1]===` +`)||r.includes("\r")?`"${r}"`:r;return t.map(n).join(e)}function Yg(t,e,n=","){return[t,...e].map(r=>wp(r,n)).join(` +`)}function Zv(t,e){return qc(t,e).headers}function G6(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 bE(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 q6(t,e){return t[e]==="\r"?t[e+1]===` `?2:1:t[e]===` `?1:0}function Db(t,e){return t[e-2]==="\r"&&t[e-1]===` `?2:t[e-1]==="\r"||t[e-1]===` -`?1:0}const _b="\uFEFF";function kE(t,e){const n=t.startsWith(_b)?_b.length:0,r=e.rowSpans[0];if(r!==void 0)return{start:n,end:r.start-Db(t,r.start)};const i=t.slice(n);return{start:n,end:n+i.length-Db(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+G6(t,i.end),replacement:""}));return r.length===0?t:bE(t,r)}function Nb(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 bE(t,s)}function Y6(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 q6(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 Q6(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 J6(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 Z6(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 Lb=/^[+-]?\d{16,}$/;function e9(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(Lb.test(a)&&Lb.test(u)){const x=BigInt(a),g=BigInt(u);return s*(xg?1:0)}return s*(d-h)}return s*a.localeCompare(u)})}const n9=` +`?1:0}const _b="\uFEFF";function kE(t,e){const n=t.startsWith(_b)?_b.length:0,r=e.rowSpans[0];if(r!==void 0)return{start:n,end:r.start-Db(t,r.start)};const i=t.slice(n);return{start:n,end:n+i.length-Db(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+q6(t,i.end),replacement:""}));return r.length===0?t:bE(t,r)}function Nb(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 bE(t,s)}function Y6(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 Q6(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 J6(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 Z6(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 e9(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 Lb=/^[+-]?\d{16,}$/;function t9(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(Lb.test(a)&&Lb.test(u)){const x=BigInt(a),g=BigInt(u);return s*(xg?1:0)}return s*(d-h)}return s*a.localeCompare(u)})}const r9=` -`;function qf(t,e){return Math.max(0,Math.min(t,e))}function Fb(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),x=[];for(let g=h;gw[f+b]??""))}x.length!==0&&s.push(qg(m,x,t.delimiter))}if(s.length>0)return s.join(n9);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 Bb=24,Jg=26,zb=110,Zg=40,r9=12,Bn=1,$b='ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',jb='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';function Hb(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 i9(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:jb,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:jb,lineHeight:1}}function s9(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),x=v.useRef(p);x.current=p;const g=v.useRef(null),[y,w]=v.useState(null),[k,b]=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(()=>i9(r),[r]),ne=s9(r),ie=r?"hsl(240 3.7% 15.9%)":"hsl(240 4.8% 95.9%)",W=v.useRef();W.current===void 0&&(W.current=new V6);const Y=v.useMemo(()=>Yc(t,e),[t,e]),R=v.useMemo(()=>X6(Y),[Y]),O=Y.headers.length,F=v.useRef({text:t,table:Y});F.current={text:t,table:Y};const L=v.useRef(T);L.current=T,v.useEffect(()=>{const V=window.setTimeout(()=>h(c),150);return()=>window.clearTimeout(V)},[c]);const H=v.useMemo(()=>{const V=e9(Y.rows,d);return p?t9(V,Y.rows,p.col,p.dir,R[p.col]??!1):V},[Y,d,p,R]),$=v.useRef(H);$.current=H,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(zb,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=H.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}})},[H]),v.useEffect(()=>{m(V=>V!==null&&V.col>=O?null:V),w(V=>V!==null&&V.col>=O?null:V)},[O]);const ce=d!=="",xe=Y.rows.length,Ge=Jg+Math.min(H.length,r9)*Bb,$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};b(de),w({col:J,bounds:Ue});return}g.current=x.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}=F.current,ve=Y6(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(()=>H.filter(V=>A.has(V)),[H,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=L.current,pe=Fb(F.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=L.current,ht=Fb(F.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||Hb(pe.target)||Hb(document.activeElement))return;const ht=Z6(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(F.current.text,F.current.table,me))},he=()=>{!D||ut||Ie.length===0||ft(Nb(F.current.text,F.current.table,Ie))},rt=v.useCallback(V=>{if(!i)return!1;const{text:J,table:ve}=F.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}=F.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 ${$b}`,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 ${$b}`}: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=o9(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(_I,{"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?`${H.length.toLocaleString()} of ${xe.toLocaleString()}`:`${xe.toLocaleString()} rows`}),nt&&M.jsxs("span",{className:"flex flex-wrap 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":H.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(t6,{imageWindowLoader:W.current,renderers:F6,columns:ct,rows:H.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:Bb,headerHeight:Jg,freezeColumns:Bn,fillHandle:D,onPaste:D?()=>!0:!1,keybindings:{search:!1},theme:ee,drawHeader:dt,drawCell:fe,getRowThemeOverride:Ze,minColumnWidth:zb,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=>b(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&&H.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&&H.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 o9(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 md:p-6 md:px-16",children:M.jsxs("div",{className:"flex w-full max-w-sm flex-col items-center gap-2.5 md:gap-3",children:[M.jsx("div",{"aria-hidden":"true",className:"flex size-9 items-center justify-center rounded-xl border border-border bg-muted/50 text-muted-foreground md:size-11",children:M.jsx(kI,{className:"size-4 md: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=c9(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 whitespace-nowrap 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 whitespace-nowrap 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(LI,{"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 Wb(t){return t>=127462&&t<=127487}const Vb=8205;function h9(t,e,n=!0,r=!0){return(n?TE:p9)(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+=Ub(r);e=0&&Wb(em(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function p9(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 Ub(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=g9(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 m9(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new kn(Kb(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,Kb(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=` +`;function Yf(t,e){return Math.max(0,Math.min(t,e))}function Fb(t,e,n,r){const i=t.headers.length,s=[];for(const a of n.ranges){const u=Yf(a.x,r+i),c=Yf(a.x+a.width,r+i);if(c<=r)continue;const f=u-r,d=c-r;if(d<=f)continue;const h=Yf(a.y,e.length),p=Yf(a.y+a.height,e.length);if(p<=h)continue;const m=t.headers.slice(f,d),x=[];for(let g=h;gw[f+b]??""))}x.length!==0&&s.push(Yg(m,x,t.delimiter))}if(s.length>0)return s.join(r9);const o=[...n.rows].filter(a=>a>=0&&ae[a]).filter(a=>a!==void 0);if(o.length>0)return Yg(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 Yg(a,u,t.delimiter)}return null}const Bb=24,Jg=26,zb=110,Zg=40,i9=12,Bn=1,$b='ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',jb='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';function Hb(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 s9(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:jb,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:jb,lineHeight:1}}function o9(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),x=v.useRef(p);x.current=p;const g=v.useRef(null),[y,w]=v.useState(null),[k,b]=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(()=>s9(r),[r]),ne=o9(r),ie=r?"hsl(240 3.7% 15.9%)":"hsl(240 4.8% 95.9%)",W=v.useRef();W.current===void 0&&(W.current=new U6);const q=v.useMemo(()=>qc(t,e),[t,e]),R=v.useMemo(()=>G6(q),[q]),O=q.headers.length,F=v.useRef({text:t,table:q});F.current={text:t,table:q};const L=v.useRef(T);L.current=T,v.useEffect(()=>{const V=window.setTimeout(()=>h(c),150);return()=>window.clearTimeout(V)},[c]);const H=v.useMemo(()=>{const V=t9(q.rows,d);return p?n9(V,q.rows,p.col,p.dir,R[p.col]??!1):V},[q,d,p,R]),$=v.useRef(H);$.current=H,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(zb,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=H.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}})},[H]),v.useEffect(()=>{m(V=>V!==null&&V.col>=O?null:V),w(V=>V!==null&&V.col>=O?null:V)},[O]);const ce=d!=="",xe=q.rows.length,Ge=Jg+Math.min(H.length,i9)*Bb,$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};b(de),w({col:J,bounds:Ue});return}g.current=x.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}=F.current,ve=Y6(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(()=>H.filter(V=>A.has(V)),[H,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=L.current,pe=Fb(F.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=L.current,ht=Fb(F.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||Hb(pe.target)||Hb(document.activeElement))return;const ht=e9(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(F.current.text,F.current.table,me))},he=()=>{!D||ut||Ie.length===0||ft(Nb(F.current.text,F.current.table,Ie))},rt=v.useCallback(V=>{if(!i)return!1;const{text:J,table:ve}=F.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}=F.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 ${$b}`,textDark:"hsla(240, 3.8%, 46.1%, 0.4)"}},pe=q.headers.map((J,ve)=>({title:J.toUpperCase(),id:`c${ve}`,width:ue,themeOverride:R[ve]?{baseFontStyle:`12px ${$b}`}:void 0}));return[V,...pe]},[q.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=l9(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(NI,{"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?`${H.length.toLocaleString()} of ${xe.toLocaleString()}`:`${xe.toLocaleString()} rows`}),nt&&M.jsxs("span",{className:"flex flex-wrap 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":H.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(n6,{imageWindowLoader:W.current,renderers:B6,columns:ct,rows:H.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:Bb,headerHeight:Jg,freezeColumns:Bn,fillHandle:D,onPaste:D?()=>!0:!1,keybindings:{search:!1},theme:ee,drawHeader:dt,drawCell:fe,getRowThemeOverride:Ze,minColumnWidth:zb,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 ${q.headers[y.col]??""}`,value:k,onChange:V=>b(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&&H.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&&H.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 l9(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 md:p-6 md:px-16",children:M.jsxs("div",{className:"flex w-full max-w-sm flex-col items-center gap-2.5 md:gap-3",children:[M.jsx("div",{"aria-hidden":"true",className:"flex size-9 items-center justify-center rounded-xl border border-border bg-muted/50 text-muted-foreground md:size-11",children:M.jsx(SI,{className:"size-4 md: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=f9(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 whitespace-nowrap 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(Y2,{"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 whitespace-nowrap 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(FI,{"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 Wb(t){return t>=127462&&t<=127487}const Vb=8205;function p9(t,e,n=!0,r=!0){return(n?TE:g9)(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+=Ub(r);e=0&&Wb(em(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function g9(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 Ub(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=m9(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 y9(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new kn(Kb(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,Kb(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 g9(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 m9{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 h9(t,e,n,r)}function y9(t){return t>=56320&&t<57344}function v9(t){return t>=55296&&t<56320}function w9(t,e){let n=t.charCodeAt(e);if(!v9(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return y9(r)?(n-55296<<10)+(r-56320)+65536:n}function x9(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 Pn 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 Pn(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?!Xb(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(x=>x instanceof Be?d.facet(x)===f.facet(x):x instanceof as?d.field(x,!1)==f.field(x,!1):!0)||(l?Xb(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 Xb(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 k9(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(x=>x.type==0))if(l[p.id]=a.length<<1|1,tw(m,h))a.push(r.facet(p));else{let x=p.combine(h.map(g=>g.value));a.push(r&&p.compare(x,r.facet(p))?r.facet(p):x)}else{for(let x of h)x.type==0?(l[x.id]=a.length<<1|1,a.push(x.value)):(l[x.id]=u.length<<1,u.push(g=>x.dynamicSlot(g)));l[p.id]=u.length<<1,u.push(x=>b9(x,p,h))}}let f=u.map(d=>d(l));return new kh(e,o,f,l,a,s)}}function k9(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 S9}}class S9{of(e){return new Ro(this,e)}}class C9{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 C9(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 _n{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==_n.time)||(this.annotations=s.concat(_n.time.of(Date.now())))}static create(e,n,r,i,s,o){return new _n(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(_n.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}_n.time=Ro.define();_n.userEvent=Ro.define();_n.addToHistory=Ro.define();_n.remote=Ro.define();function T9(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 _n?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof _n?t=s[0]:t=$E(e,ga(s),!1)}return t}function A9(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:_n.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const M9=[];function ga(t){return t==null?M9: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 R9=/[\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 O9(t){if(U0)return U0.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||R9.test(n)))return!0}return!1}function P9(t){return e=>{if(!/\S/.test(e))return Ss.Space;if(O9(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 P9(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=Gb(o,l,r),u=new Cu(o,a,s),c=new Cu(l,a,s);r.iterGaps((f,d,h)=>Yb(u,f,c,d,h,i)),r.empty&&r.length==0&&Yb(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=Gb(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?I9(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 I9(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 Gb(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=qb(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=qb(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 Yb(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 qb(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="ͼ",Qb=typeof Symbol>"u"?"__"+Y0:Symbol.for(Y0),q0=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Jb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class bo{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(x=>m.replace(/&/,x))).reduce((m,x)=>m.concat(x)),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=Jb[Qb]||1;return Jb[Qb]=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 _9(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let Zb=new Map;class _9{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Zb.get(r);if(s)return e[q0]=s;this.sheet=new i.CSSStyleSheet,Zb.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:'"'},N9=typeof navigator<"u"&&/Mac/.test(navigator.platform),L9=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 F9(t){var e=N9&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||L9&&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:bp,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 B9(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 z9(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?ri.WidgetRange:this.startSide<=0?ri.WidgetBefore:ri.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof cl&&$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)}}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 $9(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 j9(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 H9(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=j9(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 x=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+x&&(x=e.right-d.right+s)):e.right>d.right-s&&(x=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 W9{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 V9(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function U9(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 x=ji[m+2],g=x&2?i:x&4?x&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 x=l-3;x>=0;x-=3){let g=ji[x+2];if(g&2)break;if(m)ji[x+2]|=2;else{if(g&4)break;ji[x+2]|=4}}}}}function Q9(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==x&&(p=n[--m].from,x=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 x=m.direction==fl!=!(h%2);iy(t,x?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 x=m.from,g=u;;){if(x==e)break e;if(g&&s[g-1].to==x)x=s[--g].from;else{if(Xt[x-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 Z9(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)}),tV=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 Zr(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 xs=Be.define({combine:t=>t.length?t[0]:!0});let nV=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 li.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(Zr(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){Zr(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){Zr(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=eV(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 ei{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new ei(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 ei(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 rV=[];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 rV}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&&B9(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&&sV(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):iV(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 iV(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=nc(e);return n[n.length-1]||null}function sV(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 oV{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 lV(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 uV{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=dV(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=hV(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:z9(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 dV(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 hV(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 pV(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 ei(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:!SV(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?mV(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;r=new ei(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=wV(o,this.decorations,e.changes);a.length&&(r=ei.extendWithRanges(r,a));let u=bV(l,this.blockWrappers,e.changes);return u.length&&(r=ei.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 fV(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&&gV(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)&&kV(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=yV(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],x=d+m.length,g=m.dom.getBoundingClientRect(),{height:y}=g;if(h&&!p&&(u+=g.top-h.top),m instanceof Ts)x>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 b=k[k.length-1],S=a?b.right-g.left:g.right-b.left;S>l&&(l=S,this.minWidth=s,this.minWidthFrom=d,this.minWidthTo=x)}}h&&p==f.children.length-1&&(u+=h.bottom-g.bottom),d=x+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){Zr(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(H9(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 gV(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 xA(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 mV(t,e,n){let r=xA(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 ei(a.mapPos(s),a.mapPos(o),s,o),text:i}}function yV(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 CV(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+D9(o,s,t.state.tabSize)}function EV(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==ri.Text&&(i.type!=s.type||(n<0?s.frome)))&&(i=s)}}return i||r}return r}function AV(t,e,n,r){let i=EV(t,e.head,e.assoc||-1),s=!r||i.type!=ri.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=Z9(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 MV(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 RV(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,x=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==ri.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==ri.Text){let f=TV(t,i,u,o,l);return new Yi(f,f==u.from?1:-1)}}if(u.type!=ri.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 OV(t,o,l,t.textDirectionAt(u.from)).scanTile(c,u.from)}class OV{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 x=n(m),g=0;if(x)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 PV{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)&&!DV(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+(IV(e,r.node,r.offset)?n:0))}}function IV(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?[]:LV(e),u=new PV(a,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=FV(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(xs)||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=bA(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=NV(t,e,n));return t.state.facet(cA).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function NV(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&&xA(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,x=m-c.length;if(t.state.sliceDoc(x,m)!=c||m>=f.from&&x<=f.to)return{range:p};let g=i.changes({from:x,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 LV(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 FV(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 BV{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&&eU(e.contentDOM.ownerDocument)}handleEvent(e){!XV(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&&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||jV.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)&&zV(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 zV(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){Zr(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 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"}],jV="dthko",EA=[16,17,18,20,91,92,224,225],td=6;function nd(t){return Math.max(0,t)*.7+8}function HV(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class WV{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)&&VV(e,n),this.dragging=KV(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&&HV(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=bA(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 VV(t,e){let n=t.state.facet(oA);return n.length?n[0](e):Ee.mac?e.metaKey:e.ctrlKey}function UV(t,e){let n=t.state.facet(lA);return n.length?n[0](e):Ee.mac?!e.altKey:!e.ctrlKey}function KV(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 XV(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 GV(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=qV(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new WV(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 CV(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 qV(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=QV(i,a.pos))?u:l?i.addRange(c):le.create([c])}}}function QV(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&&UV(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):(GV(t),!1)};function JV(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 ZV(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}=ZV(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):(JV(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 eU(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 xk(){Da=!1}class tU{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 Ci(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 iU 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&&bk(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 bk(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 sU=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=sU)&&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 uU(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function cU(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 tU(r),this.stateDeco=Ck(n),this.heightMap=cr.empty().applyChanges(this.stateDeco,Pt.empty,this.heightOracle.setDoc(n.doc),[new ei(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=ei.extendWithRanges(i,oU(r,this.stateDeco,e?e.changes:Pn.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);xk(),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(tV)&&(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:b,scaleY:S}=XE(n,l);(b>.005&&Math.abs(this.scaleX-b)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=b,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?cU:aU)(n,this.paddingTop),x=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&&!uU(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 b=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(b)&&(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),b),o&&(e.docView.minWidth=0,u|=16)}x>0&&g>0?c=Math.max(x,g):x<0&&g<0&&(c=Math.min(x,g)),xk();for(let S of this.viewports){let T=S.from==this.viewport.from?b:e.docView.measureVisibleLineHeights(S);this.heightMap=(o?cr.empty().applyChanges(this.stateDeco,Pt.empty,this.heightOracle,[new ei(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new nU(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(!x){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;x=new um(c,f,g,y)}l.push(x)},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 dU(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 hU(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 Ci(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=bo.newName(),_A=bo.newName(),NA=bo.newName(),LA={"&light":"."+_A,"&dark":"."+NA};function fy(t,e,n){return new bo(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 pU=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),gU={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},cm=Ee.ie&&Ee.ie_version<=11;class mU{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new W9,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 vU(e),e.state.facet(xs)&&(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(xs)?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&&yU(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 _V(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(xs)!=e.state.facet(xs)&&(e.view.contentDOM.editContext=e.state.facet(xs)?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 yU(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 vU{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||V9(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 mU(this),this.inputState=new BV(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 _n?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){Zr(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 Zr(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(xs)?"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);bo.mount(this.root,this.styleModules.concat(pU).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=>MV(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 AV(this,e,n,r)}moveVertically(e,n,r){return am(this,e,RV(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>wU)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=J9(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 li.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return li.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=bo.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=xs;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 wU=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 xU=Ee.mac?"mac":Ee.windows?"win":Ee.linux?"linux":"key";function bU(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 CU=4e3;function TU(t,e=xU){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=>bU(g,e));for(let g=1;g{let k=to={view:w,prefix:y,scope:o};return setTimeout(()=>{to==k&&(to=null)},CU),!0}]})}let m=p.join(" ");i(m,!1);let x=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&&x.run.push(a),u&&(x.preventDefault=!0),c&&(x.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 EU(t,e,n,r){dy=e;let i=F9(e),s=w9(i,0),o=x9(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=x=>{if(x){for(let g of x.run)if(!f.has(g)&&(f.add(g),g(n)))return x.stopPropagation&&(c=!0),!0;x.preventDefault&&(x.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 AU 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 MU(t){let e=li.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Ht.set([Ht.widget({widget:new AU(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 RU(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)||RU}}}),Ok=new WeakMap,zA=li.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,x=(e=Ok.get(u))!==null&&e!==void 0?e:d.bottom-d.top,g=u.offset||PU,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-x-p-g.yr.bottom)&&k==r.bottom-f.bottom>f.top-r.top&&(k=this.above[l]=!k);let b=(k?f.top-r.top:r.bottom-f.bottom)-p;if(bw&&E.topS&&(S=k?E.top-x-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+x}),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 OU=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"}}}),PU={x:0,y:0},$A=Be.define({enables:[zA,OU]}),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 IU=$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)}}),DU=Be.define();class _U{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=>Zr(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&&!NU(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:!LU(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 NU(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 LU(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 FU(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(BU)&&!u.value||u.value==i)&&(o=[]);return o.length&&a&&r.set(o,a),o},provide:o=>Ih.from(o)});const s=li.define(o=>new _U(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,DU.of(s),IU]}}const BU=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}}}),zU=li.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:zU});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 $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 jU=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):jU,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 UU(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 HU(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 ii(h.tree,f,e,o);let p=new ii(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 ii(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 HU{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 ii(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 ii)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer: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 ii?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer: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 UU(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(b,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-b);return}else if(D==-3){u=_;return}else if(D==-4){c=_;return}else throw new RangeError(`Unrecognized record size: ${D}`);let ie=a[_],W,Y,R=P-b;if(N-P<=i&&(Y=x(l.pos-S,A))){let O=new Uint16Array(Y.size-Y.skip),F=l.pos-Y.size,L=O.length;for(;l.pos>F;)L=g(Y.start,O,L);W=new Co(O,N-Y.start,r),R=Y.start-b}else{let O=l.pos-D;l.next();let F=[],L=[],H=_>=o?_:-1,$=0,ue=N;for(;l.pos>O;)H>=0&&l.id==H&&l.size>=0?(l.end<=ue-i&&(p(F,L,P,$,l.end,ue,H,ee,ne),$=F.length,ue=l.end),l.next()):I>2500?d(P,O,F,L):f(P,O,F,L,H,I+1);if(H>=0&&$>0&&$-1&&$>0){let ce=h(ie,ne);W=ww(ie,F,L,0,F.length,0,N-P,ce,ce)}else W=m(ie,F,L,N-P,ee-N,ne)}T.push(W),E.push(R)}function d(b,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-b)}}function h(b,S){return(T,E,A)=>{let I=0,_=T.length-1,P,N;if(_>=0&&(P=T[_])instanceof Cn){if(!_&&P.type==b&&P.length==A)return P;(N=P.prop(Ct.lookAhead))&&(I=E[_]+P.length+N)}return m(b,T,E,A,I,S)}}function p(b,S,T,E,A,I,_,P,N){let D=[],ee=[];for(;b.length>E;)D.push(b.pop()),ee.push(S.pop()+T-A);b.push(m(r.types[_],D,ee,I-A,P-I,N)),S.push(A-T)}function m(b,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(b,S,T,E,_)}function x(b,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-b;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==b)&&(P.size=E,P.start=A,P.skip=I),P.size>4?P:void 0}function g(b,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(b,S,T)}S[--T]=P,S[--T]=I-b,S[--T]=A-b,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-b;f.push(ww(t,p,m,k,w,b,T,null,a))}d.push(b+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 KU{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 XU=0;class qr{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=XU++}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 qr&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new qr(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 GU=0;class Dh{constructor(e){this.name=e,this.instances=[],this.id=GU++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&YU(n,l.modified));if(r)return r;let i=[],s=new qr(e.name,i,e,n);for(let l of n)l.instances.push(s);let o=qU(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 YU(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function qU(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 QU(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function JU(t,e,n,r=0,i=t.length){let s=new ZU(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class ZU{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=e7(e)||Dc.empty,f=QU(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(x=>!x.scope||x.scope(d.tree.type)),m=e.firstChild();for(let x=0,g=l;;x++){let y=x=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 e7(t){let e=t.type.prop(XA);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const we=qr.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:qr.defineModifier("definition"),constant:qr.defineModifier("constant"),function:qr.defineModifier("function"),standard:qr.defineModifier("standard"),local:qr.defineModifier("local"),special:qr.defineModifier("special")};for(let t in He){let e=He[t];e instanceof qr&&(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 t7(t){return Be.define({combine:t?e=>e.concat(t):void 0})}const n7=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(n7);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 r7{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 r7(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,i7=li.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=>Zr(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,i7,We.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class s7{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const o7=Be.define(),xw=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(xw);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Fh(t,e){let n="",r=t.tabSize,i=t.facet(xw)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s=e?l7(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 xp(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 l7(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=u7(r.node);if(i)return i(bw.create(e,n,r))}return 0}function a7(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function u7(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=>h7(o,!0,1,void 0,s&&!a7(o)?i.from:void 0)}return t.parent==null?c7:null}function c7(){return 0}class bw 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 bw(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(f7(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 f7(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function d7(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 h7(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=d7(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 p7=new Ct;function g7(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 bo(r):null,this.themeType=n.themeType}static define(e,n){return new Mp(e,n||{})}}const yy=Be.define(),m7=Be.define({combine(t){return t.length?[t[0]]:null}});function mm(t){let e=t.facet(yy);return e.length?e:t.facet(m7)}function Hk(t,e){let n=[v7],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 y7{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)JU(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 v7=nw.high(li.fromClass(y7,{decorations:t=>t.decorations})),w7=1e4,x7="()[]{}",b7=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(b7);return e?e(t.node):t}function la(t,e,n,r={}){let i=r.maxScanDistance||w7,s=r.brackets||x7,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 k7(t,e,n,a,c,u,s)}}return S7(t,e,n,o,l.type,i,s)}function k7(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,x=n>0?h.length:-1;m!=x;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 C7=Object.create(null),Wk=[Cr.none],Vk=[],Uk=Object.create(null),T7=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"]])T7[t]=E7(C7,e);function ym(t,e){Vk.indexOf(t)>-1||(Vk.push(t),console.warn(e))}function E7(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 A7=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Sw(t.state,n.from);return r.line?M7(t):r.block?O7(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 M7=kw(D7,0),R7=kw(ZA,0),O7=kw((t,e)=>ZA(t,e,I7(e)),0);function Sw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Au=50;function P7(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 I7(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)=>P7(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 xy=Ro.define(),_7=Ro.define(),N7=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(xy);if(r){let a=xr.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(_7);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(_n.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=xr.fromTransaction(e),o=e.annotation(_n.time),l=e.annotation(_n.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(xr.fromJSON),t.undone.map(xr.fromJSON))}});function L7(t={}){return[tM,eM.of(t),We.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?nM:e.inputType=="historyRedo"?by: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),by=Rp(1,!1),F7=Rp(0,!0),B7=Rp(1,!0);class xr{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 xr(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 xr(e.changes&&Pn.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=ti;for(let i of e.startState.facet(N7)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new xr(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ti)}static selection(e){return new xr(void 0,ti,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 z7(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 rM(t,e){return t.length?e.length?t.concat(e):t:e}const ti=[],j7=200;function iM(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-j7));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Bh(t,t.length-1,1e9,n.setSelAfter(r)))}else return[xr.selection([e])]}function H7(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=ti;for(;n;){let i=W7(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?[xr.selection(r)]:ti}function W7(t,e,n){let r=rM(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ti,n);if(!t.changes)return xr.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new xr(i,Gt.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const V7=/^(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||V7.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 K7=t=>aM(t,!rr(t)),X7=t=>aM(t,rr(t));function G7(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;G7(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 Y7=t=>_i(t,e=>Pp(t.state,e,!rr(t))),q7=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 Q7=t=>_i(t,e=>Oo(t,e,!0)),J7=t=>_i(t,e=>Oo(t,e,!1)),Z7=t=>_i(t,e=>Oo(t,e,!rr(t))),eK=t=>_i(t,e=>Oo(t,e,rr(t))),tK=t=>_i(t,e=>le.cursor(t.lineBlockAt(e.head).from,1)),nK=t=>_i(t,e=>le.cursor(t.lineBlockAt(e.head).to,-1));function rK(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.headrK(t,e);function ai(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 ai(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 ai(t,e,n=>t.moveByGroup(n,e))}const sK=t=>yM(t,!rr(t)),oK=t=>yM(t,rr(t)),lK=t=>{let e=!rr(t);return ai(t,e,n=>Pp(t.state,n,e))},aK=t=>{let e=rr(t);return ai(t,e,n=>Pp(t.state,n,e))};function vM(t,e){return ai(t,e,n=>t.moveVertically(n,e))}const wM=t=>vM(t,!1),xM=t=>vM(t,!0);function bM(t,e){return ai(t,e,n=>t.moveVertically(n,e,dM(t).height))}const Xk=t=>bM(t,!1),Gk=t=>bM(t,!0),uK=t=>ai(t,!0,e=>Oo(t,e,!0)),cK=t=>ai(t,!1,e=>Oo(t,e,!1)),fK=t=>{let e=!rr(t);return ai(t,e,n=>Oo(t,n,e))},dK=t=>{let e=rr(t);return ai(t,e,n=>Oo(t,n,e))},hK=t=>ai(t,!1,e=>le.cursor(t.lineBlockAt(e.head).from)),pK=t=>ai(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),gK=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),mK=({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},yK=({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 vK=t=>kM(t,!1),wK=t=>kM(t,!0),xK=({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),bK=t=>TM(t,!0),kK=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)}),CK=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},EK=({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 AK=({state:t,dispatch:e})=>AM(t,e,!1),MK=({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 RK=({state:t,dispatch:e})=>MM(t,e,!1),OK=({state:t,dispatch:e})=>MM(t,e,!0),PK=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 IK(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),DK=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&&IK(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=xp(/^\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 _K=({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(xw)})}),{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=xp(i,t.tabSize),o=0,l=Fh(t,Math.max(0,s-Lh(t)));for(;o(t.setTabFocusMode(),!0),LK=[{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:xM},{key:"Ctrl-a",run:tK,shift:hK},{key:"Ctrl-e",run:nK,shift:pK},{key:"Ctrl-d",run:CM},{key:"Ctrl-h",run:Sy},{key:"Ctrl-k",run:kK},{key:"Ctrl-Alt-h",run:EM},{key:"Ctrl-o",run:TK},{key:"Ctrl-t",run:EK},{key:"Ctrl-v",run:ky}],FK=[{key:"ArrowLeft",run:oM,shift:gM,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:K7,shift:sK,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Z7,shift:fK,preventDefault:!0},{key:"ArrowRight",run:lM,shift:mM,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:X7,shift:oK,preventDefault:!0},{mac:"Cmd-ArrowRight",run:eK,shift:dK,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:xM,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:J7,shift:cK,preventDefault:!0},{key:"Mod-Home",run:Yk,shift:Qk},{key:"End",run:Q7,shift:uK,preventDefault:!0},{key:"Mod-End",run:qk,shift:Jk},{key:"Enter",run:Zk,shift:Zk},{key:"Mod-a",run:gK},{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:bK,preventDefault:!0},{mac:"Mod-Backspace",run:SK,preventDefault:!0},{mac:"Mod-Delete",run:CK,preventDefault:!0}].concat(LK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),BK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Y7,shift:lK},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:q7,shift:aK},{key:"Alt-ArrowUp",run:AK},{key:"Shift-Alt-ArrowUp",run:RK},{key:"Alt-ArrowDown",run:MK},{key:"Shift-Alt-ArrowDown",run:OK},{key:"Mod-Alt-ArrowUp",run:vK},{key:"Mod-Alt-ArrowDown",run:wK},{key:"Escape",run:xK},{key:"Mod-Enter",run:DK},{key:"Alt-l",mac:"Ctrl-l",run:mK},{key:"Mod-i",run:yK,preventDefault:!0},{key:"Mod-[",run:PM},{key:"Mod-]",run:OM},{key:"Mod-Alt-\\",run:_K},{key:"Shift-Mod-k",run:PK},{key:"Shift-Mod-\\",run:iK},{key:"Mod-/",run:A7},{key:"Alt-A",mac:"Ctrl-A",run:R7},{key:"Ctrl-m",mac:"Shift-Alt-m",run:NK}].concat(FK),zK={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 $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 jK{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;HK(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 HK(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||WK(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],x=t[p+1]||65536;if(c=x)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 WK(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 VK{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 UK{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 VK(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&&GK(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 KK(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 YK=KA({String:He.string,Number:He.number,"True False":He.bool,PropertyName:He.propertyName,Null:He.null,", :":He.separator,"[ ]":He.squareBracket,"{ }":He.brace}),qK=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:[YK],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}),QK=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=JK(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function JK(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 ZK=_h.define({name:"json",parser:qK.configure({props:[QA.add({Object:jk({except:/^\s*\}/}),Array:jk({except:/^\s*\]/})}),p7.add({"Object Array":g7})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function lS(){return new s7(ZK)}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,x;if(l.length)m=a,x=l.reduce((w,k)=>Math.min(w,k.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;x=p.to,l.push(p),h++}for(;hw.from||w.to==m))l.push(w),h++,x=Math.min(w.to,x);else{x=Math.min(w.from,x);break}}x=Math.min(x,f);let g=!1;if(l.some(w=>w.from==m&&(w.to==x||x==f))&&(g=m==x,!g&&x-m<10)){let w=m-(c+u.value.length);w>0&&(u.next(w),c=m);for(let k=m;;){if(k>=x){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=hX(l);if(g)o.add(m,m,Ht.widget({widget:new uX(y),diagnostics:l.slice()}));else{let w=l.reduce((k,b)=>b.markClass?k+" "+b.markClass:k,"");o.add(m,x,Ht.mark({class:"cm-lintRange cm-lintRange-"+y+w,diagnostics:l.slice(),inclusiveEnd:l.some(k=>k.to>x)}))}if(a=x,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 eX(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 tX(t,e){return t.field(Ai,!1)?e:e.concat(Gt.appendConfig.of(LM))}function nX(t,e){return{effects:tX(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)]}),rX=Ht.mark({class:"cm-lintRange cm-lintRange-active"});function iX(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)},oX=li.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(nX(this.view.state,r.reduce((i,s)=>i.concat(s))))},r=>{Zr(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 lX(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 aX(t,e={}){return[es.of({source:t,config:e}),oX,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 uX 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 cX(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function yd(t){return cX(``,'width="6" height="3"')}const fX=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 dX(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function hX(t){let e="hint",n=1;for(let r of t){let i=dX(r.severity);i>n&&(n=i,e=r.severity)}return e}const pX=FU(iX,{hideOn:eX}),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([rX.range(e.from,e.to)])}),pX,fX],gX=512*1024,dS=512*1024,FM=2e6;function mX(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 yX=t=>t.state.doc.length>gX?[]:QK()(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 vX=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,x=v.useRef(m),g=t.length>dS,y=v.useRef(g),w=!m&&t.length>FM,k=w?mX(t,dS):t,b=v.useRef(!1),S=v.useCallback((T,E)=>T?[We.updateListener.of(A=>{var I;A.docChanged&&!b.current&&((I=c.current)==null||I.call(c,A.state.doc.toString()))}),...E?[]:[aX(yX,{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,L7(),FA.of([...BK,...U7,zK]),vX,E.of(Hk(hS(r))),A.of(S(m,g)),...i?[MU(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)){b.current=!0;try{T.dispatch({..._!==k?{changes:{from:0,to:T.state.doc.length,insert:k}}:{},...I.length>0?{effects:I}:{}})}finally{b.current=!1}}},[k,g,m,S]),v.useEffect(()=>{const T=u.current,E=h.current;!T||!E||m!==x.current&&(x.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:Br("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-x-2 gap-y-1.5 border-b border-border px-3.5 py-2 max-md:gap-2 md:min-h-12 md:py-1.5 md:pr-2.5 md:pl-3.5 lg:gap-x-3 lg:pr-3 lg:pl-5",children:[M.jsxs("div",{className:"flex items-center gap-2 lg: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,x){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]--),x.unshift(m)}return x}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 x=d.lastIndexOf(` +`){[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 m9(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 y9{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 p9(t,e,n,r)}function v9(t){return t>=56320&&t<57344}function w9(t){return t>=55296&&t<56320}function x9(t,e){let n=t.charCodeAt(e);if(!w9(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return v9(r)?(n-55296<<10)+(r-56320)+65536:n}function b9(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 Pn 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 Pn(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?!Xb(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(x=>x instanceof Be?d.facet(x)===f.facet(x):x instanceof as?d.field(x,!1)==f.field(x,!1):!0)||(l?Xb(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 Xb(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 S9(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(x=>x.type==0))if(l[p.id]=a.length<<1|1,tw(m,h))a.push(r.facet(p));else{let x=p.combine(h.map(g=>g.value));a.push(r&&p.compare(x,r.facet(p))?r.facet(p):x)}else{for(let x of h)x.type==0?(l[x.id]=a.length<<1|1,a.push(x.value)):(l[x.id]=u.length<<1,u.push(g=>x.dynamicSlot(g)));l[p.id]=u.length<<1,u.push(x=>k9(x,p,h))}}let f=u.map(d=>d(l));return new kh(e,o,f,l,a,s)}}function S9(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 C9}}class C9{of(e){return new Ro(this,e)}}class T9{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 T9(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 _n{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==_n.time)||(this.annotations=s.concat(_n.time.of(Date.now())))}static create(e,n,r,i,s,o){return new _n(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(_n.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}_n.time=Ro.define();_n.userEvent=Ro.define();_n.addToHistory=Ro.define();_n.remote=Ro.define();function E9(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 _n?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof _n?t=s[0]:t=$E(e,ga(s),!1)}return t}function M9(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:_n.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const R9=[];function ga(t){return t==null?R9: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 O9=/[\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 P9(t){if(U0)return U0.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||O9.test(n)))return!0}return!1}function I9(t){return e=>{if(!/\S/.test(e))return Ss.Space;if(P9(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 I9(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=Gb(o,l,r),u=new Cu(o,a,s),c=new Cu(l,a,s);r.iterGaps((f,d,h)=>qb(u,f,c,d,h,i)),r.empty&&r.length==0&&qb(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=Gb(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?D9(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 D9(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 Gb(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=Yb(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=Yb(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 qb(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 Yb(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 q0="ͼ",Qb=typeof Symbol>"u"?"__"+q0:Symbol.for(q0),Y0=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Jb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class bo{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(x=>m.replace(/&/,x))).reduce((m,x)=>m.concat(x)),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=Jb[Qb]||1;return Jb[Qb]=e+1,q0+e.toString(36)}static mount(e,n,r){let i=e[Y0],s=r&&r.nonce;i?s&&i.setNonce(s):i=new N9(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let Zb=new Map;class N9{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Zb.get(r);if(s)return e[Y0]=s;this.sheet=new i.CSSStyleSheet,Zb.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Y0]=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:'"'},L9=typeof navigator<"u"&&/Mac/.test(navigator.platform),F9=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 B9(t){var e=L9&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||F9&&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:bp,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 z9(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 $9(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 Yc 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 Yc&&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)}}Yc.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?ri.WidgetRange:this.startSide<=0?ri.WidgetBefore:ri.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof cl&&j9(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 j9(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 H9(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 W9(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=H9(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 x=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+x&&(x=e.right-d.right+s)):e.right>d.right-s&&(x=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 V9{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 qE(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 YE(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=qE(t);t.focus(Wo==null?{get preventScroll(){return Wo={preventScroll:!0},!0}}:void 0),Wo||(Wo=!1,YE(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 U9(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function K9(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 x=ji[m+2],g=x&2?i:x&4?x&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 x=l-3;x>=0;x-=3){let g=ji[x+2];if(g&2)break;if(m)ji[x+2]|=2;else{if(g&4)break;ji[x+2]|=4}}}}}function J9(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==x&&(p=n[--m].from,x=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 x=m.direction==fl!=!(h%2);iy(t,x?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 x=m.from,g=u;;){if(x==e)break e;if(g&&s[g-1].to==x)x=s[--g].from;else{if(Xt[x-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 eV(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)}),nV=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 Zr(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 xs=Be.define({combine:t=>t.length?t[0]:!0});let rV=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 li.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(Zr(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){Zr(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){Zr(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=tV(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 ei{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new ei(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 ei(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 iV=[];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 iV}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&&z9(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&&oV(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):sV(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 sV(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=nc(e);return n[n.length-1]||null}function oV(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 lV{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 aV(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 cV{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=hV(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=pV(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 Yc({tagName:i.nodeName.toLowerCase(),attributes:$9(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 hV(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 pV(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 gV(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 ei(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:!CV(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?yV(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;r=new ei(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=xV(o,this.decorations,e.changes);a.length&&(r=ei.extendWithRanges(r,a));let u=kV(l,this.blockWrappers,e.changes);return u.length&&(r=ei.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 dV(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&&mV(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)&&SV(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=vV(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],x=d+m.length,g=m.dom.getBoundingClientRect(),{height:y}=g;if(h&&!p&&(u+=g.top-h.top),m instanceof Ts)x>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 b=k[k.length-1],S=a?b.right-g.left:g.right-b.left;S>l&&(l=S,this.minWidth=s,this.minWidthFrom=d,this.minWidthTo=x)}}h&&p==f.children.length-1&&(u+=h.bottom-g.bottom),d=x+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){Zr(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(W9(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 mV(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 xA(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 yV(t,e,n){let r=xA(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 ei(a.mapPos(s),a.mapPos(o),s,o),text:i}}function vV(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 TV(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+_9(o,s,t.state.tabSize)}function AV(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==ri.Text&&(i.type!=s.type||(n<0?s.frome)))&&(i=s)}}return i||r}return r}function MV(t,e,n,r){let i=AV(t,e.head,e.assoc||-1),s=!r||i.type!=ri.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=eV(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 RV(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 OV(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,x=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 qi(t.state.doc.length,-1);if(u=t.elementAtHeight(a),r==null)break;if(u.type==ri.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==ri.Text){let f=EV(t,i,u,o,l);return new qi(f,f==u.from?1:-1)}}if(u.type!=ri.Text)return a<(u.top+u.bottom)/2?new qi(u.from,1):new qi(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 PV(t,o,l,t.textDirectionAt(u.from)).scanTile(c,u.from)}class PV{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 x=n(m),g=0;if(x)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 qi(r[i.i+1],-1):new qi(r[i.i],1)}scanTile(e,n){if(!e.length)return new qi(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 qi(r[i.i+1],-1):new qi(o,1)}}const Wl="￿";class IV{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)&&!_V(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+(DV(e,r.node,r.offset)?n:0))}}function DV(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?[]:FV(e),u=new IV(a,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=BV(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(xs)||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=bA(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=LV(t,e,n));return t.state.facet(cA).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function LV(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&&xA(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,x=m-c.length;if(t.state.sliceDoc(x,m)!=c||m>=f.from&&x<=f.to)return{range:p};let g=i.changes({from:x,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 FV(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 BV(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 zV{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&&tU(e.contentDOM.ownerDocument)}handleEvent(e){!GV(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=jV(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||HV.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)&&$V(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 $V(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){Zr(n.state,i)}}}function jV(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"}],HV="dthko",EA=[16,17,18,20,91,92,224,225],td=6;function nd(t){return Math.max(0,t)*.7+8}function WV(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class VV{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)&&UV(e,n),this.dragging=XV(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&&WV(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=bA(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 UV(t,e){let n=t.state.facet(oA);return n.length?n[0](e):Ee.mac?e.metaKey:e.ctrlKey}function KV(t,e){let n=t.state.facet(lA);return n.length?n[0](e):Ee.mac?!e.altKey:!e.ctrlKey}function XV(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 GV(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 qV(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=QV(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new VV(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 TV(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 QV(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=JV(i,a.pos))?u:l?i.addRange(c):le.create([c])}}}function JV(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&&KV(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):(qV(t),!1)};function ZV(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 eU(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}=eU(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):(ZV(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 tU(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 xk(){Da=!1}class nU{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 Ci(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 sU 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&&bk(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 bk(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 oU=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=oU)&&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 cU(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function fU(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 nU(r),this.stateDeco=Ck(n),this.heightMap=cr.empty().applyChanges(this.stateDeco,Pt.empty,this.heightOracle.setDoc(n.doc),[new ei(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=ei.extendWithRanges(i,lU(r,this.stateDeco,e?e.changes:Pn.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);xk(),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(nV)&&(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:b,scaleY:S}=XE(n,l);(b>.005&&Math.abs(this.scaleX-b)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=b,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?fU:uU)(n,this.paddingTop),x=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&&!cU(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 b=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(b)&&(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),b),o&&(e.docView.minWidth=0,u|=16)}x>0&&g>0?c=Math.max(x,g):x<0&&g<0&&(c=Math.min(x,g)),xk();for(let S of this.viewports){let T=S.from==this.viewport.from?b:e.docView.measureVisibleLineHeights(S);this.heightMap=(o?cr.empty().applyChanges(this.stateDeco,Pt.empty,this.heightOracle,[new ei(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new rU(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(!x){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;x=new um(c,f,g,y)}l.push(x)},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 hU(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 pU(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 Ci(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=bo.newName(),_A=bo.newName(),NA=bo.newName(),LA={"&light":"."+_A,"&dark":"."+NA};function fy(t,e,n){return new bo(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 gU=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),mU={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},cm=Ee.ie&&Ee.ie_version<=11;class yU{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new V9,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 wU(e),e.state.facet(xs)&&(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(xs)?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&&vU(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 NV(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(xs)!=e.state.facet(xs)&&(e.view.contentDOM.editContext=e.state.facet(xs)?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 vU(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 wU{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||U9(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 yU(this),this.inputState=new zV(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 _n?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){Zr(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 Zr(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(xs)?"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);bo.mount(this.root,this.styleModules.concat(gU).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=>RV(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 MV(this,e,n,r)}moveVertically(e,n,r){return am(this,e,OV(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>xU)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=Z9(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 li.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return li.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=bo.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=xs;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 xU=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 bU=Ee.mac?"mac":Ee.windows?"win":Ee.linux?"linux":"key";function kU(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 TU=4e3;function EU(t,e=bU){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=>kU(g,e));for(let g=1;g{let k=to={view:w,prefix:y,scope:o};return setTimeout(()=>{to==k&&(to=null)},TU),!0}]})}let m=p.join(" ");i(m,!1);let x=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&&x.run.push(a),u&&(x.preventDefault=!0),c&&(x.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 AU(t,e,n,r){dy=e;let i=B9(e),s=x9(i,0),o=b9(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=x=>{if(x){for(let g of x.run)if(!f.has(g)&&(f.add(g),g(n)))return x.stopPropagation&&(c=!0),!0;x.preventDefault&&(x.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 MU 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 RU(t){let e=li.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Ht.set([Ht.widget({widget:new MU(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 OU(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)||OU}}}),Ok=new WeakMap,zA=li.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,x=(e=Ok.get(u))!==null&&e!==void 0?e:d.bottom-d.top,g=u.offset||IU,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-x-p-g.yr.bottom)&&k==r.bottom-f.bottom>f.top-r.top&&(k=this.above[l]=!k);let b=(k?f.top-r.top:r.bottom-f.bottom)-p;if(bw&&E.topS&&(S=k?E.top-x-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+x}),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 PU=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"}}}),IU={x:0,y:0},$A=Be.define({enables:[zA,PU]}),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 DU=$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)}}),_U=Be.define();class NU{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=>Zr(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&&!LU(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:!FU(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 LU(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 FU(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 BU(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(zU)&&!u.value||u.value==i)&&(o=[]);return o.length&&a&&r.set(o,a),o},provide:o=>Ih.from(o)});const s=li.define(o=>new NU(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,_U.of(s),DU]}}const zU=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}}}),$U=li.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:$U});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 jU=0;class dm{constructor(e,n){this.from=e,this.to=n}}class Ct{constructor(e={}){this.id=jU++,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 HU=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):HU,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 KU(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 WU(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 ii(h.tree,f,e,o);let p=new ii(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 ii(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 WU{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 ii(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 ii)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer: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 ii?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer: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 KU(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(b,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-b);return}else if(D==-3){u=_;return}else if(D==-4){c=_;return}else throw new RangeError(`Unrecognized record size: ${D}`);let ie=a[_],W,q,R=P-b;if(N-P<=i&&(q=x(l.pos-S,A))){let O=new Uint16Array(q.size-q.skip),F=l.pos-q.size,L=O.length;for(;l.pos>F;)L=g(q.start,O,L);W=new Co(O,N-q.start,r),R=q.start-b}else{let O=l.pos-D;l.next();let F=[],L=[],H=_>=o?_:-1,$=0,ue=N;for(;l.pos>O;)H>=0&&l.id==H&&l.size>=0?(l.end<=ue-i&&(p(F,L,P,$,l.end,ue,H,ee,ne),$=F.length,ue=l.end),l.next()):I>2500?d(P,O,F,L):f(P,O,F,L,H,I+1);if(H>=0&&$>0&&$-1&&$>0){let ce=h(ie,ne);W=ww(ie,F,L,0,F.length,0,N-P,ce,ce)}else W=m(ie,F,L,N-P,ee-N,ne)}T.push(W),E.push(R)}function d(b,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-b)}}function h(b,S){return(T,E,A)=>{let I=0,_=T.length-1,P,N;if(_>=0&&(P=T[_])instanceof Cn){if(!_&&P.type==b&&P.length==A)return P;(N=P.prop(Ct.lookAhead))&&(I=E[_]+P.length+N)}return m(b,T,E,A,I,S)}}function p(b,S,T,E,A,I,_,P,N){let D=[],ee=[];for(;b.length>E;)D.push(b.pop()),ee.push(S.pop()+T-A);b.push(m(r.types[_],D,ee,I-A,P-I,N)),S.push(A-T)}function m(b,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(b,S,T,E,_)}function x(b,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-b;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==b)&&(P.size=E,P.start=A,P.skip=I),P.size>4?P:void 0}function g(b,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(b,S,T)}S[--T]=P,S[--T]=I-b,S[--T]=A-b,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-b;f.push(ww(t,p,m,k,w,b,T,null,a))}d.push(b+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 XU{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 GU=0;class Yr{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=GU++}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 qU=0;class Dh{constructor(e){this.name=e,this.instances=[],this.id=qU++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&YU(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=QU(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 YU(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function QU(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 JU(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function ZU(t,e,n,r=0,i=t.length){let s=new e7(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class e7{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=t7(e)||Dc.empty,f=JU(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(x=>!x.scope||x.scope(d.tree.type)),m=e.firstChild();for(let x=0,g=l;;x++){let y=x=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 t7(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(),Ys=we(),Fk=we(Ys),Bk=we(Ys),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:Ys,variableName:we(Ys),typeName:Fk,tagName:we(Fk),propertyName:Bk,attributeName:we(Bk),className:we(Ys),labelName:we(Ys),namespace:we(Ys),macroName:we(Ys),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 n7(t){return Be.define({combine:t?e=>e.concat(t):void 0})}const r7=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(r7);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 i7{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 i7(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 qA=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(qA=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,s7=li.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=qA(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=>Zr(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,s7,We.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class o7{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const l7=Be.define(),xw=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(xw);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Fh(t,e){let n="",r=t.tabSize,i=t.facet(xw)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s=e?a7(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 xp(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 a7(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=c7(r.node);if(i)return i(bw.create(e,n,r))}return 0}function u7(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function c7(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=>p7(o,!0,1,void 0,s&&!u7(o)?i.from:void 0)}return t.parent==null?f7:null}function f7(){return 0}class bw 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 bw(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(d7(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 d7(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function h7(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 p7(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=h7(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 g7=new Ct;function m7(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 bo(r):null,this.themeType=n.themeType}static define(e,n){return new Mp(e,n||{})}}const yy=Be.define(),y7=Be.define({combine(t){return t.length?[t[0]]:null}});function mm(t){let e=t.facet(yy);return e.length?e:t.facet(y7)}function Hk(t,e){let n=[w7],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 v7{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)ZU(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 w7=nw.high(li.fromClass(v7,{decorations:t=>t.decorations})),x7=1e4,b7="()[]{}",k7=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(k7);return e?e(t.node):t}function la(t,e,n,r={}){let i=r.maxScanDistance||x7,s=r.brackets||b7,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 S7(t,e,n,a,c,u,s)}}return C7(t,e,n,o,l.type,i,s)}function S7(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,x=n>0?h.length:-1;m!=x;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 T7=Object.create(null),Wk=[Cr.none],Vk=[],Uk=Object.create(null),E7=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"]])E7[t]=A7(T7,e);function ym(t,e){Vk.indexOf(t)>-1||(Vk.push(t),console.warn(e))}function A7(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 M7=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Sw(t.state,n.from);return r.line?R7(t):r.block?P7(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 R7=kw(_7,0),O7=kw(ZA,0),P7=kw((t,e)=>ZA(t,e,D7(e)),0);function Sw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Au=50;function I7(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 D7(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)=>I7(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 xy=Ro.define(),N7=Ro.define(),L7=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(xy);if(r){let a=xr.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(N7);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(_n.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=xr.fromTransaction(e),o=e.annotation(_n.time),l=e.annotation(_n.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(xr.fromJSON),t.undone.map(xr.fromJSON))}});function F7(t={}){return[tM,eM.of(t),We.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?nM:e.inputType=="historyRedo"?by: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),by=Rp(1,!1),B7=Rp(0,!0),z7=Rp(1,!0);class xr{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 xr(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 xr(e.changes&&Pn.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=ti;for(let i of e.startState.facet(L7)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new xr(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ti)}static selection(e){return new xr(void 0,ti,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 $7(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 j7(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 ti=[],H7=200;function iM(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-H7));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Bh(t,t.length-1,1e9,n.setSelAfter(r)))}else return[xr.selection([e])]}function W7(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=ti;for(;n;){let i=V7(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?[xr.selection(r)]:ti}function V7(t,e,n){let r=rM(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ti,n);if(!t.changes)return xr.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new xr(i,Gt.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const U7=/^(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||U7.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 X7=t=>aM(t,!rr(t)),G7=t=>aM(t,rr(t));function q7(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;q7(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 Y7=t=>_i(t,e=>Pp(t.state,e,!rr(t))),Q7=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 J7=t=>_i(t,e=>Oo(t,e,!0)),Z7=t=>_i(t,e=>Oo(t,e,!1)),eK=t=>_i(t,e=>Oo(t,e,!rr(t))),tK=t=>_i(t,e=>Oo(t,e,rr(t))),nK=t=>_i(t,e=>le.cursor(t.lineBlockAt(e.head).from,1)),rK=t=>_i(t,e=>le.cursor(t.lineBlockAt(e.head).to,-1));function iK(t,e,n){let r=!1,i=qa(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.headiK(t,e);function ai(t,e,n){let r=qa(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 ai(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 ai(t,e,n=>t.moveByGroup(n,e))}const oK=t=>yM(t,!rr(t)),lK=t=>yM(t,rr(t)),aK=t=>{let e=!rr(t);return ai(t,e,n=>Pp(t.state,n,e))},uK=t=>{let e=rr(t);return ai(t,e,n=>Pp(t.state,n,e))};function vM(t,e){return ai(t,e,n=>t.moveVertically(n,e))}const wM=t=>vM(t,!1),xM=t=>vM(t,!0);function bM(t,e){return ai(t,e,n=>t.moveVertically(n,e,dM(t).height))}const Xk=t=>bM(t,!1),Gk=t=>bM(t,!0),cK=t=>ai(t,!0,e=>Oo(t,e,!0)),fK=t=>ai(t,!1,e=>Oo(t,e,!1)),dK=t=>{let e=!rr(t);return ai(t,e,n=>Oo(t,n,e))},hK=t=>{let e=rr(t);return ai(t,e,n=>Oo(t,n,e))},pK=t=>ai(t,!1,e=>le.cursor(t.lineBlockAt(e.head).from)),gK=t=>ai(t,!0,e=>le.cursor(t.lineBlockAt(e.head).to)),qk=({state:t,dispatch:e})=>(e(Di(t,{anchor:0})),!0),Yk=({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),mK=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),yK=({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},vK=({state:t,dispatch:e})=>{let n=qa(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 wK=t=>kM(t,!1),xK=t=>kM(t,!0),bK=({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),kK=t=>TM(t,!0),SK=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)}),TK=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},AK=({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 MK=({state:t,dispatch:e})=>AM(t,e,!1),RK=({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 OK=({state:t,dispatch:e})=>MM(t,e,!1),PK=({state:t,dispatch:e})=>MM(t,e,!0),IK=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 DK(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),_K=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&&DK(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new Ap(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=YA(u,s);for(c==null&&(c=xp(/^\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 NK=({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=YA(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(xw)})}),{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=xp(i,t.tabSize),o=0,l=Fh(t,Math.max(0,s-Lh(t)));for(;o(t.setTabFocusMode(),!0),FK=[{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:xM},{key:"Ctrl-a",run:nK,shift:pK},{key:"Ctrl-e",run:rK,shift:gK},{key:"Ctrl-d",run:CM},{key:"Ctrl-h",run:Sy},{key:"Ctrl-k",run:SK},{key:"Ctrl-Alt-h",run:EM},{key:"Ctrl-o",run:EK},{key:"Ctrl-t",run:AK},{key:"Ctrl-v",run:ky}],BK=[{key:"ArrowLeft",run:oM,shift:gM,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:X7,shift:oK,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:eK,shift:dK,preventDefault:!0},{key:"ArrowRight",run:lM,shift:mM,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:G7,shift:lK,preventDefault:!0},{mac:"Cmd-ArrowRight",run:tK,shift:hK,preventDefault:!0},{key:"ArrowUp",run:cM,shift:wM,preventDefault:!0},{mac:"Cmd-ArrowUp",run:qk,shift:Qk},{mac:"Ctrl-ArrowUp",run:Kk,shift:Xk},{key:"ArrowDown",run:fM,shift:xM,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Yk,shift:Jk},{mac:"Ctrl-ArrowDown",run:ky,shift:Gk},{key:"PageUp",run:Kk,shift:Xk},{key:"PageDown",run:ky,shift:Gk},{key:"Home",run:Z7,shift:fK,preventDefault:!0},{key:"Mod-Home",run:qk,shift:Qk},{key:"End",run:J7,shift:cK,preventDefault:!0},{key:"Mod-End",run:Yk,shift:Jk},{key:"Enter",run:Zk,shift:Zk},{key:"Mod-a",run:mK},{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:kK,preventDefault:!0},{mac:"Mod-Backspace",run:CK,preventDefault:!0},{mac:"Mod-Delete",run:TK,preventDefault:!0}].concat(FK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),zK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Y7,shift:aK},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Q7,shift:uK},{key:"Alt-ArrowUp",run:MK},{key:"Shift-Alt-ArrowUp",run:OK},{key:"Alt-ArrowDown",run:RK},{key:"Shift-Alt-ArrowDown",run:PK},{key:"Mod-Alt-ArrowUp",run:wK},{key:"Mod-Alt-ArrowDown",run:xK},{key:"Escape",run:bK},{key:"Mod-Enter",run:_K},{key:"Alt-l",mac:"Ctrl-l",run:yK},{key:"Mod-i",run:vK,preventDefault:!0},{key:"Mod-[",run:PM},{key:"Mod-]",run:OM},{key:"Mod-Alt-\\",run:NK},{key:"Shift-Mod-k",run:IK},{key:"Shift-Mod-\\",run:sK},{key:"Mod-/",run:M7},{key:"Alt-A",mac:"Ctrl-A",run:O7},{key:"Ctrl-m",mac:"Shift-Alt-m",run:LK}].concat(BK),$K={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 jK(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 jK{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 HK{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;WK(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 WK(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||VK(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],x=t[p+1]||65536;if(c=x)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 VK(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 UK{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 KK{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 UK(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&&qK(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 XK(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 YK=KA({String:He.string,Number:He.number,"True False":He.bool,PropertyName:He.propertyName,Null:He.null,", :":He.separator,"[ ]":He.squareBracket,"{ }":He.brace}),QK=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:[YK],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}),JK=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=ZK(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function ZK(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 eX=_h.define({name:"json",parser:QK.configure({props:[QA.add({Object:jk({except:/^\s*\}/}),Array:jk({except:/^\s*\]/})}),g7.add({"Object Array":m7})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function lS(){return new o7(eX)}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,x;if(l.length)m=a,x=l.reduce((w,k)=>Math.min(w,k.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;x=p.to,l.push(p),h++}for(;hw.from||w.to==m))l.push(w),h++,x=Math.min(w.to,x);else{x=Math.min(w.from,x);break}}x=Math.min(x,f);let g=!1;if(l.some(w=>w.from==m&&(w.to==x||x==f))&&(g=m==x,!g&&x-m<10)){let w=m-(c+u.value.length);w>0&&(u.next(w),c=m);for(let k=m;;){if(k>=x){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=pX(l);if(g)o.add(m,m,Ht.widget({widget:new cX(y),diagnostics:l.slice()}));else{let w=l.reduce((k,b)=>b.markClass?k+" "+b.markClass:k,"");o.add(m,x,Ht.mark({class:"cm-lintRange cm-lintRange-"+y+w,diagnostics:l.slice(),inclusiveEnd:l.some(k=>k.to>x)}))}if(a=x,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 tX(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 nX(t,e){return t.field(Ai,!1)?e:e.concat(Gt.appendConfig.of(LM))}function rX(t,e){return{effects:nX(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)]}),iX=Ht.mark({class:"cm-lintRange cm-lintRange-active"});function sX(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)},lX=li.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(rX(this.view.state,r.reduce((i,s)=>i.concat(s))))},r=>{Zr(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 aX(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 uX(t,e={}){return[es.of({source:t,config:e}),lX,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 cX 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 fX(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function yd(t){return fX(``,'width="6" height="3"')}const dX=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 hX(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function pX(t){let e="hint",n=1;for(let r of t){let i=hX(r.severity);i>n&&(n=i,e=r.severity)}return e}const gX=BU(sX,{hideOn:tX}),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([iX.range(e.from,e.to)])}),gX,dX],mX=512*1024,dS=512*1024,FM=2e6;function yX(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 vX=t=>t.state.doc.length>mX?[]:JK()(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 wX=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,x=v.useRef(m),g=t.length>dS,y=v.useRef(g),w=!m&&t.length>FM,k=w?yX(t,dS):t,b=v.useRef(!1),S=v.useCallback((T,E)=>T?[We.updateListener.of(A=>{var I;A.docChanged&&!b.current&&((I=c.current)==null||I.call(c,A.state.doc.toString()))}),...E?[]:[uX(vX,{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,F7(),FA.of([...zK,...K7,$K]),wX,E.of(Hk(hS(r))),A.of(S(m,g)),...i?[RU(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)){b.current=!0;try{T.dispatch({..._!==k?{changes:{from:0,to:T.state.doc.length,insert:k}}:{},...I.length>0?{effects:I}:{}})}finally{b.current=!1}}},[k,g,m,S]),v.useEffect(()=>{const T=u.current,E=h.current;!T||!E||m!==x.current&&(x.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:Br("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-x-2 gap-y-1.5 border-b border-border px-3.5 py-2 max-md:gap-2 md:min-h-12 md:py-1.5 md:pr-2.5 md:pl-3.5 lg:gap-x-3 lg:pr-3 lg:pl-5",children:[M.jsxs("div",{className:"flex items-center gap-2 lg: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,x){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]--),x.unshift(m)}return x}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 x=d.lastIndexOf(` `,ie.offset),g=d.indexOf(` `,ie.offset),y=d.substring(x>=-1?x: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 b=new Array(w),S=0;Sy&&(y=g,w=[]),w.push(R))}function b(){var R,O,F,L;return F=g,L=g,R=function(H){return ee=","}()?"":null,R!==null?(O=A(),O!==null?R=[R,O]:(R=null,g=L)):(R=null,g=L),R!==null&&(R=function(H,$){return $}(F,R[1])),R===null&&(g=F),R}function S(){var R,O,F,L;return F=g,L=g,R=function(H){return ee=";"}()?"":null,R!==null?(O=A(),O!==null?R=[R,O]:(R=null,g=L)):(R=null,g=L),R!==null&&(R=function(H,$){return $}(F,R[1])),R===null&&(g=F),R}function T(){var R,O,F,L;return F=g,L=g,R=function(H){return ee="|"}()?"":null,R!==null?(O=A(),O!==null?R=[R,O]:(R=null,g=L)):(R=null,g=L),R!==null&&(R=function(H,$){return $}(F,R[1])),R===null&&(g=F),R}function E(){var R,O,F,L;return F=g,L=g,R=function(H){return ee=" "}()?"":null,R!==null?(O=A(),O!==null?R=[R,O]:(R=null,g=L)):(R=null,g=L),R!==null&&(R=function(H,$){return $}(F,R[1])),R===null&&(g=F),R}function A(){var R,O,F,L,H,$,ue,ce,xe;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(F=[],ce=g,xe=g,/^[\n\r]/.test(p.charAt(g))?(H=p.charAt(g),g++):(H=null,k("[\\n\\r]")),H!==null)for(L=[];H!==null;)L.push(H),/^[\n\r]/.test(p.charAt(g))?(H=p.charAt(g),g++):(H=null,k("[\\n\\r]"));else L=null;for(L!==null?(H=I(),H!==null?L=[L,H]:(L=null,g=xe)):(L=null,g=xe),L!==null&&(L=function(Ge,$e){return $e}(ce,L[1])),L===null&&(g=ce);L!==null;){if(F.push(L),ce=g,xe=g,/^[\n\r]/.test(p.charAt(g))?(H=p.charAt(g),g++):(H=null,k("[\\n\\r]")),H!==null)for(L=[];H!==null;)L.push(H),/^[\n\r]/.test(p.charAt(g))?(H=p.charAt(g),g++):(H=null,k("[\\n\\r]"));else L=null;L!==null?(H=I(),H!==null?L=[L,H]:(L=null,g=xe)):(L=null,g=xe),L!==null&&(L=function(Ge,$e){return $e}(ce,L[1])),L===null&&(g=ce)}if(F!==null){for(L=[],/^[\n\r]/.test(p.charAt(g))?(H=p.charAt(g),g++):(H=null,k("[\\n\\r]"));H!==null;)L.push(H),/^[\n\r]/.test(p.charAt(g))?(H=p.charAt(g),g++):(H=null,k("[\\n\\r]"));L!==null?R=[R,O,F,L]:(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,F,L,H,$,ue,ce,xe;if($=g,ue=g,R=_(),R!==null){for(O=[],ce=g,xe=g,p.length>g?(F=p.charAt(g),g++):(F=null,k("any character")),F!==null?(L=function(Ge,$e){return $e==ee}(g,F)?"":null,L!==null?(H=_(),H!==null?F=[F,L,H]:(F=null,g=xe)):(F=null,g=xe)):(F=null,g=xe),F!==null&&(F=function(Ge,$e,at){return at}(ce,F[0],F[2])),F===null&&(g=ce);F!==null;)O.push(F),ce=g,xe=g,p.length>g?(F=p.charAt(g),g++):(F=null,k("any character")),F!==null?(L=function(Ge,$e){return $e==ee}(g,F)?"":null,L!==null?(H=_(),H!==null?F=[F,L,H]:(F=null,g=xe)):(F=null,g=xe)):(F=null,g=xe),F!==null&&(F=function(Ge,$e,at){return at}(ce,F[0],F[2])),F===null&&(g=ce);O!==null?(F=function(Ge,$e,at){return!!$e||at.length}(g,R,O)?"":null,F!==null?R=[R,O,F]:(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,F,L,H,$;if(L=g,H=g,p.charCodeAt(g)===34?(R='"',g++):(R=null,k('"\\""')),R!==null){for(O=[],F=P();F!==null;)O.push(F),F=P();O!==null?(p.charCodeAt(g)===34?(F='"',g++):(F=null,k('"\\""')),F!==null?R=[R,O,F]:(R=null,g=H)):(R=null,g=H)}else R=null,g=H;if(R!==null&&(R=function(ue,ce){return ce.join("")}(L,R[1])),R===null&&(g=L),R===null){for(L=g,R=[],H=g,$=g,/^[^\n\r]/.test(p.charAt(g))?(O=p.charAt(g),g++):(O=null,k("[^\\n\\r]")),O!==null?(F=function(ue,ce){return ce!=ee}(g,O)?"":null,F!==null?O=[O,F]:(O=null,g=$)):(O=null,g=$),O!==null&&(O=function(ue,ce){return ce}(H,O[0])),O===null&&(g=H);O!==null;)R.push(O),H=g,$=g,/^[^\n\r]/.test(p.charAt(g))?(O=p.charAt(g),g++):(O=null,k("[^\\n\\r]")),O!==null?(F=function(ue,ce){return ce!=ee}(g,O)?"":null,F!==null?O=[O,F]:(O=null,g=$)):(O=null,g=$),O!==null&&(O=function(ue,ce){return ce}(H,O[0])),O===null&&(g=H);R!==null&&(R=function(ue,ce){return(o?ce.join("").trim():ce.join("")).replace(/(^")|("$)/g,"")}(L,R)),R===null&&(g=L)}return R}function P(){var R,O,F,L;return F=g,L=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=L)):(R=null,g=L),R!==null&&(R=function(H){return'"'}()),R===null&&(g=F),R===null&&(/^[^"]/.test(p.charAt(g))?(R=p.charAt(g),g++):(R=null,k('[^"]'))),R}function N(R){R.sort();for(var O=null,F=[],L=0;L=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 RX(t){return t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function OX(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(RX)?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 PX(t,e){if(e.parseJSON){const n=MX(t);if(n.ok&&typeof n.value!="number")return n.value}return e.parseNumbers?AX(t):t}function IX(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=PX(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 DX=/^([^.[\]]+)(?:\.(0|[1-9]\d*)|\[(0|[1-9]\d*)\])(?:\.(.+))?$/;function jM(t){const e=DX.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)??[],x={};for(const g of m){if(!g.subKey)continue;const y=t[g.column];gS(y,r)||(x[g.subKey]=y)}Object.keys(x).length>0&&h.push(x)}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 x=t[m];gS(x,r)||h.push(x)}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 _X(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=xX(r,{...e,parseNumbers:!1,parseJSON:!1,trim:!1}),s=IX(i,n);return e.collapseIndexedArrays!==!1&&!e.transpose?_X(i,s,n.emptyFields):s}catch(i){throw new Error($M(i))}}function NX(t,e={}){try{const n=e.flatten?OX(t):t;return kX(n,e)}catch(n){const r=$M(n);throw TX.some(i=>r.startsWith(i))?new SX(CX(r,e.flatten??!1)):new Error(r)}}function LX(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 FX(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 BX(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 zX(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 xS=t=>t==="auto"?void 0:t;function $X(t){let e=!1,n=1;for(let r=0;r=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 OX(t){return t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function PX(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(OX)?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 IX(t,e){if(e.parseJSON){const n=RX(t);if(n.ok&&typeof n.value!="number")return n.value}return e.parseNumbers?MX(t):t}function DX(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=IX(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 _X=/^([^.[\]]+)(?:\.(0|[1-9]\d*)|\[(0|[1-9]\d*)\])(?:\.(.+))?$/;function jM(t){const e=_X.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)??[],x={};for(const g of m){if(!g.subKey)continue;const y=t[g.column];gS(y,r)||(x[g.subKey]=y)}Object.keys(x).length>0&&h.push(x)}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 x=t[m];gS(x,r)||h.push(x)}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 NX(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=bX(r,{...e,parseNumbers:!1,parseJSON:!1,trim:!1}),s=DX(i,n);return e.collapseIndexedArrays!==!1&&!e.transpose?NX(i,s,n.emptyFields):s}catch(i){throw new Error($M(i))}}function LX(t,e={}){try{const n=e.flatten?PX(t):t;return SX(n,e)}catch(n){const r=$M(n);throw EX.some(i=>r.startsWith(i))?new CX(TX(r,e.flatten??!1)):new Error(r)}}function FX(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 BX(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 zX(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 $X(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 xS=t=>t==="auto"?void 0:t;function jX(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=xS(n.separator),s=NX(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 WX(){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,keepLabelOnMobile:s=!1}){return M.jsxs("button",{type:"button","data-testid":e,"aria-label":t,disabled:r,onClick:n,title:t,className:Jo,children:[i?M.jsx(i,{"aria-hidden":"true"}):null,i&&!s?M.jsx("span",{className:"hidden xl:inline",children:t}):t]})}function VX(t){const e=Math.min(t.length,65536);let n=!1,r=0;for(let i=0;i0;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=xS(n.separator),s=LX(r,{separator:i,flatten:n.flatten}),o=qc(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 VX(){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,keepLabelOnMobile:s=!1}){return M.jsxs("button",{type:"button","data-testid":e,"aria-label":t,disabled:r,onClick:n,title:t,className:Jo,children:[i?M.jsx(i,{"aria-hidden":"true"}):null,i&&!s?M.jsx("span",{className:"hidden xl:inline",children:t}):t]})}function UX(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 UX({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:x=!1,canRedo:g=!1,onUndo:y,onRedo:w,collapseIndexedArrays:k=!0,onToggleCollapseIndexedArrays:b}){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 L=VX(e),H=Yc(L,p);return Ey(H.headers.map($=>$.trim()))},[N,P,e,p]),ee=v.useMemo(()=>N||P?[]:FX(e),[N,P,e]),ne=v.useMemo(()=>N||P?null:BX(e),[N,P,e]),ie=L=>{var H;L.preventDefault(),Array.from(((H=L.dataTransfer)==null?void 0:H.types)??[]).includes("Files")&&(I.current++,A(!0))},W=()=>{I.current=Math.max(0,I.current-1),I.current===0&&A(!1)},Y=L=>{var $,ue;L.preventDefault(),I.current=0,A(!1);const H=(ue=($=L.dataTransfer)==null?void 0:$.files)==null?void 0:ue[0];H&&r(H,"drop")},R=L=>{var $;if(!P||L.defaultPrevented||L.target instanceof HTMLTextAreaElement||L.target instanceof HTMLInputElement)return;const H=($=L.clipboardData)==null?void 0:$.getData("text/plain");H&&(L.preventDefault(),n(H))},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:Br("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 lg:px-2.5",S?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:[M.jsx($I,{"aria-hidden":"true",className:"size-3.5 md:hidden lg:inline"}),"Table"]}),M.jsxs("button",{type:"button","data-testid":"raw-toggle","aria-pressed":S,onClick:()=>T(!0),className:Br("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 lg:px-2.5",S?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[M.jsx(Z1,{"aria-hidden":"true",className:"size-3.5 md:hidden lg:inline"}),"Raw"]})]}):null,F=u&&a?M.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[M.jsx(WX,{})," ",a]}):a?c?`${a} · ${c}`:a:c;return M.jsx("div",{"data-testid":"input-pane",onDragEnter:ie,onDragOver:L=>L.preventDefault(),onDragLeave:W,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:F,actions:M.jsxs(M.Fragment,{children:[O,N&&(x||g)?M.jsxs(M.Fragment,{children:[M.jsx("button",{type:"button","data-testid":"csv-undo-button","aria-label":"Undo",title:"Undo",disabled:!x,onClick:()=>y==null?void 0:y(),className:Jo,children:M.jsx(XI,{"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(RI,{"aria-hidden":"true"})})]}):null,ne?M.jsx(Ru,{label:ne.label,testId:"json-format-toggle",onClick:()=>n(ne.nextInput),Icon:Z1,keepLabelOnMobile:!0}):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:L=>{var $;const H=($=L.target.files)==null?void 0:$[0];H&&r(H,"picker"),L.target.value=""}}),M.jsx(Ru,{label:"Upload",testId:"upload",onClick:()=>{var L;return(L=_.current)==null?void 0:L.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(f9,{format:t,onIngest:n,onBrowse:()=>{var L;return(L=_.current)==null?void 0:L.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(L=>`${L.prefix}[${L.indices.length}]`).join(", ")}):`}),M.jsx("button",{type:"button","data-testid":"csv-indexed-array-pill","aria-pressed":k,onClick:()=>b==null?void 0:b(),className:Br("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:L=>n(L.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(L=>M.jsx("button",{type:"button","data-testid":`json-unwrap-pill-${L.key}`,onClick:()=>n(L.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 .${L.key} (${L.rowCount} ${L.rowCount===1?"row":"rows"})`},L.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 KX=/\.(csv|tsv|txt|json|ndjson|md|log)$/i;function XX(t){return t.type.startsWith("text/")||t.type==="application/json"?!0:KX.test(t.name)}const GX=[{value:"utf-8",label:"UTF-8"},{value:"windows-1252",label:"Windows-1252"}];async function bS(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 VM=[{value:"auto",label:"Auto-detect"},{value:",",label:"Comma"},{value:";",label:"Semicolon"},{value:" ",label:"Tab"},{value:"|",label:"Pipe"}];function kS(){return M.jsx("div",{className:"hidden h-5 w-px shrink-0 bg-border xl:block","aria-hidden":"true"})}function YX(t,e){var i;const r=[e.separator==="auto"?"Auto":((i=VM.find(s=>s.value===e.separator))==null?void 0:i.label)??"Auto"];return t==="csv2json"?(e.parseNumbers&&r.push("Parse numbers"),e.parseJSON&&r.push("Parse JSON"),e.emptyFields==="skip"&&r.push("Skip empty"),e.nullLiterals==="null"&&r.push("NULL→null"),e.transpose&&r.push("Transpose"),e.hash&&r.push("Hash"),e.minify&&r.push("Minify")):e.flatten&&r.push("Flatten"),r.join(" · ")}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:Br("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:Br("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 qX({direction:t,options:e,onChange:n,notice:r,uploadEncoding:i,onUploadEncodingChange:s}){const[o,l]=v.useState(!1),a=t==="csv2json",u=YX(t,e);return M.jsxs("div",{"data-testid":"options-row",className:"flex flex-shrink-0 flex-col border-t border-border bg-panel px-3.5 py-2 text-[13px] text-muted-foreground md:flex-row md:flex-wrap md:items-center md:gap-x-3.5 md:gap-y-2 md:px-4 md:py-2 xl:gap-5 xl:px-5 xl:py-2.5",children:[M.jsx("div",{className:"flex w-full items-center justify-between gap-2 md:hidden",children:M.jsxs("button",{type:"button","data-testid":"options-mobile-toggle","aria-expanded":o,onClick:()=>l(c=>!c),className:"inline-flex min-w-0 flex-1 cursor-pointer items-center justify-between gap-2 rounded-md py-0.5 text-left text-xs font-medium text-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[M.jsx("span",{className:"font-mono text-[11px] font-semibold tracking-[0.14em] text-muted-foreground uppercase",children:"Options"}),M.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[M.jsx("span",{"data-testid":"options-mobile-summary",className:"truncate font-normal",children:u}),M.jsx(xI,{"aria-hidden":"true",className:Br("size-3.5 shrink-0 transition-transform",o&&"rotate-180")})]})]})}),M.jsxs("div",{"data-testid":"options-controls",className:Br("flex-wrap items-center gap-x-4 gap-y-2.5 md:flex md:flex-1 md:gap-x-3.5 md:gap-y-2 xl:gap-5",o?"mt-2 flex border-t border-border pt-2.5 md:mt-0 md:border-t-0 md:pt-0":"max-md:hidden"),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:c=>n({separator:c.target.value}),className:SS(),children:VM.map(c=>M.jsx("option",{value:c.value,children:c.label},c.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:c=>s(c.target.value),className:SS(),children:GX.map(c=>M.jsx("option",{value:c.value,children:c.label},c.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,{}),a?M.jsxs(M.Fragment,{children:[M.jsx(Ks,{label:"Parse numbers",checked:e.parseNumbers,onChange:c=>n({parseNumbers:c}),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:c=>n({parseJSON:c}),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:c=>n({emptyFields:c?"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:c=>n({nullLiterals:c?"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:c=>n({transpose:c}),hint:"Flip rows and columns — the first column becomes the header row."}),M.jsx(Ks,{label:"Hash output",checked:e.hash,onChange:c=>n({hash:c}),hint:"The first column becomes the object key instead of a field."}),M.jsx(Ks,{label:"Minify",checked:e.minify,onChange:c=>n({minify:c}),hint:"Remove indentation from the JSON output. Data is untouched."})]}):M.jsx(Ks,{label:"Flatten nested arrays",checked:e.flatten,onChange:c=>n({flatten:c}),hint:"Explode nested arrays into extra rows with dotted keys — needed when the JSON isn't a flat table."}),r?M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex-1"}),M.jsx("span",{"data-testid":"options-notice",className:"text-muted-foreground",children:r})]}):null]})]})}const QX=3;function JX(t){const e=t.slice(0,QX),n=t.length-e.length;return(n>0?[...e,`+${n} more`]:e).join(` -`)}function ZX({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 x=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(ex,{"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","aria-label":"Copy",title:"Copy",onClick:f,disabled:!n,className:Jo,children:[M.jsx(Ev,{"aria-hidden":"true"}),M.jsx("span",{className:"hidden xl:inline",children:"Copy"})]}),M.jsxs("button",{type:"button","data-testid":"download-output","aria-label":"Download",title:"Download",onClick:d,disabled:!n,className:Jo,children:[M.jsx(Y2,{"aria-hidden":"true"}),M.jsx("span",{className:"hidden xl:inline",children:"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(ex,{"aria-hidden":"true"}),"Discard edits & reconvert"]}):void 0}:r?{kind:"error",message:r}:o&&o.length>0?{kind:"notice",message:JX(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?x?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 eG({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 xm(t){return Math.min(Ry,Math.max(My,t))}function tG({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 x;const p=(x=o.current)==null?void 0:x.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(xm(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(xm(e-d));break;case"ArrowRight":case"ArrowDown":f.preventDefault(),n(xm(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:Br("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:Br("flex min-h-0 min-w-0 flex-col overflow-hidden border-border bg-panel max-md:min-h-[280px] max-md:max-h-[360px]","h-[var(--split)] border-b","md:h-auto md:w-[var(--split)] md:border-b-0 md:border-r"),children:r}),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:Br("relative z-10 flex h-9 flex-shrink-0 items-center justify-center border-b border-border bg-muted/20 cursor-row-resize","md:absolute md:top-0 md:right-auto md:bottom-0 md:left-[var(--split)] md:h-auto md:w-0 md:border-b-0 md:bg-transparent md:cursor-col-resize"),children:[M.jsx("div",{className:Br("absolute","inset-0","md:inset-auto md:top-0 md:right-auto md:bottom-0 md:-left-1.5 md:h-auto md:w-3")}),s?M.jsx("div",{className:"relative z-10 md:absolute md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2",children:s}):null]}),M.jsx("div",{"data-testid":"pane-right",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-panel max-md:min-h-[240px] max-md:max-h-[340px]",children:i})]})}function nG({theme:t}){return t==="dark"?M.jsx(BI,{size:15,strokeWidth:2,"aria-hidden":"true"}):M.jsx(AI,{size:15,strokeWidth:2,"aria-hidden":"true"})}function rG({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(nG,{theme:t})})]})}function iG(t){return[...t].sort((e,n)=>n.id-e.id)}const UM=[{id:14,date:"2026-10-17",tag:"improvement",title:"Polished mobile stacked panes and collapsible options bar",summary:"Small screens now stack the input and output panes with an in-flow direction switch and compact icon actions so nothing overlaps. The options bar collapses into a one-tap summary on phones while keeping every setting a tap away."},{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."}],sG=864e5;function AS(t){return Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}function oG(t,e=Date.now()){const n=new Date(`${t}T00:00:00Z`),r=new Date(e),i=Math.round((AS(r)-AS(n))/sG);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 KM="csvjson:changelog.v1",Fd=Math.max(...UM.map(t=>t.id),0),lG=iG(UM);function aG(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&&!uG(e.clientId)||e.pendingIds!==void 0&&(!Array.isArray(e.pendingIds)||e.pendingIds.some(n=>typeof n!="number"||!Number.isInteger(n)||n<1)))}function uG(t){return typeof t=="string"&&/^[0-9a-fA-F-]{8,64}$/.test(t)}function XM(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=XM(t.pendingIds),i=n?[...new Set([...r,e])].sort((s,o)=>s-o):r.filter(s=>s!==e);return{...t,pendingIds:i}}function cG(){try{const t=window.localStorage.getItem(KM);if(t===null)return{lastSeenId:null,votes:{}};const e=JSON.parse(t);return aG(e)?{...e,pendingIds:XM(e.pendingIds)}:{lastSeenId:null,votes:{}}}catch{return{lastSeenId:null,votes:{}}}}function fG(t){try{window.localStorage.setItem(KM,JSON.stringify(t))}catch{}}function dG(){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 hG(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 pG({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:oG(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(VI,{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(HI,{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 gG(){const[t,e]=v.useState(cG),[n,r]=v.useState(!1),i=v.useRef(t),s=v.useCallback(b=>{fG(b),i.current=b,e(b)},[]),[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((b,S)=>{l(T=>{const E=new Set(T);return S?E.add(b):E.delete(b),E})},[]),p=v.useCallback((b,S,T,E)=>{const A=(f.current.get(b)??0)+1;f.current.set(b,A),a.current.add(b),E&&h(b,!0),hG(T,b,S).then(I=>{f.current.get(b)===A&&(a.current.delete(b),I==="ok"&&(nI({entry_id:b,vote:S}),s(MS(i.current,b,!1))),E&&h(b,!1))})},[s,h]),m=v.useCallback(b=>{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===b||a.current.has(I))continue;const _=E[I];_!==void 0&&p(I,_,S,!1)}},[p]),x=(b,S)=>{if(t.votes[b]===S){m();return}const T=t.clientId??dG();s(MS({...t,votes:{...t.votes,[b]:S},clientId:T},b,!0)),p(b,S,T,!0),m(b)},g=()=>{r(!0),tI(),t.lastSeenId!==Fd&&s({...t,lastSeenId:Fd}),m()},y=v.useCallback(()=>{r(!1)},[]),w=v.useRef(!1);v.useEffect(()=>{var b;w.current&&!n&&((b=c.current)==null||b.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 b=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",b),document.addEventListener("click",S),()=>{document.removeEventListener("keydown",b),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(PI,{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:lG.map(b=>{var S;return M.jsx(pG,{entry:b,vote:t.votes[b.id],queued:((S=t.pendingIds)==null?void 0:S.includes(b.id))??!1,inFlight:o.has(b.id),onVote:x},b.id)})})]})]})}function mG(t,e){const[n,r]=v.useState(t);return v.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function yG(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 vG={},wG=["csv2json","json2csv","json_validator","json_beautifier","sql2json","csvjson2json","datajanitor"],xG=["csv2json","json2csv","csvjson2json"];function bG(t){return xG.includes(t)}const kG=/^[0-9a-f]{32}$/i,SG=/^\/([a-z0-9_]+)\/([0-9a-f]{32})\/?$/i,bm=vG,CG=((bm==null?void 0:bm.VITE_S3_DATA_URL)??"https://csvjson.s3.us-east-2.amazonaws.com/data/").replace(/\/*$/,"/");function TG(t){const e=SG.exec(t);if(!e)return null;const n=e[1].toLowerCase();return wG.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 EG(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string"||typeof e=="boolean")}function AG(t){var i;if(!EG(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 MG(t){if(!kG.test(t))throw new Oy;let e;try{e=await fetch(`${CG}${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 RG(t){const e=v.useMemo(()=>t&&bG(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 MG(e).then(f=>{if(c)return;const d=AG(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 OG="\uFEFF";function PG(t,e){return e?OG+t:t}function IG(t,e,n){const r=PG(t,n);return new Blob([r],{type:`${e};charset=utf-8`})}const DG=new Set(["csv","tsv","json","txt"]);function _G(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(!DG.has(e.slice(n+1).toLowerCase()))break;e=e.slice(0,n)}return e}function NG(t,e){const n=e==="csv2json"?"json":"csv";return t?`${_G(t)}.${n}`:`data.${n}`}function IS(t,e,{mime:n="text/plain",bom:r=!1}={}){const i=IG(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 LG(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 FG=`album,year,US_peak_chart_post +`&&(i+=1),r+=1,r>=3))return t.slice(0,i+1)}return t.slice(0,e)}function KX({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:x=!1,canRedo:g=!1,onUndo:y,onRedo:w,collapseIndexedArrays:k=!0,onToggleCollapseIndexedArrays:b}){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 L=UX(e),H=qc(L,p);return Ey(H.headers.map($=>$.trim()))},[N,P,e,p]),ee=v.useMemo(()=>N||P?[]:BX(e),[N,P,e]),ne=v.useMemo(()=>N||P?null:zX(e),[N,P,e]),ie=L=>{var H;L.preventDefault(),Array.from(((H=L.dataTransfer)==null?void 0:H.types)??[]).includes("Files")&&(I.current++,A(!0))},W=()=>{I.current=Math.max(0,I.current-1),I.current===0&&A(!1)},q=L=>{var $,ue;L.preventDefault(),I.current=0,A(!1);const H=(ue=($=L.dataTransfer)==null?void 0:$.files)==null?void 0:ue[0];H&&r(H,"drop")},R=L=>{var $;if(!P||L.defaultPrevented||L.target instanceof HTMLTextAreaElement||L.target instanceof HTMLInputElement)return;const H=($=L.clipboardData)==null?void 0:$.getData("text/plain");H&&(L.preventDefault(),n(H))},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:Br("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 lg:px-2.5",S?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:[M.jsx(jI,{"aria-hidden":"true",className:"size-3.5 md:hidden lg:inline"}),"Table"]}),M.jsxs("button",{type:"button","data-testid":"raw-toggle","aria-pressed":S,onClick:()=>T(!0),className:Br("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 lg:px-2.5",S?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[M.jsx(Z1,{"aria-hidden":"true",className:"size-3.5 md:hidden lg:inline"}),"Raw"]})]}):null,F=u&&a?M.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[M.jsx(VX,{})," ",a]}):a?c?`${a} · ${c}`:a:c;return M.jsx("div",{"data-testid":"input-pane",onDragEnter:ie,onDragOver:L=>L.preventDefault(),onDragLeave:W,onDrop:q,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:F,actions:M.jsxs(M.Fragment,{children:[O,N&&(x||g)?M.jsxs(M.Fragment,{children:[M.jsx("button",{type:"button","data-testid":"csv-undo-button","aria-label":"Undo",title:"Undo",disabled:!x,onClick:()=>y==null?void 0:y(),className:Jo,children:M.jsx(GI,{"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(OI,{"aria-hidden":"true"})})]}):null,ne?M.jsx(Ru,{label:ne.label,testId:"json-format-toggle",onClick:()=>n(ne.nextInput),Icon:Z1,keepLabelOnMobile:!0}):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:L=>{var $;const H=($=L.target.files)==null?void 0:$[0];H&&r(H,"picker"),L.target.value=""}}),M.jsx(Ru,{label:"Upload",testId:"upload",onClick:()=>{var L;return(L=_.current)==null?void 0:L.click()},Icon:Y2}),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:q2})]}),status:f?{kind:"error",message:f}:d?{kind:"notice",message:d}:null,children:[P?M.jsx(d9,{format:t,onIngest:n,onBrowse:()=>{var L;return(L=_.current)==null?void 0:L.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(L=>`${L.prefix}[${L.indices.length}]`).join(", ")}):`}),M.jsx("button",{type:"button","data-testid":"csv-indexed-array-pill","aria-pressed":k,onClick:()=>b==null?void 0:b(),className:Br("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:L=>n(L.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(L=>M.jsx("button",{type:"button","data-testid":`json-unwrap-pill-${L.key}`,onClick:()=>n(L.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 .${L.key} (${L.rowCount} ${L.rowCount===1?"row":"rows"})`},L.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 XX=/\.(csv|tsv|txt|json|ndjson|md|log)$/i;function GX(t){return t.type.startsWith("text/")||t.type==="application/json"?!0:XX.test(t.name)}const qX=[{value:"utf-8",label:"UTF-8"},{value:"windows-1252",label:"Windows-1252"}];async function bS(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()}}function VM(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 UM=[{value:"auto",label:"Auto-detect"},{value:",",label:"Comma"},{value:";",label:"Semicolon"},{value:" ",label:"Tab"},{value:"|",label:"Pipe"}];function kS(){return M.jsx("div",{className:"hidden h-5 w-px shrink-0 bg-border fit:block","aria-hidden":"true"})}function YX(t,e){var i;const r=[e.separator==="auto"?"Auto":((i=UM.find(s=>s.value===e.separator))==null?void 0:i.label)??"Auto"];return t==="csv2json"?(e.parseNumbers&&r.push("Parse numbers"),e.parseJSON&&r.push("Parse JSON"),e.emptyFields==="skip"&&r.push("Skip empty"),e.nullLiterals==="null"&&r.push("NULL→null"),e.transpose&&r.push("Transpose"),e.hash&&r.push("Hash"),e.minify&&r.push("Minify")):e.flatten&&r.push("Flatten"),r.join(" · ")}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:Br("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:Br("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 QX({direction:t,options:e,onChange:n,notice:r,uploadEncoding:i,onUploadEncodingChange:s}){const[o,l]=v.useState(!1),a=v.useRef(null),u=v.useRef(null),c=VM("(min-width: 98.5rem)"),f=t==="csv2json",d=YX(t,e),h=v.useCallback(()=>{var m;l(!1),(m=a.current)==null||m.focus()},[]);v.useEffect(()=>{if(!o)return;const m=g=>{g.key==="Escape"&&h()},x=g=>{const y=u.current;y===null||!(g.target instanceof Node)||y.contains(g.target)||h()};return document.addEventListener("keydown",m),document.addEventListener("click",x),()=>{document.removeEventListener("keydown",m),document.removeEventListener("click",x)}},[o,h]);const p=M.jsxs(M.Fragment,{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:m=>n({separator:m.target.value}),className:SS(),children:UM.map(m=>M.jsx("option",{value:m.value,children:m.label},m.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:m=>s(m.target.value),className:SS(),children:qX.map(m=>M.jsx("option",{value:m.value,children:m.label},m.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,{}),f?M.jsxs(M.Fragment,{children:[M.jsx(Ks,{label:"Parse numbers",checked:e.parseNumbers,onChange:m=>n({parseNumbers:m}),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:m=>n({parseJSON:m}),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:m=>n({emptyFields:m?"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:m=>n({nullLiterals:m?"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:m=>n({transpose:m}),hint:"Flip rows and columns — the first column becomes the header row."}),M.jsx(Ks,{label:"Hash output",checked:e.hash,onChange:m=>n({hash:m}),hint:"The first column becomes the object key instead of a field."}),M.jsx(Ks,{label:"Minify",checked:e.minify,onChange:m=>n({minify:m}),hint:"Remove indentation from the JSON output. Data is untouched."})]}):M.jsx(Ks,{label:"Flatten nested arrays",checked:e.flatten,onChange:m=>n({flatten:m}),hint:"Explode nested arrays into extra rows with dotted keys — needed when the JSON isn't a flat table."})]});return c?M.jsx("div",{"data-testid":"options-row",className:"flex flex-shrink-0 flex-row items-center gap-5 border-t border-border bg-panel px-5 py-2.5 text-[13px] text-muted-foreground",children:M.jsxs("div",{"data-testid":"options-settings-menu",role:"group","aria-label":"Parse settings",className:"flex flex-1 flex-wrap items-center gap-x-4 gap-y-2.5",children:[p,r?M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex-1"}),M.jsx("span",{"data-testid":"options-notice",children:r})]}):null]})}):M.jsxs("div",{"data-testid":"options-row",ref:u,className:"relative flex flex-shrink-0 flex-col border-t border-border bg-panel px-3.5 py-2 text-[13px] text-muted-foreground md:px-4",children:[M.jsxs("div",{className:"flex w-full items-center gap-2",children:[M.jsxs("button",{type:"button",ref:a,"data-testid":"options-settings-toggle","aria-expanded":o,"aria-haspopup":"true",onClick:()=>o?h():l(!0),className:"inline-flex shrink-0 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-md py-0.5 text-[13px] font-medium text-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:["Parse settings",M.jsx(bI,{"aria-hidden":"true",className:Br("size-3.5 shrink-0 transition-transform",o&&"rotate-180")})]}),M.jsx("span",{"data-testid":"options-settings-summary",className:"min-w-0 truncate",children:d}),r?M.jsx("span",{"data-testid":"options-notice",className:"ml-auto shrink-0 text-right",children:r}):null]}),M.jsx("div",{"data-testid":"options-settings-menu",role:"group","aria-label":"Parse settings",hidden:!o,className:Br("absolute bottom-full left-0 z-50 mb-2 w-full items-center gap-x-4 gap-y-2.5 rounded-md border border-border bg-panel p-3 shadow-md",o?"flex flex-wrap":"hidden"),children:p})]})}const JX=3;function ZX(t){const e=t.slice(0,JX),n=t.length-e.length;return(n>0?[...e,`+${n} more`]:e).join(` +`)}function eG({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 x=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(ex,{"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","aria-label":"Copy",title:"Copy",onClick:f,disabled:!n,className:Jo,children:[M.jsx(Ev,{"aria-hidden":"true"}),M.jsx("span",{className:"hidden xl:inline",children:"Copy"})]}),M.jsxs("button",{type:"button","data-testid":"download-output","aria-label":"Download",title:"Download",onClick:d,disabled:!n,className:Jo,children:[M.jsx(q2,{"aria-hidden":"true"}),M.jsx("span",{className:"hidden xl:inline",children:"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(ex,{"aria-hidden":"true"}),"Discard edits & reconvert"]}):void 0}:r?{kind:"error",message:r}:o&&o.length>0?{kind:"notice",message:ZX(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?x?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 tG({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 xm(t){return Math.min(Ry,Math.max(My,t))}function nG({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 x;const p=(x=o.current)==null?void 0:x.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(xm(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(xm(e-d));break;case"ArrowRight":case"ArrowDown":f.preventDefault(),n(xm(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:Br("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:Br("flex min-h-0 min-w-0 flex-col overflow-hidden border-border bg-panel max-md:min-h-[280px] max-md:max-h-[360px]","h-[var(--split)] border-b","md:h-auto md:w-[var(--split)] md:border-b-0 md:border-r"),children:r}),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:Br("relative z-10 flex h-9 flex-shrink-0 items-center justify-center border-b border-border bg-muted/20 cursor-row-resize","md:absolute md:top-0 md:right-auto md:bottom-0 md:left-[var(--split)] md:h-auto md:w-0 md:border-b-0 md:bg-transparent md:cursor-col-resize"),children:[M.jsx("div",{className:Br("absolute","inset-0","md:inset-auto md:top-0 md:right-auto md:bottom-0 md:-left-1.5 md:h-auto md:w-3")}),s?M.jsx("div",{className:"relative z-10 md:absolute md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2",children:s}):null]}),M.jsx("div",{"data-testid":"pane-right",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-panel max-md:min-h-[240px] max-md:max-h-[340px]",children:i})]})}function rG({theme:t}){return t==="dark"?M.jsx(zI,{size:15,strokeWidth:2,"aria-hidden":"true"}):M.jsx(MI,{size:15,strokeWidth:2,"aria-hidden":"true"})}function iG({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(rG,{theme:t})})]})}function sG(t){return[...t].sort((e,n)=>n.id-e.id)}const KM=[{id:15,date:"2026-10-18",tag:"improvement",title:"Options fold into a Parse settings menu",summary:"On narrower screens the converter's options bar no longer wraps onto extra lines — it collapses to a single Parse settings line showing your active options, with the full control set in a drop-up above it. Small screens lose the accordion that squeezed the panes."},{id:14,date:"2026-10-17",tag:"improvement",title:"Polished mobile stacked panes and collapsible options bar",summary:"Small screens now stack the input and output panes with an in-flow direction switch and compact icon actions so nothing overlaps. The options bar collapses into a one-tap summary on phones while keeping every setting a tap away."},{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."}],oG=864e5;function AS(t){return Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}function lG(t,e=Date.now()){const n=new Date(`${t}T00:00:00Z`),r=new Date(e),i=Math.round((AS(r)-AS(n))/oG);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 XM="csvjson:changelog.v1",Fd=Math.max(...KM.map(t=>t.id),0),aG=sG(KM);function uG(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&&!cG(e.clientId)||e.pendingIds!==void 0&&(!Array.isArray(e.pendingIds)||e.pendingIds.some(n=>typeof n!="number"||!Number.isInteger(n)||n<1)))}function cG(t){return typeof t=="string"&&/^[0-9a-fA-F-]{8,64}$/.test(t)}function GM(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=GM(t.pendingIds),i=n?[...new Set([...r,e])].sort((s,o)=>s-o):r.filter(s=>s!==e);return{...t,pendingIds:i}}function fG(){try{const t=window.localStorage.getItem(XM);if(t===null)return{lastSeenId:null,votes:{}};const e=JSON.parse(t);return uG(e)?{...e,pendingIds:GM(e.pendingIds)}:{lastSeenId:null,votes:{}}}catch{return{lastSeenId:null,votes:{}}}}function dG(t){try{window.localStorage.setItem(XM,JSON.stringify(t))}catch{}}function hG(){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 pG(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 gG({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:lG(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(UI,{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(WI,{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 mG(){const[t,e]=v.useState(fG),[n,r]=v.useState(!1),i=v.useRef(t),s=v.useCallback(b=>{dG(b),i.current=b,e(b)},[]),[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((b,S)=>{l(T=>{const E=new Set(T);return S?E.add(b):E.delete(b),E})},[]),p=v.useCallback((b,S,T,E)=>{const A=(f.current.get(b)??0)+1;f.current.set(b,A),a.current.add(b),E&&h(b,!0),pG(T,b,S).then(I=>{f.current.get(b)===A&&(a.current.delete(b),I==="ok"&&(rI({entry_id:b,vote:S}),s(MS(i.current,b,!1))),E&&h(b,!1))})},[s,h]),m=v.useCallback(b=>{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===b||a.current.has(I))continue;const _=E[I];_!==void 0&&p(I,_,S,!1)}},[p]),x=(b,S)=>{if(t.votes[b]===S){m();return}const T=t.clientId??hG();s(MS({...t,votes:{...t.votes,[b]:S},clientId:T},b,!0)),p(b,S,T,!0),m(b)},g=()=>{r(!0),nI(),t.lastSeenId!==Fd&&s({...t,lastSeenId:Fd}),m()},y=v.useCallback(()=>{r(!1)},[]),w=v.useRef(!1);v.useEffect(()=>{var b;w.current&&!n&&((b=c.current)==null||b.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 b=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",b),document.addEventListener("click",S),()=>{document.removeEventListener("keydown",b),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(II,{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:aG.map(b=>{var S;return M.jsx(gG,{entry:b,vote:t.votes[b.id],queued:((S=t.pendingIds)==null?void 0:S.includes(b.id))??!1,inFlight:o.has(b.id),onVote:x},b.id)})})]})]})}function yG(t,e){const[n,r]=v.useState(t);return v.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}const vG={},wG=["csv2json","json2csv","json_validator","json_beautifier","sql2json","csvjson2json","datajanitor"],xG=["csv2json","json2csv","csvjson2json"];function bG(t){return xG.includes(t)}const kG=/^[0-9a-f]{32}$/i,SG=/^\/([a-z0-9_]+)\/([0-9a-f]{32})\/?$/i,bm=vG,CG=((bm==null?void 0:bm.VITE_S3_DATA_URL)??"https://csvjson.s3.us-east-2.amazonaws.com/data/").replace(/\/*$/,"/");function TG(t){const e=SG.exec(t);if(!e)return null;const n=e[1].toLowerCase();return wG.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 EG(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string"||typeof e=="boolean")}function AG(t){var i;if(!EG(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 MG(t){if(!kG.test(t))throw new Oy;let e;try{e=await fetch(`${CG}${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 RG(t){const e=v.useMemo(()=>t&&bG(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 MG(e).then(f=>{if(c)return;const d=AG(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 OG="\uFEFF";function PG(t,e){return e?OG+t:t}function IG(t,e,n){const r=PG(t,n);return new Blob([r],{type:`${e};charset=utf-8`})}const DG=new Set(["csv","tsv","json","txt"]);function _G(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(!DG.has(e.slice(n+1).toLowerCase()))break;e=e.slice(0,n)}return e}function NG(t,e){const n=e==="csv2json"?"json":"csv";return t?`${_G(t)}.${n}`:`data.${n}`}function IS(t,e,{mime:n="text/plain",bom:r=!1}={}){const i=IG(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 LG(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 FG=`album,year,US_peak_chart_post The White Stripes,1999, De Stijl,2000, White Blood Cells,2001,61 @@ -286,4 +286,4 @@ Icky Thump,2007,2`,BG=`[ "year": 2007, "label": "XL Recordings" } -]`,GM="csvjson-theme";function zG(){try{const t=localStorage.getItem(GM);return t==="dark"||t==="light"?t:null}catch{return null}}function $G(){try{if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return"light"}function jG(){return zG()??$G()}function HG(t){try{localStorage.setItem(GM,t)}catch{}}function WG(t){return new URLSearchParams(t).get("direction")==="json2csv"?"json2csv":"csv2json"}const DS=2*1024*1024,VG=150,UG=1e3,KG=2e3,XG=2e3;function GG(t,e){return t===0?null:e>0?`${t} rows · ${e} cols`:`${t} rows`}function YG(t){try{return JSON.parse(t),!0}catch{return!1}}function qG(){var dt;const[t,e]=v.useState(jG);v.useEffect(()=>{document.documentElement.classList.toggle("dark",t==="dark")},[t]);const n=()=>e(fe=>{const Ze=fe==="dark"?"light":"dark";return HG(Ze),Ze}),[r,i]=v.useState(()=>typeof window>"u"?"csv2json":WG(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),[x,g]=v.useState(null),[y,w]=v.useState("utf-8"),k=v.useRef({direction:r,options:a,input:l,resultOk:!0}),b=v.useRef(null);b.current||(b.current=uI({settleMs:KG,minWindowMs:XG,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=b.current,E=yG("(min-width: 48rem)")?"side-by-side":"stacked",A=r==="csv2json",I=A?"CSV":"JSON",_=A?"JSON":"CSV",P=l.trim()==="",N=l.length>DS?UG:VG,D=mG(l,P?0:N),ee=v.useRef(null),ne=v.useRef(null),W=l!==""&&((dt=ee.current)==null?void 0:dt.text)===l?l:D,Y=v.useMemo(()=>typeof window>"u"?null:TG(window.location.pathname),[]),R=RG(Y),O=v.useMemo(()=>Mu(r,W,a),[r,W,a]);k.current={direction:r,options:a,input:W,resultOk:O.ok},v.useEffect(()=>{const fe=ne.current;!fe||fe.text!==W||(ne.current=null,S.discrete(fe.direction,fe.via,fe.text))},[W,O,S]);const[F,L]=v.useState(null);v.useEffect(()=>{W.trim()!==""&&O.ok&&L(O.text)},[O,W]);const H=W.trim()!==""&&O.ok?O.text:F,[$,ue]=v.useState(!1),[ce,xe]=v.useState(null),Ge=$?ce:H,$e=A&&!P&&Ge!==null&&($||O.ok),at=v.useCallback(fe=>{if(fe===H){ue(!1),xe(null);return}ue(!0),xe(fe)},[H]),_t=v.useCallback(()=>{const fe=Mu(r,l,a);fe.ok&&L(fe.text),ue(!1),xe(null)},[r,l,a]),Qe=v.useCallback(fe=>{o(Ze=>A?q6(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=Q6(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=J6(s);g(null),o(fe),S.edit("csv_to_json",fe.present)},[A,s,S]),me=()=>{if($){const fe=ce??"";o(Ze=>zl(YG(fe)?fe:Ze.present)),i(Ze=>Ze==="csv2json"?"json2csv":"csv2json"),ue(!1),xe(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),xe(null),eI(),S.discrete(Ie.direction==="csv2json"?"csv_to_json":"json_to_csv","permalink",Ie.input)},[Ie,S]);const Le=async(fe,Ze)=>{if(!XX(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 bS(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 bS(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||LG(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?GG(O.rows,O.cols):null,ut=!O.ok&&F?"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:H;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:H)??"",NG(d,A?"csv2json":"json2csv"),{mime:A?"application/json":"text/csv",bom:!A})},wt=M.jsx(UX,{format:I,input:l,onInputChange:_e,onCellCommit:_e,onFile:Le,onTryExample:()=>{g(null);const fe=A?FG:BG;Qe(fe),S.edit(A?"csv_to_json":"json_to_csv",fe)},onClear:()=>{Qe(""),h(null),ue(!1),xe(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:x,delimiter:a.separator==="auto"?void 0:a.separator,dark:t==="dark"}),ct=M.jsx(ZX,{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 min-h-svh flex-col md:h-svh md:min-h-0",children:[M.jsx(DD,{}),M.jsx(rG,{theme:t,onToggleTheme:n,slot:M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx(gG,{}),M.jsx(BD,{})]})}),Y&&(R.phase==="loading"||R.phase==="not-found"||R.phase==="unsupported"||R.phase==="error")?M.jsx(eG,{phase:R.phase,message:R.phase==="error"?R.message:void 0,onRetry:R.retry}):null,M.jsx(tG,{layout:E,split:c,onSplitChange:f,left:wt,right:ct,children:M.jsx(RD,{direction:r,onFlip:me})}),M.jsx(qX,{direction:r,options:a,onChange:fe=>u(Ze=>({...Ze,...fe})),uploadEncoding:y,onUploadEncodingChange:nt,notice:he?"Large file — converting on pause":null})]}),M.jsx(PD,{})]})}K2(document.getElementById("root")).render(M.jsx(v.StrictMode,{children:M.jsx(qG,{})}));document.getElementById("root").removeAttribute("inert");JP();ZP();export{AW as C,In as R,JF as T,na as a,C3 as b,qP as c,jl as i,QF as m,v as r,Wr as s}; +]`,qM="csvjson-theme";function zG(){try{const t=localStorage.getItem(qM);return t==="dark"||t==="light"?t:null}catch{return null}}function $G(){try{if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return"light"}function jG(){return zG()??$G()}function HG(t){try{localStorage.setItem(qM,t)}catch{}}function WG(t){return new URLSearchParams(t).get("direction")==="json2csv"?"json2csv":"csv2json"}const DS=2*1024*1024,VG=150,UG=1e3,KG=2e3,XG=2e3;function GG(t,e){return t===0?null:e>0?`${t} rows · ${e} cols`:`${t} rows`}function qG(t){try{return JSON.parse(t),!0}catch{return!1}}function YG(){var dt;const[t,e]=v.useState(jG);v.useEffect(()=>{document.documentElement.classList.toggle("dark",t==="dark")},[t]);const n=()=>e(fe=>{const Ze=fe==="dark"?"light":"dark";return HG(Ze),Ze}),[r,i]=v.useState(()=>typeof window>"u"?"csv2json":WG(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),[x,g]=v.useState(null),[y,w]=v.useState("utf-8"),k=v.useRef({direction:r,options:a,input:l,resultOk:!0}),b=v.useRef(null);b.current||(b.current=cI({settleMs:KG,minWindowMs:XG,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=b.current,E=VM("(min-width: 48rem)")?"side-by-side":"stacked",A=r==="csv2json",I=A?"CSV":"JSON",_=A?"JSON":"CSV",P=l.trim()==="",N=l.length>DS?UG:VG,D=yG(l,P?0:N),ee=v.useRef(null),ne=v.useRef(null),W=l!==""&&((dt=ee.current)==null?void 0:dt.text)===l?l:D,q=v.useMemo(()=>typeof window>"u"?null:TG(window.location.pathname),[]),R=RG(q),O=v.useMemo(()=>Mu(r,W,a),[r,W,a]);k.current={direction:r,options:a,input:W,resultOk:O.ok},v.useEffect(()=>{const fe=ne.current;!fe||fe.text!==W||(ne.current=null,S.discrete(fe.direction,fe.via,fe.text))},[W,O,S]);const[F,L]=v.useState(null);v.useEffect(()=>{W.trim()!==""&&O.ok&&L(O.text)},[O,W]);const H=W.trim()!==""&&O.ok?O.text:F,[$,ue]=v.useState(!1),[ce,xe]=v.useState(null),Ge=$?ce:H,$e=A&&!P&&Ge!==null&&($||O.ok),at=v.useCallback(fe=>{if(fe===H){ue(!1),xe(null);return}ue(!0),xe(fe)},[H]),_t=v.useCallback(()=>{const fe=Mu(r,l,a);fe.ok&&L(fe.text),ue(!1),xe(null)},[r,l,a]),Qe=v.useCallback(fe=>{o(Ze=>A?Q6(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=J6(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=Z6(s);g(null),o(fe),S.edit("csv_to_json",fe.present)},[A,s,S]),me=()=>{if($){const fe=ce??"";o(Ze=>zl(qG(fe)?fe:Ze.present)),i(Ze=>Ze==="csv2json"?"json2csv":"csv2json"),ue(!1),xe(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),xe(null),tI(),S.discrete(Ie.direction==="csv2json"?"csv_to_json":"json_to_csv","permalink",Ie.input)},[Ie,S]);const Le=async(fe,Ze)=>{if(!GX(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 bS(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 bS(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||LG(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?GG(O.rows,O.cols):null,ut=!O.ok&&F?"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:H;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:H)??"",NG(d,A?"csv2json":"json2csv"),{mime:A?"application/json":"text/csv",bom:!A})},wt=M.jsx(KX,{format:I,input:l,onInputChange:_e,onCellCommit:_e,onFile:Le,onTryExample:()=>{g(null);const fe=A?FG:BG;Qe(fe),S.edit(A?"csv_to_json":"json_to_csv",fe)},onClear:()=>{Qe(""),h(null),ue(!1),xe(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:x,delimiter:a.separator==="auto"?void 0:a.separator,dark:t==="dark"}),ct=M.jsx(eG,{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 min-h-svh flex-col md:h-svh md:min-h-0",children:[M.jsx(_D,{}),M.jsx(iG,{theme:t,onToggleTheme:n,slot:M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx(mG,{}),M.jsx(zD,{})]})}),q&&(R.phase==="loading"||R.phase==="not-found"||R.phase==="unsupported"||R.phase==="error")?M.jsx(tG,{phase:R.phase,message:R.phase==="error"?R.message:void 0,onRetry:R.retry}):null,M.jsx(nG,{layout:E,split:c,onSplitChange:f,left:wt,right:ct,children:M.jsx(OD,{direction:r,onFlip:me})}),M.jsx(QX,{direction:r,options:a,onChange:fe=>u(Ze=>({...Ze,...fe})),uploadEncoding:y,onUploadEncodingChange:nt,notice:he?"Large file — converting on pause":null})]}),M.jsx(ID,{})]})}K2(document.getElementById("root")).render(M.jsx(v.StrictMode,{children:M.jsx(YG,{})}));document.getElementById("root").removeAttribute("inert");ZP();eI();export{MW as C,In as R,ZF as T,na as a,T3 as b,QP as c,jl as i,JF as m,v as r,Wr as s}; diff --git a/app/dist/assets/index-TYrfmu5U.css b/app/dist/assets/index-TYrfmu5U.css new file mode 100644 index 0000000..f061ab2 --- /dev/null +++ b/app/dist/assets/index-TYrfmu5U.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));--breakpoint-fit:98.5rem}}@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-0{top:0}.top-1{top:var(--spacing)}.top-1\/2{top:50%}.top-9{top:calc(var(--spacing) * 9)}.right-0{right:0}.right-1{right:var(--spacing)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.bottom-full{bottom:100%}.left-0{left:0}.left-1\.5{left:calc(var(--spacing) * 1.5)}.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}}@media (min-width:98.5rem){.container{max-width:98.5rem}}.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)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.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-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.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-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.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-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-12{min-height:calc(var(--spacing) * 12)}.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-\[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-2\.5{gap:calc(var(--spacing) * 2.5)}.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)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2\.5{row-gap:calc(var(--spacing) * 2.5)}: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))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.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\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.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-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\:max-h-\[340px\]{max-height:340px}.max-md\:max-h-\[360px\]{max-height:360px}.max-md\:min-h-\[240px\]{min-height:240px}.max-md\:min-h-\[280px\]{min-height:280px}.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}.sm\:px-4{padding-inline:calc(var(--spacing) * 4)}.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media (min-width:48rem){.md\:absolute{position:absolute}.md\:inset-auto{inset:auto}.md\:top-0{top:0}.md\:top-1\/2{top:50%}.md\:right-auto{right:auto}.md\:bottom-0{bottom:0}.md\:-left-1\.5{left:calc(var(--spacing) * -1.5)}.md\:left-1\/2{left:50%}.md\:left-\[var\(--split\)\]{left:var(--split)}.md\:block{display:block}.md\:hidden{display:none}.md\:size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.md\:size-11{width:calc(var(--spacing) * 11);height:calc(var(--spacing) * 11)}.md\:h-8{height:calc(var(--spacing) * 8)}.md\:h-12{height:calc(var(--spacing) * 12)}.md\:h-auto{height:auto}.md\:h-svh{height:100svh}.md\:min-h-0{min-height:0}.md\:min-h-12{min-height:calc(var(--spacing) * 12)}.md\:w-0{width:0}.md\:w-3{width:calc(var(--spacing) * 3)}.md\:w-\[var\(--split\)\]{width:var(--split)}.md\:-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:cursor-col-resize{cursor:col-resize}.md\:flex-row{flex-direction:row}.md\:gap-1{gap:var(--spacing)}.md\:gap-3{gap:calc(var(--spacing) * 3)}.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\:bg-transparent{background-color:#0000}.md\:p-6{padding:calc(var(--spacing) * 6)}.md\:px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.md\:px-4{padding-inline:calc(var(--spacing) * 4)}.md\:px-16{padding-inline:calc(var(--spacing) * 16)}.md\:py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.md\:pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.md\:pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.md\:text-\[11px\]{font-size:11px}}@media (min-width:64rem){.lg\:inline{display:inline}.lg\:gap-3{gap:calc(var(--spacing) * 3)}.lg\:gap-x-3{column-gap:calc(var(--spacing) * 3)}.lg\:px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.lg\:pr-3{padding-right:calc(var(--spacing) * 3)}.lg\:pl-5{padding-left:calc(var(--spacing) * 5)}}@media (min-width:80rem){.xl\:block{display:block}.xl\:inline{display:inline}}@media (min-width:98.5rem){.fit\:block{display:block}}.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-BpbJ-7AH.js b/app/dist/assets/number-overlay-editor-Vq5g9w6Z.js similarity index 99% rename from app/dist/assets/number-overlay-editor-BpbJ-7AH.js rename to app/dist/assets/number-overlay-editor-Vq5g9w6Z.js index 48cf4f9..2b40c99 100644 --- a/app/dist/assets/number-overlay-editor-BpbJ-7AH.js +++ b/app/dist/assets/number-overlay-editor-Vq5g9w6Z.js @@ -1,4 +1,4 @@ -import{s as Be,R as Y,r as O}from"./index-CRYEo6Tq.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 - - + + - +

CSV to JSON and JSON to CSV converter

Enjoy a cleaner, simpler CSVJSON. Leave feedback or ask for features here.

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.
Auto · Parse numbers · Parse JSON

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.