@telepath-computer/television 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canonical/v2/components.js +1 -1
- package/dist/canonical/v2/styles.css +101 -13
- package/dist/cli.cjs +5 -5
- package/dist/skills/television/SKILL.md +3 -1
- package/dist/skills/television/theming.md +35 -36
- package/dist/views/markdown/index.html +3 -3
- package/dist/web/assets/main-Bi6QZnn7.css +1 -0
- package/dist/web/assets/main-BszOP74L.js +706 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/main-3UimTRLK.css +0 -1
- package/dist/web/assets/main-CSSzbG7q.js +0 -704
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</span>`)}function xZ({textContent:i,classes:t}){return L(t)?`<span class="${t.join(" ")}">${ng(i)}</span>`:ng(i)}const yZ=[{type:"table",location:"bottom-right"},{type:"table",location:"right"},{type:"table",location:"bottom"}];function kZ({row:i,col:t},e){const n=[{type:"header",location:"col",index:t},{type:"border",location:"top",index:i}],r=[{type:"border",location:"col",index:t+1},{type:"border",location:"row",index:i+1}],s=[{type:"header",location:"row",index:i},{type:"border",location:"left",index:i}];return[...e.top?n:[],...r,...e.left?s:[]]}function QZ({location:i,type:t},e){return t==="header"?{location:i,type:t,index:e[i]}:i==="top"?{location:i,type:t,index:e.row}:i==="left"?{location:i,type:t,index:e.col}:{location:i,type:t,index:e[i]+1}}function yf(i,t){return(i==null?void 0:i.type)!==(t==null?void 0:t.type)||(i==null?void 0:i.location)!==(t==null?void 0:t.location)?!1:(i==null?void 0:i.type)==="table"||(t==null?void 0:t.type)==="table"?!0:(i==null?void 0:i.index)===(t==null?void 0:t.index)}class bc{constructor(t,e){P(this,"state");P(this,"extraTags");this.state=t,this.extraTags=e}style(t){return aQ(this.state,L(this.extraTags)?[...t,...this.extraTags]:t)}static of(t,e){return new bc(t,e)}}function ov(i){return ih(i).type==="None"}function lv(i){return!ov(i)}function sg(i){return lv(i)?ih(i).getRangeAt(0).startOffset:void 0}function $Z(i){return lv(i)?ih(i).getRangeAt(0).startContainer:void 0}function CZ(i){ih(i).empty()}function ih(i){return i.getSelection()}var ps,ms,gs,bs,ws,Ss,vs,xs,ys,ks,Qs,$s,Cs,Ps,Ts,Rs,As,Zs,Xs,Es,Ls,Ms,zs,_s,Is,js,Ds,Ys,Ws,Vs,Bs;const lO=class lO{constructor({table:t,selection:e,scrollElement:n,rootEditor:r,menuRootElement:s,extensions:o,markdownConfig:l,globalKeyBindings:a,selectionType:c,lineWrapping:h,onUndo:u,onRedo:f,onNavigate:d,onDelete:O}){R(this,ps);R(this,ms);R(this,gs);R(this,bs);R(this,ws);R(this,Ss);R(this,vs);R(this,xs);R(this,ys);R(this,ks);R(this,Qs);R(this,$s);R(this,Cs);R(this,Ps);R(this,Ts);R(this,Rs);R(this,As);R(this,Zs);R(this,Xs);R(this,Es);R(this,Ls);R(this,Ms);R(this,zs);R(this,_s);R(this,Is);R(this,js);R(this,Ds);R(this,Ys);R(this,Ws);R(this,Vs);R(this,Bs);A(this,ps,H(t)),A(this,ms,H(e)),A(this,gs,ct(!1));const p=this.selection.isCell()?this.selection.cell:void 0;A(this,bs,ct(p)),A(this,ws,ct(p)),A(this,Ss,ct(L(p)?rt.ofCell(p):void 0)),A(this,vs,H(r)),A(this,xs,H(o)),A(this,ys,H(l)),A(this,ks,H(a)),A(this,Qs,H(c)),A(this,$s,H(h)),A(this,Cs,ct(void 0)),A(this,Ps,ct(void 0)),A(this,Ts,H(n)),A(this,Rs,H(s)),A(this,As,H(()=>bc.of(this.rootEditor.state,[S.heading]))),A(this,Zs,H(()=>bc.of(this.rootEditor.state))),A(this,Xs,H(u)),A(this,Es,H(f)),A(this,Ls,H(d)),A(this,Ms,H(O)),A(this,zs,ct(!1)),A(this,_s,ct(void 0)),A(this,Is,ct(void 0)),A(this,js,ct(void 0)),A(this,Ds,ct(void 0)),A(this,Ys,ct(void 0)),A(this,Ws,ct(void 0)),A(this,Vs,H(()=>V(this.move)&&V(this.resize)&&V(this.menu)&&V(this.outline))),A(this,Bs,ct(!1));const m=H(()=>{var g;if(Nc(this.window)){if(L(this.menu))return"default";if(L(this.activeHandle)){const{type:b,location:v}=this.activeHandle.handle;if(b==="table"){if(v==="right")return"col-resize";if(v==="bottom-right")return"nwse-resize";if(v==="bottom")return"row-resize"}else{if(b==="border")return v==="top"?"row-resize":v==="left"?"col-resize":`${v}-resize`;if(b==="header")return this.pointerDown?"grabbing":this.activeHandle.state==="hover"?"pointer":void 0}}else{if(((g=this.outline)==null?void 0:g.outlined)??!1)return"cell";if(L(this.hoveredCell))return"text"}}});Wd([()=>this.selectionValue],()=>{if(this.selectionChanged){this.selectionChanged=!1;return}this.selection.isCell()?(this.activeCell=this.selection.cell,this.anchorCell=this.selection.cell,this.outlinedSection=rt.ofCell(this.selection.cell)):this.selection.isHidden()?(this.focusTable(),this.activeCell=void 0,this.anchorCell=void 0,this.outlinedSection=void 0):(this.activeTable=!1,this.activeCell=void 0,this.anchorCell=void 0,this.outlinedSection=void 0)}),Hc(()=>{this.document.body.style.cursor=$(m)??""})}get table(){return $(w(this,ps))}set table(t){q(w(this,ps),t)}get _selection(){return $(w(this,ms))}set _selection(t){q(w(this,ms),t)}get selectionChanged(){return $(w(this,gs))}set selectionChanged(t){q(w(this,gs),t,!0)}get activeCell(){return $(w(this,bs))}set activeCell(t){q(w(this,bs),t)}get anchorCell(){return $(w(this,ws))}set anchorCell(t){q(w(this,ws),t)}get outlinedSection(){return $(w(this,Ss))}set outlinedSection(t){q(w(this,Ss),t)}get rootEditor(){return $(w(this,vs))}set rootEditor(t){q(w(this,vs),t)}get extensions(){return $(w(this,xs))}set extensions(t){q(w(this,xs),t)}get markdownConfig(){return $(w(this,ys))}set markdownConfig(t){q(w(this,ys),t)}get globalKeyBindings(){return $(w(this,ks))}set globalKeyBindings(t){q(w(this,ks),t)}get selectionType(){return $(w(this,Qs))}set selectionType(t){q(w(this,Qs),t)}get lineWrapping(){return $(w(this,$s))}set lineWrapping(t){q(w(this,$s),t)}get wrapperElement(){return $(w(this,Cs))}set wrapperElement(t){q(w(this,Cs),t)}get tableElement(){return $(w(this,Ps))}set tableElement(t){q(w(this,Ps),t)}get scrollElement(){return $(w(this,Ts))}set scrollElement(t){q(w(this,Ts),t)}get menuRootElement(){return $(w(this,Rs))}set menuRootElement(t){q(w(this,Rs),t)}get headerCellHighlighter(){return $(w(this,As))}set headerCellHighlighter(t){q(w(this,As),t)}get dataCellHighlighter(){return $(w(this,Zs))}set dataCellHighlighter(t){q(w(this,Zs),t)}get onUndo(){return $(w(this,Xs))}set onUndo(t){q(w(this,Xs),t)}get onRedo(){return $(w(this,Es))}set onRedo(t){q(w(this,Es),t)}get onNavigate(){return $(w(this,Ls))}set onNavigate(t){q(w(this,Ls),t)}get onDelete(){return $(w(this,Ms))}set onDelete(t){q(w(this,Ms),t)}get activeTable(){return $(w(this,zs))}set activeTable(t){q(w(this,zs),t)}get hoveredCell(){return $(w(this,_s))}set hoveredCell(t){q(w(this,_s),t)}get activeHandle(){return $(w(this,Is))}set activeHandle(t){q(w(this,Is),t)}get menu(){return $(w(this,js))}set menu(t){q(w(this,js),t)}get move(){return $(w(this,Ds))}set move(t){q(w(this,Ds),t)}get outline(){return $(w(this,Ys))}set outline(t){q(w(this,Ys),t)}get resize(){return $(w(this,Ws))}set resize(t){q(w(this,Ws),t)}get interactive(){return $(w(this,Vs))}set interactive(t){q(w(this,Vs),t)}get pointerDown(){return $(w(this,Bs))}set pointerDown(t){q(w(this,Bs),t)}static of(t){return new lO(t)}focusTable(){this.activeTable=!0,this.tableElement.focus({preventScroll:!0}),this.selectionValue="hidden",CZ(this.document)}scrollToCell(t){requestAnimationFrame(()=>{var e;(e=gc(this.tableElement,t))==null||e.scrollIntoView({inline:"nearest",block:"nearest"})})}scrollToFirstCell(t,e){requestAnimationFrame(()=>{var n;(n=gc(this.tableElement,{...this.table.firstCellLocation,[t]:e}))==null||n.scrollIntoView({inline:"nearest",block:"nearest"})})}get document(){return this.rootEditor.dom.ownerDocument}get window(){return this.document.defaultView??window}get rootScrollElement(){return this.rootEditor.scrollDOM}get scrollOffsetX(){return this.rootScrollElement.scrollLeft+this.scrollElement.scrollLeft}get scrollOffsetY(){return this.rootScrollElement.scrollTop+this.scrollElement.scrollTop}deleteTable(){this.onDelete()}navigate(t){this.onNavigate(t)}undo(){this.onUndo()}redo(){this.onRedo()}get selection(){return this._selection}get selectionValue(){return this._selection.value}set selectionValue(t){th(this._selection.value,t)||(this._selection.value=t,this.selectionChanged=!0)}highlighter({row:t}){return t===this.table.firstRowIndex?this.headerCellHighlighter:this.dataCellHighlighter}cellHandleState(t,e){var n,r,s,o,l;return e.type==="border"||((n=this.activeHandle)==null?void 0:n.state)=="active"?yf((r=this.activeHandle)==null?void 0:r.handle,e)?(s=this.activeHandle)==null?void 0:s.state:void 0:yf((o=this.activeHandle)==null?void 0:o.handle,e)||t[e.location]===((l=this.activeCell)==null?void 0:l[e.location])?"hover":void 0}};ps=new WeakMap,ms=new WeakMap,gs=new WeakMap,bs=new WeakMap,ws=new WeakMap,Ss=new WeakMap,vs=new WeakMap,xs=new WeakMap,ys=new WeakMap,ks=new WeakMap,Qs=new WeakMap,$s=new WeakMap,Cs=new WeakMap,Ps=new WeakMap,Ts=new WeakMap,Rs=new WeakMap,As=new WeakMap,Zs=new WeakMap,Xs=new WeakMap,Es=new WeakMap,Ls=new WeakMap,Ms=new WeakMap,zs=new WeakMap,_s=new WeakMap,Is=new WeakMap,js=new WeakMap,Ds=new WeakMap,Ys=new WeakMap,Ws=new WeakMap,Vs=new WeakMap,Bs=new WeakMap;let kf=lO;function av({tableState:i,event:t}){if(V(i.outlinedSection))return;t==null||t.preventDefault();const e=Hm(i.outlinedSection.rowRange,i.table.rowRange),n=Hm(i.outlinedSection.colRange,i.table.colRange),r=n&&!e&&Qn(i.outlinedSection.rowRange).every(l=>i.table.hasEmptyRowAt(l)),s=e&&!n&&Qn(i.outlinedSection.colRange).every(l=>i.table.hasEmptyColAt(l)),o=e&&n&&Qn(i.outlinedSection.colRange).every(l=>i.table.hasEmptyColAt(l));if(r){i.table.removeRowsAt({row:i.outlinedSection.startRow,count:i.outlinedSection.rowCount});const l=i.table.hasRowAt(i.outlinedSection.startRow)?i.outlinedSection.startRow:i.table.lastRowIndex,a={row:l,col:i.table.lastColIndex};i.outlinedSection=rt.of({row:{start:l,endExclusive:l+1},col:i.table.colRange}),i.activeCell=a,i.anchorCell=a}else if(s){i.table.removeColsAt({col:i.outlinedSection.startCol,count:i.outlinedSection.colCount});const l=i.table.hasColAt(i.outlinedSection.startCol)?i.outlinedSection.startCol:i.table.lastColIndex,a={row:i.table.lastRowIndex,col:l};i.outlinedSection=rt.of({row:i.table.rowRange,col:{start:l,endExclusive:l+1}}),i.activeCell=a,i.anchorCell=a}else o?i.deleteTable():i.table.clearSection(i.outlinedSection)}function cv(i){uv(i,"copy")}function hv(i){uv(i,"cut")}function Vd({event:i,tableState:t}){if(V(t.outlinedSection))return;const e=i.clipboardData.getData("text/plain"),n=gl.maybeOf(B.of(e.split(/\r\n|\n|\r/)));L(n)?(i.preventDefault(),i.stopPropagation(),og(n,t)):t.selection.isCell()||(i.preventDefault(),i.stopPropagation(),og(PZ(e),t))}function og(i,t){const{startRow:e,startCol:n,rowCount:r,colCount:s}=t.outlinedSection,o=Zm(r/i.rowCount),l=Zm(s/i.colCount);i.tile({rowRepeat:ce(o-1,{min:0}),colRepeat:ce(l-1,{min:0})}),t.table.merge(i,{row:e,col:n}),t.outlinedSection=rt.of({row:{start:e,endExclusive:e+i.rowCount},col:{start:n,endExclusive:n+i.colCount}}),V(t.anchorCell)&&(t.anchorCell=t.activeCell);const a=t.anchorCell.row<=t.activeCell.row,c=t.anchorCell.col<=t.activeCell.col;t.anchorCell=t.outlinedSection.cornerCellAt(`${a?"top":"bottom"}-${c?"left":"right"}`),t.activeCell=t.outlinedSection.cornerCellAt(`${a?"bottom":"top"}-${c?"right":"left"}`),t.focusTable()}function PZ(i){const{text:t}=j1([[le(i)]],["none"]);return gl.of(t)}function uv({event:i,tableState:t},e){var r;if(V(t.outlinedSection)||t.selection.isCell())return;i.preventDefault(),i.stopPropagation();const n=t.table.sliceSectionAt(t.outlinedSection);(r=i.clipboardData)==null||r.setData("text/plain",n.text.toString()),e==="cut"&&av({tableState:t})}function TZ(i){i.pointerDown=!0}function RZ(i){i.pointerDown=!1}function AZ(i){i.pointerDown=!1}function ZZ(i,t){t.selection.isCell()||cv({tableState:t,event:i})}function XZ(i,t){t.selection.isCell()||hv({tableState:t,event:i})}function EZ(i,t){t.selection.isCell()||Vd({tableState:t,event:i})}const Bd="CellView";function fv(i){return NS(i,{component:Bd})}function LZ(i){return qS(i,{component:Bd})}const kn="\0";function dv(i,t,{trim:e}){const n=nv(i),{from:r,to:s}=iv(i),o=t.toString(),l=B.of(`${o.slice(0,r)}${kn}${o.slice(r,s)}${kn}${o.slice(s)}`.split(`
|
|
62
62
|
`)),a=Qd(l,{trim:e}).toString(),c=a.indexOf(kn),h=a.lastIndexOf(kn)-1;return n?{anchor:c,head:h}:{head:c,anchor:h}}function lg(i,t){const e=nv(i),{from:n,to:r}=iv(i),s=t.toString(),o=B.of(`${s.slice(0,n)}${kn}${s.slice(n,r)}${kn}${s.slice(r)}`.split(`
|
|
63
63
|
`)),l=fc(o).toString(),a=l.indexOf(kn),c=l.lastIndexOf(kn)-1;return e?{anchor:a,head:c}:{head:a,anchor:c}}function MZ(i){if(V(i.tableElement)||ov(i.document))return;const t=$Z(i.document);if(V(t)||!VS(i.tableElement,t))return;const e=jl(t);if(V(e))return;const n=eh(e);i.selection.isCell()&&Rr(i.selection.cell,n)||(i.activeTable=!1,i.selectionValue={cell:n,section:zZ(i.document,t)},i.activeCell=n,i.anchorCell=n,i.outlinedSection=rt.ofCell(n))}function zZ(i,t){const e=fv(t),n=j5({ancestor:e,descendent:t,getText:l=>_5(l)?`
|
|
64
|
-
`:l.textContent??""})??"",r=(t.textContent??"").slice(0,sg(i)),s=le(`${n}${r}`),o=n.length+sg(i);return dv({anchor:o,head:o},s,{trim:!1})}function _Z(i,t){var e=_d(),n=Et(e);Pr(n,()=>t.children),I(i,e)}function IZ(i,t){Wn(t,!0),Kc(()=>{const e=IS(_Z,{target:t.to,context:VA(),props:{children:t.children}});return()=>{jS(e)}}),Vn()}YA();var jZ=ot('<div class="tbl-blocking-overlay" aria-hidden="true"></div>');function DZ(i){var t=jZ();I(i,t)}function wc(i,t){const e=t.devicePixelRatio;return zR(i*e)/e}function YZ({x:i,y:t},e){return{x:wc(i,e),y:wc(t,e)}}var WZ=ot('<th class="tbl-cell tbl-header-cell"><!></th>'),VZ=ot('<td class="tbl-cell tbl-data-cell"><!></td>');function BZ(i,t){Wn(t,!0);const e=H(()=>rg(L(t.movement)?t.movement.border:{top:t.position.top,right:!0,bottom:!0,left:t.position.left})),n=H(()=>rg(t.outline)),r=H(()=>{var u;if(V((u=t.movement)==null?void 0:u.translate))return;const{x:c,y:h}=t.movement.state==="moving"?YZ(t.movement.translate,t.win):t.movement.translate;return`translate3d(${c}px, ${h}px, 0px)`});var s=_d(),o=Et(s);{var l=c=>{var h=WZ();let u;var f=Ue(h);Pr(f,()=>t.children),se(d=>{var O;$t(h,"align",t.alignment==="none"?void 0:t.alignment),$t(h,"data-component",bl),$t(h,"data-row",t.location.row),$t(h,"data-col",t.location.col),$t(h,"data-border",$(e)),$t(h,"data-outline",$(n)),$t(h,"data-selected",d),$t(h,"data-state",(O=t.movement)==null?void 0:O.state),u=Oc(h,"",u,{transform:$(r)})},[()=>wr(t.selected)]),I(c,h)},a=c=>{var h=VZ();let u;var f=Ue(h);Pr(f,()=>t.children),se(d=>{var O;$t(h,"align",t.alignment==="none"?void 0:t.alignment),$t(h,"data-component",bl),$t(h,"data-row",t.location.row),$t(h,"data-col",t.location.col),$t(h,"data-border",$(e)),$t(h,"data-outline",$(n)),$t(h,"data-selected",d),$t(h,"data-state",(O=t.movement)==null?void 0:O.state),u=Oc(h,"",u,{transform:$(r)})},[()=>wr(t.selected)]),I(c,h)};Ft(o,c=>{t.position.top?c(l):c(a,!1)})}I(i,s),Vn()}function Ov(i){var t;return L((t=ml(i.dom).activeElement)==null?void 0:t.closest(".cm-panels"))}function ag(i){return i.trim().split(/\s+/)}function qZ({doc:i,selection:t,parent:e,extensions:n,markdownConfig:r,selectionType:s,lineWrapping:o,globalKeyBindings:l,rootEditor:a,highlighter:c,onChange:h,eventHandlers:u}){return new z({doc:i,selection:t,parent:e,extensions:[n,hn.lowest([z.editorAttributes.of(f=>{const d=new Set(ag(a.themeClasses)),O=new Set(ag(f.themeClasses));return{class:[...d.difference(O)].join(" ")}}),_n.of([...l.map(f=>({...f,run:L(f.run)?()=>f.run(a):void 0,shift:L(f.shift)?()=>f.shift(a):void 0}))]),s==="codemirror"?Sk():[],w0(c),_c({extensions:[L1,r.extensions??[]],addKeymap:!1,completeHTMLTags:r.completeHTMLTags,pasteURLAsLink:r.pasteURLAsLink,htmlTagLanguage:r.htmlTagLanguage}),z.domEventObservers(u),o==="wrap"?z.lineWrapping:[]])],dispatchTransactions:(f,d)=>{d.update(f),f.forEach(h)}})}var NZ=ot('<div class="tbl-cell-editor"></div>');function GZ(i,t){Wn(t,!0);let e=gf(t,"text",15),n=gf(t,"selection",15),r,s,o=!1,l=!1;function a(h){const{docChanged:u,newDoc:f,selection:d}=h;if(o)return;const O=L(d);if(u||O){if(u){const p=Qd(f,{trim:!0});p.eq(e())||(e(p),l=!0)}if(O){const{head:p,anchor:m}=d.main,g=dv({head:p,anchor:m},f,{trim:!0});ev(g,n())||(n(g),l=!0)}}}Wd([()=>e(),()=>n()],()=>{if(l){l=!1;return}o=!0,s.dispatch({changes:s.state.changes({from:0,to:s.state.doc.length,insert:fc(e())}),selection:lg(n(),e())}),o=!1},{lazy:!0}),Kc(()=>(s=qZ({doc:fc(e()),selection:lg(n(),e()),parent:r,selectionType:t.selectionType,lineWrapping:t.lineWrapping,extensions:t.extensions,markdownConfig:t.markdownConfig,globalKeyBindings:t.globalKeyBindings,rootEditor:t.rootEditor,highlighter:t.highlighter,onChange:a,eventHandlers:{beforeinput:t.onbeforeinput,dragstart:t.ondragstart,keydown:(h,{state:u})=>t.onkeydown(h,u),paste:t.onpaste}}),Ov(s)||s.focus(),()=>s.destroy()));var c=NZ();pc(c,h=>r=h,()=>r),I(i,c),Vn()}class nh{constructor({event:t,tableState:e,position:n}){P(this,"event");P(this,"tableState");P(this,"position");this.event=t,this.tableState=e,this.position=n}static navigate(t){new nh(t)[`navigate${t.key}`]()}navigateTab(){this.moveRight({createRow:!0,position:"end"})}navigateShiftTab(){this.moveLeft({createRow:!0,position:"end"})}navigateEnter(){this.moveDown({createRow:!0,position:"end"})}navigateArrowLeft(){this.position.left&&this.moveLeft({createRow:!1,position:"end"})}navigateArrowUp(){this.position.top&&this.moveUp({createRow:!1,position:"end"})}navigateArrowRight(){this.position.right&&this.moveRight({createRow:!1,position:"start"})}navigateArrowDown(){this.position.bottom&&this.moveDown({createRow:!1,position:"end"})}navigateShiftArrowLeft(){if(!(!this.position.left||V(this.tableState.outlinedSection)||V(this.tableState.activeCell))){if(this.event.preventDefault(),this.tableState.focusTable(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.tableState.activeCell),this.tableState.outlinedSection.endCol===this.tableState.anchorCell.col){if(this.tableState.outlinedSection.startCol===this.tableState.table.firstColIndex)return;this.tableState.outlinedSection=this.tableState.outlinedSection.expandLeft()}else this.tableState.outlinedSection=this.tableState.outlinedSection.contractLeft();this.tableState.activeCell=tv(this.tableState.activeCell)}}navigateShiftArrowUp(){if(!(!this.position.top||V(this.tableState.outlinedSection)||V(this.tableState.activeCell))){if(this.event.preventDefault(),this.tableState.focusTable(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.tableState.activeCell),this.tableState.outlinedSection.endRow===this.tableState.anchorCell.row){if(this.tableState.outlinedSection.startRow===this.tableState.table.firstRowIndex)return;this.tableState.outlinedSection=this.tableState.outlinedSection.expandUp()}else this.tableState.outlinedSection=this.tableState.outlinedSection.contractUp();this.tableState.activeCell=FS(this.tableState.activeCell)}}navigateShiftArrowRight(){if(!(!this.position.right||V(this.tableState.outlinedSection)||V(this.tableState.activeCell))){if(this.event.preventDefault(),this.tableState.focusTable(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.tableState.activeCell),this.tableState.outlinedSection.startCol===this.tableState.anchorCell.col){if(this.tableState.outlinedSection.endCol===this.tableState.table.lastColIndex)return;this.tableState.outlinedSection=this.tableState.outlinedSection.expandRight()}else this.tableState.outlinedSection=this.tableState.outlinedSection.contractRight();this.tableState.activeCell=KS(this.tableState.activeCell)}}navigateShiftArrowDown(){if(!(!this.position.bottom||V(this.tableState.outlinedSection)||V(this.tableState.activeCell))){if(this.event.preventDefault(),this.tableState.focusTable(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.tableState.activeCell),this.tableState.outlinedSection.startRow===this.tableState.anchorCell.row){if(this.tableState.outlinedSection.endRow===this.tableState.table.lastRowIndex)return;this.tableState.outlinedSection=this.tableState.outlinedSection.expandDown()}else this.tableState.outlinedSection=this.tableState.outlinedSection.contractDown();this.tableState.activeCell=JS(this.tableState.activeCell)}}moveLeft({createRow:t,position:e}){if(!V(this.tableState.activeCell)){if(this.event.preventDefault(),Rr(this.tableState.activeCell,this.tableState.table.firstCellLocation)){if(!t){this.tableState.navigate("before");return}this.tableState.table.prependEmptyRows(1),this.tableState.activeCell={row:this.tableState.activeCell.row+1,col:this.tableState.activeCell.col}}this.moveTo(this.tableState.activeCell.col===this.tableState.table.firstColIndex?{row:this.tableState.activeCell.row-1,col:this.tableState.table.lastColIndex}:{row:this.tableState.activeCell.row,col:this.tableState.activeCell.col-1},e)}}moveUp({createRow:t,position:e}){if(!V(this.tableState.activeCell)){if(this.event.preventDefault(),this.tableState.activeCell.row===this.tableState.table.firstRowIndex){if(!t){this.tableState.navigate("before");return}this.tableState.table.prependEmptyRows(1),this.tableState.activeCell={row:this.tableState.activeCell.row+1,col:this.tableState.activeCell.col}}this.moveTo({row:this.tableState.activeCell.row-1,col:this.tableState.activeCell.col},e)}}moveRight({createRow:t,position:e}){if(!V(this.tableState.activeCell)){if(this.event.preventDefault(),Rr(this.tableState.activeCell,this.tableState.table.lastCellLocation)){if(!t){this.tableState.navigate("after");return}this.tableState.table.appendEmptyRows(1)}this.moveTo(this.tableState.activeCell.col===this.tableState.table.lastColIndex?{row:this.tableState.activeCell.row+1,col:this.tableState.table.firstColIndex}:{row:this.tableState.activeCell.row,col:this.tableState.activeCell.col+1},e)}}moveDown({createRow:t,position:e}){if(!V(this.tableState.activeCell)){if(this.event.preventDefault(),this.tableState.activeCell.row===this.tableState.table.lastRowIndex){if(!t){this.tableState.navigate("after");return}this.tableState.table.appendEmptyRows(1)}this.moveTo({row:this.tableState.activeCell.row+1,col:this.tableState.activeCell.col},e)}}moveTo(t,e){if(this.tableState.activeCell=t,this.tableState.anchorCell=t,this.tableState.outlinedSection=rt.ofCell(t),this.tableState.selection.isCell()){const n=e==="start"?0:this.tableState.table.cellAt(t).length;this.tableState.selectionValue={cell:t,section:{anchor:n,head:n}}}}}const bt={alt:"Alt",arrowDown:"ArrowDown",arrowLeft:"ArrowLeft",arrowRight:"ArrowRight",arrowUp:"ArrowUp",backspace:"Backspace",c:"c",delete:"Delete",enter:"Enter",escape:"Escape",shift:"Shift",tab:"Tab",v:"v",x:"x"},UZ=[bt.arrowDown,bt.arrowLeft,bt.arrowRight,bt.arrowUp,bt.enter,bt.tab,`${bt.shift}${bt.arrowDown}`,`${bt.shift}${bt.arrowLeft}`,`${bt.shift}${bt.arrowRight}`,`${bt.shift}${bt.arrowUp}`,`${bt.shift}${bt.tab}`],cg=new Set(UZ);function pv({key:i,shiftKey:t,altKey:e,metaKey:n,ctrlKey:r}){if(!(e||n||r))return t?cg.has(`${bt.shift}${i}`)?`${bt.shift}${i}`:void 0:cg.has(i)?i:void 0}function HZ(i,t){i.inputType==="historyUndo"?(t.undo(),i.preventDefault()):i.inputType==="historyRedo"&&(t.redo(),i.preventDefault())}function FZ(i){i.preventDefault()}function KZ(i,t,e){const n=pv(i);if(V(n))return;const r=t.selection.main.head,s=t.doc.lineAt(r).number,o=0,l=t.doc.length,a=1,c=t.doc.lines,h={top:s===a,right:r===l,bottom:s===c,left:r===o};nh.navigate({tableState:e,key:n,event:i,position:h})}function JZ(i,t){Vd({tableState:t,event:i})}var tX=ot('<div class="tbl-cell-view" contenteditable="" tabindex="-1"><!></div>');function eX(i,t){Wn(t,!0);var e=tX(),n=Ue(e);Pr(n,()=>t.children),se(r=>{$t(e,"data-component",Bd),$t(e,"data-hidden",r)},[()=>wr(t.hidden)]),I(i,e),Vn()}const mv="Handle";function qd(i){if(!GS(i,{component:mv}))return;const{type:t,location:e}=Id(i).dataset;if(t==="table")return{type:t,location:e};{const n=eh(jl(i));return QZ({location:e,type:t},n)}}var iX=ni('<svg class="tbl-handle-grip" width="15" height="3" fill="currentColor" viewBox="0 0 15 3" xmlns="http://www.w3.org/2000/svg"><circle cx="1.5" cy="1.5" r="1.5"></circle><circle cx="7.5" cy="1.5" r="1.5"></circle><circle cx="13.5" cy="1.5" r="1.5"></circle></svg>'),nX=ni('<svg class="tbl-handle-grip" width="3" height="15" fill="currentColor" viewBox="0 0 3 15" xmlns="http://www.w3.org/2000/svg"><circle cy="1.5" cx="1.5" r="1.5"></circle><circle cy="7.5" cx="1.5" r="1.5"></circle><circle cy="13.5" cx="1.5" r="1.5"></circle></svg>'),rX=ot('<div class="tbl-handle" role="button" aria-hidden="true"><!></div>');function hg(i,t){Wn(t,!0);let e=gf(t,"toggle",3,!1);const n={table:{right:"vertical",bottom:"horizontal"},header:{row:"vertical",col:"horizontal"}},r=H(()=>{var c;return(c=n[t.of.type])==null?void 0:c[t.of.location]});var s=rX();Oc(s,"",{},{opacity:"var(--tbl-handle-opacity, 0)"});var o=Ue(s);{var l=c=>{var h=iX();I(c,h)},a=c=>{var h=nX();I(c,h)};Ft(o,c=>{$(r)==="horizontal"?c(l):$(r)==="vertical"&&c(a,1)})}se((c,h,u)=>{$t(s,"data-component",mv),$t(s,"data-type",t.of.type),$t(s,"data-location",t.of.location),$t(s,"data-active",c),$t(s,"data-hover",h),$t(s,"data-toggle",u)},[()=>wr(t.state==="active"),()=>wr(t.state==="hover"),()=>wr(e())]),I(i,s),Vn()}var sX=ot('<div class="tbl-menu"><!></div>');function oX(i,t){Wn(t,!0);let e,n=ct(void 0);Kc(()=>{t.translate(e).then(l=>q(n,l,!0))});var r=sX();let s;var o=Ue(r);Pr(o,()=>t.children),pc(r,l=>e=l,()=>e),se(l=>s=Oc(r,"",s,l),[()=>({visibility:L($(n))?void 0:"hidden",transform:L($(n))?`translate3d(${$(n).x}px, ${$(n).y}px, 0px)`:void 0})]),I(i,r),Vn()}var lX=ot('<div class="tbl-menu-item" role="menuitem" tabindex="-1"><!></div>');function Re(i,t){var e=lX(),n=Ue(e);Pr(n,()=>t.children),Lo("click",e,function(...r){var s;(s=t.onclick)==null||s.apply(this,r)}),I(i,e)}_S(["click"]);function Ae(i,t){switch(i.action){case"add":return t.menu.clickAdd(i.direction);case"align":return t.menu.clickAlign(i.alignment);case"clear":return t.menu.clickClear();case"duplicate":return t.menu.clickDuplicate();case"move":return t.menu.clickMove(i.direction);case"remove":return t.menu.clickRemove();case"sort":return t.menu.clickSort(i.direction)}}var aX=ni('<path d="M294.6 454.6L214.6 534.6C202.1 547.1 181.8 547.1 169.3 534.6L89.3 454.6C76.8 442.1 76.8 421.8 89.3 409.3C101.8 396.8 122.1 396.8 134.6 409.3L160 434.7L160 128C160 110.3 174.3 96 192 96C209.7 96 224 110.3 224 128L224 434.7L249.4 409.3C261.9 396.8 282.2 396.8 294.7 409.3C307.2 421.8 307.2 442.1 294.7 454.6zM476.6 113.7C527.3 215 553.9 268.4 556.6 273.7C564.5 289.5 558.1 308.7 542.3 316.6C526.5 324.5 507.3 318.1 499.4 302.3L492.2 288L403.8 288L396.6 302.3C388.7 318.1 369.5 324.5 353.7 316.6C337.9 308.7 331.5 289.5 339.4 273.7C342.1 268.4 368.7 215 419.4 113.7C424.8 102.9 435.9 96 448 96C460.1 96 471.2 102.8 476.6 113.7zM448 199.6L427.8 240L468.2 240L448 199.6zM352 384C352 366.3 366.3 352 384 352L512 352C524.9 352 536.6 359.8 541.6 371.8C546.6 383.8 543.8 397.5 534.7 406.7L461.3 480L512 480C529.7 480 544 494.3 544 512C544 529.7 529.7 544 512 544L384 544C371.1 544 359.4 536.2 354.4 524.2C349.4 512.2 352.2 498.5 361.3 489.3L434.7 415.9L384 415.9C366.3 415.9 352 401.6 352 383.9z"></path>'),cX=ni('<path d="M294.6 454.6L214.6 534.6C202.1 547.1 181.8 547.1 169.3 534.6L89.3 454.6C76.8 442.1 76.8 421.8 89.3 409.3C101.8 396.8 122.1 396.8 134.6 409.3L160 434.7L160 128C160 110.3 174.3 96 192 96C209.7 96 224 110.3 224 128L224 434.7L249.4 409.3C261.9 396.8 282.2 396.8 294.7 409.3C307.2 421.8 307.2 442.1 294.7 454.6zM352 128C352 110.3 366.3 96 384 96L512 96C524.9 96 536.6 103.8 541.6 115.8C546.6 127.8 543.8 141.5 534.7 150.7L461.3 224L512 224C529.7 224 544 238.3 544 256C544 273.7 529.7 288 512 288L384 288C371.1 288 359.4 280.2 354.4 268.2C349.4 256.2 352.2 242.5 361.3 233.3L434.8 160L384 160C366.3 160 352 145.7 352 128zM476.6 337.7L556.6 497.7C564.5 513.5 558.1 532.7 542.3 540.6C526.5 548.5 507.3 542.1 499.4 526.3L492.2 512L403.8 512L396.6 526.3C388.7 542.1 369.5 548.5 353.7 540.6C337.9 532.7 331.5 513.5 339.4 497.7L419.4 337.7C424.8 326.9 435.9 320 448 320C460.1 320 471.2 326.8 476.6 337.7zM448 423.6L427.8 464L468.2 464L448 423.6z"></path>'),hX=ni('<path d="M384 128C384 145.7 369.7 160 352 160L128 160C110.3 160 96 145.7 96 128C96 110.3 110.3 96 128 96L352 96C369.7 96 384 110.3 384 128zM384 384C384 401.7 369.7 416 352 416L128 416C110.3 416 96 401.7 96 384C96 366.3 110.3 352 128 352L352 352C369.7 352 384 366.3 384 384zM96 256C96 238.3 110.3 224 128 224L512 224C529.7 224 544 238.3 544 256C544 273.7 529.7 288 512 288L128 288C110.3 288 96 273.7 96 256zM544 512C544 529.7 529.7 544 512 544L128 544C110.3 544 96 529.7 96 512C96 494.3 110.3 480 128 480L512 480C529.7 480 544 494.3 544 512z"></path>'),uX=ni('<path d="M448 128C448 110.3 433.7 96 416 96L224 96C206.3 96 192 110.3 192 128C192 145.7 206.3 160 224 160L416 160C433.7 160 448 145.7 448 128zM544 256C544 238.3 529.7 224 512 224L128 224C110.3 224 96 238.3 96 256C96 273.7 110.3 288 128 288L512 288C529.7 288 544 273.7 544 256zM96 512C96 529.7 110.3 544 128 544L512 544C529.7 544 544 529.7 544 512C544 494.3 529.7 480 512 480L128 480C110.3 480 96 494.3 96 512zM448 384C448 366.3 433.7 352 416 352L224 352C206.3 352 192 366.3 192 384C192 401.7 206.3 416 224 416L416 416C433.7 416 448 401.7 448 384z"></path>'),fX=ni('<path d="M544 128C544 145.7 529.7 160 512 160L288 160C270.3 160 256 145.7 256 128C256 110.3 270.3 96 288 96L512 96C529.7 96 544 110.3 544 128zM544 384C544 401.7 529.7 416 512 416L288 416C270.3 416 256 401.7 256 384C256 366.3 270.3 352 288 352L512 352C529.7 352 544 366.3 544 384zM96 256C96 238.3 110.3 224 128 224L512 224C529.7 224 544 238.3 544 256C544 273.7 529.7 288 512 288L128 288C110.3 288 96 273.7 96 256zM544 512C544 529.7 529.7 544 512 544L128 544C110.3 544 96 529.7 96 512C96 494.3 110.3 480 128 480L512 480C529.7 480 544 494.3 544 512z"></path>'),dX=ni('<path d="M342.6 81.4C330.1 68.9 309.8 68.9 297.3 81.4L137.3 241.4C124.8 253.9 124.8 274.2 137.3 286.7C149.8 299.2 170.1 299.2 182.6 286.7L288 181.3L288 552C288 569.7 302.3 584 320 584C337.7 584 352 569.7 352 552L352 181.3L457.4 286.7C469.9 299.2 490.2 299.2 502.7 286.7C515.2 274.2 515.2 253.9 502.7 241.4L342.7 81.4z"></path>'),OX=ni('<path d="M566.6 342.6C579.1 330.1 579.1 309.8 566.6 297.3L406.6 137.3C394.1 124.8 373.8 124.8 361.3 137.3C348.8 149.8 348.8 170.1 361.3 182.6L466.7 288L96 288C78.3 288 64 302.3 64 320C64 337.7 78.3 352 96 352L466.7 352L361.3 457.4C348.8 469.9 348.8 490.2 361.3 502.7C373.8 515.2 394.1 515.2 406.6 502.7L566.6 342.7z"></path>'),pX=ni('<path d="M297.4 566.6C309.9 579.1 330.2 579.1 342.7 566.6L502.7 406.6C515.2 394.1 515.2 373.8 502.7 361.3C490.2 348.8 469.9 348.8 457.4 361.3L352 466.7L352 96C352 78.3 337.7 64 320 64C302.3 64 288 78.3 288 96L288 466.7L182.6 361.3C170.1 348.8 149.8 348.8 137.3 361.3C124.8 373.8 124.8 394.1 137.3 406.6L297.3 566.6z"></path>'),mX=ni('<path d="M73.4 297.4C60.9 309.9 60.9 330.2 73.4 342.7L233.4 502.7C245.9 515.2 266.2 515.2 278.7 502.7C291.2 490.2 291.2 469.9 278.7 457.4L173.3 352L544 352C561.7 352 576 337.7 576 320C576 302.3 561.7 288 544 288L173.3 288L278.7 182.6C291.2 170.1 291.2 149.8 278.7 137.3C266.2 124.8 245.9 124.8 233.4 137.3L73.4 297.3z"></path>'),gX=ni('<path d="M262.2 48C248.9 48 236.9 56.3 232.2 68.8L216 112L120 112C106.7 112 96 122.7 96 136C96 149.3 106.7 160 120 160L520 160C533.3 160 544 149.3 544 136C544 122.7 533.3 112 520 112L424 112L407.8 68.8C403.1 56.3 391.2 48 377.8 48L262.2 48zM128 208L128 512C128 547.3 156.7 576 192 576L448 576C483.3 576 512 547.3 512 512L512 208L464 208L464 512C464 520.8 456.8 528 448 528L192 528C183.2 528 176 520.8 176 512L176 208L128 208zM288 280C288 266.7 277.3 256 264 256C250.7 256 240 266.7 240 280L240 456C240 469.3 250.7 480 264 480C277.3 480 288 469.3 288 456L288 280zM400 280C400 266.7 389.3 256 376 256C362.7 256 352 266.7 352 280L352 456C352 469.3 362.7 480 376 480C389.3 480 400 469.3 400 456L400 280z"></path>'),bX=ot('<div class="tbl-menu-item-icon"><svg xmlns="http://www.w3.org/2000/svg" height="14" width="14" viewBox="0 0 640 640" fill="currentColor"><!></svg></div>');function Ze(i,t){var e=bX(),n=Ue(e),r=Ue(n);{var s=b=>{var v=aX();I(b,v)},o=b=>{var v=cX();I(b,v)},l=b=>{},a=b=>{var v=hX();I(b,v)},c=b=>{var v=uX();I(b,v)},h=b=>{var v=fX();I(b,v)},u=b=>{var v=dX();I(b,v)},f=b=>{var v=OX();I(b,v)},d=b=>{var v=pX();I(b,v)},O=b=>{var v=mX();I(b,v)},p=b=>{},m=b=>{},g=b=>{var v=gX();I(b,v)};Ft(r,b=>{t.name==="sort-ascending"?b(s):t.name==="sort-descending"?b(o,1):t.name==="align-none"?b(l,2):t.name==="align-left"?b(a,3):t.name==="align-center"?b(c,4):t.name==="align-right"?b(h,5):t.name==="move-up"?b(u,6):t.name==="move-right"?b(f,7):t.name==="move-down"?b(d,8):t.name==="move-left"?b(O,9):t.name==="duplicate"?b(p,10):t.name==="clear"?b(m,11):t.name==="remove"&&b(g,12)})}I(i,e)}var wX=ot('<div class="tbl-menu-item-text"><!></div>');function Xe(i,t){var e=wX(),n=Ue(e);Pr(n,()=>t.children),I(i,e)}var SX=ot('<div class="tbl-menu-separator"></div>');function Oa(i){var t=SX();I(i,t)}var vX=ot('<div class="tbl-select-all-overlay" aria-hidden="true"></div>');function xX(i){var t=vX();I(i,t)}const yX=new Set([bt.c,bt.v,bt.x]);function kX(i,t){return yX.has(i.key)&&i[aA(t)]}const QX=[bt.backspace,bt.delete],$X=new Set(QX);function CX({key:i}){return $X.has(i)?i:void 0}function PX(i){return/^F\d+$/.test(i)}const TX=new Set([bt.alt,bt.escape,bt.enter,bt.shift]);function RX({metaKey:i,ctrlKey:t,key:e}){return!t&&!i&&!TX.has(e)&&!PX(e)}function AX(i,t){t.selection.isCell()||cv({tableState:t,event:i})}function ZX(i,t){t.selection.isCell()||hv({tableState:t,event:i})}function XX(i,t){t.selection.isCell()||Vd({tableState:t,event:i})}function EX(i,t){if(L(i.target)&&L(fv(i.target))){i.preventDefault();return}if(!t.interactive||t.selection.isCell())return;const e=pv(i);if(L(e)){nh.navigate({tableState:t,key:e,event:i,position:{left:!0,top:!0,right:!0,bottom:!0}});return}const n=CX(i);if(L(n)){av({tableState:t,event:i});return}if(t.activeTable&&L(t.activeCell)&&RX(i)){t.activeTable=!1,t.anchorCell=t.activeCell;const r=t.table.cellAt(t.activeCell).length;t.selectionValue={cell:t.activeCell,section:{head:r,anchor:r}},t.outlinedSection=rt.ofCell(t.activeCell);return}kX(i,t.window)||Ok(t.rootEditor,i,"editor")&&i.preventDefault()}function Nd(i){return i.buttons===1}function gv(i,t){return t.setPointerCapture(i.pointerId),()=>t.releasePointerCapture(i.pointerId)}class rh{constructor({offset:t,maxScroll:e,boundaryElement:n,scrollElement:r}){P(this,"offset");P(this,"maxScroll");P(this,"boundaryElement");P(this,"scrollElement");P(this,"scroll");P(this,"handle");P(this,"xAmount");P(this,"yAmount");const s=this.scrollInternal.bind(this);this.scroll=()=>{this.handle=requestAnimationFrame(s)},this.xAmount=0,this.yAmount=0,this.offset=t??0,this.maxScroll=e,this.boundaryElement=n,this.scrollElement=r}updatePosition(t,e){const n=this.boundaryElement.x.getBoundingClientRect();t<n.left+this.offset?this.xAmount=-ce(this.offset+(n.left-t),{max:this.maxScroll}):t>n.right-this.offset?this.xAmount=ce(this.offset-(n.right-t),{max:this.maxScroll}):this.xAmount=0;const r=this.boundaryElement.y.getBoundingClientRect();e<r.top+this.offset?this.yAmount=-ce(this.offset+(r.top-e),{max:this.maxScroll}):e>r.bottom-this.offset?this.yAmount=ce(this.offset-(r.bottom-e),{max:this.maxScroll}):this.yAmount=0,V(this.handle)&&(this.xAmount!==0||this.yAmount!==0)&&this.scroll()}destroy(){L(this.handle)&&cancelAnimationFrame(this.handle)}scrollInternal(){if(this.xAmount===0&&this.yAmount===0){this.scroll();return}this.scrollElement.x.scrollBy({left:this.xAmount}),this.scrollElement.y.scrollBy({top:this.yAmount}),this.scroll()}static of(t){return new rh(t)}}class Sc{constructor({start:t,size:e}){P(this,"start");P(this,"size");this.start=t,this.size=e}get mid(){return this.start+this.size/2}get end(){return this.start+this.size}static of(t){return new Sc(t)}}var vc;(i=>{function t(e,n){return Gd.of(e,n)}i.of=t})(vc||(vc={}));class Gd{constructor(t,e){P(this,"rows");P(this,"cols");P(this,"firstRowIndex",0);P(this,"firstColIndex",0);const n=[...t.querySelectorAll("tr:first-child > th")],r=[...t.querySelectorAll("tr > th:first-child,tr > td:first-child")];this.rows=r.map((s,o)=>{const{top:l,height:a}=ug(s,e),c=0;return Sc.of({start:l+c,size:a-c})}),this.cols=n.map((s,o)=>{const{left:l,width:a}=ug(s,e),c=o===0?1:0;return Sc.of({start:l+c,size:a-c})})}rowsOrCols(t){return t==="row"?this.rows:this.cols}rowAt(t){return this.rows[t]}colAt(t){return this.cols[t]}rowOrColAt(t,e){return t==="row"?this.rowAt(e):this.colAt(e)}get firstRow(){return this.rows[this.firstRowIndex]}get firstCol(){return this.cols[this.firstColIndex]}firstRowOrCol(t){return t==="row"?this.firstRow:this.firstCol}get lastRow(){return this.rows[this.lastRowIndex]}get lastCol(){return this.cols[this.lastColIndex]}lastRowOrCol(t){return t==="row"?this.lastRow:this.lastCol}firstRowOrColIndex(t){return 0}get lastRowIndex(){return this.rowCount-1}get lastColIndex(){return this.colCount-1}lastRowOrColIndex(t){return t==="row"?this.lastRowIndex:this.lastColIndex}get rowCount(){return this.rows.length}get colCount(){return this.cols.length}get minRowSize(){return uc(...this.rows.map(t=>t.size))}get minColSize(){return uc(...this.cols.map(t=>t.size))}moveRowOrColAt(t,{fromIndex:e,toIndex:n}){if(e===n)return;const r=this.rowsOrCols(t),s=r[e];if(e<n){for(const o of Qn({start:e,endExclusive:n}))r[o]=r[o+1],r[o].start-=s.size;s.start=r[n].start+r[n].size}else{for(const o of Qn({start:e,endExclusive:n}))r[o]=r[o-1],r[o].start+=s.size;s.start=r[n].start-s.size}r[n]=s}lastCellBeforePosition(t){const e=this.rows.map(r=>r.start).findLastIndex(r=>r<t.y),n=this.cols.map(r=>r.start).findLastIndex(r=>r<t.x);return{row:e===-1?0:e,col:n===-1?0:n}}static of(t,e){return new Gd(t,e)}}function ug(i,t){const{top:e,left:n,width:r,height:s}=i.getBoundingClientRect();return{top:e+t.y,left:n+t.x,width:r,height:s}}class wl{constructor({tableState:t,cellLocation:e}){P(this,"tableState");P(this,"tableMeasurement");P(this,"autoScroller");P(this,"shouldAutoScroll");P(this,"removeEventListeners");P(this,"currentCell");this.tableState=t,this.currentCell=e,this.autoScroller=rh.of({offset:10,maxScroll:32,boundaryElement:{x:t.scrollElement,y:t.rootScrollElement},scrollElement:{x:t.scrollElement,y:t.rootScrollElement}}),this.shouldAutoScroll=V5({delayMillis:500}),this.tableMeasurement=vc.of(t.tableElement,{x:t.scrollOffsetX,y:t.scrollOffsetY})}start(){this.tableState.activeCell=this.currentCell,this.tableState.anchorCell=this.currentCell,this.tableState.outlinedSection=rt.ofCell(this.currentCell),this.tableState.outline={outlined:!1},this.removeEventListeners=Tr(Mt(this.tableState.window,"pointermove",t=>this.drag(t)),Mt(this.tableState.window,"pointerup",()=>this.end()),Mt(this.tableState.window,"pointerleave",()=>this.end()))}resizeAndContinue(t){t.preventDefault(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.currentCell),this.expandOrContract(this.currentCell),this.tableState.outline={outlined:!0},this.removeEventListeners=Tr(Mt(this.tableState.window,"pointermove",e=>this.drag(e)),Mt(this.tableState.window,"pointerup",()=>this.end()),Mt(this.tableState.window,"pointerleave",()=>this.end()))}drag(t){if(!Nd(t)){this.end();return}t.preventDefault(),this.shouldAutoScroll()&&this.autoScroller.updatePosition(t.clientX,t.clientY);const e=this.tableMeasurement.lastCellBeforePosition({x:t.clientX+this.tableState.scrollOffsetX,y:t.clientY+this.tableState.scrollOffsetY});Rr(e,this.currentCell)||(this.currentCell=e,this.tableState.outline={outlined:!0},this.expandOrContract(e))}end(){var t;(t=this.removeEventListeners)==null||t.call(this),this.autoScroller.destroy(),this.tableState.outline=void 0}expandOrContract(t){this.tableState.focusTable();const[e,n]=t.row<=this.tableState.anchorCell.row?[t.row,this.tableState.anchorCell.row]:[this.tableState.anchorCell.row,t.row],[r,s]=t.col<=this.tableState.anchorCell.col?[t.col,this.tableState.anchorCell.col]:[this.tableState.anchorCell.col,t.col];this.tableState.outlinedSection=rt.of({row:{start:e,endExclusive:n+1},col:{start:r,endExclusive:s+1}}),this.tableState.activeCell=t}static startOutline(t){new wl(t).start()}static resizeAndContinueOutline(t){new wl(t).resizeAndContinue(t.event)}}function LX(i,t){Nc(t.window)&&(t.hoveredCell=i)}function MX(i){Nc(i.window)&&(i.hoveredCell=void 0)}function zX(i,t,e){if(!(!e.interactive||!Nd(i)))if(i.shiftKey){if(e.selection.isCell()&&Rr(t,e.selection.cell))return;wl.resizeAndContinueOutline({event:i,tableState:e,cellLocation:t})}else wl.startOutline({event:i,tableState:e,cellLocation:t})}const _X=new Intl.Collator(navigator.language,{numeric:!0,sensitivity:"base"});function fg(i,t){return _X.compare(i,t)}function IX({metaKey:i,shiftKey:t,altKey:e,ctrlKey:n,key:r}){return r===bt.escape&&!t&&!e&&!i&&!n}class Ud{constructor({tableState:t,handle:e,point:n}){P(this,"tableState");P(this,"handle");P(this,"point");P(this,"removeEventListeners");this.tableState=t,this.handle=e,this.point=n}get rowOrCol(){return this.handle.location}get index(){return this.handle.index}open(){const t=this.tableState.document.body;this.removeEventListeners=Tr(Mt(t,"pointerdown",o=>{o.preventDefault(),(V(o.target)||!VS(this.tableState.menuRootElement,o.target))&&this.close()}),Mt(t,"wheel",o=>o.preventDefault(),{passive:!1}),Mt(t,"keydown",o=>{o.preventDefault(),IX(o)&&this.close()})),this.tableState.focusTable(),this.tableState.activeHandle={state:"active",handle:this.handle},this.tableState.outlinedSection=rt.of(this.rowOrCol==="row"?{row:{start:this.index,endExclusive:this.index+1},col:this.tableState.table.colRange}:{row:this.tableState.table.rowRange,col:{start:this.index,endExclusive:this.index+1}});const e=this.rowOrCol==="row"?{row:this.index,col:this.tableState.table.lastColIndex}:{row:this.tableState.table.lastRowIndex,col:this.index};this.tableState.activeCell=e,this.tableState.anchorCell=e;const n=this.index!==this.tableState.table.firstRowOrColIndex(this.rowOrCol),r=this.index!==this.tableState.table.lastRowOrColIndex(this.rowOrCol);let s=!1;n?s=r?!0:"backward":r&&(s="forward"),this.tableState.menu={type:this.rowOrCol,capabilities:{addable:!0,alignable:this.rowOrCol==="col",clearable:!0,duplicatable:!0,moveable:s,removable:!this.tableState.table.hasSingleRowOrCol(this.rowOrCol),sortable:this.rowOrCol==="col"},clickAdd:o=>this.clickAdd(o),clickAlign:o=>this.clickAlign(o),clickClear:()=>this.clickClear(),clickDuplicate:()=>this.clickDuplicate(),clickMove:o=>this.clickMove(o),clickRemove:()=>this.clickRemove(),clickSort:o=>this.clickSort(o),computeTranslation:o=>this.computeTranslation(o)}}close(){var t;(t=this.removeEventListeners)==null||t.call(this),this.tableState.menu=void 0,this.tableState.activeHandle=void 0}async computeTranslation(t){const e=await eR({getBoundingClientRect:()=>({x:this.point.x,y:this.point.y,top:this.point.y,right:this.point.x,bottom:this.point.y,left:this.point.x,width:0,height:0})},t,{middleware:[JT({allowedPlacements:this.rowOrCol==="row"?["right-start","right-end"]:["right-start","right"]}),tR({crossAxis:!0})]}),n=bo(t);return{x:wc(e.x,n),y:wc(e.y,n)}}clickAdd(t){var e;if(this.tableState.table.addEmptyRowsOrColsAt(this.rowOrCol,{index:t==="before"?this.index:this.index+1,count:1}),t==="after"){this.tableState.outlinedSection=(e=this.tableState.outlinedSection)==null?void 0:e.shift(this.rowOrCol,"forward");const n=Uh(this.rowOrCol,this.tableState.activeCell,"forward");this.tableState.activeCell=n,this.tableState.anchorCell=n}this.close()}clickAlign(t){this.tableState.table.setAlignmentAt(this.index,t),this.close()}clickClear(){this.tableState.table.clearRowOrCol(this.rowOrCol,this.index),this.close()}clickDuplicate(){this.tableState.table.duplicateRowOrColAt(this.rowOrCol,this.index),this.close()}clickMove(t){var n;this.tableState.table.moveRowOrColAt(this.rowOrCol,{fromIndex:this.index,toIndex:t==="backward"?this.index-1:this.index+1}),this.tableState.outlinedSection=(n=this.tableState.outlinedSection)==null?void 0:n.shift(this.rowOrCol,t);const e=Uh(this.rowOrCol,this.tableState.activeCell,t);this.tableState.activeCell=e,this.tableState.anchorCell=e,this.close()}clickRemove(){var t;if(this.tableState.table.removeRowsOrColsAt(this.rowOrCol,{index:this.index,count:1}),!this.tableState.table.hasRowOrColAt(this.rowOrCol,this.index)){this.tableState.outlinedSection=(t=this.tableState.outlinedSection)==null?void 0:t.shift(this.rowOrCol,"backward");const e=Uh(this.rowOrCol,this.tableState.activeCell,"backward");this.tableState.activeCell=e,this.tableState.anchorCell=e}this.close()}clickSort(t){this.tableState.table.sortByColAt(this.index,t==="ascending"?(e,n)=>fg(e.toString(),n.toString()):(e,n)=>fg(n.toString(),e.toString())),this.close()}static showMenu(t){new Ud(t).open()}}class Hd{constructor({rowOrCol:t,index:e,position:n,subject:r,tableElement:s,scrollOffsetX:o,scrollOffsetY:l}){P(this,"coordinate");P(this,"initialIndex");P(this,"size");P(this,"initialPosition");P(this,"minBound");P(this,"maxBound");P(this,"scrollOffsetX");P(this,"scrollOffsetY");P(this,"subject");P(this,"rowOrCol");P(this,"tableMeasurement");P(this,"currentIndex");P(this,"currentPosition");P(this,"dragged");this.scrollOffsetX=o,this.scrollOffsetY=l;const a=vc.of(s,{x:this.scrollOffsetX(),y:this.scrollOffsetY()});this.rowOrCol=t,this.coordinate=t==="row"?"y":"x",this.initialIndex=e,this.initialPosition=n[this.coordinate],this.minBound=a.firstRowOrCol(this.rowOrCol).start-a.rowOrColAt(this.rowOrCol,e).start,this.maxBound=a.lastRowOrCol(this.rowOrCol).end-a.rowOrColAt(this.rowOrCol,e).end,this.size=a.rowOrColAt(this.rowOrCol,e).size,this.subject=r,this.dragged=!1,this.tableMeasurement=a,this.currentIndex=e,this.currentPosition=n[this.coordinate]}start(){return{cellMovement:t=>this.cellMovement(t)}}drag(t){this.currentPosition=t[this.coordinate];const{currentIndex:e,move:n}=this.calculateDrag();return this.currentIndex=e,this.initialIndex!==this.currentIndex&&(this.dragged=!0),L(n)&&this.tableMeasurement.moveRowOrColAt(this.rowOrCol,n),{cellMovement:r=>this.cellMovement(r)}}end(){return this.initialIndex===this.currentIndex?{moved:!1,dragged:this.dragged}:{moved:!0,toIndex:this.currentIndex}}cellMovement(t){return{border:this.cellBorder(t),state:this.cellState(t),translate:this.cellTranslate(t)}}cellBorder(t){const e=this.isRowOrColExposed(t[this.rowOrCol]),n=this.subject.containsCell(t);return this.rowOrCol==="row"?{top:e,right:!0,bottom:!n||t.row===this.tableMeasurement.lastRowIndex,left:this.tableMeasurement.firstColIndex===t.col}:{top:this.tableMeasurement.firstRowIndex===t.row,right:!n||t.col===this.tableMeasurement.lastColIndex,bottom:!0,left:e}}cellState(t){return this.subject.containsCell(t)?"moving":"shiftable"}cellTranslate(t){const e=this.rowOrColTranslate(t[this.rowOrCol]);return this.rowOrCol==="row"?{x:0,y:e}:{x:e,y:0}}isRowOrColExposed(t){const e=this.reorderIndex(t),n=e===this.tableMeasurement.firstRowOrColIndex(this.rowOrCol),r=e===this.currentIndex+1;return n||r}get rowOrColShift(){if(this.currentIndex!==this.initialIndex)return this.currentIndex<this.initialIndex?{direction:"forwards",range:{start:this.currentIndex,endExclusive:this.initialIndex},indexDiff:1,positionDiff:this.size-1}:{direction:"backwards",range:{start:this.initialIndex+1,endExclusive:this.currentIndex+1},indexDiff:-1,positionDiff:1-this.size}}rowOrColTranslate(t){if(t===this.initialIndex)return ce(this.currentPosition-this.initialPosition,{min:this.minBound,max:this.maxBound});const e=this.rowOrColShift;return V(e)?0:yn(t,e.range)?e.positionDiff:0}reorderIndex(t){const e=this.rowOrColShift;return V(e)?t:t===this.initialIndex?this.currentIndex:yn(t,e.range)?t+e.indexDiff:t}calculateDrag(){const t=this.tableMeasurement.rowsOrCols(this.rowOrCol),e={name:"current",index:this.currentIndex,mid:t[this.currentIndex].mid},n=this.currentIndex!==this.tableMeasurement.firstRowOrColIndex(this.rowOrCol)?{name:"left",index:this.currentIndex-1,mid:t[this.currentIndex-1].start+t[this.currentIndex].size/2}:void 0,r=this.currentIndex!==this.tableMeasurement.lastRowOrColIndex(this.rowOrCol)?{name:"right",index:this.currentIndex+1,mid:t[this.currentIndex].start+t[this.currentIndex+1].size+t[this.currentIndex].size/2}:void 0,s=ZR(XR([e,n,r]),(o,l)=>tf(this.currentPosition-o.mid)-tf(this.currentPosition-l.mid));return s.name==="current"?{currentIndex:this.currentIndex,move:void 0}:{currentIndex:s.index,move:{fromIndex:this.currentIndex,toIndex:s.index}}}static of(t){return new Hd(t)}}class Fd{constructor({event:t,tableState:e,rowOrCol:n,index:r,onClick:s}){P(this,"tableState");P(this,"rowOrCol");P(this,"index");P(this,"onClick");P(this,"moveTracker");P(this,"subject");P(this,"autoScroller");P(this,"removeEventListeners");this.tableState=e,this.rowOrCol=n,this.index=r,this.subject=rt.of(n==="row"?{row:{start:r,endExclusive:r+1},col:this.tableState.table.colRange}:{row:this.tableState.table.rowRange,col:{start:r,endExclusive:r+1}}),this.onClick=s,this.autoScroller=rh.of({offset:16,maxScroll:32,boundaryElement:{x:e.scrollElement,y:e.rootScrollElement},scrollElement:{x:e.scrollElement,y:e.rootScrollElement}}),this.moveTracker=Hd.of({subject:this.subject,rowOrCol:n,index:r,position:{x:t.clientX+e.scrollOffsetX,y:t.clientY+e.scrollOffsetY},tableElement:e.tableElement,scrollOffsetX:()=>this.tableState.scrollOffsetX,scrollOffsetY:()=>this.tableState.scrollOffsetY})}start(t){t.preventDefault();const e=this.moveTracker.start();this.tableState.outlinedSection=this.subject,this.tableState.move=e,this.tableState.activeHandle={state:"active",handle:{type:"header",index:this.index,location:this.rowOrCol}};const n=this.rowOrCol==="row"?{row:this.index,col:this.tableState.table.lastColIndex}:{row:this.tableState.table.lastRowIndex,col:this.index};this.tableState.activeCell=n,this.tableState.anchorCell=n,this.tableState.focusTable();const r=Id(t.target);this.removeEventListeners=Tr(gv(t,r),Mt(r,"pointermove",s=>this.drag(s)),Mt(r,"pointerup",()=>this.end()))}drag(t){t.preventDefault(),this.autoScroller.updatePosition(t.clientX,t.clientY),this.tableState.move=this.moveTracker.drag({x:t.clientX+this.tableState.scrollOffsetX,y:t.clientY+this.tableState.scrollOffsetY})}end(){var e;(e=this.removeEventListeners)==null||e.call(this),this.autoScroller.destroy();const t=this.moveTracker.end();if(t.moved){this.tableState.table.moveRowOrColAt(this.rowOrCol,{fromIndex:this.index,toIndex:t.toIndex}),this.tableState.outlinedSection=rt.of(this.rowOrCol==="row"?{row:{start:t.toIndex,endExclusive:t.toIndex+1},col:this.tableState.table.colRange}:{row:this.tableState.table.rowRange,col:{start:t.toIndex,endExclusive:t.toIndex+1}});const n=this.rowOrCol==="row"?{row:t.toIndex,col:this.tableState.table.lastColIndex}:{row:this.tableState.table.lastRowIndex,col:t.toIndex};this.tableState.activeCell=n,this.tableState.anchorCell=n}this.tableState.move=void 0,this.tableState.activeHandle=void 0,!t.moved&&!t.dragged&&this.onClick()}static startMove(t){new Fd(t).start(t.event)}}function jX(i){return i==="row"?"y":"x"}class Kd{constructor({tableState:t,handle:e,position:n,cellSizePixels:r,dragThresholdPixels:s}){P(this,"tableState");P(this,"type");P(this,"initialHandle");P(this,"initialRowOrColCount");P(this,"initialPosition");P(this,"initialOutlinedSection");P(this,"initialActiveCell");P(this,"initialAnchorCell");P(this,"cellSizePixels");P(this,"dragThresholdPixels");P(this,"dragged");this.tableState=t,this.type=this.handleToType(e),this.initialHandle=e,this.initialPosition=n,this.initialRowOrColCount={row:t.table.rowCount,col:t.table.colCount},this.initialActiveCell=t.activeCell,this.initialAnchorCell=t.anchorCell,this.initialOutlinedSection=t.outlinedSection,this.cellSizePixels=r,this.dragThresholdPixels=s,this.dragged=!1}start(){return{activeHandle:{state:"active",handle:this.initialHandle}}}drag(t){return this.dragged=!0,this.calculateDrag(t)}end(){return this.dragged?{activeHandle:void 0}:this.calculateClick()}calculateClick(){if(this.type!=="table")return this.calculateClickRowOrCol(this.type);if(this.initialHandle.location==="right")return this.calculateClickRowOrCol("col");if(this.initialHandle.location==="bottom")return this.calculateClickRowOrCol("row");const t=this.calculateClickRowOrCol("row"),e=this.calculateClickRowOrCol("col");return{operation:{row:t.operation.row,col:e.operation.col},activeHandle:t.activeHandle,activeCell:L(t.activeCell)&&L(e.activeCell)?{row:t.activeCell.row,col:e.activeCell.col}:void 0,anchorCell:L(t.anchorCell)&&L(e.anchorCell)?{row:t.anchorCell.row,col:e.anchorCell.col}:void 0,outlinedSection:L(t.outlinedSection)&&L(e.outlinedSection)?rt.of({row:t.outlinedSection.row,col:e.outlinedSection.col}):void 0}}calculateClickRowOrCol(t){const e=this.type==="table"?this.tableState.table.lastRowOrColIndex(t)+1:this.initialHandle.index;return{operation:{[t]:{action:"add",index:e,count:1}},activeHandle:this.type==="table"?void 0:{state:"hover",handle:{type:"border",location:this.handleLocationAt(e),index:e}},...this.calculateCellMovement(t,1)}}calculateDrag(t){if(this.type!=="table")return this.calculateDragRowOrCol(this.type,t);if(this.initialHandle.location==="right")return this.calculateDragRowOrCol("col",t);if(this.initialHandle.location==="bottom")return this.calculateDragRowOrCol("row",t);const e=this.calculateDragRowOrCol("row",t),n=this.calculateDragRowOrCol("col",t);if(V(e)&&V(n))return;const r=e??this.calculateCellMovement("row",this.rowOrColDiff("row")),s=n??this.calculateCellMovement("col",this.rowOrColDiff("col"));return{operation:{row:e==null?void 0:e.operation.row,col:n==null?void 0:n.operation.col},activeHandle:(e==null?void 0:e.activeHandle)??(n==null?void 0:n.activeHandle),activeCell:L(r.activeCell)&&L(s.activeCell)?{row:r.activeCell.row,col:s.activeCell.col}:void 0,anchorCell:L(r.anchorCell)&&L(s.anchorCell)?{row:r.anchorCell.row,col:s.anchorCell.col}:void 0,outlinedSection:L(r.outlinedSection)&&L(s.outlinedSection)?rt.of({row:r.outlinedSection.row,col:s.outlinedSection.col}):void 0}}calculateDragRowOrCol(t,e){const n=jX(t),r=e.position[n]-this.initialPosition[n],s=_R(r/this.cellSizePixels[t]),o=r%this.cellSizePixels[t]>=this.dragThresholdPixels[t]?1:0,l=this.tableState.table.rowOrColCount(t)-this.initialRowOrColCount[t],a=s+o-l,c=this.type==="table"?this.tableState.table.lastRowOrColIndex(t)+1:this.initialHandle.index+l;if(a!==0)return a>0?this.calculateDragRowOrColMore({rowOrCol:t,start:c,length:a}):this.calculateDragRowOrColLess({rowOrCol:t,start:c,length:uc(-a,c,this.tableState.table.lastRowOrColIndex(t))})}calculateDragRowOrColLess({rowOrCol:t,start:e,length:n}){let r=0;for(const o of Qn({start:e-1,endExclusive:e-n-1})){if(!this.tableState.table.hasEmptyRowOrColAt(t,o))break;r++}if(r===0)return;const s=e-(r-1)-1;return{operation:{[t]:{action:"remove",index:e-r,count:r}},activeHandle:this.type==="table"?{state:"active",handle:this.initialHandle}:{state:"active",handle:{type:"border",location:this.handleLocationAt(s),index:s}},...this.calculateCellMovement(t,this.rowOrColDiff(t)-r)}}calculateDragRowOrColMore({rowOrCol:t,start:e,length:n}){return{operation:{[t]:{action:"add",index:e,count:n}},activeHandle:{state:"active",handle:this.type==="table"?this.initialHandle:{type:"border",location:this.handleLocationAt(e+n),index:e+n}},...this.calculateCellMovement(t,this.rowOrColDiff(t)+n)}}calculateCellMovement(t,e){var r,s;const n=this.type==="table"?this.initialRowOrColCount[t]:this.initialHandle.index;if(e>=0)return{outlinedSection:(r=this.initialOutlinedSection)==null?void 0:r.addForwardsByRowOrCol(t,{start:n,count:e}),activeCell:L(this.initialActiveCell)?eg(t,this.initialActiveCell,{start:n,count:e}):void 0,anchorCell:L(this.initialAnchorCell)?eg(t,this.initialAnchorCell,{start:n,count:e}):void 0};{const o=-e,l=(s=this.initialOutlinedSection)==null?void 0:s.subtractBackwardsByRowOrCol(t,{start:n,count:o,min:this.tableState.table.firstRowOrColIndex(t)}),a=L(l)?{min:l.startRowOrCol(t),max:l.endRowOrCol(t)}:void 0,c=L(this.initialActiveCell)?ig(t,this.initialActiveCell,{start:n,count:o,boundary:a}):void 0,h=L(this.initialAnchorCell)?ig(t,this.initialAnchorCell,{start:n,count:o,boundary:a}):void 0;return{outlinedSection:l,activeCell:c,anchorCell:h}}}rowOrColDiff(t){return this.tableState.table.rowOrColCount(t)-this.initialRowOrColCount[t]}handleLocationAt(t){if(this.type!=="table")return this.type==="row"&&t===this.tableState.table.firstRowIndex?"top":this.type==="col"&&t===this.tableState.table.firstColIndex?"left":this.type}handleToType(t){return t.type==="table"?"table":t.location==="top"?"row":t.location==="left"?"col":t.location}static of(t){return new Kd(t)}}function DX(i){const t=gc(i.tableElement,i.table.firstCellLocation),e=LZ(t),{minWidth:n}=getComputedStyle(t),{lineHeight:r,paddingTop:s,paddingBottom:o}=getComputedStyle(e),l=parseFloat(n)+1,a=parseFloat(r)+parseFloat(s)+parseFloat(o)+1;return{width:l,height:a}}class Jd{constructor({event:t,tableState:e,handle:n}){P(this,"tableState");P(this,"resizeTracker");P(this,"removeEventListeners");this.tableState=e;const{width:r,height:s}=DX(e);this.resizeTracker=Kd.of({tableState:this.tableState,handle:n,position:{x:t.clientX,y:t.clientY},cellSizePixels:{row:s,col:r},dragThresholdPixels:{row:s/2,col:r/2}})}start(t){t.preventDefault();const e=this.resizeTracker.start();this.tableState.resize={},this.tableState.activeHandle=e.activeHandle,this.tableState.focusTable(),this.removeEventListeners=Tr(gv(t,this.tableState.tableElement),Mt(this.tableState.tableElement,"pointermove",n=>this.drag(n)),Mt(this.tableState.tableElement,"pointerup",()=>this.end()))}drag(t){t.preventDefault();const e=this.resizeTracker.drag({position:{x:t.clientX,y:t.clientY}});L(e)&&(this.resizeTable(e.operation),this.tableState.activeHandle=e.activeHandle,this.tableState.activeCell=e.activeCell,this.tableState.anchorCell=e.anchorCell,this.tableState.outlinedSection=e.outlinedSection)}end(){var e;(e=this.removeEventListeners)==null||e.call(this);const t=this.resizeTracker.end();"operation"in t&&(this.resizeTable(t.operation),this.tableState.activeCell=t.activeCell,this.tableState.anchorCell=t.anchorCell,this.tableState.outlinedSection=t.outlinedSection),this.tableState.activeHandle=t.activeHandle,this.tableState.resize=void 0}resizeTable({row:t,col:e}){if(L(t)){const{action:n,index:r,count:s}=t;n==="add"?this.tableState.table.addEmptyRowsAt({row:r,count:s}):this.tableState.table.removeRowsAt({row:r,count:s})}if(L(e)){const{action:n,index:r,count:s}=e;n==="add"?this.tableState.table.addEmptyColsAt({col:r,count:s}):this.tableState.table.removeColsAt({col:r,count:s})}}static startResize(t){new Jd(t).start(t.event)}}function YX(i,t){t.interactive&&(t.activeHandle={state:"hover",handle:i})}function WX(i){i.interactive&&(i.activeHandle=void 0)}function VX(i,t,e){if(e.interactive){if(!Nd(i)){i.preventDefault();return}t.type==="table"||t.type==="border"?Jd.startResize({event:i,handle:t,tableState:e}):t.type==="header"&&Fd.startMove({event:i,rowOrCol:t.location,index:t.index,tableState:e,onClick:()=>Ud.showMenu({handle:t,point:{x:i.clientX,y:i.clientY},tableState:e})})}}function BX(i,t){const e=i.target;if(V(e))return;const n=qd(e);if(L(n)){YX(n,t);return}const r=jl(e);if(L(r)){LX(eh(r),t);return}}function qX(i,t){const e=i.target;if(V(e))return;const n=qd(e);if(L(n)){WX(t);return}const r=jl(e);if(L(r)){MX(t);return}}function NX(i,t){const e=i.target;if(V(e))return;const n=qd(e);if(L(n)){VX(i,n,t);return}const r=jl(e);if(L(r)){zX(i,eh(r),t);return}i.preventDefault()}function GX(i){i.preventDefault()}var UX=ot("<!> <!> <!>",1),HX=ot('<tr class="tbl-table-row"></tr>'),FX=ot('<tbody class="tbl-table-body"></tbody>'),KX=ot("<!> <!>",1),JX=ot("<!> <!>",1),tE=ot("<!> <!> <!>",1),eE=ot("<!> <!>",1),iE=ot("<!> <!>",1),nE=ot("<!> <!>",1),rE=ot("<!> <!>",1),sE=ot("<!> <!> <!> <!> <!>",1),oE=ot("<!> <!>",1),lE=ot("<!> <!>",1),aE=ot("<!> <!> <!>",1),cE=ot("<!> <!>",1),hE=ot("<!> <!>",1),uE=ot("<!> <!> <!>",1),fE=ot("<!> <!>",1),dE=ot("<!> <!>",1),OE=ot("<!> <!>",1),pE=ot("<!> <!> <!> <!> <!> <!> <!>",1),mE=ot('<div class="tbl-table-wrapper"><table class="tbl-table" role="grid" tabindex="-1"><thead class="tbl-table-head"><!></thead><!></table> <!> <!> <!> <!></div>');function gE(i,t){Wn(t,!0);const e=kf.of({table:()=>t.table,selection:()=>t.selection,scrollElement:()=>t.scrollElement,rootEditor:()=>t.rootEditor,menuRootElement:()=>t.menuRootElement,extensions:()=>t.extensions,markdownConfig:()=>t.markdownConfig,globalKeyBindings:()=>t.globalKeyBindings,selectionType:()=>t.selectionType,lineWrapping:()=>t.lineWrapping,onUndo:()=>t.onUndo,onRedo:()=>t.onRedo,onNavigate:()=>t.onNavigate,onDelete:()=>t.onDelete});Kc(()=>Tr(Mt(e.document,"selectionchange",()=>MZ(e)),Mt(e.document.body,"pointerdown",()=>TZ(e),{capture:!0,passive:!0}),Mt(e.document.body,"pointerup",()=>RZ(e),{capture:!0,passive:!0}),Mt(e.document.body,"pointerleave",()=>AZ(e),{capture:!0,passive:!0}),Mt(e.document.body,"copy",x=>ZZ(x,e)),Mt(e.document.body,"cut",x=>XZ(x,e)),Mt(e.document.body,"paste",x=>EZ(x,e))));var n=mE(),r=Ue(n);{const x=(y,k=U1)=>{var Q=HX();ua(Q,20,()=>e.table.colIndices,E=>E,(E,W)=>{const X=H(()=>({row:k(),col:W})),D=H(()=>({top:k()===e.table.firstRowIndex,left:W===e.table.firstColIndex})),_=H(()=>e.selection.isCell()&&Rr($(X),e.selection.cell));{let F=H(()=>{var U;return((U=e.outlinedSection)==null?void 0:U.containsOnEdge($(X)))??{top:!1,right:!1,bottom:!1,left:!1}}),G=H(()=>{var U;return(U=e.move)==null?void 0:U.cellMovement($(X))});BZ(E,{get location(){return $(X)},get alignment(){return e.table.alignments[W]},get selected(){return $(_)},get position(){return $(D)},get outline(){return $(F)},get movement(){return $(G)},get win(){return e.window},children:(U,Xt)=>{var _t=UX(),Bt=Et(_t);ua(Bt,16,()=>kZ($(X),$(D)),yt=>yt,(yt,Nt)=>{{let re=H(()=>e.cellHandleState($(X),Nt)),be=H(()=>L(e.resize));hg(yt,{get of(){return Nt},get state(){return $(re)},get toggle(){return $(be)}})}});var lt=et(Bt,2);eX(lt,{get hidden(){return $(_)},children:(yt,Nt)=>{var re=_d(),be=Et(re);A5(be,()=>SZ(e.table.cellAt($(X)),e.highlighter($(X)))),I(yt,re)},$$slots:{default:!0}});var Yt=et(lt,2);{var $e=yt=>{var Nt=()=>e.table.cellAt($(X)),re=pt=>e.table.setCellAt($(X),pt),be=()=>e.selection.cellSection,tt=pt=>{e.selectionValue={cell:$(X),section:pt}};{let pt=H(()=>e.highlighter($(X)));GZ(yt,{get text(){return Nt()},set text(mt){re(mt)},get selection(){return be()},set selection(mt){tt(mt)},get selectionType(){return e.selectionType},get lineWrapping(){return e.lineWrapping},get extensions(){return e.extensions},get markdownConfig(){return e.markdownConfig},get rootEditor(){return e.rootEditor},get globalKeyBindings(){return e.globalKeyBindings},get highlighter(){return $(pt)},onbeforeinput:mt=>HZ(mt,e),ondragstart:mt=>FZ(mt),onkeydown:(mt,At)=>KZ(mt,At,e),onpaste:mt=>JZ(mt,e)})}};Ft(Yt,yt=>{$(_)&&yt($e)})}I(U,_t)},$$slots:{default:!0}})}}),I(y,Q)};var s=Ue(r),o=Ue(s);x(o,()=>e.table.headerRowIndex);var l=et(s);{var a=y=>{var k=FX();ua(k,20,()=>e.table.dataRowIndices,Q=>Q,(Q,E)=>{x(Q,()=>E)}),I(y,k)},c=H(()=>e.table.hasDataRows());Ft(l,y=>{$(c)&&y(a)})}pc(r,y=>e.tableElement=y,()=>e==null?void 0:e.tableElement)}var h=et(r,2);{var u=x=>{const y=H(()=>e.menu.type==="row"?"row":"column");IZ(x,{get to(){return e.menuRootElement},children:(k,Q)=>{oX(k,{translate:E=>e.menu.computeTranslation(E),children:(E,W)=>{const X=H(()=>{const{addable:tt,alignable:pt,clearable:mt,duplicatable:At,moveable:Wt,removable:Vt,sortable:fe}=e.menu.capabilities;return{addable:tt,alignable:pt,clearable:mt,duplicatable:At,moveable:Wt,removable:Vt,sortable:fe}});var D=pE(),_=Et(D);{var F=tt=>{var pt=tE(),mt=Et(pt);Re(mt,{onclick:()=>Ae({action:"sort",direction:"ascending"},e),children:(Vt,fe)=>{var ut=KX(),gt=Et(ut);Ze(gt,{name:"sort-ascending"});var It=et(gt,2);Xe(It,{children:(kt,Ut)=>{var Zt=Te();se(()=>Bi(Zt,`Sort by ${$(y)??""} (A-Z)`)),I(kt,Zt)}}),I(Vt,ut)}});var At=et(mt,2);Re(At,{onclick:()=>Ae({action:"sort",direction:"descending"},e),children:(Vt,fe)=>{var ut=JX(),gt=Et(ut);Ze(gt,{name:"sort-descending"});var It=et(gt,2);Xe(It,{children:(kt,Ut)=>{var Zt=Te();se(()=>Bi(Zt,`Sort by ${$(y)??""} (Z-A)`)),I(kt,Zt)}}),I(Vt,ut)}});var Wt=et(At,2);Oa(Wt),I(tt,pt)};Ft(_,tt=>{$(X).sortable&&tt(F)})}var G=et(_,2);{var U=tt=>{var pt=sE(),mt=Et(pt);Re(mt,{onclick:()=>Ae({action:"align",alignment:"none"},e),children:(ut,gt)=>{var It=eE(),kt=Et(It);Ze(kt,{name:"align-none"});var Ut=et(kt,2);Xe(Ut,{children:(Zt,ri)=>{var Wi=Te("Align none");I(Zt,Wi)}}),I(ut,It)}});var At=et(mt,2);Re(At,{onclick:()=>Ae({action:"align",alignment:"left"},e),children:(ut,gt)=>{var It=iE(),kt=Et(It);Ze(kt,{name:"align-left"});var Ut=et(kt,2);Xe(Ut,{children:(Zt,ri)=>{var Wi=Te("Align left");I(Zt,Wi)}}),I(ut,It)}});var Wt=et(At,2);Re(Wt,{onclick:()=>Ae({action:"align",alignment:"center"},e),children:(ut,gt)=>{var It=nE(),kt=Et(It);Ze(kt,{name:"align-center"});var Ut=et(kt,2);Xe(Ut,{children:(Zt,ri)=>{var Wi=Te("Align center");I(Zt,Wi)}}),I(ut,It)}});var Vt=et(Wt,2);Re(Vt,{onclick:()=>Ae({action:"align",alignment:"right"},e),children:(ut,gt)=>{var It=rE(),kt=Et(It);Ze(kt,{name:"align-right"});var Ut=et(kt,2);Xe(Ut,{children:(Zt,ri)=>{var Wi=Te("Align right");I(Zt,Wi)}}),I(ut,It)}});var fe=et(Vt,2);Oa(fe),I(tt,pt)};Ft(G,tt=>{$(X).alignable&&tt(U)})}var Xt=et(G,2);{var _t=tt=>{var pt=aE(),mt=Et(pt);Re(mt,{onclick:()=>Ae({action:"add",direction:"before"},e),children:(Vt,fe)=>{var ut=oE(),gt=Et(ut);Ze(gt,{name:"add-before"});var It=et(gt,2);Xe(It,{children:(kt,Ut)=>{var Zt=Te();se(()=>Bi(Zt,`Add ${$(y)??""} ${$(y)==="row"?"above":"before"}`)),I(kt,Zt)}}),I(Vt,ut)}});var At=et(mt,2);Re(At,{onclick:()=>Ae({action:"add",direction:"after"},e),children:(Vt,fe)=>{var ut=lE(),gt=Et(ut);Ze(gt,{name:"add-after"});var It=et(gt,2);Xe(It,{children:(kt,Ut)=>{var Zt=Te();se(()=>Bi(Zt,`Add ${$(y)??""} ${$(y)==="row"?"below":"after"}`)),I(kt,Zt)}}),I(Vt,ut)}});var Wt=et(At,2);Oa(Wt),I(tt,pt)};Ft(Xt,tt=>{$(X).addable&&tt(_t)})}var Bt=et(Xt,2);{var lt=tt=>{var pt=uE(),mt=Et(pt);{var At=ut=>{Re(ut,{onclick:()=>Ae({action:"move",direction:"backward"},e),children:(gt,It)=>{var kt=cE(),Ut=Et(kt);{let ri=H(()=>`move-${$(y)==="row"?"up":"left"}`);Ze(Ut,{get name(){return $(ri)}})}var Zt=et(Ut,2);Xe(Zt,{children:(ri,Wi)=>{var wo=Te();se(()=>Bi(wo,`Move ${$(y)??""} ${$(y)==="row"?"up":"left"}`)),I(ri,wo)}}),I(gt,kt)}})};Ft(mt,ut=>{($(X).moveable==="backward"||$(X).moveable===!0)&&ut(At)})}var Wt=et(mt,2);{var Vt=ut=>{Re(ut,{onclick:()=>Ae({action:"move",direction:"forward"},e),children:(gt,It)=>{var kt=hE(),Ut=Et(kt);{let ri=H(()=>`move-${$(y)==="row"?"down":"right"}`);Ze(Ut,{get name(){return $(ri)}})}var Zt=et(Ut,2);Xe(Zt,{children:(ri,Wi)=>{var wo=Te();se(()=>Bi(wo,`Move ${$(y)??""} ${$(y)==="row"?"down":"right"}`)),I(ri,wo)}}),I(gt,kt)}})};Ft(Wt,ut=>{($(X).moveable==="forward"||$(X).moveable===!0)&&ut(Vt)})}var fe=et(Wt,2);Oa(fe),I(tt,pt)};Ft(Bt,tt=>{$(X).moveable!==!1&&tt(lt)})}var Yt=et(Bt,2);{var $e=tt=>{Re(tt,{onclick:()=>Ae({action:"duplicate"},e),children:(pt,mt)=>{var At=fE(),Wt=Et(At);Ze(Wt,{name:"duplicate"});var Vt=et(Wt,2);Xe(Vt,{children:(fe,ut)=>{var gt=Te();se(()=>Bi(gt,`Duplicate ${$(y)??""}`)),I(fe,gt)}}),I(pt,At)}})};Ft(Yt,tt=>{$(X).duplicatable&&tt($e)})}var yt=et(Yt,2);{var Nt=tt=>{Re(tt,{onclick:()=>Ae({action:"clear"},e),children:(pt,mt)=>{var At=dE(),Wt=Et(At);Ze(Wt,{name:"clear"});var Vt=et(Wt,2);Xe(Vt,{children:(fe,ut)=>{var gt=Te();se(()=>Bi(gt,`Clear ${$(y)??""}`)),I(fe,gt)}}),I(pt,At)}})};Ft(yt,tt=>{$(X).clearable&&tt(Nt)})}var re=et(yt,2);{var be=tt=>{Re(tt,{onclick:()=>Ae({action:"remove"},e),children:(pt,mt)=>{var At=OE(),Wt=Et(At);Ze(Wt,{name:"remove"});var Vt=et(Wt,2);Xe(Vt,{children:(fe,ut)=>{var gt=Te();se(()=>Bi(gt,`Delete ${$(y)??""}`)),I(fe,gt)}}),I(pt,At)}})};Ft(re,tt=>{$(X).removable&&tt(be)})}I(E,D)},$$slots:{default:!0}})},$$slots:{default:!0}})},f=H(()=>L(e.menu));Ft(h,x=>{$(f)&&x(u)})}var d=et(h,2);ua(d,16,()=>yZ,x=>x,(x,y)=>{{let k=H(()=>{var Q;return yf((Q=e.activeHandle)==null?void 0:Q.handle,y)?e.activeHandle.state:void 0});hg(x,{get of(){return y},get state(){return $(k)}})}});var O=et(d,2);{var p=x=>{DZ(x)},m=H(()=>!e.interactive&&V(e.outline));Ft(O,x=>{$(m)&&x(p)})}var g=et(O,2);{var b=x=>{xX(x)},v=H(()=>e.selection.isAll());Ft(g,x=>{$(v)&&x(b)})}pc(n,x=>e.wrapperElement=x,()=>e==null?void 0:e.wrapperElement),se(x=>$t(n,"data-select-all",x),[()=>wr(e.selection.isAll())]),Lo("mouseover",n,x=>BX(x,e)),Lo("mouseout",n,x=>qX(x,e)),Lo("pointerdown",n,x=>NX(x,e)),ca("dragover",n,x=>GX(x)),Lo("keydown",r,x=>EX(x,e)),ca("copy",r,x=>AX(x,e)),ca("cut",r,x=>ZX(x,e)),ca("paste",r,x=>XX(x,e)),I(i,n),Vn()}_S(["mouseover","mouseout","pointerdown","keydown"]);class tO extends zn{constructor(e,n){super();P(this,"tableDescription");P(this,"widgetElement");P(this,"height");P(this,"destroyWidgetElement");this.tableDescription=e;const r=TE(n);if(L(r)){const{widgetElement:s,destroyWidgetElement:o}=this.create(r);this.widgetElement=s,this.destroyWidgetElement=o,this.height=D5(r,s)}else this.widgetElement=void 0,this.destroyWidgetElement=void 0,this.height=Gm}get estimatedHeight(){return this.height}coordsAt(e,n,r){const s=this.tableDescription.table.closestCellAtPosition(n),o=gc(e,s);if(V(o))return null;const l=o.getBoundingClientRect();return{top:l.top,right:l.right,bottom:l.bottom,left:l.left}}toDOM(e){if(L(this.widgetElement))return this.widgetElement;const{widgetElement:n,destroyWidgetElement:r}=this.create(e);return this.widgetElement=n,this.destroyWidgetElement=r,e.requestMeasure({read:()=>{this.height=n.getBoundingClientRect().height}}),n}destroy(e){var n;(n=this.destroyWidgetElement)==null||n.call(this),this.destroyWidgetElement=void 0,this.widgetElement=void 0,this.height=Gm}create(e){const n=ml(e.dom).createElement("div");n.className="tbl-table-widget",n.tabIndex=-1,n.addEventListener("pointerdown",O=>{(O==null?void 0:O.target)===n&&O.preventDefault()});const r=this.tableDescription,s=p5(()=>{Hc(()=>{const O=!r.table.text.eq(r.editorTableText),p=!th(r.selection.value,r.editorSelectionValue);if(!O&&!p)return;let m;if(r.selection.isCell()){const{from:b}=r.table.cellSpan(r.selection.cell);m={anchor:r.from+b+r.selection.cellSection.anchor,head:r.from+b+r.selection.cellSection.head}}else r.selection.isAll()?m={anchor:r.from,head:r.to}:r.selection.isHidden()&&(m={anchor:r.from+1,head:r.from+1});const g=O?{from:r.from,to:r.to,insert:r.table.text}:void 0;r.markSynchronized(),e.dispatch({annotations:Tn("table.edit"),changes:g,selection:m})})}),{extensions:o,markdownConfig:l,globalKeyBindings:a,selectionType:c,lineWrapping:h}=Sv(e.state),u=IS(gE,{target:n,props:{table:r.table,selection:r.selection,scrollElement:n,rootEditor:e,extensions:o,markdownConfig:l,globalKeyBindings:a,selectionType:c,lineWrapping:h,menuRootElement:Pk(e,rv).dom,onUndo:()=>ed(e),onRedo:()=>Ga(e),onNavigate:O=>{e.dispatch({annotations:Tn("table.navigate"),selection:{anchor:O==="before"?r.from-1:r.to+1}}),e.focus()},onDelete:()=>{e.dispatch({annotations:Tn("table.delete"),changes:{from:r.from,to:r.to},selection:e.state.selection}),e.focus()}}}),f=()=>{jS(u)},d=Y5(n,({height:O})=>{this.height=O});return{widgetElement:n,destroyWidgetElement:Tr(s,f,d)}}static of(e,n){return new tO(e,n)}}function bE(i,t){return{widget:tO.of(i,t),block:!0,inclusive:!0}}function wE(i,t){return J.replace(bE(i,t))}function SE(i,t){const e=new Ns;for(const n of i)e.add(n.from,n.to,wE(n,t));return e.finish()}function vE(i){return bv(i)}function xE(i,t){return bv(i,t)}function bv(i,t=[]){const e=[];QR(St(i),s=>{M1(s)&&e.push({from:i.doc.lineAt(s.from).from,to:i.doc.lineAt(s.to).to})});const n=[],r=[];for(const s of e){if(LR(t,s,B1)){n.push(s);continue}const o=yE(s,i);qc(o)?n.push(s):r.push(...o)}return{spans:n,formatting:r,complete:Uk(i)}}function yE(i,t){return[...kE(i,t),...QE(i,t)]}function kE(i,{doc:t,lineBreak:e}){return yd({doc:t,lineBreak:e,span:i}).changes}function QE({from:i,to:t},{doc:e}){const n=e.slice(i,t),{text:r}=ef(n);return n.eq(r)?[]:[{from:i,to:t,insert:r}]}const $E={create(i){return pa(i)},update(i,t){if(eZ(t))return pa(t.state);if(!t.docChanged&&V(t.selection)&&i.complete)return i;const{tables:e,formatting:n,decorations:r}=i;if(!t.docChanged&&i.complete)return{tables:dg(e,t),formatting:n,decorations:r.map(t.changes),complete:!0};if(tZ(t)||CE(t,e))return pa(t.state);const s=dg(e,t).map(c=>c.span),{complete:o,spans:l,formatting:a}=xE(t.state,s);return mn(s,l,B1)?{complete:o,tables:e,formatting:a,decorations:r.map(t.changes)}:pa(t.state)},provide(i){return z.decorations.from(i,t=>t.decorations)}},wv=mi.define($E);function pa(i){const{spans:t,formatting:e,complete:n}=vE(i),{doc:r,selection:s}=i,o=t.map(l=>vf.of({span:l,doc:r,selection:s}));return{complete:n,tables:o,formatting:e,decorations:SE(o,i)}}function CE(i,t){return!Yd(i)&&t.some(e=>i.changes.touchesRange(e.from,e.to)!==!1)}function dg(i,t){return TR(i,e=>e.applyTransaction(t))}const PE={create(){return{view:void 0}},update(i){return i}},eO=mi.define(PE);function Sv(i){return i.facet(nf)}function Mn(i){return i.field(wv)}function TE(i){return i.field(eO).view}function RE(i){const{handlePosition:t,selectionType:e,lineWrapping:n}=Sv(i);return{...Nc(window)?{"data-tbl-hoverable":""}:{},"data-tbl-theme-mode":i.facet(z.darkTheme)?"dark":"light","data-tbl-handle-position":t,"data-tbl-selection-type":e,"data-tbl-line-wrapping":n}}const AE=["undo","redo","select.undo","select.redo"];function ZE(i){return AE.some(t=>i.isUserEvent(t))}function XE(i){return vv(i,"select.search")}function EE(i){return vv(i,"select")}function LE(i){return i.isUserEvent("delete.forward")}function ME(i){return i.isUserEvent("delete.backward")}function vv(i,t){return i.annotation(Tt.userEvent)===t}const zE=({state:i,view:t,transactions:e})=>{t.hasFocus||Mn(i).tables.some(n=>n.containsSelection())||e.some(n=>ZE(n)||XE(n)&&!Ov(t))&&t.focus()},xv=Pt.define(),_E=new Map(US.map(i=>[i,xv.of(i)]));function yv(i){return _E.get(i)}const IE=(i,t)=>!t||!Mn(i).tables.some(e=>e.containsSelection())?null:yv("table.focus"),jE=i=>{const{selection:t,startState:e,docChanged:n}=i;if(V(t)||n||!EE(i)||!lc(t)||!lc(e.selection))return i;const r=e.selection.main,s=t.main;for(const o of Mn(e).tables){const l=o.from===s.head,a=o.to===s.head,c=o.from===r.head+1&&o.to===s.head-1,h=o.from===s.head+1&&o.to===r.head-1;let u;if(l?u=o.table.firstCellSpan.from:c?u=o.table.firstCellSpan.to:(a||h)&&(u=o.table.lastCellSpan.to),L(u))return[i,{annotation:Tn("table.navigate"),selection:aR({pos:o.from+u})}]}return i},DE=i=>{const{selection:t,startState:e}=i;if(V(t)||!lc(t))return i;const n=e.selection.main;if(LE(i)){for(const r of Mn(e).tables)if(n.head===r.from-1){const s=r.table.firstCellSpan.from;return[{selection:{anchor:r.from+s,head:r.from+s}}]}return i}else if(ME(i)){for(const r of Mn(e).tables)if(n.head===r.to+1){const s=r.table.lastCellSpan.to;return[{selection:{anchor:r.from+s,head:r.from+s}}]}return i}else return i};function YE(i){return TQ(i)>0||RQ(i)>0}const WE=({state:i,docChanged:t,selectionSet:e,transactions:n,view:r})=>{if(!t&&!e&&YE(i)||n.some(a=>Yd(a)))return;const{formatting:s}=Mn(i);if(qc(s))return;const o=Lt.of(s,i.doc.length,i.lineBreak),l=i.selection.map(o);r.dispatch({annotations:Tn("table.format"),changes:o,selection:l})},VE=i=>{if(!i.docChanged||Yd(i))return i;const t=i.changes,{tables:e}=Mn(i.startState),n=[];for(const o of e)if(t.touchesRange(o.from-1,o.from)!==!1||t.touchesRange(o.to,o.to+1)!==!1){const l={from:t.mapPos(o.from,1),to:t.mapPos(o.to)};if(l.from>=l.to)continue;n.push(yd({doc:i.newDoc,lineBreak:i.startState.lineBreak,span:l}).changes)}if(qc(n))return i;const r=Lt.of(n,i.changes.newLength,i.startState.lineBreak),s=i.newSelection.map(r);return[i,{annotation:Tn("table.correct"),changes:r,selection:s,sequential:!0}]};function BE(i,{anchor:t,head:e,goalColumn:n,bidiLevel:r}={}){return C.range(t??i.anchor,e??i.head,n??i.goalColumn,r??i.bidiLevel??void 0)}const qE=i=>{const{selection:t,startState:e,docChanged:n}=i;if(V(t)||n||lc(t))return i;const r=t.ranges.map(s=>{if(s.empty)return s;const o=Mn(e).tables,l=Og(s.anchor,o),a=Og(s.head,o);return L(l)||L(a)?BE(s,{anchor:l,head:a}):s});return mn(t.ranges,r,(s,o)=>s===o)?i:[i,{annotations:Tn("table.select"),selection:C.create(r,t.mainIndex)}]};function Og(i,t){for(const e of t){const n=e.from,r=e.to,s=e.from+1,o=e.to-1;if(i===n||i===s)return n-1;if(i===r||i===o)return r+1}}const NE={"& .cm-tooltip.cm-tooltip-autocomplete:has(.cm-completionIcon-table)":{border:"1px solid var(--tbl-theme-menu-border-color)","box-shadow":"2px 2px 0 0 rgb(0 0 0 / 10%)","font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)"},"& .cm-tooltip.cm-tooltip-autocomplete > ul:has(.cm-completionIcon-table)":{"min-width":"auto",display:"flex","flex-direction":"column","justify-content":"center",padding:"0.25em 0","line-height":1,"font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)",background:"var(--tbl-theme-menu-background)"},"& .cm-tooltip.cm-tooltip-autocomplete ul li[aria-selected]:has(.cm-completionIcon-table)":{color:"var(--tbl-theme-menu-hover-text-color)","&::before":{background:"var(--tbl-theme-menu-hover-background)"}},"& .cm-tooltip.cm-tooltip-autocomplete ul li:not([aria-selected]):has(.cm-completionIcon-table)":{color:"var(--tbl-theme-menu-text-color)"},"& .cm-tooltip.cm-tooltip-autocomplete ul li:not([aria-selected]):has(.cm-completionIcon-table), & .cm-tooltip.cm-tooltip-autocomplete ul li[aria-selected]:has(.cm-completionIcon-table)":{position:"relative",padding:"0.5em 0.75em",background:"var(--tbl-theme-menu-background)",display:"flex",gap:"0.75em","align-items":"center","font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)","line-height":1,"&::before":{position:"absolute",height:"100%",width:"calc(100% - 0.5em)",left:"0.25em",top:0,content:'""',"pointer-events":"none"}},"& .cm-completionIcon.cm-completionIcon-table":{opacity:1,"mask-image":`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='14' width='12.25' viewBox='0 0 448 512'%3E%3C!--!Font Awesome Free v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--%3E%3Cpath d='M384 96l-128 0 0 128 128 0 0-128zm64 128l0 192c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 128zM64 288l0 128 128 0 0-128-128 0zm128-64l0-128-128 0 0 128 128 0zm64 64l0 128 128 0 0-128-128 0z'/%3E%3C/svg%3E")`,"mask-position":"center","mask-repeat":"no-repeat",padding:0,background:"currentColor",position:"relative",width:"1em",height:"1em","font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)","line-height":1},"& :has(.cm-completionIcon.cm-completionIcon-table) .cm-completionLabel":{position:"relative"}},GE={'&[data-tbl-handle-position="inside"] .tbl-table-widget':{"padding-left":"6px","margin-left":0},".tbl-table-widget":{contain:"paint","padding-top":"16px","padding-right":"16px","padding-bottom":"16px","padding-left":"16px","margin-left":"-10px","overflow-x":"auto","overflow-y":"hidden","&, &::before, &::after, & *, & *::before, & *::after":{"box-sizing":"border-box"}},"&.cm-editor .cm-content div.tbl-table-widget::selection, & .cm-content div.tbl-table-widget ::selection, & .cm-content div.tbl-table-widget:focus::selection, & .cm-content div.tbl-table-widget :focus::selection":{"background-color":"transparent !important","caret-color":"transparent !important"}},UE={".cm-tooltip.tbl-menu-tooltip":{border:"none","user-select":"none","&, &::before, &::after, & *, & *::before, & *::after":{"box-sizing":"border-box"}}},HE={".tbl-blocking-overlay":{position:"absolute",top:0,left:0,"z-index":900,"background-color":"transparent",width:"100%",height:"100%"}},FE={"& .cm-content div.tbl-table-widget .tbl-cell-editor ::selection, & .cm-content div.tbl-table-widget .tbl-cell-editor :focus::selection":{"background-color":"Highlight !important","caret-color":"initial !important"},"&[data-tbl-selection-type='codemirror'] .tbl-cell-editor .cm-editor .cm-content":{"caret-color":"transparent !important"},"&[data-tbl-selection-type='codemirror'] .tbl-cell-editor .cm-editor .cm-content ::selection, &[data-tbl-selection-type='codemirror'] .tbl-cell-editor .cm-editor .cm-content :focus::selection":{"background-color":"transparent !important","caret-color":"transparent !important"},"&[data-tbl-line-wrapping='wrap'] .tbl-cell-editor .cm-editor .cm-content":{"word-break":"normal","overflow-wrap":"break-word"},".tbl-cell-editor":{height:"100%"},".tbl-cell-editor .cm-editor":{margin:0,padding:0,outline:"none",height:"100%",background:"unset",color:"var(--tbl-theme-text-color)"},".tbl-cell-editor .cm-editor .cm-scroller":{margin:0,padding:0,overflow:"hidden","line-height":1.5,"font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)",color:"var(--tbl-theme-text-color)"},".tbl-cell-editor .cm-editor .cm-content":{margin:0,padding:"7px 9px","line-height":1.5,"font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)",color:"var(--tbl-theme-text-color)"},".tbl-cell-editor .cm-editor .cm-line":{margin:0,padding:"0 1px","line-height":1.5,"touch-action":"none","font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)",color:"var(--tbl-theme-text-color)"}},KE={".tbl-cell":{"box-sizing":"content-box",position:"relative","vertical-align":"top","background-color":"var(--tbl-row-background)",padding:0,"font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)","min-width":"calc(4ch + 20px)",height:"inherit","user-select":"none",border:"none","scroll-margin-right":"1px","scroll-margin-left":"1px","&:first-child":{"scroll-margin-left":"16px"},"&:last-child":{"scroll-margin-right":"16px"},'&[align="left"]':{"text-align":"left"},'&[align="center"]':{"text-align":"center"},'&[align="right"]':{"text-align":"right"},'&[data-border~="top"]':{"border-top":"1px solid var(--tbl-theme-border-color)"},'&[data-border~="right"]':{"border-right":"1px solid var(--tbl-theme-border-color)"},'&[data-border~="bottom"]':{"border-bottom":"1px solid var(--tbl-theme-border-color)"},'&[data-border~="left"]':{"border-left":"1px solid var(--tbl-theme-border-color)"},'&[data-state="moving"]':{"z-index":200,"background-color":"color-mix(in srgb, var(--tbl-row-background), transparent 15%)"},'&[data-state="shiftable"]':{transform:"translate3d(0, 0, 0)",transition:"transform 150ms ease"},"&[data-outline]":{"&::after":{display:"block",position:"absolute",top:"-1px",left:"-1px",border:"none",width:"calc(100% + 2px)",height:"calc(100% + 2px)","pointer-events":"none",content:'""'},'&[data-outline~="top"]::after':{"border-top":"2px solid var(--tbl-theme-outline-color)"},'&[data-outline~="right"]::after':{"border-right":"2px solid var(--tbl-theme-outline-color)"},'&[data-outline~="bottom"]::after':{"border-bottom":"2px solid var(--tbl-theme-outline-color)"},'&[data-outline~="left"]::after':{"border-left":"2px solid var(--tbl-theme-outline-color)"}}},".tbl-header-cell:not([align])":{"text-align":"var(--tbl-style-default-header-alignment)"}},JE={'&[data-tbl-line-wrapping="wrap"] .tbl-cell-view':{"word-break":"normal","overflow-wrap":"break-word"},'&[data-tbl-line-wrapping="nowrap"] .tbl-cell-view':{"white-space":"pre"},".tbl-cell-view":{margin:0,outline:"none",padding:"7px 10px",height:"100%","line-height":1.5,"white-space-collapse":"break-spaces","font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)",color:"var(--tbl-theme-text-color)","&[data-hidden]":{display:"none"}},".tbl-cell-view [data-br]":{"white-space":"pre"}},tL={".tbl-handle":{display:"flex",position:"absolute","justify-content":"center","align-items":"center","z-index":200,transition:"opacity 150ms ease 50ms","touch-action":"none"},".tbl-handle[data-hover], .tbl-handle[data-active]":{"--tbl-handle-opacity":1},'&:not([data-tbl-hoverable]) .tbl-handle[data-type="border"], &:not([data-tbl-hoverable]) .tbl-handle[data-type="table"]':{display:"none"},'.tbl-handle[data-type="border"]':{"background-color":"var(--tbl-theme-border-hover-color)"},'.tbl-handle[data-type="border"][data-active]':{"background-color":"var(--tbl-theme-border-active-color)"},'.tbl-handle[data-type="border"][data-toggle]':{transition:"none"},'.tbl-handle[data-type="border"][data-location="top"]':{top:"-1px",left:"-1px",width:"calc(100% + 2px)",height:"2px"},'.tbl-handle[data-type="border"][data-location="left"]':{top:"-1px",left:"-1px",width:"2px",height:"calc(100% + 2px)"},'.tbl-handle[data-type="border"][data-location="col"]':{top:"-1px",right:"-2px",width:"3px",height:"calc(100% + 2px)"},'.tbl-handle[data-type="border"][data-location="row"]':{bottom:"-2px",left:"-1px",width:"calc(100% + 2px)",height:"3px"},'.tbl-handle[data-type="table"]':{"box-sizing":"content-box",color:"var(--tbl-theme-border-hover-color)","background-color":"color-mix(in srgb, var(--tbl-theme-border-color), var(--tbl-theme-header-row-background) 80%)"},'.tbl-handle[data-type="table"][data-location="right"]':{top:0,left:"100%",width:"15px",height:"calc(100% - 2px)",border:"1px solid var(--tbl-theme-border-color)","border-left":"none","&::before":{position:"absolute",top:"-1px",left:"-2px",width:"2px",height:"calc(100% + 2px)",content:'""'},"&::after":{position:"absolute","z-index":366,top:"-1px",left:0,content:'""',width:"calc(100% + 1px)",height:"calc(100% + 2px)","background-color":"var(--tbl-overlay)"}},'.tbl-handle[data-type="table"][data-location="bottom-right"]':{left:"calc(100% - 1px)",top:"calc(100% - 1px)","z-index":250,width:"15px",height:"15px",border:"1px solid var(--tbl-theme-border-color)","border-top-style":"dashed","border-left-style":"dashed","&::after":{position:"absolute","z-index":366,top:"-1px",left:"-1px",content:'""',width:"calc(100% + 2px)",height:"calc(100% + 2px)","background-color":"var(--tbl-overlay)"}},'.tbl-handle[data-type="table"][data-location="bottom"]':{top:"100%",left:"0",width:"calc(100% - 2px)",height:"15px",border:"1px solid var(--tbl-theme-border-color)","border-top":"none","&::before":{position:"absolute",top:"-2px",left:"-1px",width:"calc(100% + 2px)",height:"2px",content:'""'},"&::after":{position:"absolute","z-index":366,top:0,left:"-1px",content:'""',width:"calc(100% + 2px)",height:"calc(100% + 1px)","background-color":"var(--tbl-overlay)"}},'.tbl-handle[data-type="table"][data-location="bottom-right"][data-hover] ~ .tbl-handle[data-type="table"][data-location="right"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="right"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-hover] ~ .tbl-handle[data-type="table"][data-location="bottom"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="bottom"]':{"--tbl-handle-opacity":1},'.tbl-handle[data-type="table"][data-location="bottom-right"][data-hover] ~ .tbl-handle[data-type="table"][data-location="right"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="right"]':{"border-bottom":"none"},'.tbl-handle[data-type="table"][data-location="bottom-right"][data-hover] ~ .tbl-handle[data-type="table"][data-location="bottom"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="bottom"]':{"border-right":"none"},'.tbl-handle[data-type="table"][data-active], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="right"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="bottom"]':{"background-color":"color-mix(in srgb, var(--tbl-theme-border-color), var(--tbl-theme-header-row-background) 80%)",color:"var(--tbl-theme-border-active-color)"},'&[data-tbl-handle-position="outside"] .tbl-handle[data-type="header"]':{"box-sizing":"content-box",transition:"none","z-index":300,color:"var(--tbl-theme-border-hover-color)",border:"1px solid transparent","&:hover":{"border-color":"var(--tbl-theme-border-color)","background-color":"color-mix(in srgb, var(--tbl-theme-border-color), var(--tbl-theme-header-row-background) 80%)"},"&[data-active]":{"background-color":"var(--tbl-theme-outline-color)","border-color":"var(--tbl-theme-outline-color)",color:"#ffffff"}},'&[data-tbl-handle-position="outside"] .tbl-handle[data-type="header"][data-location="row"]':{top:"-1px",left:"-17px",width:"15px",height:"100%","border-right":"none"},'&[data-tbl-handle-position="outside"] .tbl-handle[data-type="header"][data-location="col"]':{top:"-17px",left:"-1px",width:"100%",height:"15px","border-bottom":"none","&:hover::after":{position:"absolute","z-index":366,top:"-1px",left:"-1px",content:'""',width:"calc(100% + 2px)",height:"calc(100% + 1px)","background-color":"var(--tbl-overlay)"}},'&[data-tbl-handle-position="inside"] .tbl-handle[data-type="header"]':{transition:"none","z-index":300,color:"var(--tbl-theme-border-hover-color)","&:hover":{color:"var(--tbl-theme-border-active-color)"},"&[data-active]":{color:"var(--tbl-theme-outline-color)"}},'&[data-tbl-handle-position="inside"] .tbl-handle[data-type="header"][data-location="row"]':{top:"calc(50% - 13px)",left:"-1px",width:"3px",height:"26px","border-top":"4px solid var(--tbl-row-background)","border-bottom":"4px solid var(--tbl-row-background)","background-color":"var(--tbl-row-background)","&:hover::after, &[data-active]::after":{position:"absolute",top:"-6px",left:0,"box-sizing":"content-box","border-top":"2px solid transparent","border-bottom":"2px solid transparent",width:"calc(100% + 6px)",height:"calc(100% + 8px)",content:'""'}},'&[data-tbl-handle-position="inside"] .tbl-handle[data-type="header"][data-location="col"]':{top:"-1px",left:"calc(50% - 11.5px)",width:"23px",height:"3px","border-right":"4px solid var(--tbl-row-background)","border-left":"4px solid var(--tbl-row-background)","background-color":"var(--tbl-row-background)","&:hover::after, &[data-active]::after":{position:"absolute",top:0,left:"-6px","box-sizing":"content-box","border-right":"2px solid transparent","border-left":"2px solid transparent",width:"calc(100% + 8px)",height:"calc(100% + 6px)",content:'""'}},".tbl-handle-grip":{"pointer-events":"none","z-index":333}},eL={".tbl-menu-item-icon":{"z-index":200,width:"1em",height:"1em","pointer-events":"none","font-size":"var(--tbl-style-menu-font-size)"}},iL={".tbl-menu-item-text":{"z-index":200,"pointer-events":"none","user-select":"none","font-size":"var(--tbl-style-menu-font-size)"}},nL={".tbl-menu-item":{display:"flex",position:"relative","align-items":"center",gap:"0.75em",padding:"0.5em 0.75em",color:"var(--tbl-theme-menu-text-color)","user-select":"none","line-height":1,"font-size":"var(--tbl-style-menu-font-size)","&:active":{cursor:"pointer",color:"var(--tbl-theme-menu-hover-text-color)","&::after":{"background-color":"var(--tbl-theme-menu-hover-background)"}},"&::after":{position:"absolute",left:"0.25em",width:"calc(100% - 0.5em)",height:"100%",content:'""'}},"&[data-tbl-hoverable] .tbl-menu-item:hover":{cursor:"pointer",color:"var(--tbl-theme-menu-hover-text-color)","&::after":{"background-color":"var(--tbl-theme-menu-hover-background)"}}},rL={".tbl-menu-separator":{margin:"0.25em 0.5em","background-color":"var(--tbl-theme-menu-border-color)",height:"1px","font-size":"var(--tbl-style-menu-font-size)"}},sL={".tbl-menu":{position:"absolute",top:0,left:0,"z-index":900,"box-shadow":"2px 2px 0 0 rgb(0 0 0 / 10%)",border:"1px solid var(--tbl-theme-menu-border-color)","background-color":"var(--tbl-theme-menu-background)",padding:"0.25em 0",width:"max-content","font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)"}},oL={".tbl-select-all-overlay":{position:"absolute",top:0,left:0,"z-index":900,"background-color":"var(--tbl-overlay)",width:"100%",height:"100%","pointer-events":"none"}},lL={"& .tbl-table-wrapper[data-select-all]":{"--tbl-select-all-overlay":"var(--tbl-theme-select-all-blur-overlay)"},"&.cm-focused .tbl-table-wrapper[data-select-all]":{"--tbl-select-all-overlay":"var(--tbl-theme-select-all-focus-overlay)"},".tbl-table-wrapper":{"--tbl-overlay":"var(--tbl-select-all-overlay, transparent)",position:"relative",width:"fit-content","white-space-collapse":"collapse","touch-action":"none"},".tbl-table":{"border-collapse":"separate","border-spacing":0,overflow:"visible","touch-action":"none","&:focus-visible":{outline:"none"}},".tbl-table-head, .tbl-table-body":{height:"100%"},".tbl-table-row":{height:0},"@supports (-moz-appearance: none) /* TableTheme */":{".tbl-table-row":{height:"fit-content"}},".tbl-table-head .tbl-table-row":{"--tbl-row-background":"var(--tbl-theme-header-row-background)"},".tbl-table-body .tbl-table-row:nth-child(2n + 1)":{"--tbl-row-background":"var(--tbl-theme-even-row-background)"},".tbl-table-body .tbl-table-row:nth-child(2n)":{"--tbl-row-background":"var(--tbl-theme-odd-row-background)"}},aL={...NE,...UE,...GE,...lL,...HE,...KE,...FE,...JE,...tL,...sL,...nL,...eL,...iL,...rL,...oL},cL=i=>{var e;const t=(e=i.effects.find(n=>n.is(xv)))==null?void 0:e.value;return L(t)?{annotations:Tn(t)}:null},hL=i=>{const t=i.annotation(Dd);return L(t)?[yv(H5(t))]:[]};class iO{static of(t){return t.state.field(eO).view=t,new iO}constructor(){}}function uL(i){return[nf.of(i),wv,eO,di.define(t=>iO.of(t)),z.editorAttributes.compute([nf,z.darkTheme],RE),z.baseTheme(aL),z.theme("light"in i.theme?{':where(:root:has(&[data-tbl-theme-mode="light"]))':i.theme.light.props,':where(:root:has(&[data-tbl-theme-mode="dark"]))':i.theme.dark.props}:{":where(:root:has(&))":i.theme.props}),z.theme({":where(:root:has(&))":i.style.props}),x0.of(hL),r0.of(rv),K.transactionExtender.of(cL),K.transactionFilter.of(VE),K.transactionFilter.of(DE),K.transactionFilter.of(jE),K.transactionFilter.of(qE),z.updateListener.of(WE),z.updateListener.of(zE),z.clipboardInputFilter.of(oA),z.focusChangeEffect.of(IE)]}function fL(i){return uL(X1(i))}const dL=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]);function kv(i,t){try{const e=new URL(t),n=new URL(i,e);return n.protocol==="http:"||n.protocol==="https:"?{kind:"web",url:n.href}:dL.has(n.protocol)?{kind:"browser-local",url:n.href}:{kind:"application",url:n.href}}catch{return{kind:"invalid"}}}const Qv="cm-md-mark",$v="cm-md-inline-code",Qf="cm-md-list-item",$f="cm-md-list-bullet",Cv="cm-md-blockquote-line",Pv="cm-md-fenced-line",Tv="cm-md-hr",Rv="cm-md-task-checkbox",Av="cm-md-heading-1",Zv="cm-md-heading-2",nO="cm-md-link",Xv="cm-md-tag",Ev="cm-md-list-indent-source",pg="1.2em",OL="0.62em",Ro=J.replace({}),Gn=J.mark({class:Qv}),pL=J.mark({class:Ev}),mL=J.mark({class:$v}),gL=J.line({class:$f}),bL=J.line({class:Cv}),wL=J.line({class:Pv}),SL=J.line({class:Av}),vL=J.line({class:Zv}),xL=J.mark({class:Xv});class yL extends zn{toDOM(){const t=document.createElement("hr");return t.className=Tv,t}eq(t){return!0}ignoreEvent(){return!0}}const kL=J.replace({widget:new yL});class QL extends zn{constructor(e,n,r){super();P(this,"checked");P(this,"from");P(this,"to");this.checked=e,this.from=n,this.to=r}eq(e){return e.checked===this.checked&&e.from===this.from&&e.to===this.to}toDOM(e){const n=document.createElement("input");return n.type="checkbox",n.checked=this.checked,n.className=Rv,n.tabIndex=-1,n.addEventListener("mousedown",r=>{r.preventDefault()}),n.addEventListener("change",()=>{const r=this.checked?"[ ]":"[x]";e.dispatch({changes:{from:this.from,to:this.to,insert:r}})}),n}ignoreEvent(e){return e.type!=="click"&&e.type!=="change"&&e.type!=="mousedown"}}const $L=new Set(["EmphasisMark","LinkMark","URL"]),CL=new Set(["HeaderMark","QuoteMark"]),mg=/(^|\s)(#[\p{L}\p{N}_/-]+)/gu,PL=/[/.,;:!?]+$/u,TL=new RegExp("\\p{L}","u"),RL=new Set(["InlineCode","FencedCode","URL","Link"]);function AL(i,t,e,n,r,s){return CL.has(i)?{kind:"block",contextFrom:r,contextTo:s}:i==="CodeMark"?t==="InlineCode"&&e!==null&&n!==null?{kind:"inline",contextFrom:e,contextTo:n}:null:$L.has(i)?e===null||n===null?null:{kind:"inline",contextFrom:e,contextTo:n}:null}function gn(i,t,e,n){return i<=n&&t>=e}function ZL(i,t,e,n){const r=i.doc.lineAt(n);return gn(t,e,r.from,r.to)}function XL(i,t,e,n){return t.kind==="inline"?!gn(e,n,t.contextFrom,t.contextTo):!ZL(i,e,n,t.contextFrom)}function EL(i){let t=i.firstChild;for(;t;){if(t.name==="TaskMarker")return!0;if(t.name==="Task"){let e=t.firstChild;for(;e;){if(e.name==="TaskMarker")return!0;e=e.nextSibling}}t=t.nextSibling}return!1}function LL(i){let t=i.parent;for(;t;){if(t.name==="ListItem")return t;t=t.parent}return null}function Kn(i,t){let e=i.firstChild;for(;e;){if(e.name===t)return e;e=e.nextSibling}return null}function gg(i,t){const e=[];let n=t.firstChild;for(;n;)n.name==="CodeMark"&&e.push(n),n=n.nextSibling;if(e.length>=2)return{from:t.from,to:e[e.length-1].to,closed:!0};const r=i.doc.lineAt(t.from);return{from:r.from,to:r.to,closed:!1}}function Lv(i,t){let e=t.to;for(;e<i.doc.length&&i.doc.sliceString(e,e+1)===" ";)e+=1;return{from:t.from,to:e}}function Hh(i,t){return{from:i.doc.lineAt(t.from).from,to:Lv(i,t).to}}function Fh(i,t){return Lv(i,t)}function bg(i,t,e){const n=Kn(t,"ListMark"),r=n?i.doc.lineAt(n.from).from:e.from;let s=e.to;for(;s<i.doc.length&&i.doc.sliceString(s,s+1)===" ";)s+=1;return{from:r,to:s}}function Kh(i,t,e){const n=i.doc.lineAt(t.from);n.from<t.from&&e.push(pL.range(n.from,t.from))}function ML(i,t,e){let n=0;for(let r=t;r<e;r+=1)n+=i.doc.sliceString(r,r+1)===" "?2:1;return n}function zL(i){return J.line({class:Qf,attributes:{style:`--cm-md-list-indent: ${i.prefixRevealed?0:i.indentColumns};`}})}function wg(i,t,e,n,r){let s=t;for(;s<=e;){const o=i.doc.lineAt(s);if(r.push(n.range(o.from)),o.to>=e)break;s=o.to+1}}function _L(i,t,e,n){const r=Kn(t,"ListMark"),s=i.doc.lineAt(r?r.from:t.from).from,o=r?ML(i,s,r.from):0;let l=t.from;for(;l<=t.to;){const a=i.doc.lineAt(l),c=a.from===s,h=/^\s/.test(a.text);if(c||h){const u=e.get(a.from),f={indentColumns:o,prefixRevealed:c&&n};u===void 0||o>u.indentColumns?e.set(a.from,f):o===u.indentColumns&&f.prefixRevealed&&e.set(a.from,{...u,prefixRevealed:!0})}if(a.to>=t.to)break;l=a.to+1}}function IL(i,t){let e=i.resolveInner(t,1);for(;e;){if(RL.has(e.name)||e.name.startsWith("Table"))return!0;e=e.parent}return!1}function jL(i,t){const e=/^( {0,3})(#{1,6})(?:\s|$)/.exec(i);if(!e)return!1;const n=e[1]??"",r=e[2]??"",s=n.length,o=s+r.length;return t>=s&&t<o}function DL(i,t,e){for(let n=1;n<=i.doc.lines;n+=1){const r=i.doc.line(n);mg.lastIndex=0;let s;for(;(s=mg.exec(r.text))!==null;){const o=s[1]??"",a=(s[2]??"").replace(PL,"");if(a.length<=1||!TL.test(a))continue;const c=r.from+s.index+o.length,h=c+a.length;jL(r.text,c-r.from)||IL(t,c)||e.push(xL.range(c,h))}}}function Sg(i,t,e,n){const r=[],s=new Map,o=new Set,l=i.selection.main,a=n?Math.min(l.from,l.to):-1,c=n?Math.max(l.from,l.to):-1;e.iterate({from:0,to:i.doc.length,enter:h=>{var p,m;if(h.name==="Table"||h.name.startsWith("Table"))return!1;const u=h.node.parent,f=(u==null?void 0:u.name)??null;let d=h.to;(h.name==="HeaderMark"||h.name==="QuoteMark")&&i.doc.sliceString(d,d+1)===" "&&(d+=1);const O=AL(h.name,f,(u==null?void 0:u.from)??null,(u==null?void 0:u.to)??null,h.from,d);if(O){const g=XL(i,O,a,c)?Ro:Gn;r.push(g.range(h.from,d))}if(h.name==="ListMark"){const g=h.node.parent;if(g&&g.name==="ListItem"){const b=EL(g),v=((p=g.parent)==null?void 0:p.name)==="OrderedList";if(!b&&!v){const x=Hh(i,h.node),y=Fh(i,h.node);gn(a,c,x.from,x.to)?(Kh(i,h.node,r),r.push(Gn.range(y.from,y.to))):r.push(Ro.range(x.from,x.to))}else if(v){const x=i.doc.lineAt(h.node.from),y=Hh(i,h.node);x.from<h.node.from&&(gn(a,c,y.from,y.to)?Kh(i,h.node,r):r.push(Ro.range(x.from,h.node.from))),r.push(Gn.range(h.node.from,h.node.to))}}}if(h.name==="InlineCode"){const g=h.node.firstChild,b=h.node.lastChild;g&&b&&g!==b&&g.name==="CodeMark"&&b.name==="CodeMark"&&g.to<b.from&&r.push(mL.range(g.to,b.from))}if(h.name==="ListItem"){const g=Kn(h.node,"ListMark"),b=Kn(h.node,"Task"),v=Kn(h.node,"TaskMarker")??(b?Kn(b,"TaskMarker"):null),x=v!==null,y=((m=h.node.parent)==null?void 0:m.name)==="OrderedList";let k=!1;if(g){const Q=v?bg(i,h.node,v):Hh(i,g);k=gn(a,c,Q.from,Q.to)}if(_L(i,h.node,s,k),!x&&!y&&g&&!k){const Q=i.doc.lineAt(h.from);o.add(Q.from)}}else if(h.name==="Blockquote")wg(i,h.from,h.to,bL,r);else if(h.name==="ATXHeading1"){const g=i.doc.lineAt(h.from);r.push(SL.range(g.from))}else if(h.name==="ATXHeading2"){const g=i.doc.lineAt(h.from);r.push(vL.range(g.from))}else if(h.name==="FencedCode"){const g=gg(i,h.node);wg(i,g.from,g.to,wL,r)}if(h.name==="Link"){let g=null,b=null,v=null,x=h.node.firstChild;for(;x;)x.name==="LinkMark"?g===null?g=x:b=x:x.name==="URL"&&(v=x),x=x.nextSibling;if(g&&b&&v&&g.to<b.from){const y=i.doc.sliceString(v.from,v.to),k=J.mark({class:nO,tagName:"a",attributes:{"data-href":y}});r.push(k.range(g.to,b.from))}}if(h.name==="CodeMark"&&f==="FencedCode"){const g=h.node.parent;if(g){const b=gg(i,g);if(b.closed){const v=gn(a,c,b.from,b.to)?Gn:Ro;r.push(v.range(h.from,h.to))}else r.push(Gn.range(h.from,h.to))}}if(h.name==="HorizontalRule"){const g=i.doc.lineAt(h.from);g.to>g.from&&!gn(a,c,g.from,g.to)&&r.push(kL.range(g.from,g.to))}if(h.name==="TaskMarker"){const g=LL(h.node),b=g?Kn(g,"ListMark"):null,v=g?bg(i,g,h.node):{from:h.from,to:h.to};if(gn(a,c,v.from,v.to)){if(b){const y=Fh(i,b);Kh(i,b,r),r.push(Gn.range(y.from,y.to))}r.push(Gn.range(h.from,h.to))}else{if(b){const E=Fh(i,b),W=i.doc.lineAt(b.from).from;r.push(Ro.range(W,E.to))}const y=i.doc.sliceString(h.from,h.to),k=y==="[x]"||y==="[X]",Q=J.replace({widget:new QL(k,h.from,h.to)});r.push(Q.range(h.from,h.to))}}}});for(const[h,u]of s)r.push(zL(u).range(h));for(const h of o)r.push(gL.range(h));return DL(i,e,r),J.set(r,!0)}const YL=di.fromClass(class{constructor(i){P(this,"decorations");this.decorations=Sg(i.state,i.visibleRanges,St(i.state),i.hasFocus)}update(i){(i.docChanged||i.selectionSet||i.viewportChanged||i.focusChanged||St(i.state)!==St(i.startState))&&(this.decorations=Sg(i.state,i.view.visibleRanges,St(i.state),i.view.hasFocus))}},{decorations:i=>i.decorations}),WL=z.theme({"&":{fontFamily:"var(--font-sans)",fontSize:"calc(var(--text-base) + 0.5px)",lineHeight:"1.5"},".cm-scroller":{fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit"},".cm-content":{fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",padding:"1.5rem 1rem"},[`.${Ev}`]:{fontFamily:"var(--font-mono)"},[`.${Qv}`]:{fontFamily:"var(--font-mono)",fontSize:"0.9em",color:"var(--color-text-muted)"},[`.${Av}`]:{fontSize:"1.3em"},[`.${Zv}`]:{fontSize:"1.1em"},[`.${$v}`]:{fontFamily:"var(--font-mono)",fontSize:"0.92em",backgroundColor:"rgba(0, 0, 0, 0.06)",padding:"1px 4px",borderRadius:"3px"},[`.${Xv}`]:{color:"var(--color-primary)",backgroundColor:"color-mix(in srgb, currentColor 8%, transparent)",borderRadius:"var(--radius-pill)",padding:"0 0.35em",fontWeight:"600",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone"},[`.${Qf}`]:{paddingLeft:`calc(0.5rem + var(--cm-md-list-indent, 0) * ${OL})`},[`.${Qf}.${$f}`]:{borderLeft:`${pg} solid transparent`},[`.${$f}::before`]:{content:"'•'",marginLeft:`calc(-1 * ${pg})`,fontFamily:"var(--font-mono)",fontSize:"0.9em",color:"var(--color-text-muted)",paddingRight:"0.5rem"},[`.${Cv}`]:{borderLeft:"3px solid var(--color-border)",paddingLeft:"1rem",marginLeft:"0.25rem",color:"var(--color-text-muted)"},[`.${Pv}`]:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:"0.92em",backgroundColor:"rgba(0, 0, 0, 0.04)",paddingLeft:"0.75em"},[`.${Tv}`]:{display:"inline-block",verticalAlign:"middle",border:"none",borderTop:"1px solid rgba(0, 0, 0, 0.2)",margin:0,width:"100%"},[`.${Rv}`]:{margin:"0 0.4em 0 0",cursor:"default",verticalAlign:"middle"},[`a.${nO}`]:{textDecoration:"underline",textUnderlineOffset:"0.15em",color:"rgba(0, 0, 0, 0.55)",cursor:"pointer"}}),VL=4;function Mv(i){return i instanceof Element?i.closest(`a.${nO}`):null}function BL(i){const t=i.getAttribute("data-href");if(t===null)return null;try{return new URL(t,window.document.baseURI).href}catch{return null}}function zv(){return window.__televisionContentBridge}function qL(i){const t={type:"navigation-request",url:i},e=zv();if(e){e.postToHost(t);return}window.parent.postMessage(t,"*")}function NL(i){const t=zv();if(t!=null&&t.openApplicationLink){t.openApplicationLink(i);return}window.location.href=i}function GL(i,t){return Math.hypot(t.clientX-i.x,t.clientY-i.y)>VL}let Ir=null;function vg(i){const t=Mv(i.target);if(!t||i.altKey)return Ir=null,!1;const e=Ir;if(Ir=null,!e||e.anchor!==t)return!1;if(i.preventDefault(),GL(e,i))return!0;const n=kv(e.url,window.document.baseURI);return n.kind==="application"?NL(n.url):n.kind==="web"&&e.openExternally?window.open(n.url,"_blank","noopener,noreferrer"):n.kind==="web"&&qL(n.url),!0}const UL=z.domEventHandlers({mousedown(i){const t=Mv(i.target);if(Ir=null,!t||i.button!==0&&i.button!==1||i.altKey)return!1;const e=BL(t);return e===null||i.button===1&&kv(e,window.document.baseURI).kind!=="application"?!1:(Ir={anchor:t,url:e,openExternally:i.metaKey||i.ctrlKey,x:i.clientX,y:i.clientY},i.preventDefault(),!0)},click(i){return i.button!==0?!1:vg(i)},auxclick(i){return i.button!==1?!1:vg(i)}}),HL=/^(\d+)([.)])(\s|$)/;function FL(i){const t=[];let e=!1,n=1;for(let r=1;r<=i.doc.lines;r+=1){const s=i.doc.line(r),o=HL.exec(s.text);o?(e||(e=!0,n=1),parseInt(o[1],10)!==n&&t.push({from:s.from,to:s.from+o[1].length,insert:String(n)}),n+=1):s.text===""&&(e=!1)}return t}const xg=ti.define(),KL=K.transactionFilter.of(i=>{if(!i.docChanged||i.annotation(xg))return i;const t=i.annotation(Tt.userEvent);if(t==="undo"||t==="redo")return i;const e=FL(i.state);if(e.length===0)return i;const n=Lt.of(e,i.state.doc.length),r=i.changes.compose(n);return i.startState.update({changes:r,selection:i.selection,scrollIntoView:i.scrollIntoView,effects:i.effects,annotations:[xg.of(!0),...t?[Tt.userEvent.of(t)]:[]],filter:!1})}),JL=/^(\s*)([-*]|\d+[.)])(\s\[[ xX]\])?\s$/,t4=i=>{const{state:t}=i,e=t.selection.main;if(e.from!==e.to)return!1;const n=t.doc.lineAt(e.from),r=n.text.slice(0,e.from-n.from);return JL.test(r)?(i.dispatch({changes:{from:e.from-1,to:e.from,insert:""},selection:{anchor:e.from-1},userEvent:"delete.backward",scrollIntoView:!0}),!0):!1},e4=hn.highest(_n.of([{key:"Backspace",run:t4}])),i4=[YL,WL,KL,e4,UL],n4=500,yg=ti.define(),r4=Zc.define([{tag:S.heading,fontWeight:"600"},{tag:S.strong,fontWeight:"600"},{tag:S.emphasis,fontStyle:"italic"},{tag:S.strikethrough,textDecoration:"line-through"}]);function kg(i){const t=i.length;return({state:e,dispatch:n})=>{const r=e.changeByRange(s=>{if(s.empty)return{changes:{from:s.from,insert:i+i},range:C.cursor(s.from+t)};const o=e.sliceDoc(s.from,s.to);if(o.length>=t*2&&o.startsWith(i)&&o.endsWith(i))return{changes:[{from:s.from,to:s.from+t},{from:s.to-t,to:s.to}],range:C.range(s.from,s.to-t*2)};const l=s.from>=t&&e.sliceDoc(s.from-t,s.from)===i,a=s.to+t<=e.doc.length&&e.sliceDoc(s.to,s.to+t)===i;return l&&a?{changes:[{from:s.from-t,to:s.from},{from:s.to,to:s.to+t}],range:C.range(s.from-t,s.to-t)}:{changes:[{from:s.from,insert:i},{from:s.to,insert:i}],range:C.range(s.from+t,s.to+t)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}const s4=hn.highest(_n.of([{key:"Mod-b",run:kg("**")},{key:"Mod-i",run:kg("*")},{key:"Enter",run:O1({nonTightLists:!1})}])),o4=dl.light.with({"--tbl-theme-row-background":"transparent","--tbl-theme-header-row-background":"color-mix(in srgb, currentColor 4%, transparent)","--tbl-theme-even-row-background":"transparent","--tbl-theme-odd-row-background":"transparent","--tbl-theme-border-color":"color-mix(in srgb, currentColor 11%, transparent)","--tbl-theme-border-hover-color":"color-mix(in srgb, currentColor 22%, transparent)","--tbl-theme-border-active-color":"color-mix(in srgb, currentColor 40%, transparent)","--tbl-theme-outline-color":"var(--color-primary)","--tbl-theme-text-color":"currentColor","--tbl-theme-menu-border-color":"color-mix(in srgb, currentColor 11%, transparent)","--tbl-theme-menu-background":"var(--color-surface)","--tbl-theme-menu-hover-background":"color-mix(in srgb, black 8%, transparent)","--tbl-theme-menu-text-color":"var(--color-text)","--tbl-theme-menu-hover-text-color":"var(--color-text)","--tbl-theme-select-all-focus-overlay":"color-mix(in srgb, currentColor 15%, transparent)","--tbl-theme-select-all-blur-overlay":"color-mix(in srgb, currentColor 8%, transparent)"}),l4=oc.default.with({"--tbl-style-font-family":"var(--font-sans)","--tbl-style-font-size":"inherit","--tbl-style-menu-font-family":"var(--font-sans)","--tbl-style-menu-font-size":"var(--text-sm, 0.875rem)","--tbl-style-default-header-alignment":"left"}),a4=fL({theme:o4,style:l4,selectionType:"native",handlePosition:"outside",lineWrapping:"wrap",extensions:[_n.of(ew)],globalKeyBindings:[...C0]}),_v=[$Q(),fo.of(" "),s4,_n.of([...ew,...C0,T$]),_c({extensions:[Qw,hd,{remove:["SetextHeading"]}]}),w0(r4),z.lineWrapping,i4,a4];function c4(i){const{parent:t,ctx:e}=i,n=i.debounceMs??n4;let r=null,s=null,o=null;const l=f=>{h.state.doc.toString()!==f&&h.dispatch({changes:{from:0,to:h.state.doc.length,insert:f},annotations:[yg.of(!0),Tt.addToHistory.of(!1)]})},a=async()=>{o=null;const f=h.state.doc.toString();r=f;try{await e.updateContent(f),s=f}catch{const d=s??"";l(d),r=d}},c=z.updateListener.of(f=>{!f.docChanged||f.transactions.some(O=>O.annotation(yg))||(o!==null&&clearTimeout(o),o=setTimeout(()=>{a()},n))}),h=new z({parent:t,state:K.create({doc:"",extensions:[_v,c]})}),u=f=>{const d=f.content;r!==null&&d===r||(l(d),s=d)};return e.addEventListener("content-updated",u),{view:h,dispose(){o!==null&&(clearTimeout(o),o=null),e.removeEventListener("content-updated",u),h.destroy()}}}const h4=`# Heading 1
|
|
64
|
+
`:l.textContent??""})??"",r=(t.textContent??"").slice(0,sg(i)),s=le(`${n}${r}`),o=n.length+sg(i);return dv({anchor:o,head:o},s,{trim:!1})}function _Z(i,t){var e=_d(),n=Et(e);Pr(n,()=>t.children),I(i,e)}function IZ(i,t){Wn(t,!0),Kc(()=>{const e=IS(_Z,{target:t.to,context:VA(),props:{children:t.children}});return()=>{jS(e)}}),Vn()}YA();var jZ=ot('<div class="tbl-blocking-overlay" aria-hidden="true"></div>');function DZ(i){var t=jZ();I(i,t)}function wc(i,t){const e=t.devicePixelRatio;return zR(i*e)/e}function YZ({x:i,y:t},e){return{x:wc(i,e),y:wc(t,e)}}var WZ=ot('<th class="tbl-cell tbl-header-cell"><!></th>'),VZ=ot('<td class="tbl-cell tbl-data-cell"><!></td>');function BZ(i,t){Wn(t,!0);const e=H(()=>rg(L(t.movement)?t.movement.border:{top:t.position.top,right:!0,bottom:!0,left:t.position.left})),n=H(()=>rg(t.outline)),r=H(()=>{var u;if(V((u=t.movement)==null?void 0:u.translate))return;const{x:c,y:h}=t.movement.state==="moving"?YZ(t.movement.translate,t.win):t.movement.translate;return`translate3d(${c}px, ${h}px, 0px)`});var s=_d(),o=Et(s);{var l=c=>{var h=WZ();let u;var f=Ue(h);Pr(f,()=>t.children),se(d=>{var O;$t(h,"align",t.alignment==="none"?void 0:t.alignment),$t(h,"data-component",bl),$t(h,"data-row",t.location.row),$t(h,"data-col",t.location.col),$t(h,"data-border",$(e)),$t(h,"data-outline",$(n)),$t(h,"data-selected",d),$t(h,"data-state",(O=t.movement)==null?void 0:O.state),u=Oc(h,"",u,{transform:$(r)})},[()=>wr(t.selected)]),I(c,h)},a=c=>{var h=VZ();let u;var f=Ue(h);Pr(f,()=>t.children),se(d=>{var O;$t(h,"align",t.alignment==="none"?void 0:t.alignment),$t(h,"data-component",bl),$t(h,"data-row",t.location.row),$t(h,"data-col",t.location.col),$t(h,"data-border",$(e)),$t(h,"data-outline",$(n)),$t(h,"data-selected",d),$t(h,"data-state",(O=t.movement)==null?void 0:O.state),u=Oc(h,"",u,{transform:$(r)})},[()=>wr(t.selected)]),I(c,h)};Ft(o,c=>{t.position.top?c(l):c(a,!1)})}I(i,s),Vn()}function Ov(i){var t;return L((t=ml(i.dom).activeElement)==null?void 0:t.closest(".cm-panels"))}function ag(i){return i.trim().split(/\s+/)}function qZ({doc:i,selection:t,parent:e,extensions:n,markdownConfig:r,selectionType:s,lineWrapping:o,globalKeyBindings:l,rootEditor:a,highlighter:c,onChange:h,eventHandlers:u}){return new z({doc:i,selection:t,parent:e,extensions:[n,hn.lowest([z.editorAttributes.of(f=>{const d=new Set(ag(a.themeClasses)),O=new Set(ag(f.themeClasses));return{class:[...d.difference(O)].join(" ")}}),_n.of([...l.map(f=>({...f,run:L(f.run)?()=>f.run(a):void 0,shift:L(f.shift)?()=>f.shift(a):void 0}))]),s==="codemirror"?Sk():[],w0(c),_c({extensions:[L1,r.extensions??[]],addKeymap:!1,completeHTMLTags:r.completeHTMLTags,pasteURLAsLink:r.pasteURLAsLink,htmlTagLanguage:r.htmlTagLanguage}),z.domEventObservers(u),o==="wrap"?z.lineWrapping:[]])],dispatchTransactions:(f,d)=>{d.update(f),f.forEach(h)}})}var NZ=ot('<div class="tbl-cell-editor"></div>');function GZ(i,t){Wn(t,!0);let e=gf(t,"text",15),n=gf(t,"selection",15),r,s,o=!1,l=!1;function a(h){const{docChanged:u,newDoc:f,selection:d}=h;if(o)return;const O=L(d);if(u||O){if(u){const p=Qd(f,{trim:!0});p.eq(e())||(e(p),l=!0)}if(O){const{head:p,anchor:m}=d.main,g=dv({head:p,anchor:m},f,{trim:!0});ev(g,n())||(n(g),l=!0)}}}Wd([()=>e(),()=>n()],()=>{if(l){l=!1;return}o=!0,s.dispatch({changes:s.state.changes({from:0,to:s.state.doc.length,insert:fc(e())}),selection:lg(n(),e())}),o=!1},{lazy:!0}),Kc(()=>(s=qZ({doc:fc(e()),selection:lg(n(),e()),parent:r,selectionType:t.selectionType,lineWrapping:t.lineWrapping,extensions:t.extensions,markdownConfig:t.markdownConfig,globalKeyBindings:t.globalKeyBindings,rootEditor:t.rootEditor,highlighter:t.highlighter,onChange:a,eventHandlers:{beforeinput:t.onbeforeinput,dragstart:t.ondragstart,keydown:(h,{state:u})=>t.onkeydown(h,u),paste:t.onpaste}}),Ov(s)||s.focus(),()=>s.destroy()));var c=NZ();pc(c,h=>r=h,()=>r),I(i,c),Vn()}class nh{constructor({event:t,tableState:e,position:n}){P(this,"event");P(this,"tableState");P(this,"position");this.event=t,this.tableState=e,this.position=n}static navigate(t){new nh(t)[`navigate${t.key}`]()}navigateTab(){this.moveRight({createRow:!0,position:"end"})}navigateShiftTab(){this.moveLeft({createRow:!0,position:"end"})}navigateEnter(){this.moveDown({createRow:!0,position:"end"})}navigateArrowLeft(){this.position.left&&this.moveLeft({createRow:!1,position:"end"})}navigateArrowUp(){this.position.top&&this.moveUp({createRow:!1,position:"end"})}navigateArrowRight(){this.position.right&&this.moveRight({createRow:!1,position:"start"})}navigateArrowDown(){this.position.bottom&&this.moveDown({createRow:!1,position:"end"})}navigateShiftArrowLeft(){if(!(!this.position.left||V(this.tableState.outlinedSection)||V(this.tableState.activeCell))){if(this.event.preventDefault(),this.tableState.focusTable(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.tableState.activeCell),this.tableState.outlinedSection.endCol===this.tableState.anchorCell.col){if(this.tableState.outlinedSection.startCol===this.tableState.table.firstColIndex)return;this.tableState.outlinedSection=this.tableState.outlinedSection.expandLeft()}else this.tableState.outlinedSection=this.tableState.outlinedSection.contractLeft();this.tableState.activeCell=tv(this.tableState.activeCell)}}navigateShiftArrowUp(){if(!(!this.position.top||V(this.tableState.outlinedSection)||V(this.tableState.activeCell))){if(this.event.preventDefault(),this.tableState.focusTable(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.tableState.activeCell),this.tableState.outlinedSection.endRow===this.tableState.anchorCell.row){if(this.tableState.outlinedSection.startRow===this.tableState.table.firstRowIndex)return;this.tableState.outlinedSection=this.tableState.outlinedSection.expandUp()}else this.tableState.outlinedSection=this.tableState.outlinedSection.contractUp();this.tableState.activeCell=FS(this.tableState.activeCell)}}navigateShiftArrowRight(){if(!(!this.position.right||V(this.tableState.outlinedSection)||V(this.tableState.activeCell))){if(this.event.preventDefault(),this.tableState.focusTable(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.tableState.activeCell),this.tableState.outlinedSection.startCol===this.tableState.anchorCell.col){if(this.tableState.outlinedSection.endCol===this.tableState.table.lastColIndex)return;this.tableState.outlinedSection=this.tableState.outlinedSection.expandRight()}else this.tableState.outlinedSection=this.tableState.outlinedSection.contractRight();this.tableState.activeCell=KS(this.tableState.activeCell)}}navigateShiftArrowDown(){if(!(!this.position.bottom||V(this.tableState.outlinedSection)||V(this.tableState.activeCell))){if(this.event.preventDefault(),this.tableState.focusTable(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.tableState.activeCell),this.tableState.outlinedSection.startRow===this.tableState.anchorCell.row){if(this.tableState.outlinedSection.endRow===this.tableState.table.lastRowIndex)return;this.tableState.outlinedSection=this.tableState.outlinedSection.expandDown()}else this.tableState.outlinedSection=this.tableState.outlinedSection.contractDown();this.tableState.activeCell=JS(this.tableState.activeCell)}}moveLeft({createRow:t,position:e}){if(!V(this.tableState.activeCell)){if(this.event.preventDefault(),Rr(this.tableState.activeCell,this.tableState.table.firstCellLocation)){if(!t){this.tableState.navigate("before");return}this.tableState.table.prependEmptyRows(1),this.tableState.activeCell={row:this.tableState.activeCell.row+1,col:this.tableState.activeCell.col}}this.moveTo(this.tableState.activeCell.col===this.tableState.table.firstColIndex?{row:this.tableState.activeCell.row-1,col:this.tableState.table.lastColIndex}:{row:this.tableState.activeCell.row,col:this.tableState.activeCell.col-1},e)}}moveUp({createRow:t,position:e}){if(!V(this.tableState.activeCell)){if(this.event.preventDefault(),this.tableState.activeCell.row===this.tableState.table.firstRowIndex){if(!t){this.tableState.navigate("before");return}this.tableState.table.prependEmptyRows(1),this.tableState.activeCell={row:this.tableState.activeCell.row+1,col:this.tableState.activeCell.col}}this.moveTo({row:this.tableState.activeCell.row-1,col:this.tableState.activeCell.col},e)}}moveRight({createRow:t,position:e}){if(!V(this.tableState.activeCell)){if(this.event.preventDefault(),Rr(this.tableState.activeCell,this.tableState.table.lastCellLocation)){if(!t){this.tableState.navigate("after");return}this.tableState.table.appendEmptyRows(1)}this.moveTo(this.tableState.activeCell.col===this.tableState.table.lastColIndex?{row:this.tableState.activeCell.row+1,col:this.tableState.table.firstColIndex}:{row:this.tableState.activeCell.row,col:this.tableState.activeCell.col+1},e)}}moveDown({createRow:t,position:e}){if(!V(this.tableState.activeCell)){if(this.event.preventDefault(),this.tableState.activeCell.row===this.tableState.table.lastRowIndex){if(!t){this.tableState.navigate("after");return}this.tableState.table.appendEmptyRows(1)}this.moveTo({row:this.tableState.activeCell.row+1,col:this.tableState.activeCell.col},e)}}moveTo(t,e){if(this.tableState.activeCell=t,this.tableState.anchorCell=t,this.tableState.outlinedSection=rt.ofCell(t),this.tableState.selection.isCell()){const n=e==="start"?0:this.tableState.table.cellAt(t).length;this.tableState.selectionValue={cell:t,section:{anchor:n,head:n}}}}}const bt={alt:"Alt",arrowDown:"ArrowDown",arrowLeft:"ArrowLeft",arrowRight:"ArrowRight",arrowUp:"ArrowUp",backspace:"Backspace",c:"c",delete:"Delete",enter:"Enter",escape:"Escape",shift:"Shift",tab:"Tab",v:"v",x:"x"},UZ=[bt.arrowDown,bt.arrowLeft,bt.arrowRight,bt.arrowUp,bt.enter,bt.tab,`${bt.shift}${bt.arrowDown}`,`${bt.shift}${bt.arrowLeft}`,`${bt.shift}${bt.arrowRight}`,`${bt.shift}${bt.arrowUp}`,`${bt.shift}${bt.tab}`],cg=new Set(UZ);function pv({key:i,shiftKey:t,altKey:e,metaKey:n,ctrlKey:r}){if(!(e||n||r))return t?cg.has(`${bt.shift}${i}`)?`${bt.shift}${i}`:void 0:cg.has(i)?i:void 0}function HZ(i,t){i.inputType==="historyUndo"?(t.undo(),i.preventDefault()):i.inputType==="historyRedo"&&(t.redo(),i.preventDefault())}function FZ(i){i.preventDefault()}function KZ(i,t,e){const n=pv(i);if(V(n))return;const r=t.selection.main.head,s=t.doc.lineAt(r).number,o=0,l=t.doc.length,a=1,c=t.doc.lines,h={top:s===a,right:r===l,bottom:s===c,left:r===o};nh.navigate({tableState:e,key:n,event:i,position:h})}function JZ(i,t){Vd({tableState:t,event:i})}var tX=ot('<div class="tbl-cell-view" contenteditable="" tabindex="-1"><!></div>');function eX(i,t){Wn(t,!0);var e=tX(),n=Ue(e);Pr(n,()=>t.children),se(r=>{$t(e,"data-component",Bd),$t(e,"data-hidden",r)},[()=>wr(t.hidden)]),I(i,e),Vn()}const mv="Handle";function qd(i){if(!GS(i,{component:mv}))return;const{type:t,location:e}=Id(i).dataset;if(t==="table")return{type:t,location:e};{const n=eh(jl(i));return QZ({location:e,type:t},n)}}var iX=ni('<svg class="tbl-handle-grip" width="15" height="3" fill="currentColor" viewBox="0 0 15 3" xmlns="http://www.w3.org/2000/svg"><circle cx="1.5" cy="1.5" r="1.5"></circle><circle cx="7.5" cy="1.5" r="1.5"></circle><circle cx="13.5" cy="1.5" r="1.5"></circle></svg>'),nX=ni('<svg class="tbl-handle-grip" width="3" height="15" fill="currentColor" viewBox="0 0 3 15" xmlns="http://www.w3.org/2000/svg"><circle cy="1.5" cx="1.5" r="1.5"></circle><circle cy="7.5" cx="1.5" r="1.5"></circle><circle cy="13.5" cx="1.5" r="1.5"></circle></svg>'),rX=ot('<div class="tbl-handle" role="button" aria-hidden="true"><!></div>');function hg(i,t){Wn(t,!0);let e=gf(t,"toggle",3,!1);const n={table:{right:"vertical",bottom:"horizontal"},header:{row:"vertical",col:"horizontal"}},r=H(()=>{var c;return(c=n[t.of.type])==null?void 0:c[t.of.location]});var s=rX();Oc(s,"",{},{opacity:"var(--tbl-handle-opacity, 0)"});var o=Ue(s);{var l=c=>{var h=iX();I(c,h)},a=c=>{var h=nX();I(c,h)};Ft(o,c=>{$(r)==="horizontal"?c(l):$(r)==="vertical"&&c(a,1)})}se((c,h,u)=>{$t(s,"data-component",mv),$t(s,"data-type",t.of.type),$t(s,"data-location",t.of.location),$t(s,"data-active",c),$t(s,"data-hover",h),$t(s,"data-toggle",u)},[()=>wr(t.state==="active"),()=>wr(t.state==="hover"),()=>wr(e())]),I(i,s),Vn()}var sX=ot('<div class="tbl-menu"><!></div>');function oX(i,t){Wn(t,!0);let e,n=ct(void 0);Kc(()=>{t.translate(e).then(l=>q(n,l,!0))});var r=sX();let s;var o=Ue(r);Pr(o,()=>t.children),pc(r,l=>e=l,()=>e),se(l=>s=Oc(r,"",s,l),[()=>({visibility:L($(n))?void 0:"hidden",transform:L($(n))?`translate3d(${$(n).x}px, ${$(n).y}px, 0px)`:void 0})]),I(i,r),Vn()}var lX=ot('<div class="tbl-menu-item" role="menuitem" tabindex="-1"><!></div>');function Re(i,t){var e=lX(),n=Ue(e);Pr(n,()=>t.children),Lo("click",e,function(...r){var s;(s=t.onclick)==null||s.apply(this,r)}),I(i,e)}_S(["click"]);function Ae(i,t){switch(i.action){case"add":return t.menu.clickAdd(i.direction);case"align":return t.menu.clickAlign(i.alignment);case"clear":return t.menu.clickClear();case"duplicate":return t.menu.clickDuplicate();case"move":return t.menu.clickMove(i.direction);case"remove":return t.menu.clickRemove();case"sort":return t.menu.clickSort(i.direction)}}var aX=ni('<path d="M294.6 454.6L214.6 534.6C202.1 547.1 181.8 547.1 169.3 534.6L89.3 454.6C76.8 442.1 76.8 421.8 89.3 409.3C101.8 396.8 122.1 396.8 134.6 409.3L160 434.7L160 128C160 110.3 174.3 96 192 96C209.7 96 224 110.3 224 128L224 434.7L249.4 409.3C261.9 396.8 282.2 396.8 294.7 409.3C307.2 421.8 307.2 442.1 294.7 454.6zM476.6 113.7C527.3 215 553.9 268.4 556.6 273.7C564.5 289.5 558.1 308.7 542.3 316.6C526.5 324.5 507.3 318.1 499.4 302.3L492.2 288L403.8 288L396.6 302.3C388.7 318.1 369.5 324.5 353.7 316.6C337.9 308.7 331.5 289.5 339.4 273.7C342.1 268.4 368.7 215 419.4 113.7C424.8 102.9 435.9 96 448 96C460.1 96 471.2 102.8 476.6 113.7zM448 199.6L427.8 240L468.2 240L448 199.6zM352 384C352 366.3 366.3 352 384 352L512 352C524.9 352 536.6 359.8 541.6 371.8C546.6 383.8 543.8 397.5 534.7 406.7L461.3 480L512 480C529.7 480 544 494.3 544 512C544 529.7 529.7 544 512 544L384 544C371.1 544 359.4 536.2 354.4 524.2C349.4 512.2 352.2 498.5 361.3 489.3L434.7 415.9L384 415.9C366.3 415.9 352 401.6 352 383.9z"></path>'),cX=ni('<path d="M294.6 454.6L214.6 534.6C202.1 547.1 181.8 547.1 169.3 534.6L89.3 454.6C76.8 442.1 76.8 421.8 89.3 409.3C101.8 396.8 122.1 396.8 134.6 409.3L160 434.7L160 128C160 110.3 174.3 96 192 96C209.7 96 224 110.3 224 128L224 434.7L249.4 409.3C261.9 396.8 282.2 396.8 294.7 409.3C307.2 421.8 307.2 442.1 294.7 454.6zM352 128C352 110.3 366.3 96 384 96L512 96C524.9 96 536.6 103.8 541.6 115.8C546.6 127.8 543.8 141.5 534.7 150.7L461.3 224L512 224C529.7 224 544 238.3 544 256C544 273.7 529.7 288 512 288L384 288C371.1 288 359.4 280.2 354.4 268.2C349.4 256.2 352.2 242.5 361.3 233.3L434.8 160L384 160C366.3 160 352 145.7 352 128zM476.6 337.7L556.6 497.7C564.5 513.5 558.1 532.7 542.3 540.6C526.5 548.5 507.3 542.1 499.4 526.3L492.2 512L403.8 512L396.6 526.3C388.7 542.1 369.5 548.5 353.7 540.6C337.9 532.7 331.5 513.5 339.4 497.7L419.4 337.7C424.8 326.9 435.9 320 448 320C460.1 320 471.2 326.8 476.6 337.7zM448 423.6L427.8 464L468.2 464L448 423.6z"></path>'),hX=ni('<path d="M384 128C384 145.7 369.7 160 352 160L128 160C110.3 160 96 145.7 96 128C96 110.3 110.3 96 128 96L352 96C369.7 96 384 110.3 384 128zM384 384C384 401.7 369.7 416 352 416L128 416C110.3 416 96 401.7 96 384C96 366.3 110.3 352 128 352L352 352C369.7 352 384 366.3 384 384zM96 256C96 238.3 110.3 224 128 224L512 224C529.7 224 544 238.3 544 256C544 273.7 529.7 288 512 288L128 288C110.3 288 96 273.7 96 256zM544 512C544 529.7 529.7 544 512 544L128 544C110.3 544 96 529.7 96 512C96 494.3 110.3 480 128 480L512 480C529.7 480 544 494.3 544 512z"></path>'),uX=ni('<path d="M448 128C448 110.3 433.7 96 416 96L224 96C206.3 96 192 110.3 192 128C192 145.7 206.3 160 224 160L416 160C433.7 160 448 145.7 448 128zM544 256C544 238.3 529.7 224 512 224L128 224C110.3 224 96 238.3 96 256C96 273.7 110.3 288 128 288L512 288C529.7 288 544 273.7 544 256zM96 512C96 529.7 110.3 544 128 544L512 544C529.7 544 544 529.7 544 512C544 494.3 529.7 480 512 480L128 480C110.3 480 96 494.3 96 512zM448 384C448 366.3 433.7 352 416 352L224 352C206.3 352 192 366.3 192 384C192 401.7 206.3 416 224 416L416 416C433.7 416 448 401.7 448 384z"></path>'),fX=ni('<path d="M544 128C544 145.7 529.7 160 512 160L288 160C270.3 160 256 145.7 256 128C256 110.3 270.3 96 288 96L512 96C529.7 96 544 110.3 544 128zM544 384C544 401.7 529.7 416 512 416L288 416C270.3 416 256 401.7 256 384C256 366.3 270.3 352 288 352L512 352C529.7 352 544 366.3 544 384zM96 256C96 238.3 110.3 224 128 224L512 224C529.7 224 544 238.3 544 256C544 273.7 529.7 288 512 288L128 288C110.3 288 96 273.7 96 256zM544 512C544 529.7 529.7 544 512 544L128 544C110.3 544 96 529.7 96 512C96 494.3 110.3 480 128 480L512 480C529.7 480 544 494.3 544 512z"></path>'),dX=ni('<path d="M342.6 81.4C330.1 68.9 309.8 68.9 297.3 81.4L137.3 241.4C124.8 253.9 124.8 274.2 137.3 286.7C149.8 299.2 170.1 299.2 182.6 286.7L288 181.3L288 552C288 569.7 302.3 584 320 584C337.7 584 352 569.7 352 552L352 181.3L457.4 286.7C469.9 299.2 490.2 299.2 502.7 286.7C515.2 274.2 515.2 253.9 502.7 241.4L342.7 81.4z"></path>'),OX=ni('<path d="M566.6 342.6C579.1 330.1 579.1 309.8 566.6 297.3L406.6 137.3C394.1 124.8 373.8 124.8 361.3 137.3C348.8 149.8 348.8 170.1 361.3 182.6L466.7 288L96 288C78.3 288 64 302.3 64 320C64 337.7 78.3 352 96 352L466.7 352L361.3 457.4C348.8 469.9 348.8 490.2 361.3 502.7C373.8 515.2 394.1 515.2 406.6 502.7L566.6 342.7z"></path>'),pX=ni('<path d="M297.4 566.6C309.9 579.1 330.2 579.1 342.7 566.6L502.7 406.6C515.2 394.1 515.2 373.8 502.7 361.3C490.2 348.8 469.9 348.8 457.4 361.3L352 466.7L352 96C352 78.3 337.7 64 320 64C302.3 64 288 78.3 288 96L288 466.7L182.6 361.3C170.1 348.8 149.8 348.8 137.3 361.3C124.8 373.8 124.8 394.1 137.3 406.6L297.3 566.6z"></path>'),mX=ni('<path d="M73.4 297.4C60.9 309.9 60.9 330.2 73.4 342.7L233.4 502.7C245.9 515.2 266.2 515.2 278.7 502.7C291.2 490.2 291.2 469.9 278.7 457.4L173.3 352L544 352C561.7 352 576 337.7 576 320C576 302.3 561.7 288 544 288L173.3 288L278.7 182.6C291.2 170.1 291.2 149.8 278.7 137.3C266.2 124.8 245.9 124.8 233.4 137.3L73.4 297.3z"></path>'),gX=ni('<path d="M262.2 48C248.9 48 236.9 56.3 232.2 68.8L216 112L120 112C106.7 112 96 122.7 96 136C96 149.3 106.7 160 120 160L520 160C533.3 160 544 149.3 544 136C544 122.7 533.3 112 520 112L424 112L407.8 68.8C403.1 56.3 391.2 48 377.8 48L262.2 48zM128 208L128 512C128 547.3 156.7 576 192 576L448 576C483.3 576 512 547.3 512 512L512 208L464 208L464 512C464 520.8 456.8 528 448 528L192 528C183.2 528 176 520.8 176 512L176 208L128 208zM288 280C288 266.7 277.3 256 264 256C250.7 256 240 266.7 240 280L240 456C240 469.3 250.7 480 264 480C277.3 480 288 469.3 288 456L288 280zM400 280C400 266.7 389.3 256 376 256C362.7 256 352 266.7 352 280L352 456C352 469.3 362.7 480 376 480C389.3 480 400 469.3 400 456L400 280z"></path>'),bX=ot('<div class="tbl-menu-item-icon"><svg xmlns="http://www.w3.org/2000/svg" height="14" width="14" viewBox="0 0 640 640" fill="currentColor"><!></svg></div>');function Ze(i,t){var e=bX(),n=Ue(e),r=Ue(n);{var s=b=>{var v=aX();I(b,v)},o=b=>{var v=cX();I(b,v)},l=b=>{},a=b=>{var v=hX();I(b,v)},c=b=>{var v=uX();I(b,v)},h=b=>{var v=fX();I(b,v)},u=b=>{var v=dX();I(b,v)},f=b=>{var v=OX();I(b,v)},d=b=>{var v=pX();I(b,v)},O=b=>{var v=mX();I(b,v)},p=b=>{},m=b=>{},g=b=>{var v=gX();I(b,v)};Ft(r,b=>{t.name==="sort-ascending"?b(s):t.name==="sort-descending"?b(o,1):t.name==="align-none"?b(l,2):t.name==="align-left"?b(a,3):t.name==="align-center"?b(c,4):t.name==="align-right"?b(h,5):t.name==="move-up"?b(u,6):t.name==="move-right"?b(f,7):t.name==="move-down"?b(d,8):t.name==="move-left"?b(O,9):t.name==="duplicate"?b(p,10):t.name==="clear"?b(m,11):t.name==="remove"&&b(g,12)})}I(i,e)}var wX=ot('<div class="tbl-menu-item-text"><!></div>');function Xe(i,t){var e=wX(),n=Ue(e);Pr(n,()=>t.children),I(i,e)}var SX=ot('<div class="tbl-menu-separator"></div>');function Oa(i){var t=SX();I(i,t)}var vX=ot('<div class="tbl-select-all-overlay" aria-hidden="true"></div>');function xX(i){var t=vX();I(i,t)}const yX=new Set([bt.c,bt.v,bt.x]);function kX(i,t){return yX.has(i.key)&&i[aA(t)]}const QX=[bt.backspace,bt.delete],$X=new Set(QX);function CX({key:i}){return $X.has(i)?i:void 0}function PX(i){return/^F\d+$/.test(i)}const TX=new Set([bt.alt,bt.escape,bt.enter,bt.shift]);function RX({metaKey:i,ctrlKey:t,key:e}){return!t&&!i&&!TX.has(e)&&!PX(e)}function AX(i,t){t.selection.isCell()||cv({tableState:t,event:i})}function ZX(i,t){t.selection.isCell()||hv({tableState:t,event:i})}function XX(i,t){t.selection.isCell()||Vd({tableState:t,event:i})}function EX(i,t){if(L(i.target)&&L(fv(i.target))){i.preventDefault();return}if(!t.interactive||t.selection.isCell())return;const e=pv(i);if(L(e)){nh.navigate({tableState:t,key:e,event:i,position:{left:!0,top:!0,right:!0,bottom:!0}});return}const n=CX(i);if(L(n)){av({tableState:t,event:i});return}if(t.activeTable&&L(t.activeCell)&&RX(i)){t.activeTable=!1,t.anchorCell=t.activeCell;const r=t.table.cellAt(t.activeCell).length;t.selectionValue={cell:t.activeCell,section:{head:r,anchor:r}},t.outlinedSection=rt.ofCell(t.activeCell);return}kX(i,t.window)||Ok(t.rootEditor,i,"editor")&&i.preventDefault()}function Nd(i){return i.buttons===1}function gv(i,t){return t.setPointerCapture(i.pointerId),()=>t.releasePointerCapture(i.pointerId)}class rh{constructor({offset:t,maxScroll:e,boundaryElement:n,scrollElement:r}){P(this,"offset");P(this,"maxScroll");P(this,"boundaryElement");P(this,"scrollElement");P(this,"scroll");P(this,"handle");P(this,"xAmount");P(this,"yAmount");const s=this.scrollInternal.bind(this);this.scroll=()=>{this.handle=requestAnimationFrame(s)},this.xAmount=0,this.yAmount=0,this.offset=t??0,this.maxScroll=e,this.boundaryElement=n,this.scrollElement=r}updatePosition(t,e){const n=this.boundaryElement.x.getBoundingClientRect();t<n.left+this.offset?this.xAmount=-ce(this.offset+(n.left-t),{max:this.maxScroll}):t>n.right-this.offset?this.xAmount=ce(this.offset-(n.right-t),{max:this.maxScroll}):this.xAmount=0;const r=this.boundaryElement.y.getBoundingClientRect();e<r.top+this.offset?this.yAmount=-ce(this.offset+(r.top-e),{max:this.maxScroll}):e>r.bottom-this.offset?this.yAmount=ce(this.offset-(r.bottom-e),{max:this.maxScroll}):this.yAmount=0,V(this.handle)&&(this.xAmount!==0||this.yAmount!==0)&&this.scroll()}destroy(){L(this.handle)&&cancelAnimationFrame(this.handle)}scrollInternal(){if(this.xAmount===0&&this.yAmount===0){this.scroll();return}this.scrollElement.x.scrollBy({left:this.xAmount}),this.scrollElement.y.scrollBy({top:this.yAmount}),this.scroll()}static of(t){return new rh(t)}}class Sc{constructor({start:t,size:e}){P(this,"start");P(this,"size");this.start=t,this.size=e}get mid(){return this.start+this.size/2}get end(){return this.start+this.size}static of(t){return new Sc(t)}}var vc;(i=>{function t(e,n){return Gd.of(e,n)}i.of=t})(vc||(vc={}));class Gd{constructor(t,e){P(this,"rows");P(this,"cols");P(this,"firstRowIndex",0);P(this,"firstColIndex",0);const n=[...t.querySelectorAll("tr:first-child > th")],r=[...t.querySelectorAll("tr > th:first-child,tr > td:first-child")];this.rows=r.map((s,o)=>{const{top:l,height:a}=ug(s,e),c=0;return Sc.of({start:l+c,size:a-c})}),this.cols=n.map((s,o)=>{const{left:l,width:a}=ug(s,e),c=o===0?1:0;return Sc.of({start:l+c,size:a-c})})}rowsOrCols(t){return t==="row"?this.rows:this.cols}rowAt(t){return this.rows[t]}colAt(t){return this.cols[t]}rowOrColAt(t,e){return t==="row"?this.rowAt(e):this.colAt(e)}get firstRow(){return this.rows[this.firstRowIndex]}get firstCol(){return this.cols[this.firstColIndex]}firstRowOrCol(t){return t==="row"?this.firstRow:this.firstCol}get lastRow(){return this.rows[this.lastRowIndex]}get lastCol(){return this.cols[this.lastColIndex]}lastRowOrCol(t){return t==="row"?this.lastRow:this.lastCol}firstRowOrColIndex(t){return 0}get lastRowIndex(){return this.rowCount-1}get lastColIndex(){return this.colCount-1}lastRowOrColIndex(t){return t==="row"?this.lastRowIndex:this.lastColIndex}get rowCount(){return this.rows.length}get colCount(){return this.cols.length}get minRowSize(){return uc(...this.rows.map(t=>t.size))}get minColSize(){return uc(...this.cols.map(t=>t.size))}moveRowOrColAt(t,{fromIndex:e,toIndex:n}){if(e===n)return;const r=this.rowsOrCols(t),s=r[e];if(e<n){for(const o of Qn({start:e,endExclusive:n}))r[o]=r[o+1],r[o].start-=s.size;s.start=r[n].start+r[n].size}else{for(const o of Qn({start:e,endExclusive:n}))r[o]=r[o-1],r[o].start+=s.size;s.start=r[n].start-s.size}r[n]=s}lastCellBeforePosition(t){const e=this.rows.map(r=>r.start).findLastIndex(r=>r<t.y),n=this.cols.map(r=>r.start).findLastIndex(r=>r<t.x);return{row:e===-1?0:e,col:n===-1?0:n}}static of(t,e){return new Gd(t,e)}}function ug(i,t){const{top:e,left:n,width:r,height:s}=i.getBoundingClientRect();return{top:e+t.y,left:n+t.x,width:r,height:s}}class wl{constructor({tableState:t,cellLocation:e}){P(this,"tableState");P(this,"tableMeasurement");P(this,"autoScroller");P(this,"shouldAutoScroll");P(this,"removeEventListeners");P(this,"currentCell");this.tableState=t,this.currentCell=e,this.autoScroller=rh.of({offset:10,maxScroll:32,boundaryElement:{x:t.scrollElement,y:t.rootScrollElement},scrollElement:{x:t.scrollElement,y:t.rootScrollElement}}),this.shouldAutoScroll=V5({delayMillis:500}),this.tableMeasurement=vc.of(t.tableElement,{x:t.scrollOffsetX,y:t.scrollOffsetY})}start(){this.tableState.activeCell=this.currentCell,this.tableState.anchorCell=this.currentCell,this.tableState.outlinedSection=rt.ofCell(this.currentCell),this.tableState.outline={outlined:!1},this.removeEventListeners=Tr(Mt(this.tableState.window,"pointermove",t=>this.drag(t)),Mt(this.tableState.window,"pointerup",()=>this.end()),Mt(this.tableState.window,"pointerleave",()=>this.end()))}resizeAndContinue(t){t.preventDefault(),V(this.tableState.anchorCell)&&(this.tableState.anchorCell=this.currentCell),this.expandOrContract(this.currentCell),this.tableState.outline={outlined:!0},this.removeEventListeners=Tr(Mt(this.tableState.window,"pointermove",e=>this.drag(e)),Mt(this.tableState.window,"pointerup",()=>this.end()),Mt(this.tableState.window,"pointerleave",()=>this.end()))}drag(t){if(!Nd(t)){this.end();return}t.preventDefault(),this.shouldAutoScroll()&&this.autoScroller.updatePosition(t.clientX,t.clientY);const e=this.tableMeasurement.lastCellBeforePosition({x:t.clientX+this.tableState.scrollOffsetX,y:t.clientY+this.tableState.scrollOffsetY});Rr(e,this.currentCell)||(this.currentCell=e,this.tableState.outline={outlined:!0},this.expandOrContract(e))}end(){var t;(t=this.removeEventListeners)==null||t.call(this),this.autoScroller.destroy(),this.tableState.outline=void 0}expandOrContract(t){this.tableState.focusTable();const[e,n]=t.row<=this.tableState.anchorCell.row?[t.row,this.tableState.anchorCell.row]:[this.tableState.anchorCell.row,t.row],[r,s]=t.col<=this.tableState.anchorCell.col?[t.col,this.tableState.anchorCell.col]:[this.tableState.anchorCell.col,t.col];this.tableState.outlinedSection=rt.of({row:{start:e,endExclusive:n+1},col:{start:r,endExclusive:s+1}}),this.tableState.activeCell=t}static startOutline(t){new wl(t).start()}static resizeAndContinueOutline(t){new wl(t).resizeAndContinue(t.event)}}function LX(i,t){Nc(t.window)&&(t.hoveredCell=i)}function MX(i){Nc(i.window)&&(i.hoveredCell=void 0)}function zX(i,t,e){if(!(!e.interactive||!Nd(i)))if(i.shiftKey){if(e.selection.isCell()&&Rr(t,e.selection.cell))return;wl.resizeAndContinueOutline({event:i,tableState:e,cellLocation:t})}else wl.startOutline({event:i,tableState:e,cellLocation:t})}const _X=new Intl.Collator(navigator.language,{numeric:!0,sensitivity:"base"});function fg(i,t){return _X.compare(i,t)}function IX({metaKey:i,shiftKey:t,altKey:e,ctrlKey:n,key:r}){return r===bt.escape&&!t&&!e&&!i&&!n}class Ud{constructor({tableState:t,handle:e,point:n}){P(this,"tableState");P(this,"handle");P(this,"point");P(this,"removeEventListeners");this.tableState=t,this.handle=e,this.point=n}get rowOrCol(){return this.handle.location}get index(){return this.handle.index}open(){const t=this.tableState.document.body;this.removeEventListeners=Tr(Mt(t,"pointerdown",o=>{o.preventDefault(),(V(o.target)||!VS(this.tableState.menuRootElement,o.target))&&this.close()}),Mt(t,"wheel",o=>o.preventDefault(),{passive:!1}),Mt(t,"keydown",o=>{o.preventDefault(),IX(o)&&this.close()})),this.tableState.focusTable(),this.tableState.activeHandle={state:"active",handle:this.handle},this.tableState.outlinedSection=rt.of(this.rowOrCol==="row"?{row:{start:this.index,endExclusive:this.index+1},col:this.tableState.table.colRange}:{row:this.tableState.table.rowRange,col:{start:this.index,endExclusive:this.index+1}});const e=this.rowOrCol==="row"?{row:this.index,col:this.tableState.table.lastColIndex}:{row:this.tableState.table.lastRowIndex,col:this.index};this.tableState.activeCell=e,this.tableState.anchorCell=e;const n=this.index!==this.tableState.table.firstRowOrColIndex(this.rowOrCol),r=this.index!==this.tableState.table.lastRowOrColIndex(this.rowOrCol);let s=!1;n?s=r?!0:"backward":r&&(s="forward"),this.tableState.menu={type:this.rowOrCol,capabilities:{addable:!0,alignable:this.rowOrCol==="col",clearable:!0,duplicatable:!0,moveable:s,removable:!this.tableState.table.hasSingleRowOrCol(this.rowOrCol),sortable:this.rowOrCol==="col"},clickAdd:o=>this.clickAdd(o),clickAlign:o=>this.clickAlign(o),clickClear:()=>this.clickClear(),clickDuplicate:()=>this.clickDuplicate(),clickMove:o=>this.clickMove(o),clickRemove:()=>this.clickRemove(),clickSort:o=>this.clickSort(o),computeTranslation:o=>this.computeTranslation(o)}}close(){var t;(t=this.removeEventListeners)==null||t.call(this),this.tableState.menu=void 0,this.tableState.activeHandle=void 0}async computeTranslation(t){const e=await eR({getBoundingClientRect:()=>({x:this.point.x,y:this.point.y,top:this.point.y,right:this.point.x,bottom:this.point.y,left:this.point.x,width:0,height:0})},t,{middleware:[JT({allowedPlacements:this.rowOrCol==="row"?["right-start","right-end"]:["right-start","right"]}),tR({crossAxis:!0})]}),n=bo(t);return{x:wc(e.x,n),y:wc(e.y,n)}}clickAdd(t){var e;if(this.tableState.table.addEmptyRowsOrColsAt(this.rowOrCol,{index:t==="before"?this.index:this.index+1,count:1}),t==="after"){this.tableState.outlinedSection=(e=this.tableState.outlinedSection)==null?void 0:e.shift(this.rowOrCol,"forward");const n=Uh(this.rowOrCol,this.tableState.activeCell,"forward");this.tableState.activeCell=n,this.tableState.anchorCell=n}this.close()}clickAlign(t){this.tableState.table.setAlignmentAt(this.index,t),this.close()}clickClear(){this.tableState.table.clearRowOrCol(this.rowOrCol,this.index),this.close()}clickDuplicate(){this.tableState.table.duplicateRowOrColAt(this.rowOrCol,this.index),this.close()}clickMove(t){var n;this.tableState.table.moveRowOrColAt(this.rowOrCol,{fromIndex:this.index,toIndex:t==="backward"?this.index-1:this.index+1}),this.tableState.outlinedSection=(n=this.tableState.outlinedSection)==null?void 0:n.shift(this.rowOrCol,t);const e=Uh(this.rowOrCol,this.tableState.activeCell,t);this.tableState.activeCell=e,this.tableState.anchorCell=e,this.close()}clickRemove(){var t;if(this.tableState.table.removeRowsOrColsAt(this.rowOrCol,{index:this.index,count:1}),!this.tableState.table.hasRowOrColAt(this.rowOrCol,this.index)){this.tableState.outlinedSection=(t=this.tableState.outlinedSection)==null?void 0:t.shift(this.rowOrCol,"backward");const e=Uh(this.rowOrCol,this.tableState.activeCell,"backward");this.tableState.activeCell=e,this.tableState.anchorCell=e}this.close()}clickSort(t){this.tableState.table.sortByColAt(this.index,t==="ascending"?(e,n)=>fg(e.toString(),n.toString()):(e,n)=>fg(n.toString(),e.toString())),this.close()}static showMenu(t){new Ud(t).open()}}class Hd{constructor({rowOrCol:t,index:e,position:n,subject:r,tableElement:s,scrollOffsetX:o,scrollOffsetY:l}){P(this,"coordinate");P(this,"initialIndex");P(this,"size");P(this,"initialPosition");P(this,"minBound");P(this,"maxBound");P(this,"scrollOffsetX");P(this,"scrollOffsetY");P(this,"subject");P(this,"rowOrCol");P(this,"tableMeasurement");P(this,"currentIndex");P(this,"currentPosition");P(this,"dragged");this.scrollOffsetX=o,this.scrollOffsetY=l;const a=vc.of(s,{x:this.scrollOffsetX(),y:this.scrollOffsetY()});this.rowOrCol=t,this.coordinate=t==="row"?"y":"x",this.initialIndex=e,this.initialPosition=n[this.coordinate],this.minBound=a.firstRowOrCol(this.rowOrCol).start-a.rowOrColAt(this.rowOrCol,e).start,this.maxBound=a.lastRowOrCol(this.rowOrCol).end-a.rowOrColAt(this.rowOrCol,e).end,this.size=a.rowOrColAt(this.rowOrCol,e).size,this.subject=r,this.dragged=!1,this.tableMeasurement=a,this.currentIndex=e,this.currentPosition=n[this.coordinate]}start(){return{cellMovement:t=>this.cellMovement(t)}}drag(t){this.currentPosition=t[this.coordinate];const{currentIndex:e,move:n}=this.calculateDrag();return this.currentIndex=e,this.initialIndex!==this.currentIndex&&(this.dragged=!0),L(n)&&this.tableMeasurement.moveRowOrColAt(this.rowOrCol,n),{cellMovement:r=>this.cellMovement(r)}}end(){return this.initialIndex===this.currentIndex?{moved:!1,dragged:this.dragged}:{moved:!0,toIndex:this.currentIndex}}cellMovement(t){return{border:this.cellBorder(t),state:this.cellState(t),translate:this.cellTranslate(t)}}cellBorder(t){const e=this.isRowOrColExposed(t[this.rowOrCol]),n=this.subject.containsCell(t);return this.rowOrCol==="row"?{top:e,right:!0,bottom:!n||t.row===this.tableMeasurement.lastRowIndex,left:this.tableMeasurement.firstColIndex===t.col}:{top:this.tableMeasurement.firstRowIndex===t.row,right:!n||t.col===this.tableMeasurement.lastColIndex,bottom:!0,left:e}}cellState(t){return this.subject.containsCell(t)?"moving":"shiftable"}cellTranslate(t){const e=this.rowOrColTranslate(t[this.rowOrCol]);return this.rowOrCol==="row"?{x:0,y:e}:{x:e,y:0}}isRowOrColExposed(t){const e=this.reorderIndex(t),n=e===this.tableMeasurement.firstRowOrColIndex(this.rowOrCol),r=e===this.currentIndex+1;return n||r}get rowOrColShift(){if(this.currentIndex!==this.initialIndex)return this.currentIndex<this.initialIndex?{direction:"forwards",range:{start:this.currentIndex,endExclusive:this.initialIndex},indexDiff:1,positionDiff:this.size-1}:{direction:"backwards",range:{start:this.initialIndex+1,endExclusive:this.currentIndex+1},indexDiff:-1,positionDiff:1-this.size}}rowOrColTranslate(t){if(t===this.initialIndex)return ce(this.currentPosition-this.initialPosition,{min:this.minBound,max:this.maxBound});const e=this.rowOrColShift;return V(e)?0:yn(t,e.range)?e.positionDiff:0}reorderIndex(t){const e=this.rowOrColShift;return V(e)?t:t===this.initialIndex?this.currentIndex:yn(t,e.range)?t+e.indexDiff:t}calculateDrag(){const t=this.tableMeasurement.rowsOrCols(this.rowOrCol),e={name:"current",index:this.currentIndex,mid:t[this.currentIndex].mid},n=this.currentIndex!==this.tableMeasurement.firstRowOrColIndex(this.rowOrCol)?{name:"left",index:this.currentIndex-1,mid:t[this.currentIndex-1].start+t[this.currentIndex].size/2}:void 0,r=this.currentIndex!==this.tableMeasurement.lastRowOrColIndex(this.rowOrCol)?{name:"right",index:this.currentIndex+1,mid:t[this.currentIndex].start+t[this.currentIndex+1].size+t[this.currentIndex].size/2}:void 0,s=ZR(XR([e,n,r]),(o,l)=>tf(this.currentPosition-o.mid)-tf(this.currentPosition-l.mid));return s.name==="current"?{currentIndex:this.currentIndex,move:void 0}:{currentIndex:s.index,move:{fromIndex:this.currentIndex,toIndex:s.index}}}static of(t){return new Hd(t)}}class Fd{constructor({event:t,tableState:e,rowOrCol:n,index:r,onClick:s}){P(this,"tableState");P(this,"rowOrCol");P(this,"index");P(this,"onClick");P(this,"moveTracker");P(this,"subject");P(this,"autoScroller");P(this,"removeEventListeners");this.tableState=e,this.rowOrCol=n,this.index=r,this.subject=rt.of(n==="row"?{row:{start:r,endExclusive:r+1},col:this.tableState.table.colRange}:{row:this.tableState.table.rowRange,col:{start:r,endExclusive:r+1}}),this.onClick=s,this.autoScroller=rh.of({offset:16,maxScroll:32,boundaryElement:{x:e.scrollElement,y:e.rootScrollElement},scrollElement:{x:e.scrollElement,y:e.rootScrollElement}}),this.moveTracker=Hd.of({subject:this.subject,rowOrCol:n,index:r,position:{x:t.clientX+e.scrollOffsetX,y:t.clientY+e.scrollOffsetY},tableElement:e.tableElement,scrollOffsetX:()=>this.tableState.scrollOffsetX,scrollOffsetY:()=>this.tableState.scrollOffsetY})}start(t){t.preventDefault();const e=this.moveTracker.start();this.tableState.outlinedSection=this.subject,this.tableState.move=e,this.tableState.activeHandle={state:"active",handle:{type:"header",index:this.index,location:this.rowOrCol}};const n=this.rowOrCol==="row"?{row:this.index,col:this.tableState.table.lastColIndex}:{row:this.tableState.table.lastRowIndex,col:this.index};this.tableState.activeCell=n,this.tableState.anchorCell=n,this.tableState.focusTable();const r=Id(t.target);this.removeEventListeners=Tr(gv(t,r),Mt(r,"pointermove",s=>this.drag(s)),Mt(r,"pointerup",()=>this.end()))}drag(t){t.preventDefault(),this.autoScroller.updatePosition(t.clientX,t.clientY),this.tableState.move=this.moveTracker.drag({x:t.clientX+this.tableState.scrollOffsetX,y:t.clientY+this.tableState.scrollOffsetY})}end(){var e;(e=this.removeEventListeners)==null||e.call(this),this.autoScroller.destroy();const t=this.moveTracker.end();if(t.moved){this.tableState.table.moveRowOrColAt(this.rowOrCol,{fromIndex:this.index,toIndex:t.toIndex}),this.tableState.outlinedSection=rt.of(this.rowOrCol==="row"?{row:{start:t.toIndex,endExclusive:t.toIndex+1},col:this.tableState.table.colRange}:{row:this.tableState.table.rowRange,col:{start:t.toIndex,endExclusive:t.toIndex+1}});const n=this.rowOrCol==="row"?{row:t.toIndex,col:this.tableState.table.lastColIndex}:{row:this.tableState.table.lastRowIndex,col:t.toIndex};this.tableState.activeCell=n,this.tableState.anchorCell=n}this.tableState.move=void 0,this.tableState.activeHandle=void 0,!t.moved&&!t.dragged&&this.onClick()}static startMove(t){new Fd(t).start(t.event)}}function jX(i){return i==="row"?"y":"x"}class Kd{constructor({tableState:t,handle:e,position:n,cellSizePixels:r,dragThresholdPixels:s}){P(this,"tableState");P(this,"type");P(this,"initialHandle");P(this,"initialRowOrColCount");P(this,"initialPosition");P(this,"initialOutlinedSection");P(this,"initialActiveCell");P(this,"initialAnchorCell");P(this,"cellSizePixels");P(this,"dragThresholdPixels");P(this,"dragged");this.tableState=t,this.type=this.handleToType(e),this.initialHandle=e,this.initialPosition=n,this.initialRowOrColCount={row:t.table.rowCount,col:t.table.colCount},this.initialActiveCell=t.activeCell,this.initialAnchorCell=t.anchorCell,this.initialOutlinedSection=t.outlinedSection,this.cellSizePixels=r,this.dragThresholdPixels=s,this.dragged=!1}start(){return{activeHandle:{state:"active",handle:this.initialHandle}}}drag(t){return this.dragged=!0,this.calculateDrag(t)}end(){return this.dragged?{activeHandle:void 0}:this.calculateClick()}calculateClick(){if(this.type!=="table")return this.calculateClickRowOrCol(this.type);if(this.initialHandle.location==="right")return this.calculateClickRowOrCol("col");if(this.initialHandle.location==="bottom")return this.calculateClickRowOrCol("row");const t=this.calculateClickRowOrCol("row"),e=this.calculateClickRowOrCol("col");return{operation:{row:t.operation.row,col:e.operation.col},activeHandle:t.activeHandle,activeCell:L(t.activeCell)&&L(e.activeCell)?{row:t.activeCell.row,col:e.activeCell.col}:void 0,anchorCell:L(t.anchorCell)&&L(e.anchorCell)?{row:t.anchorCell.row,col:e.anchorCell.col}:void 0,outlinedSection:L(t.outlinedSection)&&L(e.outlinedSection)?rt.of({row:t.outlinedSection.row,col:e.outlinedSection.col}):void 0}}calculateClickRowOrCol(t){const e=this.type==="table"?this.tableState.table.lastRowOrColIndex(t)+1:this.initialHandle.index;return{operation:{[t]:{action:"add",index:e,count:1}},activeHandle:this.type==="table"?void 0:{state:"hover",handle:{type:"border",location:this.handleLocationAt(e),index:e}},...this.calculateCellMovement(t,1)}}calculateDrag(t){if(this.type!=="table")return this.calculateDragRowOrCol(this.type,t);if(this.initialHandle.location==="right")return this.calculateDragRowOrCol("col",t);if(this.initialHandle.location==="bottom")return this.calculateDragRowOrCol("row",t);const e=this.calculateDragRowOrCol("row",t),n=this.calculateDragRowOrCol("col",t);if(V(e)&&V(n))return;const r=e??this.calculateCellMovement("row",this.rowOrColDiff("row")),s=n??this.calculateCellMovement("col",this.rowOrColDiff("col"));return{operation:{row:e==null?void 0:e.operation.row,col:n==null?void 0:n.operation.col},activeHandle:(e==null?void 0:e.activeHandle)??(n==null?void 0:n.activeHandle),activeCell:L(r.activeCell)&&L(s.activeCell)?{row:r.activeCell.row,col:s.activeCell.col}:void 0,anchorCell:L(r.anchorCell)&&L(s.anchorCell)?{row:r.anchorCell.row,col:s.anchorCell.col}:void 0,outlinedSection:L(r.outlinedSection)&&L(s.outlinedSection)?rt.of({row:r.outlinedSection.row,col:s.outlinedSection.col}):void 0}}calculateDragRowOrCol(t,e){const n=jX(t),r=e.position[n]-this.initialPosition[n],s=_R(r/this.cellSizePixels[t]),o=r%this.cellSizePixels[t]>=this.dragThresholdPixels[t]?1:0,l=this.tableState.table.rowOrColCount(t)-this.initialRowOrColCount[t],a=s+o-l,c=this.type==="table"?this.tableState.table.lastRowOrColIndex(t)+1:this.initialHandle.index+l;if(a!==0)return a>0?this.calculateDragRowOrColMore({rowOrCol:t,start:c,length:a}):this.calculateDragRowOrColLess({rowOrCol:t,start:c,length:uc(-a,c,this.tableState.table.lastRowOrColIndex(t))})}calculateDragRowOrColLess({rowOrCol:t,start:e,length:n}){let r=0;for(const o of Qn({start:e-1,endExclusive:e-n-1})){if(!this.tableState.table.hasEmptyRowOrColAt(t,o))break;r++}if(r===0)return;const s=e-(r-1)-1;return{operation:{[t]:{action:"remove",index:e-r,count:r}},activeHandle:this.type==="table"?{state:"active",handle:this.initialHandle}:{state:"active",handle:{type:"border",location:this.handleLocationAt(s),index:s}},...this.calculateCellMovement(t,this.rowOrColDiff(t)-r)}}calculateDragRowOrColMore({rowOrCol:t,start:e,length:n}){return{operation:{[t]:{action:"add",index:e,count:n}},activeHandle:{state:"active",handle:this.type==="table"?this.initialHandle:{type:"border",location:this.handleLocationAt(e+n),index:e+n}},...this.calculateCellMovement(t,this.rowOrColDiff(t)+n)}}calculateCellMovement(t,e){var r,s;const n=this.type==="table"?this.initialRowOrColCount[t]:this.initialHandle.index;if(e>=0)return{outlinedSection:(r=this.initialOutlinedSection)==null?void 0:r.addForwardsByRowOrCol(t,{start:n,count:e}),activeCell:L(this.initialActiveCell)?eg(t,this.initialActiveCell,{start:n,count:e}):void 0,anchorCell:L(this.initialAnchorCell)?eg(t,this.initialAnchorCell,{start:n,count:e}):void 0};{const o=-e,l=(s=this.initialOutlinedSection)==null?void 0:s.subtractBackwardsByRowOrCol(t,{start:n,count:o,min:this.tableState.table.firstRowOrColIndex(t)}),a=L(l)?{min:l.startRowOrCol(t),max:l.endRowOrCol(t)}:void 0,c=L(this.initialActiveCell)?ig(t,this.initialActiveCell,{start:n,count:o,boundary:a}):void 0,h=L(this.initialAnchorCell)?ig(t,this.initialAnchorCell,{start:n,count:o,boundary:a}):void 0;return{outlinedSection:l,activeCell:c,anchorCell:h}}}rowOrColDiff(t){return this.tableState.table.rowOrColCount(t)-this.initialRowOrColCount[t]}handleLocationAt(t){if(this.type!=="table")return this.type==="row"&&t===this.tableState.table.firstRowIndex?"top":this.type==="col"&&t===this.tableState.table.firstColIndex?"left":this.type}handleToType(t){return t.type==="table"?"table":t.location==="top"?"row":t.location==="left"?"col":t.location}static of(t){return new Kd(t)}}function DX(i){const t=gc(i.tableElement,i.table.firstCellLocation),e=LZ(t),{minWidth:n}=getComputedStyle(t),{lineHeight:r,paddingTop:s,paddingBottom:o}=getComputedStyle(e),l=parseFloat(n)+1,a=parseFloat(r)+parseFloat(s)+parseFloat(o)+1;return{width:l,height:a}}class Jd{constructor({event:t,tableState:e,handle:n}){P(this,"tableState");P(this,"resizeTracker");P(this,"removeEventListeners");this.tableState=e;const{width:r,height:s}=DX(e);this.resizeTracker=Kd.of({tableState:this.tableState,handle:n,position:{x:t.clientX,y:t.clientY},cellSizePixels:{row:s,col:r},dragThresholdPixels:{row:s/2,col:r/2}})}start(t){t.preventDefault();const e=this.resizeTracker.start();this.tableState.resize={},this.tableState.activeHandle=e.activeHandle,this.tableState.focusTable(),this.removeEventListeners=Tr(gv(t,this.tableState.tableElement),Mt(this.tableState.tableElement,"pointermove",n=>this.drag(n)),Mt(this.tableState.tableElement,"pointerup",()=>this.end()))}drag(t){t.preventDefault();const e=this.resizeTracker.drag({position:{x:t.clientX,y:t.clientY}});L(e)&&(this.resizeTable(e.operation),this.tableState.activeHandle=e.activeHandle,this.tableState.activeCell=e.activeCell,this.tableState.anchorCell=e.anchorCell,this.tableState.outlinedSection=e.outlinedSection)}end(){var e;(e=this.removeEventListeners)==null||e.call(this);const t=this.resizeTracker.end();"operation"in t&&(this.resizeTable(t.operation),this.tableState.activeCell=t.activeCell,this.tableState.anchorCell=t.anchorCell,this.tableState.outlinedSection=t.outlinedSection),this.tableState.activeHandle=t.activeHandle,this.tableState.resize=void 0}resizeTable({row:t,col:e}){if(L(t)){const{action:n,index:r,count:s}=t;n==="add"?this.tableState.table.addEmptyRowsAt({row:r,count:s}):this.tableState.table.removeRowsAt({row:r,count:s})}if(L(e)){const{action:n,index:r,count:s}=e;n==="add"?this.tableState.table.addEmptyColsAt({col:r,count:s}):this.tableState.table.removeColsAt({col:r,count:s})}}static startResize(t){new Jd(t).start(t.event)}}function YX(i,t){t.interactive&&(t.activeHandle={state:"hover",handle:i})}function WX(i){i.interactive&&(i.activeHandle=void 0)}function VX(i,t,e){if(e.interactive){if(!Nd(i)){i.preventDefault();return}t.type==="table"||t.type==="border"?Jd.startResize({event:i,handle:t,tableState:e}):t.type==="header"&&Fd.startMove({event:i,rowOrCol:t.location,index:t.index,tableState:e,onClick:()=>Ud.showMenu({handle:t,point:{x:i.clientX,y:i.clientY},tableState:e})})}}function BX(i,t){const e=i.target;if(V(e))return;const n=qd(e);if(L(n)){YX(n,t);return}const r=jl(e);if(L(r)){LX(eh(r),t);return}}function qX(i,t){const e=i.target;if(V(e))return;const n=qd(e);if(L(n)){WX(t);return}const r=jl(e);if(L(r)){MX(t);return}}function NX(i,t){const e=i.target;if(V(e))return;const n=qd(e);if(L(n)){VX(i,n,t);return}const r=jl(e);if(L(r)){zX(i,eh(r),t);return}i.preventDefault()}function GX(i){i.preventDefault()}var UX=ot("<!> <!> <!>",1),HX=ot('<tr class="tbl-table-row"></tr>'),FX=ot('<tbody class="tbl-table-body"></tbody>'),KX=ot("<!> <!>",1),JX=ot("<!> <!>",1),tE=ot("<!> <!> <!>",1),eE=ot("<!> <!>",1),iE=ot("<!> <!>",1),nE=ot("<!> <!>",1),rE=ot("<!> <!>",1),sE=ot("<!> <!> <!> <!> <!>",1),oE=ot("<!> <!>",1),lE=ot("<!> <!>",1),aE=ot("<!> <!> <!>",1),cE=ot("<!> <!>",1),hE=ot("<!> <!>",1),uE=ot("<!> <!> <!>",1),fE=ot("<!> <!>",1),dE=ot("<!> <!>",1),OE=ot("<!> <!>",1),pE=ot("<!> <!> <!> <!> <!> <!> <!>",1),mE=ot('<div class="tbl-table-wrapper"><table class="tbl-table" role="grid" tabindex="-1"><thead class="tbl-table-head"><!></thead><!></table> <!> <!> <!> <!></div>');function gE(i,t){Wn(t,!0);const e=kf.of({table:()=>t.table,selection:()=>t.selection,scrollElement:()=>t.scrollElement,rootEditor:()=>t.rootEditor,menuRootElement:()=>t.menuRootElement,extensions:()=>t.extensions,markdownConfig:()=>t.markdownConfig,globalKeyBindings:()=>t.globalKeyBindings,selectionType:()=>t.selectionType,lineWrapping:()=>t.lineWrapping,onUndo:()=>t.onUndo,onRedo:()=>t.onRedo,onNavigate:()=>t.onNavigate,onDelete:()=>t.onDelete});Kc(()=>Tr(Mt(e.document,"selectionchange",()=>MZ(e)),Mt(e.document.body,"pointerdown",()=>TZ(e),{capture:!0,passive:!0}),Mt(e.document.body,"pointerup",()=>RZ(e),{capture:!0,passive:!0}),Mt(e.document.body,"pointerleave",()=>AZ(e),{capture:!0,passive:!0}),Mt(e.document.body,"copy",x=>ZZ(x,e)),Mt(e.document.body,"cut",x=>XZ(x,e)),Mt(e.document.body,"paste",x=>EZ(x,e))));var n=mE(),r=Ue(n);{const x=(y,k=U1)=>{var Q=HX();ua(Q,20,()=>e.table.colIndices,E=>E,(E,W)=>{const X=H(()=>({row:k(),col:W})),D=H(()=>({top:k()===e.table.firstRowIndex,left:W===e.table.firstColIndex})),_=H(()=>e.selection.isCell()&&Rr($(X),e.selection.cell));{let F=H(()=>{var U;return((U=e.outlinedSection)==null?void 0:U.containsOnEdge($(X)))??{top:!1,right:!1,bottom:!1,left:!1}}),G=H(()=>{var U;return(U=e.move)==null?void 0:U.cellMovement($(X))});BZ(E,{get location(){return $(X)},get alignment(){return e.table.alignments[W]},get selected(){return $(_)},get position(){return $(D)},get outline(){return $(F)},get movement(){return $(G)},get win(){return e.window},children:(U,Xt)=>{var _t=UX(),Bt=Et(_t);ua(Bt,16,()=>kZ($(X),$(D)),yt=>yt,(yt,Nt)=>{{let re=H(()=>e.cellHandleState($(X),Nt)),be=H(()=>L(e.resize));hg(yt,{get of(){return Nt},get state(){return $(re)},get toggle(){return $(be)}})}});var lt=et(Bt,2);eX(lt,{get hidden(){return $(_)},children:(yt,Nt)=>{var re=_d(),be=Et(re);A5(be,()=>SZ(e.table.cellAt($(X)),e.highlighter($(X)))),I(yt,re)},$$slots:{default:!0}});var Yt=et(lt,2);{var $e=yt=>{var Nt=()=>e.table.cellAt($(X)),re=pt=>e.table.setCellAt($(X),pt),be=()=>e.selection.cellSection,tt=pt=>{e.selectionValue={cell:$(X),section:pt}};{let pt=H(()=>e.highlighter($(X)));GZ(yt,{get text(){return Nt()},set text(mt){re(mt)},get selection(){return be()},set selection(mt){tt(mt)},get selectionType(){return e.selectionType},get lineWrapping(){return e.lineWrapping},get extensions(){return e.extensions},get markdownConfig(){return e.markdownConfig},get rootEditor(){return e.rootEditor},get globalKeyBindings(){return e.globalKeyBindings},get highlighter(){return $(pt)},onbeforeinput:mt=>HZ(mt,e),ondragstart:mt=>FZ(mt),onkeydown:(mt,At)=>KZ(mt,At,e),onpaste:mt=>JZ(mt,e)})}};Ft(Yt,yt=>{$(_)&&yt($e)})}I(U,_t)},$$slots:{default:!0}})}}),I(y,Q)};var s=Ue(r),o=Ue(s);x(o,()=>e.table.headerRowIndex);var l=et(s);{var a=y=>{var k=FX();ua(k,20,()=>e.table.dataRowIndices,Q=>Q,(Q,E)=>{x(Q,()=>E)}),I(y,k)},c=H(()=>e.table.hasDataRows());Ft(l,y=>{$(c)&&y(a)})}pc(r,y=>e.tableElement=y,()=>e==null?void 0:e.tableElement)}var h=et(r,2);{var u=x=>{const y=H(()=>e.menu.type==="row"?"row":"column");IZ(x,{get to(){return e.menuRootElement},children:(k,Q)=>{oX(k,{translate:E=>e.menu.computeTranslation(E),children:(E,W)=>{const X=H(()=>{const{addable:tt,alignable:pt,clearable:mt,duplicatable:At,moveable:Wt,removable:Vt,sortable:fe}=e.menu.capabilities;return{addable:tt,alignable:pt,clearable:mt,duplicatable:At,moveable:Wt,removable:Vt,sortable:fe}});var D=pE(),_=Et(D);{var F=tt=>{var pt=tE(),mt=Et(pt);Re(mt,{onclick:()=>Ae({action:"sort",direction:"ascending"},e),children:(Vt,fe)=>{var ut=KX(),gt=Et(ut);Ze(gt,{name:"sort-ascending"});var It=et(gt,2);Xe(It,{children:(kt,Ut)=>{var Zt=Te();se(()=>Bi(Zt,`Sort by ${$(y)??""} (A-Z)`)),I(kt,Zt)}}),I(Vt,ut)}});var At=et(mt,2);Re(At,{onclick:()=>Ae({action:"sort",direction:"descending"},e),children:(Vt,fe)=>{var ut=JX(),gt=Et(ut);Ze(gt,{name:"sort-descending"});var It=et(gt,2);Xe(It,{children:(kt,Ut)=>{var Zt=Te();se(()=>Bi(Zt,`Sort by ${$(y)??""} (Z-A)`)),I(kt,Zt)}}),I(Vt,ut)}});var Wt=et(At,2);Oa(Wt),I(tt,pt)};Ft(_,tt=>{$(X).sortable&&tt(F)})}var G=et(_,2);{var U=tt=>{var pt=sE(),mt=Et(pt);Re(mt,{onclick:()=>Ae({action:"align",alignment:"none"},e),children:(ut,gt)=>{var It=eE(),kt=Et(It);Ze(kt,{name:"align-none"});var Ut=et(kt,2);Xe(Ut,{children:(Zt,ri)=>{var Wi=Te("Align none");I(Zt,Wi)}}),I(ut,It)}});var At=et(mt,2);Re(At,{onclick:()=>Ae({action:"align",alignment:"left"},e),children:(ut,gt)=>{var It=iE(),kt=Et(It);Ze(kt,{name:"align-left"});var Ut=et(kt,2);Xe(Ut,{children:(Zt,ri)=>{var Wi=Te("Align left");I(Zt,Wi)}}),I(ut,It)}});var Wt=et(At,2);Re(Wt,{onclick:()=>Ae({action:"align",alignment:"center"},e),children:(ut,gt)=>{var It=nE(),kt=Et(It);Ze(kt,{name:"align-center"});var Ut=et(kt,2);Xe(Ut,{children:(Zt,ri)=>{var Wi=Te("Align center");I(Zt,Wi)}}),I(ut,It)}});var Vt=et(Wt,2);Re(Vt,{onclick:()=>Ae({action:"align",alignment:"right"},e),children:(ut,gt)=>{var It=rE(),kt=Et(It);Ze(kt,{name:"align-right"});var Ut=et(kt,2);Xe(Ut,{children:(Zt,ri)=>{var Wi=Te("Align right");I(Zt,Wi)}}),I(ut,It)}});var fe=et(Vt,2);Oa(fe),I(tt,pt)};Ft(G,tt=>{$(X).alignable&&tt(U)})}var Xt=et(G,2);{var _t=tt=>{var pt=aE(),mt=Et(pt);Re(mt,{onclick:()=>Ae({action:"add",direction:"before"},e),children:(Vt,fe)=>{var ut=oE(),gt=Et(ut);Ze(gt,{name:"add-before"});var It=et(gt,2);Xe(It,{children:(kt,Ut)=>{var Zt=Te();se(()=>Bi(Zt,`Add ${$(y)??""} ${$(y)==="row"?"above":"before"}`)),I(kt,Zt)}}),I(Vt,ut)}});var At=et(mt,2);Re(At,{onclick:()=>Ae({action:"add",direction:"after"},e),children:(Vt,fe)=>{var ut=lE(),gt=Et(ut);Ze(gt,{name:"add-after"});var It=et(gt,2);Xe(It,{children:(kt,Ut)=>{var Zt=Te();se(()=>Bi(Zt,`Add ${$(y)??""} ${$(y)==="row"?"below":"after"}`)),I(kt,Zt)}}),I(Vt,ut)}});var Wt=et(At,2);Oa(Wt),I(tt,pt)};Ft(Xt,tt=>{$(X).addable&&tt(_t)})}var Bt=et(Xt,2);{var lt=tt=>{var pt=uE(),mt=Et(pt);{var At=ut=>{Re(ut,{onclick:()=>Ae({action:"move",direction:"backward"},e),children:(gt,It)=>{var kt=cE(),Ut=Et(kt);{let ri=H(()=>`move-${$(y)==="row"?"up":"left"}`);Ze(Ut,{get name(){return $(ri)}})}var Zt=et(Ut,2);Xe(Zt,{children:(ri,Wi)=>{var wo=Te();se(()=>Bi(wo,`Move ${$(y)??""} ${$(y)==="row"?"up":"left"}`)),I(ri,wo)}}),I(gt,kt)}})};Ft(mt,ut=>{($(X).moveable==="backward"||$(X).moveable===!0)&&ut(At)})}var Wt=et(mt,2);{var Vt=ut=>{Re(ut,{onclick:()=>Ae({action:"move",direction:"forward"},e),children:(gt,It)=>{var kt=hE(),Ut=Et(kt);{let ri=H(()=>`move-${$(y)==="row"?"down":"right"}`);Ze(Ut,{get name(){return $(ri)}})}var Zt=et(Ut,2);Xe(Zt,{children:(ri,Wi)=>{var wo=Te();se(()=>Bi(wo,`Move ${$(y)??""} ${$(y)==="row"?"down":"right"}`)),I(ri,wo)}}),I(gt,kt)}})};Ft(Wt,ut=>{($(X).moveable==="forward"||$(X).moveable===!0)&&ut(Vt)})}var fe=et(Wt,2);Oa(fe),I(tt,pt)};Ft(Bt,tt=>{$(X).moveable!==!1&&tt(lt)})}var Yt=et(Bt,2);{var $e=tt=>{Re(tt,{onclick:()=>Ae({action:"duplicate"},e),children:(pt,mt)=>{var At=fE(),Wt=Et(At);Ze(Wt,{name:"duplicate"});var Vt=et(Wt,2);Xe(Vt,{children:(fe,ut)=>{var gt=Te();se(()=>Bi(gt,`Duplicate ${$(y)??""}`)),I(fe,gt)}}),I(pt,At)}})};Ft(Yt,tt=>{$(X).duplicatable&&tt($e)})}var yt=et(Yt,2);{var Nt=tt=>{Re(tt,{onclick:()=>Ae({action:"clear"},e),children:(pt,mt)=>{var At=dE(),Wt=Et(At);Ze(Wt,{name:"clear"});var Vt=et(Wt,2);Xe(Vt,{children:(fe,ut)=>{var gt=Te();se(()=>Bi(gt,`Clear ${$(y)??""}`)),I(fe,gt)}}),I(pt,At)}})};Ft(yt,tt=>{$(X).clearable&&tt(Nt)})}var re=et(yt,2);{var be=tt=>{Re(tt,{onclick:()=>Ae({action:"remove"},e),children:(pt,mt)=>{var At=OE(),Wt=Et(At);Ze(Wt,{name:"remove"});var Vt=et(Wt,2);Xe(Vt,{children:(fe,ut)=>{var gt=Te();se(()=>Bi(gt,`Delete ${$(y)??""}`)),I(fe,gt)}}),I(pt,At)}})};Ft(re,tt=>{$(X).removable&&tt(be)})}I(E,D)},$$slots:{default:!0}})},$$slots:{default:!0}})},f=H(()=>L(e.menu));Ft(h,x=>{$(f)&&x(u)})}var d=et(h,2);ua(d,16,()=>yZ,x=>x,(x,y)=>{{let k=H(()=>{var Q;return yf((Q=e.activeHandle)==null?void 0:Q.handle,y)?e.activeHandle.state:void 0});hg(x,{get of(){return y},get state(){return $(k)}})}});var O=et(d,2);{var p=x=>{DZ(x)},m=H(()=>!e.interactive&&V(e.outline));Ft(O,x=>{$(m)&&x(p)})}var g=et(O,2);{var b=x=>{xX(x)},v=H(()=>e.selection.isAll());Ft(g,x=>{$(v)&&x(b)})}pc(n,x=>e.wrapperElement=x,()=>e==null?void 0:e.wrapperElement),se(x=>$t(n,"data-select-all",x),[()=>wr(e.selection.isAll())]),Lo("mouseover",n,x=>BX(x,e)),Lo("mouseout",n,x=>qX(x,e)),Lo("pointerdown",n,x=>NX(x,e)),ca("dragover",n,x=>GX(x)),Lo("keydown",r,x=>EX(x,e)),ca("copy",r,x=>AX(x,e)),ca("cut",r,x=>ZX(x,e)),ca("paste",r,x=>XX(x,e)),I(i,n),Vn()}_S(["mouseover","mouseout","pointerdown","keydown"]);class tO extends zn{constructor(e,n){super();P(this,"tableDescription");P(this,"widgetElement");P(this,"height");P(this,"destroyWidgetElement");this.tableDescription=e;const r=TE(n);if(L(r)){const{widgetElement:s,destroyWidgetElement:o}=this.create(r);this.widgetElement=s,this.destroyWidgetElement=o,this.height=D5(r,s)}else this.widgetElement=void 0,this.destroyWidgetElement=void 0,this.height=Gm}get estimatedHeight(){return this.height}coordsAt(e,n,r){const s=this.tableDescription.table.closestCellAtPosition(n),o=gc(e,s);if(V(o))return null;const l=o.getBoundingClientRect();return{top:l.top,right:l.right,bottom:l.bottom,left:l.left}}toDOM(e){if(L(this.widgetElement))return this.widgetElement;const{widgetElement:n,destroyWidgetElement:r}=this.create(e);return this.widgetElement=n,this.destroyWidgetElement=r,e.requestMeasure({read:()=>{this.height=n.getBoundingClientRect().height}}),n}destroy(e){var n;(n=this.destroyWidgetElement)==null||n.call(this),this.destroyWidgetElement=void 0,this.widgetElement=void 0,this.height=Gm}create(e){const n=ml(e.dom).createElement("div");n.className="tbl-table-widget",n.tabIndex=-1,n.addEventListener("pointerdown",O=>{(O==null?void 0:O.target)===n&&O.preventDefault()});const r=this.tableDescription,s=p5(()=>{Hc(()=>{const O=!r.table.text.eq(r.editorTableText),p=!th(r.selection.value,r.editorSelectionValue);if(!O&&!p)return;let m;if(r.selection.isCell()){const{from:b}=r.table.cellSpan(r.selection.cell);m={anchor:r.from+b+r.selection.cellSection.anchor,head:r.from+b+r.selection.cellSection.head}}else r.selection.isAll()?m={anchor:r.from,head:r.to}:r.selection.isHidden()&&(m={anchor:r.from+1,head:r.from+1});const g=O?{from:r.from,to:r.to,insert:r.table.text}:void 0;r.markSynchronized(),e.dispatch({annotations:Tn("table.edit"),changes:g,selection:m})})}),{extensions:o,markdownConfig:l,globalKeyBindings:a,selectionType:c,lineWrapping:h}=Sv(e.state),u=IS(gE,{target:n,props:{table:r.table,selection:r.selection,scrollElement:n,rootEditor:e,extensions:o,markdownConfig:l,globalKeyBindings:a,selectionType:c,lineWrapping:h,menuRootElement:Pk(e,rv).dom,onUndo:()=>ed(e),onRedo:()=>Ga(e),onNavigate:O=>{e.dispatch({annotations:Tn("table.navigate"),selection:{anchor:O==="before"?r.from-1:r.to+1}}),e.focus()},onDelete:()=>{e.dispatch({annotations:Tn("table.delete"),changes:{from:r.from,to:r.to},selection:e.state.selection}),e.focus()}}}),f=()=>{jS(u)},d=Y5(n,({height:O})=>{this.height=O});return{widgetElement:n,destroyWidgetElement:Tr(s,f,d)}}static of(e,n){return new tO(e,n)}}function bE(i,t){return{widget:tO.of(i,t),block:!0,inclusive:!0}}function wE(i,t){return J.replace(bE(i,t))}function SE(i,t){const e=new Ns;for(const n of i)e.add(n.from,n.to,wE(n,t));return e.finish()}function vE(i){return bv(i)}function xE(i,t){return bv(i,t)}function bv(i,t=[]){const e=[];QR(St(i),s=>{M1(s)&&e.push({from:i.doc.lineAt(s.from).from,to:i.doc.lineAt(s.to).to})});const n=[],r=[];for(const s of e){if(LR(t,s,B1)){n.push(s);continue}const o=yE(s,i);qc(o)?n.push(s):r.push(...o)}return{spans:n,formatting:r,complete:Uk(i)}}function yE(i,t){return[...kE(i,t),...QE(i,t)]}function kE(i,{doc:t,lineBreak:e}){return yd({doc:t,lineBreak:e,span:i}).changes}function QE({from:i,to:t},{doc:e}){const n=e.slice(i,t),{text:r}=ef(n);return n.eq(r)?[]:[{from:i,to:t,insert:r}]}const $E={create(i){return pa(i)},update(i,t){if(eZ(t))return pa(t.state);if(!t.docChanged&&V(t.selection)&&i.complete)return i;const{tables:e,formatting:n,decorations:r}=i;if(!t.docChanged&&i.complete)return{tables:dg(e,t),formatting:n,decorations:r.map(t.changes),complete:!0};if(tZ(t)||CE(t,e))return pa(t.state);const s=dg(e,t).map(c=>c.span),{complete:o,spans:l,formatting:a}=xE(t.state,s);return mn(s,l,B1)?{complete:o,tables:e,formatting:a,decorations:r.map(t.changes)}:pa(t.state)},provide(i){return z.decorations.from(i,t=>t.decorations)}},wv=mi.define($E);function pa(i){const{spans:t,formatting:e,complete:n}=vE(i),{doc:r,selection:s}=i,o=t.map(l=>vf.of({span:l,doc:r,selection:s}));return{complete:n,tables:o,formatting:e,decorations:SE(o,i)}}function CE(i,t){return!Yd(i)&&t.some(e=>i.changes.touchesRange(e.from,e.to)!==!1)}function dg(i,t){return TR(i,e=>e.applyTransaction(t))}const PE={create(){return{view:void 0}},update(i){return i}},eO=mi.define(PE);function Sv(i){return i.facet(nf)}function Mn(i){return i.field(wv)}function TE(i){return i.field(eO).view}function RE(i){const{handlePosition:t,selectionType:e,lineWrapping:n}=Sv(i);return{...Nc(window)?{"data-tbl-hoverable":""}:{},"data-tbl-theme-mode":i.facet(z.darkTheme)?"dark":"light","data-tbl-handle-position":t,"data-tbl-selection-type":e,"data-tbl-line-wrapping":n}}const AE=["undo","redo","select.undo","select.redo"];function ZE(i){return AE.some(t=>i.isUserEvent(t))}function XE(i){return vv(i,"select.search")}function EE(i){return vv(i,"select")}function LE(i){return i.isUserEvent("delete.forward")}function ME(i){return i.isUserEvent("delete.backward")}function vv(i,t){return i.annotation(Tt.userEvent)===t}const zE=({state:i,view:t,transactions:e})=>{t.hasFocus||Mn(i).tables.some(n=>n.containsSelection())||e.some(n=>ZE(n)||XE(n)&&!Ov(t))&&t.focus()},xv=Pt.define(),_E=new Map(US.map(i=>[i,xv.of(i)]));function yv(i){return _E.get(i)}const IE=(i,t)=>!t||!Mn(i).tables.some(e=>e.containsSelection())?null:yv("table.focus"),jE=i=>{const{selection:t,startState:e,docChanged:n}=i;if(V(t)||n||!EE(i)||!lc(t)||!lc(e.selection))return i;const r=e.selection.main,s=t.main;for(const o of Mn(e).tables){const l=o.from===s.head,a=o.to===s.head,c=o.from===r.head+1&&o.to===s.head-1,h=o.from===s.head+1&&o.to===r.head-1;let u;if(l?u=o.table.firstCellSpan.from:c?u=o.table.firstCellSpan.to:(a||h)&&(u=o.table.lastCellSpan.to),L(u))return[i,{annotation:Tn("table.navigate"),selection:aR({pos:o.from+u})}]}return i},DE=i=>{const{selection:t,startState:e}=i;if(V(t)||!lc(t))return i;const n=e.selection.main;if(LE(i)){for(const r of Mn(e).tables)if(n.head===r.from-1){const s=r.table.firstCellSpan.from;return[{selection:{anchor:r.from+s,head:r.from+s}}]}return i}else if(ME(i)){for(const r of Mn(e).tables)if(n.head===r.to+1){const s=r.table.lastCellSpan.to;return[{selection:{anchor:r.from+s,head:r.from+s}}]}return i}else return i};function YE(i){return TQ(i)>0||RQ(i)>0}const WE=({state:i,docChanged:t,selectionSet:e,transactions:n,view:r})=>{if(!t&&!e&&YE(i)||n.some(a=>Yd(a)))return;const{formatting:s}=Mn(i);if(qc(s))return;const o=Lt.of(s,i.doc.length,i.lineBreak),l=i.selection.map(o);r.dispatch({annotations:Tn("table.format"),changes:o,selection:l})},VE=i=>{if(!i.docChanged||Yd(i))return i;const t=i.changes,{tables:e}=Mn(i.startState),n=[];for(const o of e)if(t.touchesRange(o.from-1,o.from)!==!1||t.touchesRange(o.to,o.to+1)!==!1){const l={from:t.mapPos(o.from,1),to:t.mapPos(o.to)};if(l.from>=l.to)continue;n.push(yd({doc:i.newDoc,lineBreak:i.startState.lineBreak,span:l}).changes)}if(qc(n))return i;const r=Lt.of(n,i.changes.newLength,i.startState.lineBreak),s=i.newSelection.map(r);return[i,{annotation:Tn("table.correct"),changes:r,selection:s,sequential:!0}]};function BE(i,{anchor:t,head:e,goalColumn:n,bidiLevel:r}={}){return C.range(t??i.anchor,e??i.head,n??i.goalColumn,r??i.bidiLevel??void 0)}const qE=i=>{const{selection:t,startState:e,docChanged:n}=i;if(V(t)||n||lc(t))return i;const r=t.ranges.map(s=>{if(s.empty)return s;const o=Mn(e).tables,l=Og(s.anchor,o),a=Og(s.head,o);return L(l)||L(a)?BE(s,{anchor:l,head:a}):s});return mn(t.ranges,r,(s,o)=>s===o)?i:[i,{annotations:Tn("table.select"),selection:C.create(r,t.mainIndex)}]};function Og(i,t){for(const e of t){const n=e.from,r=e.to,s=e.from+1,o=e.to-1;if(i===n||i===s)return n-1;if(i===r||i===o)return r+1}}const NE={"& .cm-tooltip.cm-tooltip-autocomplete:has(.cm-completionIcon-table)":{border:"1px solid var(--tbl-theme-menu-border-color)","box-shadow":"2px 2px 0 0 rgb(0 0 0 / 10%)","font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)"},"& .cm-tooltip.cm-tooltip-autocomplete > ul:has(.cm-completionIcon-table)":{"min-width":"auto",display:"flex","flex-direction":"column","justify-content":"center",padding:"0.25em 0","line-height":1,"font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)",background:"var(--tbl-theme-menu-background)"},"& .cm-tooltip.cm-tooltip-autocomplete ul li[aria-selected]:has(.cm-completionIcon-table)":{color:"var(--tbl-theme-menu-hover-text-color)","&::before":{background:"var(--tbl-theme-menu-hover-background)"}},"& .cm-tooltip.cm-tooltip-autocomplete ul li:not([aria-selected]):has(.cm-completionIcon-table)":{color:"var(--tbl-theme-menu-text-color)"},"& .cm-tooltip.cm-tooltip-autocomplete ul li:not([aria-selected]):has(.cm-completionIcon-table), & .cm-tooltip.cm-tooltip-autocomplete ul li[aria-selected]:has(.cm-completionIcon-table)":{position:"relative",padding:"0.5em 0.75em",background:"var(--tbl-theme-menu-background)",display:"flex",gap:"0.75em","align-items":"center","font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)","line-height":1,"&::before":{position:"absolute",height:"100%",width:"calc(100% - 0.5em)",left:"0.25em",top:0,content:'""',"pointer-events":"none"}},"& .cm-completionIcon.cm-completionIcon-table":{opacity:1,"mask-image":`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='14' width='12.25' viewBox='0 0 448 512'%3E%3C!--!Font Awesome Free v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--%3E%3Cpath d='M384 96l-128 0 0 128 128 0 0-128zm64 128l0 192c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 128zM64 288l0 128 128 0 0-128-128 0zm128-64l0-128-128 0 0 128 128 0zm64 64l0 128 128 0 0-128-128 0z'/%3E%3C/svg%3E")`,"mask-position":"center","mask-repeat":"no-repeat",padding:0,background:"currentColor",position:"relative",width:"1em",height:"1em","font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)","line-height":1},"& :has(.cm-completionIcon.cm-completionIcon-table) .cm-completionLabel":{position:"relative"}},GE={'&[data-tbl-handle-position="inside"] .tbl-table-widget':{"padding-left":"6px","margin-left":0},".tbl-table-widget":{contain:"paint","padding-top":"16px","padding-right":"16px","padding-bottom":"16px","padding-left":"16px","margin-left":"-10px","overflow-x":"auto","overflow-y":"hidden","&, &::before, &::after, & *, & *::before, & *::after":{"box-sizing":"border-box"}},"&.cm-editor .cm-content div.tbl-table-widget::selection, & .cm-content div.tbl-table-widget ::selection, & .cm-content div.tbl-table-widget:focus::selection, & .cm-content div.tbl-table-widget :focus::selection":{"background-color":"transparent !important","caret-color":"transparent !important"}},UE={".cm-tooltip.tbl-menu-tooltip":{border:"none","user-select":"none","&, &::before, &::after, & *, & *::before, & *::after":{"box-sizing":"border-box"}}},HE={".tbl-blocking-overlay":{position:"absolute",top:0,left:0,"z-index":900,"background-color":"transparent",width:"100%",height:"100%"}},FE={"& .cm-content div.tbl-table-widget .tbl-cell-editor ::selection, & .cm-content div.tbl-table-widget .tbl-cell-editor :focus::selection":{"background-color":"Highlight !important","caret-color":"initial !important"},"&[data-tbl-selection-type='codemirror'] .tbl-cell-editor .cm-editor .cm-content":{"caret-color":"transparent !important"},"&[data-tbl-selection-type='codemirror'] .tbl-cell-editor .cm-editor .cm-content ::selection, &[data-tbl-selection-type='codemirror'] .tbl-cell-editor .cm-editor .cm-content :focus::selection":{"background-color":"transparent !important","caret-color":"transparent !important"},"&[data-tbl-line-wrapping='wrap'] .tbl-cell-editor .cm-editor .cm-content":{"word-break":"normal","overflow-wrap":"break-word"},".tbl-cell-editor":{height:"100%"},".tbl-cell-editor .cm-editor":{margin:0,padding:0,outline:"none",height:"100%",background:"unset",color:"var(--tbl-theme-text-color)"},".tbl-cell-editor .cm-editor .cm-scroller":{margin:0,padding:0,overflow:"hidden","line-height":1.5,"font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)",color:"var(--tbl-theme-text-color)"},".tbl-cell-editor .cm-editor .cm-content":{margin:0,padding:"7px 9px","line-height":1.5,"font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)",color:"var(--tbl-theme-text-color)"},".tbl-cell-editor .cm-editor .cm-line":{margin:0,padding:"0 1px","line-height":1.5,"touch-action":"none","font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)",color:"var(--tbl-theme-text-color)"}},KE={".tbl-cell":{"box-sizing":"content-box",position:"relative","vertical-align":"top","background-color":"var(--tbl-row-background)",padding:0,"font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)","min-width":"calc(4ch + 20px)",height:"inherit","user-select":"none",border:"none","scroll-margin-right":"1px","scroll-margin-left":"1px","&:first-child":{"scroll-margin-left":"16px"},"&:last-child":{"scroll-margin-right":"16px"},'&[align="left"]':{"text-align":"left"},'&[align="center"]':{"text-align":"center"},'&[align="right"]':{"text-align":"right"},'&[data-border~="top"]':{"border-top":"1px solid var(--tbl-theme-border-color)"},'&[data-border~="right"]':{"border-right":"1px solid var(--tbl-theme-border-color)"},'&[data-border~="bottom"]':{"border-bottom":"1px solid var(--tbl-theme-border-color)"},'&[data-border~="left"]':{"border-left":"1px solid var(--tbl-theme-border-color)"},'&[data-state="moving"]':{"z-index":200,"background-color":"color-mix(in srgb, var(--tbl-row-background), transparent 15%)"},'&[data-state="shiftable"]':{transform:"translate3d(0, 0, 0)",transition:"transform 150ms ease"},"&[data-outline]":{"&::after":{display:"block",position:"absolute",top:"-1px",left:"-1px",border:"none",width:"calc(100% + 2px)",height:"calc(100% + 2px)","pointer-events":"none",content:'""'},'&[data-outline~="top"]::after':{"border-top":"2px solid var(--tbl-theme-outline-color)"},'&[data-outline~="right"]::after':{"border-right":"2px solid var(--tbl-theme-outline-color)"},'&[data-outline~="bottom"]::after':{"border-bottom":"2px solid var(--tbl-theme-outline-color)"},'&[data-outline~="left"]::after':{"border-left":"2px solid var(--tbl-theme-outline-color)"}}},".tbl-header-cell:not([align])":{"text-align":"var(--tbl-style-default-header-alignment)"}},JE={'&[data-tbl-line-wrapping="wrap"] .tbl-cell-view':{"word-break":"normal","overflow-wrap":"break-word"},'&[data-tbl-line-wrapping="nowrap"] .tbl-cell-view':{"white-space":"pre"},".tbl-cell-view":{margin:0,outline:"none",padding:"7px 10px",height:"100%","line-height":1.5,"white-space-collapse":"break-spaces","font-family":"var(--tbl-style-font-family)","font-size":"var(--tbl-style-font-size)",color:"var(--tbl-theme-text-color)","&[data-hidden]":{display:"none"}},".tbl-cell-view [data-br]":{"white-space":"pre"}},tL={".tbl-handle":{display:"flex",position:"absolute","justify-content":"center","align-items":"center","z-index":200,transition:"opacity 150ms ease 50ms","touch-action":"none"},".tbl-handle[data-hover], .tbl-handle[data-active]":{"--tbl-handle-opacity":1},'&:not([data-tbl-hoverable]) .tbl-handle[data-type="border"], &:not([data-tbl-hoverable]) .tbl-handle[data-type="table"]':{display:"none"},'.tbl-handle[data-type="border"]':{"background-color":"var(--tbl-theme-border-hover-color)"},'.tbl-handle[data-type="border"][data-active]':{"background-color":"var(--tbl-theme-border-active-color)"},'.tbl-handle[data-type="border"][data-toggle]':{transition:"none"},'.tbl-handle[data-type="border"][data-location="top"]':{top:"-1px",left:"-1px",width:"calc(100% + 2px)",height:"2px"},'.tbl-handle[data-type="border"][data-location="left"]':{top:"-1px",left:"-1px",width:"2px",height:"calc(100% + 2px)"},'.tbl-handle[data-type="border"][data-location="col"]':{top:"-1px",right:"-2px",width:"3px",height:"calc(100% + 2px)"},'.tbl-handle[data-type="border"][data-location="row"]':{bottom:"-2px",left:"-1px",width:"calc(100% + 2px)",height:"3px"},'.tbl-handle[data-type="table"]':{"box-sizing":"content-box",color:"var(--tbl-theme-border-hover-color)","background-color":"color-mix(in srgb, var(--tbl-theme-border-color), var(--tbl-theme-header-row-background) 80%)"},'.tbl-handle[data-type="table"][data-location="right"]':{top:0,left:"100%",width:"15px",height:"calc(100% - 2px)",border:"1px solid var(--tbl-theme-border-color)","border-left":"none","&::before":{position:"absolute",top:"-1px",left:"-2px",width:"2px",height:"calc(100% + 2px)",content:'""'},"&::after":{position:"absolute","z-index":366,top:"-1px",left:0,content:'""',width:"calc(100% + 1px)",height:"calc(100% + 2px)","background-color":"var(--tbl-overlay)"}},'.tbl-handle[data-type="table"][data-location="bottom-right"]':{left:"calc(100% - 1px)",top:"calc(100% - 1px)","z-index":250,width:"15px",height:"15px",border:"1px solid var(--tbl-theme-border-color)","border-top-style":"dashed","border-left-style":"dashed","&::after":{position:"absolute","z-index":366,top:"-1px",left:"-1px",content:'""',width:"calc(100% + 2px)",height:"calc(100% + 2px)","background-color":"var(--tbl-overlay)"}},'.tbl-handle[data-type="table"][data-location="bottom"]':{top:"100%",left:"0",width:"calc(100% - 2px)",height:"15px",border:"1px solid var(--tbl-theme-border-color)","border-top":"none","&::before":{position:"absolute",top:"-2px",left:"-1px",width:"calc(100% + 2px)",height:"2px",content:'""'},"&::after":{position:"absolute","z-index":366,top:0,left:"-1px",content:'""',width:"calc(100% + 2px)",height:"calc(100% + 1px)","background-color":"var(--tbl-overlay)"}},'.tbl-handle[data-type="table"][data-location="bottom-right"][data-hover] ~ .tbl-handle[data-type="table"][data-location="right"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="right"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-hover] ~ .tbl-handle[data-type="table"][data-location="bottom"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="bottom"]':{"--tbl-handle-opacity":1},'.tbl-handle[data-type="table"][data-location="bottom-right"][data-hover] ~ .tbl-handle[data-type="table"][data-location="right"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="right"]':{"border-bottom":"none"},'.tbl-handle[data-type="table"][data-location="bottom-right"][data-hover] ~ .tbl-handle[data-type="table"][data-location="bottom"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="bottom"]':{"border-right":"none"},'.tbl-handle[data-type="table"][data-active], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="right"], .tbl-handle[data-type="table"][data-location="bottom-right"][data-active] ~ .tbl-handle[data-type="table"][data-location="bottom"]':{"background-color":"color-mix(in srgb, var(--tbl-theme-border-color), var(--tbl-theme-header-row-background) 80%)",color:"var(--tbl-theme-border-active-color)"},'&[data-tbl-handle-position="outside"] .tbl-handle[data-type="header"]':{"box-sizing":"content-box",transition:"none","z-index":300,color:"var(--tbl-theme-border-hover-color)",border:"1px solid transparent","&:hover":{"border-color":"var(--tbl-theme-border-color)","background-color":"color-mix(in srgb, var(--tbl-theme-border-color), var(--tbl-theme-header-row-background) 80%)"},"&[data-active]":{"background-color":"var(--tbl-theme-outline-color)","border-color":"var(--tbl-theme-outline-color)",color:"#ffffff"}},'&[data-tbl-handle-position="outside"] .tbl-handle[data-type="header"][data-location="row"]':{top:"-1px",left:"-17px",width:"15px",height:"100%","border-right":"none"},'&[data-tbl-handle-position="outside"] .tbl-handle[data-type="header"][data-location="col"]':{top:"-17px",left:"-1px",width:"100%",height:"15px","border-bottom":"none","&:hover::after":{position:"absolute","z-index":366,top:"-1px",left:"-1px",content:'""',width:"calc(100% + 2px)",height:"calc(100% + 1px)","background-color":"var(--tbl-overlay)"}},'&[data-tbl-handle-position="inside"] .tbl-handle[data-type="header"]':{transition:"none","z-index":300,color:"var(--tbl-theme-border-hover-color)","&:hover":{color:"var(--tbl-theme-border-active-color)"},"&[data-active]":{color:"var(--tbl-theme-outline-color)"}},'&[data-tbl-handle-position="inside"] .tbl-handle[data-type="header"][data-location="row"]':{top:"calc(50% - 13px)",left:"-1px",width:"3px",height:"26px","border-top":"4px solid var(--tbl-row-background)","border-bottom":"4px solid var(--tbl-row-background)","background-color":"var(--tbl-row-background)","&:hover::after, &[data-active]::after":{position:"absolute",top:"-6px",left:0,"box-sizing":"content-box","border-top":"2px solid transparent","border-bottom":"2px solid transparent",width:"calc(100% + 6px)",height:"calc(100% + 8px)",content:'""'}},'&[data-tbl-handle-position="inside"] .tbl-handle[data-type="header"][data-location="col"]':{top:"-1px",left:"calc(50% - 11.5px)",width:"23px",height:"3px","border-right":"4px solid var(--tbl-row-background)","border-left":"4px solid var(--tbl-row-background)","background-color":"var(--tbl-row-background)","&:hover::after, &[data-active]::after":{position:"absolute",top:0,left:"-6px","box-sizing":"content-box","border-right":"2px solid transparent","border-left":"2px solid transparent",width:"calc(100% + 8px)",height:"calc(100% + 6px)",content:'""'}},".tbl-handle-grip":{"pointer-events":"none","z-index":333}},eL={".tbl-menu-item-icon":{"z-index":200,width:"1em",height:"1em","pointer-events":"none","font-size":"var(--tbl-style-menu-font-size)"}},iL={".tbl-menu-item-text":{"z-index":200,"pointer-events":"none","user-select":"none","font-size":"var(--tbl-style-menu-font-size)"}},nL={".tbl-menu-item":{display:"flex",position:"relative","align-items":"center",gap:"0.75em",padding:"0.5em 0.75em",color:"var(--tbl-theme-menu-text-color)","user-select":"none","line-height":1,"font-size":"var(--tbl-style-menu-font-size)","&:active":{cursor:"pointer",color:"var(--tbl-theme-menu-hover-text-color)","&::after":{"background-color":"var(--tbl-theme-menu-hover-background)"}},"&::after":{position:"absolute",left:"0.25em",width:"calc(100% - 0.5em)",height:"100%",content:'""'}},"&[data-tbl-hoverable] .tbl-menu-item:hover":{cursor:"pointer",color:"var(--tbl-theme-menu-hover-text-color)","&::after":{"background-color":"var(--tbl-theme-menu-hover-background)"}}},rL={".tbl-menu-separator":{margin:"0.25em 0.5em","background-color":"var(--tbl-theme-menu-border-color)",height:"1px","font-size":"var(--tbl-style-menu-font-size)"}},sL={".tbl-menu":{position:"absolute",top:0,left:0,"z-index":900,"box-shadow":"2px 2px 0 0 rgb(0 0 0 / 10%)",border:"1px solid var(--tbl-theme-menu-border-color)","background-color":"var(--tbl-theme-menu-background)",padding:"0.25em 0",width:"max-content","font-family":"var(--tbl-style-menu-font-family)","font-size":"var(--tbl-style-menu-font-size)"}},oL={".tbl-select-all-overlay":{position:"absolute",top:0,left:0,"z-index":900,"background-color":"var(--tbl-overlay)",width:"100%",height:"100%","pointer-events":"none"}},lL={"& .tbl-table-wrapper[data-select-all]":{"--tbl-select-all-overlay":"var(--tbl-theme-select-all-blur-overlay)"},"&.cm-focused .tbl-table-wrapper[data-select-all]":{"--tbl-select-all-overlay":"var(--tbl-theme-select-all-focus-overlay)"},".tbl-table-wrapper":{"--tbl-overlay":"var(--tbl-select-all-overlay, transparent)",position:"relative",width:"fit-content","white-space-collapse":"collapse","touch-action":"none"},".tbl-table":{"border-collapse":"separate","border-spacing":0,overflow:"visible","touch-action":"none","&:focus-visible":{outline:"none"}},".tbl-table-head, .tbl-table-body":{height:"100%"},".tbl-table-row":{height:0},"@supports (-moz-appearance: none) /* TableTheme */":{".tbl-table-row":{height:"fit-content"}},".tbl-table-head .tbl-table-row":{"--tbl-row-background":"var(--tbl-theme-header-row-background)"},".tbl-table-body .tbl-table-row:nth-child(2n + 1)":{"--tbl-row-background":"var(--tbl-theme-even-row-background)"},".tbl-table-body .tbl-table-row:nth-child(2n)":{"--tbl-row-background":"var(--tbl-theme-odd-row-background)"}},aL={...NE,...UE,...GE,...lL,...HE,...KE,...FE,...JE,...tL,...sL,...nL,...eL,...iL,...rL,...oL},cL=i=>{var e;const t=(e=i.effects.find(n=>n.is(xv)))==null?void 0:e.value;return L(t)?{annotations:Tn(t)}:null},hL=i=>{const t=i.annotation(Dd);return L(t)?[yv(H5(t))]:[]};class iO{static of(t){return t.state.field(eO).view=t,new iO}constructor(){}}function uL(i){return[nf.of(i),wv,eO,di.define(t=>iO.of(t)),z.editorAttributes.compute([nf,z.darkTheme],RE),z.baseTheme(aL),z.theme("light"in i.theme?{':where(:root:has(&[data-tbl-theme-mode="light"]))':i.theme.light.props,':where(:root:has(&[data-tbl-theme-mode="dark"]))':i.theme.dark.props}:{":where(:root:has(&))":i.theme.props}),z.theme({":where(:root:has(&))":i.style.props}),x0.of(hL),r0.of(rv),K.transactionExtender.of(cL),K.transactionFilter.of(VE),K.transactionFilter.of(DE),K.transactionFilter.of(jE),K.transactionFilter.of(qE),z.updateListener.of(WE),z.updateListener.of(zE),z.clipboardInputFilter.of(oA),z.focusChangeEffect.of(IE)]}function fL(i){return uL(X1(i))}const dL=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]);function kv(i,t){try{const e=new URL(t),n=new URL(i,e);return n.protocol==="http:"||n.protocol==="https:"?{kind:"web",url:n.href}:dL.has(n.protocol)?{kind:"browser-local",url:n.href}:{kind:"application",url:n.href}}catch{return{kind:"invalid"}}}const Qv="cm-md-mark",$v="cm-md-inline-code",Qf="cm-md-list-item",$f="cm-md-list-bullet",Cv="cm-md-blockquote-line",Pv="cm-md-fenced-line",Tv="cm-md-hr",Rv="cm-md-task-checkbox",Av="cm-md-heading-1",Zv="cm-md-heading-2",nO="cm-md-link",Xv="cm-md-tag",Ev="cm-md-list-indent-source",pg="1.2em",OL="0.62em",Ro=J.replace({}),Gn=J.mark({class:Qv}),pL=J.mark({class:Ev}),mL=J.mark({class:$v}),gL=J.line({class:$f}),bL=J.line({class:Cv}),wL=J.line({class:Pv}),SL=J.line({class:Av}),vL=J.line({class:Zv}),xL=J.mark({class:Xv});class yL extends zn{toDOM(){const t=document.createElement("hr");return t.className=Tv,t}eq(t){return!0}ignoreEvent(){return!0}}const kL=J.replace({widget:new yL});class QL extends zn{constructor(e,n,r){super();P(this,"checked");P(this,"from");P(this,"to");this.checked=e,this.from=n,this.to=r}eq(e){return e.checked===this.checked&&e.from===this.from&&e.to===this.to}toDOM(e){const n=document.createElement("input");return n.type="checkbox",n.checked=this.checked,n.className=Rv,n.tabIndex=-1,n.addEventListener("mousedown",r=>{r.preventDefault()}),n.addEventListener("change",()=>{const r=this.checked?"[ ]":"[x]";e.dispatch({changes:{from:this.from,to:this.to,insert:r}})}),n}ignoreEvent(e){return e.type!=="click"&&e.type!=="change"&&e.type!=="mousedown"}}const $L=new Set(["EmphasisMark","LinkMark","URL"]),CL=new Set(["HeaderMark","QuoteMark"]),mg=/(^|\s)(#[\p{L}\p{N}_/-]+)/gu,PL=/[/.,;:!?]+$/u,TL=new RegExp("\\p{L}","u"),RL=new Set(["InlineCode","FencedCode","URL","Link"]);function AL(i,t,e,n,r,s){return CL.has(i)?{kind:"block",contextFrom:r,contextTo:s}:i==="CodeMark"?t==="InlineCode"&&e!==null&&n!==null?{kind:"inline",contextFrom:e,contextTo:n}:null:$L.has(i)?e===null||n===null?null:{kind:"inline",contextFrom:e,contextTo:n}:null}function gn(i,t,e,n){return i<=n&&t>=e}function ZL(i,t,e,n){const r=i.doc.lineAt(n);return gn(t,e,r.from,r.to)}function XL(i,t,e,n){return t.kind==="inline"?!gn(e,n,t.contextFrom,t.contextTo):!ZL(i,e,n,t.contextFrom)}function EL(i){let t=i.firstChild;for(;t;){if(t.name==="TaskMarker")return!0;if(t.name==="Task"){let e=t.firstChild;for(;e;){if(e.name==="TaskMarker")return!0;e=e.nextSibling}}t=t.nextSibling}return!1}function LL(i){let t=i.parent;for(;t;){if(t.name==="ListItem")return t;t=t.parent}return null}function Kn(i,t){let e=i.firstChild;for(;e;){if(e.name===t)return e;e=e.nextSibling}return null}function gg(i,t){const e=[];let n=t.firstChild;for(;n;)n.name==="CodeMark"&&e.push(n),n=n.nextSibling;if(e.length>=2)return{from:t.from,to:e[e.length-1].to,closed:!0};const r=i.doc.lineAt(t.from);return{from:r.from,to:r.to,closed:!1}}function Lv(i,t){let e=t.to;for(;e<i.doc.length&&i.doc.sliceString(e,e+1)===" ";)e+=1;return{from:t.from,to:e}}function Hh(i,t){return{from:i.doc.lineAt(t.from).from,to:Lv(i,t).to}}function Fh(i,t){return Lv(i,t)}function bg(i,t,e){const n=Kn(t,"ListMark"),r=n?i.doc.lineAt(n.from).from:e.from;let s=e.to;for(;s<i.doc.length&&i.doc.sliceString(s,s+1)===" ";)s+=1;return{from:r,to:s}}function Kh(i,t,e){const n=i.doc.lineAt(t.from);n.from<t.from&&e.push(pL.range(n.from,t.from))}function ML(i,t,e){let n=0;for(let r=t;r<e;r+=1)n+=i.doc.sliceString(r,r+1)===" "?2:1;return n}function zL(i){return J.line({class:Qf,attributes:{style:`--cm-md-list-indent: ${i.prefixRevealed?0:i.indentColumns};`}})}function wg(i,t,e,n,r){let s=t;for(;s<=e;){const o=i.doc.lineAt(s);if(r.push(n.range(o.from)),o.to>=e)break;s=o.to+1}}function _L(i,t,e,n){const r=Kn(t,"ListMark"),s=i.doc.lineAt(r?r.from:t.from).from,o=r?ML(i,s,r.from):0;let l=t.from;for(;l<=t.to;){const a=i.doc.lineAt(l),c=a.from===s,h=/^\s/.test(a.text);if(c||h){const u=e.get(a.from),f={indentColumns:o,prefixRevealed:c&&n};u===void 0||o>u.indentColumns?e.set(a.from,f):o===u.indentColumns&&f.prefixRevealed&&e.set(a.from,{...u,prefixRevealed:!0})}if(a.to>=t.to)break;l=a.to+1}}function IL(i,t){let e=i.resolveInner(t,1);for(;e;){if(RL.has(e.name)||e.name.startsWith("Table"))return!0;e=e.parent}return!1}function jL(i,t){const e=/^( {0,3})(#{1,6})(?:\s|$)/.exec(i);if(!e)return!1;const n=e[1]??"",r=e[2]??"",s=n.length,o=s+r.length;return t>=s&&t<o}function DL(i,t,e){for(let n=1;n<=i.doc.lines;n+=1){const r=i.doc.line(n);mg.lastIndex=0;let s;for(;(s=mg.exec(r.text))!==null;){const o=s[1]??"",a=(s[2]??"").replace(PL,"");if(a.length<=1||!TL.test(a))continue;const c=r.from+s.index+o.length,h=c+a.length;jL(r.text,c-r.from)||IL(t,c)||e.push(xL.range(c,h))}}}function Sg(i,t,e,n){const r=[],s=new Map,o=new Set,l=i.selection.main,a=n?Math.min(l.from,l.to):-1,c=n?Math.max(l.from,l.to):-1;e.iterate({from:0,to:i.doc.length,enter:h=>{var p,m;if(h.name==="Table"||h.name.startsWith("Table"))return!1;const u=h.node.parent,f=(u==null?void 0:u.name)??null;let d=h.to;(h.name==="HeaderMark"||h.name==="QuoteMark")&&i.doc.sliceString(d,d+1)===" "&&(d+=1);const O=AL(h.name,f,(u==null?void 0:u.from)??null,(u==null?void 0:u.to)??null,h.from,d);if(O){const g=XL(i,O,a,c)?Ro:Gn;r.push(g.range(h.from,d))}if(h.name==="ListMark"){const g=h.node.parent;if(g&&g.name==="ListItem"){const b=EL(g),v=((p=g.parent)==null?void 0:p.name)==="OrderedList";if(!b&&!v){const x=Hh(i,h.node),y=Fh(i,h.node);gn(a,c,x.from,x.to)?(Kh(i,h.node,r),r.push(Gn.range(y.from,y.to))):r.push(Ro.range(x.from,x.to))}else if(v){const x=i.doc.lineAt(h.node.from),y=Hh(i,h.node);x.from<h.node.from&&(gn(a,c,y.from,y.to)?Kh(i,h.node,r):r.push(Ro.range(x.from,h.node.from))),r.push(Gn.range(h.node.from,h.node.to))}}}if(h.name==="InlineCode"){const g=h.node.firstChild,b=h.node.lastChild;g&&b&&g!==b&&g.name==="CodeMark"&&b.name==="CodeMark"&&g.to<b.from&&r.push(mL.range(g.to,b.from))}if(h.name==="ListItem"){const g=Kn(h.node,"ListMark"),b=Kn(h.node,"Task"),v=Kn(h.node,"TaskMarker")??(b?Kn(b,"TaskMarker"):null),x=v!==null,y=((m=h.node.parent)==null?void 0:m.name)==="OrderedList";let k=!1;if(g){const Q=v?bg(i,h.node,v):Hh(i,g);k=gn(a,c,Q.from,Q.to)}if(_L(i,h.node,s,k),!x&&!y&&g&&!k){const Q=i.doc.lineAt(h.from);o.add(Q.from)}}else if(h.name==="Blockquote")wg(i,h.from,h.to,bL,r);else if(h.name==="ATXHeading1"){const g=i.doc.lineAt(h.from);r.push(SL.range(g.from))}else if(h.name==="ATXHeading2"){const g=i.doc.lineAt(h.from);r.push(vL.range(g.from))}else if(h.name==="FencedCode"){const g=gg(i,h.node);wg(i,g.from,g.to,wL,r)}if(h.name==="Link"){let g=null,b=null,v=null,x=h.node.firstChild;for(;x;)x.name==="LinkMark"?g===null?g=x:b=x:x.name==="URL"&&(v=x),x=x.nextSibling;if(g&&b&&v&&g.to<b.from){const y=i.doc.sliceString(v.from,v.to),k=J.mark({class:nO,tagName:"a",attributes:{"data-href":y}});r.push(k.range(g.to,b.from))}}if(h.name==="CodeMark"&&f==="FencedCode"){const g=h.node.parent;if(g){const b=gg(i,g);if(b.closed){const v=gn(a,c,b.from,b.to)?Gn:Ro;r.push(v.range(h.from,h.to))}else r.push(Gn.range(h.from,h.to))}}if(h.name==="HorizontalRule"){const g=i.doc.lineAt(h.from);g.to>g.from&&!gn(a,c,g.from,g.to)&&r.push(kL.range(g.from,g.to))}if(h.name==="TaskMarker"){const g=LL(h.node),b=g?Kn(g,"ListMark"):null,v=g?bg(i,g,h.node):{from:h.from,to:h.to};if(gn(a,c,v.from,v.to)){if(b){const y=Fh(i,b);Kh(i,b,r),r.push(Gn.range(y.from,y.to))}r.push(Gn.range(h.from,h.to))}else{if(b){const E=Fh(i,b),W=i.doc.lineAt(b.from).from;r.push(Ro.range(W,E.to))}const y=i.doc.sliceString(h.from,h.to),k=y==="[x]"||y==="[X]",Q=J.replace({widget:new QL(k,h.from,h.to)});r.push(Q.range(h.from,h.to))}}}});for(const[h,u]of s)r.push(zL(u).range(h));for(const h of o)r.push(gL.range(h));return DL(i,e,r),J.set(r,!0)}const YL=di.fromClass(class{constructor(i){P(this,"decorations");this.decorations=Sg(i.state,i.visibleRanges,St(i.state),i.hasFocus)}update(i){(i.docChanged||i.selectionSet||i.viewportChanged||i.focusChanged||St(i.state)!==St(i.startState))&&(this.decorations=Sg(i.state,i.view.visibleRanges,St(i.state),i.view.hasFocus))}},{decorations:i=>i.decorations}),WL=z.theme({"&":{fontFamily:"var(--font-sans)",fontSize:"calc(var(--text-base) + 0.5px)",lineHeight:"1.5"},".cm-scroller":{fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit"},".cm-content":{fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",padding:"1.5rem 1rem"},[`.${Ev}`]:{fontFamily:"var(--font-mono)"},[`.${Qv}`]:{fontFamily:"var(--font-mono)",fontSize:"0.9em"},[`.${Av}`]:{fontSize:"1.3em"},[`.${Zv}`]:{fontSize:"1.1em"},[`.${$v}`]:{fontFamily:"var(--font-mono)",fontSize:"0.92em",padding:"1px 4px",borderRadius:"3px"},[`.${Xv}`]:{borderRadius:"var(--radius-pill)",padding:"0 0.35em",fontWeight:"600",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone"},[`.${Qf}`]:{paddingLeft:`calc(0.5rem + var(--cm-md-list-indent, 0) * ${OL})`},[`.${Qf}.${$f}`]:{borderLeft:`${pg} solid transparent`},[`.${$f}::before`]:{content:"'•'",marginLeft:`calc(-1 * ${pg})`,fontFamily:"var(--font-mono)",fontSize:"0.9em",paddingRight:"0.5rem"},[`.${Cv}`]:{borderLeft:"3px solid transparent",paddingLeft:"1rem",marginLeft:"0.25rem"},[`.${Pv}`]:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:"0.92em",paddingLeft:"0.75em"},[`.${Tv}`]:{display:"inline-block",verticalAlign:"middle",border:"none",borderTop:"1px solid transparent",margin:0,width:"100%"},[`.${Rv}`]:{margin:"0 0.4em 0 0",cursor:"default",verticalAlign:"middle"},[`a.${nO}`]:{textDecoration:"underline",textUnderlineOffset:"0.15em",cursor:"pointer"}}),VL=4;function Mv(i){return i instanceof Element?i.closest(`a.${nO}`):null}function BL(i){const t=i.getAttribute("data-href");if(t===null)return null;try{return new URL(t,window.document.baseURI).href}catch{return null}}function zv(){return window.__televisionContentBridge}function qL(i){const t={type:"navigation-request",url:i},e=zv();if(e){e.postToHost(t);return}window.parent.postMessage(t,"*")}function NL(i){const t=zv();if(t!=null&&t.openApplicationLink){t.openApplicationLink(i);return}window.location.href=i}function GL(i,t){return Math.hypot(t.clientX-i.x,t.clientY-i.y)>VL}let Ir=null;function vg(i){const t=Mv(i.target);if(!t||i.altKey)return Ir=null,!1;const e=Ir;if(Ir=null,!e||e.anchor!==t)return!1;if(i.preventDefault(),GL(e,i))return!0;const n=kv(e.url,window.document.baseURI);return n.kind==="application"?NL(n.url):n.kind==="web"&&e.openExternally?window.open(n.url,"_blank","noopener,noreferrer"):n.kind==="web"&&qL(n.url),!0}const UL=z.domEventHandlers({mousedown(i){const t=Mv(i.target);if(Ir=null,!t||i.button!==0&&i.button!==1||i.altKey)return!1;const e=BL(t);return e===null||i.button===1&&kv(e,window.document.baseURI).kind!=="application"?!1:(Ir={anchor:t,url:e,openExternally:i.metaKey||i.ctrlKey,x:i.clientX,y:i.clientY},i.preventDefault(),!0)},click(i){return i.button!==0?!1:vg(i)},auxclick(i){return i.button!==1?!1:vg(i)}}),HL=/^(\d+)([.)])(\s|$)/;function FL(i){const t=[];let e=!1,n=1;for(let r=1;r<=i.doc.lines;r+=1){const s=i.doc.line(r),o=HL.exec(s.text);o?(e||(e=!0,n=1),parseInt(o[1],10)!==n&&t.push({from:s.from,to:s.from+o[1].length,insert:String(n)}),n+=1):s.text===""&&(e=!1)}return t}const xg=ti.define(),KL=K.transactionFilter.of(i=>{if(!i.docChanged||i.annotation(xg))return i;const t=i.annotation(Tt.userEvent);if(t==="undo"||t==="redo")return i;const e=FL(i.state);if(e.length===0)return i;const n=Lt.of(e,i.state.doc.length),r=i.changes.compose(n);return i.startState.update({changes:r,selection:i.selection,scrollIntoView:i.scrollIntoView,effects:i.effects,annotations:[xg.of(!0),...t?[Tt.userEvent.of(t)]:[]],filter:!1})}),JL=/^(\s*)([-*]|\d+[.)])(\s\[[ xX]\])?\s$/,t4=i=>{const{state:t}=i,e=t.selection.main;if(e.from!==e.to)return!1;const n=t.doc.lineAt(e.from),r=n.text.slice(0,e.from-n.from);return JL.test(r)?(i.dispatch({changes:{from:e.from-1,to:e.from,insert:""},selection:{anchor:e.from-1},userEvent:"delete.backward",scrollIntoView:!0}),!0):!1},e4=hn.highest(_n.of([{key:"Backspace",run:t4}])),i4=[YL,WL,KL,e4,UL],n4=500,yg=ti.define(),r4=Zc.define([{tag:S.heading,fontWeight:"600"},{tag:S.strong,fontWeight:"600"},{tag:S.emphasis,fontStyle:"italic"},{tag:S.strikethrough,textDecoration:"line-through"}]);function kg(i){const t=i.length;return({state:e,dispatch:n})=>{const r=e.changeByRange(s=>{if(s.empty)return{changes:{from:s.from,insert:i+i},range:C.cursor(s.from+t)};const o=e.sliceDoc(s.from,s.to);if(o.length>=t*2&&o.startsWith(i)&&o.endsWith(i))return{changes:[{from:s.from,to:s.from+t},{from:s.to-t,to:s.to}],range:C.range(s.from,s.to-t*2)};const l=s.from>=t&&e.sliceDoc(s.from-t,s.from)===i,a=s.to+t<=e.doc.length&&e.sliceDoc(s.to,s.to+t)===i;return l&&a?{changes:[{from:s.from-t,to:s.from},{from:s.to,to:s.to+t}],range:C.range(s.from-t,s.to-t)}:{changes:[{from:s.from,insert:i},{from:s.to,insert:i}],range:C.range(s.from+t,s.to+t)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}const s4=hn.highest(_n.of([{key:"Mod-b",run:kg("**")},{key:"Mod-i",run:kg("*")},{key:"Enter",run:O1({nonTightLists:!1})}])),o4=oc.default.with({"--tbl-style-font-family":"var(--font-sans)","--tbl-style-font-size":"inherit","--tbl-style-menu-font-family":"var(--font-sans)","--tbl-style-menu-font-size":"var(--text-sm, 0.875rem)","--tbl-style-default-header-alignment":"left"}),l4=fL({theme:dl.light,style:o4,selectionType:"native",handlePosition:"outside",lineWrapping:"wrap",extensions:[_n.of(ew)],globalKeyBindings:[...C0]}),_v=[$Q(),fo.of(" "),s4,_n.of([...ew,...C0,T$]),_c({extensions:[Qw,hd,{remove:["SetextHeading"]}]}),w0(r4),z.lineWrapping,i4,l4];function a4(i){const{parent:t,ctx:e}=i,n=i.debounceMs??n4;let r=null,s=null,o=null;const l=f=>{h.state.doc.toString()!==f&&h.dispatch({changes:{from:0,to:h.state.doc.length,insert:f},annotations:[yg.of(!0),Tt.addToHistory.of(!1)]})},a=async()=>{o=null;const f=h.state.doc.toString();r=f;try{await e.updateContent(f),s=f}catch{const d=s??"";l(d),r=d}},c=z.updateListener.of(f=>{!f.docChanged||f.transactions.some(O=>O.annotation(yg))||(o!==null&&clearTimeout(o),o=setTimeout(()=>{a()},n))}),h=new z({parent:t,state:K.create({doc:"",extensions:[_v,c]})}),u=f=>{const d=f.content;r!==null&&d===r||(l(d),s=d)};return e.addEventListener("content-updated",u),{view:h,dispose(){o!==null&&(clearTimeout(o),o=null),e.removeEventListener("content-updated",u),h.destroy()}}}const c4=`# Heading 1
|
|
65
65
|
|
|
66
66
|
Some paragraph text with **bold**, *italic*, \`inline code\`, and an [inline link](https://example.com).
|
|
67
67
|
|
|
@@ -113,9 +113,9 @@ Above the rule.
|
|
|
113
113
|
---
|
|
114
114
|
|
|
115
115
|
Below the rule.
|
|
116
|
-
`,Cf=document.getElementById("editor");if(!Cf)throw new Error("Editor mount point #editor not found");const Iv=!!window.__televisionContentBridge,jv=window.parent!==window,
|
|
116
|
+
`,Cf=document.getElementById("editor");if(!Cf)throw new Error("Editor mount point #editor not found");const Iv=!!window.__televisionContentBridge,jv=window.parent!==window,h4=!Iv&&!jv;jv&&sx(window);const Go=h4?null:Iv?new rx:new nx;let Qg=0;Go==null||Go.onStylesChanged(()=>{const i=document.querySelector('link[data-television-style="canonical"]');if(!i)return;const t=new URL(i.href);Qg+=1,t.searchParams.set("tv-styles",`${Date.now()}-${Qg}`),i.href=t.href});const u4=Go===null?new z({parent:Cf,state:K.create({doc:c4,extensions:_v})}):a4({parent:Cf,ctx:Go}).view;window.__cmView=u4;
|
|
117
117
|
</script>
|
|
118
|
-
<style>html,body{height:100%;overscroll-behavior-x:contain;overscroll-behavior-y:contain}body{display:flex;letter-spacing:.015em}#editor{flex:1;min-width:0;overflow:auto}.cm-editor{height:100%}.cm-editor .tbl-header-cell{font-weight:var(--font-weight-semibold)}#editor .cm-content{caret-color:currentColor}#editor .cm-cursor,#editor .cm-dropCursor{border-left-color:currentColor}
|
|
118
|
+
<style>html,body{height:100%;overscroll-behavior-x:contain;overscroll-behavior-y:contain}body{display:flex;letter-spacing:.015em}#editor{flex:1;min-width:0;overflow:auto}.cm-editor{height:100%}.cm-editor .tbl-header-cell{font-weight:var(--font-weight-semibold)}input.cm-md-task-checkbox{height:32px;padding:0 12px;border:.5px solid transparent;border-radius:12px;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}#editor>.cm-editor{color:var(--color-text);--tbl-theme-row-background: transparent;--tbl-theme-header-row-background: var(--color-surface-muted);--tbl-theme-even-row-background: transparent;--tbl-theme-odd-row-background: transparent;--tbl-theme-border-color: var(--color-border);--tbl-theme-border-hover-color: color-mix(in srgb, var(--color-text) 22%, transparent);--tbl-theme-border-active-color: color-mix(in srgb, var(--color-text) 40%, transparent);--tbl-theme-outline-color: var(--color-primary);--tbl-theme-text-color: var(--color-text);--tbl-theme-menu-border-color: var(--color-border);--tbl-theme-menu-background: var(--color-surface);--tbl-theme-menu-hover-background: var(--option-background-highlighted);--tbl-theme-menu-text-color: var(--color-text);--tbl-theme-menu-hover-text-color: var(--color-text);--tbl-theme-select-all-focus-overlay: var(--tint-primary);--tbl-theme-select-all-blur-overlay: color-mix(in srgb, var(--color-text) 8%, transparent)}#editor>.cm-editor.cm-focused{outline-color:var(--color-primary)}#editor>.cm-editor .cm-tooltip{color:var(--color-text);border-color:var(--color-border);background-color:var(--color-surface)}#editor>.cm-editor[data-tbl-handle-position=outside] .tbl-handle[data-type=header][data-active]{color:var(--color-primary-text)}#editor .cm-content{caret-color:currentColor}#editor .cm-cursor,#editor .cm-dropCursor{border-left-color:currentColor}#editor .cm-md-mark,#editor .cm-md-list-bullet:before,#editor .cm-md-blockquote-line{color:var(--color-text-muted)}#editor .cm-md-blockquote-line{border-left-color:var(--color-border)}#editor .cm-md-inline-code,#editor .cm-md-fenced-line{background-color:var(--color-surface-muted)}#editor .cm-md-tag{color:var(--color-primary);background-color:color-mix(in srgb,currentColor 8%,transparent)}#editor .cm-md-hr{border-top-color:var(--color-border)}#editor a.cm-md-link{color:var(--color-link)}#editor input.cm-md-task-checkbox{accent-color:var(--checkbox-color);border-color:color-mix(in srgb,currentColor 22%,transparent);background:color-mix(in srgb,currentColor 8%,transparent)}
|
|
119
119
|
</style>
|
|
120
120
|
</head>
|
|
121
121
|
<body>
|