open-grid 1.6.1 → 1.7.1
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/CHANGELOG.md +62 -0
- package/dist/ExportProgressView-BYPw8osg.cjs +2 -0
- package/dist/ExportProgressView-Bt5-z7rE.js +2 -0
- package/dist/LcpMergeOrderer-CeP6C6G1.cjs +2 -0
- package/dist/LcpMergeOrderer-Ebwuir-r.js +2 -0
- package/dist/OpenGrid-Bh1NMOcm.cjs +98 -0
- package/dist/OpenGrid-CeXt04ho.js +98 -0
- package/dist/Registry-CrT46EAO.js +2 -0
- package/dist/Registry-DpHOpU5V.cjs +2 -0
- package/dist/XlsxChannel-CuOZ3LQz.js +2 -0
- package/dist/XlsxChannel-DQHLGend.cjs +2 -0
- package/dist/XlsxWorkbookWriter-DixuNGtw.cjs +3 -0
- package/dist/XlsxWorkbookWriter-VgbibI0Z.js +3 -0
- package/dist/fflate-Cs3txMgg.js +2 -0
- package/dist/fflate-G9RAFEgF.cjs +2 -0
- package/dist/index-1OXjJmct.js +2 -0
- package/dist/index-B5V7e4Xc.js +2 -0
- package/dist/index-DbKDox8y.cjs +2 -0
- package/dist/index-HaDoF1HM.cjs +2 -0
- package/dist/open-grid-react.cjs +1 -27
- package/dist/open-grid-react.js +1 -30
- package/dist/open-grid-vue.cjs +1 -31
- package/dist/open-grid-vue.js +1 -33
- package/dist/open-grid.cjs +6 -275
- package/dist/open-grid.js +6 -293
- package/dist/sinks-BCZFMGQJ.cjs +2 -0
- package/dist/sinks-qkBJ5bKn.js +2 -0
- package/dist/types/core/CFRenderBridge.d.ts +5 -1
- package/dist/types/core/CellEditManager.d.ts +26 -2
- package/dist/types/core/CellEventHandler.d.ts +6 -2
- package/dist/types/core/ColumnLayout.d.ts +8 -0
- package/dist/types/core/DataLayer.d.ts +48 -1
- package/dist/types/core/DetailManager.d.ts +43 -2
- package/dist/types/core/ExportManager.d.ts +25 -0
- package/dist/types/core/FindBarManager.d.ts +6 -2
- package/dist/types/core/FlatRowModel.d.ts +61 -3
- package/dist/types/core/FooterManager.d.ts +43 -1
- package/dist/types/core/FormulaController.d.ts +4 -4
- package/dist/types/core/GridComposer.d.ts +11 -1
- package/dist/types/core/GridRenderer.d.ts +84 -19
- package/dist/types/core/GroupTreeManager.d.ts +6 -4
- package/dist/types/core/KeyboardManager.d.ts +3 -2
- package/dist/types/core/MutationService.d.ts +10 -8
- package/dist/types/core/OpenGrid.d.ts +7 -5
- package/dist/types/core/RangeSelectionManager.d.ts +23 -2
- package/dist/types/core/RenderController.d.ts +126 -8
- package/dist/types/core/SortFilterManager.d.ts +10 -2
- package/dist/types/core/VirtualScroll.d.ts +12 -0
- package/dist/types/core/coordinate/CellTextPolicy.d.ts +58 -0
- package/dist/types/core/coordinate/ColumnGeometry.d.ts +60 -0
- package/dist/types/core/coordinate/ColumnWindow.d.ts +40 -0
- package/dist/types/core/coordinate/ColumnWindowPolicy.d.ts +89 -0
- package/dist/types/core/coordinate/ExtraColumns.d.ts +39 -0
- package/dist/types/core/coordinate/RangeRectCalculator.d.ts +35 -0
- package/dist/types/core/coordinate/ViewportHeightJudge.d.ts +28 -0
- package/dist/types/core/coordinate/geometryPorts.d.ts +250 -0
- package/dist/types/core/coordinate/ports.d.ts +5 -0
- package/dist/types/core/domain/footer/FooterValues.d.ts +50 -0
- package/dist/types/core/domain/footer/ports.d.ts +31 -0
- package/dist/types/core/domain/render/RenderPlanner.d.ts +17 -0
- package/dist/types/core/domain/render/RenderRequest.d.ts +91 -0
- package/dist/types/core/domain/render/ports.d.ts +169 -0
- package/dist/types/core/domain/resize/ResizeGesture.d.ts +25 -0
- package/dist/types/core/domain/resize/ResizeHitZone.d.ts +23 -0
- package/dist/types/core/domain/resize/ports.d.ts +64 -0
- package/dist/types/core/domain/sort/ComparisonOrderer.d.ts +11 -0
- package/dist/types/core/domain/sort/LcpMergeOrderer.d.ts +15 -0
- package/dist/types/core/domain/sort/RankIndex.d.ts +74 -0
- package/dist/types/core/domain/sort/SortCostEstimate.d.ts +36 -0
- package/dist/types/core/domain/sort/SortKeyColumn.d.ts +89 -0
- package/dist/types/core/domain/sort/SortKeyStore.d.ts +34 -0
- package/dist/types/core/domain/sort/Sorter.d.ts +54 -0
- package/dist/types/core/domain/sort/SyncSortRunner.d.ts +9 -0
- package/dist/types/core/domain/sort/commonPrefix.d.ts +5 -0
- package/dist/types/core/domain/sort/ports.d.ts +140 -0
- package/dist/types/core/export/ExportProgressView.d.ts +28 -0
- package/dist/types/core/export/channels/XlsxChannel.d.ts +38 -1
- package/dist/types/core/export/channels/XlsxRichTextRun.d.ts +14 -0
- package/dist/types/core/export/channels/XlsxSheetXml.d.ts +19 -0
- package/dist/types/core/export/channels/XlsxStyleEntries.d.ts +80 -0
- package/dist/types/core/export/channels/XlsxStylesRegistry.d.ts +20 -0
- package/dist/types/core/export/channels/XlsxWorkbookWriter.d.ts +20 -0
- package/dist/types/core/export/channels/XlsxXml.d.ts +6 -0
- package/dist/types/core/export/index.d.ts +2 -0
- package/dist/types/core/export/sinks.d.ts +81 -0
- package/dist/types/core/export/types.d.ts +63 -0
- package/dist/types/core/host/archCheck.d.ts +16 -1
- package/dist/types/core/i18n/locales/en.d.ts +6 -0
- package/dist/types/core/i18n/locales/ko.d.ts +6 -0
- package/dist/types/core/i18n/types.d.ts +8 -0
- package/dist/types/core/render/FooterView.d.ts +121 -0
- package/dist/types/core/render/GeometryApplier.d.ts +55 -0
- package/dist/types/core/render/HorizontalReveal.d.ts +26 -0
- package/dist/types/core/render/RangeOverlayAdapter.d.ts +10 -0
- package/dist/types/core/render/RenderScheduler.d.ts +225 -0
- package/dist/types/core/render/ResizeSinkAdapter.d.ts +35 -0
- package/dist/types/core/render/ScrollFollower.d.ts +34 -0
- package/dist/types/core/render/ScrollObserver.d.ts +47 -0
- package/dist/types/core/render/ScrollbarGutter.d.ts +19 -0
- package/dist/types/core/render/body/BodyEventRouter.d.ts +58 -0
- package/dist/types/core/render/body/BodyRowSet.d.ts +28 -0
- package/dist/types/core/render/body/BodyView.d.ts +185 -0
- package/dist/types/core/render/body/CellLocator.d.ts +36 -0
- package/dist/types/core/render/body/CellRegistry.d.ts +24 -0
- package/dist/types/core/render/body/ColumnPaintPlan.d.ts +19 -0
- package/dist/types/core/render/body/ExtraCellPainters.d.ts +20 -0
- package/dist/types/core/render/body/rows/BodyRowContext.d.ts +138 -0
- package/dist/types/core/render/body/rows/DataRowPainter.d.ts +58 -0
- package/dist/types/core/render/body/rows/DetailRowPainter.d.ts +24 -0
- package/dist/types/core/render/body/rows/GroupRowPainter.d.ts +32 -0
- package/dist/types/core/render/body/rows/RowPainterTable.d.ts +24 -0
- package/dist/types/core/render/body/rows/WindowLayout.d.ts +38 -0
- package/dist/types/core/render/dom.d.ts +10 -0
- package/dist/types/core/render/header/HeaderSortIndicator.d.ts +39 -0
- package/dist/types/core/render/header/HeaderView.d.ts +84 -0
- package/dist/types/core/render/header/ResizeHandleBinder.d.ts +110 -0
- package/dist/types/core/render/ports.d.ts +218 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +7 -0
- package/dist/types/core/types.d.ts +94 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/vue/OpenGrid.vue.d.ts +1 -1
- package/dist/xlsx.min-CMvrM6b4.cjs +138 -0
- package/dist/xlsx.min-i_b-4PvU.js +138 -0
- package/package.json +3 -8
- package/dist/OpenGrid-CLk8Vt7j.cjs +0 -7459
- package/dist/OpenGrid-D6YxCsnV.js +0 -7472
- package/dist/Registry-CPJYOqCn.js +0 -74
- package/dist/Registry-D74ZmdDz.cjs +0 -71
- package/dist/index-CeJ-0-80.cjs +0 -260
- package/dist/index-D0DJtKYI.cjs +0 -452
- package/dist/index-DnarQ4eR.js +0 -266
- package/dist/index-VkKgQ506.js +0 -481
- package/dist/xlsx.min-BQ1o3sB6.cjs +0 -11793
- package/dist/xlsx.min-Bbz2ZypC.js +0 -11794
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";class EventEmitter{constructor(){this.listeners=new Map}on(e,s){const i=this.listeners.get(e)??[];return i.push({handler:s,once:!1}),this.listeners.set(e,i),this}once(e,s){const i=this.listeners.get(e)??[];return i.push({handler:s,once:!0}),this.listeners.set(e,i),this}off(e,s){if(!s)return this.listeners.delete(e),this;const i=this.listeners.get(e);if(i){const n=i.filter(r=>r.handler!==s);n.length===0?this.listeners.delete(e):this.listeners.set(e,n)}return this}emit(e,...s){const i=this.listeners.get(e);if(!i||i.length===0)return!1;const n=[];for(const r of i)r.handler(...s),r.once||n.push(r);return n.length!==i.length&&(n.length===0?this.listeners.delete(e):this.listeners.set(e,n)),!0}removeAllListeners(e){return e?this.listeners.delete(e):this.listeners.clear(),this}listenerCount(e){var s;return((s=this.listeners.get(e))==null?void 0:s.length)??0}}class VirtualScroll{constructor(e,s){this._totalRows=0,this.$cW=0,this.$ef=0,this.$dT=null,this.$bx=()=>{this.$cW=this.container.scrollTop,this.$fq(!0)},this.container=e,this.rowHeight=s.rowHeight,this.overscan=s.overscan??5,this.onRender=s.onRender,this.$kf=s.requestRender??null,this.container.addEventListener("scroll",this.$bx,{passive:!0})}$fq(e=!1){const s=this.$kf;if(s!==null){const i=this.getVisibleRange();s(i.startIndex,i.endIndex,e);return}this.$dT===null&&(this.$dT=requestAnimationFrame(()=>{this.$dT=null;const i=this.getVisibleRange();this.onRender(i.startIndex,i.endIndex)}))}getVisibleRange(){const e=Math.ceil(this.$ef/this.rowHeight),s=Math.max(0,Math.floor(this.$cW/this.rowHeight)-this.overscan),i=Math.min(this._totalRows-1,s+e+this.overscan*2),n=s*this.rowHeight;return{startIndex:s,endIndex:i,offsetY:n}}setTotalRows(e){this._totalRows=e,this.$kP(),this.$fq()}setViewportHeight(e){e!==this.$ef&&(this.$ef=e,this.$fq())}setRowHeight(e){this.rowHeight=e,this.$kP(),this.$fq()}scrollToRow(e){const s=e*this.rowHeight,i=s+this.rowHeight,n=this.$cW+this.$ef;if(s<this.$cW)this.$cW=s,this.container.scrollTop=s;else if(i>n){const r=i-this.$ef;this.$cW=r,this.container.scrollTop=r}}getTotalHeight(){return this._totalRows*this.rowHeight}$kP(){const e=this.container.querySelector(".og-spacer");e&&(e.style.height=`${this.getTotalHeight()}px`)}destroy(){this.container.removeEventListener("scroll",this.$bx),this.$dT!==null&&cancelAnimationFrame(this.$dT)}}class ColumnLayout{constructor(e,s=0){this.$bo=[],this.$W=1,this._frozenCount=0,this.$fF=null,this.$al=e,this._frozenCount=s,this.$fc()}$fc(){const e=[];let s=0;const i=(n,r)=>{for(const l of n)l.children&&l.children.length>0?(i(l.children,r+1),this.$W=Math.max(this.$W,r+1)):e.push({...l,_colIndex:s++,_depth:r,_leaf:!0})};this.$W=1,i(this.$al,1),this.$bo=e,this.$fF=null}get leaves(){return this.$bo}get visibleLeaves(){return this.$fF??(this.$fF=this.$bo.filter(e=>!e.hidden))}get headerDepth(){return this.$W}get frozenCount(){return this._frozenCount}setFrozen(e){this._frozenCount=e}setColumns(e){this.$al=e,this.$fc()}hideColumn(e){const s=Array.isArray(e)?e:[e];this.$bo.forEach(i=>{s.includes(i.field)&&(i.hidden=!0)}),this.$fF=null}showColumn(e){const s=Array.isArray(e)?e:[e];this.$bo.forEach(i=>{s.includes(i.field)&&(i.hidden=!1)}),this.$fF=null}addColumn(e,s="last"){s==="last"?this.$al.push(e):s==="first"?this.$al.unshift(e):this.$al.splice(s,0,e),this.$fc()}removeColumn(e){const s=i=>i.filter(n=>n.field===e?!1:(n.children&&(n.children=s(n.children)),!0));this.$al=s(this.$al),this.$fc()}getColumnByField(e){return this.$bo.find(s=>s.field===e)}getColumnByIndex(e){return this.$bo[e]}getColumnIndex(e){return this.$bo.findIndex(s=>s.field===e)}buildHeaderCells(){const e=Array.from({length:this.$W},()=>[]);let s=0;const i=(n,r)=>{let l=0;for(const a of n)if(!a.hidden)if(a.children&&a.children.length>0){const h=i(a.children,r+1);h>0&&(e[r-1].push({column:a,colIndex:s,depth:r,colSpan:h,rowSpan:1}),l+=h)}else e[r-1].push({column:a,colIndex:s++,depth:r,colSpan:1,rowSpan:this.$W-r+1}),l++;return l};return i(this.$al,1),e}computeWidths(e,s=100){const i=this.visibleLeaves,n=i.filter(h=>h.flex),r=i.filter(h=>!h.flex&&h.width).reduce((h,c)=>h+c.width,0),l=n.reduce((h,c)=>h+(c.flex??1),0),a=Math.max(0,e-r);return i.map(h=>h.flex?Math.round(h.flex/l*a):h.width??s)}}function interpolate(o,e){return o.indexOf("{")===-1?o:o.replace(/\{\{|\}\}|\{(\w+)\}/g,(s,i)=>{if(s==="{{")return"{";if(s==="}}")return"}";const n=e?e[i]:void 0;return n===void 0?s:String(n)})}const KO_MESSAGES={contextMenu:{sortAsc:"오름차순 정렬",sortDesc:"내림차순 정렬",find:"찾기",exportExcel:"Excel로 저장",exportCsv:"CSV로 저장",print:"인쇄"},filter:{title:"필터",opContains:"포함",opEq:"같음",opNe:"같지 않음",opStartsWith:"시작",opEndsWith:"끝남",opGt:"보다 큼",opLt:"보다 작음",opGte:"이상",opLte:"이하",valuePlaceholder:"필터 값 입력...",clear:"초기화",apply:"적용",legend:"필터",clearAria:"필터 초기화",all:"전체"},findBar:{label:"찾기",placeholder:"검색어 입력...",searchAria:"그리드 내 검색",closeAria:"찾기 닫기",countBadge:"{n}건"},pagination:{rowsPerPage:"행/페이지:",rangeBadge:"{from}–{to} / {total}건",empty:"0건"},drag:{rowCount:"{count}개 행 이동"},crossGrid:{overlayAria:"그리드 필드 매핑",title:"필드 매핑",desc1:"두 그리드의 필드 구조가 다릅니다. <b>타깃 필드</b>마다 어떤 <b>소스 필드</b>의 값을 가져올지 지정하세요. ",desc2:"아래 스크립트를 복사해 <code>crossGridMapping</code> 에 baking 하면 다음부터는 이 창 없이 자동 변환됩니다.",emptyOption:"(비움)",scriptTitle:"생성된 변환 스크립트",copy:"복사",copied:"복사됨!",copyFailed:"복사 실패",cancel:"취소",applyMove:"적용 후 이동",scriptComment:"// crossGridMapping 옵션에 이 함수를 그대로 지정하세요."},shuttle:{toRight:"체크한 행을 오른쪽 그리드로 이동",toLeft:"체크한 행을 왼쪽 그리드로 이동",allRight:"왼쪽 전체를 오른쪽으로 이동",allLeft:"오른쪽 전체를 왼쪽으로 이동"},tree:{collapse:"접기",expand:"펼치기"},detail:{glyphLabel:"▤ 상세",glyphTooltip:"상세 보기",expandAria:"상세 패널 펼치기",collapseAria:"상세 패널 접기",expandedAnnounce:"행 상세 패널을 펼쳤습니다.",collapsedAnnounce:"행 상세 패널을 접었습니다.",collapsedAllAnnounce:"모든 상세 패널을 접었습니다.",depthLimitOpen:"중첩 깊이 한계({max})로 상세 패널을 열 수 없습니다.",depthLimitSubgrid:"중첩 깊이 한계({max})로 서브 그리드를 생성하지 않습니다."},worksheet:{addAria:"새 워크시트 추가"},editor:{datePick:"날짜 선택",select:"선택",cellPositionAnnounce:"{row}행 {col}열, {header}: {value}"},cell:{emptyValue:"빈 값",revealTooltip:"클릭하면 원문 표시",revealAria:"마스킹 해제",radioAria:"선택",barcodeAria:"바코드: {value}"},row:{selectAllAria:"전체 행 선택",selectAria:"{n}행 선택",moveAnnounce:"행 {from}을(를) {to}번째 위치로 이동"},group:{badge:"{label} ({count}건)",nullLabel:"(없음)"},pivot:{totalLabel:"합계"},data:{loadedAnnounce:"{count}행 데이터 로드됨",skippedCellsAnnounce:"쓰기 대상이 아닌 셀 {count}개를 건너뛰었습니다"},range:{selectionAnnounce:"{r1}행 {c1}열 ~ {r2}행 {c2}열, {n}개 셀 선택",formulaPreserved:"수식 셀 {count}개 보존",fillSkipped:"채우기 대상이 아닌 셀 {count}개를 건너뛰었습니다",fillHandleAria:"채우기 핸들"},sort:{asc:"오름차순",desc:"내림차순",none:"정렬 해제",announce:"{field} {dir} 정렬"},chart:{defaultTitle:"차트",badgeSampled:"샘플링됨 {to}/{from}행",badgeAggregated:"category 집계됨 ({op})",badgePieFirstSeries:"파이: 첫 시리즈만 표시",badgeNegativesAbs:"음수→절대값 표시 · bar 권장",badgeRangeFallback:"범위 소스 없음 · 선택 행으로 대체",badgeEngineFallback:"{engine} 미설치 · 내장 차트로 대체",announcePrefix:"차트 안내: {badges}",a11ySummary:"{title}: 카테고리 {categories}개, 시리즈 {series}",a11ySummaryNoTitle:"카테고리 {categories}개, 시리즈 {series}",a11yAltText:"{title}: {categories}개 카테고리별 {series} — 상세 값은 아래 표를 참고하세요",a11yNoData:"데이터 없음",tooltipEmpty:"없음",canvasDefault:"차트"},formulaError:{err:"수식 오류",ref:"참조 대상이 삭제됨",cycle:"순환 참조",div0:"0으로 나눔",name:"알 수 없는 함수/이름",value:"숫자가 아닌 값에 산술 연산",num:"수치 도메인 오류",fallback:"수식 오류"},formula:{cellErrorAnnounce:"{field} 셀 오류: {message}",ariaError:"수식 {src}, 오류: {message}",ariaValue:"수식 {src}, 값 {value}{approx}",approxSuffix:" (근사값)"},grid:{containerAria:"OPEN_GRID 데이터 그리드",emptyMessage:"데이터가 없습니다.",filterTooltip:"필터",detailRegion:"상세 내용"},export:{printSummary:"{rows}행 × {cols}열 · {date}",preparing:"내보내기를 준비하고 있어요…",exporting:"{done} / {total}행 내보내는 중 ({percent}%)",cancel:"취소",cancelled:"내보내기를 취소했어요",done:"내보내기를 마쳤어요",exportError:"내보내기에 실패했어요"}},KO_META={intlLocale:"ko-KR",dir:"ltr",exportFont:"맑은 고딕"},EN_MESSAGES={contextMenu:{sortAsc:"Sort ascending",sortDesc:"Sort descending",find:"Find",exportExcel:"Save as Excel",exportCsv:"Save as CSV",print:"Print"},filter:{title:"Filter",opContains:"Contains",opEq:"Equals",opNe:"Not equal",opStartsWith:"Starts with",opEndsWith:"Ends with",opGt:"Greater than",opLt:"Less than",opGte:"At least",opLte:"At most",valuePlaceholder:"Enter filter value...",clear:"Reset",apply:"Apply",legend:"Filter",clearAria:"Reset filter",all:"All"},findBar:{label:"Find",placeholder:"Enter search term...",searchAria:"Search within grid",closeAria:"Close find",countBadge:o=>o.n===1?"1 match":`${o.n} matches`},pagination:{rowsPerPage:"Rows per page:",rangeBadge:"{from}–{to} of {total}",empty:"0 rows"},drag:{rowCount:o=>o.count===1?"Move 1 row":`Move ${o.count} rows`},crossGrid:{overlayAria:"Grid field mapping",title:"Field mapping",desc1:"The two grids have different field structures. For each <b>target field</b>, choose which <b>source field</b> to pull its value from. ",desc2:"Copy the script below and bake it into <code>crossGridMapping</code> to convert automatically without this dialog next time.",emptyOption:"(none)",scriptTitle:"Generated conversion script",copy:"Copy",copied:"Copied!",copyFailed:"Copy failed",cancel:"Cancel",applyMove:"Apply and move",scriptComment:"// Assign this function to the crossGridMapping option as-is."},shuttle:{toRight:"Move checked rows to the right grid",toLeft:"Move checked rows to the left grid",allRight:"Move all from left to right",allLeft:"Move all from right to left"},tree:{collapse:"Collapse",expand:"Expand"},detail:{glyphLabel:"▤ Detail",glyphTooltip:"View detail",expandAria:"Expand detail panel",collapseAria:"Collapse detail panel",expandedAnnounce:"Row detail panel expanded.",collapsedAnnounce:"Row detail panel collapsed.",collapsedAllAnnounce:"All detail panels collapsed.",depthLimitOpen:"Nesting depth limit ({max}) reached — cannot open the detail panel.",depthLimitSubgrid:"Nesting depth limit ({max}) reached — subgrid will not be created."},worksheet:{addAria:"Add new worksheet"},editor:{datePick:"Pick a date",select:"Select",cellPositionAnnounce:"Row {row}, column {col}, {header}: {value}"},cell:{emptyValue:"empty",revealTooltip:"Click to reveal the original",revealAria:"Reveal masked value",radioAria:"Select",barcodeAria:"Barcode: {value}"},row:{selectAllAria:"Select all rows",selectAria:"Select row {n}",moveAnnounce:"Move row {from} to position {to}"},group:{badge:"{label} ({count})",nullLabel:"(none)"},pivot:{totalLabel:"Total"},data:{loadedAnnounce:o=>o.count===1?"1 row loaded":`${o.count} rows loaded`,skippedCellsAnnounce:o=>o.count===1?"Skipped 1 non-writable cell":`Skipped ${o.count} non-writable cells`},range:{selectionAnnounce:"Selected {n} cells from row {r1} column {c1} to row {r2} column {c2}",formulaPreserved:o=>o.count===1?"1 formula cell preserved":`${o.count} formula cells preserved`,fillSkipped:o=>o.count===1?"Skipped 1 non-fillable cell":`Skipped ${o.count} non-fillable cells`,fillHandleAria:"Fill handle"},sort:{asc:"ascending",desc:"descending",none:"unsorted",announce:"{field} sorted {dir}"},chart:{defaultTitle:"Chart",badgeSampled:"Sampled {to}/{from} rows",badgeAggregated:"Category aggregated ({op})",badgePieFirstSeries:"Pie: first series only",badgeNegativesAbs:"Negatives shown as absolute · bar recommended",badgeRangeFallback:"No range source · using selected rows",badgeEngineFallback:"{engine} not installed · using built-in chart",announcePrefix:"Chart notice: {badges}",a11ySummary:"{title}: {categories} categories, series {series}",a11ySummaryNoTitle:"{categories} categories, series {series}",a11yAltText:"{title}: {series} across {categories} categories — see the table below for detailed values",a11yNoData:"No data",tooltipEmpty:"none",canvasDefault:"Chart"},formulaError:{err:"Formula error",ref:"Reference was deleted",cycle:"Circular reference",div0:"Division by zero",name:"Unknown function/name",value:"Arithmetic on a non-numeric value",num:"Numeric domain error",fallback:"Formula error"},formula:{cellErrorAnnounce:"{field} cell error: {message}",ariaError:"Formula {src}, error: {message}",ariaValue:"Formula {src}, value {value}{approx}",approxSuffix:" (approx.)"},grid:{containerAria:"OPEN_GRID data grid",emptyMessage:"No data.",filterTooltip:"Filter",detailRegion:"Detail"},export:{printSummary:"{rows} rows × {cols} cols · {date}",preparing:"Preparing export…",exporting:"Exporting {done} / {total} rows ({percent}%)",cancel:"Cancel",cancelled:"Export cancelled",done:"Export complete",exportError:"Export failed"}},EN_META={intlLocale:"en-US",dir:"ltr",exportFont:"Calibri"};function splitDot(o){const e=o.indexOf(".");return e<0?[o,""]:[o.slice(0,e),o.slice(e+1)]}function ownLookup(o,e){if(!o)return;const[s,i]=splitDot(e),n=o[s];return n?n[i]:void 0}function deepMerge2(o,e){const s={};for(const i of Object.keys(o))s[i]={...o[i]};for(const i of Object.keys(e))s[i]={...s[i]??{},...e[i]};return s}class LocaleRegistry{constructor(e){this._locales=new Map,this._meta=new Map,this.$iy=new Map,this.$aB={},this.$h=new Map,this.$aq=new Set,this._parent=e,this.$E=e?e.$E:"ko"}register(e,s,i){return this._locales.set(e,s),i!=null&&i.extends&&this.$iy.set(e,i.extends),this.$h.clear(),{missingKeys:this.$kX().filter(l=>ownLookup(s,l)===void 0)}}extend(e,s){const i=this._locales.get(e)??{};return this._locales.set(e,deepMerge2(i,s)),this.$h.clear(),this}has(e){var s;return this._locales.has(e)||(((s=this._parent)==null?void 0:s.has(e))??!1)}get(e){return this._locales.get(e)}list(){const e=new Set(this._locales.keys());if(this._parent)for(const s of this._parent.list())e.add(s);return[...e]}setActive(e){if(!this.has(e)&&e!=="ko"){typeof console<"u"&&console.warn(`[LocaleRegistry] 미등록 로케일 "${e}" — 무시하고 현재 로케일 유지. / unknown locale, keeping current.`);return}this.$E=e}active(){return this.$E}child(){return new LocaleRegistry(this)}setOverride(e,s){var i;const[n,r]=splitDot(e),l=(i=this.$aB)[n]??(i[n]={});return l[r]=s,this.$h.clear(),this}applyOverrides(e){return this.$aB=deepMerge2(this.$aB,e),this.$h.clear(),this}t(e,s){const i=this.$mW(e);return i===void 0?(this.$aq.has(e)||(this.$aq.add(e),typeof console<"u"&&console.warn(`[LocaleRegistry] 미등록 메시지 키 "${e}" — 키 원문 반환. / unknown message key, returning the key.`)),e):typeof i=="function"?i(s??{}):interpolate(i,s)}meta(){return this.$ki(this.$E)??this.$ki("ko")??{intlLocale:this.$E}}$mW(e){const s=`${this.$E}\0${e}`,i=this.$h.get(s);if(i!==void 0)return i===null?void 0:i;const n=this.$cR(e);return this.$h.set(s,n===void 0?null:n),n}$cR(e){const s=this.$E;for(let n=this;n;n=n._parent){const r=ownLookup(n.$aB,e);if(r!==void 0)return r;const l=ownLookup(n._locales.get(s),e);if(l!==void 0)return l}const i=this.$lM(s);if(i&&i!==s&&this.$kh(i)!==void 0){const r=ownLookup2(this,i,e);if(r!==void 0)return r}if(s!=="ko"){const n=ownLookup2(this,"ko",e);if(n!==void 0)return n}}$kh(e){for(let s=this;s;s=s._parent){const i=s._locales.get(e);if(i)return i}}$lM(e){for(let s=this;s;s=s._parent){const i=s.$iy.get(e);if(i)return i}}$ki(e){for(let s=this;s;s=s._parent){const i=s._meta.get(e);if(i)return i}}$kX(){const e=this.$kh("ko");if(!e)return[];const s=[];for(const i of Object.keys(e)){const n=e[i];if(n)for(const r of Object.keys(n))s.push(`${i}.${r}`)}return s}_seed(e,s,i){this._locales.set(e,s),this._meta.set(e,i)}}function ownLookup2(o,e,s){for(let i=o;i;i=i._parent){const n=ownLookup(i._locales.get(e),s);if(n!==void 0)return n}}const localeRegistry=new LocaleRegistry;localeRegistry._seed("ko",KO_MESSAGES,KO_META),localeRegistry._seed("en",EN_MESSAGES,EN_META);function t(o,e){return localeRegistry.t(o,e)}class FilterPanel{constructor(e,s,i,n){this._field="",this.$bX=null,this.$jC=s,this.$gN=i,this._t=n??t,this.$d=document.createElement("div"),this.$d.className="og-filter-panel",this.$d.style.cssText=`
|
|
2
|
+
position:absolute;z-index:1000;min-width:200px;max-width:280px;
|
|
3
|
+
background:var(--og-row-bg,#fff);border:1px solid var(--og-border-color,#e0e0e0);
|
|
4
|
+
border-radius:var(--og-radius-md,4px);box-shadow:0 4px 16px rgba(0,0,0,0.15);
|
|
5
|
+
padding:10px;box-sizing:border-box;display:none;font-size:13px;
|
|
6
|
+
`,e.appendChild(this.$d)}open(e,s,i){var n;this._field=e,this.$d.innerHTML="";const r=document.createElement("div");r.textContent=this._t("filter.title"),r.style.cssText="font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);",this.$d.appendChild(r);const l=document.createElement("div");l.style.cssText="display:flex;gap:4px;margin-bottom:6px;";const a=document.createElement("select");a.style.cssText="flex:1;padding:3px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:var(--og-radius-md,3px);font-size:12px;";const h=[{label:this._t("filter.opContains"),value:"contains"},{label:this._t("filter.opEq"),value:"="},{label:this._t("filter.opNe"),value:"!="},{label:this._t("filter.opStartsWith"),value:"startsWith"},{label:this._t("filter.opEndsWith"),value:"endsWith"},{label:this._t("filter.opGt"),value:">"},{label:this._t("filter.opLt"),value:"<"},{label:this._t("filter.opGte"),value:">="},{label:this._t("filter.opLte"),value:"<="}];for(const m of h){const w=document.createElement("option");w.value=m.value,w.textContent=m.label,a.appendChild(w)}i[0]&&(a.value=i[0].operator),l.appendChild(a),this.$d.appendChild(l);const c=document.createElement("input");c.type="text",c.placeholder=this._t("filter.valuePlaceholder"),c.value=((n=i[0])==null?void 0:n.value)??"",c.style.cssText=`
|
|
7
|
+
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
8
|
+
border-radius:var(--og-radius-md,3px);font-size:12px;box-sizing:border-box;margin-bottom:8px;
|
|
9
|
+
outline:none;
|
|
10
|
+
`,c.addEventListener("keydown",m=>{m.key==="Enter"?u.click():m.key==="Escape"&&this.close()}),this.$d.appendChild(c);const d=document.createElement("div");d.style.cssText="display:flex;gap:6px;justify-content:flex-end;";const f=document.createElement("button");f.textContent=this._t("filter.clear"),f.style.cssText=`
|
|
11
|
+
padding:3px 10px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
12
|
+
border-radius:var(--og-radius-md,3px);background:#fff;cursor:pointer;font-size:12px;color:#666;
|
|
13
|
+
`,f.addEventListener("click",()=>{this.$gN(this._field),this.close()});const u=document.createElement("button");u.textContent=this._t("filter.apply"),u.style.cssText=`
|
|
14
|
+
padding:3px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
15
|
+
border-radius:var(--og-radius-md,3px);background:var(--og-primary,#1976d2);
|
|
16
|
+
color:#fff;cursor:pointer;font-size:12px;
|
|
17
|
+
`,u.addEventListener("click",()=>{const m=c.value.trim();m?this.$jC(this._field,[{operator:a.value,value:m}]):this.$gN(this._field),this.close()}),d.appendChild(f),d.appendChild(u),this.$d.appendChild(d);const p=s.getBoundingClientRect(),g=this.$d.parentElement.getBoundingClientRect();this.$d.style.top=`${p.bottom-g.top+2}px`,this.$d.style.left=`${Math.min(p.left-g.left,g.width-220)}px`,this.$d.style.display="block",requestAnimationFrame(()=>c.focus()),this.$bX&&document.removeEventListener("mousedown",this.$bX),this.$bX=m=>{!this.$d.contains(m.target)&&m.target!==s&&this.close()},setTimeout(()=>document.addEventListener("mousedown",this.$bX),0)}close(){this.$d.style.display="none",this.$bX&&(document.removeEventListener("mousedown",this.$bX),this.$bX=null)}get isOpen(){return this.$d.style.display!=="none"}destroy(){this.close(),this.$d.remove()}}const BORDER_COLOR_FALLBACK="#e0e0e0";class ThemeContext{constructor(e="default",s="default"){this.theme=e,this.skin=s}}class AppearanceResolver{constructor(e=new ThemeContext){this.$G=e}get context(){return this.$G}$hs(){return this.$G.skin!=="default"}setSkin(e){this.$G=new ThemeContext(this.$G.theme,e)}$fL(){return`var(--og-border-color,${BORDER_COLOR_FALLBACK})`}border(e){let s=(e==null?void 0:e.style)??"solid";if(e!=null&&e.state&&(s="solid"),this.$hs()){const i="var(--og-border-width, 1px)",n=e!=null&&e.state?"solid":`var(--og-border-style, ${s})`;return`${i} ${n} ${this.$fL()}`}return`1px ${s} ${this.$fL()}`}divider(){return this.$hs()?`var(--og-border-width, 1px) var(--og-divider-style, solid) ${this.$fL()}`:this.border()}texture(e){return e==="data"||e==="status"||e==="range"||e==="merge"||e==="focus"?"none":"var(--og-texture-bg, none)"}radius(e){return`${e}px`}cellPadding(){return"2px 8px"}elevation(e="md"){const s={sm:"0 1px 2px",md:"0 2px 6px",lg:"0 8px 24px"},i={sm:"0.07",md:"0.10",lg:"0.14"};return`var(--og-elevation-${e}, ${s[e]}) rgba(var(--og-shadow-ink, 0 0 0), var(--og-elevation-alpha-${e}, ${i[e]}))`}focusRing(e){let s=(e==null?void 0:e.width)??2,i=(e==null?void 0:e.style)??"solid";s<2&&(s=2),i==="none"&&(i="solid");const n=(e==null?void 0:e.color)??"var(--og-focus-border,var(--og-primary,#1976d2))";return this.$hs()&&(e==null?void 0:e.width)===void 0&&(e==null?void 0:e.style)===void 0?`var(--og-focus-width, 2px) var(--og-focus-style, solid) ${n}`:`${s}px ${i} ${n}`}}const defaultAppearance=new AppearanceResolver;function _el(o,e){const s=document.createElement(o);return e&&(s.className=e),s}function _style(o,e){Object.assign(o.style,e)}class CellRegistry{constructor(){this.$k=new Map}set(e,s,i){let n=this.$k.get(e);n||(n=new Map,this.$k.set(e,n)),n.set(s,i)}setRow(e,s){this.$k.set(e,s)}get(e,s){var i;return(i=this.$k.get(e))==null?void 0:i.get(s)}*cellsOfColumn(e){for(const s of this.$k.values()){const i=s.get(e);i&&(yield i)}}dropRow(e){this.$k.delete(e)}dropColumn(e,s){var i;(i=this.$k.get(e))==null||i.delete(s)}clear(){this.$k.clear()}get size(){let e=0;for(const s of this.$k.values())e+=s.size;return e}}function clamp$1(o,e){return Math.min(e.max,Math.max(e.min,o))}function widthAt(o,e){return Number.isFinite(e)?clamp$1(o.startWidth+(e-o.pressX),o):o.width}function commitOf(o,e){return e===o.startWidth?null:{ci:o.ci,width:e}}const nothing=()=>null,ignore=()=>{},IDLE={phase:"idle",press:(o,e,s,i,n)=>o.begin(e,s,i,n),move:nothing,release:nothing,cancel:nothing,lose:nothing,consumeClick:()=>!1,expireSwallow:ignore},PRESSED={phase:"pressed",press:ignore,move:(o,e)=>e===o.d.pressX||!Number.isFinite(e)?null:(o.to(DRAGGING),DRAGGING.move(o,e)),release:(o,e)=>e===o.d.pressX||!Number.isFinite(e)?(o.to(SWALLOWING),null):(o.to(DRAGGING),DRAGGING.release(o,e)),cancel:o=>(o.to(IDLE),null),lose:o=>(o.to(IDLE),null),consumeClick:o=>(o.to(IDLE),!0),expireSwallow:ignore},DRAGGING={phase:"dragging",press:ignore,move:(o,e)=>{const s=widthAt(o.d,e);return s===o.d.width?null:(o.d.width=s,s)},release:(o,e)=>{const s=widthAt(o.d,e);return o.d.width=s,o.to(SWALLOWING),commitOf(o.d,s)},cancel:o=>(o.to(SWALLOWING),{ci:o.d.ci,width:o.d.startWidth}),lose:o=>(o.to(SWALLOWING),commitOf(o.d,o.d.width)),consumeClick:()=>!0,expireSwallow:ignore},SWALLOWING={phase:"swallowing",press:(o,e,s,i,n)=>o.begin(e,s,i,n),move:nothing,release:nothing,cancel:nothing,lose:nothing,consumeClick:o=>(o.to(IDLE),!0),expireSwallow:o=>o.to(IDLE)};class ResizeGesture{constructor(){this.$f=IDLE;const e={ci:-1,startWidth:0,pressX:0,min:0,max:1/0,width:0};this.$aZ={d:e,to:s=>{this.$f=s,s===IDLE&&(e.ci=-1)},begin:(s,i,n,r)=>{if(!(r.min<=r.max))throw new RangeError(`invalid resize bounds: min ${r.min} > max ${r.max}`);!Number.isFinite(n)||!Number.isFinite(i)||(e.ci=s,e.startWidth=i,e.pressX=n,e.min=r.min,e.max=r.max,e.width=i,this.$f=PRESSED)}}}get phase(){return this.$f.phase}get column(){return this.$aZ.d.ci}press(e,s,i,n){this.$f.press(this.$aZ,e,s,i,n)}move(e){return this.$f.move(this.$aZ,e)}release(e){return this.$f.release(this.$aZ,e)}cancel(){return this.$f.cancel(this.$aZ)}lose(){return this.$f.lose(this.$aZ)}consumeClick(){return this.$f.consumeClick(this.$aZ)}expireSwallow(){this.$f.expireSwallow(this.$aZ)}}const RESIZE_HIT_HALF_PX=6;class ResizeHitZone{constructor(e=RESIZE_HIT_HALF_PX){this.$eG=e}columnFor(e,s,i,n){if(!Number.isFinite(e)||!Number.isFinite(s)||i<0)return-1;const r=s-e,l=r>=-this.$eG&&r<=this.$eG&&n(i),a=e>=-this.$eG&&e<=this.$eG&&i>0&&n(i-1);return l&&a?r<=e?i:i-1:l?i:a?i-1:-1}}const Change={RowsScrolled:1,ColsScrolled:2,ColWidth:4,RowSet:8,RowOrder:16,RowState:32,Focus:64,CellValue:128,Range:256,Columns:512,Viewport:1024,Appearance:2048,SortIndicator:4096,All:8191},px$1=o=>o,viewIndex=o=>o,leafColIndex=o=>o;function makeRect(o,e,s,i){return{x:px$1(o),y:px$1(e),w:px$1(Math.max(0,s)),h:px$1(Math.max(0,i))}}const NO_CELLS$1=Object.freeze([]);function cellOrder(o,e){return o.ri!==e.ri?o.ri-e.ri:o.field<e.field?-1:o.field>e.field?1:0}function frozenCell(o){return Object.isFrozen(o)?o:Object.freeze({ri:o.ri,field:o.field})}function isCanonical(o){if(!Object.isFrozen(o))return!1;for(let e=0;e<o.length;e++)if(!Object.isFrozen(o[e])||e>0&&cellOrder(o[e-1],o[e])>=0)return!1;return!0}function canonicalCells(o){if(o.length===0)return NO_CELLS$1;if(isCanonical(o))return o;const e=o.slice().sort(cellOrder),s=[];for(let i=0;i<e.length;i++){const n=e[i],r=s[s.length-1];r!==void 0&&r.ri===n.ri&&r.field===n.field||s.push(frozenCell(n))}return Object.freeze(s)}function unionCells(o,e){if(e.length===0)return o;if(o.length===0)return e;const s=[];let i=0,n=0;for(;i<o.length||n<e.length;){const r=o[i],l=e[n],a=r===void 0?1:l===void 0?-1:cellOrder(r,l);a<=0&&i++,a>=0&&n++,s.push(a<=0?r:l)}return Object.freeze(s)}function frozenRows(o){return o===null||o==="clear"||Object.isFrozen(o)?o:Object.freeze({start:o.start,end:o.end})}function frozenPos(o){return o===null||Object.isFrozen(o)?o:Object.freeze({ri:o.ri,ci:o.ci})}function minOrNull(o,e){return o===null?e:e===null||o<e?o:e}const _RenderRequest=class nt{constructor(e,s,i,n,r,l){this.changes=e,this.detail=Object.freeze({cells:s,focusTo:i,widthChangedFrom:n,rows:r,sync:l}),Object.freeze(this)}static of(e,s){if(!Number.isInteger(e)||e<0||e&-8192)throw new RangeError(`RenderRequest: unknown change bits ${e}`);return new nt(e,canonicalCells((s==null?void 0:s.cells)??NO_CELLS$1),frozenPos((s==null?void 0:s.focusTo)??null),(s==null?void 0:s.widthChangedFrom)??null,frozenRows((s==null?void 0:s.rows)??null),(s==null?void 0:s.sync)??!1)}static rowsInclusive(e,s){return nt.of(Change.All,{sync:!0,rows:{start:viewIndex(e),end:viewIndex(s+1)}})}has(e){return(this.changes&e)!==0}merge(e){return new RenderRequestAccumulator().add(this).add(e).freeze()}};_RenderRequest.NONE=new _RenderRequest(0,NO_CELLS$1,null,null,null,!1),_RenderRequest.REPAINT_VISIBLE=new _RenderRequest(Change.All,NO_CELLS$1,null,null,null,!0),_RenderRequest.REPAINT_CLEAR=new _RenderRequest(Change.All,NO_CELLS$1,null,null,"clear",!0),_RenderRequest.ROW_STATE=new _RenderRequest(Change.RowState,NO_CELLS$1,null,null,null,!0),_RenderRequest.SCROLLED=new _RenderRequest(Change.RowsScrolled,NO_CELLS$1,null,null,null,!1),_RenderRequest.WINDOW_CHANGED=new _RenderRequest(Change.All,NO_CELLS$1,null,null,null,!1);let RenderRequest=_RenderRequest;class RenderRequestAccumulator{constructor(){this._mask=0,this.$gm=null,this.$fG=null,this.$k=null,this.$cZ=!1,this.$ap=!1,this.$ct=NO_CELLS$1,this.$cu=NO_CELLS$1,this.$c=null}get pending(){return this.$ap}add(e){const s=e.detail;return this.$ap=!0,this._mask|=e.changes,s.focusTo!==null&&(this.$gm=s.focusTo),s.rows!==null&&(this.$k=s.rows),this.$fG=minOrNull(this.$fG,s.widthChangedFrom),this.$cZ=this.$cZ||s.sync,s.cells.length>0&&this.$kV(e instanceof RenderRequest?s.cells:canonicalCells(s.cells)),this}freeze(){const e=RenderRequest.of(this._mask,{cells:this.$lW(),focusTo:this.$gm,widthChangedFrom:this.$fG,rows:this.$k,sync:this.$cZ});return this.clear(),e}clear(){this._mask=0,this.$gm=null,this.$fG=null,this.$k=null,this.$cZ=!1,this.$ap=!1,this.$ct=NO_CELLS$1,this.$cu=NO_CELLS$1,this.$c=null}$kV(e){if(this.$c===null){if(this.$ct.length===0){this.$ct=e;return}if(this.$cu.length===0){this.$cu=e;return}this.$c=new Map,this.$gY(this.$ct),this.$gY(this.$cu),this.$ct=NO_CELLS$1,this.$cu=NO_CELLS$1}this.$gY(e)}$gY(e){const s=this.$c;for(let i=0;i<e.length;i++){const n=e[i];s.set(`${n.ri}\0${n.field}`,n)}}$lW(){return this.$c!==null?canonicalCells([...this.$c.values()]):unionCells(this.$ct,this.$cu)}}const BOUNDS$1={min:40,max:1/0},RESIZE_CURSOR="col-resize";class ResizeHandleBinder{constructor(e,s){this.$mN=e,this.$bj=s,this.$eC=new ResizeGesture,this.$nx=new ResizeHitZone,this.$fl=new Map,this.$eP=new Map,this.$gB=new WeakMap,this.$eI=null,this.$dr=null,this.$hj="",this.$jR=null,this.$L=null,this.$bl=null,this.$jh=()=>NaN}clear(e){this.$hq=e,this.$fl.clear(),this.$eP.clear(),this.$gB=new WeakMap,this.$fm()}connect(e){this.$jR=e}destroy(){var e,s,i;(e=this.$L)==null||e.end(),this.$L=null,(s=this.$bl)==null||s.abort(),this.$bl=null,this.clear(),(i=this.$eI)==null||i.abort(),this.$eI=null}bindHeader(e,s){var i;this.$jh=s,(i=this.$eI)==null||i.abort();const n=new AbortController;this.$eI=n;const r={signal:n.signal};e.addEventListener("mousemove",a=>this.$me(a),r),e.addEventListener("mouseleave",()=>this.$fm(),r);const l=a=>{if(this.$L){a.type==="mousedown"&&a.preventDefault();return}if(a.button!==0)return;const h=this.$iT(a);h&&this.$hN(a,h.th,h.ci)};e.addEventListener("pointerdown",l,r),e.addEventListener("mousedown",l,r)}leaf(e,s){s>=0&&this.$gB.set(e,s)}attach(e,s,i,n){i>=0&&(this.$fl.set(i,s),n!==void 0&&this.$eP.set(n,i));const r=a=>{if(this.$L){a.type==="mousedown"&&(a.stopPropagation(),a.preventDefault());return}a.button===0&&this.$hN(a,s,i)},l=this.$hq&&{signal:this.$hq};e.addEventListener("pointerdown",r,l),e.addEventListener("mousedown",r,l)}shouldSwallowClick(e){return this.$eC.consumeClick()}$iT(e){var s,i;const n=e.target;if(!n||(s=n.classList)!=null&&s.contains("og-resize-handle"))return null;const r=(i=n.closest)==null?void 0:i.call(n,"th");if(!r)return null;const l=this.$gB.get(r);if(l===void 0)return null;const a=this.$nx.columnFor(xInCell(e,n,r),this.$jh(l),l,c=>this.$fl.has(c)),h=a>=0?this.$fl.get(a):void 0;return h?{ci:a,th:h,cell:r}:null}$me(e){if(this.$eC.phase==="dragging"||this.$eC.phase==="pressed")return;const s=this.$iT(e);if(!s){this.$fm();return}const i=s.cell;this.$dr!==i&&(this.$fm(),this.$dr=i,this.$hj=i.style.cursor,i.style.cursor=RESIZE_CURSOR)}$fm(){this.$dr&&(this.$dr.style.cursor=this.$hj),this.$dr=null,this.$hj=""}$hN(e,s,i){var n;e.type==="mousedown"&&(e.stopPropagation(),e.preventDefault());const r=this.$eC,l=this.$jR,a=i>=0,h=l&&a?l.geometry.widthOf(leafColIndex(i)):this.$mN(s);if(r.press(i,h,e.clientX,l&&a?l.sink.boundsOf(i):BOUNDS$1),r.phase!=="pressed")return;const c=s.ownerDocument,d=c.defaultView,f="pointerId"in e&&typeof e.pointerId=="number"&&e.type==="pointerdown"?e.pointerId:null,u=e.target;let p;for(const[C,I]of this.$eP)if(I===i){p=C;break}const g=()=>p===void 0?i:this.$eP.get(p)??-1,m=new AbortController,w={signal:m.signal},y={ci:i,th:s,pointerId:f,lastWritten:h,end:()=>{m.abort(),this.$L===y&&(this.$L=null)}};this.$L=y;const v=(C,I)=>{if(a&&l){const L=g();if(L<0)return;l.widths.setWidth(leafColIndex(L),C),y.lastWritten=C,l.scheduler.submit(RenderRequest.of(Change.ColWidth,{widthChangedFrom:L,sync:I}))}else a||(s.style.width=`${C}px`,s.style.minWidth=`${C}px`)},_=()=>a&&!!l&&g()<0,b=()=>{const C=d??globalThis,I=L=>{r.consumeClick()&&L.stopPropagation()};C.addEventListener("click",I,{capture:!0,once:!0}),C.requestAnimationFrame(()=>{C.removeEventListener("click",I,{capture:!0}),r.expireSwallow()})},E=()=>{r.cancel(),y.end(),b()},x=C=>{if(_()){E();return}y.end(),!C&&a&&l&&y.lastWritten!==h&&v(h,!0),C&&a&&(l?(C.width!==y.lastWritten&&v(C.width,!0),l.sink.commit(g(),C.width),l.sink.needsHeaderRemeasure()&&l.sink.remeasureHeader()):this.$bj(i,C.width)),b()},S=C=>{if(f!==null&&C.pointerId!==f)return;if(_()){E();return}const I=r.move(C.clientX);I!==null&&v(I,!1)},M=C=>{f!==null&&C.pointerId!==f||x(r.release(C.clientX))},R=C=>{var I;if(C.key!=="Escape")return;C.preventDefault(),C.stopPropagation();const L=r.cancel();y.end(),(L&&a&&l||L&&!a)&&v(L.width,!1),(I=this.$bl)==null||I.abort();const T=new AbortController;this.$bl=T;const z=()=>{T.abort(),this.$bl===T&&(this.$bl=null),b()};c.addEventListener(f!==null?"pointerup":"mouseup",z,{capture:!0,signal:T.signal}),f!==null&&c.addEventListener("pointercancel",z,{capture:!0,signal:T.signal}),d==null||d.addEventListener("blur",()=>{T.abort(),this.$bl===T&&(this.$bl=null),r.expireSwallow()},{signal:T.signal})},k=()=>x(r.lose());if(f!==null){c.addEventListener("pointermove",S,w),c.addEventListener("pointerup",M,w),c.addEventListener("pointercancel",k,w);try{(n=u==null?void 0:u.setPointerCapture)==null||n.call(u,f)}catch{}u==null||u.addEventListener("lostpointercapture",()=>{u.isConnected&&k()},w)}else c.addEventListener("mousemove",S,w),c.addEventListener("mouseup",M,w);c.addEventListener("keydown",R,{signal:m.signal,capture:!0}),d==null||d.addEventListener("blur",k,w)}}function xInCell(o,e,s){let i=o.offsetX,n=e;for(;n&&n!==s;)i+=n.offsetLeft,n=n.offsetParent;return n===s?i:NaN}class HeaderView{constructor(e,s,i,n,r){this.$N=e,this.$T=s,this.$l=i,this.$aP=n,this.$bF=r,this.$e=null,this.$V=0,this.$hv=null,this.$t=null,this.$bE=null,this.$ae=new AbortController,this.$aP.bindHeader(this.$N,l=>this.$e?this.$e.widthOf(l):NaN)}setGeometry(e){this.$e=e}setEndGutter(e){e!==this.$V&&(this.$V=e,this.$hv&&(this.$hv.style.marginRight=e>0?`${e}px`:"0px"))}setSortIndicator(e){this.$bE=e}destroy(){this.$ae.abort(),this.$aP.destroy()}setApplier(e){this.$t=e}_t(e,s){return this.$bF(e,s)}height(){return this.$N.offsetHeight}paint(e,s,i,n,r){var l,a,h,c;this.$N.innerHTML="",this.$ae.abort(),this.$ae=new AbortController;const d=this.$ae.signal;this.$aP.clear(d),(l=this.$bE)==null||l.release();const f=this.$t;f==null||f.release("header");const u=this.$T,p=r._frozenCount??0,g=this.$e,m=g.extra,w=g.totalWidth();this.$N.style.background="var(--og-header-bg,#f5f5f5)";const y=_el("table","og-header-table");y.setAttribute("role","presentation"),y.style.cssText=`table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${w}px;background:var(--og-header-bg,#f5f5f5);`,f==null||f.trackTotal(y,"width","header"),this.$V>0&&(y.style.marginRight=`${this.$V}px`),this.$hv=y;const v=e.length,_=(x,S,M,R="")=>{const k=m.widthOf(S),C=_el("th",`og-header-cell og-extra-col ${R}`);C.setAttribute("rowspan",String(v)),C.textContent=M,_style(C,{width:`${k}px`,minWidth:`${k}px`,textAlign:"center",borderRight:u.border(),borderBottom:u.border(),borderTop:"0",borderLeft:"0",lineHeight:"normal",verticalAlign:"middle",padding:"0",fontSize:"11px",color:"#999",userSelect:"none",boxSizing:"border-box",background:"var(--og-header-bg,#f5f5f5)"}),p>0&&(C.style.position="sticky",C.style.left=`${m.leftOf(S)}px`,C.style.zIndex="4"),x.appendChild(C)},E={state:x=>_(x,"state",""),drag:x=>_(x,"drag",""),rowNumber:x=>_(x,"rowNumber","No"),check:x=>{const S=m.widthOf("check"),M=_el("th","og-header-cell og-extra-col");M.setAttribute("rowspan",String(v)),M.style.cssText=`width:${S}px;min-width:${S}px;text-align:center;border-right:${u.border()};border-bottom:${u.border()};border-top:0;border-left:0;line-height:normal;vertical-align:middle;background:var(--og-header-bg,#f5f5f5);box-sizing:border-box;`,p>0&&(M.style.position="sticky",M.style.left=`${m.leftOf("check")}px`,M.style.zIndex="4");const R=document.createElement("input");R.type="checkbox",R.setAttribute("aria-label",this._t("row.selectAllAria")),R.style.cssText="width:16px;height:16px;",R.addEventListener("change",()=>this.$l.onAllCheck(R.checked),{signal:d}),M.appendChild(R),x.appendChild(M)},detail:x=>_(x,"detail","","og-detail-toggle-col")};for(let x=0;x<e.length;x++){const S=_el("tr","og-header-row");if(S.style.height=`${r.headerHeight}px`,x===0)for(const M of m.ids)E[M](S);for(const M of e[x]??[]){const R=_el("th","og-header-cell"),k=M.column;M.colSpan>1&&(R.colSpan=M.colSpan),M.rowSpan>1&&(R.rowSpan=M.rowSpan);const C=M.colSpan===1?s.findIndex(F=>F.field===k.field):-1;if(M.colSpan===1){const F=C>=0?g.widthOf(C):k.width??r.defaultColumnWidth;R.style.width=`${F}px`,R.style.minWidth=`${F}px`,C>=0&&(f==null||f.trackHeaderCell(R,C,"wm"))}const I=n.find(F=>F.field===k.field),L=k.sortable!==!1&&r.sortable&&M.colSpan===1;R.setAttribute("role","columnheader"),R.setAttribute("scope","col"),L&&(R.classList.add("og-sortable"),R.setAttribute("aria-sort",I?I.dir==="asc"?"ascending":"descending":"none"),R.tabIndex=C===0?0:-1,R.addEventListener("keydown",F=>{if(F.key==="Enter"||F.key===" ")F.preventDefault(),this.$l.onHeaderClick(k.field,F.shiftKey);else if(F.key==="ArrowRight"){F.preventDefault();const N=R.nextElementSibling;(N==null?void 0:N.tagName)==="TH"&&N.focus()}else if(F.key==="ArrowLeft"){F.preventDefault();const N=R.previousElementSibling;(N==null?void 0:N.tagName)==="TH"&&N.focus()}},{signal:d})),C>=0&&C<p&&(R.classList.add("og-frozen"),C===p-1&&R.classList.add("og-frozen-last"),R.style.left=`${g.leftOf(C)}px`,f==null||f.trackLeft(R,C,"header"));const T=k.header??k.field,z=typeof T=="string"&&T.indexOf(`
|
|
18
|
+
`)>=0,K=k.headerWrap===!0||z;_style(R,{padding:"4px 8px",boxSizing:"border-box",background:"var(--og-header-bg)",color:"var(--og-header-color)",lineHeight:K?"1.3":"normal",verticalAlign:"middle",fontSize:"var(--og-font-size)",textAlign:k.headerAlign??"center",borderTop:"0",borderLeft:"0",borderRight:u.border(),borderBottom:u.border(),userSelect:"none",cursor:L?"pointer":"default",whiteSpace:K?"normal":"nowrap",overflow:K?"visible":"hidden",textOverflow:K?"clip":"ellipsis",wordBreak:K?"break-word":"normal",position:"relative"}),R.title=(typeof k.tooltip=="string"?k.tooltip:T)??"";const H=_el("span");if(K?(H.style.cssText="overflow:visible;text-overflow:clip;white-space:normal;word-break:break-word;",String(T).split(`
|
|
19
|
+
`).forEach((N,W)=>{W>0&&H.appendChild(document.createElement("br")),H.appendChild(document.createTextNode(N))})):(H.textContent=T,H.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"),R.appendChild(H),I){R.classList.add("og-sorted");const F=_el("span","og-sort-icon");F.textContent=I.dir==="asc"?" ↑":" ↓",R.appendChild(F)}if(k.filterable!==!1&&r.filterable&&M.colSpan===1){const F=_el("span","og-filter-icon"),N=(((h=(a=r._activeFilters)==null?void 0:a[k.field])==null?void 0:h.length)??0)>0;F.textContent=N?"⊿":"▿",F.title=this._t("grid.filterTooltip"),F.style.cssText="margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;",N&&F.classList.add("og-filter-icon--active"),F.addEventListener("click",W=>{W.stopPropagation(),this.$l.onFilterIconClick(k.field,F)},{signal:d}),R.appendChild(F)}if(k.resizable!==!1){const F=_el("div","og-resize-handle");F.style.cssText="position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;",R.appendChild(F),this.$aP.attach(F,R,C,C>=0?k.field:void 0)}C>=0&&M.colSpan===1&&this.$aP.leaf(R,C),M.colSpan===1&&((c=this.$bE)==null||c.bind(R,k.field,L)),r.columnReorder&&C>=0&&M.colSpan===1&&(R.draggable=!0,R.addEventListener("dragstart",F=>{var N;this.$l.onColDragStart(C),R.classList.add("og-col-dragging"),(N=F.dataTransfer)==null||N.setData("text/plain",String(C))},{signal:d}),R.addEventListener("dragend",()=>{R.classList.remove("og-col-dragging"),this.$N.querySelectorAll(".og-col-drop-over").forEach(F=>F.classList.remove("og-col-drop-over"))},{signal:d}),R.addEventListener("dragover",F=>{F.preventDefault();const N=this.$l.getColDragIdx();N!==null&&N!==C&&(this.$N.querySelectorAll(".og-col-drop-over").forEach(W=>W.classList.remove("og-col-drop-over")),R.classList.add("og-col-drop-over"))},{signal:d}),R.addEventListener("dragleave",()=>{R.classList.remove("og-col-drop-over")},{signal:d}),R.addEventListener("drop",F=>{F.preventDefault(),R.classList.remove("og-col-drop-over"),this.$l.onColDrop(C)},{signal:d})),L&&R.addEventListener("click",F=>{this.$aP.shouldSwallowClick(F)||F.target.classList.contains("og-resize-handle")||this.$l.onHeaderClick(k.field,F.shiftKey)},{signal:d}),S.appendChild(R)}y.appendChild(S)}this.$N.appendChild(y)}}function stick(o,e,s){s.frozenCount>0&&(o.style.position="sticky",o.style.left=`${e}px`,o.style.zIndex="2",o.style.background=s.bg)}const STATE_ICONS={added:"✚",edited:"✎",removed:"✖",none:""},STATE_COLORS={added:"#2e7d32",edited:"#bf360c",removed:"#c62828",none:""};class StateCellPainter{constructor(){this.id="state"}paint(e,s,i,n){const r=_el("div","og-cell og-col-state");r.textContent=STATE_ICONS[n.rowState]??"",r.style.color=STATE_COLORS[n.rowState]??"",r.title=n.rowState,stick(r,n.extraLeft.state,n),e.appendChild(r)}}class DragCellPainter{constructor(){this.id="drag"}paint(e,s,i,n){const r=n.dnd;if(!r)return;const l=r.attachHandle(e,s,n.opts._totalRows??n.endIndex+1);stick(l,n.extraLeft.drag,n),e.appendChild(l)}}class RowNumberCellPainter{constructor(){this.id="rowNumber"}paint(e,s,i,n){const r=_el("div","og-cell og-col-rownum");r.textContent=String(s+1),stick(r,n.extraLeft.rowNumber-n.dragGap,n),e.appendChild(r)}}class CheckCellPainter{constructor(e,s){this.$l=e,this._t=s,this.id="check"}paint(e,s,i,n){const r=_el("div","og-cell og-col-check"),l=document.createElement("input");l.type="checkbox",l.checked=n.checkedRows.has(s),l.setAttribute("aria-label",this._t("row.selectAria",{n:s+1})),l.addEventListener("click",a=>a.stopPropagation()),l.addEventListener("change",a=>{a.stopPropagation(),this.$l.onRowCheck(s,l.checked)}),r.appendChild(l),stick(r,n.extraLeft.check-n.dragGap,n),e.appendChild(r)}}class DetailCellPainter{constructor(){this.id="detail"}paint(e,s,i,n){if(!n.detailColOn)return;const r=n.detailApi,l=_el("div","og-cell og-col-detail-toggle");l.style.cssText="display:flex;align-items:center;justify-content:center;flex-shrink:0;box-sizing:border-box;";const a=r.getRowId(i),h=!!a&&r.isExpanded(a),c=r.getGlyph(h),d=_detailExpanderButton(c,a,s,r);l.appendChild(d),stick(l,n.extraLeft.detail-n.dragGap,n);const f=n.detailWidth;l.style.width=`${f}px`,l.style.minWidth=`${f}px`,e.appendChild(l),a&&e.setAttribute("aria-expanded",h?"true":"false")}}function createExtraCellPainters(o,e){return Object.freeze({state:new StateCellPainter,drag:new DragCellPainter,rowNumber:new RowNumberCellPainter,check:new CheckCellPainter(o,e),detail:new DetailCellPainter})}class RowPainterTable{constructor(e){this.$hR=new Map;for(const s of e)this.$hR.set(s.kind,s)}kindOf(e){const s=e;if(s){if(s._isDetailFiller===!0)return"detail-filler";if(s._isDetailHead===!0)return"detail-head";if(s._isGroup===!0)return"group"}return"data"}painterFor(e){const s=this.$hR.get(e);if(!s)throw new Error(`[OpenGrid] no row painter for kind: ${String(e)}`);return s}}function layoutOf(o){const e=[],s=o.segments,i=o.gaps();let n=0,r=0;for(;n<s.length||r<i.length;){const h=s[n],c=i[r];h&&(!c||h.from<c.from)?(e.push({gap:!1,from:h.from,to:h.to}),n++):(e.push({gap:!0,from:c.from,to:c.to}),r++)}const l=e[e.length-1],a=e[e.length-2];return Object.freeze({pieces:Object.freeze(e),lastBeforeGap:l!=null&&l.gap&&a&&!a.gap?a.to:-1})}function paintGap(o,e,s){var i;const n=_el("div","og-col-gap");return n.style.cssText=`width:${s.geometry.spanWidth(leafColIndex(o),e-o+1)}px;flex-shrink:0;`,n.setAttribute("aria-hidden","true"),(i=s.applier)==null||i.trackGap(n,o,e,"body"),n}function reuseGap(o,e,s,i){var n;return o.style.width=`${i.geometry.spanWidth(leafColIndex(e),s-e+1)}px`,(n=i.applier)==null||n.trackGap(o,e,s,"body"),o}const ROW_BG="var(--og-row-bg,#fff)",ROW_ALT_BG="var(--og-row-alt-bg,#fafafa)",_FORMULA_ERROR_KEY$1={"#ERR":"formulaError.err","#REF":"formulaError.ref","#CYCLE":"formulaError.cycle","#DIV0":"formulaError.div0","#NAME":"formulaError.name","#VALUE":"formulaError.value","#NUM":"formulaError.num"};class DataRowPainter{constructor(e,s,i,n,r){this.$T=e,this.$l=s,this.$at=i,this.$bF=n,this.$lO=r,this.kind="data",this.$nr=(l,a)=>this.$bF(l,a),this.$lX=[],this.$as=document.createDocumentFragment()}_t(e,s){return this.$bF(e,s)}paint(e,s,i){const{opts:n,startIndex:r,offsetY:l,selectedRows:a,auto:h}=i;if(!this.$km(e,s,i))return null;const c=i.rowData,d=i.rowState,f=_el("div","og-row");if(f.setAttribute("role","row"),f.setAttribute("aria-rowindex",String(e+1)),!h){const m=l+(e-r)*n.rowHeight;f.style.top=`${m}px`,f.style.height=`${n.rowHeight}px`}f.style.background=e%2===0?ROW_BG:ROW_ALT_BG,d==="added"&&f.classList.add("og-state-added"),d==="edited"&&f.classList.add("og-state-edited"),d==="removed"&&f.classList.add("og-state-removed"),a.has(e)&&f.classList.add("og-selected"),f.setAttribute("aria-selected",a.has(e)?"true":"false");const u=new Map,p=this.$l.getDndManager();i.dnd=p,i.dragGap=n.draggable&&!p?i.dragWidth:0;const g=i.extraIds;for(let m=0;m<g.length;m++)this.$lO[g[m]].paint(f,e,c,i);return i.extraCount=f.childElementCount,this.$mI(f,e,i,u),this.$at.setRow(e,u),f}$mI(e,s,i,n){var r;const l=i.layout.pieces;for(let h=0;h<l.length;h++){const c=l[h];if(c.gap)e.appendChild(paintGap(c.from,c.to,i));else for(let d=c.from;d<=c.to;d++)this.$hW(e,s,d,i,n)}const a=i.layout.lastBeforeGap;a>=0&&((r=n.get(a))==null||r.classList.add("og-cell--last"))}shift(e,s,i,n,r,l){var a;if(!this.$km(s,i,r))return;const h=this.$at,c=r.columns,d=n.segments;for(let v=0;v<d.length;v++)for(let _=d[v].from;_<=d[v].to;_++){if(c.contains(leafColIndex(_)))continue;const b=h.get(s,_);b&&(l(b),b.remove(),h.dropColumn(s,_))}const f=r.applier,u=this.$lX;u.length=0;for(let v=e.children[r.extraCount]??null;v;){const _=v.nextElementSibling;v.classList.contains("og-col-gap")?(u.push(v),v.remove()):v.classList.remove("og-cell--last"),v=_}let p=0,g=r.extraCount>0?e.children[r.extraCount-1]??null:null;const m=r.layout.pieces,w=this.$as;for(let v=0;v<m.length;v++){const _=m[v];if(_.gap){const b=p<u.length?reuseGap(u[p++],_.from,_.to,r):paintGap(_.from,_.to,r);e.insertBefore(b,g?g.nextSibling:e.firstChild),g=b;continue}for(let b=_.from;b<=_.to;b++){const E=h.get(s,b);if(E){g=E;continue}this.$hW(w,s,b,r,null);const x=w.firstChild;e.insertBefore(w,g?g.nextSibling:e.firstChild),x&&(g=x)}}for(;p<u.length;p++)f==null||f.untrack(u[p]);u.length=0;const y=r.layout.lastBeforeGap;y>=0&&((a=h.get(s,y))==null||a.classList.add("og-cell--last"))}$km(e,s,i){const{data:n,groupFlatRows:r,selectedRows:l}=i,a=s&&s._isTree===!0,h=a?s:null,c=h?h.data:r?s:n.getRowByIndex(e);if(!c)return!1;const d=a?"none":n.getRowState(e);let f=e%2===0?ROW_BG:ROW_ALT_BG;return d==="added"&&(f="var(--og-row-added-bg,#e8f5e9)"),d==="edited"&&(f="var(--og-row-edited-bg,#fff8e1)"),d==="removed"&&(f="var(--og-row-removed-bg,#ffebee)"),l.has(e)&&(f="var(--og-row-selected-bg,#bbdefb)"),i.rowData=c,i.treeNode=h,i.rowState=d,i.bg=f,!0}$hW(e,s,i,n,r){var l,a,h,c,d,f,u,p,g,m,w,y,v,_,b,E,x;const{opts:S,leaves:M,startIndex:R,offsetY:k,selectedRows:C,mergeEngine:I,frozenCount:L,frag:T,applier:z}=n,K=this.$T,H=n.geometry,rt=H.count,F=n.rowData,N=n.rowState,W=n.bg,P=n.treeNode,O=M[i],tt=leafColIndex(i),Q=H.widthOf(tt),ot=S.editable&&O.editable!==!1,lt=i===0,Z=I&&!I.isEmpty?I.getInfo(s,i):null;if(Z!=null&&Z.hidden){const D=_el("div","og-cell og-cell--merge-ph");D.style.cssText=`width:${Q}px;min-width:${Q}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`,z==null||z.trackSpan(D,i,1,"wm","body"),e.appendChild(D);return}const A=_el("div","og-cell");A.setAttribute("role","gridcell"),A.setAttribute("aria-colindex",String(i+1));const Y=(Z==null?void 0:Z.rowSpan)??1,X=(Z==null?void 0:Z.colSpan)??1,st=Y>1?Y*S.rowHeight:S.rowHeight;let J=Q,at=!0;if(X>1){J=H.spanWidth(tt,X);const D=i+X-rt,$=D>0?D*S.defaultColumnWidth:0;D>0&&(J+=$,at=!1),z==null||z.trackSpan(A,i,X,"wmm","body",$)}const it=i<L;it&&(A.classList.add("og-frozen-cell"),i===L-1&&A.classList.add("og-frozen-last")),A.style.width=`${J}px`,A.style.minWidth=`${J}px`,A.style.maxWidth=`${J}px`,Y>1&&(A.style.height=`${st}px`),it&&(A.style.background=W),P&<&&(A.style.padding="0"),A.style.overflow="hidden",Y>1?(A.style.height=`${st}px`,A.style.position="absolute",A.style.zIndex="3",A.style.background=W&&W!=="inherit"?W:"var(--og-row-bg, #fff)",A.style.borderTop="0",A.style.borderLeft="0",A.style.borderBottom="1px solid var(--og-border-color, #e0e0e0)"):it&&(A.style.position="sticky",A.style.left=`${H.leftOf(tt)}px`,A.style.zIndex="1"),O.type==="number"||O.align==="right"?A.classList.add("og-cell--right"):O.align==="center"&&A.classList.add("og-cell--center"),ot&&A.classList.add("og-cell--editable"),O.wrap&&A.classList.add("og-cell--wrap"),ot||A.setAttribute("aria-readonly","true"),X>1&&A.setAttribute("aria-colspan",String(X)),Y>1&&A.setAttribute("aria-rowspan",String(Y)),((l=S._focusCell)==null?void 0:l.ri)===s&&((a=S._focusCell)==null?void 0:a.ci)===i&&(A.classList.add("og-cell-focused"),A.tabIndex=-1);const ht=S._rangeRects;ht!=null&&ht.some(D=>s>=D.startRow&&s<=D.endRow&&i>=D.startCol&&i<=D.endCol)&&(A.classList.add("og-range-selected"),A.style.background="var(--og-range-bg, rgba(25,118,210,0.12))");const G=F?F[O.field]:null,et=O.ariaLabel;A.setAttribute("aria-label",et==null?`${O.header}: ${G==null?"":String(G)}`:String(typeof et=="function"?et(G,F)??"":et)),O.tooltip!=null?A.title=typeof O.tooltip=="function"?String(O.tooltip(G,F)??""):String(O.tooltip):S.tooltips&&G!=null&&G!==""&&(A.title=String(G));const j=((c=(h=this.$l).getFormulaMeta)==null?void 0:c.call(h,s,O.field))??null;if(j){const D=G==null?this._t("cell.emptyValue"):String(G);if(j.error){const $=_FORMULA_ERROR_KEY$1[j.error],q=$?this._t($):this._t("formulaError.fallback");A.setAttribute("aria-label",this._t("formula.ariaError",{src:j.src,message:q})),A.title=`${j.error} — ${q}`,A.style.color="var(--og-formula-error-color, #c62828)"}else{const $=j.approx?this._t("formula.approxSuffix"):"";A.setAttribute("aria-label",this._t("formula.ariaValue",{src:j.src,value:D,approx:$})),A.title=`${j.src}${$}`}if(((d=S.formula)==null?void 0:d.cellMarker)!==!1){A.classList.add("og-formula-cell");const $=j.error?"var(--og-formula-error-color, #c62828)":"var(--og-formula-marker-color, #1976d2)",q=A.style.background||A.style.backgroundColor;A.style.backgroundImage=`linear-gradient(135deg, ${$} 0 6px, transparent 6px)`,A.style.backgroundRepeat="no-repeat",A.style.backgroundPosition="top right",A.style.backgroundSize="8px 8px",q&&(A.style.backgroundColor=q)}}const ct=(u=(f=this.$l).resolveRenderHook)==null?void 0:u.call(f,"cellClass",s,O.field);ct&&(A.className+=" "+ct);const dt=(g=(p=this.$l).resolveRenderHook)==null?void 0:g.call(p,"ariaLabel",s,O.field);dt!=null&&A.setAttribute("aria-label",String(dt));let ut=A;if(P&<){const D=_el("div","og-tree-cell"),$=P._ancestorHasMore??[];for(let V=0;V<P._depth;V++){const ft=_el("span","og-tree-guide");$[V]&&ft.classList.add("og-tree-guide--line"),D.appendChild(ft)}if(P._depth>0){const V=_el("span","og-tree-connector");V.classList.add(P._isLastChild?"og-tree-connector--last":"og-tree-connector--mid"),D.appendChild(V)}const q=_el("span","og-tree-toggle-wrap");if(!P._hasChildren){const V=_el("span","og-tree-leaf-dot");q.appendChild(V)}D.appendChild(q);const U=document.createElement("i");if(P._hasChildren){const V=_resolveTreeIcon(O.treeNodeIcon,F,!0,P._expanded);U.className=P._expanded?`${V} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle`:`${V} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`,U.setAttribute("role","button"),U.setAttribute("tabindex","0"),U.setAttribute("aria-expanded",P._expanded?"true":"false"),U.setAttribute("aria-label",this._t(P._expanded?"tree.collapse":"tree.expand")),n.treeIcons.set(U,P._treeId)}else{const V=_resolveTreeIcon(O.treeNodeIcon,F,!1,!1);U.setAttribute("aria-hidden","true"),U.className=`${V} og-tree-node-icon og-tree-node-icon--leaf`}D.appendChild(U),A.appendChild(D),ut=D}if(O.cellStyle){const D=F[O.field],$=typeof O.cellStyle=="function"?O.cellStyle(D,F,s):O.cellStyle;Object.assign(A.style,$)}const gt=n.plans[i].renderer().render({value:F[O.field],row:F,rowIndex:s,column:O,colIndex:i,isSelected:C.has(s),rowState:N,displayValue:((w=(m=this.$l).resolveRenderHook)==null?void 0:w.call(m,"displayText",s,O.field))??((v=(y=this.$l).getDisplayText)==null?void 0:v.call(y,s,O.field))??null,displayFormatter:((b=(_=this.$l).getDisplayFormatter)==null?void 0:b.call(_))??null,hasCellFormula:j!=null,t:this.$nr});if(ut.appendChild(gt),n.cellCi=i,n.cellSpan=X,(x=(E=this.$l).applyCF)==null||x.call(E,A,s,O.field,F?F[O.field]:void 0,J,st,at?n.trackBar:void 0),r?r.set(i,A):this.$at.set(s,i,A),Y>1){const D=document.createElement("div");D.style.cssText=[`width:${Q}px;min-width:${Q}px;height:${S.rowHeight}px;`,"flex-shrink:0;box-sizing:border-box;",`border-right:${K.border()};`].join(""),z==null||z.trackSpan(D,i,1,"wm","body"),e.appendChild(D);const $=k+(s-R)*S.rowHeight;A.style.left=`${H.leftOf(tt)}px`,A.style.top=`${$}px`,z==null||z.trackLeft(A,i,"body"),n.masters.set(A,s),T.appendChild(A)}else e.appendChild(A)}}function _resolveTreeIcon(o,e,s,i){let n;return o?typeof o=="function"?n=o(e,s,i):s?n=i?o.branchOpen??"bi-folder2-open":o.branch??"bi-folder2":n=o.leaf??"bi-file-earmark":n=s?i?"bi-folder2-open":"bi-folder2":"bi-file-earmark",n.startsWith("bi ")?n:`bi ${n}`}class GroupRowPainter{constructor(e,s){this.$T=e,this.$bF=s,this.kind="group"}_t(e,s){return this.$bF(e,s)}paint(e,s,i){const{opts:n,startIndex:r,offsetY:l,auto:a,applier:h}=i,c=this.$T,d=i.extraWidth,f=s,u=`__${f._groupField}:${f._groupValue}`,p=_el("div","og-group-row"),g=l+(e-r)*n.rowHeight;if(p.style.cssText=[a?"":`top:${g}px;height:${n.rowHeight}px;`,"display:flex;align-items:stretch;cursor:pointer;",`padding-left:${4+f._depth*12}px;`,"background:var(--og-header-bg,#f5f5f5);",`border:0;border-bottom:${c.divider()};`].join(""),p.setAttribute("role","row"),p.setAttribute("aria-expanded",f._expanded?"true":"false"),p.setAttribute("aria-rowindex",String(e+1)),p.setAttribute("aria-level",String(f._depth+1)),d>0){const m=_el("div","og-group-state-cell");m.style.cssText=[`width:${d}px;min-width:${d}px;flex-shrink:0;`,"display:flex;align-items:center;justify-content:center;","font-size:10px;font-weight:700;gap:2px;",`border-right:${c.border()};`].join("");const w=f._states??{added:0,edited:0,removed:0};if(w.added>0){const y=_el("span");y.textContent=`+${w.added}`,y.style.cssText=`color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:${c.radius(3)};`,m.appendChild(y)}if(w.edited>0){const y=_el("span");y.textContent=`M${w.edited}`,y.style.cssText=`color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:${c.radius(3)};`,m.appendChild(y)}if(w.removed>0){const y=_el("span");y.textContent=`D${w.removed}`,y.style.cssText=`color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:${c.radius(3)};`,m.appendChild(y)}h==null||h.trackExtra(m,"body"),p.appendChild(m)}return this.$al(p,f,i),i.groupKeys.set(p,u),p}shift(e,s,i){const n=i.applier;n==null||n.untrack(e);const r=i.extraWidth>0?1:0;for(;e.children.length>r;){const l=e.lastElementChild;n==null||n.untrack(l),l.remove()}this.$al(e,s,i)}$al(e,s,i){const{leaves:n,applier:r}=i,l=this.$T,a=i.geometry;let h=-1;for(let f=0;f<n.length;f++)if(!(s._summaryFmt!==void 0&&n[f].field in(s._summaryFmt??{}))){h=f;break}const c=i.layout.pieces;let d=-1;for(let f=0;f<c.length;f++)c[f].gap||(d=f);for(let f=0;f<c.length;f++){const u=c[f];if(u.gap){e.appendChild(paintGap(u.from,u.to,i));continue}const p=e.children.length;for(let g=u.from;g<=u.to;g++){const m=n[g],w=a.widthOf(leafColIndex(g)),y=s._summaryFmt!==void 0&&m.field in(s._summaryFmt??{}),v=_el("div","og-group-cell");if(v.style.cssText=[`width:${w}px;min-width:${w}px;flex-shrink:0;`,`padding:${l.cellPadding()};box-sizing:border-box;overflow:hidden;`,`border-right:${l.border()};`,"display:flex;align-items:center;","white-space:nowrap;text-overflow:ellipsis;"].join(""),y){const _=s._summaryFmt[m.field];v.textContent=_!==""?_:"-",v.style.justifyContent="flex-end",v.style.color="var(--og-primary,#1976d2)",v.style.fontWeight="600"}else if(g===h){const _=_el("span","og-group-arrow");_.textContent=s._expanded?"▾ ":"▸ ",_.style.cssText="color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;",v.appendChild(_);const b=_el("span","og-group-label");b.textContent=this._t("group.badge",{label:s._groupLabel,count:s._childCount}),b.style.cssText="overflow:hidden;text-overflow:ellipsis;font-weight:600;",v.appendChild(b),v.style.gap="0"}f!==d&&(r==null||r.trackSpan(v,g,1,"wm","body")),e.appendChild(v)}f===d&&(r==null||r.trackRowCells(e,p,u.from,u.to,"wm","body"))}h>=0&&!i.columns.contains(leafColIndex(h))?e.setAttribute("aria-label",this._t("group.badge",{label:s._groupLabel,count:s._childCount})):e.hasAttribute("aria-label")&&e.removeAttribute("aria-label")}}class DetailRowPainter{constructor(e){this.$T=e,this.kind="detail-head"}paint(e,s,i){var n;const r=i.detailApi;if(!r)return null;const{opts:l,offsetY:a,startIndex:h}=i,c=a+(e-h)*l.rowHeight,d=s._rowId,f=s._span*l.rowHeight,u=_el("div","og-detail-panel og-detail-panel-intro");u.dataset.ogRowId=d,u.id=`og-detail-${d}`,u.setAttribute("role","region"),u.setAttribute("aria-label",r.ariaLabel),u.style.cssText=["position:absolute;left:0;",`top:${c}px;width:${i.totalColWidth}px;height:${f}px;`,"box-sizing:border-box;","overflow-y:auto;overflow-x:auto;","overscroll-behavior:contain;","background:var(--og-detail-bg,#fff);",`border:0;border-bottom:${this.$T.divider()};`,"z-index:var(--og-z-detail,2);"].join(""),(n=i.applier)==null||n.trackTotal(u,"width","body");const p=r.getPanelHost(d);return u.appendChild(p),u}}class DetailFillerRowPainter{constructor(){this.kind="detail-filler"}paint(){return null}}const DEFAULT_PREC=10;function round(o,e=DEFAULT_PREC){const s=Math.pow(10,e);return Math.round(o*s)/s}class OGDecimal{constructor(e,s){this.$v=e,this.$z=s<0?0:s}static from(e){if(e instanceof OGDecimal)return e;if(typeof e=="bigint")return new OGDecimal(e,0);const s=String(e).trim();if(!s||s==="null"||s==="undefined"||s==="NaN")return new OGDecimal(0n,0);const i=s.startsWith("-"),n=i?s.slice(1):s,r=n.indexOf(".");let l,a;if(r===-1)l=BigInt(n),a=0;else{const h=n.slice(r+1);l=BigInt(n.slice(0,r)+h),a=h.length}return new OGDecimal(i?-l:l,a)}static zero(){return new OGDecimal(0n,0)}static one(){return new OGDecimal(1n,0)}static $cl(e,s){return e.$z===s.$z?[e.$v,s.$v,e.$z]:e.$z>s.$z?[e.$v,s.$v*10n**BigInt(e.$z-s.$z),e.$z]:[e.$v*10n**BigInt(s.$z-e.$z),s.$v,s.$z]}add(e){const[s,i,n]=OGDecimal.$cl(this,OGDecimal.from(e));return new OGDecimal(s+i,n)}sub(e){const[s,i,n]=OGDecimal.$cl(this,OGDecimal.from(e));return new OGDecimal(s-i,n)}mul(e){const s=OGDecimal.from(e);return new OGDecimal(this.$v*s.$v,this.$z+s.$z)}div(e,s=20){const i=OGDecimal.from(e);if(i.$v===0n)throw new Error("OGDecimal: division by zero");const r=this.$v*10n**BigInt(s+i.$z)/i.$v;return new OGDecimal(r,s+this.$z)}mod(e){const s=OGDecimal.from(e),[i,n,r]=OGDecimal.$cl(this,s);return new OGDecimal(i%n,r)}neg(){return new OGDecimal(-this.$v,this.$z)}abs(){return new OGDecimal(this.$v<0n?-this.$v:this.$v,this.$z)}eq(e){const[s,i]=OGDecimal.$cl(this,OGDecimal.from(e));return s===i}gt(e){const[s,i]=OGDecimal.$cl(this,OGDecimal.from(e));return s>i}lt(e){const[s,i]=OGDecimal.$cl(this,OGDecimal.from(e));return s<i}gte(e){return!this.lt(e)}lte(e){return!this.gt(e)}isZero(){return this.$v===0n}isNeg(){return this.$v<0n}isPos(){return this.$v>0n}toFixed(e){let s=this.$v,i=this.$z;if(i<e)s=s*10n**BigInt(e-i);else if(i>e){const d=10n**BigInt(i-e),f=d/2n,u=s<0n,p=u?-s:s,g=p%d;let m=p/d;g>=f&&(m+=1n),s=u?-m:m}i=e;const n=s<0n,l=(n?-s:s).toString().padStart(e+1,"0"),a=l.slice(0,l.length-e)||"0",h=e>0?"."+l.slice(l.length-e):"";return(n?"-":"")+a+h}toString(){if(this.$z===0)return this.$v.toString();let e=this.$v,s=this.$z;for(;s>0&&e!==0n&&e%10n===0n;)e/=10n,s--;return new OGDecimal(e,s).toFixed(s)}toNumber(){return parseFloat(this.toFixed(20))}static sum(e){return e.reduce((s,i)=>s.add(i),OGDecimal.zero())}static avg(e,s=20){return e.length?OGDecimal.sum(e).div(e.length,s):OGDecimal.zero()}static min(e){if(!e.length)throw new Error("OGDecimal.min: empty array");return e.map(OGDecimal.from).reduce((s,i)=>s.lt(i)?s:i)}static max(e){if(!e.length)throw new Error("OGDecimal.max: empty array");return e.map(OGDecimal.from).reduce((s,i)=>s.gt(i)?s:i)}}function evaluateFormula(o,e,s=30){return new _FormulaParser(o,e,s).parse()}class _FormulaParser{constructor(e,s,i){this.$G=s,this.$fa=i,this.$j=0,this.$o=e.trim()}parse(){const e=this.$de();if(this.$aR(),this.$j<this.$o.length)throw new SyntaxError(`FormulaEngine: 예상치 못한 토큰 '${this.$o[this.$j]}' (위치 ${this.$j})`);return e}$de(){let e=this.$jx();for(this.$aR();this.$j<this.$o.length;){const s=this.$o[this.$j];if(s!=="+"&&s!=="-")break;this.$j++,this.$aR();const i=this.$jx();e=s==="+"?e.add(i):e.sub(i),this.$aR()}return e}$jx(){let e=this.$hx();for(this.$aR();this.$j<this.$o.length;){const s=this.$o[this.$j];if(s!=="*"&&s!=="/"&&s!=="%")break;this.$j++,this.$aR();const i=this.$hx();s==="*"?e=e.mul(i):s==="/"?e=e.div(i,this.$fa):e=e.mod(i),this.$aR()}return e}$hx(){return this.$aR(),this.$o[this.$j]==="-"?(this.$j++,this.$hx().neg()):this.$mM()}$mM(){this.$aR();const e=this.$o[this.$j];if(e==="("){this.$j++;const s=this.$de();if(this.$aR(),this.$o[this.$j]!==")")throw new SyntaxError("FormulaEngine: 닫는 괄호 ) 누락");return this.$j++,s}return e==="["?this.$ge():this.$ml()}$ge(){this.$j++;const e=this.$j;for(;this.$j<this.$o.length&&this.$o[this.$j]!=="]";)this.$j++;if(this.$j>=this.$o.length)throw new SyntaxError("FormulaEngine: 닫는 ] 누락");const s=this.$o.slice(e,this.$j);this.$j++;const i=this.$G[s];if(i==null)throw new ReferenceError(`FormulaEngine: 필드 '[${s}]'가 행 데이터에 없습니다`);return OGDecimal.from(i)}$ml(){const e=this.$j;for(;this.$j<this.$o.length&&/[0-9.]/.test(this.$o[this.$j]);)this.$j++;const s=this.$o.slice(e,this.$j);if(!s)throw new SyntaxError(`FormulaEngine: 숫자 또는 [필드]를 기대했지만 '${this.$o[this.$j]??"EOF"}' 발견 (위치 ${e})`);return OGDecimal.from(s)}$aR(){for(;this.$j<this.$o.length&&/\s/.test(this.$o[this.$j]);)this.$j++}}function applyMask(o,e){if(o==null||o==="")return o??"";const s=typeof e=="string"?{type:e}:e,i=s.char??"*";switch(s.type){case"ssn":return _maskSSN(o,i);case"phone":case"mobile":return _maskPhone(o,i);case"email":return _maskEmail(o,i);case"credit":return _maskCredit(o,i);case"account":return _maskAccount(o,i,s.visiblePrefix??3,s.visibleSuffix??4);case"password":return i.repeat(Math.max(o.length,6));case"name":return _maskName(o,i);case"ip":return _maskIP(o,i);case"partial":return _maskPartial(o,i,s.visiblePrefix??0,s.visibleSuffix??4);default:return o}}function _maskSSN(o,e){const s=o.replace(/[^0-9]/g,"");if(s.length<7){const l=o.includes("-")?"-":"",a=o.indexOf("-")>=0?o.indexOf("-"):6;return o.slice(0,a)+l+e.repeat(Math.max(1,o.length-a-l.length))}const i=s.slice(0,6),n=s[6],r=s.length-7;return`${i}-${n}${e.repeat(r)}`}function _maskPhone(o,e){const s=o.replace(/[^0-9]/g,"");return s.length===11?`${s.slice(0,3)}-${e.repeat(4)}-${s.slice(7)}`:s.length===10?s.startsWith("02")?`${s.slice(0,2)}-${e.repeat(4)}-${s.slice(6)}`:`${s.slice(0,3)}-${e.repeat(3)}-${s.slice(6)}`:s.length===9?`${s.slice(0,2)}-${e.repeat(3)}-${s.slice(5)}`:_maskPartial(o,e,3,4)}function _maskEmail(o,e){const s=o.indexOf("@");if(s<0)return _maskPartial(o,e,2,0);const i=o.slice(0,s),n=o.slice(s),r=Math.min(2,i.length),l=i.slice(0,r),a=Math.max(i.length-r,3);return`${l}${e.repeat(a)}${n}`}function _maskCredit(o,e){const s=o.replace(/[^0-9]/g,"");if(s.length<8)return o;const i=s.slice(0,4),n=s.slice(-4),r=s.length-8,l=e.repeat(Math.max(r,8)),a=[i];for(let h=0;h<l.length;h+=4){const c=l.slice(h,h+4);c&&a.push(c)}return a.push(n),a.join("-")}function _maskAccount(o,e,s,i){const n=o.replace(/[^0-9]/g,"");if(n.length<=s+i)return _maskPartial(n,e,s,i);const r=n.slice(0,s),l=n.slice(-i),a=n.length-s-i;return`${r}-${e.repeat(a)}-${l}`}function _maskName(o,e){const s=o.trim();return s.length===0?o:s.length===1?e:s.length===2?`${s[0]}${e}`:`${s[0]}${e.repeat(s.length-2)}${s[s.length-1]}`}function _maskIP(o,e){const s=o.split(".");if(s.length!==4)return _maskPartial(o,e,3,0);const i=n=>e.repeat(Math.max(n.length,3));return`${s[0]}.${s[1]}.${i(s[2])}.${i(s[3])}`}function _maskPartial(o,e,s,i){if(o.length<=s+i)return o;const n=o.slice(0,s),r=i>0?o.slice(-i):"",l=o.length-s-i;return`${n}${e.repeat(l)}${r}`}const ICON_VIEWBOX="0 0 16 16",BOOTSTRAP_ICONS={"sort-up":'<path d="M3.5 12.5a.5.5 0 0 1-1 0V3.707L1.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.5.5 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L3.5 3.707zm3.5-9a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 6a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z"/>',"sort-down":'<path d="M3.5 2.5a.5.5 0 0 0-1 0v8.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L3.5 11.293zm3.5 1a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 6a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z"/>',"chevron-expand":'<path fill-rule="evenodd" d="M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708m0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708"/>',funnel:'<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2z"/>',"funnel-fill":'<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5z"/>',filter:'<path d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5"/>',search:'<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>',"chevron-left":'<path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0"/>',"chevron-right":'<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>',"chevron-up":'<path fill-rule="evenodd" d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z"/>',"chevron-down":'<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/>',"chevron-double-left":'<path fill-rule="evenodd" d="M8.354 1.646a.5.5 0 0 1 0 .708L2.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0"/><path fill-rule="evenodd" d="M12.354 1.646a.5.5 0 0 1 0 .708L6.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0"/>',"chevron-double-right":'<path fill-rule="evenodd" d="M3.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L9.293 8 3.646 2.354a.5.5 0 0 1 0-.708"/><path fill-rule="evenodd" d="M7.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L13.293 8 7.646 2.354a.5.5 0 0 1 0-.708"/>',"arrow-up":'<path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5"/>',"arrow-down":'<path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1"/>',"arrow-left":'<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>',"arrow-right":'<path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8"/>',"arrow-clockwise":'<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/><path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>',"plus-lg":'<path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2"/>',"plus-circle":'<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>',trash3:'<path d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5M11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47M8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5"/>',"grip-vertical":'<path d="M7 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M7 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M7 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/>',"grip-horizontal":'<path d="M2 8a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>',"pin-angle":'<path d="M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a6 6 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707s.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a6 6 0 0 1 1.013.16l3.134-3.133a3 3 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146m.122 2.112v-.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a5 5 0 0 0-.288-.076 5 5 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a5 5 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034q.172.002.343-.04L9.927 2.028q-.042.172-.04.343a1.8 1.8 0 0 0 .062.46z"/>',"pin-angle-fill":'<path d="M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a6 6 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707s.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a6 6 0 0 1 1.013.16l3.134-3.133a3 3 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146"/>',eye:'<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8M1.173 8a13 13 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5s3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5s-3.879-1.168-5.168-2.457A13 13 0 0 1 1.172 8z"/><path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0"/>',"eye-slash":'<path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7 7 0 0 0-2.79.588l.77.771A6 6 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755q-.247.248-.517.486z"/><path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829"/><path d="M3.35 5.47q-.27.24-.518.487A13 13 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7 7 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296 8.884-12-12 .708-.708 12 12z"/>',pencil:'<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325"/>',"check-lg":'<path d="M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425z"/>',"x-lg":'<path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/>',clipboard:'<path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z"/><path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z"/>',"clipboard-check":'<path fill-rule="evenodd" d="M10.854 7.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 9.793l2.646-2.647a.5.5 0 0 1 .708 0"/><path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z"/><path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z"/>',eraser:'<path d="M8.086 2.207a2 2 0 0 1 2.828 0l3.879 3.879a2 2 0 0 1 0 2.828l-5.5 5.5A2 2 0 0 1 7.879 15H5.12a2 2 0 0 1-1.414-.586l-2.5-2.5a2 2 0 0 1 0-2.828zm2.121.707a1 1 0 0 0-1.414 0L4.16 7.547l5.293 5.293 4.633-4.633a1 1 0 0 0 0-1.414zM8.746 13.547 3.453 8.254 1.914 9.793a1 1 0 0 0 0 1.414l2.5 2.5a1 1 0 0 0 .707.293H7.88a1 1 0 0 0 .707-.293z"/>',square:'<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>',"check-square":'<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/><path d="M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/>',"dash-square":'<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/><path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8"/>',"check-all":'<path d="M8.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L2.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093L8.95 4.992zm-.92 5.14.92.92a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 1 0-1.091-1.028L9.477 9.417l-.485-.486z"/>',"filetype-csv":'<path fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM3.517 14.841a1.13 1.13 0 0 0 .401.823q.195.162.478.252.284.091.665.091.507 0 .859-.158.354-.158.539-.44.187-.284.187-.656 0-.336-.134-.56a1 1 0 0 0-.375-.357 2 2 0 0 0-.566-.21l-.621-.144a1 1 0 0 1-.404-.176.37.37 0 0 1-.144-.299q0-.234.185-.384.188-.152.512-.152.214 0 .37.068a.6.6 0 0 1 .246.181.56.56 0 0 1 .12.258h.75a1.1 1.1 0 0 0-.2-.566 1.2 1.2 0 0 0-.5-.41 1.8 1.8 0 0 0-.78-.152q-.439 0-.776.15-.337.149-.527.421-.19.273-.19.639 0 .302.122.524.124.223.352.367.228.143.539.213l.618.144q.31.073.463.193a.39.39 0 0 1 .152.326.5.5 0 0 1-.085.29.56.56 0 0 1-.255.193q-.167.07-.413.07-.175 0-.32-.04a.8.8 0 0 1-.248-.115.58.58 0 0 1-.255-.384zM.806 13.693q0-.373.102-.633a.87.87 0 0 1 .302-.399.8.8 0 0 1 .475-.137q.225 0 .398.097a.7.7 0 0 1 .272.26.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964 1.4 1.4 0 0 0-.489-.272 1.8 1.8 0 0 0-.606-.097q-.534 0-.911.223-.375.222-.572.632-.195.41-.196.979v.498q0 .568.193.976.197.407.572.626.375.217.914.217.439 0 .785-.164t.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.8.8 0 0 1-.118.363.7.7 0 0 1-.272.25.9.9 0 0 1-.401.087.85.85 0 0 1-.478-.132.83.83 0 0 1-.299-.392 1.7 1.7 0 0 1-.102-.627zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879z"/>',"filetype-xlsx":'<path fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM7.86 14.841a1.13 1.13 0 0 0 .401.823q.195.162.479.252.284.091.665.091.507 0 .858-.158.355-.158.54-.44a1.17 1.17 0 0 0 .187-.656q0-.336-.135-.56a1 1 0 0 0-.375-.357 2 2 0 0 0-.565-.21l-.621-.144a1 1 0 0 1-.405-.176.37.37 0 0 1-.143-.299q0-.234.184-.384.188-.152.513-.152.214 0 .37.068a.6.6 0 0 1 .245.181.56.56 0 0 1 .12.258h.75a1.1 1.1 0 0 0-.199-.566 1.2 1.2 0 0 0-.5-.41 1.8 1.8 0 0 0-.78-.152q-.44 0-.777.15-.336.149-.527.421-.19.273-.19.639 0 .302.123.524t.351.367q.229.143.54.213l.618.144q.31.073.462.193a.39.39 0 0 1 .153.326.5.5 0 0 1-.085.29.56.56 0 0 1-.255.193q-.168.07-.413.07-.176 0-.32-.04a.8.8 0 0 1-.249-.115.58.58 0 0 1-.255-.384zm-3.726-2.909h.893l-1.274 2.007 1.254 1.992h-.908l-.85-1.415h-.035l-.853 1.415H1.5l1.24-2.016-1.228-1.983h.931l.832 1.438h.036zm1.923 3.325h1.697v.674H5.266v-3.999h.791zm7.636-3.325h.893l-1.274 2.007 1.254 1.992h-.908l-.85-1.415h-.035l-.853 1.415h-.861l1.24-2.016-1.228-1.983h.931l.832 1.438h.036z"/>',"filetype-pdf":'<path fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.6 11.85H0v3.999h.791v-1.342h.803q.43 0 .732-.173.305-.175.463-.474a1.4 1.4 0 0 0 .161-.677q0-.375-.158-.677a1.2 1.2 0 0 0-.46-.477q-.3-.18-.732-.179m.545 1.333a.8.8 0 0 1-.085.38.57.57 0 0 1-.238.241.8.8 0 0 1-.375.082H.788V12.48h.66q.327 0 .512.181.185.183.185.522m1.217-1.333v3.999h1.46q.602 0 .998-.237a1.45 1.45 0 0 0 .595-.689q.196-.45.196-1.084 0-.63-.196-1.075a1.43 1.43 0 0 0-.589-.68q-.396-.234-1.005-.234zm.791.645h.563q.371 0 .609.152a.9.9 0 0 1 .354.454q.118.302.118.753a2.3 2.3 0 0 1-.068.592 1.1 1.1 0 0 1-.196.422.8.8 0 0 1-.334.252 1.3 1.3 0 0 1-.483.082h-.563zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638z"/>',"filetype-json":'<path fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM4.151 15.29a1.2 1.2 0 0 1-.111-.449h.764a.58.58 0 0 0 .255.384q.105.073.25.114.142.041.319.041.245 0 .413-.07a.56.56 0 0 0 .255-.193.5.5 0 0 0 .084-.29.39.39 0 0 0-.152-.326q-.152-.12-.463-.193l-.618-.143a1.7 1.7 0 0 1-.539-.214 1 1 0 0 1-.352-.367 1.1 1.1 0 0 1-.123-.524q0-.366.19-.639.192-.272.528-.422.337-.15.777-.149.456 0 .779.152.326.153.5.41.18.255.2.566h-.75a.56.56 0 0 0-.12-.258.6.6 0 0 0-.246-.181.9.9 0 0 0-.37-.068q-.324 0-.512.152a.47.47 0 0 0-.185.384q0 .18.144.3a1 1 0 0 0 .404.175l.621.143q.326.075.566.211a1 1 0 0 1 .375.358q.135.222.135.56 0 .37-.188.656a1.2 1.2 0 0 1-.539.439q-.351.158-.858.158-.381 0-.665-.09a1.4 1.4 0 0 1-.478-.252 1.1 1.1 0 0 1-.29-.375m-3.104-.033a1.3 1.3 0 0 1-.082-.466h.764a.6.6 0 0 0 .074.27.5.5 0 0 0 .454.246q.285 0 .422-.164.137-.165.137-.466v-2.745h.791v2.725q0 .66-.357 1.005-.355.345-.985.345a1.6 1.6 0 0 1-.568-.094 1.15 1.15 0 0 1-.407-.266 1.1 1.1 0 0 1-.243-.39m9.091-1.585v.522q0 .384-.117.641a.86.86 0 0 1-.322.387.9.9 0 0 1-.47.126.9.9 0 0 1-.47-.126.87.87 0 0 1-.32-.387 1.55 1.55 0 0 1-.117-.641v-.522q0-.386.117-.641a.87.87 0 0 1 .32-.387.87.87 0 0 1 .47-.129q.265 0 .47.129a.86.86 0 0 1 .322.387q.117.255.117.641m.803.519v-.513q0-.565-.205-.973a1.46 1.46 0 0 0-.59-.63q-.38-.22-.916-.22-.534 0-.92.22a1.44 1.44 0 0 0-.589.628q-.205.407-.205.975v.513q0 .562.205.973.205.407.589.626.386.217.92.217.536 0 .917-.217.384-.22.589-.626.204-.41.205-.973m1.29-.935v2.675h-.746v-3.999h.662l1.752 2.66h.032v-2.66h.75v4h-.656l-1.761-2.676z"/>',printer:'<path d="M2.5 8a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1"/><path d="M5 1a2 2 0 0 0-2 2v2H2a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h1v1a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-1h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-1V3a2 2 0 0 0-2-2zM4 3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2H4zm1 5a2 2 0 0 0-2 2v1H2a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v-1a2 2 0 0 0-2-2zm7 2v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1"/>',download:'<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/><path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708z"/>',upload:'<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/><path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708z"/>',table:'<path d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z"/>',"bar-chart":'<path d="M4 11H2v3h2zm5-4H7v7h2zm5-5v12h-2V2zm-2-1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM6 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm-5 4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1z"/>',"graph-up":'<path fill-rule="evenodd" d="M0 0h1v15h15v1H0zm14.817 3.113a.5.5 0 0 1 .07.704l-4.5 5.5a.5.5 0 0 1-.74.037L7.06 6.767l-3.656 5.027a.5.5 0 0 1-.808-.588l4-5.5a.5.5 0 0 1 .758-.06l2.609 2.61 4.15-5.073a.5.5 0 0 1 .704-.07"/>',"pie-chart":'<path d="M7.5 1.018a7 7 0 0 0-4.79 11.566L7.5 7.793zm1 0V7.5h6.482A7 7 0 0 0 8.5 1.018M14.982 8.5H8.207l-4.79 4.79A7 7 0 0 0 14.982 8.5M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8"/>',"check-circle-fill":'<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>',"exclamation-triangle-fill":'<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>',"x-circle-fill":'<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293z"/>',"info-circle":'<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/>',"lock-fill":'<path fill-rule="evenodd" d="M8 0a4 4 0 0 1 4 4v2.05a2.5 2.5 0 0 1 2 2.45v5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 13.5v-5a2.5 2.5 0 0 1 2-2.45V4a4 4 0 0 1 4-4m0 1a3 3 0 0 0-3 3v2h6V4a3 3 0 0 0-3-3"/>',unlock:'<path fill-rule="evenodd" d="M12 0a4 4 0 0 1 4 4v2.5h-1V4a3 3 0 1 0-6 0v2h.5A2.5 2.5 0 0 1 12 8.5v5A2.5 2.5 0 0 1 9.5 16h-7A2.5 2.5 0 0 1 0 13.5v-5A2.5 2.5 0 0 1 2.5 6H8V4a4 4 0 0 1 4-4M2.5 7A1.5 1.5 0 0 0 1 8.5v5A1.5 1.5 0 0 0 2.5 15h7a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 9.5 7z"/>',asterisk:'<path d="M8 0a1 1 0 0 1 1 1v5.268l4.562-2.634a1 1 0 1 1 1 1.732L10 8l4.562 2.634a1 1 0 1 1-1 1.732L9 9.732V15a1 1 0 1 1-2 0V9.732l-4.562 2.634a1 1 0 1 1-1-1.732L6 8 1.438 5.366a1 1 0 0 1 1-1.732L7 6.268V1a1 1 0 0 1 1-1"/>',calculator:'<path d="M12 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/><path d="M4 2.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5zm0 4a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5z"/>',gear:'<path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"/><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"/>',list:'<path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5"/>',"three-dots-vertical":'<path d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>',"three-dots":'<path d="M3 9.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"/>',plus:'<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>',dash:'<path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8"/>',"question-circle":'<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="M5.255 5.786a.237.237 0 0 0 .241.247h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286m1.557 5.763c0 .533.425.927 1.01.927.609 0 1.028-.394 1.028-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94"/>',"eye-reveal":'<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8z"/><path d="M8 5.5A2.5 2.5 0 1 0 8 10.5 2.5 2.5 0 0 0 8 5.5zm0 4A1.5 1.5 0 1 1 8 6.5a1.5 1.5 0 0 1 0 3z" fill="#fff"/>'};Object.keys(BOOTSTRAP_ICONS).length;const DEFAULT_ICON_ROLES={"sort.asc":"sort-up","sort.desc":"sort-down","sort.none":"chevron-expand",filter:"funnel","filter.active":"funnel-fill",search:"search","row.add":"plus-lg","row.delete":"trash3",delete:"trash3","row.drag":"grip-vertical","column.drag":"grip-horizontal",expand:"chevron-right",collapse:"chevron-down","tree.expand":"chevron-right","tree.collapse":"chevron-down","mask.reveal":"eye-reveal","mask.show":"eye","mask.hide":"eye-slash","export.excel":"filetype-xlsx","export.csv":"filetype-csv","export.pdf":"filetype-pdf","export.json":"filetype-json",export:"download",import:"upload",print:"printer",table:"table",edit:"pencil",copy:"clipboard",paste:"clipboard-check",clear:"eraser",check:"check-lg",close:"x-lg",add:"plus",remove:"dash","select.all":"check-all","select.none":"square","select.check":"check-square","select.indeterminate":"dash-square",pin:"pin-angle","pin.active":"pin-angle-fill","status.error":"x-circle-fill","status.warning":"exclamation-triangle-fill","status.success":"check-circle-fill","status.info":"info-circle","status.lock":"lock-fill","status.unlock":"unlock",required:"asterisk",chart:"bar-chart","chart.bar":"bar-chart","chart.line":"graph-up","chart.pie":"pie-chart",formula:"calculator","nav.first":"chevron-double-left","nav.prev":"chevron-left","nav.next":"chevron-right","nav.last":"chevron-double-right","nav.up":"arrow-up","nav.down":"arrow-down",refresh:"arrow-clockwise",menu:"list",more:"three-dots-vertical","more.horizontal":"three-dots",settings:"gear",help:"question-circle"},FALLBACK_BODY="";function _escapeAttr(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}class IconRegistry{constructor(e,s){if(this.$fp=new Map,this._parent=s,e)for(const[i,n]of Object.entries(e))this.register(i,n)}register(e,s){const i=Object.prototype.hasOwnProperty.call(BOOTSTRAP_ICONS,s)?BOOTSTRAP_ICONS[s]:s;return this.$fp.set(e,i),this}has(e){var s;return this.$fp.has(e)||(((s=this._parent)==null?void 0:s.has(e))??!1)}resolveBody(e){const s=this.$fp.get(e);return s!==void 0?s:this._parent?this._parent.resolveBody(e):null}child(){return new IconRegistry(void 0,this)}render(e,s){const i=this.resolveBody(e)??FALLBACK_BODY,n=s==null?void 0:s.size,r=n!=null?` width="${n}" height="${n}"`:"",l=s==null?void 0:s.title,a=l?`<title>${_escapeAttr(l)}</title>`:"",c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${ICON_VIEWBOX}"${r} fill="currentColor"${l?' role="img"':""} style="stroke-linejoin:var(--og-icon-corner, miter)">${a}${i}</svg>`;return s!=null&&s.el?new DOMParser().parseFromString(c,"image/svg+xml").documentElement:c}roles(){return[...this.$fp.keys()]}}const iconRegistry=new IconRegistry(DEFAULT_ICON_ROLES);function renderIcon(o,e){return iconRegistry.render(o,e)}function ctxT(o,e,s){return o.t?o.t(e,s):t(e,s)}function resolveFormula(o){if(o.hasCellFormula)return null;const e=o.column;if(!e.formula)return null;const s=e.formulaPrecision??30;try{let i;return typeof e.formula=="function"?i=e.formula(o.row,OGDecimal):i=evaluateFormula(e.formula,o.row,s),i instanceof OGDecimal?e.precision!=null?i.toFixed(e.precision):i.toString():typeof i=="string"?i:e.precision!=null?OGDecimal.from(i).toFixed(e.precision):String(i)}catch(i){return console.warn("[OpenGrid] Formula error:",i),"#ERR"}}function formatNumber(o,e,s,i,n,r){if(o==null||o==="")return"";let l=Number(o);if(isNaN(l))return String(o);if(s!=null&&(l=round(l,s)),i)try{return new Intl.NumberFormat(void 0,{style:"currency",currency:i,...s!=null?{minimumFractionDigits:s,maximumFractionDigits:s}:{}}).format(l)}catch{}if(!e)return s!=null?l.toFixed(s):String(l);const a=e.indexOf(";"),h=a>=0?e.slice(a+1):null,c=l<0&&h!=null?h:a>=0?e.slice(0,a):e,d=l<0&&h!=null?Math.abs(l):l,f=c.match(/[#0][#0,]*(?:\.[#0]+)?/);if(!f)return String(l);const u=f[0],p=c.slice(0,f.index),g=c.slice(f.index+u.length),m=u.includes(","),w=u.includes(".")?u.split(".")[1].length:s??0,y=d.toLocaleString("ko-KR",{minimumFractionDigits:w,maximumFractionDigits:w,useGrouping:m});return p+y+g}function formatDate(o,e="yyyy-MM-dd",s,i){if(!o)return"";const n=o instanceof Date?o:new Date(o);if(isNaN(n.getTime()))return String(o);const r=n.getFullYear(),l=String(n.getMonth()+1).padStart(2,"0"),a=String(n.getDate()).padStart(2,"0");return e.replace("yyyy",String(r)).replace("MM",l).replace("dd",a)}function _renderMasked(o,e,s,i){const n=applyMask(o,e.mask),r=document.createElement("span");r.style.cssText="display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";const l=document.createElement("span");l.style.cssText="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:monospace;letter-spacing:0.4px;color:var(--og-mask-text,#888);",l.textContent=n;const a=document.createElement("button");return a.title=ctxT(i,"cell.revealTooltip"),a.setAttribute("aria-label",ctxT(i,"cell.revealAria")),a.innerHTML=iconRegistry.render("mask.reveal",{size:13}),a.style.cssText=`flex-shrink:0;background:none;border:none;cursor:pointer;color:#c0c0c0;padding:1px 2px;line-height:0;border-radius:${defaultAppearance.radius(3)};display:flex;align-items:center;`,a.addEventListener("mouseover",()=>{a.style.color="var(--og-primary,#1976d2)",a.style.background="rgba(25,118,210,0.08)"}),a.addEventListener("mouseout",()=>{a.style.color="#c0c0c0",a.style.background="none"}),a.addEventListener("click",h=>{h.stopPropagation(),l.textContent=o,l.style.fontFamily="",l.style.letterSpacing="",l.style.color="",a.remove(),(e._maskRevealedRows??(e._maskRevealedRows=new Set)).add(s)}),r.appendChild(l),r.appendChild(a),r}class TextRenderer{render(e){var s;const i=document.createElement("span");i.className="og-cell-text";const n=resolveFormula(e);if(n!==null)return i.textContent=n,i.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",i;const{value:r,column:l,rowIndex:a}=e;if(e.displayValue!=null)return i.textContent=e.displayValue,i.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",i;let h;if(l.valueMap&&r!=null&&l.valueMap[r]?h=l.valueMap[r]:h=r==null?"":String(r),l.mask){const c=l._maskRevealed===!0,d=((s=l._maskRevealedRows)==null?void 0:s.has(a))===!0;if(!c&&!d)return _renderMasked(h,l,a,e)}return i.textContent=h,i.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",i}}class SelectRenderer{constructor(e=[],s){this.$aA=e.map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.text??String(i.value??""),value:i.value}),this.$gl=s??null}render(e){const s=document.createElement("span");s.className="og-cell-text",s.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;";const i=e.value;if(i==null||i==="")return s;const n=String(i),l=(this.$gl?this.$gl(e.row,e.rowIndex).map(a=>typeof a=="string"?{label:a,value:a}:{label:a.label??a.text??String(a.value??""),value:a.value}):this.$aA).find(a=>String(a.value)===n);return s.textContent=l?l.label:n,s}}class NumberRenderer{render(e){const s=document.createElement("span");s.className="og-cell-number";const i=resolveFormula(e);if(i!==null)return s.textContent=i,s.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",s;if(e.displayFormatter){const n=e.displayFormatter(e.value,e.column.field??"",e.row);if(n!=null)return s.textContent=n,s.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",s}return s.textContent=formatNumber(e.value,e.column.format??"#,##0",e.column.precision,e.column.currency,e.column.field,e.row),s.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",s}}class DateRenderer{render(e){const s=document.createElement("span");s.className="og-cell-date";const i=e.displayFormatter?e.displayFormatter(e.value,e.column.field??"",e.row):null;return i!=null?s.textContent=i:s.textContent=formatDate(e.value,e.column.format,e.column.field,e.row),s.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",s}}class CheckboxRenderer{render(e){const s=document.createElement("span");s.className="og-cell-checkbox",s.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const i=document.createElement("input");return i.type="checkbox",i.checked=!!e.value,i.disabled=!0,i.style.cssText+="cursor:pointer;pointer-events:none;",s.appendChild(i),s}}class ButtonRenderer{constructor(e){this.def=e}render(e){var s,i,n,r;const l=document.createElement("span");l.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const a=document.createElement("button");a.className=`og-cell-btn${(s=this.def)!=null&&s.buttonClass?" "+this.def.buttonClass:""}`;const h=(i=this.def)==null?void 0:i.label,c=typeof h=="function"?h(e.value,e.row):h??String(e.value??"btn");if(a.style.cssText=`
|
|
20
|
+
padding:2px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
21
|
+
border-radius:4px;background:var(--og-row-bg,#fff);color:var(--og-primary,#1976d2);
|
|
22
|
+
cursor:pointer;font-size:12px;white-space:nowrap;transition:background 0.12s;
|
|
23
|
+
${((n=this.def)==null?void 0:n.style)??""}
|
|
24
|
+
`,(r=this.def)!=null&&r.icon){a.style.display="inline-flex",a.style.alignItems="center",a.style.gap="4px";const d=document.createElement("span");d.style.cssText="display:inline-flex;flex-shrink:0;",d.innerHTML=iconRegistry.render(this.def.icon,{size:13});const f=document.createElement("span");f.textContent=c,this.def.iconPos==="right"?(a.appendChild(f),a.appendChild(d)):(a.appendChild(d),a.appendChild(f))}else a.textContent=c;return a.addEventListener("mouseover",()=>a.style.background="var(--og-primary-light,#e3f2fd)"),a.addEventListener("mouseout",()=>a.style.background="var(--og-row-bg,#fff)"),l.appendChild(a),l}}class BadgeRenderer{constructor(e,s){this.colorMap=e,this.labelMap=s}render(e){var s,i,n;const r=document.createElement("span");r.style.cssText="display:flex;align-items:center;height:100%;";const l=document.createElement("span"),a=e.value==null?"":String(e.value),h=((s=this.labelMap)==null?void 0:s[a])??((i=e.column.valueMap)==null?void 0:i[a])??a;l.textContent=h;const c=((n=this.colorMap)==null?void 0:n[a])??"#666";return l.style.cssText=`
|
|
25
|
+
display:inline-block;padding:2px 8px;border-radius:${defaultAppearance.radius(12)};font-size:11px;
|
|
26
|
+
background:${c}22;color:${c};border:1px solid ${c}66;
|
|
27
|
+
white-space:nowrap;
|
|
28
|
+
`,r.appendChild(l),r}}class LinkRenderer{constructor(e,s){this.hrefFn=e,this.target=s}render(e){const s=document.createElement("a");return s.className="og-cell-link",s.textContent=e.value==null?"":String(e.value),s.href=this.hrefFn?this.hrefFn(e.value,e.row):"#",this.target&&(s.target=this.target),s.style.cssText="color:var(--og-primary,#1976d2);text-decoration:underline;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",this.hrefFn||s.addEventListener("click",i=>i.preventDefault()),s}}class TemplateRenderer{constructor(e){this.templateFn=e}render(e){const s=document.createElement("div");return s.className="og-cell-template",s.style.cssText="display:flex;align-items:center;height:100%;overflow:hidden;",s.innerHTML=this.templateFn(e.value,e.row,e.rowIndex),s}}class ImageRenderer{constructor(e){this.def=e}render(e){var s,i,n,r,l;const a=document.createElement("span");a.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const h=document.createElement("img"),c=(s=this.def)!=null&&s.srcFn?this.def.srcFn(e.value,e.row):String(e.value??"");h.src=c;const d=((i=this.def)==null?void 0:i.width)??28,f=((n=this.def)==null?void 0:n.height)??28,u=((r=this.def)==null?void 0:r.radius)??4;h.style.cssText=`width:${d}px;height:${f}px;object-fit:cover;border-radius:${defaultAppearance.radius(u)};display:block;`;const p=(l=this.def)==null?void 0:l.alt;return h.alt=typeof p=="function"?p(e.value,e.row):p??"",h.onerror=()=>{h.style.display="none"},a.appendChild(h),a}}class ProgressRenderer{constructor(e){this.def=e}render(e){var s,i,n,r;const l=document.createElement("span");l.style.cssText="display:flex;align-items:center;gap:5px;width:100%;padding:0 4px;box-sizing:border-box;";const a=((s=this.def)==null?void 0:s.max)??100,h=Number(e.value)||0,c=Math.min(100,Math.max(0,h/a*100)),d=(i=this.def)!=null&&i.colorFn?this.def.colorFn(h):((n=this.def)==null?void 0:n.color)??"var(--og-primary,#1976d2)",f=document.createElement("div");f.className="og-progress-track",f.style.cssText=`flex:1;height:10px;background:#e0e0e0;border-radius:${defaultAppearance.radius(5)};overflow:hidden;`;const u=document.createElement("div");if(u.className="og-progress-fill",u.style.cssText=`width:${c}%;height:100%;background:${d};border-radius:${defaultAppearance.radius(5)};`,f.appendChild(u),l.appendChild(f),((r=this.def)==null?void 0:r.showLabel)!==!1){const p=document.createElement("span");p.style.cssText="font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;",p.textContent=`${Math.round(c)}%`,l.appendChild(p)}return l}}class SparklineRenderer{constructor(e){this.def=e}render(e){var s,i,n,r;const l=document.createElement("span");l.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const a=Array.isArray(e.value)?e.value.map(Number):[];if(!a.length)return l.textContent="-",l;const h=((s=this.def)==null?void 0:s.width)??80,c=((i=this.def)==null?void 0:i.height)??22,d=((n=this.def)==null?void 0:n.color)??"#1976d2",f=((r=this.def)==null?void 0:r.chartType)??"bar",u=document.createElement("canvas");u.width=h,u.height=c,u.style.cssText="display:block;";const p=u.getContext("2d");if(p){const g=Math.max(...a,1),m=Math.min(...a,0),w=g-m||1,y=a.length;if(f==="bar"){const v=h/y;a.forEach((_,b)=>{const E=(_-m)/w*(c-2);p.fillStyle=d,p.fillRect(b*v+1,c-E-1,v-2,E)})}else{const v=a.map((_,b)=>({x:b/(y-1||1)*h,y:c-(_-m)/w*(c-4)-2}));f==="area"&&(p.fillStyle=d+"33",p.beginPath(),p.moveTo(v[0].x,c),v.forEach(_=>p.lineTo(_.x,_.y)),p.lineTo(v[v.length-1].x,c),p.closePath(),p.fill()),p.strokeStyle=d,p.lineWidth=1.5,p.beginPath(),v.forEach((_,b)=>b===0?p.moveTo(_.x,_.y):p.lineTo(_.x,_.y)),p.stroke()}}return l.appendChild(u),l}}class SwitchRenderer{render(e){const s=document.createElement("span");s.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const i=!!e.value,n=document.createElement("span");n.className="og-switch"+(i?" og-switch--on":""),n.style.cssText=`display:inline-block;width:34px;height:18px;border-radius:${defaultAppearance.radius(9)};
|
|
29
|
+
background:${i?"var(--og-primary,#1976d2)":"#bdbdbd"};
|
|
30
|
+
position:relative;transition:background 0.2s;cursor:pointer;flex-shrink:0;pointer-events:none;`;const r=document.createElement("span");return r.style.cssText=`position:absolute;top:2px;left:${i?"16px":"2px"};
|
|
31
|
+
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
32
|
+
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`,n.appendChild(r),s.appendChild(n),s}}class RatingRenderer{constructor(e){this.def=e}render(e){var s,i;const n=document.createElement("span");n.style.cssText="display:flex;align-items:center;gap:1px;height:100%;";const r=((s=this.def)==null?void 0:s.max)??5,l=Math.round(Number(e.value)||0),a=((i=this.def)==null?void 0:i.color)??"#ffa000";for(let h=1;h<=r;h++){const c=document.createElement("span");c.textContent="★",c.style.cssText=`font-size:14px;color:${h<=l?a:"#e0e0e0"};line-height:1;`,n.appendChild(c)}return n}}class RadioRenderer{render(e){const s=document.createElement("span");s.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;pointer-events:none;";const i=document.createElement("input");return i.type="radio",i.checked=!!e.value,i.setAttribute("aria-checked",e.value?"true":"false"),i.setAttribute("aria-label",e.column.header??ctxT(e,"cell.radioAria")),e.column.group&&(i.name=`og-radio-${e.rowIndex}-${e.column.group}`),i.style.cssText="width:14px;height:14px;cursor:pointer;accent-color:var(--og-primary,#1976d2);",s.appendChild(i),s}}class ImgRenderer{render(e){const s=document.createElement("span");if(s.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;",!e.value)return s;const i=document.createElement("img");return i.src=String(e.value),i.alt=e.column.alt??e.column.field,i.style.cssText="max-width:100%;max-height:100%;object-fit:contain;display:block;",i.setAttribute("role","img"),s.appendChild(i),s}}function _sanitizeHtml(o){const e=document.createElement("div");return e.innerHTML=o,e.querySelectorAll("script,iframe,object,embed").forEach(s=>s.remove()),e.querySelectorAll("*").forEach(s=>{for(const i of[...s.attributes])i.name.startsWith("on")&&s.removeAttribute(i.name);if(s.tagName==="A"){const i=s.getAttribute("href")??"";/^javascript:/i.test(i)&&s.removeAttribute("href")}}),e.innerHTML}class HtmlRenderer{render(e){const s=document.createElement("span");s.style.cssText="display:block;overflow:hidden;width:100%;";const i=e.column.sanitize!==!1,n=String(e.value??"");return s.innerHTML=i?_sanitizeHtml(n):n,s}}const _C128W=["212222","222122","222221","121223","121322","131222","122213","122312","132212","221213","221312","231212","112232","122132","122231","113222","123122","123221","223211","221132","221231","213212","223112","312131","311222","321122","321221","312212","322112","322211","212123","212321","232121","111323","131123","131321","112313","132113","132311","211313","231113","231311","112133","112331","132131","113123","113321","133121","313121","211331","231131","213113","213311","213131","311123","311321","331121","312113","312311","332111","314111","221411","431111","111224","111422","121124","121421","141122","141221","112214","112412","122114","122411","142112","142211","241211","221114","413111","241112","134111","111242","121142","121241","114212","124112","124211","411212","421112","421211","212141","214121","412121","111143","111341","131141","114113","114311","411113","411311","113141","114131","311141","411131","211412","211214","211232"],_C128_STOP="2331112";function _c128Bits(o){let e="",s=!0;for(const i of o)e+=(s?"1":"0").repeat(+i),s=!s;return e}function _encodeC128B(o){const e=[104];for(const i of o){const n=i.charCodeAt(0)-32;n>=0&&n<=94&&e.push(n)}let s=104;for(let i=1;i<e.length;i++)s+=e[i]*i;return e.push(s%103),e.map(i=>_c128Bits(_C128W[i])).join("")+_c128Bits(_C128_STOP)+"11"}class BarcodeRenderer{render(e){const s=String(e.value??""),i=e.column.barcodeHeight??28,n=document.createElement("div");n.style.cssText="display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;",n.setAttribute("role","img"),n.setAttribute("aria-label",ctxT(e,"cell.barcodeAria",{value:s})),n.innerHTML=_barcodeSvg(s,i);const r=document.createElement("span");return r.textContent=s,r.style.cssText="font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;",n.appendChild(r),n}}function _barcodeSvg(o,e){if(!o)return"";const s=_encodeC128B(o),i=1.4,n=6,r=s.length*i+n*2,l=[];let a=0,h=n;for(;a<s.length;)if(s[a]==="1"){let c=0;for(;a+c<s.length&&s[a+c]==="1";)c++;l.push(`<rect x="${h.toFixed(2)}" y="0" width="${(c*i).toFixed(2)}" height="${e}"/>`),h+=c*i,a+=c}else h+=i,a++;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${r.toFixed(2)} ${e}" width="${r.toFixed(2)}" height="${e}" style="display:block" aria-hidden="true"><g fill="currentColor">${l.join("")}</g></svg>`}const _rendererRegistry=new Map;function registerRenderer(o,e){_rendererRegistry.set(o,e)}registerRenderer("number",()=>new NumberRenderer),registerRenderer("date",()=>new DateRenderer),registerRenderer("boolean",()=>new CheckboxRenderer),registerRenderer("checkbox",()=>new CheckboxRenderer),registerRenderer("radio",()=>new RadioRenderer),registerRenderer("img",()=>new ImgRenderer),registerRenderer("html",()=>new HtmlRenderer),registerRenderer("barcode",()=>new BarcodeRenderer),registerRenderer("switch",()=>new SwitchRenderer),registerRenderer("select",o=>new SelectRenderer(o.options??[],o.optionsFn)),registerRenderer("button",(o,e)=>new ButtonRenderer(e)),registerRenderer("link",(o,e)=>new LinkRenderer(e==null?void 0:e.hrefFn,e==null?void 0:e.target)),registerRenderer("badge",(o,e)=>new BadgeRenderer(e==null?void 0:e.colorMap,e?e.labelMap??e.valueMap:void 0)),registerRenderer("image",(o,e)=>e?new ImageRenderer(e):new TextRenderer),registerRenderer("progress",(o,e)=>e?new ProgressRenderer(e):new TextRenderer),registerRenderer("sparkline",(o,e)=>e?new SparklineRenderer(e):new TextRenderer),registerRenderer("rating",(o,e)=>e?new RatingRenderer(e):new TextRenderer),registerRenderer("template",(o,e)=>e?new TemplateRenderer(e.templateFn):new TextRenderer);const _builtinFactories=new Set(_rendererRegistry.values());function _rendererName(o){const e=o.renderer;return e?typeof e=="string"?e:e.type:String(o.type??"")}function _rendererDef(o){const e=o.renderer;return e&&typeof e!="string"?e:void 0}function createRenderer(o){const e=_rendererRegistry.get(_rendererName(o));return e?e(o,_rendererDef(o)):new TextRenderer}function createBuiltinRenderer(o){const e=_rendererRegistry.get(_rendererName(o));return e?_builtinFactories.has(e)?e(o,_rendererDef(o)):null:new TextRenderer}class ColumnPaintPlan{constructor(e){this.$eq=e,this.$kx=createBuiltinRenderer(e)}renderer(){return this.$kx??createRenderer(this.$eq)}}function isDataCell(o){return o.getAttribute("role")==="gridcell"}class CellLocator{constructor(e,s){this.$s=e,this.$cL=s,this.$md={top:null,cell:null,ri:-1,ci:-1}}locate(e){let s=e instanceof Element?e:(e==null?void 0:e.parentElement)??null,i=null;for(;s&&s.parentElement!==this.$s;)i=s,s=s.parentElement;if(!s)return null;const n=this.$md;if(n.top=s,n.cell=null,n.ri=-1,n.ci=-1,isDataCell(s)){const r=this.$cL.get(s);if(r===void 0)return n;n.cell=s,n.ri=r}else s.classList.contains("og-row")&&(n.ri=Number(s.getAttribute("aria-rowindex"))-1,i&&isDataCell(i)&&(n.cell=i));return n.cell&&(n.ci=Number(n.cell.getAttribute("aria-colindex"))-1),n}}const CELL_ONLY={dblclick:"onCellDblClick",mousedown:"onCellMouseDown",mouseup:"onCellMouseUp",mousemove:"onCellMouseMove"},ENTER_LEAVE={mouseover:"onCellMouseOver",mouseout:"onCellMouseOut"},TYPES=["click","dblclick","mouseover","mouseout","mousedown","mouseup","mousemove","keydown"];class BodyEventRouter{constructor(e,s,i,n){this.$s=e,this.$mo=s,this.$l=i,this.$aK=n,this.$cn=null,this.$hK=-1,this.$hJ=-1,this.$co=null,this.$jD=r=>{const l=this.$cn;this.$co=r,this.$l.onCellDblClick(this.$hK,this.$hJ,r),l&&!l.isConnected&&this.$cn===l&&this.$cm(null,-1,-1),setTimeout(()=>{this.$co===r&&(this.$co=null)},0)};for(const r of TYPES)e.addEventListener(r,this)}destroy(){for(const e of TYPES)this.$s.removeEventListener(e,this);this.$cm(null,-1,-1),this.$co=null}forget(e){this.$cn===e&&this.$cm(null,-1,-1)}$cm(e,s,i){var n;this.$cn!==e&&((n=this.$cn)==null||n.removeEventListener("dblclick",this.$jD),e==null||e.addEventListener("dblclick",this.$jD),this.$cn=e),this.$hK=s,this.$hJ=i}handleEvent(e){const s=e.type;if(s==="keydown"){const a=e.key;(a==="Enter"||a===" ")&&this.$aK.treeToggle(e.target)&&(e.preventDefault(),e.stopPropagation());return}if(s==="click"&&this.$aK.treeToggle(e.target)){e.stopPropagation();return}const i=this.$mo.locate(e.target);if(!i)return;const n=e;if(!i.cell){if(s!=="click")return;i.ri>=0?this.$l.onCellClick(i.ri,-1,n):this.$aK.otherRowClick(i.top);return}if(e.stopPropagation(),s==="click"){this.$cm(i.cell,i.ri,i.ci),this.$l.onCellClick(i.ri,i.ci,n);return}if(s==="dblclick"&&e===this.$co){this.$co=null;return}const r=ENTER_LEAVE[s];if(r){const a=n.relatedTarget;a instanceof Node&&i.cell.contains(a)||this.$l[r](i.ri,i.ci,n);return}const l=CELL_ONLY[s];l&&this.$l[l](i.ri,i.ci,n)}}const EMPTY=Object.freeze([]);function segment(o,e){return Object.freeze({from:leafColIndex(o),to:leafColIndex(e)})}class ColumnWindow{constructor(e,s){this.segments=e,this.count=s;const i=e[0];this.full=e.length===0?s===0:e.length===1&&i.from===0&&i.to===s-1,this.$iI=this.full?EMPTY:ColumnWindow.$lY(e,s),Object.freeze(this)}static full(e){return ColumnWindow.$hZ(e),new ColumnWindow(e===0?EMPTY:Object.freeze([segment(0,e-1)]),e)}static of(e,s){ColumnWindow.$hZ(s);const i=[];let n=-1;for(let r=0;r<e.length;r++){const l=e[r],a=l.from,h=l.to;if(!Number.isInteger(a)||!Number.isInteger(h)||a<0||h>=s||a>h)throw new RangeError(`ColumnWindow: segment [${a}, ${h}] is outside 0..${s-1}`);if(a<=n)throw new RangeError(`ColumnWindow: segment [${a}, ${h}] overlaps or is out of order`);const c=i[i.length-1];c!==void 0&&a===n+1?i[i.length-1]=segment(c.from,h):i.push(segment(a,h)),n=h}return new ColumnWindow(i.length===0?EMPTY:Object.freeze(i),s)}contains(e){const s=this.segments;for(let i=0;i<s.length;i++){const n=s[i];if(e<n.from)return!1;if(e<=n.to)return!0}return!1}forEachColumn(e){const s=this.segments;for(let i=0;i<s.length;i++){const n=s[i];for(let r=n.from;r<=n.to;r++)e(leafColIndex(r))}}gaps(){return this.$iI}equals(e){if(e===this)return!0;if(e.full!==this.full)return!1;const s=this.segments,i=e.segments;if(s.length!==i.length)return!1;for(let n=0;n<s.length;n++)if(s[n].from!==i[n].from||s[n].to!==i[n].to)return!1;return!0}static $hZ(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`ColumnWindow: column count ${e} is invalid`)}static $lY(e,s){const i=[];let n=0;for(let r=0;r<e.length;r++){const l=e[r];l.from>n&&i.push(segment(n,l.from-1)),n=l.to+1}return n<s&&i.push(segment(n,s-1)),i.length===0?EMPTY:Object.freeze(i)}}class BodyRowSet{constructor(){this.$k=new Map}get size(){return this.$k.size}has(e){return this.$k.has(e)}get(e){return this.$k.get(e)}add(e,s){this.$k.set(e,s)}remove(e){const s=this.$k.get(e);return this.$k.delete(e),s}diff(e,s){const i=[],n=[];for(let r=e.start;r<e.end;r++)this.$k.has(r)||i.push(r);for(const r of this.$k.keys())r>=e.start&&r<e.end||s.indexOf(r)>=0||n.push(r);return n.sort((r,l)=>r-l),{enter:i,leave:n}}forEach(e){const s=Array.from(this.$k.keys()).sort((i,n)=>i-n);for(const i of s)e(i,this.$k.get(i))}clear(){this.$k.clear()}}class BodyView{constructor(e,s,i,n,r){this.$s=e,this.$T=s,this.$l=i,this.$at=n,this.$bF=r,this.$cL=new Map,this.$eF=new Map,this.$bH=new Map,this.$am={columns:null,diffBlocked:!0},this.$dZ=new BodyRowSet,this.$cT=new Map,this.$dx=null,this.$ci=0,this.$ez=-1,this.$G=null,this.$I=null,this.$jI=a=>{var h;this.$eA.forget(a);const c=a.firstElementChild;c&&c.classList.contains("og-cf-bar")&&((h=this.$t)==null||h.untrack(c)),this.$bH.size>0&&this.$iE(a)};const l=createExtraCellPainters(i,r);this.$ex=new DataRowPainter(s,i,n,r,l),this.$gq=new GroupRowPainter(s,r),this.$k=new RowPainterTable([this.$ex,this.$gq,new DetailRowPainter(s),new DetailFillerRowPainter]),this.$eA=new BodyEventRouter(e,new CellLocator(e,this.$cL),i,{otherRowClick:a=>{var h;const c=this.$eF.get(a);c!==void 0&&((h=this.$gO)==null||h.call(this,c))},treeToggle:a=>{var h;return this.$bH.has(a)?((h=this.$gQ)==null||h.call(this,this.$bH.get(a)),!0):!1}})}get drawn(){return this.$am}$iE(e){const s=e.getElementsByClassName("og-tree-node-icon--toggle");for(let i=0;i<s.length;i++)this.$bH.delete(s[i])}destroy(){this.$eA.destroy(),this.$cL.clear(),this.$eF.clear(),this.$bH.clear()}setGeometry(e){this.$e=e}setApplier(e){this.$t=e}_t(e,s){return this.$bF(e,s)}cell(e,s){return this.$at.get(e,s)}rebuildWindow(e){if(e.rowWork==="diff"&&this.$lq(e)){this.$lA(e);return}const{startIndex:s,endIndex:i,data:n,totalHeight:r,groupFlatRows:l=null,onGroupToggle:a,onTreeToggle:h,extraOpts:c={},mergeEngine:d,detailApi:f}=e,u=this.$t;u==null||u.release("body");let p=e.opts;Object.keys(c).length&&(p={...p,...c}),f==null||f.onBeforeTeardown(),this.$s.innerHTML="",this.$at.clear(),this.$dZ.clear(),this.$cT.clear(),this.$cL.clear(),this.$eF.clear(),this.$bH.clear(),this.$gO=a,this.$gQ=h;const g=p.autoHeight===!0;this.$s.classList.toggle("og-autoheight",g),this.$s.style.height=g?"":`${r}px`;const m=p._frozenCount??0,w=this.$e,y=w.extra,v=!!f&&y.widthOf("detail")>0,_=e.columns??ColumnWindow.full(w.count);this.$am.columns=_,this.$am.diffBlocked=g||l!==null||!!(d&&!d.isEmpty),this.$I=e,this.$G=null,this.$ci=s,this.$ez=i;const b=w.totalWidth();if(this.$s.style.minWidth=`${b}px`,u==null||u.trackTotal(this.$s,"minWidth","body"),i<s)return;const E=document.createDocumentFragment(),x=this.$if(e,p,_,g,m,v,b,E),S=this.$k;if(l&&f)for(let M=s-1;M>=0;M--){const R=l[M];if(!(R&&R._isDetailFiller===!0)){if(R&&R._isDetailHead===!0&&M+R._span-1>=s){const k=S.painterFor("detail-head").paint(M,R,x);k&&E.appendChild(k)}break}}for(let M=s;M<=i;M++){const R=l?l[M]:null,k=S.painterFor(S.kindOf(R)).paint(M,R,x);k&&(E.appendChild(k),this.$am.diffBlocked||(this.$dZ.add(M,k),this.$cT.set(M,this.$fw(M,x,x.rowState))))}if(n.rowCount===0){const M=_el("div","og-empty-message");M.textContent=this._t("grid.emptyMessage"),M.style.cssText="width:100%;",E.appendChild(M)}this.$s.appendChild(E)}$if(e,s,i,n,r,l,a,h){const{startIndex:c,endIndex:d,data:f,leaves:u,offsetY:p,selectedRows:g,checkedRows:m,groupFlatRows:w=null,mergeEngine:y,detailApi:v}=e,_=this.$e,b=_.extra,E=this.$t,x={opts:s,data:f,leaves:u,startIndex:c,endIndex:d,offsetY:p,selectedRows:g,checkedRows:m,groupFlatRows:w,mergeEngine:y,detailApi:v,detailColOn:l,auto:n,frozenCount:r,geometry:_,totalColWidth:a,frag:h,columns:i,layout:layoutOf(i),plans:u.map(S=>new ColumnPaintPlan(S)),masters:this.$cL,groupKeys:this.$eF,treeIcons:this.$bH,extraIds:b.ids,extraLeft:{state:b.leftOf("state"),drag:b.leftOf("drag"),rowNumber:b.leftOf("rowNumber"),check:b.leftOf("check"),detail:b.leftOf("detail")},extraWidth:b.width(),dragWidth:b.widthOf("drag"),detailWidth:b.widthOf("detail"),applier:E,trackBar:void 0,rowState:"none",bg:"",dnd:null,dragGap:0,cellCi:0,cellSpan:1,rowData:null,treeNode:null,extraCount:0};return this.$G=x,E&&(x.trackBar=(S,M)=>E.trackBar(S,x.cellCi,x.cellSpan,M)),x}$fw(e,s,i){const n=s.opts,r=n._focusCell;let l=`${i??s.data.getRowState(e)}|${s.selectedRows.has(e)?1:0}|${s.checkedRows.has(e)?1:0}|${r&&r.ri===e?r.ci:-1}`;const a=n._rangeRects;if(a)for(const h of a)e>=h.startRow&&e<=h.endRow&&(l+=`|${h.startCol}-${h.endCol}`);return l}$lq(e){const s=this.$I,i=this.$G;if(!s||!i||this.$am.diffBlocked||this.$dZ.size===0||e.data!==s.data||e.leaves.length!==s.leaves.length||e.opts.rowHeight!==s.opts.rowHeight||(e.groupFlatRows??null)!==null||e.opts.autoHeight===!0||e.mergeEngine&&!e.mergeEngine.isEmpty||e.endIndex<e.startIndex)return!1;const n=this.$am.columns,r=e.columns??ColumnWindow.full(this.$e.count);return!n||n.count!==r.count?!1:Math.min(this.$ez,e.endIndex)>=Math.max(this.$ci,e.startIndex)}$lA(e){var s;const i=this.$am.columns,{startIndex:n,endIndex:r,totalHeight:l,extraOpts:a={}}=e;let h=e.opts;Object.keys(a).length&&(h={...h,...a});const c=this.$e,d=e.columns??ColumnWindow.full(c.count),f=`${l}px`;this.$s.style.height!==f&&(this.$s.style.height=f);const u=c.totalWidth(),p=`${u}px`;this.$s.style.minWidth!==p&&(this.$s.style.minWidth=p);const g=!!e.detailApi&&c.extra.widthOf("detail")>0,m=document.createDocumentFragment(),w=((s=this.$G)==null?void 0:s.extraCount)??0,y=this.$if(e,h,d,!1,h._frozenCount??0,g,u,m);y.extraCount=w,this.$I=e,this.$ci=n,this.$ez=r,this.$gO=e.onGroupToggle,this.$gQ=e.onTreeToggle;const v=this.$dZ,_=this.$dx!==null?[this.$dx]:[],{enter:b,leave:E}=v.diff({start:viewIndex(n),end:viewIndex(r+1)},_);for(const C of E)this.$ga(C,v.remove(C));const x=this.$ex,S=!i.equals(d),M=h.rowHeight;v.forEach((C,I)=>{if(C!==this.$dx&&this.$cT.get(C)!==this.$fw(C,y)){this.$ga(C,I,!0);const T=x.paint(C,null,y);T?(I.replaceWith(T),this.$cT.set(C,this.$fw(C,y,y.rowState)),v.add(C,T)):(I.remove(),v.remove(C));return}S&&x.shift(I,C,null,i,y,this.$jI);const L=`${e.offsetY+(C-n)*M}px`;I.style.top!==L&&(I.style.top=L)});const R=[];v.forEach(C=>{R.push(C)});let k=0;for(const C of b){for(;k<R.length&&R[k]<C;)k++;const I=k<R.length?v.get(R[k]):null,L=x.paint(C,null,y);L&&(this.$s.insertBefore(L,I),v.add(C,L),this.$cT.set(C,this.$fw(C,y,y.rowState)))}m.firstChild&&this.$s.appendChild(m),this.$am.columns=d}$ga(e,s,i=!1){this.$at.dropRow(e),this.$cT.delete(e);const n=this.$t,r=s.getElementsByTagName("*");for(let l=0;l<r.length;l++){const a=r[l];n==null||n.untrack(a),a.getAttribute("role")==="gridcell"&&this.$eA.forget(a)}n==null||n.untrack(s),this.$bH.size>0&&this.$iE(s),i||s.remove()}pin(e){if(!("editRow"in e))return;const s=this.$dx,i=e.editRow??null;if(this.$dx=i,s===null||s===i||s>=this.$ci&&s<=this.$ez)return;const n=this.$dZ.remove(s);n&&this.$ga(s,n)}update(e,s,i){const n=e.columns;if(s==="rebuild"||s==="clear"||s==="diff"){this.$I&&this.rebuildWindow({...this.$I,columns:n});return}if(i!=="shift")return;const r=this.$am.columns,l=this.$G;if(r&&r.equals(n))return;if(!r||!l||r.count!==n.count){this.$I&&this.rebuildWindow({...this.$I,columns:n});return}l.columns=n,l.layout=layoutOf(n);const a=l.groupFlatRows;for(let h=this.$s.firstElementChild;h;h=h.nextElementSibling){const c=h.classList;if(c.contains("og-row")){const d=Number(h.getAttribute("aria-rowindex"))-1;this.$ex.shift(h,d,a?a[d]:null,r,l,this.$jI)}else c.contains("og-group-row")&&a&&this.$gq.shift(h,a[Number(h.getAttribute("aria-rowindex"))-1],l)}this.$am.columns=n}}class ScrollLeftFollower{constructor(){this.$db=[],this.$q=null,this.$ad=0,this.$bx=()=>{this.sync(this.$q.scrollLeft)}}follow(e){this.$db.indexOf(e)>=0||(this.$db.push(e),this.$ad!==0&&(e.scrollLeft=this.$ad))}unfollow(e){const s=this.$db.indexOf(e);s>=0&&this.$db.splice(s,1)}sync(e){this.$ad=e;const s=this.$db;for(let i=0;i<s.length;i++)s[i].scrollLeft=e}listenTo(e){this.$q!==e&&(this.$ii(),this.$q=e,e.addEventListener("scroll",this.$bx,{passive:!0}))}destroy(){this.$ii(),this.$db.length=0,this.$ad=0}$ii(){this.$q&&(this.$q.removeEventListener("scroll",this.$bx),this.$q=null)}}function spanOf(o,e,s){return o.spanWidth(leafColIndex(e),s-e+1)}function hits(o,e,s){for(const i of o.widthCols){if(i>s)return!1;if(i>=e)return!0}return!1}function single(o,e){return{touched:e,emit:(s,i,n,r)=>r(i.el,o(s,i))}}const spanTouched=(o,e)=>hits(o,e.ci,e.last),KINDS={cell:single((o,e)=>spanOf(o,e.ci,e.last),spanTouched),span:single((o,e)=>spanOf(o,e.ci,e.last)+e.extra,spanTouched),gap:single((o,e)=>spanOf(o,e.ci,e.last)+e.extra,spanTouched),left:single((o,e)=>o.leftOf(leafColIndex(e.ci)),(o,e)=>e.ci>=o.leftFrom),total:single(o=>o.totalWidth(),o=>o.totalChanged),extra:single(o=>o.extra.width(),()=>!1),bar:single((o,e)=>Math.max(0,Math.min(1,e.ratio))*spanOf(o,e.ci,e.last),spanTouched),row:{touched:spanTouched,emit:(o,e,s,i)=>{const n=e.el.children;for(let r=e.ci;r<=e.last;r++){if(s&&!hits(s,r,r))continue;const l=n[e.child+(r-e.ci)];l&&i(l,o.widthOf(leafColIndex(r)))}}}},PROPS={w:["width"],wm:["width","minWidth"],wmm:["width","minWidth","maxWidth"]},WIDTH_ONLY=PROPS.w,MIN_ONLY=["minWidth"],LEFT_ONLY=["left"],CELL_PROPS=PROPS.wmm,px=o=>`${o}px`;class GeometryApplier{constructor(e,s){this.$aS={header:new Map,body:new Map,footer:new Map},this.$e=e,this.$p=s}writeCellWidth(e,s,i){const n=px(this.$e.widthOf(leafColIndex(s)));for(const r of PROPS[i])e.style[r]=n}trackHeaderCell(e,s,i){this._add("header",e,"cell",s,s,PROPS[i],0,0)}trackSpan(e,s,i,n,r,l=0){this._add(r,e,"span",s,s+Math.max(1,i)-1,PROPS[n],0,0,l)}trackRowCells(e,s,i,n,r,l){n<i||this._add(l,e,"row",i,n,PROPS[r],0,s)}trackLeft(e,s,i){this._add(i,e,"left",s,s,LEFT_ONLY,0,0)}trackTotal(e,s,i){this._add(i,e,"total",0,0,s==="width"?WIDTH_ONLY:MIN_ONLY,0,0)}trackExtra(e,s){this._add(s,e,"extra",0,0,WIDTH_ONLY,0,0)}trackGap(e,s,i,n,r=0){this._add(n,e,"gap",s,i,WIDTH_ONLY,0,0,r)}trackBar(e,s,i,n){this._add("body",e,"bar",s,s+Math.max(1,i)-1,WIDTH_ONLY,n,0)}untrack(e){this.$aS.header.delete(e),this.$aS.body.delete(e),this.$aS.footer.delete(e)}release(e){this.$aS[e].clear()}applyChange(e,s){if(e.none)return;const i=this.$e,n=e.structural,r=(s==null?void 0:s.skipScope)==="body",l=r?0:i.count,a=i.frozenCount;for(let c=0;c<l;c++){const d=n||hits(e,c,c),f=c<a&&(n||c>=e.leftFrom);if(!d&&!f)continue;const u=px(i.widthOf(leafColIndex(c))),p=px(i.leftOf(leafColIndex(c)));for(const g of this.$p.cellsOfColumn(c)){if(d)for(const m of CELL_PROPS)setIfDiff(g,m,u);f&&setIfDiff(g,"left",p)}}const h=n?null:e;for(const c of this.$ca())if(!(r&&c===this.$aS.body))for(const[d,f]of c){if(!d.isConnected){c.delete(d);continue}for(const u of f){const p=KINDS[u.kind];h&&!p.touched(h,u)||p.emit(i,u,h,(g,m)=>{const w=px(m);for(const y of u.props)setIfDiff(g,y,w)})}}}projections(e){const s=[];for(const i of this.$ca(e))for(const n of i.values())for(const r of n)KINDS[r.kind].emit(this.$e,r,null,(l,a)=>{for(const h of r.props)s.push({el:l,prop:h,value:px(a)})});return s}trackedCount(e){let s=0;for(const i of this.$ca(e))for(const n of i.values())s+=n.length;return s}$ca(e){return e?[this.$aS[e]]:[this.$aS.header,this.$aS.body,this.$aS.footer]}_add(e,s,i,n,r,l,a,h,c=0){const d=this.$aS[e],f={el:s,kind:i,ci:n,last:r,props:l,ratio:a,child:h,extra:c},u=d.get(s);if(!u){d.set(s,[f]);return}const p=u.findIndex(g=>g.kind===i);p>=0?u[p]=f:u.push(f)}}function setIfDiff(o,e,s){o.style[e]!==s&&(o.style[e]=s)}class ScrollbarGutter{constructor(e,s,i){this.$s=e,this.$N=s,this.$ej=i,this.$bB=null,this.$gZ=0,!(typeof ResizeObserver>"u")&&(this.$bB=new ResizeObserver(()=>this.measure()),this.$bB.observe(e))}get px(){return this.$gZ}measure(){const e=Math.max(0,Math.round(this.$N.clientWidth-this.$s.clientWidth));e!==this.$gZ&&(this.$gZ=e,this.$ej(e))}destroy(){var e;(e=this.$bB)==null||e.disconnect(),this.$bB=null}}class GridRenderer{constructor(e,s,i,n){this.$at=new CellRegistry,this.$aJ=new ScrollLeftFollower,this.$t=null,this.$V=null,this.$iO=null,this._root=e,this.$aA=s,this.$l=i,this.$aP=new ResizeHandleBinder(r=>r.offsetWidth,(r,l)=>i.onColResize(r,l)),this.$T=n??new AppearanceResolver(new ThemeContext(s.theme??"default")),this.$N=_el("div","og-header"),this.$N.style.cssText=`flex-shrink:0;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:${this.$T.divider()};scrollbar-width:none;`,this.$bs=new HeaderView(this.$N,this.$T,this.$l,this.$aP,(r,l)=>this._t(r,l)),this.$aV=_el("div","og-body-wrapper"),this.$aV.style.cssText="flex:1;overflow:auto;position:relative;",this.$aV.style.setProperty("--scrollbar-size","8px"),this.$s=_el("div","og-body"),this.$s.style.cssText="position:relative;",this.$aV.appendChild(this.$s),this.$cs=new BodyView(this.$s,this.$T,this.$l,this.$at,(r,l)=>this._t(r,l)),e.appendChild(this.$N),e.appendChild(this.$aV),this.$aJ.follow(this.$N),this.$aJ.listenTo(this.$aV),this.$V=new ScrollbarGutter(this.$aV,this.$N,r=>{var l;this.$bs.setEndGutter(r),(l=this.$iO)==null||l.call(this,r)})}get follower(){return this.$aJ}get applier(){return this.$t}get bodyView(){return this.$cs}onEndGutter(e){var s;this.$iO=e,(s=this.$V)!=null&&s.px&&e(this.$V.px)}connectResize(e){this.$aP.connect(e)}commitColumnResize(e,s){this.$l.onColResize(e,s)}get bodyWrapper(){return this.$aV}_t(e,s){return this.$l.t?this.$l.t(e,s):t(e,s)}updateSize(e,s){this.$aV.style.height=`${e-s}px`}setSortIndicator(e){this.$bs.setSortIndicator(e)}setGeometry(e){this.$bs.setGeometry(e),this.$cs.setGeometry(e),this.$t=new GeometryApplier(e,this.$at),this.$bs.setApplier(this.$t),this.$cs.setApplier(this.$t)}getHeaderHeight(){return this.$bs.height()}renderHeader(e,s,i,n,r){this.$bs.paint(e,s,i,n,r)}renderBody(e){this.$cs.rebuildWindow(e)}getCellEl(e,s){return this.$at.get(e,s)}destroy(){var e;this.$aJ.destroy(),(e=this.$V)==null||e.destroy(),this.$bs.destroy(),this.$cs.destroy(),this._root.innerHTML=""}}function _detailExpanderButton(o,e,s,i){const n=_el("span","og-detail-expander");n.textContent=o.glyph,n.title=o.title,n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",o.ariaLabel),e&&n.setAttribute("aria-controls",`og-detail-${e}`),n.style.cssText="cursor:pointer;display:inline-flex;align-items:center;justify-content:center;min-width:22px;min-height:22px;user-select:none;line-height:1;";const r=e,l=s,a=h=>{h.stopPropagation(),r&&i.onToggle(l,r)};return n.addEventListener("click",a),n.addEventListener("keydown",h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),a(h))}),n}function _downloadText(o,e,s="text/plain;charset=utf-8"){const i=new Blob([o],{type:s}),n=URL.createObjectURL(i),r=document.createElement("a");r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}const FORM_TOKENS=new Set(["--og-radius-none","--og-radius-sm","--og-radius-md","--og-radius-lg","--og-radius-pill","--og-radius-container","--og-radius-control","--og-radius-widget","--og-container-radius","--og-border-width","--og-border-width-strong","--og-border-style","--og-divider-style","--og-divider-repeat","--og-elevation-sm","--og-elevation-md","--og-elevation-lg","--og-elevation-alpha-sm","--og-elevation-alpha-md","--og-elevation-alpha-lg","--og-elevation-inset","--og-cell-padding-x","--og-cell-padding-y","--og-density-row-height","--og-density-header-height","--og-density-footer-height","--og-scrollbar-size","--og-texture-bg","--og-texture-size","--og-texture-opacity","--og-focus-width","--og-focus-style","--og-focus-offset","--og-focus-radius","--og-icon-size","--og-icon-fill","--og-icon-stroke-width","--og-icon-corner","--og-transition-fast","--og-transition-base","--og-row-accent-width"]),HEX_COLOR=/#[0-9a-fA-F]{3,8}\b/,FUNC_COLOR_LITERAL=/\b(?:rgba?|hsla?)\(\s*\d/,NAMED_COLOR=/\b(?:red|green|blue|black|white|gray|grey|yellow|orange|purple|pink|brown|cyan|magenta)\b/i;function assertFormOnly(o,e){for(const[s,i]of Object.entries(e)){const n=s;if(!FORM_TOKENS.has(n))throw new Error(`[SkinRegistry] 스킨 "${o}" 의 토큰 "${n}" 은 FORM 토큰이 아닙니다. 스킨은 형태(radius/border/elevation/…)만 소유하며 색 토큰은 data-og-theme 축입니다(색⊥형태 직교성).`);const r=String(i??"");if(HEX_COLOR.test(r)||FUNC_COLOR_LITERAL.test(r)||NAMED_COLOR.test(r))throw new Error(`[SkinRegistry] 스킨 "${o}" 토큰 "${n}: ${r}" 에 색 리터럴이 있습니다. 스킨 델타는 색을 담을 수 없습니다(Rule 2). 색이 필요하면 COLOR 토큰(예: var(--og-texture-ink))을 참조하세요.`)}}function applyGuardrails(o,e){const s={...e},i=[],n=s["--og-focus-width"];if(n!=null){const r=parseFloat(String(n));!Number.isNaN(r)&&r<2&&(s["--og-focus-width"]="2px",i.push(`focus-width ${n} → 2px (가시 포커스 최소 2px, 접근성 가드레일)`))}return s["--og-focus-style"]==="none"&&(s["--og-focus-style"]="solid",i.push("focus-style none → solid (가시 포커스 비협상, 접근성 가드레일)")),{delta:s,warnings:i}}class SkinRegistry{constructor(){this.$eb=new Map,this.$ed=null}registerBuiltin(e,s){assertFormOnly(e,s);const{delta:i}=applyGuardrails(e,s);this.$eb.set(e,i)}define(e,s){assertFormOnly(e,s);const i=applyGuardrails(e,s);this.$eb.set(e,i.delta);for(const n of i.warnings)typeof console<"u"&&console.warn(`[SkinRegistry] "${e}": ${n}`);return this.$mh(e,i.delta),i}has(e){return this.$eb.has(e)}get(e){return this.$eb.get(e)}list(){return[...this.$eb.keys()]}$mh(e,s){if(typeof document>"u")return;this.$ed||(this.$ed=document.createElement("style"),this.$ed.setAttribute("data-og-skins","runtime"),document.head.appendChild(this.$ed));const i=Object.entries(s).map(([n,r])=>` ${n}: ${r};`).join(`
|
|
33
|
+
`);this.$ed.appendChild(document.createTextNode(`
|
|
34
|
+
.og-container[data-og-skin="${e}"] {
|
|
35
|
+
${i}
|
|
36
|
+
}
|
|
37
|
+
`))}}const SKIN_SHARP={"--og-radius-sm":"0","--og-radius-md":"0","--og-radius-lg":"0","--og-radius-pill":"0","--og-radius-container":"0","--og-container-radius":"0","--og-border-width":"1px","--og-border-style":"solid","--og-divider-style":"solid","--og-elevation-sm":"none","--og-elevation-md":"none","--og-elevation-lg":"0 1px 2px","--og-cell-padding-x":"6px","--og-density-row-height":"28","--og-density-header-height":"28","--og-focus-width":"2px","--og-focus-style":"solid","--og-focus-radius":"0","--og-icon-fill":"0","--og-icon-corner":"miter"},SKIN_ROUNDED={"--og-radius-sm":"4px","--og-radius-md":"8px","--og-radius-lg":"12px","--og-radius-pill":"999px","--og-radius-container":"12px","--og-container-radius":"12px","--og-radius-control":"8px","--og-radius-widget":"6px","--og-border-width":"1px","--og-border-style":"solid","--og-elevation-sm":"0 1px 3px","--og-elevation-md":"0 4px 12px","--og-elevation-lg":"0 12px 32px","--og-elevation-alpha-sm":"0.06","--og-elevation-alpha-md":"0.10","--og-elevation-alpha-lg":"0.16","--og-cell-padding-x":"12px","--og-cell-padding-y":"2px","--og-density-row-height":"40","--og-density-header-height":"42","--og-focus-width":"2px","--og-focus-offset":"2px","--og-focus-radius":"8px","--og-icon-fill":"0","--og-icon-corner":"round"},SKIN_STITCH={"--og-radius-sm":"2px","--og-radius-md":"3px","--og-radius-lg":"4px","--og-container-radius":"3px","--og-border-width":"1px","--og-border-style":"dashed","--og-divider-style":"dashed","--og-divider-repeat":"2","--og-texture-bg":"repeating-linear-gradient(45deg, rgba(var(--og-texture-ink),0.04) 0 2px, transparent 2px 6px)","--og-texture-size":"6px 6px","--og-texture-opacity":"1","--og-elevation-sm":"0 1px 2px","--og-elevation-md":"0 2px 4px","--og-elevation-lg":"0 4px 10px","--og-cell-padding-x":"10px","--og-density-row-height":"36","--og-focus-style":"dashed","--og-icon-fill":"0","--og-icon-corner":"round"},SKIN_FLAT={"--og-radius-sm":"2px","--og-radius-md":"3px","--og-radius-lg":"4px","--og-container-radius":"4px","--og-border-width":"1px","--og-border-style":"solid","--og-divider-style":"solid","--og-elevation-sm":"none","--og-elevation-md":"none","--og-elevation-lg":"none","--og-elevation-inset":"none","--og-cell-padding-x":"10px","--og-density-row-height":"34","--og-focus-width":"2px","--og-focus-style":"solid","--og-icon-fill":"0","--og-icon-corner":"round"},SKIN_HIGH_CONTRAST={"--og-radius-sm":"0","--og-radius-md":"2px","--og-radius-lg":"2px","--og-container-radius":"2px","--og-border-width":"2px","--og-border-width-strong":"3px","--og-border-style":"solid","--og-divider-style":"solid","--og-elevation-sm":"none","--og-elevation-md":"0 2px 4px","--og-elevation-lg":"0 4px 8px","--og-elevation-alpha-md":"0.30","--og-elevation-alpha-lg":"0.40","--og-cell-padding-x":"10px","--og-density-row-height":"40","--og-focus-width":"3px","--og-focus-style":"solid","--og-focus-offset":"2px","--og-focus-radius":"0","--og-icon-size":"18px","--og-icon-fill":"1","--og-icon-stroke-width":"2","--og-icon-corner":"miter"},SKIN_MATERIAL={"--og-radius-sm":"2px","--og-radius-md":"4px","--og-radius-lg":"8px","--og-container-radius":"8px","--og-radius-control":"4px","--og-radius-widget":"4px","--og-border-width":"1px","--og-border-style":"solid","--og-divider-style":"solid","--og-elevation-sm":"0 1px 2px","--og-elevation-md":"0 2px 6px","--og-elevation-lg":"0 8px 24px","--og-elevation-alpha-sm":"0.12","--og-elevation-alpha-md":"0.16","--og-elevation-alpha-lg":"0.20","--og-cell-padding-x":"8px","--og-density-row-height":"36","--og-focus-width":"2px","--og-focus-style":"solid","--og-focus-offset":"1px","--og-icon-fill":"0","--og-icon-corner":"round"},BUILTIN_SKINS=[["sharp",SKIN_SHARP],["rounded",SKIN_ROUNDED],["stitch",SKIN_STITCH],["flat",SKIN_FLAT],["high-contrast",SKIN_HIGH_CONTRAST],["material",SKIN_MATERIAL]],skinRegistry=new SkinRegistry;for(const[o,e]of BUILTIN_SKINS)skinRegistry.registerBuiltin(o,e);const DEFAULT_AXIS_VALUE="default",EMPTY_RESOLUTION=Object.freeze({tokens:Object.freeze({})});function assertNamespace(o,e,s){for(const i of Object.keys(s))if(!e.has(i))throw new Error(`[AppearanceAxis:${o}] 토큰 "${i}" 은 ${o} 축 이름공간이 아닙니다. 각 축은 자기 이름공간 토큰만 소유합니다(축 섞임 금지 — 이름-분리 물리 직교, 불변식 1).`)}class TokenAxis{constructor(e){this.$ah=new Map,this.id=e.id,this.namespace=e.namespace,this.$hL=e.attrName,this.$kg=e.requiresRelayout??!1}registerBuiltin(e,s){assertNamespace(this.id,this.namespace,s),this.$ah.set(e,this.$cB(e,s).delta)}$cB(e,s){return{delta:s,warnings:[]}}define(e,s){assertNamespace(this.id,this.namespace,s);const i=this.$cB(e,s);this.$ah.set(e,i.delta);for(const n of i.warnings)typeof console<"u"&&console.warn(`[AppearanceAxis:${this.id}] "${e}": ${n}`);return i}has(e){return this.$ah.has(e)}resolve(e){if(e===DEFAULT_AXIS_VALUE)return EMPTY_RESOLUTION;const s=this.$ah.get(e);if(s===void 0)return EMPTY_RESOLUTION;const i={tokens:s,attr:{name:this.$hL,value:e}};return this.$kg&&(i.requiresRelayout=!0),i}list(){return[...this.$ah.keys()]}}const DENSITY_TOKENS=new Set(["--og-density-row-height","--og-density-header-height","--og-density-footer-height","--og-font-size","--og-density-touch-min"]),TOUCH_MIN_PX=44;class DensityRegistry extends TokenAxis{constructor(){super({id:"density",attrName:"data-og-density",namespace:DENSITY_TOKENS,requiresRelayout:!0})}$cB(e,s){const i={...s},n=[];for(const r of["--og-density-row-height","--og-density-header-height","--og-density-footer-height"]){const l=i[r];if(l==null)continue;const a=parseFloat(String(l));!Number.isNaN(a)&&a<TOUCH_MIN_PX&&e.includes("touch")&&(i[r]=`${TOUCH_MIN_PX}px`,n.push(`${r} ${l} → ${TOUCH_MIN_PX}px (터치 히트타깃 최소 44px, REQ-T2-018)`))}return{delta:i,warnings:n}}}const DENSITY_COMPACT={"--og-density-row-height":"28px","--og-density-header-height":"30px","--og-density-footer-height":"28px","--og-font-size":"12px"},DENSITY_COMFORTABLE={"--og-density-row-height":"36px","--og-density-header-height":"38px","--og-density-footer-height":"36px","--og-font-size":"13px"},DENSITY_SPACIOUS={"--og-density-row-height":"40px","--og-density-header-height":"44px","--og-density-footer-height":"40px","--og-font-size":"14px"},DENSITY_GALLERY={"--og-density-row-height":"56px","--og-density-header-height":"48px","--og-density-footer-height":"48px","--og-font-size":"15px"},DENSITY_COMPACT_TOUCH={"--og-density-row-height":"44px","--og-density-header-height":"44px","--og-density-footer-height":"44px","--og-font-size":"13px"},BUILTIN_DENSITIES=[["compact",DENSITY_COMPACT],["comfortable",DENSITY_COMFORTABLE],["spacious",DENSITY_SPACIOUS],["gallery",DENSITY_GALLERY],["compact-touch",DENSITY_COMPACT_TOUCH]],densityRegistry=new DensityRegistry;for(const[o,e]of BUILTIN_DENSITIES)densityRegistry.registerBuiltin(o,e);const TEXTURE_TOKENS=new Set(["--og-texture-bg","--og-texture-size","--og-texture-opacity","--og-texture-seam","--og-texture-zone"]),TEXTURE_OPACITY_CAP=.1;class TextureRegistry extends TokenAxis{constructor(){super({id:"texture",attrName:"data-og-texture",namespace:TEXTURE_TOKENS})}$cB(e,s){const i={...s},n=[],r=i["--og-texture-opacity"];if(r!=null){const l=parseFloat(String(r));!Number.isNaN(l)&&l>TEXTURE_OPACITY_CAP&&(i["--og-texture-opacity"]=String(TEXTURE_OPACITY_CAP),n.push(`--og-texture-opacity ${r} → ${TEXTURE_OPACITY_CAP} (질감 알파 정직 상한, 텍스트 아래 AA 안전, §9.5)`))}return{delta:i,warnings:n}}}const TEXTURE_LINEN={"--og-texture-bg":"repeating-linear-gradient(0deg, rgba(var(--og-texture-ink, 0, 0, 0),0.05) 0 1px, transparent 1px 4px), repeating-linear-gradient(90deg, rgba(var(--og-texture-ink, 0, 0, 0),0.04) 0 1px, transparent 1px 4px)","--og-texture-size":"4px 4px","--og-texture-opacity":"0.06","--og-texture-zone":"chrome"},TEXTURE_PAPER_GRAIN={"--og-texture-bg":"radial-gradient(rgba(var(--og-texture-ink, 0, 0, 0),0.05) 0.5px, transparent 0.5px)","--og-texture-size":"3px 3px","--og-texture-opacity":"0.05","--og-texture-zone":"chrome"},TEXTURE_GRAPH={"--og-texture-bg":"repeating-linear-gradient(0deg, rgba(var(--og-texture-ink, 0, 0, 0),0.06) 0 1px, transparent 1px 8px), repeating-linear-gradient(90deg, rgba(var(--og-texture-ink, 0, 0, 0),0.06) 0 1px, transparent 1px 8px)","--og-texture-size":"8px 8px","--og-texture-opacity":"0.07","--og-texture-seam":"var(--og-texture-ink)","--og-texture-zone":"chrome"},BUILTIN_TEXTURES=[["linen",TEXTURE_LINEN],["paper-grain",TEXTURE_PAPER_GRAIN],["graph",TEXTURE_GRAPH]],textureRegistry=new TextureRegistry;for(const[o,e]of BUILTIN_TEXTURES)textureRegistry.registerBuiltin(o,e);const TABLE=[{id:"state",width:24},{id:"drag",width:18},{id:"rowNumber",width:44},{id:"check",width:36},{id:"detail",width:28}],CACHE=new Array(1<<TABLE.length);class ExtraColumns{constructor(e){const s=[];this.$ai=new Float64Array(TABLE.length),this.$w=new Float64Array(TABLE.length);let i=0;for(let n=0;n<TABLE.length;n++){const r=(e&1<<n)!==0;this.$w[n]=i,r&&(s.push(TABLE[n].id),this.$ai[n]=TABLE[n].width,i+=TABLE[n].width)}this.ids=Object.freeze(s),this._total=i}static fromOptions(e){const s=e??{},i=(s.stateColumn?1:0)|(s.draggable?2:0)|(s.rowNumber?4:0)|(s.checkColumn?8:0)|(s.detailExpanderCol?16:0);return CACHE[i]??(CACHE[i]=new ExtraColumns(i))}widthOf(e){return px$1(this.$ai[indexOf(e)])}leftOf(e){const s=indexOf(e);return px$1(this.$ai[s]>0?this.$w[s]:this._total)}width(){return px$1(this._total)}}const INDEX={state:0,drag:1,rowNumber:2,check:3,detail:4};function indexOf(o){return INDEX[o]}function findCol(o,e){const s=o.length-1;if(s<=0)return 0;let i=0,n=s-1;const r=Math.max(0,e);for(;i<n;){const l=i+n+1>>>1;o[l]<=r?i=l:n=l-1}return i}class ColumnMetrics{constructor(e,s){const i=e.map(r=>Math.max(0,r)),n=new Array(i.length+1);n[0]=0;for(let r=0;r<i.length;r++)n[r+1]=n[r]+i[r];this.$aj=i,this.$w=n,this.$go=Math.max(0,Math.min(Math.floor(s),i.length))}get count(){return this.$aj.length}totalWidth(){return px$1(this.$w[this.$aj.length])}leftOf(e){const s=this.$ls(e);return px$1(this.$w[s])}widthOf(e){return e<0||e>=this.$aj.length?px$1(0):px$1(this.$aj[Math.floor(e)])}colAt(e){return leafColIndex(findCol(this.$w,e))}get frozenLeft(){return this.$go}frozenWidth(){return px$1(this.$w[this.$go])}$ls(e){return e<0?0:e>this.$aj.length?this.$aj.length:Math.floor(e)}}const HISTORY_CAP=64,EMPTY_COLS=Object.freeze([]);function noneAt(o,e){return Object.freeze({none:!0,widthCols:EMPTY_COLS,leftFrom:leafColIndex(e),totalChanged:!1,structural:!1,version:o})}const MAX_WIDTH=1e15;function sanitize(o){return px$1(Number.isFinite(o)&&o>0?Math.min(MAX_WIDTH,o):0)}function clampFrozen(o,e){return Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),e)):0}function sameExtra(o,e){if(o===e)return!0;if(o.ids.length!==e.ids.length)return!1;for(let s=0;s<o.ids.length;s++){const i=o.ids[s];if(i!==e.ids[s]||o.widthOf(i)!==e.widthOf(i))return!1}return!0}class ColumnGeometry{constructor(e,s,i){this.$dI=0,this.$bf=0,this.$aY=[],this.$cr=0,this.$eK(e.map(sanitize),s,i),this.$cN=noneAt(this.$bf,this.count)}get version(){return this.$bf}get count(){return this.$aM.count}get frozenCount(){return this.$aM.frozenLeft}get extra(){return this.$dz}widthOf(e){return Number.isInteger(e)?this.$aM.widthOf(e):px$1(0)}leftOf(e){return px$1(this.$dI+this.$aM.leftOf(Number.isFinite(e)?e:leafColIndex(0)))}spanWidth(e,s){if(!(s>0)||!Number.isFinite(e))return px$1(0);const i=this.count,n=Math.min(i,Math.max(0,Math.floor(e))),r=Math.min(i,n+Math.floor(s));return px$1(this.$aM.leftOf(leafColIndex(r))-this.$aM.leftOf(leafColIndex(n)))}totalWidth(){return px$1(this.$dI+this.$aM.totalWidth())}frozenRight(){return px$1(this.$dI+this.$aM.frozenWidth())}colAt(e){return this.$aM.colAt(px$1(e-this.$dI))}widths(){return this.$aj}changesSince(e){if(e===this.$bf)return this.$cN;if(!(e>=this.$cr&&e<this.$bf))return this.$kG();const s=e-this.$cr;if(s===this.$aY.length-1)return this.$aY[s];let i=this.count,n=!1;for(let a=s;a<this.$aY.length;a++){const h=this.$aY[a];if(h.structural)return this.$kG();h.totalChanged&&(n=!0),h.leftFrom<i&&(i=h.leftFrom)}const r=new Set;for(let a=s;a<this.$aY.length;a++)for(const h of this.$aY[a].widthCols)r.add(h);const l=Array.from(r).sort((a,h)=>a-h).map(leafColIndex);return Object.freeze({none:!1,widthCols:Object.freeze(l),leftFrom:leafColIndex(i),totalChanged:n,structural:!1,version:this.$bf})}reset(e,s,i){const n=e.map(sanitize),r=clampFrozen(i,n.length),l=n.length!==this.count||r!==this.frozenCount||!sameExtra(s,this.$dz),a=this.totalWidth();if(l)return this.$eK(n,s,i),this.$bj(this.$kF(this.totalWidth()!==a));const h=[];for(let c=0;c<n.length;c++)n[c]!==this.$aj[c]&&h.push(leafColIndex(c));return this.$dz=s,h.length===0?this.$cN:(this.$eK(n,s,i),this.$bj({widthCols:Object.freeze(h),leftFrom:leafColIndex(h[0]+1),totalChanged:this.totalWidth()!==a,structural:!1}))}resize(e,s){if(!Number.isInteger(e)||e<0||e>=this.count)throw new RangeError(`column index out of range: ${e} (count ${this.count})`);if(!Number.isFinite(s))return this.$cN;const i=Math.min(MAX_WIDTH,Math.max(1,Math.round(s)));if(i===this.$aj[e])return this.$cN;const n=this.$aj.slice();return n[e]=px$1(i),this.$eK(n,this.$dz,this.frozenCount),this.$bj({widthCols:Object.freeze([e]),leftFrom:leafColIndex(e+1),totalChanged:!0,structural:!1})}$eK(e,s,i){this.$aj=Object.freeze(e),this.$aM=new ColumnMetrics(e,clampFrozen(i,e.length)),this.$dz=s,this.$dI=s.width()}$bj(e){this.$bf++;const s=Object.freeze({none:!1,...e,version:this.$bf});return this.$aY.push(s),this.$aY.length>HISTORY_CAP&&(this.$aY.shift(),this.$cr++),this.$cN=noneAt(this.$bf,this.count),s}$kF(e){const s=this.count,i=new Array(s);for(let n=0;n<s;n++)i[n]=leafColIndex(n);return{widthCols:Object.freeze(i),leftFrom:leafColIndex(0),totalChanged:e,structural:!0}}$kG(){return Object.freeze({none:!1,...this.$kF(!0),version:this.$bf})}}const PORT_SHAPE_BASE={autoHeight:!1,mergeEmpty:!0,virtualColumns:!0},NO_PINNED$2=Object.freeze([]);class ColumnWindowPolicy{constructor(e,s,i){this.$iG=null,this.$jf=NaN,this.$e=e,this.$kn=Object.freeze([...s]),this.$ju=ColumnWindowPolicy.$jy(i==null?void 0:i.minMarginPx,400),this.$dV=ColumnWindowPolicy.$jy(i==null?void 0:i.marginRatio,.5)}static defaultRules(){return Object.freeze([Object.freeze({id:"autoHeight",allowsWindow:e=>!e.autoHeight}),Object.freeze({id:"unknownWidth",allowsWindow:e=>e.viewportWidth>0}),Object.freeze({id:"mergeActive",allowsWindow:e=>e.mergeEmpty}),Object.freeze({id:"optOut",allowsWindow:e=>e.virtualColumns})])}next(e,s,i){const n=ColumnWindowPolicy.$ai(s),r=this.$R(s,n),l=this.$jf;return this.$jf=r,e!==null&&!e.full&&this.$hG(i)&&this.covers(e,s)?e:this.$kT(s,i,Number.isNaN(l)?0:r-l)}compute(e,s){return this.$kT(e,s,0)}$kT(e,s,i){const n=this.$e,r=n.count;if(r===0||!this.$hG(s))return this.$iH(r);const l=n.frozenCount,a=ColumnWindowPolicy.$ai(e),h=this.$R(e,a),c=this.$jr(a),d=Math.min(Math.abs(i)*2,a);let f=this.$eq(h-c-(i<0?d:0),r);const u=this.$eq(h+a+c+(i>0?d:0),r);f<l&&(f=l);const p=[];l>0&&p.push({from:leafColIndex(0),to:leafColIndex(l-1)}),f<=u&&p.push({from:leafColIndex(f),to:leafColIndex(u)});const g=e.pinned;for(let w=0;w<g.length;w++){const y=g[w];!Number.isInteger(y)||y<l||y>=r||y>=f&&y<=u||ColumnWindowPolicy.$mi(p,y)}const m=ColumnWindow.of(p,r);return m.full?this.$iH(r):m}covers(e,s){const i=this.$e,n=i.count;if(e.full||e.count!==n)return!1;const r=e.segments,l=i.frozenCount,a=r[0];if(l>0&&(a===void 0||a.from!==0||a.to<l-1))return!1;const h=s.pinned;for(let w=0;w<h.length;w++){const y=h[w];if(Number.isInteger(y)&&y>=l&&y<n&&!e.contains(y))return!1}const c=ColumnWindowPolicy.$ai(s),d=this.$R(s,c),f=this.$jr(c)/2,u=i.leftOf(leafColIndex(0)),p=i.totalWidth();let g=Math.min(d+c+f,p),m=Math.max(d-f,u);g<u&&(g=u),m>g&&(m=g);for(let w=r.length-1;w>=0;w--){const y=r[w];if(!(m<i.leftOf(y.from)))return g<=i.leftOf(leafColIndex(y.to+1))}return!1}horizontalWindow(e,s){const n=this.compute({box:{scrollLeft:e,width:s},pinned:NO_PINNED$2},{...PORT_SHAPE_BASE,viewportWidth:s}).segments;return n.length===0?{start:leafColIndex(0),end:leafColIndex(0)}:{start:n[0].from,end:leafColIndex(n[n.length-1].to+1)}}$hG(e){const s=this.$kn;for(let i=0;i<s.length;i++)if(!s[i].allowsWindow(e))return!1;return!0}static $ai(e){const s=e.box.width;return Number.isFinite(s)&&s>0?s:0}$R(e,s){const i=e.box.scrollLeft;if(!Number.isFinite(i)||i<=0)return 0;const n=Math.max(0,this.$e.totalWidth()-s);return i<n?i:n}static $mi(e,s){let i=0;for(;i<e.length&&e[i].to<s;)i++;i<e.length&&e[i].from<=s||e.splice(i,0,{from:leafColIndex(s),to:leafColIndex(s)})}$jr(e){return Math.max(this.$ju,e*this.$dV)}$eq(e,s){const i=this.$e.colAt(px$1(Math.max(0,e)));return i<0?0:i>=s?s-1:i}$iH(e){const s=this.$iG;if(s!==null&&s.count===e)return s;const i=ColumnWindow.full(e);return this.$iG=i,i}static $jy(e,s){return e!==void 0&&Number.isFinite(e)&&e>=0?e:s}}class ScrollObserver{constructor(e,s){this.$ai=0,this.$dg=!0,this.$bx=()=>{if(!this.$dg)return;const i=this.$d;this.$hw=i.scrollTop,this.$kv(i.scrollLeft)},this.$d=e,this._scheduler=s,this.$w=e.scrollLeft||0,this.$hw=e.scrollTop||0,this.$dk={scrollLeft:this.$w,width:0},this.$cU=ScrollObserver.$gx(e),e.addEventListener("scroll",this.$bx,{passive:!0})}get box(){return this.$dk}get scrollTop(){return this.$hw}setWidth(e){if(!this.$dg)return;this.$cU=ScrollObserver.$gx(this.$d);const s=!this.$cU&&Number.isFinite(e)&&e>0?e:0;s!==this.$ai&&(this.$ai=s,this.$dk={scrollLeft:this.$w,width:s},this._scheduler.submit(RenderRequest.of(Change.Viewport)))}scrollLeftTo(e){if(!this.$dg||!Number.isFinite(e))return;const s=e<0?0:e;this.$d.scrollLeft=s,this.$kv(s)}destroy(){this.$dg&&(this.$dg=!1,this.$d.removeEventListener("scroll",this.$bx))}static $gx(e){const s=e.ownerDocument.defaultView;return s!==null&&s.getComputedStyle(e).direction==="rtl"}$kv(e){if(e<0&&!this.$cU&&!ScrollObserver.$gx(this.$d)&&(e=0),e<0&&!this.$cU){this.$cU=!0,this.$ai=0,this.$w=e,this.$dk={scrollLeft:e,width:0},this._scheduler.submit(RenderRequest.of(Change.Viewport));return}e!==this.$w&&(this.$w=e,this.$dk={scrollLeft:e,width:this.$ai},this._scheduler.submit(RenderRequest.of(Change.ColsScrolled)))}}class HorizontalReveal{constructor(e,s){this.$R=e,this.$e=s}revealColumn(e){this.reveal(e)}reveal(e){const s=this.$e;if(!Number.isInteger(e)||e<0||e>=s.count||e<s.frozenCount)return null;const{scrollLeft:i,width:n}=this.$R.box;if(!(n>0))return null;const r=leafColIndex(e),l=s.leftOf(r),a=l+s.widthOf(r),h=s.frozenCount>0?s.frozenRight():0,c=i+h,d=i+n;let f;if(l<c||a-l>n-h)f=l-h;else if(a>d)f=a-n;else return null;const u=Math.max(0,s.totalWidth()-n);return f=Math.min(u,Math.max(0,f)),f===i?null:(this.$R.scrollLeftTo(f),f)}}class RangeRectCalculator{constructor(e,s){this.$e=e,this.$kl=(s==null?void 0:s.rowBorderPx)??1}rect(e,s,i,n){const r=this.$hX(e.startCol,s.left),l=this.$e.widthOf(e.startCol),a=this.$hX(e.endCol,s.left),h=this.$e.widthOf(e.endCol),c=Math.min(r,a),d=Math.max(r+l,a+h),f=Math.min(e.startRow,e.endRow),u=Math.max(e.startRow,e.endRow),p=n+f*i-s.top,g=n+u*i+i-this.$kl-s.top;return{left:c,top:p,width:Math.max(0,d-c),height:Math.max(0,g-p)}}$hX(e,s){const i=leafColIndex(e),n=this.$e.leftOf(i);return e<this.$e.frozenCount?n:n-s}}class RenderController{constructor(e){var s,i,n;this.$hM=!1,this.$iP=-1,this.$e=new ColumnGeometry([],ExtraColumns.fromOptions(null),0),this.$nw=new ColumnWindowPolicy(this.$e,ColumnWindowPolicy.defaultRules()),this.$R=null,this.$nc=null,this._rangeRects=new RangeRectCalculator(this.$e),this.$b=e,(i=(s=e.getRenderer())==null?void 0:s.setGeometry)==null||i.call(s,this.$e);const r=(n=e.getRenderer())==null?void 0:n.bodyWrapper;r&&(this.$R=new ScrollObserver(r,{submit:l=>e.submitRender(l)}))}get windowPolicy(){return this.$nw}get scroll(){return this.$R}shape(){var e;const s=this.$b.getOptions();return{autoHeight:s.autoHeight===!0,viewportWidth:((e=this.$R)==null?void 0:e.box.width)??0,mergeEmpty:this.$b.getMergeEngine().isEmpty,virtualColumns:s.virtualColumns!==!1}}revealColumn(e){const s=this.$R;s===null||e<0||e>=this.$e.count||(this.$nc??(this.$nc=new HorizontalReveal(s,this.$e))).reveal(e)}rangeRect(e){const s=this.$R,i=this.$e;return s===null||e.endCol>=i.count||e.startCol<0?null:this._rangeRects.rect({startRow:e.startRow,endRow:e.endRow,startCol:leafColIndex(e.startCol),endCol:leafColIndex(e.endCol)},{top:s.scrollTop,left:s.box.scrollLeft},this.$b.getOptions().rowHeight,0)}destroy(){var e;(e=this.$R)==null||e.destroy(),this.$R=null}get geometry(){return this.$e}currentGeometry(){return this.syncGeometry()}$iz(){const e=this.$b.getOptions(),s=e.masterDetail;return ExtraColumns.fromOptions({stateColumn:e.stateColumn,draggable:e.draggable,rowNumber:e.rowNumber,checkColumn:e.checkColumn,detailExpanderCol:!!(s!=null&&s.enabled)&&((s==null?void 0:s.toggle)??"expander-col")==="expander-col"})}syncGeometry(){const e=this.$b.getOptions(),s=this.$b.getColLayout(),i=this.$b.getColWidths(),n=e.defaultColumnWidth;return this.$e.reset(s.visibleLeaves.map((r,l)=>i[l]??n),this.$iz(),s.frozenCount),this.$e}$jM(){return this.$b.getOptions().pagination?38:0}onResize(){const{width:e}=this.$b.getContainer().getBoundingClientRect();e&&(this.recalcWidths(e),this.renderHeader(),this.syncViewportWidth(),this.$b.submitRender(RenderRequest.REPAINT_VISIBLE))}syncViewportWidth(){var e,s;const i=(e=this.$b.getRenderer())==null?void 0:e.bodyWrapper;i&&((s=this.$R)==null||s.setWidth(i.clientWidth))}recalcWidths(e){const s=this.$b.getColLayout(),i=this.$b.getOptions(),n=s.computeWidths(e-this.$iz().width(),i.defaultColumnWidth),r=this.$b.getUserWidths();r.size&&s.visibleLeaves.forEach((l,a)=>{const h=r.get(l.field);h!=null&&(n[a]=h)}),this.$b.setColWidths(n)}commitColumnWidth(e,s){const i=this.syncGeometry();e<i.count&&i.widthOf(leafColIndex(e))!==Math.round(s)&&(this.setUserWidth(e,s),this.$b.submitRender(RenderRequest.of(Change.ColWidth,{sync:!0,widthChangedFrom:e})));const n=this.$b.getColLayout().visibleLeaves[e];n&&this.$b.getUserWidths().set(n.field,Math.round(s))}setUserWidth(e,s){const i=Math.round(s),n=this.$b.getColWidths();if(n[e]===void 0){const r=this.$b.getOptions().defaultColumnWidth,l=this.$b.getColLayout().visibleLeaves.length;for(let a=0;a<l;a++)n[a]===void 0&&(n[a]=r)}return n[e]!==void 0&&(n[e]=i),this.syncGeometry(),this.$e.resize(leafColIndex(e),i)}hasWrappedHeader(){return this.$b.getColLayout().visibleLeaves.some(e=>{const s=e.header??e.field;return e.headerWrap===!0||typeof s=="string"&&s.indexOf(`
|
|
38
|
+
`)>=0})}renderHeader(){const e=this.$b.getRenderer(),s=this.$b.getColLayout(),i=this.$b.getSfMgr(),n=this.$b.getOptions();e==null||e.renderHeader(s.buildHeaderCells(),s.visibleLeaves,this.syncGeometry().widths(),i.sortList,{...n,_activeFilters:i.filters,_frozenCount:s.frozenCount}),this.syncHeaderLayout()}relayoutHeaderIfChanged(){const e=this.$b.getRenderer();e&&e.getHeaderHeight()!==this.$iP&&this.syncHeaderLayout()}syncHeaderLayout(){const e=this.$b.getRenderer(),s=this.$b.getVs();if(!e||!s)return;const i=this.$b.getOptions(),{height:n}=this.$b.getContainer().getBoundingClientRect();if(!n)return;const r=e.getHeaderHeight();this.$iP=r;const l=r>i.headerHeight?r:i.headerHeight;e.updateSize(n-this.$jM(),l);let a=n-l-this.$jM();const h=i.fallbackViewportHeight;if(h&&h>0){const c=s.getTotalHeight();a>=c&&a>h&&(a=h)}s.setViewportHeight(a)}doRender(e,s,i,n){const r=this.$b.getRenderer(),l=this.$b.getVs();if(!r||!l)return;const a=this.$b.getOptions(),h=l.getVisibleRange(),c=a.autoHeight===!0;c&&([e,s]=this.visRange(),!this.$hM&&s-e+1>2e3&&(this.$hM=!0,console.warn(`[OpenGrid] autoHeight 는 가상 스크롤이 아니라 전 행(${s-e+1}행)을 렌더합니다. 행이 많으면 고정 rowHeight(가상 스크롤) 사용을 권장합니다.`)));const d=this.$b.getGrpMgr(),u=d.isGroupMode||d.isTreeMode||this.$b.getDetailMgr().isActive?this.$b.getFlatModel().getFlatArray():null,p=this.$b.getColLayout(),g=this.$b.getData(),m=this.$b.getRowMgr();r.renderBody({startIndex:e,endIndex:s,data:g,leaves:p.visibleLeaves,widths:this.syncGeometry().widths(),opts:a,offsetY:c?0:h.offsetY,totalHeight:c?0:l.getTotalHeight(),selectedRows:m.selectedRows,checkedRows:m.checkedRows,groupFlatRows:u,onGroupToggle:w=>d.handleGroupToggle(w),onTreeToggle:d.isTreeMode?w=>d.handleTreeToggle(w):void 0,extraOpts:{_totalRows:g.rowCount,_frozenCount:p.frozenCount,_focusCell:this.$b.getEditMgr().focusCell,...this.$b.getRangeMgr().getOverlayExtraOpts()},mergeEngine:this.$b.getMergeEngine(),detailApi:this.$b.buildDetailRenderContext(),columns:i,...n===void 0?null:{rowWork:n}}),this.$b.getRangeMgr().repaint()}visRange(){var e;const s=this.$b.getOptions(),i=this.$b.getPagination();if(s.pagination&&i){const{start:l,end:a}=i.getRange();return[l,a]}const n=this.$b.getFlatModel().count();if(s.autoHeight)return[0,n-1];const r=(e=this.$b.getVs())==null?void 0:e.getVisibleRange();return[(r==null?void 0:r.startIndex)??0,Math.min((r==null?void 0:r.endIndex)??30,n-1)]}}const PREFIX_MIN_ROWS=1024;class Sorter{constructor(e,s,i,n,r={}){if(this.$q=e,this.$cY=s,this.$cZ=n,this.lastOrdererId="",this.prefixSortReady=Promise.resolve(),this.$ca=null,i.length===0)throw new RangeError("Sorter: at least one orderer is required");this.$dN=i,this.$gD=r.loadPrefixSort??null}sortNow(e,s,i=this.$q.displayOrder()){return e.length===0?i.slice():Array.from(this.$ci(e,s,i).settle())}sortInteractive(e,s,i=this.$q.displayOrder()){return this.$ci(e,s,i)}$ci(e,s,i){const n=e.map(h=>this.$cY.keyColumnFor(h,s,i)),r=e.map(h=>h.dir),l=this.$mH(n,i);this.lastOrdererId=l.id;const a=this.$cZ.run(i,n,r,l);return a.onDone(h=>{var c,d;return(d=(c=this.$cY).noteSorted)==null?void 0:d.call(c,n[0],h,r[0])}),a}$mH(e,s){if(this.$ca)return this.$ca(this.$dN,e,s);this.$lP(e,s.length);const i=this.$dN.find(n=>n.accepts(e,s.length));if(!i)throw new Error("Sorter: no orderer accepts these keys");return i}$lP(e,s){const i=this.$gD;!i||e.length!==1||e[0].kind!=="string"||s<PREFIX_MIN_ROWS||(this.$gD=null,this.prefixSortReady=i().then(n=>{this.$dN=[...this.$dN,new n.LcpMergeOrderer],this.$ca=(r,l,a)=>n.SortCostEstimate.pickOrderer(r,l,a)},()=>{}))}}const DEFAULT_SORT_COMPARATOR=(o,e)=>{if(o==null&&e==null)return 0;if(o==null)return-1;if(e==null)return 1;if(typeof o=="number"&&typeof e=="number")return o-e;const s=String(o),i=String(e);return s<i?-1:s>i?1:0};function allPrimitive(o){for(let e=0;e<o.length;e++){const s=o[e];if(s!==null&&(typeof s=="object"||typeof s=="function"))return!1}return!0}class SortKeyColumn{static build(e,s,i,n,r){if(!n)return new GeneralKeyColumn(e,s,i,r);const l=ValueShape.of(s);return l.numeric?new NumberKeyColumn(e,l.copy):l.textual?new StringKeyColumn(e,l.copy):new GeneralKeyColumn(e,l.copy,i,r)}}class ValueShape{constructor(e,s,i){this.copy=e,this.numeric=s,this.textual=i}static of(e){const s=e.length,i=new Array(s);let n=!0,r=!0,l=0,a=0;for(let h=0;h<s;h++){const c=e[h];if(i[h]=c,c==null)continue;const d=typeof c;d==="number"?(r=!1,c!==c?n=!1:c===1/0?++l>1&&(n=!1):c===-1/0&&++a>1&&(n=!1)):d==="string"||d==="boolean"?n=!1:(n=!1,r=!1)}return new ValueShape(i,n,r)}}class GeneralKeyColumn extends SortKeyColumn{constructor(e,s,i,n){super(),this.field=e,this.$ah=s,this.$lu=i,this.$lB=n,this.kind="general",this.cacheable=allPrimitive(s)}compare(e,s){const i=this.$lu;return i(this.$ah[e],this.$ah[s],this.field,this.$lB)}stringKeyAt(e){return null}}class NumberKeyColumn extends SortKeyColumn{constructor(e,s){super(),this.field=e,this.kind="number",this.cacheable=!0;const i=s.length;this.$ac=new Float64Array(i),this.$gc=new Uint8Array(i);for(let n=0;n<i;n++){const r=s[n];r==null?this.$gc[n]=1:this.$ac[n]=r}}compare(e,s){const i=this.$gc;return i[e]?i[s]?0:-1:i[s]?1:this.$ac[e]-this.$ac[s]}stringKeyAt(e){return null}}class StringKeyColumn extends SortKeyColumn{constructor(e,s){super(),this.field=e,this.kind="string",this.cacheable=!0;const i=s.length,n=new Array(i);for(let r=0;r<i;r++){const l=s[r];n[r]=l==null?null:String(l)}this.$ac=n}compare(e,s){const i=this.$ac[e],n=this.$ac[s];return i==null?n==null?0:-1:n==null?1:i<n?-1:i>n?1:0}stringKeyAt(e){return this.$ac[e]??null}}class ValueSnapshot{constructor(e,s,i){this.field=e,this.values=s,this.$ev=new Uint8Array(s.length);for(let n=0;n<i.length;n++)this.$ev[i[n]]=1}covers(e){const s=this.$ev;for(let i=0;i<e.length;i++)if(!s[e[i]])return!1;return!0}isFreshFor(e,s){const i=this.values,n=i.length;if(e.length!==n)return!1;const r=this.field,l=this.$ev;if(s){for(let a=0;a<s.length;a++){const h=s[a];if(!l[h]||e[h][r]!==i[h])return!1}return!0}for(let a=0;a<n;a++)if(l[a]&&e[a][r]!==i[a])return!1;return!0}}class RankIndex{constructor(e,s,i){this.field=e,this.$cP=s,this.$bD=i}static fromSorted(e,s,i,n,r){const l=new Int32Array(r.length),a=i.length,h=n==="asc";let c=0;for(let d=0;d<a;d++){const f=h?d:a-1-d,u=i[f];d>0&&s.compare(i[h?f-1:f+1],u)!==0&&c++,l[u]=c}return new RankIndex(e,l,new ValueSnapshot(e,r,i))}compare(e,s){return this.$cP[e]-this.$cP[s]}covers(e){return this.$bD.covers(e)}isFreshFor(e,s){return this.$bD.isFreshFor(e,s)}}class RankedKeyColumn{constructor(e){this.$iX=e,this.kind="ranked",this.cacheable=!0}get field(){return this.$iX.field}compare(e,s){return this.$iX.compare(e,s)}stringKeyAt(e){return null}}class SortKeyStore{constructor(e){this.$q=e,this.$cH=new Map}get size(){return this.$cH.size}keyColumnFor(e,s,i=this.$q.displayOrder()){const n=this.$q.rows,r=e.field,l=s===DEFAULT_SORT_COMPARATOR;if(l){const c=this.$cH.get(r);if(c&&c.snapshot.isFreshFor(n,i))return this.$nb(c,i)}const a=new Array(n.length);for(let c=0;c<i.length;c++){const d=i[c];a[d]=n[d][r]}const h=SortKeyColumn.build(r,a,s,l,e.dir);return l&&(h.kind==="number"||h.kind==="string")?this.$cH.set(r,{key:h,snapshot:new ValueSnapshot(r,a,i),sorted:null,dir:void 0,ranks:null}):l&&this.$cH.delete(r),h}noteSorted(e,s,i){const n=this.$cH.get(e.field);!n||n.key!==e||(n.sorted=s,n.dir=i)}clear(){this.$cH.clear()}$nb(e,s){return e.sorted&&(!e.ranks||!e.ranks.covers(s))&&(e.ranks=RankIndex.fromSorted(e.key.field,e.key,e.sorted,e.dir,e.snapshot.values),e.sorted=null),e.ranks&&e.ranks.covers(s)?new RankedKeyColumn(e.ranks):e.key}}class ComparisonOrderer{constructor(){this.id="comparison"}accepts(e,s){return!0}order(e,s,i){const n=e.slice(),r=s.length;return r>0&&n.sort((l,a)=>{for(let h=0;h<r;h++){const c=s[h].compare(l,a);if(c!==0)return i[h]==="asc"?c:-c}return 0}),Int32Array.from(n)}}class DoneSortJob{constructor(e){this.$cO=e,this.done=!0,this.$hT=!1}cancel(){this.$hT=!0}onDone(e){this.$hT||e(this.$cO)}settle(){return this.$cO}peekWindow(e,s){return null}}class SyncSortRunner{run(e,s,i,n){return new DoneSortJob(n.order(e,s,i))}}let _rowIdSeq=0;function nextRowId(){return`og-r-${++_rowIdSeq}`}class DataLayer{constructor(e="_ogRowId"){this._data=[],this.$dO=[],this._meta=new Map,this._displayIndexes=[],this.$bt=new Map,this.$gk="",this.$gj=[],this._getStrategy=(s,i)=>i,this.$ac=new SortKeyStore(this),this.$nl=new Sorter(this,this.$ac,[new ComparisonOrderer],new SyncSortRunner,{loadPrefixSort:()=>Promise.resolve().then(()=>require("./LcpMergeOrderer-CeP6C6G1.cjs"))}),this.$bc=0,this.$y=e}getDataIndexByRowId(e){return this.$bt.get(e)}get structureVersion(){return this.$bc}setStrategyResolver(e){this._getStrategy=e}setData(e){this.$ac.clear(),this._data=e.map(s=>{const i=nextRowId(),n={...s,[this.$y]:i};return this._meta.set(i,{state:"none",rowId:i}),n}),this.$dO=this._data.map(s=>({...s})),this.$dW(),this._displayIndexes=this._data.map((s,i)=>i),this.$bc++}getData(){return this._displayIndexes.map(e=>this._data[e])}getOriginalData(){return[...this.$dO]}getAllData(){return[...this._data]}clearData(){this.$ac.clear(),this._data=[],this.$dO=[],this._meta.clear(),this.$bt.clear(),this._displayIndexes=[],this.$bc++}get rowCount(){return this._displayIndexes.length}get totalRowCount(){return this._data.length}addRow(e,s="last"){const i=nextRowId(),n={...e,[this.$y]:i};if(this._meta.set(i,{state:"added",rowId:i}),s==="last"){const r=this._data.push(n)-1;this.$bt.set(i,r),this._displayIndexes.push(r)}else if(s==="first")this._data.unshift(n),this.$dW(),this._displayIndexes.unshift(0);else{const r=Math.min(s,this._displayIndexes.length),l=r<this._displayIndexes.length?this._displayIndexes[r]:this._data.length;this._data.splice(l,0,n),this.$dW(),this._displayIndexes=this._data.map((a,h)=>h)}this.$bc++}removeRow(e){const s=this._displayIndexes[e];if(s===void 0)return;const i=this._data[s],n=i[this.$y],r=this._meta.get(n);return(r==null?void 0:r.state)==="added"?(this._data.splice(s,1),this._meta.delete(n)):this._meta.set(n,{...r,state:"removed"}),this.$dW(),this._displayIndexes=this._data.map((l,a)=>({r:l,i:a})).filter(({r:l})=>{var a;return((a=this._meta.get(l[this.$y]))==null?void 0:a.state)!=="removed"}).map(({i:l})=>l),this.$bc++,i}moveRow(e,s){const i=this._displayIndexes[e],n=this._displayIndexes[s];if(i===void 0||n===void 0)return;const[r]=this._data.splice(i,1),l=i<n?n-1:n;this._data.splice(l,0,r),this.$dW(),this._displayIndexes=this._data.map((a,h)=>({r:a,i:h})).filter(({r:a})=>{var h;return((h=this._meta.get(a[this.$y]))==null?void 0:h.state)!=="removed"}).map(({i:a})=>a),this.$bc++}updateCell(e,s,i){const n=this._displayIndexes[e];if(n===void 0)return!1;const l=this._data[n][this.$y],a=this._meta.get(l);return(a==null?void 0:a.state)==="none"&&this._meta.set(l,{...a,state:"edited",original:{...this.$dO[n]}}),this._data[n][s]=i,!0}getRowByIndex(e){const s=this._displayIndexes[e];return s!==void 0?this._data[s]:void 0}getCellValue(e,s){var i;return(i=this.getRowByIndex(e))==null?void 0:i[s]}hasRow(e){var s;return this.$bt.get(e)===void 0?!1:((s=this._meta.get(e))==null?void 0:s.state)!=="removed"}getRowById(e){if(!this.hasRow(e))return;const s=this.$bt.get(e);return this._data[s]}getCellValueByRowId(e,s){var i;return(i=this.getRowById(e))==null?void 0:i[s]}setComputedValueByRowId(e,s,i){const n=this.$bt.get(e);n!==void 0&&(this._data[n][s]=i)}getEditedRows(){return this._data.filter(e=>{var s;return((s=this._meta.get(e[this.$y]))==null?void 0:s.state)==="edited"})}getChangedRows(){return this.getEditedRows()}getAddedRows(){return this._data.filter(e=>{var s;return((s=this._meta.get(e[this.$y]))==null?void 0:s.state)==="added"})}getRemovedRows(){return this._data.filter(e=>{var s;return((s=this._meta.get(e[this.$y]))==null?void 0:s.state)==="removed"})}getChanges(){const e=[],s=[],i=[];for(const n of this._data){const r=n[this.$y],l=this._meta.get(r),a=(l==null?void 0:l.state)??"none";if(a==="added")e.push({...n});else if(a==="removed")i.push({...n});else if(a==="edited"){const h=l.original??{},c=Object.keys(n).filter(d=>d!==this.$y&&n[d]!==h[d]);s.push({...n,_changedFields:c})}}return{added:e,edited:s,removed:i}}getChangedColumns(){return this._data.filter(e=>{var s;return((s=this._meta.get(e[this.$y]))==null?void 0:s.state)==="edited"}).map(e=>{var s;const i=((s=this._meta.get(e[this.$y]))==null?void 0:s.original)??{},n=[];for(const r of Object.keys(e))r!==this.$y&&e[r]!==i[r]&&n.push({field:r,oldValue:i[r],newValue:e[r]});return{row:{...e},fields:n.map(r=>r.field),diff:n}})}getOriginalRow(e){const s=this._displayIndexes[e];if(s===void 0)return;const i=this._data[s],n=this._meta.get(i[this.$y]);if(!(!n||n.state==="added"))return n.state==="edited"&&n.original?{...n.original}:{...this.$dO[s]}}getRowsWithState(e){return this._data.map(s=>{var i;const n=((i=this._meta.get(s[this.$y]))==null?void 0:i.state)??"none";return{...s,[e]:n}})}getRowState(e){var s;const i=this.getRowByIndex(e);return i?((s=this._meta.get(i[this.$y]))==null?void 0:s.state)??"none":"none"}applySort(e){if(e.length===0){this._displayIndexes=this._data.map((n,r)=>r).filter(n=>this.$gw(n)),this.$bc++;return}const s=this._getStrategy("sortComparator",DEFAULT_SORT_COMPARATOR),i=this._displayIndexes.filter(n=>this.$gw(n));this.$kw(this.$nl.sortNow(e,s,i),i.length)}get rows(){return this._data}displayOrder(){return this._displayIndexes.filter(e=>this.$gw(e))}applyOrder(e){this.$kw(e,this.displayOrder().length)}$kw(e,s){if(e.length!==s)throw new RangeError(`DataLayer.applyOrder: expected ${s} indexes, got ${e.length}`);this._displayIndexes=Array.from(e),this.$bc++}$gw(e){var s,i;return((i=this._meta.get((s=this._data[e])==null?void 0:s[this.$y]))==null?void 0:i.state)!=="removed"}applyFilter(e){const s=Object.keys(e),i=this._getStrategy("filterPredicate",(n,r,l)=>matchFilter(n,r));this._displayIndexes=this._data.map((n,r)=>({r:n,i:r})).filter(({r:n})=>{var r;if(((r=this._meta.get(n[this.$y]))==null?void 0:r.state)==="removed"||s.length>0&&!s.every(l=>{const a=n[l];return e[l].every(h=>i(a,h,l))}))return!1;if(this.$gk&&this.$gj.length>0){const l=this.$gk;if(!this.$gj.some(h=>{const c=n[h];return c!=null&&String(c).toLowerCase().includes(l)}))return!1}return!0}).map(({i:n})=>n),this.$bc++}setFindFilter(e,s){this.$gk=e.toLowerCase(),this.$gj=s}$dW(){this.$bt.clear(),this._data.forEach((e,s)=>{this.$bt.set(e[this.$y],s)})}}function matchFilter(o,e){const s=o,i=e.value;switch(e.operator){case"=":return s==i;case"!=":return s!=i;case">":return s>i;case">=":return s>=i;case"<":return s<i;case"<=":return s<=i;case"contains":return String(s).includes(String(i));case"startsWith":return String(s).startsWith(String(i));case"endsWith":return String(s).endsWith(String(i));default:return!0}}function _isGroup(o){return o&&o._isGroup===!0}function buildGroups(o,e,s=[],i=new Set,n,r){return e.length?_groupByFields(o,e,0,s,i,"",n,r):[]}function _groupByFields(o,e,s,i,n,r,l,a){const h=e[s],c=new Map;for(const f of o){const u=a?a(f,e.slice(s)):f[h];c.has(u)||c.set(u,[]),c.get(u).push(f)}const d=[];for(const[f,u]of c){const p=`${r}__${h}:${f}`,g=n.has(p);let m;s<e.length-1?m=_groupByFields(u,e,s+1,i,n,p,l,a):m=u;const{summary:w,summaryFmt:y}=_calcSummary(u,i),v=_calcStates(u,l);d.push({_isGroup:!0,_groupField:h,_groupValue:f,_groupLabel:f==null?t("group.nullLabel"):String(f),_depth:s,_expanded:g,_childCount:u.length,_summary:w,_summaryFmt:y,_states:v,children:m})}return d}function _calcSummary(o,e){const s={},i={};for(const n of e){const r=o.map(c=>c[n.field]).filter(c=>c!=null&&c!=="");let l=null;const a=n.op.toUpperCase();if(a==="SUM")l=r.length>0?OGDecimal.sum(r.map(String)):null;else if(a==="AVG")l=r.length>0?OGDecimal.sum(r.map(String)).div(OGDecimal.from(String(r.length))):null;else if(a==="COUNT"){s[n.field]=o.length,i[n.field]=o.length.toLocaleString("ko-KR");continue}else a==="MAX"?l=r.length>0?OGDecimal.max(r.map(String)):null:a==="MIN"&&(l=r.length>0?OGDecimal.min(r.map(String)):null);if(!l){s[n.field]=null,i[n.field]="";continue}const h=l.toNumber();s[n.field]=h,i[n.field]=_fmtNum(h,n.format)}return{summary:s,summaryFmt:i}}function _calcStates(o,e){if(!e)return{added:0,edited:0,removed:0};let s=0,i=0,n=0;for(const r of o){const l=e(r);l==="added"?s++:l==="edited"?i++:l==="removed"&&n++}return{added:s,edited:i,removed:n}}function _fmtNum(o,e){if(e==null)return o%1===0?o.toLocaleString("ko-KR"):parseFloat(o.toFixed(6)).toLocaleString("ko-KR",{minimumFractionDigits:2,maximumFractionDigits:6});const s=e.includes("#")||e.includes(","),i=e.match(/\.(\d+)$/),n=i?parseInt(i[1],10):/^\d+$/.test(e)?parseInt(e,10):0,r=Math.abs(o).toFixed(n),[l="0",a]=r.split("."),h=s?l.replace(/\B(?=(\d{3})+(?!\d))/g,","):l,c=a!==void 0?`${h}.${a}`:h;return o<0?`-${c}`:c}function flattenGroups(o){const e=[];for(const s of o)if(e.push(s),s._expanded)for(const i of s.children)_isGroup(i)?e.push(...flattenGroups([i])):e.push(i);return e}function collectAllKeys(o,e=""){const s=[];for(const i of o){const n=`${e}__${i._groupField}:${i._groupValue}`;s.push(n);const r=i.children.filter(l=>_isGroup(l));r.length&&s.push(...collectAllKeys(r,n))}return s}function isTreeNode(o){return o!=null&&o._isTree===!0}function buildTree(o,e,s=new Set){const{idField:i,parentIdField:n,expandOnLoad:r=!1}=e,l=new Map,a=[];for(const d of o){const f=d[i],u={_isTree:!0,_treeId:f,_treeParentId:d[n],_depth:0,_expanded:r||s.has(f),_hasChildren:!1,_childCount:0,_isLastChild:!1,_ancestorHasMore:[],data:d,children:[]};l.set(f,u)}for(const d of l.values()){const f=d._treeParentId;if(f==null||f===""||!l.has(f))a.push(d);else{const p=l.get(f);p.children.push(d),p._hasChildren=!0}}function h(d,f){for(const u of d)u._depth=f,u._childCount=_countDescendants(u),h(u.children,f+1)}h(a,0);function c(d,f){for(let u=0;u<d.length;u++){const p=d[u],g=u===d.length-1;p._isLastChild=g,p._ancestorHasMore=f,p.children.length>0&&c(p.children,[...f,!g])}}return c(a,[]),a}function _countDescendants(o){let e=o.children.length;for(const s of o.children)e+=_countDescendants(s);return e}function flattenTree(o){const e=[];for(const s of o)e.push(s),s._expanded&&s.children.length>0&&e.push(...flattenTree(s.children));return e}function toggleTreeNode(o,e){o.has(e)?o.delete(e):o.add(e)}function collectAllTreeIds(o){const e=[];for(const s of o)e.push(s._treeId),s.children.length&&e.push(...collectAllTreeIds(s.children));return e}class CompositionKey{constructor(e,s,i){this.$jW=e,this.$jV=s,this.$jX=i,this.$cw=null,this.$kH=-1,this.$ar=null,this.$cr=null,this.$kR=[]}same(){const e=this.$jW();if(e!==this.$cw||e.structureVersion!==this.$kH)return!1;const s=this.$jV();if(s!==this.$ar||s&&s()!==this.$cr)return!1;const i=this.$jX();for(let n=0;n<i.length;n++)if(i[n].version()!==this.$kR[n])return!1;return!0}take(){const e=this.$jX();for(let i=0;i<e.length;i++){const n=e[i].version;if(n===null)return!1;this.$kR[i]=n()}const s=this.$jW();return this.$cw=s,this.$kH=s.structureVersion,this.$ar=this.$jV(),this.$cr=this.$ar?this.$ar():null,!0}}class DirectFlatSource{constructor(e){this.$cw=e,this.$iU=0}get hits(){return this.$iU}count(){return this.$cw().rowCount}itemAt(e){return this.$iU++,this.$cw().getRowByIndex(e)}array(){return this.$cw().getData()}}class ComposedFlatSource{constructor(e,s){this.$fU=e,this.$an=s,this.$h=null,this.$hQ=0}get builds(){return this.$hQ}count(){return this.$av().length}itemAt(e){return this.$av()[e]}array(){return this.$av()}invalidate(){this.$h=null}$av(){if(this.$h!==null&&this.$an.same())return this.$h;const e=this.$an.take(),s=this.$fU();return this.$hQ++,this.$h=e?s:null,s}}class FlatRowModel{constructor(e){this.$ar=null,this.$ec=[],this.$fn=null,this.$he=null,this.$a=e,this.$fY=new DirectFlatSource(()=>this.$a.getDataLayer()),this.$es=new ComposedFlatSource(()=>this.$fU(),new CompositionKey(()=>this.$a.getDataLayer(),()=>this.$ar,()=>this.$ec))}get directHits(){return this.$fY.hits}get dataStructureVersion(){return this.$a.getDataLayer().structureVersion}setBacking(e){this.$ar=e,this.$cE()}registerSplice(e,s=()=>!0,i){this.$ec.push({fn:e,isActive:s,version:i??null}),this.$cE()}count(){return this.$q().count()}getFlatArray(){return this.$q().array()}resolveFlatRow(e){const s=this.$q().itemAt(e);if(s==null)return{kind:"data"};if(s._isDetailFiller===!0)return{kind:"detailFiller",rowId:s._rowId};if(s._isDetailHead===!0)return{kind:"detailHead",rowId:s._rowId};if(_isGroup(s))return{kind:"group"};if(isTreeNode(s)){const l=s.data;return{kind:"tree",rowId:l==null?void 0:l[this.$a.rowIdField]}}const i=s[this.$a.rowIdField],n=this.$a.getDataLayer().getDataIndexByRowId(i),r={kind:"data",rowId:i};return n!==void 0&&(r.dataIndex=n),this.$ar||(r.displayIndex=e),r}rowAt(e){const s=this.$q().itemAt(e);return s==null||s._isDetailFiller===!0||s._isDetailHead===!0||_isGroup(s)?null:isTreeNode(s)?s.data??null:s}flatIndexOfRowId(e){return this.$lC(),this.$fn.get(e)??-1}rowIdOfFlat(e){const s=this.resolveFlatRow(e);return s.kind==="data"||s.kind==="tree"?s.rowId??null:null}$q(){if(this.$ar)return this.$es;for(let e=0;e<this.$ec.length;e++)if(this.$ec[e].isActive())return this.$es;return this.$fY}$fU(){let e=this.$ar?this.$ar():this.$a.getDataLayer().getData();for(const s of this.$ec)e=s.fn(e);return e}$cE(){this.$es.invalidate(),this.$fn=null,this.$he=null}$lC(){const e=this.$q().array();if(this.$fn&&this.$he===e)return;const s=new Map;for(let i=0;i<e.length;i++){const n=e[i];if(n==null||_isGroup(n)||n._isDetailHead===!0||n._isDetailFiller===!0)continue;const r=isTreeNode(n)?n.data:n,l=r==null?void 0:r[this.$a.rowIdField];l!=null&&s.set(l,i)}this.$fn=s,this.$he=e}}class RowManager{constructor(e){this._selectedRows=new Set,this.$aW=new Set,this._data=e}get selectedRows(){return this._selectedRows}get checkedRows(){return this.$aW}selectSingle(e){this._selectedRows.clear(),this._selectedRows.add(e)}selectToggle(e){this._selectedRows.has(e)?this._selectedRows.delete(e):this._selectedRows.add(e)}clearSelection(){this._selectedRows.clear()}check(e,s){s?this.$aW.add(e):this.$aW.delete(e)}checkAll(e,s){if(e)for(let i=0;i<s;i++)this.$aW.add(i);else this.$aW.clear()}checkByValue(e,s){for(let i=0;i<this._data.rowCount;i++)s.includes(this._data.getCellValue(i,e))&&this.$aW.add(i)}uncheckAll(){this.$aW.clear()}checkById(e){}addCheckById(e){}uncheckById(e){}getSelections(){return[...this._selectedRows].map(e=>this._data.getRowByIndex(e)).filter(Boolean)}getChecked(){return[...this.$aW].map(e=>({row:this._data.getRowByIndex(e),rowIndex:e}))}getAllChecked(){return this.getChecked().map(e=>e.row)}getActiveRow(){return this._selectedRows.size>0?[...this._selectedRows][0]:-1}activate(e){this._selectedRows.clear(),this._selectedRows.add(e)}deselect(){this._selectedRows.clear()}reset(){this._selectedRows.clear(),this.$aW.clear()}}function cellKey(o,e){return`${o}:${e}`}function parseCellKey(o){const e=o.indexOf(":");return e===-1?{rowId:o,field:""}:{rowId:o.slice(0,e),field:o.slice(e+1)}}const FORMULA_ERROR_CODES=new Set(["#ERR","#REF","#CYCLE","#DIV0","#NAME","#VALUE","#NUM"]);function isErrorToken(o){return typeof o=="string"&&FORMULA_ERROR_CODES.has(o)?o:null}const FORMULA_LARGE_RECALC_THRESHOLD=500,_FORMULA_ERROR_KEY={"#REF":"formulaError.ref","#CYCLE":"formulaError.cycle","#VALUE":"formulaError.value","#DIV0":"formulaError.div0","#NAME":"formulaError.name","#NUM":"formulaError.num"};class FormulaController{constructor(e){this.$b=e}flushRecalc(){const e=this.$b.getDirtySeeds();if(e.size===0)return;const s=[...e];e.clear(),this.afterRecalc(this.$b.getRecalc().onValuesChanged(s),{skipRender:!0})}afterRecalc(e,s={}){var i,n;if(e.changed.length>0||e.cycles>0){const r={changed:e.changed,cycles:e.cycles,ms:e.ms,large:e.changed.length>FORMULA_LARGE_RECALC_THRESHOLD};this.$b.emit("formulaRecalc",r),(n=(i=this.$b.getOptions().formula)==null?void 0:i.onFormulaRecalc)==null||n.call(i,r)}s.skipRender||this.$b.submitRender(RenderRequest.REPAINT_VISIBLE)}handleFormulaError(e,s,i){var n,r;const a={rowIndex:this.$b.getFlatModel().flatIndexOfRowId(e),field:s,error:i};this.$b.emit("formulaError",a),(r=(n=this.$b.getOptions().formula)==null?void 0:n.onFormulaError)==null||r.call(n,a),this.$b.announce(this.$b.t("formula.cellErrorAnnounce",{field:s,message:this.$lU(i)}))}$lU(e){const s=_FORMULA_ERROR_KEY[e]??"formulaError.fallback";return this.$b.t(s)}buildAccessor(){return{visibleFields:()=>this.$b.getColLayout().visibleLeaves.map(e=>e.field),rowIdAtFlat:e=>{const s=this.$b.getFlatModel().resolveFlatRow(e);return s.kind==="data"?s.rowId??null:null},flatIndexOfRowId:e=>this.$b.getFlatModel().flatIndexOfRowId(e),displayedRowIds:()=>{const e=[],s=this.$b.getFlatModel(),i=s.count();for(let n=0;n<i;n++){const r=s.resolveFlatRow(n);r.kind==="data"&&r.rowId&&e.push(r.rowId)}return e},getCellValue:(e,s)=>this.$b.getData().getCellValueByRowId(e,s),hasRow:e=>this.$b.getData().hasRow(e),hasField:e=>this.$b.getColLayout().getColumnByField(e)!=null}}setCellFormula(e,s,i){const n=this.$b.getFlatModel().resolveFlatRow(e);n.kind!=="data"||!n.rowId||this.setCellFormulaByRowId(n.rowId,s,i,e)}setCellFormulaByRowId(e,s,i,n){var r,l;const a=n??this.$b.getFlatModel().flatIndexOfRowId(e),h=this.$b.getRecalc(),c=h.getCellFormula(e,s),d=h.setCellFormula(e,s,i),f={rowIndex:a,field:s,formula:i,oldFormula:c};this.$b.emit("formulaChange",f),(l=(r=this.$b.getOptions().formula)==null?void 0:r.onFormulaChange)==null||l.call(r,f),this.afterRecalc(d)}getCellFormula(e,s){const i=this.$b.getFlatModel().resolveFlatRow(e);return i.kind!=="data"||!i.rowId?null:this.$b.getRecalc().getCellFormula(i.rowId,s)}hasCellFormula(e,s){const i=this.$b.getFlatModel().resolveFlatRow(e);return i.kind==="data"&&!!i.rowId&&this.$b.getRecalc().hasCellFormula(i.rowId,s)}clearCellFormula(e,s){const i=this.$b.getFlatModel().resolveFlatRow(e);if(i.kind!=="data"||!i.rowId)return;const n=this.$b.getRecalc(),r=n.clearCellFormula(i.rowId,s);r.length?this.afterRecalc(n.onValuesChanged(r)):this.$b.submitRender(RenderRequest.REPAINT_VISIBLE)}getCellError(e,s){const i=this.$b.getFlatModel().resolveFlatRow(e);return i.kind!=="data"||!i.rowId?null:this.$b.getRecalc().getCellError(i.rowId,s)}getDependents(e,s){const i=this.$b.getFlatModel().resolveFlatRow(e);if(i.kind!=="data"||!i.rowId)return[];const n=this.$b.getFlatModel();return this.$b.getRecalc().getDependents(i.rowId,s).map(({rowId:r,field:l})=>({rowIndex:n.flatIndexOfRowId(r),field:l}))}getPrecedents(e,s){const i=this.$b.getFlatModel().resolveFlatRow(e);if(i.kind!=="data"||!i.rowId)return[];const n=this.$b.getFlatModel();return this.$b.getRecalc().graph.getPrecedents(cellKey(i.rowId,s)).map(parseCellKey).map(({rowId:r,field:l})=>({rowIndex:n.flatIndexOfRowId(r),field:l}))}recalculate(){this.afterRecalc(this.$b.getRecalc().recalculateAll())}recalculateCell(e,s){const i=this.$b.getFlatModel().resolveFlatRow(e);i.kind!=="data"||!i.rowId||this.afterRecalc(this.$b.getRecalc().onValuesChanged([cellKey(i.rowId,s)]))}offsetFormula(e,s,i,n){return this.$b.getRecalc().offsetFormula(e,s,i,n)}getFormulaMeta(e,s){const i=this.$b.getRecalc().store;if(i.size()===0)return null;const n=this.$b.getFlatModel().resolveFlatRow(e);if(n.kind!=="data"||!n.rowId)return null;const r=i.getFormula(n.rowId,s);return r?{src:r.src,error:r.error,approx:!!r.approx}:null}recalcRangeBearingFormulas(){const e=this.$b.getRecalc().recalcRangeBearing();this.afterRecalc(e,{skipRender:e.changed.length===0&&e.cycles===0})}}const NUMERIC_LITERAL_RE=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function normalizeNumericLiteral(o){const e=o.trim(),s=/^([+-]?)(\d*)(?:\.(\d*))?[eE]([+-]?\d+)$/.exec(e);if(!s)return e;const[,i,n,r="",l]=s,a=n||"0",h=parseInt(l,10);let c=a+r,d=a.length+h;c===""&&(c="0"),d<=0?(c="0".repeat(-d+1)+c,d=1):d>c.length&&(c=c+"0".repeat(d-c.length));const f=c.slice(0,d)||"0",u=c.slice(d);return i+f+(u?"."+u:"")}function parseFormula(o){const e=o.startsWith("=")?o.slice(1):o,s=new _Parser(e),i=s.parseComparison();if(s.skip(),!s.eof())throw new SyntaxError(`FormulaParser: 예상치 못한 토큰 '${s.peekChar()}' (위치 ${s.pos})`);return i}class _Parser{constructor(e){this.pos=0,this.src=e}eof(){return this.pos>=this.src.length}peekChar(){return this.src[this.pos]??""}skip(){for(;!this.eof()&&/\s/.test(this.peekChar());)this.pos++}$kO(...e){this.skip();for(const s of e.sort((i,n)=>n.length-i.length))if(this.src.startsWith(s,this.pos))return this.pos+=s.length,s;return null}parseComparison(){let e=this.parseConcat();for(;;){const s=this.$kO("<=",">=","<>","=","<",">");if(!s)break;const i=this.parseConcat();e={t:"bin",op:s,left:e,right:i}}return e}parseConcat(){let e=this.parseAdditive();for(;this.$kO("&");){const i=this.parseAdditive();e={t:"bin",op:"&",left:e,right:i}}return e}parseAdditive(){let e=this.parseMultiplicative();for(;;){this.skip();const s=this.peekChar();if(s!=="+"&&s!=="-")break;this.pos++;const i=this.parseMultiplicative();e={t:"bin",op:s,left:e,right:i}}return e}parseMultiplicative(){let e=this.parsePower();for(;;){this.skip();const s=this.peekChar();if(s!=="*"&&s!=="/"&&s!=="%")break;this.pos++;const i=this.parsePower();e={t:"bin",op:s,left:e,right:i}}return e}parsePower(){const e=this.parseUnary();if(this.skip(),this.peekChar()==="^"){this.pos++;const s=this.parsePower();return{t:"bin",op:"^",left:e,right:s}}return e}parseUnary(){this.skip();const e=this.peekChar();return e==="-"||e==="+"?(this.pos++,{t:"unary",op:e,arg:this.parseUnary()}):this.parsePrimary()}parsePrimary(){this.skip();const e=this.peekChar();if(e==="("){this.pos++;const s=this.parseComparison();if(this.skip(),this.peekChar()!==")")throw new SyntaxError("FormulaParser: 닫는 괄호 ) 누락");return this.pos++,s}if(e==="[")return this.$ge();if(e==='"')return this.$np();if(/[A-Za-z$]/.test(e))return this.$mf();if(/[0-9.]/.test(e))return this.$mw();throw new SyntaxError(`FormulaParser: 예상치 못한 문자 '${e||"EOF"}' (위치 ${this.pos})`)}$ge(){this.pos++;const e=this.pos;for(;!this.eof()&&this.peekChar()!=="]";)this.pos++;if(this.eof())throw new SyntaxError("FormulaParser: 닫는 ] 누락");const s=this.src.slice(e,this.pos);return this.pos++,{t:"field",field:s}}$np(){this.pos++;let e="";for(;!this.eof();){const s=this.peekChar();if(s==='"'){if(this.src[this.pos+1]==='"'){e+='"',this.pos+=2;continue}return this.pos++,{t:"str",v:e}}e+=s,this.pos++}throw new SyntaxError('FormulaParser: 닫는 " 누락')}$mf(){const e=this.pos;let s=!1;this.peekChar()==="$"&&(s=!0,this.pos++);const i=this.pos;for(;!this.eof()&&/[A-Za-z]/.test(this.peekChar());)this.pos++;const n=this.src.slice(i,this.pos);if(!n)throw new SyntaxError(`FormulaParser: 식별자를 기대했지만 '${this.peekChar()||"EOF"}' (위치 ${e})`);if(!s){if(this.skip(),this.peekChar()==="("){this.pos++;const d=[];if(this.skip(),this.peekChar()!==")")for(d.push(this.parseComparison()),this.skip();this.peekChar()===",";)this.pos++,d.push(this.parseComparison()),this.skip();if(this.peekChar()!==")")throw new SyntaxError(`FormulaParser: 함수 '${n}' 닫는 ) 누락`);return this.pos++,{t:"call",name:n.toUpperCase(),args:d}}const c=n.toUpperCase();if(this.peekChar()!=="$"&&!/[0-9]/.test(this.peekChar())){if(c==="TRUE")return{t:"bool",v:!0};if(c==="FALSE")return{t:"bool",v:!1}}}let r=!1;this.peekChar()==="$"&&(r=!0,this.pos++);const l=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.pos===l){if(s||r)throw new SyntaxError(`FormulaParser: 셀참조 행번호 누락 (위치 ${this.pos})`);return{t:"error",code:"#NAME"}}const a=parseInt(this.src.slice(l,this.pos),10),h={t:"rawRef",colLetters:n.toUpperCase(),row:a,dollarCol:s,dollarRow:r};return this.$mq(h)}$mq(e){const s=this.pos;if(this.skip(),this.peekChar()===":"){this.pos++,this.skip();let i=!1,n=!1;this.peekChar()==="$"&&(i=!0,this.pos++);const r=this.pos;for(;!this.eof()&&/[A-Za-z]/.test(this.peekChar());)this.pos++;const l=this.src.slice(r,this.pos).toUpperCase();if(!l)throw new SyntaxError(`FormulaParser: 범위 두번째 코너 열문자 누락 (위치 ${this.pos})`);this.peekChar()==="$"&&(n=!0,this.pos++);const a=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.pos===a)throw new SyntaxError(`FormulaParser: 범위 두번째 코너 행번호 누락 (위치 ${this.pos})`);const h=parseInt(this.src.slice(a,this.pos),10);return{t:"rawRange",a:e,b:{t:"rawRef",colLetters:l,row:h,dollarCol:i,dollarRow:n}}}return this.pos=s,e}$mw(){const e=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.peekChar()===".")for(this.pos++;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.peekChar()==="e"||this.peekChar()==="E"){const i=this.pos;this.pos++,(this.peekChar()==="+"||this.peekChar()==="-")&&this.pos++;const n=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;this.pos===n&&(this.pos=i)}const s=this.src.slice(e,this.pos);if(!s||s===".")throw new SyntaxError(`FormulaParser: 숫자를 기대했지만 '${this.peekChar()||"EOF"}' (위치 ${e})`);return{t:"num",v:normalizeNumericLiteral(s)}}}function colLettersToIndex(o){let e=0;for(const s of o.toUpperCase())e=e*26+(s.charCodeAt(0)-64);return e-1}function indexToColLetters(o){let e=o+1,s="";for(;e>0;){const i=(e-1)%26;s=String.fromCharCode(65+i)+s,e=Math.floor((e-1)/26)}return s||"A"}function normalizeSingleRef(o,e){const{accessor:s,host:i,refMode:n}=e,r=colLettersToIndex(o.colLetters),a=s.visibleFields()[r];if(a===void 0)return null;const h=o.row-1,c=s.rowIdAtFlat(h);if(c===null)return null;if(n==="relative"&&!o.dollarRow){const d=s.flatIndexOfRowId(i.rowId);return{kind:"rel",dRow:d===-1?0:h-d,field:a,dollarRow:o.dollarRow,dollarCol:o.dollarCol}}return{kind:"abs",rowId:c,field:a,dollarRow:o.dollarRow,dollarCol:o.dollarCol}}function normalizeAst(o,e,s,i="stable"){const n={host:e,accessor:s,refMode:i};function r(l){switch(l.t){case"rawRef":{const a=normalizeSingleRef(l,n);return a?{t:"ref",ref:a}:{t:"error",code:"#REF"}}case"rawRange":{const a=normalizeSingleRef(l.a,n),h=normalizeSingleRef(l.b,n);return!a||!h?{t:"error",code:"#REF"}:{t:"range",ref:{a,b:h}}}case"call":return{t:"call",name:l.name,args:l.args.map(r)};case"unary":return{t:"unary",op:l.op,arg:r(l.arg)};case"bin":return{t:"bin",op:l.op,left:r(l.left),right:r(l.right)};default:return l}}return r(o)}function computeHasRangeRef(o){switch(o.t){case"range":return!0;case"call":return o.args.some(computeHasRangeRef);case"unary":return computeHasRangeRef(o.arg);case"bin":return computeHasRangeRef(o.left)||computeHasRangeRef(o.right);default:return!1}}class FormulaEvalError extends Error{constructor(e){super(e),this.code=e}}function evaluate(o,e,s,i={}){const n=new Set,r={v:!1},l=i.divisionPrecision??30;try{return{value:evalNode(o,e,s,n,r,l,i.functions,i.now),error:null,approx:r.v,touched:n}}catch(a){const h=a instanceof FormulaEvalError?a.code:"#ERR";return{value:h,error:h,approx:r.v,touched:n}}}function resolveRowId(o,e,s){if(o.kind==="abs")return o.rowId;const i=s.flatIndexOfRowId(e.rowId);return i===-1?null:s.rowIdAtFlat(i+o.dRow)}function readRef(o,e,s,i){const n=resolveRowId(o,e,s);if(n===null||!s.hasRow(n))throw new FormulaEvalError("#REF");if(!s.hasField(o.field))throw new FormulaEvalError("#REF");i.add(cellKey(n,o.field));const r=s.getCellValue(n,o.field),l=isErrorToken(r);if(l)throw new FormulaEvalError(l);return r}function resolveRangeMembers(o,e,s,i){const n=resolveRowId(o.a,e,s),r=resolveRowId(o.b,e,s);if(n===null||r===null||!s.hasRow(n)||!s.hasRow(r))throw new FormulaEvalError("#REF");if(!s.hasField(o.a.field)||!s.hasField(o.b.field))throw new FormulaEvalError("#REF");const l=s.displayedRowIds(),a=l.indexOf(n),h=l.indexOf(r);if(a===-1||h===-1)throw new FormulaEvalError("#REF");const c=Math.min(a,h),d=Math.max(a,h),f=l.slice(c,d+1),u=s.visibleFields(),p=u.indexOf(o.a.field),g=u.indexOf(o.b.field),[m,w]=p===-1||g===-1?[null,null]:[Math.min(p,g),Math.max(p,g)],y=[];for(const v of f){if(m===null||w===null){i.add(cellKey(v,o.a.field)),y.push(s.getCellValue(v,o.a.field));continue}for(let _=m;_<=w;_++){const b=u[_];i.add(cellKey(v,b)),y.push(s.getCellValue(v,b))}}return y}function toNumericOrThrow(o){if(o==null||o==="")return OGDecimal.zero();if(o instanceof OGDecimal)return o;if(typeof o=="boolean")return OGDecimal.from(o?"1":"0");if(typeof o=="number")return OGDecimal.from(o);if(typeof o=="string"){const e=o.trim();if(!NUMERIC_LITERAL_RE.test(e))throw new FormulaEvalError("#VALUE");return OGDecimal.from(normalizeNumericLiteral(e))}throw new FormulaEvalError("#VALUE")}function toDisplayString(o){return o==null?"":o instanceof OGDecimal?o.toString():typeof o=="boolean"?o?"TRUE":"FALSE":String(o)}function toBool(o){return typeof o=="boolean"?o:o instanceof OGDecimal?!o.isZero():typeof o=="number"?o!==0:typeof o=="string"?o.trim().toUpperCase()==="TRUE"||NUMERIC_LITERAL_RE.test(o.trim())&&o.trim()!=="0":!1}function unitAtDp(o){return o<=0?OGDecimal.from("1"):OGDecimal.from("0."+"0".repeat(o-1)+"1")}function truncateToDp(o,e,s){const i=Math.max(e,0),n=o.toFixed(i+20),r=n.startsWith("-"),l=r?n.slice(1):n,[a,h=""]=l.split("."),c=h.slice(0,i),d=h.slice(i),f=/[1-9]/.test(d),u=(r?"-":"")+a+(i>0?"."+c:"");let p=OGDecimal.from(u);if(f&&s==="up"){const g=unitAtDp(i);p=r?p.sub(g):p.add(g)}return p}function floorDecimal(o){const e=truncateToDp(o,0,"down");return o.isNeg()&&!o.eq(e)?e.sub("1"):e}function roundHalfUp(o,e){return OGDecimal.from(o.toFixed(Math.max(e,0)))}function powDecimal(o,e,s,i){const n=floorDecimal(e);if(e.eq(n)){const r=Number(n.toFixed(0));if(!Number.isFinite(r)||Math.abs(r)>1e5)return i.v=!0,OGDecimal.from(String(Math.pow(o.toNumber(),e.toNumber())));if(r===0)return OGDecimal.one();let l=OGDecimal.one();for(let a=0;a<Math.abs(r);a++)l=l.mul(o);if(r<0){if(l.isZero())throw new FormulaEvalError("#DIV0");l=OGDecimal.one().div(l,s)}return l}return i.v=!0,OGDecimal.from(String(Math.pow(o.toNumber(),e.toNumber())))}function evalBin(o,e,s,i,n){switch(o){case"+":return toNumericOrThrow(e).add(toNumericOrThrow(s));case"-":return toNumericOrThrow(e).sub(toNumericOrThrow(s));case"*":return toNumericOrThrow(e).mul(toNumericOrThrow(s));case"/":{const r=toNumericOrThrow(s);if(r.isZero())throw new FormulaEvalError("#DIV0");return toNumericOrThrow(e).div(r,i)}case"%":{const r=toNumericOrThrow(s);if(r.isZero())throw new FormulaEvalError("#DIV0");return toNumericOrThrow(e).mod(r)}case"^":return powDecimal(toNumericOrThrow(e),toNumericOrThrow(s),i,n);case"&":return toDisplayString(e)+toDisplayString(s);case"=":case"<>":{const r=looseEquals(e,s);return o==="="?r:!r}case"<":case"<=":case">":case">=":{const r=toNumericOrThrow(e),l=toNumericOrThrow(s);return o==="<"?r.lt(l):o==="<="?r.lte(l):o===">"?r.gt(l):r.gte(l)}default:throw new FormulaEvalError("#ERR")}}function looseEquals(o,e){try{return toNumericOrThrow(o).eq(toNumericOrThrow(e))}catch{return toDisplayString(o)===toDisplayString(e)}}function evalArgAsList(o,e){return o.t==="range"?resolveRangeMembers(o.ref,e.host,e.accessor,e.touched):[evalNode(o,e.host,e.accessor,e.touched,e.approxBox,e.prec,e.functions,e.now)]}function flattenAggArgs(o,e){const s=[];for(const i of o)for(const n of evalArgAsList(i,e))isErrorToken(n)||s.push(n);return s}function isNumericValue(o){return o==null||o===""?!1:o instanceof OGDecimal||typeof o=="number"?!0:typeof o=="string"?NUMERIC_LITERAL_RE.test(o.trim()):!1}function callFunction(o,e,s){if(s.functions){const i=s.functions.get(o);if(i)return callRegistryFn(i,e,s)}switch(o){case"SUM":{const i=flattenAggArgs(e,s);return OGDecimal.sum(i.map(n=>toNumericOrThrow(n)))}case"AVG":case"AVERAGE":{const n=flattenAggArgs(e,s).filter(r=>r!=null&&r!=="").map(r=>toNumericOrThrow(r));if(n.length===0)throw new FormulaEvalError("#ERR");return OGDecimal.avg(n,s.prec)}case"MIN":{const i=flattenAggArgs(e,s).filter(isNumericValue);if(i.length===0)throw new FormulaEvalError("#ERR");return OGDecimal.min(i.map(n=>toNumericOrThrow(n)))}case"MAX":{const i=flattenAggArgs(e,s).filter(isNumericValue);if(i.length===0)throw new FormulaEvalError("#ERR");return OGDecimal.max(i.map(n=>toNumericOrThrow(n)))}case"COUNT":{const i=flattenAggArgs(e,s);return OGDecimal.from(String(i.filter(isNumericValue).length))}case"COUNTA":{const i=flattenAggArgs(e,s);return OGDecimal.from(String(i.filter(n=>n!=null&&n!=="").length))}case"IF":{if(e.length<2)throw new FormulaEvalError("#ERR");const i=evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now);return toBool(i)?evalNode(e[1],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now):e.length>2?evalNode(e[2],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now):!1}case"AND":return e.every(i=>toBool(evalNode(i,s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)));case"OR":return e.some(i=>toBool(evalNode(i,s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)));case"NOT":if(e.length!==1)throw new FormulaEvalError("#ERR");return!toBool(evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now));case"ROUND":{if(e.length!==2)throw new FormulaEvalError("#ERR");const i=toNumericOrThrow(evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)),n=Number(toNumericOrThrow(evalNode(e[1],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)).toFixed(0));return roundHalfUp(i,n)}case"ROUNDUP":case"ROUNDDOWN":{if(e.length!==2)throw new FormulaEvalError("#ERR");const i=toNumericOrThrow(evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)),n=Number(toNumericOrThrow(evalNode(e[1],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)).toFixed(0));return truncateToDp(i,n,o==="ROUNDUP"?"up":"down")}case"ABS":{if(e.length!==1)throw new FormulaEvalError("#ERR");return toNumericOrThrow(evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)).abs()}case"INT":{if(e.length!==1)throw new FormulaEvalError("#ERR");return floorDecimal(toNumericOrThrow(evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)))}case"MOD":{if(e.length!==2)throw new FormulaEvalError("#ERR");const i=toNumericOrThrow(evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)),n=toNumericOrThrow(evalNode(e[1],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now));if(n.isZero())throw new FormulaEvalError("#DIV0");return i.mod(n)}case"POWER":{if(e.length!==2)throw new FormulaEvalError("#ERR");const i=toNumericOrThrow(evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)),n=toNumericOrThrow(evalNode(e[1],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now));return powDecimal(i,n,s.prec,s.approxBox)}case"SQRT":{if(e.length!==1)throw new FormulaEvalError("#ERR");const i=toNumericOrThrow(evalNode(e[0],s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now));if(i.isNeg())throw new FormulaEvalError("#NUM");return s.approxBox.v=!0,OGDecimal.from(String(Math.sqrt(i.toNumber())))}case"CONCAT":return e.map(i=>toDisplayString(evalNode(i,s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now))).join("");default:throw new FormulaEvalError("#NAME")}}function callRegistryFn(o,e,s){const{min:i,max:n}=o.arity;if(e.length<i||n!=="variadic"&&e.length>n)throw new FormulaEvalError("#ERR");const r=e.map(a=>({scalar:()=>evalNode(a,s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now),tryScalar:()=>{try{return{ok:!0,value:evalNode(a,s.host,s.accessor,s.touched,s.approxBox,s.prec,s.functions,s.now)}}catch(h){return{ok:!1,error:h instanceof FormulaEvalError?h.code:"#ERR"}}},list:()=>evalArgAsList(a,s)})),l={prec:s.prec,now:s.now??(()=>Date.now()),argCount:e.length,markApprox:()=>{s.approxBox.v=!0},fail:a=>{throw new FormulaEvalError(a)},toNum:a=>toNumericOrThrow(a),toBool:a=>toBool(a),toStr:a=>toDisplayString(a),isNumeric:a=>isNumericValue(a),collect:()=>flattenAggArgs(e,s)};return o.evaluate(r,l)}function evalNode(o,e,s,i,n,r,l,a){switch(o.t){case"num":return OGDecimal.from(o.v);case"str":return o.v;case"bool":return o.v;case"error":throw new FormulaEvalError(o.code);case"field":{if(!s.hasField(o.field))throw new FormulaEvalError("#REF");i.add(cellKey(e.rowId,o.field));const h=s.getCellValue(e.rowId,o.field),c=isErrorToken(h);if(c)throw new FormulaEvalError(c);return normalizeRawCellValue(h)}case"ref":{const h=readRef(o.ref,e,s,i);return normalizeRawCellValue(h)}case"range":throw new FormulaEvalError("#VALUE");case"call":return callFunction(o.name,o.args,{host:e,accessor:s,touched:i,prec:r,approxBox:n,functions:l,now:a});case"unary":{const h=toNumericOrThrow(evalNode(o.arg,e,s,i,n,r,l,a));return o.op==="-"?h.neg():h}case"bin":return evalBin(o.op,evalNode(o.left,e,s,i,n,r,l,a),evalNode(o.right,e,s,i,n,r,l,a),r,n);default:throw new FormulaEvalError("#ERR")}}function normalizeRawCellValue(o){return o==null?null:o instanceof OGDecimal||typeof o=="string"||typeof o=="boolean"?o:typeof o=="number"?OGDecimal.from(o):String(o)}class FormulaStore{constructor(){this.$p=new Map}setFormula(e,s,i){this.$p.set(cellKey(e,s),i)}getFormula(e,s){return this.$p.get(cellKey(e,s))}clearFormula(e,s){this.$p.delete(cellKey(e,s))}hasFormula(e,s){return this.$p.has(cellKey(e,s))}getFormulaByKey(e){return this.$p.get(e)}getAllFormulaCells(){const e=[];for(const[s,i]of this.$p){const n=s.indexOf(":");e.push({rowId:s.slice(0,n),field:s.slice(n+1),cell:i})}return e}getRangeBearingKeys(){const e=[];for(const[s,i]of this.$p)i.hasRangeRef&&e.push(s);return e}size(){return this.$p.size}}class FormulaGraph{constructor(){this.$cb=new Map,this.$bk=new Map,this.$do=new Map,this.$dn=new Map}$kW(e,s){let i=this.$bk.get(e);i||(i=new Set,this.$bk.set(e,i)),i.add(s);const{rowId:n,field:r}=parseCellKey(e);let l=this.$do.get(n);l||(l=new Set,this.$do.set(n,l)),l.add(s);let a=this.$dn.get(r);a||(a=new Set,this.$dn.set(r,a)),a.add(s)}$kd(e){const s=this.$cb.get(e);if(s)for(const i of s){const n=this.$bk.get(i);n&&(n.delete(e),n.size===0&&this.$bk.delete(i));const{rowId:r,field:l}=parseCellKey(i),a=this.$do.get(r);a&&(a.delete(e),a.size===0&&this.$do.delete(r));const h=this.$dn.get(l);h&&(h.delete(e),h.size===0&&this.$dn.delete(l))}}addFormula(e,s){this.$kd(e),this.$cb.set(e,new Set(s));for(const i of s)this.$kW(i,e)}removeFormula(e){this.$kd(e),this.$cb.delete(e)}isFormula(e){return this.$cb.has(e)}getPrecedents(e){return[...this.$cb.get(e)??[]]}getDependents(e){return[...this.$bk.get(e)??[]]}getDependentsClosure(e){const s=new Set;for(const r of e)this.isFormula(r)&&s.add(r);const i=[...e];let n=0;for(;n<i.length;){const r=i[n++],l=this.$bk.get(r);if(l)for(const a of l)s.has(a)||(s.add(a),i.push(a))}return[...s]}topoOrder(e){const s=new Set(e),i=new Map;for(const c of e){const d=this.$cb.get(c);let f=0;if(d)for(const u of d)s.has(u)&&f++;i.set(c,f)}const n=[];for(const[c,d]of i)d===0&&n.push(c);let r=0;const l=[];for(;r<n.length;){const c=n[r++];l.push(c);const d=this.$bk.get(c);if(d)for(const f of d){if(!s.has(f))continue;const u=(i.get(f)??0)-1;i.set(f,u),u===0&&n.push(f)}}const a=new Set(l),h=e.filter(c=>!a.has(c));return{order:l,cycles:h}}formulasReferencing(e,s){return s!==void 0?[...this.$bk.get(cellKey(e,s))??[]]:[...this.$do.get(e)??[]]}formulasReferencingField(e){return[...this.$dn.get(e)??[]]}allFormulaKeys(){return[...this.$cb.keys()]}}function refToA1(o,e,s){let i;if(o.kind==="abs")i=o.rowId;else{const h=s.flatIndexOfRowId(e.rowId);i=h===-1?null:s.rowIdAtFlat(h+o.dRow)}if(i===null||!s.hasRow(i)||!s.hasField(o.field))return"#REF!";const n=s.flatIndexOfRowId(i),r=s.visibleFields().indexOf(o.field);if(n===-1||r===-1)return"#REF!";const l=(o.dollarCol?"$":"")+indexToColLetters(r),a=(o.dollarRow?"$":"")+(n+1);return l+a}function escapeStringLit(o){return'"'+o.replace(/"/g,'""')+'"'}const BIN_TEXT={"+":"+","-":"-","*":"*","/":"/","%":"%","^":"^","&":"&","=":"=","<>":"<>","<":"<","<=":"<=",">":">",">=":">="};function astToSource(o,e,s){return"="+render(o,e,s)}function render(o,e,s){switch(o.t){case"num":return o.v;case"str":return escapeStringLit(o.v);case"bool":return o.v?"TRUE":"FALSE";case"field":return`[${o.field}]`;case"error":return"#REF!";case"ref":return refToA1(o.ref,e,s);case"range":return`${refToA1(o.ref.a,e,s)}:${refToA1(o.ref.b,e,s)}`;case"call":return`${o.name}(${o.args.map(i=>render(i,e,s)).join(",")})`;case"unary":return`${o.op}${render(o.arg,e,s)}`;case"bin":return`(${render(o.left,e,s)}${BIN_TEXT[o.op]}${render(o.right,e,s)})`;default:return"#REF!"}}class RecalcCoordinator{constructor(e){this.store=new FormulaStore,this.graph=new FormulaGraph,this.$P=e.accessor,this.$fu=e.setComputedValue,this.$eV=e.onFormulaError,this.$ka=e.refMode??"stable",this.$fa=e.divisionPrecision??30,this.$gp=e.functions,this.$i=e.now}$iv(){const e={divisionPrecision:this.$fa};return this.$gp&&(e.functions=this.$gp),this.$i&&(e.now=this.$i),e}compile(e,s){let i;try{i=parseFormula(e)}catch{i={t:"error",code:"#ERR"}}const n=normalizeAst(i,s,this.$P,this.$ka);return{ast:n,hasRangeRef:computeHasRangeRef(n)}}setCellFormula(e,s,i){const n={rowId:e,field:s},{ast:r,hasRangeRef:l}=this.compile(i,n),a={src:i,ast:r,hasRangeRef:l,value:null,error:null};this.store.setFormula(e,s,a);const h=cellKey(e,s),c=evaluate(r,n,this.$P,this.$iv());return this.graph.addFormula(h,c.touched),this.onValuesChanged([h])}getCellFormula(e,s){var i;return((i=this.store.getFormula(e,s))==null?void 0:i.src)??null}hasCellFormula(e,s){return this.store.hasFormula(e,s)}clearCellFormula(e,s){const i=cellKey(e,s),n=this.graph.getDependents(i);return this.store.clearFormula(e,s),this.graph.removeFormula(i),n}getCellError(e,s){var i;return((i=this.store.getFormula(e,s))==null?void 0:i.error)??null}getDependents(e,s){return this.graph.getDependents(cellKey(e,s)).map(parseCellKey)}onValuesChanged(e){var s;const i=_now(),n=this.graph.getDependentsClosure(e),{order:r,cycles:l}=this.graph.topoOrder(n);for(const a of l){const{rowId:h,field:c}=parseCellKey(a),d=this.store.getFormula(h,c);d&&(d.value="#CYCLE",d.error="#CYCLE"),this.$fu(h,c,"#CYCLE"),(s=this.$eV)==null||s.call(this,h,c,"#CYCLE")}for(const a of r)this.$iw(a);return{changed:[...r,...l],cycles:l.length,ms:_now()-i}}$iw(e){var s;const{rowId:i,field:n}=parseCellKey(e),r=this.store.getFormula(i,n);if(!r)return;const l=evaluate(r.ast,{rowId:i,field:n},this.$P,this.$iv());this.graph.addFormula(e,l.touched),r.value=l.value,r.error=l.error,r.approx=l.approx,this.$fu(i,n,l.value),l.error&&((s=this.$eV)==null||s.call(this,i,n,l.error))}recalculateAll(){var e;const s=_now(),i=this.graph.allFormulaKeys(),{order:n,cycles:r}=this.graph.topoOrder(i);for(const l of r){const{rowId:a,field:h}=parseCellKey(l),c=this.store.getFormula(a,h);c&&(c.value="#CYCLE",c.error="#CYCLE"),this.$fu(a,h,"#CYCLE"),(e=this.$eV)==null||e.call(this,a,h,"#CYCLE")}for(const l of n)this.$iw(l);return{changed:[...n,...r],cycles:r.length,ms:_now()-s}}recalcRangeBearing(){return this.onValuesChanged(this.store.getRangeBearingKeys())}invalidateRow(e){return this.onValuesChanged(this.graph.formulasReferencing(e))}invalidateField(e){return this.onValuesChanged(this.graph.formulasReferencingField(e))}offsetFormula(e,s,i,n){const r=this.store.getFormula(e,s);if(!r)return"";const l=(()=>{const h=this.$P.flatIndexOfRowId(e);return h===-1?e:this.$P.rowIdAtFlat(h+i)??e})();(()=>{const h=this.$P.visibleFields(),c=h.indexOf(s);return c===-1?s:h[c+n]??s})();const a=this.$ni(r.ast,i,n);return astToSource(a,{rowId:l},this.$P)}$ni(e,s,i){const n=l=>{if(l.kind==="rel")return{...l,dRow:l.dollarRow?l.dRow:l.dRow+s};let a=l.field;if(!l.dollarCol&&i!==0){const c=this.$P.visibleFields(),d=c.indexOf(l.field),f=d===-1?void 0:c[d+i];if(!f)return{kind:"abs",rowId:"__dead__",field:"__dead__",dollarRow:l.dollarRow,dollarCol:l.dollarCol};a=f}let h=l.rowId;if(!l.dollarRow&&s!==0){const c=this.$P.flatIndexOfRowId(l.rowId),d=c===-1?null:this.$P.rowIdAtFlat(c+s);if(d===null)return{kind:"abs",rowId:"__dead__",field:"__dead__",dollarRow:l.dollarRow,dollarCol:l.dollarCol};h=d}return{kind:"abs",rowId:h,field:a,dollarRow:l.dollarRow,dollarCol:l.dollarCol}},r=l=>{switch(l.t){case"ref":{const a=n(l.ref);return a.kind==="abs"&&a.rowId==="__dead__"?{t:"error",code:"#REF"}:{t:"ref",ref:a}}case"range":{const a=n(l.ref.a),h=n(l.ref.b);return a.kind==="abs"&&a.rowId==="__dead__"||h.kind==="abs"&&h.rowId==="__dead__"?{t:"error",code:"#REF"}:{t:"range",ref:{a,b:h}}}case"call":return{t:"call",name:l.name,args:l.args.map(r)};case"unary":return{t:"unary",op:l.op,arg:r(l.arg)};case"bin":return{t:"bin",op:l.op,left:r(l.left),right:r(l.right)};default:return l}};return r(e)}}function _now(){return typeof performance<"u"?performance.now():Date.now()}class DateEditor{constructor(){this.$az=e=>{e.stopPropagation(),e.key==="Enter"?(e.preventDefault(),this.$X(this.input.value)):e.key==="Escape"&&this.$aN()},this.$bv=()=>{this.$X(this.input.value)}}mount(e,s,i,n){this._container=e,this.$X=i,this.$aN=n,e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","true"),this.input=document.createElement("input"),this.input.type="date",this.input.className="og-cell-input",this.input.setAttribute("aria-label",s.column.header??ctxT(s,"editor.datePick"));const r=s.value;if(r){const l=r instanceof Date?r:new Date(r);isNaN(l.getTime())||(this.input.value=formatDate(l,"yyyy-MM-dd"))}this.input.addEventListener("keydown",this.$az),this.input.addEventListener("blur",this.$bv),e.appendChild(this.input)}getValue(){var e;return(e=this.input)==null?void 0:e.value}focus(){var e;(e=this.input)==null||e.focus()}destroy(){var e,s,i;(e=this._container)==null||e.setAttribute("aria-expanded","false"),(s=this.input)==null||s.removeEventListener("keydown",this.$az),(i=this.input)==null||i.removeEventListener("blur",this.$bv)}}function normalizeOptions(o){return o.map(e=>typeof e=="string"?{label:e,value:e}:{label:e.label??e.text??String(e.value??""),value:e.value})}class SelectEditor{constructor(e=[],s){this._options=normalizeOptions(e),this.$gS=s??null}mount(e,s,i,n){this._container=e,this.$X=i,this.$aN=n,e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-expanded","true"),this.select=document.createElement("select"),this.select.className="og-cell-select",this.select.setAttribute("aria-label",s.column.header??ctxT(s,"editor.select"));const r=this.$gS?normalizeOptions(this.$gS(s.row,s.rowIndex)):this._options;for(const a of r){const h=document.createElement("option");h.value=String(a.value),h.textContent=a.label,this.select.appendChild(h)}const l=s.value==null?"":String(s.value);r.some(a=>String(a.value)===l)&&(this.select.value=l),this.select.addEventListener("change",()=>i(this.select.value)),this.select.addEventListener("blur",()=>i(this.select.value)),this.select.addEventListener("keydown",a=>{a.key==="Escape"&&n()}),e.appendChild(this.select)}getValue(){var e;return(e=this.select)==null?void 0:e.value}focus(){var e;(e=this.select)==null||e.focus()}destroy(){var e;(e=this._container)==null||e.setAttribute("aria-expanded","false")}}class TextEditor{constructor(){this.$az=e=>{e.stopPropagation(),e.key==="Enter"||e.key==="Tab"?(e.preventDefault(),this.$X(this.input.value)):e.key==="Escape"&&this.$aN()},this.$bv=()=>{this.$X(this.input.value)}}mount(e,s,i,n){this.$X=i,this.$aN=n,this.input=document.createElement("input"),this.input.type="text",this.input.value=s.value==null?"":String(s.value),this.input.style.cssText=`
|
|
39
|
+
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
40
|
+
font-size:var(--og-font-size,13px);font-family:var(--og-font-family,sans-serif);
|
|
41
|
+
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
42
|
+
`,this.input.addEventListener("keydown",this.$az),this.input.addEventListener("blur",this.$bv),e.appendChild(this.input)}getValue(){var e;return(e=this.input)==null?void 0:e.value}focus(){var e,s;(e=this.input)==null||e.focus(),(s=this.input)==null||s.select()}destroy(){var e,s;(e=this.input)==null||e.removeEventListener("keydown",this.$az),(s=this.input)==null||s.removeEventListener("blur",this.$bv)}}class NumberEditor{constructor(e){this.$az=s=>{s.stopPropagation(),s.key==="Enter"||s.key==="Tab"?(s.preventDefault(),this.$bj()):s.key==="Escape"&&this.$aN()},this.$bv=()=>{this.$bj()},this.min=e==null?void 0:e.min,this.max=e==null?void 0:e.max,this.step=e==null?void 0:e.step}mount(e,s,i,n){this.$X=i,this.$aN=n,this.input=document.createElement("input"),this.input.type="number",this.input.value=s.value==null?"":String(s.value),this.min!=null&&(this.input.min=String(this.min)),this.max!=null&&(this.input.max=String(this.max)),this.step!=null&&(this.input.step=String(this.step)),this.input.style.cssText=`
|
|
43
|
+
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
44
|
+
font-size:var(--og-font-size,13px);text-align:right;
|
|
45
|
+
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
46
|
+
`,this.input.addEventListener("keydown",this.$az),this.input.addEventListener("blur",this.$bv),e.appendChild(this.input)}$bj(){const e=this.input.value===""?null:Number(this.input.value);this.$X(e)}getValue(){var e,s;return((e=this.input)==null?void 0:e.value)===""?null:Number((s=this.input)==null?void 0:s.value)}focus(){var e,s;(e=this.input)==null||e.focus(),(s=this.input)==null||s.select()}destroy(){var e,s;(e=this.input)==null||e.removeEventListener("keydown",this.$az),(s=this.input)==null||s.removeEventListener("blur",this.$bv)}}class CheckboxEditor{mount(e,s,i,n){this.$X=i,e.style.cssText+="display:flex;align-items:center;justify-content:center;",this.chk=document.createElement("input"),this.chk.type="checkbox",this.chk.checked=!!s.value,this.chk.style.cursor="pointer",this.chk.addEventListener("change",()=>i(this.chk.checked)),e.appendChild(this.chk)}getValue(){var e;return(e=this.chk)==null?void 0:e.checked}focus(){var e;(e=this.chk)==null||e.focus()}destroy(){}}const _editorRegistry=new Map;function registerEditor(o,e){_editorRegistry.set(o,e)}registerEditor("number",(o,e)=>{const s={};return e&&(e.min!=null&&(s.min=e.min),e.max!=null&&(s.max=e.max),e.step!=null&&(s.step=e.step)),new NumberEditor(s)}),registerEditor("date",()=>new DateEditor),registerEditor("boolean",()=>new CheckboxEditor),registerEditor("checkbox",()=>new CheckboxEditor),registerEditor("select",(o,e)=>new SelectEditor((e?e.options:o.options)??[],o.optionsFn));function createEditor(o){const e=o.editor;let s,i;e?typeof e=="string"?(s=e,i=void 0):(s=e.type,i=e):(s=String(o.type??""),i=void 0);const n=_editorRegistry.get(s);return n?n(o,i):new TextEditor}function isToggleCol(o){const e=typeof o.renderer=="string"?o.renderer:o.renderer&&typeof o.renderer=="object"?o.renderer.type:"";return o.type==="boolean"||o.type==="checkbox"||e==="checkbox"||e==="switch"}const FOCUS_REPAINT=RenderRequest.of(Change.Focus,{sync:!0}),PINNED_CHANGED=RenderRequest.of(Change.ColsScrolled),PINNED_CHANGED_NOW=RenderRequest.of(Change.ColsScrolled,{sync:!0}),NO_PINNED$1=Object.freeze([]);class CellEditManager{constructor(e){this.$bg=null,this.$aH=null,this._focusCell=null,this.$ik=null,this.$gV=NO_PINNED$1,this.$a=e}get activeEditor(){return this.$bg}get editCell(){return this.$aH}get focusCell(){return this._focusCell}get dragColIdx(){return this.$ik}set dragColIdx(e){this.$ik=e}pinnedColumns(){const e=this.$aH?this.$aH.ci:-1,s=this._focusCell?this._focusCell.ci:-1,i=Math.min(e,s),n=Math.max(e,s),r=this.$gV,l=i<0?n<0?0:1:i===n?1:2,a=i<0?n:i;return r.length===l&&(l===0||r[0]===a&&(l===1||r[1]===n))?r:(this.$gV=l===0?NO_PINNED$1:Object.freeze(l===1?[a]:[i,n]),this.$gV)}$jA(e){this.pinnedColumns()!==e&&this.$a.submitRender(PINNED_CHANGED)}setFocusCell(e,s){var i,n;this._focusCell={ri:e,ci:s},this.$a.scrollToRow(e),(n=(i=this.$a).revealColumn)==null||n.call(i,s),this.$a.submitRender(FOCUS_REPAINT);const r=this.$a.getVisibleLeaves()[s],l=this.$a.data.getRowByIndex(e);if(r&&l){const a=l[r.field];this.$a.announce(this.$a.t("editor.cellPositionAnnounce",{row:e+1,col:s+1,header:r.header,value:a==null?this.$a.t("cell.emptyValue"):String(a)}))}}clearFocusCell(){this._focusCell=null}startEditByKey(e,s){var i,n,r,l,a,h,c,d,f,u,p;const g=this.$a.getVisibleLeaves()[s];if(!g)return;if(isToggleCol(g)){const x=this.$a.getOptions();if(g.editable!==!1&&(g.editable!==void 0||x.editable)){const M=this.$a.data.getRowByIndex(e);M&&this.$a.writeCell(e,g.field,!M[g.field])}return}const m=this.$a.data.getRowByIndex(e);if(g.editable===!1||typeof g.editable=="function"&&!g.editable(m,e))return;this.commitEdit();let w=(i=this.$a.getRenderer())==null?void 0:i.getCellEl(e,s);if(w||((r=(n=this.$a).revealColumn)==null||r.call(n,s),this.$a.submitRender(PINNED_CHANGED_NOW),w=(l=this.$a.getRenderer())==null?void 0:l.getCellEl(e,s)),!w)return;w.innerHTML="";const y=createEditor(g),v=this.pinnedColumns();this.$bg=y,this.$aH={ri:e,ci:s},this.$jA(v),(c=(h=(a=this.$a).getBodyPin)==null?void 0:h.call(a))==null||c.pin({editRow:e});const _={type:"editStart",rowIndex:e,columnIndex:s,field:g.field,oldValue:m==null?void 0:m[g.field],newValue:m==null?void 0:m[g.field],row:m,column:g};this.$a.emit("editStart",_),w.classList.add("og-editing");const E={value:((f=(d=this.$a).hasCellFormula)!=null&&f.call(d,e,g.field)?(p=(u=this.$a).getCellFormula)==null?void 0:p.call(u,e,g.field):null)??(m==null?void 0:m[g.field]),row:m,rowIndex:e,column:g,colIndex:s,isSelected:!0,rowState:"none",t:(x,S)=>this.$a.t(x,S)};y.mount(w,E,x=>this.commitEditWithValue(e,s,x),()=>this.cancelEdit()),requestAnimationFrame(()=>y.focus())}startEdit(e,s,i){var n,r,l,a,h,c,d,f;const u=this.$a.getOptions();if(!u.editable)return;const p=this.$a.getVisibleLeaves()[s];if(!p||isToggleCol(p))return;const g=this.$a.data.getRowByIndex(e);if(p.editable===!1||typeof p.editable=="function"&&!p.editable(g,e)||!p.editable&&!u.editable)return;this.commitEdit();const m=(n=this.$a.getRenderer())==null?void 0:n.getCellEl(e,s);if(!m)return;m.innerHTML="";const w=createEditor(p),y=this.pinnedColumns();this.$bg=w,this.$aH={ri:e,ci:s},this.$jA(y),(a=(l=(r=this.$a).getBodyPin)==null?void 0:l.call(r))==null||a.pin({editRow:e});const v={type:"editStart",rowIndex:e,columnIndex:s,field:p.field,oldValue:g==null?void 0:g[p.field],newValue:g==null?void 0:g[p.field],row:g,column:p};this.$a.emit("editStart",v),m.classList.add("og-editing");const b={value:((c=(h=this.$a).hasCellFormula)!=null&&c.call(h,e,p.field)?(f=(d=this.$a).getCellFormula)==null?void 0:f.call(d,e,p.field):null)??(g==null?void 0:g[p.field]),row:g,rowIndex:e,column:p,colIndex:s,isSelected:!0,rowState:"none",t:(E,x)=>this.$a.t(E,x)};w.mount(m,b,E=>this.commitEditWithValue(e,s,E),()=>this.cancelEdit()),requestAnimationFrame(()=>w.focus())}commitEdit(){if(!this.$bg||!this.$aH)return;const e=this.$bg.getValue(),{ri:s,ci:i}=this.$aH;this._finishEdit(s,i,e,!1)}commitEditWithValue(e,s,i){this._finishEdit(e,s,i,!1)}cancelEdit(){if(!this.$aH)return;const{ri:e,ci:s}=this.$aH;this._finishEdit(e,s,void 0,!0)}_finishEdit(e,s,i,n){var r,l,a,h,c,d,f,u,p,g;if(!this.$bg)return;const m=this.$a.getVisibleLeaves()[s],w=(r=this.$a.getRenderer())==null?void 0:r.getCellEl(e,s);if(this.$bg.destroy(),w&&w.classList.remove("og-editing"),this.$bg=null,this.$aH=null,(h=(a=(l=this.$a).getBodyPin)==null?void 0:a.call(l))==null||h.pin({editRow:null}),!n&&m){const y=this.$a.data.getCellValue(e,m.field),v=((d=(c=this.$a).hasCellFormula)==null?void 0:d.call(c,e,m.field))??!1;if(typeof i=="string"&&i.trimStart().startsWith("=")){(u=(f=this.$a).setCellFormula)==null||u.call(f,e,m.field,i);const b=this.$a.data.getRowByIndex(e),E={type:"editEnd",rowIndex:e,columnIndex:s,field:m.field,oldValue:y,newValue:i,row:b,column:m};this.$a.emit("editEnd",E),this.$a.emit("dataChange",this.$a.data.getData())}else if(i!==y||v){v&&((g=(p=this.$a).clearCellFormula)==null||g.call(p,e,m.field)),this.$a.data.updateCell(e,m.field,i);const b=this.$a.data.getRowByIndex(e),E={type:"editEnd",rowIndex:e,columnIndex:s,field:m.field,oldValue:y,newValue:i,row:b,column:m};this.$a.emit("editEnd",E),this.$a.emit("dataChange",this.$a.data.getData())}}this.$a.submitRender(RenderRequest.REPAINT_VISIBLE),requestAnimationFrame(()=>this.$a.getContainer().focus({preventScroll:!0}))}}const STREAM_DEFAULTS={streamRowThreshold:5e4};function shouldStream(o,e){return o>=STREAM_DEFAULTS.streamRowThreshold}new TextEncoder;async function defaultLoadStreamModules(){const[o,e,s]=await Promise.all([Promise.resolve().then(()=>require("./sinks-BCZFMGQJ.cjs")),Promise.resolve().then(()=>require("./XlsxChannel-DQHLGend.cjs")),Promise.resolve().then(()=>require("./XlsxWorkbookWriter-DixuNGtw.cjs"))]);return{pickExcelSink:o.pickExcelSink,createChannel:i=>new e.XlsxChannel(new s.XlsxWorkbookWriter({level:i.compressionLevel}),i)}}class ExportManager{constructor(e){this.$a=e}$cd(e){return getComputedStyle(this.$a.getContainer()).getPropertyValue(e).trim()}$iR(e){const s=e.trim(),i=s.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/i);if(i)return[i[1],i[2],i[3]].map(r=>parseInt(r).toString(16).padStart(2,"0")).join("").toUpperCase();const n=s.replace("#","").toUpperCase();return n.length===3?n[0]+n[0]+n[1]+n[1]+n[2]+n[2]:n.length===6?n:""}$hC(e){return typeof e=="string"&&/^[#0,.%]+$/.test(e)?e:void 0}$hI(e,s,i,n,r,l){var a,h;let c="1565C0",d="FFFFFF",f="FFFFFF",u="EEF2FF",p="212121",g="BDBDBD",m=10;if(l==="theme"){const _=E=>this.$iR(E);c=_(this.$cd("--og-header-bg"))||c,d=_(this.$cd("--og-header-color"))||d,f=_(this.$cd("--og-row-bg"))||f,u=_(this.$cd("--og-row-alt-bg"))||u,p=_(this.$cd("--og-row-color"))||p,g=_(this.$cd("--og-border-color"))||g;const b=this.$cd("--og-font-size");b&&(m=Math.max(8,Math.round(parseFloat(b)*.75)))}const w=l==="none",y=((h=(a=this.$a).getMeta)==null?void 0:h.call(a).exportFont)??"맑은 고딕",v={hdrFont:w?{}:{bold:!0,color:{rgb:d},sz:m,name:y},dataFont:w?{}:{sz:m,color:{rgb:p},name:y},hdrFill:w?{}:{patternType:"solid",fgColor:{rgb:c}},evenFill:w?{}:{patternType:"solid",fgColor:{rgb:f}},oddFill:w?{}:{patternType:"solid",fgColor:{rgb:u}},hdrBorder:w?{}:{top:{style:"medium",color:{rgb:c}},bottom:{style:"medium",color:{rgb:c}},left:{style:"thin",color:{rgb:c}},right:{style:"thin",color:{rgb:c}}},dataBorder:w?{}:{top:{style:"thin",color:{rgb:g}},bottom:{style:"thin",color:{rgb:g}},left:{style:"thin",color:{rgb:g}},right:{style:"thin",color:{rgb:g}}}};i.forEach((_,b)=>{const E=r&&b===0,S=(r?b-1:b)%2===0;_.forEach((M,R)=>{const k=e.encode_cell({r:b,c:R});s[k]||(s[k]={t:"s",v:""});const C=n[R],I=C.type==="number"||C.align==="right",L=E?"center":I?"right":C.align??"left",T=E?void 0:this.$hC(C.format);T&&s[k].t==="n"&&(s[k].z=T),s[k].s={font:E?v.hdrFont:v.dataFont,fill:E?v.hdrFill:S?v.evenFill:v.oddFill,border:E?v.hdrBorder:v.dataBorder,alignment:{horizontal:L,vertical:"center",wrapText:!1},...T?{numFmt:T}:{}}})})}exportExcel(e){const s=typeof e=="string"?{filename:e}:e??{};let i=s.filename??"export";i.toLowerCase().endsWith(".xlsx")||(i+=".xlsx");const n=s.sheetName??(this.$a.getOptions().ariaLabel||"Sheet1"),r=this.$a.getData(),l=this.$a.getColLayout().visibleLeaves.filter(u=>{var p;return!((p=s.exceptFields)!=null&&p.includes(u.field))}),a=s.includeHeader!==!1,h=s.stream??"auto",c=h==="force"||h==="auto"&&shouldStream(r.length),d=(this.$a.getStrategy??((u,p)=>p))("cellSerializer",(u,p,g)=>p.type==="number"&&typeof u=="number"?u:typeof u=="boolean"?u?"✓":"":typeof u=="object"?"":String(u)),f=(u,p)=>{const g=u[p.field];if(s.maskOnExport&&p.mask&&this.$a.getMaskEnabled(p.field))return applyMask(g==null?"":String(g),p.mask);const m=g;return m==null||m===""?"":d(m,p,u)};if(c){this.$lL(s,i,n,r,l,f,a);return}Promise.resolve().then(()=>require("./xlsx.min-CMvrM6b4.cjs")).then(u=>u.xlsx_min).then(({utils:u,writeFile:p})=>{var g;const m=[];a&&m.push(l.map(b=>b.header));for(const b of r)m.push(l.map(E=>f(b,E)));const w=u.aoa_to_sheet(m),y=this.$a.getColWidths(),v=this.$a.getColLayout();w["!cols"]=l.map(b=>({wpx:y[v.getColumnIndex(b.field)]??100})),w["!rows"]=m.map((b,E)=>({hpx:E===0&&a?22:19})),this.$hI(u,w,m,l,a,s.styleMode??"theme");const _=u.book_new();u.book_append_sheet(_,w,n),p(_,i,{cellStyles:!0}),(g=s.onAfter)==null||g.call(s,new Blob([]))}).catch(()=>{console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.")})}async $lL(e,s,i,n,r,l,a){var h,c;const d=this.$a.getColWidths(),f=this.$a.getColLayout(),u=b=>typeof b=="string"&&this.$iR(b)||void 0,p=(b,E)=>{const x=u((b==null?void 0:b.backgroundColor)??(b==null?void 0:b.background)),S=u(b==null?void 0:b.color),M=b==null?void 0:b.fontWeight,R=M==="bold"||M==="bolder"||Number(M)>=600,k=(b==null?void 0:b.fontStyle)==="italic";if(!(!x&&!S&&!R&&!k&&!E))return{...x?{fill:{rgb:x}}:{},...S||R||k?{font:{...R?{bold:!0}:{},...k?{italic:!0}:{},...S?{color:{rgb:S}}:{}}}:{},...E?{numFmt:E}:{}}},g=r.map(b=>({fn:typeof b.cellStyle=="function"?b.cellStyle:void 0,fmt:this.$hC(b.format),fixed:typeof b.cellStyle=="function"?void 0:p(b.cellStyle,this.$hC(b.format))})),m={projectHeader:()=>[r.map(b=>({text:b.header,field:b.field,colSpan:1,rowSpan:1,widthPx:d[f.getColumnIndex(b.field)]??100,align:b.align??"left"}))],totalRows:()=>n.length,dataState:()=>"ready",projectRows:()=>async function*(){let E=[];for(let x=0;x<n.length;x++){const S=n[x],M=r.map((R,k)=>{const C=l(S,R),I=typeof C=="number"&&R.type==="number",L=g[k],T=L.fn?p(L.fn(S[R.field],S,x),I?L.fmt:void 0):L.fixed,z=!I&&typeof R.cellRuns=="function"?R.cellRuns(S[R.field],S,x):void 0;return{text:String(C),...I?{rawText:String(C)}:{},applied:[],rowSpan:1,colSpan:1,hidden:!1,align:I||R.align==="right"?"right":R.align??"left",type:I?"number":"text",...T?{xlsxStyle:T}:{},...z&&z.length>0?{xlsxRuns:z}:{}}});E.push({modelIndex:x,cells:M}),E.length>=2e3&&(yield{rows:E,done:!1},E=[])}yield{rows:E,done:!0}}()},w=new AbortController,y=e.signal;y&&(y.aborted?w.abort():y.addEventListener("abort",()=>w.abort(),{once:!0}));const{ExportProgressView:v}=await Promise.resolve().then(()=>require("./ExportProgressView-BYPw8osg.cjs")),_=new v({t:this.$a.t,onCancel:()=>w.abort()});try{const b=await(this.$a.loadStreamModules??defaultLoadStreamModules)();let E,x;try{const k=b.pickExcelSink({fileName:s});x=k.kind,E=await k.create()}catch(k){if((k==null?void 0:k.name)==="AbortError"){_.close();return}if((k==null?void 0:k.name)!=="SecurityError"&&(k==null?void 0:k.name)!=="NotAllowedError")throw k;const C=b.pickExcelSink({fileName:s,fsAccess:"off"});x=C.kind,E=await C.create()}const S=[];if(x==="blob"&&e.onAfter){const k=E;E={write:C=>(S.push(typeof C=="string"?C:C.slice()),k.write(C)),close:()=>k.close(),abort:C=>k.abort(C),get desiredSize(){return k.desiredSize}}}const M=n.length,R=await b.createChannel({sheetName:i,includeHeader:a,compressionLevel:e.compressionLevel}).writeStreaming(m,E,{signal:w.signal,onProgress:(k,C)=>{var I;_.update(k,C||M),(I=e.onProgress)==null||I.call(e,k,C||M)}});_.close(),!R.aborted&&x==="blob"&&((h=e.onAfter)==null||h.call(e,new Blob(S,{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})))}catch(b){if(w.signal.aborted){_.close();return}_.fail(b instanceof Error?b.message:String(b)),(c=e.onError)==null||c.call(e,b),console.error("Excel 스트리밍 내보내기 실패",b)}}exportCsv(e){const s=typeof e=="string"?{filename:e}:e??{},i=this.$a.getData(),n=this.$a.getColLayout().visibleLeaves,r=n.map(h=>`"${h.header}"`).join(","),l=i.map(h=>n.map(c=>{const d=h[c.field]??"";if(s.maskOnExport&&c.mask&&this.$a.getMaskEnabled(c.field))return applyMask(String(d),c.mask);const f=d;return typeof f=="string"&&f.includes(",")?`"${f}"`:f}).join(",")),a=s.filename??"export.csv";_downloadText("\uFEFF"+[r,...l].join(`
|
|
47
|
+
`),a)}exportJson(e){const s=typeof e=="string"?e:(e==null?void 0:e.filename)??"export.json";_downloadText(JSON.stringify(this.$a.getData(),null,2),s,"application/json")}print(e){var s,i;const n=(e==null?void 0:e.title)??"OPEN_GRID",r=(e==null?void 0:e.footerText)??"",l=this.$a.getData(),a=this.$a.getColLayout().visibleLeaves.filter(w=>{var y;return!((y=e==null?void 0:e.excludeFields)!=null&&y.includes(w.field))}),h=a.map(w=>`<th>${w.header??w.field}</th>`).join(""),c=l.map(w=>`<tr>${a.map(y=>`<td>${String(w[y.field]??"")}</td>`).join("")}</tr>`).join(""),d=r?`<div class="og-print-footer">${r}</div>`:"",u=(((i=(s=this.$a).getMeta)==null?void 0:i.call(s))??{intlLocale:"ko-KR"}).intlLocale,p=this.$a.t?this.$a.t("export.printSummary",{rows:l.length,cols:a.length,date:new Date().toLocaleString(u)}):`${l.length}행 × ${a.length}열 · ${new Date().toLocaleString(u)}`,g=`<!DOCTYPE html>
|
|
48
|
+
<html lang="${u}"><head>
|
|
49
|
+
<meta charset="UTF-8"><title>${n}</title>
|
|
50
|
+
<style>
|
|
51
|
+
@page{margin:0;}
|
|
52
|
+
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:12px;margin:0;padding:1cm;}
|
|
53
|
+
h2{margin:0 0 10px;font-size:14px;color:#333;}
|
|
54
|
+
p{margin:0 0 8px;font-size:11px;color:#999;}
|
|
55
|
+
table{border-collapse:collapse;width:100%;}
|
|
56
|
+
th,td{border:1px solid #ccc;padding:5px 8px;text-align:left;white-space:nowrap;}
|
|
57
|
+
th{background:#f5f5f5;font-weight:600;color:#333;}
|
|
58
|
+
tr:nth-child(even) td{background:#fafafa;}
|
|
59
|
+
.og-print-footer{position:fixed;bottom:0;left:0;right:0;padding:6px 1cm;font-size:10px;color:#888;border-top:1px solid #e5e7eb;background:#fff;text-align:center;}
|
|
60
|
+
</style>
|
|
61
|
+
</head><body>
|
|
62
|
+
<h2>${n}</h2>
|
|
63
|
+
<p>${p}</p>
|
|
64
|
+
<table>
|
|
65
|
+
<thead><tr>${h}</tr></thead>
|
|
66
|
+
<tbody>${c}</tbody>
|
|
67
|
+
</table>
|
|
68
|
+
${d}
|
|
69
|
+
<script>window.addEventListener('load',()=>{window.print();window.addEventListener('afterprint',()=>window.close());});<\/script>
|
|
70
|
+
</body></html>`,m=window.open("","_blank","width=960,height=640");m&&(m.document.write(g),m.document.close())}exportSheetsExcel(e){const s=this.$a.getWsManager();if(!s){this.exportExcel(e??"workbook");return}const i=e??"workbook.xlsx",n=(this.$a.getStrategy??((r,l)=>l))("cellSerializer",(r,l,a)=>typeof r=="boolean"?r?"✓":"":l.type==="number"&&typeof r=="number"?r:String(r));Promise.resolve().then(()=>require("./xlsx.min-CMvrM6b4.cjs")).then(r=>r.xlsx_min).then(({utils:r,writeFile:l})=>{const a=r.book_new(),h=this.$a.getOptions(),c=s.getActive();for(const d of s.getNames()){const f=s.get(d),u=f.columns.length?f.columns:h.columns,p=d===c?this.$a.getData():f.data,g=[u.map(w=>w.header)];for(const w of p)g.push(u.map(y=>{const v=w[y.field];return v==null?"":n(v,y,w)}));const m=r.aoa_to_sheet(g);m["!cols"]=u.map(w=>({wpx:w.width??100})),m["!rows"]=g.map((w,y)=>({hpx:y===0?22:19})),this.$hI(r,m,g,u,!0,"theme"),r.book_append_sheet(a,m,d)}l(a,i.endsWith(".xlsx")?i:i+".xlsx",{cellStyles:!0})}).catch(()=>console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."))}}const asStrings=o=>o.map(e=>String(e)),AGGREGATES=new Map([["SUM",o=>o.length>0?OGDecimal.sum(asStrings(o)):null],["AVG",o=>o.length>0?OGDecimal.sum(asStrings(o)).div(OGDecimal.from(String(o.length))):null],["MAX",o=>o.length>0?OGDecimal.max(asStrings(o)):null],["MIN",o=>o.length>0?OGDecimal.min(asStrings(o)):null]]),NO_STRATEGY=(o,e)=>e;let ERR_MAX_LEN=0;const ERR_FIRST=new Set;for(const o of FORMULA_ERROR_CODES)o.length>ERR_MAX_LEN&&(ERR_MAX_LEN=o.length),ERR_FIRST.add(o.charCodeAt(0));const isErrorCell=o=>typeof o=="string"&&o.length<=ERR_MAX_LEN&&ERR_FIRST.has(o.charCodeAt(0))&&FORMULA_ERROR_CODES.has(o);function collect(o,e){const s=[];for(let i=0;i<o.length;i++){const n=o[i][e];n==null||n===""||isErrorCell(n)||s.push(n)}return s}class FooterValues{constructor(e){this.$kE=(e==null?void 0:e.getStrategy)??NO_STRATEGY}compute(e,s){if(!e||e.length===0)return[];const i=s.rows(),n=e.filter(h=>h.field&&h.op),r=new Map;for(const h of n)r.set(h.field,(r.get(h.field)??0)+1);const l=new Map,a=h=>{let c=l.get(h);return c||(c=collect(i,h),l.set(h,c)),r.get(h)>1?c.slice():c};return n.map(h=>this.$lv(h,a))}format(e,s){if(!s)return Math.round(e).toLocaleString("ko-KR");const i=s.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/),n=i?s.slice(0,i.index):"",r=i?s.slice(i.index+i[0].length):"",l=i?i[0]:s,a=l.includes("#")||l.includes(","),h=l.match(/\.(\d+)$/),c=h?parseInt(h[1],10):/^\d+$/.test(l)?parseInt(l,10):0,d=Math.abs(e).toFixed(c),[f="0",u]=d.split("."),p=a?f.replace(/\B(?=(\d{3})+(?!\d))/g,","):f,g=u!==void 0?`${p}.${u}`:p,m=`${n}${g}${r}`;return e<0?`-${m}`:m}$lv(e,s){const i=e.field,n=e.op,r=s(i),l=n.toUpperCase(),a=this.$kE("summaryOp",null);if(a){const f=a(l,r,i);if(f!=null)return{_field:i,_value:f,_formatted:this.format(f,e.format)}}if(l==="COUNT"){const f=r.length;return{_field:i,_value:f,_formatted:f.toLocaleString("ko-KR")}}const h=AGGREGATES.get(l),c=h?h(r):null;if(!c)return{_field:i,_value:null,_formatted:""};const d=c.toNumber();return{_field:i,_value:d,_formatted:this.format(d,e.format)}}}const MISSING_WIDTH=100;class FooterView{constructor(e){this.$u=null,this.$fX=null,this.$p=[],this.$fE=[],this.$iK=-1,this.$iQ=void 0,this.$eZ=void 0,this.$t=null,this.$V=0,this.$aX=null,this.$a=e,this.$aJ=e.follower??null}setFollower(e){var s;this.$u&&((s=this.$aJ)==null||s.unfollow(this.$u)),this.$aJ=e,this.$u&&(e==null||e.follow(this.$u))}setEndGutter(e){var s;const i=e>0?e:0;if(i===this.$V)return;this.$V=i;const n=this.$u;if(n){if(i===0){(s=this.$aX)==null||s.remove(),this.$aX=null;return}if(!this.$aX){this.$aX=this.$jq(i),n.appendChild(this.$aX);return}this.$aX.style.width=`${i}px`}}$jq(e){const s=document.createElement("div");return s.className="og-footer-gutter",s.style.cssText=`width:${e}px;flex-shrink:0;`,s}setApplier(e){var s;(s=this.$t)==null||s.release("footer"),this.$t=e,this.$u&&this.paint()}paint(){var e,s,i;const n=this.$a.container(),r=n.querySelector(".og-footer-bar");r==null||r.remove(),this.$kb();const l=this.$a.options(),a=l.footer;if(!a||a.length===0)return;const h=this.$a.leaves(),c=this.$a.geometry(),d=this.$a.widths(),f=new Map(this.$a.values().map(b=>[b._field,b])),u=document.createElement("div");u.className="og-footer-bar",u.style.cssText=["display:flex;align-items:stretch;",`min-height:${l.footerHeight}px;`,"border-top:2px solid var(--og-primary,#1976d2);","background:var(--og-header-bg,#f5f5f5);","overflow:hidden;flex-shrink:0;font-size:13px;font-weight:600;"].join("");const p=c.extra.width();if(p>0){const b=document.createElement("div");b.style.cssText=`width:${p}px;flex-shrink:0;border-right:1px solid var(--og-border-color,#e0e0e0);`,u.appendChild(b)}let g=0,m=p,w=!0;const y=[],v=[];for(const b of a){const E=Math.max(1,b.colspan??1);let x=0,S=!0;for(let L=0;L<E;L++)x+=this.$nv(g+L,c,d,h),S=S&&this.$lV(g+L,c,d);const M=g;w=w&&S;const R=h[g];g+=E,m+=x;const k=document.createElement("div");k.style.cssText=[`width:${x}px;min-width:${x}px;flex-shrink:0;`,"padding:4px 8px;box-sizing:border-box;overflow:hidden;","border-right:1px solid var(--og-border-color,#e0e0e0);","white-space:nowrap;text-overflow:ellipsis;"].join("");const C=b.field,I=C?f.get(C):null;I?(this.$kU(k,b,I),k.style.color="var(--og-primary,#1976d2)",k.style.textAlign=b.align??((R==null?void 0:R.type)==="number","right")):b.label&&(k.textContent=b.label,k.style.textAlign=b.align??"left",k.style.color="var(--og-row-color,#212121)"),u.appendChild(k),S&&((e=this.$t)==null||e.trackSpan(k,M,E,"wm","footer")),y.push(k),v.push(!!I)}const _=c.totalWidth()-m;if(_>0){const b=document.createElement("div");b.className="og-footer-fill",b.style.cssText=`width:${_}px;flex-shrink:0;`,u.appendChild(b),w&&g<c.count&&((s=this.$t)==null||s.trackGap(b,g,c.count-1,"footer"))}this.$aX=this.$V>0?this.$jq(this.$V):null,this.$aX&&u.appendChild(this.$aX),l.footerPosition==="top"?n.insertBefore(u,n.firstChild):n.appendChild(u),this.$u=u,this.$fX=a,this.$p=y,this.$fE=v,this.$iK=c.version,this.$iQ=l.footerHeight,this.$eZ=l.footerPosition,(i=this.$aJ)==null||i.follow(u)}updateValues(){const e=this.$u,s=this.$fX,i=this.$a.options();if(!e||e.parentNode!==this.$a.container()||!s||i.footer!==s||i.footerHeight!==this.$iQ||i.footerPosition!==this.$eZ||this.$a.geometry().version!==this.$iK){this.paint();return}const n=new Map(this.$a.values().map(r=>[r._field,r]));for(let r=0;r<s.length;r++){const l=s[r].field;if(!!(l&&n.get(l))!==this.$fE[r]){this.paint();return}}for(let r=0;r<s.length;r++){if(!this.$fE[r])continue;const l=s[r];this.$kU(this.$p[r],l,n.get(l.field))}}$kU(e,s,i){var n;const r=i._formatted??String(i._value??""),l=s.label?`${s.label}: `:"";e.textContent=l+r,e.title=`${((n=s.op)==null?void 0:n.toUpperCase())??""} = ${r}`}destroy(){this.$kb()}$lV(e,s,i){return i!=null&&i[e]!=null&&e<s.count}$nv(e,s,i,n){var r;if(i==null)return((r=n[e])==null?void 0:r.width)??MISSING_WIDTH;const l=i[e];return l==null?MISSING_WIDTH:e<s.count?s.widthOf(e):l}$kb(){var e,s;(e=this.$t)==null||e.release("footer"),this.$u&&((s=this.$aJ)==null||s.unfollow(this.$u),this.$u=null,this.$fX=null,this.$p=[],this.$fE=[])}}class FooterManager{constructor(e){this.$a=e,this.$ah=new FooterValues({getStrategy:(s,i)=>(this.$a.getStrategy??((n,r)=>r))(s,i)}),this.$q={rows:()=>this.$a.getData()},this.$bJ=new FooterView({container:()=>this.$a.getContainer(),options:()=>this.$a.getOptions(),leaves:()=>this.$a.getColLayout().visibleLeaves,geometry:()=>this.$a.getGeometry(),widths:()=>this.$a.getColWidths(),values:()=>this.computeValues()})}fmtNum(e,s){return this.$ah.format(e,s)}computeValues(){return this.$ah.compute(this.$a.getOptions().footer,this.$q)}render(){this.$bJ.paint()}paint(){this.$bJ.paint()}updateValues(){this.$bJ.updateValues()}setFollower(e){this.$bJ.setFollower(e)}setApplier(e){this.$bJ.setApplier(e)}setEndGutter(e){this.$bJ.setEndGutter(e)}destroy(){this.$bJ.destroy()}}const FOCUS_RANGE_REPAINT=RenderRequest.of(Change.Focus|Change.Range,{sync:!0});class KeyboardManager{constructor(e){this.$a=e}handleKeyDown(e){var s,i,n,r,l;const a=this.$a.getEditMgr();if(a.activeEditor)return;this.$a.handleCellKeyEvt("cellKeyDown",e);const h=this.$a.getData(),c=this.$a.getColLayout(),d=h.rowCount,f=c.visibleLeaves.length;if(d===0||f===0)return;if((e.ctrlKey||e.metaKey)&&e.key==="c"){e.preventDefault(),this.$lw();return}if((e.ctrlKey||e.metaKey)&&e.key==="v"){e.preventDefault(),this.$mJ();return}const u=((i=(s=this.$a).getRangeHooks)==null?void 0:i.call(s))??null;if((e.ctrlKey||e.metaKey)&&(u!=null&&u.isEnabled())&&(e.key==="d"||e.key==="D")){e.preventDefault(),u.ctrlFill("down");return}if((e.ctrlKey||e.metaKey)&&(u!=null&&u.isEnabled())&&(e.key==="r"||e.key==="R")){e.preventDefault(),u.ctrlFill("right");return}if(e.shiftKey&&(u!=null&&u.isEnabled())&&(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")){e.preventDefault();const g=e.key==="ArrowDown"?"down":e.key==="ArrowUp"?"up":e.key==="ArrowLeft"?"left":"right";u.extendFocus(g);return}const p=this.$a.getOptions();if((e.ctrlKey||e.metaKey)&&p.draggable&&a.focusCell){if(e.key==="ArrowDown"){e.preventDefault();const g=a.focusCell.ci!==void 0?a.focusCell.ri:0;g<d-1&&(this.$a.handleRowDrop(g,g+1),this.$a.setFocusCell(g+1,a.focusCell.ci),this.$a.announce(this.$a.t("row.moveAnnounce",{from:g+1,to:g+2})));return}if(e.key==="ArrowUp"){e.preventDefault();const g=a.focusCell.ri;g>0&&(this.$a.handleRowDrop(g,g-1),this.$a.setFocusCell(g-1,a.focusCell.ci),this.$a.announce(this.$a.t("row.moveAnnounce",{from:g+1,to:g})));return}}switch(e.key){case"ArrowDown":{e.preventDefault();const g=a.focusCell,m=g?Math.min(g.ri+1,d-1):0;this.$a.setFocusCell(m,(g==null?void 0:g.ci)??0);break}case"ArrowUp":{e.preventDefault();const g=a.focusCell,m=g?Math.max(g.ri-1,0):0;this.$a.setFocusCell(m,(g==null?void 0:g.ci)??0);break}case"ArrowRight":{e.preventDefault();const g=a.focusCell;if(!g){this.$a.setFocusCell(0,0);break}g.ci<f-1?this.$a.setFocusCell(g.ri,g.ci+1):g.ri<d-1&&this.$a.setFocusCell(g.ri+1,0);break}case"ArrowLeft":{e.preventDefault();const g=a.focusCell;if(!g){this.$a.setFocusCell(0,0);break}g.ci>0?this.$a.setFocusCell(g.ri,g.ci-1):g.ri>0&&this.$a.setFocusCell(g.ri-1,f-1);break}case"Tab":{e.preventDefault();const g=a.focusCell;if(!g){this.$a.setFocusCell(0,0);break}e.shiftKey?g.ci>0?this.$a.setFocusCell(g.ri,g.ci-1):g.ri>0&&this.$a.setFocusCell(g.ri-1,f-1):g.ci<f-1?this.$a.setFocusCell(g.ri,g.ci+1):g.ri<d-1&&this.$a.setFocusCell(g.ri+1,0);break}case"Home":{if(e.preventDefault(),e.ctrlKey||e.metaKey)this.$a.setFocusCell(0,0);else{const g=a.focusCell;this.$a.setFocusCell((g==null?void 0:g.ri)??0,0)}break}case"End":{if(e.preventDefault(),e.ctrlKey||e.metaKey)this.$a.setFocusCell(d-1,f-1);else{const g=a.focusCell;this.$a.setFocusCell((g==null?void 0:g.ri)??0,f-1)}break}case"PageDown":{e.preventDefault();const g=a.focusCell,m=this.$a.getOptions().pageSize??10,w=Math.min(g?g.ri+m:m-1,d-1);this.$a.setFocusCell(w,(g==null?void 0:g.ci)??0);break}case"PageUp":{e.preventDefault();const g=a.focusCell,m=this.$a.getOptions().pageSize??10,w=g?Math.max(g.ri-m,0):0;this.$a.setFocusCell(w,(g==null?void 0:g.ci)??0);break}case" ":{if(a.focusCell){e.preventDefault();const g=a.focusCell.ri,m=this.$a.getRowMgr();this.$a.getOptions().checkColumn?(m.check(g,!m.checkedRows.has(g)),this.$a.submitRender(RenderRequest.ROW_STATE)):(m.selectToggle(g),this.$a.submitRender(RenderRequest.ROW_STATE))}break}case"F2":case"Enter":{a.focusCell&&this.$a.getOptions().editable&&(e.preventDefault(),a.startEditByKey(a.focusCell.ri,a.focusCell.ci));break}case"Escape":{(l=(r=(n=this.$a).getRangeHooks)==null?void 0:r.call(n))==null||l.clear(),a.clearFocusCell(),this.$a.submitRender(FOCUS_RANGE_REPAINT);break}}}$lw(){var e,s,i,n;if(!this.$a.getOptions().clipboard)return;const l=(s=(e=this.$a).getRangeHooks)==null?void 0:s.call(e);if(l!=null&&l.isEnabled()&&l.hasSelection()){const f=l.copyText();if(f!=null){(i=navigator.clipboard)==null||i.writeText(f).catch(()=>{});return}}const a=this.$a.getEditMgr(),h=this.$a.getColLayout(),c=this.$a.getData();let d="";if(a.focusCell){const{ri:f,ci:u}=a.focusCell,p=h.visibleLeaves[u];p&&(d=String(c.getCellValue(f,p.field)??""))}else if(this.$a.getRowMgr().selectedRows.size>0){const f=h.visibleLeaves;d=[...this.$a.getRowMgr().selectedRows].sort((p,g)=>p-g).map(p=>{const g=c.getRowByIndex(p);return f.map(m=>String((g==null?void 0:g[m.field])??"")).join(" ")}).join(`
|
|
71
|
+
`)}d&&((n=navigator.clipboard)==null||n.writeText(d).catch(()=>{}))}$mJ(){var e,s,i;const n=this.$a.getOptions();if(!n.clipboard||!n.editable)return;const r=this.$a.getEditMgr(),l=(s=(e=this.$a).getRangeHooks)==null?void 0:s.call(e);(i=navigator.clipboard)==null||i.readText().then(a=>{var h,c;if(!a||l!=null&&l.isEnabled()&&l.hasSelection()&&l.pasteText(a)||!r.focusCell)return;const{ri:d,ci:f}=r.focusCell,u=a.split(`
|
|
72
|
+
`),p=this.$a.getColLayout().visibleLeaves,g=this.$a.getData(),m=[];for(let w=0;w<u.length;w++){const y=u[w].split(" ");for(let v=0;v<y.length;v++){const _=d+w,b=f+v,E=p[b];E&&_<g.rowCount&&m.push({rowIndex:_,field:E.field,value:y[v]})}}m.length&&((c=(h=this.$a).writeCells)==null||c.call(h,m))}).catch(()=>{})}}class SortFilterManager{constructor(e){this.$r=[],this.$bn={},this.$a=e}get sortList(){return this.$r}get filters(){return this.$bn}handleSortClick(e,s){var i,n;const r=this.$a.getOptions();if(!r.sortable)return;const l=this.$r.findIndex(c=>c.field===e);if(l>=0){const c=this.$r[l];c.dir==="asc"?c.dir="desc":this.$r.splice(l,1)}else(!s||!r.multiSort)&&(this.$r=[]),this.$r.push({field:e,dir:"asc"});this.$a.getData().applySort(this.$r),(n=(i=this.$a).onReproject)==null||n.call(i),this.$hp(),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE);const a=this.$r.find(c=>c.field===e),h=this.$a.t(a?a.dir==="asc"?"sort.asc":"sort.desc":"sort.none");this.$a.announce(this.$a.t("sort.announce",{field:e,dir:h})),this.$gb(e)}sort(e,s="asc"){var i,n,r;if(Array.isArray(e))this.$r=e;else{const l=this.$r.findIndex(a=>a.field===e);l>=0?this.$r[l].dir=s:this.$r=[{field:e,dir:s}],this.$a.getOptions().multiSort||(this.$r=this.$r.slice(-1))}this.$a.getData().applySort(this.$r),(n=(i=this.$a).onReproject)==null||n.call(i),this.$hp(),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE),this.$gb(Array.isArray(e)?(r=e[0])==null?void 0:r.field:e)}$gb(e){const s={sortList:this.$r};if(e!=null){s.field=e;const i=this.$r.find(n=>n.field===e);i&&(s.dir=i.dir)}this.$a.emit("sortChange",s)}$hp(){const e=this.$a.sortIndicator;e?e.update(this.$r):this.$a.renderHeader()}resetSort(){var e,s;const i=this.$r.length>0;this.$r=[],this.$a.getData().applySort([]),(s=(e=this.$a).onReproject)==null||s.call(e),this.$hp(),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE),i&&this.$gb(void 0)}initSort(e){var s,i;this.$r=[...e],this.$a.getData().applySort(this.$r),(i=(s=this.$a).onReproject)==null||i.call(s)}getSortState(){return[...this.$r]}setFilter(e,s){this.$bn[e]=s,this.applyFilters(),this.$a.renderHeader(),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE),this.$a.emit("filterChange",{field:e,filterItems:s,allFilters:this.$bn})}resetFilter(e){e?delete this.$bn[e]:this.$bn={},this.applyFilters(),this.$a.renderHeader(),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE)}getFilterState(){return{...this.$bn}}restoreFilter(e){this.$bn={...e},this.applyFilters()}applyFilters(){var e,s,i,n;const r=this.$a.getData();r.setFindFilter(this.$a.getFindFilter(),this.$a.getColLayout().visibleLeaves.map(a=>a.field)),r.applyFilter(this.$bn),(s=(e=this.$a).onReproject)==null||s.call(e);const l=r.rowCount;(i=this.$a.getVs())==null||i.setTotalRows(l),(n=this.$a.getPagination())==null||n.setTotalRows(l)}}class FindBarManager{constructor(e){this.$u=null,this.$bT=null,this.$bO=null,this.$gA=null,this.$fS=null,this.$cy="",this.$a=e}get findFilter(){return this.$cy}init(e){const s=document.createElement("div");s.className="og-find-bar",s.hidden=!0;const i=document.createElement("span");i.className="og-find-label",i.textContent=this.$a.t("findBar.label");const n=document.createElement("input");n.type="text",n.className="og-find-input",n.placeholder=this.$a.t("findBar.placeholder"),n.setAttribute("aria-label",this.$a.t("findBar.searchAria"));const r=document.createElement("span");r.className="og-find-count";const l=document.createElement("button");l.className="og-find-close",l.textContent="✕",l.setAttribute("aria-label",this.$a.t("findBar.closeAria")),s.appendChild(i),s.appendChild(n),s.appendChild(r),s.appendChild(l),e.insertBefore(s,e.firstChild),n.addEventListener("input",()=>{this.$cy=n.value.trim(),this.$ej()}),n.addEventListener("keydown",a=>{a.key==="Escape"&&this.close()}),l.addEventListener("click",()=>this.close()),this.$u=s,this.$bT=n,this.$bO=r,this.$gA=i,this.$fS=l}refreshLabels(){this.$gA&&(this.$gA.textContent=this.$a.t("findBar.label")),this.$bT&&(this.$bT.placeholder=this.$a.t("findBar.placeholder"),this.$bT.setAttribute("aria-label",this.$a.t("findBar.searchAria"))),this.$fS&&this.$fS.setAttribute("aria-label",this.$a.t("findBar.closeAria")),this.$bO&&this.$cy&&(this.$bO.textContent=this.$a.t("findBar.countBadge",{n:this.$a.getData().rowCount}))}open(){this.$u&&(this.$u.hidden=!1,this.$bT.focus(),this.$bT.select())}close(){this.$u&&(this.$u.hidden=!0,this.$cy="",this.$bT.value="",this.$bO&&(this.$bO.textContent=""),this.$ej())}$ej(){var e,s;const i=this.$a.getData(),n=this.$a.getColLayout().visibleLeaves.map(l=>l.field);i.setFindFilter(this.$cy,n),i.applyFilter(this.$a.getFilters());const r=i.rowCount;(e=this.$a.getVs())==null||e.setTotalRows(r),(s=this.$a.getPagination())==null||s.setTotalRows(r),this.$bO&&(this.$bO.textContent=this.$cy?this.$a.t("findBar.countBadge",{n:r}):""),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE)}}class CellEventHandler{constructor(e){this.$a=e}handleCellClick(e,s,i){var n,r,l,a,h,c;const d=this.$a.getOptions(),f=this.$a.getRowMgr(),u=this.$a.getEditMgr();d.selection==="single"||d.selection==="row"?f.selectSingle(e):d.selection==="multiple"?i.ctrlKey||i.metaKey?f.selectToggle(e):f.selectSingle(e):d.selection==="cells"&&s>=0&&((r=(n=this.$a).onCellsClick)==null||r.call(n,e,s,i.shiftKey));const p=this.$a.getData().getRowByIndex(e),g=this.$a.getColLayout().visibleLeaves[s];if(p&&g){u.setFocusCell(e,s);const m=g.editable!==!1&&(g.editable!==void 0||d.editable);if(isToggleCol(g)&&m){const E=p[g.field];this.$a.writeCell(e,g.field,!E)}if(g.type==="radio"){const E=g.group;for(const x of this.$a.getColLayout().visibleLeaves)x.type==="radio"&&x.field!==g.field&&(!E||x.group===E)&&this.$a.getData().updateCell(e,x.field,!1);this.$a.writeCell(e,g.field,!0)}let w=p[g.field];if(w===void 0&&g.formula)try{const E=g.formulaPrecision??30,x=evaluateFormula(g.formula,p,E);w=x instanceof OGDecimal?g.precision!=null?x.toFixed(g.precision):x.toString():String(x)}catch{}const y={type:"cellClick",rowIndex:e,columnIndex:s,field:g.field,value:w,row:p,column:g,target:i.target,originalEvent:i};this.$a.emit("cellClick",y);const v={type:"rowClick",rowIndex:e,row:p,target:i.target,originalEvent:i};this.$a.emit("rowClick",v);const _=g.type==="select";!(u.activeEditor!=null&&((l=u.editCell)==null?void 0:l.ri)===e&&((a=u.editCell)==null?void 0:a.ci)===s)&&(d.editMode==="click"||_)&&!isToggleCol(g)&&u.startEdit(e,s,i)}u.activeEditor&&((h=u.editCell)==null?void 0:h.ri)===e&&((c=u.editCell)==null?void 0:c.ci)===s||d.selection!=="cells"&&(this.$a.submitRender(RenderRequest.ROW_STATE),this.$a.emit("selectionChange",{rows:f.getSelections(),rowIndexes:[...f.selectedRows],cells:[]}))}handleCellDblClick(e,s,i){const n=this.$a.getData().getRowByIndex(e),r=this.$a.getColLayout().visibleLeaves[s];if(!n||!r)return;const l=this.$a.getOptions(),a={type:"cellDblClick",rowIndex:e,columnIndex:s,field:r.field,value:n[r.field],row:n,column:r,target:i.target,originalEvent:i};this.$a.emit("cellDblClick",a);const h={type:"rowDblClick",rowIndex:e,row:n,target:i.target,originalEvent:i};this.$a.emit("rowDblClick",h),l.editMode==="dblclick"&&this.$a.getEditMgr().startEdit(e,s,i)}handleCellMouseOver(e,s,i){const n=this.$a.getData().getRowByIndex(e),r=this.$a.getColLayout().visibleLeaves[s];if(!n||!r)return;const l={type:"cellMouseOver",rowIndex:e,columnIndex:s,field:r.field,value:n[r.field],row:n,column:r,target:i.target,originalEvent:i};this.$a.emit("cellMouseOver",l);const a={type:"rowMouseOver",rowIndex:e,row:n,target:i.target,originalEvent:i};this.$a.emit("rowMouseOver",a)}handleCellMouseOut(e,s,i){const n=this.$a.getData().getRowByIndex(e),r=this.$a.getColLayout().visibleLeaves[s];if(!n||!r)return;const l={type:"cellMouseOut",rowIndex:e,columnIndex:s,field:r.field,value:n[r.field],row:n,column:r,target:i.target,originalEvent:i};this.$a.emit("cellMouseOut",l);const a={type:"rowMouseOut",rowIndex:e,row:n,target:i.target,originalEvent:i};this.$a.emit("rowMouseOut",a)}handleCellMouseDown(e,s,i){var n,r;(r=(n=this.$a).rangeMouseDown)==null||r.call(n,e,s,i);const l=this.$a.getData().getRowByIndex(e),a=this.$a.getColLayout().visibleLeaves[s];if(!l||!a)return;const h={type:"cellMouseDown",rowIndex:e,columnIndex:s,field:a.field,value:l[a.field],row:l,column:a,target:i.target,originalEvent:i};this.$a.emit("cellMouseDown",h);const c={type:"rowMouseDown",rowIndex:e,row:l,target:i.target,originalEvent:i};this.$a.emit("rowMouseDown",c)}handleCellMouseUp(e,s,i){var n,r;(r=(n=this.$a).rangeMouseUp)==null||r.call(n,e,s,i);const l=this.$a.getData().getRowByIndex(e),a=this.$a.getColLayout().visibleLeaves[s];if(!l||!a)return;const h={type:"cellMouseUp",rowIndex:e,columnIndex:s,field:a.field,value:l[a.field],row:l,column:a,target:i.target,originalEvent:i};this.$a.emit("cellMouseUp",h);const c={type:"rowMouseUp",rowIndex:e,row:l,target:i.target,originalEvent:i};this.$a.emit("rowMouseUp",c)}handleCellMouseMove(e,s,i){var n,r;(r=(n=this.$a).rangeMouseMove)==null||r.call(n,e,s,i);const l=this.$a.getData().getRowByIndex(e),a=this.$a.getColLayout().visibleLeaves[s];if(!l||!a)return;const h={type:"cellMouseMove",rowIndex:e,columnIndex:s,field:a.field,value:l[a.field],row:l,column:a,target:i.target,originalEvent:i};this.$a.emit("cellMouseMove",h);const c={type:"rowMouseMove",rowIndex:e,row:l,target:i.target,originalEvent:i};this.$a.emit("rowMouseMove",c)}handleCellKeyEvt(e,s){const i=this.$a.getEditMgr();if(!i.focusCell||i.activeEditor)return;const{ri:n,ci:r}=i.focusCell,l=this.$a.getData().getRowByIndex(n),a=this.$a.getColLayout().visibleLeaves[r];if(!l||!a)return;const h={type:e,rowIndex:n,columnIndex:r,field:a.field,value:l[a.field],row:l,column:a,key:s.key,target:this.$a.getContainer(),originalEvent:s};this.$a.emit(e,h)}}function normalize(o,e){return{startRow:Math.min(o.ri,e.ri),endRow:Math.max(o.ri,e.ri),startCol:Math.min(o.ci,e.ci),endCol:Math.max(o.ci,e.ci)}}class RangeModel{constructor(e){this.$aU={ri:0,ci:0},this.$aw={ri:0,ci:0},this.$aL={rowIds:[],fields:[]},this.$aO=[],this.$ax=!1,this.$de=!1,this.$m=e}get hasSelection(){return this.$ax}getAnchor(){return{...this.$aU}}getFocus(){return{...this.$aw}}getIdentity(){return{rowIds:[...this.$aL.rowIds],fields:[...this.$aL.fields]}}getRangeSelection(){return this.$aO.map(e=>({...e}))}getActiveRange(){return this.$aO[0]?{...this.$aO[0]}:null}getPrimaryRect(){return this.getActiveRange()}getProjectedFlatRows(){return this.$aL.rowIds.map(e=>this.$m.flatIndexOfRowId(e)).filter(e=>e>=0).sort((e,s)=>e-s)}beginDrag(e,s,i={}){i.shift&&this.$ax?this.$aw={ri:e,ci:s}:(this.$aU={ri:e,ci:s},this.$aw={ri:e,ci:s}),this.$ax=!0,this.$de=!!i.additive,this.$dX()}updateFocus(e,s){this.$ax&&(this.$aw={ri:e,ci:s},this.$dX())}endDrag(){this.$ax&&this.snapshotIdentity()}get additive(){return this.$de}click(e,s){this.$aU={ri:e,ci:s},this.$aw={ri:e,ci:s},this.$ax=!0,this.$dX(),this.snapshotIdentity()}shiftClickExtend(e,s){if(!this.$ax){this.click(e,s);return}this.$aw={ri:e,ci:s},this.$dX(),this.snapshotIdentity()}extendFocus(e){if(!this.$ax)return;const s=Math.max(0,this.$m.count()-1),i=Math.max(0,this.$m.visibleFields().length-1);let{ri:n,ci:r}=this.$aw;switch(e){case"up":n=Math.max(0,n-1);break;case"down":n=Math.min(s,n+1);break;case"left":r=Math.max(0,r-1);break;case"right":r=Math.min(i,r+1);break}this.$aw={ri:n,ci:r},this.$dX(),this.snapshotIdentity()}setRect(e){this.$aU={ri:e.startRow,ci:e.startCol},this.$aw={ri:e.endRow,ci:e.endCol},this.$ax=!0,this.$aO=[{...e}],this.snapshotIdentity()}clear(){this.$ax=!1,this.$aO=[],this.$aL={rowIds:[],fields:[]}}snapshotIdentity(){const e=this.$aO[0];if(!e){this.$aL={rowIds:[],fields:[]};return}const s=[];for(let r=e.startRow;r<=e.endRow;r++){const l=this.$m.rowIdOfFlat(r);l&&s.push(l)}const n=this.$m.visibleFields().slice(e.startCol,e.endCol+1);this.$aL={rowIds:s,fields:n}}reproject(){if(!this.$ax)return;if(this.$aL.rowIds.length===0||this.$aL.fields.length===0){this.$aO=[];return}const e=this.$aL.rowIds.map(h=>this.$m.flatIndexOfRowId(h)).filter(h=>h>=0),s=this.$m.visibleFields(),i=this.$aL.fields.map(h=>s.indexOf(h)).filter(h=>h>=0);if(e.length===0||i.length===0){this.$aO=[];return}const n=Math.min(...e),r=Math.max(...e),l=Math.min(...i),a=Math.max(...i);this.$aO=[{startRow:n,endRow:r,startCol:l,endCol:a}],this.$aU={ri:n,ci:l},this.$aw={ri:r,ci:a}}$dX(){this.$aO=[normalize(this.$aU,this.$aw)]}}const NUMERIC_RE=/^-?\d+(\.\d+)?$/,TEXT_SUFFIX_RE=/^(.*?)(\d+)$/;function tryParseDecimal(o){const e=String(o??"").trim();if(e===""||!NUMERIC_RE.test(e))return null;try{return OGDecimal.from(e)}catch{return null}}function detectSeries(o){const e=o.length;if(e===0)return{kind:"copy"};const s=o.map(tryParseDecimal);if(s.every(i=>i!==null)){if(e===1)return{kind:"copy"};const i=s,n=i.slice(1).map((l,a)=>l.sub(i[a]));return n.every(l=>l.eq(n[0]))?{kind:"arith",step:n[0],values:i}:{kind:"copy"}}if(e>=2){const i=o.map(n=>TEXT_SUFFIX_RE.exec(String(n??"")));if(i.every(n=>n!==null)){const n=i.map(l=>l[1]);if(n.every(l=>l===n[0])){const l=i.map(c=>OGDecimal.from(c[2])),a=l.slice(1).map((c,d)=>c.sub(l[d]));if(a.every(c=>c.eq(a[0])))return{kind:"text-suffix",step:a[0],values:l,prefix:n[0]}}}}return{kind:"copy"}}function copyTileIndex(o,e,s){return s<=0?0:o==="down"||o==="right"?(e-1)%s:(s-e%s)%s}function extrapolateValue(o,e,s,i){const n=e.length;if(o.kind==="copy"||!o.values||!o.step)return e[copyTileIndex(s,i,n)];const r=s==="down"||s==="right",l=r?o.values[o.values.length-1]:o.values[0],a=r?o.step:o.step.neg(),h=l.add(a.mul(i));return o.kind==="text-suffix"?`${o.prefix}${h.toNumber()}`:h.toNumber()}function range(o,e){const s=[];for(let i=o;i<=e;i++)s.push(i);return s}function planValueOrSkip(o,e,s,i,n){var r;const l=o.resolveFlatRow(e);return l.kind!=="data"||!l.rowId?{rowIndex:e,field:s,action:"skip",reason:"non-data-row"}:o.isEditable&&!o.isEditable(l.rowId,s)?{rowIndex:e,field:s,action:"skip",reason:"not-editable"}:!!((r=o.hasCellFormula)!=null&&r.call(o,l.rowId,s))&&!o.overwriteFormula?(n(),{rowIndex:e,field:s,action:"skip",reason:"formula-preserved"}):{rowIndex:e,field:s,action:"value",value:i}}function planCopyCell(o,e,s,i,n,r,l,a){var h,c;const d=o.resolveFlatRow(e);if(d.kind!=="data"||!d.rowId)return{rowIndex:e,field:i,action:"skip",reason:"non-data-row"};if(o.isEditable&&!o.isEditable(d.rowId,i))return{rowIndex:e,field:i,action:"skip",reason:"not-editable"};const f=o.resolveFlatRow(n),u=!!(f.rowId&&((h=o.hasCellFormula)!=null&&h.call(o,f.rowId,l)));if(u&&f.rowId){if(o.forceCopyFormula){const m=o.getCellValue(n,l);return{rowIndex:e,field:i,action:"setFormula",formula:String(m)}}if(o.offsetFormula){const m=o.offsetFormula(f.rowId,l,e-n,s-r);return{rowIndex:e,field:i,action:"setFormula",formula:m}}}const p=!!((c=o.hasCellFormula)!=null&&c.call(o,d.rowId,i));if(!u&&p&&!o.overwriteFormula)return a(),{rowIndex:e,field:i,action:"skip",reason:"formula-preserved"};const g=o.getCellValue(n,l);return{rowIndex:e,field:i,action:"value",value:g}}function buildFillPlan(o,e,s,i,n){const r=s==="up"||s==="down",l=[];let a=0;const h=()=>{a++},c=r?range(o.startCol,o.endCol):range(o.startRow,o.endRow);for(const d of c){const f=r?n.fieldAt(d):void 0,u=r?range(o.startRow,o.endRow).map(y=>({ri:y,ci:d})):range(o.startCol,o.endCol).map(y=>({ri:d,ci:y})),p=u.map(y=>{const v=r?f:n.fieldAt(y.ci);return v?n.getCellValue(y.ri,v):void 0}),g=i==="series"?detectSeries(p):{kind:"copy"},m=r?range(e.startRow,e.endRow):range(e.startCol,e.endCol);(s==="down"||s==="right"?m:[...m].reverse()).forEach((y,v)=>{const _=v+1,b=r?y:d,E=r?d:y,x=r?f:n.fieldAt(y);if(!x)return;if(g.kind!=="copy"){const k=extrapolateValue(g,p,s,_);l.push(planValueOrSkip(n,b,x,k,h));return}const S=copyTileIndex(s,_,u.length),M=u[S],R=r?f:n.fieldAt(M.ci);R&&l.push(planCopyCell(n,b,E,x,M.ri,M.ci,R,h))})}return{items:l,skippedFormula:a}}function ctrlFillSourceTarget(o,e){return e==="down"?o.endRow<=o.startRow?null:{source:{startRow:o.startRow,endRow:o.startRow,startCol:o.startCol,endCol:o.endCol},target:{startRow:o.startRow+1,endRow:o.endRow,startCol:o.startCol,endCol:o.endCol}}:o.endCol<=o.startCol?null:{source:{startRow:o.startRow,endRow:o.endRow,startCol:o.startCol,endCol:o.startCol},target:{startRow:o.startRow,endRow:o.endRow,startCol:o.startCol+1,endCol:o.endCol}}}function rangeToTSV(o,e){const s=[];for(let i=o.startRow;i<=o.endRow;i++){const n=[];for(let r=o.startCol;r<=o.endCol;r++){const l=e.fieldAt(r);if(!l){n.push("");continue}const a=e.getDisplayText?e.getDisplayText(i,l):String(e.getCellValue(i,l)??"");n.push(a)}s.push(n.join(" "))}return s.join(`
|
|
73
|
+
`)}function parseTSV(o){return o===""?[[""]]:o.split(`
|
|
74
|
+
`).map(e=>e.split(" "))}function buildPastePlan(o,e,s){var i;const n=o.length,r=n>0?Math.max(...o.map(f=>f.length)):0;if(n===0||r===0)return[];const l=e.endRow-e.startRow+1,a=e.endCol-e.startCol+1,h=Math.max(l,n),c=Math.max(a,r),d=[];for(let f=0;f<h;f++)for(let u=0;u<c;u++){const p=e.startRow+f,g=e.startCol+u,m=s.fieldAt(g);if(!m)continue;const w=s.resolveFlatRow(p);if(w.kind!=="data"||!w.rowId){d.push({rowIndex:p,field:m,action:"skip",reason:"non-data-row"});continue}if(s.isEditable&&!s.isEditable(w.rowId,m)){d.push({rowIndex:p,field:m,action:"skip",reason:"not-editable"});continue}const y=((i=o[f%n])==null?void 0:i[u%r])??"";d.push({rowIndex:p,field:m,action:"value",value:y})}return d}function getRangeValues(o,e){const s=[];for(let i=o.startRow;i<=o.endRow;i++){const n=[];for(let r=o.startCol;r<=o.endCol;r++){const l=e.fieldAt(r);n.push(l?e.getCellValue(i,l):void 0)}s.push(n)}return s}function getRangeStats(o,e){const s=getRangeValues(o,e).flat(),i=[];for(const n of s){const r=String(n??"").trim();r===""||!/^-?\d+(\.\d+)?$/.test(r)||i.push(OGDecimal.from(r))}return i.length===0?null:{sum:OGDecimal.sum(i).toString(),avg:OGDecimal.avg(i).toString(),count:i.length,min:OGDecimal.min(i).toString(),max:OGDecimal.max(i).toString()}}const RANGE_REPAINT=RenderRequest.of(Change.Range,{sync:!0});class RangeSelectionManager{constructor(e){this.$eL=!1,this.$gg=null,this.$gh=null,this.$bm=null,this._handlePointerId=null,this.$cq=null,this.$fH=0,this.$fI=0,this.$jL=null,this.$el=null,this.$dS=null,this._handleEl=null,this.$jv=null,this.$a=e;const s={count:()=>this.$a.getFlatModel().count(),resolveFlatRow:i=>this.$a.getFlatModel().resolveFlatRow(i),flatIndexOfRowId:i=>this.$a.getFlatModel().flatIndexOfRowId(i),rowIdOfFlat:i=>this.$a.getFlatModel().rowIdOfFlat(i),visibleFields:()=>this.$a.getColLayout().visibleLeaves.map(i=>i.field)};this.$n=new RangeModel(s)}isEnabled(){var e;const s=this.$a.getOptions();return((e=s.rangeSelection)==null?void 0:e.enabled)??s.selection==="cells"}$fd(){const e=this.$a.getOptions().rangeSelection;return{fillHandle:(e==null?void 0:e.fillHandle)??!0,multiRange:(e==null?void 0:e.multiRange)??!1,autoScrollEdge:(e==null?void 0:e.autoScrollEdge)??24,seriesFill:(e==null?void 0:e.seriesFill)??!0,enabledInTreeGroup:(e==null?void 0:e.enabledInTreeGroup)??!1,fillOverwriteFormula:(e==null?void 0:e.fillOverwriteFormula)??!1}}$ip(){return this.$a.getEditMgr().activeEditor!=null}hasSelection(){return this.$n.hasSelection}getRangeSelection(){return this.$n.getRangeSelection()}getActiveRange(){return this.$n.getActiveRange()}getFillPreview(){return this.$bm}getRangeValues(){const e=this.getActiveRange();return e?getRangeValues(e,this.$jU()):[]}getRangeStats(){const e=this.getActiveRange();return e?getRangeStats(e,this.$jU()):null}$jU(){return{fieldAt:e=>{var s;return(s=this.$a.getColLayout().visibleLeaves[e])==null?void 0:s.field},getCellValue:(e,s)=>this.$a.getData().getCellValue(e,s)}}handleCellMouseDown(e,s,i){if(!this.isEnabled()||this.$ip()||e<0||s<0)return;this.$n.beginDrag(e,s,{additive:i.ctrlKey||i.metaKey,shift:i.shiftKey}),this.$eL=!0,this.$a.setFocusCell(e,s),this.$a.submitRender(RANGE_REPAINT);const n=()=>{document.removeEventListener("mouseup",n),this.handleCellMouseUp(-1,-1,i)};document.addEventListener("mouseup",n)}handleCellMouseMove(e,s,i){this.$eL&&(e>=0&&s>=0&&(this.$n.updateFocus(e,s),this.$a.submitRender(RANGE_REPAINT)),this.$mp(i))}handleCellMouseUp(e,s,i){this.$eL&&(this.$eL=!1,this.$kD(),this.$n.endDrag(),this.$df(!0))}handleClick(e,s,i){if(!this.isEnabled()||this.$ip())return;i?this.$n.shiftClickExtend(e,s):this.$n.click(e,s);const n=this.$n.getFocus();this.$a.setFocusCell(n.ri,n.ci),this.$df(!0)}extendFocus(e){if(!this.isEnabled()||!this.$n.hasSelection)return;this.$n.extendFocus(e);const s=this.$n.getFocus();this.$a.setFocusCell(s.ri,s.ci),this.$df(!0)}clear(){this.$n.hasSelection&&(this.$n.clear(),this.$df(!0))}clearRangeSelection(){this.clear()}setRangeSelection(e){const s=Array.isArray(e)?e[0]:e;if(!s){this.clear();return}this.$n.setRect(s);const i=this.$n.getFocus();this.$a.setFocusCell(i.ri,i.ci),this.$df(!0)}reproject(){var e,s;if(!this.$n.hasSelection)return;this.$n.reproject();const i=this.$n.getActiveRange();this.$a.emit("rangeChange",{range:i}),(s=(e=this.$a.getOptions()).onRangeChange)==null||s.call(e,{range:i})}$df(e){var s;if(this.$a.submitRender(RANGE_REPAINT),!e)return;const i=this.$n.getRangeSelection(),n=this.$n.getActiveRange(),r=this.$a.getOptions();this.$a.emit("selectionChange",{rows:[],rowIndexes:[],cells:i}),this.$a.emit("rangeChange",{range:n}),(s=r.onRangeChange)==null||s.call(r,{range:n}),this.$la()}$la(){const e=this.getActiveRange();if(!e)return;const s=e.endRow-e.startRow+1,i=e.endCol-e.startCol+1;this.$a.announce(this.$a.t("range.selectionAnnounce",{r1:e.startRow+1,c1:e.startCol+1,r2:e.endRow+1,c2:e.endCol+1,n:s*i}))}ctrlFill(e){if(!this.isEnabled())return;const s=this.getActiveRange();if(!s)return;const i=ctrlFillSourceTarget(s,e);i&&this.$fT(i.source,i.target,e,"copy")}fillRange(e,s,i="copy"){let n;s.startRow<e.startRow?n="up":s.endRow>e.endRow?n="down":s.startCol<e.startCol?n="left":n="right",this.$fT(e,s,n,i)}$jb(e,s){const i=this.$a.getColLayout().getColumnByField(s);if(!i||i.editable===!1)return!1;const n=this.$a.getOptions();if(typeof i.editable=="function"){const r=this.$a.getFlatModel().flatIndexOfRowId(e),l=r>=0?this.$a.getData().getRowByIndex(r):void 0;return l?!!i.editable(l,r):!1}return i.editable!==void 0?!0:!!n.editable}$fT(e,s,i,n){var r,l,a,h;const c=this.$fd(),d=c.seriesFill?n:"copy",f={resolveFlatRow:v=>this.$a.getFlatModel().resolveFlatRow(v),fieldAt:v=>{var _;return(_=this.$a.getColLayout().visibleLeaves[v])==null?void 0:_.field},getCellValue:(v,_)=>this.$a.getData().getCellValue(v,_),isEditable:(v,_)=>this.$jb(v,_),hasCellFormula:(v,_)=>{var b,E;return((E=(b=this.$a).hasCellFormula)==null?void 0:E.call(b,v,_))??!1},offsetFormula:(v,_,b,E)=>{var x,S;return((S=(x=this.$a).offsetFormula)==null?void 0:S.call(x,v,_,b,E))??""},overwriteFormula:c.fillOverwriteFormula},u=buildFillPlan(e,s,i,d,f),p=[],g=[],m=[];for(const v of u.items)if(v.action==="value"){const _=this.$a.getData().getCellValue(v.rowIndex,v.field);p.push({rowIndex:v.rowIndex,field:v.field,oldValue:_,newValue:v.value}),g.push({rowIndex:v.rowIndex,field:v.field,value:v.value})}else if(v.action==="setFormula"&&v.formula!=null){const _=this.$a.getFlatModel().resolveFlatRow(v.rowIndex);_.kind==="data"&&_.rowId&&(m.push({rowId:_.rowId,field:v.field,formula:v.formula}),p.push({rowIndex:v.rowIndex,field:v.field,oldValue:this.$a.getData().getCellValue(v.rowIndex,v.field),newValue:v.formula}))}const w={source:e,target:s,mode:d,written:p,skippedFormula:u.skippedFormula,cancel:!1};if(this.$a.emit("rangeFill",w),(l=(r=this.$a.getOptions()).onRangeFill)==null||l.call(r,w),w.cancel)return;g.length&&this.$a.writeCells(g);for(const v of m)(h=(a=this.$a).setCellFormulaByRowId)==null||h.call(a,v.rowId,v.field,v.formula);u.skippedFormula>0&&this.$a.announce(this.$a.t("range.formulaPreserved",{count:u.skippedFormula}));const y=u.items.filter(v=>v.action==="skip"&&v.reason!=="formula-preserved").length;y>0&&this.$a.announce(this.$a.t("range.fillSkipped",{count:y}))}copyText(){var e,s;const i=this.getActiveRange();if(!i)return null;const r=rangeToTSV(i,{fieldAt:l=>{var a;return(a=this.$a.getColLayout().visibleLeaves[l])==null?void 0:a.field},getCellValue:(l,a)=>this.$a.getData().getCellValue(l,a),getDisplayText:(l,a)=>this.$a.getDisplayValue(l,a)});return this.$a.emit("rangeCopy",{range:i,text:r}),(s=(e=this.$a.getOptions()).onRangeCopy)==null||s.call(e,{range:i,text:r}),r}pasteText(e){const s=this.getActiveRange();if(!s)return!1;const i=parseTSV(e),l=buildPastePlan(i,s,{resolveFlatRow:a=>this.$a.getFlatModel().resolveFlatRow(a),fieldAt:a=>{var h;return(h=this.$a.getColLayout().visibleLeaves[a])==null?void 0:h.field},isEditable:(a,h)=>this.$jb(a,h)}).filter(a=>a.action==="value").map(a=>({rowIndex:a.rowIndex,field:a.field,value:a.value}));return this.$a.writeCells(l),!0}$mp(e){const s=this.$a.getRenderer();if(!s)return;const n=s.bodyWrapper.getBoundingClientRect(),r=this.$fd().autoScrollEdge;let l=0,a=0;const h=e.clientY-n.top,c=n.bottom-e.clientY,d=e.clientX-n.left,f=n.right-e.clientX;if(h<r?a=-this.$fr(r-h):c<r&&(a=this.$fr(r-c)),d<r?l=-this.$fr(r-d):f<r&&(l=this.$fr(r-f)),l===0&&a===0){this.$kD();return}this.$fH=l,this.$fI=a,this.$cq==null&&this.$ko()}$fr(e){return Math.max(2,Math.min(20,e))}$ko(){const e=this.$a.getRenderer();if(!e){this.$cq=null;return}e.bodyWrapper.scrollTop+=this.$fI,e.bodyWrapper.scrollLeft+=this.$fH,this.$cq=requestAnimationFrame(()=>this.$ko())}$kD(){this.$cq!=null&&(cancelAnimationFrame(this.$cq),this.$cq=null),this.$fH=0,this.$fI=0}mount(e){if(this.$jv===e)return;this.$jv=e;const s=document.createElement("div");s.className="og-range-overlay",s.style.cssText="position:sticky;top:0;left:0;width:0;height:0;overflow:visible;pointer-events:none;z-index:6;";const i=document.createElement("div");i.className="og-range-border",i.style.cssText="position:absolute;box-sizing:border-box;border:2px solid var(--og-range-border,#1976d2);pointer-events:none;display:none;";const n=document.createElement("div");n.className="og-range-fill-preview",n.style.cssText="position:absolute;box-sizing:border-box;border:1px dashed var(--og-range-border,#1976d2);pointer-events:none;display:none;";const r=document.createElement("div");r.className="og-range-fill-handle",r.setAttribute("role","button"),r.setAttribute("aria-label",this.$a.t("range.fillHandleAria")),r.style.cssText="position:absolute;display:none;pointer-events:auto;background-color:var(--og-fill-handle-bg,#1976d2);",r.addEventListener("pointerdown",l=>this.$mz(l)),s.appendChild(i),s.appendChild(n),s.appendChild(r),e.insertBefore(s,e.firstChild),e.addEventListener("scroll",()=>this.repaint(),{passive:!0}),this.$jL=s,this.$el=i,this.$dS=n,this._handleEl=r}repaint(){if(!this.$jL)return;const e=this.$a.getRenderer(),s=this.getActiveRange();if(!e||!s){this.$iS();return}const i=this.$hO(e,s);if(!i){this.$iS();return}const{left:n,top:r,right:l,bottom:a}=i;if(Object.assign(this.$el.style,{display:"block",left:`${n}px`,top:`${r}px`,width:`${Math.max(0,l-n)}px`,height:`${Math.max(0,a-r)}px`}),this.$fd().fillHandle?Object.assign(this._handleEl.style,{display:"block",left:`${l}px`,top:`${a}px`}):this._handleEl.style.display="none",this.$bm){const h=this.$hO(e,this.$bm.target);if(h){const{left:c,top:d,right:f,bottom:u}=h;Object.assign(this.$dS.style,{display:"block",left:`${c}px`,top:`${d}px`,width:`${Math.max(0,f-c)}px`,height:`${Math.max(0,u-d)}px`});return}}this.$dS.style.display="none"}$hO(e,s){var i,n;const r=e.getCellEl(s.startRow,s.startCol),l=e.getCellEl(s.endRow,s.endCol);if(r&&l){const h=e.bodyWrapper.getBoundingClientRect(),c=r.getBoundingClientRect(),d=l.getBoundingClientRect();return{left:Math.min(c.left,d.left)-h.left,top:Math.min(c.top,d.top)-h.top,right:Math.max(c.right,d.right)-h.left,bottom:Math.max(c.bottom,d.bottom)-h.top}}const a=(n=(i=this.$a).rangeRect)==null?void 0:n.call(i,s);return a?{left:a.left,top:a.top,right:a.left+a.width,bottom:a.top+a.height}:null}$iS(){this.$el&&(this.$el.style.display="none"),this._handleEl&&(this._handleEl.style.display="none"),this.$dS&&(this.$dS.style.display="none")}getOverlayExtraOpts(){return{_rangeRects:this.$n.getRangeSelection()}}$mX(e,s){const i=typeof document.elementFromPoint=="function"?document.elementFromPoint(e,s):null,n=i==null?void 0:i.closest(".og-cell"),r=n==null?void 0:n.closest(".og-row");if(!n||!r)return null;const l=n.getAttribute("aria-colindex"),a=r.getAttribute("aria-rowindex");return l==null||a==null?null:{ri:Number(a)-1,ci:Number(l)-1}}$mz(e){var s;const i=this.getActiveRange();if(!i)return;e.stopPropagation(),e.preventDefault(),this._handlePointerId=e.pointerId;try{(s=this._handleEl)==null||s.setPointerCapture(e.pointerId)}catch{}this.$gg=i,this.$gh={x:e.clientX,y:e.clientY};const n=l=>this.$mA(l),r=l=>{document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",r),this.$mB(l)};document.addEventListener("pointermove",n),document.addEventListener("pointerup",r)}$mA(e){const s=this.$gg,i=this.$gh;if(!s||!i)return;const n=this.$mX(e.clientX,e.clientY);if(!n)return;const r=e.clientX-i.x,l=e.clientY-i.y,a=Math.abs(l)>=Math.abs(r);let h,c;if(a)if(n.ri>s.endRow)h="down",c={startRow:s.endRow+1,endRow:n.ri,startCol:s.startCol,endCol:s.endCol};else if(n.ri<s.startRow)h="up",c={startRow:n.ri,endRow:s.startRow-1,startCol:s.startCol,endCol:s.endCol};else{this.$bm=null,this.repaint();return}else if(n.ci>s.endCol)h="right",c={startRow:s.startRow,endRow:s.endRow,startCol:s.endCol+1,endCol:n.ci};else if(n.ci<s.startCol)h="left",c={startRow:s.startRow,endRow:s.endRow,startCol:n.ci,endCol:s.startCol-1};else{this.$bm=null,this.repaint();return}const f=this.$fd().seriesFill?"series":"copy",p=e.ctrlKey||e.metaKey?f==="series"?"copy":"series":f;this.$bm={source:s,target:c,axis:h,mode:p},this.repaint()}$mB(e){const s=this.$bm;this.$gg=null,this.$gh=null,this.$bm=null,this._handlePointerId=null,s&&this.$fT(s.source,s.target,s.axis,s.mode),this.repaint()}}class GroupTreeManager{constructor(e){this.$eD=[],this.$bq=new Set,this.$eE=[],this.$cF=!1,this.$fD=[],this.$fC=[],this.$bG=new Set,this.$cG=!1,this.$a=e}get isGroupMode(){return this.$cF}get isTreeMode(){return this.$cG}get groupFlatRows(){return this.$eE}get treeFlatRows(){return this.$fC}groupBy(e){this.$eD=e,this.$bq.clear(),this.$cF=e.length>0,this.rebuildGroups()}clearGroup(){var e;this.$eD=[],this.$bq.clear(),this.$cF=!1,this.$eE=[],this.$a.setFlatBacking(null),(e=this.$a.getVs())==null||e.setTotalRows(this.$a.getFlatCount()),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE)}expandAll(){if(!this.$cF)return;const e=buildGroups(this.$a.getData(),this.$eD,this.$iL(),void 0,void 0,this.$iN());collectAllKeys(e).forEach(s=>this.$bq.add(s)),this.rebuildGroups()}$iN(){return this.$a.getStrategy?this.$a.getStrategy("groupKeyFn",void 0):void 0}collapseAll(){this.$bq.clear(),this.$cF&&this.rebuildGroups()}handleGroupToggle(e){this.$bq.has(e)?this.$bq.delete(e):this.$bq.add(e),this.rebuildGroups()}rebuildGroups(){var e;const s=this.$a.getData(),i=this.$a.getDataLayer(),n=a=>{const h=s.indexOf(a);return h>=0?i.getRowState(h):"none"},r=buildGroups(s,this.$eD,this.$iL(),this.$bq,n,this.$iN());this.$eE=flattenGroups(r),this.$a.setFlatBacking(()=>this.$eE);const l=this.$a.getFlatCount();(e=this.$a.getVs())==null||e.setTotalRows(l),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE)}enableTree(){this.$cG=!0,this.$cF=!1;const e=this.$a.getOptions();if(e.expandOnLoad){const s=buildTree(this.$a.getData(),{idField:e.treeId,parentIdField:e.treeParentId});collectAllTreeIds(s).forEach(i=>this.$bG.add(i))}this.rebuildTree()}disableTree(){var e;this.$cG=!1,this.$fD=[],this.$fC=[],this.$bG.clear(),this.$a.setFlatBacking(null),(e=this.$a.getVs())==null||e.setTotalRows(this.$a.getFlatCount()),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE)}expandNodes(e,s=!0){const i=Array.isArray(e)?e:[e];for(const n of i)s?this.$bG.add(n):this.$bG.delete(n);this.$cG&&this.rebuildTree()}expandAllNodes(){this.$cG&&(collectAllTreeIds(this.$fD).forEach(e=>this.$bG.add(e)),this.rebuildTree())}collapseAllNodes(){this.$cG&&(this.$bG.clear(),this.rebuildTree())}handleTreeToggle(e){toggleTreeNode(this.$bG,e),this.rebuildTree()}rebuildTree(){var e;const s=this.$a.getOptions();this.$fD=buildTree(this.$a.getData(),{idField:s.treeId,parentIdField:s.treeParentId,expandOnLoad:s.expandOnLoad},this.$bG),this.$fC=flattenTree(this.$fD),this.$a.setFlatBacking(()=>this.$fC);const i=this.$a.getFlatCount();(e=this.$a.getVs())==null||e.setTotalRows(i),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE)}$iL(){const e=this.$a.getOptions().summary;if(!e)return[];if(e.rows&&e.rows.length>0)return e.fields.flatMap(i=>e.rows.map(n=>({field:i,op:n.op,format:n.format})));const s=Array.isArray(e.ops)?e.ops:e.ops?[e.ops]:["SUM"];return e.fields.map(i=>({field:i,op:s[0]??"SUM",format:e.format}))}}class DetailState{constructor(e={}){this._expanded=new Set,this.$W=e.maxDepth??2,this.$gd=e.expandMultiple??!0,this._depth=e.depth??0}get expandedRowIds(){return this._expanded}get size(){return this._expanded.size}get depth(){return this._depth}get maxDepth(){return this.$W}get expandMultiple(){return this.$gd}isExpanded(e){return this._expanded.has(e)}canExpand(){return this._depth<this.$W}expand(e){return this._expanded.has(e)?!0:this.canExpand()?(this.$gd||this._expanded.clear(),this._expanded.add(e),!0):!1}collapse(e){return this._expanded.delete(e)}toggle(e){return this._expanded.has(e)?(this.collapse(e),"collapsed"):this.expand(e)?"expanded":"rejected"}collapseAll(){const e=Array.from(this._expanded);return this._expanded.clear(),e}buildEventPayload(e,s,i,n){return{rowIndex:s,rowId:e,row:i,host:n}}}function isGroupItem(o){return!!o&&o._isGroup===!0}function isTreeItem(o){return!!o&&o._isTree===!0}function isDetailPseudoRow(o){return!!o&&(o._isDetailHead===!0||o._isDetailFiller===!0)}function isEligibleMaster(o){return!(o==null||isDetailPseudoRow(o)||isGroupItem(o))}function extractRow(o){return isTreeItem(o)?o.data:o}function computeSlotCount(o,e,s){if(s.getSlotCount){const r=Math.floor(s.getSlotCount(o,e));return Number.isFinite(r)&&r>0?r:1}const i=s.height??200,n=s.rowHeight>0?s.rowHeight:1;return Math.max(1,Math.ceil(i/n))}function spliceDetails(o,e){const s=[];if(e.expandedRowIds.size===0){for(const i of o)s.push(i);return s}for(const i of o){if(s.push(i),!isEligibleMaster(i))continue;const n=extractRow(i),r=n!=null?e.getRowId(n):null;if(r==null||!e.expandedRowIds.has(r))continue;const l=computeSlotCount(n,r,e),a={_isDetailHead:!0,_rowId:r,_masterFlatBase:i,_span:l};s.push(a);for(let h=1;h<l;h++)s.push({_isDetailFiller:!0,_rowId:r})}return s}class SubgridCache{constructor(e){this.adapter=e,this.$Q=new Map}get size(){return this.$Q.size}has(e){return this.$Q.has(e)}getOrCreate(e,s){const i=this.$Q.get(e);if(i)return i.attached=!0,i;const n=s(),r=this.adapter.create(e,n),l={host:n,instance:r,attached:!0};return this.$Q.set(e,l),l}reattach(e){const s=this.$Q.get(e);return!s||s.attached?!1:(this.adapter.reattach(s.instance,s.host),s.attached=!0,!0)}detach(e){const s=this.$Q.get(e);return!s||!s.attached?!1:(this.adapter.detach(s.instance,s.host),s.attached=!1,!0)}detachAll(){for(const e of this.$Q.keys())this.detach(e)}remove(e,s={}){const i=this.$Q.get(e);if(i){if(s.cache){i.attached&&this.adapter.detach(i.instance,i.host),i.attached=!1;return}this.adapter.destroy(i.instance,i.host),this.$Q.delete(e)}}getInstance(e){var s;return(s=this.$Q.get(e))==null?void 0:s.instance}getHost(e){var s;return(s=this.$Q.get(e))==null?void 0:s.host}isAttached(e){var s;return((s=this.$Q.get(e))==null?void 0:s.attached)===!0}isEditing(e,s){if(!s)return!1;const i=this.$Q.get(e);return!!i&&s(i.instance)}destroyAll(){for(const e of this.$Q.values())this.adapter.destroy(e.instance,e.host);this.$Q.clear()}}let _autoHeightWarned=!1;class DetailManager{constructor(e){this.$bS=new Map,this.$dD=null,this.$ck=0,this.$kt=void 0,this.$ks=void 0,this.$ku=void 0,this.$kr=void 0,this.$jj=!1,this.$jk=-1,this.$jl=-1,this.$a=e;const s=this.$cM();this.$f=new DetailState({maxDepth:s.maxDepth??2,expandMultiple:s.expandMultiple??!0,depth:e.getDepth()});const i={create:(r,l)=>this.$lm(r,l),detach:(r,l)=>{l.remove()},reattach:()=>{},destroy:(r,l)=>{var a;try{(a=r==null?void 0:r.destroy)==null||a.call(r)}catch{}l.remove()}};this.$h=new SubgridCache(i),e.getFlatModel().registerSplice(r=>this.$nm(r),()=>this.$mb(),()=>this.activeVersion),s.heightMode==="auto"&&!_autoHeightWarned&&(_autoHeightWarned=!0,console.warn("[OpenGrid] masterDetail.heightMode:'auto' 는 Spike-B(가변높이 VirtualScroll) 통과 전까지 미공개 기능입니다. 'fixed' 로 동작합니다(11_design_F2_v2.md §2.2/C12.2)."))}$cM(){var e;return((e=this.$a.getOptions())==null?void 0:e.masterDetail)??{}}get enabled(){return this.$cM().enabled===!0}get isActive(){return this.enabled&&this.$f.size>0}get activeVersion(){var e;const s=this.$cM(),i=(e=this.$a.getOptions())==null?void 0:e.rowHeight;return(s.enabled!==this.$kr||s.height!==this.$ks||s.detailRowCount!==this.$ku||i!==this.$kt)&&(this.$kr=s.enabled,this.$ks=s.height,this.$ku=s.detailRowCount,this.$kt=i,this.$ck++),this.$ck}$mb(){if(!this.enabled||this.$f.size===0)return!1;const e=this.$ck,s=this.$a.getFlatModel().dataStructureVersion;if(e===this.$jk&&s===this.$jl)return this.$jj;let i=!1;for(const n of this.$f.expandedRowIds)if(this.$a.getRowById(n)!==void 0){i=!0;break}return this.$jj=i,this.$jk=e,this.$jl=s,i}get maxDepth(){return this.$f.maxDepth}$dY(e){if(typeof e=="number"){const s=this.$a.getFlatModel().resolveFlatRow(e);return s.kind==="data"||s.kind==="tree"?s.rowId??null:null}return(e==null?void 0:e.id)??null}isExpandedId(e){return this.$f.isExpanded(e)}isRowExpanded(e){const s=this.$dY(e);return s!=null&&this.$f.isExpanded(s)}expandRow(e){if(!this.enabled)return;const s=this.$dY(e);if(s==null||this.$f.isExpanded(s))return;const i=this.$f.expand(s);if(this.$ck++,!i){this.$a.announce(this.$a.t("detail.depthLimitOpen",{max:this.$f.maxDepth}));return}this.$hE(s,"expanded")}collapseRow(e){const s=this.$dY(e);if(s==null||!this.$f.isExpanded(s))return;const i=this.$bS.get(s);i&&document.activeElement&&i.contains(document.activeElement)&&(this.$dD=s),this.$f.collapse(s),this.$ck++,this.$kc(s),this.$hE(s,"collapsed")}toggleRow(e){const s=this.$dY(e);s!=null&&(this.$f.isExpanded(s)?this.collapseRow(e):this.expandRow(e))}collapseAllDetails(){const e=this.$f.collapseAll();if(e.length!==0){this.$ck++;for(const s of e)this.$kc(s);this.$hb();for(const s of e)this.$a.emit("rowCollapse",{rowIndex:this.$a.getFlatModel().flatIndexOfRowId(s),rowId:s,row:this.$a.getRowById(s),host:null});this.$a.announce(this.$a.t("detail.collapsedAllAnnounce"))}}getDetailInstance(e){const s=this.$dY(e);if(s!=null)return this.$h.getInstance(s)}resyncPanelWidths(){this.isActive&&this.$hb()}getPanelHost(e){let s=this.$bS.get(e);return s||(s=document.createElement("div"),s.className="og-detail-host",s.style.cssText="width:100%;height:100%;box-sizing:border-box;overflow:auto;",this.$bS.set(e,s)),this.$h.getOrCreate(e,()=>s),this.$dD===e&&(this.$dD=null),s}$lm(e,s){const i=this.$cM(),n=this.$a.getRowById(e),r=this.$a.getDepth(),l={grid:this.$a.getGridInstance(),rowId:e,depth:r,collapse:()=>this.collapseRow({id:e}),refresh:()=>{var a,h;try{(h=(a=this.$h.getInstance(e))==null?void 0:a.refresh)==null||h.call(a)}catch{}}};if(typeof i.renderer=="function"){const a=i.renderer(n,s,l);return a instanceof HTMLElement&&a!==s&&s.appendChild(a),{destroy:()=>{}}}if(i.subgridOptions){if(r+1>this.$f.maxDepth)return this.$a.announce(this.$a.t("detail.depthLimitSubgrid",{max:this.$f.maxDepth})),{destroy:()=>{}};if(this.$a.createSubgrid)return this.$a.createSubgrid(s,i.subgridOptions,r+1)}return{destroy:()=>{}}}onBeforeTeardown(){for(const[e,s]of this.$bS)if(this.$h.isAttached(e)){if(this.isEditing(e)){document.body.appendChild(s);continue}this.$h.detach(e)}}isEditing(e){const s=this.$h.getInstance(e);return!!s&&typeof s.isEditing=="function"&&!!s.isEditing()}consumePendingFocusRestore(){const e=this.$dD;return this.$dD=null,e}$kc(e){const s=this.$cM();this.$h.remove(e,{cache:s.cache===!0}),s.cache!==!0&&this.$bS.delete(e)}$nm(e){var s;if(!this.isActive)return e;const i=this.$cM(),n=((s=this.$a.getOptions())==null?void 0:s.rowHeight)??32,r={expandedRowIds:this.$f.expandedRowIds,getRowId:l=>this.$a.getRowId(l),rowHeight:n,height:i.height??200};if(typeof i.detailRowCount=="number"){const l=i.detailRowCount;r.getSlotCount=()=>l}return spliceDetails(e,r)}$hE(e,s){this.$hb();const n=this.$a.getFlatModel().flatIndexOfRowId(e),r=s==="expanded"?this.$bS.get(e)??null:null,l={rowIndex:n,rowId:e,row:this.$a.getRowById(e),host:r};this.$a.emit(s==="expanded"?"rowExpand":"rowCollapse",l),this.$a.announce(this.$a.t(s==="expanded"?"detail.expandedAnnounce":"detail.collapsedAnnounce"))}$hb(){var e;const s=this.$a.getFlatModel().count();(e=this.$a.getVs())==null||e.setTotalRows(s),this.$a.submitRender(RenderRequest.REPAINT_VISIBLE)}destroy(){this.$h.destroyAll(),this.$bS.clear()}}function formatCell(o,e){return o==null||Number.isNaN(o)?"":e?e(o,{axis:"tooltip"}):String(o)}function buildA11yTable(o,e={}){const{categories:s,series:i}=o,n=["category",...i.map(c=>c.name)],r=s.map((c,d)=>[c,...i.map(f=>formatCell(f.data[d]??null,e.numberFormat))]),a=i.map(c=>c.name).join(", ")||t("chart.tooltipEmpty");return{caption:e.title?t("chart.a11ySummary",{title:e.title,categories:s.length,series:a}):t("chart.a11ySummaryNoTitle",{categories:s.length,series:a}),colHeaders:n,rows:r}}const NUMERIC_SAMPLE_MIN_RATIO=.8,NUMERIC_SAMPLE_MAX=50;function coerceNumber(o){if(o==null||o==="")return null;if(typeof o=="number")return Number.isFinite(o)?o:null;const e=Number(o);return Number.isFinite(e)?e:null}function isNumericColumn(o,e,s){if((o==null?void 0:o.type)==="number")return!0;if(o!=null&&o.type)return!1;let i=0,n=0;for(const r of e){if(i>=NUMERIC_SAMPLE_MAX)break;const l=r[s];l==null||l===""||(i++,coerceNumber(l)!==null&&n++)}return i===0?!1:n/i>=NUMERIC_SAMPLE_MIN_RATIO}function seriesSpecField(o){return typeof o=="string"?o:o.field}function seriesSpecName(o,e){return typeof o=="string"?e:o.name??e}function inferCategoryAndSeries(o,e){let s=null;for(const n of e)if(!isNumericColumn(n,o,n.field)){s=n;break}const i=e.filter(n=>n!==s&&isNumericColumn(n,o,n.field));return{categoryField:(s==null?void 0:s.field)??null,seriesCols:i}}function aggregateValues(o,e,s){if(typeof s=="function")return s(o,e);if(!o.length)return 0;switch(s){case"sum":return OGDecimal.sum(o).toNumber();case"avg":return OGDecimal.avg(o).toNumber();case"min":return OGDecimal.min(o).toNumber();case"max":return OGDecimal.max(o).toNumber();case"count":return o.length;default:return OGDecimal.sum(o).toNumber()}}function resolveRows(o,e){var s;switch(o.kind){case"all":case"columns":return{rows:e.getAllRows(),effectiveKind:o.kind,rangeFallback:!1};case"selection":return{rows:e.getSelectedRows(),effectiveKind:"selection",rangeFallback:!1};case"checked":return{rows:e.getCheckedRows(),effectiveKind:"checked",rangeFallback:!1};case"range":{const i=o.range??((s=e.getActiveRange)==null?void 0:s.call(e))??null;return!i||!e.getRangeRows?{rows:e.getSelectedRows(),effectiveKind:"selection",rangeFallback:!0}:{rows:e.getRangeRows(i),effectiveKind:"range",rangeFallback:!1}}}}function resolveColumns(o,e,s){return o.kind==="range"&&e==="range"&&o.range&&s.getRangeColumns?s.getRangeColumns(o.range):s.getVisibleColumns()}function extractChartData(o,e,s={}){const{rows:i,effectiveKind:n,rangeFallback:r}=resolveRows(o,e),l=resolveColumns(o,n,e);let a=null,h;if(o.kind==="columns")a=s.category??o.category??null,h=s.series??o.series;else if(s.series)a=s.category??null,h=s.series;else{const v=inferCategoryAndSeries(i,l);a=s.category??v.categoryField,h=v.seriesCols.map(_=>_.field)}const c=new Map(l.map(v=>[v.field,v])),d=a?i.map(v=>String(v[a]??"")):i.map((v,_)=>String(_+1)),f=h.map(v=>{const _=seriesSpecField(v),b=c.get(_),E=seriesSpecName(v,(b==null?void 0:b.header)??_),x=i.map(k=>coerceNumber(k[_])),S=typeof v=="string"?void 0:v.pattern,M=typeof v=="string"?void 0:v.color,R={name:E,data:x};return S&&(R.pattern=S),M&&(R.color=M),R}),u=i.length;let p=d,g=f,m,w=!1;if(s.aggregate&&d.length>0){const v=[],_=new Map;for(let b=0;b<d.length;b++){const E=d[b];_.has(E)?_.get(E).push(b):(_.set(E,[b]),v.push(E))}v.length<d.length&&(p=v,g=f.map(b=>({...b,data:v.map(E=>{const S=_.get(E).map(M=>b.data[M]).filter(M=>M!==null);return S.length?aggregateValues(S,E,s.aggregate):null})})),m=typeof s.aggregate=="function"?"custom":s.aggregate,w=!0)}const y={categories:p,series:g,meta:{sourceKind:n,total:u,sampled:w,a11yTable:buildA11yTable({categories:p,series:g},{title:s.title,numberFormat:s.numberFormat})}};return m&&(y.meta.aggregatedOp=m),{model:y,rangeFallback:r}}function isLineLike(o){return o==="line"||o==="area"}function numericOf(o){return o==null||Number.isNaN(o)?null:o}function envelopeIndices(o){let e=-1,s=-1,i=1/0,n=-1/0;for(let l=0;l<o.length;l++){const a=numericOf(o[l]);a!=null&&(a<i&&(i=a,e=l),a>n&&(n=a,s=l))}const r=[];return e>=0&&r.push(e),s>=0&&r.push(s),r}function lttbIndices(o,e){const s=o.length;if(e>=s||e<=2)return Array.from({length:s},(a,h)=>h);const i=a=>numericOf(o[a])??0,n=[0],r=(s-2)/(e-2);let l=0;for(let a=0;a<e-2;a++){let h=0,c=0;const d=Math.floor((a+1)*r)+1;let f=Math.floor((a+2)*r)+1;f=Math.min(f,s);const u=f-d;for(let _=d;_<f;_++)h+=_,c+=i(_);u>0&&(h/=u,c/=u);const p=Math.floor(a*r)+1,g=Math.floor((a+1)*r)+1,m=l,w=i(l);let y=-1,v=p;for(let _=p;_<g&&_<s;_++){const b=Math.abs((m-h)*(i(_)-w)-(m-_)*(c-w))*.5;b>y&&(y=b,v=_)}n.push(v),l=v}return n.push(s-1),n}function downsampleModel(o,e,s,i={}){var n;const r=o.categories.length;if(!Number.isFinite(e)||e<=0||r<=e)return{model:o,sampled:!1};let l,a;if(isLineLike(s)){const c=((n=o.series[0])==null?void 0:n.data)??new Array(r).fill(0),d=new Set([0,r-1]);for(const g of o.series)for(const m of envelopeIndices(g.data))d.add(m);const f=new Set(d),u=lttbIndices(c,e);for(const g of u){if(f.size>=e)break;f.add(g)}let p=[...f].sort((g,m)=>g-m);if(p.length>e){const g=new Set([0,r-1]),m=o.series.map(y=>envelopeIndices(y.data));let w=!0;for(;w&&g.size<e;){w=!1;for(const y of m){if(g.size>=e)break;const v=y.find(_=>!g.has(_));v!==void 0&&(g.add(v),w=!0)}}p=[...g].sort((y,v)=>y-v).slice(0,e)}l=p.map(g=>o.categories[g]),a=o.series.map(g=>({...g,data:p.map(m=>g.data[m])}))}else{const c=e,d=r/c;l=[];const f=[];for(let u=0;u<c;u++){const p=Math.floor(u*d),g=Math.min(Math.floor((u+1)*d),r);if(p>=g)continue;f.push([p,g]);const m=o.categories[p],w=o.categories[g-1];l.push(g-p>1?`${m}…${w}`:m)}a=o.series.map(u=>({...u,data:f.map(([p,g])=>{let m=0,w=!1;for(let y=p;y<g;y++){const v=numericOf(u.data[y]);v!=null&&(m+=v,w=!0)}return w?m:null})}))}return{model:{categories:l,series:a,meta:{...o.meta,sampled:!0,sampledFrom:r,sampledTo:l.length,a11yTable:buildA11yTable({categories:l,series:a},{title:i.title,numberFormat:i.numberFormat})}},sampled:!0}}const OKABE_ITO=["#0072B2","#E69F00","#009E73","#CC79A7","#F0E442","#56B4E9","#D55E00","#999999"],PATTERN_CYCLE=["solid","hatch","dot","cross"];function clamp255(o){return Math.min(255,Math.max(0,o))}function parseColor(o){const e=o.trim(),s=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(s)return{r:clamp255(+s[1]),g:clamp255(+s[2]),b:clamp255(+s[3])};const i=e.replace("#","");return/^[0-9a-f]{3}$/i.test(i)?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16)}:/^[0-9a-f]{6}$/i.test(i)?{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16)}:null}function srgbToLinear(o){const e=o/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function relativeLuminance(o){return .2126*srgbToLinear(o.r)+.7152*srgbToLinear(o.g)+.0722*srgbToLinear(o.b)}function contrastRatio(o,e){const s=parseColor(o),i=parseColor(e);if(!s||!i)return 1;const n=relativeLuminance(s),r=relativeLuminance(i),[l,a]=n>=r?[n,r]:[r,n];return(l+.05)/(a+.05)}function resolveSeriesStyles(o,e={}){var s;const i=(e.palette&&e.palette.length?e.palette:OKABE_ITO).slice();return!((s=e.palette)!=null&&s.length)&&e.primary&&parseColor(e.primary)&&(i.length<2||contrastRatio(e.primary,i[1])>=3)&&(i[0]=e.primary),o.map((n,r)=>({color:n.color??i[r%i.length],pattern:n.pattern??PATTERN_CYCLE[r%PATTERN_CYCLE.length]}))}function niceNum(o,e){if(o===0)return 0;const s=Math.abs(o),i=Math.floor(Math.log10(s)),n=s/Math.pow(10,i);let r;return e?n<1.5?r=1:n<3?r=2:n<7?r=5:r=10:n<=1?r=1:n<=2?r=2:n<=5?r=5:r=10,r*Math.pow(10,i)}function roundToStep(o,e){const s=Math.max(0,-Math.floor(Math.log10(e))+6),i=Math.pow(10,s),n=Math.round(o*i)/i;return n===0?0:n}function niceScale(o,e,s=6){let i=o,n=e;if(i>n&&([i,n]=[n,i]),i===n)if(i===0)i=-1,n=1;else{const u=Math.abs(i)*.5;i-=u,n+=u}const r=Math.max(2,s),l=niceNum(n-i,!1),a=niceNum(l/(r-1),!0),h=roundToStep(Math.floor(i/a)*a,a),c=roundToStep(Math.ceil(n/a)*a,a),d=[],f=Math.round((c-h)/a)+1;for(let u=0;u<f;u++)d.push(roundToStep(h+u*a,a));return{min:h,max:c,step:a,ticks:d}}function hitBar(o,e,s){for(const i of o){const n=Math.min(i.x,i.x+i.w),r=Math.max(i.x,i.x+i.w),l=Math.min(i.y,i.y+i.h),a=Math.max(i.y,i.y+i.h);if(e>=n&&e<=r&&s>=l&&s<=a)return i}return null}function hitLine(o,e,s){if(!o.length)return null;let i=-1,n=1/0;for(const a of o){const h=Math.abs(a.cx-e);h<n&&(n=h,i=a.categoryIndex)}let r=null,l=1/0;for(const a of o){if(a.categoryIndex!==i)continue;const h=Math.abs(a.cy-s);h<l&&(l=h,r=a)}return r}function hitTest(o,e,s,i){return o.length?i==="line"||i==="area"?hitLine(o,e,s):hitBar(o,e,s):null}const VISUALLY_HIDDEN="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;padding:0;margin:-1px;",PAD={top:26,right:14,bottom:34,left:52},MARKER_R=3.5;let _a11yIdSeq=0;function fmt(o,e,s){return o==null||Number.isNaN(o)?"":e.numberFormat?e.numberFormat(o,{axis:s}):String(o)}class CanvasAdapter{constructor(){this.id="builtin-canvas",this.$m=null,this.$U=null,this.$eh=null,this.$eQ=null,this.$dc=null,this.$ay=null,this.$n=null,this.$dd=480,this.$cC=300,this.$bp=[],this.$bR=new Set,this.$H={cat:0,series:0},this.$gP=null,this.$bw=e=>{if(this.$Y.tooltip===!1)return;const{x:s,y:i}=this.$jn(e),n=hitTest(this.$bp,s,i,this.$Y.type);n?this.$ky(n,s,i):this.$gv()},this.$jH=()=>this.$gv(),this.$jE=e=>{const{x:s,y:i}=this.$jn(e),n=hitTest(this.$bp,s,i,this.$Y.type);n&&this.$is(n)},this.$az=e=>{const s=this.$n;if(!s)return;const i=s.categories.length,n=s.series.length;let r=!0;switch(e.key){case"ArrowRight":this.$H.cat=Math.min(i-1,this.$H.cat+1);break;case"ArrowLeft":this.$H.cat=Math.max(0,this.$H.cat-1);break;case"ArrowDown":this.$H.series=Math.min(n-1,this.$H.series+1);break;case"ArrowUp":this.$H.series=Math.max(0,this.$H.series-1);break;case"Enter":case" ":{const l=this.$ih();l&&this.$is(l);break}default:r=!1}r&&(e.preventDefault(),this.$kZ())}}async init(e,s){this.$m=e,this.$Y=s,e.classList.add("og-chart"),getComputedStyle(e).position==="static"&&(e.style.position="relative");const i=document.createElement("canvas");i.className="og-chart-canvas",i.style.cssText="display:block;",i.setAttribute("role","img"),i.tabIndex=0,i.setAttribute("aria-label",s.title??t("chart.canvasDefault")),this.$U=i;const n=document.createElement("table");n.className="og-chart-a11y",n.style.cssText=VISUALLY_HIDDEN;const r=`og-chart-a11y-${++_a11yIdSeq}`;n.id=r,i.setAttribute("aria-describedby",r),this.$eh=n;const l=document.createElement("div");l.className="og-chart-legend",l.style.cssText="display:flex;flex-wrap:wrap;gap:8px;margin-top:6px;",this.$eQ=l;const a=document.createElement("div");a.className="og-chart-tooltip",a.style.cssText="position:absolute;pointer-events:none;display:none;z-index:5;padding:4px 8px;font-size:12px;border-radius:4px;background:#333;color:#fff;white-space:nowrap;",this.$dc=a;const h=document.createElement("div");h.className="og-chart-live",h.setAttribute("aria-live","polite"),h.style.cssText=VISUALLY_HIDDEN,this.$ay=h,e.appendChild(i),e.appendChild(n),e.appendChild(l),e.appendChild(a),e.appendChild(h),i.addEventListener("mousemove",this.$bw),i.addEventListener("mouseleave",this.$jH),i.addEventListener("click",this.$jE),i.addEventListener("keydown",this.$az)}render(e,s){var i;this.$n=e,this.$Y=s,this.$H.cat=e.categories.length?Math.min(Math.max(this.$H.cat,0),e.categories.length-1):0,this.$H.series=e.series.length?Math.min(Math.max(this.$H.series,0),e.series.length-1):0,this.$U&&this.$U.setAttribute("aria-label",((i=s.a11y)==null?void 0:i.caption)??s.title??t("chart.canvasDefault")),this.$mQ(e,s),this.$mS(e,s),this.$id(e,s),this.$aC(e,s),this.$gv()}resize(e,s){this.$dd=Math.max(80,Math.floor(e)),this.$cC=Math.max(60,Math.floor(s)),this.$n&&this.render(this.$n,this.$Y)}onPointClick(e){this.$gP=e}destroy(){var e,s,i,n,r,l;const a=this.$U;a&&(a.removeEventListener("mousemove",this.$bw),a.removeEventListener("mouseleave",this.$jH),a.removeEventListener("click",this.$jE),a.removeEventListener("keydown",this.$az)),(e=this.$eh)==null||e.remove(),(s=this.$U)==null||s.remove(),(i=this.$eQ)==null||i.remove(),(n=this.$dc)==null||n.remove(),(r=this.$ay)==null||r.remove(),(l=this.$m)==null||l.classList.remove("og-chart"),this.$m=this.$U=this.$eh=this.$eQ=this.$dc=this.$ay=null,this.$bp=[],this.$gP=null}getGeometry(){return this.$bp}$mQ(e,s){const i=this.$eh;if(!i)return;const n=e.meta.a11yTable;i.innerHTML="";const r=document.createElement("caption");r.textContent=n.caption,i.appendChild(r);const l=document.createElement("thead"),a=document.createElement("tr");for(const c of n.colHeaders){const d=document.createElement("th");d.scope="col",d.textContent=c,a.appendChild(d)}l.appendChild(a),i.appendChild(l);const h=document.createElement("tbody");for(const c of n.rows){const d=document.createElement("tr");c.forEach((f,u)=>{const p=document.createElement(u===0?"th":"td");u===0&&(p.scope="row"),p.textContent=f,d.appendChild(p)}),h.appendChild(d)}i.appendChild(h)}$mS(e,s){const i=this.$eQ;if(!i)return;if(s.legend===!1){i.style.display="none";return}i.style.display="flex";const n=this.$kI(e,s),r=Array.from(i.querySelectorAll("button.og-chart-legend-item"));if(r.length===e.series.length&&r.every((c,d)=>c.dataset.seriesName===e.series[d].name)){e.series.forEach((c,d)=>{const f=r[d],u=!this.$bR.has(d);this.$hy(f,e.series[d],n[d],u)});return}const a=document.activeElement,h=a instanceof HTMLButtonElement?r.indexOf(a):-1;if(i.innerHTML="",e.series.forEach((c,d)=>{const f=document.createElement("button");f.type="button",f.className="og-chart-legend-item",f.dataset.seriesName=c.name,f.style.cssText="display:inline-flex;align-items:center;gap:5px;min-height:24px;padding:2px 6px;font-size:12px;cursor:pointer;background:none;border:1px solid transparent;border-radius:4px;";const u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.cssText="display:inline-block;width:12px;height:12px;border-radius:2px;";const p=document.createElement("span");f.appendChild(u),f.appendChild(p),this.$hy(f,c,n[d],!this.$bR.has(d)),f.addEventListener("click",()=>{const g=!this.$bR.has(d);g?this.$bR.add(d):this.$bR.delete(d),this.$hy(f,c,n[d],!g),this.$id(this.$n,this.$Y),this.$aC(this.$n,this.$Y)}),i.appendChild(f)}),h>=0){const c=i.querySelectorAll("button.og-chart-legend-item"),d=c[h]??c[c.length-1];d==null||d.focus()}}$hy(e,s,i,n){e.setAttribute("aria-pressed",String(n)),e.style.opacity=n?"1":"0.45";const r=e.querySelector("span[aria-hidden]");r&&(r.style.background=i.color);const l=e.querySelector("span:not([aria-hidden])");l&&(l.textContent=`${s.name} (${i.pattern})`)}$kI(e,s){var i,n;return resolveSeriesStyles(e.series.map(r=>({color:r.color,pattern:r.pattern})),{palette:s.palette??((i=s.theme)==null?void 0:i.palette),primary:(n=s.theme)==null?void 0:n.primary})}$jP(){return{x:PAD.left,y:PAD.top,w:Math.max(1,this.$dd-PAD.left-PAD.right),h:Math.max(1,this.$cC-PAD.top-PAD.bottom)}}$kQ(e){let s=1/0,i=-1/0;return e.series.forEach((n,r)=>{if(!this.$bR.has(r))for(const l of n.data)l==null||Number.isNaN(l)||(l<s&&(s=l),l>i&&(i=l))}),(!Number.isFinite(s)||!Number.isFinite(i))&&(s=0,i=1),(this.$Y.type==="bar"||this.$Y.type==="bar-stacked"||this.$Y.type==="bar-grouped")&&(s=Math.min(0,s),i=Math.max(0,i)),{min:s,max:i}}$id(e,s){const i=[],n=this.$jP(),l=e.categories.length||1,{min:a,max:h}=this.$kQ(e),c=niceScale(a,h,6),d=m=>{const w=(m-c.min)/(c.max-c.min||1);return n.y+n.h-w*n.h},f=d(0<c.min?c.min:0>c.max?c.max:0),u=n.w/l,p=s.type==="line"||s.type==="area",g=e.series.map((m,w)=>({s:m,si:w})).filter(({si:m})=>!this.$bR.has(m));if(p)for(const{s:m,si:w}of g)m.data.forEach((y,v)=>{const _=n.x+u*v+u/2,b=y==null?NaN:d(y);Number.isNaN(b)||i.push({seriesIndex:w,categoryIndex:v,x:_-MARKER_R,y:b-MARKER_R,w:MARKER_R*2,h:MARKER_R*2,cx:_,cy:b})});else{const m=g.length||1,w=u*.72,y=w/m;g.forEach(({s:v,si:_},b)=>{v.data.forEach((E,x)=>{if(E==null||Number.isNaN(E))return;const M=n.x+u*x+(u-w)/2+y*b,R=d(E),k=Math.min(R,f),C=Math.abs(f-R);i.push({seriesIndex:_,categoryIndex:x,x:M,y:k,w:y,h:C,cx:M+y/2,cy:k+C/2})})})}this.$bp=i}$aC(e,s){const i=this.$U;if(!i)return;const n=deviceRatio();i.width=Math.floor(this.$dd*n),i.height=Math.floor(this.$cC*n),i.style.width=`${this.$dd}px`,i.style.height=`${this.$cC}px`;const r=i.getContext?i.getContext("2d"):null;if(!r)return;r.setTransform(n,0,0,n,0,0),r.clearRect(0,0,this.$dd,this.$cC);const l=s.theme,a=this.$jP(),{min:h,max:c}=this.$kQ(e),d=niceScale(h,c,6),f=m=>{const w=(m-d.min)/(d.max-d.min||1);return a.y+a.h-w*a.h};r.strokeStyle=(l==null?void 0:l.gridLine)||(l==null?void 0:l.border)||"#e0e0e0",r.fillStyle=(l==null?void 0:l.text)||"#212121",r.lineWidth=1,r.font=`${(l==null?void 0:l.fontSize)||12}px ${(l==null?void 0:l.fontFamily)||"sans-serif"}`,r.textAlign="right",r.textBaseline="middle";for(const m of d.ticks){const w=f(m);r.beginPath(),r.moveTo(a.x,w),r.lineTo(a.x+a.w,w),r.stroke(),r.fillText(fmt(m,s,"y"),a.x-6,w)}r.textAlign="center",r.textBaseline="top";const u=a.w/(e.categories.length||1);e.categories.forEach((m,w)=>{const y=a.x+u*w+u/2;r.fillText(String(m),y,a.y+a.h+6)});const p=this.$kI(e,s);if(s.type==="line"||s.type==="area"){const m=new Map;for(const w of this.$bp){let y=m.get(w.seriesIndex);y||(y=[],m.set(w.seriesIndex,y)),y.push(w)}for(const[w,y]of m){y.sort((v,_)=>v.categoryIndex-_.categoryIndex),r.strokeStyle=p[w].color,r.lineWidth=2,r.setLineDash(dashFor(p[w].pattern)),r.beginPath(),y.forEach((v,_)=>_===0?r.moveTo(v.cx,v.cy):r.lineTo(v.cx,v.cy)),r.stroke(),r.setLineDash([]),r.fillStyle=p[w].color;for(const v of y)r.beginPath(),r.arc(v.cx,v.cy,MARKER_R,0,Math.PI*2),r.fill()}}else for(const m of this.$bp)r.fillStyle=p[m.seriesIndex].color,r.fillRect(m.x,m.y,m.w,m.h),paintPattern(r,m,p[m.seriesIndex].pattern)}$jn(e){var s;const i=(s=this.$U)==null?void 0:s.getBoundingClientRect();if(!i||i.width===0&&i.height===0)return{x:e.offsetX??0,y:e.offsetY??0};const n=i.width>0?this.$dd/i.width:1,r=i.height>0?this.$cC/i.height:1;return{x:(e.clientX-i.left)*n,y:(e.clientY-i.top)*r}}$ih(){return this.$bp.find(e=>e.categoryIndex===this.$H.cat&&e.seriesIndex===this.$H.series)??null}$kZ(){const e=this.$n;if(!e)return;const s=e.series[this.$H.series],i=e.categories[this.$H.cat],n=(s==null?void 0:s.data[this.$H.cat])??null,r=`${(s==null?void 0:s.name)??""}, ${i??""}: ${fmt(n,this.$Y,"tooltip")||t("chart.tooltipEmpty")}`;this.$ay&&(this.$ay.textContent=r);const l=this.$ih();l&&this.$ky(l,l.cx,l.cy)}$jQ(e){var s,i;const n=this.$n;return{seriesName:((s=n.series[e.seriesIndex])==null?void 0:s.name)??"",category:n.categories[e.categoryIndex]??"",value:((i=n.series[e.seriesIndex])==null?void 0:i.data[e.categoryIndex])??null,index:e.categoryIndex}}$is(e){var s;(s=this.$gP)==null||s.call(this,this.$jQ(e))}$ky(e,s,i){const n=this.$dc;if(!n||this.$Y.tooltip===!1)return;const r=this.$jQ(e);n.textContent=`${r.seriesName} · ${r.category}: ${fmt(r.value,this.$Y,"tooltip")}`,n.style.display="block",n.style.left=`${s+10}px`,n.style.top=`${i+10}px`}$gv(){this.$dc&&(this.$dc.style.display="none")}}function dashFor(o){switch(o){case"hatch":return[6,3];case"dot":return[2,3];case"cross":return[8,3,2,3];default:return[]}}function paintPattern(o,e,s){if(s==="solid"||!s)return;o.save(),o.beginPath(),o.rect(e.x,e.y,e.w,e.h),o.clip(),o.strokeStyle="rgba(255,255,255,0.55)",o.lineWidth=1;const i=5;if(s==="hatch"||s==="cross")for(let n=-e.h;n<e.w;n+=i)o.beginPath(),o.moveTo(e.x+n,e.y+e.h),o.lineTo(e.x+n+e.h,e.y),o.stroke();if(s==="cross")for(let n=0;n<e.w+e.h;n+=i)o.beginPath(),o.moveTo(e.x+n,e.y),o.lineTo(e.x+n-e.h,e.y+e.h),o.stroke();if(s==="dot"){o.fillStyle="rgba(255,255,255,0.6)";for(let n=e.y+i;n<e.y+e.h;n+=i)for(let r=e.x+i;r<e.x+e.w;r+=i)o.beginPath(),o.arc(r,n,1,0,Math.PI*2),o.fill()}o.restore()}function deviceRatio(){return typeof window<"u"&&window.devicePixelRatio?window.devicePixelRatio:1}const DEFAULT_MAX_POINTS=500,DEFAULT_DEBOUNCE_MS=50,DEFAULT_RESIZE_DEBOUNCE_MS=100,DEFAULT_SIZE={width:480,height:300};let _seq=0;class ChartManager{constructor(e){this.$dq=new Map,this.$a=e}createChart(e){var s;const i=`chart-${++_seq}`,n=this.$a.getContainer(),r=this.$kz(e),{adapter:l,engineFallback:a}=this.$mV(e),{panel:h,host:c,badgeBox:d,backdrop:f}=this.$ln(e,n),u={id:i,config:e,adapter:l,panel:h,badgeBox:d,host:c,backdrop:f,model:null,spec:null,snapshot:r,liveHandler:null,debounceTimer:null,resizeObserver:null,resizeDebounceTimer:null,renderSize:{...DEFAULT_SIZE},localEvents:new Map,destroyed:!1,instance:null};try{this.$dq.set(i,u);const{model:p,rangeFallback:g}=this.$iA(u);u.model=p,u.spec=this.$hP(e,p),u.renderSize=this.$na(e,c),l.init(c,u.spec),l.resize(u.renderSize.width,u.renderSize.height),l.render(p,u.spec),(s=l.onPointClick)==null||s.call(l,w=>this.$mF(u,w)),this.$ke(u,g,a),e.live!==!1&&this.$nq(u),this.$le(u);const m=this.$gF(u);return this.$lf(u),this.$M(u,"chartCreate",m),this.$a.emit("chartCreate",m),m}catch(p){try{this._destroy(u)}catch{}throw p}}$na(e,s){var i;const n=e.size??DEFAULT_SIZE,r=s.clientWidth;return{width:((i=e.size)==null?void 0:i.width)??(r>0?r:n.width),height:n.height}}$le(e){if(typeof ResizeObserver>"u")return;const s=DEFAULT_RESIZE_DEBOUNCE_MS,i=new ResizeObserver(()=>{e.destroyed||(clearTimeout(e.resizeDebounceTimer),e.resizeDebounceTimer=setTimeout(()=>{if(e.destroyed)return;const n=e.host.clientWidth;n>0&&n!==e.renderSize.width&&(e.renderSize={width:n,height:e.renderSize.height},e.adapter.resize(e.renderSize.width,e.renderSize.height))},s))});i.observe(e.host),e.resizeObserver=i}getCharts(){return[...this.$dq.values()].filter(e=>!e.destroyed).map(e=>this.$gF(e))}destroyCharts(){for(const e of[...this.$dq.values()])this._destroy(e)}$kz(e){var s,i;if(e.source.kind!=="range")return null;const n=e.source.range??((i=(s=this.$a).getActiveRange)==null?void 0:i.call(s))??null;if(!n)return null;const r=this.$a.getFlatModel(),l=this.$a.getVisibleColumns(),a=[];for(let c=n.startRow;c<=n.endRow;c++){const d=r.rowIdOfFlat(c);d!=null&&a.push(d)}const h=[];for(let c=n.startCol;c<=n.endCol;c++){const d=l[c];d&&h.push(d.field)}return{rowIds:a,fields:h}}$iA(e){var s;const i=e.config,n=((s=this.$a.getOptions())==null?void 0:s.chart)??{},r=i.numberFormat??n.numberFormat,l=this.$lN(e),a=extractChartData(i.source,l,{category:i.category,series:i.series??(i.source.kind==="columns"?i.source.series:void 0),aggregate:i.aggregate,title:i.title,numberFormat:r}),h=i.maxPoints??n.maxPoints??DEFAULT_MAX_POINTS;return{model:downsampleModel(a.model,h,i.type,{title:i.title,numberFormat:r}).model,rangeFallback:a.rangeFallback}}$lN(e){const s=e.snapshot;return{getAllRows:()=>this.$a.getAllRows(),getSelectedRows:()=>this.$a.getSelectedRows(),getCheckedRows:()=>this.$a.getCheckedRows(),getVisibleColumns:()=>this.$a.getVisibleColumns(),getActiveRange:this.$a.getActiveRange?()=>this.$a.getActiveRange():void 0,getRangeRows:s?()=>s.rowIds.map(i=>this.$a.getRowById(i)).filter(i=>!!i):void 0,getRangeColumns:s?()=>{const i=this.$a.getVisibleColumns(),n=new Set(s.fields),r=i.filter(l=>n.has(l.field));return r.length?r:i}:void 0}}$hP(e,s){var i;const n=((i=this.$a.getOptions())==null?void 0:i.chart)??{},r=this.$nk(),l={type:e.type,theme:r,a11y:s.meta.a11yTable,palette:e.palette??n.palette??r.palette};e.title!==void 0&&(l.title=e.title),e.legend!==void 0&&(l.legend=e.legend),e.tooltip!==void 0&&(l.tooltip=e.tooltip),e.axis!==void 0&&(l.axis=e.axis);const a=e.numberFormat??n.numberFormat;return a&&(l.numberFormat=a),l}$bA(e,s,i){return getComputedStyle(e).getPropertyValue(s).trim()||i}$nk(){var e;const s=this.$a.getContainer(),i=((e=this.$a.getOptions())==null?void 0:e.chart)??{},n=this.$bA(s,"--og-primary","#1976d2"),r=this.$bA(s,"--og-font-size","13px"),l=parseInt(r,10)||13;return{primary:n,border:this.$bA(s,"--og-border-color","#e0e0e0"),text:this.$bA(s,"--og-row-color","#212121"),bg:this.$bA(s,"--og-row-bg","#ffffff"),gridLine:this.$bA(s,"--og-border-color","#e0e0e0"),fontFamily:getComputedStyle(s).fontFamily||"sans-serif",fontSize:l,palette:(i.palette&&i.palette.length?i.palette:OKABE_ITO).slice()}}$ln(e,s){var i,n;const r=e.placement??((n=(i=this.$a.getOptions())==null?void 0:i.chart)==null?void 0:n.placement)??"docked",l=e.size??DEFAULT_SIZE,a=document.createElement("div");a.className="og-chart-panel",a.setAttribute("data-placement",r),a.setAttribute("role","group"),a.setAttribute("aria-label",e.title??this.$a.t("chart.defaultTitle"));const h=document.createElement("div");h.className="og-chart-badges",h.style.cssText="display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px;";const c=document.createElement("div");c.className="og-chart-host",c.style.cssText=`position:relative;width:${l.width}px;max-width:100%;`;let d=null;const f=this.$bA(s,"--og-row-bg","#ffffff"),u=this.$bA(s,"--og-border-color","#e0e0e0"),p=`box-sizing:border-box;padding:10px;background:${f};border:1px solid ${u};border-radius:6px;`;return r==="modal"?(d=document.createElement("div"),d.className="og-chart-backdrop",d.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:1000;display:flex;align-items:center;justify-content:center;",a.style.cssText=p+"max-width:90vw;max-height:90vh;overflow:auto;box-shadow:0 8px 30px rgba(0,0,0,0.3);",d.appendChild(a),d.addEventListener("click",g=>{g.target===d&&this.$lz(a)}),document.body.appendChild(d)):r==="inline"?(a.style.cssText=p+"width:100%;",(e.mount??s).appendChild(a)):r==="floating"?(a.style.cssText=p+"position:absolute;top:12px;right:12px;z-index:20;box-shadow:0 4px 16px rgba(0,0,0,0.18);",s.appendChild(a)):(a.style.cssText=p+"width:100%;margin-top:8px;",s.appendChild(a)),a.appendChild(h),a.appendChild(c),{panel:a,host:c,badgeBox:h,backdrop:d}}$ke(e,s,i){var n;const r=e.badgeBox;r.innerHTML="";const l=e.model.meta,a=[];l.sampled&&l.sampledFrom&&a.push(this.$a.t("chart.badgeSampled",{to:(n=l.sampledTo)==null?void 0:n.toLocaleString(),from:l.sampledFrom.toLocaleString()})),l.aggregatedOp&&a.push(this.$a.t("chart.badgeAggregated",{op:l.aggregatedOp})),l.pieReducedToFirst&&a.push(this.$a.t("chart.badgePieFirstSeries")),l.negativesAbsInPie&&a.push(this.$a.t("chart.badgeNegativesAbs")),s&&a.push(this.$a.t("chart.badgeRangeFallback")),i&&a.push(this.$a.t("chart.badgeEngineFallback",{engine:i}));for(const h of a){const c=document.createElement("span");c.className="og-chart-badge",c.style.cssText="display:inline-block;padding:2px 8px;font-size:11px;border-radius:10px;background:#fff3cd;color:#8a6d3b;border:1px solid #ffe08a;",c.textContent=h,r.appendChild(c)}r.style.display=a.length?"flex":"none",a.length&&this.$a.announce(this.$a.t("chart.announcePrefix",{badges:a.join(", ")}))}$nq(e){var s;const n=(((s=this.$a.getOptions())==null?void 0:s.chart)??{}).debounceMs??DEFAULT_DEBOUNCE_MS,r=()=>{e.destroyed||(clearTimeout(e.debounceTimer),e.debounceTimer=setTimeout(()=>{e.destroyed||this.$fh(e)},n))};e.liveHandler=r,this.$a.on("dataChange",r),this.$a.on("formulaRecalc",r)}$fh(e){if(e.destroyed)return;const{model:s,rangeFallback:i}=this.$iA(e);e.model=s,e.spec=this.$hP(e.config,s),e.adapter.render(s,e.spec),this.$ke(e,i,null),this.$M(e,"chartRender",{id:e.id,model:s}),this.$a.emit("chartRender",{id:e.id,model:s})}$mV(e){var s,i;const n=e.engine??((i=(s=this.$a.getOptions())==null?void 0:s.chart)==null?void 0:i.defaultEngine)??"builtin";return n&&typeof n=="object"?{adapter:n,engineFallback:null}:n==="chartjs"||n==="echarts"?{adapter:new CanvasAdapter,engineFallback:n}:{adapter:new CanvasAdapter,engineFallback:null}}$mF(e,s){this.$M(e,"chartPointClick",{id:e.id,point:s}),this.$a.emit("chartPointClick",{id:e.id,point:s})}$gF(e){if(e.instance)return e.instance;const s={id:e.id,update:i=>{e.destroyed||(i&&(e.config={...e.config,...i}),i&&(i.source||i.category||i.series)&&(e.snapshot=this.$kz(e.config)),this.$fh(e))},refresh:()=>this.$fh(e),setType:i=>{e.destroyed||(e.config={...e.config,type:i},this.$fh(e))},destroy:()=>this._destroy(e),toBlob:i=>e.adapter.toBlob?e.adapter.toBlob(i):Promise.resolve(null),getModel:()=>e.model,on:(i,n)=>this.$eS(e,i,n)};return e.instance=s,s}$lf(e){var s;const i=((s=this.$a.getOptions())==null?void 0:s.chart)??{},n=this.$gF(e);typeof i.onChartCreate=="function"&&i.onChartCreate(n),typeof i.onChartRender=="function"&&this.$eS(e,"chartRender",i.onChartRender),typeof i.onChartPointClick=="function"&&this.$eS(e,"chartPointClick",i.onChartPointClick),typeof i.onChartDestroy=="function"&&this.$eS(e,"chartDestroy",i.onChartDestroy)}$eS(e,s,i){const n=e.localEvents.get(s)??[];n.push(i),e.localEvents.set(s,n)}$M(e,s,...i){for(const n of e.localEvents.get(s)??[])try{n(...i)}catch{}}$lz(e){for(const s of this.$dq.values())if(s.panel===e){this._destroy(s);return}}_destroy(e){var s;if(!e.destroyed){e.destroyed=!0,e.liveHandler&&(this.$a.off("dataChange",e.liveHandler),this.$a.off("formulaRecalc",e.liveHandler)),clearTimeout(e.debounceTimer),clearTimeout(e.resizeDebounceTimer);try{(s=e.resizeObserver)==null||s.disconnect()}catch{}try{e.adapter.destroy()}catch{}(e.backdrop??e.panel).remove(),this.$M(e,"chartDestroy",{id:e.id}),this.$a.emit("chartDestroy",{id:e.id}),e.localEvents.clear(),this.$dq.delete(e.id)}}}class OverrideKernel{constructor(e,s){this.$ba=new Map,this.$gr=new Map,this.$A=new Map,this.$fy=new Map,this._callPath=[],this.$m=e,this.$fz=(s==null?void 0:s.strict)??!0,this.$W=(s==null?void 0:s.maxDepth)??32}override(e,s,i={}){if(typeof s!="function")throw new TypeError(`OverrideKernel.override: fn for "${e}" must be a function`);if(!this.$ba.has(e)){const r=this.$m[e];if(typeof r!="function")throw new TypeError(`OverrideKernel.override: host["${e}"] is not a function`);this.$gr.set(e,Object.prototype.hasOwnProperty.call(this.$m,e)),this.$ba.set(e,r.bind(this.$m))}const n=this.$A.get(e)??[];return n.push({fn:s,opts:i}),this.$A.set(e,n),this.$m[e]=this.$ll(e),this.$m}$ll(e){var s;const i=this.$ba.get(e),n=this.$A.get(e)??[],r=n.reduce((d,f)=>(...u)=>f.fn(d,...u),i),l=((s=n[n.length-1])==null?void 0:s.opts)??{},a=l.reentrant===!0,h=l.onError==="fallback",c=this;return function(...d){if(!a&&c._callPath.indexOf(e)!==-1)return i(...d);if(c._callPath.length>=c.$W){if(c.$fz&&!h)throw new Error(`OverrideKernel: max override depth (${c.$W}) exceeded at "${e}"`);return i(...d)}c._callPath.push(e);try{return r(...d)}catch(f){if(h&&!c.$fz)return console.warn(`[og.override:${e}]`,f),i(...d);if(h&&c.$fz)return console.warn(`[og.override:${e}]`,f),i(...d);throw f}finally{c._callPath.pop()}}}strategy(e,s){if(typeof s!="function")throw new TypeError(`OverrideKernel.strategy: fn for "${e}" must be a function`);return this.$fy.set(e,s),this.$m}getStrategy(e,s){return this.$fy.get(e)??s}hasStrategy(e){return this.$fy.has(e)}restore(e){return this.$ba.has(e)?(this.$gr.get(e)?this.$m[e]=this.$ba.get(e):delete this.$m[e],this.$ba.delete(e),this.$gr.delete(e),this.$A.delete(e),this.$m):this.$m}restoreAll(){for(const e of[...this.$ba.keys()])this.restore(e);return this.$fy.clear(),this._callPath=[],this.$m}hasOverride(e){return this.$ba.has(e)}getOverrideNames(){return[...this.$ba.keys()]}}const NOTHING=()=>null;function late(o){return o===void 0?NOTHING:typeof o=="function"?o:()=>o}const RAF_FRAME={request:o=>requestAnimationFrame(o),cancel:o=>cancelAnimationFrame(o)},NO_WINDOW=ColumnWindow.full(0),NO_WIDTHS=Object.freeze([]),NO_PINNED=Object.freeze([]),NO_BOX=Object.freeze({scrollLeft:0,width:0}),SKIP_BODY=Object.freeze({skipScope:"body"}),UNPINNED=Object.freeze({editRow:null,editCol:null,focusRow:null});class RenderScheduler{constructor(e,s){var i;this.$bK=0,this.$cc=new RenderRequestAccumulator,this.$je=null,this.$cA=null,this._depth=0,this.$aG=!1,this.$fZ=null,this.$jN=0,this.$fk=!1,this.$I=e,this.$jO=s.planner,this.$aC=s.paint,this.$iD=s.footer??null,this.$bE=s.sort??null,this.$e=late(s.geometry),this.$t=late(s.applier),this.$gs=s.headerLayout??null,this.$gt=s.headerWraps??null,this.$bY=s.overlay??null,this.$aa=s.window&&s.scroll&&s.shape&&s.body?{window:late(s.window),scroll:late(s.scroll),shape:s.shape,body:late(s.body),pinned:s.pinnedColumns??null}:null,this.$bK=((i=this.$e())==null?void 0:i.version)??0,this.$r=s.sortList??null}get lastPlan(){return this.$je}get depth(){return this._depth}submit(e){if(!this.$aG){if(e.detail.sync&&e.detail.rows!==null&&this._depth===0&&this.$cc.pending){this.$cV(e);return}this.$cc.add(e),e.detail.sync?(this.$fN(),this.$cV()):this.$ch()}}flushNow(){this.$aG||!this.$cc.pending||(this.$fN(),this.$cV())}destroy(){this.$fN(),this.$aG=!0,this.$cc.clear()}$ch(){this.$cA===null&&(this.$cA=this.$I.request(()=>{if(this.$cA=null,!(this.$aG||!this.$cc.pending))try{this.$cV()}catch(e){console.error("[OpenGrid] render frame failed",e)}}))}$fN(){this.$cA!==null&&(this.$I.cancel(this.$cA),this.$cA=null)}$cV(e){if(this._depth>0){this.$fk=!0;return}this._depth++;try{let s=e;do{this.$fk=!1;const i=s??this.$cc.freeze();s=void 0;const n=this.$jO.plan(i,this.$am(),this.$mt(i.detail.rows));this.$je=n,this.$lE(n)}while(this.$fk&&this.$cc.pending)}finally{this._depth--,this.$fk=!1}}$mt(e){let s;if(e===null){const[r,l]=this.$aC.visibleRows();s={start:r,end:l+1}}else s=e;const i=this.$e(),n=this.$mu();return i===null||this.$t()===null?{rows:s,columns:n,columnWidths:NO_WIDTHS,geometryVersion:0,appliedGeometryVersion:0}:{rows:s,columns:n,columnWidths:i.widths(),geometryVersion:i.version,appliedGeometryVersion:this.$bK}}$mu(){var e;const s=this.$aa,i=s===null?null:s.window();if(s===null||i===null)return NO_WINDOW;const n=s.pinned===null?NO_PINNED:s.pinned(),r=((e=s.scroll())==null?void 0:e.box)??NO_BOX;return i.next(this.$im(),{box:r,pinned:n},s.shape())}$im(){var e;const s=this.$aa;return s===null?NO_WINDOW:((e=s.body())==null?void 0:e.drawn.columns)??null}$am(){var e,s;const i=((s=(e=this.$aa)==null?void 0:e.body())==null?void 0:s.drawn.diffBlocked)??!0;return{rows:this.$fZ,columns:this.$im(),pinned:UNPINNED,focus:null,diffBlocked:i,coverWidths:NO_WIDTHS}}$lE(e){this.$lH(e),this.$lK(e),this.$lF(e),this.$lI(e),this.$lG(e),this.$lJ(e)}$lH(e){const s=this.$e(),i=this.$t();if(!e.geometry||s===null||i===null)return;const n=s.changesSince(this.$bK);this.$bK=n.version,!n.none&&(i.applyChange(n,e.rows==="rebuild"||e.rows==="clear"?SKIP_BODY:void 0),this.$gs!==null&&(this.$gt===null||this.$gt())&&this.$gs())}$lJ(e){e.overlay&&e.rows==="none"&&this.$bY!==null&&this.$bY.repaint()}$lI(e){const s=this.$bE,i=this.$r;e.header==="sortIndicator"&&s!==null&&i!==null&&s.update(i())}$lF(e){var s,i;e.cols==="shift"&&e.rows!=="diff"&&((i=(s=this.$aa)==null?void 0:s.body())==null||i.update(e.next,"none","shift"))}$lK(e){const s=e.next.rows;if(e.rows==="none")return;const i=e.rows==="clear"||s==="clear"?"clear":s,n=++this.$jN;this.$fZ=null,i==="clear"?this.$aC.paintRows(0,-1):this.$aa===null?this.$aC.paintRows(i.start,i.end-1):e.rows==="diff"?this.$aC.paintRows(i.start,i.end-1,e.next.columns,"diff"):this.$aC.paintRows(i.start,i.end-1,e.next.columns),this.$jN===n&&(this.$fZ=i)}$lG(e){const s=this.$iD;s!==null&&(e.footer==="rebuild"?s.paint():e.footer==="values"&&s.updateValues())}}const ICON_CLASS="og-sort-icon",ARROW={asc:" ↑",desc:" ↓"},ARIA={asc:"ascending",desc:"descending"};class HeaderSortIndicator{constructor(){this.$dj=[],this.$fb=null}bind(e,s,i){const n=this.$iW(e),r=e.classList.contains("og-sorted")?(n==null?void 0:n.textContent)===ARROW.desc?"desc":"asc":null;this.$dj.push({th:e,field:s,sortable:i,dir:r})}update(e){var s;for(const i of this.$dj){const n=((s=e.find(r=>r.field===i.field))==null?void 0:s.dir)??null;n!==i.dir&&this.$aC(i,n)}}setPressed(e){if(this.$fb!==e){for(const s of this.$dj)s.field===this.$fb&&s.th.classList.remove("og-sorting"),s.field===e&&s.th.classList.add("og-sorting");this.$fb=e}}setBusy(e,s,i){for(const n of this.$dj)n.field===e&&(s?n.th.setAttribute("aria-busy","true"):n.th.removeAttribute("aria-busy"))}release(){this.$dj=[],this.$fb=null}$aC(e,s){const i=e.th;let n=this.$iW(i);if(s){if(i.classList.add("og-sorted"),!n){n=_el("span",ICON_CLASS);const r=i.firstElementChild;i.insertBefore(n,r?r.nextSibling:i.firstChild)}n.textContent=ARROW[s]}else i.classList.remove("og-sorted"),n==null||n.remove();e.sortable&&i.setAttribute("aria-sort",s?ARIA[s]:"none"),e.dir=s}$iW(e){for(let s=e.firstElementChild;s;s=s.nextElementSibling)if(s.classList.contains(ICON_CLASS))return s;return null}}const BOUNDS=Object.freeze({min:40,max:1/0});class ResizeSinkAdapter{constructor(e){this.$m=e}boundsOf(e){return BOUNDS}commit(e,s){this.$m.commitWidth(e,s)}needsHeaderRemeasure(){return this.$m.hasWrappedHeader()}remeasureHeader(){this.$m.relayoutHeaderIfChanged()}}const PLAN_TABLE=[{bit:Change.All,when:"always",feature:null,rows:"rebuild",cols:"none",header:"rebuild",footer:"values",geometry:!0,overlay:!0,extra:"none",offHeader:"rebuild",offFooter:"values"},{bit:0,when:"explicitClear",feature:null,rows:"clear",cols:"none",header:"none",footer:"none",geometry:!1,overlay:!1,extra:"none",offHeader:"none",offFooter:"none"},{bit:0,when:"explicitRange",feature:null,rows:"rebuild",cols:"none",header:"none",footer:"none",geometry:!1,overlay:!0,extra:"none",offHeader:"none",offFooter:"none"},{bit:Change.Columns,when:"always",feature:null,rows:"rebuild",cols:"none",header:"rebuild",footer:"rebuild",geometry:!0,overlay:!0,extra:"none",offHeader:"rebuild",offFooter:"rebuild"},{bit:Change.Appearance,when:"always",feature:null,rows:"rebuild",cols:"none",header:"rebuild",footer:"rebuild",geometry:!0,overlay:!0,extra:"none",offHeader:"rebuild",offFooter:"rebuild"},{bit:Change.Viewport,when:"always",feature:"columnWindow",rows:"viewportRows",cols:"shiftIfChanged",header:"none",footer:"none",geometry:!0,overlay:!0,extra:"none",offHeader:"none",offFooter:"none"},{bit:Change.RowSet,when:"always",feature:null,rows:"rebuild",cols:"none",header:"none",footer:"values",geometry:!1,overlay:!0,extra:"none",offHeader:"none",offFooter:"values"},{bit:Change.RowOrder,when:"always",feature:"sortIndicatorOnly",rows:"rebuild",cols:"none",header:"sortIndicator",footer:"none",geometry:!1,overlay:!0,extra:"none",offHeader:"rebuild",offFooter:"values"},{bit:Change.SortIndicator,when:"always",feature:"sortIndicatorOnly",rows:"none",cols:"none",header:"sortIndicator",footer:"none",geometry:!1,overlay:!1,extra:"none",offHeader:"rebuild",offFooter:"none"},{bit:Change.RowsScrolled,when:"rowsSame",feature:"scrollSkip",rows:"none",cols:"none",header:"none",footer:"none",geometry:!1,overlay:!1,extra:"none",offHeader:"none",offFooter:"none"},{bit:Change.RowsScrolled,when:"rowsChanged",feature:"rowDiff",rows:"diffOrRebuild",cols:"none",header:"none",footer:"none",geometry:!1,overlay:!0,extra:"none",offHeader:"none",offFooter:"none"},{bit:Change.ColsScrolled,when:"colsSame",feature:"scrollSkip",rows:"none",cols:"none",header:"none",footer:"none",geometry:!1,overlay:!1,extra:"none",offHeader:"none",offFooter:"none"},{bit:Change.ColsScrolled,when:"colsChanged",feature:"columnWindow",rows:"none",cols:"shiftIfChanged",header:"none",footer:"none",geometry:!1,overlay:!0,extra:"none",offHeader:"none",offFooter:"none"},{bit:Change.ColWidth,when:"always",feature:"geometryOnly",rows:"none",cols:"shiftIfChanged",header:"none",footer:"none",geometry:!0,overlay:!0,extra:"refill",offHeader:"none",offFooter:"none"},{bit:Change.CellValue,when:"always",feature:"smallUpdates",rows:"cellsOrRebuild",cols:"none",header:"none",footer:"values",geometry:!1,overlay:!1,extra:"cells",offHeader:"none",offFooter:"values"},{bit:Change.RowState,when:"always",feature:"smallUpdates",rows:"none",cols:"none",header:"none",footer:"none",geometry:!1,overlay:!1,extra:"rowState",offHeader:"none",offFooter:"none"},{bit:Change.Focus,when:"always",feature:"smallUpdates",rows:"none",cols:"none",header:"none",footer:"none",geometry:!1,overlay:!1,extra:"focus",offHeader:"none",offFooter:"none"},{bit:Change.Range,when:"always",feature:"smallUpdates",rows:"none",cols:"none",header:"none",footer:"none",geometry:!1,overlay:!0,extra:"none",offHeader:"none",offFooter:"none"}],isSpan=o=>o!==null&&o!=="clear";function rowsSame(o){const e=o.drawn.rows,s=o.next.rows;return isSpan(e)&&isSpan(s)&&e.start===s.start&&e.end===s.end}function colsSame(o){const e=o.drawn.columns;return e!==null&&e.equals(o.next.columns)}function diffOrRebuild(o){const e=o.drawn.rows,s=o.next.rows;if(!o.f.rowDiff||o.drawn.diffBlocked||!isSpan(e)||!isSpan(s))return"rebuild";const i=e.end-e.start;if(i<=0)return"rebuild";const n=Math.max(0,Math.min(e.end,s.end)-Math.max(e.start,s.start));return n===0?"rebuild":Math.max(s.end-s.start-n,i-n)<i*o.ratio?"diff":"rebuild"}const WHEN={always:()=>!0,rowsSame,rowsChanged:o=>!rowsSame(o),colsSame,colsChanged:o=>!colsSame(o),explicitClear:o=>o.req.detail.rows==="clear",explicitRange:o=>isSpan(o.req.detail.rows)},ROWS={none:()=>"none",rebuild:()=>"rebuild",clear:()=>"clear",diffOrRebuild,viewportRows:o=>rowsSame(o)?"none":diffOrRebuild(o),cellsOrRebuild:o=>o.req.detail.cells.length===0?"rebuild":"none"},EXTRA={none:()=>{},refill:o=>{o.refill=refillColumns(o.drawn,o.next)},cells:o=>{o.cells=o.req.detail.cells},rowState:o=>{o.stateRows=drawnRows(o.drawn)},focus:o=>{const e=o.drawn.focus,s=o.req.detail.focusTo;(s!==null||e!==null)&&(o.focus=Object.freeze({from:e,to:s}))}},ROW_RANK={none:0,diff:1,rebuild:2,clear:3},HEADER_RANK={none:0,sortIndicator:1,rebuild:2},FOOTER_RANK={none:0,values:1,rebuild:2},ROW_BY_RANK=["none","diff","rebuild","clear"],HEADER_BY_RANK=["none","sortIndicator","rebuild"],FOOTER_BY_RANK=["none","values","rebuild"],NO_NUMBERS=Object.freeze([]),NO_CELLS=Object.freeze([]),ALL_OFF=Object.freeze({sortIndicatorOnly:!1,footerGating:!1,scrollSkip:!1,geometryOnly:!1,columnWindow:!1,rowDiff:!1,smallUpdates:!1});class RenderPlanner{constructor(e){const s=e==null?void 0:e.diffMaxRatio;this.$dV=s!==void 0&&Number.isFinite(s)&&s>0?s:.5,this.$iC=Object.freeze({...ALL_OFF,...e==null?void 0:e.features})}plan(e,s,i){const n=e.changes;if(n===0)return makePlan("none","none","none","none",!1,NO_NUMBERS,NO_NUMBERS,null,NO_CELLS,!1,i);const r={req:e,drawn:s,next:i,f:this.$iC,ratio:this.$dV,rows:0,shift:!1,header:0,footer:0,geometry:!1,overlay:!1,refill:NO_NUMBERS,stateRows:NO_NUMBERS,focus:null,cells:NO_CELLS},l=n===Change.All;for(let f=0;f<PLAN_TABLE.length;f++){const u=PLAN_TABLE[f];if(!(u.bit===0?!0:u.bit===Change.All?l:!l&&(n&u.bit)!==0)||!WHEN[u.when](r))continue;if(r.geometry=r.geometry||u.geometry,u.feature!==null&&!r.f[u.feature]){r.rows=Math.max(r.rows,ROW_RANK.rebuild),r.header=Math.max(r.header,HEADER_RANK[u.offHeader]),r.footer=Math.max(r.footer,FOOTER_RANK[u.offFooter]),r.overlay=!0;continue}let g=ROWS[u.rows](r);u.cols==="shiftIfChanged"&&!colsSame(r)&&(s.columns!==null&&r.f.columnWindow?r.shift=!0:g="rebuild"),r.rows=Math.max(r.rows,ROW_RANK[g]),r.header=Math.max(r.header,HEADER_RANK[u.header]),r.footer=Math.max(r.footer,FOOTER_RANK[u.footer]),r.overlay=r.overlay||u.overlay,EXTRA[u.extra](r)}const a=ROW_BY_RANK[r.rows];let h=r.footer;!r.f.footerGating&&a!=="none"&&(h=Math.max(h,FOOTER_RANK.values));const c=a==="rebuild"||a==="clear",d=r.refill;return makePlan(a,!c&&r.shift?"shift":"none",HEADER_BY_RANK[r.header],FOOTER_BY_RANK[h],r.geometry&&i.geometryVersion!==i.appliedGeometryVersion,c?NO_NUMBERS:d,c?NO_NUMBERS:r.stateRows,c?null:r.focus,c?NO_CELLS:r.cells,r.overlay,i)}}function refillColumns(o,e){const s=o.coverWidths,i=e.columnWidths,n=e.columns.segments,r=[];for(let l=0;l<n.length;l++){const a=n[l];for(let h=a.from;h<=a.to;h++){const c=s[h];c!==void 0&&i[h]>c&&r.push(h)}}return r.length===0?NO_NUMBERS:Object.freeze(r)}function drawnRows(o){const e=o.rows;if(!isSpan(e)||e.end<=e.start)return NO_NUMBERS;const s=new Array(e.end-e.start);for(let i=0;i<s.length;i++)s[i]=e.start+i;return Object.freeze(s)}function makePlan(o,e,s,i,n,r,l,a,h,c,d){const f=o==="none"&&e==="none"&&s==="none"&&i==="none"&&!n&&!c&&r.length===0&&l.length===0&&a===null&&h.length===0;return Object.freeze({rows:o,cols:e,header:s,footer:i,geometry:n,refillColumns:r,rowStateRows:l,focus:a,cells:h,overlay:c,next:d,empty:f})}const ROW_ID_FIELD$2="_ogRowId";class GridComposer{static compose(e,s,i,n){const r=GridComposer.buildCoreServices(e,s,i),l=GridComposer.buildFormula(e,r),a=GridComposer.buildManagers(e,r,l,n),h=GridComposer.buildOverrideKernel(e,a);return{mounted:GridComposer.mount(e,h)}}static buildCoreServices(e,s,i){const n=typeof s=="string"?document.querySelector(s):s;if(!n)throw new Error(`OpenGrid: container not found: ${s}`);if(e._container=n,e._options={height:"100%",width:"100%",rowHeight:32,headerHeight:34,footerHeight:30,autoHeight:!1,fillWidth:!1,defaultColumnWidth:100,virtualColumns:!0,editable:!1,editMode:"dblclick",history:!0,historySize:100,selection:"single",clipboard:!0,sortable:!0,multiSort:!0,filterable:!0,defaultSort:[],frozenColumns:0,frozenRows:0,rowNumber:!1,stateColumn:!1,checkColumn:!1,draggable:!1,crossGrid:!1,crossGridMapping:"auto",mergeCells:!1,groupBy:[],summary:void 0,treeMode:"auto",treeId:"id",treeParentId:"parentId",expandOnLoad:!1,pagination:!1,pageSize:50,footer:void 0,footerPosition:"bottom",theme:"default",skin:"default",cssVars:{},ariaLabel:"OPEN_GRID 데이터 그리드",...i},e._data=new DataLayer(ROW_ID_FIELD$2),e._flatModel=new FlatRowModel({getDataLayer:()=>e._data,rowIdField:ROW_ID_FIELD$2}),e._rowMgr=new RowManager(e._data),e._colLayout=new ColumnLayout(e._options.columns,e._options.frozenColumns),i.locale||i.messages){const r=localeRegistry.child();i.messages&&r.applyOverrides(i.messages),i.locale&&(r.setActive(i.locale),e._container.setAttribute("lang",r.meta().intlLocale)),e._locales=r}else e._locales=null;return e._sortIndicator=new HeaderSortIndicator,e._scheduler=new RenderScheduler(RAF_FRAME,{planner:new RenderPlanner({features:{footerGating:!0,sortIndicatorOnly:!0,scrollSkip:!0,geometryOnly:!0,columnWindow:!0,rowDiff:!0}}),paint:{paintRows:(r,l,a,h)=>e._doRender(r,l,a,h),visibleRows:()=>e._visRange()},sort:e._sortIndicator,sortList:()=>e._sfMgr.sortList,geometry:()=>{var r;return((r=e._render)==null?void 0:r.geometry)??null},applier:()=>{var r;return((r=e._renderer)==null?void 0:r.applier)??null},headerLayout:()=>{var r;return(r=e._render)==null?void 0:r.relayoutHeaderIfChanged()},headerWraps:()=>{var r;return((r=e._render)==null?void 0:r.hasWrappedHeader())??!1},overlay:{repaint:()=>e._rangeMgr.repaint()},window:()=>{var r;return((r=e._render)==null?void 0:r.windowPolicy)??null},scroll:()=>{var r;return((r=e._render)==null?void 0:r.scroll)??null},shape:()=>e._render.shape(),pinnedColumns:()=>e._editMgr.pinnedColumns(),body:()=>{var r;return((r=e._renderer)==null?void 0:r.bodyView)??null},footer:{paint:()=>e._footerMgr.paint(),updateValues:()=>e._footerMgr.updateValues()}}),{_phase:"core"}}static buildFormula(e,s){var i,n;return e._formula=new FormulaController({getData:()=>e._data,getColLayout:()=>e._colLayout,getFlatModel:()=>e._flatModel,getRecalc:()=>e._recalc,getDirtySeeds:()=>e._formulaDirtySeeds,getOptions:()=>e._options,emit:(r,l)=>{e.emit(r,l)},announce:r=>e._announce(r),t:(r,l)=>e.t(r,l),submitRender:r=>e._scheduler.submit(r)}),e._recalc=new RecalcCoordinator({accessor:e._formula.buildAccessor(),setComputedValue:(r,l,a)=>e._data.setComputedValueByRowId(r,l,a),onFormulaError:(r,l,a)=>e._formula.handleFormulaError(r,l,a),refMode:((i=e._options.formula)==null?void 0:i.refMode)??"stable",divisionPrecision:((n=e._options.formula)==null?void 0:n.divisionPrecision)??30}),{_phase:"formula"}}static buildManagers(e,s,i,n){return e._editMgr=new CellEditManager({revealColumn:r=>{var l;return(l=e._render)==null?void 0:l.revealColumn(r)},getBodyPin:()=>{var r;return((r=e._renderer)==null?void 0:r.bodyView)??null},data:e._data,colLayout:e._colLayout,getRenderer:()=>e._renderer,getContainer:()=>e._container,getOptions:()=>e._options,emit:(r,...l)=>e.emit(r,...l),submitRender:r=>e._scheduler.submit(r),announce:r=>e._announce(r),t:(r,l)=>e.t(r,l),writeCell:(r,l,a)=>e.writeCell(r,l,a),scrollToRow:r=>{var l;return(l=e._vs)==null?void 0:l.scrollToRow(r)},getVisibleLeaves:()=>e._colLayout.visibleLeaves,hasCellFormula:(r,l)=>e.hasCellFormula(r,l),getCellFormula:(r,l)=>e.getCellFormula(r,l),setCellFormula:(r,l,a)=>e.setCellFormula(r,l,a),clearCellFormula:(r,l)=>e.clearCellFormula(r,l)}),e._exportMgr=new ExportManager({getData:()=>e._data.getData(),getColLayout:()=>e._colLayout,getColWidths:()=>e._colWidths,getOptions:()=>e._options,getContainer:()=>e._container,getMaskEnabled:r=>e.getMaskEnabled(r),getWsManager:()=>e._wsManager,getStrategy:(r,l)=>e._ovk.getStrategy(r,l),t:(r,l)=>e.t(r,l),getMeta:()=>(e._locales??localeRegistry).meta()}),e._footerMgr=new FooterManager({getData:()=>e._data.getData(),getColLayout:()=>e._colLayout,getColWidths:()=>e._colWidths,getGeometry:()=>e._render.currentGeometry(),getOptions:()=>e._options,getContainer:()=>e._container,getStrategy:(r,l)=>e._ovk.getStrategy(r,l)}),e._kbdMgr=new KeyboardManager({getEditMgr:()=>e._editMgr,getRowMgr:()=>e._rowMgr,getData:()=>e._data,getColLayout:()=>e._colLayout,getOptions:()=>e._options,setFocusCell:(r,l)=>e._setFocusCell(r,l),handleRowDrop:(r,l)=>e._handleRowDrop(r,l),submitRender:r=>e._scheduler.submit(r),announce:r=>e._announce(r),t:(r,l)=>e.t(r,l),emit:(r,...l)=>e.emit(r,...l),visRange:()=>e._visRange(),handleCellKeyEvt:(r,l)=>e._handleCellKeyEvt(r,l),writeCells:r=>e.writeCells(r),getRangeHooks:()=>e._rangeMgr}),e._sfMgr=new SortFilterManager({sortIndicator:e._sortIndicator,getData:()=>e._data,getColLayout:()=>e._colLayout,getFindFilter:()=>e._findMgr.findFilter,getVs:()=>e._vs,getPagination:()=>e._pagination,getOptions:()=>e._options,renderHeader:()=>e._renderHeader(),submitRender:r=>e._scheduler.submit(r),announce:r=>e._announce(r),t:(r,l)=>e.t(r,l),emit:(r,...l)=>e.emit(r,...l),onReproject:()=>e._rangeMgr.reproject()}),e._findMgr=new FindBarManager({getColLayout:()=>e._colLayout,getData:()=>e._data,getFilters:()=>e._sfMgr.filters,getVs:()=>e._vs,getPagination:()=>e._pagination,submitRender:r=>e._scheduler.submit(r),t:(r,l)=>e.t(r,l)}),e._cellEvt=new CellEventHandler({getData:()=>e._data,getColLayout:()=>e._colLayout,getOptions:()=>e._options,getEditMgr:()=>e._editMgr,getRowMgr:()=>e._rowMgr,emit:(r,...l)=>e.emit(r,...l),writeCell:(r,l,a)=>e.writeCell(r,l,a),submitRender:r=>e._scheduler.submit(r),getContainer:()=>e._container,onCellsClick:(r,l,a)=>e._rangeMgr.handleClick(r,l,a),rangeMouseDown:(r,l,a)=>e._rangeMgr.handleCellMouseDown(r,l,a),rangeMouseMove:(r,l,a)=>e._rangeMgr.handleCellMouseMove(r,l,a),rangeMouseUp:(r,l,a)=>e._rangeMgr.handleCellMouseUp(r,l,a)}),e._rangeMgr=new RangeSelectionManager({rangeRect:r=>{var l;return((l=e._render)==null?void 0:l.rangeRect(r))??null},getOptions:()=>e._options,getData:()=>e._data,getColLayout:()=>e._colLayout,getFlatModel:()=>e._flatModel,getRenderer:()=>e._renderer,getEditMgr:()=>e._editMgr,setFocusCell:(r,l)=>e._setFocusCell(r,l),writeCells:r=>e.writeCells(r),getDisplayValue:(r,l)=>e.getDisplayValue(r,l),emit:(r,...l)=>e.emit(r,...l),submitRender:r=>e._scheduler.submit(r),announce:r=>e._announce(r),t:(r,l)=>e.t(r,l),hasCellFormula:(r,l)=>e._recalc.hasCellFormula(r,l),offsetFormula:(r,l,a,h)=>e._recalc.offsetFormula(r,l,a,h),setCellFormulaByRowId:(r,l,a)=>e._formula.setCellFormulaByRowId(r,l,a)}),e._grpMgr=new GroupTreeManager({getData:()=>e._data.getData(),getDataLayer:()=>e._data,getOptions:()=>e._options,getVs:()=>e._vs,submitRender:r=>e._scheduler.submit(r),getStrategy:(r,l)=>e._ovk.getStrategy(r,l),setFlatBacking:r=>e._flatModel.setBacking(r),getFlatCount:()=>e._flatModel.count()}),e._detailMgr=new DetailManager({getOptions:()=>e._options,getFlatModel:()=>e._flatModel,getVs:()=>e._vs,getRowId:r=>r[ROW_ID_FIELD$2],getRowById:r=>e._data.getRowById(r),submitRender:r=>e._scheduler.submit(r),emit:(r,l)=>e.emit(r,l),announce:r=>e._announce(r),t:(r,l)=>e.t(r,l),getDepth:()=>e._options._detailDepth??0,getGridInstance:()=>e,createSubgrid:(r,l,a)=>n.createSubgrid(r,l,a)}),e._chartMgr=new ChartManager({getContainer:()=>e._container,getOptions:()=>e._options,getAllRows:()=>e._data.getData(),getSelectedRows:()=>e._rowMgr.getSelections(),getCheckedRows:()=>e._rowMgr.getChecked().map(r=>r.row),getVisibleColumns:()=>e._colLayout.visibleLeaves.map(r=>({field:r.field,header:r.header,type:r.type})),getFlatModel:()=>e._flatModel,getRowById:r=>e._data.getRowById(r),getActiveRange:()=>e._rangeMgr.getActiveRange(),on:(r,l)=>{e.on(r,l)},off:(r,l)=>{e.off(r,l)},emit:(r,...l)=>e.emit(r,...l),announce:r=>e._announce(r),t:(r,l)=>e.t(r,l)}),{_phase:"managers"}}static buildOverrideKernel(e,s){if(e._ovk=new OverrideKernel(e,{strict:e._options.overrideStrict??!0}),e._data.setStrategyResolver((i,n)=>e._ovk.getStrategy(i,n)),e._ovk==null)throw new Error("[OpenGrid] 초기화 순서 위반: OverrideKernel(_ovk)은 _mount() 이전에 생성돼야 합니다 — 매니저 strategy 슬롯(footer/group 등)이 초기 렌더에서 _ovk.getStrategy 를 참조합니다.");return{_phase:"ovk"}}static mount(e,s){var i;if(e._mount(),e._renderer&&e._footerMgr.setFollower(e._renderer.follower),(i=e._renderer)==null||i.onEndGutter(n=>{var r;e._footerMgr.setEndGutter(n),(r=e._render)==null||r.syncViewportWidth()}),e._renderer&&e._render){const n=e._render;e._footerMgr.setApplier(e._renderer.applier),e._renderer.connectResize({widths:{setWidth:(r,l)=>n.setUserWidth(r,l)},scheduler:e._scheduler,sink:new ResizeSinkAdapter({commitWidth:(r,l)=>{var a;return(a=e._renderer)==null?void 0:a.commitColumnResize(r,l)},hasWrappedHeader:()=>n.hasWrappedHeader(),relayoutHeaderIfChanged:()=>n.relayoutHeaderIfChanged()}),geometry:n.geometry})}return{_phase:"mounted"}}}class MutationService{constructor(e){this.$di=0,this.$fK=!1,this.$b=e}commit(e){var s,i,n,r,l;if(e.coalescable&&this.$di>0){this.$fK=!0;return}const a=this.$b.getData();e.totals==="count"?((s=this.$b.getVs())==null||s.setTotalRows(this.$b.getFlatModel().count()),(i=this.$b.getPagination())==null||i.setTotalRows(a.rowCount)):e.totals==="zero"&&((n=this.$b.getVs())==null||n.setTotalRows(0),(r=this.$b.getPagination())==null||r.setTotalRows(0)),(l=e.preRender)==null||l.call(e),e.flushFormula&&this.$b.flushFormula();const h=()=>{e.renderMode==="sync-window"?this.$b.submitRender(RenderRequest.REPAINT_VISIBLE):e.renderMode==="full"&&this.$b.submitRender(RenderRequest.REPAINT_CLEAR)},c=()=>{this.$b.emit("dataChange",e.emitPayload())};e.emitBeforeRender?(c(),h()):(h(),c())}setData(e){var s;const i=this.$b.getTrigMgr(),n=i.mkCtx("setData",[e]);if(!i.exec("before:setData",n))return;this.$b.getRowMgr().reset();const r=this.$b.getData();r.setData(e),this.$b.resetFormulaState(),this.$b.applyFilters();const l=this.$b.getGrpMgr();l.isTreeMode?l.rebuildTree():l.isGroupMode?l.rebuildGroups():(s=this.$b.getVs())==null||s.setTotalRows(this.$b.getFlatModel().count());const a=this.$b.getContainer();a.setAttribute("aria-rowcount",String(r.rowCount)),a.setAttribute("aria-colcount",String(this.$b.getColLayout().visibleLeaves.length)),this.$b.announce(this.$b.t("data.loadedAnnounce",{count:r.rowCount})),this.commit({renderMode:"async-vs",emitPayload:()=>r.getData()}),n.result=e.length,i.exec("after:setData",n)}insertRow(e,s="last"){const i=this.$b.getTrigMgr(),n=i.mkCtx("insertRow",[e,s]);if(!i.exec("before:insertRow",n))return;const r=this.$b.getData(),l=s==="before"?0:s==="after"?r.rowCount:s;r.addRow(e,l);const a=r.rowCount;this.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>r.getData()}),n.result={rowCount:a,item:e},i.exec("after:insertRow",n)}pushRow(e){const s=Array.isArray(e)?e:[e],i=this.$b.getData();s.forEach(n=>i.addRow(n,"last")),this.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>i.getData()})}deleteRow(e){const s=this.$b.getTrigMgr(),i=this.$b.getData(),n=s.mkCtx("deleteRow",[e]),r=Array.isArray(e)?[...e]:[e];if(n.extra={rows:r.map(c=>i.getRowByIndex(c))},!s.exec("before:deleteRow",n))return;const l=r.sort((c,d)=>d-c),a=l.map(c=>this.$b.getRowIdAt(c)).filter(c=>c!=null);l.forEach(c=>i.removeRow(c));const h=i.rowCount;this.commit({totals:"count",renderMode:"sync-window",preRender:()=>this.$b.invalidateRemovedRows(a),emitPayload:()=>i.getData()}),n.result={deleted:l.length,rowCount:h},s.exec("after:deleteRow",n)}writeCell(e,s,i){const n=this.$b.getData(),r=n.getCellValue(e,s),l=this.$b.getTrigMgr(),a=l.mkCtx("writeCell",[e,s,i]);if(a.extra={oldValue:r,rowIndex:e,field:s},!l.exec("before:writeCell",a))return;n.updateCell(e,s,i);const h=n.getRowByIndex(e),c=this.$b.getColLayout(),d=c.getColumnByField(s),f=c.getColumnIndex(s),u={type:"editEnd",rowIndex:e,columnIndex:f,field:s,oldValue:r,newValue:i,row:h,column:d};this.$b.emit("editEnd",u),this.$b.seedFormulaDirty(e,s),this.commit({renderMode:"sync-window",flushFormula:!0,emitBeforeRender:!0,emitPayload:()=>n.getData(),coalescable:!0}),a.result={rowIndex:e,field:s,oldValue:r,newValue:i},l.exec("after:writeCell",a)}beginBatch(){this.$di++}endBatch(){this.$di!==0&&(this.$di--,this.$di===0&&this.$fK&&(this.$fK=!1,this.commit({renderMode:"sync-window",flushFormula:!0,emitBeforeRender:!0,emitPayload:()=>this.$b.getData().getData()})))}writeCells(e){this.beginBatch();let s=0;const i=this.$b.getFlatModel();for(const n of e){if(i.resolveFlatRow(n.rowIndex).kind!=="data"){s++;continue}this.writeCell(n.rowIndex,n.field,n.value)}return this.endBatch(),s>0&&(this.$b.announce(this.$b.t("data.skippedCellsAnnounce",{count:s})),this.$b.emit("writeCellsSkip",{skipped:s,total:e.length})),s}}const NONE="";function buildMappingScript(o){const e=Object.entries(o).filter(([,s])=>s!==NONE).map(([s,i])=>` ${JSON.stringify(s)}: src[${JSON.stringify(i)}],`);return t("crossGrid.scriptComment")+`
|
|
75
|
+
function mapRow(src) {
|
|
76
|
+
return {
|
|
77
|
+
`+e.join(`
|
|
78
|
+
`)+(e.length?`
|
|
79
|
+
`:"")+` };
|
|
80
|
+
}`}function buildTransform(o){return e=>{const s={};for(const[i,n]of Object.entries(o))n!==NONE&&(s[i]=e[n]);return s}}function sameSchema(o,e){if(o.length!==e.length)return!1;const s=new Set(e);return o.every(i=>s.has(i))}function openCrossGridMapper(o,e){return new Promise(s=>{const i=new Set(o.map(x=>x.field)),n={};for(const x of e)n[x.field]=i.has(x.field)?x.field:NONE;const r=document.createElement("div");r.className="og-mapper-overlay",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-label",t("crossGrid.overlayAria")),r.style.cssText="position:fixed;inset:0;z-index:100000;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;font-family:var(--og-font-family,-apple-system,sans-serif);";const l=document.createElement("div");l.style.cssText="background:#fff;border-radius:10px;box-shadow:0 12px 40px rgba(0,0,0,0.3);width:min(620px,92vw);max-height:88vh;overflow:auto;color:#222;",r.appendChild(l);const a=document.createElement("div");a.style.cssText="padding:18px 20px 8px;",a.innerHTML='<div style="font-size:16px;font-weight:700;">'+t("crossGrid.title")+'</div><div style="font-size:12.5px;color:#666;margin-top:4px;line-height:1.5;">'+t("crossGrid.desc1")+t("crossGrid.desc2")+"</div>",l.appendChild(a);const h=document.createElement("div");h.style.cssText="padding:6px 20px;";const c=`<option value="">${t("crossGrid.emptyOption")}</option>`+o.map(x=>`<option value="${esc(x.field)}">${esc(x.header)} <${esc(x.field)}></option>`).join("");for(const x of e){const S=document.createElement("div");S.style.cssText="display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid #f0f0f0;";const M=document.createElement("div");M.style.cssText="flex:1;font-size:13px;min-width:0;",M.innerHTML=`<span style="font-weight:600;">${esc(x.header)}</span><span style="color:#999;font-size:11.5px;"> <${esc(x.field)}></span>`;const R=document.createElement("span");R.textContent="←",R.style.cssText="color:#888;flex-shrink:0;";const k=document.createElement("select");k.style.cssText="flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;",k.innerHTML=c,k.value=n[x.field]??NONE,k.addEventListener("change",()=>{n[x.field]=k.value,m()}),S.append(M,R,k),h.appendChild(S)}l.appendChild(h);const d=document.createElement("div");d.style.cssText="padding:10px 20px 4px;";const f=document.createElement("div");f.style.cssText="display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;",f.innerHTML='<span style="font-size:12.5px;font-weight:600;color:#444;">'+t("crossGrid.scriptTitle")+"</span>";const u=document.createElement("button");u.type="button",u.textContent=t("crossGrid.copy"),u.style.cssText="font-size:12px;padding:4px 10px;border:1px solid #ccc;border-radius:6px;background:#f7f7f7;cursor:pointer;",f.appendChild(u);const p=document.createElement("pre");p.style.cssText="margin:0;background:#0d1117;color:#c9d1d9;padding:12px;border-radius:8px;font-family:ui-monospace,Consolas,monospace;font-size:12px;line-height:1.5;overflow:auto;max-height:180px;",d.append(f,p),l.appendChild(d);function g(){return buildMappingScript(n)}function m(){p.textContent=g()}m(),u.addEventListener("click",()=>{var x;const S=g();(x=navigator.clipboard)==null||x.writeText(S).then(()=>{u.textContent=t("crossGrid.copied"),setTimeout(()=>u.textContent=t("crossGrid.copy"),1200)},()=>{u.textContent=t("crossGrid.copyFailed"),setTimeout(()=>u.textContent=t("crossGrid.copy"),1200)})});const w=document.createElement("div");w.style.cssText="display:flex;justify-content:flex-end;gap:8px;padding:14px 20px 18px;";const y=document.createElement("button");y.type="button",y.textContent=t("crossGrid.cancel"),y.style.cssText="font-size:13px;padding:8px 16px;border:1px solid #ccc;border-radius:7px;background:#fff;cursor:pointer;";const v=document.createElement("button");v.type="button",v.textContent=t("crossGrid.applyMove"),v.style.cssText="font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;",w.append(y,v),l.appendChild(w);let _=!1;function b(x){_||(_=!0,document.removeEventListener("keydown",E),r.remove(),s(x))}function E(x){x.key==="Escape"&&b(null)}y.addEventListener("click",()=>b(null)),r.addEventListener("mousedown",x=>{x.target===r&&b(null)}),v.addEventListener("click",()=>b({mapping:{...n},script:g()})),document.addEventListener("keydown",E),document.body.appendChild(r),v.focus()})}function esc(o){return String(o).replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e])}class CrossGridRegistry{constructor(){this.$c=new Map}register(e,s){this.$c.set(e,s)}unregister(e){this.$c.delete(e)}get(e){return this.$c.get(e)}get size(){return this.$c.size}resolveAt(e,s,i){const n=document.elementFromPoint(e,s),r=n==null?void 0:n.closest(".og-body-wrapper");if(!r)return null;const l=this.$c.get(r);return!l||l===i?null:l}}const crossGridRegistry=new CrossGridRegistry,ROW_ID_FIELD$1="_ogRowId";class CrossGridController{constructor(e){this.$b=e}getSelf(){return this.$b.getSelf()}$nd(){return this.$b.getData().rowCount}$mj(e,s){this.$b.insertRow(e,s)}$kS(){return this.$b.getColLayout().visibleLeaves.map(e=>({field:e.field,header:e.header}))}handleCrossGridDrop(e,s,i){const n=crossGridRegistry.get(s);!n||n===this.$b.getSelf()||this.moveRowsTo(n,this.$b.dragRowSet(e),i)}async moveRowsTo(e,s,i){const n=this.$b.getSelf();if(!e||e===n||!s.length)return!1;const r=this.$b.getPeerController(e);if(!r)return!1;const l=[...new Set(s)].sort((f,u)=>f-u),a=i??r.$nd();let h=l.map(f=>{const u={...this.$b.getData().getRowByIndex(f)};return delete u[ROW_ID_FIELD$1],u});const c=await this.$mZ(r);if(c===!1)return!1;c&&(h=h.map(f=>c(f)));const d={sourceGrid:n,targetGrid:e,rows:h,sourceIndexes:l,targetIndex:a};return this.fireGridDropBefore(d)===!1||d.cancel||r.fireGridDropBefore(d)===!1||d.cancel?!1:(h.forEach((f,u)=>r.$mj(f,a+u)),[...l].sort((f,u)=>u-f).forEach(f=>this.$b.deleteRow(f)),this.fireGridDropAfter(d),r.fireGridDropAfter(d),this.fireGridDropComplete(d),r.fireGridDropComplete(d),!0)}async moveCheckedTo(e){const s=this.$b.getChecked().map(i=>i.rowIndex);return s.length?(this.$b.uncheckAll(),this.moveRowsTo(e,s)):!1}async $mZ(e){var s,i;const n=this.$b.getOptions().crossGridMapping;if(typeof n=="function")return n;if(n!=="interactive")return null;const r=this.$kS(),l=e.$kS();if(sameSchema(r.map(c=>c.field),l.map(c=>c.field)))return null;const a=await openCrossGridMapper(r,l);if(!a)return!1;const h={sourceGrid:this.$b.getSelf(),targetGrid:e.getSelf(),mapping:a.mapping,script:a.script};return this.$b.emit("gridDropMapping",h),(i=(s=this.$b.getOptions()).onGridDropMapping)==null||i.call(s,h),console.log(`[OpenGrid] cross-grid mapping script:
|
|
81
|
+
`+buildMappingScript(a.mapping)),buildTransform(a.mapping)}fireGridDropBefore(e){var s,i;return this.$b.emit("gridDropBefore",e),(i=(s=this.$b.getOptions()).onGridDropBefore)==null?void 0:i.call(s,e)}fireGridDropAfter(e){var s,i;this.$b.emit("gridDropAfter",e),(i=(s=this.$b.getOptions()).onGridDropAfter)==null||i.call(s,e)}fireGridDropComplete(e){var s,i;this.$b.emit("gridDropComplete",e),(i=(s=this.$b.getOptions()).onGridDropComplete)==null||i.call(s,e)}}const DETAIL_GLYPH_COLLAPSED="⊕",DETAIL_GLYPH_EXPANDED="⊖";function getDetailGlyph(o,e=t){return{glyph:o?DETAIL_GLYPH_EXPANDED:DETAIL_GLYPH_COLLAPSED,ariaLabel:e(o?"detail.collapseAria":"detail.expandAria"),title:e("detail.glyphTooltip")}}class FilterSelectPanel{constructor(e,s,i,n,r,l){this.$ho=new Map,this.$cX={},this.$et=s,this.$jG=i,this.$dL=n,this._t=l??t,this.$d=document.createElement("fieldset"),this.$d.className="og-filter-select";const a=document.createElement("legend");a.className="og-filter-select-legend",a.textContent=s.legend??this._t("filter.legend"),this.$d.appendChild(a);const h=document.createElement("div");h.className="og-filter-select-row";for(const d of s.columns){const f=`og-fsel-${d.field}`,u=document.createElement("div");u.className="og-filter-select-group";const p=document.createElement("label");p.htmlFor=f,p.textContent=d.label,p.className="og-filter-select-label";const g=document.createElement("select");g.id=f,g.className="og-filter-select-sel",g.setAttribute("aria-label",d.label),r&&g.setAttribute("aria-controls",r),d.dependsOn?this.$dB(g,[],!1):this.$dB(g,this.$cR(d,""),!0),g.addEventListener("change",()=>this.$eT(d.field,g.value)),u.appendChild(p),u.appendChild(g),h.appendChild(u),this.$ho.set(d.field,g)}const c=document.createElement("button");c.type="button",c.textContent=this._t("filter.clear"),c.className="og-filter-select-reset",c.setAttribute("aria-label",this._t("filter.clearAria")),c.addEventListener("click",()=>this._reset()),this.$d.appendChild(h),this.$d.appendChild(c),e.insertBefore(this.$d,e.firstChild)}$cR(e,s){if(e.options)return e.options;let i=e.data??[];e.dependsOn&&e.dependsOnKey&&s&&(i=i.filter(l=>String(l[e.dependsOnKey]??"")===s));const n=e.valueKey??"value",r=e.textKey??n;return i.map(l=>({value:String(l[n]??""),text:String(l[r]??l[n]??"")}))}$dB(e,s,i){e.innerHTML="";const n=document.createElement("option");n.value="",n.textContent=this._t("filter.all"),e.appendChild(n);for(const r of s){const l=document.createElement("option");l.value=r.value,l.textContent=r.text,e.appendChild(l)}e.disabled=!i}$eT(e,s){const i=this.$et.columns.find(r=>r.field===e),n=i.filterKey??i.field;s?(this.$cX[e]=s,this.$jG(n,[{operator:"=",value:s}])):(delete this.$cX[e],this.$dL(n)),this.$hV(e)}$hV(e){const s=this.$cX[e]??"";for(const i of this.$et.columns){if(i.dependsOn!==e)continue;const n=this.$ho.get(i.field);if(!n)continue;const r=i.filterKey??i.field;s?(this.$dB(n,this.$cR(i,s),!0),n.value="",delete this.$cX[i.field],this.$dL(r)):(this.$dB(n,[],!1),delete this.$cX[i.field],this.$dL(r),this.$hV(i.field))}}_reset(){this.$cX={};for(const e of this.$et.columns){const s=this.$ho.get(e.field),i=e.filterKey??e.field;s&&(e.dependsOn?this.$dB(s,[],!1):(s.value="",s.disabled=!1),this.$dL(i))}}reset(){this._reset()}destroy(){this.$d.remove()}}const _KO_FALLBACK={"pagination.rowsPerPage":"행/페이지:","pagination.empty":"0건"};function _defaultT(o,e){return o==="pagination.rangeBadge"?`${e==null?void 0:e.from}–${e==null?void 0:e.to} / ${e==null?void 0:e.total}건`:_KO_FALLBACK[o]??o}class Pagination{constructor(e,s,i,n){this.$J=1,this._totalRows=0,this.$bz=s,this.$eT=i,this._t=n??_defaultT,this.$d=document.createElement("div"),this.$d.className="og-pagination",this.$d.style.cssText=`
|
|
82
|
+
display:flex;align-items:center;justify-content:center;gap:4px;
|
|
83
|
+
padding:6px 8px;border-top:1px solid var(--og-border-color,#e0e0e0);
|
|
84
|
+
background:var(--og-header-bg,#f5f5f5);flex-shrink:0;user-select:none;
|
|
85
|
+
font-size:12px;color:var(--og-text-color,#333);
|
|
86
|
+
`,e.appendChild(this.$d),this._render()}get page(){return this.$J}get pageSize(){return this.$bz}get totalPages(){return Math.max(1,Math.ceil(this._totalRows/this.$bz))}setTotalRows(e){this._totalRows=e,this.$J>this.totalPages&&(this.$J=this.totalPages),this._render()}setPageSize(e){this.$bz=e,this.$J=1,this._render(),this.$M()}goTo(e){const s=Math.max(1,Math.min(e,this.totalPages));s!==this.$J&&(this.$J=s,this._render(),this.$M())}getRange(){const e=(this.$J-1)*this.$bz,s=Math.min(e+this.$bz-1,this._totalRows-1);return{start:e,end:s}}$M(){this.$eT({page:this.$J,pageSize:this.$bz,totalRows:this._totalRows,totalPages:this.totalPages})}_render(){this.$d.innerHTML="";const e=this.totalPages,s=document.createElement("span");s.style.cssText="display:flex;align-items:center;gap:3px;margin-right:8px;";const i=document.createElement("span");i.textContent=this._t("pagination.rowsPerPage"),i.style.color="#888";const n=document.createElement("select");n.style.cssText="padding:2px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:11px;cursor:pointer;";for(const d of[10,20,50,100,200]){const f=document.createElement("option");f.value=String(d),f.textContent=String(d),d===this.$bz&&(f.selected=!0),n.appendChild(f)}n.addEventListener("change",()=>this.setPageSize(Number(n.value))),s.appendChild(i),s.appendChild(n),this.$d.appendChild(s);const r=document.createElement("span"),{start:l,end:a}=this.getRange();r.textContent=this._totalRows>0?this._t("pagination.rangeBadge",{from:l+1,to:a+1,total:this._totalRows}):this._t("pagination.empty"),r.style.cssText="margin-right:8px;color:#888;",this.$d.appendChild(r);const h=(d,f,u)=>{const p=document.createElement("button");return p.textContent=d,p.disabled=u,p.style.cssText=`
|
|
87
|
+
min-width:28px;height:24px;padding:0 6px;
|
|
88
|
+
border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;
|
|
89
|
+
background:${u?"#f5f5f5":"#fff"};
|
|
90
|
+
color:${u?"#bbb":"var(--og-text-color,#333)"};
|
|
91
|
+
cursor:${u?"default":"pointer"};font-size:12px;
|
|
92
|
+
`,u||p.addEventListener("click",()=>this.goTo(f)),p};this.$d.appendChild(h("«",1,this.$J===1)),this.$d.appendChild(h("‹",this.$J-1,this.$J===1));const c=_pageRange(this.$J,e);for(const d of c)if(d===-1){const f=document.createElement("span");f.textContent="…",f.style.padding="0 3px",this.$d.appendChild(f)}else{const f=h(String(d),d,d===this.$J);d===this.$J&&(f.style.background="var(--og-primary,#1976d2)",f.style.color="#fff",f.style.borderColor="var(--og-primary,#1976d2)"),this.$d.appendChild(f)}this.$d.appendChild(h("›",this.$J+1,this.$J===e)),this.$d.appendChild(h("»",e,this.$J===e))}refreshLabels(){this._render()}destroy(){this.$d.remove()}}function _pageRange(o,e){if(e<=7)return Array.from({length:e},(i,n)=>n+1);const s=[1];o>3&&s.push(-1);for(let i=Math.max(2,o-1);i<=Math.min(e-1,o+1);i++)s.push(i);return o<e-2&&s.push(-1),s.push(e),s}class DragGhost{constructor(e,s,i,n){this.$in=s-e.left,this.$io=i-e.top;const r=document.createElement("div");r.className="og-drag-ghost",r.style.cssText=`position:fixed;left:0;top:0;width:${e.width}px;height:${Math.min(e.height,40)}px;transform:translate(${e.left}px,${e.top}px);background:rgba(25,118,210,0.12);border:2px dashed #1976d2;box-sizing:border-box;pointer-events:none;z-index:10000;border-radius:3px;opacity:0.92;display:flex;align-items:center;padding-left:10px;font-size:12px;color:#1565c0;font-weight:600;white-space:nowrap;overflow:hidden;`,n>1&&(r.textContent=t("drag.rowCount",{count:n})),document.body.appendChild(r),this.$d=r}move(e,s){this.$d.style.transform=`translate(${e-this.$in}px,${s-this.$io}px)`}destroy(){this.$d.remove()}}class DropIndicator{constructor(e="#1976d2"){const s=document.createElement("div");s.className="og-drop-indicator",s.style.cssText="position:absolute;left:0;right:0;display:none;align-items:center;pointer-events:none;z-index:9998;transform:translateY(-50%);";const i=r=>{const l=document.createElement("div"),a=r==="left"?`border-left:7px solid ${e}`:`border-right:7px solid ${e}`;return l.style.cssText=`width:0;height:0;flex-shrink:0;border-top:5px solid transparent;border-bottom:5px solid transparent;${a};`,l},n=document.createElement("div");n.style.cssText=`flex:1;height:3px;background:${e};border-radius:2px;box-shadow:0 0 0 1px rgba(255,255,255,0.7);`,s.append(i("left"),n,i("right")),this.$d=s}showIn(e,s){this.$d.parentElement!==e&&(this.$d.remove(),e.appendChild(this.$d)),this.$d.style.display="flex",this.$d.style.top=`${s}px`}hide(){this.$d.style.display="none"}destroy(){this.$d.remove()}}const clamp=(o,e,s)=>Math.max(e,Math.min(s,o));class RowDragDrop{constructor(e,s,i,n=null,r=()=>1){this.$lh=e,this.$aQ=s,this.$eU=i,this.$aF=n,this.$lZ=r,this.$L=null,this.$ft=new DropIndicator("#1976d2"),this.$ew=new DropIndicator("#2e7d32"),this.$bw=this.$bw.bind(this),this.$dK=this.$dK.bind(this)}setRowHeight(e){this.$aQ=e}attachHandle(e,s,i){const n=document.createElement("div");return n.className="og-drag-handle",n.innerHTML="⠿",n.style.cssText=`
|
|
93
|
+
width:18px;min-width:18px;height:100%;
|
|
94
|
+
display:flex;align-items:center;justify-content:center;
|
|
95
|
+
cursor:grab;font-size:14px;color:#bbb;flex-shrink:0;
|
|
96
|
+
user-select:none;border-right:1px solid var(--og-border-color,#e0e0e0);
|
|
97
|
+
`,n.addEventListener("mousedown",r=>{r.preventDefault(),r.stopPropagation(),this.$nn(r,e,s,i)}),n}$nn(e,s,i,n){const r=s.getBoundingClientRect(),l=this.$lZ(i);this.$L={fromIndex:i,bodyEl:this.$lh,rowHeight:this.$aQ,totalRows:n,ghost:new DragGhost(r,e.clientX,e.clientY,l),currentTarget:i,crossTarget:null},document.addEventListener("mousemove",this.$bw,!0),document.addEventListener("mouseup",this.$dK,!0)}$bw(e){if(!this.$L)return;const s=this.$L;if(s.ghost.move(e.clientX,e.clientY),this.$aF){const r=this.$aF.resolveTarget(e.clientX,e.clientY);if(r&&r.bodyEl!==s.bodyEl){const l=r.bodyEl.getBoundingClientRect(),a=e.clientY-l.top+r.bodyEl.scrollTop,h=clamp(Math.round(a/r.rowHeight),0,r.totalRows);s.crossTarget={bodyEl:r.bodyEl,index:h},this.$ft.hide(),this.$ew.showIn(r.bodyEl,h*r.rowHeight);return}}s.crossTarget=null,this.$ew.hide();const i=s.bodyEl.getBoundingClientRect(),n=e.clientY-i.top+s.bodyEl.scrollTop;s.currentTarget=clamp(Math.round(n/s.rowHeight),0,s.totalRows-1),this.$ft.showIn(s.bodyEl,s.currentTarget*s.rowHeight)}$dK(e){if(document.removeEventListener("mousemove",this.$bw,!0),document.removeEventListener("mouseup",this.$dK,!0),!this.$L)return;const{fromIndex:s,currentTarget:i,ghost:n,crossTarget:r}=this.$L;this.$L=null,n.destroy(),this.$ft.hide(),this.$ew.hide(),r&&this.$aF?this.$aF.onCrossDrop(s,r.bodyEl,r.index):s!==i&&this.$eU(s,i)}destroy(){var e;document.removeEventListener("mousemove",this.$bw,!0),document.removeEventListener("mouseup",this.$dK,!0),(e=this.$L)==null||e.ghost.destroy(),this.$ft.destroy(),this.$ew.destroy(),this.$L=null}}class MergeEngine{constructor(){this.$c=new Map}static $an(e,s){return`${e}:${s}`}applyMergeCells(e){this.$c.clear();for(const s of e){const i=Math.max(1,s.rowSpan??1),n=Math.max(1,s.colSpan??1);this.$c.set(MergeEngine.$an(s.row,s.col),{rowSpan:i,colSpan:n,hidden:!1});for(let r=0;r<i;r++)for(let l=0;l<n;l++)r===0&&l===0||this.$c.set(MergeEngine.$an(s.row+r,s.col+l),{rowSpan:1,colSpan:1,hidden:!0})}}applyAutoMerge(e,s,i){var n,r;this.$c.clear();for(let l=0;l<s.length;l++){const a=s[l],h=i[l];let c=0;for(let d=1;d<=e.length;d++){const f=(n=e[d-1])==null?void 0:n[h],u=d<e.length?(r=e[d])==null?void 0:r[h]:void 0;if(d===e.length||u!==f){const p=d-c;if(p>1){this.$c.set(MergeEngine.$an(c,a),{rowSpan:p,colSpan:1,hidden:!1});for(let g=c+1;g<d;g++)this.$c.set(MergeEngine.$an(g,a),{rowSpan:1,colSpan:1,hidden:!0})}c=d}}}}getInfo(e,s){return this.$c.get(MergeEngine.$an(e,s))??null}clear(){this.$c.clear()}get isEmpty(){return this.$c.size===0}}const _DEFAULT_ITEM_TEMPLATE=[{id:"sort-asc",labelKey:"contextMenu.sortAsc",icon:"↑",action:"sortAsc"},{id:"sort-desc",labelKey:"contextMenu.sortDesc",icon:"↓",action:"sortDesc"},{type:"divider"},{id:"find",labelKey:"contextMenu.find",icon:"🔍",action:"find"},{type:"divider"},{id:"excel",labelKey:"contextMenu.exportExcel",icon:"📊",action:"excel"},{id:"csv",labelKey:"contextMenu.exportCsv",icon:"📄",action:"csv"},{id:"print",labelKey:"contextMenu.print",icon:"🖨",action:"print"}],DEFAULT_CONTEXT_ITEMS=[{id:"sort-asc",label:"오름차순 정렬",icon:"↑",action:"sortAsc"},{id:"sort-desc",label:"내림차순 정렬",icon:"↓",action:"sortDesc"},{type:"divider"},{id:"find",label:"찾기",icon:"🔍",action:"find"},{type:"divider"},{id:"excel",label:"Excel로 저장",icon:"📊",action:"excel"},{id:"csv",label:"CSV로 저장",icon:"📄",action:"csv"},{id:"print",label:"인쇄",icon:"🖨",action:"print"}];function _buildDefaultItems(o){return o?_DEFAULT_ITEM_TEMPLATE.map(e=>"type"in e?{type:"divider"}:{id:e.id,label:o(e.labelKey),icon:e.icon,action:e.action}):DEFAULT_CONTEXT_ITEMS}class ContextMenuManager{constructor(e,s,i){this.$aU=e,this._actions=s,this._t=i,this.$d=null,this.$ds=null,this.$dt=null,this.$dv=null,this.$du=null,this.$dC=-1}open(e,s){this.close();const i=s??_buildDefaultItems(this._t),n=document.createElement("div");n.className="og-context-menu",n.setAttribute("role","menu");for(const c of i){if(c.type==="divider"){const u=document.createElement("div");u.className="og-cm-divider",u.setAttribute("role","separator"),n.appendChild(u);continue}const d=document.createElement("button");if(d.className="og-cm-item",d.setAttribute("role","menuitem"),d.setAttribute("tabindex","-1"),c.disabled&&(d.classList.add("og-cm-disabled"),d.setAttribute("aria-disabled","true")),c.icon){const u=document.createElement("span");if(u.className="og-cm-icon",/^[a-zA-Z][\w-]*(\s+[\w-]+)+$/.test(c.icon.trim())){const p=document.createElement("i");p.className=c.icon,u.appendChild(p)}else u.textContent=c.icon;u.setAttribute("aria-hidden","true"),d.appendChild(u)}const f=document.createElement("span");f.className="og-cm-label",f.textContent=c.label??"",d.appendChild(f),d.addEventListener("click",u=>{u.stopPropagation(),c.disabled||this.$ng(c),this.close()}),n.appendChild(d)}const r=this.$aU.closest("[data-og-theme]"),l=r==null?void 0:r.getAttribute("data-og-theme");l&&n.setAttribute("data-og-theme",l);const a=this.$aU.closest("[data-og-skin]"),h=a==null?void 0:a.getAttribute("data-og-skin");h&&n.setAttribute("data-og-skin",h),document.body.appendChild(n),this.$d=n,this.$du=c=>{if(!this.$d)return;const d=this.$d.getBoundingClientRect();(c.clientX<d.left-4||c.clientX>d.right+4||c.clientY<d.top-4||c.clientY>d.bottom+4)&&this.close()},this.$eZ(n,e.clientX,e.clientY,()=>{this.$d===n&&document.addEventListener("mousemove",this.$du,{capture:!0,passive:!0})}),this.$ds=c=>{n.contains(c.target)||this.close()},this.$dt=c=>{if(c.key==="Escape"){this.close();return}if(c.key==="ArrowDown"){c.preventDefault(),this.$gJ(1);return}if(c.key==="ArrowUp"){c.preventDefault(),this.$gJ(-1);return}if(c.key==="Enter"){const d=n.querySelector(".og-cm-item:focus");d==null||d.click()}},this.$dv=()=>this.close(),setTimeout(()=>{document.addEventListener("click",this.$ds),document.addEventListener("keydown",this.$dt),window.addEventListener("scroll",this.$dv,{passive:!0})},0),this.$dC=-1,this.$gJ(1)}close(){var e;(e=this.$d)==null||e.remove(),this.$d=null,this.$ds&&document.removeEventListener("click",this.$ds),this.$dt&&document.removeEventListener("keydown",this.$dt),this.$dv&&window.removeEventListener("scroll",this.$dv),this.$du&&document.removeEventListener("mousemove",this.$du,{capture:!0}),this.$ds=this.$dt=this.$dv=this.$du=null,this.$dC=-1}destroy(){this.close()}$eZ(e,s,i,n){e.style.cssText="position:fixed;visibility:hidden;left:0;top:0;",requestAnimationFrame(()=>{const{width:r,height:l}=e.getBoundingClientRect(),a=window.innerWidth,h=window.innerHeight,c=s+r>a?Math.max(0,s-r):s,d=i+l>h?Math.max(0,i-l):i;e.style.cssText=`position:fixed;left:${c}px;top:${d}px;z-index:9999;`,n==null||n()})}$gJ(e){var s;if(!this.$d)return;const i=Array.from(this.$d.querySelectorAll(".og-cm-item:not(.og-cm-disabled)"));i.length&&(this.$dC=(this.$dC+e+i.length)%i.length,(s=i[this.$dC])==null||s.focus())}$ng(e){if(typeof e.action=="function"){e.action();return}switch(e.action){case"sortAsc":this._actions.onSortAsc();break;case"sortDesc":this._actions.onSortDesc();break;case"find":this._actions.onFind();break;case"excel":this._actions.onExcel();break;case"csv":this._actions.onCsv();break;case"print":this._actions.onPrint();break}}}class WorksheetManager{constructor(e,s,i){this.$D=new Map,this.$E="",this.$jJ=s,this._t=i??t,this.$ee=this.$lo(e)}add(e,s=[],i=[]){if(this.$D.has(e))throw new Error(`WorksheetManager: 시트 '${e}'이 이미 존재합니다`);this.$D.set(e,{name:e,columns:s,data:i}),this.$cQ(),this.$D.size===1&&this.switch(e)}remove(e){if(!this.$D.has(e))return;if(this.$D.size===1)throw new Error("WorksheetManager: 마지막 시트는 삭제할 수 없습니다");const s=this.$E===e;this.$D.delete(e),this.$cQ(),s&&this.switch(this.$D.keys().next().value)}rename(e,s){if(!this.$D.has(e))return;if(this.$D.has(s))throw new Error(`WorksheetManager: 시트 '${s}'이 이미 존재합니다`);this.$D.get(e);const i=Array.from(this.$D.entries()).map(([n,r])=>n===e?[s,{...r,name:s}]:[n,r]);this.$D=new Map(i),this.$E===e&&(this.$E=s),this.$cQ()}switch(e){const s=this.$D.get(e);if(!s)throw new Error(`WorksheetManager: 시트 '${e}'을 찾을 수 없습니다`);this.$E=e,this.$cQ(),this.$jJ(e,s)}get(e){return this.$D.get(e)}getNames(){return Array.from(this.$D.keys())}getActive(){return this.$E}syncData(e,s){const i=this.$D.get(e);i&&(i.data=s)}destroy(){this.$ee.remove()}$lo(e){const s=document.createElement("div");return s.className="og-sheet-tabs",e.appendChild(s),s}$cQ(){this.$ee.innerHTML="";for(const s of this.$D.keys()){const i=document.createElement("button");i.className="og-sheet-tab",i.textContent=s,i.setAttribute("role","tab"),i.setAttribute("aria-selected",s===this.$E?"true":"false"),s===this.$E&&i.classList.add("og-sheet-tab--active"),i.addEventListener("click",()=>{s!==this.$E&&this.switch(s)}),i.addEventListener("dblclick",()=>this.$no(i,s)),this.$ee.appendChild(i)}const e=document.createElement("button");e.className="og-sheet-add",e.textContent="+",e.setAttribute("aria-label",this._t("worksheet.addAria")),e.addEventListener("click",()=>{const s=`Sheet${this.$D.size+1}`;this.add(s,[],[]),this.switch(s)}),this.$ee.appendChild(e)}$no(e,s){const i=document.createElement("input");i.className="og-sheet-tab-rename",i.value=s,e.replaceWith(i),i.focus(),i.select();const n=()=>{const r=i.value.trim()||s;try{r!==s?this.rename(s,r):this.$cQ()}catch{this.$cQ()}};i.addEventListener("blur",n),i.addEventListener("keydown",r=>{r.key==="Enter"&&i.blur(),r.key==="Escape"&&(i.value=s,i.blur())})}}class TriggerManager{constructor(){this.$bI=new Map}add(e,s){this.$bI.has(e)||this.$bI.set(e,[]),this.$bI.get(e).push(s)}remove(e,s){const i=this.$bI.get(e);if(i){const n=i.indexOf(s);n>=0&&i.splice(n,1)}}clear(e){e?this.$bI.delete(e):this.$bI.clear()}mkCtx(e,s){let i=!1;return{operation:e,args:s,result:void 0,extra:{},timestamp:Date.now(),get cancelled(){return i},cancel(){i=!0}}}exec(e,s){const i=this.$bI.get(e)??[];for(const n of i)if(n(s),s.cancelled)return!1;if(e.startsWith("after:")){const n=this.$bI.get("complete")??[];for(const r of n)r(s)}return!0}}class RenderHookRegistry{constructor(){this.$cO=[],this.$aK=new Map}register(e){this.$aK.has(e.id)||this.$cO.push(e.id),this.$aK.set(e.id,e)}get(e){return this.$aK.get(e)}has(e){return this.$aK.has(e)}ids(){return[...this.$cO]}resolve(e,s,i){const n=this.$aK.get(e);return!n||!n.gate()?null:n.resolve(s,i)}activeIds(){return this.$cO.filter(e=>this.$aK.get(e).gate())}}class ExtensionPointRegistry{constructor(e){this.$fj=new RenderHookRegistry,this.$b=e}get renderHooks(){return this.$fj}registerRenderHook(e){this.$fj.register(e)}resolveRenderHook(e,s,i){return this.$fj.resolve(e,s,i)}strategy(e,s){this.$b.kernel.strategy(e,s)}getStrategy(e,s){return this.$b.kernel.getStrategy(e,s)}hasStrategy(e){return this.$b.kernel.hasStrategy(e)}override(e,s,i={}){this.$b.kernel.override(e,s,i)}beforeMutation(e,s){this.$b.getTrigMgr().add(`before:${e}`,s)}afterMutation(e,s){this.$b.getTrigMgr().add(`after:${e}`,s)}offMutation(e,s,i){this.$b.getTrigMgr().remove(`${e}:${s}`,i)}catalog(){const e=[["sortComparator","(a,b,field,dir)=>number"],["filterPredicate","(value,fi,field)=>boolean"],["displayFormatter","(value,field,row)=>string"],["cellSerializer","(value,col,row)=>any"],["groupKeyFn","(row,remainingFields)=>any"],["summaryOp","(op,nums,field)=>number|null"],["cellClassResolver","(value,field,row)=>string|null"],["ariaLabelResolver","(value,field,row)=>string|null"],["skinResolver","(skinId)=>SkinTokenDelta|null"]].map(([l,a])=>({name:l,category:"strategy",signature:a})),s=this.$fj.ids().map(l=>({name:l,category:"renderHook",signature:"(rowIndex,field)=>value|null"})),i=[{name:"before:mutation",category:"lifecycle",signature:"(ctx)=>void — cancelable"},{name:"after:mutation",category:"lifecycle",signature:"(ctx)=>void — observe"}],n=[{name:"getDisplayValue",category:"override",signature:"(orig,rowIndex,field)=>string"},{name:"readCell",category:"override",signature:"(orig,rowIndex,field)=>any"}],r=[{name:"override(name,fn)",category:"escapeHatch",signature:"best-effort arbitrary method wrap (UC-11)"}];return[...e,...s,...i,...n,...r]}}const CF_BAR_CLASS="og-cf-bar",CF_ICON_CLASS="og-cf-icon",CF_FLAG="ogCf";function glyphChar(o){return o==="triangleUp"?"▲":o==="triangleDown"?"▼":"●"}function clearCF(o){for(const e of Array.from(o.children))(e.classList.contains(CF_BAR_CLASS)||e.classList.contains(CF_ICON_CLASS))&&e.remove();o.dataset[CF_FLAG]&&(o.style.backgroundColor="",o.style.color="",o.style.textShadow="",delete o.dataset[CF_FLAG])}function applyVisualSpecs(o,e,s,i,n){if(clearCF(o),e.length===0)return;let r=!1;const l=[];for(const a of e){if(a.ariaSummary&&l.push(a.ariaSummary),a.fill){const{color:h,from:c,ratio:d}=a.fill;if(c===void 0)o.style.backgroundColor=h;else{o.style.position="relative";const f=document.createElement("div");f.className=CF_BAR_CLASS;const u=Math.max(0,Math.min(1,d))*s;f.style.position="absolute",f.style.top="0",f.style.bottom="0",f.style.width=`${u}px`,f.style.background=h,c==="right"?f.style.right="0":f.style.left="0",f.style.zIndex="0",f.style.pointerEvents="none",o.insertBefore(f,o.firstChild),n==null||n(f,d)}o.style.color=a.inkColor,a.inkOutline&&(o.style.textShadow="0 0 2px rgba(255,255,255,0.9), 0 0 2px rgba(255,255,255,0.9)"),r=!0}if(a.glyph){const{role:h,tint:c,shape:d}=a.glyph,f=document.createElement("span");f.className=CF_ICON_CLASS,f.textContent=glyphChar(d),f.style.color=c,f.style.marginRight="4px",f.style.display="inline-block",f.setAttribute("role","img"),f.setAttribute("aria-label",h),o.insertBefore(f,o.firstChild),r=!0}}if(l.length>0){const a=o.getAttribute("aria-label")??"",h=l.join(" · ");o.setAttribute("aria-label",a?`${a} — ${h}`:h),r=!0}r&&(o.dataset[CF_FLAG]="1")}const ROW_ID_FIELD="_ogRowId";function removeEntry(o,e){const s=o.indexOf(e);s>=0&&o.splice(s,1)}const gridsByContainer=new WeakMap,OPTION_EVENTS={cellClick:"onCellClick",cellDblClick:"onCellDblClick",rowClick:"onRowClick",rowDblClick:"onRowDblClick",cellMouseOver:"onCellMouseOver",cellMouseOut:"onCellMouseOut",cellMouseDown:"onCellMouseDown",cellMouseUp:"onCellMouseUp",cellMouseMove:"onCellMouseMove",rowMouseOver:"onRowMouseOver",rowMouseOut:"onRowMouseOut",rowMouseDown:"onRowMouseDown",rowMouseUp:"onRowMouseUp",rowMouseMove:"onRowMouseMove",cellKeyDown:"onCellKeyDown",cellKeyUp:"onCellKeyUp",cellKeyPress:"onCellKeyPress",editStart:"onEditStart",editEnd:"onEditEnd",dataChange:"onDataChange",selectionChange:"onSelectionChange",sortChange:"onSortChange",filterChange:"onFilterChange",scroll:"onScroll",rowExpand:"onRowExpand",rowCollapse:"onRowCollapse"},_OpenGrid=class B extends EventEmitter{constructor(e,s){var i;super(),this._vs=null,this.$bB=null,this._renderer=null,this.$dh=null,this.$dG=null,this._locales=null,this.$B=new TriggerManager,this.$aG=!1,this._colWidths=[],this.$nu=new Map,this.$cz=null,this.$gi=null,this._pagination=null,this.$ey=null,this.$eR=new MergeEngine,this.$ao=null,this.$au=null,this.$bh=null,this.$bi=null,this._wsManager=null,this._formulaDirtySeeds=new Set,this.$dp=null,this.$ep=new Map,this.$fR=[],this.$fQ=null,this.$hY=null,this.$cg=null,GridComposer.compose(this,e,s,{createSubgrid:(l,a,h)=>new B(l,{...a,_detailDepth:h})});const n=gridsByContainer.get(this._container)??new Set;n.add(this),gridsByContainer.set(this._container,n),this.$lg(),(i=this._options.defaultSort)!=null&&i.length&&this._sfMgr.initSort(this._options.defaultSort),this.override=Object.assign((l,a,h)=>this._ovk.override(l,a,h),{strategy:(l,a)=>this._ovk.strategy(l,a)});const r=this.destroy.bind(this);this.destroy=()=>{try{r()}finally{this._ovk.restoreAll()}};for(const[l,a]of B._defaultStrategies)this._ovk.strategy(l,a);for(const[l,a,h]of B._defaultOverrides)this._ovk.override(l,a,h);requestAnimationFrame(()=>{var l,a;this.emit("ready",this),(a=(l=this._options).onReady)==null||a.call(l,this)})}get extensions(){return this.$bQ}static instancesIn(e){return[e,...Array.from(e.querySelectorAll(".og-container"))].flatMap(i=>[...gridsByContainer.get(i)??[]])}static destroyAllIn(e){const s=[];for(const i of B.instancesIn(e))try{i.destroy()}catch(n){s.push(n)}if(s.length===1)throw s[0];if(s.length>1)throw Object.assign(new Error(`OpenGrid.destroyAllIn: ${s.length} grids failed to destroy`),{errors:s})}static addDefaultOverride(e,s,i={}){const n=[e,s,i];return B._defaultOverrides.push(n),()=>removeEntry(B._defaultOverrides,n)}static addDefaultStrategy(e,s){const i=[e,s];return B._defaultStrategies.push(i),()=>removeEntry(B._defaultStrategies,i)}static defaultOverride(e,s,i={}){return B.addDefaultOverride(e,s,i),B}static registerRenderer(e,s){return registerRenderer(e,s),B}static registerEditor(e,s){return registerEditor(e,s),B}static defineSkin(e,s){return skinRegistry.define(e,s),B}static defineIconSet(e){for(const[s,i]of Object.entries(e))iconRegistry.register(s,i);return B}static defineLocale(e,s,i){return localeRegistry.register(e,s,i),B}restore(e){return this._ovk.restore(e),this}restoreAll(){return this._ovk.restoreAll(),this}hasOverride(e){return this._ovk.hasOverride(e)}getOverrideNames(){return this._ovk.getOverrideNames()}getStrategy(e,s){return this._ovk.getStrategy(e,s)}_mount(){var e,s,i;this.$bQ=new ExtensionPointRegistry({kernel:this._ovk,getTrigMgr:()=>this.$B}),this.$bQ.registerRenderHook({id:"displayText",gate:()=>this.hasOverride("getDisplayValue")||this._ovk.hasStrategy("displayFormatter"),resolve:(a,h)=>this.getDisplayValue(a,h)}),this.$bQ.registerRenderHook({id:"cellClass",gate:()=>this._ovk.hasStrategy("cellClassResolver"),resolve:(a,h)=>{const c=this._ovk.getStrategy("cellClassResolver",null);return c?c(this.readCell(a,h),h,this._data.getRowByIndex(a)):null}}),this.$bQ.registerRenderHook({id:"ariaLabel",gate:()=>this._ovk.hasStrategy("ariaLabelResolver"),resolve:(a,h)=>{const c=this._ovk.getStrategy("ariaLabelResolver",null);return c?c(this.readCell(a,h),h,this._data.getRowByIndex(a)):null}}),this._container.classList.add("og-container");const n=this._options.height,r=this._options.width;this._container.style.height=typeof n=="number"?`${n}px`:String(n),this._container.style.width=typeof r=="number"?`${r}px`:String(r),this._container.style.display="flex",this._container.style.flexDirection="column",this._container.style.overflow="hidden",this._container.style.boxSizing="border-box",this._container.style.border="1px solid var(--og-border-color, #e0e0e0)",this._container.style.fontFamily="var(--og-font-family, -apple-system, sans-serif)",this._container.style.fontSize="var(--og-font-size, 13px)",this._container.setAttribute("data-og-theme",this._options.theme),this._container.setAttribute("data-og-skin",this._options.skin??"default");for(const[a,h]of Object.entries(this._options.cssVars))this._container.style.setProperty(a,h);this.$dh=new AppearanceResolver(new ThemeContext(this._options.theme,this._options.skin??"default")),this._renderer=new GridRenderer(this._container,this._options,{onHeaderClick:(a,h)=>this._handleSortClick(a,h),onCellClick:(a,h,c)=>this._handleCellClick(a,h,c),onCellDblClick:(a,h,c)=>this._handleCellDblClick(a,h,c),onCellMouseOver:(a,h,c)=>this._handleCellMouseOver(a,h,c),onCellMouseOut:(a,h,c)=>this._handleCellMouseOut(a,h,c),onCellMouseDown:(a,h,c)=>this._handleCellMouseDown(a,h,c),onCellMouseUp:(a,h,c)=>this._handleCellMouseUp(a,h,c),onCellMouseMove:(a,h,c)=>this._handleCellMouseMove(a,h,c),onRowCheck:(a,h)=>this._handleRowCheck(a,h),onAllCheck:a=>this._handleAllCheck(a),onColResize:(a,h)=>this._handleColResize(a,h),onFilterIconClick:(a,h)=>this._handleFilterIconClick(a,h),getDndManager:()=>this.$ey,onColDragStart:a=>{this._editMgr.dragColIdx=a},onColDrop:a=>{this._editMgr.dragColIdx!==null&&this._editMgr.dragColIdx!==a&&this.$mT(this._editMgr.dragColIdx,a),this._editMgr.dragColIdx=null},getColDragIdx:()=>this._editMgr.dragColIdx,resolveRenderHook:(a,h,c)=>this.$bQ.resolveRenderHook(a,h,c),getDisplayFormatter:()=>this._ovk.getStrategy("displayFormatter",null)??null,getFormulaMeta:(a,h)=>this._formula.getFormulaMeta(a,h),t:(a,h)=>this.t(a,h),applyCF:(a,h,c,d,f,u,p)=>{if(!this.$dp||!this.$fQ)return;const g=this.$ep.get(c);if(!g)return;const m=this.$dp.paintFor({value:d,rowIndex:h,columnId:c,rowState:"none"},g,this.$fQ,makeRect(0,0,f,u),{now:Date.now()});applyVisualSpecs(a,m,f,u,p)}},this.$dh),this._renderer.setSortIndicator(this._sortIndicator),this._render=new RenderController({getContainer:()=>this._container,getOptions:()=>this._options,getRenderer:()=>this._renderer,getVs:()=>this._vs,getPagination:()=>this._pagination,getData:()=>this._data,getColLayout:()=>this._colLayout,getFlatModel:()=>this._flatModel,getMergeEngine:()=>this.$eR,getColWidths:()=>this._colWidths,setColWidths:a=>{this._colWidths=a},getUserWidths:()=>this.$nu,getSfMgr:()=>this._sfMgr,getRowMgr:()=>this._rowMgr,getEditMgr:()=>this._editMgr,getGrpMgr:()=>this._grpMgr,getDetailMgr:()=>this._detailMgr,getRangeMgr:()=>this._rangeMgr,buildDetailRenderContext:()=>this.$lk(),submitRender:a=>this._scheduler.submit(a)}),this.$C=new MutationService({getData:()=>this._data,getVs:()=>this._vs,getPagination:()=>this._pagination,getFlatModel:()=>this._flatModel,getColLayout:()=>this._colLayout,getContainer:()=>this._container,getTrigMgr:()=>this.$B,getRowMgr:()=>this._rowMgr,getGrpMgr:()=>this._grpMgr,getOptions:()=>this._options,emit:(a,h)=>{this.emit(a,h)},announce:a=>this._announce(a),t:(a,h)=>this.t(a,h),applyFilters:()=>this.$lc(),flushFormula:()=>this._formula.flushRecalc(),submitRender:a=>this._scheduler.submit(a),resetFormulaState:()=>{var a,h;this._formulaDirtySeeds.clear(),this._recalc=new RecalcCoordinator({accessor:this._formula.buildAccessor(),setComputedValue:(c,d,f)=>this._data.setComputedValueByRowId(c,d,f),onFormulaError:(c,d,f)=>this._formula.handleFormulaError(c,d,f),refMode:((a=this._options.formula)==null?void 0:a.refMode)??"stable",divisionPrecision:((h=this._options.formula)==null?void 0:h.divisionPrecision)??30})},seedFormulaDirty:(a,h)=>{const c=this._flatModel.resolveFlatRow(a);c.kind==="data"&&c.rowId&&this._formulaDirtySeeds.add(cellKey(c.rowId,h))},invalidateRemovedRows:a=>{for(const h of a)this._formula.afterRecalc(this._recalc.invalidateRow(h),{skipRender:!0})},getRowIdAt:a=>{var h;return(h=this._data.getRowByIndex(a))==null?void 0:h[ROW_ID_FIELD]}}),this._rangeMgr.mount(this._renderer.bodyWrapper),this.$cz=new FilterPanel(this._container,(a,h)=>this.setFilter(a,h),a=>this.resetFilter(a),(a,h)=>this.t(a,h)),this._container.setAttribute("role","grid"),this._container.setAttribute("aria-label",this._options.ariaLabel??((e=this._options.cssVars)==null?void 0:e["aria-label"])??this.t("grid.containerAria")),this._container.setAttribute("aria-rowcount","0"),this._container.setAttribute("aria-colcount",String(this._options.columns.filter(a=>!a.hidden).length)),this.$ao=document.createElement("div"),this.$ao.setAttribute("aria-live","polite"),this.$ao.setAttribute("aria-atomic","true"),this.$ao.className="og-live-region",Object.assign(this.$ao.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:"0"}),this._container.appendChild(this.$ao),this._container.tabIndex=0,this._container.addEventListener("keydown",a=>this._handleKeyDown(a)),this._container.addEventListener("keyup",a=>this._handleCellKeyEvt("cellKeyUp",a)),this._container.addEventListener("keypress",a=>this._handleCellKeyEvt("cellKeyPress",a)),this._vs=new VirtualScroll(this._renderer.bodyWrapper,{rowHeight:this._options.rowHeight,onRender:(a,h)=>this._scheduler.submit(RenderRequest.rowsInclusive(a,h)),requestRender:(a,h,c)=>this._scheduler.submit(c?RenderRequest.SCROLLED:RenderRequest.WINDOW_CHANGED)});const l=this._renderer.bodyWrapper;l.addEventListener("scroll",()=>{const{scrollTop:a,scrollLeft:h,scrollHeight:c,clientHeight:d}=l;this.emit("scroll",{scrollTop:a,scrollLeft:h,isAtTop:a<=0,isAtBottom:a+d>=c-1})},{passive:!0}),crossGridRegistry.register(this._renderer.bodyWrapper,this),this.$aF=new CrossGridController({getSelf:()=>this,getData:()=>this._data,getColLayout:()=>this._colLayout,getOptions:()=>this._options,emit:(a,h)=>{this.emit(a,h)},insertRow:(a,h)=>this.insertRow(a,h),deleteRow:a=>this.deleteRow(a),getChecked:()=>this._rowMgr.getChecked(),uncheckAll:()=>this._rowMgr.uncheckAll(),dragRowSet:a=>this.$il(a),getPeerController:a=>a.$aF}),this._options.draggable&&(this.$ey=new RowDragDrop(this._renderer.bodyWrapper,this._options.rowHeight,(a,h)=>this._handleRowDrop(a,h),this._options.crossGrid?{resolveTarget:(a,h)=>{const c=crossGridRegistry.resolveAt(a,h,this);return!c||!c._options.crossGrid?null:{bodyEl:c._crossBodyEl(),rowHeight:c._options.rowHeight,totalRows:c._data.rowCount}},onCrossDrop:(a,h,c)=>this.$aF.handleCrossGridDrop(a,h,c)}:void 0,a=>this.$il(a).length)),this._options.pagination&&(this._pagination=new Pagination(this._container,this._options.pageSize,a=>{this.emit("pageChange",a),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)},(a,h)=>this.t(a,h))),this._findMgr.init(this._container),this.$iY(),(s=this._options.worksheets)!=null&&s.length&&this.$mg(),this._options.density!=null&&this.setDensity(this._options.density),this._options.texture!=null&&this.setTexture(this._options.texture),(i=this._options.conditionalFormat)!=null&&i.length&&this.setConditionalFormat(this._options.conditionalFormat),this.$bB=new ResizeObserver(()=>this.$dM()),this.$bB.observe(this._container),this.$dM()}$iY(){const e=this._options.contextMenu;e!==!1&&(this.$bh&&this._container.removeEventListener("contextmenu",this.$bh),this.$bi&&this._container.removeEventListener("keydown",this.$bi),this.$bh=this.$bi=null,this.$au=new ContextMenuManager(this._container,{onSortAsc:()=>{const s=this._colLayout.visibleLeaves[0];s&&this.orderBy(s.field,"asc")},onSortDesc:()=>{const s=this._colLayout.visibleLeaves[0];s&&this.orderBy(s.field,"desc")},onFind:()=>this._findMgr.open(),onExcel:()=>this.exportExcel(),onCsv:()=>this.exportCsv(),onPrint:()=>this.print()},(s,i)=>this.t(s,i)),this.$bh=s=>{var i;const n=s.target.closest(".og-cell");if(!n)return;s.preventDefault();const r=Number(n.dataset.colIndex??-1),l=this._colLayout.visibleLeaves[r];l&&this.$au&&(this.$au._actions.onSortAsc=()=>this.orderBy(l.field,"asc"),this.$au._actions.onSortDesc=()=>this.orderBy(l.field,"desc"));const a=Array.isArray(e)?e:void 0;(i=this.$au)==null||i.open(s,a)},this._container.addEventListener("contextmenu",this.$bh),this.$bi=s=>{var i;if(s.shiftKey&&s.key==="F10"){s.preventDefault();const n=this._container.getBoundingClientRect(),r={clientX:n.left+80,clientY:n.top+40};(i=this.$au)==null||i.open(r)}},this._container.addEventListener("keydown",this.$bi))}openContextMenu(e,s){var i;(i=this.$au)==null||i.open(e,s)}closeContextMenu(){var e;(e=this.$au)==null||e.close()}setFilterSelect(e){var s;(s=this.$gi)==null||s.destroy(),this.$gi=null,e&&(this._container.id||(this._container.id=`og-${Math.random().toString(36).slice(2,7)}`),this.$gi=new FilterSelectPanel(this._container,e,(i,n)=>this.setFilter(i,n),i=>this.resetFilter(i),this._container.id,(i,n)=>this.t(i,n)))}setOptions(e){var s;if(Object.assign(this._options,e),"contextMenu"in e&&((s=this.$au)==null||s.destroy(),this.$au=null,this.$iY()),"groupBy"in e||"summary"in e){const i=e.groupBy??[];i.length>0?this._grpMgr.groupBy(i):this.clearGroup();return}this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}setMaskEnabled(e,s){var i;const n=this._colLayout.getColumnByField(e);n&&(s?(n._maskRevealed=!1,(i=n._maskRevealedRows)==null||i.clear()):n._maskRevealed=!0,this._scheduler.submit(RenderRequest.REPAINT_VISIBLE))}getMaskEnabled(e){const s=this._colLayout.getColumnByField(e);return s?s._maskRevealed!==!0:!1}$mg(){const e=this._options.worksheets;this._wsManager=new WorksheetManager(this._container,(s,i)=>this.$jm(i),(s,i)=>this.t(s,i));for(const s of e)this._wsManager.add(s.name,s.columns??this._options.columns,s.data??[])}$jm(e){var s,i;this._rowMgr.reset(),this._data.setData(e.data),this._colLayout=new ColumnLayout(e.columns.length?e.columns:this._options.columns,this._options.frozenColumns),(s=this._vs)==null||s.setTotalRows(this._data.rowCount),(i=this._pagination)==null||i.setTotalRows(this._data.rowCount),this._container.setAttribute("aria-rowcount",String(this._data.rowCount)),this._container.setAttribute("aria-colcount",String(this._colLayout.visibleLeaves.length));const{width:n}=this._container.getBoundingClientRect();n&&this._recalcWidths(n),this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}addWorksheet(e,s,i){this._wsManager||(this._wsManager=new WorksheetManager(this._container,(n,r)=>this.$jm(r),(n,r)=>this.t(n,r))),this._wsManager.add(e,s??this._options.columns,i??[])}removeWorksheet(e){var s;(s=this._wsManager)==null||s.remove(e)}switchWorksheet(e){var s;(s=this._wsManager)==null||s.switch(e)}renameWorksheet(e,s){var i;(i=this._wsManager)==null||i.rename(e,s)}getWorksheet(e){var s;return(s=this._wsManager)==null?void 0:s.get(e)}getWorksheetNames(){var e;return((e=this._wsManager)==null?void 0:e.getNames())??[]}exportSheetsExcel(e){this._exportMgr.exportSheetsExcel(e)}$dM(){this._render.onResize()}_recalcWidths(e){this._render.recalcWidths(e)}_renderHeader(){this._render.renderHeader()}$nA(){this._render.syncHeaderLayout()}_doRender(e,s,i,n){this._render.doRender(e,s,i,n)}$lk(){if(!this._detailMgr.enabled)return;const e=this._options.masterDetail??{};return{toggleMode:e.toggle??"expander-col",ariaLabel:e.ariaLabel??this.t("grid.detailRegion"),getRowId:s=>s==null?void 0:s[ROW_ID_FIELD],isExpanded:s=>this._detailMgr.isExpandedId(s),onToggle:(s,i)=>this._detailMgr.toggleRow({id:i}),getGlyph:s=>getDetailGlyph(s,(i,n)=>this.t(i,n)),getPanelHost:s=>this._detailMgr.getPanelHost(s),onBeforeTeardown:()=>this._detailMgr.onBeforeTeardown()}}_handleGroupToggle(e){this._grpMgr.handleGroupToggle(e)}_visRange(){return this._render.visRange()}_handleSortClick(e,s){this._sfMgr.handleSortClick(e,s)}$ny(e){return isToggleCol(e)}_handleCellClick(e,s,i){this._cellEvt.handleCellClick(e,s,i)}_handleCellDblClick(e,s,i){this._cellEvt.handleCellDblClick(e,s,i)}_handleCellMouseOver(e,s,i){this._cellEvt.handleCellMouseOver(e,s,i)}_handleCellMouseOut(e,s,i){this._cellEvt.handleCellMouseOut(e,s,i)}_handleCellMouseDown(e,s,i){this._cellEvt.handleCellMouseDown(e,s,i)}_handleCellMouseUp(e,s,i){this._cellEvt.handleCellMouseUp(e,s,i)}_handleCellMouseMove(e,s,i){this._cellEvt.handleCellMouseMove(e,s,i)}_handleCellKeyEvt(e,s){this._cellEvt.handleCellKeyEvt(e,s)}_handleRowCheck(e,s){this._rowMgr.check(e,s),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE),this.emit("rowCheck",{rowIndex:e,checked:s,row:this._data.getRowByIndex(e)})}_handleFilterIconClick(e,s){var i,n;if((i=this.$cz)!=null&&i.isOpen){this.$cz.close();return}const r=this._sfMgr.filters[e]??[];(n=this.$cz)==null||n.open(e,s,r)}_handleAllCheck(e){this._rowMgr.checkAll(e,this._data.rowCount),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE),this.emit("allCheck",{checked:e})}_handleRowDrop(e,s){var i,n;this._data.moveRow(e,s),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE),this.emit("rowDrop",{fromIndex:e,toIndex:s}),(n=(i=this._options).onRowDrop)==null||n.call(i,{fromIndex:e,toIndex:s})}_crossBodyEl(){return this._renderer.bodyWrapper}$il(e){const s=[...this._rowMgr.selectedRows];return s.length>1&&s.includes(e)?s.sort((i,n)=>i-n):[e]}moveRowsTo(e,s,i){return this.$aF.moveRowsTo(e,s,i)}moveCheckedTo(e){return this.$aF.moveCheckedTo(e)}reorderRow(e,s){this._data.moveRow(e,s),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}_handleColResize(e,s){this._render.commitColumnWidth(e,s)}_handleKeyDown(e){this._kbdMgr.handleKeyDown(e)}_setFocusCell(e,s){this._rowMgr.selectSingle(e),this._editMgr.setFocusCell(e,s)}_announce(e){this.$ao&&(this.$ao.textContent="",setTimeout(()=>{this.$ao&&(this.$ao.textContent=e)},50))}$lg(){for(const[e,s]of Object.entries(OPTION_EVENTS))this.on(e,i=>{var n,r;return(r=(n=this._options)[s])==null?void 0:r.call(n,i)})}setData(e){this.$C.setData(e),this.$dp&&(this.$jY(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE))}getData(){return this._data.getData()}getSourceRows(){return this._data.getOriginalData()}pushData(e){var s,i;const n=[...this._data.getAllData(),...e];this._data.setData(n);const r=this._data.rowCount;(s=this._vs)==null||s.setTotalRows(this._flatModel.count()),(i=this._pagination)==null||i.setTotalRows(r)}prefixData(e){var s,i;const n=[...e,...this._data.getAllData()];this._data.setData(n);const r=this._data.rowCount;(s=this._vs)==null||s.setTotalRows(this._flatModel.count()),(i=this._pagination)==null||i.setTotalRows(r)}async setConditionalFormat(e){if(this.$fR=e,!e.length){this.$dp=null,this.$ep.clear(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE);return}const s=await Promise.resolve().then(()=>require("./index-HaDoF1HM.cjs"));this.$dp=new s.CFEngine(new s.CFRuleStore(e)),this.$fQ=s.staticAppearanceView(),this.$hY=s.computeColumnStats,this.$jY(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}$jY(){const e=this.$hY;if(!this.$fR.length||!e){this.$ep.clear();return}const s=new Set(this.$fR.map(r=>r.scope.columnId)),i=this._data.getData(),n=new Map;for(const r of s)n.set(r,e(i.map(l=>l[r])));this.$ep=n}async setRealtimeSource(e,s){var i;(i=this.$cg)==null||i.detach(),this.$cg=null;const n=await Promise.resolve().then(()=>require("./index-DbKDox8y.cjs")),l={mutation:{writeCell:(u,p,g)=>this.$C.writeCell(u,p,g),writeCells:u=>this.$C.writeCells(u.map(p=>({...p}))),insertRow:(u,p)=>this.$C.insertRow(u,p??"last"),deleteRows:u=>this.$C.deleteRow([...u]),beginBatch:()=>this.$C.beginBatch(),endBatch:()=>this.$C.endBatch()},coords:{rowCount:()=>this._flatModel.count(),rowIdAt:u=>this._flatModel.rowIdOfFlat(u)??void 0,indexOf:u=>this._flatModel.flatIndexOfRowId(u),getCellValue:(u,p)=>this._data.getCellValueByRowId(u,p),getRowSnapshot:u=>{const p=this._data.getRowById(u);return p?{...p}:void 0}},values:{equals:(u,p)=>Object.is(u,p)},clock:{now:()=>Date.now()}},a={dispatchSilent:u=>u.do(l),beginBatch:()=>this.$C.beginBatch(),endBatch:()=>this.$C.endBatch()},h={rowIdToIndex:u=>this._flatModel.flatIndexOfRowId(u),indexToRowId:u=>this._flatModel.rowIdOfFlat(u)??void 0},c={readSelection:()=>[],readScroll:()=>{var u;return{pixelWithinRow:0,scrollLeft:((u=this._renderer)==null?void 0:u.bodyWrapper.scrollLeft)??0}},readEditing:()=>{},readSortFilterSig:()=>"",writeSelection:()=>{},writeScroll:()=>{},writeEditing:()=>{}},d={sink:a,stateGuard:new n.LiveStateGuard(c,h),freshness:new n.FreshnessClock({staleAfterMs:(s==null?void 0:s.staleAfterMs)??5e3}),announce:new n.RtAnnouncePolicy({announce:(s==null?void 0:s.announce)??(()=>{}),...(s==null?void 0:s.debounceMs)!==void 0?{debounceMs:s.debounceMs}:{}}),...s!=null&&s.scheduleFrame?{scheduleFrame:s.scheduleFrame}:{},...(s==null?void 0:s.maxBatchPerFrame)!==void 0?{maxBatchPerFrame:s.maxBatchPerFrame}:{},applySnapshot:u=>this.setData(u)},f=new n.RealtimeController(e,d);return this.$cg=f,f.attach(),f}disconnectRealtime(){var e;(e=this.$cg)==null||e.detach(),this.$cg=null}clearData(){this._rowMgr.reset(),this._data.clearData(),this.$C.commit({totals:"zero",renderMode:"full",emitPayload:()=>[]})}insertRow(e,s="last"){this.$C.insertRow(e,s)}pushRow(e){this.$C.pushRow(e)}appendRows(e){this.pushRow(e)}unshiftRow(e){(Array.isArray(e)?e:[e]).forEach(i=>this._data.addRow(i,"first")),this.$C.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>this._data.getData()})}prependRows(e){this.unshiftRow(e)}deleteRow(e){this.$C.deleteRow(e)}deleteById(e){}readCell(e,s){return this._data.getCellValue(e,s)}getDisplayValue(e,s){const i=this.readCell(e,s);return this._ovk.getStrategy("displayFormatter",(r,l,a)=>r==null?"":String(r))(i,s,this._data.getRowByIndex(e))}writeCell(e,s,i){this.$C.writeCell(e,s,i)}getRowAt(e){return this._data.getRowByIndex(e)}getFlatRow(e){return this._flatModel.rowAt(e)}getFlatRowModel(){return this._flatModel}beginBatch(){this.$C.beginBatch()}endBatch(){this.$C.endBatch()}setCellFormula(e,s,i){this._formula.setCellFormula(e,s,i)}getCellFormula(e,s){return this._formula.getCellFormula(e,s)}hasCellFormula(e,s){return this._formula.hasCellFormula(e,s)}clearCellFormula(e,s){this._formula.clearCellFormula(e,s)}getCellError(e,s){return this._formula.getCellError(e,s)}getDependents(e,s){return this._formula.getDependents(e,s)}getPrecedents(e,s){return this._formula.getPrecedents(e,s)}recalculate(){this._formula.recalculate()}recalculateCell(e,s){this._formula.recalculateCell(e,s)}offsetFormula(e,s,i,n){return this._formula.offsetFormula(e,s,i,n)}writeCells(e){return this.$C.writeCells(e)}getRangeSelection(){return this._rangeMgr.getRangeSelection()}getActiveRange(){return this._rangeMgr.getActiveRange()}setRangeSelection(e){this._rangeMgr.setRangeSelection(e)}clearRangeSelection(){this._rangeMgr.clearRangeSelection()}getRangeValues(){return this._rangeMgr.getRangeValues()}getRangeStats(){return this._rangeMgr.getRangeStats()}fillRange(e,s,i="copy"){this._rangeMgr.fillRange(e,s,i)}createChart(e){return this._chartMgr.createChart(e)}getCharts(){return this._chartMgr.getCharts()}destroyCharts(){this._chartMgr.destroyCharts()}getChanges(){return this._data.getChanges()}getEditedRows(){return this._data.getEditedRows()}getChangedRows(){return this._data.getChangedRows()}getChangedColumns(){return this._data.getChangedColumns()}getAddedRows(){return this._data.getAddedRows()}getRemovedRows(){return this._data.getRemovedRows()}getOriginalRow(e){return this._data.getOriginalRow(e)}getRowsWithState(e){return this._data.getRowsWithState(e)}undo(){}redo(){}clearHistory(){}getColumnDefs(){return this._colLayout.visibleLeaves.slice()}getAllColumnDefs(){return this._colLayout.leaves}getColumnCount(){return this._colLayout.visibleLeaves.length}applyColumns(e){const s=this.$B.mkCtx("applyColumns",[e]);this.$B.exec("before:applyColumns",s)&&(this._colLayout.setColumns(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE),s.result={columnCount:e.length},this.$B.exec("after:applyColumns",s))}insertColumn(e,s){this._colLayout.addColumn(e,s),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}deleteColumn(e){this._colLayout.removeColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._formula.afterRecalc(this._recalc.invalidateField(e),{skipRender:!0}),this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}$mT(e,s){var i,n;const r=this._colLayout.visibleLeaves.map(h=>h);if(e<0||s<0||e>=r.length||s>=r.length)return;const l=[...this._options.columns],[a]=l.splice(e,1);l.splice(s,0,a),this._options.columns=l,this.applyColumns(l),(n=(i=this._options).onColumnReorder)==null||n.call(i,{fromIndex:e,toIndex:s,field:a.field??""})}hideColumn(e){this._colLayout.hideColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}showColumn(e){this._colLayout.showColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}getColumnIndex(e){return this._colLayout.getColumnIndex(e)}getFieldAt(e){var s;return((s=this._colLayout.getColumnByIndex(e))==null?void 0:s.field)??""}getColValues(e,s=!1){return this._data.getData().map(i=>i[e])}getUniqueValues(e,s=!1){return[...new Set(this.getColValues(e,s))]}setColWidths(e){}calcColWidths(e=!1){return[]}getSelections(){return this._rowMgr.getSelections()}getActiveRow(){return this._rowMgr.getActiveRow()}activate(e){this._rowMgr.activate(e),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}deselect(){this._rowMgr.deselect(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}getChecked(){return this._rowMgr.getChecked()}getAllChecked(){return this._rowMgr.getAllChecked()}checkById(e){}addCheckById(e){}checkByValue(e,s){this._rowMgr.checkByValue(e,s),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}uncheckById(e){}uncheckAll(){this._rowMgr.uncheckAll(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}orderBy(e,s="asc"){const i=this.$B.mkCtx("orderBy",[e,s]);this.$B.exec("before:orderBy",i)&&(this._sfMgr.sort(e,s),this.$fe(),i.result={sortList:this._sfMgr.sortList},this.$B.exec("after:orderBy",i))}resetOrder(){this._sfMgr.resetSort(),this.$fe()}setFilter(e,s){const i=this.$B.mkCtx("setFilter",[e,s]);this.$B.exec("before:setFilter",i)&&(this._sfMgr.setFilter(e,s),this.$fe(),i.result={field:e,filteredCount:this._data.rowCount},this.$B.exec("after:setFilter",i))}resetFilter(e){this._sfMgr.resetFilter(e),this.$fe()}$fe(){this._formula.recalcRangeBearingFormulas()}getFilterState(){return this._sfMgr.getFilterState()}restoreFilter(e){this._sfMgr.restoreFilter(e)}$lc(){this._sfMgr.applyFilters()}freeze(e){this._colLayout.setFrozen(e),this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}mergeCells(e){this.$eR.applyMergeCells(e),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}autoMerge(e){const s=this._colLayout.visibleLeaves,i=[],n=[];for(const r of e){const l=s.findIndex(a=>a.field===r);l>=0&&(i.push(l),n.push(r))}this.$eR.applyAutoMerge(this._data.getData(),i,n),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}clearMerge(){this.$eR.clear(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}freezeRows(e){}groupBy(e){const s=this.$B.mkCtx("groupBy",[e]);this.$B.exec("before:groupBy",s)&&(this._grpMgr.groupBy(e),s.result={fields:e},this.$B.exec("after:groupBy",s))}clearGroup(){this._grpMgr.clearGroup()}expandAll(){this._grpMgr.expandAll()}collapseAll(){this._grpMgr.collapseAll()}enableTree(){this._grpMgr.enableTree()}disableTree(){this._grpMgr.disableTree()}expandNodes(e,s=!0){this._grpMgr.expandNodes(e,s)}expandAllNodes(){this._grpMgr.expandAllNodes()}collapseAllNodes(){this._grpMgr.collapseAllNodes()}expandRow(e){this._detailMgr.expandRow(e)}collapseRow(e){this._detailMgr.collapseRow(e)}toggleRow(e){this._detailMgr.toggleRow(e)}isRowExpanded(e){return this._detailMgr.isRowExpanded(e)}collapseAllDetails(){this._detailMgr.collapseAllDetails()}getDetailInstance(e){return this._detailMgr.getDetailInstance(e)}resyncPanelWidths(){this._detailMgr.resyncPanelWidths()}addTreeRow(e,s,i){}exportExcel(e){this._exportMgr.exportExcel(e)}exportCsv(e){this._exportMgr.exportCsv(e)}exportJson(e){this._exportMgr.exportJson(e)}print(e){this._exportMgr.print(e)}setPageSize(e){var s;if(!Number.isInteger(e)||e<1)throw new RangeError(`OpenGrid.setPageSize: size must be an integer >= 1 (got ${e})`);this._options.pageSize=e,(s=this._pagination)==null||s.setPageSize(e)}openFindBar(){this._findMgr.open()}closeFindBar(){this._findMgr.close()}toArray(e=!0){const s=this._data.getData();if(e)return s;const i=this._colLayout.visibleLeaves;return s.map(n=>i.map(r=>n[r.field]))}jumpToRow(e){var s;this._rowMgr.selectSingle(e),(s=this._vs)==null||s.scrollToRow(e),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}jumpToCol(e){var s;(s=this._render)==null||s.revealColumn(this._colLayout.visibleLeaves.findIndex(i=>i.field===e))}getScrollPos(){var e,s;return{x:((e=this._renderer)==null?void 0:e.bodyWrapper.scrollLeft)??0,y:((s=this._renderer)==null?void 0:s.bodyWrapper.scrollTop)??0}}setFooter(e){this._options.footer=e,this.$mR()}getFooterData(){return this._footerMgr.computeValues()}getFooterValue(e){var s;return((s=this._footerMgr.computeValues().find(i=>i._field===e))==null?void 0:s._value)??null}$mR(){this._footerMgr.render()}resize(e,s){e&&(this._container.style.width=`${e}px`),s&&(this._container.style.height=`${s}px`),this.$dM()}setTheme(e){this._container.setAttribute("data-og-theme",e)}setThemeVar(e,s){this._container.style.setProperty(e,s)}setSkin(e){var s;this._options.skin=e,this._container.setAttribute("data-og-skin",e),(s=this.$dh)==null||s.setSkin(e),this._container.style.border=e==="default"?"1px solid var(--og-border-color, #e0e0e0)":this.$dh?this.$dh.border():"1px solid var(--og-border-color, #e0e0e0)",this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE)}getSkin(){return this._options.skin??"default"}setIcon(e,s){var i;this.$dG||(this.$dG=iconRegistry.child()),this.$dG.register(e,s);try{(i=this.$bQ)==null||i.strategy("iconResolver",(n,r)=>this.$dG.render(n,r))}catch{}return this}renderIcon(e,s){return(this.$dG??iconRegistry).render(e,s)}setLocale(e){var s,i;const n=this.getLocale();(this._locales??(this._locales=localeRegistry.child())).setActive(e),this._options.locale=e,this._container.setAttribute("lang",(this._locales??localeRegistry).meta().intlLocale),(s=this._pagination)==null||s.refreshLabels(),(i=this._findMgr)==null||i.refreshLabels(),this.$cz=null,this._renderHeader(),this._scheduler.submit(RenderRequest.REPAINT_VISIBLE),this.emit("localeChange",{locale:e,prev:n})}getLocale(){return(this._locales??localeRegistry).active()}setMessage(e,s){return(this._locales??(this._locales=localeRegistry.child())).setOverride(e,s),this}t(e,s){return(this._locales??localeRegistry).t(e,s)}setSkinVar(e,s){if(/#[0-9a-fA-F]{3,8}\b/.test(s)||/\b(?:rgba?|hsla?)\(\s*\d/.test(s))throw new Error(`[OpenGrid.setSkinVar] "${e}: ${s}" 에 색 리터럴 — 색은 setThemeVar 축입니다(색⊥형태).`);this._container.style.setProperty(e,s)}setDensity(e){const s=densityRegistry.resolve(e);s.attr?this._container.setAttribute(s.attr.name,s.attr.value):this._container.removeAttribute("data-og-density");for(const n of DENSITY_TOKENS)this._container.style.removeProperty(n);this._container.style.removeProperty("--og-row-height");for(const[n,r]of Object.entries(s.tokens))this._container.style.setProperty(n,r);const i=s.tokens["--og-density-row-height"];i!=null&&this._container.style.setProperty("--og-row-height",i),this.$hz??(this.$hz=this._options.rowHeight),this.$hH(i!=null?parseFloat(i):this.$hz),s.requiresRelayout&&this.$dM()}setRowHeight(e){if(!Number.isFinite(e)||e<1)throw new RangeError(`OpenGrid.setRowHeight: px must be a finite number >= 1 (got ${e})`);this.$hz=e,this.$hH(e),this.$dM()}$hH(e){var s,i;this._options.rowHeight=e,(s=this._vs)==null||s.setRowHeight(e),(i=this.$ey)==null||i.setRowHeight(e)}setTexture(e){const s=textureRegistry.resolve(e);s.attr?this._container.setAttribute(s.attr.name,s.attr.value):this._container.removeAttribute("data-og-texture");for(const i of TEXTURE_TOKENS)this._container.style.removeProperty(i);for(const[i,n]of Object.entries(s.tokens))this._container.style.setProperty(i,n)}addTrigger(e,s){return this.$B.add(e,s),this}removeTrigger(e,s){return this.$B.remove(e,s),this}clearTriggers(e){return this.$B.clear(e),this}$nz(e,s){return this.$B.mkCtx(e,s)}$nB(e,s){return this.$B.exec(e,s)}destroy(){var e,s,i,n,r,l,a,h,c,d,f,u,p,g,m,w;this.$aG||(this.$aG=!0,(e=gridsByContainer.get(this._container))==null||e.delete(this),this._renderer&&crossGridRegistry.unregister(this._renderer.bodyWrapper),this.$B.clear(),(s=this.$bB)==null||s.disconnect(),(i=this._vs)==null||i.destroy(),(n=this._scheduler)==null||n.destroy(),(r=this._render)==null||r.destroy(),(l=this.$cg)==null||l.detach(),this.$cg=null,(a=this._chartMgr)==null||a.destroyCharts(),(h=this._detailMgr)==null||h.destroy(),(c=this._footerMgr)==null||c.destroy(),(d=this.$cz)==null||d.destroy(),(f=this.$ey)==null||f.destroy(),this.$bh&&this._container.removeEventListener("contextmenu",this.$bh),this.$bi&&this._container.removeEventListener("keydown",this.$bi),this.$bh=this.$bi=null,(u=this.$au)==null||u.destroy(),(p=this._wsManager)==null||p.destroy(),(g=this._renderer)==null||g.destroy(),(m=this.$ao)==null||m.remove(),this.$ao=null,this._container.innerHTML="",(w=gridsByContainer.get(this._container))!=null&&w.size||this._container.classList.remove("og-container"),this.removeAllListeners())}};_OpenGrid._defaultOverrides=[],_OpenGrid._defaultStrategies=[],_OpenGrid.defaults={strategy(o,e){return _OpenGrid.addDefaultStrategy(o,e),_OpenGrid}};let OpenGrid=_OpenGrid;exports.DEFAULT_ICON_ROLES=DEFAULT_ICON_ROLES,exports.IconRegistry=IconRegistry,exports.LocaleRegistry=LocaleRegistry,exports.OpenGrid=OpenGrid,exports.SkinRegistry=SkinRegistry,exports.buildTree=buildTree,exports.contrastRatio=contrastRatio,exports.iconRegistry=iconRegistry,exports.localeRegistry=localeRegistry,exports.parseColor=parseColor,exports.renderIcon=renderIcon,exports.skinRegistry=skinRegistry,exports.t=t;
|
|
98
|
+
//# sourceMappingURL=OpenGrid-Bh1NMOcm.cjs.map
|