open-grid 1.1.1 → 1.2.0
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 +20 -0
- package/README.md +30 -1
- package/dist/{OpenGrid-yg4mw6Ge.js → OpenGrid-B0Spm0rU.js} +2777 -1878
- package/dist/OpenGrid-CuXj0isp.cjs +97 -0
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-vue.cjs +1 -1
- package/dist/open-grid-vue.js +1 -1
- package/dist/open-grid.cjs +5 -5
- package/dist/open-grid.js +155 -152
- package/dist/types/core/CellEditManager.d.ts +2 -0
- package/dist/types/core/ChartManager.d.ts +2 -0
- package/dist/types/core/ContextMenu.d.ts +5 -1
- package/dist/types/core/DetailManager.d.ts +2 -0
- package/dist/types/core/ExportManager.d.ts +7 -0
- package/dist/types/core/FilterPanel.d.ts +4 -1
- package/dist/types/core/FilterSelect.d.ts +4 -1
- package/dist/types/core/FindBarManager.d.ts +6 -0
- package/dist/types/core/FormulaController.d.ts +2 -0
- package/dist/types/core/GridComposer.d.ts +5 -0
- package/dist/types/core/GridRenderer.d.ts +3 -0
- package/dist/types/core/KeyboardManager.d.ts +2 -0
- package/dist/types/core/MutationService.d.ts +2 -0
- package/dist/types/core/OpenGrid.d.ts +393 -34
- package/dist/types/core/Pagination.d.ts +6 -1
- package/dist/types/core/RangeSelectionManager.d.ts +2 -0
- package/dist/types/core/SortFilterManager.d.ts +2 -0
- package/dist/types/core/WorksheetManager.d.ts +4 -1
- package/dist/types/core/detail/DetailGlyph.d.ts +3 -1
- package/dist/types/core/i18n/LocaleRegistry.d.ts +0 -0
- package/dist/types/core/i18n/interpolate.d.ts +5 -0
- package/dist/types/core/i18n/locales/en.d.ts +166 -0
- package/dist/types/core/i18n/locales/ko.d.ts +166 -0
- package/dist/types/core/i18n/types.d.ts +249 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +5 -0
- package/dist/types/core/types.d.ts +352 -96
- package/dist/types/index.d.ts +22 -0
- package/package.json +3 -1
- package/dist/OpenGrid-LcZ5iixx.cjs +0 -97
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";class ks{constructor(){this.listeners=new Map}on(e,t){const s=this.listeners.get(e)??[];return s.push({handler:t,once:!1}),this.listeners.set(e,s),this}once(e,t){const s=this.listeners.get(e)??[];return s.push({handler:t,once:!0}),this.listeners.set(e,s),this}off(e,t){if(!t)return this.listeners.delete(e),this;const s=this.listeners.get(e);if(s){const o=s.filter(i=>i.handler!==t);o.length===0?this.listeners.delete(e):this.listeners.set(e,o)}return this}emit(e,...t){const s=this.listeners.get(e);if(!s||s.length===0)return!1;const o=[];for(const i of s)i.handler(...t),i.once||o.push(i);return o.length!==s.length&&(o.length===0?this.listeners.delete(e):this.listeners.set(e,o)),!0}removeAllListeners(e){return e?this.listeners.delete(e):this.listeners.clear(),this}listenerCount(e){var t;return((t=this.listeners.get(e))==null?void 0:t.length)??0}}class Es{constructor(e,t){this._totalRows=0,this._scrollTop=0,this._viewportHeight=0,this._rafId=null,this._onScroll=()=>{this._scrollTop=this.container.scrollTop,this._scheduleRender()},this.container=e,this.rowHeight=t.rowHeight,this.overscan=t.overscan??5,this.onRender=t.onRender,this.container.addEventListener("scroll",this._onScroll,{passive:!0})}_scheduleRender(){this._rafId===null&&(this._rafId=requestAnimationFrame(()=>{this._rafId=null;const e=this.getVisibleRange();this.onRender(e.startIndex,e.endIndex)}))}getVisibleRange(){const e=Math.ceil(this._viewportHeight/this.rowHeight),t=Math.max(0,Math.floor(this._scrollTop/this.rowHeight)-this.overscan),s=Math.min(this._totalRows-1,t+e+this.overscan*2),o=t*this.rowHeight;return{startIndex:t,endIndex:s,offsetY:o}}setTotalRows(e){this._totalRows=e,this._updateSpacerHeight(),this._scheduleRender()}setViewportHeight(e){this._viewportHeight=e,this._scheduleRender()}setRowHeight(e){this.rowHeight=e,this._updateSpacerHeight(),this._scheduleRender()}scrollToRow(e){const t=e*this.rowHeight,s=t+this.rowHeight,o=this._scrollTop+this._viewportHeight;if(t<this._scrollTop)this._scrollTop=t,this.container.scrollTop=t;else if(s>o){const i=s-this._viewportHeight;this._scrollTop=i,this.container.scrollTop=i}}getTotalHeight(){return this._totalRows*this.rowHeight}_updateSpacerHeight(){const e=this.container.querySelector(".og-spacer");e&&(e.style.height=`${this.getTotalHeight()}px`)}destroy(){this.container.removeEventListener("scroll",this._onScroll),this._rafId!==null&&cancelAnimationFrame(this._rafId)}}class Jt{constructor(e,t=0){this._flatLeaves=[],this._maxDepth=1,this._frozenCount=0,this._columns=e,this._frozenCount=t,this._process()}_process(){const e=[];let t=0;const s=(o,i)=>{for(const n of o)n.children&&n.children.length>0?(s(n.children,i+1),this._maxDepth=Math.max(this._maxDepth,i+1)):e.push({...n,_colIndex:t++,_depth:i,_leaf:!0})};this._maxDepth=1,s(this._columns,1),this._flatLeaves=e}get leaves(){return this._flatLeaves}get visibleLeaves(){return this._flatLeaves.filter(e=>!e.hidden)}get headerDepth(){return this._maxDepth}get frozenCount(){return this._frozenCount}setFrozen(e){this._frozenCount=e}setColumns(e){this._columns=e,this._process()}hideColumn(e){const t=Array.isArray(e)?e:[e];this._flatLeaves.forEach(s=>{t.includes(s.field)&&(s.hidden=!0)})}showColumn(e){const t=Array.isArray(e)?e:[e];this._flatLeaves.forEach(s=>{t.includes(s.field)&&(s.hidden=!1)})}addColumn(e,t="last"){t==="last"?this._columns.push(e):t==="first"?this._columns.unshift(e):this._columns.splice(t,0,e),this._process()}removeColumn(e){const t=s=>s.filter(o=>o.field===e?!1:(o.children&&(o.children=t(o.children)),!0));this._columns=t(this._columns),this._process()}getColumnByField(e){return this._flatLeaves.find(t=>t.field===e)}getColumnByIndex(e){return this._flatLeaves[e]}getColumnIndex(e){return this._flatLeaves.findIndex(t=>t.field===e)}buildHeaderCells(){const e=Array.from({length:this._maxDepth},()=>[]);let t=0;const s=(o,i)=>{let n=0;for(const a of o)if(!a.hidden)if(a.children&&a.children.length>0){const l=s(a.children,i+1);l>0&&(e[i-1].push({column:a,colIndex:t,depth:i,colSpan:l,rowSpan:1}),n+=l)}else e[i-1].push({column:a,colIndex:t++,depth:i,colSpan:1,rowSpan:this._maxDepth-i+1}),n++;return n};return s(this._columns,1),e}computeWidths(e,t=100){const s=this.visibleLeaves,o=s.filter(l=>l.flex),i=s.filter(l=>!l.flex&&l.width).reduce((l,d)=>l+d.width,0),n=o.reduce((l,d)=>l+(d.flex??1),0),a=Math.max(0,e-i);return s.map(l=>l.flex?Math.round(l.flex/n*a):l.width??t)}}class Fs{constructor(e,t,s){this._field="",this._outsideHandler=null,this._onApply=t,this._onClear=s,this._el=document.createElement("div"),this._el.className="og-filter-panel",this._el.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: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._el)}open(e,t,s){var p;this._field=e,this._el.innerHTML="";const o=document.createElement("div");o.textContent="필터",o.style.cssText="font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);",this._el.appendChild(o);const i=document.createElement("div");i.style.cssText="display:flex;gap:4px;margin-bottom:6px;";const n=document.createElement("select");n.style.cssText="flex:1;padding:3px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:12px;";const a=[{label:"포함",value:"contains"},{label:"같음",value:"="},{label:"같지 않음",value:"!="},{label:"시작",value:"startsWith"},{label:"끝남",value:"endsWith"},{label:"보다 큼",value:">"},{label:"보다 작음",value:"<"},{label:"이상",value:">="},{label:"이하",value:"<="}];for(const f of a){const w=document.createElement("option");w.value=f.value,w.textContent=f.label,n.appendChild(w)}s[0]&&(n.value=s[0].operator),i.appendChild(n),this._el.appendChild(i);const l=document.createElement("input");l.type="text",l.placeholder="필터 값 입력...",l.value=((p=s[0])==null?void 0:p.value)??"",l.style.cssText=`
|
|
7
|
-
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
8
|
-
border-radius:3px;font-size:12px;box-sizing:border-box;margin-bottom:8px;
|
|
9
|
-
outline:none;
|
|
10
|
-
`,l.addEventListener("keydown",f=>{f.key==="Enter"?h.click():f.key==="Escape"&&this.close()}),this._el.appendChild(l);const d=document.createElement("div");d.style.cssText="display:flex;gap:6px;justify-content:flex-end;";const c=document.createElement("button");c.textContent="초기화",c.style.cssText=`
|
|
11
|
-
padding:3px 10px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
12
|
-
border-radius:3px;background:#fff;cursor:pointer;font-size:12px;color:#666;
|
|
13
|
-
`,c.addEventListener("click",()=>{this._onClear(this._field),this.close()});const h=document.createElement("button");h.textContent="적용",h.style.cssText=`
|
|
14
|
-
padding:3px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
15
|
-
border-radius:3px;background:var(--og-primary,#1976d2);
|
|
16
|
-
color:#fff;cursor:pointer;font-size:12px;
|
|
17
|
-
`,h.addEventListener("click",()=>{const f=l.value.trim();f?this._onApply(this._field,[{operator:n.value,value:f}]):this._onClear(this._field),this.close()}),d.appendChild(c),d.appendChild(h),this._el.appendChild(d);const u=t.getBoundingClientRect(),g=this._el.parentElement.getBoundingClientRect();this._el.style.top=`${u.bottom-g.top+2}px`,this._el.style.left=`${Math.min(u.left-g.left,g.width-220)}px`,this._el.style.display="block",requestAnimationFrame(()=>l.focus()),this._outsideHandler&&document.removeEventListener("mousedown",this._outsideHandler),this._outsideHandler=f=>{!this._el.contains(f.target)&&f.target!==t&&this.close()},setTimeout(()=>document.addEventListener("mousedown",this._outsideHandler),0)}close(){this._el.style.display="none",this._outsideHandler&&(document.removeEventListener("mousedown",this._outsideHandler),this._outsideHandler=null)}get isOpen(){return this._el.style.display!=="none"}destroy(){this.close(),this._el.remove()}}const Ss=10;function Ls(r,e=Ss){const t=Math.pow(10,e);return Math.round(r*t)/t}class v{constructor(e,t){this._c=e,this._s=t<0?0:t}static from(e){if(e instanceof v)return e;if(typeof e=="bigint")return new v(e,0);const t=String(e).trim();if(!t||t==="null"||t==="undefined"||t==="NaN")return new v(0n,0);const s=t.startsWith("-"),o=s?t.slice(1):t,i=o.indexOf(".");let n,a;if(i===-1)n=BigInt(o),a=0;else{const l=o.slice(i+1);n=BigInt(o.slice(0,i)+l),a=l.length}return new v(s?-n:n,a)}static zero(){return new v(0n,0)}static one(){return new v(1n,0)}static _align(e,t){return e._s===t._s?[e._c,t._c,e._s]:e._s>t._s?[e._c,t._c*10n**BigInt(e._s-t._s),e._s]:[e._c*10n**BigInt(t._s-e._s),t._c,t._s]}add(e){const[t,s,o]=v._align(this,v.from(e));return new v(t+s,o)}sub(e){const[t,s,o]=v._align(this,v.from(e));return new v(t-s,o)}mul(e){const t=v.from(e);return new v(this._c*t._c,this._s+t._s)}div(e,t=20){const s=v.from(e);if(s._c===0n)throw new Error("OGDecimal: division by zero");const i=this._c*10n**BigInt(t+s._s)/s._c;return new v(i,t+this._s)}mod(e){const t=v.from(e),[s,o,i]=v._align(this,t);return new v(s%o,i)}neg(){return new v(-this._c,this._s)}abs(){return new v(this._c<0n?-this._c:this._c,this._s)}eq(e){const[t,s]=v._align(this,v.from(e));return t===s}gt(e){const[t,s]=v._align(this,v.from(e));return t>s}lt(e){const[t,s]=v._align(this,v.from(e));return t<s}gte(e){return!this.lt(e)}lte(e){return!this.gt(e)}isZero(){return this._c===0n}isNeg(){return this._c<0n}isPos(){return this._c>0n}toFixed(e){let t=this._c,s=this._s;if(s<e)t=t*10n**BigInt(e-s);else if(s>e){const c=10n**BigInt(s-e),h=c/2n,u=t<0n,g=u?-t:t,p=g%c;let f=g/c;p>=h&&(f+=1n),t=u?-f:f}s=e;const o=t<0n,n=(o?-t:t).toString().padStart(e+1,"0"),a=n.slice(0,n.length-e)||"0",l=e>0?"."+n.slice(n.length-e):"";return(o?"-":"")+a+l}toString(){if(this._s===0)return this._c.toString();let e=this._c,t=this._s;for(;t>0&&e!==0n&&e%10n===0n;)e/=10n,t--;return new v(e,t).toFixed(t)}toNumber(){return parseFloat(this.toFixed(20))}static sum(e){return e.reduce((t,s)=>t.add(s),v.zero())}static avg(e,t=20){return e.length?v.sum(e).div(e.length,t):v.zero()}static min(e){if(!e.length)throw new Error("OGDecimal.min: empty array");return e.map(v.from).reduce((t,s)=>t.lt(s)?t:s)}static max(e){if(!e.length)throw new Error("OGDecimal.max: empty array");return e.map(v.from).reduce((t,s)=>t.gt(s)?t:s)}}function Qt(r,e,t=30){return new Is(r,e,t).parse()}class Is{constructor(e,t,s){this._ctx=t,this._prec=s,this._pos=0,this._src=e.trim()}parse(){const e=this._additive();if(this._skip(),this._pos<this._src.length)throw new SyntaxError(`FormulaEngine: 예상치 못한 토큰 '${this._src[this._pos]}' (위치 ${this._pos})`);return e}_additive(){let e=this._multiplicative();for(this._skip();this._pos<this._src.length;){const t=this._src[this._pos];if(t!=="+"&&t!=="-")break;this._pos++,this._skip();const s=this._multiplicative();e=t==="+"?e.add(s):e.sub(s),this._skip()}return e}_multiplicative(){let e=this._unary();for(this._skip();this._pos<this._src.length;){const t=this._src[this._pos];if(t!=="*"&&t!=="/"&&t!=="%")break;this._pos++,this._skip();const s=this._unary();t==="*"?e=e.mul(s):t==="/"?e=e.div(s,this._prec):e=e.mod(s),this._skip()}return e}_unary(){return this._skip(),this._src[this._pos]==="-"?(this._pos++,this._unary().neg()):this._primary()}_primary(){this._skip();const e=this._src[this._pos];if(e==="("){this._pos++;const t=this._additive();if(this._skip(),this._src[this._pos]!==")")throw new SyntaxError("FormulaEngine: 닫는 괄호 ) 누락");return this._pos++,t}return e==="["?this._fieldRef():this._literal()}_fieldRef(){this._pos++;const e=this._pos;for(;this._pos<this._src.length&&this._src[this._pos]!=="]";)this._pos++;if(this._pos>=this._src.length)throw new SyntaxError("FormulaEngine: 닫는 ] 누락");const t=this._src.slice(e,this._pos);this._pos++;const s=this._ctx[t];if(s==null)throw new ReferenceError(`FormulaEngine: 필드 '[${t}]'가 행 데이터에 없습니다`);return v.from(s)}_literal(){const e=this._pos;for(;this._pos<this._src.length&&/[0-9.]/.test(this._src[this._pos]);)this._pos++;const t=this._src.slice(e,this._pos);if(!t)throw new SyntaxError(`FormulaEngine: 숫자 또는 [필드]를 기대했지만 '${this._src[this._pos]??"EOF"}' 발견 (위치 ${e})`);return v.from(t)}_skip(){for(;this._pos<this._src.length&&/\s/.test(this._src[this._pos]);)this._pos++}}function nt(r,e){if(r==null||r==="")return r??"";const t=typeof e=="string"?{type:e}:e,s=t.char??"*";switch(t.type){case"ssn":return As(r,s);case"phone":case"mobile":return Ts(r,s);case"email":return Ds(r,s);case"credit":return $s(r,s);case"account":return Os(r,s,t.visiblePrefix??3,t.visibleSuffix??4);case"password":return s.repeat(Math.max(r.length,6));case"name":return zs(r,s);case"ip":return Hs(r,s);case"partial":return Oe(r,s,t.visiblePrefix??0,t.visibleSuffix??4);default:return r}}function As(r,e){const t=r.replace(/[^0-9]/g,"");if(t.length<7){const n=r.includes("-")?"-":"",a=r.indexOf("-")>=0?r.indexOf("-"):6;return r.slice(0,a)+n+e.repeat(Math.max(1,r.length-a-n.length))}const s=t.slice(0,6),o=t[6],i=t.length-7;return`${s}-${o}${e.repeat(i)}`}function Ts(r,e){const t=r.replace(/[^0-9]/g,"");return t.length===11?`${t.slice(0,3)}-${e.repeat(4)}-${t.slice(7)}`:t.length===10?t.startsWith("02")?`${t.slice(0,2)}-${e.repeat(4)}-${t.slice(6)}`:`${t.slice(0,3)}-${e.repeat(3)}-${t.slice(6)}`:t.length===9?`${t.slice(0,2)}-${e.repeat(3)}-${t.slice(5)}`:Oe(r,e,3,4)}function Ds(r,e){const t=r.indexOf("@");if(t<0)return Oe(r,e,2,0);const s=r.slice(0,t),o=r.slice(t),i=Math.min(2,s.length),n=s.slice(0,i),a=Math.max(s.length-i,3);return`${n}${e.repeat(a)}${o}`}function $s(r,e){const t=r.replace(/[^0-9]/g,"");if(t.length<8)return r;const s=t.slice(0,4),o=t.slice(-4),i=t.length-8,n=e.repeat(Math.max(i,8)),a=[s];for(let l=0;l<n.length;l+=4){const d=n.slice(l,l+4);d&&a.push(d)}return a.push(o),a.join("-")}function Os(r,e,t,s){const o=r.replace(/[^0-9]/g,"");if(o.length<=t+s)return Oe(o,e,t,s);const i=o.slice(0,t),n=o.slice(-s),a=o.length-t-s;return`${i}-${e.repeat(a)}-${n}`}function zs(r,e){const t=r.trim();return t.length===0?r:t.length===1?e:t.length===2?`${t[0]}${e}`:`${t[0]}${e.repeat(t.length-2)}${t[t.length-1]}`}function Hs(r,e){const t=r.split(".");if(t.length!==4)return Oe(r,e,3,0);const s=o=>e.repeat(Math.max(o.length,3));return`${t[0]}.${t[1]}.${s(t[2])}.${s(t[3])}`}function Oe(r,e,t,s){if(r.length<=t+s)return r;const o=r.slice(0,t),i=s>0?r.slice(-s):"",n=r.length-t-s;return`${o}${e.repeat(n)}${i}`}const Bs="#e0e0e0";class Ke{constructor(e="default",t="default"){this.theme=e,this.skin=t}}class ut{constructor(e=new Ke){this._ctx=e}get context(){return this._ctx}_skinActive(){return this._ctx.skin!=="default"}setSkin(e){this._ctx=new Ke(this._ctx.theme,e)}_borderColorVar(){return`var(--og-border-color,${Bs})`}border(e){let t=(e==null?void 0:e.style)??"solid";if(e!=null&&e.state&&(t="solid"),this._skinActive()){const s="var(--og-border-width, 1px)",o=e!=null&&e.state?"solid":`var(--og-border-style, ${t})`;return`${s} ${o} ${this._borderColorVar()}`}return`1px ${t} ${this._borderColorVar()}`}divider(){return this._skinActive()?`var(--og-border-width, 1px) var(--og-divider-style, solid) ${this._borderColorVar()}`: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 t={sm:"0 1px 2px",md:"0 2px 6px",lg:"0 8px 24px"},s={sm:"0.07",md:"0.10",lg:"0.14"};return`var(--og-elevation-${e}, ${t[e]}) rgba(var(--og-shadow-ink, 0 0 0), var(--og-elevation-alpha-${e}, ${s[e]}))`}focusRing(e){let t=(e==null?void 0:e.width)??2,s=(e==null?void 0:e.style)??"solid";t<2&&(t=2),s==="none"&&(s="solid");const o=(e==null?void 0:e.color)??"var(--og-focus-border,var(--og-primary,#1976d2))";return this._skinActive()&&(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) ${o}`:`${t}px ${s} ${o}`}}const Ee=new ut,Vs="0 0 16 16",rt={"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(rt).length;const es={"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"},Ps="";function Ns(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}class je{constructor(e,t){if(this._roles=new Map,this._parent=t,e)for(const[s,o]of Object.entries(e))this.register(s,o)}register(e,t){const s=Object.prototype.hasOwnProperty.call(rt,t)?rt[t]:t;return this._roles.set(e,s),this}has(e){var t;return this._roles.has(e)||(((t=this._parent)==null?void 0:t.has(e))??!1)}resolveBody(e){const t=this._roles.get(e);return t!==void 0?t:this._parent?this._parent.resolveBody(e):null}child(){return new je(void 0,this)}render(e,t){const s=this.resolveBody(e)??Ps,o=t==null?void 0:t.size,i=o!=null?` width="${o}" height="${o}"`:"",n=t==null?void 0:t.title,a=n?`<title>${Ns(n)}</title>`:"",d=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Vs}"${i} fill="currentColor"${n?' role="img"':""} style="stroke-linejoin:var(--og-icon-corner, miter)">${a}${s}</svg>`;return t!=null&&t.el?new DOMParser().parseFromString(d,"image/svg+xml").documentElement:d}roles(){return[...this._roles.keys()]}}const xe=new je(es);function Ws(r,e){return xe.render(r,e)}function ts(r){if(r.hasCellFormula)return null;const e=r.column;if(!e.formula)return null;const t=e.formulaPrecision??30;try{let s;return typeof e.formula=="function"?s=e.formula(r.row,v):s=Qt(e.formula,r.row,t),s instanceof v?e.precision!=null?s.toFixed(e.precision):s.toString():typeof s=="string"?s:e.precision!=null?v.from(s).toFixed(e.precision):String(s)}catch(s){return console.warn("[OpenGrid] Formula error:",s),"#ERR"}}function Ks(r,e,t,s,o,i){if(r==null||r==="")return"";let n=Number(r);if(isNaN(n))return String(r);if(t!=null&&(n=Ls(n,t)),s)try{return new Intl.NumberFormat(void 0,{style:"currency",currency:s,...t!=null?{minimumFractionDigits:t,maximumFractionDigits:t}:{}}).format(n)}catch{}if(!e)return t!=null?n.toFixed(t):String(n);const a=e.indexOf(";"),l=a>=0?e.slice(a+1):null,d=n<0&&l!=null?l:a>=0?e.slice(0,a):e,c=n<0&&l!=null?Math.abs(n):n,h=d.match(/[#0][#0,]*(?:\.[#0]+)?/);if(!h)return String(n);const u=h[0],g=d.slice(0,h.index),p=d.slice(h.index+u.length),f=u.includes(","),w=u.includes(".")?u.split(".")[1].length:t??0,m=c.toLocaleString("ko-KR",{minimumFractionDigits:w,maximumFractionDigits:w,useGrouping:f});return g+m+p}function ss(r,e="yyyy-MM-dd",t,s){if(!r)return"";const o=r instanceof Date?r:new Date(r);if(isNaN(o.getTime()))return String(r);const i=o.getFullYear(),n=String(o.getMonth()+1).padStart(2,"0"),a=String(o.getDate()).padStart(2,"0");return e.replace("yyyy",String(i)).replace("MM",n).replace("dd",a)}function Us(r,e,t){const s=nt(r,e.mask),o=document.createElement("span");o.style.cssText="display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";const i=document.createElement("span");i.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);",i.textContent=s;const n=document.createElement("button");return n.title="클릭하면 원문 표시",n.setAttribute("aria-label","마스킹 해제"),n.innerHTML=xe.render("mask.reveal",{size:13}),n.style.cssText=`flex-shrink:0;background:none;border:none;cursor:pointer;color:#c0c0c0;padding:1px 2px;line-height:0;border-radius:${Ee.radius(3)};display:flex;align-items:center;`,n.addEventListener("mouseover",()=>{n.style.color="var(--og-primary,#1976d2)",n.style.background="rgba(25,118,210,0.08)"}),n.addEventListener("mouseout",()=>{n.style.color="#c0c0c0",n.style.background="none"}),n.addEventListener("click",a=>{a.stopPropagation(),i.textContent=r,i.style.fontFamily="",i.style.letterSpacing="",i.style.color="",n.remove(),(e._maskRevealedRows??(e._maskRevealedRows=new Set)).add(t)}),o.appendChild(i),o.appendChild(n),o}class Fe{render(e){var l;const t=document.createElement("span");t.className="og-cell-text";const s=ts(e);if(s!==null)return t.textContent=s,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",t;const{value:o,column:i,rowIndex:n}=e;if(e.displayValue!=null)return t.textContent=e.displayValue,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",t;let a;if(i.valueMap&&o!=null&&i.valueMap[o]?a=i.valueMap[o]:a=o==null?"":String(o),i.mask){const d=i._maskRevealed===!0,c=((l=i._maskRevealedRows)==null?void 0:l.has(n))===!0;if(!d&&!c)return Us(a,i,n)}return t.textContent=a,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",t}}class qs{constructor(e=[],t){this._opts=e.map(s=>typeof s=="string"?{label:s,value:s}:{label:s.label??s.text??String(s.value??""),value:s.value}),this._fn=t??null}render(e){const t=document.createElement("span");t.className="og-cell-text",t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;";const s=e.value;if(s==null||s==="")return t;const o=String(s),n=(this._fn?this._fn(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._opts).find(a=>String(a.value)===o);return t.textContent=n?n.label:o,t}}class js{render(e){const t=document.createElement("span");t.className="og-cell-number";const s=ts(e);if(s!==null)return t.textContent=s,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",t;if(e.displayFormatter){const o=e.displayFormatter(e.value,e.column.field??"",e.row);if(o!=null)return t.textContent=o,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",t}return t.textContent=Ks(e.value,e.column.format??"#,##0",e.column.precision,e.column.currency,e.column.field,e.row),t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",t}}class Gs{render(e){const t=document.createElement("span");t.className="og-cell-date";const s=e.displayFormatter?e.displayFormatter(e.value,e.column.field??"",e.row):null;return s!=null?t.textContent=s:t.textContent=ss(e.value,e.column.format,e.column.field,e.row),t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",t}}class is{render(e){const t=document.createElement("span");t.className="og-cell-checkbox",t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("input");return s.type="checkbox",s.checked=!!e.value,s.disabled=!0,s.style.cssText+="cursor:pointer;pointer-events:none;",t.appendChild(s),t}}class Ys{constructor(e){this.def=e}render(e){var n,a,l,d;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("button");s.className=`og-cell-btn${(n=this.def)!=null&&n.buttonClass?" "+this.def.buttonClass:""}`;const o=(a=this.def)==null?void 0:a.label,i=typeof o=="function"?o(e.value,e.row):o??String(e.value??"btn");if(s.style.cssText=`
|
|
18
|
-
padding:2px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
19
|
-
border-radius:4px;background:var(--og-row-bg,#fff);color:var(--og-primary,#1976d2);
|
|
20
|
-
cursor:pointer;font-size:12px;white-space:nowrap;transition:background 0.12s;
|
|
21
|
-
${((l=this.def)==null?void 0:l.style)??""}
|
|
22
|
-
`,(d=this.def)!=null&&d.icon){s.style.display="inline-flex",s.style.alignItems="center",s.style.gap="4px";const c=document.createElement("span");c.style.cssText="display:inline-flex;flex-shrink:0;",c.innerHTML=xe.render(this.def.icon,{size:13});const h=document.createElement("span");h.textContent=i,this.def.iconPos==="right"?(s.appendChild(h),s.appendChild(c)):(s.appendChild(c),s.appendChild(h))}else s.textContent=i;return s.addEventListener("mouseover",()=>s.style.background="var(--og-primary-light,#e3f2fd)"),s.addEventListener("mouseout",()=>s.style.background="var(--og-row-bg,#fff)"),t.appendChild(s),t}}class Xs{constructor(e,t){this.colorMap=e,this.labelMap=t}render(e){var a,l,d;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;height:100%;";const s=document.createElement("span"),o=e.value==null?"":String(e.value),i=((a=this.labelMap)==null?void 0:a[o])??((l=e.column.valueMap)==null?void 0:l[o])??o;s.textContent=i;const n=((d=this.colorMap)==null?void 0:d[o])??"#666";return s.style.cssText=`
|
|
23
|
-
display:inline-block;padding:2px 8px;border-radius:${Ee.radius(12)};font-size:11px;
|
|
24
|
-
background:${n}22;color:${n};border:1px solid ${n}66;
|
|
25
|
-
white-space:nowrap;
|
|
26
|
-
`,t.appendChild(s),t}}class Zs{constructor(e,t){this.hrefFn=e,this.target=t}render(e){const t=document.createElement("a");return t.className="og-cell-link",t.textContent=e.value==null?"":String(e.value),t.href=this.hrefFn?this.hrefFn(e.value,e.row):"#",this.target&&(t.target=this.target),t.style.cssText="color:var(--og-primary,#1976d2);text-decoration:underline;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",this.hrefFn||t.addEventListener("click",s=>s.preventDefault()),t}}class Js{constructor(e){this.templateFn=e}render(e){const t=document.createElement("div");return t.className="og-cell-template",t.style.cssText="display:flex;align-items:center;height:100%;overflow:hidden;",t.innerHTML=this.templateFn(e.value,e.row,e.rowIndex),t}}class Qs{constructor(e){this.def=e}render(e){var d,c,h,u,g;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("img"),o=(d=this.def)!=null&&d.srcFn?this.def.srcFn(e.value,e.row):String(e.value??"");s.src=o;const i=((c=this.def)==null?void 0:c.width)??28,n=((h=this.def)==null?void 0:h.height)??28,a=((u=this.def)==null?void 0:u.radius)??4;s.style.cssText=`width:${i}px;height:${n}px;object-fit:cover;border-radius:${Ee.radius(a)};display:block;`;const l=(g=this.def)==null?void 0:g.alt;return s.alt=typeof l=="function"?l(e.value,e.row):l??"",s.onerror=()=>{s.style.display="none"},t.appendChild(s),t}}class ei{constructor(e){this.def=e}render(e){var d,c,h,u;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;gap:5px;width:100%;padding:0 4px;box-sizing:border-box;";const s=((d=this.def)==null?void 0:d.max)??100,o=Number(e.value)||0,i=Math.min(100,Math.max(0,o/s*100)),n=(c=this.def)!=null&&c.colorFn?this.def.colorFn(o):((h=this.def)==null?void 0:h.color)??"var(--og-primary,#1976d2)",a=document.createElement("div");a.className="og-progress-track",a.style.cssText=`flex:1;height:10px;background:#e0e0e0;border-radius:${Ee.radius(5)};overflow:hidden;`;const l=document.createElement("div");if(l.className="og-progress-fill",l.style.cssText=`width:${i}%;height:100%;background:${n};border-radius:${Ee.radius(5)};`,a.appendChild(l),t.appendChild(a),((u=this.def)==null?void 0:u.showLabel)!==!1){const g=document.createElement("span");g.style.cssText="font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;",g.textContent=`${Math.round(i)}%`,t.appendChild(g)}return t}}class ti{constructor(e){this.def=e}render(e){var c,h,u,g;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=Array.isArray(e.value)?e.value.map(Number):[];if(!s.length)return t.textContent="-",t;const o=((c=this.def)==null?void 0:c.width)??80,i=((h=this.def)==null?void 0:h.height)??22,n=((u=this.def)==null?void 0:u.color)??"#1976d2",a=((g=this.def)==null?void 0:g.chartType)??"bar",l=document.createElement("canvas");l.width=o,l.height=i,l.style.cssText="display:block;";const d=l.getContext("2d");if(d){const p=Math.max(...s,1),f=Math.min(...s,0),w=p-f||1,m=s.length;if(a==="bar"){const _=o/m;s.forEach((y,M)=>{const k=(y-f)/w*(i-2);d.fillStyle=n,d.fillRect(M*_+1,i-k-1,_-2,k)})}else{const _=s.map((y,M)=>({x:M/(m-1||1)*o,y:i-(y-f)/w*(i-4)-2}));a==="area"&&(d.fillStyle=n+"33",d.beginPath(),d.moveTo(_[0].x,i),_.forEach(y=>d.lineTo(y.x,y.y)),d.lineTo(_[_.length-1].x,i),d.closePath(),d.fill()),d.strokeStyle=n,d.lineWidth=1.5,d.beginPath(),_.forEach((y,M)=>M===0?d.moveTo(y.x,y.y):d.lineTo(y.x,y.y)),d.stroke()}}return t.appendChild(l),t}}class si{render(e){const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=!!e.value,o=document.createElement("span");o.className="og-switch"+(s?" og-switch--on":""),o.style.cssText=`display:inline-block;width:34px;height:18px;border-radius:${Ee.radius(9)};
|
|
27
|
-
background:${s?"var(--og-primary,#1976d2)":"#bdbdbd"};
|
|
28
|
-
position:relative;transition:background 0.2s;cursor:pointer;flex-shrink:0;pointer-events:none;`;const i=document.createElement("span");return i.style.cssText=`position:absolute;top:2px;left:${s?"16px":"2px"};
|
|
29
|
-
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
30
|
-
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`,o.appendChild(i),t.appendChild(o),t}}class ii{constructor(e){this.def=e}render(e){var n,a;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;gap:1px;height:100%;";const s=((n=this.def)==null?void 0:n.max)??5,o=Math.round(Number(e.value)||0),i=((a=this.def)==null?void 0:a.color)??"#ffa000";for(let l=1;l<=s;l++){const d=document.createElement("span");d.textContent="★",d.style.cssText=`font-size:14px;color:${l<=o?i:"#e0e0e0"};line-height:1;`,t.appendChild(d)}return t}}class oi{render(e){const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;pointer-events:none;";const s=document.createElement("input");return s.type="radio",s.checked=!!e.value,s.setAttribute("aria-checked",e.value?"true":"false"),s.setAttribute("aria-label",e.column.header??"선택"),e.column.group&&(s.name=`og-radio-${e.rowIndex}-${e.column.group}`),s.style.cssText="width:14px;height:14px;cursor:pointer;accent-color:var(--og-primary,#1976d2);",t.appendChild(s),t}}class ni{render(e){const t=document.createElement("span");if(t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;",!e.value)return t;const s=document.createElement("img");return s.src=String(e.value),s.alt=e.column.alt??e.column.field,s.style.cssText="max-width:100%;max-height:100%;object-fit:contain;display:block;",s.setAttribute("role","img"),t.appendChild(s),t}}function ri(r){const e=document.createElement("div");return e.innerHTML=r,e.querySelectorAll("script,iframe,object,embed").forEach(t=>t.remove()),e.querySelectorAll("*").forEach(t=>{for(const s of[...t.attributes])s.name.startsWith("on")&&t.removeAttribute(s.name);if(t.tagName==="A"){const s=t.getAttribute("href")??"";/^javascript:/i.test(s)&&t.removeAttribute("href")}}),e.innerHTML}class ai{render(e){const t=document.createElement("span");t.style.cssText="display:block;overflow:hidden;width:100%;";const s=e.column.sanitize!==!1,o=String(e.value??"");return t.innerHTML=s?ri(o):o,t}}const li=["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"],di="2331112";function Mt(r){let e="",t=!0;for(const s of r)e+=(t?"1":"0").repeat(+s),t=!t;return e}function ci(r){const e=[104];for(const s of r){const o=s.charCodeAt(0)-32;o>=0&&o<=94&&e.push(o)}let t=104;for(let s=1;s<e.length;s++)t+=e[s]*s;return e.push(t%103),e.map(s=>Mt(li[s])).join("")+Mt(di)+"11"}class hi{render(e){const t=String(e.value??""),s=e.column.barcodeHeight??28,o=document.createElement("div");o.style.cssText="display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;",o.setAttribute("role","img"),o.setAttribute("aria-label",`바코드: ${t}`),o.innerHTML=ui(t,s);const i=document.createElement("span");return i.textContent=t,i.style.cssText="font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;",o.appendChild(i),o}}function ui(r,e){if(!r)return"";const t=ci(r),s=1.4,o=6,i=t.length*s+o*2,n=[];let a=0,l=o;for(;a<t.length;)if(t[a]==="1"){let d=0;for(;a+d<t.length&&t[a+d]==="1";)d++;n.push(`<rect x="${l.toFixed(2)}" y="0" width="${(d*s).toFixed(2)}" height="${e}"/>`),l+=d*s,a+=d}else l+=s,a++;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${i.toFixed(2)} ${e}" width="${i.toFixed(2)}" height="${e}" style="display:block" aria-hidden="true"><g fill="currentColor">${n.join("")}</g></svg>`}const os=new Map;function G(r,e){os.set(r,e)}G("number",()=>new js);G("date",()=>new Gs);G("boolean",()=>new is);G("checkbox",()=>new is);G("radio",()=>new oi);G("img",()=>new ni);G("html",()=>new ai);G("barcode",()=>new hi);G("switch",()=>new si);G("select",r=>new qs(r.options??[],r.optionsFn));G("button",(r,e)=>new Ys(e));G("link",(r,e)=>new Zs(e==null?void 0:e.hrefFn,e==null?void 0:e.target));G("badge",(r,e)=>new Xs(e==null?void 0:e.colorMap,e?e.labelMap??e.valueMap:void 0));G("image",(r,e)=>e?new Qs(e):new Fe);G("progress",(r,e)=>e?new ei(e):new Fe);G("sparkline",(r,e)=>e?new ti(e):new Fe);G("rating",(r,e)=>e?new ii(e):new Fe);G("template",(r,e)=>e?new Js(e.templateFn):new Fe);function pi(r){const e=r.renderer;let t,s;e?typeof e=="string"?(t=e,s=void 0):(t=e.type,s=e):(t=String(r.type??""),s=void 0);const o=os.get(t);return o?o(r,s):new Fe}const gi={"#ERR":"수식 오류","#REF":"참조 대상이 삭제됨","#CYCLE":"순환 참조","#DIV0":"0으로 나눔","#NAME":"알 수 없는 함수/이름","#VALUE":"숫자가 아닌 값에 산술 연산","#NUM":"수치 도메인 오류"};class fi{constructor(e,t,s,o){this._cellMap=new Map,this._root=e,this._opts=t,this._cbs=s,this._ap=o??new ut(new Ke(t.theme??"default")),this._header=T("div","og-header"),this._header.style.cssText=`flex-shrink:0;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:${this._ap.divider()};scrollbar-width:none;`,this._bodyWrap=T("div","og-body-wrapper"),this._bodyWrap.style.cssText="flex:1;overflow:auto;position:relative;",this._bodyWrap.style.setProperty("--scrollbar-size","8px"),this._body=T("div","og-body"),this._body.style.cssText="position:relative;",this._bodyWrap.appendChild(this._body),e.appendChild(this._header),e.appendChild(this._bodyWrap),this._bodyWrap.addEventListener("scroll",()=>{this._header.scrollLeft=this._bodyWrap.scrollLeft},{passive:!0})}get bodyWrapper(){return this._bodyWrap}updateSize(e,t){this._bodyWrap.style.height=`${e-t}px`}getHeaderHeight(){return this._header.offsetHeight}renderHeader(e,t,s,o,i){var w,m,_,y;this._header.innerHTML="";const n=this._ap,a=i._frozenCount??0,l=!!((w=i.masterDetail)!=null&&w.enabled)&&(((m=i.masterDetail)==null?void 0:m.toggle)??"expander-col")==="expander-col",d=28;let c=0;i.stateColumn&&(c+=24),i.draggable&&(c+=18),i.rowNumber&&(c+=44),i.checkColumn&&(c+=36),l&&(c+=d);const h=c+t.reduce((M,k,b)=>M+(s[b]??i.defaultColumnWidth),0);this._header.style.background="var(--og-header-bg,#f5f5f5)";const u=T("table","og-header-table");u.setAttribute("role","presentation"),u.style.cssText=`table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${h}px;background:var(--og-header-bg,#f5f5f5);`;const g=e.length;let p=0;const f=(M,k,b,x="")=>{const E=T("th",`og-header-cell og-extra-col ${x}`);E.setAttribute("rowspan",String(g)),E.textContent=b,Et(E,{width:`${k}px`,minWidth:`${k}px`,textAlign:"center",borderRight:n.border(),borderBottom:n.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)"}),a>0&&(E.style.position="sticky",E.style.left=`${p}px`,E.style.zIndex="4"),p+=k,M.appendChild(E)};for(let M=0;M<e.length;M++){const k=T("tr","og-header-row");if(k.style.height=`${i.headerHeight}px`,M===0){if(i.stateColumn&&f(k,24,""),i.draggable&&f(k,18,""),i.rowNumber&&f(k,44,"No"),i.checkColumn){const b=T("th","og-header-cell og-extra-col");b.setAttribute("rowspan",String(g)),b.style.cssText=`width:36px;min-width:36px;text-align:center;border-right:${n.border()};border-bottom:${n.border()};border-top:0;border-left:0;line-height:normal;vertical-align:middle;background:var(--og-header-bg,#f5f5f5);box-sizing:border-box;`,a>0&&(b.style.position="sticky",b.style.left=`${p}px`,b.style.zIndex="4"),p+=36;const x=document.createElement("input");x.type="checkbox",x.setAttribute("aria-label","전체 행 선택"),x.style.cssText="width:16px;height:16px;",x.addEventListener("change",()=>this._cbs.onAllCheck(x.checked)),b.appendChild(x),k.appendChild(b)}l&&f(k,d,"","og-detail-toggle-col")}for(const b of e[M]??[]){const x=T("th","og-header-cell"),E=b.column;b.colSpan>1&&(x.colSpan=b.colSpan),b.rowSpan>1&&(x.rowSpan=b.rowSpan);const L=b.colSpan===1?t.findIndex(F=>F.field===E.field):-1;if(b.colSpan===1){const F=L>=0?s[L]??i.defaultColumnWidth:E.width??i.defaultColumnWidth;x.style.width=`${F}px`,x.style.minWidth=`${F}px`}const B=o.find(F=>F.field===E.field),z=E.sortable!==!1&&i.sortable&&b.colSpan===1;if(x.setAttribute("role","columnheader"),x.setAttribute("scope","col"),z&&(x.setAttribute("aria-sort",B?B.dir==="asc"?"ascending":"descending":"none"),x.tabIndex=L===0?0:-1,x.addEventListener("keydown",F=>{if(F.key==="Enter"||F.key===" ")F.preventDefault(),this._cbs.onHeaderClick(E.field,F.shiftKey);else if(F.key==="ArrowRight"){F.preventDefault();const D=x.nextElementSibling;(D==null?void 0:D.tagName)==="TH"&&D.focus()}else if(F.key==="ArrowLeft"){F.preventDefault();const D=x.previousElementSibling;(D==null?void 0:D.tagName)==="TH"&&D.focus()}})),L>=0&&L<a){let F=0;i.stateColumn&&(F+=24),i.draggable&&(F+=18),i.rowNumber&&(F+=44),i.checkColumn&&(F+=36),l&&(F+=d);for(let D=0;D<L;D++)F+=s[D]??i.defaultColumnWidth;x.classList.add("og-frozen"),L===a-1&&x.classList.add("og-frozen-last"),x.style.left=`${F}px`}const V=E.header??E.field,Z=typeof V=="string"&&V.indexOf(`
|
|
31
|
-
`)>=0,ee=E.headerWrap===!0||Z;Et(x,{padding:"4px 8px",boxSizing:"border-box",background:"var(--og-header-bg)",color:"var(--og-header-color)",lineHeight:ee?"1.3":"normal",verticalAlign:"middle",fontSize:"var(--og-font-size)",textAlign:E.headerAlign??"center",borderTop:"0",borderLeft:"0",borderRight:n.border(),borderBottom:n.border(),userSelect:"none",cursor:z?"pointer":"default",whiteSpace:ee?"normal":"nowrap",overflow:ee?"visible":"hidden",textOverflow:ee?"clip":"ellipsis",wordBreak:ee?"break-word":"normal",position:"relative"}),x.title=(typeof E.tooltip=="string"?E.tooltip:V)??"";const re=T("span");if(ee?(re.style.cssText="overflow:visible;text-overflow:clip;white-space:normal;word-break:break-word;",String(V).split(`
|
|
32
|
-
`).forEach((D,te)=>{te>0&&re.appendChild(document.createElement("br")),re.appendChild(document.createTextNode(D))})):(re.textContent=V,re.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"),x.appendChild(re),B){x.classList.add("og-sorted");const F=T("span","og-sort-icon");F.textContent=B.dir==="asc"?" ↑":" ↓",x.appendChild(F)}if(E.filterable!==!1&&i.filterable&&b.colSpan===1){const F=T("span","og-filter-icon"),D=(((y=(_=i._activeFilters)==null?void 0:_[E.field])==null?void 0:y.length)??0)>0;F.textContent=D?"⊿":"▿",F.title="필터",F.style.cssText="margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;",D&&F.classList.add("og-filter-icon--active"),F.addEventListener("click",te=>{te.stopPropagation(),this._cbs.onFilterIconClick(E.field,F)}),x.appendChild(F)}if(E.resizable!==!1){const F=T("div","og-resize-handle");F.style.cssText="position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;",x.appendChild(F);const D=L;_i(F,x,te=>{D>=0&&this._cbs.onColResize(D,te)})}i.columnReorder&&L>=0&&b.colSpan===1&&(x.draggable=!0,x.addEventListener("dragstart",F=>{var D;this._cbs.onColDragStart(L),x.classList.add("og-col-dragging"),(D=F.dataTransfer)==null||D.setData("text/plain",String(L))}),x.addEventListener("dragend",()=>{x.classList.remove("og-col-dragging"),this._header.querySelectorAll(".og-col-drop-over").forEach(F=>F.classList.remove("og-col-drop-over"))}),x.addEventListener("dragover",F=>{F.preventDefault();const D=this._cbs.getColDragIdx();D!==null&&D!==L&&(this._header.querySelectorAll(".og-col-drop-over").forEach(te=>te.classList.remove("og-col-drop-over")),x.classList.add("og-col-drop-over"))}),x.addEventListener("dragleave",()=>{x.classList.remove("og-col-drop-over")}),x.addEventListener("drop",F=>{F.preventDefault(),x.classList.remove("og-col-drop-over"),this._cbs.onColDrop(L)})),z&&x.addEventListener("click",F=>{F.target.classList.contains("og-resize-handle")||this._cbs.onHeaderClick(E.field,F.shiftKey)}),k.appendChild(x)}u.appendChild(k)}this._header.appendChild(u)}renderBody(e){var B,z,V,Z,ee,re,ze,F,D,te,He,Be,_t,mt,wt;const{startIndex:t,endIndex:s,data:o,leaves:i,widths:n,offsetY:a,totalHeight:l,selectedRows:d,checkedRows:c,groupFlatRows:h=null,onGroupToggle:u,onTreeToggle:g,extraOpts:p={},mergeEngine:f,detailApi:w}=e;let m=e.opts;const _=this._ap;Object.keys(p).length&&(m={...m,...p}),w==null||w.onBeforeTeardown(),this._body.innerHTML="",this._cellMap.clear();const y=m.autoHeight===!0;this._body.classList.toggle("og-autoheight",y),this._body.style.height=y?"":`${l}px`;const M=m._frozenCount??0,k=!!w&&(w.toggleMode??"expander-col")==="expander-col",b=28;let x=0;m.stateColumn&&(x+=24),m.draggable&&(x+=18),m.rowNumber&&(x+=44),m.checkColumn&&(x+=36),k&&(x+=b);const E=x+i.reduce((I,N,Ce)=>I+(n[Ce]??m.defaultColumnWidth),0);if(this._body.style.minWidth=`${E}px`,s<t)return;const L=document.createDocumentFragment();if(h&&w)for(let I=t-1;I>=0;I--){const N=h[I];if(!(N&&N._isDetailFiller===!0)){if(N&&N._isDetailHead===!0&&I+N._span-1>=t){const Ce=a+(I-t)*m.rowHeight;this._appendDetailPanel(L,N._rowId,Ce,N._span*m.rowHeight,E,w)}break}}for(let I=t;I<=s;I++){const N=h?h[I]:null;if(N&&N._isDetailFiller===!0)continue;if(N&&N._isDetailHead===!0&&w){const R=N,A=a+(I-t)*m.rowHeight;this._appendDetailPanel(L,R._rowId,A,R._span*m.rowHeight,E,w);continue}if(N&&N._isDetailHead===!0)continue;const Ce=N&&N._isGroup===!0,yt=N&&N._isTree===!0;if(Ce){const R=N,A=`__${R._groupField}:${R._groupValue}`,P=T("div","og-group-row"),ge=a+(I-t)*m.rowHeight;P.style.cssText=[y?"":`top:${ge}px;height:${m.rowHeight}px;`,"display:flex;align-items:stretch;cursor:pointer;",`padding-left:${4+R._depth*12}px;`,"background:var(--og-header-bg,#f5f5f5);",`border:0;border-bottom:${_.divider()};`].join(""),P.setAttribute("role","row"),P.setAttribute("aria-expanded",R._expanded?"true":"false"),P.setAttribute("aria-rowindex",String(I+1)),P.setAttribute("aria-level",String(R._depth+1));let U=0;if(m.stateColumn&&(U+=24),m.draggable&&(U+=18),m.rowNumber&&(U+=44),m.checkColumn&&(U+=36),k&&(U+=b),U>0){const C=T("div","og-group-state-cell");C.style.cssText=[`width:${U}px;min-width:${U}px;flex-shrink:0;`,"display:flex;align-items:center;justify-content:center;","font-size:10px;font-weight:700;gap:2px;",`border-right:${_.border()};`].join("");const q=R._states??{added:0,edited:0,removed:0};if(q.added>0){const H=T("span");H.textContent=`+${q.added}`,H.style.cssText=`color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:${_.radius(3)};`,C.appendChild(H)}if(q.edited>0){const H=T("span");H.textContent=`M${q.edited}`,H.style.cssText=`color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:${_.radius(3)};`,C.appendChild(H)}if(q.removed>0){const H=T("span");H.textContent=`D${q.removed}`,H.style.cssText=`color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:${_.radius(3)};`,C.appendChild(H)}P.appendChild(C)}let J=!1;for(let C=0;C<i.length;C++){const q=i[C],H=n[C]??m.defaultColumnWidth,Ve=R._summaryFmt!==void 0&&q.field in(R._summaryFmt??{}),ie=T("div","og-group-cell");if(ie.style.cssText=[`width:${H}px;min-width:${H}px;flex-shrink:0;`,`padding:${_.cellPadding()};box-sizing:border-box;overflow:hidden;`,`border-right:${_.border()};`,"display:flex;align-items:center;","white-space:nowrap;text-overflow:ellipsis;"].join(""),Ve){const he=R._summaryFmt[q.field];ie.textContent=he!==""?he:"-",ie.style.justifyContent="flex-end",ie.style.color="var(--og-primary,#1976d2)",ie.style.fontWeight="600"}else if(!J){J=!0;const he=T("span","og-group-arrow");he.textContent=R._expanded?"▾ ":"▸ ",he.style.cssText="color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;",ie.appendChild(he);const le=T("span","og-group-label");le.textContent=`${R._groupLabel} (${R._childCount}건)`,le.style.cssText="overflow:hidden;text-overflow:ellipsis;font-weight:600;",ie.appendChild(le),ie.style.gap="0"}P.appendChild(ie)}P.addEventListener("click",()=>u==null?void 0:u(A)),L.appendChild(P);continue}const Y=yt?N:null,ae=Y?Y.data:h?N:o.getRowByIndex(I);if(!ae)continue;const de=yt||Ce?"none":o.getRowState(I),K=T("div","og-row");if(K.setAttribute("role","row"),K.setAttribute("aria-rowindex",String(I+1)),!y){const R=a+(I-t)*m.rowHeight;K.style.top=`${R}px`,K.style.height=`${m.rowHeight}px`}let se=I%2===0?"var(--og-row-bg,#fff)":"var(--og-row-alt-bg,#fafafa)";K.style.background=se,de==="added"&&K.classList.add("og-state-added"),de==="edited"&&K.classList.add("og-state-edited"),de==="removed"&&K.classList.add("og-state-removed"),d.has(I)&&K.classList.add("og-selected"),K.setAttribute("aria-selected",d.has(I)?"true":"false"),de==="added"&&(se="var(--og-row-added-bg,#e8f5e9)"),de==="edited"&&(se="var(--og-row-edited-bg,#fff8e1)"),de==="removed"&&(se="var(--og-row-removed-bg,#ffebee)"),d.has(I)&&(se="var(--og-row-selected-bg,#bbdefb)");const Rs=I;K.addEventListener("click",R=>{this._cbs.onCellClick(Rs,-1,R)});const vt=new Map;let ce=0;if(m.stateColumn){const R=T("div","og-cell og-col-state"),A={added:"✚",edited:"✎",removed:"✖",none:""},P={added:"#2e7d32",edited:"#bf360c",removed:"#c62828",none:""};R.textContent=A[de]??"",R.style.color=P[de]??"",R.title=de,M>0&&(R.style.position="sticky",R.style.left=`${ce}px`,R.style.zIndex="2",R.style.background=se),ce+=24,K.appendChild(R)}const bt=this._cbs.getDndManager();if(m.draggable&&bt){const R=bt.attachHandle(K,I,m._totalRows??s+1);M>0&&(R.style.position="sticky",R.style.left=`${ce}px`,R.style.zIndex="2",R.style.background=se),ce+=18,K.appendChild(R)}if(m.rowNumber){const R=T("div","og-cell og-col-rownum");R.textContent=String(I+1),M>0&&(R.style.position="sticky",R.style.left=`${ce}px`,R.style.zIndex="2",R.style.background=se),ce+=44,K.appendChild(R)}if(m.checkColumn){const R=T("div","og-cell og-col-check"),A=document.createElement("input");A.type="checkbox",A.checked=c.has(I),A.setAttribute("aria-label",`${I+1}행 선택`),A.addEventListener("click",P=>P.stopPropagation()),A.addEventListener("change",P=>{P.stopPropagation(),this._cbs.onRowCheck(I,A.checked)}),R.appendChild(A),M>0&&(R.style.position="sticky",R.style.left=`${ce}px`,R.style.zIndex="2",R.style.background=se),ce+=36,K.appendChild(R)}if(k){const R=T("div","og-cell og-col-detail-toggle");R.style.cssText="display:flex;align-items:center;justify-content:center;flex-shrink:0;box-sizing:border-box;";const A=w.getRowId(ae),P=!!A&&w.isExpanded(A),ge=w.getGlyph(P),U=T("span","og-detail-expander");U.textContent=ge.glyph,U.title=ge.title,U.setAttribute("role","button"),U.setAttribute("tabindex","0"),U.setAttribute("aria-label",ge.ariaLabel),A&&U.setAttribute("aria-controls",`og-detail-${A}`),U.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 J=A,C=I,q=H=>{H.stopPropagation(),J&&w.onToggle(C,J)};U.addEventListener("click",q),U.addEventListener("keydown",H=>{(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),q(H))}),R.appendChild(U),M>0&&(R.style.position="sticky",R.style.left=`${ce}px`,R.style.zIndex="2",R.style.background=se),R.style.width=`${b}px`,R.style.minWidth=`${b}px`,ce+=b,K.appendChild(R),A&&K.setAttribute("aria-expanded",P?"true":"false")}for(let R=0;R<i.length;R++){const A=i[R],P=n[R]??m.defaultColumnWidth,ge=m.editable&&A.editable!==!1,U=R===0,J=f&&!f.isEmpty?f.getInfo(I,R):null;if(J!=null&&J.hidden){const S=T("div","og-cell og-cell--merge-ph");S.style.cssText=`width:${P}px;min-width:${P}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`,K.appendChild(S);continue}const C=T("div","og-cell");C.setAttribute("role","gridcell"),C.setAttribute("aria-colindex",String(R+1));const q=(J==null?void 0:J.rowSpan)??1,H=(J==null?void 0:J.colSpan)??1,Ve=q>1?q*m.rowHeight:m.rowHeight;let ie=P;if(H>1)for(let S=1;S<H;S++)ie+=n[R+S]??m.defaultColumnWidth;const he=R<M;let le=0;if(he){m.stateColumn&&(le+=24),m.draggable&&(le+=18),m.rowNumber&&(le+=44),m.checkColumn&&(le+=36),k&&(le+=b);for(let S=0;S<R;S++)le+=n[S]??m.defaultColumnWidth;C.classList.add("og-frozen-cell"),R===M-1&&C.classList.add("og-frozen-last")}C.style.width=`${ie}px`,C.style.minWidth=`${ie}px`,C.style.maxWidth=`${ie}px`,q>1&&(C.style.height=`${Ve}px`),he&&(C.style.background=se),Y&&U&&(C.style.padding="0"),C.style.overflow="hidden",q>1?(C.style.height=`${Ve}px`,C.style.position="absolute",C.style.zIndex="3",C.style.background=se&&se!=="inherit"?se:"var(--og-row-bg, #fff)",C.style.borderTop="0",C.style.borderLeft="0",C.style.borderBottom="1px solid var(--og-border-color, #e0e0e0)"):he&&(C.style.position="sticky",C.style.left=`${le}px`,C.style.zIndex="1"),A.type==="number"||A.align==="right"?C.classList.add("og-cell--right"):A.align==="center"&&C.classList.add("og-cell--center"),ge&&C.classList.add("og-cell--editable"),A.wrap&&C.classList.add("og-cell--wrap"),ge||C.setAttribute("aria-readonly","true"),H>1&&C.setAttribute("aria-colspan",String(H)),q>1&&C.setAttribute("aria-rowspan",String(q)),((B=m._focusCell)==null?void 0:B.ri)===I&&((z=m._focusCell)==null?void 0:z.ci)===R&&(C.classList.add("og-cell-focused"),C.tabIndex=-1);const Ye=m._rangeRects;Ye!=null&&Ye.some(S=>I>=S.startRow&&I<=S.endRow&&R>=S.startCol&&R<=S.endCol)&&(C.classList.add("og-range-selected"),C.style.background="var(--og-range-bg, rgba(25,118,210,0.12))");const fe=ae?ae[A.field]:null;C.setAttribute("aria-label",`${A.header}: ${fe==null?"":String(fe)}`),A.tooltip!=null?C.title=typeof A.tooltip=="function"?String(A.tooltip(fe,ae)??""):String(A.tooltip):m.tooltips&&fe!=null&&fe!==""&&(C.title=String(fe));const ue=((Z=(V=this._cbs).getFormulaMeta)==null?void 0:Z.call(V,I,A.field))??null;if(ue){const S=fe==null?"빈 값":String(fe);if(ue.error){const j=gi[ue.error]??"수식 오류";C.setAttribute("aria-label",`수식 ${ue.src}, 오류: ${j}`),C.title=`${ue.error} — ${j}`,C.style.color="var(--og-formula-error-color, #c62828)"}else{const j=ue.approx?" (근사값)":"";C.setAttribute("aria-label",`수식 ${ue.src}, 값 ${S}${j}`),C.title=`${ue.src}${j}`}if(((ee=m.formula)==null?void 0:ee.cellMarker)!==!1){C.classList.add("og-formula-cell");const j=ue.error?"var(--og-formula-error-color, #c62828)":"var(--og-formula-marker-color, #1976d2)",we=C.style.background||C.style.backgroundColor;C.style.backgroundImage=`linear-gradient(135deg, ${j} 0 6px, transparent 6px)`,C.style.backgroundRepeat="no-repeat",C.style.backgroundPosition="top right",C.style.backgroundSize="8px 8px",we&&(C.style.backgroundColor=we)}}const xt=(ze=(re=this._cbs).resolveRenderHook)==null?void 0:ze.call(re,"cellClass",I,A.field);xt&&(C.className+=" "+xt);const Ct=(D=(F=this._cbs).resolveRenderHook)==null?void 0:D.call(F,"ariaLabel",I,A.field);Ct!=null&&C.setAttribute("aria-label",String(Ct));let Rt=C;if(Y&&U){const S=T("div","og-tree-cell"),j=Y._ancestorHasMore??[];for(let ne=0;ne<Y._depth;ne++){const pe=T("span","og-tree-guide");j[ne]&&pe.classList.add("og-tree-guide--line"),S.appendChild(pe)}if(Y._depth>0){const ne=T("span","og-tree-connector");ne.classList.add(Y._isLastChild?"og-tree-connector--last":"og-tree-connector--mid"),S.appendChild(ne)}const we=T("span","og-tree-toggle-wrap");if(!Y._hasChildren){const ne=T("span","og-tree-leaf-dot");we.appendChild(ne)}S.appendChild(we);const oe=document.createElement("i");if(Y._hasChildren){const ne=kt(A.treeNodeIcon,ae,!0,Y._expanded);oe.className=Y._expanded?`${ne} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle`:`${ne} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`,oe.setAttribute("role","button"),oe.setAttribute("tabindex","0"),oe.setAttribute("aria-expanded",Y._expanded?"true":"false"),oe.setAttribute("aria-label",Y._expanded?"접기":"펼치기"),oe.addEventListener("click",pe=>{pe.stopPropagation(),g==null||g(Y._treeId)}),oe.addEventListener("keydown",pe=>{(pe.key==="Enter"||pe.key===" ")&&(pe.preventDefault(),pe.stopPropagation(),g==null||g(Y._treeId))})}else{const ne=kt(A.treeNodeIcon,ae,!1,!1);oe.setAttribute("aria-hidden","true"),oe.className=`${ne} og-tree-node-icon og-tree-node-icon--leaf`}S.appendChild(oe),C.appendChild(S),Rt=S}if(A.cellStyle){const S=ae[A.field],j=typeof A.cellStyle=="function"?A.cellStyle(S,ae,I):A.cellStyle;Object.assign(C.style,j)}const Ms=pi(A).render({value:ae[A.field],row:ae,rowIndex:I,column:A,colIndex:R,isSelected:d.has(I),rowState:de,displayValue:((He=(te=this._cbs).resolveRenderHook)==null?void 0:He.call(te,"displayText",I,A.field))??((_t=(Be=this._cbs).getDisplayText)==null?void 0:_t.call(Be,I,A.field))??null,displayFormatter:((wt=(mt=this._cbs).getDisplayFormatter)==null?void 0:wt.call(mt))??null,hasCellFormula:ue!=null});Rt.appendChild(Ms);const _e=I,me=R;if(C.addEventListener("click",S=>{S.stopPropagation(),this._cbs.onCellClick(_e,me,S)}),C.addEventListener("dblclick",S=>{S.stopPropagation(),this._cbs.onCellDblClick(_e,me,S)}),C.addEventListener("mouseover",S=>{S.stopPropagation(),this._cbs.onCellMouseOver(_e,me,S)}),C.addEventListener("mouseout",S=>{S.stopPropagation(),this._cbs.onCellMouseOut(_e,me,S)}),C.addEventListener("mousedown",S=>{S.stopPropagation(),this._cbs.onCellMouseDown(_e,me,S)}),C.addEventListener("mouseup",S=>{S.stopPropagation(),this._cbs.onCellMouseUp(_e,me,S)}),C.addEventListener("mousemove",S=>{S.stopPropagation(),this._cbs.onCellMouseMove(_e,me,S)}),vt.set(R,C),q>1){const S=document.createElement("div");S.style.cssText=[`width:${P}px;min-width:${P}px;height:${m.rowHeight}px;`,"flex-shrink:0;box-sizing:border-box;",`border-right:${_.border()};`].join(""),K.appendChild(S);let j=0;m.stateColumn&&(j+=24),m.draggable&&(j+=18),m.rowNumber&&(j+=44),m.checkColumn&&(j+=36),k&&(j+=b);for(let oe=0;oe<R;oe++)j+=n[oe]??m.defaultColumnWidth;const we=a+(I-t)*m.rowHeight;C.style.left=`${j}px`,C.style.top=`${we}px`,L.appendChild(C)}else K.appendChild(C)}this._cellMap.set(I,vt),L.appendChild(K)}if(o.rowCount===0){const I=T("div","og-empty-message");I.textContent="데이터가 없습니다.",I.style.cssText="width:100%;",L.appendChild(I)}this._body.appendChild(L)}getCellEl(e,t){var s;return(s=this._cellMap.get(e))==null?void 0:s.get(t)}_appendDetailPanel(e,t,s,o,i,n){const a=T("div","og-detail-panel og-detail-panel-intro");a.dataset.ogRowId=t,a.id=`og-detail-${t}`,a.setAttribute("role","region"),a.setAttribute("aria-label",n.ariaLabel),a.style.cssText=["position:absolute;left:0;",`top:${s}px;width:${i}px;height:${o}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._ap.divider()};`,"z-index:var(--og-z-detail,2);"].join("");const l=n.getPanelHost(t);a.appendChild(l),e.appendChild(a)}destroy(){this._root.innerHTML=""}}function kt(r,e,t,s){let o;return r?typeof r=="function"?o=r(e,t,s):t?o=s?r.branchOpen??"bi-folder2-open":r.branch??"bi-folder2":o=r.leaf??"bi-file-earmark":o=t?s?"bi-folder2-open":"bi-folder2":"bi-file-earmark",o.startsWith("bi ")?o:`bi ${o}`}function T(r,e){const t=document.createElement(r);return e&&(t.className=e),t}function Et(r,e){Object.assign(r.style,e)}function Ft(r,e,t="text/plain;charset=utf-8"){const s=new Blob([r],{type:t}),o=URL.createObjectURL(s),i=document.createElement("a");i.href=o,i.download=e,i.click(),URL.revokeObjectURL(o)}function _i(r,e,t){let s=0,o=0;r.addEventListener("mousedown",i=>{i.stopPropagation(),i.preventDefault(),s=i.clientX,o=e.offsetWidth;const n=l=>{const d=Math.max(40,o+l.clientX-s);e.style.width=`${d}px`,e.style.minWidth=`${d}px`},a=l=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",a),t(Math.max(40,o+l.clientX-s))};document.addEventListener("mousemove",n),document.addEventListener("mouseup",a)})}const mi=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"]),wi=/#[0-9a-fA-F]{3,8}\b/,yi=/\b(?:rgba?|hsla?)\(\s*\d/,vi=/\b(?:red|green|blue|black|white|gray|grey|yellow|orange|purple|pink|brown|cyan|magenta)\b/i;function St(r,e){for(const[t,s]of Object.entries(e)){const o=t;if(!mi.has(o))throw new Error(`[SkinRegistry] 스킨 "${r}" 의 토큰 "${o}" 은 FORM 토큰이 아닙니다. 스킨은 형태(radius/border/elevation/…)만 소유하며 색 토큰은 data-og-theme 축입니다(색⊥형태 직교성).`);const i=String(s??"");if(wi.test(i)||yi.test(i)||vi.test(i))throw new Error(`[SkinRegistry] 스킨 "${r}" 토큰 "${o}: ${i}" 에 색 리터럴이 있습니다. 스킨 델타는 색을 담을 수 없습니다(Rule 2). 색이 필요하면 COLOR 토큰(예: var(--og-texture-ink))을 참조하세요.`)}}function Lt(r,e){const t={...e},s=[],o=t["--og-focus-width"];if(o!=null){const i=parseFloat(String(o));!Number.isNaN(i)&&i<2&&(t["--og-focus-width"]="2px",s.push(`focus-width ${o} → 2px (가시 포커스 최소 2px, HANMS)`))}return t["--og-focus-style"]==="none"&&(t["--og-focus-style"]="solid",s.push("focus-style none → solid (가시 포커스 비협상, HANMS)")),{delta:t,warnings:s}}class ns{constructor(){this._skins=new Map,this._styleEl=null}registerBuiltin(e,t){St(e,t);const{delta:s}=Lt(e,t);this._skins.set(e,s)}define(e,t){St(e,t);const s=Lt(e,t);this._skins.set(e,s.delta);for(const o of s.warnings)typeof console<"u"&&console.warn(`[SkinRegistry] "${e}": ${o}`);return this._inject(e,s.delta),s}has(e){return this._skins.has(e)}get(e){return this._skins.get(e)}list(){return[...this._skins.keys()]}_inject(e,t){if(typeof document>"u")return;this._styleEl||(this._styleEl=document.createElement("style"),this._styleEl.setAttribute("data-og-skins","runtime"),document.head.appendChild(this._styleEl));const s=Object.entries(t).map(([o,i])=>` ${o}: ${i};`).join(`
|
|
33
|
-
`);this._styleEl.appendChild(document.createTextNode(`
|
|
34
|
-
.og-container[data-og-skin="${e}"] {
|
|
35
|
-
${s}
|
|
36
|
-
}
|
|
37
|
-
`))}}const bi={"--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"},xi={"--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"},Ci={"--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"},Ri={"--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"},Mi={"--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"},ki={"--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"},Ei=[["sharp",bi],["rounded",xi],["stitch",Ci],["flat",Ri],["high-contrast",Mi],["material",ki]],pt=new ns;for(const[r,e]of Ei)pt.registerBuiltin(r,e);class Fi{constructor(e){this._autoHeightWarned=!1,this._deps=e}_paginationHeight(){return this._deps.getOptions().pagination?38:0}onResize(){const{width:e}=this._deps.getContainer().getBoundingClientRect();e&&(this.recalcWidths(e),this.renderHeader(),this.doRender(...this.visRange()))}recalcWidths(e){const t=this._deps.getColLayout(),s=this._deps.getOptions(),o=t.computeWidths(e-(s.stateColumn?24:0)-(s.draggable?18:0)-(s.rowNumber?44:0)-(s.checkColumn?36:0),s.defaultColumnWidth),i=this._deps.getUserWidths();i.size&&t.visibleLeaves.forEach((n,a)=>{const l=i.get(n.field);l!=null&&(o[a]=l)}),this._deps.setColWidths(o)}renderHeader(){const e=this._deps.getRenderer(),t=this._deps.getColLayout(),s=this._deps.getSfMgr(),o=this._deps.getOptions();e==null||e.renderHeader(t.buildHeaderCells(),t.visibleLeaves,this._deps.getColWidths(),s.sortList,{...o,_activeFilters:s.filters,_frozenCount:t.frozenCount}),this.syncHeaderLayout()}syncHeaderLayout(){const e=this._deps.getRenderer(),t=this._deps.getVs();if(!e||!t)return;const s=this._deps.getOptions(),{height:o}=this._deps.getContainer().getBoundingClientRect();if(!o)return;const i=e.getHeaderHeight(),n=i>s.headerHeight?i:s.headerHeight;e.updateSize(o-this._paginationHeight(),n);let a=o-n-this._paginationHeight();const l=s.fallbackViewportHeight;if(l&&l>0){const d=t.getTotalHeight();a>=d&&a>l&&(a=l)}t.setViewportHeight(a)}doRender(e,t){var p;const s=this._deps.getRenderer(),o=this._deps.getVs();if(!s||!o)return;const i=this._deps.getOptions(),n=o.getVisibleRange(),a=i.autoHeight===!0;a&&([e,t]=this.visRange(),!this._autoHeightWarned&&t-e+1>2e3&&(this._autoHeightWarned=!0,console.warn(`[OpenGrid] autoHeight 는 가상 스크롤이 아니라 전 행(${t-e+1}행)을 렌더합니다. 행이 많으면 고정 rowHeight(가상 스크롤) 사용을 권장합니다.`)));const l=this._deps.getGrpMgr(),c=l.isGroupMode||l.isTreeMode||this._deps.getDetailMgr().isActive?this._deps.getFlatModel().getFlatArray():null,h=this._deps.getColLayout(),u=this._deps.getData(),g=this._deps.getRowMgr();s.renderBody({startIndex:e,endIndex:t,data:u,leaves:h.visibleLeaves,widths:this._deps.getColWidths(),opts:i,offsetY:a?0:n.offsetY,totalHeight:a?0:o.getTotalHeight(),selectedRows:g.selectedRows,checkedRows:g.checkedRows,groupFlatRows:c,onGroupToggle:f=>l.handleGroupToggle(f),onTreeToggle:l.isTreeMode?f=>l.handleTreeToggle(f):void 0,extraOpts:{_totalRows:u.rowCount,_frozenCount:h.frozenCount,_focusCell:this._deps.getEditMgr().focusCell,...this._deps.getRangeMgr().getOverlayExtraOpts()},mergeEngine:this._deps.getMergeEngine(),detailApi:this._deps.buildDetailRenderContext()}),(p=i.footer)!=null&&p.length&&this._deps.renderFooterEl(),this._deps.getRangeMgr().repaint()}visRange(){var i;const e=this._deps.getOptions(),t=this._deps.getPagination();if(e.pagination&&t){const{start:n,end:a}=t.getRange();return[n,a]}const s=this._deps.getFlatModel().count();if(e.autoHeight)return[0,s-1];const o=(i=this._deps.getVs())==null?void 0:i.getVisibleRange();return[(o==null?void 0:o.startIndex)??0,Math.min(((o==null?void 0:o.endIndex)??30)+this._visCount()+5,s-1)]}_visCount(){const e=this._deps.getOptions(),t=this._deps.getContainer().getBoundingClientRect().height;return Math.ceil((t-e.headerHeight-this._paginationHeight())/e.rowHeight)+5}}let Si=0;function It(){return`og-r-${++Si}`}class Li{constructor(e="_ogRowId"){this._data=[],this._original=[],this._meta=new Map,this._displayIndexes=[],this._idMap=new Map,this._findQuery="",this._findFields=[],this._getStrategy=(t,s)=>s,this._idField=e}getDataIndexByRowId(e){return this._idMap.get(e)}setStrategyResolver(e){this._getStrategy=e}setData(e){this._data=e.map(t=>{const s=It(),o={...t,[this._idField]:s};return this._meta.set(s,{state:"none",rowId:s}),o}),this._original=this._data.map(t=>({...t})),this._rebuildIdMap(),this._displayIndexes=this._data.map((t,s)=>s)}getData(){return this._displayIndexes.map(e=>this._data[e])}getOriginalData(){return[...this._original]}getAllData(){return[...this._data]}clearData(){this._data=[],this._original=[],this._meta.clear(),this._idMap.clear(),this._displayIndexes=[]}get rowCount(){return this._displayIndexes.length}get totalRowCount(){return this._data.length}addRow(e,t="last"){const s=It(),o={...e,[this._idField]:s};if(this._meta.set(s,{state:"added",rowId:s}),t==="last"){const i=this._data.push(o)-1;this._idMap.set(s,i),this._displayIndexes.push(i)}else if(t==="first")this._data.unshift(o),this._rebuildIdMap(),this._displayIndexes.unshift(0);else{const i=Math.min(t,this._displayIndexes.length),n=i<this._displayIndexes.length?this._displayIndexes[i]:this._data.length;this._data.splice(n,0,o),this._rebuildIdMap(),this._displayIndexes=this._data.map((a,l)=>l)}}removeRow(e){const t=this._displayIndexes[e];if(t===void 0)return;const s=this._data[t],o=s[this._idField],i=this._meta.get(o);return(i==null?void 0:i.state)==="added"?(this._data.splice(t,1),this._meta.delete(o)):this._meta.set(o,{...i,state:"removed"}),this._rebuildIdMap(),this._displayIndexes=this._data.map((n,a)=>({r:n,i:a})).filter(({r:n})=>{var a;return((a=this._meta.get(n[this._idField]))==null?void 0:a.state)!=="removed"}).map(({i:n})=>n),s}moveRow(e,t){const s=this._displayIndexes[e],o=this._displayIndexes[t];if(s===void 0||o===void 0)return;const[i]=this._data.splice(s,1),n=s<o?o-1:o;this._data.splice(n,0,i),this._rebuildIdMap(),this._displayIndexes=this._data.map((a,l)=>({r:a,i:l})).filter(({r:a})=>{var l;return((l=this._meta.get(a[this._idField]))==null?void 0:l.state)!=="removed"}).map(({i:a})=>a)}updateCell(e,t,s){const o=this._displayIndexes[e];if(o===void 0)return!1;const n=this._data[o][this._idField],a=this._meta.get(n);return(a==null?void 0:a.state)==="none"&&this._meta.set(n,{...a,state:"edited",original:{...this._original[o]}}),this._data[o][t]=s,!0}getRowByIndex(e){const t=this._displayIndexes[e];return t!==void 0?this._data[t]:void 0}getCellValue(e,t){var s;return(s=this.getRowByIndex(e))==null?void 0:s[t]}hasRow(e){var s;return this._idMap.get(e)===void 0?!1:((s=this._meta.get(e))==null?void 0:s.state)!=="removed"}getRowById(e){if(!this.hasRow(e))return;const t=this._idMap.get(e);return this._data[t]}getCellValueByRowId(e,t){var s;return(s=this.getRowById(e))==null?void 0:s[t]}setComputedValueByRowId(e,t,s){const o=this._idMap.get(e);o!==void 0&&(this._data[o][t]=s)}getEditedRows(){return this._data.filter(e=>{var t;return((t=this._meta.get(e[this._idField]))==null?void 0:t.state)==="edited"})}getChangedRows(){return this.getEditedRows()}getAddedRows(){return this._data.filter(e=>{var t;return((t=this._meta.get(e[this._idField]))==null?void 0:t.state)==="added"})}getRemovedRows(){return this._data.filter(e=>{var t;return((t=this._meta.get(e[this._idField]))==null?void 0:t.state)==="removed"})}getChanges(){const e=[],t=[],s=[];for(const o of this._data){const i=o[this._idField],n=this._meta.get(i),a=(n==null?void 0:n.state)??"none";if(a==="added")e.push({...o});else if(a==="removed")s.push({...o});else if(a==="edited"){const l=n.original??{},d=Object.keys(o).filter(c=>c!==this._idField&&o[c]!==l[c]);t.push({...o,_changedFields:d})}}return{added:e,edited:t,removed:s}}getChangedColumns(){return this._data.filter(e=>{var t;return((t=this._meta.get(e[this._idField]))==null?void 0:t.state)==="edited"}).map(e=>{var o;const t=((o=this._meta.get(e[this._idField]))==null?void 0:o.original)??{},s=[];for(const i of Object.keys(e))i!==this._idField&&e[i]!==t[i]&&s.push({field:i,oldValue:t[i],newValue:e[i]});return{row:{...e},fields:s.map(i=>i.field),diff:s}})}getOriginalRow(e){const t=this._displayIndexes[e];if(t===void 0)return;const s=this._data[t],o=this._meta.get(s[this._idField]);if(!(!o||o.state==="added"))return o.state==="edited"&&o.original?{...o.original}:{...this._original[t]}}getRowsWithState(e){return this._data.map(t=>{var o;const s=((o=this._meta.get(t[this._idField]))==null?void 0:o.state)??"none";return{...t,[e]:s}})}getRowState(e){var s;const t=this.getRowByIndex(e);return t?((s=this._meta.get(t[this._idField]))==null?void 0:s.state)??"none":"none"}applySort(e){const t=i=>{var n,a;return((a=this._meta.get((n=this._data[i])==null?void 0:n[this._idField]))==null?void 0:a.state)!=="removed"};if(e.length===0){this._displayIndexes=this._data.map((i,n)=>n).filter(t);return}const s=this._displayIndexes.filter(t).map(i=>{const n=this._data[i];return{idx:i,keys:e.map(a=>n[a.field])}}),o=this._getStrategy("sortComparator",(i,n,a,l)=>{if(i==null&&n==null)return 0;if(i==null)return-1;if(n==null)return 1;if(typeof i=="number"&&typeof n=="number")return i-n;const d=String(i),c=String(n);return d<c?-1:d>c?1:0});s.sort((i,n)=>{for(let a=0;a<e.length;a++){const l=e[a].dir,d=e[a].field,c=i.keys[a],h=n.keys[a],u=o(c,h,d,l);if(u!==0)return l==="asc"?u:-u}return 0}),this._displayIndexes=s.map(i=>i.idx)}applyFilter(e){const t=Object.keys(e),s=this._getStrategy("filterPredicate",(o,i,n)=>Ii(o,i));this._displayIndexes=this._data.map((o,i)=>({r:o,i})).filter(({r:o})=>{var i;if(((i=this._meta.get(o[this._idField]))==null?void 0:i.state)==="removed"||t.length>0&&!t.every(n=>{const a=o[n];return e[n].every(l=>s(a,l,n))}))return!1;if(this._findQuery&&this._findFields.length>0){const n=this._findQuery;if(!this._findFields.some(l=>{const d=o[l];return d!=null&&String(d).toLowerCase().includes(n)}))return!1}return!0}).map(({i:o})=>o)}setFindFilter(e,t){this._findQuery=e.toLowerCase(),this._findFields=t}_rebuildIdMap(){this._idMap.clear(),this._data.forEach((e,t)=>{this._idMap.set(e[this._idField],t)})}}function Ii(r,e){const t=r,s=e.value;switch(e.operator){case"=":return t==s;case"!=":return t!=s;case">":return t>s;case">=":return t>=s;case"<":return t<s;case"<=":return t<=s;case"contains":return String(t).includes(String(s));case"startsWith":return String(t).startsWith(String(s));case"endsWith":return String(t).endsWith(String(s));default:return!0}}function Ue(r){return r&&r._isGroup===!0}function At(r,e,t=[],s=new Set,o,i){return e.length?rs(r,e,0,t,s,"",o,i):[]}function rs(r,e,t,s,o,i,n,a){const l=e[t],d=new Map;for(const h of r){const u=a?a(h,e.slice(t)):h[l];d.has(u)||d.set(u,[]),d.get(u).push(h)}const c=[];for(const[h,u]of d){const g=`${i}__${l}:${h}`,p=o.has(g);let f;t<e.length-1?f=rs(u,e,t+1,s,o,g,n,a):f=u;const{summary:w,summaryFmt:m}=Ai(u,s),_=Ti(u,n);c.push({_isGroup:!0,_groupField:l,_groupValue:h,_groupLabel:h==null?"(없음)":String(h),_depth:t,_expanded:p,_childCount:u.length,_summary:w,_summaryFmt:m,_states:_,children:f})}return c}function Ai(r,e){const t={},s={};for(const o of e){const i=r.map(d=>d[o.field]).filter(d=>d!=null&&d!=="");let n=null;const a=o.op.toUpperCase();if(a==="SUM")n=i.length>0?v.sum(i.map(String)):null;else if(a==="AVG")n=i.length>0?v.sum(i.map(String)).div(v.from(String(i.length))):null;else if(a==="COUNT"){t[o.field]=r.length,s[o.field]=r.length.toLocaleString("ko-KR");continue}else a==="MAX"?n=i.length>0?v.max(i.map(String)):null:a==="MIN"&&(n=i.length>0?v.min(i.map(String)):null);if(!n){t[o.field]=null,s[o.field]="";continue}const l=n.toNumber();t[o.field]=l,s[o.field]=Di(l,o.format)}return{summary:t,summaryFmt:s}}function Ti(r,e){if(!e)return{added:0,edited:0,removed:0};let t=0,s=0,o=0;for(const i of r){const n=e(i);n==="added"?t++:n==="edited"?s++:n==="removed"&&o++}return{added:t,edited:s,removed:o}}function Di(r,e){if(e==null)return r%1===0?r.toLocaleString("ko-KR"):parseFloat(r.toFixed(6)).toLocaleString("ko-KR",{minimumFractionDigits:2,maximumFractionDigits:6});const t=e.includes("#")||e.includes(","),s=e.match(/\.(\d+)$/),o=s?parseInt(s[1],10):/^\d+$/.test(e)?parseInt(e,10):0,i=Math.abs(r).toFixed(o),[n="0",a]=i.split("."),l=t?n.replace(/\B(?=(\d{3})+(?!\d))/g,","):n,d=a!==void 0?`${l}.${a}`:l;return r<0?`-${d}`:d}function as(r){const e=[];for(const t of r)if(e.push(t),t._expanded)for(const s of t.children)Ue(s)?e.push(...as([s])):e.push(s);return e}function ls(r,e=""){const t=[];for(const s of r){const o=`${e}__${s._groupField}:${s._groupValue}`;t.push(o);const i=s.children.filter(n=>Ue(n));i.length&&t.push(...ls(i,o))}return t}function Tt(r){return r!=null&&r._isTree===!0}function at(r,e,t=new Set){const{idField:s,parentIdField:o,expandOnLoad:i=!1}=e,n=new Map,a=[];for(const c of r){const h=c[s],u={_isTree:!0,_treeId:h,_treeParentId:c[o],_depth:0,_expanded:i||t.has(h),_hasChildren:!1,_childCount:0,_isLastChild:!1,_ancestorHasMore:[],data:c,children:[]};n.set(h,u)}for(const c of n.values()){const h=c._treeParentId;if(h==null||h===""||!n.has(h))a.push(c);else{const g=n.get(h);g.children.push(c),g._hasChildren=!0}}function l(c,h){for(const u of c)u._depth=h,u._childCount=ds(u),l(u.children,h+1)}l(a,0);function d(c,h){for(let u=0;u<c.length;u++){const g=c[u],p=u===c.length-1;g._isLastChild=p,g._ancestorHasMore=h,g.children.length>0&&d(g.children,[...h,!p])}}return d(a,[]),a}function ds(r){let e=r.children.length;for(const t of r.children)e+=ds(t);return e}function cs(r){const e=[];for(const t of r)e.push(t),t._expanded&&t.children.length>0&&e.push(...cs(t.children));return e}function $i(r,e){r.has(e)?r.delete(e):r.add(e)}function lt(r){const e=[];for(const t of r)e.push(t._treeId),t.children.length&&e.push(...lt(t.children));return e}class Oi{constructor(e){this._backing=null,this._splices=[],this._revIndex=null,this._revIndexSrc=null,this._d=e}setBacking(e){this._backing=e,this._invalidate()}registerSplice(e){this._splices.push(e),this._invalidate()}count(){return this._flat().length}getFlatArray(){return this._flat()}resolveFlatRow(e){const t=this._flat()[e];if(t==null)return{kind:"data"};if(t._isDetailFiller===!0)return{kind:"detailFiller",rowId:t._rowId};if(t._isDetailHead===!0)return{kind:"detailHead",rowId:t._rowId};if(Ue(t))return{kind:"group"};if(Tt(t)){const n=t.data;return{kind:"tree",rowId:n==null?void 0:n[this._d.rowIdField]}}const s=t[this._d.rowIdField],o=this._d.getDataLayer().getDataIndexByRowId(s),i={kind:"data",rowId:s};return o!==void 0&&(i.dataIndex=o),this._backing||(i.displayIndex=e),i}flatIndexOfRowId(e){return this._ensureRevIndex(),this._revIndex.get(e)??-1}rowIdOfFlat(e){const t=this.resolveFlatRow(e);return t.kind==="data"||t.kind==="tree"?t.rowId??null:null}_flat(){let e=this._backing?this._backing():this._d.getDataLayer().getData();for(const t of this._splices)e=t(e);return e}_invalidate(){this._revIndex=null,this._revIndexSrc=null}_ensureRevIndex(){const e=this._flat();if(this._revIndex&&this._revIndexSrc===e)return;const t=new Map;for(let s=0;s<e.length;s++){const o=e[s];if(o==null||Ue(o)||o._isDetailHead===!0||o._isDetailFiller===!0)continue;const i=Tt(o)?o.data:o,n=i==null?void 0:i[this._d.rowIdField];n!=null&&t.set(n,s)}this._revIndex=t,this._revIndexSrc=e}}class zi{constructor(e){this._selectedRows=new Set,this._checkedRows=new Set,this._data=e}get selectedRows(){return this._selectedRows}get checkedRows(){return this._checkedRows}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,t){t?this._checkedRows.add(e):this._checkedRows.delete(e)}checkAll(e,t){if(e)for(let s=0;s<t;s++)this._checkedRows.add(s);else this._checkedRows.clear()}checkByValue(e,t){for(let s=0;s<this._data.rowCount;s++)t.includes(this._data.getCellValue(s,e))&&this._checkedRows.add(s)}uncheckAll(){this._checkedRows.clear()}checkById(e){}addCheckById(e){}uncheckById(e){}getSelections(){return[...this._selectedRows].map(e=>this._data.getRowByIndex(e)).filter(Boolean)}getChecked(){return[...this._checkedRows].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._checkedRows.clear()}}function Q(r,e){return`${r}:${e}`}function be(r){const e=r.indexOf(":");return e===-1?{rowId:r,field:""}:{rowId:r.slice(0,e),field:r.slice(e+1)}}const Hi=new Set(["#ERR","#REF","#CYCLE","#DIV0","#NAME","#VALUE","#NUM"]);function Ge(r){return typeof r=="string"&&Hi.has(r)?r:null}const Bi=500;class Vi{constructor(e){this._deps=e}flushRecalc(){const e=this._deps.getDirtySeeds();if(e.size===0)return;const t=[...e];e.clear(),this.afterRecalc(this._deps.getRecalc().onValuesChanged(t),{skipRender:!0})}afterRecalc(e,t={}){var s,o;if(e.changed.length>0||e.cycles>0){const i={changed:e.changed,cycles:e.cycles,ms:e.ms,large:e.changed.length>Bi};this._deps.emit("formulaRecalc",i),(o=(s=this._deps.getOptions().formula)==null?void 0:s.onFormulaRecalc)==null||o.call(s,i)}t.skipRender||this._deps.doRenderWindow()}handleFormulaError(e,t,s){var n,a;const i={rowIndex:this._deps.getFlatModel().flatIndexOfRowId(e),field:t,error:s};this._deps.emit("formulaError",i),(a=(n=this._deps.getOptions().formula)==null?void 0:n.onFormulaError)==null||a.call(n,i),this._deps.announce(`${t} 셀 오류: ${this._formulaErrorMessageKo(s)}`)}_formulaErrorMessageKo(e){switch(e){case"#REF":return"참조 대상이 삭제됨";case"#CYCLE":return"순환 참조";case"#VALUE":return"숫자가 아닌 값에 산술 연산";case"#DIV0":return"0으로 나눔";case"#NAME":return"알 수 없는 함수/이름";case"#NUM":return"수치 도메인 오류";default:return"수식 오류"}}buildAccessor(){return{visibleFields:()=>this._deps.getColLayout().visibleLeaves.map(e=>e.field),rowIdAtFlat:e=>{const t=this._deps.getFlatModel().resolveFlatRow(e);return t.kind==="data"?t.rowId??null:null},flatIndexOfRowId:e=>this._deps.getFlatModel().flatIndexOfRowId(e),displayedRowIds:()=>{const e=[],t=this._deps.getFlatModel(),s=t.count();for(let o=0;o<s;o++){const i=t.resolveFlatRow(o);i.kind==="data"&&i.rowId&&e.push(i.rowId)}return e},getCellValue:(e,t)=>this._deps.getData().getCellValueByRowId(e,t),hasRow:e=>this._deps.getData().hasRow(e),hasField:e=>this._deps.getColLayout().getColumnByField(e)!=null}}setCellFormula(e,t,s){const o=this._deps.getFlatModel().resolveFlatRow(e);o.kind!=="data"||!o.rowId||this.setCellFormulaByRowId(o.rowId,t,s,e)}setCellFormulaByRowId(e,t,s,o){var c,h;const i=o??this._deps.getFlatModel().flatIndexOfRowId(e),n=this._deps.getRecalc(),a=n.getCellFormula(e,t),l=n.setCellFormula(e,t,s),d={rowIndex:i,field:t,formula:s,oldFormula:a};this._deps.emit("formulaChange",d),(h=(c=this._deps.getOptions().formula)==null?void 0:c.onFormulaChange)==null||h.call(c,d),this.afterRecalc(l)}getCellFormula(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);return s.kind!=="data"||!s.rowId?null:this._deps.getRecalc().getCellFormula(s.rowId,t)}hasCellFormula(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);return s.kind==="data"&&!!s.rowId&&this._deps.getRecalc().hasCellFormula(s.rowId,t)}clearCellFormula(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);if(s.kind!=="data"||!s.rowId)return;const o=this._deps.getRecalc(),i=o.clearCellFormula(s.rowId,t);i.length?this.afterRecalc(o.onValuesChanged(i)):this._deps.doRenderWindow()}getCellError(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);return s.kind!=="data"||!s.rowId?null:this._deps.getRecalc().getCellError(s.rowId,t)}getDependents(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);if(s.kind!=="data"||!s.rowId)return[];const o=this._deps.getFlatModel();return this._deps.getRecalc().getDependents(s.rowId,t).map(({rowId:i,field:n})=>({rowIndex:o.flatIndexOfRowId(i),field:n}))}getPrecedents(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);if(s.kind!=="data"||!s.rowId)return[];const o=this._deps.getFlatModel();return this._deps.getRecalc().graph.getPrecedents(Q(s.rowId,t)).map(be).map(({rowId:i,field:n})=>({rowIndex:o.flatIndexOfRowId(i),field:n}))}recalculate(){this.afterRecalc(this._deps.getRecalc().recalculateAll())}recalculateCell(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);s.kind!=="data"||!s.rowId||this.afterRecalc(this._deps.getRecalc().onValuesChanged([Q(s.rowId,t)]))}offsetFormula(e,t,s,o){return this._deps.getRecalc().offsetFormula(e,t,s,o)}getFormulaMeta(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);if(s.kind!=="data"||!s.rowId)return null;const o=this._deps.getRecalc().store.getFormula(s.rowId,t);return o?{src:o.src,error:o.error,approx:!!o.approx}:null}recalcRangeBearingFormulas(){this.afterRecalc(this._deps.getRecalc().recalcRangeBearing())}}const gt=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function hs(r){const e=r.trim(),t=/^([+-]?)(\d*)(?:\.(\d*))?[eE]([+-]?\d+)$/.exec(e);if(!t)return e;const[,s,o,i="",n]=t,a=o||"0",l=parseInt(n,10);let d=a+i,c=a.length+l;d===""&&(d="0"),c<=0?(d="0".repeat(-c+1)+d,c=1):c>d.length&&(d=d+"0".repeat(c-d.length));const h=d.slice(0,c)||"0",u=d.slice(c);return s+h+(u?"."+u:"")}function Pi(r){const e=r.startsWith("=")?r.slice(1):r,t=new Ni(e),s=t.parseComparison();if(t.skip(),!t.eof())throw new SyntaxError(`FormulaParser: 예상치 못한 토큰 '${t.peekChar()}' (위치 ${t.pos})`);return s}class Ni{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++}_tryOp(...e){this.skip();for(const t of e.sort((s,o)=>o.length-s.length))if(this.src.startsWith(t,this.pos))return this.pos+=t.length,t;return null}parseComparison(){let e=this.parseConcat();for(;;){const t=this._tryOp("<=",">=","<>","=","<",">");if(!t)break;const s=this.parseConcat();e={t:"bin",op:t,left:e,right:s}}return e}parseConcat(){let e=this.parseAdditive();for(;this._tryOp("&");){const s=this.parseAdditive();e={t:"bin",op:"&",left:e,right:s}}return e}parseAdditive(){let e=this.parseMultiplicative();for(;;){this.skip();const t=this.peekChar();if(t!=="+"&&t!=="-")break;this.pos++;const s=this.parseMultiplicative();e={t:"bin",op:t,left:e,right:s}}return e}parseMultiplicative(){let e=this.parsePower();for(;;){this.skip();const t=this.peekChar();if(t!=="*"&&t!=="/"&&t!=="%")break;this.pos++;const s=this.parsePower();e={t:"bin",op:t,left:e,right:s}}return e}parsePower(){const e=this.parseUnary();if(this.skip(),this.peekChar()==="^"){this.pos++;const t=this.parsePower();return{t:"bin",op:"^",left:e,right:t}}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 t=this.parseComparison();if(this.skip(),this.peekChar()!==")")throw new SyntaxError("FormulaParser: 닫는 괄호 ) 누락");return this.pos++,t}if(e==="[")return this._fieldRef();if(e==='"')return this._stringLit();if(/[A-Za-z$]/.test(e))return this._identifierLike();if(/[0-9.]/.test(e))return this._number();throw new SyntaxError(`FormulaParser: 예상치 못한 문자 '${e||"EOF"}' (위치 ${this.pos})`)}_fieldRef(){this.pos++;const e=this.pos;for(;!this.eof()&&this.peekChar()!=="]";)this.pos++;if(this.eof())throw new SyntaxError("FormulaParser: 닫는 ] 누락");const t=this.src.slice(e,this.pos);return this.pos++,{t:"field",field:t}}_stringLit(){this.pos++;let e="";for(;!this.eof();){const t=this.peekChar();if(t==='"'){if(this.src[this.pos+1]==='"'){e+='"',this.pos+=2;continue}return this.pos++,{t:"str",v:e}}e+=t,this.pos++}throw new SyntaxError('FormulaParser: 닫는 " 누락')}_identifierLike(){const e=this.pos;let t=!1;this.peekChar()==="$"&&(t=!0,this.pos++);const s=this.pos;for(;!this.eof()&&/[A-Za-z]/.test(this.peekChar());)this.pos++;const o=this.src.slice(s,this.pos);if(!o)throw new SyntaxError(`FormulaParser: 식별자를 기대했지만 '${this.peekChar()||"EOF"}' (위치 ${e})`);if(!t){if(this.skip(),this.peekChar()==="("){this.pos++;const c=[];if(this.skip(),this.peekChar()!==")")for(c.push(this.parseComparison()),this.skip();this.peekChar()===",";)this.pos++,c.push(this.parseComparison()),this.skip();if(this.peekChar()!==")")throw new SyntaxError(`FormulaParser: 함수 '${o}' 닫는 ) 누락`);return this.pos++,{t:"call",name:o.toUpperCase(),args:c}}const d=o.toUpperCase();if(this.peekChar()!=="$"&&!/[0-9]/.test(this.peekChar())){if(d==="TRUE")return{t:"bool",v:!0};if(d==="FALSE")return{t:"bool",v:!1}}}let i=!1;this.peekChar()==="$"&&(i=!0,this.pos++);const n=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.pos===n){if(t||i)throw new SyntaxError(`FormulaParser: 셀참조 행번호 누락 (위치 ${this.pos})`);return{t:"error",code:"#NAME"}}const a=parseInt(this.src.slice(n,this.pos),10),l={t:"rawRef",colLetters:o.toUpperCase(),row:a,dollarCol:t,dollarRow:i};return this._maybeRange(l)}_maybeRange(e){const t=this.pos;if(this.skip(),this.peekChar()===":"){this.pos++,this.skip();let s=!1,o=!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).toUpperCase();if(!n)throw new SyntaxError(`FormulaParser: 범위 두번째 코너 열문자 누락 (위치 ${this.pos})`);this.peekChar()==="$"&&(o=!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 l=parseInt(this.src.slice(a,this.pos),10);return{t:"rawRange",a:e,b:{t:"rawRef",colLetters:n,row:l,dollarCol:s,dollarRow:o}}}return this.pos=t,e}_number(){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 s=this.pos;this.pos++,(this.peekChar()==="+"||this.peekChar()==="-")&&this.pos++;const o=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;this.pos===o&&(this.pos=s)}const t=this.src.slice(e,this.pos);if(!t||t===".")throw new SyntaxError(`FormulaParser: 숫자를 기대했지만 '${this.peekChar()||"EOF"}' (위치 ${e})`);return{t:"num",v:hs(t)}}}function Wi(r){let e=0;for(const t of r.toUpperCase())e=e*26+(t.charCodeAt(0)-64);return e-1}function Ki(r){let e=r+1,t="";for(;e>0;){const s=(e-1)%26;t=String.fromCharCode(65+s)+t,e=Math.floor((e-1)/26)}return t||"A"}function Xe(r,e){const{accessor:t,host:s,refMode:o}=e,i=Wi(r.colLetters),a=t.visibleFields()[i];if(a===void 0)return null;const l=r.row-1,d=t.rowIdAtFlat(l);if(d===null)return null;if(o==="relative"&&!r.dollarRow){const c=t.flatIndexOfRowId(s.rowId);return{kind:"rel",dRow:c===-1?0:l-c,field:a,dollarRow:r.dollarRow,dollarCol:r.dollarCol}}return{kind:"abs",rowId:d,field:a,dollarRow:r.dollarRow,dollarCol:r.dollarCol}}function Ui(r,e,t,s="stable"){const o={host:e,accessor:t,refMode:s};function i(n){switch(n.t){case"rawRef":{const a=Xe(n,o);return a?{t:"ref",ref:a}:{t:"error",code:"#REF"}}case"rawRange":{const a=Xe(n.a,o),l=Xe(n.b,o);return!a||!l?{t:"error",code:"#REF"}:{t:"range",ref:{a,b:l}}}case"call":return{t:"call",name:n.name,args:n.args.map(i)};case"unary":return{t:"unary",op:n.op,arg:i(n.arg)};case"bin":return{t:"bin",op:n.op,left:i(n.left),right:i(n.right)};default:return n}}return i(r)}function Ae(r){switch(r.t){case"range":return!0;case"call":return r.args.some(Ae);case"unary":return Ae(r.arg);case"bin":return Ae(r.left)||Ae(r.right);default:return!1}}class $ extends Error{constructor(e){super(e),this.code=e}}function Dt(r,e,t,s={}){const o=new Set,i={v:!1},n=s.divisionPrecision??30;try{return{value:W(r,e,t,o,i,n),error:null,approx:i.v,touched:o}}catch(a){const l=a instanceof $?a.code:"#ERR";return{value:l,error:l,approx:i.v,touched:o}}}function dt(r,e,t){if(r.kind==="abs")return r.rowId;const s=t.flatIndexOfRowId(e.rowId);return s===-1?null:t.rowIdAtFlat(s+r.dRow)}function qi(r,e,t,s){const o=dt(r,e,t);if(o===null||!t.hasRow(o))throw new $("#REF");if(!t.hasField(r.field))throw new $("#REF");s.add(Q(o,r.field));const i=t.getCellValue(o,r.field),n=Ge(i);if(n)throw new $(n);return i}function ji(r,e,t,s){const o=dt(r.a,e,t),i=dt(r.b,e,t);if(o===null||i===null||!t.hasRow(o)||!t.hasRow(i))throw new $("#REF");if(!t.hasField(r.a.field)||!t.hasField(r.b.field))throw new $("#REF");const n=t.displayedRowIds(),a=n.indexOf(o),l=n.indexOf(i);if(a===-1||l===-1)throw new $("#REF");const d=Math.min(a,l),c=Math.max(a,l),h=n.slice(d,c+1),u=t.visibleFields(),g=u.indexOf(r.a.field),p=u.indexOf(r.b.field),[f,w]=g===-1||p===-1?[null,null]:[Math.min(g,p),Math.max(g,p)],m=[];for(const _ of h){if(f===null||w===null){s.add(Q(_,r.a.field)),m.push(t.getCellValue(_,r.a.field));continue}for(let y=f;y<=w;y++){const M=u[y];s.add(Q(_,M)),m.push(t.getCellValue(_,M))}}return m}function O(r){if(r==null||r==="")return v.zero();if(r instanceof v)return r;if(typeof r=="boolean")return v.from(r?"1":"0");if(typeof r=="number")return v.from(r);if(typeof r=="string"){const e=r.trim();if(!gt.test(e))throw new $("#VALUE");return v.from(hs(e))}throw new $("#VALUE")}function De(r){return r==null?"":r instanceof v?r.toString():typeof r=="boolean"?r?"TRUE":"FALSE":String(r)}function Pe(r){return typeof r=="boolean"?r:r instanceof v?!r.isZero():typeof r=="number"?r!==0:typeof r=="string"?r.trim().toUpperCase()==="TRUE"||gt.test(r.trim())&&r.trim()!=="0":!1}function Gi(r){return r<=0?v.from("1"):v.from("0."+"0".repeat(r-1)+"1")}function us(r,e,t){const s=Math.max(e,0),o=r.toFixed(s+20),i=o.startsWith("-"),n=i?o.slice(1):o,[a,l=""]=n.split("."),d=l.slice(0,s),c=l.slice(s),h=/[1-9]/.test(c),u=(i?"-":"")+a+(s>0?"."+d:"");let g=v.from(u);if(h&&t==="up"){const p=Gi(s);g=i?g.sub(p):g.add(p)}return g}function ps(r){const e=us(r,0,"down");return r.isNeg()&&!r.eq(e)?e.sub("1"):e}function Yi(r,e){return v.from(r.toFixed(Math.max(e,0)))}function gs(r,e,t,s){const o=ps(e);if(e.eq(o)){const i=Number(o.toFixed(0));if(!Number.isFinite(i)||Math.abs(i)>1e5)return s.v=!0,v.from(String(Math.pow(r.toNumber(),e.toNumber())));if(i===0)return v.one();let n=v.one();for(let a=0;a<Math.abs(i);a++)n=n.mul(r);if(i<0){if(n.isZero())throw new $("#DIV0");n=v.one().div(n,t)}return n}return s.v=!0,v.from(String(Math.pow(r.toNumber(),e.toNumber())))}function Xi(r,e,t,s,o){switch(r){case"+":return O(e).add(O(t));case"-":return O(e).sub(O(t));case"*":return O(e).mul(O(t));case"/":{const i=O(t);if(i.isZero())throw new $("#DIV0");return O(e).div(i,s)}case"%":{const i=O(t);if(i.isZero())throw new $("#DIV0");return O(e).mod(i)}case"^":return gs(O(e),O(t),s,o);case"&":return De(e)+De(t);case"=":case"<>":{const i=Zi(e,t);return r==="="?i:!i}case"<":case"<=":case">":case">=":{const i=O(e),n=O(t);return r==="<"?i.lt(n):r==="<="?i.lte(n):r===">"?i.gt(n):i.gte(n)}default:throw new $("#ERR")}}function Zi(r,e){try{return O(r).eq(O(e))}catch{return De(r)===De(e)}}function Ji(r,e){return r.t==="range"?ji(r.ref,e.host,e.accessor,e.touched):[W(r,e.host,e.accessor,e.touched,e.approxBox,e.prec)]}function Re(r,e){const t=[];for(const s of r)for(const o of Ji(s,e))Ge(o)||t.push(o);return t}function Ze(r){return r==null||r===""?!1:r instanceof v||typeof r=="number"?!0:typeof r=="string"?gt.test(r.trim()):!1}function Qi(r,e,t){switch(r){case"SUM":{const s=Re(e,t);return v.sum(s.map(o=>O(o)))}case"AVG":case"AVERAGE":{const o=Re(e,t).filter(i=>i!=null&&i!=="").map(i=>O(i));if(o.length===0)throw new $("#ERR");return v.avg(o,t.prec)}case"MIN":{const s=Re(e,t).filter(Ze);if(s.length===0)throw new $("#ERR");return v.min(s.map(o=>O(o)))}case"MAX":{const s=Re(e,t).filter(Ze);if(s.length===0)throw new $("#ERR");return v.max(s.map(o=>O(o)))}case"COUNT":{const s=Re(e,t);return v.from(String(s.filter(Ze).length))}case"COUNTA":{const s=Re(e,t);return v.from(String(s.filter(o=>o!=null&&o!=="").length))}case"IF":{if(e.length<2)throw new $("#ERR");const s=W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec);return Pe(s)?W(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec):e.length>2?W(e[2],t.host,t.accessor,t.touched,t.approxBox,t.prec):!1}case"AND":return e.every(s=>Pe(W(s,t.host,t.accessor,t.touched,t.approxBox,t.prec)));case"OR":return e.some(s=>Pe(W(s,t.host,t.accessor,t.touched,t.approxBox,t.prec)));case"NOT":if(e.length!==1)throw new $("#ERR");return!Pe(W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec));case"ROUND":{if(e.length!==2)throw new $("#ERR");const s=O(W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)),o=Number(O(W(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec)).toFixed(0));return Yi(s,o)}case"ROUNDUP":case"ROUNDDOWN":{if(e.length!==2)throw new $("#ERR");const s=O(W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)),o=Number(O(W(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec)).toFixed(0));return us(s,o,r==="ROUNDUP"?"up":"down")}case"ABS":{if(e.length!==1)throw new $("#ERR");return O(W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)).abs()}case"INT":{if(e.length!==1)throw new $("#ERR");return ps(O(W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)))}case"MOD":{if(e.length!==2)throw new $("#ERR");const s=O(W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)),o=O(W(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec));if(o.isZero())throw new $("#DIV0");return s.mod(o)}case"POWER":{if(e.length!==2)throw new $("#ERR");const s=O(W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)),o=O(W(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec));return gs(s,o,t.prec,t.approxBox)}case"SQRT":{if(e.length!==1)throw new $("#ERR");const s=O(W(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec));if(s.isNeg())throw new $("#NUM");return t.approxBox.v=!0,v.from(String(Math.sqrt(s.toNumber())))}case"CONCAT":return e.map(s=>De(W(s,t.host,t.accessor,t.touched,t.approxBox,t.prec))).join("");default:throw new $("#NAME")}}function W(r,e,t,s,o,i){switch(r.t){case"num":return v.from(r.v);case"str":return r.v;case"bool":return r.v;case"error":throw new $(r.code);case"field":{if(!t.hasField(r.field))throw new $("#REF");s.add(Q(e.rowId,r.field));const n=t.getCellValue(e.rowId,r.field),a=Ge(n);if(a)throw new $(a);return $t(n)}case"ref":{const n=qi(r.ref,e,t,s);return $t(n)}case"range":throw new $("#VALUE");case"call":return Qi(r.name,r.args,{host:e,accessor:t,touched:s,prec:i,approxBox:o});case"unary":{const n=O(W(r.arg,e,t,s,o,i));return r.op==="-"?n.neg():n}case"bin":return Xi(r.op,W(r.left,e,t,s,o,i),W(r.right,e,t,s,o,i),i,o);default:throw new $("#ERR")}}function $t(r){return r==null?null:r instanceof v||typeof r=="string"||typeof r=="boolean"?r:typeof r=="number"?v.from(r):String(r)}class eo{constructor(){this._cells=new Map}setFormula(e,t,s){this._cells.set(Q(e,t),s)}getFormula(e,t){return this._cells.get(Q(e,t))}clearFormula(e,t){this._cells.delete(Q(e,t))}hasFormula(e,t){return this._cells.has(Q(e,t))}getFormulaByKey(e){return this._cells.get(e)}getAllFormulaCells(){const e=[];for(const[t,s]of this._cells){const o=t.indexOf(":");e.push({rowId:t.slice(0,o),field:t.slice(o+1),cell:s})}return e}getRangeBearingKeys(){const e=[];for(const[t,s]of this._cells)s.hasRangeRef&&e.push(t);return e}size(){return this._cells.size}}class to{constructor(){this._precedents=new Map,this._dependents=new Map,this._byRowId=new Map,this._byField=new Map}_addEdge(e,t){let s=this._dependents.get(e);s||(s=new Set,this._dependents.set(e,s)),s.add(t);const{rowId:o,field:i}=be(e);let n=this._byRowId.get(o);n||(n=new Set,this._byRowId.set(o,n)),n.add(t);let a=this._byField.get(i);a||(a=new Set,this._byField.set(i,a)),a.add(t)}_removeEdgesFrom(e){const t=this._precedents.get(e);if(t)for(const s of t){const o=this._dependents.get(s);o&&(o.delete(e),o.size===0&&this._dependents.delete(s));const{rowId:i,field:n}=be(s),a=this._byRowId.get(i);a&&(a.delete(e),a.size===0&&this._byRowId.delete(i));const l=this._byField.get(n);l&&(l.delete(e),l.size===0&&this._byField.delete(n))}}addFormula(e,t){this._removeEdgesFrom(e),this._precedents.set(e,new Set(t));for(const s of t)this._addEdge(s,e)}removeFormula(e){this._removeEdgesFrom(e),this._precedents.delete(e)}isFormula(e){return this._precedents.has(e)}getPrecedents(e){return[...this._precedents.get(e)??[]]}getDependents(e){return[...this._dependents.get(e)??[]]}getDependentsClosure(e){const t=new Set;for(const i of e)this.isFormula(i)&&t.add(i);const s=[...e];let o=0;for(;o<s.length;){const i=s[o++],n=this._dependents.get(i);if(n)for(const a of n)t.has(a)||(t.add(a),s.push(a))}return[...t]}topoOrder(e){const t=new Set(e),s=new Map;for(const d of e){const c=this._precedents.get(d);let h=0;if(c)for(const u of c)t.has(u)&&h++;s.set(d,h)}const o=[];for(const[d,c]of s)c===0&&o.push(d);let i=0;const n=[];for(;i<o.length;){const d=o[i++];n.push(d);const c=this._dependents.get(d);if(c)for(const h of c){if(!t.has(h))continue;const u=(s.get(h)??0)-1;s.set(h,u),u===0&&o.push(h)}}const a=new Set(n),l=e.filter(d=>!a.has(d));return{order:n,cycles:l}}formulasReferencing(e,t){return t!==void 0?[...this._dependents.get(Q(e,t))??[]]:[...this._byRowId.get(e)??[]]}formulasReferencingField(e){return[...this._byField.get(e)??[]]}allFormulaKeys(){return[...this._precedents.keys()]}}function Je(r,e,t){let s;if(r.kind==="abs")s=r.rowId;else{const l=t.flatIndexOfRowId(e.rowId);s=l===-1?null:t.rowIdAtFlat(l+r.dRow)}if(s===null||!t.hasRow(s)||!t.hasField(r.field))return"#REF!";const o=t.flatIndexOfRowId(s),i=t.visibleFields().indexOf(r.field);if(o===-1||i===-1)return"#REF!";const n=(r.dollarCol?"$":"")+Ki(i),a=(r.dollarRow?"$":"")+(o+1);return n+a}function so(r){return'"'+r.replace(/"/g,'""')+'"'}const io={"+":"+","-":"-","*":"*","/":"/","%":"%","^":"^","&":"&","=":"=","<>":"<>","<":"<","<=":"<=",">":">",">=":">="};function oo(r,e,t){return"="+Te(r,e,t)}function Te(r,e,t){switch(r.t){case"num":return r.v;case"str":return so(r.v);case"bool":return r.v?"TRUE":"FALSE";case"field":return`[${r.field}]`;case"error":return"#REF!";case"ref":return Je(r.ref,e,t);case"range":return`${Je(r.ref.a,e,t)}:${Je(r.ref.b,e,t)}`;case"call":return`${r.name}(${r.args.map(s=>Te(s,e,t)).join(",")})`;case"unary":return`${r.op}${Te(r.arg,e,t)}`;case"bin":return`(${Te(r.left,e,t)}${io[r.op]}${Te(r.right,e,t)})`;default:return"#REF!"}}class fs{constructor(e){this.store=new eo,this.graph=new to,this._accessor=e.accessor,this._setComputedValue=e.setComputedValue,this._onFormulaError=e.onFormulaError,this._refMode=e.refMode??"stable",this._prec=e.divisionPrecision??30}compile(e,t){let s;try{s=Pi(e)}catch{s={t:"error",code:"#ERR"}}const o=Ui(s,t,this._accessor,this._refMode);return{ast:o,hasRangeRef:Ae(o)}}setCellFormula(e,t,s){const o={rowId:e,field:t},{ast:i,hasRangeRef:n}=this.compile(s,o),a={src:s,ast:i,hasRangeRef:n,value:null,error:null};this.store.setFormula(e,t,a);const l=Q(e,t),d=Dt(i,o,this._accessor,{divisionPrecision:this._prec});return this.graph.addFormula(l,d.touched),this.onValuesChanged([l])}getCellFormula(e,t){var s;return((s=this.store.getFormula(e,t))==null?void 0:s.src)??null}hasCellFormula(e,t){return this.store.hasFormula(e,t)}clearCellFormula(e,t){const s=Q(e,t),o=this.graph.getDependents(s);return this.store.clearFormula(e,t),this.graph.removeFormula(s),o}getCellError(e,t){var s;return((s=this.store.getFormula(e,t))==null?void 0:s.error)??null}getDependents(e,t){return this.graph.getDependents(Q(e,t)).map(be)}onValuesChanged(e){var n;const t=Ne(),s=this.graph.getDependentsClosure(e),{order:o,cycles:i}=this.graph.topoOrder(s);for(const a of i){const{rowId:l,field:d}=be(a),c=this.store.getFormula(l,d);c&&(c.value="#CYCLE",c.error="#CYCLE"),this._setComputedValue(l,d,"#CYCLE"),(n=this._onFormulaError)==null||n.call(this,l,d,"#CYCLE")}for(const a of o)this._evaluateOne(a);return{changed:[...o,...i],cycles:i.length,ms:Ne()-t}}_evaluateOne(e){var n;const{rowId:t,field:s}=be(e),o=this.store.getFormula(t,s);if(!o)return;const i=Dt(o.ast,{rowId:t,field:s},this._accessor,{divisionPrecision:this._prec});this.graph.addFormula(e,i.touched),o.value=i.value,o.error=i.error,o.approx=i.approx,this._setComputedValue(t,s,i.value),i.error&&((n=this._onFormulaError)==null||n.call(this,t,s,i.error))}recalculateAll(){var i;const e=Ne(),t=this.graph.allFormulaKeys(),{order:s,cycles:o}=this.graph.topoOrder(t);for(const n of o){const{rowId:a,field:l}=be(n),d=this.store.getFormula(a,l);d&&(d.value="#CYCLE",d.error="#CYCLE"),this._setComputedValue(a,l,"#CYCLE"),(i=this._onFormulaError)==null||i.call(this,a,l,"#CYCLE")}for(const n of s)this._evaluateOne(n);return{changed:[...s,...o],cycles:o.length,ms:Ne()-e}}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,t,s,o){const i=this.store.getFormula(e,t);if(!i)return"";const n=(()=>{const l=this._accessor.flatIndexOfRowId(e);return l===-1?e:this._accessor.rowIdAtFlat(l+s)??e})();(()=>{const l=this._accessor.visibleFields(),d=l.indexOf(t);return d===-1?t:l[d+o]??t})();const a=this._shiftAst(i.ast,s,o);return oo(a,{rowId:n},this._accessor)}_shiftAst(e,t,s){const o=n=>{if(n.kind==="rel")return{...n,dRow:n.dollarRow?n.dRow:n.dRow+t};let a=n.field;if(!n.dollarCol&&s!==0){const d=this._accessor.visibleFields(),c=d.indexOf(n.field),h=c===-1?void 0:d[c+s];if(!h)return{kind:"abs",rowId:"__dead__",field:"__dead__",dollarRow:n.dollarRow,dollarCol:n.dollarCol};a=h}let l=n.rowId;if(!n.dollarRow&&t!==0){const d=this._accessor.flatIndexOfRowId(n.rowId),c=d===-1?null:this._accessor.rowIdAtFlat(d+t);if(c===null)return{kind:"abs",rowId:"__dead__",field:"__dead__",dollarRow:n.dollarRow,dollarCol:n.dollarCol};l=c}return{kind:"abs",rowId:l,field:a,dollarRow:n.dollarRow,dollarCol:n.dollarCol}},i=n=>{switch(n.t){case"ref":{const a=o(n.ref);return a.kind==="abs"&&a.rowId==="__dead__"?{t:"error",code:"#REF"}:{t:"ref",ref:a}}case"range":{const a=o(n.ref.a),l=o(n.ref.b);return a.kind==="abs"&&a.rowId==="__dead__"||l.kind==="abs"&&l.rowId==="__dead__"?{t:"error",code:"#REF"}:{t:"range",ref:{a,b:l}}}case"call":return{t:"call",name:n.name,args:n.args.map(i)};case"unary":return{t:"unary",op:n.op,arg:i(n.arg)};case"bin":return{t:"bin",op:n.op,left:i(n.left),right:i(n.right)};default:return n}};return i(e)}}function Ne(){return typeof performance<"u"?performance.now():Date.now()}class no{constructor(){this._onKeyDown=e=>{e.stopPropagation(),e.key==="Enter"?(e.preventDefault(),this._onCommit(this.input.value)):e.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._onCommit(this.input.value)}}mount(e,t,s,o){this._container=e,this._onCommit=s,this._onCancel=o,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",t.column.header??"날짜 선택");const i=t.value;if(i){const n=i instanceof Date?i:new Date(i);isNaN(n.getTime())||(this.input.value=ss(n,"yyyy-MM-dd"))}this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),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,t,s;(e=this._container)==null||e.setAttribute("aria-expanded","false"),(t=this.input)==null||t.removeEventListener("keydown",this._onKeyDown),(s=this.input)==null||s.removeEventListener("blur",this._onBlur)}}function Ot(r){return r.map(e=>typeof e=="string"?{label:e,value:e}:{label:e.label??e.text??String(e.value??""),value:e.value})}class ro{constructor(e=[],t){this._options=Ot(e),this._optionsFn=t??null}mount(e,t,s,o){this._container=e,this._onCommit=s,this._onCancel=o,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",t.column.header??"선택");const i=this._optionsFn?Ot(this._optionsFn(t.row,t.rowIndex)):this._options;for(const a of i){const l=document.createElement("option");l.value=String(a.value),l.textContent=a.label,this.select.appendChild(l)}const n=t.value==null?"":String(t.value);i.some(a=>String(a.value)===n)&&(this.select.value=n),this.select.addEventListener("change",()=>s(this.select.value)),this.select.addEventListener("blur",()=>s(this.select.value)),this.select.addEventListener("keydown",a=>{a.key==="Escape"&&o()}),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 ao{constructor(){this._onKeyDown=e=>{e.stopPropagation(),e.key==="Enter"||e.key==="Tab"?(e.preventDefault(),this._onCommit(this.input.value)):e.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._onCommit(this.input.value)}}mount(e,t,s,o){this._onCommit=s,this._onCancel=o,this.input=document.createElement("input"),this.input.type="text",this.input.value=t.value==null?"":String(t.value),this.input.style.cssText=`
|
|
38
|
-
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
39
|
-
font-size:var(--og-font-size,13px);font-family:var(--og-font-family,sans-serif);
|
|
40
|
-
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
41
|
-
`,this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),e.appendChild(this.input)}getValue(){var e;return(e=this.input)==null?void 0:e.value}focus(){var e,t;(e=this.input)==null||e.focus(),(t=this.input)==null||t.select()}destroy(){var e,t;(e=this.input)==null||e.removeEventListener("keydown",this._onKeyDown),(t=this.input)==null||t.removeEventListener("blur",this._onBlur)}}class lo{constructor(e){this._onKeyDown=t=>{t.stopPropagation(),t.key==="Enter"||t.key==="Tab"?(t.preventDefault(),this._commit()):t.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._commit()},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,t,s,o){this._onCommit=s,this._onCancel=o,this.input=document.createElement("input"),this.input.type="number",this.input.value=t.value==null?"":String(t.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=`
|
|
42
|
-
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
43
|
-
font-size:var(--og-font-size,13px);text-align:right;
|
|
44
|
-
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
45
|
-
`,this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),e.appendChild(this.input)}_commit(){const e=this.input.value===""?null:Number(this.input.value);this._onCommit(e)}getValue(){var e,t;return((e=this.input)==null?void 0:e.value)===""?null:Number((t=this.input)==null?void 0:t.value)}focus(){var e,t;(e=this.input)==null||e.focus(),(t=this.input)==null||t.select()}destroy(){var e,t;(e=this.input)==null||e.removeEventListener("keydown",this._onKeyDown),(t=this.input)==null||t.removeEventListener("blur",this._onBlur)}}class _s{mount(e,t,s,o){this._onCommit=s,e.style.cssText+="display:flex;align-items:center;justify-content:center;",this.chk=document.createElement("input"),this.chk.type="checkbox",this.chk.checked=!!t.value,this.chk.style.cursor="pointer",this.chk.addEventListener("change",()=>s(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 ms=new Map;function Se(r,e){ms.set(r,e)}Se("number",(r,e)=>{const t={};return e&&(e.min!=null&&(t.min=e.min),e.max!=null&&(t.max=e.max),e.step!=null&&(t.step=e.step)),new lo(t)});Se("date",()=>new no);Se("boolean",()=>new _s);Se("checkbox",()=>new _s);Se("select",(r,e)=>new ro((e?e.options:r.options)??[],r.optionsFn));function zt(r){const e=r.editor;let t,s;e?typeof e=="string"?(t=e,s=void 0):(t=e.type,s=e):(t=String(r.type??""),s=void 0);const o=ms.get(t);return o?o(r,s):new ao}function $e(r){const e=typeof r.renderer=="string"?r.renderer:r.renderer&&typeof r.renderer=="object"?r.renderer.type:"";return r.type==="boolean"||r.type==="checkbox"||e==="checkbox"||e==="switch"}class co{constructor(e){this._activeEditor=null,this._editCell=null,this._focusCell=null,this._dragColIdx=null,this._d=e}get activeEditor(){return this._activeEditor}get editCell(){return this._editCell}get focusCell(){return this._focusCell}get dragColIdx(){return this._dragColIdx}set dragColIdx(e){this._dragColIdx=e}setFocusCell(e,t){this._focusCell={ri:e,ci:t},this._d.scrollToRow(e),this._d.doRender();const s=this._d.getVisibleLeaves()[t],o=this._d.data.getRowByIndex(e);if(s&&o){const i=o[s.field];this._d.announce(`${e+1}행 ${t+1}열, ${s.header}: ${i==null?"빈 값":String(i)}`)}}clearFocusCell(){this._focusCell=null}startEditByKey(e,t){var c,h,u,g,p,f,w;const s=this._d.getVisibleLeaves()[t];if(!s)return;if($e(s)){const m=this._d.getOptions();if(s.editable!==!1&&(s.editable!==void 0||m.editable)){const y=this._d.data.getRowByIndex(e);y&&this._d.writeCell(e,s.field,!y[s.field])}return}const o=this._d.data.getRowByIndex(e);if(s.editable===!1||typeof s.editable=="function"&&!s.editable(o,e))return;this.commitEdit();const i=(c=this._d.getRenderer())==null?void 0:c.getCellEl(e,t);if(!i)return;i.innerHTML="";const n=zt(s);this._activeEditor=n,this._editCell={ri:e,ci:t};const a={type:"editStart",rowIndex:e,columnIndex:t,field:s.field,oldValue:o==null?void 0:o[s.field],newValue:o==null?void 0:o[s.field],row:o,column:s};this._d.emit("editStart",a),(u=(h=this._d.getOptions()).onEditStart)==null||u.call(h,a),i.classList.add("og-editing");const d={value:((p=(g=this._d).hasCellFormula)!=null&&p.call(g,e,s.field)?(w=(f=this._d).getCellFormula)==null?void 0:w.call(f,e,s.field):null)??(o==null?void 0:o[s.field]),row:o,rowIndex:e,column:s,colIndex:t,isSelected:!0,rowState:"none"};n.mount(i,d,m=>this.commitEditWithValue(e,t,m),()=>this.cancelEdit()),requestAnimationFrame(()=>n.focus())}startEdit(e,t,s){var u,g,p,f,w,m;const o=this._d.getOptions();if(!o.editable)return;const i=this._d.getVisibleLeaves()[t];if(!i||$e(i))return;const n=this._d.data.getRowByIndex(e);if(i.editable===!1||typeof i.editable=="function"&&!i.editable(n,e)||!i.editable&&!o.editable)return;this.commitEdit();const a=(u=this._d.getRenderer())==null?void 0:u.getCellEl(e,t);if(!a)return;a.innerHTML="";const l=zt(i);this._activeEditor=l,this._editCell={ri:e,ci:t};const d={type:"editStart",rowIndex:e,columnIndex:t,field:i.field,oldValue:n==null?void 0:n[i.field],newValue:n==null?void 0:n[i.field],row:n,column:i};this._d.emit("editStart",d),(g=o.onEditStart)==null||g.call(o,d),a.classList.add("og-editing");const h={value:((f=(p=this._d).hasCellFormula)!=null&&f.call(p,e,i.field)?(m=(w=this._d).getCellFormula)==null?void 0:m.call(w,e,i.field):null)??(n==null?void 0:n[i.field]),row:n,rowIndex:e,column:i,colIndex:t,isSelected:!0,rowState:"none"};l.mount(a,h,_=>this.commitEditWithValue(e,t,_),()=>this.cancelEdit()),requestAnimationFrame(()=>l.focus())}commitEdit(){if(!this._activeEditor||!this._editCell)return;const e=this._activeEditor.getValue(),{ri:t,ci:s}=this._editCell;this._finishEdit(t,s,e,!1)}commitEditWithValue(e,t,s){this._finishEdit(e,t,s,!1)}cancelEdit(){if(!this._editCell)return;const{ri:e,ci:t}=this._editCell;this._finishEdit(e,t,void 0,!0)}_finishEdit(e,t,s,o){var a,l,d,c,h,u,g,p,f,w,m;if(!this._activeEditor)return;const i=this._d.getVisibleLeaves()[t],n=(a=this._d.getRenderer())==null?void 0:a.getCellEl(e,t);if(n&&(this._activeEditor.destroy(),n.classList.remove("og-editing")),this._activeEditor=null,this._editCell=null,!o&&i){const _=this._d.data.getCellValue(e,i.field),y=((d=(l=this._d).hasCellFormula)==null?void 0:d.call(l,e,i.field))??!1;if(typeof s=="string"&&s.trimStart().startsWith("=")){(h=(c=this._d).setCellFormula)==null||h.call(c,e,i.field,s);const k=this._d.data.getRowByIndex(e),b=this._d.getOptions(),x={type:"editEnd",rowIndex:e,columnIndex:t,field:i.field,oldValue:_,newValue:s,row:k,column:i};this._d.emit("editEnd",x),(u=b.onEditEnd)==null||u.call(b,x),this._d.emit("dataChange",this._d.data.getData()),(g=b.onDataChange)==null||g.call(b,this._d.data.getData())}else if(s!==_||y){y&&((f=(p=this._d).clearCellFormula)==null||f.call(p,e,i.field)),this._d.data.updateCell(e,i.field,s);const k=this._d.data.getRowByIndex(e),b=this._d.getOptions(),x={type:"editEnd",rowIndex:e,columnIndex:t,field:i.field,oldValue:_,newValue:s,row:k,column:i};this._d.emit("editEnd",x),(w=b.onEditEnd)==null||w.call(b,x),this._d.emit("dataChange",this._d.data.getData()),(m=b.onDataChange)==null||m.call(b,this._d.data.getData())}}this._d.doRender(),requestAnimationFrame(()=>this._d.getContainer().focus({preventScroll:!0}))}}class ho{constructor(e){this._d=e}_readCssVar(e){return getComputedStyle(this._d.getContainer()).getPropertyValue(e).trim()}_hexToXlsxRgb(e){const t=e.trim(),s=t.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/i);if(s)return[s[1],s[2],s[3]].map(i=>parseInt(i).toString(16).padStart(2,"0")).join("").toUpperCase();const o=t.replace("#","").toUpperCase();return o.length===3?o[0]+o[0]+o[1]+o[1]+o[2]+o[2]:o.length===6?o:""}exportExcel(e){const t=typeof e=="string"?{filename:e}:e??{};let s=t.filename??"export";s.toLowerCase().endsWith(".xlsx")||(s+=".xlsx");const o=t.sheetName??(this._d.getOptions().ariaLabel||"Sheet1"),i=this._d.getData(),n=this._d.getColLayout().visibleLeaves.filter(d=>{var c;return!((c=t.exceptFields)!=null&&c.includes(d.field))}),a=t.includeHeader!==!1,l=(this._d.getStrategy??((d,c)=>c))("cellSerializer",(d,c,h)=>c.type==="number"&&typeof d=="number"?d:typeof d=="boolean"?d?"✓":"":typeof d=="object"?"":String(d));Promise.resolve().then(()=>require("./xlsx.min-Bx-LxWOf.cjs")).then(d=>d.xlsx_min).then(({utils:d,writeFile:c})=>{var B;const h=[];a&&h.push(n.map(z=>z.header));for(const z of i)h.push(n.map(V=>{const Z=z[V.field];if(t.maskOnExport&&V.mask&&this._d.getMaskEnabled(V.field))return nt(Z==null?"":String(Z),V.mask);const ee=Z;return ee==null||ee===""?"":l(ee,V,z)}));const u=d.aoa_to_sheet(h),g=this._d.getColWidths(),p=this._d.getColLayout();u["!cols"]=n.map(z=>({wpx:g[p.getColumnIndex(z.field)]??100})),u["!rows"]=h.map((z,V)=>({hpx:V===0&&a?22:19}));const f=t.styleMode??"theme";let w="1565C0",m="FFFFFF",_="FFFFFF",y="EEF2FF",M="212121",k="BDBDBD",b=10;if(f==="theme"){const z=Z=>this._hexToXlsxRgb(Z);w=z(this._readCssVar("--og-header-bg"))||w,m=z(this._readCssVar("--og-header-color"))||m,_=z(this._readCssVar("--og-row-bg"))||_,y=z(this._readCssVar("--og-row-alt-bg"))||y,M=z(this._readCssVar("--og-row-color"))||M,k=z(this._readCssVar("--og-border-color"))||k;const V=this._readCssVar("--og-font-size");V&&(b=Math.max(8,Math.round(parseFloat(V)*.75)))}const x=f==="none",E={hdrFont:x?{}:{bold:!0,color:{rgb:m},sz:b,name:"맑은 고딕"},dataFont:x?{}:{sz:b,color:{rgb:M},name:"맑은 고딕"},hdrFill:x?{}:{patternType:"solid",fgColor:{rgb:w}},evenFill:x?{}:{patternType:"solid",fgColor:{rgb:_}},oddFill:x?{}:{patternType:"solid",fgColor:{rgb:y}},hdrBorder:x?{}:{top:{style:"medium",color:{rgb:w}},bottom:{style:"medium",color:{rgb:w}},left:{style:"thin",color:{rgb:w}},right:{style:"thin",color:{rgb:w}}},dataBorder:x?{}:{top:{style:"thin",color:{rgb:k}},bottom:{style:"thin",color:{rgb:k}},left:{style:"thin",color:{rgb:k}},right:{style:"thin",color:{rgb:k}}}};h.forEach((z,V)=>{const Z=a&&V===0,re=(a?V-1:V)%2===0;z.forEach((ze,F)=>{const D=d.encode_cell({r:V,c:F});u[D]||(u[D]={t:"s",v:""});const te=n[F],He=te.type==="number"||te.align==="right",Be=Z?"center":He?"right":te.align??"left";u[D].s={font:Z?E.hdrFont:E.dataFont,fill:Z?E.hdrFill:re?E.evenFill:E.oddFill,border:Z?E.hdrBorder:E.dataBorder,alignment:{horizontal:Be,vertical:"center",wrapText:!1}}})});const L=d.book_new();d.book_append_sheet(L,u,o),c(L,s,{cellStyles:!0}),(B=t.onAfter)==null||B.call(t,new Blob([]))}).catch(()=>{console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.")})}exportCsv(e){const t=typeof e=="string"?{filename:e}:e??{},s=this._d.getData(),o=this._d.getColLayout().visibleLeaves,i=o.map(l=>`"${l.header}"`).join(","),n=s.map(l=>o.map(d=>{const c=l[d.field]??"";if(t.maskOnExport&&d.mask&&this._d.getMaskEnabled(d.field))return nt(String(c),d.mask);const h=c;return typeof h=="string"&&h.includes(",")?`"${h}"`:h}).join(",")),a=t.filename??"export.csv";Ft("\uFEFF"+[i,...n].join(`
|
|
46
|
-
`),a)}exportJson(e){const t=typeof e=="string"?e:(e==null?void 0:e.filename)??"export.json";Ft(JSON.stringify(this._d.getData(),null,2),t,"application/json")}print(e){const t=(e==null?void 0:e.title)??"OPEN_GRID",s=(e==null?void 0:e.footerText)??"",o=this._d.getData(),i=this._d.getColLayout().visibleLeaves.filter(h=>{var u;return!((u=e==null?void 0:e.excludeFields)!=null&&u.includes(h.field))}),n=i.map(h=>`<th>${h.header??h.field}</th>`).join(""),a=o.map(h=>`<tr>${i.map(u=>`<td>${String(h[u.field]??"")}</td>`).join("")}</tr>`).join(""),l=s?`<div class="og-print-footer">${s}</div>`:"",d=`<!DOCTYPE html>
|
|
47
|
-
<html lang="ko"><head>
|
|
48
|
-
<meta charset="UTF-8"><title>${t}</title>
|
|
49
|
-
<style>
|
|
50
|
-
@page{margin:0;}
|
|
51
|
-
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:12px;margin:0;padding:1cm;}
|
|
52
|
-
h2{margin:0 0 10px;font-size:14px;color:#333;}
|
|
53
|
-
p{margin:0 0 8px;font-size:11px;color:#999;}
|
|
54
|
-
table{border-collapse:collapse;width:100%;}
|
|
55
|
-
th,td{border:1px solid #ccc;padding:5px 8px;text-align:left;white-space:nowrap;}
|
|
56
|
-
th{background:#f5f5f5;font-weight:600;color:#333;}
|
|
57
|
-
tr:nth-child(even) td{background:#fafafa;}
|
|
58
|
-
.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;}
|
|
59
|
-
</style>
|
|
60
|
-
</head><body>
|
|
61
|
-
<h2>${t}</h2>
|
|
62
|
-
<p>${o.length}행 × ${i.length}열 · ${new Date().toLocaleString("ko-KR")}</p>
|
|
63
|
-
<table>
|
|
64
|
-
<thead><tr>${n}</tr></thead>
|
|
65
|
-
<tbody>${a}</tbody>
|
|
66
|
-
</table>
|
|
67
|
-
${l}
|
|
68
|
-
<script>window.addEventListener('load',()=>{window.print();window.addEventListener('afterprint',()=>window.close());});<\/script>
|
|
69
|
-
</body></html>`,c=window.open("","_blank","width=960,height=640");c&&(c.document.write(d),c.document.close())}exportSheetsExcel(e){const t=this._d.getWsManager();if(!t){this.exportExcel(e??"workbook");return}const s=e??"workbook.xlsx",o=(this._d.getStrategy??((i,n)=>n))("cellSerializer",(i,n,a)=>typeof i=="boolean"?i?"✓":"":n.type==="number"&&typeof i=="number"?i:String(i));Promise.resolve().then(()=>require("./xlsx.min-Bx-LxWOf.cjs")).then(i=>i.xlsx_min).then(({utils:i,writeFile:n})=>{const a=i.book_new(),l=this._d.getOptions();for(const d of t.getNames()){const c=t.get(d),h=c.columns.length?c.columns:l.columns,u=[h.map(p=>p.header)];for(const p of c.data)u.push(h.map(f=>{const w=p[f.field];return w==null?"":o(w,f,p)}));const g=i.aoa_to_sheet(u);g["!cols"]=h.map(()=>({wpx:100})),i.book_append_sheet(a,g,d)}n(a,s.endsWith(".xlsx")?s:s+".xlsx",{cellStyles:!0})}).catch(()=>console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."))}}class uo{constructor(e){this._d=e}fmtNum(e,t){if(!t)return Math.round(e).toLocaleString("ko-KR");const s=t.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/),o=s?t.slice(0,s.index):"",i=s?t.slice(s.index+s[0].length):"",n=s?s[0]:t,a=n.includes("#")||n.includes(","),l=n.match(/\.(\d+)$/),d=l?parseInt(l[1],10):/^\d+$/.test(n)?parseInt(n,10):0,c=Math.abs(e).toFixed(d),[h="0",u]=c.split("."),g=a?h.replace(/\B(?=(\d{3})+(?!\d))/g,","):h,p=u!==void 0?`${g}.${u}`:g,f=`${o}${p}${i}`;return e<0?`-${f}`:f}computeValues(){const e=this._d.getOptions().footer;if(!e||e.length===0)return[];const t=this._d.getData();return e.filter(s=>s.field&&s.op).map(s=>{const o=s.field,i=s.op,n=t.map(u=>u[o]).filter(u=>u!=null&&u!==""&&!Ge(u));let a=null;const l=i.toUpperCase(),d=(this._d.getStrategy??((u,g)=>g))("summaryOp",null);if(d){const u=d(l,n,o);if(u!=null)return{_field:o,_value:u,_formatted:this.fmtNum(u,s.format)}}if(l==="SUM")a=n.length>0?v.sum(n.map(u=>String(u))):null;else if(l==="AVG")a=n.length>0?v.sum(n.map(u=>String(u))).div(v.from(String(n.length))):null;else if(l==="COUNT"){const u=n.length;return{_field:o,_value:u,_formatted:u.toLocaleString("ko-KR")}}else l==="MAX"?a=n.length>0?v.max(n.map(u=>String(u))):null:l==="MIN"&&(a=n.length>0?v.min(n.map(u=>String(u))):null);if(!a)return{_field:o,_value:null,_formatted:""};const c=a.toNumber(),h=this.fmtNum(c,s.format);return{_field:o,_value:c,_formatted:h}})}render(){var h;const e=this._d.getContainer(),t=e.querySelector(".og-footer-bar");t==null||t.remove();const s=this._d.getOptions(),o=s.footer;if(!o||o.length===0)return;const i=this._d.getColLayout().visibleLeaves,n=this._d.getColWidths()??i.map(u=>u.width??100),a=new Map(this.computeValues().map(u=>[u._field,u])),l=document.createElement("div");l.className="og-footer-bar",l.style.cssText=["display:flex;align-items:stretch;",`min-height:${s.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("");let d=0;if(s.stateColumn&&(d+=24),s.draggable&&(d+=18),s.rowNumber&&(d+=44),s.checkColumn&&(d+=36),d>0){const u=document.createElement("div");u.style.cssText=`width:${d}px;flex-shrink:0;border-right:1px solid var(--og-border-color,#e0e0e0);`,l.appendChild(u)}let c=0;for(const u of o){const g=Math.max(1,u.colspan??1);let p=0;for(let y=0;y<g;y++)p+=n[c+y]??100;const f=i[c];c+=g;const w=document.createElement("div");w.style.cssText=[`width:${p}px;min-width:${p}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 m=u.field,_=m?a.get(m):null;if(_){const y=_._formatted??String(_._value??""),M=u.label?`${u.label}: `:"";w.textContent=M+y,w.title=`${((h=u.op)==null?void 0:h.toUpperCase())??""} = ${y}`,w.style.color="var(--og-primary,#1976d2)",w.style.textAlign=u.align??((f==null?void 0:f.type)==="number","right")}else u.label&&(w.textContent=u.label,w.style.textAlign=u.align??"left",w.style.color="var(--og-row-color,#212121)");l.appendChild(w)}s.footerPosition==="top"?e.insertBefore(l,e.firstChild):e.appendChild(l)}}class po{constructor(e){this._d=e}handleKeyDown(e){var d,c,h,u,g;const t=this._d.getEditMgr();if(t.activeEditor)return;this._d.handleCellKeyEvt("cellKeyDown",e);const s=this._d.getData(),o=this._d.getColLayout(),i=s.rowCount,n=o.visibleLeaves.length;if(i===0||n===0)return;if((e.ctrlKey||e.metaKey)&&e.key==="c"){e.preventDefault(),this._copyToClipboard();return}if((e.ctrlKey||e.metaKey)&&e.key==="v"){e.preventDefault(),this._pasteFromClipboard();return}const a=((c=(d=this._d).getRangeHooks)==null?void 0:c.call(d))??null;if((e.ctrlKey||e.metaKey)&&(a!=null&&a.isEnabled())&&(e.key==="d"||e.key==="D")){e.preventDefault(),a.ctrlFill("down");return}if((e.ctrlKey||e.metaKey)&&(a!=null&&a.isEnabled())&&(e.key==="r"||e.key==="R")){e.preventDefault(),a.ctrlFill("right");return}if(e.shiftKey&&(a!=null&&a.isEnabled())&&(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")){e.preventDefault();const p=e.key==="ArrowDown"?"down":e.key==="ArrowUp"?"up":e.key==="ArrowLeft"?"left":"right";a.extendFocus(p);return}const l=this._d.getOptions();if((e.ctrlKey||e.metaKey)&&l.draggable&&t.focusCell){if(e.key==="ArrowDown"){e.preventDefault();const p=t.focusCell.ci!==void 0?t.focusCell.ri:0;p<i-1&&(this._d.handleRowDrop(p,p+1),this._d.setFocusCell(p+1,t.focusCell.ci),this._d.announce(`행 ${p+1}을(를) ${p+2}번째 위치로 이동`));return}if(e.key==="ArrowUp"){e.preventDefault();const p=t.focusCell.ri;p>0&&(this._d.handleRowDrop(p,p-1),this._d.setFocusCell(p-1,t.focusCell.ci),this._d.announce(`행 ${p+1}을(를) ${p}번째 위치로 이동`));return}}switch(e.key){case"ArrowDown":{e.preventDefault();const p=t.focusCell,f=p?Math.min(p.ri+1,i-1):0;this._d.setFocusCell(f,(p==null?void 0:p.ci)??0);break}case"ArrowUp":{e.preventDefault();const p=t.focusCell,f=p?Math.max(p.ri-1,0):0;this._d.setFocusCell(f,(p==null?void 0:p.ci)??0);break}case"ArrowRight":{e.preventDefault();const p=t.focusCell;if(!p){this._d.setFocusCell(0,0);break}p.ci<n-1?this._d.setFocusCell(p.ri,p.ci+1):p.ri<i-1&&this._d.setFocusCell(p.ri+1,0);break}case"ArrowLeft":{e.preventDefault();const p=t.focusCell;if(!p){this._d.setFocusCell(0,0);break}p.ci>0?this._d.setFocusCell(p.ri,p.ci-1):p.ri>0&&this._d.setFocusCell(p.ri-1,n-1);break}case"Tab":{e.preventDefault();const p=t.focusCell;if(!p){this._d.setFocusCell(0,0);break}e.shiftKey?p.ci>0?this._d.setFocusCell(p.ri,p.ci-1):p.ri>0&&this._d.setFocusCell(p.ri-1,n-1):p.ci<n-1?this._d.setFocusCell(p.ri,p.ci+1):p.ri<i-1&&this._d.setFocusCell(p.ri+1,0);break}case"Home":{if(e.preventDefault(),e.ctrlKey||e.metaKey)this._d.setFocusCell(0,0);else{const p=t.focusCell;this._d.setFocusCell((p==null?void 0:p.ri)??0,0)}break}case"End":{if(e.preventDefault(),e.ctrlKey||e.metaKey)this._d.setFocusCell(i-1,n-1);else{const p=t.focusCell;this._d.setFocusCell((p==null?void 0:p.ri)??0,n-1)}break}case"PageDown":{e.preventDefault();const p=t.focusCell,f=this._d.getOptions().pageSize??10,w=Math.min(p?p.ri+f:f-1,i-1);this._d.setFocusCell(w,(p==null?void 0:p.ci)??0);break}case"PageUp":{e.preventDefault();const p=t.focusCell,f=this._d.getOptions().pageSize??10,w=p?Math.max(p.ri-f,0):0;this._d.setFocusCell(w,(p==null?void 0:p.ci)??0);break}case" ":{if(t.focusCell){e.preventDefault();const p=t.focusCell.ri,f=this._d.getRowMgr();this._d.getOptions().checkColumn?(f.check(p,!f.checkedRows.has(p)),this._d.doRender()):(f.selectToggle(p),this._d.doRender())}break}case"F2":case"Enter":{t.focusCell&&this._d.getOptions().editable&&(e.preventDefault(),t.startEditByKey(t.focusCell.ri,t.focusCell.ci));break}case"Escape":{(g=(u=(h=this._d).getRangeHooks)==null?void 0:u.call(h))==null||g.clear(),t.clearFocusCell(),this._d.doRender();break}}}_copyToClipboard(){var a,l,d,c;if(!this._d.getOptions().clipboard)return;const t=(l=(a=this._d).getRangeHooks)==null?void 0:l.call(a);if(t!=null&&t.isEnabled()&&t.hasSelection()){const h=t.copyText();if(h!=null){(d=navigator.clipboard)==null||d.writeText(h).catch(()=>{});return}}const s=this._d.getEditMgr(),o=this._d.getColLayout(),i=this._d.getData();let n="";if(s.focusCell){const{ri:h,ci:u}=s.focusCell,g=o.visibleLeaves[u];g&&(n=String(i.getCellValue(h,g.field)??""))}else if(this._d.getRowMgr().selectedRows.size>0){const h=o.visibleLeaves;n=[...this._d.getRowMgr().selectedRows].sort((g,p)=>g-p).map(g=>{const p=i.getRowByIndex(g);return h.map(f=>String((p==null?void 0:p[f.field])??"")).join(" ")}).join(`
|
|
70
|
-
`)}n&&((c=navigator.clipboard)==null||c.writeText(n).catch(()=>{}))}_pasteFromClipboard(){var o,i,n;const e=this._d.getOptions();if(!e.clipboard||!e.editable)return;const t=this._d.getEditMgr(),s=(i=(o=this._d).getRangeHooks)==null?void 0:i.call(o);(n=navigator.clipboard)==null||n.readText().then(a=>{var p,f;if(!a||s!=null&&s.isEnabled()&&s.hasSelection()&&s.pasteText(a)||!t.focusCell)return;const{ri:l,ci:d}=t.focusCell,c=a.split(`
|
|
71
|
-
`),h=this._d.getColLayout().visibleLeaves,u=this._d.getData(),g=[];for(let w=0;w<c.length;w++){const m=c[w].split(" ");for(let _=0;_<m.length;_++){const y=l+w,M=d+_,k=h[M];k&&y<u.rowCount&&g.push({rowIndex:y,field:k.field,value:m[_]})}}g.length&&((f=(p=this._d).writeCells)==null||f.call(p,g))}).catch(()=>{})}}class go{constructor(e){this._sortList=[],this._filters={},this._d=e}get sortList(){return this._sortList}get filters(){return this._filters}handleSortClick(e,t){var a,l,d;const s=this._d.getOptions();if(!s.sortable)return;const o=this._sortList.findIndex(c=>c.field===e);if(o>=0){const c=this._sortList[o];c.dir==="asc"?c.dir="desc":this._sortList.splice(o,1)}else(!t||!s.multiSort)&&(this._sortList=[]),this._sortList.push({field:e,dir:"asc"});this._d.getData().applySort(this._sortList),(l=(a=this._d).onReproject)==null||l.call(a),this._d.renderHeader(),this._d.doRender();const i=this._sortList.find(c=>c.field===e),n=i?i.dir==="asc"?"오름차순":"내림차순":"정렬 해제";this._d.announce(`${e} ${n} 정렬`),this._d.emit("sortChange",{sortList:this._sortList}),(d=s.onSortChange)==null||d.call(s,{field:e,dir:(i==null?void 0:i.dir)??"asc",sortList:this._sortList})}sort(e,t="asc"){var s,o;if(Array.isArray(e))this._sortList=e;else{const i=this._sortList.findIndex(n=>n.field===e);i>=0?this._sortList[i].dir=t:this._sortList=[{field:e,dir:t}],this._d.getOptions().multiSort||(this._sortList=this._sortList.slice(-1))}this._d.getData().applySort(this._sortList),(o=(s=this._d).onReproject)==null||o.call(s),this._d.renderHeader(),this._d.doRender(),this._d.emit("sortChange",{sortList:this._sortList})}resetSort(){var e,t;this._sortList=[],this._d.getData().applySort([]),(t=(e=this._d).onReproject)==null||t.call(e),this._d.renderHeader(),this._d.doRender()}initSort(e){var t,s;this._sortList=[...e],this._d.getData().applySort(this._sortList),(s=(t=this._d).onReproject)==null||s.call(t)}getSortState(){return[...this._sortList]}setFilter(e,t){var s,o;this._filters[e]=t,this.applyFilters(),this._d.renderHeader(),this._d.doRender(),this._d.emit("filterChange",{field:e,filterItems:t,allFilters:this._filters}),(o=(s=this._d.getOptions()).onFilterChange)==null||o.call(s,{field:e,filterItems:t,allFilters:this._filters})}resetFilter(e){e?delete this._filters[e]:this._filters={},this.applyFilters(),this._d.renderHeader(),this._d.doRender()}getFilterState(){return{...this._filters}}restoreFilter(e){this._filters={...e},this.applyFilters()}applyFilters(){var s,o,i,n;const e=this._d.getData();e.setFindFilter(this._d.getFindFilter(),this._d.getColLayout().visibleLeaves.map(a=>a.field)),e.applyFilter(this._filters),(o=(s=this._d).onReproject)==null||o.call(s);const t=e.rowCount;(i=this._d.getVs())==null||i.setTotalRows(t),(n=this._d.getPagination())==null||n.setTotalRows(t)}}class fo{constructor(e){this._bar=null,this._input=null,this._count=null,this._filter="",this._d=e}get findFilter(){return this._filter}init(e){const t=document.createElement("div");t.className="og-find-bar",t.hidden=!0;const s=document.createElement("span");s.className="og-find-label",s.textContent="찾기";const o=document.createElement("input");o.type="text",o.className="og-find-input",o.placeholder="검색어 입력...",o.setAttribute("aria-label","그리드 내 검색");const i=document.createElement("span");i.className="og-find-count";const n=document.createElement("button");n.className="og-find-close",n.textContent="✕",n.setAttribute("aria-label","찾기 닫기"),t.appendChild(s),t.appendChild(o),t.appendChild(i),t.appendChild(n),e.insertBefore(t,e.firstChild),o.addEventListener("input",()=>{this._filter=o.value.trim(),this._apply()}),o.addEventListener("keydown",a=>{a.key==="Escape"&&this.close()}),n.addEventListener("click",()=>this.close()),this._bar=t,this._input=o,this._count=i}open(){this._bar&&(this._bar.hidden=!1,this._input.focus(),this._input.select())}close(){this._bar&&(this._bar.hidden=!0,this._filter="",this._input.value="",this._count&&(this._count.textContent=""),this._apply())}_apply(){var o,i;const e=this._d.getData(),t=this._d.getColLayout().visibleLeaves.map(n=>n.field);e.setFindFilter(this._filter,t),e.applyFilter(this._d.getFilters());const s=e.rowCount;(o=this._d.getVs())==null||o.setTotalRows(s),(i=this._d.getPagination())==null||i.setTotalRows(s),this._count&&(this._count.textContent=this._filter?`${s}건`:""),this._d.doRender()}}class _o{constructor(e){this._d=e}handleCellClick(e,t,s){var d,c,h,u,g,p,f,w,m;const o=this._d.getOptions(),i=this._d.getRowMgr(),n=this._d.getEditMgr();o.selection==="single"||o.selection==="row"?i.selectSingle(e):o.selection==="multiple"?s.ctrlKey||s.metaKey?i.selectToggle(e):i.selectSingle(e):o.selection==="cells"&&t>=0&&((c=(d=this._d).onCellsClick)==null||c.call(d,e,t,s.shiftKey));const a=this._d.getData().getRowByIndex(e),l=this._d.getColLayout().visibleLeaves[t];if(a&&l){const _=l.editable!==!1&&(l.editable!==void 0||o.editable);if($e(l)&&_){const E=a[l.field];this._d.writeCell(e,l.field,!E)}if(l.type==="radio"){const E=l.group;for(const L of this._d.getColLayout().visibleLeaves)L.type==="radio"&&L.field!==l.field&&(!E||L.group===E)&&this._d.getData().updateCell(e,L.field,!1);this._d.writeCell(e,l.field,!0)}let y=a[l.field];if(y===void 0&&l.formula)try{const E=l.formulaPrecision??30,L=Qt(l.formula,a,E);y=L instanceof v?l.precision!=null?L.toFixed(l.precision):L.toString():String(L)}catch{}const M={type:"cellClick",rowIndex:e,columnIndex:t,field:l.field,value:y,row:a,column:l,target:s.target,originalEvent:s};this._d.emit("cellClick",M),(h=o.onCellClick)==null||h.call(o,M);const k={type:"rowClick",rowIndex:e,row:a,target:s.target,originalEvent:s};this._d.emit("rowClick",k),(u=o.onRowClick)==null||u.call(o,k);const b=l.type==="select";!(n.activeEditor!=null&&((g=n.editCell)==null?void 0:g.ri)===e&&((p=n.editCell)==null?void 0:p.ci)===t)&&(o.editMode==="click"||b)&&!$e(l)&&n.startEdit(e,t,s)}n.activeEditor&&((f=n.editCell)==null?void 0:f.ri)===e&&((w=n.editCell)==null?void 0:w.ci)===t||o.selection!=="cells"&&(this._d.doRender(),this._d.emit("selectionChange",{rows:i.getSelections(),rowIndexes:[...i.selectedRows]}),(m=o.onSelectionChange)==null||m.call(o,{rows:i.getSelections(),rowIndexes:[...i.selectedRows],cells:[]}))}handleCellDblClick(e,t,s){var d,c;const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const n=this._d.getOptions(),a={type:"cellDblClick",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellDblClick",a),(d=n.onCellDblClick)==null||d.call(n,a);const l={type:"rowDblClick",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowDblClick",l),(c=n.onRowDblClick)==null||c.call(n,l),n.editMode==="dblclick"&&this._d.getEditMgr().startEdit(e,t,s)}handleCellMouseOver(e,t,s){var d,c;const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const n=this._d.getOptions(),a={type:"cellMouseOver",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseOver",a),(d=n.onCellMouseOver)==null||d.call(n,a);const l={type:"rowMouseOver",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseOver",l),(c=n.onRowMouseOver)==null||c.call(n,l)}handleCellMouseOut(e,t,s){var d,c;const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const n=this._d.getOptions(),a={type:"cellMouseOut",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseOut",a),(d=n.onCellMouseOut)==null||d.call(n,a);const l={type:"rowMouseOut",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseOut",l),(c=n.onRowMouseOut)==null||c.call(n,l)}handleCellMouseDown(e,t,s){var d,c,h,u;(c=(d=this._d).rangeMouseDown)==null||c.call(d,e,t,s);const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const n=this._d.getOptions(),a={type:"cellMouseDown",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseDown",a),(h=n.onCellMouseDown)==null||h.call(n,a);const l={type:"rowMouseDown",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseDown",l),(u=n.onRowMouseDown)==null||u.call(n,l)}handleCellMouseUp(e,t,s){var d,c,h,u;(c=(d=this._d).rangeMouseUp)==null||c.call(d,e,t,s);const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const n=this._d.getOptions(),a={type:"cellMouseUp",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseUp",a),(h=n.onCellMouseUp)==null||h.call(n,a);const l={type:"rowMouseUp",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseUp",l),(u=n.onRowMouseUp)==null||u.call(n,l)}handleCellMouseMove(e,t,s){var d,c,h,u;(c=(d=this._d).rangeMouseMove)==null||c.call(d,e,t,s);const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const n=this._d.getOptions(),a={type:"cellMouseMove",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseMove",a),(h=n.onCellMouseMove)==null||h.call(n,a);const l={type:"rowMouseMove",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseMove",l),(u=n.onRowMouseMove)==null||u.call(n,l)}handleCellKeyEvt(e,t){var c,h,u;const s=this._d.getEditMgr();if(!s.focusCell||s.activeEditor)return;const{ri:o,ci:i}=s.focusCell,n=this._d.getData().getRowByIndex(o),a=this._d.getColLayout().visibleLeaves[i];if(!n||!a)return;const l=this._d.getOptions(),d={type:e,rowIndex:o,columnIndex:i,field:a.field,value:n[a.field],row:n,column:a,key:t.key,target:this._d.getContainer(),originalEvent:t};this._d.emit(e,d),e==="cellKeyDown"?(c=l.onCellKeyDown)==null||c.call(l,d):e==="cellKeyUp"?(h=l.onCellKeyUp)==null||h.call(l,d):(u=l.onCellKeyPress)==null||u.call(l,d)}}function mo(r,e){return{startRow:Math.min(r.ri,e.ri),endRow:Math.max(r.ri,e.ri),startCol:Math.min(r.ci,e.ci),endCol:Math.max(r.ci,e.ci)}}class wo{constructor(e){this._anchor={ri:0,ci:0},this._focus={ri:0,ci:0},this._identity={rowIds:[],fields:[]},this._rects=[],this._hasSelection=!1,this._additive=!1,this._host=e}get hasSelection(){return this._hasSelection}getAnchor(){return{...this._anchor}}getFocus(){return{...this._focus}}getIdentity(){return{rowIds:[...this._identity.rowIds],fields:[...this._identity.fields]}}getRangeSelection(){return this._rects.map(e=>({...e}))}getActiveRange(){return this._rects[0]?{...this._rects[0]}:null}getPrimaryRect(){return this.getActiveRange()}getProjectedFlatRows(){return this._identity.rowIds.map(e=>this._host.flatIndexOfRowId(e)).filter(e=>e>=0).sort((e,t)=>e-t)}beginDrag(e,t,s={}){s.shift&&this._hasSelection?this._focus={ri:e,ci:t}:(this._anchor={ri:e,ci:t},this._focus={ri:e,ci:t}),this._hasSelection=!0,this._additive=!!s.additive,this._recompute()}updateFocus(e,t){this._hasSelection&&(this._focus={ri:e,ci:t},this._recompute())}endDrag(){this._hasSelection&&this.snapshotIdentity()}get additive(){return this._additive}click(e,t){this._anchor={ri:e,ci:t},this._focus={ri:e,ci:t},this._hasSelection=!0,this._recompute(),this.snapshotIdentity()}shiftClickExtend(e,t){if(!this._hasSelection){this.click(e,t);return}this._focus={ri:e,ci:t},this._recompute(),this.snapshotIdentity()}extendFocus(e){if(!this._hasSelection)return;const t=Math.max(0,this._host.count()-1),s=Math.max(0,this._host.visibleFields().length-1);let{ri:o,ci:i}=this._focus;switch(e){case"up":o=Math.max(0,o-1);break;case"down":o=Math.min(t,o+1);break;case"left":i=Math.max(0,i-1);break;case"right":i=Math.min(s,i+1);break}this._focus={ri:o,ci:i},this._recompute(),this.snapshotIdentity()}setRect(e){this._anchor={ri:e.startRow,ci:e.startCol},this._focus={ri:e.endRow,ci:e.endCol},this._hasSelection=!0,this._rects=[{...e}],this.snapshotIdentity()}clear(){this._hasSelection=!1,this._rects=[],this._identity={rowIds:[],fields:[]}}snapshotIdentity(){const e=this._rects[0];if(!e){this._identity={rowIds:[],fields:[]};return}const t=[];for(let i=e.startRow;i<=e.endRow;i++){const n=this._host.rowIdOfFlat(i);n&&t.push(n)}const o=this._host.visibleFields().slice(e.startCol,e.endCol+1);this._identity={rowIds:t,fields:o}}reproject(){if(!this._hasSelection)return;if(this._identity.rowIds.length===0||this._identity.fields.length===0){this._rects=[];return}const e=this._identity.rowIds.map(l=>this._host.flatIndexOfRowId(l)).filter(l=>l>=0),t=this._host.visibleFields(),s=this._identity.fields.map(l=>t.indexOf(l)).filter(l=>l>=0);if(e.length===0||s.length===0){this._rects=[];return}const o=Math.min(...e),i=Math.max(...e),n=Math.min(...s),a=Math.max(...s);this._rects=[{startRow:o,endRow:i,startCol:n,endCol:a}],this._anchor={ri:o,ci:n},this._focus={ri:i,ci:a}}_recompute(){this._rects=[mo(this._anchor,this._focus)]}}const yo=/^-?\d+(\.\d+)?$/,vo=/^(.*?)(\d+)$/;function bo(r){const e=String(r??"").trim();if(e===""||!yo.test(e))return null;try{return v.from(e)}catch{return null}}function xo(r){const e=r.length;if(e===0)return{kind:"copy"};const t=r.map(bo);if(t.every(s=>s!==null)){if(e===1)return{kind:"copy"};const s=t,o=s.slice(1).map((n,a)=>n.sub(s[a]));return o.every(n=>n.eq(o[0]))?{kind:"arith",step:o[0],values:s}:{kind:"copy"}}if(e>=2){const s=r.map(o=>vo.exec(String(o??"")));if(s.every(o=>o!==null)){const o=s.map(n=>n[1]);if(o.every(n=>n===o[0])){const n=s.map(d=>v.from(d[2])),a=n.slice(1).map((d,c)=>d.sub(n[c]));if(a.every(d=>d.eq(a[0])))return{kind:"text-suffix",step:a[0],values:n,prefix:o[0]}}}}return{kind:"copy"}}function ws(r,e,t){return t<=0?0:r==="down"||r==="right"?(e-1)%t:(t-e%t)%t}function Co(r,e,t,s){const o=e.length;if(r.kind==="copy"||!r.values||!r.step)return e[ws(t,s,o)];const i=t==="down"||t==="right",n=i?r.values[r.values.length-1]:r.values[0],a=i?r.step:r.step.neg(),l=n.add(a.mul(s));return r.kind==="text-suffix"?`${r.prefix}${l.toNumber()}`:l.toNumber()}function Me(r,e){const t=[];for(let s=r;s<=e;s++)t.push(s);return t}function Ro(r,e,t,s,o){var a;const i=r.resolveFlatRow(e);return i.kind!=="data"||!i.rowId?{rowIndex:e,field:t,action:"skip",reason:"non-data-row"}:r.isEditable&&!r.isEditable(i.rowId,t)?{rowIndex:e,field:t,action:"skip",reason:"not-editable"}:!!((a=r.hasCellFormula)!=null&&a.call(r,i.rowId,t))&&!r.overwriteFormula?(o(),{rowIndex:e,field:t,action:"skip",reason:"formula-preserved"}):{rowIndex:e,field:t,action:"value",value:s}}function Mo(r,e,t,s,o,i,n,a){var g,p;const l=r.resolveFlatRow(e);if(l.kind!=="data"||!l.rowId)return{rowIndex:e,field:s,action:"skip",reason:"non-data-row"};if(r.isEditable&&!r.isEditable(l.rowId,s))return{rowIndex:e,field:s,action:"skip",reason:"not-editable"};const d=r.resolveFlatRow(o),c=!!(d.rowId&&((g=r.hasCellFormula)!=null&&g.call(r,d.rowId,n)));if(c&&d.rowId){if(r.forceCopyFormula){const f=r.getCellValue(o,n);return{rowIndex:e,field:s,action:"setFormula",formula:String(f)}}if(r.offsetFormula){const f=r.offsetFormula(d.rowId,n,e-o,t-i);return{rowIndex:e,field:s,action:"setFormula",formula:f}}}const h=!!((p=r.hasCellFormula)!=null&&p.call(r,l.rowId,s));if(!c&&h&&!r.overwriteFormula)return a(),{rowIndex:e,field:s,action:"skip",reason:"formula-preserved"};const u=r.getCellValue(o,n);return{rowIndex:e,field:s,action:"value",value:u}}function ko(r,e,t,s,o){const i=t==="up"||t==="down",n=[];let a=0;const l=()=>{a++},d=i?Me(r.startCol,r.endCol):Me(r.startRow,r.endRow);for(const c of d){const h=i?o.fieldAt(c):void 0,u=i?Me(r.startRow,r.endRow).map(m=>({ri:m,ci:c})):Me(r.startCol,r.endCol).map(m=>({ri:c,ci:m})),g=u.map(m=>{const _=i?h:o.fieldAt(m.ci);return _?o.getCellValue(m.ri,_):void 0}),p=s==="series"?xo(g):{kind:"copy"},f=i?Me(e.startRow,e.endRow):Me(e.startCol,e.endCol);(t==="down"||t==="right"?f:[...f].reverse()).forEach((m,_)=>{const y=_+1,M=i?m:c,k=i?c:m,b=i?h:o.fieldAt(m);if(!b)return;if(p.kind!=="copy"){const B=Co(p,g,t,y);n.push(Ro(o,M,b,B,l));return}const x=ws(t,y,u.length),E=u[x],L=i?h:o.fieldAt(E.ci);L&&n.push(Mo(o,M,k,b,E.ri,E.ci,L,l))})}return{items:n,skippedFormula:a}}function Eo(r,e){return e==="down"?r.endRow<=r.startRow?null:{source:{startRow:r.startRow,endRow:r.startRow,startCol:r.startCol,endCol:r.endCol},target:{startRow:r.startRow+1,endRow:r.endRow,startCol:r.startCol,endCol:r.endCol}}:r.endCol<=r.startCol?null:{source:{startRow:r.startRow,endRow:r.endRow,startCol:r.startCol,endCol:r.startCol},target:{startRow:r.startRow,endRow:r.endRow,startCol:r.startCol+1,endCol:r.endCol}}}function Fo(r,e){const t=[];for(let s=r.startRow;s<=r.endRow;s++){const o=[];for(let i=r.startCol;i<=r.endCol;i++){const n=e.fieldAt(i);if(!n){o.push("");continue}const a=e.getDisplayText?e.getDisplayText(s,n):String(e.getCellValue(s,n)??"");o.push(a)}t.push(o.join(" "))}return t.join(`
|
|
72
|
-
`)}function So(r){return r===""?[[""]]:r.split(`
|
|
73
|
-
`).map(e=>e.split(" "))}function Lo(r,e,t){var c;const s=r.length,o=s>0?Math.max(...r.map(h=>h.length)):0;if(s===0||o===0)return[];const i=e.endRow-e.startRow+1,n=e.endCol-e.startCol+1,a=Math.max(i,s),l=Math.max(n,o),d=[];for(let h=0;h<a;h++)for(let u=0;u<l;u++){const g=e.startRow+h,p=e.startCol+u,f=t.fieldAt(p);if(!f)continue;const w=t.resolveFlatRow(g);if(w.kind!=="data"||!w.rowId){d.push({rowIndex:g,field:f,action:"skip",reason:"non-data-row"});continue}if(t.isEditable&&!t.isEditable(w.rowId,f)){d.push({rowIndex:g,field:f,action:"skip",reason:"not-editable"});continue}const m=((c=r[h%s])==null?void 0:c[u%o])??"";d.push({rowIndex:g,field:f,action:"value",value:m})}return d}function ys(r,e){const t=[];for(let s=r.startRow;s<=r.endRow;s++){const o=[];for(let i=r.startCol;i<=r.endCol;i++){const n=e.fieldAt(i);o.push(n?e.getCellValue(s,n):void 0)}t.push(o)}return t}function Io(r,e){const t=ys(r,e).flat(),s=[];for(const o of t){const i=String(o??"").trim();i===""||!/^-?\d+(\.\d+)?$/.test(i)||s.push(v.from(i))}return s.length===0?null:{sum:v.sum(s).toString(),avg:v.avg(s).toString(),count:s.length,min:v.min(s).toString(),max:v.max(s).toString()}}class Ao{constructor(e){this._isDragging=!1,this._fillDragSource=null,this._fillDragStart=null,this._fillPreview=null,this._handlePointerId=null,this._autoScrollRAF=null,this._autoScrollVX=0,this._autoScrollVY=0,this._overlayEl=null,this._borderEl=null,this._previewEl=null,this._handleEl=null,this._mountedWrap=null,this._d=e;const t={count:()=>this._d.getFlatModel().count(),resolveFlatRow:s=>this._d.getFlatModel().resolveFlatRow(s),flatIndexOfRowId:s=>this._d.getFlatModel().flatIndexOfRowId(s),rowIdOfFlat:s=>this._d.getFlatModel().rowIdOfFlat(s),visibleFields:()=>this._d.getColLayout().visibleLeaves.map(s=>s.field)};this._model=new wo(t)}isEnabled(){var t;const e=this._d.getOptions();return((t=e.rangeSelection)==null?void 0:t.enabled)??e.selection==="cells"}_rangeOpts(){const e=this._d.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}}_editorActive(){return this._d.getEditMgr().activeEditor!=null}hasSelection(){return this._model.hasSelection}getRangeSelection(){return this._model.getRangeSelection()}getActiveRange(){return this._model.getActiveRange()}getFillPreview(){return this._fillPreview}getRangeValues(){const e=this.getActiveRange();return e?ys(e,this._queryCtx()):[]}getRangeStats(){const e=this.getActiveRange();return e?Io(e,this._queryCtx()):null}_queryCtx(){return{fieldAt:e=>{var t;return(t=this._d.getColLayout().visibleLeaves[e])==null?void 0:t.field},getCellValue:(e,t)=>this._d.getData().getCellValue(e,t)}}handleCellMouseDown(e,t,s){if(!this.isEnabled()||this._editorActive()||e<0||t<0)return;this._model.beginDrag(e,t,{additive:s.ctrlKey||s.metaKey,shift:s.shiftKey}),this._isDragging=!0,this._d.setFocusCell(e,t),this._d.doRender();const o=()=>{document.removeEventListener("mouseup",o),this.handleCellMouseUp(-1,-1,s)};document.addEventListener("mouseup",o)}handleCellMouseMove(e,t,s){this._isDragging&&(e>=0&&t>=0&&(this._model.updateFocus(e,t),this._d.doRender()),this._maybeAutoscroll(s))}handleCellMouseUp(e,t,s){this._isDragging&&(this._isDragging=!1,this._stopAutoscroll(),this._model.endDrag(),this._afterModelChange(!0))}handleClick(e,t,s){if(!this.isEnabled()||this._editorActive())return;s?this._model.shiftClickExtend(e,t):this._model.click(e,t);const o=this._model.getFocus();this._d.setFocusCell(o.ri,o.ci),this._afterModelChange(!0)}extendFocus(e){if(!this.isEnabled()||!this._model.hasSelection)return;this._model.extendFocus(e);const t=this._model.getFocus();this._d.setFocusCell(t.ri,t.ci),this._afterModelChange(!0)}clear(){this._model.hasSelection&&(this._model.clear(),this._afterModelChange(!0))}clearRangeSelection(){this.clear()}setRangeSelection(e){const t=Array.isArray(e)?e[0]:e;if(!t){this.clear();return}this._model.setRect(t);const s=this._model.getFocus();this._d.setFocusCell(s.ri,s.ci),this._afterModelChange(!0)}reproject(){var t,s;if(!this._model.hasSelection)return;this._model.reproject();const e=this._model.getActiveRange();this._d.emit("rangeChange",{range:e}),(s=(t=this._d.getOptions()).onRangeChange)==null||s.call(t,{range:e})}_afterModelChange(e){var i,n;if(this._d.doRender(),!e)return;const t=this._model.getRangeSelection(),s=this._model.getActiveRange(),o=this._d.getOptions();this._d.emit("selectionChange",{rows:[],rowIndexes:[],cells:t}),(i=o.onSelectionChange)==null||i.call(o,{rows:[],rowIndexes:[],cells:t}),this._d.emit("rangeChange",{range:s}),(n=o.onRangeChange)==null||n.call(o,{range:s}),this._announceSelection()}_announceSelection(){const e=this.getActiveRange();if(!e)return;const t=e.endRow-e.startRow+1,s=e.endCol-e.startCol+1;this._d.announce(`${e.startRow+1}행 ${e.startCol+1}열 ~ ${e.endRow+1}행 ${e.endCol+1}열, ${t*s}개 셀 선택`)}ctrlFill(e){if(!this.isEnabled())return;const t=this.getActiveRange();if(!t)return;const s=Eo(t,e);s&&this._commitFill(s.source,s.target,e,"copy")}fillRange(e,t,s="copy"){let o;t.startRow<e.startRow?o="up":t.endRow>e.endRow?o="down":t.startCol<e.startCol?o="left":o="right",this._commitFill(e,t,o,s)}_isEditable(e,t){const s=this._d.getColLayout().getColumnByField(t);if(!s||s.editable===!1)return!1;const o=this._d.getOptions();if(typeof s.editable=="function"){const i=this._d.getFlatModel().flatIndexOfRowId(e),n=i>=0?this._d.getData().getRowByIndex(i):void 0;return n?!!s.editable(n,i):!1}return s.editable!==void 0?!0:!!o.editable}_commitFill(e,t,s,o){var p,f,w,m;const i=this._rangeOpts(),n=i.seriesFill?o:"copy",a={resolveFlatRow:_=>this._d.getFlatModel().resolveFlatRow(_),fieldAt:_=>{var y;return(y=this._d.getColLayout().visibleLeaves[_])==null?void 0:y.field},getCellValue:(_,y)=>this._d.getData().getCellValue(_,y),isEditable:(_,y)=>this._isEditable(_,y),hasCellFormula:(_,y)=>{var M,k;return((k=(M=this._d).hasCellFormula)==null?void 0:k.call(M,_,y))??!1},offsetFormula:(_,y,M,k)=>{var b,x;return((x=(b=this._d).offsetFormula)==null?void 0:x.call(b,_,y,M,k))??""},overwriteFormula:i.fillOverwriteFormula},l=ko(e,t,s,n,a),d=[],c=[],h=[];for(const _ of l.items)if(_.action==="value"){const y=this._d.getData().getCellValue(_.rowIndex,_.field);d.push({rowIndex:_.rowIndex,field:_.field,oldValue:y,newValue:_.value}),c.push({rowIndex:_.rowIndex,field:_.field,value:_.value})}else if(_.action==="setFormula"&&_.formula!=null){const y=this._d.getFlatModel().resolveFlatRow(_.rowIndex);y.kind==="data"&&y.rowId&&(h.push({rowId:y.rowId,field:_.field,formula:_.formula}),d.push({rowIndex:_.rowIndex,field:_.field,oldValue:this._d.getData().getCellValue(_.rowIndex,_.field),newValue:_.formula}))}const u={source:e,target:t,mode:n,written:d,skippedFormula:l.skippedFormula,cancel:!1};if(this._d.emit("rangeFill",u),(f=(p=this._d.getOptions()).onRangeFill)==null||f.call(p,u),u.cancel)return;c.length&&this._d.writeCells(c);for(const _ of h)(m=(w=this._d).setCellFormulaByRowId)==null||m.call(w,_.rowId,_.field,_.formula);l.skippedFormula>0&&this._d.announce(`수식 셀 ${l.skippedFormula}개 보존`);const g=l.items.filter(_=>_.action==="skip"&&_.reason!=="formula-preserved").length;g>0&&this._d.announce(`채우기 대상이 아닌 셀 ${g}개를 건너뛰었습니다`)}copyText(){var o,i;const e=this.getActiveRange();if(!e)return null;const s=Fo(e,{fieldAt:n=>{var a;return(a=this._d.getColLayout().visibleLeaves[n])==null?void 0:a.field},getCellValue:(n,a)=>this._d.getData().getCellValue(n,a),getDisplayText:(n,a)=>this._d.getDisplayValue(n,a)});return this._d.emit("rangeCopy",{range:e,text:s}),(i=(o=this._d.getOptions()).onRangeCopy)==null||i.call(o,{range:e,text:s}),s}pasteText(e){const t=this.getActiveRange();if(!t)return!1;const s=So(e),n=Lo(s,t,{resolveFlatRow:a=>this._d.getFlatModel().resolveFlatRow(a),fieldAt:a=>{var l;return(l=this._d.getColLayout().visibleLeaves[a])==null?void 0:l.field},isEditable:(a,l)=>this._isEditable(a,l)}).filter(a=>a.action==="value").map(a=>({rowIndex:a.rowIndex,field:a.field,value:a.value}));return this._d.writeCells(n),!0}_maybeAutoscroll(e){const t=this._d.getRenderer();if(!t)return;const o=t.bodyWrapper.getBoundingClientRect(),i=this._rangeOpts().autoScrollEdge;let n=0,a=0;const l=e.clientY-o.top,d=o.bottom-e.clientY,c=e.clientX-o.left,h=o.right-e.clientX;if(l<i?a=-this._scrollSpeed(i-l):d<i&&(a=this._scrollSpeed(i-d)),c<i?n=-this._scrollSpeed(i-c):h<i&&(n=this._scrollSpeed(i-h)),n===0&&a===0){this._stopAutoscroll();return}this._autoScrollVX=n,this._autoScrollVY=a,this._autoScrollRAF==null&&this._runAutoscroll()}_scrollSpeed(e){return Math.max(2,Math.min(20,e))}_runAutoscroll(){const e=this._d.getRenderer();if(!e){this._autoScrollRAF=null;return}e.bodyWrapper.scrollTop+=this._autoScrollVY,e.bodyWrapper.scrollLeft+=this._autoScrollVX,this._autoScrollRAF=requestAnimationFrame(()=>this._runAutoscroll())}_stopAutoscroll(){this._autoScrollRAF!=null&&(cancelAnimationFrame(this._autoScrollRAF),this._autoScrollRAF=null),this._autoScrollVX=0,this._autoScrollVY=0}mount(e){if(this._mountedWrap===e)return;this._mountedWrap=e;const t=document.createElement("div");t.className="og-range-overlay",t.style.cssText="position:sticky;top:0;left:0;width:0;height:0;overflow:visible;pointer-events:none;z-index:6;";const s=document.createElement("div");s.className="og-range-border",s.style.cssText="position:absolute;box-sizing:border-box;border:2px solid var(--og-range-border,#1976d2);pointer-events:none;display:none;";const o=document.createElement("div");o.className="og-range-fill-preview",o.style.cssText="position:absolute;box-sizing:border-box;border:1px dashed var(--og-range-border,#1976d2);pointer-events:none;display:none;";const i=document.createElement("div");i.className="og-range-fill-handle",i.setAttribute("role","button"),i.setAttribute("aria-label","채우기 핸들"),i.style.cssText="position:absolute;display:none;pointer-events:auto;background-color:var(--og-fill-handle-bg,#1976d2);",i.addEventListener("pointerdown",n=>this._onHandlePointerDown(n)),t.appendChild(s),t.appendChild(o),t.appendChild(i),e.insertBefore(t,e.firstChild),e.addEventListener("scroll",()=>this.repaint(),{passive:!0}),this._overlayEl=t,this._borderEl=s,this._previewEl=o,this._handleEl=i}repaint(){if(!this._overlayEl)return;const e=this._d.getRenderer(),t=this.getActiveRange();if(!e||!t){this._hideOverlay();return}const s=e.bodyWrapper.getBoundingClientRect(),o=e.getCellEl(t.startRow,t.startCol),i=e.getCellEl(t.endRow,t.endCol);if(!o||!i){this._hideOverlay();return}const n=o.getBoundingClientRect(),a=i.getBoundingClientRect(),l=Math.min(n.left,a.left)-s.left,d=Math.min(n.top,a.top)-s.top,c=Math.max(n.right,a.right)-s.left,h=Math.max(n.bottom,a.bottom)-s.top;if(Object.assign(this._borderEl.style,{display:"block",left:`${l}px`,top:`${d}px`,width:`${Math.max(0,c-l)}px`,height:`${Math.max(0,h-d)}px`}),this._rangeOpts().fillHandle?Object.assign(this._handleEl.style,{display:"block",left:`${c}px`,top:`${h}px`}):this._handleEl.style.display="none",this._fillPreview){const u=this._fillPreview.target,g=e.getCellEl(u.startRow,u.startCol),p=e.getCellEl(u.endRow,u.endCol);if(g&&p){const f=g.getBoundingClientRect(),w=p.getBoundingClientRect(),m=Math.min(f.left,w.left)-s.left,_=Math.min(f.top,w.top)-s.top,y=Math.max(f.right,w.right)-s.left,M=Math.max(f.bottom,w.bottom)-s.top;Object.assign(this._previewEl.style,{display:"block",left:`${m}px`,top:`${_}px`,width:`${Math.max(0,y-m)}px`,height:`${Math.max(0,M-_)}px`});return}}this._previewEl.style.display="none"}_hideOverlay(){this._borderEl&&(this._borderEl.style.display="none"),this._handleEl&&(this._handleEl.style.display="none"),this._previewEl&&(this._previewEl.style.display="none")}getOverlayExtraOpts(){return{_rangeRects:this._model.getRangeSelection()}}_resolveCellAtPoint(e,t){const s=typeof document.elementFromPoint=="function"?document.elementFromPoint(e,t):null,o=s==null?void 0:s.closest(".og-cell"),i=o==null?void 0:o.closest(".og-row");if(!o||!i)return null;const n=o.getAttribute("aria-colindex"),a=i.getAttribute("aria-rowindex");return n==null||a==null?null:{ri:Number(a)-1,ci:Number(n)-1}}_onHandlePointerDown(e){var i;const t=this.getActiveRange();if(!t)return;e.stopPropagation(),e.preventDefault(),this._handlePointerId=e.pointerId;try{(i=this._handleEl)==null||i.setPointerCapture(e.pointerId)}catch{}this._fillDragSource=t,this._fillDragStart={x:e.clientX,y:e.clientY};const s=n=>this._onHandlePointerMove(n),o=n=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",o),this._onHandlePointerUp(n)};document.addEventListener("pointermove",s),document.addEventListener("pointerup",o)}_onHandlePointerMove(e){const t=this._fillDragSource,s=this._fillDragStart;if(!t||!s)return;const o=this._resolveCellAtPoint(e.clientX,e.clientY);if(!o)return;const i=e.clientX-s.x,n=e.clientY-s.y,a=Math.abs(n)>=Math.abs(i);let l,d;if(a)if(o.ri>t.endRow)l="down",d={startRow:t.endRow+1,endRow:o.ri,startCol:t.startCol,endCol:t.endCol};else if(o.ri<t.startRow)l="up",d={startRow:o.ri,endRow:t.startRow-1,startCol:t.startCol,endCol:t.endCol};else{this._fillPreview=null,this.repaint();return}else if(o.ci>t.endCol)l="right",d={startRow:t.startRow,endRow:t.endRow,startCol:t.endCol+1,endCol:o.ci};else if(o.ci<t.startCol)l="left",d={startRow:t.startRow,endRow:t.endRow,startCol:o.ci,endCol:t.startCol-1};else{this._fillPreview=null,this.repaint();return}const h=this._rangeOpts().seriesFill?"series":"copy",g=e.ctrlKey||e.metaKey?h==="series"?"copy":"series":h;this._fillPreview={source:t,target:d,axis:l,mode:g},this.repaint()}_onHandlePointerUp(e){const t=this._fillPreview;this._fillDragSource=null,this._fillDragStart=null,this._fillPreview=null,this._handlePointerId=null,t&&this._commitFill(t.source,t.target,t.axis,t.mode),this.repaint()}}class To{constructor(e){this._groupFields=[],this._groupExpandedKeys=new Set,this._groupFlatRows=[],this._isGroupMode=!1,this._treeRoots=[],this._treeFlatRows=[],this._treeExpandedKeys=new Set,this._isTreeMode=!1,this._d=e}get isGroupMode(){return this._isGroupMode}get isTreeMode(){return this._isTreeMode}get groupFlatRows(){return this._groupFlatRows}get treeFlatRows(){return this._treeFlatRows}groupBy(e){this._groupFields=e,this._groupExpandedKeys.clear(),this._isGroupMode=e.length>0,this.rebuildGroups()}clearGroup(){var e;this._groupFields=[],this._groupExpandedKeys.clear(),this._isGroupMode=!1,this._groupFlatRows=[],this._d.setFlatBacking(null),(e=this._d.getVs())==null||e.setTotalRows(this._d.getFlatCount()),this._d.doRender()}expandAll(){if(!this._isGroupMode)return;const e=At(this._d.getData(),this._groupFields,this._getSummaryDefs(),void 0,void 0,this._groupKeyFn());ls(e).forEach(t=>this._groupExpandedKeys.add(t)),this.rebuildGroups()}_groupKeyFn(){return this._d.getStrategy?this._d.getStrategy("groupKeyFn",void 0):void 0}collapseAll(){this._groupExpandedKeys.clear(),this._isGroupMode&&this.rebuildGroups()}handleGroupToggle(e){this._groupExpandedKeys.has(e)?this._groupExpandedKeys.delete(e):this._groupExpandedKeys.add(e),this.rebuildGroups()}rebuildGroups(){var n;const e=this._d.getData(),t=this._d.getDataLayer(),s=a=>{const l=e.indexOf(a);return l>=0?t.getRowState(l):"none"},o=At(e,this._groupFields,this._getSummaryDefs(),this._groupExpandedKeys,s,this._groupKeyFn());this._groupFlatRows=as(o),this._d.setFlatBacking(()=>this._groupFlatRows);const i=this._d.getFlatCount();(n=this._d.getVs())==null||n.setTotalRows(i),this._d.doRenderFull(i)}enableTree(){this._isTreeMode=!0,this._isGroupMode=!1;const e=this._d.getOptions();if(e.expandOnLoad){const t=at(this._d.getData(),{idField:e.treeId,parentIdField:e.treeParentId});lt(t).forEach(s=>this._treeExpandedKeys.add(s))}this.rebuildTree()}disableTree(){var e;this._isTreeMode=!1,this._treeRoots=[],this._treeFlatRows=[],this._treeExpandedKeys.clear(),this._d.setFlatBacking(null),(e=this._d.getVs())==null||e.setTotalRows(this._d.getFlatCount()),this._d.doRender()}expandNodes(e,t=!0){const s=Array.isArray(e)?e:[e];for(const o of s)t?this._treeExpandedKeys.add(o):this._treeExpandedKeys.delete(o);this._isTreeMode&&this.rebuildTree()}expandAllNodes(){this._isTreeMode&&(lt(this._treeRoots).forEach(e=>this._treeExpandedKeys.add(e)),this.rebuildTree())}collapseAllNodes(){this._isTreeMode&&(this._treeExpandedKeys.clear(),this.rebuildTree())}handleTreeToggle(e){$i(this._treeExpandedKeys,e),this.rebuildTree()}rebuildTree(){var s;const e=this._d.getOptions();this._treeRoots=at(this._d.getData(),{idField:e.treeId,parentIdField:e.treeParentId,expandOnLoad:e.expandOnLoad},this._treeExpandedKeys),this._treeFlatRows=cs(this._treeRoots),this._d.setFlatBacking(()=>this._treeFlatRows);const t=this._d.getFlatCount();(s=this._d.getVs())==null||s.setTotalRows(t),this._d.doRenderFull(t)}_getSummaryDefs(){const e=this._d.getOptions().summary;if(!e)return[];if(e.rows&&e.rows.length>0)return e.fields.flatMap(s=>e.rows.map(o=>({field:s,op:o.op,format:o.format})));const t=Array.isArray(e.ops)?e.ops:e.ops?[e.ops]:["SUM"];return e.fields.map(s=>({field:s,op:t[0]??"SUM",format:e.format}))}}class Do{constructor(e={}){this._expanded=new Set,this._maxDepth=e.maxDepth??2,this._expandMultiple=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._maxDepth}get expandMultiple(){return this._expandMultiple}isExpanded(e){return this._expanded.has(e)}canExpand(){return this._depth<this._maxDepth}expand(e){return this._expanded.has(e)?!0:this.canExpand()?(this._expandMultiple||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,t,s,o){return{rowIndex:t,rowId:e,row:s,host:o}}}function $o(r){return!!r&&r._isGroup===!0}function Oo(r){return!!r&&r._isTree===!0}function zo(r){return!!r&&(r._isDetailHead===!0||r._isDetailFiller===!0)}function Ho(r){return!(r==null||zo(r)||$o(r))}function Bo(r){return Oo(r)?r.data:r}function Vo(r,e,t){if(t.getSlotCount){const i=Math.floor(t.getSlotCount(r,e));return Number.isFinite(i)&&i>0?i:1}const s=t.height??200,o=t.rowHeight>0?t.rowHeight:1;return Math.max(1,Math.ceil(s/o))}function Po(r,e){const t=[];if(e.expandedRowIds.size===0){for(const s of r)t.push(s);return t}for(const s of r){if(t.push(s),!Ho(s))continue;const o=Bo(s),i=o!=null?e.getRowId(o):null;if(i==null||!e.expandedRowIds.has(i))continue;const n=Vo(o,i,e),a={_isDetailHead:!0,_rowId:i,_masterFlatBase:s,_span:n};t.push(a);for(let l=1;l<n;l++)t.push({_isDetailFiller:!0,_rowId:i})}return t}class No{constructor(e){this.adapter=e,this._entries=new Map}get size(){return this._entries.size}has(e){return this._entries.has(e)}getOrCreate(e,t){const s=this._entries.get(e);if(s)return s.attached=!0,s;const o=t(),i=this.adapter.create(e,o),n={host:o,instance:i,attached:!0};return this._entries.set(e,n),n}reattach(e){const t=this._entries.get(e);return!t||t.attached?!1:(this.adapter.reattach(t.instance,t.host),t.attached=!0,!0)}detach(e){const t=this._entries.get(e);return!t||!t.attached?!1:(this.adapter.detach(t.instance,t.host),t.attached=!1,!0)}detachAll(){for(const e of this._entries.keys())this.detach(e)}remove(e,t={}){const s=this._entries.get(e);if(s){if(t.cache){s.attached&&this.adapter.detach(s.instance,s.host),s.attached=!1;return}this.adapter.destroy(s.instance,s.host),this._entries.delete(e)}}getInstance(e){var t;return(t=this._entries.get(e))==null?void 0:t.instance}getHost(e){var t;return(t=this._entries.get(e))==null?void 0:t.host}isAttached(e){var t;return((t=this._entries.get(e))==null?void 0:t.attached)===!0}isEditing(e,t){if(!t)return!1;const s=this._entries.get(e);return!!s&&t(s.instance)}destroyAll(){for(const e of this._entries.values())this.adapter.destroy(e.instance,e.host);this._entries.clear()}}let Ht=!1;class Wo{constructor(e){this._hosts=new Map,this._focusPendingRestore=null,this._d=e;const t=this._mdOpts();this._state=new Do({maxDepth:t.maxDepth??2,expandMultiple:t.expandMultiple??!0,depth:e.getDepth()});const s={create:(i,n)=>this._buildInstance(i,n),detach:(i,n)=>{n.remove()},reattach:()=>{},destroy:(i,n)=>{var a;try{(a=i==null?void 0:i.destroy)==null||a.call(i)}catch{}n.remove()}};this._cache=new No(s),e.getFlatModel().registerSplice(i=>this._splice(i)),t.heightMode==="auto"&&!Ht&&(Ht=!0,console.warn("[OpenGrid] masterDetail.heightMode:'auto' 는 Spike-B(가변높이 VirtualScroll) 통과 전까지 미공개 기능입니다. 'fixed' 로 동작합니다(11_design_F2_v2.md §2.2/C12.2)."))}_mdOpts(){var e;return((e=this._d.getOptions())==null?void 0:e.masterDetail)??{}}get enabled(){return this._mdOpts().enabled===!0}get isActive(){return this.enabled&&this._state.size>0}get maxDepth(){return this._state.maxDepth}_resolveRowId(e){if(typeof e=="number"){const t=this._d.getFlatModel().resolveFlatRow(e);return t.kind==="data"||t.kind==="tree"?t.rowId??null:null}return(e==null?void 0:e.id)??null}isExpandedId(e){return this._state.isExpanded(e)}isRowExpanded(e){const t=this._resolveRowId(e);return t!=null&&this._state.isExpanded(t)}expandRow(e){if(!this.enabled)return;const t=this._resolveRowId(e);if(t==null||this._state.isExpanded(t))return;if(!this._state.expand(t)){this._d.announce(`중첩 깊이 한계(${this._state.maxDepth})로 상세 패널을 열 수 없습니다.`);return}this._afterToggle(t,"expanded")}collapseRow(e){const t=this._resolveRowId(e);if(t==null||!this._state.isExpanded(t))return;const s=this._hosts.get(t);s&&document.activeElement&&s.contains(document.activeElement)&&(this._focusPendingRestore=t),this._state.collapse(t),this._releaseInstance(t),this._afterToggle(t,"collapsed")}toggleRow(e){const t=this._resolveRowId(e);t!=null&&(this._state.isExpanded(t)?this.collapseRow(e):this.expandRow(e))}collapseAllDetails(){const e=this._state.collapseAll();if(e.length!==0){for(const t of e)this._releaseInstance(t);this._rebuildAndRender();for(const t of e)this._d.emit("rowCollapse",{rowIndex:this._d.getFlatModel().flatIndexOfRowId(t),rowId:t,row:this._d.getRowById(t),host:null});this._d.announce("모든 상세 패널을 접었습니다.")}}getDetailInstance(e){const t=this._resolveRowId(e);if(t!=null)return this._cache.getInstance(t)}resyncPanelWidths(){this.isActive&&this._rebuildAndRender()}getPanelHost(e){let t=this._hosts.get(e);return t||(t=document.createElement("div"),t.className="og-detail-host",t.style.cssText="width:100%;height:100%;box-sizing:border-box;overflow:auto;",this._hosts.set(e,t)),this._cache.getOrCreate(e,()=>t),this._focusPendingRestore===e&&(this._focusPendingRestore=null),t}_buildInstance(e,t){const s=this._mdOpts(),o=this._d.getRowById(e),i=this._d.getDepth(),n={grid:this._d.getGridInstance(),rowId:e,depth:i,collapse:()=>this.collapseRow({id:e}),refresh:()=>{var a,l;try{(l=(a=this._cache.getInstance(e))==null?void 0:a.refresh)==null||l.call(a)}catch{}}};if(typeof s.renderer=="function"){const a=s.renderer(o,t,n);return a instanceof HTMLElement&&a!==t&&t.appendChild(a),{destroy:()=>{}}}if(s.subgridOptions){if(i+1>this._state.maxDepth)return this._d.announce(`중첩 깊이 한계(${this._state.maxDepth})로 서브 그리드를 생성하지 않습니다.`),{destroy:()=>{}};if(this._d.createSubgrid)return this._d.createSubgrid(t,s.subgridOptions,i+1)}return{destroy:()=>{}}}onBeforeTeardown(){for(const[e,t]of this._hosts)if(this._cache.isAttached(e)){if(this.isEditing(e)){document.body.appendChild(t);continue}this._cache.detach(e)}}isEditing(e){const t=this._cache.getInstance(e);return!!t&&typeof t.isEditing=="function"&&!!t.isEditing()}consumePendingFocusRestore(){const e=this._focusPendingRestore;return this._focusPendingRestore=null,e}_releaseInstance(e){const t=this._mdOpts();this._cache.remove(e,{cache:t.cache===!0}),t.cache!==!0&&this._hosts.delete(e)}_splice(e){var i;if(!this.isActive)return e;const t=this._mdOpts(),s=((i=this._d.getOptions())==null?void 0:i.rowHeight)??32,o={expandedRowIds:this._state.expandedRowIds,getRowId:n=>this._d.getRowId(n),rowHeight:s,height:t.height??200};if(typeof t.detailRowCount=="number"){const n=t.detailRowCount;o.getSlotCount=()=>n}return Po(e,o)}_afterToggle(e,t){this._rebuildAndRender();const o=this._d.getFlatModel().flatIndexOfRowId(e),i=t==="expanded"?this._hosts.get(e)??null:null,n={rowIndex:o,rowId:e,row:this._d.getRowById(e),host:i};this._d.emit(t==="expanded"?"rowExpand":"rowCollapse",n),this._d.announce(t==="expanded"?"행 상세 패널을 펼쳤습니다.":"행 상세 패널을 접었습니다.")}_rebuildAndRender(){var t;const e=this._d.getFlatModel().count();(t=this._d.getVs())==null||t.setTotalRows(e),this._d.doRenderFull(e)}destroy(){this._cache.destroyAll(),this._hosts.clear()}}function Ko(r,e){return r==null||Number.isNaN(r)?"":e?e(r,{axis:"tooltip"}):String(r)}function vs(r,e={}){const{categories:t,series:s}=r,o=["category",...s.map(l=>l.name)],i=t.map((l,d)=>[l,...s.map(c=>Ko(c.data[d]??null,e.numberFormat))]),n=s.map(l=>l.name).join(", ");return{caption:e.title?`${e.title}: 카테고리 ${t.length}개, 시리즈 ${n||"없음"}`:`카테고리 ${t.length}개, 시리즈 ${n||"없음"}`,colHeaders:o,rows:i}}const Uo=.8,qo=50;function bs(r){if(r==null||r==="")return null;if(typeof r=="number")return Number.isFinite(r)?r:null;const e=Number(r);return Number.isFinite(e)?e:null}function Bt(r,e,t){if((r==null?void 0:r.type)==="number")return!0;if(r!=null&&r.type)return!1;let s=0,o=0;for(const i of e){if(s>=qo)break;const n=i[t];n==null||n===""||(s++,bs(n)!==null&&o++)}return s===0?!1:o/s>=Uo}function jo(r){return typeof r=="string"?r:r.field}function Go(r,e){return typeof r=="string"?e:r.name??e}function Yo(r,e){let t=null;for(const o of e)if(!Bt(o,r,o.field)){t=o;break}const s=e.filter(o=>o!==t&&Bt(o,r,o.field));return{categoryField:(t==null?void 0:t.field)??null,seriesCols:s}}function Xo(r,e,t){if(typeof t=="function")return t(r,e);if(!r.length)return 0;switch(t){case"sum":return v.sum(r).toNumber();case"avg":return v.avg(r).toNumber();case"min":return v.min(r).toNumber();case"max":return v.max(r).toNumber();case"count":return r.length;default:return v.sum(r).toNumber()}}function Zo(r,e){var t;switch(r.kind){case"all":case"columns":return{rows:e.getAllRows(),effectiveKind:r.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 s=r.range??((t=e.getActiveRange)==null?void 0:t.call(e))??null;return!s||!e.getRangeRows?{rows:e.getSelectedRows(),effectiveKind:"selection",rangeFallback:!0}:{rows:e.getRangeRows(s),effectiveKind:"range",rangeFallback:!1}}}}function Jo(r,e,t){return r.kind==="range"&&e==="range"&&r.range&&t.getRangeColumns?t.getRangeColumns(r.range):t.getVisibleColumns()}function Qo(r,e,t={}){const{rows:s,effectiveKind:o,rangeFallback:i}=Zo(r,e),n=Jo(r,o,e);let a=null,l;if(r.kind==="columns")a=t.category??r.category??null,l=t.series??r.series;else if(t.series)a=t.category??null,l=t.series;else{const _=Yo(s,n);a=t.category??_.categoryField,l=_.seriesCols.map(y=>y.field)}const d=new Map(n.map(_=>[_.field,_])),c=a?s.map(_=>String(_[a]??"")):s.map((_,y)=>String(y+1)),h=l.map(_=>{const y=jo(_),M=d.get(y),k=Go(_,(M==null?void 0:M.header)??y),b=s.map(B=>bs(B[y])),x=typeof _=="string"?void 0:_.pattern,E=typeof _=="string"?void 0:_.color,L={name:k,data:b};return x&&(L.pattern=x),E&&(L.color=E),L}),u=s.length;let g=c,p=h,f,w=!1;if(t.aggregate&&c.length>0){const _=[],y=new Map;for(let M=0;M<c.length;M++){const k=c[M];y.has(k)?y.get(k).push(M):(y.set(k,[M]),_.push(k))}_.length<c.length&&(g=_,p=h.map(M=>({...M,data:_.map(k=>{const x=y.get(k).map(E=>M.data[E]).filter(E=>E!==null);return x.length?Xo(x,k,t.aggregate):null})})),f=typeof t.aggregate=="function"?"custom":t.aggregate,w=!0)}const m={categories:g,series:p,meta:{sourceKind:o,total:u,sampled:w,a11yTable:vs({categories:g,series:p},{title:t.title,numberFormat:t.numberFormat})}};return f&&(m.meta.aggregatedOp=f),{model:m,rangeFallback:i}}function en(r){return r==="line"||r==="area"}function ft(r){return r==null||Number.isNaN(r)?null:r}function Vt(r){let e=-1,t=-1,s=1/0,o=-1/0;for(let n=0;n<r.length;n++){const a=ft(r[n]);a!=null&&(a<s&&(s=a,e=n),a>o&&(o=a,t=n))}const i=[];return e>=0&&i.push(e),t>=0&&i.push(t),i}function tn(r,e){const t=r.length;if(e>=t||e<=2)return Array.from({length:t},(a,l)=>l);const s=a=>ft(r[a])??0,o=[0],i=(t-2)/(e-2);let n=0;for(let a=0;a<e-2;a++){let l=0,d=0;const c=Math.floor((a+1)*i)+1;let h=Math.floor((a+2)*i)+1;h=Math.min(h,t);const u=h-c;for(let y=c;y<h;y++)l+=y,d+=s(y);u>0&&(l/=u,d/=u);const g=Math.floor(a*i)+1,p=Math.floor((a+1)*i)+1,f=n,w=s(n);let m=-1,_=g;for(let y=g;y<p&&y<t;y++){const M=Math.abs((f-l)*(s(y)-w)-(f-y)*(d-w))*.5;M>m&&(m=M,_=y)}o.push(_),n=_}return o.push(t-1),o}function sn(r,e,t,s={}){var l;const o=r.categories.length;if(!Number.isFinite(e)||e<=0||o<=e)return{model:r,sampled:!1};let i,n;if(en(t)){const d=((l=r.series[0])==null?void 0:l.data)??new Array(o).fill(0),c=new Set([0,o-1]);for(const p of r.series)for(const f of Vt(p.data))c.add(f);const h=new Set(c),u=tn(d,e);for(const p of u){if(h.size>=e)break;h.add(p)}let g=[...h].sort((p,f)=>p-f);if(g.length>e){const p=new Set([0,o-1]),f=r.series.map(m=>Vt(m.data));let w=!0;for(;w&&p.size<e;){w=!1;for(const m of f){if(p.size>=e)break;const _=m.find(y=>!p.has(y));_!==void 0&&(p.add(_),w=!0)}}g=[...p].sort((m,_)=>m-_).slice(0,e)}i=g.map(p=>r.categories[p]),n=r.series.map(p=>({...p,data:g.map(f=>p.data[f])}))}else{const d=e,c=o/d;i=[];const h=[];for(let u=0;u<d;u++){const g=Math.floor(u*c),p=Math.min(Math.floor((u+1)*c),o);if(g>=p)continue;h.push([g,p]);const f=r.categories[g],w=r.categories[p-1];i.push(p-g>1?`${f}…${w}`:f)}n=r.series.map(u=>({...u,data:h.map(([g,p])=>{let f=0,w=!1;for(let m=g;m<p;m++){const _=ft(u.data[m]);_!=null&&(f+=_,w=!0)}return w?f:null})}))}return{model:{categories:i,series:n,meta:{...r.meta,sampled:!0,sampledFrom:o,sampledTo:i.length,a11yTable:vs({categories:i,series:n},{title:s.title,numberFormat:s.numberFormat})}},sampled:!0}}const xs=["#0072B2","#E69F00","#009E73","#CC79A7","#F0E442","#56B4E9","#D55E00","#999999"],Pt=["solid","hatch","dot","cross"];function Qe(r){return Math.min(255,Math.max(0,r))}function ct(r){const e=r.trim(),t=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(t)return{r:Qe(+t[1]),g:Qe(+t[2]),b:Qe(+t[3])};const s=e.replace("#","");return/^[0-9a-f]{3}$/i.test(s)?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16)}:/^[0-9a-f]{6}$/i.test(s)?{r:parseInt(s.slice(0,2),16),g:parseInt(s.slice(2,4),16),b:parseInt(s.slice(4,6),16)}:null}function et(r){const e=r/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Nt(r){return .2126*et(r.r)+.7152*et(r.g)+.0722*et(r.b)}function on(r,e){const t=ct(r),s=ct(e);if(!t||!s)return 1;const o=Nt(t),i=Nt(s),[n,a]=o>=i?[o,i]:[i,o];return(n+.05)/(a+.05)}function nn(r,e={}){var s;const t=(e.palette&&e.palette.length?e.palette:xs).slice();return!((s=e.palette)!=null&&s.length)&&e.primary&&ct(e.primary)&&(t.length<2||on(e.primary,t[1])>=3)&&(t[0]=e.primary),r.map((o,i)=>({color:o.color??t[i%t.length],pattern:o.pattern??Pt[i%Pt.length]}))}function Wt(r,e){if(r===0)return 0;const t=Math.abs(r),s=Math.floor(Math.log10(t)),o=t/Math.pow(10,s);let i;return e?o<1.5?i=1:o<3?i=2:o<7?i=5:i=10:o<=1?i=1:o<=2?i=2:o<=5?i=5:i=10,i*Math.pow(10,s)}function tt(r,e){const t=Math.max(0,-Math.floor(Math.log10(e))+6),s=Math.pow(10,t),o=Math.round(r*s)/s;return o===0?0:o}function Kt(r,e,t=6){let s=r,o=e;if(s>o&&([s,o]=[o,s]),s===o)if(s===0)s=-1,o=1;else{const u=Math.abs(s)*.5;s-=u,o+=u}const i=Math.max(2,t),n=Wt(o-s,!1),a=Wt(n/(i-1),!0),l=tt(Math.floor(s/a)*a,a),d=tt(Math.ceil(o/a)*a,a),c=[],h=Math.round((d-l)/a)+1;for(let u=0;u<h;u++)c.push(tt(l+u*a,a));return{min:l,max:d,step:a,ticks:c}}function rn(r,e,t){for(const s of r){const o=Math.min(s.x,s.x+s.w),i=Math.max(s.x,s.x+s.w),n=Math.min(s.y,s.y+s.h),a=Math.max(s.y,s.y+s.h);if(e>=o&&e<=i&&t>=n&&t<=a)return s}return null}function an(r,e,t){if(!r.length)return null;let s=-1,o=1/0;for(const a of r){const l=Math.abs(a.cx-e);l<o&&(o=l,s=a.categoryIndex)}let i=null,n=1/0;for(const a of r){if(a.categoryIndex!==s)continue;const l=Math.abs(a.cy-t);l<n&&(n=l,i=a)}return i}function Ut(r,e,t,s){return r.length?s==="line"||s==="area"?an(r,e,t):rn(r,e,t):null}const qt="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;",ke={top:26,right:14,bottom:34,left:52},Le=3.5;let ln=0;function st(r,e,t){return r==null||Number.isNaN(r)?"":e.numberFormat?e.numberFormat(r,{axis:t}):String(r)}class jt{constructor(){this.id="builtin-canvas",this._host=null,this._canvas=null,this._a11yTable=null,this._legend=null,this._tooltip=null,this._live=null,this._model=null,this._w=480,this._h=300,this._geoms=[],this._hidden=new Set,this._cursor={cat:0,series:0},this._onPoint=null,this._onMouseMove=e=>{if(this._spec.tooltip===!1)return;const{x:t,y:s}=this._localXY(e),o=Ut(this._geoms,t,s,this._spec.type);o?this._showTooltip(o,t,s):this._hideTooltip()},this._onMouseLeave=()=>this._hideTooltip(),this._onClick=e=>{const{x:t,y:s}=this._localXY(e),o=Ut(this._geoms,t,s,this._spec.type);o&&this._emitPoint(o)},this._onKeyDown=e=>{const t=this._model;if(!t)return;const s=t.categories.length,o=t.series.length;let i=!0;switch(e.key){case"ArrowRight":this._cursor.cat=Math.min(s-1,this._cursor.cat+1);break;case"ArrowLeft":this._cursor.cat=Math.max(0,this._cursor.cat-1);break;case"ArrowDown":this._cursor.series=Math.min(o-1,this._cursor.series+1);break;case"ArrowUp":this._cursor.series=Math.max(0,this._cursor.series-1);break;case"Enter":case" ":{const n=this._cursorPoint();n&&this._emitPoint(n);break}default:i=!1}i&&(e.preventDefault(),this._announceCursor())}}async init(e,t){this._host=e,this._spec=t,e.classList.add("og-chart"),getComputedStyle(e).position==="static"&&(e.style.position="relative");const s=document.createElement("canvas");s.className="og-chart-canvas",s.style.cssText="display:block;",s.setAttribute("role","img"),s.tabIndex=0,s.setAttribute("aria-label",t.title??"차트"),this._canvas=s;const o=document.createElement("table");o.className="og-chart-a11y",o.style.cssText=qt;const i=`og-chart-a11y-${++ln}`;o.id=i,s.setAttribute("aria-describedby",i),this._a11yTable=o;const n=document.createElement("div");n.className="og-chart-legend",n.style.cssText="display:flex;flex-wrap:wrap;gap:8px;margin-top:6px;",this._legend=n;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._tooltip=a;const l=document.createElement("div");l.className="og-chart-live",l.setAttribute("aria-live","polite"),l.style.cssText=qt,this._live=l,e.appendChild(s),e.appendChild(o),e.appendChild(n),e.appendChild(a),e.appendChild(l),s.addEventListener("mousemove",this._onMouseMove),s.addEventListener("mouseleave",this._onMouseLeave),s.addEventListener("click",this._onClick),s.addEventListener("keydown",this._onKeyDown)}render(e,t){var s;this._model=e,this._spec=t,this._cursor.cat=e.categories.length?Math.min(Math.max(this._cursor.cat,0),e.categories.length-1):0,this._cursor.series=e.series.length?Math.min(Math.max(this._cursor.series,0),e.series.length-1):0,this._canvas&&this._canvas.setAttribute("aria-label",((s=t.a11y)==null?void 0:s.caption)??t.title??"차트"),this._renderA11yTable(e,t),this._renderLegend(e,t),this._computeGeometry(e,t),this._paint(e,t),this._hideTooltip()}resize(e,t){this._w=Math.max(80,Math.floor(e)),this._h=Math.max(60,Math.floor(t)),this._model&&this.render(this._model,this._spec)}onPointClick(e){this._onPoint=e}destroy(){var t,s,o,i,n,a;const e=this._canvas;e&&(e.removeEventListener("mousemove",this._onMouseMove),e.removeEventListener("mouseleave",this._onMouseLeave),e.removeEventListener("click",this._onClick),e.removeEventListener("keydown",this._onKeyDown)),(t=this._a11yTable)==null||t.remove(),(s=this._canvas)==null||s.remove(),(o=this._legend)==null||o.remove(),(i=this._tooltip)==null||i.remove(),(n=this._live)==null||n.remove(),(a=this._host)==null||a.classList.remove("og-chart"),this._host=this._canvas=this._a11yTable=this._legend=this._tooltip=this._live=null,this._geoms=[],this._onPoint=null}getGeometry(){return this._geoms}_renderA11yTable(e,t){const s=this._a11yTable;if(!s)return;const o=e.meta.a11yTable;s.innerHTML="";const i=document.createElement("caption");i.textContent=o.caption,s.appendChild(i);const n=document.createElement("thead"),a=document.createElement("tr");for(const d of o.colHeaders){const c=document.createElement("th");c.scope="col",c.textContent=d,a.appendChild(c)}n.appendChild(a),s.appendChild(n);const l=document.createElement("tbody");for(const d of o.rows){const c=document.createElement("tr");d.forEach((h,u)=>{const g=document.createElement(u===0?"th":"td");u===0&&(g.scope="row"),g.textContent=h,c.appendChild(g)}),l.appendChild(c)}s.appendChild(l)}_renderLegend(e,t){const s=this._legend;if(!s)return;if(t.legend===!1){s.style.display="none";return}s.style.display="flex";const o=this._styles(e,t),i=Array.from(s.querySelectorAll("button.og-chart-legend-item"));if(i.length===e.series.length&&i.every((d,c)=>d.dataset.seriesName===e.series[c].name)){e.series.forEach((d,c)=>{const h=i[c],u=!this._hidden.has(c);this._updateLegendButton(h,e.series[c],o[c],u)});return}const a=document.activeElement,l=a instanceof HTMLButtonElement?i.indexOf(a):-1;if(s.innerHTML="",e.series.forEach((d,c)=>{const h=document.createElement("button");h.type="button",h.className="og-chart-legend-item",h.dataset.seriesName=d.name,h.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 g=document.createElement("span");h.appendChild(u),h.appendChild(g),this._updateLegendButton(h,d,o[c],!this._hidden.has(c)),h.addEventListener("click",()=>{const p=!this._hidden.has(c);p?this._hidden.add(c):this._hidden.delete(c),this._updateLegendButton(h,d,o[c],!p),this._computeGeometry(this._model,this._spec),this._paint(this._model,this._spec)}),s.appendChild(h)}),l>=0){const d=s.querySelectorAll("button.og-chart-legend-item"),c=d[l]??d[d.length-1];c==null||c.focus()}}_updateLegendButton(e,t,s,o){e.setAttribute("aria-pressed",String(o)),e.style.opacity=o?"1":"0.45";const i=e.querySelector("span[aria-hidden]");i&&(i.style.background=s.color);const n=e.querySelector("span:not([aria-hidden])");n&&(n.textContent=`${t.name} (${s.pattern})`)}_styles(e,t){var s,o;return nn(e.series.map(i=>({color:i.color,pattern:i.pattern})),{palette:t.palette??((s=t.theme)==null?void 0:s.palette),primary:(o=t.theme)==null?void 0:o.primary})}_plotRect(){return{x:ke.left,y:ke.top,w:Math.max(1,this._w-ke.left-ke.right),h:Math.max(1,this._h-ke.top-ke.bottom)}}_valueExtent(e){let t=1/0,s=-1/0;return e.series.forEach((o,i)=>{if(!this._hidden.has(i))for(const n of o.data)n==null||Number.isNaN(n)||(n<t&&(t=n),n>s&&(s=n))}),(!Number.isFinite(t)||!Number.isFinite(s))&&(t=0,s=1),(this._spec.type==="bar"||this._spec.type==="bar-stacked"||this._spec.type==="bar-grouped")&&(t=Math.min(0,t),s=Math.max(0,s)),{min:t,max:s}}_computeGeometry(e,t){const s=[],o=this._plotRect(),n=e.categories.length||1,{min:a,max:l}=this._valueExtent(e),d=Kt(a,l,6),c=f=>{const w=(f-d.min)/(d.max-d.min||1);return o.y+o.h-w*o.h},h=c(0<d.min?d.min:0>d.max?d.max:0),u=o.w/n,g=t.type==="line"||t.type==="area",p=e.series.map((f,w)=>({s:f,si:w})).filter(({si:f})=>!this._hidden.has(f));if(g)for(const{s:f,si:w}of p)f.data.forEach((m,_)=>{const y=o.x+u*_+u/2,M=m==null?NaN:c(m);Number.isNaN(M)||s.push({seriesIndex:w,categoryIndex:_,x:y-Le,y:M-Le,w:Le*2,h:Le*2,cx:y,cy:M})});else{const f=p.length||1,w=u*.72,m=w/f;p.forEach(({s:_,si:y},M)=>{_.data.forEach((k,b)=>{if(k==null||Number.isNaN(k))return;const E=o.x+u*b+(u-w)/2+m*M,L=c(k),B=Math.min(L,h),z=Math.abs(h-L);s.push({seriesIndex:y,categoryIndex:b,x:E,y:B,w:m,h:z,cx:E+m/2,cy:B+z/2})})})}this._geoms=s}_paint(e,t){const s=this._canvas;if(!s)return;const o=hn();s.width=Math.floor(this._w*o),s.height=Math.floor(this._h*o),s.style.width=`${this._w}px`,s.style.height=`${this._h}px`;const i=s.getContext?s.getContext("2d"):null;if(!i)return;i.setTransform(o,0,0,o,0,0),i.clearRect(0,0,this._w,this._h);const n=t.theme,a=this._plotRect(),{min:l,max:d}=this._valueExtent(e),c=Kt(l,d,6),h=f=>{const w=(f-c.min)/(c.max-c.min||1);return a.y+a.h-w*a.h};i.strokeStyle=(n==null?void 0:n.gridLine)||(n==null?void 0:n.border)||"#e0e0e0",i.fillStyle=(n==null?void 0:n.text)||"#212121",i.lineWidth=1,i.font=`${(n==null?void 0:n.fontSize)||12}px ${(n==null?void 0:n.fontFamily)||"sans-serif"}`,i.textAlign="right",i.textBaseline="middle";for(const f of c.ticks){const w=h(f);i.beginPath(),i.moveTo(a.x,w),i.lineTo(a.x+a.w,w),i.stroke(),i.fillText(st(f,t,"y"),a.x-6,w)}i.textAlign="center",i.textBaseline="top";const u=a.w/(e.categories.length||1);e.categories.forEach((f,w)=>{const m=a.x+u*w+u/2;i.fillText(String(f),m,a.y+a.h+6)});const g=this._styles(e,t);if(t.type==="line"||t.type==="area"){const f=new Map;for(const w of this._geoms){let m=f.get(w.seriesIndex);m||(m=[],f.set(w.seriesIndex,m)),m.push(w)}for(const[w,m]of f){m.sort((_,y)=>_.categoryIndex-y.categoryIndex),i.strokeStyle=g[w].color,i.lineWidth=2,i.setLineDash(dn(g[w].pattern)),i.beginPath(),m.forEach((_,y)=>y===0?i.moveTo(_.cx,_.cy):i.lineTo(_.cx,_.cy)),i.stroke(),i.setLineDash([]),i.fillStyle=g[w].color;for(const _ of m)i.beginPath(),i.arc(_.cx,_.cy,Le,0,Math.PI*2),i.fill()}}else for(const f of this._geoms)i.fillStyle=g[f.seriesIndex].color,i.fillRect(f.x,f.y,f.w,f.h),cn(i,f,g[f.seriesIndex].pattern)}_localXY(e){var i;const t=(i=this._canvas)==null?void 0:i.getBoundingClientRect();if(!t||t.width===0&&t.height===0)return{x:e.offsetX??0,y:e.offsetY??0};const s=t.width>0?this._w/t.width:1,o=t.height>0?this._h/t.height:1;return{x:(e.clientX-t.left)*s,y:(e.clientY-t.top)*o}}_cursorPoint(){return this._geoms.find(e=>e.categoryIndex===this._cursor.cat&&e.seriesIndex===this._cursor.series)??null}_announceCursor(){const e=this._model;if(!e)return;const t=e.series[this._cursor.series],s=e.categories[this._cursor.cat],o=(t==null?void 0:t.data[this._cursor.cat])??null,i=`${(t==null?void 0:t.name)??""}, ${s??""}: ${st(o,this._spec,"tooltip")||"없음"}`;this._live&&(this._live.textContent=i);const n=this._cursorPoint();n&&this._showTooltip(n,n.cx,n.cy)}_pointOf(e){var s,o;const t=this._model;return{seriesName:((s=t.series[e.seriesIndex])==null?void 0:s.name)??"",category:t.categories[e.categoryIndex]??"",value:((o=t.series[e.seriesIndex])==null?void 0:o.data[e.categoryIndex])??null,index:e.categoryIndex}}_emitPoint(e){var t;(t=this._onPoint)==null||t.call(this,this._pointOf(e))}_showTooltip(e,t,s){const o=this._tooltip;if(!o||this._spec.tooltip===!1)return;const i=this._pointOf(e);o.textContent=`${i.seriesName} · ${i.category}: ${st(i.value,this._spec,"tooltip")}`,o.style.display="block",o.style.left=`${t+10}px`,o.style.top=`${s+10}px`}_hideTooltip(){this._tooltip&&(this._tooltip.style.display="none")}}function dn(r){switch(r){case"hatch":return[6,3];case"dot":return[2,3];case"cross":return[8,3,2,3];default:return[]}}function cn(r,e,t){if(t==="solid"||!t)return;r.save(),r.beginPath(),r.rect(e.x,e.y,e.w,e.h),r.clip(),r.strokeStyle="rgba(255,255,255,0.55)",r.lineWidth=1;const s=5;if(t==="hatch"||t==="cross")for(let o=-e.h;o<e.w;o+=s)r.beginPath(),r.moveTo(e.x+o,e.y+e.h),r.lineTo(e.x+o+e.h,e.y),r.stroke();if(t==="cross")for(let o=0;o<e.w+e.h;o+=s)r.beginPath(),r.moveTo(e.x+o,e.y),r.lineTo(e.x+o-e.h,e.y+e.h),r.stroke();if(t==="dot"){r.fillStyle="rgba(255,255,255,0.6)";for(let o=e.y+s;o<e.y+e.h;o+=s)for(let i=e.x+s;i<e.x+e.w;i+=s)r.beginPath(),r.arc(i,o,1,0,Math.PI*2),r.fill()}r.restore()}function hn(){return typeof window<"u"&&window.devicePixelRatio?window.devicePixelRatio:1}const un=500,pn=50,gn=100,it={width:480,height:300};let fn=0;class _n{constructor(e){this._charts=new Map,this._d=e}createChart(e){var u;const t=`chart-${++fn}`,s=this._d.getContainer(),o=this._snapshotRange(e),{adapter:i,engineFallback:n}=this._resolveAdapter(e),{panel:a,host:l,badgeBox:d,backdrop:c}=this._buildPanel(e,s),h={id:t,config:e,adapter:i,panel:a,badgeBox:d,host:l,backdrop:c,model:null,spec:null,snapshot:o,liveHandler:null,debounceTimer:null,resizeObserver:null,resizeDebounceTimer:null,renderSize:{...it},localEvents:new Map,destroyed:!1,instance:null};try{this._charts.set(t,h);const{model:g,rangeFallback:p}=this._extract(h);h.model=g,h.spec=this._buildSpec(e,g),h.renderSize=this._resolveRenderSize(e,l),i.init(l,h.spec),i.resize(h.renderSize.width,h.renderSize.height),i.render(g,h.spec),(u=i.onPointClick)==null||u.call(i,w=>this._onPointClick(h,w)),this._renderBadges(h,p,n),e.live!==!1&&this._subscribeLive(h),this._attachResizeObserver(h);const f=this._makeInstance(h);return this._bindOptionCallbacks(h),this._emit(h,"chartCreate",f),this._d.emit("chartCreate",f),f}catch(g){try{this._destroy(h)}catch{}throw g}}_resolveRenderSize(e,t){var n;const s=e.size??it,o=t.clientWidth;return{width:((n=e.size)==null?void 0:n.width)??(o>0?o:s.width),height:s.height}}_attachResizeObserver(e){if(typeof ResizeObserver>"u")return;const t=gn,s=new ResizeObserver(()=>{e.destroyed||(clearTimeout(e.resizeDebounceTimer),e.resizeDebounceTimer=setTimeout(()=>{if(e.destroyed)return;const o=e.host.clientWidth;o>0&&o!==e.renderSize.width&&(e.renderSize={width:o,height:e.renderSize.height},e.adapter.resize(e.renderSize.width,e.renderSize.height))},t))});s.observe(e.host),e.resizeObserver=s}getCharts(){return[...this._charts.values()].filter(e=>!e.destroyed).map(e=>this._makeInstance(e))}destroyCharts(){for(const e of[...this._charts.values()])this._destroy(e)}_snapshotRange(e){var a,l;if(e.source.kind!=="range")return null;const t=e.source.range??((l=(a=this._d).getActiveRange)==null?void 0:l.call(a))??null;if(!t)return null;const s=this._d.getFlatModel(),o=this._d.getVisibleColumns(),i=[];for(let d=t.startRow;d<=t.endRow;d++){const c=s.rowIdOfFlat(d);c!=null&&i.push(c)}const n=[];for(let d=t.startCol;d<=t.endCol;d++){const c=o[d];c&&n.push(c.field)}return{rowIds:i,fields:n}}_extract(e){var d;const t=e.config,s=((d=this._d.getOptions())==null?void 0:d.chart)??{},o=t.numberFormat??s.numberFormat,i=this._extractDeps(e),n=Qo(t.source,i,{category:t.category,series:t.series??(t.source.kind==="columns"?t.source.series:void 0),aggregate:t.aggregate,title:t.title,numberFormat:o}),a=t.maxPoints??s.maxPoints??un;return{model:sn(n.model,a,t.type,{title:t.title,numberFormat:o}).model,rangeFallback:n.rangeFallback}}_extractDeps(e){const t=e.snapshot;return{getAllRows:()=>this._d.getAllRows(),getSelectedRows:()=>this._d.getSelectedRows(),getCheckedRows:()=>this._d.getCheckedRows(),getVisibleColumns:()=>this._d.getVisibleColumns(),getActiveRange:this._d.getActiveRange?()=>this._d.getActiveRange():void 0,getRangeRows:t?()=>t.rowIds.map(s=>this._d.getRowById(s)).filter(s=>!!s):void 0,getRangeColumns:t?()=>{const s=this._d.getVisibleColumns(),o=new Set(t.fields),i=s.filter(n=>o.has(n.field));return i.length?i:s}:void 0}}_buildSpec(e,t){var a;const s=((a=this._d.getOptions())==null?void 0:a.chart)??{},o=this._snapshotTheme(),i={type:e.type,theme:o,a11y:t.meta.a11yTable,palette:e.palette??s.palette??o.palette};e.title!==void 0&&(i.title=e.title),e.legend!==void 0&&(i.legend=e.legend),e.tooltip!==void 0&&(i.tooltip=e.tooltip),e.axis!==void 0&&(i.axis=e.axis);const n=e.numberFormat??s.numberFormat;return n&&(i.numberFormat=n),i}_readVar(e,t,s){return getComputedStyle(e).getPropertyValue(t).trim()||s}_snapshotTheme(){var n;const e=this._d.getContainer(),t=((n=this._d.getOptions())==null?void 0:n.chart)??{},s=this._readVar(e,"--og-primary","#1976d2"),o=this._readVar(e,"--og-font-size","13px"),i=parseInt(o,10)||13;return{primary:s,border:this._readVar(e,"--og-border-color","#e0e0e0"),text:this._readVar(e,"--og-row-color","#212121"),bg:this._readVar(e,"--og-row-bg","#ffffff"),gridLine:this._readVar(e,"--og-border-color","#e0e0e0"),fontFamily:getComputedStyle(e).fontFamily||"sans-serif",fontSize:i,palette:(t.palette&&t.palette.length?t.palette:xs).slice()}}_buildPanel(e,t){var u,g;const s=e.placement??((g=(u=this._d.getOptions())==null?void 0:u.chart)==null?void 0:g.placement)??"docked",o=e.size??it,i=document.createElement("div");i.className="og-chart-panel",i.setAttribute("data-placement",s),i.setAttribute("role","group"),i.setAttribute("aria-label",e.title??"차트");const n=document.createElement("div");n.className="og-chart-badges",n.style.cssText="display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px;";const a=document.createElement("div");a.className="og-chart-host",a.style.cssText=`position:relative;width:${o.width}px;max-width:100%;`;let l=null;const d=this._readVar(t,"--og-row-bg","#ffffff"),c=this._readVar(t,"--og-border-color","#e0e0e0"),h=`box-sizing:border-box;padding:10px;background:${d};border:1px solid ${c};border-radius:6px;`;return s==="modal"?(l=document.createElement("div"),l.className="og-chart-backdrop",l.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:1000;display:flex;align-items:center;justify-content:center;",i.style.cssText=h+"max-width:90vw;max-height:90vh;overflow:auto;box-shadow:0 8px 30px rgba(0,0,0,0.3);",l.appendChild(i),l.addEventListener("click",p=>{p.target===l&&this._destroyById(i)}),document.body.appendChild(l)):s==="inline"?(i.style.cssText=h+"width:100%;",(e.mount??t).appendChild(i)):s==="floating"?(i.style.cssText=h+"position:absolute;top:12px;right:12px;z-index:20;box-shadow:0 4px 16px rgba(0,0,0,0.18);",t.appendChild(i)):(i.style.cssText=h+"width:100%;margin-top:8px;",t.appendChild(i)),i.appendChild(n),i.appendChild(a),{panel:i,host:a,badgeBox:n,backdrop:l}}_renderBadges(e,t,s){var a;const o=e.badgeBox;o.innerHTML="";const i=e.model.meta,n=[];i.sampled&&i.sampledFrom&&n.push(`샘플링됨 ${(a=i.sampledTo)==null?void 0:a.toLocaleString()}/${i.sampledFrom.toLocaleString()}행`),i.aggregatedOp&&n.push(`category 집계됨 (${i.aggregatedOp})`),i.pieReducedToFirst&&n.push("파이: 첫 시리즈만 표시"),i.negativesAbsInPie&&n.push("음수→절대값 표시 · bar 권장"),t&&n.push("범위 소스 없음 · 선택 행으로 대체"),s&&n.push(`${s} 미설치 · 내장 차트로 대체`);for(const l of n){const d=document.createElement("span");d.className="og-chart-badge",d.style.cssText="display:inline-block;padding:2px 8px;font-size:11px;border-radius:10px;background:#fff3cd;color:#8a6d3b;border:1px solid #ffe08a;",d.textContent=l,o.appendChild(d)}o.style.display=n.length?"flex":"none",n.length&&this._d.announce(`차트 안내: ${n.join(", ")}`)}_subscribeLive(e){var i;const s=(((i=this._d.getOptions())==null?void 0:i.chart)??{}).debounceMs??pn,o=()=>{e.destroyed||(clearTimeout(e.debounceTimer),e.debounceTimer=setTimeout(()=>{e.destroyed||this._refresh(e)},s))};e.liveHandler=o,this._d.on("dataChange",o),this._d.on("formulaRecalc",o)}_refresh(e){if(e.destroyed)return;const{model:t,rangeFallback:s}=this._extract(e);e.model=t,e.spec=this._buildSpec(e.config,t),e.adapter.render(t,e.spec),this._renderBadges(e,s,null),this._emit(e,"chartRender",{id:e.id,model:t}),this._d.emit("chartRender",{id:e.id,model:t})}_resolveAdapter(e){var s,o;const t=e.engine??((o=(s=this._d.getOptions())==null?void 0:s.chart)==null?void 0:o.defaultEngine)??"builtin";return t&&typeof t=="object"?{adapter:t,engineFallback:null}:t==="chartjs"||t==="echarts"?{adapter:new jt,engineFallback:t}:{adapter:new jt,engineFallback:null}}_onPointClick(e,t){this._emit(e,"chartPointClick",{id:e.id,point:t}),this._d.emit("chartPointClick",{id:e.id,point:t})}_makeInstance(e){if(e.instance)return e.instance;const t={id:e.id,update:s=>{e.destroyed||(s&&(e.config={...e.config,...s}),s&&(s.source||s.category||s.series)&&(e.snapshot=this._snapshotRange(e.config)),this._refresh(e))},refresh:()=>this._refresh(e),setType:s=>{e.destroyed||(e.config={...e.config,type:s},this._refresh(e))},destroy:()=>this._destroy(e),toBlob:s=>e.adapter.toBlob?e.adapter.toBlob(s):Promise.resolve(null),getModel:()=>e.model,on:(s,o)=>this._on(e,s,o)};return e.instance=t,t}_bindOptionCallbacks(e){var o;const t=((o=this._d.getOptions())==null?void 0:o.chart)??{},s=this._makeInstance(e);typeof t.onChartCreate=="function"&&t.onChartCreate(s),typeof t.onChartRender=="function"&&this._on(e,"chartRender",t.onChartRender),typeof t.onChartPointClick=="function"&&this._on(e,"chartPointClick",t.onChartPointClick),typeof t.onChartDestroy=="function"&&this._on(e,"chartDestroy",t.onChartDestroy)}_on(e,t,s){const o=e.localEvents.get(t)??[];o.push(s),e.localEvents.set(t,o)}_emit(e,t,...s){for(const o of e.localEvents.get(t)??[])try{o(...s)}catch{}}_destroyById(e){for(const t of this._charts.values())if(t.panel===e){this._destroy(t);return}}_destroy(e){var t;if(!e.destroyed){e.destroyed=!0,e.liveHandler&&(this._d.off("dataChange",e.liveHandler),this._d.off("formulaRecalc",e.liveHandler)),clearTimeout(e.debounceTimer),clearTimeout(e.resizeDebounceTimer);try{(t=e.resizeObserver)==null||t.disconnect()}catch{}try{e.adapter.destroy()}catch{}(e.backdrop??e.panel).remove(),this._emit(e,"chartDestroy",{id:e.id}),this._d.emit("chartDestroy",{id:e.id}),e.localEvents.clear(),this._charts.delete(e.id)}}}class mn{constructor(e,t){this._originals=new Map,this._hadOwn=new Map,this._stack=new Map,this._strategies=new Map,this._callPath=[],this._host=e,this._strict=(t==null?void 0:t.strict)??!0,this._maxDepth=(t==null?void 0:t.maxDepth)??32}override(e,t,s={}){if(typeof t!="function")throw new TypeError(`OverrideKernel.override: fn for "${e}" must be a function`);if(!this._originals.has(e)){const i=this._host[e];if(typeof i!="function")throw new TypeError(`OverrideKernel.override: host["${e}"] is not a function`);this._hadOwn.set(e,Object.prototype.hasOwnProperty.call(this._host,e)),this._originals.set(e,i.bind(this._host))}const o=this._stack.get(e)??[];return o.push({fn:t,opts:s}),this._stack.set(e,o),this._host[e]=this._buildDispatcher(e),this._host}_buildDispatcher(e){var d;const t=this._originals.get(e),s=this._stack.get(e)??[],o=s.reduce((c,h)=>(...u)=>h.fn(c,...u),t),i=((d=s[s.length-1])==null?void 0:d.opts)??{},n=i.reentrant===!0,a=i.onError==="fallback",l=this;return function(...c){if(!n&&l._callPath.indexOf(e)!==-1)return t(...c);if(l._callPath.length>=l._maxDepth){if(l._strict&&!a)throw new Error(`OverrideKernel: max override depth (${l._maxDepth}) exceeded at "${e}"`);return t(...c)}l._callPath.push(e);try{return o(...c)}catch(h){if(a&&!l._strict)return console.warn(`[og.override:${e}]`,h),t(...c);if(a&&l._strict)return console.warn(`[og.override:${e}]`,h),t(...c);throw h}finally{l._callPath.pop()}}}strategy(e,t){if(typeof t!="function")throw new TypeError(`OverrideKernel.strategy: fn for "${e}" must be a function`);return this._strategies.set(e,t),this._host}getStrategy(e,t){return this._strategies.get(e)??t}hasStrategy(e){return this._strategies.has(e)}restore(e){return this._originals.has(e)?(this._hadOwn.get(e)?this._host[e]=this._originals.get(e):delete this._host[e],this._originals.delete(e),this._hadOwn.delete(e),this._stack.delete(e),this._host):this._host}restoreAll(){for(const e of[...this._originals.keys()])this.restore(e);return this._strategies.clear(),this._callPath=[],this._host}hasOverride(e){return this._originals.has(e)}getOverrideNames(){return[...this._originals.keys()]}}const ot="_ogRowId";class ye{static compose(e,t,s,o){const i=ye.buildCoreServices(e,t,s),n=ye.buildFormula(e,i),a=ye.buildManagers(e,i,n,o),l=ye.buildOverrideKernel(e,a);return{mounted:ye.mount(e,l)}}static buildCoreServices(e,t,s){const o=typeof t=="string"?document.querySelector(t):t;if(!o)throw new Error(`OpenGrid: container not found: ${t}`);return e._container=o,e._options={height:"100%",width:"100%",rowHeight:32,headerHeight:34,footerHeight:30,autoHeight:!1,fillWidth:!1,defaultColumnWidth:100,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 데이터 그리드",...s},e._data=new Li(ot),e._flatModel=new Oi({getDataLayer:()=>e._data,rowIdField:ot}),e._rowMgr=new zi(e._data),e._colLayout=new Jt(e._options.columns,e._options.frozenColumns),{_phase:"core"}}static buildFormula(e,t){var s,o;return e._formula=new Vi({getData:()=>e._data,getColLayout:()=>e._colLayout,getFlatModel:()=>e._flatModel,getRecalc:()=>e._recalc,getDirtySeeds:()=>e._formulaDirtySeeds,getOptions:()=>e._options,emit:(i,n)=>{e.emit(i,n)},announce:i=>e._announce(i),doRenderWindow:()=>e._doRender(...e._visRange())}),e._recalc=new fs({accessor:e._formula.buildAccessor(),setComputedValue:(i,n,a)=>e._data.setComputedValueByRowId(i,n,a),onFormulaError:(i,n,a)=>e._formula.handleFormulaError(i,n,a),refMode:((s=e._options.formula)==null?void 0:s.refMode)??"stable",divisionPrecision:((o=e._options.formula)==null?void 0:o.divisionPrecision)??30}),{_phase:"formula"}}static buildManagers(e,t,s,o){return e._editMgr=new co({data:e._data,colLayout:e._colLayout,getRenderer:()=>e._renderer,getContainer:()=>e._container,getOptions:()=>e._options,emit:(i,...n)=>e.emit(i,...n),doRender:()=>e._doRender(...e._visRange()),announce:i=>e._announce(i),writeCell:(i,n,a)=>e.writeCell(i,n,a),scrollToRow:i=>{var n;return(n=e._vs)==null?void 0:n.scrollToRow(i)},getVisibleLeaves:()=>e._colLayout.visibleLeaves,hasCellFormula:(i,n)=>e.hasCellFormula(i,n),getCellFormula:(i,n)=>e.getCellFormula(i,n),setCellFormula:(i,n,a)=>e.setCellFormula(i,n,a),clearCellFormula:(i,n)=>e.clearCellFormula(i,n)}),e._exportMgr=new ho({getData:()=>e._data.getData(),getColLayout:()=>e._colLayout,getColWidths:()=>e._colWidths,getOptions:()=>e._options,getContainer:()=>e._container,getMaskEnabled:i=>e.getMaskEnabled(i),getWsManager:()=>e._wsManager,getStrategy:(i,n)=>e._ovk.getStrategy(i,n)}),e._footerMgr=new uo({getData:()=>e._data.getData(),getColLayout:()=>e._colLayout,getColWidths:()=>e._colWidths,getOptions:()=>e._options,getContainer:()=>e._container,getStrategy:(i,n)=>e._ovk.getStrategy(i,n)}),e._kbdMgr=new po({getEditMgr:()=>e._editMgr,getRowMgr:()=>e._rowMgr,getData:()=>e._data,getColLayout:()=>e._colLayout,getOptions:()=>e._options,setFocusCell:(i,n)=>e._setFocusCell(i,n),handleRowDrop:(i,n)=>e._handleRowDrop(i,n),doRender:()=>e._doRender(...e._visRange()),announce:i=>e._announce(i),emit:(i,...n)=>e.emit(i,...n),visRange:()=>e._visRange(),handleCellKeyEvt:(i,n)=>e._handleCellKeyEvt(i,n),writeCells:i=>e.writeCells(i),getRangeHooks:()=>e._rangeMgr}),e._sfMgr=new go({getData:()=>e._data,getColLayout:()=>e._colLayout,getFindFilter:()=>e._findMgr.findFilter,getVs:()=>e._vs,getPagination:()=>e._pagination,getOptions:()=>e._options,renderHeader:()=>e._renderHeader(),doRender:()=>e._doRender(...e._visRange()),announce:i=>e._announce(i),emit:(i,...n)=>e.emit(i,...n),onReproject:()=>e._rangeMgr.reproject()}),e._findMgr=new fo({getColLayout:()=>e._colLayout,getData:()=>e._data,getFilters:()=>e._sfMgr.filters,getVs:()=>e._vs,getPagination:()=>e._pagination,doRender:()=>e._doRender(...e._visRange())}),e._cellEvt=new _o({getData:()=>e._data,getColLayout:()=>e._colLayout,getOptions:()=>e._options,getEditMgr:()=>e._editMgr,getRowMgr:()=>e._rowMgr,emit:(i,...n)=>e.emit(i,...n),writeCell:(i,n,a)=>e.writeCell(i,n,a),doRender:()=>e._doRender(...e._visRange()),getContainer:()=>e._container,onCellsClick:(i,n,a)=>e._rangeMgr.handleClick(i,n,a),rangeMouseDown:(i,n,a)=>e._rangeMgr.handleCellMouseDown(i,n,a),rangeMouseMove:(i,n,a)=>e._rangeMgr.handleCellMouseMove(i,n,a),rangeMouseUp:(i,n,a)=>e._rangeMgr.handleCellMouseUp(i,n,a)}),e._rangeMgr=new Ao({getOptions:()=>e._options,getData:()=>e._data,getColLayout:()=>e._colLayout,getFlatModel:()=>e._flatModel,getRenderer:()=>e._renderer,getEditMgr:()=>e._editMgr,setFocusCell:(i,n)=>e._setFocusCell(i,n),writeCells:i=>e.writeCells(i),getDisplayValue:(i,n)=>e.getDisplayValue(i,n),emit:(i,...n)=>e.emit(i,...n),doRender:()=>e._doRender(...e._visRange()),announce:i=>e._announce(i),hasCellFormula:(i,n)=>e._recalc.hasCellFormula(i,n),offsetFormula:(i,n,a,l)=>e._recalc.offsetFormula(i,n,a,l),setCellFormulaByRowId:(i,n,a)=>e._formula.setCellFormulaByRowId(i,n,a)}),e._grpMgr=new To({getData:()=>e._data.getData(),getDataLayer:()=>e._data,getOptions:()=>e._options,getVs:()=>e._vs,doRenderFull:i=>e._doRender(0,i-1),doRender:()=>e._doRender(...e._visRange()),getStrategy:(i,n)=>e._ovk.getStrategy(i,n),setFlatBacking:i=>e._flatModel.setBacking(i),getFlatCount:()=>e._flatModel.count()}),e._detailMgr=new Wo({getOptions:()=>e._options,getFlatModel:()=>e._flatModel,getVs:()=>e._vs,getRowId:i=>i[ot],getRowById:i=>e._data.getRowById(i),doRenderFull:i=>e._doRender(0,i-1),emit:(i,n)=>e.emit(i,n),announce:i=>e._announce(i),getDepth:()=>e._options._detailDepth??0,getGridInstance:()=>e,createSubgrid:(i,n,a)=>o.createSubgrid(i,n,a)}),e._chartMgr=new _n({getContainer:()=>e._container,getOptions:()=>e._options,getAllRows:()=>e._data.getData(),getSelectedRows:()=>e._rowMgr.getSelections(),getCheckedRows:()=>e._rowMgr.getChecked().map(i=>i.row),getVisibleColumns:()=>e._colLayout.visibleLeaves.map(i=>({field:i.field,header:i.header,type:i.type})),getFlatModel:()=>e._flatModel,getRowById:i=>e._data.getRowById(i),getActiveRange:()=>e._rangeMgr.getActiveRange(),on:(i,n)=>{e.on(i,n)},off:(i,n)=>{e.off(i,n)},emit:(i,...n)=>e.emit(i,...n),announce:i=>e._announce(i)}),{_phase:"managers"}}static buildOverrideKernel(e,t){if(e._ovk=new mn(e,{strict:e._options.overrideStrict??!0}),e._data.setStrategyResolver((s,o)=>e._ovk.getStrategy(s,o)),e._ovk==null)throw new Error("[OpenGrid] 초기화 순서 위반: OverrideKernel(_ovk)은 _mount() 이전에 생성돼야 합니다 — 매니저 strategy 슬롯(footer/group 등)이 초기 렌더에서 _ovk.getStrategy 를 참조합니다.");return{_phase:"ovk"}}static mount(e,t){return e._mount(),{_phase:"mounted"}}}class wn{constructor(e){this._batchDepth=0,this._batchDirty=!1,this._deps=e}commit(e){var i,n,a,l,d;if(e.coalescable&&this._batchDepth>0){this._batchDirty=!0;return}const t=this._deps.getData();e.totals==="count"?((i=this._deps.getVs())==null||i.setTotalRows(this._deps.getFlatModel().count()),(n=this._deps.getPagination())==null||n.setTotalRows(t.rowCount)):e.totals==="zero"&&((a=this._deps.getVs())==null||a.setTotalRows(0),(l=this._deps.getPagination())==null||l.setTotalRows(0)),(d=e.preRender)==null||d.call(e),e.flushFormula&&this._deps.flushFormula();const s=()=>{e.renderMode==="sync-window"?this._deps.doRenderWindow():e.renderMode==="full"&&this._deps.doRenderFull()},o=()=>{var c,h;this._deps.emit("dataChange",e.emitPayload()),e.fireOnDataChangeExplicitly&&((h=(c=this._deps.getOptions()).onDataChange)==null||h.call(c,e.emitPayload()))};e.emitBeforeRender?(o(),s()):(s(),o())}setData(e){var a;const t=this._deps.getTrigMgr(),s=t.mkCtx("setData",[e]);if(!t.exec("before:setData",s))return;this._deps.getRowMgr().reset();const o=this._deps.getData();o.setData(e),this._deps.resetFormulaState(),this._deps.applyFilters();const i=this._deps.getGrpMgr();i.isTreeMode?i.rebuildTree():i.isGroupMode?i.rebuildGroups():(a=this._deps.getVs())==null||a.setTotalRows(this._deps.getFlatModel().count());const n=this._deps.getContainer();n.setAttribute("aria-rowcount",String(o.rowCount)),n.setAttribute("aria-colcount",String(this._deps.getColLayout().visibleLeaves.length)),this._deps.announce(`${o.rowCount}행 데이터 로드됨`),this.commit({renderMode:"async-vs",emitPayload:()=>o.getData()}),s.result=e.length,t.exec("after:setData",s)}insertRow(e,t="last"){const s=this._deps.getTrigMgr(),o=s.mkCtx("insertRow",[e,t]);if(!s.exec("before:insertRow",o))return;const i=this._deps.getData(),n=t==="before"?0:t==="after"?i.rowCount:t;i.addRow(e,n);const a=i.rowCount;this.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>i.getData(),fireOnDataChangeExplicitly:!0}),o.result={rowCount:a,item:e},s.exec("after:insertRow",o)}pushRow(e){const t=Array.isArray(e)?e:[e],s=this._deps.getData();t.forEach(o=>s.addRow(o,"last")),this.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>s.getData(),fireOnDataChangeExplicitly:!0})}deleteRow(e){const t=this._deps.getTrigMgr(),s=this._deps.getData(),o=t.mkCtx("deleteRow",[e]),i=Array.isArray(e)?[...e]:[e];if(o.extra={rows:i.map(d=>s.getRowByIndex(d))},!t.exec("before:deleteRow",o))return;const n=i.sort((d,c)=>c-d),a=n.map(d=>this._deps.getRowIdAt(d)).filter(d=>d!=null);n.forEach(d=>s.removeRow(d));const l=s.rowCount;this.commit({totals:"count",renderMode:"sync-window",preRender:()=>this._deps.invalidateRemovedRows(a),emitPayload:()=>s.getData(),fireOnDataChangeExplicitly:!0}),o.result={deleted:n.length,rowCount:l},t.exec("after:deleteRow",o)}writeCell(e,t,s){var g,p;const o=this._deps.getData(),i=o.getCellValue(e,t),n=this._deps.getTrigMgr(),a=n.mkCtx("writeCell",[e,t,s]);if(a.extra={oldValue:i,rowIndex:e,field:t},!n.exec("before:writeCell",a))return;o.updateCell(e,t,s);const l=o.getRowByIndex(e),d=this._deps.getColLayout(),c=d.getColumnByField(t),h=d.getColumnIndex(t),u={type:"editEnd",rowIndex:e,columnIndex:h,field:t,oldValue:i,newValue:s,row:l,column:c};this._deps.emit("editEnd",u),(p=(g=this._deps.getOptions()).onEditEnd)==null||p.call(g,u),this._deps.seedFormulaDirty(e,t),this.commit({renderMode:"sync-window",flushFormula:!0,emitBeforeRender:!0,emitPayload:()=>o.getData(),fireOnDataChangeExplicitly:!0,coalescable:!0}),a.result={rowIndex:e,field:t,oldValue:i,newValue:s},n.exec("after:writeCell",a)}beginBatch(){this._batchDepth++}endBatch(){this._batchDepth!==0&&(this._batchDepth--,this._batchDepth===0&&this._batchDirty&&(this._batchDirty=!1,this.commit({renderMode:"sync-window",flushFormula:!0,emitBeforeRender:!0,emitPayload:()=>this._deps.getData().getData(),fireOnDataChangeExplicitly:!0})))}writeCells(e){this.beginBatch();let t=0;const s=this._deps.getFlatModel();for(const o of e){if(s.resolveFlatRow(o.rowIndex).kind!=="data"){t++;continue}this.writeCell(o.rowIndex,o.field,o.value)}return this.endBatch(),t>0&&(this._deps.announce(`쓰기 대상이 아닌 셀 ${t}개를 건너뛰었습니다`),this._deps.emit("writeCellsSkip",{skipped:t,total:e.length})),t}}const qe="";function Cs(r){const e=Object.entries(r).filter(([,t])=>t!==qe).map(([t,s])=>` ${JSON.stringify(t)}: src[${JSON.stringify(s)}],`);return`// crossGridMapping 옵션에 이 함수를 그대로 지정하세요.
|
|
74
|
-
function mapRow(src) {
|
|
75
|
-
return {
|
|
76
|
-
`+e.join(`
|
|
77
|
-
`)+(e.length?`
|
|
78
|
-
`:"")+` };
|
|
79
|
-
}`}function yn(r){return e=>{const t={};for(const[s,o]of Object.entries(r))o!==qe&&(t[s]=e[o]);return t}}function vn(r,e){if(r.length!==e.length)return!1;const t=new Set(e);return r.every(s=>t.has(s))}function bn(r,e){return new Promise(t=>{const s=new Set(r.map(b=>b.field)),o={};for(const b of e)o[b.field]=s.has(b.field)?b.field:qe;const i=document.createElement("div");i.className="og-mapper-overlay",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-label","그리드 필드 매핑"),i.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 n=document.createElement("div");n.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;",i.appendChild(n);const a=document.createElement("div");a.style.cssText="padding:18px 20px 8px;",a.innerHTML='<div style="font-size:16px;font-weight:700;">필드 매핑</div><div style="font-size:12.5px;color:#666;margin-top:4px;line-height:1.5;">두 그리드의 필드 구조가 다릅니다. <b>타깃 필드</b>마다 어떤 <b>소스 필드</b>의 값을 가져올지 지정하세요. 아래 스크립트를 복사해 <code>crossGridMapping</code> 에 baking 하면 다음부터는 이 창 없이 자동 변환됩니다.</div>',n.appendChild(a);const l=document.createElement("div");l.style.cssText="padding:6px 20px;";const d='<option value="">(비움)</option>'+r.map(b=>`<option value="${Ie(b.field)}">${Ie(b.header)} <${Ie(b.field)}></option>`).join("");for(const b of e){const x=document.createElement("div");x.style.cssText="display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid #f0f0f0;";const E=document.createElement("div");E.style.cssText="flex:1;font-size:13px;min-width:0;",E.innerHTML=`<span style="font-weight:600;">${Ie(b.header)}</span><span style="color:#999;font-size:11.5px;"> <${Ie(b.field)}></span>`;const L=document.createElement("span");L.textContent="←",L.style.cssText="color:#888;flex-shrink:0;";const B=document.createElement("select");B.style.cssText="flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;",B.innerHTML=d,B.value=o[b.field]??qe,B.addEventListener("change",()=>{o[b.field]=B.value,f()}),x.append(E,L,B),l.appendChild(x)}n.appendChild(l);const c=document.createElement("div");c.style.cssText="padding:10px 20px 4px;";const h=document.createElement("div");h.style.cssText="display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;",h.innerHTML='<span style="font-size:12.5px;font-weight:600;color:#444;">생성된 변환 스크립트</span>';const u=document.createElement("button");u.type="button",u.textContent="복사",u.style.cssText="font-size:12px;padding:4px 10px;border:1px solid #ccc;border-radius:6px;background:#f7f7f7;cursor:pointer;",h.appendChild(u);const g=document.createElement("pre");g.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;",c.append(h,g),n.appendChild(c);function p(){return Cs(o)}function f(){g.textContent=p()}f(),u.addEventListener("click",()=>{var x;const b=p();(x=navigator.clipboard)==null||x.writeText(b).then(()=>{u.textContent="복사됨!",setTimeout(()=>u.textContent="복사",1200)},()=>{u.textContent="복사 실패",setTimeout(()=>u.textContent="복사",1200)})});const w=document.createElement("div");w.style.cssText="display:flex;justify-content:flex-end;gap:8px;padding:14px 20px 18px;";const m=document.createElement("button");m.type="button",m.textContent="취소",m.style.cssText="font-size:13px;padding:8px 16px;border:1px solid #ccc;border-radius:7px;background:#fff;cursor:pointer;";const _=document.createElement("button");_.type="button",_.textContent="적용 후 이동",_.style.cssText="font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;",w.append(m,_),n.appendChild(w);let y=!1;function M(b){y||(y=!0,document.removeEventListener("keydown",k),i.remove(),t(b))}function k(b){b.key==="Escape"&&M(null)}m.addEventListener("click",()=>M(null)),i.addEventListener("mousedown",b=>{b.target===i&&M(null)}),_.addEventListener("click",()=>M({mapping:{...o},script:p()})),document.addEventListener("keydown",k),document.body.appendChild(i),_.focus()})}function Ie(r){return String(r).replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e])}class xn{constructor(){this._map=new Map}register(e,t){this._map.set(e,t)}unregister(e){this._map.delete(e)}get(e){return this._map.get(e)}get size(){return this._map.size}resolveAt(e,t,s){const o=document.elementFromPoint(e,t),i=o==null?void 0:o.closest(".og-body-wrapper");if(!i)return null;const n=this._map.get(i);return!n||n===s?null:n}}const We=new xn,Cn="_ogRowId";class Rn{constructor(e){this._deps=e}getSelf(){return this._deps.getSelf()}_rowCount(){return this._deps.getData().rowCount}_insertRow(e,t){this._deps.insertRow(e,t)}_visibleLeafInfos(){return this._deps.getColLayout().visibleLeaves.map(e=>({field:e.field,header:e.header}))}handleCrossGridDrop(e,t,s){const o=We.get(t);!o||o===this._deps.getSelf()||this.moveRowsTo(o,this._deps.dragRowSet(e),s)}async moveRowsTo(e,t,s){const o=this._deps.getSelf();if(!e||e===o||!t.length)return!1;const i=this._deps.getPeerController(e);if(!i)return!1;const n=[...new Set(t)].sort((h,u)=>h-u),a=s??i._rowCount();let l=n.map(h=>{const u={...this._deps.getData().getRowByIndex(h)};return delete u[Cn],u});const d=await this._resolveCrossTransform(i);if(d===!1)return!1;d&&(l=l.map(h=>d(h)));const c={sourceGrid:o,targetGrid:e,rows:l,sourceIndexes:n,targetIndex:a};return this.fireGridDropBefore(c)===!1||c.cancel||i.fireGridDropBefore(c)===!1||c.cancel?!1:(l.forEach((h,u)=>i._insertRow(h,a+u)),[...n].sort((h,u)=>u-h).forEach(h=>this._deps.deleteRow(h)),this.fireGridDropAfter(c),i.fireGridDropAfter(c),this.fireGridDropComplete(c),i.fireGridDropComplete(c),!0)}async moveCheckedTo(e){const t=this._deps.getChecked().map(s=>s.rowIndex);return t.length?(this._deps.uncheckAll(),this.moveRowsTo(e,t)):!1}async _resolveCrossTransform(e){var a,l;const t=this._deps.getOptions().crossGridMapping;if(typeof t=="function")return t;if(t!=="interactive")return null;const s=this._visibleLeafInfos(),o=e._visibleLeafInfos();if(vn(s.map(d=>d.field),o.map(d=>d.field)))return null;const i=await bn(s,o);if(!i)return!1;const n={sourceGrid:this._deps.getSelf(),targetGrid:e.getSelf(),mapping:i.mapping,script:i.script};return this._deps.emit("gridDropMapping",n),(l=(a=this._deps.getOptions()).onGridDropMapping)==null||l.call(a,n),console.log(`[OpenGrid] cross-grid mapping script:
|
|
80
|
-
`+Cs(i.mapping)),yn(i.mapping)}fireGridDropBefore(e){var t,s;return this._deps.emit("gridDropBefore",e),(s=(t=this._deps.getOptions()).onGridDropBefore)==null?void 0:s.call(t,e)}fireGridDropAfter(e){var t,s;this._deps.emit("gridDropAfter",e),(s=(t=this._deps.getOptions()).onGridDropAfter)==null||s.call(t,e)}fireGridDropComplete(e){var t,s;this._deps.emit("gridDropComplete",e),(s=(t=this._deps.getOptions()).onGridDropComplete)==null||s.call(t,e)}}const Mn="⊕",kn="⊖",En="상세 보기";function Fn(r){return{glyph:r?kn:Mn,ariaLabel:r?"상세 패널 접기":"상세 패널 펼치기",title:En}}class Sn{constructor(e,t,s,o,i){this._selects=new Map,this._selected={},this._config=t,this._onFilter=s,this._onReset=o,this._el=document.createElement("fieldset"),this._el.className="og-filter-select";const n=document.createElement("legend");n.className="og-filter-select-legend",n.textContent=t.legend??"필터",this._el.appendChild(n);const a=document.createElement("div");a.className="og-filter-select-row";for(const d of t.columns){const c=`og-fsel-${d.field}`,h=document.createElement("div");h.className="og-filter-select-group";const u=document.createElement("label");u.htmlFor=c,u.textContent=d.label,u.className="og-filter-select-label";const g=document.createElement("select");g.id=c,g.className="og-filter-select-sel",g.setAttribute("aria-label",d.label),i&&g.setAttribute("aria-controls",i),d.dependsOn?this._fill(g,[],!1):this._fill(g,this._resolve(d,""),!0),g.addEventListener("change",()=>this._onChange(d.field,g.value)),h.appendChild(u),h.appendChild(g),a.appendChild(h),this._selects.set(d.field,g)}const l=document.createElement("button");l.type="button",l.textContent="초기화",l.className="og-filter-select-reset",l.setAttribute("aria-label","필터 초기화"),l.addEventListener("click",()=>this._reset()),this._el.appendChild(a),this._el.appendChild(l),e.insertBefore(this._el,e.firstChild)}_resolve(e,t){if(e.options)return e.options;let s=e.data??[];e.dependsOn&&e.dependsOnKey&&t&&(s=s.filter(n=>String(n[e.dependsOnKey]??"")===t));const o=e.valueKey??"value",i=e.textKey??o;return s.map(n=>({value:String(n[o]??""),text:String(n[i]??n[o]??"")}))}_fill(e,t,s){e.innerHTML="";const o=document.createElement("option");o.value="",o.textContent="전체",e.appendChild(o);for(const i of t){const n=document.createElement("option");n.value=i.value,n.textContent=i.text,e.appendChild(n)}e.disabled=!s}_onChange(e,t){const s=this._config.columns.find(i=>i.field===e),o=s.filterKey??s.field;t?(this._selected[e]=t,this._onFilter(o,[{operator:"=",value:t}])):(delete this._selected[e],this._onReset(o)),this._cascade(e)}_cascade(e){const t=this._selected[e]??"";for(const s of this._config.columns){if(s.dependsOn!==e)continue;const o=this._selects.get(s.field);if(!o)continue;const i=s.filterKey??s.field;t?(this._fill(o,this._resolve(s,t),!0),o.value="",delete this._selected[s.field],this._onReset(i)):(this._fill(o,[],!1),delete this._selected[s.field],this._onReset(i),this._cascade(s.field))}}_reset(){this._selected={};for(const e of this._config.columns){const t=this._selects.get(e.field),s=e.filterKey??e.field;t&&(e.dependsOn?this._fill(t,[],!1):(t.value="",t.disabled=!1),this._onReset(s))}}reset(){this._reset()}destroy(){this._el.remove()}}class Ln{constructor(e,t,s){this._page=1,this._totalRows=0,this._pageSize=t,this._onChange=s,this._el=document.createElement("div"),this._el.className="og-pagination",this._el.style.cssText=`
|
|
81
|
-
display:flex;align-items:center;justify-content:center;gap:4px;
|
|
82
|
-
padding:6px 8px;border-top:1px solid var(--og-border-color,#e0e0e0);
|
|
83
|
-
background:var(--og-header-bg,#f5f5f5);flex-shrink:0;user-select:none;
|
|
84
|
-
font-size:12px;color:var(--og-text-color,#333);
|
|
85
|
-
`,e.appendChild(this._el),this._render()}get page(){return this._page}get pageSize(){return this._pageSize}get totalPages(){return Math.max(1,Math.ceil(this._totalRows/this._pageSize))}setTotalRows(e){this._totalRows=e,this._page>this.totalPages&&(this._page=this.totalPages),this._render()}setPageSize(e){this._pageSize=e,this._page=1,this._render(),this._emit()}goTo(e){const t=Math.max(1,Math.min(e,this.totalPages));t!==this._page&&(this._page=t,this._render(),this._emit())}getRange(){const e=(this._page-1)*this._pageSize,t=Math.min(e+this._pageSize-1,this._totalRows-1);return{start:e,end:t}}_emit(){this._onChange({page:this._page,pageSize:this._pageSize,totalRows:this._totalRows,totalPages:this.totalPages})}_render(){this._el.innerHTML="";const e=this.totalPages,t=document.createElement("span");t.style.cssText="display:flex;align-items:center;gap:3px;margin-right:8px;";const s=document.createElement("span");s.textContent="행/페이지:",s.style.color="#888";const o=document.createElement("select");o.style.cssText="padding:2px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:11px;cursor:pointer;";for(const c of[10,20,50,100,200]){const h=document.createElement("option");h.value=String(c),h.textContent=String(c),c===this._pageSize&&(h.selected=!0),o.appendChild(h)}o.addEventListener("change",()=>this.setPageSize(Number(o.value))),t.appendChild(s),t.appendChild(o),this._el.appendChild(t);const i=document.createElement("span"),{start:n,end:a}=this.getRange();i.textContent=this._totalRows>0?`${n+1}–${a+1} / ${this._totalRows}건`:"0건",i.style.cssText="margin-right:8px;color:#888;",this._el.appendChild(i);const l=(c,h,u)=>{const g=document.createElement("button");return g.textContent=c,g.disabled=u,g.style.cssText=`
|
|
86
|
-
min-width:28px;height:24px;padding:0 6px;
|
|
87
|
-
border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;
|
|
88
|
-
background:${u?"#f5f5f5":"#fff"};
|
|
89
|
-
color:${u?"#bbb":"var(--og-text-color,#333)"};
|
|
90
|
-
cursor:${u?"default":"pointer"};font-size:12px;
|
|
91
|
-
`,u||g.addEventListener("click",()=>this.goTo(h)),g};this._el.appendChild(l("«",1,this._page===1)),this._el.appendChild(l("‹",this._page-1,this._page===1));const d=In(this._page,e);for(const c of d)if(c===-1){const h=document.createElement("span");h.textContent="…",h.style.padding="0 3px",this._el.appendChild(h)}else{const h=l(String(c),c,c===this._page);c===this._page&&(h.style.background="var(--og-primary,#1976d2)",h.style.color="#fff",h.style.borderColor="var(--og-primary,#1976d2)"),this._el.appendChild(h)}this._el.appendChild(l("›",this._page+1,this._page===e)),this._el.appendChild(l("»",e,this._page===e))}destroy(){this._el.remove()}}function In(r,e){if(e<=7)return Array.from({length:e},(s,o)=>o+1);const t=[1];r>3&&t.push(-1);for(let s=Math.max(2,r-1);s<=Math.min(e-1,r+1);s++)t.push(s);return r<e-2&&t.push(-1),t.push(e),t}class An{constructor(e,t,s,o){this._dx=t-e.left,this._dy=s-e.top;const i=document.createElement("div");i.className="og-drag-ghost",i.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;`,o>1&&(i.textContent=`${o}개 행 이동`),document.body.appendChild(i),this._el=i}move(e,t){this._el.style.transform=`translate(${e-this._dx}px,${t-this._dy}px)`}destroy(){this._el.remove()}}class Gt{constructor(e="#1976d2"){const t=document.createElement("div");t.className="og-drop-indicator",t.style.cssText="position:absolute;left:0;right:0;display:none;align-items:center;pointer-events:none;z-index:9998;transform:translateY(-50%);";const s=i=>{const n=document.createElement("div"),a=i==="left"?`border-left:7px solid ${e}`:`border-right:7px solid ${e}`;return n.style.cssText=`width:0;height:0;flex-shrink:0;border-top:5px solid transparent;border-bottom:5px solid transparent;${a};`,n},o=document.createElement("div");o.style.cssText=`flex:1;height:3px;background:${e};border-radius:2px;box-shadow:0 0 0 1px rgba(255,255,255,0.7);`,t.append(s("left"),o,s("right")),this._el=t}showIn(e,t){this._el.parentElement!==e&&(this._el.remove(),e.appendChild(this._el)),this._el.style.display="flex",this._el.style.top=`${t}px`}hide(){this._el.style.display="none"}destroy(){this._el.remove()}}const Yt=(r,e,t)=>Math.max(e,Math.min(t,r));class Tn{constructor(e,t,s,o=null,i=()=>1){this._bodyEl=e,this._rowHeight=t,this._onDrop=s,this._cross=o,this._getDragCount=i,this._drag=null,this._selfIndicator=new Gt("#1976d2"),this._crossIndicator=new Gt("#2e7d32"),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this)}attachHandle(e,t,s){const o=document.createElement("div");return o.className="og-drag-handle",o.innerHTML="⠿",o.style.cssText=`
|
|
92
|
-
width:18px;min-width:18px;height:100%;
|
|
93
|
-
display:flex;align-items:center;justify-content:center;
|
|
94
|
-
cursor:grab;font-size:14px;color:#bbb;flex-shrink:0;
|
|
95
|
-
user-select:none;border-right:1px solid var(--og-border-color,#e0e0e0);
|
|
96
|
-
`,o.addEventListener("mousedown",i=>{i.preventDefault(),i.stopPropagation(),this._startDrag(i,e,t,s)}),o}_startDrag(e,t,s,o){const i=t.getBoundingClientRect(),n=this._getDragCount(s);this._drag={fromIndex:s,bodyEl:this._bodyEl,rowHeight:this._rowHeight,totalRows:o,ghost:new An(i,e.clientX,e.clientY,n),currentTarget:s,crossTarget:null},document.addEventListener("mousemove",this._onMouseMove,!0),document.addEventListener("mouseup",this._onMouseUp,!0)}_onMouseMove(e){if(!this._drag)return;const t=this._drag;if(t.ghost.move(e.clientX,e.clientY),this._cross){const i=this._cross.resolveTarget(e.clientX,e.clientY);if(i&&i.bodyEl!==t.bodyEl){const n=i.bodyEl.getBoundingClientRect(),a=e.clientY-n.top+i.bodyEl.scrollTop,l=Yt(Math.round(a/i.rowHeight),0,i.totalRows);t.crossTarget={bodyEl:i.bodyEl,index:l},this._selfIndicator.hide(),this._crossIndicator.showIn(i.bodyEl,l*i.rowHeight);return}}t.crossTarget=null,this._crossIndicator.hide();const s=t.bodyEl.getBoundingClientRect(),o=e.clientY-s.top+t.bodyEl.scrollTop;t.currentTarget=Yt(Math.round(o/t.rowHeight),0,t.totalRows-1),this._selfIndicator.showIn(t.bodyEl,t.currentTarget*t.rowHeight)}_onMouseUp(e){if(document.removeEventListener("mousemove",this._onMouseMove,!0),document.removeEventListener("mouseup",this._onMouseUp,!0),!this._drag)return;const{fromIndex:t,currentTarget:s,ghost:o,crossTarget:i}=this._drag;this._drag=null,o.destroy(),this._selfIndicator.hide(),this._crossIndicator.hide(),i&&this._cross?this._cross.onCrossDrop(t,i.bodyEl,i.index):t!==s&&this._onDrop(t,s)}destroy(){var e;document.removeEventListener("mousemove",this._onMouseMove,!0),document.removeEventListener("mouseup",this._onMouseUp,!0),(e=this._drag)==null||e.ghost.destroy(),this._selfIndicator.destroy(),this._crossIndicator.destroy(),this._drag=null}}class ve{constructor(){this._map=new Map}static _key(e,t){return`${e}:${t}`}applyMergeCells(e){this._map.clear();for(const t of e){const s=Math.max(1,t.rowSpan??1),o=Math.max(1,t.colSpan??1);this._map.set(ve._key(t.row,t.col),{rowSpan:s,colSpan:o,hidden:!1});for(let i=0;i<s;i++)for(let n=0;n<o;n++)i===0&&n===0||this._map.set(ve._key(t.row+i,t.col+n),{rowSpan:1,colSpan:1,hidden:!0})}}applyAutoMerge(e,t,s){var o,i;this._map.clear();for(let n=0;n<t.length;n++){const a=t[n],l=s[n];let d=0;for(let c=1;c<=e.length;c++){const h=(o=e[c-1])==null?void 0:o[l],u=c<e.length?(i=e[c])==null?void 0:i[l]:void 0;if(c===e.length||u!==h){const g=c-d;if(g>1){this._map.set(ve._key(d,a),{rowSpan:g,colSpan:1,hidden:!1});for(let p=d+1;p<c;p++)this._map.set(ve._key(p,a),{rowSpan:1,colSpan:1,hidden:!0})}d=c}}}}getInfo(e,t){return this._map.get(ve._key(e,t))??null}clear(){this._map.clear()}get isEmpty(){return this._map.size===0}}const Dn=[{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"}];class $n{constructor(e,t){this._anchor=e,this._actions=t,this._el=null,this._docClick=null,this._docKey=null,this._docScroll=null,this._docMouseMove=null,this._focusIdx=-1}open(e,t){this.close();const s=t??Dn,o=document.createElement("div");o.className="og-context-menu",o.setAttribute("role","menu");for(const d of s){if(d.type==="divider"){const u=document.createElement("div");u.className="og-cm-divider",u.setAttribute("role","separator"),o.appendChild(u);continue}const c=document.createElement("button");if(c.className="og-cm-item",c.setAttribute("role","menuitem"),c.setAttribute("tabindex","-1"),d.disabled&&(c.classList.add("og-cm-disabled"),c.setAttribute("aria-disabled","true")),d.icon){const u=document.createElement("span");if(u.className="og-cm-icon",/^[a-zA-Z][\w-]*(\s+[\w-]+)+$/.test(d.icon.trim())){const g=document.createElement("i");g.className=d.icon,u.appendChild(g)}else u.textContent=d.icon;u.setAttribute("aria-hidden","true"),c.appendChild(u)}const h=document.createElement("span");h.className="og-cm-label",h.textContent=d.label??"",c.appendChild(h),c.addEventListener("click",u=>{u.stopPropagation(),d.disabled||this._runAction(d),this.close()}),o.appendChild(c)}const i=this._anchor.closest("[data-og-theme]"),n=i==null?void 0:i.getAttribute("data-og-theme");n&&o.setAttribute("data-og-theme",n);const a=this._anchor.closest("[data-og-skin]"),l=a==null?void 0:a.getAttribute("data-og-skin");l&&o.setAttribute("data-og-skin",l),document.body.appendChild(o),this._el=o,this._docMouseMove=d=>{if(!this._el)return;const c=this._el.getBoundingClientRect();(d.clientX<c.left-4||d.clientX>c.right+4||d.clientY<c.top-4||d.clientY>c.bottom+4)&&this.close()},this._position(o,e.clientX,e.clientY,()=>{this._el===o&&document.addEventListener("mousemove",this._docMouseMove,{capture:!0,passive:!0})}),this._docClick=d=>{o.contains(d.target)||this.close()},this._docKey=d=>{if(d.key==="Escape"){this.close();return}if(d.key==="ArrowDown"){d.preventDefault(),this._moveFocus(1);return}if(d.key==="ArrowUp"){d.preventDefault(),this._moveFocus(-1);return}if(d.key==="Enter"){const c=o.querySelector(".og-cm-item:focus");c==null||c.click()}},this._docScroll=()=>this.close(),setTimeout(()=>{document.addEventListener("click",this._docClick),document.addEventListener("keydown",this._docKey),window.addEventListener("scroll",this._docScroll,{passive:!0})},0),this._focusIdx=-1,this._moveFocus(1)}close(){var e;(e=this._el)==null||e.remove(),this._el=null,this._docClick&&document.removeEventListener("click",this._docClick),this._docKey&&document.removeEventListener("keydown",this._docKey),this._docScroll&&window.removeEventListener("scroll",this._docScroll),this._docMouseMove&&document.removeEventListener("mousemove",this._docMouseMove,{capture:!0}),this._docClick=this._docKey=this._docScroll=this._docMouseMove=null,this._focusIdx=-1}destroy(){this.close()}_position(e,t,s,o){e.style.cssText="position:fixed;visibility:hidden;left:0;top:0;",requestAnimationFrame(()=>{const{width:i,height:n}=e.getBoundingClientRect(),a=window.innerWidth,l=window.innerHeight,d=t+i>a?Math.max(0,t-i):t,c=s+n>l?Math.max(0,s-n):s;e.style.cssText=`position:fixed;left:${d}px;top:${c}px;z-index:9999;`,o==null||o()})}_moveFocus(e){var s;if(!this._el)return;const t=Array.from(this._el.querySelectorAll(".og-cm-item:not(.og-cm-disabled)"));t.length&&(this._focusIdx=(this._focusIdx+e+t.length)%t.length,(s=t[this._focusIdx])==null||s.focus())}_runAction(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 Xt{constructor(e,t){this._sheets=new Map,this._active="",this._onSwitch=t,this._tabBar=this._buildTabBar(e)}add(e,t=[],s=[]){if(this._sheets.has(e))throw new Error(`WorksheetManager: 시트 '${e}'이 이미 존재합니다`);this._sheets.set(e,{name:e,columns:t,data:s}),this._renderTabs(),this._sheets.size===1&&this.switch(e)}remove(e){if(!this._sheets.has(e))return;if(this._sheets.size===1)throw new Error("WorksheetManager: 마지막 시트는 삭제할 수 없습니다");const t=this._active===e;this._sheets.delete(e),this._renderTabs(),t&&this.switch(this._sheets.keys().next().value)}rename(e,t){if(!this._sheets.has(e))return;if(this._sheets.has(t))throw new Error(`WorksheetManager: 시트 '${t}'이 이미 존재합니다`);this._sheets.get(e);const s=Array.from(this._sheets.entries()).map(([o,i])=>o===e?[t,{...i,name:t}]:[o,i]);this._sheets=new Map(s),this._active===e&&(this._active=t),this._renderTabs()}switch(e){const t=this._sheets.get(e);if(!t)throw new Error(`WorksheetManager: 시트 '${e}'을 찾을 수 없습니다`);this._active=e,this._renderTabs(),this._onSwitch(e,t)}get(e){return this._sheets.get(e)}getNames(){return Array.from(this._sheets.keys())}getActive(){return this._active}syncData(e,t){const s=this._sheets.get(e);s&&(s.data=t)}destroy(){this._tabBar.remove()}_buildTabBar(e){const t=document.createElement("div");return t.className="og-sheet-tabs",e.appendChild(t),t}_renderTabs(){this._tabBar.innerHTML="";for(const t of this._sheets.keys()){const s=document.createElement("button");s.className="og-sheet-tab",s.textContent=t,s.setAttribute("role","tab"),s.setAttribute("aria-selected",t===this._active?"true":"false"),t===this._active&&s.classList.add("og-sheet-tab--active"),s.addEventListener("click",()=>{t!==this._active&&this.switch(t)}),s.addEventListener("dblclick",()=>this._startRename(s,t)),this._tabBar.appendChild(s)}const e=document.createElement("button");e.className="og-sheet-add",e.textContent="+",e.setAttribute("aria-label","새 워크시트 추가"),e.addEventListener("click",()=>{const t=`Sheet${this._sheets.size+1}`;this.add(t,[],[]),this.switch(t)}),this._tabBar.appendChild(e)}_startRename(e,t){const s=document.createElement("input");s.className="og-sheet-tab-rename",s.value=t,e.replaceWith(s),s.focus(),s.select();const o=()=>{const i=s.value.trim()||t;try{i!==t?this.rename(t,i):this._renderTabs()}catch{this._renderTabs()}};s.addEventListener("blur",o),s.addEventListener("keydown",i=>{i.key==="Enter"&&s.blur(),i.key==="Escape"&&(s.value=t,s.blur())})}}class On{constructor(){this._triggers=new Map}add(e,t){this._triggers.has(e)||this._triggers.set(e,[]),this._triggers.get(e).push(t)}remove(e,t){const s=this._triggers.get(e);if(s){const o=s.indexOf(t);o>=0&&s.splice(o,1)}}clear(e){e?this._triggers.delete(e):this._triggers.clear()}mkCtx(e,t){let s=!1;return{operation:e,args:t,result:void 0,extra:{},timestamp:Date.now(),get cancelled(){return s},cancel(){s=!0}}}exec(e,t){const s=this._triggers.get(e)??[];for(const o of s)if(o(t),t.cancelled)return!1;if(e.startsWith("after:")){const o=this._triggers.get("complete")??[];for(const i of o)i(t)}return!0}}class zn{constructor(){this._order=[],this._hooks=new Map}register(e){this._hooks.has(e.id)||this._order.push(e.id),this._hooks.set(e.id,e)}get(e){return this._hooks.get(e)}has(e){return this._hooks.has(e)}ids(){return[...this._order]}resolve(e,t,s){const o=this._hooks.get(e);return!o||!o.gate()?null:o.resolve(t,s)}activeIds(){return this._order.filter(e=>this._hooks.get(e).gate())}}class Hn{constructor(e){this._renderHooks=new zn,this._deps=e}get renderHooks(){return this._renderHooks}registerRenderHook(e){this._renderHooks.register(e)}resolveRenderHook(e,t,s){return this._renderHooks.resolve(e,t,s)}strategy(e,t){this._deps.kernel.strategy(e,t)}getStrategy(e,t){return this._deps.kernel.getStrategy(e,t)}hasStrategy(e){return this._deps.kernel.hasStrategy(e)}override(e,t,s={}){this._deps.kernel.override(e,t,s)}beforeMutation(e,t){this._deps.getTrigMgr().add(`before:${e}`,t)}afterMutation(e,t){this._deps.getTrigMgr().add(`after:${e}`,t)}offMutation(e,t,s){this._deps.getTrigMgr().remove(`${e}:${t}`,s)}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(([n,a])=>({name:n,category:"strategy",signature:a})),t=this._renderHooks.ids().map(n=>({name:n,category:"renderHook",signature:"(rowIndex,field)=>value|null"})),s=[{name:"before:mutation",category:"lifecycle",signature:"(ctx)=>void — cancelable"},{name:"after:mutation",category:"lifecycle",signature:"(ctx)=>void — observe"}],o=[{name:"getDisplayValue",category:"override",signature:"(orig,rowIndex,field)=>string"},{name:"readCell",category:"override",signature:"(orig,rowIndex,field)=>any"}],i=[{name:"override(name,fn)",category:"escapeHatch",signature:"best-effort arbitrary method wrap (UC-11)"}];return[...e,...t,...s,...o,...i]}}const Zt="_ogRowId",X=class X extends ks{constructor(e,t){var o;super(),this._vs=null,this._ro=null,this._renderer=null,this._appearance=null,this._icons=null,this._trigMgr=new On,this._destroyed=!1,this._colWidths=[],this._userWidths=new Map,this._filterPanel=null,this._filterSelect=null,this._pagination=null,this._dnd=null,this._mergeEngine=new ve,this._liveRegion=null,this._ctxMenu=null,this._cmHandler=null,this._cmKbdHandler=null,this._wsManager=null,this._formulaDirtySeeds=new Set,ye.compose(this,e,t,{createSubgrid:(i,n,a)=>new X(i,{...n,_detailDepth:a})}),this._bindOptionEvents(),(o=this._options.defaultSort)!=null&&o.length&&this._sfMgr.initSort(this._options.defaultSort),this.override=Object.assign((i,n,a)=>this._ovk.override(i,n,a),{strategy:(i,n)=>this._ovk.strategy(i,n)});const s=this.destroy.bind(this);this.destroy=()=>{try{s()}finally{this._ovk.restoreAll()}};for(const[i,n]of X._defaultStrategies)this._ovk.strategy(i,n);for(const[i,n,a]of X._defaultOverrides)this._ovk.override(i,n,a);requestAnimationFrame(()=>{var i,n;this.emit("ready",this),(n=(i=this._options).onReady)==null||n.call(i,this)})}get extensions(){return this._extensions}static defaultOverride(e,t,s={}){return X._defaultOverrides.push([e,t,s]),X}static registerRenderer(e,t){return G(e,t),X}static registerEditor(e,t){return Se(e,t),X}static defineSkin(e,t){return pt.define(e,t),X}static defineIconSet(e){for(const[t,s]of Object.entries(e))xe.register(t,s);return X}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,t){return this._ovk.getStrategy(e,t)}_mount(){var s,o;this._extensions=new Hn({kernel:this._ovk,getTrigMgr:()=>this._trigMgr}),this._extensions.registerRenderHook({id:"displayText",gate:()=>this.hasOverride("getDisplayValue")||this._ovk.hasStrategy("displayFormatter"),resolve:(i,n)=>this.getDisplayValue(i,n)}),this._extensions.registerRenderHook({id:"cellClass",gate:()=>this._ovk.hasStrategy("cellClassResolver"),resolve:(i,n)=>{const a=this._ovk.getStrategy("cellClassResolver",null);return a?a(this.readCell(i,n),n,this._data.getRowByIndex(i)):null}}),this._extensions.registerRenderHook({id:"ariaLabel",gate:()=>this._ovk.hasStrategy("ariaLabelResolver"),resolve:(i,n)=>{const a=this._ovk.getStrategy("ariaLabelResolver",null);return a?a(this.readCell(i,n),n,this._data.getRowByIndex(i)):null}}),this._container.classList.add("og-container");const e=this._options.height,t=this._options.width;this._container.style.height=typeof e=="number"?`${e}px`:String(e),this._container.style.width=typeof t=="number"?`${t}px`:String(t),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[i,n]of Object.entries(this._options.cssVars))this._container.style.setProperty(i,n);this._appearance=new ut(new Ke(this._options.theme,this._options.skin??"default")),this._renderer=new fi(this._container,this._options,{onHeaderClick:(i,n)=>this._handleSortClick(i,n),onCellClick:(i,n,a)=>this._handleCellClick(i,n,a),onCellDblClick:(i,n,a)=>this._handleCellDblClick(i,n,a),onCellMouseOver:(i,n,a)=>this._handleCellMouseOver(i,n,a),onCellMouseOut:(i,n,a)=>this._handleCellMouseOut(i,n,a),onCellMouseDown:(i,n,a)=>this._handleCellMouseDown(i,n,a),onCellMouseUp:(i,n,a)=>this._handleCellMouseUp(i,n,a),onCellMouseMove:(i,n,a)=>this._handleCellMouseMove(i,n,a),onRowCheck:(i,n)=>this._handleRowCheck(i,n),onAllCheck:i=>this._handleAllCheck(i),onColResize:(i,n)=>this._handleColResize(i,n),onFilterIconClick:(i,n)=>this._handleFilterIconClick(i,n),getDndManager:()=>this._dnd,onColDragStart:i=>{this._editMgr.dragColIdx=i},onColDrop:i=>{this._editMgr.dragColIdx!==null&&this._editMgr.dragColIdx!==i&&this._reorderColumn(this._editMgr.dragColIdx,i),this._editMgr.dragColIdx=null},getColDragIdx:()=>this._editMgr.dragColIdx,resolveRenderHook:(i,n,a)=>this._extensions.resolveRenderHook(i,n,a),getDisplayFormatter:()=>this._ovk.getStrategy("displayFormatter",null)??null,getFormulaMeta:(i,n)=>this._formula.getFormulaMeta(i,n)},this._appearance),this._render=new Fi({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._mergeEngine,getColWidths:()=>this._colWidths,setColWidths:i=>{this._colWidths=i},getUserWidths:()=>this._userWidths,getSfMgr:()=>this._sfMgr,getRowMgr:()=>this._rowMgr,getEditMgr:()=>this._editMgr,getGrpMgr:()=>this._grpMgr,getDetailMgr:()=>this._detailMgr,getRangeMgr:()=>this._rangeMgr,buildDetailRenderContext:()=>this._buildDetailRenderContext(),renderFooterEl:()=>this._renderFooterEl()}),this._mutation=new wn({getData:()=>this._data,getVs:()=>this._vs,getPagination:()=>this._pagination,getFlatModel:()=>this._flatModel,getColLayout:()=>this._colLayout,getContainer:()=>this._container,getTrigMgr:()=>this._trigMgr,getRowMgr:()=>this._rowMgr,getGrpMgr:()=>this._grpMgr,getOptions:()=>this._options,emit:(i,n)=>{this.emit(i,n)},announce:i=>this._announce(i),applyFilters:()=>this._applyFilters(),flushFormula:()=>this._formula.flushRecalc(),doRenderWindow:()=>this._doRender(...this._visRange()),doRenderFull:()=>this._doRender(0,-1),resetFormulaState:()=>{var i,n;this._formulaDirtySeeds.clear(),this._recalc=new fs({accessor:this._formula.buildAccessor(),setComputedValue:(a,l,d)=>this._data.setComputedValueByRowId(a,l,d),onFormulaError:(a,l,d)=>this._formula.handleFormulaError(a,l,d),refMode:((i=this._options.formula)==null?void 0:i.refMode)??"stable",divisionPrecision:((n=this._options.formula)==null?void 0:n.divisionPrecision)??30})},seedFormulaDirty:(i,n)=>{const a=this._flatModel.resolveFlatRow(i);a.kind==="data"&&a.rowId&&this._formulaDirtySeeds.add(Q(a.rowId,n))},invalidateRemovedRows:i=>{for(const n of i)this._formula.afterRecalc(this._recalc.invalidateRow(n),{skipRender:!0})},getRowIdAt:i=>{var n;return(n=this._data.getRowByIndex(i))==null?void 0:n[Zt]}}),this._rangeMgr.mount(this._renderer.bodyWrapper),this._filterPanel=new Fs(this._container,(i,n)=>this.setFilter(i,n),i=>this.resetFilter(i)),this._container.setAttribute("role","grid"),this._container.setAttribute("aria-label",this._options.ariaLabel??((s=this._options.cssVars)==null?void 0:s["aria-label"])??"OPEN_GRID 데이터 그리드"),this._container.setAttribute("aria-rowcount","0"),this._container.setAttribute("aria-colcount",String(this._options.columns.filter(i=>!i.hidden).length)),this._liveRegion=document.createElement("div"),this._liveRegion.setAttribute("aria-live","polite"),this._liveRegion.setAttribute("aria-atomic","true"),this._liveRegion.className="og-live-region",Object.assign(this._liveRegion.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._liveRegion),this._container.tabIndex=0,this._container.addEventListener("keydown",i=>this._handleKeyDown(i)),this._container.addEventListener("keyup",i=>this._handleCellKeyEvt("cellKeyUp",i)),this._container.addEventListener("keypress",i=>this._handleCellKeyEvt("cellKeyPress",i)),this._vs=new Es(this._renderer.bodyWrapper,{rowHeight:this._options.rowHeight,onRender:(i,n)=>this._doRender(i,n)}),We.register(this._renderer.bodyWrapper,this),this._cross=new Rn({getSelf:()=>this,getData:()=>this._data,getColLayout:()=>this._colLayout,getOptions:()=>this._options,emit:(i,n)=>{this.emit(i,n)},insertRow:(i,n)=>this.insertRow(i,n),deleteRow:i=>this.deleteRow(i),getChecked:()=>this._rowMgr.getChecked(),uncheckAll:()=>this._rowMgr.uncheckAll(),dragRowSet:i=>this._dragRowSet(i),getPeerController:i=>i._cross}),this._options.draggable&&(this._dnd=new Tn(this._renderer.bodyWrapper,this._options.rowHeight,(i,n)=>this._handleRowDrop(i,n),this._options.crossGrid?{resolveTarget:(i,n)=>{const a=We.resolveAt(i,n,this);return!a||!a._options.crossGrid?null:{bodyEl:a._crossBodyEl(),rowHeight:a._options.rowHeight,totalRows:a._data.rowCount}},onCrossDrop:(i,n,a)=>this._cross.handleCrossGridDrop(i,n,a)}:void 0,i=>this._dragRowSet(i).length)),this._options.pagination&&(this._pagination=new Ln(this._container,this._options.pageSize,i=>{this.emit("pageChange",i),this._doRender(...this._visRange())})),this._findMgr.init(this._container),this._initContextMenu(),(o=this._options.worksheets)!=null&&o.length&&this._initWorksheets(),this._ro=new ResizeObserver(()=>this._onResize()),this._ro.observe(this._container),this._onResize()}_initContextMenu(){const e=this._options.contextMenu;e!==!1&&(this._cmHandler&&this._container.removeEventListener("contextmenu",this._cmHandler),this._cmKbdHandler&&this._container.removeEventListener("keydown",this._cmKbdHandler),this._cmHandler=this._cmKbdHandler=null,this._ctxMenu=new $n(this._container,{onSortAsc:()=>{const t=this._colLayout.visibleLeaves[0];t&&this.orderBy(t.field,"asc")},onSortDesc:()=>{const t=this._colLayout.visibleLeaves[0];t&&this.orderBy(t.field,"desc")},onFind:()=>this._findMgr.open(),onExcel:()=>this.exportExcel(),onCsv:()=>this.exportCsv(),onPrint:()=>this.print()}),this._cmHandler=t=>{var a;const s=t.target.closest(".og-cell");if(!s)return;t.preventDefault();const o=Number(s.dataset.colIndex??-1),i=this._colLayout.visibleLeaves[o];i&&this._ctxMenu&&(this._ctxMenu._actions.onSortAsc=()=>this.orderBy(i.field,"asc"),this._ctxMenu._actions.onSortDesc=()=>this.orderBy(i.field,"desc"));const n=Array.isArray(e)?e:void 0;(a=this._ctxMenu)==null||a.open(t,n)},this._container.addEventListener("contextmenu",this._cmHandler),this._cmKbdHandler=t=>{var s;if(t.shiftKey&&t.key==="F10"){t.preventDefault();const o=this._container.getBoundingClientRect(),i={clientX:o.left+80,clientY:o.top+40};(s=this._ctxMenu)==null||s.open(i)}},this._container.addEventListener("keydown",this._cmKbdHandler))}openContextMenu(e,t){var s;(s=this._ctxMenu)==null||s.open(e,t)}closeContextMenu(){var e;(e=this._ctxMenu)==null||e.close()}setFilterSelect(e){var t;(t=this._filterSelect)==null||t.destroy(),this._filterSelect=null,e&&(this._container.id||(this._container.id=`og-${Math.random().toString(36).slice(2,7)}`),this._filterSelect=new Sn(this._container,e,(s,o)=>this.setFilter(s,o),s=>this.resetFilter(s),this._container.id))}setOptions(e){var t;if(Object.assign(this._options,e),"contextMenu"in e&&((t=this._ctxMenu)==null||t.destroy(),this._ctxMenu=null,this._initContextMenu()),"groupBy"in e||"summary"in e){const s=e.groupBy??[];s.length>0?this._grpMgr.groupBy(s):this.clearGroup();return}this._renderHeader(),this._doRender(...this._visRange())}setMaskEnabled(e,t){var o;const s=this._colLayout.getColumnByField(e);s&&(t?(s._maskRevealed=!1,(o=s._maskRevealedRows)==null||o.clear()):s._maskRevealed=!0,this._doRender(...this._visRange()))}getMaskEnabled(e){const t=this._colLayout.getColumnByField(e);return t?t._maskRevealed!==!0:!1}_initWorksheets(){const e=this._options.worksheets;this._wsManager=new Xt(this._container,(t,s)=>this._loadWorksheetState(s));for(const t of e)this._wsManager.add(t.name,t.columns??this._options.columns,t.data??[])}_loadWorksheetState(e){var s,o;this._rowMgr.reset(),this._data.setData(e.data),this._colLayout=new Jt(e.columns.length?e.columns:this._options.columns,this._options.frozenColumns),(s=this._vs)==null||s.setTotalRows(this._data.rowCount),(o=this._pagination)==null||o.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:t}=this._container.getBoundingClientRect();t&&this._recalcWidths(t),this._renderHeader(),this._doRender(...this._visRange())}addWorksheet(e,t,s){this._wsManager||(this._wsManager=new Xt(this._container,(o,i)=>this._loadWorksheetState(i))),this._wsManager.add(e,t??this._options.columns,s??[])}removeWorksheet(e){var t;(t=this._wsManager)==null||t.remove(e)}switchWorksheet(e){var t;(t=this._wsManager)==null||t.switch(e)}renameWorksheet(e,t){var s;(s=this._wsManager)==null||s.rename(e,t)}getWorksheet(e){var t;return(t=this._wsManager)==null?void 0:t.get(e)}getWorksheetNames(){var e;return((e=this._wsManager)==null?void 0:e.getNames())??[]}exportSheetsExcel(e){this._exportMgr.exportSheetsExcel(e)}_onResize(){this._render.onResize()}_recalcWidths(e){this._render.recalcWidths(e)}_renderHeader(){this._render.renderHeader()}_syncHeaderLayout(){this._render.syncHeaderLayout()}_doRender(e,t){this._render.doRender(e,t)}_buildDetailRenderContext(){if(!this._detailMgr.enabled)return;const e=this._options.masterDetail??{};return{toggleMode:e.toggle??"expander-col",ariaLabel:e.ariaLabel??"상세 내용",getRowId:t=>t==null?void 0:t[Zt],isExpanded:t=>this._detailMgr.isExpandedId(t),onToggle:(t,s)=>this._detailMgr.toggleRow({id:s}),getGlyph:t=>Fn(t),getPanelHost:t=>this._detailMgr.getPanelHost(t),onBeforeTeardown:()=>this._detailMgr.onBeforeTeardown()}}_handleGroupToggle(e){this._grpMgr.handleGroupToggle(e)}_visRange(){return this._render.visRange()}_handleSortClick(e,t){this._sfMgr.handleSortClick(e,t)}_isToggleCol(e){return $e(e)}_handleCellClick(e,t,s){this._cellEvt.handleCellClick(e,t,s)}_handleCellDblClick(e,t,s){this._cellEvt.handleCellDblClick(e,t,s)}_handleCellMouseOver(e,t,s){this._cellEvt.handleCellMouseOver(e,t,s)}_handleCellMouseOut(e,t,s){this._cellEvt.handleCellMouseOut(e,t,s)}_handleCellMouseDown(e,t,s){this._cellEvt.handleCellMouseDown(e,t,s)}_handleCellMouseUp(e,t,s){this._cellEvt.handleCellMouseUp(e,t,s)}_handleCellMouseMove(e,t,s){this._cellEvt.handleCellMouseMove(e,t,s)}_handleCellKeyEvt(e,t){this._cellEvt.handleCellKeyEvt(e,t)}_handleRowCheck(e,t){this._rowMgr.check(e,t),this._doRender(...this._visRange()),this.emit("rowCheck",{rowIndex:e,checked:t,row:this._data.getRowByIndex(e)})}_handleFilterIconClick(e,t){var o,i;if((o=this._filterPanel)!=null&&o.isOpen){this._filterPanel.close();return}const s=this._sfMgr.filters[e]??[];(i=this._filterPanel)==null||i.open(e,t,s)}_handleAllCheck(e){this._rowMgr.checkAll(e,this._data.rowCount),this._doRender(...this._visRange()),this.emit("allCheck",{checked:e})}_handleRowDrop(e,t){var s,o;this._data.moveRow(e,t),this._doRender(...this._visRange()),this.emit("rowDrop",{fromIndex:e,toIndex:t}),(o=(s=this._options).onRowDrop)==null||o.call(s,{fromIndex:e,toIndex:t})}_crossBodyEl(){return this._renderer.bodyWrapper}_dragRowSet(e){const t=[...this._rowMgr.selectedRows];return t.length>1&&t.includes(e)?t.sort((s,o)=>s-o):[e]}moveRowsTo(e,t,s){return this._cross.moveRowsTo(e,t,s)}moveCheckedTo(e){return this._cross.moveCheckedTo(e)}reorderRow(e,t){this._data.moveRow(e,t),this._doRender(...this._visRange())}_handleColResize(e,t){this._colWidths[e]!==void 0&&(this._colWidths[e]=t);const s=this._colLayout.visibleLeaves[e];s&&this._userWidths.set(s.field,t),this._renderHeader(),this._doRender(...this._visRange())}_handleKeyDown(e){this._kbdMgr.handleKeyDown(e)}_setFocusCell(e,t){this._rowMgr.selectSingle(e),this._editMgr.setFocusCell(e,t)}_announce(e){this._liveRegion&&(this._liveRegion.textContent="",setTimeout(()=>{this._liveRegion&&(this._liveRegion.textContent=e)},50))}_bindOptionEvents(){this._options.onCellClick&&this.on("cellClick",this._options.onCellClick),this._options.onCellDblClick&&this.on("cellDblClick",this._options.onCellDblClick),this._options.onRowClick&&this.on("rowClick",this._options.onRowClick),this._options.onEditStart&&this.on("editStart",this._options.onEditStart),this._options.onEditEnd&&this.on("editEnd",this._options.onEditEnd),this._options.onSortChange&&this.on("sortChange",this._options.onSortChange),this._options.onFilterChange&&this.on("filterChange",this._options.onFilterChange),this._options.onScroll&&this.on("scroll",this._options.onScroll),this._options.onDataChange&&this.on("dataChange",this._options.onDataChange),this._options.onSelectionChange&&this.on("selectionChange",this._options.onSelectionChange),this._options.onRowDblClick&&this.on("rowDblClick",this._options.onRowDblClick),this._options.onRowMouseOver&&this.on("rowMouseOver",this._options.onRowMouseOver),this._options.onRowMouseOut&&this.on("rowMouseOut",this._options.onRowMouseOut),this._options.onRowMouseDown&&this.on("rowMouseDown",this._options.onRowMouseDown),this._options.onRowMouseUp&&this.on("rowMouseUp",this._options.onRowMouseUp),this._options.onRowMouseMove&&this.on("rowMouseMove",this._options.onRowMouseMove),this._options.onCellMouseOver&&this.on("cellMouseOver",this._options.onCellMouseOver),this._options.onCellMouseOut&&this.on("cellMouseOut",this._options.onCellMouseOut),this._options.onCellMouseDown&&this.on("cellMouseDown",this._options.onCellMouseDown),this._options.onCellMouseUp&&this.on("cellMouseUp",this._options.onCellMouseUp),this._options.onCellMouseMove&&this.on("cellMouseMove",this._options.onCellMouseMove),this._options.onCellKeyDown&&this.on("cellKeyDown",this._options.onCellKeyDown),this._options.onCellKeyUp&&this.on("cellKeyUp",this._options.onCellKeyUp),this._options.onCellKeyPress&&this.on("cellKeyPress",this._options.onCellKeyPress),this._options.onRowExpand&&this.on("rowExpand",this._options.onRowExpand),this._options.onRowCollapse&&this.on("rowCollapse",this._options.onRowCollapse)}setData(e){this._mutation.setData(e)}getData(){return this._data.getData()}getSourceRows(){return this._data.getOriginalData()}pushData(e){var o,i;const t=[...this._data.getAllData(),...e];this._data.setData(t);const s=this._data.rowCount;(o=this._vs)==null||o.setTotalRows(this._flatModel.count()),(i=this._pagination)==null||i.setTotalRows(s)}prefixData(e){var o,i;const t=[...e,...this._data.getAllData()];this._data.setData(t);const s=this._data.rowCount;(o=this._vs)==null||o.setTotalRows(this._flatModel.count()),(i=this._pagination)==null||i.setTotalRows(s)}clearData(){this._rowMgr.reset(),this._data.clearData(),this._mutation.commit({totals:"zero",renderMode:"full",emitPayload:()=>[]})}insertRow(e,t="last"){this._mutation.insertRow(e,t)}pushRow(e){this._mutation.pushRow(e)}appendRows(e){this.pushRow(e)}unshiftRow(e){(Array.isArray(e)?e:[e]).forEach(s=>this._data.addRow(s,"first")),this._mutation.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>this._data.getData(),fireOnDataChangeExplicitly:!0})}prependRows(e){this.unshiftRow(e)}deleteRow(e){this._mutation.deleteRow(e)}deleteById(e){}readCell(e,t){return this._data.getCellValue(e,t)}getDisplayValue(e,t){const s=this.readCell(e,t);return this._ovk.getStrategy("displayFormatter",(i,n,a)=>i==null?"":String(i))(s,t,this._data.getRowByIndex(e))}writeCell(e,t,s){this._mutation.writeCell(e,t,s)}getRowAt(e){return this._data.getRowByIndex(e)}getFlatRowModel(){return this._flatModel}beginBatch(){this._mutation.beginBatch()}endBatch(){this._mutation.endBatch()}setCellFormula(e,t,s){this._formula.setCellFormula(e,t,s)}getCellFormula(e,t){return this._formula.getCellFormula(e,t)}hasCellFormula(e,t){return this._formula.hasCellFormula(e,t)}clearCellFormula(e,t){this._formula.clearCellFormula(e,t)}getCellError(e,t){return this._formula.getCellError(e,t)}getDependents(e,t){return this._formula.getDependents(e,t)}getPrecedents(e,t){return this._formula.getPrecedents(e,t)}recalculate(){this._formula.recalculate()}recalculateCell(e,t){this._formula.recalculateCell(e,t)}offsetFormula(e,t,s,o){return this._formula.offsetFormula(e,t,s,o)}writeCells(e){return this._mutation.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,t,s="copy"){this._rangeMgr.fillRange(e,t,s)}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}getAllColumnDefs(){return this._colLayout.leaves}getColumnCount(){return this._colLayout.visibleLeaves.length}applyColumns(e){const t=this._trigMgr.mkCtx("applyColumns",[e]);this._trigMgr.exec("before:applyColumns",t)&&(this._colLayout.setColumns(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange()),t.result={columnCount:e.length},this._trigMgr.exec("after:applyColumns",t))}insertColumn(e,t){this._colLayout.addColumn(e,t),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}deleteColumn(e){this._colLayout.removeColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._formula.afterRecalc(this._recalc.invalidateField(e),{skipRender:!0}),this._renderHeader(),this._doRender(...this._visRange())}_reorderColumn(e,t){var n,a;const s=this._colLayout.visibleLeaves.map(l=>l);if(e<0||t<0||e>=s.length||t>=s.length)return;const o=[...this._options.columns],[i]=o.splice(e,1);o.splice(t,0,i),this._options.columns=o,this.applyColumns(o),(a=(n=this._options).onColumnReorder)==null||a.call(n,{fromIndex:e,toIndex:t,field:i.field??""})}hideColumn(e){this._colLayout.hideColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}showColumn(e){this._colLayout.showColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}getColumnIndex(e){return this._colLayout.getColumnIndex(e)}getFieldAt(e){var t;return((t=this._colLayout.getColumnByIndex(e))==null?void 0:t.field)??""}getColValues(e,t=!1){return this._data.getData().map(s=>s[e])}getUniqueValues(e,t=!1){return[...new Set(this.getColValues(e,t))]}setColWidths(e){}calcColWidths(e=!1){return[]}getSelections(){return this._rowMgr.getSelections()}getActiveRow(){return this._rowMgr.getActiveRow()}activate(e){this._rowMgr.activate(e),this._doRender(...this._visRange())}deselect(){this._rowMgr.deselect(),this._doRender(...this._visRange())}getChecked(){return this._rowMgr.getChecked()}getAllChecked(){return this._rowMgr.getAllChecked()}checkById(e){}addCheckById(e){}checkByValue(e,t){this._rowMgr.checkByValue(e,t),this._doRender(...this._visRange())}uncheckById(e){}uncheckAll(){this._rowMgr.uncheckAll(),this._doRender(...this._visRange())}orderBy(e,t="asc"){const s=this._trigMgr.mkCtx("orderBy",[e,t]);this._trigMgr.exec("before:orderBy",s)&&(this._sfMgr.sort(e,t),this._recalcRangeBearingFormulas(),s.result={sortList:this._sfMgr.sortList},this._trigMgr.exec("after:orderBy",s))}resetOrder(){this._sfMgr.resetSort(),this._recalcRangeBearingFormulas()}setFilter(e,t){const s=this._trigMgr.mkCtx("setFilter",[e,t]);this._trigMgr.exec("before:setFilter",s)&&(this._sfMgr.setFilter(e,t),this._recalcRangeBearingFormulas(),s.result={field:e,filteredCount:this._data.rowCount},this._trigMgr.exec("after:setFilter",s))}resetFilter(e){this._sfMgr.resetFilter(e),this._recalcRangeBearingFormulas()}_recalcRangeBearingFormulas(){this._formula.recalcRangeBearingFormulas()}getFilterState(){return this._sfMgr.getFilterState()}restoreFilter(e){this._sfMgr.restoreFilter(e)}_applyFilters(){this._sfMgr.applyFilters()}freeze(e){this._colLayout.setFrozen(e),this._renderHeader(),this._doRender(...this._visRange())}mergeCells(e){this._mergeEngine.applyMergeCells(e),this._doRender(...this._visRange())}autoMerge(e){const t=this._colLayout.visibleLeaves,s=[],o=[];for(const i of e){const n=t.findIndex(a=>a.field===i);n>=0&&(s.push(n),o.push(i))}this._mergeEngine.applyAutoMerge(this._data.getData(),s,o),this._doRender(...this._visRange())}clearMerge(){this._mergeEngine.clear(),this._doRender(...this._visRange())}freezeRows(e){}groupBy(e){const t=this._trigMgr.mkCtx("groupBy",[e]);this._trigMgr.exec("before:groupBy",t)&&(this._grpMgr.groupBy(e),t.result={fields:e},this._trigMgr.exec("after:groupBy",t))}clearGroup(){this._grpMgr.clearGroup()}expandAll(){this._grpMgr.expandAll()}collapseAll(){this._grpMgr.collapseAll()}enableTree(){this._grpMgr.enableTree()}disableTree(){this._grpMgr.disableTree()}expandNodes(e,t=!0){this._grpMgr.expandNodes(e,t)}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,t,s){}exportExcel(e){this._exportMgr.exportExcel(e)}exportCsv(e){this._exportMgr.exportCsv(e)}exportJson(e){this._exportMgr.exportJson(e)}print(e){this._exportMgr.print(e)}toArray(e=!0){const t=this._data.getData();if(e)return t;const s=this._colLayout.visibleLeaves;return t.map(o=>s.map(i=>o[i.field]))}jumpToRow(e){var t;this._rowMgr.selectSingle(e),(t=this._vs)==null||t.scrollToRow(e),this._doRender(...this._visRange())}jumpToCol(e){}getScrollPos(){var e,t;return{x:((e=this._renderer)==null?void 0:e.bodyWrapper.scrollLeft)??0,y:((t=this._renderer)==null?void 0:t.bodyWrapper.scrollTop)??0}}setFooter(e){this._options.footer=e,this._renderFooterEl()}getFooterData(){return this._footerMgr.computeValues()}getFooterValue(e){var t;return((t=this._footerMgr.computeValues().find(s=>s._field===e))==null?void 0:t._value)??null}_renderFooterEl(){this._footerMgr.render()}resize(e,t){e&&(this._container.style.width=`${e}px`),t&&(this._container.style.height=`${t}px`),this._onResize()}setTheme(e){this._container.setAttribute("data-og-theme",e)}setThemeVar(e,t){this._container.style.setProperty(e,t)}setSkin(e){var t;this._options.skin=e,this._container.setAttribute("data-og-skin",e),(t=this._appearance)==null||t.setSkin(e),this._container.style.border=e==="default"?"1px solid var(--og-border-color, #e0e0e0)":this._appearance?this._appearance.border():"1px solid var(--og-border-color, #e0e0e0)",this._renderHeader(),this._doRender(...this._visRange())}getSkin(){return this._options.skin??"default"}setIcon(e,t){var s;this._icons||(this._icons=xe.child()),this._icons.register(e,t);try{(s=this._extensions)==null||s.strategy("iconResolver",(o,i)=>this._icons.render(o,i))}catch{}return this}renderIcon(e,t){return(this._icons??xe).render(e,t)}setSkinVar(e,t){if(/#[0-9a-fA-F]{3,8}\b/.test(t)||/\b(?:rgba?|hsla?)\(\s*\d/.test(t))throw new Error(`[OpenGrid.setSkinVar] "${e}: ${t}" 에 색 리터럴 — 색은 setThemeVar 축입니다(색⊥형태).`);this._container.style.setProperty(e,t)}addTrigger(e,t){return this._trigMgr.add(e,t),this}removeTrigger(e,t){return this._trigMgr.remove(e,t),this}clearTriggers(e){return this._trigMgr.clear(e),this}_mkCtx(e,t){return this._trigMgr.mkCtx(e,t)}_trig(e,t){return this._trigMgr.exec(e,t)}destroy(){var e,t,s,o,i,n,a,l,d,c;this._destroyed||(this._destroyed=!0,this._renderer&&We.unregister(this._renderer.bodyWrapper),this._trigMgr.clear(),(e=this._ro)==null||e.disconnect(),(t=this._vs)==null||t.destroy(),(s=this._chartMgr)==null||s.destroyCharts(),(o=this._detailMgr)==null||o.destroy(),(i=this._filterPanel)==null||i.destroy(),(n=this._dnd)==null||n.destroy(),this._cmHandler&&this._container.removeEventListener("contextmenu",this._cmHandler),this._cmKbdHandler&&this._container.removeEventListener("keydown",this._cmKbdHandler),this._cmHandler=this._cmKbdHandler=null,(a=this._ctxMenu)==null||a.destroy(),(l=this._wsManager)==null||l.destroy(),(d=this._renderer)==null||d.destroy(),(c=this._liveRegion)==null||c.remove(),this._liveRegion=null,this._container.innerHTML="",this._container.classList.remove("og-container"),this.removeAllListeners())}};X._defaultOverrides=[],X._defaultStrategies=[],X.defaults={strategy(e,t){return X._defaultStrategies.push([e,t]),X}};let ht=X;exports.DEFAULT_ICON_ROLES=es;exports.IconRegistry=je;exports.OpenGrid=ht;exports.SkinRegistry=ns;exports.buildTree=at;exports.iconRegistry=xe;exports.renderIcon=Ws;exports.skinRegistry=pt;
|
|
97
|
-
//# sourceMappingURL=OpenGrid-LcZ5iixx.cjs.map
|