From 479cc21d0b51090b4c752b79c6ca4594d1229842 Mon Sep 17 00:00:00 2001 From: Rinjae Date: Fri, 5 Dec 2025 18:06:04 +0900 Subject: [PATCH 1/4] =?UTF-8?q?sysout=20checkstyle=20=ED=95=B4=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/checkstyle/checkstyle.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 22e595a..48c1a43 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -6,12 +6,12 @@ - - - - - - + + + + + + From c31123973dd81b572eaaa8d8c988460b99c66834 Mon Sep 17 00:00:00 2001 From: daekuk Date: Mon, 8 Dec 2025 11:18:00 +0900 Subject: [PATCH 2/4] =?UTF-8?q?System.out.print=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EB=98=90=EB=8A=94=20=EB=94=94=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EB=A1=9C=EA=B7=B8=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/TransactionBAPServiceImpl.java | 3 +- .../work/inst/BapSystemInstService.java | 3 +- .../rms/ext/kakaocard/cm/TempController.java | 2 +- .../onl/adapter/info/AdapterInfosManager.java | 6 +-- .../controller/ModernDashboardController.java | 20 ++++----- .../modern/mapper/SmsNotificationMapper.java | 42 ++++++++++++++----- 6 files changed, 47 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/eactive/eai/rms/bap/loader/service/TransactionBAPServiceImpl.java b/src/main/java/com/eactive/eai/rms/bap/loader/service/TransactionBAPServiceImpl.java index 3a80f53..1fdab8c 100644 --- a/src/main/java/com/eactive/eai/rms/bap/loader/service/TransactionBAPServiceImpl.java +++ b/src/main/java/com/eactive/eai/rms/bap/loader/service/TransactionBAPServiceImpl.java @@ -657,7 +657,8 @@ public class TransactionBAPServiceImpl extends BaseService implements Transactio mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); String json = mapper.writeValueAsString(interfaceDeploy); - System.out.println(json); +// System.out.println(json); + logger.debug(json); FileWriteUtil.FileWrite(path , fileName+".txt", json, "UTF-8"); } diff --git a/src/main/java/com/eactive/eai/rms/bap/manage/work/inst/BapSystemInstService.java b/src/main/java/com/eactive/eai/rms/bap/manage/work/inst/BapSystemInstService.java index 3ec16e5..63082a0 100644 --- a/src/main/java/com/eactive/eai/rms/bap/manage/work/inst/BapSystemInstService.java +++ b/src/main/java/com/eactive/eai/rms/bap/manage/work/inst/BapSystemInstService.java @@ -60,7 +60,8 @@ public class BapSystemInstService extends BapBaseService { List> sysConnList = dao.selectDetailSysconn(param); HashMap map = new HashMap(); - System.out.println( "list-->" + list.size()); +// System.out.println( "list-->" + list.size()); + logger.debug( "list-->" + list.size()); map.put("detail", detail); map.put("rows", list); map.put("sysConnList", sysConnList); diff --git a/src/main/java/com/eactive/eai/rms/ext/kakaocard/cm/TempController.java b/src/main/java/com/eactive/eai/rms/ext/kakaocard/cm/TempController.java index 915cf5e..a93d396 100644 --- a/src/main/java/com/eactive/eai/rms/ext/kakaocard/cm/TempController.java +++ b/src/main/java/com/eactive/eai/rms/ext/kakaocard/cm/TempController.java @@ -199,7 +199,7 @@ public class TempController implements InterceptorSkipController { result = "success"; } catch (Exception e) { - System.out.println(e); +// System.out.println(e); result = e.getMessage(); } diff --git a/src/main/java/com/eactive/eai/rms/onl/adapter/info/AdapterInfosManager.java b/src/main/java/com/eactive/eai/rms/onl/adapter/info/AdapterInfosManager.java index 223c151..5822d5c 100644 --- a/src/main/java/com/eactive/eai/rms/onl/adapter/info/AdapterInfosManager.java +++ b/src/main/java/com/eactive/eai/rms/onl/adapter/info/AdapterInfosManager.java @@ -191,13 +191,13 @@ public class AdapterInfosManager { public String toString() { - System.out.println("---------------- Display START -------------------"); +// System.out.println("---------------- Display START -------------------"); Collection coll = AdapterInfosManager.adaptersMap.values(); Iterator iter = coll.iterator(); while (iter.hasNext()) { AdapterInfosVO tempVO = iter.next(); - System.out.println(tempVO.toString()); +// System.out.println(tempVO.toString()); } return new String("---------------- Display END -------------------" ); @@ -254,7 +254,7 @@ public class AdapterInfosManager { + "\n AND B.PRPTYGROUPNAME = TAB5.PRPTYGROUPNAME " + "\n ORDER BY 1, 3, 4 " + "\n WITH UR"; - System.out.println(SqlString); +// System.out.println(SqlString); return SqlString; } diff --git a/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/controller/ModernDashboardController.java b/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/controller/ModernDashboardController.java index 3b17bb6..79b7f09 100644 --- a/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/controller/ModernDashboardController.java +++ b/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/controller/ModernDashboardController.java @@ -223,10 +223,6 @@ public class ModernDashboardController implements InterceptorSkipController { @RequestMapping(path = "/modern-dashboard-api.do", params = "type=adapter-status") @ResponseBody public Map getAdapterStatus(@RequestParam(required = false) String serverName) { - // TODO: 디버그 완료 후 삭제 - System.out.println("========================================"); - System.out.println("[Dashboard Debug] getAdapterStatus API CALLED!"); - System.out.println("========================================"); log.error("[Dashboard Debug] getAdapterStatus API CALLED - serverName: " + serverName); Map response = new HashMap<>(); @@ -254,26 +250,26 @@ public class ModernDashboardController implements InterceptorSkipController { // TODO: 디버그 완료 후 아래 디버그 로그 전체 삭제 (라인 254-299) // [Dashboard Debug] Check server list size - System.out.println("[Dashboard Debug] getAdapterStatus: Found " + (servers == null ? 0 : servers.size()) + " servers to check."); +// System.out.println("[Dashboard Debug] getAdapterStatus: Found " + (servers == null ? 0 : servers.size()) + " servers to check."); log.error("[Dashboard Debug] getAdapterStatus: Found " + (servers == null ? 0 : servers.size()) + " servers to check."); List> serverAdapters = new ArrayList<>(); for (DataSourceType server : servers) { - System.out.println("[Dashboard Debug] Loop for server: " + server.getName()); +// System.out.println("[Dashboard Debug] Loop for server: " + server.getName()); log.error("[Dashboard Debug] Loop for server: " + server.getName()); // 서버 컨텍스트 설정 DataSourceContextHolder.setDataSourceType(server); // 서버에 대한 인스턴스 목록 조회 - System.out.println("[Dashboard Debug] Calling getEaiServerIpListDB..."); +// System.out.println("[Dashboard Debug] Calling getEaiServerIpListDB..."); List> ipList = eaiServerInfoService.getEaiServerIpListDB(); - System.out.println("[Dashboard Debug] Call to getEaiServerIpListDB finished. IP list size: " + (ipList == null ? 0 : ipList.size())); +// System.out.println("[Dashboard Debug] Call to getEaiServerIpListDB finished. IP list size: " + (ipList == null ? 0 : ipList.size())); log.error("[Dashboard Debug] Call to getEaiServerIpListDB finished. IP list size: " + (ipList == null ? 0 : ipList.size())); // 어댑터 상태 목록 조회 (개별 인스턴스별 상태) List adaptersList = dashboardService.findAdapterStatusList(ipList); - System.out.println("[Dashboard Debug] adaptersList size: " + (adaptersList == null ? "null" : adaptersList.size())); +// System.out.println("[Dashboard Debug] adaptersList size: " + (adaptersList == null ? "null" : adaptersList.size())); log.error("[Dashboard Debug] adaptersList size: " + (adaptersList == null ? "null" : adaptersList.size())); // 어댑터별 상태 코드 로깅 @@ -288,7 +284,7 @@ public class ModernDashboardController implements InterceptorSkipController { ", Socket counts: [" + vo.getSocket(0) + "," + vo.getSocket(1) + "," + vo.getSocket(2) + "]" + ", Socket2 counts: [" + vo.getSocket2(0) + "," + vo.getSocket2(1) + "," + vo.getSocket2(2) + "]" + ", Http counts: [" + vo.getHttp(0) + "," + vo.getHttp(1) + "," + vo.getHttp(2) + "]"; - System.out.println(debugMsg); +// System.out.println(debugMsg); log.error(debugMsg); } } @@ -305,8 +301,8 @@ public class ModernDashboardController implements InterceptorSkipController { ", normal=" + summaryContainer.getAdapterSummary("HTTP").getNormalCount() + ", inactive=" + summaryContainer.getAdapterSummary("HTTP").getInactiveCount() + ", overall=" + summaryContainer.getAdapterSummary("HTTP").getOverallStatus(); - System.out.println(socketSummary); - System.out.println(httpSummary); +// System.out.println(socketSummary); +// System.out.println(httpSummary); log.error(socketSummary); log.error(httpSummary); // TODO: 여기까지 디버그 로그 삭제 diff --git a/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/mapper/SmsNotificationMapper.java b/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/mapper/SmsNotificationMapper.java index 34ad9df..e65ce4f 100644 --- a/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/mapper/SmsNotificationMapper.java +++ b/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/mapper/SmsNotificationMapper.java @@ -2,6 +2,8 @@ package com.eactive.eai.rms.onl.dashboard.modern.mapper; import com.eactive.eai.rms.onl.dashboard.modern.dto.SmsNotificationDto; import com.eactive.eai.rms.onl.vo.SmsVO; + +import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import java.time.LocalDate; @@ -21,6 +23,9 @@ public class SmsNotificationMapper { private static final Pattern DATE_TIME_PATTERN = Pattern.compile("(\\d{4}) (\\d{2}:\\d{2}:\\d{2}\\.\\d{3})"); private static final Pattern COUNT_PATTERN = Pattern.compile("\\[(\\d+)\\]"); + + // Sysout --> logger + private static final Logger logger = Logger.getLogger(SmsNotificationMapper.class); /** * SmsVO 목록을 SmsNotificationDto 목록으로 변환합니다. @@ -148,22 +153,37 @@ public class SmsNotificationMapper { smsVO.setMessage(messages); List results = mapper.mapToSmsNotificationDtoList(Arrays.asList(smsVO)); - System.out.println("=== SMS 메시지 파싱 결과 ==="); +// System.out.println("=== SMS 메시지 파싱 결과 ==="); + logger.debug("=== SMS 메시지 파싱 결과 ==="); for (SmsNotificationDto dto : results) { - System.out.println("\n[메시지 정보]"); - System.out.println("시간: " + dto.getDateTime()); - System.out.println("건수: " + dto.getCount()); - System.out.println("인스턴스: " + dto.getInstanceName()); - System.out.println("에러내용: " + dto.getErrorContent()); - System.out.println("에러유형: " + dto.getErrorType()); +// System.out.println("\n[메시지 정보]"); +// System.out.println("시간: " + dto.getDateTime()); +// System.out.println("건수: " + dto.getCount()); +// System.out.println("인스턴스: " + dto.getInstanceName()); +// System.out.println("에러내용: " + dto.getErrorContent()); +// System.out.println("에러유형: " + dto.getErrorType()); + + logger.debug("\n[메시지 정보]"); + logger.debug("시간: " + dto.getDateTime()); + logger.debug("건수: " + dto.getCount()); + logger.debug("인스턴스: " + dto.getInstanceName()); + logger.debug("에러내용: " + dto.getErrorContent()); + logger.debug("에러유형: " + dto.getErrorType()); if ("ADAPTER".equals(dto.getErrorType())) { - System.out.println("어댑터설명: " + dto.getAdapterDesc()); - System.out.println("어댑터ID: " + dto.getAdapterId()); +// System.out.println("어댑터설명: " + dto.getAdapterDesc()); +// System.out.println("어댑터ID: " + dto.getAdapterId()); + + logger.debug("어댑터설명: " + dto.getAdapterDesc()); + logger.debug("어댑터ID: " + dto.getAdapterId()); } else { - System.out.println("인터페이스ID: " + dto.getInterfaceId()); +// System.out.println("인터페이스ID: " + dto.getInterfaceId()); + + logger.debug("인터페이스ID: " + dto.getInterfaceId()); } - System.out.println("------------------------"); +// System.out.println("------------------------"); + + logger.debug("------------------------"); } } } \ No newline at end of file From 49e415a3c03d6113c0ebcbe2db77ed2faf388bba Mon Sep 17 00:00:00 2001 From: daekuk Date: Mon, 8 Dec 2025 13:39:12 +0900 Subject: [PATCH 3/4] =?UTF-8?q?apifullpath=20=EC=B9=B4=EB=A9=9C=EC=BC=80?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=20->=20=EC=86=8C=EB=AC=B8=EC=9E=90=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rms/onl/transaction/apim/mapping/ApiInterfaceUIMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eactive/eai/rms/onl/transaction/apim/mapping/ApiInterfaceUIMapper.java b/src/main/java/com/eactive/eai/rms/onl/transaction/apim/mapping/ApiInterfaceUIMapper.java index c933b63..8fbcf12 100644 --- a/src/main/java/com/eactive/eai/rms/onl/transaction/apim/mapping/ApiInterfaceUIMapper.java +++ b/src/main/java/com/eactive/eai/rms/onl/transaction/apim/mapping/ApiInterfaceUIMapper.java @@ -148,7 +148,7 @@ public interface ApiInterfaceUIMapper { @Mapping(target = "eaisendrecv", source = "sendRecvType") @Mapping(target = "eaidirection", source = "inOutType") @Mapping(target = "standardMessageItems", source = "standardMessageItems") - @Mapping(target = "apiFullPath", source = "apiFullPath") + @Mapping(target = "apifullpath", source = "apiFullPath") StandardMessageInfo toStandardMessageInfo(ApiInterfaceUI vo); @AfterMapping From 57fde15597362282e691d4336ea862f6e0c5735c Mon Sep 17 00:00:00 2001 From: Rinjae Date: Mon, 8 Dec 2025 21:23:17 +0900 Subject: [PATCH 4/4] db --- .../addon/ag-grid/ag-grid-community.min.js | 1 + WebContent/addon/ag-grid/ag-grid.min.css | 7 + .../addon/ag-grid/ag-theme-alpine.min.css | 2 + .../addon/monaco/_commonjsHelpers-CT9FvmAN.js | 1 + WebContent/addon/monaco/abap-D-t0cyap.js | 1 + WebContent/addon/monaco/apex-CcIm7xu6.js | 1 + .../monaco/assets/css.worker-HnVq6Ewq.js | 93 + .../monaco/assets/editor.worker-Be8ye1pW.js | 26 + .../monaco/assets/html.worker-B51mlPHg.js | 470 + .../monaco/assets/json.worker-DKiEKt88.js | 58 + .../addon/monaco/assets/ts.worker-CMbG-7ft.js | 67731 ++++++++++++++++ WebContent/addon/monaco/azcli-BA0tQDCg.js | 1 + .../basic-languages/monaco.contribution.js | 1 + WebContent/addon/monaco/bat-C397hTD6.js | 1 + WebContent/addon/monaco/bicep-DF5aW17k.js | 2 + WebContent/addon/monaco/cameligo-plsz8qhj.js | 1 + WebContent/addon/monaco/clojure-Y2auQMzK.js | 1 + WebContent/addon/monaco/coffee-Bu45yuWE.js | 1 + WebContent/addon/monaco/cpp-CkKPQIni.js | 1 + WebContent/addon/monaco/csharp-CX28MZyh.js | 1 + WebContent/addon/monaco/csp-D8uWnyxW.js | 1 + WebContent/addon/monaco/css-CaeNmE3S.js | 3 + WebContent/addon/monaco/cssMode-CjiAH6dQ.js | 1 + WebContent/addon/monaco/cypher-DVThT8BS.js | 1 + WebContent/addon/monaco/dart-CmGfCvrO.js | 1 + .../addon/monaco/dockerfile-CZqqYdch.js | 1 + WebContent/addon/monaco/ecl-30fUercY.js | 1 + .../addon/monaco/editor.api-CalNCsUg.js | 903 + .../addon/monaco/editor/editor.main.css | 1 + WebContent/addon/monaco/editor/editor.main.js | 5 + WebContent/addon/monaco/elixir-xjPaIfzF.js | 1 + WebContent/addon/monaco/flow9-DqtmStfK.js | 1 + .../addon/monaco/freemarker2-Cz_sV6Md.js | 3 + WebContent/addon/monaco/fsharp-BOMdg4U1.js | 1 + WebContent/addon/monaco/go-D_hbi-Jt.js | 1 + WebContent/addon/monaco/graphql-CKUU4kLG.js | 1 + .../addon/monaco/handlebars-OwglfO-1.js | 1 + WebContent/addon/monaco/hcl-DTaboeZW.js | 1 + WebContent/addon/monaco/html-Pa1xEWsY.js | 1 + WebContent/addon/monaco/htmlMode-Bz67EXwp.js | 1 + WebContent/addon/monaco/ini-CsNwO04R.js | 1 + WebContent/addon/monaco/java-CI4ZMsH9.js | 1 + .../addon/monaco/javascript-PczUCGdz.js | 1 + WebContent/addon/monaco/jsonMode-DULH5oaX.js | 7 + WebContent/addon/monaco/julia-BwzEvaQw.js | 1 + WebContent/addon/monaco/kotlin-IUYPiTV8.js | 1 + .../language/css/monaco.contribution.js | 1 + .../language/html/monaco.contribution.js | 1 + .../language/json/monaco.contribution.js | 1 + .../typescript/monaco.contribution.js | 1 + WebContent/addon/monaco/less-C0eDYdqa.js | 2 + WebContent/addon/monaco/lexon-iON-Kj97.js | 1 + WebContent/addon/monaco/liquid-DqKjdPGy.js | 1 + WebContent/addon/monaco/loader.js | 1368 + .../monaco/lspLanguageFeatures-kM9O9rjY.js | 4 + WebContent/addon/monaco/lua-DtygF91M.js | 1 + WebContent/addon/monaco/m3-CsR4AuFi.js | 1 + WebContent/addon/monaco/markdown-C_rD0bIw.js | 1 + WebContent/addon/monaco/mdx-DEWtB1K5.js | 1 + WebContent/addon/monaco/mips-CiYP61RB.js | 1 + .../monaco/monaco.contribution-D2OdxNBt.js | 1 + .../monaco/monaco.contribution-DO3azKX8.js | 1 + .../monaco/monaco.contribution-EcChJV6a.js | 1 + .../monaco/monaco.contribution-qLAYrEOP.js | 1 + WebContent/addon/monaco/msdax-C38-sJlp.js | 1 + WebContent/addon/monaco/mysql-CdtbpvbG.js | 1 + .../addon/monaco/nls.messages-loader.js | 1 + WebContent/addon/monaco/nls.messages.cs.js.js | 17 + WebContent/addon/monaco/nls.messages.de.js.js | 17 + WebContent/addon/monaco/nls.messages.es.js.js | 17 + WebContent/addon/monaco/nls.messages.fr.js.js | 15 + WebContent/addon/monaco/nls.messages.it.js.js | 15 + WebContent/addon/monaco/nls.messages.ja.js.js | 17 + WebContent/addon/monaco/nls.messages.js.js | 10 + WebContent/addon/monaco/nls.messages.ko.js.js | 25 + WebContent/addon/monaco/nls.messages.pl.js.js | 17 + .../addon/monaco/nls.messages.pt-br.js.js | 6 + WebContent/addon/monaco/nls.messages.ru.js.js | 17 + WebContent/addon/monaco/nls.messages.tr.js.js | 15 + .../addon/monaco/nls.messages.zh-cn.js.js | 17 + .../addon/monaco/nls.messages.zh-tw.js.js | 15 + .../addon/monaco/objective-c-CntZFaHX.js | 1 + WebContent/addon/monaco/pascal-r6kuqfl_.js | 1 + WebContent/addon/monaco/pascaligo-BiXoTmXh.js | 1 + WebContent/addon/monaco/perl-DABw_TcH.js | 1 + WebContent/addon/monaco/pgsql-me_jFXeX.js | 1 + WebContent/addon/monaco/php-D_kh-9LK.js | 1 + WebContent/addon/monaco/pla-VfZjczW0.js | 1 + WebContent/addon/monaco/postiats-BBSzz8Pk.js | 1 + .../addon/monaco/powerquery-Dt-g_2cc.js | 1 + .../addon/monaco/powershell-B-7ap1zc.js | 1 + WebContent/addon/monaco/protobuf-BmtuEB1A.js | 2 + WebContent/addon/monaco/pug-BRpRNeEb.js | 1 + WebContent/addon/monaco/python-Cr0UkIbn.js | 1 + WebContent/addon/monaco/qsharp-BzsFaUU9.js | 1 + WebContent/addon/monaco/r-f8dDdrp4.js | 1 + WebContent/addon/monaco/razor-BYAHOTkz.js | 1 + WebContent/addon/monaco/redis-fvZQY4PI.js | 1 + WebContent/addon/monaco/redshift-45Et0LQi.js | 1 + .../addon/monaco/restructuredtext-C7UUFKFD.js | 1 + WebContent/addon/monaco/ruby-CZO8zYTz.js | 1 + WebContent/addon/monaco/rust-Bfetafyc.js | 1 + WebContent/addon/monaco/sb-3GYllVck.js | 1 + WebContent/addon/monaco/scala-foMgrKo1.js | 1 + WebContent/addon/monaco/scheme-CHdMtr7p.js | 1 + WebContent/addon/monaco/scss-C1cmLt9V.js | 3 + WebContent/addon/monaco/shell-ClXCKCEW.js | 1 + WebContent/addon/monaco/solidity-MZ6ExpPy.js | 1 + WebContent/addon/monaco/sophia-DWkuSsPQ.js | 1 + WebContent/addon/monaco/sparql-AUGFYSyk.js | 1 + WebContent/addon/monaco/sql-32GpJSV2.js | 1 + WebContent/addon/monaco/st-CuDFIVZ_.js | 1 + WebContent/addon/monaco/swift-n-2HociN.js | 3 + .../addon/monaco/systemverilog-Ch4vA8Yt.js | 1 + WebContent/addon/monaco/tcl-D74tq1nH.js | 1 + WebContent/addon/monaco/tsMode-CZz1Umrk.js | 11 + WebContent/addon/monaco/twig-C6taOxMV.js | 1 + .../addon/monaco/typescript-DfOrAzoV.js | 1 + WebContent/addon/monaco/typespec-D-PIh9Xw.js | 1 + WebContent/addon/monaco/vb-Dyb2648j.js | 1 + WebContent/addon/monaco/wgsl-BhLXMOR0.js | 298 + WebContent/addon/monaco/workers-DcJshg-q.js | 1 + WebContent/addon/monaco/xml-CdsdnY8S.js | 1 + WebContent/addon/monaco/yaml-DYGvmE88.js | 1 + WebContent/css/dbconsole/dbconsole.css | 702 + WebContent/js/dbconsole/dbconsole-decrypt.js | 114 + WebContent/js/dbconsole/dbconsole.js | 1841 + .../jsp/common/dbconsole/dbConsoleMan.jsp | 254 + .../controller/DbConsoleController.java | 314 + .../common/dbconsole/dto/ColumnInfoDto.java | 81 + .../dbconsole/dto/DatasourceInfoDto.java | 52 + .../common/dbconsole/dto/SqlRequestDto.java | 70 + .../common/dbconsole/dto/SqlResultDto.java | 83 + .../common/dbconsole/dto/TableInfoDto.java | 27 + .../service/DbConsoleDecryptService.java | 139 + .../dbconsole/service/DbConsoleService.java | 1064 + .../rms/data/entity/man/menu/MenuService.java | 2 +- 137 files changed, 76052 insertions(+), 1 deletion(-) create mode 100644 WebContent/addon/ag-grid/ag-grid-community.min.js create mode 100644 WebContent/addon/ag-grid/ag-grid.min.css create mode 100644 WebContent/addon/ag-grid/ag-theme-alpine.min.css create mode 100644 WebContent/addon/monaco/_commonjsHelpers-CT9FvmAN.js create mode 100644 WebContent/addon/monaco/abap-D-t0cyap.js create mode 100644 WebContent/addon/monaco/apex-CcIm7xu6.js create mode 100644 WebContent/addon/monaco/assets/css.worker-HnVq6Ewq.js create mode 100644 WebContent/addon/monaco/assets/editor.worker-Be8ye1pW.js create mode 100644 WebContent/addon/monaco/assets/html.worker-B51mlPHg.js create mode 100644 WebContent/addon/monaco/assets/json.worker-DKiEKt88.js create mode 100644 WebContent/addon/monaco/assets/ts.worker-CMbG-7ft.js create mode 100644 WebContent/addon/monaco/azcli-BA0tQDCg.js create mode 100644 WebContent/addon/monaco/basic-languages/monaco.contribution.js create mode 100644 WebContent/addon/monaco/bat-C397hTD6.js create mode 100644 WebContent/addon/monaco/bicep-DF5aW17k.js create mode 100644 WebContent/addon/monaco/cameligo-plsz8qhj.js create mode 100644 WebContent/addon/monaco/clojure-Y2auQMzK.js create mode 100644 WebContent/addon/monaco/coffee-Bu45yuWE.js create mode 100644 WebContent/addon/monaco/cpp-CkKPQIni.js create mode 100644 WebContent/addon/monaco/csharp-CX28MZyh.js create mode 100644 WebContent/addon/monaco/csp-D8uWnyxW.js create mode 100644 WebContent/addon/monaco/css-CaeNmE3S.js create mode 100644 WebContent/addon/monaco/cssMode-CjiAH6dQ.js create mode 100644 WebContent/addon/monaco/cypher-DVThT8BS.js create mode 100644 WebContent/addon/monaco/dart-CmGfCvrO.js create mode 100644 WebContent/addon/monaco/dockerfile-CZqqYdch.js create mode 100644 WebContent/addon/monaco/ecl-30fUercY.js create mode 100644 WebContent/addon/monaco/editor.api-CalNCsUg.js create mode 100644 WebContent/addon/monaco/editor/editor.main.css create mode 100644 WebContent/addon/monaco/editor/editor.main.js create mode 100644 WebContent/addon/monaco/elixir-xjPaIfzF.js create mode 100644 WebContent/addon/monaco/flow9-DqtmStfK.js create mode 100644 WebContent/addon/monaco/freemarker2-Cz_sV6Md.js create mode 100644 WebContent/addon/monaco/fsharp-BOMdg4U1.js create mode 100644 WebContent/addon/monaco/go-D_hbi-Jt.js create mode 100644 WebContent/addon/monaco/graphql-CKUU4kLG.js create mode 100644 WebContent/addon/monaco/handlebars-OwglfO-1.js create mode 100644 WebContent/addon/monaco/hcl-DTaboeZW.js create mode 100644 WebContent/addon/monaco/html-Pa1xEWsY.js create mode 100644 WebContent/addon/monaco/htmlMode-Bz67EXwp.js create mode 100644 WebContent/addon/monaco/ini-CsNwO04R.js create mode 100644 WebContent/addon/monaco/java-CI4ZMsH9.js create mode 100644 WebContent/addon/monaco/javascript-PczUCGdz.js create mode 100644 WebContent/addon/monaco/jsonMode-DULH5oaX.js create mode 100644 WebContent/addon/monaco/julia-BwzEvaQw.js create mode 100644 WebContent/addon/monaco/kotlin-IUYPiTV8.js create mode 100644 WebContent/addon/monaco/language/css/monaco.contribution.js create mode 100644 WebContent/addon/monaco/language/html/monaco.contribution.js create mode 100644 WebContent/addon/monaco/language/json/monaco.contribution.js create mode 100644 WebContent/addon/monaco/language/typescript/monaco.contribution.js create mode 100644 WebContent/addon/monaco/less-C0eDYdqa.js create mode 100644 WebContent/addon/monaco/lexon-iON-Kj97.js create mode 100644 WebContent/addon/monaco/liquid-DqKjdPGy.js create mode 100644 WebContent/addon/monaco/loader.js create mode 100644 WebContent/addon/monaco/lspLanguageFeatures-kM9O9rjY.js create mode 100644 WebContent/addon/monaco/lua-DtygF91M.js create mode 100644 WebContent/addon/monaco/m3-CsR4AuFi.js create mode 100644 WebContent/addon/monaco/markdown-C_rD0bIw.js create mode 100644 WebContent/addon/monaco/mdx-DEWtB1K5.js create mode 100644 WebContent/addon/monaco/mips-CiYP61RB.js create mode 100644 WebContent/addon/monaco/monaco.contribution-D2OdxNBt.js create mode 100644 WebContent/addon/monaco/monaco.contribution-DO3azKX8.js create mode 100644 WebContent/addon/monaco/monaco.contribution-EcChJV6a.js create mode 100644 WebContent/addon/monaco/monaco.contribution-qLAYrEOP.js create mode 100644 WebContent/addon/monaco/msdax-C38-sJlp.js create mode 100644 WebContent/addon/monaco/mysql-CdtbpvbG.js create mode 100644 WebContent/addon/monaco/nls.messages-loader.js create mode 100644 WebContent/addon/monaco/nls.messages.cs.js.js create mode 100644 WebContent/addon/monaco/nls.messages.de.js.js create mode 100644 WebContent/addon/monaco/nls.messages.es.js.js create mode 100644 WebContent/addon/monaco/nls.messages.fr.js.js create mode 100644 WebContent/addon/monaco/nls.messages.it.js.js create mode 100644 WebContent/addon/monaco/nls.messages.ja.js.js create mode 100644 WebContent/addon/monaco/nls.messages.js.js create mode 100644 WebContent/addon/monaco/nls.messages.ko.js.js create mode 100644 WebContent/addon/monaco/nls.messages.pl.js.js create mode 100644 WebContent/addon/monaco/nls.messages.pt-br.js.js create mode 100644 WebContent/addon/monaco/nls.messages.ru.js.js create mode 100644 WebContent/addon/monaco/nls.messages.tr.js.js create mode 100644 WebContent/addon/monaco/nls.messages.zh-cn.js.js create mode 100644 WebContent/addon/monaco/nls.messages.zh-tw.js.js create mode 100644 WebContent/addon/monaco/objective-c-CntZFaHX.js create mode 100644 WebContent/addon/monaco/pascal-r6kuqfl_.js create mode 100644 WebContent/addon/monaco/pascaligo-BiXoTmXh.js create mode 100644 WebContent/addon/monaco/perl-DABw_TcH.js create mode 100644 WebContent/addon/monaco/pgsql-me_jFXeX.js create mode 100644 WebContent/addon/monaco/php-D_kh-9LK.js create mode 100644 WebContent/addon/monaco/pla-VfZjczW0.js create mode 100644 WebContent/addon/monaco/postiats-BBSzz8Pk.js create mode 100644 WebContent/addon/monaco/powerquery-Dt-g_2cc.js create mode 100644 WebContent/addon/monaco/powershell-B-7ap1zc.js create mode 100644 WebContent/addon/monaco/protobuf-BmtuEB1A.js create mode 100644 WebContent/addon/monaco/pug-BRpRNeEb.js create mode 100644 WebContent/addon/monaco/python-Cr0UkIbn.js create mode 100644 WebContent/addon/monaco/qsharp-BzsFaUU9.js create mode 100644 WebContent/addon/monaco/r-f8dDdrp4.js create mode 100644 WebContent/addon/monaco/razor-BYAHOTkz.js create mode 100644 WebContent/addon/monaco/redis-fvZQY4PI.js create mode 100644 WebContent/addon/monaco/redshift-45Et0LQi.js create mode 100644 WebContent/addon/monaco/restructuredtext-C7UUFKFD.js create mode 100644 WebContent/addon/monaco/ruby-CZO8zYTz.js create mode 100644 WebContent/addon/monaco/rust-Bfetafyc.js create mode 100644 WebContent/addon/monaco/sb-3GYllVck.js create mode 100644 WebContent/addon/monaco/scala-foMgrKo1.js create mode 100644 WebContent/addon/monaco/scheme-CHdMtr7p.js create mode 100644 WebContent/addon/monaco/scss-C1cmLt9V.js create mode 100644 WebContent/addon/monaco/shell-ClXCKCEW.js create mode 100644 WebContent/addon/monaco/solidity-MZ6ExpPy.js create mode 100644 WebContent/addon/monaco/sophia-DWkuSsPQ.js create mode 100644 WebContent/addon/monaco/sparql-AUGFYSyk.js create mode 100644 WebContent/addon/monaco/sql-32GpJSV2.js create mode 100644 WebContent/addon/monaco/st-CuDFIVZ_.js create mode 100644 WebContent/addon/monaco/swift-n-2HociN.js create mode 100644 WebContent/addon/monaco/systemverilog-Ch4vA8Yt.js create mode 100644 WebContent/addon/monaco/tcl-D74tq1nH.js create mode 100644 WebContent/addon/monaco/tsMode-CZz1Umrk.js create mode 100644 WebContent/addon/monaco/twig-C6taOxMV.js create mode 100644 WebContent/addon/monaco/typescript-DfOrAzoV.js create mode 100644 WebContent/addon/monaco/typespec-D-PIh9Xw.js create mode 100644 WebContent/addon/monaco/vb-Dyb2648j.js create mode 100644 WebContent/addon/monaco/wgsl-BhLXMOR0.js create mode 100644 WebContent/addon/monaco/workers-DcJshg-q.js create mode 100644 WebContent/addon/monaco/xml-CdsdnY8S.js create mode 100644 WebContent/addon/monaco/yaml-DYGvmE88.js create mode 100644 WebContent/css/dbconsole/dbconsole.css create mode 100644 WebContent/js/dbconsole/dbconsole-decrypt.js create mode 100644 WebContent/js/dbconsole/dbconsole.js create mode 100644 WebContent/jsp/common/dbconsole/dbConsoleMan.jsp create mode 100644 src/main/java/com/eactive/eai/rms/common/dbconsole/controller/DbConsoleController.java create mode 100644 src/main/java/com/eactive/eai/rms/common/dbconsole/dto/ColumnInfoDto.java create mode 100644 src/main/java/com/eactive/eai/rms/common/dbconsole/dto/DatasourceInfoDto.java create mode 100644 src/main/java/com/eactive/eai/rms/common/dbconsole/dto/SqlRequestDto.java create mode 100644 src/main/java/com/eactive/eai/rms/common/dbconsole/dto/SqlResultDto.java create mode 100644 src/main/java/com/eactive/eai/rms/common/dbconsole/dto/TableInfoDto.java create mode 100644 src/main/java/com/eactive/eai/rms/common/dbconsole/service/DbConsoleDecryptService.java create mode 100644 src/main/java/com/eactive/eai/rms/common/dbconsole/service/DbConsoleService.java diff --git a/WebContent/addon/ag-grid/ag-grid-community.min.js b/WebContent/addon/ag-grid/ag-grid-community.min.js new file mode 100644 index 0000000..800a783 --- /dev/null +++ b/WebContent/addon/ag-grid/ag-grid-community.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.agGrid=t():e.agGrid=t()}(self,(function(){return function(){var e={7886:function(e,t,a){var r,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,l={};((e,t)=>{for(var a in t)n(e,a,{get:t[a],enumerable:!0})})(l,{ClientSideRowModelModule:()=>F}),e.exports=(r=l,((e,t,a,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))s.call(e,l)||l===a||n(e,l,{get:()=>t[l],enumerable:!(r=o(t,l))||r.enumerable});return e})(n({},"__esModule",{value:!0}),r));var g=a(3423),c=a(3423),d=a(3423),h=a(3423),u=class{constructor(e,t,a,r,n,o){this.nextId=0,this.rowCountReady=!1,this.allNodesMap={},this.rootNode=e,this.gos=t,this.eventService=a,this.funcColsService=r,this.beans=o,this.selectionService=n,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id="ROOT_NODE_ID",this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterAggFilter=[],this.rootNode.childrenAfterFilter=[]}getCopyOfNodesMap(){return(0,h._cloneObject)(this.allNodesMap)}getRowNode(e){return this.allNodesMap[e]}setRowData(e){if("string"==typeof e)return void(0,h._warnOnce)("rowData must be an array.");this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e);const t=this.rootNode,a=this.rootNode.sibling;t.childrenAfterFilter=null,t.childrenAfterGroup=null,t.childrenAfterAggFilter=null,t.childrenAfterSort=null,t.childrenMapped=null,t.updateHasChildren(),this.nextId=0,this.allNodesMap={},e?t.allLeafChildren=e.map(((e,t)=>this.createNode(e,this.rootNode,0,t))):(t.allLeafChildren=[],t.childrenAfterGroup=[]),a&&(a.childrenAfterFilter=t.childrenAfterFilter,a.childrenAfterGroup=t.childrenAfterGroup,a.childrenAfterAggFilter=t.childrenAfterAggFilter,a.childrenAfterSort=t.childrenAfterSort,a.childrenMapped=t.childrenMapped,a.allLeafChildren=t.allLeafChildren)}updateRowData(e){this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e.add);const t={rowNodeTransaction:{remove:[],update:[],add:[]},rowsInserted:!1},a=[];return this.executeRemove(e,t,a),this.executeUpdate(e,t,a),this.executeAdd(e,t),this.updateSelection(a,"rowDataChanged"),t}updateRowOrderFromRowData(e){const t=this.rootNode.allLeafChildren,a=t?.length??0,r=new Map;let n=-1,o=-1;for(let i=0;i0;a&&this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,source:t}),this.selectionService.updateGroupsFromChildrenSelections(t),a&&this.eventService.dispatchEvent({type:"selectionChanged",source:t})}executeAdd(e,t){const a=e.add;if((0,h._missingOrEmpty)(a))return;const r=this.rootNode.allLeafChildren;let n=r.length;if("number"==typeof e.addIndex&&(n=this.sanitizeAddIndex(e.addIndex),n>0)){if(this.gos.get("treeData"))for(let e=0;ethis.createNode(e,this.rootNode,0,n+t)));if(n=t||Number.isNaN(e)?t:Math.ceil(e)}executeRemove(e,{rowNodeTransaction:t},a){const{remove:r}=e;if((0,h._missingOrEmpty)(r))return;const n={};r.forEach((e=>{const r=this.lookupRowNode(e);r&&(r.isSelected()&&a.push(r),r.clearRowTopAndRowIndex(),n[r.id]=!0,delete this.allNodesMap[r.id],t.remove.push(r))})),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren?.filter((e=>!n[e.id]))??null,this.rootNode.allLeafChildren?.forEach(((e,t)=>{e.sourceRowIndex=t}));const o=this.rootNode.sibling;o&&(o.allLeafChildren=this.rootNode.allLeafChildren)}executeUpdate(e,{rowNodeTransaction:t},a){const{update:r}=e;(0,h._missingOrEmpty)(r)||r.forEach((e=>{const r=this.lookupRowNode(e);r&&(r.updateData(e),!r.selectable&&r.isSelected()&&a.push(r),this.setMasterForRow(r,e,0,!1),t.update.push(r))}))}lookupRowNode(e){const t=(0,h._getRowIdCallback)(this.gos);let a;if(t){const r=t({data:e,level:0});if(a=this.allNodesMap[r],!a)return(0,h._errorOnce)(`could not find row id=${r}, data item was not found for this id`),null}else if(a=this.rootNode.allLeafChildren?.find((t=>t.data===e)),!a)return(0,h._errorOnce)("could not find data item as object was not found",e),(0,h._errorOnce)("Consider using getRowId to help the Grid find matching row data"),null;return a||null}createNode(e,t,a,r){const n=new h.RowNode(this.beans);return n.sourceRowIndex=r,n.group=!1,this.setMasterForRow(n,e,a,!0),t&&(n.parent=t),n.level=a,n.setDataAndId(e,this.nextId.toString()),this.allNodesMap[n.id]&&(0,h._warnOnce)(`duplicate node id '${n.id}' detected from getRowId callback, this could cause issues in your grid.`),this.allNodesMap[n.id]=n,this.nextId++,n}setMasterForRow(e,t,a,r){if(this.gos.get("treeData"))e.setMaster(!1),r&&(e.expanded=!1);else{if(this.gos.get("masterDetail")){const a=this.gos.get("isRowMaster");a?e.setMaster(a(t)):e.setMaster(!0)}else e.setMaster(!1);if(r){const t=this.funcColsService.getRowGroupColumns(),r=a+(t?t.length:0);e.expanded=!!e.master&&this.isExpanded(r)}}}isExpanded(e){const t=this.gos.get("groupDefaultExpanded");return-1===t||e{const g=l.changeSet?.properties;if(!g)return;const c=e=>g.some((t=>e.has(t)));c(e)?this.setRowData(this.rootNode.allLeafChildren.map((e=>e.data))):c(t)?this.refreshModel({step:d.ClientSideRowModelSteps.EVERYTHING}):c(a)?this.refreshModel({step:d.ClientSideRowModelSteps.FILTER}):c(r)?this.refreshModel({step:d.ClientSideRowModelSteps.PIVOT}):c(n)?this.refreshModel({step:d.ClientSideRowModelSteps.AGGREGATE}):c(o)?this.refreshModel({step:d.ClientSideRowModelSteps.SORT}):c(i)?this.refreshModel({step:d.ClientSideRowModelSteps.FILTER_AGGREGATES}):c(s)&&this.refreshModel({step:d.ClientSideRowModelSteps.MAP})})),this.addManagedPropertyListener("rowHeight",(()=>this.resetRowHeights()))}start(){this.hasStarted=!0,this.shouldSkipSettingDataOnStart?this.dispatchUpdateEventsAndRefresh():this.setInitialData()}setInitialData(){const e=this.gos.get("rowData");e&&(this.shouldSkipSettingDataOnStart=!0,this.setRowData(e))}ensureRowHeightsValid(e,t,a,r){let n,o=!1;do{n=!1;const i=this.getRowIndexAtPixel(e),s=this.getRowIndexAtPixel(t),l=Math.max(i,a),g=Math.min(s,r);for(let e=l;e<=g;e++){const t=this.getRow(e);if(t.rowHeightEstimated){const e=(0,d._getRowHeightForNode)(this.gos,t);t.setRowHeight(e.height),n=!0,o=!0}}n&&this.setRowTopAndRowIndex()}while(n);return o}setRowTopAndRowIndex(){const e=this.environment.getDefaultRowHeight();let t=0;const a=new Set,r=(0,d._isDomLayout)(this.gos,"normal");for(let n=0;n{e&&null!=e.id&&!t.has(e.id)&&e.clearRowTopAndRowIndex()},n=e=>{if(r(e),r(e.detailNode),r(e.sibling),e.hasChildren()&&e.childrenAfterGroup){const t=-1==e.level;a&&!t&&!e.expanded||e.childrenAfterGroup.forEach(n)}};n(this.rootNode)}ensureRowsAtPixel(e,t,a=0){const r=this.getRowIndexAtPixel(t),n=this.getRow(r),o=!this.gos.get("suppressAnimationFrame");if(n===e[0])return!1;const i=this.rootNode.allLeafChildren;return e.forEach((e=>{(0,d._removeFromArray)(i,e)})),e.forEach(((e,t)=>{(0,d._insertIntoArray)(i,e,Math.max(r+a,0)+t)})),e.forEach(((e,t)=>{e.sourceRowIndex=t})),this.refreshModel({step:d.ClientSideRowModelSteps.EVERYTHING,keepRenderedRows:!0,keepEditingRows:!0,animate:o,rowNodesOrderChanged:!0}),!0}highlightRowAtPixel(e,t){const a=null!=t?this.getRowIndexAtPixel(t):null,r=null!=a?this.getRow(a):null;if(!r||!e||null==t)return void this.clearHighlightedRow();const n=this.getHighlightPosition(t,r),o=this.isHighlightingCurrentPosition(e,r,n),i=null!=this.lastHighlightedRow&&this.lastHighlightedRow!==r;(o||i)&&(this.clearHighlightedRow(),o)||(r.setHighlighted(n),this.lastHighlightedRow=r)}getHighlightPosition(e,t){if(!t){const a=this.getRowIndexAtPixel(e);if(!(t=this.getRow(a||0)))return d.RowHighlightPosition.Below}const{rowTop:a,rowHeight:r}=t;return e-a=this.rootNode.childrenAfterSort.length;if(a.footer&&r)return a.rowIndex;let n=this.rootNode.childrenAfterSort[t];if(this.gos.get("groupHideOpenParents"))for(;n.expanded&&n.childrenAfterSort&&n.childrenAfterSort.length>0;)n=n.childrenAfterSort[0];return n.rowIndex}getRowBounds(e){if((0,d._missing)(this.rowsToDisplay))return null;const t=this.rowsToDisplay[e];return t?{rowTop:t.rowTop,rowHeight:t.rowHeight}:null}onRowGroupOpened(){const e=(0,d._isAnimateRows)(this.gos);this.refreshModel({step:d.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:e})}onFilterChanged(e){if(e.afterDataChange)return;const t=(0,d._isAnimateRows)(this.gos),a=0===e.columns.length||e.columns.some((e=>e.isPrimary()))?d.ClientSideRowModelSteps.FILTER:d.ClientSideRowModelSteps.FILTER_AGGREGATES;this.refreshModel({step:a,keepRenderedRows:!0,animate:t})}onSortChanged(){const e=(0,d._isAnimateRows)(this.gos);this.refreshModel({step:d.ClientSideRowModelSteps.SORT,keepRenderedRows:!0,animate:e,keepEditingRows:!0})}getType(){return"clientSide"}onValueChanged(){this.columnModel.isPivotActive()?this.refreshModel({step:d.ClientSideRowModelSteps.PIVOT}):this.refreshModel({step:d.ClientSideRowModelSteps.AGGREGATE})}createChangePath(e){const t=(0,d._missingOrEmpty)(e),a=new d.ChangedPath(!1,this.rootNode);return t&&a.setInactive(),a}isSuppressModelUpdateAfterUpdateTransaction(e){if(!this.gos.get("suppressModelUpdateAfterUpdateTransaction"))return!1;if(null==e.rowNodeTransactions)return!1;const t=e.rowNodeTransactions.filter((e=>null!=e.add&&e.add.length>0||null!=e.remove&&e.remove.length>0));return null==t||0==t.length}buildRefreshModelParams(e){let t=d.ClientSideRowModelSteps.EVERYTHING;const a={everything:d.ClientSideRowModelSteps.EVERYTHING,group:d.ClientSideRowModelSteps.EVERYTHING,filter:d.ClientSideRowModelSteps.FILTER,map:d.ClientSideRowModelSteps.MAP,aggregate:d.ClientSideRowModelSteps.AGGREGATE,filter_aggregates:d.ClientSideRowModelSteps.FILTER_AGGREGATES,sort:d.ClientSideRowModelSteps.SORT,pivot:d.ClientSideRowModelSteps.PIVOT,nothing:d.ClientSideRowModelSteps.NOTHING};if((0,d._exists)(e)&&(t=a[e]),(0,d._missing)(t))return void(0,d._errorOnce)(`invalid step ${e}, available steps are ${Object.keys(a).join(", ")}`);return{step:t,keepRenderedRows:!0,keepEditingRows:!0,animate:!this.gos.get("suppressAnimationFrame")}}refreshModel(e){if(!this.hasStarted||this.isRefreshingModel||this.columnModel.isChangeEventsDispatching())return;const t="object"==typeof e&&"step"in e?e:this.buildRefreshModelParams(e);if(!t)return;if(this.isSuppressModelUpdateAfterUpdateTransaction(t))return;const a=this.createChangePath(t.rowNodeTransactions);switch(this.isRefreshingModel=!0,t.step){case d.ClientSideRowModelSteps.EVERYTHING:this.doRowGrouping(t.rowNodeTransactions,a,!!t.rowNodesOrderChanged,!!t.afterColumnsChanged);case d.ClientSideRowModelSteps.FILTER:this.doFilter(a);case d.ClientSideRowModelSteps.PIVOT:this.doPivot(a);case d.ClientSideRowModelSteps.AGGREGATE:this.doAggregate(a);case d.ClientSideRowModelSteps.FILTER_AGGREGATES:this.doFilterAggregates(a);case d.ClientSideRowModelSteps.SORT:this.doSort(t.rowNodeTransactions,a);case d.ClientSideRowModelSteps.MAP:this.doRowsToDisplay()}const r=this.setRowTopAndRowIndex();this.clearRowTopAndRowIndex(a,r),this.isRefreshingModel=!1,this.eventService.dispatchEvent({type:"modelUpdated",animate:t.animate,keepRenderedRows:t.keepRenderedRows,newData:t.newData,newPage:!1,keepUndoRedoStack:t.keepUndoRedoStack})}isEmpty(){const e=(0,d._missing)(this.rootNode.allLeafChildren)||0===this.rootNode.allLeafChildren.length;return(0,d._missing)(this.rootNode)||e||!this.columnModel.isReady()}isRowsToRender(){return(0,d._exists)(this.rowsToDisplay)&&this.rowsToDisplay.length>0}getNodesInRangeForSelection(e,t){let a=!1,r=!1;const n=[],o=(0,d._getGroupSelectsDescendants)(this.gos);return this.forEachNodeAfterFilterAndSort((i=>{if(r)return;if(a&&(i===t||i===e)&&(r=!0,i.group&&o))return void n.push(...i.allLeafChildren);if(!a){if(i!==t&&i!==e)return;a=!0}(!i.group||!o)&&n.push(i)})),n}setDatasource(e){(0,d._errorOnce)("should never call setDatasource on clientSideRowController")}getTopLevelNodes(){return this.rootNode?this.rootNode.childrenAfterGroup:null}getRootNode(){return this.rootNode}getRow(e){return this.rowsToDisplay[e]}isRowPresent(e){return this.rowsToDisplay.indexOf(e)>=0}getRowIndexAtPixel(e){if(this.isEmpty()||0===this.rowsToDisplay.length)return-1;let t=0,a=this.rowsToDisplay.length-1;if(e<=0)return 0;if((0,d._last)(this.rowsToDisplay).rowTop<=e)return this.rowsToDisplay.length-1;let r=-1,n=-1;for(;;){const o=Math.floor((t+a)/2),i=this.rowsToDisplay[o];if(this.isRowInPixel(i,e))return o;i.rowTope&&(a=o-1);if(r===t&&n===a)return o;r=t,n=a}}isRowInPixel(e,t){const a=e.rowTop,r=e.rowTop+e.rowHeight;return a<=t&&r>t}forEachLeafNode(e){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach(((t,a)=>e(t,a)))}forEachNode(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterGroup||[]],callback:e,recursionType:0,index:0,includeFooterNodes:t})}forEachNodeAfterFilter(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterAggFilter||[]],callback:e,recursionType:1,index:0,includeFooterNodes:t})}forEachNodeAfterFilterAndSort(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterSort||[]],callback:e,recursionType:2,index:0,includeFooterNodes:t})}forEachPivotNode(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[this.rootNode],callback:e,recursionType:3,index:0,includeFooterNodes:t})}recursivelyWalkNodesAndCallback(e){const{nodes:t,callback:a,recursionType:r,includeFooterNodes:n}=e;let{index:o}=e;const i=e=>{const r=t[0]?.parent;if(!r)return;const i=n&&(0,d._getGrandTotalRow)(this.gos),s=(0,d._getGroupTotalRowCallback)(this.gos),l=n&&s({node:r});r===this.rootNode?i===e&&(r.createFooter(),a(r.sibling,o++)):l===e&&(r.createFooter(),a(r.sibling,o++))};i("top");for(let e=0;e{n&&n.forEach((n=>{const o=()=>{n.expanded=e,r(n.childrenAfterGroup)};if(t){return void((0,d._exists)(n.childrenAfterGroup)&&o())}if(a){return void(!n.leafGroup&&o())}n.group&&o()}))};this.rootNode&&r(this.rootNode.childrenAfterGroup),this.refreshModel({step:d.ClientSideRowModelSteps.MAP}),this.eventService.dispatchEvent({type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"})}doSort(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})}doRowGrouping(e,t,a,r){if(this.groupStage){if(e?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,rowNodesOrderChanged:a,changedPath:t}):this.groupStage.execute({rowNode:this.rootNode,changedPath:t,afterColumnsChanged:r}),(0,d._getGroupSelectsDescendants)(this.gos)){this.selectionService.updateGroupsFromChildrenSelections("rowGroupChanged",t)&&this.eventService.dispatchEvent({type:"selectionChanged",source:"rowGroupChanged"})}}else{const e=this.rootNode,t=e.sibling;e.childrenAfterGroup=e.allLeafChildren,t&&(t.childrenAfterGroup=e.childrenAfterGroup),this.rootNode.updateHasChildren()}this.nodeManager.isRowCountReady()&&(this.rowCountReady=!0,this.eventService.dispatchEventOnce({type:"rowCountReady"}))}doFilter(e){this.filterStage.execute({rowNode:this.rootNode,changedPath:e})}doPivot(e){this.pivotStage?.execute({rowNode:this.rootNode,changedPath:e})}getNodeManager(){return this.nodeManager}getRowNode(e){if("string"==typeof e&&0==e.indexOf(d.RowNode.ID_PREFIX_ROW_GROUP)){let t;return this.forEachNode((a=>{a.id===e&&(t=a)})),t}return this.nodeManager.getRowNode(e)}setRowData(e){this.selectionService.reset("rowDataChanged"),this.nodeManager.setRowData(e),this.hasStarted&&this.dispatchUpdateEventsAndRefresh()}dispatchUpdateEventsAndRefresh(){this.eventService.dispatchEvent({type:"rowDataUpdated"}),this.refreshModel({step:d.ClientSideRowModelSteps.EVERYTHING,newData:!0})}batchUpdateRowData(e,t){if(null==this.applyAsyncTransactionsTimeout){this.rowDataTransactionBatch=[];const e=this.gos.get("asyncTransactionWaitMillis");this.applyAsyncTransactionsTimeout=window.setTimeout((()=>{this.isAlive()&&this.executeBatchUpdateRowData()}),e)}this.rowDataTransactionBatch.push({rowDataTransaction:e,callback:t})}flushAsyncTransactions(){null!=this.applyAsyncTransactionsTimeout&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())}executeBatchUpdateRowData(){this.valueCache.onDataChanged();const e=[],t=[];let a=!1;this.rowDataTransactionBatch?.forEach((r=>{const{rowNodeTransaction:n,rowsInserted:o}=this.nodeManager.updateRowData(r.rowDataTransaction);o&&(a=!0),t.push(n),r.callback&&e.push(r.callback.bind(null,n))})),this.commonUpdateRowData(t,a),e.length>0&&window.setTimeout((()=>{e.forEach((e=>e()))}),0),t.length>0&&this.eventService.dispatchEvent({type:"asyncTransactionsFlushed",results:t}),this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0}updateRowData(e){this.valueCache.onDataChanged();const{rowNodeTransaction:t,rowsInserted:a}=this.nodeManager.updateRowData(e);return this.commonUpdateRowData([t],a),t}afterImmutableDataChange(e,t){this.commonUpdateRowData([e],t)}commonUpdateRowData(e,t){if(!this.hasStarted)return;const a=!this.gos.get("suppressAnimationFrame");this.eventService.dispatchEvent({type:"rowDataUpdated"}),this.refreshModel({step:d.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:e,rowNodesOrderChanged:t,keepRenderedRows:!0,keepEditingRows:!0,animate:a})}doRowsToDisplay(){this.rowsToDisplay=this.flattenStage.execute({rowNode:this.rootNode})}onRowHeightChanged(){this.refreshModel({step:d.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,keepEditingRows:!0,keepUndoRedoStack:!0})}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}resetRowHeights(){const e=this.resetRowHeightsForAllRowNodes();this.rootNode.setRowHeight(this.rootNode.rowHeight,!0),this.rootNode.sibling&&this.rootNode.sibling.setRowHeight(this.rootNode.sibling.rowHeight,!0),e&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let e=!1;return this.forEachNode((t=>{t.setRowHeight(t.rowHeight,!0);const a=t.detailNode;a&&a.setRowHeight(a.rowHeight,!0),t.sibling&&t.sibling.setRowHeight(t.sibling.rowHeight,!0),e=!0})),e}onGridStylesChanges(e){if(e.rowHeightChanged){if(this.columnModel.isAutoRowHeightActive())return;this.resetRowHeights()}}onGridReady(){this.hasStarted||this.setInitialData()}isRowDataLoaded(){return this.rowCountReady}destroy(){super.destroy(),this.clearHighlightedRow()}},m=a(3423);var v=a(3423),f=class extends v.BeanStub{constructor(){super(...arguments),this.beanName="filterStage"}wireBeans(e){this.filterManager=e.filterManager}execute(e){const{changedPath:t}=e;this.filter(t)}filter(e){const t=!!this.filterManager?.isChildFilterPresent();this.filterNodes(t,e)}filterNodes(e,t){const a=(t,a)=>{t.hasChildren()?t.childrenAfterFilter=e&&!a?t.childrenAfterGroup.filter((e=>{const t=e.childrenAfterFilter&&e.childrenAfterFilter.length>0,a=e.data&&this.filterManager.doesRowPassFilter({rowNode:e});return t||a})):t.childrenAfterGroup:t.childrenAfterFilter=t.childrenAfterGroup,t.sibling&&(t.sibling.childrenAfterFilter=t.childrenAfterFilter)};if(this.doingTreeDataFiltering()){const e=(t,r)=>{if(t.childrenAfterGroup)for(let n=0;ne(t,!1);t.executeFromRootNode(r)}else{const e=e=>a(e,!1);t.forEachChangedNodeDepthFirst(e,!0)}}doingTreeDataFiltering(){return this.gos.get("treeData")&&!this.gos.get("excludeChildrenWhenTreeDataFiltering")}},b=a(3423),w=class extends b.BeanStub{constructor(){super(...arguments),this.beanName="flattenStage"}wireBeans(e){this.beans=e,this.columnModel=e.columnModel}execute(e){const t=e.rowNode,a=[],r=this.columnModel.isPivotMode(),n=r&&t.leafGroup,o=n?[t]:t.childrenAfterSort,i=this.getFlattenDetails();this.recursivelyAddToRowsToDisplay(i,o,a,r,0);if(!n&&a.length>0&&i.grandTotalRow){t.createFooter();const e="top"===i.grandTotalRow;this.addRowNodeToRowsToDisplay(i,t.sibling,a,0,e)}return a}getFlattenDetails(){const e=this.gos.get("groupRemoveSingleChildren");return{groupRemoveLowestSingleChildren:!e&&this.gos.get("groupRemoveLowestSingleChildren"),groupRemoveSingleChildren:e,isGroupMultiAutoColumn:(0,b._isGroupMultiAutoColumn)(this.gos),hideOpenParents:this.gos.get("groupHideOpenParents"),grandTotalRow:(0,b._getGrandTotalRow)(this.gos),groupTotalRow:(0,b._getGroupTotalRowCallback)(this.gos)}}recursivelyAddToRowsToDisplay(e,t,a,r,n){if(!(0,b._missingOrEmpty)(t))for(let o=0;othis.onRowDataUpdated())))}isActive(){const e=this.gos.exists("getRowId");return!this.gos.get("resetRowDataOnUpdate")&&e}setRowData(e){const t=this.createTransactionForRowData(e);if(!t)return;const a=this.clientSideRowModel.getNodeManager(),{rowNodeTransaction:r,rowsInserted:n}=a.updateRowData(t);let o=!1;this.gos.get("suppressMaintainUnsortedOrder")||(o=a.updateRowOrderFromRowData(e)),this.clientSideRowModel.afterImmutableDataChange(r,o||n)}createTransactionForRowData(e){if(!(0,C._isClientSideRowModel)(this.gos))return(0,C._errorOnce)("ImmutableService only works with ClientSideRowModel"),null;const t=(0,C._getRowIdCallback)(this.gos);if(null==t)return(0,C._errorOnce)("ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!"),null;const a=this.clientSideRowModel.getNodeManager().getCopyOfNodesMap(),r=[],n=[],o=[];return(0,C._exists)(e)&&e.forEach((e=>{const r=t({data:e,level:0}),i=a[r];if(i){i.data!==e&&n.push(e),a[r]=void 0}else o.push(e)})),(0,C._iterateObject)(a,((e,t)=>{t&&r.push(t.data)})),{remove:r,update:n,add:o}}onRowDataUpdated(){const e=this.gos.get("rowData");e&&(this.isActive()?this.setRowData(e):(this.selectionService.reset("rowDataChanged"),this.clientSideRowModel.setRowData(e)))}},k=a(3423),S=class extends k.BeanStub{constructor(){super(...arguments),this.beanName="sortService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.rowNodeSorter=e.rowNodeSorter,this.showRowGroupColsService=e.showRowGroupColsService}sort(e,t,a,r,n,o){const i=this.gos.get("groupMaintainOrder"),s=this.columnModel.getCols().some((e=>e.isRowGroupActive()));let l={};a&&r&&(l=this.calculateDirtyNodes(r));const g=this.columnModel.isPivotMode(),c=this.gos.getCallback("postSortRows"),d=r=>{this.pullDownGroupDataForHideOpenParents(r.childrenAfterAggFilter,!0);const d=g&&r.leafGroup;if(i&&s&&!r.leafGroup&&!o){const e=this.funcColsService.getRowGroupColumns()?.[r.level+1],t=null===e?.getSort(),a=r.childrenAfterAggFilter.slice(0);if(r.childrenAfterSort&&!t){const e={};r.childrenAfterSort.forEach(((t,a)=>{e[t.id]=a})),a.sort(((t,a)=>(e[t.id]??0)-(e[a.id]??0)))}r.childrenAfterSort=a}else r.childrenAfterSort=!t||d?r.childrenAfterAggFilter.slice(0):a?this.doDeltaSort(r,l,n,e):this.rowNodeSorter.doFullSort(r.childrenAfterAggFilter,e);if(r.sibling&&(r.sibling.childrenAfterSort=r.childrenAfterSort),this.updateChildIndexes(r),c){const e={nodes:r.childrenAfterSort};c(e)}};n&&n.forEachChangedNodeDepthFirst(d),this.updateGroupDataForHideOpenParents(n)}calculateDirtyNodes(e){const t={},a=e=>{e&&e.forEach((e=>t[e.id]=!0))};return e&&e.forEach((e=>{a(e.add),a(e.update),a(e.remove)})),t}doDeltaSort(e,t,a,r){const n=e.childrenAfterAggFilter,o=e.childrenAfterSort;if(!o)return this.rowNodeSorter.doFullSort(n,r);const i={},s=[];n.forEach((e=>{t[e.id]||!a.canSkip(e)?s.push(e):i[e.id]=!0}));const l=o.filter((e=>i[e.id])),g=(e,t)=>({currentPos:t,rowNode:e}),c=s.map(g).sort(((e,t)=>this.rowNodeSorter.compareRowNodes(r,e,t)));return this.mergeSortedArrays(r,c,l.map(g)).map((({rowNode:e})=>e))}mergeSortedArrays(e,t,a){const r=[];let n=0,o=0;for(;n{this.pullDownGroupDataForHideOpenParents(e.childrenAfterSort,!1),e.childrenAfterSort.forEach((e=>{e.hasChildren()&&t(e)}))};e&&e.executeFromRootNode((e=>t(e)))}pullDownGroupDataForHideOpenParents(e,t){this.gos.get("groupHideOpenParents")&&!(0,k._missing)(e)&&e.forEach((e=>{(this.showRowGroupColsService?.getShowRowGroupCols()??[]).forEach((a=>{const r=a.getColDef().showRowGroup;if("string"!=typeof r)return void(0,k._errorOnce)("groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup");const n=r,o=this.columnModel.getColDefCol(n);if(!(o===e.rowGroupColumn))if(t)e.setGroupValue(a.getId(),void 0);else{const t=this.getFirstChildOfFirstChild(e,o);t&&e.setGroupValue(a.getId(),t.key)}}))}))}getFirstChildOfFirstChild(e,t){let a=e;for(;a;){const e=a.parent;if(!e||!a.firstChild)return null;if(e.rowGroupColumn===t)return e;a=e}return null}},x=a(3423),z=class extends x.BeanStub{constructor(){super(...arguments),this.beanName="sortStage"}wireBeans(e){this.sortService=e.sortService,this.sortController=e.sortController}execute(e){const t=this.sortController.getSortOptions(),a=(0,x._exists)(t)&&t.length>0,r=a&&(0,x._exists)(e.rowNodeTransactions)&&this.gos.get("deltaSort"),n=t.some((e=>(0,x._isColumnsSortingCoupledToGroup)(this.gos)?e.column.isPrimary()&&e.column.isRowGroupActive():!!e.column.getColDef().showRowGroup));this.sortService.sort(t,a,r,e.rowNodeTransactions,e.changedPath,n)}},E="32.3.2",R=(0,g._defineModule)({version:E,moduleName:`${c.ModuleNames.ClientSideRowModelModule}-core`,rowModel:"clientSide",beans:[p,f,z,w,S,y]}),M=(0,g._defineModule)({version:E,moduleName:`${c.ModuleNames.ClientSideRowModelModule}-api`,beans:[c.RowModelHelperService],apiFunctions:{onGroupExpandedOrCollapsed:function(e){e.expansionService.onGroupExpandedOrCollapsed()},refreshClientSideRowModel:function(e,t){e.rowModelHelperService?.getClientSideRowModel()?.refreshModel(t)},isRowDataEmpty:function(e){return e.rowModelHelperService?.getClientSideRowModel()?.isEmpty()??!0},forEachLeafNode:function(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachLeafNode(t)},forEachNodeAfterFilter:function(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachNodeAfterFilter(t)},forEachNodeAfterFilterAndSort:function(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachNodeAfterFilterAndSort(t)},resetRowHeights:function(e){e.columnModel.isAutoRowHeightActive()?(0,m._warnOnce)("calling gridApi.resetRowHeights() makes no sense when using Auto Row Height."):e.rowModelHelperService?.getClientSideRowModel()?.resetRowHeights()},applyTransaction:function(e,t){return e.frameworkOverrides.wrapIncoming((()=>e.rowModelHelperService?.getClientSideRowModel()?.updateRowData(t)))},applyTransactionAsync:function(e,t,a){e.frameworkOverrides.wrapIncoming((()=>e.rowModelHelperService?.getClientSideRowModel()?.batchUpdateRowData(t,a)))},flushAsyncTransactions:function(e){e.frameworkOverrides.wrapIncoming((()=>e.rowModelHelperService?.getClientSideRowModel()?.flushAsyncTransactions()))},getBestCostNodeSelection:function(e){return e.selectionService.getBestCostNodeSelection()}},dependantModules:[R,c._CsrmSsrmSharedApiModule]}),F=(0,g._defineModule)({version:E,moduleName:c.ModuleNames.ClientSideRowModelModule,dependantModules:[R,M]})},3423:function(e,t,a){var r,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,l={};((e,t)=>{for(var a in t)n(e,a,{get:t[a],enumerable:!0})})(l,{ALWAYS_SYNC_GLOBAL_EVENTS:()=>Lc,AbstractHeaderCellCtrl:()=>di,AgAbstractField:()=>an,AgAbstractInputField:()=>rn,AgAbstractLabel:()=>tn,AgCheckbox:()=>nn,AgCheckboxSelector:()=>on,AgColumn:()=>ft,AgColumnGroup:()=>Vt,AgInputDateField:()=>Nl,AgInputNumberField:()=>To,AgInputNumberFieldSelector:()=>Io,AgInputTextArea:()=>Rl,AgInputTextField:()=>Ao,AgInputTextFieldSelector:()=>Po,AgPickerField:()=>So,AgPromise:()=>bn,AgProvidedColumnGroup:()=>Qe,AgRadioButton:()=>yo,AgSelect:()=>xo,AgSelectSelector:()=>zo,AgToggleButton:()=>ug,AgToggleButtonSelector:()=>pg,AnimateShowChangeCellRenderer:()=>Xr,AnimateSlideCellRenderer:()=>$r,AnimationFrameService:()=>Sl,AriaAnnouncementService:()=>Kc,AutoScrollService:()=>Jn,AutoWidthCalculator:()=>tg,BarColumnLabelPlacement:()=>kd,BaseComponentWrapper:()=>Cd,BeanStub:()=>Ke,BodyDropPivotTarget:()=>ji,BodyDropTarget:()=>Ji,CellComp:()=>sl,CellCtrl:()=>Os,CellNavigationService:()=>Sg,CellPositionUtils:()=>Wg,CellRangeType:()=>As,ChangedPath:()=>$c,ChartMappings:()=>yd,CheckboxCellEditor:()=>Wl,CheckboxCellRenderer:()=>sn,CheckboxSelectionComponent:()=>xs,ClientSideRowModelSteps:()=>xl,ColumnApplyStateService:()=>Ft,ColumnAutosizeService:()=>Rt,ColumnFactory:()=>Ct,ColumnKeyCreator:()=>wt,ColumnModel:()=>kt,ColumnMoveService:()=>At,ColumnNameService:()=>Nt,ColumnSizeService:()=>Bt,CommunityFeaturesModule:()=>Tc,Component:()=>Gr,ComponentUtil:()=>$t,Context:()=>Un,CssClassManager:()=>pa,CtrlsService:()=>Vg,DataTypeService:()=>oc,DateCellEditor:()=>Hl,DateFilter:()=>ri,DateStringCellEditor:()=>Vl,DragAndDropService:()=>Zn,DragService:()=>eo,DragSourceType:()=>_n,Environment:()=>_g,EventService:()=>Xg,ExcelFactoryMode:()=>Kn,ExpansionService:()=>zl,ExpressionService:()=>id,FakeHScrollComp:()=>ms,FakeVScrollComp:()=>bs,FilterManager:()=>lo,FilterWrapperComp:()=>go,FocusService:()=>ec,FuncColsService:()=>Mt,GROUP_AUTO_COLUMN_ID:()=>Je,Grid:()=>pd,GridBodyComp:()=>ul,GridBodyCtrl:()=>il,GridComp:()=>rc,GridCoreCreator:()=>vd,GridCoreModule:()=>Ac,GridCtrl:()=>ac,GridHeaderComp:()=>ls,GridHeaderCtrl:()=>Vi,GridOptionsService:()=>Hc,GroupInstanceIdCreator:()=>Wt,HeaderCellCtrl:()=>es,HeaderFilterCellComp:()=>Li,HeaderFilterCellCtrl:()=>ui,HeaderGroupCellCtrl:()=>rs,HeaderNavigationDirection:()=>Hi,HeaderNavigationService:()=>qi,HeaderPositionUtils:()=>qc,HeaderRowComp:()=>Bi,HeaderRowContainerComp:()=>ss,HeaderRowContainerCtrl:()=>is,HeaderRowCtrl:()=>os,HeaderRowType:()=>Gi,HorizontalDirection:()=>Qn,HorizontalResizeService:()=>Cl,KeyCode:()=>en,LargeTextCellEditor:()=>Fl,LayoutCssClasses:()=>cs,LocalEventService:()=>g,LocaleService:()=>Vc,ManagedFocusFeature:()=>vo,MenuService:()=>El,ModuleNames:()=>c,ModuleRegistry:()=>Wn,MouseEventService:()=>bl,MoveColumnFeature:()=>Zi,NavigationService:()=>wl,NumberCellEditor:()=>Ol,NumberFilter:()=>Bo,NumberSequence:()=>Pr,OverlayWrapperComponent:()=>hs,PinnedRowModel:()=>og,PivotResultColsService:()=>Gt,PopupComponent:()=>un,PopupEditorWrapper:()=>Dl,PopupService:()=>Cg,PositionableFeature:()=>po,PropertyKeys:()=>Jt,ProvidedFilter:()=>Co,RefPlaceholder:()=>Nr,ResizeObserverService:()=>kl,RowContainerComp:()=>gl,RowContainerCtrl:()=>nl,RowCtrl:()=>Bs,RowDragComp:()=>to,RowHighlightPosition:()=>Xn,RowModelHelperService:()=>fd,RowNode:()=>so,RowNodeBlock:()=>lg,RowNodeBlockLoader:()=>gg,RowNodeSorter:()=>Xc,RowPositionUtils:()=>Ug,RowRenderer:()=>rg,ScalarFilter:()=>Mo,ScrollVisibleService:()=>ml,SelectCellEditor:()=>Al,SelectableService:()=>td,SelectionHandleType:()=>Ds,ServerSideTransactionResultStatus:()=>sg,SetLeftFeature:()=>ni,SimpleFilter:()=>Ro,SortController:()=>rd,SortIndicatorComp:()=>Qr,SortIndicatorSelector:()=>_r,StandardMenuFactory:()=>yl,StylingService:()=>hg,TabGuardClassNames:()=>mg,TabGuardComp:()=>bg,TabGuardCtrl:()=>vg,TabGuardFeature:()=>fg,TextCellEditor:()=>Il,TextFilter:()=>Wo,TextFloatingFilter:()=>Si,TooltipFeature:()=>Lr,TooltipStateManager:()=>Ir,TouchListener:()=>Ur,UserComponentFactory:()=>Hn,UserComponentRegistry:()=>fn,ValueCache:()=>sd,ValueService:()=>ld,VanillaFrameworkOverrides:()=>kg,VerticalDirection:()=>Yn,VisibleColsService:()=>jt,_ColumnFilterModule:()=>Ei,_CommunityMenuApiModule:()=>dc,_CsrmSsrmSharedApiModule:()=>bd,_EditCoreModule:()=>_l,_EmptyBean:()=>aa,_FilterCoreModule:()=>xi,_FloatingFilterModule:()=>Fi,_ReadOnlyFloatingFilterModule:()=>Di,_RowNodeBlockModule:()=>cg,_SsrmInfiniteSharedApiModule:()=>wd,_addFocusableContainerListener:()=>vc,_areEqual:()=>Ee,_bindCellRendererToHtmlElement:()=>Ar,_capitalise:()=>Lt,_clearElement:()=>vr,_cloneObject:()=>st,_combineAttributesAndGridOptions:()=>ea,_compose:()=>x,_createIcon:()=>qr,_createIconNoSpan:()=>Vr,_debounce:()=>y,_defaultComparator:()=>I,_defineModule:()=>pi,_doOnce:()=>h,_errorOnce:()=>m,_escapeString:()=>Ot,_exists:()=>E,_existsAndNotEmpty:()=>xe,_flatten:()=>Le,_forEachReverse:()=>Ne,_formatNumberCommas:()=>Qo,_formatNumberTwoDecimalPlacesAndCommas:()=>Yo,_fuzzySuggestions:()=>mn,_getAbsoluteHeight:()=>cr,_getAbsoluteWidth:()=>dr,_getActiveDomElement:()=>J,_getAllValuesInObject:()=>gt,_getAriaPosInSet:()=>Ca,_getCtrlForEventTarget:()=>je,_getDocument:()=>Q,_getFillHandle:()=>me,_getGlobalGridOption:()=>hd,_getGrandTotalRow:()=>re,_getGroupAggFiltering:()=>ae,_getGroupSelection:()=>ye,_getGroupSelectsDescendants:()=>ke,_getGroupTotalRowCallback:()=>ne,_getHeaderCheckbox:()=>ge,_getHeaderClassesFromColDef:()=>oi,_getInnerHeight:()=>lr,_getInnerWidth:()=>gr,_getIsRowSelectable:()=>be,_getRowContainerOptions:()=>_s,_getRowHeightAsNumber:()=>j,_getRowHeightForNode:()=>W,_getRowIdCallback:()=>se,_getRowSelectionMode:()=>we,_getSuppressMultiRanges:()=>he,_getToolPanelClassesFromColDef:()=>ii,_includes:()=>Ie,_insertArrayIntoArray:()=>Pe,_insertIntoArray:()=>Ae,_isAnimateRows:()=>$,_isCellSelectionEnabled:()=>ue,_isClientSideRowModel:()=>N,_isColumnsSortingCoupledToGroup:()=>te,_isDomLayout:()=>B,_isElementInEventPath:()=>Ue,_isEventFromPrintableCharacter:()=>Fo,_isGetRowHeightFunction:()=>V,_isGroupMultiAutoColumn:()=>oe,_isGroupUseEntireRow:()=>ie,_isIOSUserAgent:()=>_a,_isMultiRowSelection:()=>Ce,_isNodeOrElement:()=>Mr,_isNothingFocused:()=>X,_isRowSelection:()=>H,_isServerSideRowModel:()=>G,_isStopPropagationForAgGrid:()=>Ve,_isUsingNewCellSelectionAPI:()=>de,_isUsingNewRowSelectionAPI:()=>ce,_isVisible:()=>wr,_iterateObject:()=>it,_jsonEquals:()=>T,_last:()=>ze,_loadTemplate:()=>Cr,_log:()=>u,_makeNull:()=>z,_mergeDeep:()=>ct,_missing:()=>R,_missingOrEmpty:()=>M,_parseDateTimeFromString:()=>Xo,_processOnChange:()=>ta,_radioCssClass:()=>er,_removeAriaExpanded:()=>Da,_removeAriaSort:()=>Ba,_removeFromArray:()=>De,_removeFromParent:()=>fr,_removeRepeatsFromArray:()=>Me,_serialiseDate:()=>_o,_setAriaActiveDescendant:()=>Ma,_setAriaChecked:()=>qa,_setAriaColCount:()=>La,_setAriaColIndex:()=>Oa,_setAriaColSpan:()=>Na,_setAriaControls:()=>Va,_setAriaDescribedBy:()=>Sa,_setAriaDisabled:()=>Ea,_setAriaExpanded:()=>Fa,_setAriaHidden:()=>Ra,_setAriaLabel:()=>ya,_setAriaLabelledBy:()=>ka,_setAriaLevel:()=>za,_setAriaPosInSet:()=>Pa,_setAriaRole:()=>wa,_setAriaRowCount:()=>Ta,_setAriaRowIndex:()=>Ia,_setAriaSelected:()=>Ha,_setAriaSetSize:()=>Aa,_setAriaSort:()=>Ga,_setDisabled:()=>or,_setDisplayed:()=>rr,_setFixedWidth:()=>zr,_setVisible:()=>nr,_shallowCompare:()=>Re,_stopPropagationForAgGrid:()=>qe,_toStringOrNull:()=>F,_unwrapUserComp:()=>qn,_utf8_encode:()=>It,_values:()=>L,_waitUntil:()=>S,_warnOnce:()=>p,createGrid:()=>ud,getDefaultFloatingFilterType:()=>vi,isColumn:()=>vt,isColumnControlsCol:()=>at,isColumnGroup:()=>qt,isColumnGroupAutoCol:()=>tt,isProvidedColumnGroup:()=>Ye,isSelectionUIEvent:()=>Oc,provideGlobalGridOptions:()=>dd}),e.exports=(r=l,((e,t,a,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))s.call(e,l)||l===a||n(e,l,{get:()=>t[l],enumerable:!(r=o(t,l))||r.enumerable});return e})(n({},"__esModule",{value:!0}),r));var g=class{constructor(){this.allSyncListeners=new Map,this.allAsyncListeners=new Map,this.globalSyncListeners=new Set,this.globalAsyncListeners=new Set,this.asyncFunctionsQueue=[],this.scheduled=!1,this.firedEvents={}}setFrameworkOverrides(e){this.frameworkOverrides=e}getListeners(e,t,a){const r=t?this.allAsyncListeners:this.allSyncListeners;let n=r.get(e);return!n&&a&&(n=new Set,r.set(e,n)),n}noRegisteredListenersExist(){return 0===this.allSyncListeners.size&&0===this.allAsyncListeners.size&&0===this.globalSyncListeners.size&&0===this.globalAsyncListeners.size}addEventListener(e,t,a=!1){this.getListeners(e,a,!0).add(t)}removeEventListener(e,t,a=!1){const r=this.getListeners(e,a,!1);if(r&&(r.delete(t),0===r.size)){(a?this.allAsyncListeners:this.allSyncListeners).delete(e)}}addGlobalListener(e,t=!1){(t?this.globalAsyncListeners:this.globalSyncListeners).add(e)}removeGlobalListener(e,t=!1){(t?this.globalAsyncListeners:this.globalSyncListeners).delete(e)}dispatchEvent(e){const t=e;this.dispatchToListeners(t,!0),this.dispatchToListeners(t,!1),this.firedEvents[t.type]=!0}dispatchEventOnce(e){this.firedEvents[e.type]||this.dispatchEvent(e)}dispatchToListeners(e,t){const a=e.type;if(t&&"event"in e){const t=e.event;t instanceof Event&&(e.eventPath=t.composedPath())}const r=(a,r)=>a.forEach((a=>{if(!r.has(a))return;const n=this.frameworkOverrides?()=>this.frameworkOverrides.wrapIncoming((()=>a(e))):()=>a(e);t?this.dispatchAsync(n):n()})),n=this.getListeners(a,t,!1)??new Set,o=new Set(n);o.size>0&&r(o,n);new Set(t?this.globalAsyncListeners:this.globalSyncListeners).forEach((r=>{const n=this.frameworkOverrides?()=>this.frameworkOverrides.wrapIncoming((()=>r(a,e))):()=>r(a,e);t?this.dispatchAsync(n):n()}))}dispatchAsync(e){if(this.asyncFunctionsQueue.push(e),!this.scheduled){const e=()=>{window.setTimeout(this.flushAsyncQueue.bind(this),0)};this.frameworkOverrides?this.frameworkOverrides.wrapIncoming(e):e(),this.scheduled=!0}}flushAsyncQueue(){this.scheduled=!1;const e=this.asyncFunctionsQueue.slice();this.asyncFunctionsQueue=[],e.forEach((e=>e()))}},c=(e=>(e.CommunityCoreModule="@ag-grid-community/core",e.InfiniteRowModelModule="@ag-grid-community/infinite-row-model",e.ClientSideRowModelModule="@ag-grid-community/client-side-row-model",e.CsvExportModule="@ag-grid-community/csv-export",e.EnterpriseCoreModule="@ag-grid-enterprise/core",e.RowGroupingModule="@ag-grid-enterprise/row-grouping",e.ColumnsToolPanelModule="@ag-grid-enterprise/column-tool-panel",e.FiltersToolPanelModule="@ag-grid-enterprise/filter-tool-panel",e.MenuModule="@ag-grid-enterprise/menu",e.SetFilterModule="@ag-grid-enterprise/set-filter",e.MultiFilterModule="@ag-grid-enterprise/multi-filter",e.StatusBarModule="@ag-grid-enterprise/status-bar",e.SideBarModule="@ag-grid-enterprise/side-bar",e.RangeSelectionModule="@ag-grid-enterprise/range-selection",e.MasterDetailModule="@ag-grid-enterprise/master-detail",e.RichSelectModule="@ag-grid-enterprise/rich-select",e.GridChartsModule="@ag-grid-enterprise/charts",e.ViewportRowModelModule="@ag-grid-enterprise/viewport-row-model",e.ServerSideRowModelModule="@ag-grid-enterprise/server-side-row-model",e.ExcelExportModule="@ag-grid-enterprise/excel-export",e.ClipboardModule="@ag-grid-enterprise/clipboard",e.SparklinesModule="@ag-grid-enterprise/sparklines",e.AdvancedFilterModule="@ag-grid-enterprise/advanced-filter",e.AngularModule="@ag-grid-community/angular",e.ReactModule="@ag-grid-community/react",e.VueModule="@ag-grid-community/vue",e))(c||{}),d={};function h(e,t){d[t]||(e(),d[t]=!0)}function u(e,...t){console.log("AG Grid: "+e,...t)}function p(e,...t){h((()=>console.warn("AG Grid: "+e,...t)),e+t?.join(""))}function m(e,...t){h((()=>console.error("AG Grid: "+e,...t)),e+t?.join(""))}function v(e){return!!(e&&e.constructor&&e.call&&e.apply)}function f(e){!function(e,t=0){e.length>0&&window.setTimeout((()=>e.forEach((e=>e()))),t)}(e,400)}var b=[],w=!1;function C(e){b.push(e),w||(w=!0,window.setTimeout((()=>{const e=b.slice();b.length=0,w=!1,e.forEach((e=>e()))}),0))}function y(e,t){let a;return function(...r){const n=this;window.clearTimeout(a),a=window.setTimeout((function(){e.apply(n,r)}),t)}}function k(e,t){let a=0;return function(...r){const n=(new Date).getTime();n-a{const s=(new Date).getTime()-n>a;(e()||s)&&(t(),i=!0,null!=o&&(window.clearInterval(o),o=null),s&&r&&p(r))};s(),i||(o=window.setInterval(s,10))}function x(...e){return t=>e.reduce(((e,t)=>t(e)),t)}function z(e){return null==e||""===e?null:e}function E(e,t=!1){return null!=e&&(""!==e||t)}function R(e){return!E(e)}function M(e){return null==e||0===e.length}function F(e){return null!=e&&"function"==typeof e.toString?e.toString():null}function D(e){if(void 0===e)return;if(null===e||""===e)return null;if("number"==typeof e)return isNaN(e)?void 0:e;const t=parseInt(e,10);return isNaN(t)?void 0:t}function A(e){if(void 0!==e)return null!==e&&""!==e&&P(e)}function P(e){return"boolean"==typeof e?e:"string"==typeof e&&("TRUE"===e.toUpperCase()||""==e)}function T(e,t){return(e?JSON.stringify(e):null)===(t?JSON.stringify(t):null)}function I(e,t,a=!1){const r=null==e,n=null==t;if(e&&e.toNumber&&(e=e.toNumber()),t&&t.toNumber&&(t=t.toNumber()),r&&n)return 0;if(r)return-1;if(n)return 1;function o(e,t){return e>t?1:et.push(e))),t}return Object.values(e)}function O(e,t){return e.get("rowModelType")===t}function N(e){return O(e,"clientSide")}function G(e){return O(e,"serverSide")}function B(e,t){return e.get("domLayout")===t}function H(e){return void 0!==we(e)}function q(e){return!e.get("suppressAsyncEvents")}function V(e){return"function"==typeof e.get("getRowHeight")}function W(e,t,a=!1,r){if(null==r&&(r=e.environment.getDefaultRowHeight()),V(e)){if(a)return{height:r,estimated:!0};const n={node:t,data:t.data},o=e.getCallback("getRowHeight")(n);if(U(o))return 0===o&&p("The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead."),{height:Math.max(1,o),estimated:!1}}if(t.detail&&e.get("masterDetail"))return function(e){if(e.get("detailRowAutoHeight"))return{height:1,estimated:!1};const t=e.get("detailRowHeight");if(U(t))return{height:t,estimated:!1};return{height:300,estimated:!1}}(e);const n=e.get("rowHeight");return{height:n&&U(n)?n:r,estimated:!1}}function j(e){const{environment:t}=e,a=e.get("rowHeight");if(!a||R(a))return t.getDefaultRowHeight();const r=t.refreshRowHeightVariable();return-1!==r?r:(p("row height must be a number if not using standard row model"),t.getDefaultRowHeight())}function U(e){return!isNaN(e)&&"number"==typeof e&&isFinite(e)}function K(e,t,a){const r=t[e.getDomDataKey()];return r?r[a]:void 0}function Y(e,t,a,r){const n=e.getDomDataKey();let o=t[n];R(o)&&(o={},t[n]=o),o[a]=r}function Q(e){let t=null;const a=e.get("getDocument");return a&&E(a)?t=a():e.eGridDiv&&(t=e.eGridDiv.ownerDocument),t&&E(t)?t:document}function _(e){return Q(e).defaultView||window}function Z(e){return e.eGridDiv.getRootNode()}function J(e){return Z(e).activeElement}function X(e){const t=Q(e),a=J(e);return null===a||a===t.body}function $(e){return!e.get("ensureDomOrder")&&e.get("animateRows")}function ee(e){return!(e.get("paginateChildRows")||e.get("groupHideOpenParents")||B(e,"print"))}function te(e){const t=e.get("autoGroupColumnDef");return!t?.comparator&&!e.get("treeData")}function ae(e){const t=e.get("groupAggFiltering");return"function"==typeof t?e.getCallback("groupAggFiltering"):!0===t?()=>!0:void 0}function re(e){const t=e.get("grandTotalRow");if(t)return t;return e.get("groupIncludeTotalFooter")?"bottom":void 0}function ne(e){const t=e.get("groupTotalRow");if("function"==typeof t)return e.getCallback("groupTotalRow");if(t)return()=>t;const a=e.get("groupIncludeFooter");if("function"==typeof a){const t=e.getCallback("groupIncludeFooter");return e=>t(e)?"bottom":void 0}return()=>a?"bottom":void 0}function oe(e){return e.exists("groupDisplayType")?"multipleColumns"===e.get("groupDisplayType"):e.get("groupHideOpenParents")}function ie(e,t){return!t&&"groupRows"===e.get("groupDisplayType")}function se(e){const t=e.getCallback("getRowId");return void 0===t?t:e=>{let a=t(e);return"string"!=typeof a&&(p("The getRowId callback must return a string. The ID ",a," is being cast to a string."),a=String(a)),a}}function le(e){return e?.checkboxes??!0}function ge(e){return"multiRow"===e?.mode&&(e.headerCheckbox??!0)}function ce(e){return"string"!=typeof e.get("rowSelection")}function de(e){return void 0!==e.get("cellSelection")}function he(e){const t=e.get("cellSelection");return void 0!==t?"boolean"!=typeof t&&(t?.suppressMultiRanges??!1):e.get("suppressMultiRangeSelection")}function ue(e){const t=e.get("cellSelection");return void 0!==t?!!t:e.get("enableRangeSelection")}function pe(e){const t=e.get("cellSelection");return void 0!==t?"boolean"!=typeof t&&"fill"===t.handle?.mode:e.get("enableFillHandle")}function me(e){const t=e.get("cellSelection");return void 0!==t?"boolean"!=typeof t&&"fill"===t.handle?.mode?t.handle:void 0:{mode:"fill",setFillValue:e.get("fillOperation"),direction:e.get("fillHandleDirection"),suppressClearOnFillReduction:e.get("suppressClearOnFillReduction")}}function ve(e){const t=e.get("rowSelection")??"single";if("string"==typeof t){const t=e.get("suppressRowClickSelection"),a=e.get("suppressRowDeselection");return(!t||!a)&&(t?"enableDeselection":!a||"enableSelection")}return("singleRow"===t.mode||"multiRow"===t.mode)&&(t.enableClickSelection??!1)}function fe(e){const t=ve(e);return!0===t||"enableDeselection"===t}function be(e){const t=e.get("rowSelection");return"string"==typeof t?e.get("isRowSelectable"):t?.isRowSelectable}function we(e){const t=e.get("rowSelection");if("string"==typeof t)switch(t){case"multiple":return"multiRow";case"single":return"singleRow";default:return}return t?.mode}function Ce(e){return"multiRow"===we(e)}function ye(e){const t=e.get("rowSelection");if("string"==typeof t){const t=e.get("groupSelectsChildren"),a=e.get("groupSelectsFiltered");return t&&a?"filteredDescendants":t?"descendants":"self"}return"multiRow"===t?.mode?t.groupSelects:void 0}function ke(e){const t=ye(e);return"descendants"===t||"filteredDescendants"===t}function Se(e){return e.isModuleRegistered("@ag-grid-enterprise/set-filter")&&!e.get("suppressSetFilterByDefault")}function xe(e){return null!=e&&e.length>0}function ze(e){if(e&&e.length)return e[e.length-1]}function Ee(e,t,a){return null==e&&null==t||null!=e&&null!=t&&e.length===t.length&&e.every(((e,r)=>a?a(e,t[r]):t[r]===e))}function Re(e,t){return Ee(e,t)}function Me(e,t){if(e)for(let a=e.length-2;a>=0;a--){const r=e[a]===t,n=e[a+1]===t;r&&n&&e.splice(a+1,1)}}function Fe(e,t){const a=e.indexOf(t);a>=0&&(e[a]=e[e.length-1],e.pop())}function De(e,t){const a=e.indexOf(t);a>=0&&e.splice(a,1)}function Ae(e,t,a){e.splice(a,0,t)}function Pe(e,t,a){if(null!=e&&null!=t)for(let r=t.length-1;r>=0;r--){Ae(e,t[r],a)}}function Te(e,t,a){!function(e,t){for(let a=0;aAe(e,t,a)))}function Ie(e,t){return e.indexOf(t)>-1}function Le(e){return e?.flatMap((e=>e))??[]}function Oe(e,t){null!=t&&null!=e&&t.forEach((t=>e.push(t)))}function Ne(e,t){if(null!=e)for(let a=e.length-1;a>=0;a--)t(e[a],a)}var Ge="__ag_Grid_Stop_Propagation",Be=["touchstart","touchend","touchmove","touchcancel","scroll"],He={};function qe(e){e[Ge]=!0}function Ve(e){return!0===e[Ge]}var We=(()=>{const e={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return t=>{if("boolean"==typeof He[t])return He[t];const a=document.createElement(e[t]||"div");return He[t="on"+t]=t in a}})();function je(e,t,a){let r=t;for(;r;){const t=K(e,r,a);if(t)return t;r=r.parentElement}return null}function Ue(e,t){return!(!t||!e)&&function(e){const t=e;if(t.path)return t.path;if(t.composedPath)return t.composedPath();return function(e){const t=[];let a=e.target;for(;a;)t.push(a),a=a.parentElement;return t}(t)}(t).indexOf(e)>=0}var Ke=class{constructor(){this.destroyFunctions=[],this.destroyed=!1,this.__v_skip=!0,this.propertyListenerId=0,this.lastChangeSetIdLookup={},this.isAlive=()=>!this.destroyed}preWireBeans(e){this.frameworkOverrides=e.frameworkOverrides,this.stubContext=e.context,this.eventService=e.eventService,this.gos=e.gos,this.localeService=e.localeService}getFrameworkOverrides(){return this.frameworkOverrides}destroy(){for(let e=0;enull;e instanceof HTMLElement?function(e,t,a,r){const n=Ie(Be,a)?{passive:!0}:void 0;e&&e.addEventListener&&e.addEventListener(t,a,r,n)}(this.getFrameworkOverrides(),e,t,a):e.addEventListener(t,a);const r=()=>(e.removeEventListener(t,a),null);return this.destroyFunctions.push(r),()=>(r(),this.destroyFunctions=this.destroyFunctions.filter((e=>e!==r)),null)}setupGridOptionListener(e,t){this.gos.addPropertyEventListener(e,t);const a=()=>(this.gos.removePropertyEventListener(e,t),null);return this.destroyFunctions.push(a),()=>(a(),this.destroyFunctions=this.destroyFunctions.filter((e=>e!==a)),null)}addManagedPropertyListener(e,t){return this.destroyed?()=>null:this.setupGridOptionListener(e,t)}addManagedPropertyListeners(e,t){if(this.destroyed)return;const a=e.join("-")+this.propertyListenerId++,r=e=>{if(e.changeSet){if(e.changeSet&&e.changeSet.id===this.lastChangeSetIdLookup[a])return;this.lastChangeSetIdLookup[a]=e.changeSet.id}const r={type:"gridPropertyChanged",changeSet:e.changeSet,source:e.source};t(r)};e.forEach((e=>this.setupGridOptionListener(e,r)))}addDestroyFunc(e){this.isAlive()?this.destroyFunctions.push(e):e()}createManagedBean(e,t){const a=this.createBean(e,t);return this.addDestroyFunc(this.destroyBean.bind(this,e,t)),a}createBean(e,t,a){return(t||this.stubContext).createBean(e,a)}destroyBean(e,t){return(t||this.stubContext).destroyBean(e)}destroyBeans(e,t){return(t||this.stubContext).destroyBeans(e)}};function Ye(e){return e instanceof Qe}var Qe=class extends Ke{constructor(e,t,a,r){super(),this.isColumn=!1,this.expandable=!1,this.instanceId=mt(),this.expandableListenerRemoveCallback=null,this.colGroupDef=e,this.groupId=t,this.expanded=!!e&&!!e.openByDefault,this.padding=a,this.level=r}destroy(){this.expandableListenerRemoveCallback&&this.reset(null,void 0),super.destroy()}reset(e,t){this.colGroupDef=e,this.level=t,this.originalParent=null,this.expandableListenerRemoveCallback&&this.expandableListenerRemoveCallback(),this.children=void 0,this.expandable=void 0}getInstanceId(){return this.instanceId}setOriginalParent(e){this.originalParent=e}getOriginalParent(){return this.originalParent}getLevel(){return this.level}isVisible(){return!!this.children&&this.children.some((e=>e.isVisible()))}isPadding(){return this.padding}setExpanded(e){this.expanded=void 0!==e&&e,this.dispatchLocalEvent({type:"expandedChanged"})}isExpandable(){return this.expandable}isExpanded(){return this.expanded}getGroupId(){return this.groupId}getId(){return this.getGroupId()}setChildren(e){this.children=e}getChildren(){return this.children}getColGroupDef(){return this.colGroupDef}getLeafColumns(){const e=[];return this.addLeafColumns(e),e}addLeafColumns(e){this.children&&this.children.forEach((t=>{vt(t)?e.push(t):Ye(t)&&t.addLeafColumns(e)}))}getColumnGroupShow(){const e=this.colGroupDef;if(e)return e.columnGroupShow}setupExpandable(){this.setExpandable(),this.expandableListenerRemoveCallback&&this.expandableListenerRemoveCallback();const e=this.onColumnVisibilityChanged.bind(this);this.getLeafColumns().forEach((t=>t.addEventListener("visibleChanged",e))),this.expandableListenerRemoveCallback=()=>{this.getLeafColumns().forEach((t=>t.removeEventListener("visibleChanged",e))),this.expandableListenerRemoveCallback=null}}setExpandable(){if(this.isPadding())return;let e=!1,t=!1,a=!1;const r=this.findChildrenRemovingPadding();for(let n=0,o=r.length;n{a.forEach((a=>{Ye(a)&&a.isPadding()?t(a.children):e.push(a)}))};return t(this.children),e}onColumnVisibilityChanged(){this.setExpandable()}},_e="ag-Grid-ControlsColumn",Ze=class extends Ke{constructor(){super(...arguments),this.beanName="controlsColService"}createControlsCols(){const{gos:e}=this,t=e.get("rowSelection");if(!t||"object"!=typeof t)return[];const a=le(t),r=ge(t);if(a||r){const t=e.get("selectionColumnDef"),a={maxWidth:50,resizable:!1,suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPosition:e.get("enableRtl")?"right":"left",comparator(e,t,a,r){const n=a.isSelected(),o=r.isSelected();return n&&o?0:n?1:-1},editable:!1,suppressFillHandle:!0,...t,colId:`${_e}`},r=new ft(a,null,a.colId,!1);return this.createBean(r),[r]}return[]}},Je="ag-Grid-AutoColumn";function Xe(e){const t=[],a=e=>{for(let r=0;re+t.getActualWidth()),0)}function et(e,t,a){const r={};if(!t)return;yt(null,t,(e=>{r[e.getInstanceId()]=e})),a&&yt(null,a,(e=>{r[e.getInstanceId()]=null}));const n=Object.values(r).filter((e=>null!=e));e.destroyBeans(n)}function tt(e){return e.getId().startsWith(Je)}function at(e){return e.getColId().startsWith(_e)}function rt(e){let t=[];if(e instanceof Array){e.some((e=>"string"!=typeof e))?p("if colDef.type is supplied an array it should be of type 'string[]'"):t=e}else"string"==typeof e?t=e.split(","):p("colDef.type should be of type 'string' | 'string[]'");return t}var nt=class{constructor(e){this.frameworkOverrides=e,this.wrappedListeners=new Map,this.wrappedGlobalListeners=new Map}wrap(e){let t=e;return this.frameworkOverrides.shouldWrapOutgoing&&(t=t=>{this.frameworkOverrides.wrapOutgoing((()=>e(t)))},this.wrappedListeners.set(e,t)),t}wrapGlobal(e){let t=e;return this.frameworkOverrides.shouldWrapOutgoing&&(t=(t,a)=>{this.frameworkOverrides.wrapOutgoing((()=>e(t,a)))},this.wrappedGlobalListeners.set(e,t)),t}unwrap(e){return this.wrappedListeners.get(e)??e}unwrapGlobal(e){return this.wrappedGlobalListeners.get(e)??e}},ot=new Set(["__proto__","constructor","prototype"]);function it(e,t){if(null!=e)if(Array.isArray(e))for(let a=0;a{if(t&&t.indexOf(e)>=0||ot.has(e))return;const n=a[e],o=ht(n)&&n.constructor===Object;r[e]=o?lt(n):n})),r}function gt(e){if(!e)return[];const t=Object;if("function"==typeof t.values)return t.values(e);const a=[];for(const t in e)e.hasOwnProperty(t)&&e.propertyIsEnumerable(t)&&a.push(e[t]);return a}function ct(e,t,a=!0,r=!1){E(t)&&it(t,((t,n)=>{if(ot.has(t))return;let o=e[t];if(o!==n){if(r){if(null==o&&null!=n){"object"==typeof n&&n.constructor===Object&&(o={},e[t]=o)}}ht(n)&&ht(o)&&!Array.isArray(o)?ct(o,n,a,r):(a||void 0!==n)&&(e[t]=n)}}))}function dt(e,t,a){if(!t||!e)return;if(!a)return e[t];const r=t.split(".");let n=e;for(let e=0;e=0&&!e,this.tooltipFieldContainsDots=E(this.colDef.tooltipField)&&this.colDef.tooltipField.indexOf(".")>=0&&!e}initMinAndMaxWidths(){const e=this.colDef;this.minWidth=e.minWidth??this.gos.environment.getDefaultColumnMinWidth(),this.maxWidth=e.maxWidth??Number.MAX_SAFE_INTEGER}initTooltip(){this.tooltipEnabled=E(this.colDef.tooltipField)||E(this.colDef.tooltipValueGetter)||E(this.colDef.tooltipComponent)}resetActualWidth(e){const t=this.calculateColInitialWidth(this.colDef);this.setActualWidth(t,e,!0)}calculateColInitialWidth(e){let t;const a=D(e.width),r=D(e.initialWidth);return t=null!=a?a:null!=r?r:200,Math.max(Math.min(t,this.maxWidth),this.minWidth)}isEmptyGroup(){return!1}isRowGroupDisplayed(e){if(R(this.colDef)||R(this.colDef.showRowGroup))return!1;const t=!0===this.colDef.showRowGroup,a=this.colDef.showRowGroup===e;return t||a}isPrimary(){return this.primary}isFilterAllowed(){return!!this.colDef.filter}isFieldContainsDots(){return this.fieldContainsDots}isTooltipEnabled(){return this.tooltipEnabled}isTooltipFieldContainsDots(){return this.tooltipFieldContainsDots}getHighlighted(){return this.highlighted}addEventListener(e,t){this.frameworkOverrides.shouldWrapOutgoing&&!this.frameworkEventListenerService&&(this.columnEventService.setFrameworkOverrides(this.frameworkOverrides),this.frameworkEventListenerService=new nt(this.frameworkOverrides));const a=this.frameworkEventListenerService?.wrap(t)??t;this.columnEventService.addEventListener(e,a)}removeEventListener(e,t){const a=this.frameworkEventListenerService?.unwrap(t)??t;this.columnEventService.removeEventListener(e,a)}createColumnFunctionCallbackParams(e){return this.gos.addGridCommonParams({node:e,data:e.data,column:this,colDef:this.colDef})}isSuppressNavigable(e){if("boolean"==typeof this.colDef.suppressNavigable)return this.colDef.suppressNavigable;if("function"==typeof this.colDef.suppressNavigable){const t=this.createColumnFunctionCallbackParams(e);return(0,this.colDef.suppressNavigable)(t)}return!1}isCellEditable(e){if(e.group)if(this.gos.get("treeData")){if(!e.data&&!this.gos.get("enableGroupEdit"))return!1}else if(!this.gos.get("enableGroupEdit"))return!1;return this.isColumnFunc(e,this.colDef.editable)}isSuppressFillHandle(){return!!this.colDef.suppressFillHandle}isAutoHeight(){return!!this.colDef.autoHeight}isAutoHeaderHeight(){return!!this.colDef.autoHeaderHeight}isRowDrag(e){return this.isColumnFunc(e,this.colDef.rowDrag)}isDndSource(e){return this.isColumnFunc(e,this.colDef.dndSource)}isCellCheckboxSelection(e){const t=this.gos.get("rowSelection");if(t&&"string"!=typeof t){const a=at(this)&&le(t);return this.isColumnFunc(e,a)}return this.isColumnFunc(e,this.colDef.checkboxSelection)}isSuppressPaste(e){return this.isColumnFunc(e,this.colDef?this.colDef.suppressPaste:null)}isResizable(){return!!this.getColDefValue("resizable")}getColDefValue(e){return this.colDef[e]??ut[e]}isColumnFunc(e,t){if("boolean"==typeof t)return t;if("function"==typeof t){return t(this.createColumnFunctionCallbackParams(e))}return!1}setHighlighted(e){this.highlighted!==e&&(this.highlighted=e,this.columnEventService.dispatchEvent(this.createColumnEvent("headerHighlightChanged","uiColumnMoved")))}setMoving(e,t){this.moving=e,this.columnEventService.dispatchEvent(this.createColumnEvent("movingChanged",t))}createColumnEvent(e,t){return this.gos.addGridCommonParams({type:e,column:this,columns:[this],source:t})}isMoving(){return this.moving}getSort(){return this.sort}setSort(e,t){this.sort!==e&&(this.sort=e,this.columnEventService.dispatchEvent(this.createColumnEvent("sortChanged",t))),this.dispatchStateUpdatedEvent("sort")}isSortable(){return!!this.getColDefValue("sortable")}isSortAscending(){return"asc"===this.sort}isSortDescending(){return"desc"===this.sort}isSortNone(){return R(this.sort)}isSorting(){return E(this.sort)}getSortIndex(){return this.sortIndex}setSortIndex(e){this.sortIndex=e,this.dispatchStateUpdatedEvent("sortIndex")}setMenuVisible(e,t){this.menuVisible!==e&&(this.menuVisible=e,this.columnEventService.dispatchEvent(this.createColumnEvent("menuVisibleChanged",t)))}isMenuVisible(){return this.menuVisible}setAggFunc(e){this.aggFunc=e,this.dispatchStateUpdatedEvent("aggFunc")}getAggFunc(){return this.aggFunc}getLeft(){return this.left}getOldLeft(){return this.oldLeft}getRight(){return this.left+this.actualWidth}setLeft(e,t){this.oldLeft=this.left,this.left!==e&&(this.left=e,this.columnEventService.dispatchEvent(this.createColumnEvent("leftChanged",t)))}isFilterActive(){return this.filterActive}setFilterActive(e,t,a){this.filterActive!==e&&(this.filterActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("filterActiveChanged",t)));const r=this.createColumnEvent("filterChanged",t);a&&ct(r,a),this.columnEventService.dispatchEvent(r)}isHovered(){return this.columnHoverService.isHovered(this)}setPinned(e){this.pinned=!0===e||"left"===e?"left":"right"===e?"right":null,this.dispatchStateUpdatedEvent("pinned")}setFirstRightPinned(e,t){this.firstRightPinned!==e&&(this.firstRightPinned=e,this.columnEventService.dispatchEvent(this.createColumnEvent("firstRightPinnedChanged",t)))}setLastLeftPinned(e,t){this.lastLeftPinned!==e&&(this.lastLeftPinned=e,this.columnEventService.dispatchEvent(this.createColumnEvent("lastLeftPinnedChanged",t)))}isFirstRightPinned(){return this.firstRightPinned}isLastLeftPinned(){return this.lastLeftPinned}isPinned(){return"left"===this.pinned||"right"===this.pinned}isPinnedLeft(){return"left"===this.pinned}isPinnedRight(){return"right"===this.pinned}getPinned(){return this.pinned}setVisible(e,t){const a=!0===e;this.visible!==a&&(this.visible=a,this.columnEventService.dispatchEvent(this.createColumnEvent("visibleChanged",t))),this.dispatchStateUpdatedEvent("hide")}isVisible(){return this.visible}isSpanHeaderHeight(){return!this.getColDef().suppressSpanHeaderHeight}getColumnGroupPaddingInfo(){let e=this.getParent();if(!e||!e.isPadding())return{numberOfParents:0,isSpanningTotal:!1};const t=e.getPaddingLevel()+1;let a=!0;for(;e;){if(!e.isPadding()){a=!1;break}e=e.getParent()}return{numberOfParents:t,isSpanningTotal:a}}getColDef(){return this.colDef}getDefinition(){return this.colDef}getColumnGroupShow(){return this.colDef.columnGroupShow}getColId(){return this.colId}getId(){return this.colId}getUniqueId(){return this.colId}getActualWidth(){return this.actualWidth}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(e){const t=e!==this.autoHeaderHeight;return this.autoHeaderHeight=e,t}createBaseColDefParams(e){return this.gos.addGridCommonParams({node:e,data:e.data,colDef:this.colDef,column:this})}getColSpan(e){if(R(this.colDef.colSpan))return 1;const t=this.createBaseColDefParams(e),a=this.colDef.colSpan(t);return Math.max(a,1)}getRowSpan(e){if(R(this.colDef.rowSpan))return 1;const t=this.createBaseColDefParams(e),a=this.colDef.rowSpan(t);return Math.max(a,1)}setActualWidth(e,t,a=!1){e=Math.max(e,this.minWidth),e=Math.min(e,this.maxWidth),this.actualWidth!==e&&(this.actualWidth=e,this.flex&&"flex"!==t&&"gridInitializing"!==t&&(this.flex=null),a||this.fireColumnWidthChangedEvent(t)),this.dispatchStateUpdatedEvent("width")}fireColumnWidthChangedEvent(e){this.columnEventService.dispatchEvent(this.createColumnEvent("widthChanged",e))}isGreaterThanMax(e){return e>this.maxWidth}getMinWidth(){return this.minWidth}getMaxWidth(){return this.maxWidth}getFlex(){return this.flex||0}setFlex(e){this.flex!==e&&(this.flex=e),this.dispatchStateUpdatedEvent("flex")}setMinimum(e){this.setActualWidth(this.minWidth,e)}setRowGroupActive(e,t){this.rowGroupActive!==e&&(this.rowGroupActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnRowGroupChanged",t))),this.dispatchStateUpdatedEvent("rowGroup")}isRowGroupActive(){return this.rowGroupActive}setPivotActive(e,t){this.pivotActive!==e&&(this.pivotActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnPivotChanged",t))),this.dispatchStateUpdatedEvent("pivot")}isPivotActive(){return this.pivotActive}isAnyFunctionActive(){return this.isPivotActive()||this.isRowGroupActive()||this.isValueActive()}isAnyFunctionAllowed(){return this.isAllowPivot()||this.isAllowRowGroup()||this.isAllowValue()}setValueActive(e,t){this.aggregationActive!==e&&(this.aggregationActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnValueChanged",t)))}isValueActive(){return this.aggregationActive}isAllowPivot(){return!0===this.colDef.enablePivot}isAllowValue(){return!0===this.colDef.enableValue}isAllowRowGroup(){return!0===this.colDef.enableRowGroup}dispatchStateUpdatedEvent(e){this.columnEventService.dispatchEvent({type:"columnStateUpdated",key:e})}},bt={numericColumn:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"},rightAligned:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"}},wt=class{constructor(){this.existingKeys={}}addExistingKeys(e){for(let t=0;t{Ye(e)&&e.setupExpandable(),e.setOriginalParent(t)})),{columnTree:c,treeDept:g}}extractExistingTreeData(e){const t=[],a=[],r=[];return e&&yt(null,e,(e=>{if(Ye(e)){const t=e;a.push(t)}else{const a=e;r.push(a.getId()),t.push(a)}})),{existingCols:t,existingGroups:a,existingColKeys:r}}balanceTreeForAutoCols(e,t){const a=[],r=this.findDepth(t);return e.forEach((e=>{let t=e;for(let a=r-1;a>=0;a--){const r=new Qe(null,`FAKE_PATH_${e.getId()}}_${a}`,!0,a);this.createBean(r),r.setChildren([t]),t.setOriginalParent(r),t=r}0===r&&e.setOriginalParent(null),a.push(t)})),[a,r]}findDepth(e){let t=0,a=e;for(;a&&a[0]&&Ye(a[0]);)t++,a=a[0].getChildren();return t}balanceColumnTree(e,t,a,r){const n=[];for(let o=0;o=t;e--){const e=r.getUniqueKey(null,null),a=this.createMergedColGroupDef(null),n=new Qe(a,e,!0,t);this.createBean(n),s&&s.setChildren([n]),s=n,o||(o=s)}if(o&&s){n.push(o);if(e.some((e=>Ye(e)))){s.setChildren([i]);continue}s.setChildren(e);break}n.push(i)}}return n}findMaxDept(e,t){let a=t;for(let r=0;r{if(e in a)p(`the column type '${e}' is a default column type and cannot be overridden.`);else{t.type&&p("Column type definitions 'columnTypes' with a 'type' attribute are not supported because a column type cannot refer to another column type. Only column definitions 'columnDefs' can use the 'type' attribute to refer to a column type."),a[e]=t}})),e.forEach((e=>{const r=a[e.trim()];r?ct(t,r,!1,!0):p("colDef.type '"+e+"' does not correspond to defined gridOptions.columnTypes")}))}isColumnGroup(e){return void 0!==e.children}};function yt(e,t,a){if(t)for(let r=0;rthis.refreshAll(St(e.source)))),this.addManagedPropertyListener("rowSelection",(e=>{this.onSelectionOptionsChanged(e.currentValue,e.previousValue,St(e.source))})),this.addManagedPropertyListener("autoGroupColumnDef",(e=>this.onAutoGroupColumnDefChanged(St(e.source)))),this.addManagedPropertyListeners(["defaultColDef","defaultColGroupDef","columnTypes","suppressFieldDotNotation"],(e=>this.recreateColumnDefs(St(e.source)))),this.addManagedPropertyListener("pivotMode",(e=>this.setPivotMode(this.gos.get("pivotMode"),St(e.source)))),this.addManagedEventListeners({firstDataRendered:()=>this.onFirstDataRendered()})}createColsFromColDefs(e){const t=this.colDefs?this.columnApplyStateService.compareColumnStatesAndDispatchEvents(e):void 0;this.valueCache.expire();const a=this.colDefCols?.list,r=this.colDefCols?.tree,n=this.columnFactory.createColumnTree(this.colDefs,!0,r,e);et(this.context,this.colDefCols?.tree,n.columnTree);const o=n.columnTree,i=n.treeDept,s=Xe(o),l={};s.forEach((e=>l[e.getId()]=e)),this.colDefCols={tree:o,treeDepth:i,list:s,map:l},this.funcColsService.extractCols(e,a),this.ready=!0,this.refreshCols(!0),this.visibleColsService.refresh(e),this.columnViewportService.checkViewportColumns(),this.eventDispatcher.everythingChanged(e),t&&(this.changeEventsDispatching=!0,t(),this.changeEventsDispatching=!1),this.eventDispatcher.newColumnsLoaded(e),"gridInitializing"===e&&this.columnSizeService.applyAutosizeStrategy()}refreshCols(e){if(!this.colDefCols)return;const t=this.cols?.tree;this.saveColOrder(),this.selectCols(),this.createAutoCols(),this.addAutoCols(),this.createControlsCols(),this.addControlsCols();const a=(r=this.gos,this.showingPivotResult?!r.get("enableStrictPivotColumnOrder"):r.get("maintainColumnOrder"));var r;e&&!a||this.restoreColOrder(),this.positionLockedCols(),this.showRowGroupColsService?.refresh(),this.quickFilterService?.refreshQuickFilterCols(),this.setColSpanActive(),this.setAutoHeightActive(),this.visibleColsService.clear(),this.columnViewportService.clear();!Ee(t,this.cols.tree)&&this.eventDispatcher.gridColumns()}selectCols(){const e=this.pivotResultColsService.getPivotResultCols();if(this.showingPivotResult=null!=e,e){const{map:t,list:a,tree:r,treeDepth:n}=e;this.cols={list:a.slice(),map:{...t},tree:r.slice(),treeDepth:n};e.list.some((e=>void 0!==this.cols?.map[e.getColId()]))||(this.lastPivotOrder=null)}else{const{map:e,list:t,tree:a,treeDepth:r}=this.colDefCols;this.cols={list:t.slice(),map:{...e},tree:a.slice(),treeDepth:r}}}getColsToShow(){const e=this.isPivotMode()&&!this.isShowingPivotResult(),t=this.funcColsService.getValueColumns();return this.cols.list.filter((a=>{const r=tt(a);if(e){const e=t&&Ie(t,a);return r||e}return r||a.isVisible()}))}addAutoCols(){null!=this.autoCols&&(this.cols.list=this.autoCols.list.concat(this.cols.list),this.cols.tree=this.autoCols.tree.concat(this.cols.tree),xt(this.cols))}createAutoCols(){const e=ie(this.gos,this.pivotMode),t=this.pivotMode?this.gos.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),a=this.funcColsService.getRowGroupColumns(),r=()=>{this.autoCols&&(et(this.context,this.autoCols.tree),this.autoCols=null)};if(!(a.length>0||this.gos.get("treeData"))||t||e||!this.autoColService)return void r();const n=this.autoColService.createAutoCols(a)??[],o=Et(n,this.autoCols?.list||null),i=this.cols.treeDepth,s=this.autoCols?this.autoCols.treeDepth:-1;if(o&&s==i)return;r();const[l,g]=this.columnFactory.balanceTreeForAutoCols(n,this.cols.tree);this.autoCols={list:n,tree:l,treeDepth:g,map:{}};const c=e=>{if(!e)return null;const t=e.filter((e=>!tt(e)));return[...n,...t]};this.lastOrder=c(this.lastOrder),this.lastPivotOrder=c(this.lastPivotOrder)}createControlsCols(){const e=()=>{et(this.context,this.controlsCols?.tree),this.controlsCols=null};this.controlsColService||e();const t=this.cols.treeDepth,a=(this.controlsCols?.treeDepth??-1)==t,r=this.controlsColService?.createControlsCols()??[];if(Et(r,this.controlsCols?.list??[])&&a)return;e();const[n,o]=this.columnFactory.balanceTreeForAutoCols(r,this.cols.tree);this.controlsCols={list:r,tree:n,treeDepth:o,map:{}};const i=e=>{if(!e)return null;const t=e.filter((e=>!at(e)));return[...r,...t]};this.lastOrder=i(this.lastOrder),this.lastPivotOrder=i(this.lastPivotOrder)}addControlsCols(){null!=this.controlsCols&&(this.cols.list=this.controlsCols.list.concat(this.cols.list),this.cols.tree=this.controlsCols.tree.concat(this.cols.tree),xt(this.cols))}refreshAll(e){this.isReady()&&(this.refreshCols(!1),this.visibleColsService.refresh(e))}setColsVisible(e,t=!1,a){this.columnApplyStateService.applyColumnState({state:e.map((e=>({colId:"string"==typeof e?e:e.getColId(),hide:!t})))},a)}setColsPinned(e,t,a){if(!this.cols)return;if(M(e))return;if(B(this.gos,"print"))return void p("Changing the column pinning status is not allowed with domLayout='print'");let r;this.columnAnimationService.start(),r=!0===t||"left"===t?"left":"right"===t?"right":null;const n=[];e.forEach((e=>{if(!e)return;const t=this.getCol(e);t&&t.getPinned()!==r&&(t.setPinned(r),n.push(t))})),n.length&&(this.visibleColsService.refresh(a),this.eventDispatcher.columnPinned(n,a)),this.columnAnimationService.finish()}setColumnGroupOpened(e,t,a){let r;r=Ye(e)?e.getId():e||"",this.columnGroupStateService.setColumnGroupState([{groupId:r,open:t}],a)}getProvidedColGroup(e){let t=null;return yt(null,this.cols?.tree,(a=>{Ye(a)&&a.getId()===e&&(t=a)})),t}isColGroupLocked(e){const t=this.gos.get("groupLockGroupColumns");if(!e.isRowGroupActive()||0===t)return!1;if(-1===t)return!0;return t>this.funcColsService.getRowGroupColumns().findIndex((t=>t.getColId()===e.getColId()))}isSuppressAutoCol(){if("custom"===this.gos.get("groupDisplayType"))return!0;return"custom"===this.gos.get("treeDataDisplayType")}setAutoHeightActive(){if(this.autoHeightActive=this.cols.list.some((e=>e.isVisible()&&e.isAutoHeight())),this.autoHeightActive){this.autoHeightActiveAtLeastOnce=!0;N(this.gos)||G(this.gos)||p("autoHeight columns only work with Client Side Row Model and Server Side Row Model.")}}restoreColOrder(){const e=this.showingPivotResult?this.lastPivotOrder:this.lastOrder;if(!e)return;const t=new Map(e.map(((e,t)=>[e,t])));if(!this.cols.list.some((e=>t.has(e))))return;const a=new Map(this.cols.list.map((e=>[e,!0]))),r=e.filter((e=>a.has(e))),n=new Map(r.map((e=>[e,!0]))),o=this.cols.list.filter((e=>!n.has(e))),i=r.slice();o.forEach((e=>{let t=e.getOriginalParent();if(!t)return void i.push(e);const a=[];for(;!a.length&&t;){t.getLeafColumns().forEach((e=>{const t=i.indexOf(e)>=0,r=a.indexOf(e)<0;t&&r&&a.push(e)})),t=t.getOriginalParent()}if(!a.length)return void i.push(e);const r=a.map((e=>i.indexOf(e))),n=Math.max(...r);Ae(i,e,n+1)})),this.cols.list=i}sortColsLikeKeys(e){if(null==this.cols)return;let t=[];const a={};e.forEach((e=>{if(a[e])return;const r=this.cols.map[e];r&&(t.push(r),a[e]=!0)}));let r=0;this.cols.list.forEach((e=>{const n=e.getColId();if(null!=a[n])return;n.startsWith(Je)?Ae(t,e,r++):t.push(e)})),t=this.columnMoveService.placeLockedColumns(t),this.columnMoveService.doesMovePassMarryChildren(t)?this.cols.list=t:p("Applying column order broke a group where columns should be married together. Applying new order has been discarded.")}sortColsLikeCols(e){if(!e||e.length<=1)return;e.filter((e=>this.cols.list.indexOf(e)<0)).length>0||e.sort(((e,t)=>this.cols.list.indexOf(e)-this.cols.list.indexOf(t)))}resetColDefIntoCol(e,t){const a=e.getUserProvidedColDef();if(!a)return!1;const r=this.columnFactory.addColumnDefaultAndTypes(a,e.getColId());return e.setColDef(r,a,t),!0}queueResizeOperations(){this.shouldQueueResizeOperations=!0}isShouldQueueResizeOperations(){return this.shouldQueueResizeOperations}processResizeOperations(){this.shouldQueueResizeOperations=!1,this.resizeOperationQueue.forEach((e=>e())),this.resizeOperationQueue=[]}pushResizeOperation(e){this.resizeOperationQueue.push(e)}moveInCols(e,t,a){Te(this.cols?.list,e,t),this.visibleColsService.refresh(a)}positionLockedCols(){this.cols.list=this.columnMoveService.placeLockedColumns(this.cols.list)}saveColOrder(){this.showingPivotResult?this.lastPivotOrder=this.cols?.list:this.lastOrder=this.cols?.list}getColumnDefs(){if(!this.colDefCols)return;const e=this.colDefCols.list.slice();this.showingPivotResult?e.sort(((e,t)=>this.lastOrder.indexOf(e)-this.lastOrder.indexOf(t))):this.lastOrder&&e.sort(((e,t)=>this.cols.list.indexOf(e)-this.cols.list.indexOf(t)));const t=this.funcColsService.getRowGroupColumns(),a=this.funcColsService.getPivotColumns();return this.columnDefFactory.buildColumnDefs(e,t,a)}isShowingPivotResult(){return this.showingPivotResult}isChangeEventsDispatching(){return this.changeEventsDispatching}isColSpanActive(){return this.colSpanActive}isProvidedColGroupsPresent(){return this.colDefCols?.treeDepth>0}setColSpanActive(){this.colSpanActive=this.cols.list.some((e=>null!=e.getColDef().colSpan))}isAutoRowHeightActive(){return this.autoHeightActive}wasAutoRowHeightEverActive(){return this.autoHeightActiveAtLeastOnce}getHeaderRowCount(){return this.cols?this.cols.treeDepth+1:-1}isReady(){return this.ready}isPivotMode(){return this.pivotMode}setPivotMode(e,t){e!==this.pivotMode&&this.isPivotSettingAllowed(this.pivotMode)&&(this.pivotMode=e,this.ready&&(this.refreshCols(!1),this.visibleColsService.refresh(t),this.eventDispatcher.pivotModeChanged()))}isPivotSettingAllowed(e){return!e||!this.gos.get("treeData")||(p("Pivot mode not available with treeData."),!1)}isPivotActive(){const e=this.funcColsService.getPivotColumns();return this.pivotMode&&!M(e)}recreateColumnDefs(e){this.cols&&(this.autoCols&&this.autoColService.updateAutoCols(this.autoCols.list,e),this.createColsFromColDefs(e))}setColumnDefs(e,t){this.colDefs=e,this.createColsFromColDefs(t)}destroy(){et(this.context,this.colDefCols?.tree),et(this.context,this.autoCols?.tree),et(this.context,this.controlsCols?.tree),super.destroy()}getColTree(){return this.cols.tree}getColDefColTree(){return this.colDefCols.tree}getColDefCols(){return this.colDefCols?.list?this.colDefCols.list:null}getCols(){return this.cols?.list??[]}getAllCols(){const e=this.pivotResultColsService.getPivotResultCols(),t=e?.list;return[this.colDefCols?.list??[],this.autoCols?.list??[],this.controlsCols?.list??[],t??[]].flat()}getColsForKeys(e){return e?e.map((e=>this.getCol(e))).filter((e=>null!=e)):[]}getColDefCol(e){return this.colDefCols?.list?this.getColFromCollection(e,this.colDefCols):null}getCol(e){return null==e?null:this.getColFromCollection(e,this.cols)}getColFromCollection(e,t){if(null==t)return null;const{map:a,list:r}=t;if("string"==typeof e&&a[e])return a[e];for(let t=0;tzt(t,e)))??null}getAutoCols(){return this.autoCols?.list??null}setColHeaderHeight(e,t){e.setAutoHeaderHeight(t)&&(e.isColumn?this.eventDispatcher.headerHeight(e):this.eventDispatcher.groupHeaderHeight(e))}getGroupRowsHeight(){const e=[],t=this.ctrlsService.getHeaderRowContainerCtrls();for(const a of t){if(!a)continue;const t=a.getGroupRowCount()||0;for(let r=0;rn)&&(e[r]=a)}}}return e}getColumnGroupHeaderRowHeight(e){const t=this.isPivotMode()?this.getPivotGroupHeaderHeight():this.getGroupHeaderHeight();let a=0;const r=e.getHeaderCtrls();for(const e of r){const t=e.getColumn();if(t.isAutoHeaderHeight()){const e=t.getAutoHeaderHeight();null!=e&&e>a&&(a=e)}}return Math.max(t,a)}getColumnHeaderRowHeight(){const e=this.isPivotMode()?this.getPivotHeaderHeight():this.getHeaderHeight(),t=this.visibleColsService.getAllCols().filter((e=>e.isAutoHeaderHeight())).map((e=>e.getAutoHeaderHeight()||0));return Math.max(e,...t)}getHeaderHeight(){return this.gos.get("headerHeight")??this.environment.getDefaultHeaderHeight()}getFloatingFiltersHeight(){return this.gos.get("floatingFiltersHeight")??this.getHeaderHeight()}getGroupHeaderHeight(){return this.gos.get("groupHeaderHeight")??this.getHeaderHeight()}getPivotHeaderHeight(){return this.gos.get("pivotHeaderHeight")??this.getHeaderHeight()}getPivotGroupHeaderHeight(){return this.gos.get("pivotGroupHeaderHeight")??this.getGroupHeaderHeight()}onFirstDataRendered(){const e=this.gos.get("autoSizeStrategy");if("fitCellContents"!==e?.type)return;const{colIds:t,skipHeader:a}=e;setTimeout((()=>{t?this.columnAutosizeService.autoSizeCols({colKeys:t,skipHeader:a,source:"autosizeColumns"}):this.columnAutosizeService.autoSizeAllColumns("autosizeColumns",a)}))}onAutoGroupColumnDefChanged(e){this.autoCols&&this.autoColService.updateAutoCols(this.autoCols.list,e)}onSelectionOptionsChanged(e,t,a){const r=(t&&"string"!=typeof t?le(t):void 0)!==(e&&"string"!=typeof e?le(e):void 0),n=t&&"string"!=typeof t?ge(t):void 0,o=e&&"string"!=typeof e?ge(e):void 0;(r||n!==o)&&this.refreshAll(a)}};function St(e){return"gridOptionsUpdated"===e?"gridOptionsChanged":e}function xt(e){e.map={},e.list.forEach((t=>e.map[t.getId()]=t))}function zt(e,t){const a=e===t,r=e.getColDef()===t,n=e.getColId()==t;return a||r||n}function Et(e,t){return Ee(e,t,((e,t)=>e.getColId()===t.getColId()))}var Rt=class extends Ke{constructor(){super(...arguments),this.beanName="columnAutosizeService",this.timesDelayed=0}wireBeans(e){this.columnModel=e.columnModel,this.visibleColsService=e.visibleColsService,this.animationFrameService=e.animationFrameService,this.autoWidthCalculator=e.autoWidthCalculator,this.eventDispatcher=e.columnEventDispatcher,this.ctrlsService=e.ctrlsService,this.renderStatusService=e.renderStatusService}autoSizeCols(e){if(this.columnModel.isShouldQueueResizeOperations())return void this.columnModel.pushResizeOperation((()=>this.autoSizeCols(e)));const{colKeys:t,skipHeader:a,skipHeaderGroups:r,stopAtGroup:n,source:o="api"}=e;if(this.animationFrameService.flushAllFrames(),this.timesDelayed<5&&this.renderStatusService&&!this.renderStatusService.areHeaderCellsRendered())return this.timesDelayed++,void setTimeout((()=>this.autoSizeCols(e)));this.timesDelayed=0;const i=[];let s=-1;const l=null!=a?a:this.gos.get("skipHeaderOnAutoSize"),g=null!=r?r:l;for(;0!==s;){s=0;const e=[];t.forEach((t=>{if(!t)return;const a=this.columnModel.getCol(t);if(!a)return;if(i.indexOf(a)>=0)return;const r=this.autoWidthCalculator.getPreferredWidthForColumn(a,l);if(r>0){const e=this.normaliseColumnWidth(a,r);a.setActualWidth(e,o),i.push(a),s++}e.push(a)})),e.length&&this.visibleColsService.refresh(o)}g||this.autoSizeColumnGroupsByColumns(t,o,n),this.eventDispatcher.columnResized(i,!0,"autosizeColumns")}autoSizeColumn(e,t,a){e&&this.autoSizeCols({colKeys:[e],skipHeader:a,skipHeaderGroups:!0,source:t})}autoSizeColumnGroupsByColumns(e,t,a){const r=new Set;let n;this.columnModel.getColsForKeys(e).forEach((e=>{let t=e.getParent();for(;t&&t!=a;)t.isPadding()||r.add(t),t=t.getParent()}));for(const e of r){for(const t of this.ctrlsService.getHeaderRowContainerCtrls())if(n=t.getHeaderCtrlForColumn(e),n)break;n&&n.resizeLeafColumnsToFit(t)}return[]}autoSizeAllColumns(e,t){if(this.columnModel.isShouldQueueResizeOperations())return void this.columnModel.pushResizeOperation((()=>this.autoSizeAllColumns(e,t)));const a=this.visibleColsService.getAllCols();this.autoSizeCols({colKeys:a,skipHeader:t,source:e})}normaliseColumnWidth(e,t){const a=e.getMinWidth();tthis.rowGroupCols.push(e),removeGroupCol:e=>De(this.rowGroupCols,e),addPivotCol:e=>this.pivotCols.push(e),removePivotCol:e=>De(this.pivotCols,e),addValueCol:e=>this.valueCols.push(e),removeValueCol:e=>De(this.valueCols,e)}}getSourceColumnsForGroupColumn(e){const t=e.getColDef().showRowGroup;if(!t)return null;if(!0===t)return this.rowGroupCols.slice(0);const a=this.columnModel.getColDefCol(t);return a?[a]:null}sortRowGroupColumns(e){this.rowGroupCols.sort(e)}sortPivotColumns(e){this.pivotCols.sort(e)}getValueColumns(){return this.valueCols?this.valueCols:[]}getPivotColumns(){return this.pivotCols?this.pivotCols:[]}getRowGroupColumns(){return this.rowGroupCols?this.rowGroupCols:[]}isRowGroupEmpty(){return M(this.rowGroupCols)}setColumnAggFunc(e,t,a){if(!e)return;const r=this.columnModel.getColDefCol(e);r&&(r.setAggFunc(t),this.eventDispatcher.columnChanged("columnValueChanged",[r],a))}setRowGroupColumns(e,t){this.setColList(e,this.rowGroupCols,"columnRowGroupChanged",!0,!0,((e,a)=>this.setRowGroupActive(e,a,t)),t)}setRowGroupActive(e,t,a){e!==t.isRowGroupActive()&&(t.setRowGroupActive(e,a),e&&!this.gos.get("suppressRowGroupHidesColumns")&&this.columnModel.setColsVisible([t],!1,a),e||this.gos.get("suppressMakeColumnVisibleAfterUnGroup")||this.columnModel.setColsVisible([t],!0,a))}addRowGroupColumns(e,t){this.updateColList(e,this.rowGroupCols,!0,!0,(e=>this.setRowGroupActive(!0,e,t)),"columnRowGroupChanged",t)}removeRowGroupColumns(e,t){this.updateColList(e,this.rowGroupCols,!1,!0,(e=>this.setRowGroupActive(!1,e,t)),"columnRowGroupChanged",t)}addPivotColumns(e,t){this.updateColList(e,this.pivotCols,!0,!1,(e=>e.setPivotActive(!0,t)),"columnPivotChanged",t)}setPivotColumns(e,t){this.setColList(e,this.pivotCols,"columnPivotChanged",!0,!1,((e,a)=>{a.setPivotActive(e,t)}),t)}removePivotColumns(e,t){this.updateColList(e,this.pivotCols,!1,!1,(e=>e.setPivotActive(!1,t)),"columnPivotChanged",t)}setValueColumns(e,t){this.setColList(e,this.valueCols,"columnValueChanged",!1,!1,((e,a)=>this.setValueActive(e,a,t)),t)}setValueActive(e,t,a){if(e!==t.isValueActive()&&(t.setValueActive(e,a),e&&!t.getAggFunc()&&this.aggFuncService)){const e=this.aggFuncService.getDefaultAggFunc(t);t.setAggFunc(e)}}addValueColumns(e,t){this.updateColList(e,this.valueCols,!0,!1,(e=>this.setValueActive(!0,e,t)),"columnValueChanged",t)}removeValueColumns(e,t){this.updateColList(e,this.valueCols,!1,!1,(e=>this.setValueActive(!1,e,t)),"columnValueChanged",t)}moveRowGroupColumn(e,t,a){if(this.isRowGroupEmpty())return;const r=this.rowGroupCols[e],n=this.rowGroupCols.slice(e,t);this.rowGroupCols.splice(e,1),this.rowGroupCols.splice(t,0,r),this.eventDispatcher.rowGroupChanged(n,a)}setColList(e,t,a,r,n,o,i){if(!this.columnModel.getCols())return;const s=new Map;t.forEach(((e,t)=>s.set(e,t))),t.length=0,E(e)&&e.forEach((e=>{const a=this.columnModel.getColDefCol(e);a&&t.push(a)})),t.forEach(((e,t)=>{const a=s.get(e);void 0!==a?r&&a!==t||s.delete(e):s.set(e,0)}));(this.columnModel.getColDefCols()||[]).forEach((e=>{const a=t.indexOf(e)>=0;o(a,e)})),n&&this.columnModel.refreshCols(!1),this.visibleColsService.refresh(i),this.eventDispatcher.columnChanged(a,[...s.keys()],i)}updateColList(e,t,a,r,n,o,i){if(!e||M(e))return;let s=!1;const l=new Set;e.forEach((e=>{if(!e)return;const r=this.columnModel.getColDefCol(e);if(r){if(l.add(r),a){if(t.indexOf(r)>=0)return;t.push(r)}else{const e=t.indexOf(r);if(e<0)return;for(let a=e+1;at.setValueActive(a,e)),(()=>{}),(()=>{}),(e=>{const t=e.aggFunc;return null===t||""===t?null:void 0!==t?!!t:void 0}),(e=>null!=e.initialAggFunc&&""!=e.initialAggFunc)),this.valueCols.forEach((e=>{const t=e.getColDef();null!=t.aggFunc&&""!=t.aggFunc?e.setAggFunc(t.aggFunc):e.getAggFunc()||e.setAggFunc(t.initialAggFunc)}))}extractRowGroupCols(e,t){this.rowGroupCols=this.extractColsCommon(t,this.rowGroupCols,((t,a)=>t.setRowGroupActive(a,e)),(e=>e.rowGroupIndex),(e=>e.initialRowGroupIndex),(e=>e.rowGroup),(e=>e.initialRowGroup))}extractPivotCols(e,t){this.pivotCols=this.extractColsCommon(t,this.pivotCols,((t,a)=>t.setPivotActive(a,e)),(e=>e.pivotIndex),(e=>e.initialPivotIndex),(e=>e.pivot),(e=>e.initialPivot))}extractColsCommon(e=[],t=[],a,r,n,o,i){const s=[],l=[];(this.columnModel.getColDefCols()||[]).forEach((a=>{const g=e.indexOf(a)<0,c=a.getColDef(),d=A(o(c)),h=A(i(c)),u=D(r(c)),p=D(n(c));let m;if(m=void 0!==d?d:void 0!==u?null!==u&&u>=0:g?void 0!==h?h:!!(void 0!==p)&&(null!=p&&p>=0):t.indexOf(a)>=0,m){(g?null!=u||null!=p:null!=u)?s.push(a):l.push(a)}}));const g=e=>{const t=r(e.getColDef()),a=n(e.getColDef());return null!=t?t:a};s.sort(((e,t)=>{const a=g(e),r=g(t);return a===r?0:a{l.indexOf(e)>=0&&c.push(e)})),l.forEach((e=>{c.indexOf(e)<0&&c.push(e)})),t.forEach((e=>{c.indexOf(e)<0&&a(e,!1)})),c.forEach((e=>{t.indexOf(e)<0&&a(e,!0)})),c}generateColumnStateForRowGroupAndPivotIndexes(e,t){const a={},r=(e,t,r,n,o,i)=>{const s=this.columnModel.getColDefCols();if(!t.length||!s)return[];const l=Object.keys(e),g=new Set(l),c=new Set(l),d=new Set(t.map((e=>{const t=e.getColId();return c.delete(t),t})).concat(l)),h=[],u={};let p=0;for(let e=0;e{const a=u[t];for(let t=f;t{const s=t.getColId();if(g.has(s))b(s),e[s][o]=m++;else{const l=t.getColDef();if(null===l[o]||void 0===l[o]&&null==l[i]){if(!v){l[r]||void 0===l[r]&&l[n]?b(s):(c.forEach((t=>{e[t][o]=m+u[t]})),m+=h.length,v=!0)}a[s]||(a[s]={colId:s}),a[s][o]=m++}}}))};return r(e,this.rowGroupCols,"rowGroup","initialRowGroup","rowGroupIndex","initialRowGroupIndex"),r(t,this.pivotCols,"pivot","initialPivot","pivotIndex","initialPivotIndex"),Object.values(a)}},Ft=class extends Ke{constructor(){super(...arguments),this.beanName="columnApplyStateService"}wireBeans(e){this.columnModel=e.columnModel,this.eventDispatcher=e.columnEventDispatcher,this.sortController=e.sortController,this.columnGetStateService=e.columnGetStateService,this.funcColsService=e.funcColsService,this.visibleColsService=e.visibleColsService,this.columnAnimationService=e.columnAnimationService,this.pivotResultColsService=e.pivotResultColsService}applyColumnState(e,t){const a=this.columnModel.getColDefCols()||[];if(M(a))return!1;if(e&&e.state&&!e.state.forEach)return p("applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state."),!1;const r=this.funcColsService.getModifyColumnsNoEventsCallbacks(),n=(a,n,o)=>{const i=this.compareColumnStatesAndDispatchEvents(t),s=n.slice(),l={},g={},c=[],d=[];let h=0;const u=this.funcColsService.getRowGroupColumns().slice(),p=this.funcColsService.getPivotColumns().slice();a.forEach((a=>{const n=a.colId||"";if(n.startsWith(Je))return c.push(a),void d.push(a);const i=o(n);i?(this.syncColumnWithStateItem(i,a,e.defaultState,l,g,!1,t,r),De(s,i)):(d.push(a),h+=1)}));const m=a=>this.syncColumnWithStateItem(a,null,e.defaultState,l,g,!1,t,r);s.forEach(m),this.funcColsService.sortRowGroupColumns(Dt.bind(this,l,u)),this.funcColsService.sortPivotColumns(Dt.bind(this,g,p)),this.columnModel.refreshCols(!1);const v=(this.columnModel.getAutoCols()||[]).slice();return c.forEach((a=>{const n=this.columnModel.getAutoCol(a.colId);De(v,n),this.syncColumnWithStateItem(n,a,e.defaultState,null,null,!0,t,r)})),v.forEach(m),this.orderLiveColsLikeState(e),this.visibleColsService.refresh(t),this.eventDispatcher.everythingChanged(t),i(),{unmatchedAndAutoStates:d,unmatchedCount:h}};this.columnAnimationService.start();let{unmatchedAndAutoStates:o,unmatchedCount:i}=n(e.state||[],a,(e=>this.columnModel.getColDefCol(e)));if(o.length>0||E(e.defaultState)){const e=this.pivotResultColsService.getPivotResultCols(),t=e?.list;i=n(o,t||[],(e=>this.pivotResultColsService.getPivotResultCol(e))).unmatchedCount}return this.columnAnimationService.finish(),0===i}resetColumnState(e){if(M(this.columnModel.getColDefCols()))return;const t=Xe(this.columnModel.getColDefColTree()),a=[];let r=1e3,n=1e3,o=[];const i=this.columnModel.getAutoCols();i&&(o=o.concat(i)),t&&(o=o.concat(t)),o.forEach((e=>{const t=this.getColumnStateFromColDef(e);R(t.rowGroupIndex)&&t.rowGroup&&(t.rowGroupIndex=r++),R(t.pivotIndex)&&t.pivot&&(t.pivotIndex=n++),a.push(t)})),this.applyColumnState({state:a,applyOrder:!0},e)}getColumnStateFromColDef(e){const t=(e,t)=>null!=e?e:null!=t?t:null,a=e.getColDef(),r=t(a.sort,a.initialSort),n=t(a.sortIndex,a.initialSortIndex),o=t(a.hide,a.initialHide),i=t(a.pinned,a.initialPinned),s=t(a.width,a.initialWidth),l=t(a.flex,a.initialFlex);let g=t(a.rowGroupIndex,a.initialRowGroupIndex),c=t(a.rowGroup,a.initialRowGroup);null!=g||null!=c&&0!=c||(g=null,c=null);let d=t(a.pivotIndex,a.initialPivotIndex),h=t(a.pivot,a.initialPivot);null!=d||null!=h&&0!=h||(d=null,h=null);const u=t(a.aggFunc,a.initialAggFunc);return{colId:e.getColId(),sort:r,sortIndex:n,hide:o,pinned:i,width:s,flex:l,rowGroup:c,rowGroupIndex:g,pivot:h,pivotIndex:d,aggFunc:u}}syncColumnWithStateItem(e,t,a,r,n,o,i,s){if(!e)return;const l=(e,r)=>{const n={value1:void 0,value2:void 0};let o=!1;return t&&(void 0!==t[e]&&(n.value1=t[e],o=!0),E(r)&&void 0!==t[r]&&(n.value2=t[r],o=!0)),!o&&a&&(void 0!==a[e]&&(n.value1=a[e]),E(r)&&void 0!==a[r]&&(n.value2=a[r])),n},g=l("hide").value1;void 0!==g&&e.setVisible(!g,i);const c=l("pinned").value1;void 0!==c&&e.setPinned(c);const d=e.getColDef().minWidth??this.gos.environment.getDefaultColumnMinWidth(),h=l("flex").value1;if(void 0!==h&&e.setFlex(h),null==h){const t=l("width").value1;null!=t&&null!=d&&t>=d&&e.setActualWidth(t,i)}const u=l("sort").value1;void 0!==u&&("desc"===u||"asc"===u?e.setSort(u,i):e.setSort(void 0,i));const m=l("sortIndex").value1;if(void 0!==m&&e.setSortIndex(m),o||!e.isPrimary())return;const v=l("aggFunc").value1;void 0!==v&&("string"==typeof v?(e.setAggFunc(v),e.isValueActive()||(e.setValueActive(!0,i),s.addValueCol(e))):(E(v)&&p("stateItem.aggFunc must be a string. if using your own aggregation functions, register the functions first before using them in get/set state. This is because it is intended for the column state to be stored and retrieved as simple JSON."),e.isValueActive()&&(e.setValueActive(!1,i),s.removeValueCol(e))));const{value1:f,value2:b}=l("rowGroup","rowGroupIndex");void 0===f&&void 0===b||("number"==typeof b||f?(e.isRowGroupActive()||(e.setRowGroupActive(!0,i),s.addGroupCol(e)),r&&"number"==typeof b&&(r[e.getId()]=b)):e.isRowGroupActive()&&(e.setRowGroupActive(!1,i),s.removeGroupCol(e)));const{value1:w,value2:C}=l("pivot","pivotIndex");void 0===w&&void 0===C||("number"==typeof C||w?(e.isPivotActive()||(e.setPivotActive(!0,i),s.addPivotCol(e)),n&&"number"==typeof C&&(n[e.getId()]=C)):e.isPivotActive()&&(e.setPivotActive(!1,i),s.removePivotCol(e)))}orderLiveColsLikeState(e){if(!e.applyOrder||!e.state)return;const t=[];e.state.forEach((e=>{null!=e.colId&&t.push(e.colId)})),this.columnModel.sortColsLikeKeys(t)}compareColumnStatesAndDispatchEvents(e){const t={rowGroupColumns:this.funcColsService.getRowGroupColumns().slice(),pivotColumns:this.funcColsService.getPivotColumns().slice(),valueColumns:this.funcColsService.getValueColumns().slice()},a=this.columnGetStateService.getColumnState(),r={};return a.forEach((e=>{r[e.colId]=e})),()=>{const n=this.columnModel.getAllCols(),o=(t,a,r,n)=>{if(Ee(a.map(n),r.map(n)))return;const o=new Set(a);r.forEach((e=>{o.delete(e)||o.add(e)}));const i=[...o];this.eventService.dispatchEvent({type:t,columns:i,column:1===i.length?i[0]:null,source:e})},i=e=>{const t=[];return n.forEach((a=>{const n=r[a.getColId()];n&&e(n,a)&&t.push(a)})),t},s=e=>e.getColId();o("columnRowGroupChanged",t.rowGroupColumns,this.funcColsService.getRowGroupColumns(),s),o("columnPivotChanged",t.pivotColumns,this.funcColsService.getPivotColumns(),s);const l=i(((e,t)=>{const a=null!=e.aggFunc,r=a!=t.isValueActive(),n=a&&e.aggFunc!=t.getAggFunc();return r||n}));l.length>0&&this.eventDispatcher.columnChanged("columnValueChanged",l,e);this.eventDispatcher.columnResized(i(((e,t)=>e.width!=t.getActualWidth())),!0,e);this.eventDispatcher.columnPinned(i(((e,t)=>e.pinned!=t.getPinned())),e);this.eventDispatcher.columnVisible(i(((e,t)=>e.hide==t.isVisible())),e);const g=i(((e,t)=>e.sort!=t.getSort()||e.sortIndex!=t.getSortIndex()));g.length>0&&this.sortController.dispatchSortChangedEvents(e,g),this.normaliseColumnMovedEventForColumnState(a,e)}}normaliseColumnMovedEventForColumnState(e,t){const a=this.columnGetStateService.getColumnState(),r={};a.forEach((e=>r[e.colId]=e));const n={};e.forEach((e=>{r[e.colId]&&(n[e.colId]=!0)}));const o=e.filter((e=>n[e.colId])),i=a.filter((e=>n[e.colId])),s=[];i.forEach(((e,t)=>{const a=o&&o[t];if(a&&a.colId!==e.colId){const e=this.columnModel.getCol(a.colId);e&&s.push(e)}})),s.length&&this.eventDispatcher.columnMoved({movedColumns:s,source:t,finished:!0})}},Dt=(e,t,a,r)=>{const n=e[a.getId()],o=e[r.getId()],i=null!=n,s=null!=o;if(i&&s)return n-o;if(i)return-1;if(s)return 1;const l=t.indexOf(a),g=t.indexOf(r),c=l>=0;return c&&g>=0?l-g:c?-1:1},At=class extends Ke{constructor(){super(...arguments),this.beanName="columnMoveService"}wireBeans(e){this.columnModel=e.columnModel,this.columnAnimationService=e.columnAnimationService,this.eventDispatcher=e.columnEventDispatcher}moveColumnByIndex(e,t,a){const r=this.columnModel.getCols();if(!r)return;const n=r[e];this.moveColumns([n],t,a)}moveColumns(e,t,a,r=!0){const n=this.columnModel.getCols();if(!n)return;if(t>n.length-e.length)return p("tried to insert columns in invalid location, toIndex = ",t),void p("remember that you should not count the moving columns when calculating the new index");this.columnAnimationService.start();const o=this.columnModel.getColsForKeys(e);this.doesMovePassRules(o,t)&&(this.columnModel.moveInCols(o,t,a),this.eventDispatcher.columnMoved({movedColumns:o,source:a,toIndex:t,finished:r})),this.columnAnimationService.finish()}doesMovePassRules(e,t){const a=this.getProposedColumnOrder(e,t);return this.doesOrderPassRules(a)}doesOrderPassRules(e){return!!this.doesMovePassMarryChildren(e)&&!!this.doesMovePassLockedPositions(e)}getProposedColumnOrder(e,t){const a=this.columnModel.getCols().slice();return Te(a,e,t),a}doesMovePassLockedPositions(e){const t=this.gos.get("enableRtl");let a=t?1:-1,r=!0;return e.forEach((e=>{const n=(o=e.getColDef().lockPosition)?"left"===o||!0===o?-1:1:0;var o;t?n>a&&(r=!1):n{if(!Ye(a))return;const r=a,n=r.getColGroupDef();if(!(n&&n.marryChildren))return;const o=[];r.getLeafColumns().forEach((t=>{const a=e.indexOf(t);o.push(a)}));Math.max.apply(Math,o)-Math.min.apply(Math,o)>r.getLeafColumns().length-1&&(t=!1)})),t}placeLockedColumns(e){const t=[],a=[],r=[];e.forEach((e=>{const n=e.getColDef().lockPosition;"right"===n?r.push(e):"left"===n||!0===n?t.push(e):a.push(e)}));return this.gos.get("enableRtl")?[...r,...a,...t]:[...t,...a,...r]}},Pt=/[&<>"']/g,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"};function It(e){const t=String.fromCharCode;function a(e,a){return t(e>>a&63|128)}function r(e){if(!(4294967168&e))return t(e);let r="";return 4294965248&e?4294901760&e?4292870144&e||(r=t(e>>18&7|240),r+=a(e,12),r+=a(e,6)):(!function(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}(e),r=t(e>>12&15|224),r+=a(e,6)):r=t(e>>6&31|192),r+=t(63&e|128),r}const n=function(e){const t=[];if(!e)return[];const a=e.length;let r,n,o=0;for(;o=55296&&r<=56319&&oTt[e]))}var Nt=class extends Ke{constructor(){super(...arguments),this.beanName="columnNameService"}wireBeans(e){this.expressionService=e.expressionService,this.funcColsService=e.funcColsService,this.columnModel=e.columnModel}getDisplayNameForColumn(e,t,a=!1){if(!e)return null;const r=this.getHeaderName(e.getColDef(),e,null,null,t);return a?this.wrapHeaderNameWithAggFunc(e,r):r}getDisplayNameForProvidedColumnGroup(e,t,a){const r=t?t.getColGroupDef():null;return r?this.getHeaderName(r,null,e,t,a):null}getDisplayNameForColumnGroup(e,t){return this.getDisplayNameForProvidedColumnGroup(e,e.getProvidedColumnGroup(),t)}getHeaderName(e,t,a,r,n){const o=e.headerValueGetter;if(o){const i=this.gos.addGridCommonParams({colDef:e,column:t,columnGroup:a,providedColumnGroup:r,location:n});return"function"==typeof o?o(i):"string"==typeof o?this.expressionService.evaluate(o,i):(p("headerValueGetter must be a function or a string"),"")}return null!=e.headerName?e.headerName:e.field?(i=e.field)&&null!=i?i.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z])([a-z])/g,"$1 $2$3").replace(/\./g," ").split(" ").map((e=>e.substring(0,1).toUpperCase()+(e.length>1?e.substring(1,e.length):""))).join(" "):null:"";var i}wrapHeaderNameWithAggFunc(e,t){if(this.gos.get("suppressAggFuncInHeader"))return t;const a=e.getColDef().pivotValueColumn;let r,n=null;if(E(a)){const o=this.funcColsService.getValueColumns(),i=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&1===o.length,s=void 0!==e.getColDef().pivotTotalColumnIds;if(i&&!s)return t;n=a?a.getAggFunc():null,r=!0}else{const t=e.isValueActive(),a=this.columnModel.isPivotMode()||!this.funcColsService.isRowGroupEmpty();t&&a?(n=e.getAggFunc(),r=!0):r=!1}if(r){const e="string"==typeof n?n:"func";return`${this.localeService.getLocaleTextFunc()(e,e)}(${t})`}return t}},Gt=class extends Ke{constructor(){super(...arguments),this.beanName="pivotResultColsService"}wireBeans(e){this.context=e.context,this.columnModel=e.columnModel,this.columnFactory=e.columnFactory,this.visibleColsService=e.visibleColsService}destroy(){et(this.context,this.pivotResultCols?.tree),super.destroy()}isPivotResultColsPresent(){return null!=this.pivotResultCols}lookupPivotResultCol(e,t){if(null==this.pivotResultCols)return null;const a=this.columnModel.getColDefCol(t);let r=null;return this.pivotResultCols.list.forEach((t=>{const n=t.getColDef().pivotKeys,o=t.getColDef().pivotValueColumn;Ee(n,e)&&o===a&&(r=t)})),r}getPivotResultCols(){return this.pivotResultCols}getPivotResultCol(e){return this.pivotResultCols?this.columnModel.getColFromCollection(e,this.pivotResultCols):null}setPivotResultCols(e,t){if(this.columnModel.isReady()&&(null!=e||null!=this.pivotResultCols)){if(e){this.processPivotResultColDef(e);const a=this.columnFactory.createColumnTree(e,!1,this.pivotResultCols?.tree||this.previousPivotResultCols||void 0,t);et(this.context,this.pivotResultCols?.tree,a.columnTree);const r=a.columnTree,n=a.treeDept,o=Xe(r),i={};this.pivotResultCols={tree:r,treeDepth:n,list:o,map:i},this.pivotResultCols.list.forEach((e=>this.pivotResultCols.map[e.getId()]=e));const s=!!this.previousPivotResultCols;this.previousPivotResultCols=null,this.columnModel.refreshCols(!s)}else this.previousPivotResultCols=this.pivotResultCols?this.pivotResultCols.tree:null,this.pivotResultCols=null,this.columnModel.refreshCols(!1);this.visibleColsService.refresh(t)}}processPivotResultColDef(e){const t=this.gos.get("processPivotResultColDef"),a=this.gos.get("processPivotResultColGroupDef");if(!t&&!a)return;const r=e=>{e.forEach((e=>{if(E(e.children)){const t=e;a&&a(t),r(t.children)}else{t&&t(e)}}))};e&&r(e)}},Bt=class extends Ke{constructor(){super(...arguments),this.beanName="columnSizeService"}wireBeans(e){this.columnModel=e.columnModel,this.columnViewportService=e.columnViewportService,this.eventDispatcher=e.columnEventDispatcher,this.visibleColsService=e.visibleColsService,this.ctrlsService=e.ctrlsService}setColumnWidths(e,t,a,r){const n=[];e.forEach((e=>{const a=this.columnModel.getColDefCol(e.key)||this.columnModel.getCol(e.key);if(!a)return;n.push({width:e.newWidth,ratios:[1],columns:[a]});if("shift"===this.gos.get("colResizeDefault")&&(t=!t),t){const t=this.visibleColsService.getColAfter(a);if(!t)return;const r=a.getActualWidth()-e.newWidth,o=t.getActualWidth()+r;n.push({width:o,ratios:[1],columns:[t]})}})),0!==n.length&&this.resizeColumnSets({resizeSets:n,finished:a,source:r})}resizeColumnSets(e){const{resizeSets:t,finished:a,source:r}=e;if(!(!t||t.every((e=>this.checkMinAndMaxWidthsForSet(e))))){if(a){const e=t&&t.length>0?t[0].columns:null;this.eventDispatcher.columnResized(e,a,r)}return}const n=[],o=[];t.forEach((e=>{const{width:t,columns:a,ratios:i}=e,s={},l={};a.forEach((e=>o.push(e)));let g=!0,c=0;for(;g;){if(c++,c>1e3){m("infinite loop in resizeColumnSets");break}g=!1;const e=[];let r=0,n=t;a.forEach(((t,a)=>{if(l[t.getId()])n-=s[t.getId()];else{e.push(t);const n=i[a];r+=n}}));const o=1/r;e.forEach(((a,r)=>{let c;r===e.length-1?c=n:(c=Math.round(i[r]*t*o),n-=c);const d=a.getMinWidth(),h=a.getMaxWidth();c0&&c>h&&(c=h,l[a.getId()]=!0,g=!0),s[a.getId()]=c}))}a.forEach((e=>{const t=s[e.getId()];e.getActualWidth()!==t&&(e.setActualWidth(t,r),n.push(e))}))}));const i=n.length>0;let s=[];i&&(s=this.refreshFlexedColumns({resizingCols:o,skipSetLeft:!0}),this.visibleColsService.setLeftValues(r),this.visibleColsService.updateBodyWidths(),this.columnViewportService.checkViewportColumns());const l=o.concat(s);(i||a)&&this.eventDispatcher.columnResized(l,a,r,s)}checkMinAndMaxWidthsForSet(e){const{columns:t,width:a}=e;let r=0,n=0,o=!0;t.forEach((e=>{const t=e.getMinWidth();r+=t||0;const a=e.getMaxWidth();a>0?n+=a:o=!1}));return a>=r&&(!o||a<=n)}refreshFlexedColumns(e={}){const t=e.source?e.source:"flex";if(null!=e.viewportWidth&&(this.flexViewportWidth=e.viewportWidth),!this.flexViewportWidth)return[];const a=this.visibleColsService.getCenterCols();let r=-1;if(e.resizingCols){const t=new Set(e.resizingCols);for(let e=a.length-1;e>=0;e--)if(t.has(a[e])){r=e;break}}let n=0,o=[],i=0,s=0;for(let e=0;er?(o.push(a[e]),s+=a[e].getFlex(),i+=a[e].getMinWidth()):n+=a[e].getActualWidth()}if(!o.length)return[];let l=[];n+i>this.flexViewportWidth&&(o.forEach((e=>e.setActualWidth(e.getMinWidth(),t))),l=o,o=[]);const g=[];let c;e:for(;;){c=this.flexViewportWidth-n;const e=c/s;for(let a=0;ah&&(c=h),c){r.setActualWidth(c,t),Fe(o,r),s-=r.getFlex(),l.push(r),n+=r.getActualWidth();continue e}g[a]=Math.floor(i)}break}let d=c;return o.forEach(((e,a)=>{const r=athis.sizeColumnsToFit(e,t,a,r)));const n={};r&&r?.columnLimits?.forEach((({key:e,...t})=>{n["string"==typeof e?e:e.getColId()]=t}));const o=this.visibleColsService.getAllCols(),i=e===$e(o);if(e<=0||!o.length||i)return;const s=[],l=[];o.forEach((e=>{!0===e.getColDef().suppressSizeToFit?l.push(e):s.push(e)}));const g=s.slice(0);let c=!1;const d=e=>{De(s,e),l.push(e)};for(s.forEach((e=>{e.resetActualWidth(t);const a=n?.[e.getId()],o=a?.minWidth??r?.defaultMinWidth,i=a?.maxWidth??r?.defaultMaxWidth,s=e.getActualWidth();"number"==typeof o&&si&&e.setActualWidth(i,t,!0)}));!c;){c=!0;const a=e-$e(l);if(a<=0)s.forEach((e=>{const a=n?.[e.getId()]?.minWidth??r?.defaultMinWidth;"number"!=typeof a?e.setMinimum(t):e.setActualWidth(a,t,!0)}));else{const e=a/$e(s);let o=a;for(let a=s.length-1;a>=0;a--){const i=s[a],l=n?.[i.getId()],g=l?.minWidth??r?.defaultMinWidth,h=l?.maxWidth??r?.defaultMaxWidth,u=i.getMinWidth(),p=i.getMaxWidth(),m="number"==typeof g&&g>u?g:u,v="number"==typeof h&&hv?(f=v,d(i),c=!1):0===a&&(f=o),i.setActualWidth(f,t,!0),o-=f}}}g.forEach((e=>{e.fireColumnWidthChangedEvent(t)})),this.visibleColsService.setLeftValues(t),this.visibleColsService.updateBodyWidths(),a||this.eventDispatcher.columnResized(g,!0,t)}applyAutosizeStrategy(){const e=this.gos.get("autoSizeStrategy");if(!e)return;const{type:t}=e;setTimeout((()=>{if("fitGridWidth"===t){const{columnLimits:t,defaultMinWidth:a,defaultMaxWidth:r}=e,n=t?.map((({colId:e,minWidth:t,maxWidth:a})=>({key:e,minWidth:t,maxWidth:a})));this.ctrlsService.getGridBodyCtrl().sizeColumnsToFit({defaultMinWidth:a,defaultMaxWidth:r,columnLimits:n})}else"fitProvidedWidth"===t&&this.sizeColumnsToFit(e.width,"sizeColumnsToFit")}))}};function Ht(e,t){return e+"_"+t}function qt(e){return e instanceof Vt}var Vt=class extends Ke{constructor(e,t,a,r){super(),this.isColumn=!1,this.displayedChildren=[],this.autoHeaderHeight=null,this.parent=null,this.groupId=t,this.partId=a,this.providedColumnGroup=e,this.pinned=r}reset(){this.parent=null,this.children=null,this.displayedChildren=null}getParent(){return this.parent}setParent(e){this.parent=e}getUniqueId(){return Ht(this.groupId,this.partId)}isEmptyGroup(){return 0===this.displayedChildren.length}isMoving(){const e=this.getProvidedColumnGroup().getLeafColumns();return!(!e||0===e.length)&&e.every((e=>e.isMoving()))}checkLeft(){if(this.displayedChildren.forEach((e=>{qt(e)&&e.checkLeft()})),this.displayedChildren.length>0)if(this.gos.get("enableRtl")){const e=ze(this.displayedChildren).getLeft();this.setLeft(e)}else{const e=this.displayedChildren[0].getLeft();this.setLeft(e)}else this.setLeft(null)}getLeft(){return this.left}getOldLeft(){return this.oldLeft}setLeft(e){this.oldLeft=this.left,this.left!==e&&(this.left=e,this.dispatchLocalEvent({type:"leftChanged"}))}getPinned(){return this.pinned}getGroupId(){return this.groupId}getPartId(){return this.partId}getActualWidth(){let e=0;return this.displayedChildren&&this.displayedChildren.forEach((t=>{e+=t.getActualWidth()})),e}isResizable(){if(!this.displayedChildren)return!1;let e=!1;return this.displayedChildren.forEach((t=>{t.isResizable()&&(e=!0)})),e}getMinWidth(){let e=0;return this.displayedChildren.forEach((t=>{e+=t.getMinWidth()})),e}addChild(e){this.children||(this.children=[]),this.children.push(e)}getDisplayedChildren(){return this.displayedChildren}getLeafColumns(){const e=[];return this.addLeafColumns(e),e}getDisplayedLeafColumns(){const e=[];return this.addDisplayedLeafColumns(e),e}getDefinition(){return this.providedColumnGroup.getColGroupDef()}getColGroupDef(){return this.providedColumnGroup.getColGroupDef()}isPadding(){return this.providedColumnGroup.isPadding()}isExpandable(){return this.providedColumnGroup.isExpandable()}isExpanded(){return this.providedColumnGroup.isExpanded()}setExpanded(e){this.providedColumnGroup.setExpanded(e)}isAutoHeaderHeight(){return!!this.getColGroupDef()?.autoHeaderHeight}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(e){const t=e!==this.autoHeaderHeight;return this.autoHeaderHeight=e,t}addDisplayedLeafColumns(e){this.displayedChildren.forEach((t=>{vt(t)?e.push(t):qt(t)&&t.addDisplayedLeafColumns(e)}))}addLeafColumns(e){this.children.forEach((t=>{vt(t)?e.push(t):qt(t)&&t.addLeafColumns(e)}))}getChildren(){return this.children}getColumnGroupShow(){return this.providedColumnGroup.getColumnGroupShow()}getProvidedColumnGroup(){return this.providedColumnGroup}getPaddingLevel(){const e=this.getParent();return this.isPadding()&&e&&e.isPadding()?1+e.getPaddingLevel():0}calculateDisplayedColumns(){this.displayedChildren=[];let e=this;for(;null!=e&&e.isPadding();)e=e.getParent();if(!(!!e&&e.getProvidedColumnGroup().isExpandable()))return this.displayedChildren=this.children,void this.dispatchLocalEvent({type:"displayedChildrenChanged"});this.children.forEach((t=>{if(qt(t)&&(!t.displayedChildren||!t.displayedChildren.length))return;switch(t.getColumnGroupShow()){case"open":e.getProvidedColumnGroup().isExpanded()&&this.displayedChildren.push(t);break;case"closed":e.getProvidedColumnGroup().isExpanded()||this.displayedChildren.push(t);break;default:this.displayedChildren.push(t)}})),this.dispatchLocalEvent({type:"displayedChildrenChanged"})}},Wt=class{constructor(){this.existingIds={}}getInstanceIdForKey(e){const t=this.existingIds[e];let a;return a="number"!=typeof t?0:t+1,this.existingIds[e]=a,a}},jt=class extends Ke{constructor(){super(...arguments),this.beanName="visibleColsService",this.colsAndGroupsMap={},this.columnsLeft=[],this.columnsRight=[],this.columnsCenter=[],this.columns=[],this.bodyWidth=0,this.leftWidth=0,this.rightWidth=0,this.bodyWidthDirty=!0}wireBeans(e){this.columnModel=e.columnModel,this.columnSizeService=e.columnSizeService,this.columnViewportService=e.columnViewportService,this.eventDispatcher=e.columnEventDispatcher}refresh(e,t=!1){t||this.buildTrees(),this.updateOpenClosedVisibilityInColumnGroups(),this.columnsLeft=Kt(this.treeLeft),this.columnsCenter=Kt(this.treeCenter),this.columnsRight=Kt(this.treeRight),this.joinColsAriaOrder(),this.joinCols(),this.setLeftValues(e),this.autoHeightCols=this.columns.filter((e=>e.isAutoHeight())),this.columnSizeService.refreshFlexedColumns(),this.updateBodyWidths(),this.columnViewportService.checkViewportColumns(!1),this.setFirstRightAndLastLeftPinned(e),this.eventDispatcher.visibleCols(e)}updateBodyWidths(){const e=$e(this.columnsCenter),t=$e(this.columnsLeft),a=$e(this.columnsRight);this.bodyWidthDirty=this.bodyWidth!==e;(this.bodyWidth!==e||this.leftWidth!==t||this.rightWidth!==a)&&(this.bodyWidth=e,this.leftWidth=t,this.rightWidth=a,this.eventService.dispatchEvent({type:"columnContainerWidthChanged"}),this.eventService.dispatchEvent({type:"displayedColumnsWidthChanged"}))}setLeftValues(e){this.setLeftValuesOfCols(e),this.setLeftValuesOfGroups()}setFirstRightAndLastLeftPinned(e){let t,a;this.gos.get("enableRtl")?(t=this.columnsLeft?this.columnsLeft[0]:null,a=this.columnsRight?ze(this.columnsRight):null):(t=this.columnsLeft?ze(this.columnsLeft):null,a=this.columnsRight?this.columnsRight[0]:null),this.columnModel.getCols().forEach((r=>{r.setLastLeftPinned(r===t,e),r.setFirstRightPinned(r===a,e)}))}buildTrees(){const e=this.columnModel.getColsToShow(),t=e.filter((e=>"left"==e.getPinned())),a=e.filter((e=>"right"==e.getPinned())),r=e.filter((e=>"left"!=e.getPinned()&&"right"!=e.getPinned())),n=new Wt;this.treeLeft=this.createGroups({columns:t,idCreator:n,pinned:"left",oldDisplayedGroups:this.treeLeft}),this.treeRight=this.createGroups({columns:a,idCreator:n,pinned:"right",oldDisplayedGroups:this.treeRight}),this.treeCenter=this.createGroups({columns:r,idCreator:n,pinned:null,oldDisplayedGroups:this.treeCenter}),this.updateColsAndGroupsMap()}clear(){this.columnsLeft=[],this.columnsRight=[],this.columnsCenter=[],this.columns=[],this.ariaOrderColumns=[]}joinColsAriaOrder(){const e=this.columnModel.getCols(),t=[],a=[],r=[];for(const n of e){const e=n.getPinned();e?!0===e||"left"===e?t.push(n):r.push(n):a.push(n)}this.ariaOrderColumns=t.concat(a).concat(r)}getAriaColIndex(e){let t;return t=qt(e)?e.getLeafColumns()[0]:e,this.ariaOrderColumns.indexOf(t)+1}getAllAutoHeightCols(){return this.autoHeightCols}setLeftValuesOfGroups(){[this.treeLeft,this.treeRight,this.treeCenter].forEach((e=>{e.forEach((e=>{if(qt(e)){e.checkLeft()}}))}))}setLeftValuesOfCols(e){if(!this.columnModel.getColDefCols())return;const t=this.columnModel.getCols().slice(0),a=this.gos.get("enableRtl");[this.columnsLeft,this.columnsRight,this.columnsCenter].forEach((r=>{if(a){let t=$e(r);r.forEach((a=>{t-=a.getActualWidth(),a.setLeft(t,e)}))}else{let t=0;r.forEach((a=>{a.setLeft(t,e),t+=a.getActualWidth()}))}!function(e,t){for(let a=0;a{t.setLeft(null,e)}))}joinCols(){this.gos.get("enableRtl")?this.columns=this.columnsRight.concat(this.columnsCenter).concat(this.columnsLeft):this.columns=this.columnsLeft.concat(this.columnsCenter).concat(this.columnsRight)}getColsCenter(){return this.columnsCenter}getAllTrees(){return this.treeLeft&&this.treeRight&&this.treeCenter?this.treeLeft.concat(this.treeCenter).concat(this.treeRight):null}getTreeLeft(){return this.treeLeft}getTreeRight(){return this.treeRight}getTreeCenter(){return this.treeCenter}getAllCols(){return this.columns}isColDisplayed(e){return this.getAllCols().indexOf(e)>=0}getLeftColsForRow(e){return this.columnModel.isColSpanActive()?this.getColsForRow(e,this.columnsLeft):this.columnsLeft}getRightColsForRow(e){return this.columnModel.isColSpanActive()?this.getColsForRow(e,this.columnsRight):this.columnsRight}getColsForRow(e,t,a,r){const n=[];let o=null;for(let i=0;i1){const e=g-1;for(let a=1;a<=e;a++)c.push(t[i+a]);i+=e}let d;if(a?(d=!1,c.forEach((e=>{a(e)&&(d=!0)}))):d=!0,d){if(0===n.length&&o){!!r&&r(s)&&n.push(o)}n.push(s)}o=s}return n}getBodyContainerWidth(){return this.bodyWidth}getContainerWidth(e){switch(e){case"left":return this.leftWidth;case"right":return this.rightWidth;default:return this.bodyWidth}}getCenterCols(){return this.columnsCenter}getLeftCols(){return this.columnsLeft}getRightCols(){return this.columnsRight}getColBefore(e){const t=this.getAllCols(),a=t.indexOf(e);return a>0?t[a-1]:null}getGroupAtDirection(e,t){const a=e.getProvidedColumnGroup().getLevel()+e.getPaddingLevel(),r=e.getDisplayedLeafColumns(),n="After"===t?ze(r):r[0],o=`getCol${t}`;for(;;){const t=this[o](n);if(!t)return null;const r=this.getColGroupAtLevel(t,a);if(r!==e)return r}}getColGroupAtLevel(e,t){let a,r,n=e.getParent();for(;;){if(a=n.getProvidedColumnGroup().getLevel(),r=n.getPaddingLevel(),a+r<=t)break;n=n.getParent()}return n}isPinningLeft(){return this.columnsLeft.length>0}isPinningRight(){return this.columnsRight.length>0}updateColsAndGroupsMap(){this.colsAndGroupsMap={};const e=e=>{this.colsAndGroupsMap[e.getUniqueId()]=e};Ut(this.treeCenter,!1,e),Ut(this.treeLeft,!1,e),Ut(this.treeRight,!1,e)}isVisible(e){return this.colsAndGroupsMap[e.getUniqueId()]===e}updateOpenClosedVisibilityInColumnGroups(){Ut(this.getAllTrees(),!1,(e=>{qt(e)&&e.calculateDisplayedColumns()}))}getFirstColumn(){const e=this.gos.get("enableRtl"),t=["getLeftCols","getCenterCols","getRightCols"];e&&t.reverse();for(let a=0;a{if(qt(a)){const o=a;let i;i=r?e===o.getGroupId()&&t===o.getPartId():e===o.getGroupId(),i&&(n=o)}})),n}getColAfter(e){const t=this.getAllCols(),a=t.indexOf(e);return a{const g=t;t=n;const c=e[g],d=(qt(c)?c.getProvidedColumnGroup():c).getOriginalParent();if(null==d){for(let t=g;t{e.forEach((e=>{if(qt(e)){const r=e;t[e.getUniqueId()]=r,a(r.getChildren())}}))};return e&&a(e),t}setupParentsIntoCols(e,t){e.forEach((e=>{if(e.setParent(t),qt(e)){const t=e;this.setupParentsIntoCols(t.getChildren(),t)}}))}};function Ut(e,t,a){if(e)for(let r=0;r{vt(e)&&t.push(e)})),t}var Yt=["columnEverythingChanged","newColumnsLoaded","columnPivotModeChanged","pivotMaxColumnsExceeded","columnRowGroupChanged","expandOrCollapseAll","columnPivotChanged","gridColumnsChanged","columnValueChanged","columnMoved","columnVisible","columnPinned","columnGroupOpened","columnResized","displayedColumnsChanged","virtualColumnsChanged","columnHeaderMouseOver","columnHeaderMouseLeave","columnHeaderClicked","columnHeaderContextMenu","asyncTransactionsFlushed","rowGroupOpened","rowDataUpdated","pinnedRowDataChanged","rangeSelectionChanged","cellSelectionChanged","chartCreated","chartRangeSelectionChanged","chartOptionsChanged","chartDestroyed","toolPanelVisibleChanged","toolPanelSizeChanged","modelUpdated","cutStart","cutEnd","pasteStart","pasteEnd","fillStart","fillEnd","cellSelectionDeleteStart","cellSelectionDeleteEnd","rangeDeleteStart","rangeDeleteEnd","undoStarted","undoEnded","redoStarted","redoEnded","cellClicked","cellDoubleClicked","cellMouseDown","cellContextMenu","cellValueChanged","cellEditRequest","rowValueChanged","headerFocused","cellFocused","rowSelected","selectionChanged","tooltipShow","tooltipHide","cellKeyDown","cellMouseOver","cellMouseOut","filterChanged","filterModified","filterOpened","advancedFilterBuilderVisibleChanged","sortChanged","virtualRowRemoved","rowClicked","rowDoubleClicked","gridReady","gridPreDestroyed","gridSizeChanged","viewportChanged","firstDataRendered","dragStarted","dragStopped","dragCancelled","rowEditingStarted","rowEditingStopped","cellEditingStarted","cellEditingStopped","bodyScroll","bodyScrollEnd","paginationChanged","componentStateChanged","storeRefreshed","stateUpdated","columnMenuVisibleChanged","contextMenuVisibleChanged","rowDragEnter","rowDragMove","rowDragLeave","rowDragEnd","rowDragCancel"],Qt=[...Yt,"scrollbarWidthChanged","keyShortcutChangedCellStart","keyShortcutChangedCellEnd","pinnedHeightChanged","cellFocusCleared","fullWidthRowFocused","checkboxChanged","heightScaleChanged","suppressMovableColumns","suppressMenuHide","suppressFieldDotNotation","columnPanelItemDragStart","columnPanelItemDragEnd","bodyHeightChanged","columnContainerWidthChanged","displayedColumnsWidthChanged","scrollVisibilityChanged","scrollGapChanged","columnHoverChanged","flashCells","paginationPixelOffsetChanged","displayedRowsChanged","leftPinnedWidthChanged","rightPinnedWidthChanged","rowContainerHeightChanged","headerHeightChanged","columnGroupHeaderHeightChanged","columnHeaderHeightChanged","gridStylesChanged","storeUpdated","filterDestroyed","rowDataUpdateStarted","rowCountReady","advancedFilterEnabledChanged","dataTypesInferred","fieldValueChanged","fieldPickerValueSelected","richSelectListRowSelected","sideBarUpdated","alignedGridScroll","alignedGridColumn","gridOptionsChanged","chartTitleEdit","recalculateRowBounds","stickyTopOffsetChanged","overlayExclusiveChanged"],_t={enableBrowserTooltips:!0,tooltipTrigger:!0,tooltipMouseTrack:!0,tooltipShowMode:!0,tooltipInteraction:!0,defaultColGroupDef:!0,suppressAutoSize:!0,skipHeaderOnAutoSize:!0,autoSizeStrategy:!0,components:!0,stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,undoRedoCellEditingLimit:!0,excelStyles:!0,cacheQuickFilter:!0,advancedFilterModel:!0,customChartThemes:!0,chartThemeOverrides:!0,chartToolPanelsDef:!0,loadingCellRendererSelector:!0,localeText:!0,keepDetailRows:!0,keepDetailRowsCount:!0,detailRowHeight:!0,detailRowAutoHeight:!0,tabIndex:!0,valueCache:!0,valueCacheNeverExpires:!0,enableCellExpressions:!0,suppressTouch:!0,suppressAsyncEvents:!0,suppressBrowserResizeObserver:!0,suppressPropertyNamesCheck:!0,debug:!0,dragAndDropImageComponent:!0,loadingOverlayComponent:!0,suppressLoadingOverlay:!0,noRowsOverlayComponent:!0,paginationPageSizeSelector:!0,paginateChildRows:!0,pivotPanelShow:!0,pivotSuppressAutoColumn:!0,suppressExpandablePivotGroups:!0,aggFuncs:!0,suppressAggFuncInHeader:!0,allowShowChangeAfterFilter:!0,ensureDomOrder:!0,enableRtl:!0,suppressColumnVirtualisation:!0,suppressMaxRenderedRowRestriction:!0,suppressRowVirtualisation:!0,rowDragText:!0,suppressGroupMaintainValueType:!0,groupLockGroupColumns:!0,rowGroupPanelSuppressSort:!0,suppressGroupRowsSticky:!0,rowModelType:!0,cacheOverflowSize:!0,infiniteInitialRowCount:!0,serverSideInitialRowCount:!0,suppressServerSideInfiniteScroll:!0,maxBlocksInCache:!0,maxConcurrentDatasourceRequests:!0,blockLoadDebounceMillis:!0,serverSideOnlyRefreshFilteredGroups:!0,serverSidePivotResultFieldSeparator:!0,viewportRowModelPageSize:!0,viewportRowModelBufferSize:!0,debounceVerticalScrollbar:!0,suppressAnimationFrame:!0,suppressPreventDefaultOnMouseWheel:!0,scrollbarWidth:!0,icons:!0,suppressRowTransform:!0,gridId:!0,enableGroupEdit:!0,initialState:!0,processUnpinnedColumns:!0,createChartContainer:!0,getLocaleText:!0,getRowId:!0,reactiveCustomComponents:!0,columnMenu:!0,suppressSetFilterByDefault:!0},Zt=class{};Zt.STRING_PROPERTIES=["overlayLoadingTemplate","overlayNoRowsTemplate","gridId","quickFilterText","rowModelType","editType","domLayout","clipboardDelimiter","rowGroupPanelShow","multiSortKey","pivotColumnGroupTotals","pivotRowTotals","pivotPanelShow","fillHandleDirection","groupDisplayType","treeDataDisplayType","colResizeDefault","tooltipTrigger","serverSidePivotResultFieldSeparator","columnMenu","tooltipShowMode","grandTotalRow"],Zt.OBJECT_PROPERTIES=["components","rowStyle","context","autoGroupColumnDef","localeText","icons","datasource","dragAndDropImageComponentParams","serverSideDatasource","viewportDatasource","groupRowRendererParams","aggFuncs","fullWidthCellRendererParams","defaultColGroupDef","defaultColDef","defaultCsvExportParams","defaultExcelExportParams","columnTypes","rowClassRules","detailCellRendererParams","loadingCellRendererParams","loadingOverlayComponentParams","noRowsOverlayComponentParams","popupParent","statusBar","sideBar","theme","chartThemeOverrides","customChartThemes","chartToolPanelsDef","dataTypeDefinitions","advancedFilterModel","advancedFilterParent","advancedFilterBuilderParams","initialState","autoSizeStrategy","cellSelection","selectionColumnDef"],Zt.ARRAY_PROPERTIES=["sortingOrder","alignedGrids","rowData","columnDefs","excelStyles","pinnedTopRowData","pinnedBottomRowData","chartThemes","rowClass","paginationPageSizeSelector"],Zt.NUMBER_PROPERTIES=["rowHeight","detailRowHeight","rowBuffer","headerHeight","groupHeaderHeight","groupLockGroupColumns","floatingFiltersHeight","pivotHeaderHeight","pivotGroupHeaderHeight","groupDefaultExpanded","pivotDefaultExpanded","viewportRowModelPageSize","viewportRowModelBufferSize","autoSizePadding","maxBlocksInCache","maxConcurrentDatasourceRequests","tooltipShowDelay","tooltipHideDelay","cacheOverflowSize","paginationPageSize","cacheBlockSize","infiniteInitialRowCount","serverSideInitialRowCount","scrollbarWidth","asyncTransactionWaitMillis","blockLoadDebounceMillis","keepDetailRowsCount","undoRedoCellEditingLimit","cellFlashDelay","cellFadeDelay","cellFlashDuration","cellFadeDuration","tabIndex","pivotMaxGeneratedColumns"],Zt.BOOLEAN_PROPERTIES=["suppressMakeColumnVisibleAfterUnGroup","suppressRowClickSelection","suppressCellFocus","suppressHeaderFocus","suppressHorizontalScroll","groupSelectsChildren","alwaysShowHorizontalScroll","alwaysShowVerticalScroll","debug","enableBrowserTooltips","enableCellExpressions","groupIncludeTotalFooter","groupSuppressBlankHeader","suppressMenuHide","suppressRowDeselection","unSortIcon","suppressMultiSort","alwaysMultiSort","singleClickEdit","suppressLoadingOverlay","suppressNoRowsOverlay","suppressAutoSize","skipHeaderOnAutoSize","suppressColumnMoveAnimation","suppressMoveWhenColumnDragging","suppressMovableColumns","suppressFieldDotNotation","enableRangeSelection","enableRangeHandle","enableFillHandle","suppressClearOnFillReduction","deltaSort","suppressTouch","suppressAsyncEvents","allowContextMenuWithControlKey","suppressContextMenu","enableCellChangeFlash","suppressDragLeaveHidesColumns","suppressRowGroupHidesColumns","suppressMiddleClickScrolls","suppressPreventDefaultOnMouseWheel","suppressCopyRowsToClipboard","copyHeadersToClipboard","copyGroupHeadersToClipboard","pivotMode","suppressAggFuncInHeader","suppressColumnVirtualisation","alwaysAggregateAtRootLevel","suppressFocusAfterRefresh","functionsReadOnly","animateRows","groupSelectsFiltered","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","enableRtl","suppressClickEdit","rowDragEntireRow","rowDragManaged","suppressRowDrag","suppressMoveWhenRowDragging","rowDragMultiRow","enableGroupEdit","embedFullWidthRows","suppressPaginationPanel","groupHideOpenParents","groupAllowUnbalanced","pagination","paginationAutoPageSize","suppressScrollOnNewData","suppressScrollWhenPopupsAreOpen","purgeClosedRowNodes","cacheQuickFilter","includeHiddenColumnsInQuickFilter","ensureDomOrder","accentedSort","suppressChangeDetection","valueCache","valueCacheNeverExpires","aggregateOnlyChangedColumns","suppressAnimationFrame","suppressExcelExport","suppressCsvExport","includeHiddenColumnsInAdvancedFilter","suppressMultiRangeSelection","enterNavigatesVerticallyAfterEdit","enterNavigatesVertically","suppressPropertyNamesCheck","rowMultiSelectWithClick","suppressRowHoverHighlight","suppressRowTransform","suppressClipboardPaste","suppressLastEmptyLineOnPaste","enableCharts","suppressMaintainUnsortedOrder","enableCellTextSelection","suppressBrowserResizeObserver","suppressMaxRenderedRowRestriction","excludeChildrenWhenTreeDataFiltering","tooltipMouseTrack","tooltipInteraction","keepDetailRows","paginateChildRows","preventDefaultOnContextMenu","undoRedoCellEditing","allowDragFromColumnsToolPanel","pivotSuppressAutoColumn","suppressExpandablePivotGroups","debounceVerticalScrollbar","detailRowAutoHeight","serverSideSortAllLevels","serverSideEnableClientSideSort","serverSideOnlyRefreshFilteredGroups","serverSideSortOnServer","serverSideFilterOnServer","suppressAggFilteredOnly","showOpenedGroup","suppressClipboardApi","suppressModelUpdateAfterUpdateTransaction","stopEditingWhenCellsLoseFocus","groupMaintainOrder","columnHoverHighlight","readOnlyEdit","suppressRowVirtualisation","enableCellEditingOnBackspace","resetRowDataOnUpdate","removePivotHeaderRowWhenSingleValueColumn","suppressCopySingleCellRanges","suppressGroupRowsSticky","suppressCutToClipboard","suppressServerSideInfiniteScroll","rowGroupPanelSuppressSort","allowShowChangeAfterFilter","enableAdvancedFilter","masterDetail","treeData","suppressGroupMaintainValueType","reactiveCustomComponents","applyQuickFilterBeforePivotOrAgg","suppressServerSideFullWidthLoadingRow","suppressAdvancedFilterEval","loading","maintainColumnOrder","enableStrictPivotColumnOrder","suppressSetFilterByDefault"],Zt.OTHER_PROPERTIES=["suppressStickyTotalRow","loadThemeGoogleFonts","rowSelection"],Zt.FUNCTION_PROPERTIES=["doesExternalFilterPass","processPivotResultColDef","processPivotResultColGroupDef","getBusinessKeyForNode","isRowSelectable","rowDragText","groupRowRenderer","dragAndDropImageComponent","fullWidthCellRenderer","loadingCellRenderer","loadingOverlayComponent","noRowsOverlayComponent","detailCellRenderer","quickFilterParser","quickFilterMatcher","getLocaleText","isExternalFilterPresent","getRowHeight","getRowClass","getRowStyle","getContextMenuItems","getMainMenuItems","processRowPostCreate","processCellForClipboard","getGroupRowAgg","isFullWidthRow","sendToClipboard","focusGridInnerElement","navigateToNextHeader","tabToNextHeader","navigateToNextCell","tabToNextCell","processCellFromClipboard","getDocument","postProcessPopup","getChildCount","getDataPath","isRowMaster","postSortRows","processHeaderForClipboard","processUnpinnedColumns","processGroupHeaderForClipboard","paginationNumberFormatter","processDataFromClipboard","getServerSideGroupKey","isServerSideGroup","createChartContainer","getChartToolbarItems","fillOperation","isApplyServerSideTransaction","getServerSideGroupLevelParams","isServerSideGroupOpenByDefault","isGroupOpenByDefault","initialGroupOrderComparator","groupIncludeFooter","loadingCellRendererSelector","getRowId","groupAggFiltering","chartMenuItems","groupTotalRow"],Zt.ALL_PROPERTIES=[...Zt.ARRAY_PROPERTIES,...Zt.OBJECT_PROPERTIES,...Zt.STRING_PROPERTIES,...Zt.NUMBER_PROPERTIES,...Zt.FUNCTION_PROPERTIES,...Zt.BOOLEAN_PROPERTIES,...Zt.OTHER_PROPERTIES];var Jt=Zt,Xt=class{static getCallbackForEvent(e){return!e||e.length<2?e:"on"+e[0].toUpperCase()+e.substring(1)}};Xt.VUE_OMITTED_PROPERTY="AG-VUE-OMITTED-PROPERTY",Xt.PUBLIC_EVENTS=Yt,Xt.EVENT_CALLBACKS=Qt.map((e=>Xt.getCallbackForEvent(e))),Xt.BOOLEAN_PROPERTIES=Jt.BOOLEAN_PROPERTIES,Xt.ALL_PROPERTIES=Jt.ALL_PROPERTIES,Xt.ALL_PROPERTIES_AND_CALLBACKS=[...Xt.ALL_PROPERTIES,...Xt.EVENT_CALLBACKS],Xt.ALL_PROPERTIES_AND_CALLBACKS_SET=new Set(Xt.ALL_PROPERTIES_AND_CALLBACKS);var $t=Xt;function ea(e,t){"object"!=typeof e&&(e={});const a={...e};return $t.ALL_PROPERTIES_AND_CALLBACKS.forEach((e=>{const r=t[e];void 0!==r&&r!==$t.VUE_OMITTED_PROPERTY&&(a[e]=r)})),a}function ta(e,t){if(!e)return;const a={};let r=!1;if(Object.keys(e).filter((e=>$t.ALL_PROPERTIES_AND_CALLBACKS_SET.has(e))).forEach((t=>{a[t]=e[t],r=!0})),!r)return;const n={type:"gridOptionsChanged",options:a};t.dispatchEvent(n);const o={type:"componentStateChanged"};it(a,((e,t)=>{o[e]=t})),t.dispatchEvent(o)}var aa=class extends Ke{};function ra(e,t,a){return a&&e.addDestroyFunc((()=>t.destroyBean(a))),a??e}var na,oa,ia,sa,la,ga,ca,da,ha,ua,pa=class{constructor(e){this.cssClassStates={},this.getGui=e}addCssClass(e){const t=(e||"").split(" ");if(t.length>1)return void t.forEach((e=>this.addCssClass(e)));if(!0!==this.cssClassStates[e]&&e.length){const t=this.getGui();t&&t.classList.add(e),this.cssClassStates[e]=!0}}removeCssClass(e){const t=(e||"").split(" ");if(t.length>1)return void t.forEach((e=>this.removeCssClass(e)));if(!1!==this.cssClassStates[e]&&e.length){const t=this.getGui();t&&t.classList.remove(e),this.cssClassStates[e]=!1}}containsCssClass(e){const t=this.getGui();return!!t&&t.classList.contains(e)}addOrRemoveCssClass(e,t){if(!e)return;if(e.indexOf(" ")>=0){const a=(e||"").split(" ");if(a.length>1)return void a.forEach((e=>this.addOrRemoveCssClass(e,t)))}if(this.cssClassStates[e]!==t&&e.length){const a=this.getGui();a&&a.classList.toggle(e,t),this.cssClassStates[e]=t}}};function ma(e,t,a){null==a||"string"==typeof a&&""==a?fa(e,t):va(e,t,a)}function va(e,t,a){e.setAttribute(ba(t),a.toString())}function fa(e,t){e.removeAttribute(ba(t))}function ba(e){return`aria-${e}`}function wa(e,t){t?e.setAttribute("role",t):e.removeAttribute("role")}function Ca(e){return parseInt(e.getAttribute("aria-posinset"),10)}function ya(e,t){ma(e,"label",t)}function ka(e,t){ma(e,"labelledby",t)}function Sa(e,t){ma(e,"describedby",t)}function xa(e,t){ma(e,"live",t)}function za(e,t){ma(e,"level",t)}function Ea(e,t){ma(e,"disabled",t)}function Ra(e,t){ma(e,"hidden",t)}function Ma(e,t){ma(e,"activedescendant",t)}function Fa(e,t){va(e,"expanded",t)}function Da(e){fa(e,"expanded")}function Aa(e,t){va(e,"setsize",t)}function Pa(e,t){va(e,"posinset",t)}function Ta(e,t){va(e,"rowcount",t)}function Ia(e,t){va(e,"rowindex",t)}function La(e,t){va(e,"colcount",t)}function Oa(e,t){va(e,"colindex",t)}function Na(e,t){va(e,"colspan",t)}function Ga(e,t){va(e,"sort",t)}function Ba(e){fa(e,"sort")}function Ha(e,t){ma(e,"selected",t)}function qa(e,t){va(e,"checked",void 0===t?"mixed":t)}function Va(e,t){ma(e,"controls",t.id),ka(t,e.id)}function Wa(e,t){return void 0===t?e("ariaIndeterminate","indeterminate"):!0===t?e("ariaChecked","checked"):e("ariaUnchecked","unchecked")}function ja(){return void 0===na&&(na=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),na}function Ua(){if(void 0===oa)if(ja()){const e=navigator.userAgent.match(/version\/(\d+)/i);e&&(oa=null!=e[1]?parseFloat(e[1]):0)}else oa=0;return oa}function Ka(){if(void 0===ia){const e=window;ia=!!e.chrome&&(!!e.chrome.webstore||!!e.chrome.runtime)||/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}return ia}function Ya(){return void 0===sa&&(sa=/(firefox)/i.test(navigator.userAgent)),sa}function Qa(){return void 0===la&&(la=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)),la}function _a(){return void 0===ga&&(ga=/iPad|iPhone|iPod/.test(navigator.platform)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1),ga}function Za(){return!ja()||Ua()>=15}function Ja(e){if(!e)return null;const t=e.tabIndex,a=e.getAttribute("tabIndex");return-1!==t||null!==a&&(""!==a||Ya())?t.toString():null}function Xa(){const e=document.body,t=document.createElement("div");t.style.width=t.style.height="100px",t.style.opacity="0",t.style.overflow="scroll",t.style.msOverflowStyle="scrollbar",t.style.position="absolute",e.appendChild(t);let a=t.offsetWidth-t.clientWidth;0===a&&0===t.clientWidth&&(a=null),t.parentNode&&t.parentNode.removeChild(t),null!=a&&(da=a,ca=0===a)}function $a(){return null==ca&&Xa(),ca}function er(e,t,a){const r=e.parentElement;let n=r&&r.firstChild;for(;n;)t&&n.classList.toggle(t,n===e),a&&n.classList.toggle(a,n!==e),n=n.nextSibling}var tr="[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";function ar(e){const t=Element.prototype.matches||Element.prototype.msMatchesSelector,a=t.call(e,"input, select, button, textarea"),r=t.call(e,tr),n=wr(e);return a&&!r&&n}function rr(e,t,a={}){const{skipAriaHidden:r}=a;e.classList.toggle("ag-hidden",!t),r||Ra(e,!t)}function nr(e,t,a={}){const{skipAriaHidden:r}=a;e.classList.toggle("ag-invisible",!t),r||Ra(e,!t)}function or(e,t){const a="disabled",r=t?e=>e.setAttribute(a,""):e=>e.removeAttribute(a);r(e),Dr(e.querySelectorAll("input"),(e=>r(e)))}function ir(e,t,a){let r=0;for(;e;){if(e.classList.contains(t))return!0;if(e=e.parentElement,"number"==typeof a){if(++r>a)break}else if(e===a)break}return!1}function sr(e){const{height:t,width:a,borderTopWidth:r,borderRightWidth:n,borderBottomWidth:o,borderLeftWidth:i,paddingTop:s,paddingRight:l,paddingBottom:g,paddingLeft:c,marginTop:d,marginRight:h,marginBottom:u,marginLeft:p,boxSizing:m}=window.getComputedStyle(e);return{height:parseFloat(t||"0"),width:parseFloat(a||"0"),borderTopWidth:parseFloat(r||"0"),borderRightWidth:parseFloat(n||"0"),borderBottomWidth:parseFloat(o||"0"),borderLeftWidth:parseFloat(i||"0"),paddingTop:parseFloat(s||"0"),paddingRight:parseFloat(l||"0"),paddingBottom:parseFloat(g||"0"),paddingLeft:parseFloat(c||"0"),marginTop:parseFloat(d||"0"),marginRight:parseFloat(h||"0"),marginBottom:parseFloat(u||"0"),marginLeft:parseFloat(p||"0"),boxSizing:m}}function lr(e){const t=sr(e);return"border-box"===t.boxSizing?t.height-t.paddingTop-t.paddingBottom:t.height}function gr(e){const t=sr(e);return"border-box"===t.boxSizing?t.width-t.paddingLeft-t.paddingRight:t.width}function cr(e){const{height:t,marginBottom:a,marginTop:r}=sr(e);return Math.floor(t+a+r)}function dr(e){const{width:t,marginLeft:a,marginRight:r}=sr(e);return Math.floor(t+a+r)}function hr(e){const t=e.getBoundingClientRect(),{borderTopWidth:a,borderLeftWidth:r,borderRightWidth:n,borderBottomWidth:o}=sr(e);return{top:t.top+(a||0),left:t.left+(r||0),right:t.right+(n||0),bottom:t.bottom+(o||0)}}function ur(){if("boolean"==typeof ua)return ua;const e=document.createElement("div");return e.style.direction="rtl",e.style.width="1px",e.style.height="1px",e.style.position="fixed",e.style.top="0px",e.style.overflow="hidden",e.dir="rtl",e.innerHTML='
\n \n \n
',document.body.appendChild(e),e.scrollLeft=1,ua=0===Math.floor(e.scrollLeft),document.body.removeChild(e),ua}function pr(e,t){let a=e.scrollLeft;return t&&(a=Math.abs(a),Ka()&&!ur()&&(a=e.scrollWidth-e.getBoundingClientRect().width-a)),a}function mr(e,t,a){a&&(ur()?t*=-1:(ja()||Ka())&&(t=e.scrollWidth-e.getBoundingClientRect().width-t)),e.scrollLeft=t}function vr(e){for(;e&&e.firstChild;)e.removeChild(e.firstChild)}function fr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function br(e){return!!e.offsetParent}function wr(e){const t=e;if(t.checkVisibility)return t.checkVisibility({checkVisibilityCSS:!0});return!(!br(e)||"visible"!==window.getComputedStyle(e).visibility)}function Cr(e){const t=document.createElement("div");return t.innerHTML=(e||"").trim(),t.firstChild}function yr(e,t,a){a&&a.nextSibling===t||(a?a.nextSibling?e.insertBefore(t,a.nextSibling):e.appendChild(t):e.firstChild&&e.firstChild!==t&&e.insertAdjacentElement("afterbegin",t))}function kr(e,t){for(let a=0;a`-${e.toLocaleLowerCase()}`)),n=r.toString(),o=n.replace(/\s*!important/g,""),i=o.length!=n.length?"important":void 0;e.style.setProperty(t,o,i)}}function xr(e,t){"flex"===t?(e.style.removeProperty("width"),e.style.removeProperty("minWidth"),e.style.removeProperty("maxWidth"),e.style.flex="1 1 auto"):zr(e,t)}function zr(e,t){t=Rr(t),e.style.width=t.toString(),e.style.maxWidth=t.toString(),e.style.minWidth=t.toString()}function Er(e,t){t=Rr(t),e.style.height=t.toString(),e.style.maxHeight=t.toString(),e.style.minHeight=t.toString()}function Rr(e){return"number"==typeof e?`${e}px`:e}function Mr(e){return e instanceof Node||e instanceof HTMLElement}function Fr(e,t,a){null==a||""===a?e.removeAttribute(t):e.setAttribute(t,a.toString())}function Dr(e,t){if(null!=e)for(let a=0;a{const a=e.getGui();null!=a&&("object"==typeof a?t.appendChild(a):t.innerHTML=a)}))}var Pr=class{constructor(e=0,t=1){this.nextValue=e,this.step=t}next(){const e=this.nextValue;return this.nextValue+=this.step,e}peek(){return this.nextValue}skip(e){this.nextValue+=e}},Tr=class e extends Ke{constructor(e,t,a,r){super(),this.parentComp=e,this.tooltipShowDelayOverride=t,this.tooltipHideDelayOverride=a,this.shouldDisplayTooltip=r,this.interactionEnabled=!1,this.isInteractingWithTooltip=!1,this.state=0,this.tooltipInstanceCount=0,this.tooltipMouseTrack=!1}wireBeans(e){this.popupService=e.popupService,this.userComponentFactory=e.userComponentFactory}postConstruct(){this.gos.get("tooltipInteraction")&&(this.interactionEnabled=!0),this.tooltipTrigger=this.getTooltipTrigger(),this.tooltipMouseTrack=this.gos.get("tooltipMouseTrack");const e=this.parentComp.getGui();0===this.tooltipTrigger&&this.addManagedListeners(e,{mouseenter:this.onMouseEnter.bind(this),mouseleave:this.onMouseLeave.bind(this)}),1===this.tooltipTrigger&&this.addManagedListeners(e,{focusin:this.onFocusIn.bind(this),focusout:this.onFocusOut.bind(this)}),this.addManagedListeners(e,{mousemove:this.onMouseMove.bind(this)}),this.interactionEnabled||this.addManagedListeners(e,{mousedown:this.onMouseDown.bind(this),keydown:this.onKeyDown.bind(this)})}getGridOptionsTooltipDelay(e){const t=this.gos.get(e);return t<0&&p(`${e} should not be lower than 0`),Math.max(200,t)}getTooltipDelay(e){return"show"===e?this.tooltipShowDelayOverride??this.getGridOptionsTooltipDelay("tooltipShowDelay"):this.tooltipHideDelayOverride??this.getGridOptionsTooltipDelay("tooltipHideDelay")}destroy(){this.setToDoNothing(),super.destroy()}getTooltipTrigger(){const e=this.gos.get("tooltipTrigger");return e&&"hover"!==e?1:0}onMouseEnter(t){this.interactionEnabled&&this.interactiveTooltipTimeoutId&&(this.unlockService(),this.startHideTimeout()),_a()||(e.isLocked?this.showTooltipTimeoutId=window.setTimeout((()=>{this.prepareToShowTooltip(t)}),100):this.prepareToShowTooltip(t))}onMouseMove(e){this.lastMouseEvent&&(this.lastMouseEvent=e),this.tooltipMouseTrack&&2===this.state&&this.tooltipComp&&this.positionTooltip()}onMouseDown(){this.setToDoNothing()}onMouseLeave(){this.interactionEnabled?this.lockService():this.setToDoNothing()}onFocusIn(){this.prepareToShowTooltip()}onFocusOut(e){const t=e.relatedTarget,a=this.parentComp.getGui(),r=this.tooltipComp?.getGui();this.isInteractingWithTooltip||a.contains(t)||this.interactionEnabled&&r?.contains(t)||this.setToDoNothing()}onKeyDown(){this.isInteractingWithTooltip&&(this.isInteractingWithTooltip=!1),this.setToDoNothing()}prepareToShowTooltip(t){if(0!=this.state||e.isLocked)return;let a=0;t&&(a=this.isLastTooltipHiddenRecently()?200:this.getTooltipDelay("show")),this.lastMouseEvent=t||null,this.showTooltipTimeoutId=window.setTimeout(this.showTooltip.bind(this),a),this.state=1}isLastTooltipHiddenRecently(){return(new Date).getTime()-e.lastTooltipHideTime<1e3}setToDoNothing(e){e||2!==this.state||this.hideTooltip(),this.onBodyScrollEventCallback&&(this.onBodyScrollEventCallback(),this.onBodyScrollEventCallback=void 0),this.onColumnMovedEventCallback&&(this.onColumnMovedEventCallback(),this.onColumnMovedEventCallback=void 0),this.onDocumentKeyDownCallback&&(this.onDocumentKeyDownCallback(),this.onDocumentKeyDownCallback=void 0),this.clearTimeouts(),this.state=0,this.lastMouseEvent=null}showTooltip(){const e={...this.parentComp.getTooltipParams()};if(!E(e.value)||this.shouldDisplayTooltip&&!this.shouldDisplayTooltip())return void this.setToDoNothing();this.state=2,this.tooltipInstanceCount++;const t=this.newTooltipComponentCallback.bind(this,this.tooltipInstanceCount);this.userComponentFactory.getTooltipCompDetails(e).newAgStackInstance().then(t)}hideTooltip(t){!t&&this.isInteractingWithTooltip||(this.tooltipComp&&(this.destroyTooltipComp(),e.lastTooltipHideTime=(new Date).getTime()),this.eventService.dispatchEvent({type:"tooltipHide",parentGui:this.parentComp.getGui()}),t&&(this.isInteractingWithTooltip=!1),this.setToDoNothing(!0))}newTooltipComponentCallback(e,t){if(2!==this.state||this.tooltipInstanceCount!==e)return void this.destroyBean(t);const a=t.getGui();this.tooltipComp=t,a.classList.contains("ag-tooltip")||a.classList.add("ag-tooltip-custom"),0===this.tooltipTrigger&&a.classList.add("ag-tooltip-animate"),this.interactionEnabled&&a.classList.add("ag-tooltip-interactive");const r=this.localeService.getLocaleTextFunc(),n=this.popupService.addPopup({eChild:a,ariaLabel:r("ariaLabelTooltip","Tooltip")});if(n&&(this.tooltipPopupDestroyFunc=n.hideFunc),this.positionTooltip(),1===this.tooltipTrigger){const e=()=>this.setToDoNothing();[this.onBodyScrollEventCallback,this.onColumnMovedEventCallback]=this.addManagedEventListeners({bodyScroll:e,columnMoved:e})}this.interactionEnabled&&([this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener]=this.addManagedElementListeners(a,{mouseenter:this.onTooltipMouseEnter.bind(this),mouseleave:this.onTooltipMouseLeave.bind(this)}),[this.onDocumentKeyDownCallback]=this.addManagedElementListeners(Q(this.gos),{keydown:e=>{a.contains(e?.target)||this.onKeyDown()}}),1===this.tooltipTrigger&&([this.tooltipFocusInListener,this.tooltipFocusOutListener]=this.addManagedElementListeners(a,{focusin:this.onTooltipFocusIn.bind(this),focusout:this.onTooltipFocusOut.bind(this)}))),this.eventService.dispatchEvent({type:"tooltipShow",tooltipGui:a,parentGui:this.parentComp.getGui()}),this.startHideTimeout()}onTooltipMouseEnter(){this.isInteractingWithTooltip=!0,this.unlockService()}onTooltipMouseLeave(){this.isTooltipFocused()||(this.isInteractingWithTooltip=!1,this.lockService())}onTooltipFocusIn(){this.isInteractingWithTooltip=!0}isTooltipFocused(){const e=this.tooltipComp?.getGui(),t=J(this.gos);return!!e&&e.contains(t)}onTooltipFocusOut(e){const t=this.parentComp.getGui();this.isTooltipFocused()||(this.isInteractingWithTooltip=!1,t.contains(e.relatedTarget)?this.startHideTimeout():this.hideTooltip())}positionTooltip(){const e={type:"tooltip",ePopup:this.tooltipComp.getGui(),nudgeY:18,skipObserver:this.tooltipMouseTrack};this.lastMouseEvent?this.popupService.positionPopupUnderMouseEvent({...e,mouseEvent:this.lastMouseEvent}):this.popupService.positionPopupByComponent({...e,eventSource:this.parentComp.getGui(),position:"under",keepWithinBounds:!0,nudgeY:5})}destroyTooltipComp(){this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");const e=this.tooltipPopupDestroyFunc,t=this.tooltipComp,a=0===this.tooltipTrigger?1e3:0;window.setTimeout((()=>{e(),this.destroyBean(t)}),a),this.clearTooltipListeners(),this.tooltipPopupDestroyFunc=void 0,this.tooltipComp=void 0}clearTooltipListeners(){[this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener,this.tooltipFocusInListener,this.tooltipFocusOutListener].forEach((e=>{e&&e()})),this.tooltipMouseEnterListener=this.tooltipMouseLeaveListener=this.tooltipFocusInListener=this.tooltipFocusOutListener=null}lockService(){e.isLocked=!0,this.interactiveTooltipTimeoutId=window.setTimeout((()=>{this.unlockService(),this.setToDoNothing()}),100)}unlockService(){e.isLocked=!1,this.clearInteractiveTimeout()}startHideTimeout(){this.clearHideTimeout(),this.hideTooltipTimeoutId=window.setTimeout(this.hideTooltip.bind(this),this.getTooltipDelay("hide"))}clearShowTimeout(){this.showTooltipTimeoutId&&(window.clearTimeout(this.showTooltipTimeoutId),this.showTooltipTimeoutId=void 0)}clearHideTimeout(){this.hideTooltipTimeoutId&&(window.clearTimeout(this.hideTooltipTimeoutId),this.hideTooltipTimeoutId=void 0)}clearInteractiveTimeout(){this.interactiveTooltipTimeoutId&&(window.clearTimeout(this.interactiveTooltipTimeoutId),this.interactiveTooltipTimeoutId=void 0)}clearTimeouts(){this.clearShowTimeout(),this.clearHideTimeout(),this.clearInteractiveTimeout()}};Tr.isLocked=!1;var Ir=Tr,Lr=class extends Ke{constructor(e,t){super(),this.ctrl=e,t&&(this.beans=t)}wireBeans(e){this.beans=e}postConstruct(){this.refreshToolTip()}setBrowserTooltip(e){const t="title",a=this.ctrl.getGui();a&&(null!=e&&""!=e?a.setAttribute(t,e):a.removeAttribute(t))}updateTooltipText(){this.tooltip=this.ctrl.getTooltipValue()}createTooltipFeatureIfNeeded(){if(null!=this.tooltipManager)return;const e={getTooltipParams:()=>this.getTooltipParams(),getGui:()=>this.ctrl.getGui()};this.tooltipManager=this.createBean(new Ir(e,this.ctrl.getTooltipShowDelayOverride?.(),this.ctrl.getTooltipHideDelayOverride?.(),this.ctrl.shouldDisplayTooltip),this.beans.context)}refreshToolTip(){this.browserTooltips=this.beans.gos.get("enableBrowserTooltips"),this.updateTooltipText(),this.browserTooltips?(this.setBrowserTooltip(this.tooltip),this.tooltipManager&&(this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context))):(this.setBrowserTooltip(null),this.createTooltipFeatureIfNeeded())}getTooltipParams(){const e=this.ctrl,t=e.getColumn?.(),a=e.getColDef?.(),r=e.getRowNode?.();return{location:e.getLocation(),colDef:a,column:t,rowIndex:e.getRowIndex?.(),node:r,data:r?.data,value:this.getTooltipText(),valueFormatted:e.getValueFormatted?.(),hideTooltipCallback:()=>this.tooltipManager?.hideTooltip(!0)}}getTooltipText(){return this.tooltip}destroy(){this.tooltipManager&&(this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context)),super.destroy()}},Or=new Pr,Nr=null,Gr=class e extends Ke{constructor(e,t){super(),this.suppressDataRefValidation=!1,this.displayed=!0,this.visible=!0,this.compId=Or.next(),this.cssClassManager=new pa((()=>this.eGui)),this.componentSelectors=new Map((t??[]).map((e=>[e.selector,e]))),e&&this.setTemplate(e)}preWireBeans(e){super.preWireBeans(e)}preConstruct(){this.usingBrowserTooltips=this.gos.get("enableBrowserTooltips"),this.wireTemplate(this.getGui())}wireTemplate(e,t){e&&this.gos&&(this.applyElementsToComponent(e),this.createChildComponentsFromTags(e,t))}getCompId(){return this.compId}getTooltipParams(){return{value:this.tooltipText,location:"UNKNOWN"}}setTooltip(e){const{newTooltipText:t,showDelayOverride:a,hideDelayOverride:r,location:n,shouldDisplayTooltip:o}=e||{};this.tooltipFeature&&(this.tooltipFeature=this.destroyBean(this.tooltipFeature)),this.tooltipText!==t&&(this.tooltipText=t);const i=()=>this.tooltipText;null!=t&&(this.tooltipFeature=this.createBean(new Lr({getTooltipValue:i,getGui:()=>this.getGui(),getLocation:()=>n??"UNKNOWN",getColDef:e?.getColDef,getColumn:e?.getColumn,getTooltipShowDelayOverride:null!=a?()=>a:void 0,getTooltipHideDelayOverride:null!=r?()=>r:void 0,shouldDisplayTooltip:o})))}getDataRefAttribute(e){return e.getAttribute?e.getAttribute("data-ref"):null}applyElementsToComponent(e,t,a,r=null){if(void 0===t&&(t=this.getDataRefAttribute(e)),t){const n=this[t];if(n===Nr)this[t]=r??e;else{const e=a&&a[t];this.suppressDataRefValidation||e||p(`Issue with data-ref: ${t} on ${this.constructor.name} with ${n}`)}}}createChildComponentsFromTags(e,t){(function(e){if(null==e)return[];const t=[];return Dr(e,(e=>t.push(e))),t})(e.childNodes).forEach((a=>{if(!(a instanceof HTMLElement))return;const r=this.createComponentFromElement(a,(e=>{e.getGui()&&this.copyAttributesFromNode(a,e.getGui())}),t);if(r){if(r.addItems&&a.children.length){this.createChildComponentsFromTags(a,t);const e=Array.prototype.slice.call(a.children);r.addItems(e)}this.swapComponentForNode(r,e,a)}else a.childNodes&&this.createChildComponentsFromTags(a,t)}))}createComponentFromElement(t,a,r){const n=t.nodeName,o=this.getDataRefAttribute(t),i=0===n.indexOf("AG-"),s=i?this.componentSelectors.get(n):null;let l=null;if(s){e.elementGettingCreated=t;const n=r&&o?r[o]:void 0;l=new s.component(n),l.setParentComponent(this),this.createBean(l,null,a)}else i&&p(`Missing selector: ${n}`);return this.applyElementsToComponent(t,o,r,l),l}copyAttributesFromNode(e,t){!function(e,t){if(e)for(let a=0;at.setAttribute(e,a)))}swapComponentForNode(e,t,a){const r=e.getGui();t.replaceChild(r,a),t.insertBefore(document.createComment(a.nodeName),r),this.addDestroyFunc(this.destroyBean.bind(this,e))}activateTabIndex(e){const t=this.gos.get("tabIndex");e||(e=[]),e.length||e.push(this.getGui()),e.forEach((e=>e.setAttribute("tabindex",t.toString())))}setTemplate(e,t,a){const r=Cr(e);this.setTemplateFromElement(r,t,a)}setTemplateFromElement(e,t,a,r=!1){if(this.eGui=e,this.suppressDataRefValidation=r,t)for(let e=0;ethis.eGui.removeEventListener(e,t)))}addCssClass(e){this.cssClassManager.addCssClass(e)}removeCssClass(e){this.cssClassManager.removeCssClass(e)}containsCssClass(e){return this.cssClassManager.containsCssClass(e)}addOrRemoveCssClass(e,t){this.cssClassManager.addOrRemoveCssClass(e,t)}},Br={columnGroupOpened:"expanded",columnGroupClosed:"contracted",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate",columnMovePin:"pin",columnMoveHide:"eye-slash",columnMoveMove:"arrows",columnMoveLeft:"left",columnMoveRight:"right",columnMoveGroup:"group",columnMoveValue:"aggregation",columnMovePivot:"pivot",dropNotAllowed:"not-allowed",groupContracted:"tree-closed",groupExpanded:"tree-open",setFilterGroupClosed:"tree-closed",setFilterGroupOpen:"tree-open",setFilterGroupIndeterminate:"tree-indeterminate",chart:"chart",close:"cross",cancel:"cancel",check:"tick",first:"first",previous:"previous",next:"next",last:"last",linked:"linked",unlinked:"unlinked",colorPicker:"color-picker",groupLoading:"loading",menu:"menu",menuAlt:"menu-alt",filter:"filter",columns:"columns",maximize:"maximize",minimize:"minimize",menuPin:"pin",menuValue:"aggregation",menuAddRowGroup:"group",menuRemoveRowGroup:"group",clipboardCopy:"copy",clipboardCut:"cut",clipboardPaste:"paste",pivotPanel:"pivot",rowGroupPanel:"group",valuePanel:"aggregation",columnDrag:"grip",rowDrag:"grip",save:"save",csvExport:"csv",excelExport:"excel",smallDown:"small-down",smallLeft:"small-left",smallRight:"small-right",smallUp:"small-up",sortAscending:"asc",sortDescending:"desc",sortUnSort:"none",advancedFilterBuilder:"group",advancedFilterBuilderDrag:"grip",advancedFilterBuilderInvalid:"not-allowed",advancedFilterBuilderMoveUp:"up",advancedFilterBuilderMoveDown:"down",advancedFilterBuilderAdd:"plus",advancedFilterBuilderRemove:"minus",chartsMenuEdit:"chart",chartsMenuAdvancedSettings:"settings",chartsMenuAdd:"plus",checkboxChecked:"checkbox-checked",checkboxIndeterminate:"checkbox-indeterminate",checkboxUnchecked:"checkbox-unchecked",radioButtonOn:"radio-button-on",radioButtonOff:"radio-button-off"},Hr=(()=>{const e=new Set(Object.values(Br));return e.add("eye"),e})();function qr(e,t,a){const r=Vr(e,t,a);if(r){const{className:e}=r;if("string"==typeof e&&e.indexOf("ag-icon")>-1||"object"==typeof e&&e["ag-icon"])return r}const n=document.createElement("span");return n.appendChild(r),n}function Vr(e,t,a,r){let n=null;const o=a&&a.getColDef().icons;if(o&&(n=o[e]),t&&!n){const a=t.get("icons");a&&(n=a[e])}if(!n){const t=document.createElement("span");let a=Br[e]??(Hr.has(e)?e:void 0);return a||(r?a=e:(p(`Did not find icon ${e}`),a="")),t.setAttribute("class",`ag-icon ag-icon-${a}`),t.setAttribute("unselectable","on"),wa(t,"presentation"),t}{let e;if("function"==typeof n)e=n();else{if("string"!=typeof n)throw new Error("icon from grid options needs to be a string or a function");e=n}if("string"==typeof e)return Cr(e);if(Mr(e))return e;p("iconRenderer should return back a string or a dom object")}}var Wr=class extends Gr{constructor(){super(...arguments),this.dragSource=null,this.eIcon=Nr,this.eLabel=Nr}postConstruct(){const e=e=>qr(e,this.gos,null);this.dropIconMap={pinned:e("columnMovePin"),hide:e("columnMoveHide"),move:e("columnMoveMove"),left:e("columnMoveLeft"),right:e("columnMoveRight"),group:e("columnMoveGroup"),aggregate:e("columnMoveValue"),pivot:e("columnMovePivot"),notAllowed:e("dropNotAllowed")}}init(e){this.dragSource=e.dragSource,this.setTemplate('
\n \n
\n
')}destroy(){this.dragSource=null,super.destroy()}setIcon(e,t=!1){vr(this.eIcon);let a=null;e||(e=this.dragSource?.getDefaultIconName?this.dragSource?.getDefaultIconName():"notAllowed"),a=this.dropIconMap[e],this.eIcon.classList.toggle("ag-shake-left-to-right",t),a===this.dropIconMap.hide&&this.gos.get("suppressDragLeaveHidesColumns")||a&&this.eIcon.appendChild(a)}setLabel(e){this.eLabel.textContent=Ot(e)}};function jr(e,t,a){if(0===a)return!1;const r=Math.abs(e.clientX-t.clientX),n=Math.abs(e.clientY-t.clientY);return Math.max(r,n)<=a}var Ur=class{constructor(e,t=!1){this.DOUBLE_TAP_MILLIS=500,this.destroyFuncs=[],this.touching=!1,this.localEventService=new g,this.eElement=e,this.preventMouseClick=t;const a=this.onTouchStart.bind(this),r=this.onTouchMove.bind(this),n=this.onTouchEnd.bind(this);this.eElement.addEventListener("touchstart",a,{passive:!0}),this.eElement.addEventListener("touchmove",r,{passive:!0}),this.eElement.addEventListener("touchend",n,{passive:!1}),this.destroyFuncs.push((()=>{this.eElement.removeEventListener("touchstart",a,{passive:!0}),this.eElement.removeEventListener("touchmove",r,{passive:!0}),this.eElement.removeEventListener("touchend",n,{passive:!1})}))}getActiveTouch(e){for(let t=0;t{const a=this.touchStart===t;if(this.touching&&a&&!this.moved){this.moved=!0;const t={type:"longTap",touchStart:this.touchStart,touchEvent:e};this.localEventService.dispatchEvent(t)}}),500)}onTouchMove(e){if(!this.touching)return;const t=this.getActiveTouch(e.touches);if(!t)return;!jr(t,this.touchStart,4)&&(this.moved=!0)}onTouchEnd(e){if(this.touching){if(!this.moved){const e={type:"tap",touchStart:this.touchStart};this.localEventService.dispatchEvent(e),this.checkForDoubleTap()}this.preventMouseClick&&e.cancelable&&e.preventDefault(),this.touching=!1}}checkForDoubleTap(){const e=(new Date).getTime();if(this.lastTapTime&&this.lastTapTime>0){if(e-this.lastTapTime>this.DOUBLE_TAP_MILLIS){const e={type:"doubleTap",touchStart:this.touchStart};this.localEventService.dispatchEvent(e),this.lastTapTime=null}else this.lastTapTime=e}else this.lastTapTime=e}destroy(){this.destroyFuncs.forEach((e=>e()))}};function Kr(e,t){return``}var Yr=`\n ${Kr("Order","order")}\n ${Kr("Asc","ascending-icon")}\n ${Kr("Desc","descending-icon")}\n ${Kr("Mixed","mixed-icon")}\n ${Kr("None","none-icon")}\n `,Qr=class extends Gr{constructor(e){super(),this.eSortOrder=Nr,this.eSortAsc=Nr,this.eSortDesc=Nr,this.eSortMixed=Nr,this.eSortNone=Nr,e||this.setTemplate(Yr)}wireBeans(e){this.sortController=e.sortController}attachCustomElements(e,t,a,r,n){this.eSortOrder=e,this.eSortAsc=t,this.eSortDesc=a,this.eSortMixed=r,this.eSortNone=n}setupSort(e,t=!1){if(this.column=e,this.suppressOrder=t,this.setupMultiSortIndicator(),!this.column.isSortable()&&!this.column.getColDef().showRowGroup)return;this.addInIcon("sortAscending",this.eSortAsc,e),this.addInIcon("sortDescending",this.eSortDesc,e),this.addInIcon("sortUnSort",this.eSortNone,e);const a=this.updateIcons.bind(this),r=this.onSortChanged.bind(this);this.addManagedPropertyListener("unSortIcon",a),this.addManagedEventListeners({newColumnsLoaded:a,sortChanged:r,columnRowGroupChanged:r}),this.onSortChanged()}addInIcon(e,t,a){if(null==t)return;const r=Vr(e,this.gos,a);r&&t.appendChild(r)}onSortChanged(){this.updateIcons(),this.suppressOrder||this.updateSortOrder()}updateIcons(){const e=this.sortController.getDisplaySortForColumn(this.column);if(this.eSortAsc){const t="asc"===e;rr(this.eSortAsc,t,{skipAriaHidden:!0})}if(this.eSortDesc){const t="desc"===e;rr(this.eSortDesc,t,{skipAriaHidden:!0})}if(this.eSortNone){const t=!this.column.getColDef().unSortIcon&&!this.gos.get("unSortIcon"),a=null==e;rr(this.eSortNone,!t&&a,{skipAriaHidden:!0})}}setupMultiSortIndicator(){this.addInIcon("sortUnSort",this.eSortMixed,this.column);const e=this.column.getColDef().showRowGroup;te(this.gos)&&e&&(this.addManagedEventListeners({sortChanged:this.updateMultiSortIndicator.bind(this),columnRowGroupChanged:this.updateMultiSortIndicator.bind(this)}),this.updateMultiSortIndicator())}updateMultiSortIndicator(){if(this.eSortMixed){const e="mixed"===this.sortController.getDisplaySortForColumn(this.column);rr(this.eSortMixed,e,{skipAriaHidden:!0})}}updateSortOrder(){if(!this.eSortOrder)return;const e=this.sortController.getColumnsWithSortingOrdered(),t=this.sortController.getDisplaySortIndexForColumn(this.column)??-1,a=e.some((e=>this.sortController.getDisplaySortIndexForColumn(e)??!1)),r=t>=0&&a;rr(this.eSortOrder,r,{skipAriaHidden:!0}),t>=0?this.eSortOrder.textContent=(t+1).toString():vr(this.eSortOrder)}},_r={selector:"AG-SORT-INDICATOR",component:Qr},Zr=class extends Gr{constructor(){super(...arguments),this.eFilter=Nr,this.eFilterButton=Nr,this.eSortIndicator=Nr,this.eMenu=Nr,this.eLabel=Nr,this.eText=Nr,this.eSortOrder=Nr,this.eSortAsc=Nr,this.eSortDesc=Nr,this.eSortMixed=Nr,this.eSortNone=Nr,this.lastMovingChanged=0}wireBeans(e){this.sortController=e.sortController,this.menuService=e.menuService,this.funcColsService=e.funcColsService}destroy(){super.destroy()}refresh(e){const t=this.params;return this.params=e,this.workOutTemplate()==this.currentTemplate&&this.workOutShowMenu()==this.currentShowMenu&&this.workOutSort()==this.currentSort&&this.shouldSuppressMenuHide()==this.currentSuppressMenuHide&&t.enableFilterButton==e.enableFilterButton&&t.enableFilterIcon==e.enableFilterIcon&&(this.setDisplayName(e),!0)}workOutTemplate(){let e=this.params.template??'';return e=e&&e.trim?e.trim():e,e}init(e){this.params=e,this.currentTemplate=this.workOutTemplate(),this.setTemplate(this.currentTemplate,[_r]),this.setupTap(),this.setMenu(),this.setupSort(),this.setupFilterIcon(),this.setupFilterButton(),this.setDisplayName(e)}setDisplayName(e){if(this.currentDisplayName!=e.displayName){this.currentDisplayName=e.displayName;const t=Ot(this.currentDisplayName,!0);this.eText&&(this.eText.textContent=t)}}addInIcon(e,t,a){if(null==t)return;const r=Vr(e,this.gos,a);r&&t.appendChild(r)}setupTap(){const{gos:e}=this;if(e.get("suppressTouch"))return;const t=new Ur(this.getGui(),!0),a=this.shouldSuppressMenuHide(),r=a&&E(this.eMenu),n=r?new Ur(this.eMenu,!0):t;if(this.params.enableMenu){const e=r?"tap":"longTap",t=e=>this.params.showColumnMenuAfterMouseClick(e.touchStart);this.addManagedListeners(n,{[e]:t})}if(this.params.enableSorting){const e=e=>{const t=e.touchStart.target;a&&(this.eMenu?.contains(t)||this.eFilterButton?.contains(t))||this.sortController.progressSort(this.params.column,!1,"uiColumnSorted")};this.addManagedListeners(t,{tap:e})}if(this.params.enableFilterButton){const e=new Ur(this.eFilterButton,!0);this.addManagedListeners(e,{tap:()=>this.params.showFilter(this.eFilterButton)}),this.addDestroyFunc((()=>e.destroy()))}this.addDestroyFunc((()=>t.destroy())),r&&this.addDestroyFunc((()=>n.destroy()))}workOutShowMenu(){return this.params.enableMenu&&this.menuService.isHeaderMenuButtonEnabled()}shouldSuppressMenuHide(){return this.menuService.isHeaderMenuButtonAlwaysShowEnabled()}setMenu(){if(!this.eMenu)return;if(this.currentShowMenu=this.workOutShowMenu(),!this.currentShowMenu)return fr(this.eMenu),void(this.eMenu=void 0);const e=this.menuService.isLegacyMenuEnabled();this.addInIcon(e?"menu":"menuAlt",this.eMenu,this.params.column),this.eMenu.classList.toggle("ag-header-menu-icon",!e),this.currentSuppressMenuHide=this.shouldSuppressMenuHide(),this.addManagedElementListeners(this.eMenu,{click:()=>this.params.showColumnMenu(this.eMenu)}),this.eMenu.classList.toggle("ag-header-menu-always-show",this.currentSuppressMenuHide)}onMenuKeyboardShortcut(e){const t=this.params.column,a=this.menuService.isLegacyMenuEnabled();if(e&&!a){if(this.menuService.isFilterMenuInHeaderEnabled(t))return this.params.showFilter(this.eFilterButton??this.eMenu??this.getGui()),!0}else if(this.params.enableMenu)return this.params.showColumnMenu(this.eMenu??this.eFilterButton??this.getGui()),!0;return!1}workOutSort(){return this.params.enableSorting}setupSort(){if(this.currentSort=this.params.enableSorting,this.eSortIndicator||(this.eSortIndicator=this.createBean(new Qr(!0)),this.eSortIndicator.attachCustomElements(this.eSortOrder,this.eSortAsc,this.eSortDesc,this.eSortMixed,this.eSortNone)),this.eSortIndicator.setupSort(this.params.column),!this.currentSort)return;this.addManagedListeners(this.params.column,{movingChanged:()=>{this.lastMovingChanged=(new Date).getTime()}}),this.eLabel&&this.addManagedElementListeners(this.eLabel,{click:e=>{const t=this.params.column.isMoving(),a=(new Date).getTime()-this.lastMovingChanged<50;if(!(t||a)){const t="ctrl"===this.gos.get("multiSortKey")?e.ctrlKey||e.metaKey:e.shiftKey;this.params.progressSort(t)}}});const e=()=>{const e=this.params.column.getSort();if(this.addOrRemoveCssClass("ag-header-cell-sorted-asc","asc"===e),this.addOrRemoveCssClass("ag-header-cell-sorted-desc","desc"===e),this.addOrRemoveCssClass("ag-header-cell-sorted-none",!e),this.params.column.getColDef().showRowGroup){const e=this.funcColsService.getSourceColumnsForGroupColumn(this.params.column),t=e?.every((e=>this.params.column.getSort()==e.getSort())),a=!t;this.addOrRemoveCssClass("ag-header-cell-sorted-mixed",a)}};this.addManagedEventListeners({sortChanged:e,columnRowGroupChanged:e})}setupFilterIcon(){this.eFilter&&this.configureFilter(this.params.enableFilterIcon,this.eFilter,this.onFilterChangedIcon.bind(this))}setupFilterButton(){if(!this.eFilterButton)return;this.configureFilter(this.params.enableFilterButton,this.eFilterButton,this.onFilterChangedButton.bind(this))?this.addManagedElementListeners(this.eFilterButton,{click:()=>this.params.showFilter(this.eFilterButton)}):this.eFilterButton=void 0}configureFilter(e,t,a){if(!e)return fr(t),!1;const r=this.params.column;return this.addInIcon("filter",t,r),this.addManagedListeners(r,{filterChanged:a}),a(),!0}onFilterChangedIcon(){const e=this.params.column.isFilterActive();rr(this.eFilter,e,{skipAriaHidden:!0})}onFilterChangedButton(){const e=this.params.column.isFilterActive();this.eFilterButton.classList.toggle("ag-filter-active",e)}getAnchorElementForMenu(e){return e?this.eFilterButton??this.eMenu??this.getGui():this.eMenu??this.eFilterButton??this.getGui()}},Jr=class extends Gr{constructor(){super(''),this.agOpened=Nr,this.agClosed=Nr,this.agLabel=Nr}wireBeans(e){this.columnModel=e.columnModel}destroy(){super.destroy()}init(e){this.params=e,this.checkWarnings(),this.setupLabel(),this.addGroupExpandIcon(),this.setupExpandIcons()}checkWarnings(){this.params.template&&p("A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)")}setupExpandIcons(){this.addInIcon("columnGroupOpened",this.agOpened),this.addInIcon("columnGroupClosed",this.agClosed);const e=e=>{if(Ve(e))return;const t=!this.params.columnGroup.isExpanded();this.columnModel.setColumnGroupOpened(this.params.columnGroup.getProvidedColumnGroup(),t,"uiColumnExpanded")};this.addTouchAndClickListeners(this.agClosed,e),this.addTouchAndClickListeners(this.agOpened,e);const t=e=>{qe(e)};this.addManagedElementListeners(this.agClosed,{dblclick:t}),this.addManagedElementListeners(this.agOpened,{dblclick:t}),this.addManagedElementListeners(this.getGui(),{dblclick:e}),this.updateIconVisibility();const a=this.params.columnGroup.getProvidedColumnGroup(),r=this.updateIconVisibility.bind(this);this.addManagedListeners(a,{expandedChanged:r,expandableChanged:r})}addTouchAndClickListeners(e,t){const a=new Ur(e,!0);this.addManagedListeners(a,{tap:t}),this.addDestroyFunc((()=>a.destroy())),this.addManagedElementListeners(e,{click:t})}updateIconVisibility(){if(this.params.columnGroup.isExpandable()){const e=this.params.columnGroup.isExpanded();rr(this.agOpened,e),rr(this.agClosed,!e)}else rr(this.agOpened,!1),rr(this.agClosed,!1)}addInIcon(e,t){const a=Vr(e,this.gos,null);a&&t.appendChild(a)}addGroupExpandIcon(){if(!this.params.columnGroup.isExpandable())return rr(this.agOpened,!1),void rr(this.agClosed,!1)}setupLabel(){const{displayName:e,columnGroup:t}=this.params;if(E(e)){const t=Ot(e,!0);this.agLabel.textContent=t}this.addOrRemoveCssClass("ag-sticky-label",!t.getColGroupDef()?.suppressStickyLabel)}},Xr=class extends Gr{constructor(){super(),this.refreshCount=0;const e=document.createElement("span"),t=document.createElement("span");t.setAttribute("class","ag-value-change-delta");const a=document.createElement("span");a.setAttribute("class","ag-value-change-value"),e.appendChild(t),e.appendChild(a),this.setTemplateFromElement(e)}wireBeans(e){this.filterManager=e.filterManager}init(e){this.eValue=this.queryForHtmlElement(".ag-value-change-value"),this.eDelta=this.queryForHtmlElement(".ag-value-change-delta"),this.refresh(e,!0)}showDelta(e,t){const a=Math.abs(t),r=e.formatValue(a),n=E(r)?r:a,o=t>=0;this.eDelta.textContent=o?"↑"+n:"↓"+n,this.eDelta.classList.toggle("ag-value-change-delta-up",o),this.eDelta.classList.toggle("ag-value-change-delta-down",!o)}setTimerToRemoveDelta(){this.refreshCount++;const e=this.refreshCount;this.getFrameworkOverrides().wrapIncoming((()=>{window.setTimeout((()=>{e===this.refreshCount&&this.hideDeltaValue()}),2e3)}))}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),vr(this.eDelta)}refresh(e,t=!1){const a=e.value;if(a===this.lastValue)return!1;if(E(e.valueFormatted)?this.eValue.textContent=e.valueFormatted:E(e.value)?this.eValue.textContent=a:vr(this.eValue),this.filterManager?.isSuppressFlashingCellsBecauseFiltering())return!1;if("number"==typeof a&&"number"==typeof this.lastValue){const t=a-this.lastValue;this.showDelta(e,t)}return this.lastValue&&this.eValue.classList.add("ag-value-change-value-highlight"),t||this.setTimerToRemoveDelta(),this.lastValue=a,!0}},$r=class extends Gr{constructor(){super(),this.refreshCount=0;const e=document.createElement("span"),t=document.createElement("span");t.setAttribute("class","ag-value-slide-current"),e.appendChild(t),this.setTemplateFromElement(e),this.eCurrent=this.queryForHtmlElement(".ag-value-slide-current")}wireBeans(e){this.filterManager=e.filterManager}init(e){this.refresh(e,!0)}addSlideAnimation(){this.refreshCount++;const e=this.refreshCount;this.ePrevious&&this.getGui().removeChild(this.ePrevious);const t=document.createElement("span");t.setAttribute("class","ag-value-slide-previous ag-value-slide-out"),this.ePrevious=t,this.ePrevious.textContent=this.eCurrent.textContent,this.getGui().insertBefore(this.ePrevious,this.eCurrent),this.getFrameworkOverrides().wrapIncoming((()=>{window.setTimeout((()=>{e===this.refreshCount&&this.ePrevious.classList.add("ag-value-slide-out-end")}),50),window.setTimeout((()=>{e===this.refreshCount&&(this.getGui().removeChild(this.ePrevious),this.ePrevious=null)}),3e3)}))}refresh(e,t=!1){let a=e.value;return R(a)&&(a=""),a!==this.lastValue&&(!this.filterManager?.isSuppressFlashingCellsBecauseFiltering()&&(t||this.addSlideAnimation(),this.lastValue=a,E(e.valueFormatted)?this.eCurrent.textContent=e.valueFormatted:E(e.value)?this.eCurrent.textContent=a:vr(this.eCurrent),!0))}},en=class{};en.BACKSPACE="Backspace",en.TAB="Tab",en.ENTER="Enter",en.ESCAPE="Escape",en.SPACE=" ",en.LEFT="ArrowLeft",en.UP="ArrowUp",en.RIGHT="ArrowRight",en.DOWN="ArrowDown",en.DELETE="Delete",en.F2="F2",en.PAGE_UP="PageUp",en.PAGE_DOWN="PageDown",en.PAGE_HOME="Home",en.PAGE_END="End",en.A="KeyA",en.C="KeyC",en.D="KeyD",en.V="KeyV",en.X="KeyX",en.Y="KeyY",en.Z="KeyZ";var tn=class extends Gr{constructor(e,t,a){super(t,a),this.labelSeparator="",this.labelAlignment="left",this.disabled=!1,this.label="",this.config=e||{}}postConstruct(){this.addCssClass("ag-labeled"),this.eLabel.classList.add("ag-label");const{labelSeparator:e,label:t,labelWidth:a,labelAlignment:r,disabled:n}=this.config;null!=n&&this.setDisabled(n),null!=e&&this.setLabelSeparator(e),null!=t&&this.setLabel(t),null!=a&&this.setLabelWidth(a),this.setLabelAlignment(r||this.labelAlignment),this.refreshLabel()}refreshLabel(){vr(this.eLabel),"string"==typeof this.label?this.eLabel.innerText=this.label+this.labelSeparator:this.label&&this.eLabel.appendChild(this.label),""===this.label?(rr(this.eLabel,!1),wa(this.eLabel,"presentation")):(rr(this.eLabel,!0),wa(this.eLabel,null))}setLabelSeparator(e){return this.labelSeparator===e||(this.labelSeparator=e,null!=this.label&&this.refreshLabel()),this}getLabelId(){return this.eLabel.id=this.eLabel.id||`ag-${this.getCompId()}-label`,this.eLabel.id}getLabel(){return this.label}setLabel(e){return this.label===e||(this.label=e,this.refreshLabel()),this}setLabelAlignment(e){const t=this.getGui().classList;return t.toggle("ag-label-align-left","left"===e),t.toggle("ag-label-align-right","right"===e),t.toggle("ag-label-align-top","top"===e),this}setLabelEllipsis(e){return this.eLabel.classList.toggle("ag-label-ellipsis",e),this}setLabelWidth(e){return null==this.label||xr(this.eLabel,e),this}setDisabled(e){e=!!e;const t=this.getGui();return or(t,e),t.classList.toggle("ag-disabled",e),this.disabled=e,this}isDisabled(){return!!this.disabled}},an=class extends tn{constructor(e,t,a,r){super(e,t,a),this.className=r}postConstruct(){super.postConstruct();const{width:e,value:t,onValueChange:a}=this.config;null!=e&&this.setWidth(e),null!=t&&this.setValue(t),null!=a&&this.onValueChange(a),this.className&&this.addCssClass(this.className),this.refreshAriaLabelledBy()}setLabel(e){return super.setLabel(e),this.refreshAriaLabelledBy(),this}refreshAriaLabelledBy(){const e=this.getAriaElement(),t=this.getLabelId(),a=this.getLabel();null==a||""==a||null!==e.getAttribute("aria-label")?ka(e,""):ka(e,t??"")}setAriaLabel(e){return ya(this.getAriaElement(),e),this.refreshAriaLabelledBy(),this}onValueChange(e){return this.addManagedListeners(this,{fieldValueChanged:()=>e(this.getValue())}),this}getWidth(){return this.getGui().clientWidth}setWidth(e){return zr(this.getGui(),e),this}getPreviousValue(){return this.previousValue}getValue(){return this.value}setValue(e,t){return this.value===e||(this.previousValue=this.value,this.value=e,t||this.dispatchLocalEvent({type:"fieldValueChanged"})),this}},rn=class extends an{constructor(e,t,a="text",r="input"){super(e,e?.template??`\n
\n
\n \n
`,[],t),this.inputType=a,this.displayFieldTag=r,this.eLabel=Nr,this.eWrapper=Nr,this.eInput=Nr}postConstruct(){super.postConstruct(),this.setInputType(),this.eLabel.classList.add(`${this.className}-label`),this.eWrapper.classList.add(`${this.className}-input-wrapper`),this.eInput.classList.add(`${this.className}-input`),this.addCssClass("ag-input-field"),this.eInput.id=this.eInput.id||`ag-${this.getCompId()}-input`;const{inputName:e,inputWidth:t}=this.config;null!=e&&this.setInputName(e),null!=t&&this.setInputWidth(t),this.addInputListeners(),this.activateTabIndex([this.eInput])}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:e=>this.setValue(e.target.value)})}setInputType(){"input"===this.displayFieldTag&&this.eInput.setAttribute("type",this.inputType)}getInputElement(){return this.eInput}setInputWidth(e){return xr(this.eWrapper,e),this}setInputName(e){return this.getInputElement().setAttribute("name",e),this}getFocusableElement(){return this.eInput}setMaxLength(e){return this.eInput.maxLength=e,this}setInputPlaceholder(e){return Fr(this.eInput,"placeholder",e),this}setInputAriaLabel(e){return ya(this.eInput,e),this.refreshAriaLabelledBy(),this}setDisabled(e){return or(this.eInput,e),super.setDisabled(e)}setAutoComplete(e){if(!0===e)Fr(this.eInput,"autocomplete",null);else{const t="string"==typeof e?e:"off";Fr(this.eInput,"autocomplete",t)}return this}},nn=class extends rn{constructor(e,t="ag-checkbox",a="checkbox"){super(e,t,a),this.labelAlignment="right",this.selected=!1,this.readOnly=!1,this.passive=!1}postConstruct(){super.postConstruct();const{readOnly:e,passive:t}=this.config;"boolean"==typeof e&&this.setReadOnly(e),"boolean"==typeof t&&this.setPassive(t)}addInputListeners(){this.addManagedElementListeners(this.eInput,{click:this.onCheckboxClick.bind(this)}),this.addManagedElementListeners(this.eLabel,{click:this.toggle.bind(this)})}getNextValue(){return void 0===this.selected||!this.selected}setPassive(e){this.passive=e}isReadOnly(){return this.readOnly}setReadOnly(e){this.eWrapper.classList.toggle("ag-disabled",e),this.eInput.disabled=e,this.readOnly=e}setDisabled(e){return this.eWrapper.classList.toggle("ag-disabled",e),super.setDisabled(e)}toggle(){if(this.eInput.disabled)return;const e=this.isSelected(),t=this.getNextValue();this.passive?this.dispatchChange(t,e):this.setValue(t)}getValue(){return this.isSelected()}setValue(e,t){return this.refreshSelectedClass(e),this.setSelected(e,t),this}setName(e){return this.getInputElement().name=e,this}isSelected(){return this.selected}setSelected(e,t){this.isSelected()!==e&&(this.previousValue=this.isSelected(),e=this.selected="boolean"==typeof e?e:void 0,this.eInput.checked=e,this.eInput.indeterminate=void 0===e,t||this.dispatchChange(this.selected,this.previousValue))}dispatchChange(e,t,a){this.dispatchLocalEvent({type:"fieldValueChanged",selected:e,previousValue:t,event:a});const r=this.getInputElement();this.eventService.dispatchEvent({type:"checkboxChanged",id:r.id,name:r.name,selected:e,previousValue:t})}onCheckboxClick(e){if(this.passive||this.eInput.disabled)return;const t=this.isSelected(),a=this.selected=e.target.checked;this.refreshSelectedClass(a),this.dispatchChange(a,t,e)}refreshSelectedClass(e){this.eWrapper.classList.toggle("ag-checked",!0===e),this.eWrapper.classList.toggle("ag-indeterminate",null==e)}},on={selector:"AG-CHECKBOX",component:nn},sn=class extends Gr{constructor(){super('\n ',[on]),this.eCheckbox=Nr}init(e){this.refresh(e);const t=this.eCheckbox.getInputElement();t.setAttribute("tabindex","-1"),xa(t,"polite"),this.addManagedListeners(t,{click:e=>{if(qe(e),this.eCheckbox.isDisabled())return;const t=this.eCheckbox.getValue();this.onCheckboxChanged(t)},dblclick:e=>{qe(e)}}),this.addManagedElementListeners(this.params.eGridCell,{keydown:e=>{if(e.key===en.SPACE&&!this.eCheckbox.isDisabled()){this.params.eGridCell===J(this.gos)&&this.eCheckbox.toggle();const t=this.eCheckbox.getValue();this.onCheckboxChanged(t),e.preventDefault()}}})}refresh(e){return this.params=e,this.updateCheckbox(e),!0}updateCheckbox(e){let t,a=!0;if(e.node.group&&e.column)if("boolean"==typeof e.value)t=e.value;else{const r=e.column.getColId();r.startsWith(Je)?t=null==e.value||""===e.value?void 0:"true"===e.value:e.node.aggData&&void 0!==e.node.aggData[r]?t=e.value??void 0:a=!1}else t=e.value??void 0;if(!a)return void this.eCheckbox.setDisplayed(!1);this.eCheckbox.setValue(t);const r=null!=e.disabled?e.disabled:!e.column?.isCellEditable(e.node);this.eCheckbox.setDisabled(r);const n=this.localeService.getLocaleTextFunc(),o=Wa(n,t),i=r?o:`${n("ariaToggleCellValue","Press SPACE to toggle cell value")} (${o})`;this.eCheckbox.setInputAriaLabel(i)}onCheckboxChanged(e){const{column:t,node:a,value:r}=this.params;this.eventService.dispatchEvent({type:"cellEditingStarted",column:t,colDef:t?.getColDef(),data:a.data,node:a,rowIndex:a.rowIndex,rowPinned:a.rowPinned,value:r});const n=this.params.node.setDataValue(this.params.column,e,"edit");this.eventService.dispatchEvent({type:"cellEditingStopped",column:t,colDef:t?.getColDef(),data:a.data,node:a,rowIndex:a.rowIndex,rowPinned:a.rowPinned,value:r,oldValue:r,newValue:e,valueChanged:n}),n||this.updateCheckbox(this.params)}},ln=class extends Gr{constructor(){super('
\n \n \n
'),this.eLoadingIcon=Nr,this.eLoadingText=Nr}init(e){e.node.failedLoad?this.setupFailed():this.setupLoading()}setupFailed(){const e=this.localeService.getLocaleTextFunc();this.eLoadingText.innerText=e("loadingError","ERR")}setupLoading(){const e=Vr("groupLoading",this.gos,null);e&&this.eLoadingIcon.appendChild(e);const t=this.localeService.getLocaleTextFunc();this.eLoadingText.innerText=t("loadingOoo","Loading")}refresh(e){return!1}destroy(){super.destroy()}},gn=class extends Gr{constructor(){super('
')}init(e){const t=`ag-cell-skeleton-renderer-${this.getCompId()}`;this.getGui().setAttribute("id",t),this.addDestroyFunc((()=>ka(e.eParentOfValue))),ka(e.eParentOfValue,t),e.node.failedLoad?this.setupFailed():this.setupLoading(e)}setupFailed(){const e=this.localeService.getLocaleTextFunc();this.getGui().innerText=e("loadingError","ERR");const t=e("ariaSkeletonCellLoadingFailed","Row failed to load");ya(this.getGui(),t)}setupLoading(e){const t=Q(this.gos).createElement("div");t.classList.add("ag-skeleton-effect");const a=e.node.rowIndex;if(null!=a){const e=75+25*(a%2==0?Math.sin(a):Math.cos(a));t.style.width=`${e}%`}this.getGui().appendChild(t);const r=this.localeService.getLocaleTextFunc()("ariaSkeletonCellLoading","Row data is loading");ya(this.getGui(),r)}refresh(e){return!1}destroy(){super.destroy()}},cn=class extends Gr{constructor(){super()}destroy(){super.destroy()}},dn=class extends cn{init(){const e=z(this.gos.get("overlayLoadingTemplate")?.trim());if(this.setTemplate(e??''),!e){const e=this.localeService.getLocaleTextFunc();setTimeout((()=>{this.getGui().textContent=e("loadingOoo","Loading...")}))}}},hn=class extends cn{init(){const e=z(this.gos.get("overlayNoRowsTemplate")?.trim());if(this.setTemplate(e??''),!e){const e=this.localeService.getLocaleTextFunc();setTimeout((()=>{this.getGui().textContent=e("noRowsToShow","No Rows To Show")}))}}},un=class extends Gr{isPopup(){return!0}setParentComponent(e){e.addCssClass("ag-has-popup"),super.setParentComponent(e)}destroy(){const e=this.parentComponent;e&&e.isAlive()&&e.getGui().classList.remove("ag-has-popup"),super.destroy()}},pn=class extends un{constructor(){super('
')}init(e){const{value:t}=e;this.getGui().textContent=Ot(t,!0)}};function mn(e){const{inputValue:t,allSuggestions:a,hideIrrelevant:r,filterByPercentageOfBestMatch:n,addSequentialWeight:o}=e;let i=a.map(((e,a)=>({value:e,relevance:vn(t.toLowerCase(),e.toLocaleLowerCase(),o),idx:a})));if(i.sort(((e,t)=>t.relevance-e.relevance)),r&&(i=i.filter((e=>0!==e.relevance))),i.length>0&&n&&n>0){const e=i[0].relevance*n;i=i.filter((t=>e-t.relevance<0))}const s=[],l=[];for(const e of i)s.push(e.value),l.push(e.idx);return{values:s,indices:l}}function vn(e,t,a=!1){const r=e.replace(/\s/g,""),n=t.replace(/\s/g,""),o=r.length,i=n.length,s=new Array(o+1).fill(null).map((()=>new Array(i+1).fill(0)));for(let e=0;e<=o;e+=1)s[e][0]=e;for(let e=0;e<=i;e+=1)s[0][e]=e;for(let e=1;e<=o;e++)for(let t=1;t<=i;t++)r[e-1]===n[t-1]?s[e][t]=s[e-1][t-1]:s[e][t]=1+Math.min(s[e][t-1],Math.min(s[e-1][t],s[e-1][t-1]));const l=s[o][i];let g=Math.max(o,i)-l;if(a){const e=function(e){const t=[],a=e.length;for(let r=1;r<=a;r++)for(let n=0;n<=a-r;n++){const a=n+r-1;t.push(e.slice(n,a+1))}return t}(r);for(let t=0;tthis.registerJsComponent(e,t)))}registerDefaultComponent(e,t,a){this.agGridDefaults[e]=t,a&&(this.agGridDefaultParams[e]=a)}registerJsComponent(e,t){this.jsComps[e]=t}retrieve(e,t){const a=(e,t,a)=>({componentFromFramework:t,component:e,params:a}),r=this.getFrameworkOverrides().frameworkComponent(t,this.gos.get("components"));if(null!=r)return a(r,!0);const n=this.jsComps[t];if(n){return a(n,this.getFrameworkOverrides().isFrameworkComponent(n))}const o=this.agGridDefaults[t];if(o)return a(o,!1,this.agGridDefaultParams[t]);const i=this.enterpriseAgDefaultCompsModule[t];return i?this.gos.assertModuleRegistered(i,`AG Grid '${e}' component: ${t}`):h((()=>{this.warnAboutMissingComponent(e,t)}),"MissingComp"+t),null}warnAboutMissingComponent(e,t){const a=mn({inputValue:t,allSuggestions:[...Object.keys(this.agGridDefaults).filter((e=>!["agCellEditor","agGroupRowRenderer","agSortIndicator"].includes(e))),...Object.keys(this.jsComps)],hideIrrelevant:!0,filterByPercentageOfBestMatch:.8}).values;p(`Could not find '${t}' component. It was configured as "${e}: '${t}'" but it wasn't found in the list of registered components.`),a.length>0&&p(` Did you mean: [${a.slice(0,3)}]?`),p(`If using a custom component check it has been registered as described in: ${this.getFrameworkOverrides().getDocLink("components/")}`)}},bn=class e{constructor(e){this.status=0,this.resolution=null,this.waiters=[],e((e=>this.onDone(e)),(e=>this.onReject(e)))}static all(t){return t.length?new e((e=>{let a=t.length;const r=new Array(a);t.forEach(((t,n)=>{t.then((t=>{r[n]=t,a--,0===a&&e(r)}))}))})):e.resolve()}static resolve(t=null){return new e((e=>e(t)))}then(t){return new e((e=>{1===this.status?e(t(this.resolution)):this.waiters.push((a=>e(t(a))))}))}onDone(e){this.status=1,this.resolution=e,this.waiters.forEach((t=>t(e)))}onReject(e){}},wn={propertyName:"dateComponent",cellRenderer:!1},Cn={propertyName:"dragAndDropImageComponent",cellRenderer:!1},yn={propertyName:"headerComponent",cellRenderer:!1},kn={propertyName:"headerGroupComponent",cellRenderer:!1},Sn={propertyName:"cellRenderer",cellRenderer:!0},xn={propertyName:"cellRenderer",cellRenderer:!1},zn={propertyName:"loadingCellRenderer",cellRenderer:!0},En={propertyName:"cellEditor",cellRenderer:!1},Rn={propertyName:"innerRenderer",cellRenderer:!0},Mn={propertyName:"loadingOverlayComponent",cellRenderer:!1},Fn={propertyName:"noRowsOverlayComponent",cellRenderer:!1},Dn={propertyName:"tooltipComponent",cellRenderer:!1},An={propertyName:"filter",cellRenderer:!1},Pn={propertyName:"floatingFilterComponent",cellRenderer:!1},Tn={propertyName:"toolPanel",cellRenderer:!1},In={propertyName:"statusPanel",cellRenderer:!1},Ln={propertyName:"fullWidthCellRenderer",cellRenderer:!0},On={propertyName:"loadingCellRenderer",cellRenderer:!0},Nn={propertyName:"groupRowRenderer",cellRenderer:!0},Gn={propertyName:"detailCellRenderer",cellRenderer:!0},Bn={propertyName:"menuItem",cellRenderer:!1},Hn=class e extends Ke{constructor(){super(...arguments),this.beanName="userComponentFactory"}wireBeans(e){this.agComponentUtils=e.agComponentUtils,this.componentMetadataProvider=e.componentMetadataProvider,this.userComponentRegistry=e.userComponentRegistry,this.frameworkComponentWrapper=e.frameworkComponentWrapper,this.gridOptions=e.gridOptions}getDragAndDropImageCompDetails(e){return this.getCompDetails(this.gridOptions,Cn,"agDragAndDropImage",e,!0)}getHeaderCompDetails(e,t){return this.getCompDetails(e,yn,"agColumnHeader",t)}getHeaderGroupCompDetails(e){const t=e.columnGroup.getColGroupDef();return this.getCompDetails(t,kn,"agColumnGroupHeader",e)}getFullWidthCellRendererDetails(e){return this.getCompDetails(this.gridOptions,Ln,null,e,!0)}getFullWidthLoadingCellRendererDetails(e){return this.getCompDetails(this.gridOptions,On,"agLoadingCellRenderer",e,!0)}getFullWidthGroupCellRendererDetails(e){return this.getCompDetails(this.gridOptions,Nn,"agGroupRowRenderer",e,!0)}getFullWidthDetailCellRendererDetails(e){return this.getCompDetails(this.gridOptions,Gn,"agDetailCellRenderer",e,!0)}getInnerRendererDetails(e,t){return this.getCompDetails(e,Rn,null,t)}getFullWidthGroupRowInnerCellRenderer(e,t){return this.getCompDetails(e,Rn,null,t)}getCellRendererDetails(e,t){return this.getCompDetails(e,Sn,null,t)}getEditorRendererDetails(e,t){return this.getCompDetails(e,xn,null,t)}getLoadingCellRendererDetails(e,t){return this.getCompDetails(e,zn,"agSkeletonCellRenderer",t,!0)}getCellEditorDetails(e,t){return this.getCompDetails(e,En,"agCellEditor",t,!0)}getFilterDetails(e,t,a){return this.getCompDetails(e,An,a,t,!0)}getDateCompDetails(e){return this.getCompDetails(this.gridOptions,wn,"agDateInput",e,!0)}getLoadingOverlayCompDetails(e){return this.getCompDetails(this.gridOptions,Mn,"agLoadingOverlay",e,!0)}getNoRowsOverlayCompDetails(e){return this.getCompDetails(this.gridOptions,Fn,"agNoRowsOverlay",e,!0)}getTooltipCompDetails(e){return this.getCompDetails(e.colDef,Dn,"agTooltipComponent",e,!0)}getSetFilterCellRendererDetails(e,t){return this.getCompDetails(e,Sn,null,t)}getFloatingFilterCompDetails(e,t,a){return this.getCompDetails(e,Pn,a,t)}getToolPanelCompDetails(e,t){return this.getCompDetails(e,Tn,null,t,!0)}getStatusPanelCompDetails(e,t){return this.getCompDetails(e,In,null,t,!0)}getMenuItemCompDetails(e,t){return this.getCompDetails(e,Bn,"agMenuItem",t,!0)}getCompDetails(t,a,r,n,o=!1){const{propertyName:i,cellRenderer:s}=a;let l,{compName:g,jsComp:c,fwComp:d,paramsFromSelector:h,popupFromSelector:u,popupPositionFromSelector:p}=e.getCompKeys(this.frameworkOverrides,t,a,n);const v=e=>{const t=this.userComponentRegistry.retrieve(i,e);t&&(c=t.componentFromFramework?void 0:t.component,d=t.componentFromFramework?t.component:void 0,l=t.params)};if(null!=g&&v(g),null==c&&null==d&&null!=r&&v(r),c&&s&&!this.agComponentUtils.doesImplementIComponent(c)&&(c=this.agComponentUtils.adaptFunction(i,c)),!c&&!d)return void(o&&m(`Could not find component ${g}, did you forget to configure this component?`));const f=this.mergeParamsWithApplicationProvidedParams(t,a,n,h,l),b=null==c,w=c||d;return{componentFromFramework:b,componentClass:w,params:f,type:a,popupFromSelector:u,popupPositionFromSelector:p,newAgStackInstance:()=>this.newAgStackInstance(w,b,f,a)}}static getCompKeys(e,t,a,r){const{propertyName:n}=a;let o,i,s,l,g,c;if(t){const a=t,d=a[n+"Selector"],h=d?d(r):null,u=t=>{if("string"==typeof t)o=t;else if(null!=t&&!0!==t){e.isFrameworkComponent(t)?s=t:i=t}};h?(u(h.component),l=h.params,g=h.popup,c=h.popupPosition):u(a[n])}return{compName:o,jsComp:i,fwComp:s,paramsFromSelector:l,popupFromSelector:g,popupPositionFromSelector:c}}newAgStackInstance(e,t,a,r){const n=r.propertyName;let o;if(!t)o=new e;else{const t=this.componentMetadataProvider.retrieve(n);o=this.frameworkComponentWrapper.wrap(e,t.mandatoryMethodList,t.optionalMethodList,r)}const i=this.initComponent(o,a);return null==i?bn.resolve(o):i.then((()=>o))}mergeParamsWithApplicationProvidedParams(e,t,a,r=null,n){const o=this.gos.getGridCommonParams();ct(o,a),n&&ct(o,n);const i=e&&e[t.propertyName+"Params"];if("function"==typeof i){ct(o,i(a))}else"object"==typeof i&&ct(o,i);return ct(o,r),o}initComponent(e,t){if(this.createBean(e),null!=e.init)return e.init(t)}};function qn(e){const t=e;return null!=t&&null!=t.getFrameworkComponentInstance?t.getFrameworkComponentInstance():e}var Vn=class e{static register(t){e.__register(t,!0,void 0)}static registerModules(t){e.__registerModules(t,!0,void 0)}static __register(t,a,r){e.runVersionChecks(t),void 0!==r?(e.areGridScopedModules=!0,void 0===e.gridModulesMap[r]&&(e.gridModulesMap[r]={}),e.gridModulesMap[r][t.moduleName]=t):e.globalModulesMap[t.moduleName]=t,e.setModuleBased(a)}static __unRegisterGridModules(t){delete e.gridModulesMap[t]}static __registerModules(t,a,r){e.setModuleBased(a),t&&t.forEach((t=>e.__register(t,a,r)))}static isValidModuleVersion(t){const[a,r]=t.version.split(".")||[],[n,o]=e.currentModuleVersion.split(".")||[];return a===n&&r===o}static runVersionChecks(t){e.currentModuleVersion||(e.currentModuleVersion=t.version);const a=e=>`You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${e} Please update all modules to the same version.`;if(t.version?e.isValidModuleVersion(t)||m(a(`'${t.moduleName}' is version ${t.version} but the other modules are version ${e.currentModuleVersion}.`)):m(a(`'${t.moduleName}' is incompatible.`)),t.validate){const e=t.validate();if(!e.isValid){m(`${e.message}`)}}}static setModuleBased(t){void 0===e.moduleBased?e.moduleBased=t:e.moduleBased!==t&&(m("AG Grid: You are mixing modules (i.e. @ag-grid-community/core) and packages (ag-grid-community) - you can only use one or the other of these mechanisms."),m("Please see https://www.ag-grid.com/javascript-grid/modules/ for more information."))}static __setIsBundled(){e.isBundled=!0}static __assertRegistered(t,a,r){if(this.__isRegistered(t,r))return!0;let n;if(e.isBundled)n=`AG Grid: unable to use ${a} as 'ag-grid-enterprise' has not been loaded. Check you are using the Enterprise bundle:\n \n + + + + + + + + + + + + diff --git a/src/main/java/com/eactive/eai/rms/common/dbconsole/controller/DbConsoleController.java b/src/main/java/com/eactive/eai/rms/common/dbconsole/controller/DbConsoleController.java new file mode 100644 index 0000000..6c3cfe1 --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/common/dbconsole/controller/DbConsoleController.java @@ -0,0 +1,314 @@ +package com.eactive.eai.rms.common.dbconsole.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.eactive.eai.rms.common.interceptor.InterceptorSkipController; +import com.eactive.eai.rms.common.login.LoginVo; +import com.eactive.eai.rms.common.login.SessionManager; +import com.eactive.eai.rms.common.dbconsole.dto.ColumnInfoDto; +import com.eactive.eai.rms.common.dbconsole.dto.DatasourceInfoDto; +import com.eactive.eai.rms.common.dbconsole.dto.SqlRequestDto; +import com.eactive.eai.rms.common.dbconsole.dto.SqlResultDto; +import com.eactive.eai.rms.common.dbconsole.dto.TableInfoDto; +import com.eactive.eai.rms.common.dbconsole.service.DbConsoleDecryptService; +import com.eactive.eai.rms.common.dbconsole.service.DbConsoleService; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * DB Console Controller + * - admin 그룹 사용자만 접근 가능 + */ +@Controller +@RequestMapping("/admin/dbconsole") +public class DbConsoleController implements InterceptorSkipController { + + private static final Logger log = LoggerFactory.getLogger(DbConsoleController.class); + + private final DbConsoleService dbConsoleService; + private final DbConsoleDecryptService decryptService; + private final ObjectMapper objectMapper; + + public DbConsoleController(DbConsoleService dbConsoleService, DbConsoleDecryptService decryptService) { + this.dbConsoleService = dbConsoleService; + this.decryptService = decryptService; + this.objectMapper = new ObjectMapper(); + } + + /** + * Admin Role 권한 체크 + */ + private void checkAdminAccess(HttpServletRequest request) { + LoginVo loginVo = SessionManager.getLoginVo(request); + if (loginVo == null) { + throw new AccessDeniedException("로그인이 필요합니다."); + } + + List roleList = loginVo.getRoleList(); + if (roleList == null || roleList.isEmpty()) { + log.warn("DB Console 접근 거부 (역할 없음): userId={}", loginVo.getUserId()); + throw new AccessDeniedException("DB Console 접근 권한이 없습니다."); + } + + // admin 역할 체크 + boolean hasAdminRole = roleList.stream() + .anyMatch(role -> role != null && + ("ADMIN".equalsIgnoreCase(role) || role.toUpperCase().contains("ADMIN"))); + + if (!hasAdminRole) { + log.warn("DB Console 접근 거부 (Admin 권한 없음): userId={}, roles={}", + loginVo.getUserId(), roleList); + throw new AccessDeniedException("DB Console 접근 권한이 없습니다. (Admin 권한 필요)"); + } + } + + /** + * DB Console 페이지 + */ + @GetMapping("/console.do") + public String dbConsolePage(HttpServletRequest request, Model model) { + checkAdminAccess(request); + + try { + List datasources = dbConsoleService.getAvailableDatasources(); + String sessionId = dbConsoleService.createSession(); + + model.addAttribute("datasources", datasources); + model.addAttribute("datasourcesJson", objectMapper.writeValueAsString(datasources)); + model.addAttribute("sessionId", sessionId); + } catch (Exception e) { + log.error("DB Console 페이지 로드 오류", e); + model.addAttribute("datasourcesJson", "[]"); + model.addAttribute("sessionId", ""); + } + + return "/common/dbconsole/dbConsoleMan"; + } + + /** + * 사용 가능한 데이터소스 목록 조회 + */ + @PostMapping("/datasources.do") + @ResponseBody + public ResponseEntity> getDatasources(HttpServletRequest request) { + checkAdminAccess(request); + return ResponseEntity.ok(dbConsoleService.getAvailableDatasources()); + } + + /** + * 새 세션 생성 + */ + @PostMapping("/session.do") + @ResponseBody + public ResponseEntity> createSession(HttpServletRequest request) { + checkAdminAccess(request); + String sessionId = dbConsoleService.createSession(); + Map result = new HashMap<>(); + result.put("sessionId", sessionId); + return ResponseEntity.ok(result); + } + + /** + * SQL 실행 + */ + @PostMapping("/execute.do") + @ResponseBody + public ResponseEntity executeSql(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + log.debug("SQL 실행 요청: session={}, action={}", sqlRequest.getSessionId(), sqlRequest.getAction()); + SqlResultDto result = dbConsoleService.executeSql(sqlRequest); + return ResponseEntity.ok(result); + } + + /** + * COMMIT + */ + @PostMapping("/commit.do") + @ResponseBody + public ResponseEntity commit(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + sqlRequest.setAction("COMMIT"); + SqlResultDto result = dbConsoleService.executeSql(sqlRequest); + return ResponseEntity.ok(result); + } + + /** + * ROLLBACK + */ + @PostMapping("/rollback.do") + @ResponseBody + public ResponseEntity rollback(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + sqlRequest.setAction("ROLLBACK"); + SqlResultDto result = dbConsoleService.executeSql(sqlRequest); + return ResponseEntity.ok(result); + } + + /** + * 세션 종료 + */ + @PostMapping("/disconnect.do") + @ResponseBody + public ResponseEntity disconnect(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + sqlRequest.setAction("DISCONNECT"); + SqlResultDto result = dbConsoleService.executeSql(sqlRequest); + return ResponseEntity.ok(result); + } + + /** + * 스키마 목록 조회 + */ + @PostMapping("/schemas.do") + @ResponseBody + public ResponseEntity> getSchemas(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + List schemas = dbConsoleService.getSchemas(sqlRequest); + return ResponseEntity.ok(schemas); + } + + /** + * 테이블 목록 조회 + */ + @PostMapping("/tables.do") + @ResponseBody + public ResponseEntity> getTables(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + List tables = dbConsoleService.getTables(sqlRequest); + return ResponseEntity.ok(tables); + } + + /** + * 테이블 컬럼 정보 조회 + */ + @PostMapping("/columns.do") + @ResponseBody + public ResponseEntity> getColumns(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + List columns = dbConsoleService.getColumns(sqlRequest); + return ResponseEntity.ok(columns); + } + + /** + * 테이블 DDL 조회 + */ + @PostMapping("/ddl.do") + @ResponseBody + public ResponseEntity> getTableDdl(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + String ddl = dbConsoleService.getTableDdl(sqlRequest); + Map result = new HashMap<>(); + result.put("ddl", ddl); + return ResponseEntity.ok(result); + } + + /** + * 세션 하트비트 (커넥션 유지용) + */ + @PostMapping("/heartbeat.do") + @ResponseBody + public ResponseEntity heartbeat(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) { + checkAdminAccess(request); + SqlResultDto result = dbConsoleService.heartbeat(sqlRequest.getSessionId()); + // 남은 시간도 함께 반환 + long remainingSeconds = dbConsoleService.getSessionRemainingTime(sqlRequest.getSessionId()); + result.setMessage(result.getMessage() + " (남은시간: " + remainingSeconds + "초)"); + return ResponseEntity.ok(result); + } + + /** + * SafeDB 암호화 데이터 복호화 (단일 값) + */ + @PostMapping("/decrypt.do") + @ResponseBody + public ResponseEntity> decryptValue(HttpServletRequest request, @RequestBody Map params) { + checkAdminAccess(request); + + String encryptedValue = params.get("value"); + if (encryptedValue == null || encryptedValue.isEmpty()) { + Map result = new HashMap<>(); + result.put("success", false); + result.put("message", "복호화할 값이 없습니다."); + return ResponseEntity.ok(result); + } + + try { + String decryptedValue = decryptService.decryptValue(encryptedValue); + Map result = new HashMap<>(); + result.put("success", true); + result.put("originalValue", encryptedValue); + result.put("decryptedValue", decryptedValue); + return ResponseEntity.ok(result); + } catch (Exception e) { + log.error("복호화 오류", e); + Map result = new HashMap<>(); + result.put("success", false); + result.put("message", "복호화 오류: " + e.getMessage()); + return ResponseEntity.ok(result); + } + } + + /** + * SafeDB 암호화 데이터 복호화 (여러 값) + */ + @PostMapping("/decryptBatch.do") + @ResponseBody + public ResponseEntity> decryptBatch(HttpServletRequest request, @RequestBody Map> params) { + checkAdminAccess(request); + + List encryptedValues = params.get("values"); + if (encryptedValues == null || encryptedValues.isEmpty()) { + Map result = new HashMap<>(); + result.put("success", false); + result.put("message", "복호화할 값이 없습니다."); + return ResponseEntity.ok(result); + } + + try { + Map decryptedMap = decryptService.decryptValues(encryptedValues); + Map result = new HashMap<>(); + result.put("success", true); + result.put("decrypted", decryptedMap); + return ResponseEntity.ok(result); + } catch (Exception e) { + log.error("복호화 오류", e); + Map result = new HashMap<>(); + result.put("success", false); + result.put("message", "복호화 오류: " + e.getMessage()); + return ResponseEntity.ok(result); + } + } + + /** + * 값이 암호화되었는지 확인 + */ + @PostMapping("/checkEncrypted.do") + @ResponseBody + public ResponseEntity> checkEncrypted(HttpServletRequest request, @RequestBody Map params) { + checkAdminAccess(request); + + String value = params.get("value"); + boolean isEncrypted = decryptService.isEncrypted(value); + + Map result = new HashMap<>(); + result.put("success", true); + result.put("value", value); + result.put("isEncrypted", isEncrypted); + return ResponseEntity.ok(result); + } +} diff --git a/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/ColumnInfoDto.java b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/ColumnInfoDto.java new file mode 100644 index 0000000..5a45a1b --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/ColumnInfoDto.java @@ -0,0 +1,81 @@ +package com.eactive.eai.rms.common.dbconsole.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 컬럼 정보 DTO + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ColumnInfoDto { + + /** + * 컬럼명 + */ + private String columnName; + + /** + * 데이터 타입 + */ + private String dataType; + + /** + * 데이터 길이 + */ + private Integer dataLength; + + /** + * NULL 허용 여부 (Y/N) + */ + private String nullable; + + /** + * 기본값 + */ + private String defaultValue; + + /** + * 코멘트 + */ + private String comments; + + /** + * 컬럼 순서 + */ + private Integer columnId; + + /** + * PK 여부 + */ + private boolean primaryKey; + + /** + * UK 여부 + */ + private boolean uniqueKey; + + /** + * FK 여부 + */ + private boolean foreignKey; + + /** + * 인덱스 여부 + */ + private boolean indexed; + + /** + * 인덱스명 (콤마로 구분) + */ + private String indexName; + + /** + * LOB 타입 여부 + */ + private boolean lobType; +} diff --git a/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/DatasourceInfoDto.java b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/DatasourceInfoDto.java new file mode 100644 index 0000000..3d19ad6 --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/DatasourceInfoDto.java @@ -0,0 +1,52 @@ +package com.eactive.eai.rms.common.dbconsole.dto; + +import lombok.Builder; +import lombok.Data; + +/** + * 데이터소스 정보 DTO + */ +@Data +@Builder +public class DatasourceInfoDto { + + /** + * 표시 이름 + */ + private String displayName; + + /** + * 타입 (JNDI, DIRECT) + */ + private String type; + + /** + * 설명 + */ + private String description; + + /** + * JNDI 이름 + */ + private String jndiName; + + /** + * JDBC URL + */ + private String jdbcUrl; + + /** + * 사용자명 + */ + private String username; + + /** + * 드라이버 클래스명 + */ + private String driverClassName; + + /** + * 스키마명 + */ + private String schema; +} diff --git a/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/SqlRequestDto.java b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/SqlRequestDto.java new file mode 100644 index 0000000..02d8168 --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/SqlRequestDto.java @@ -0,0 +1,70 @@ +package com.eactive.eai.rms.common.dbconsole.dto; + +import lombok.Data; + +/** + * SQL 실행 요청 DTO + */ +@Data +public class SqlRequestDto { + + /** + * 세션 ID + */ + private String sessionId; + + /** + * 실행할 SQL + */ + private String sql; + + /** + * 액션 (EXECUTE, COMMIT, ROLLBACK, DISCONNECT) + */ + private String action; + + /** + * 최대 조회 행 수 + */ + private Integer maxRows; + + /** + * 데이터소스 타입 (JNDI, DIRECT) + */ + private String datasourceType; + + /** + * JNDI 이름 + */ + private String jndiName; + + /** + * JDBC URL (DIRECT 연결 시) + */ + private String jdbcUrl; + + /** + * 사용자명 (DIRECT 연결 시) + */ + private String username; + + /** + * 비밀번호 (DIRECT 연결 시 또는 COMMIT 확인용) + */ + private String password; + + /** + * 드라이버 클래스명 + */ + private String driverClassName; + + /** + * 스키마명 (테이블/컬럼 조회 시) + */ + private String schemaName; + + /** + * 테이블명 (컬럼/DDL 조회 시) + */ + private String tableName; +} diff --git a/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/SqlResultDto.java b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/SqlResultDto.java new file mode 100644 index 0000000..9865e1b --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/SqlResultDto.java @@ -0,0 +1,83 @@ +package com.eactive.eai.rms.common.dbconsole.dto; + +import java.util.List; +import java.util.Map; + +import lombok.Data; + +/** + * SQL 실행 결과 DTO + */ +@Data +public class SqlResultDto { + + /** + * 성공 여부 + */ + private boolean success; + + /** + * 메시지 + */ + private String message; + + /** + * 세션 ID + */ + private String sessionId; + + /** + * 쿼리 타입 (SELECT, INSERT, UPDATE, DELETE, DDL, ERROR, MULTI) + */ + private String queryType; + + /** + * 컬럼 목록 (SELECT 결과) + */ + private List columns; + + /** + * 컬럼 메타정보 (SELECT 결과) + */ + private List columnMetas; + + /** + * 데이터 행 (SELECT 결과) + */ + private List> rows; + + /** + * 영향받은 행 수 (INSERT, UPDATE, DELETE) + */ + private Integer affectedRows; + + /** + * 실행 시간 (ms) + */ + private Long executionTime; + + /** + * 트랜잭션 활성 상태 + */ + private boolean transactionActive; + + /** + * 성공 결과 생성 + */ + public static SqlResultDto success(String message) { + SqlResultDto result = new SqlResultDto(); + result.setSuccess(true); + result.setMessage(message); + return result; + } + + /** + * 오류 결과 생성 + */ + public static SqlResultDto error(String message) { + SqlResultDto result = new SqlResultDto(); + result.setSuccess(false); + result.setMessage(message); + return result; + } +} diff --git a/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/TableInfoDto.java b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/TableInfoDto.java new file mode 100644 index 0000000..a3e887c --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/common/dbconsole/dto/TableInfoDto.java @@ -0,0 +1,27 @@ +package com.eactive.eai.rms.common.dbconsole.dto; + +import lombok.Builder; +import lombok.Data; + +/** + * 테이블 정보 DTO + */ +@Data +@Builder +public class TableInfoDto { + + /** + * 테이블명 + */ + private String tableName; + + /** + * 테이블 타입 (TABLE, VIEW) + */ + private String tableType; + + /** + * 코멘트 + */ + private String comments; +} diff --git a/src/main/java/com/eactive/eai/rms/common/dbconsole/service/DbConsoleDecryptService.java b/src/main/java/com/eactive/eai/rms/common/dbconsole/service/DbConsoleDecryptService.java new file mode 100644 index 0000000..c8baaea --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/common/dbconsole/service/DbConsoleDecryptService.java @@ -0,0 +1,139 @@ +package com.eactive.eai.rms.common.dbconsole.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.eactive.ext.kjb.safedb.KjbSafedbWrapper; + +/** + * DB Console 복호화 서비스 + * - SafeDB 암호화 데이터 복호화 기능 제공 + */ +@Service +public class DbConsoleDecryptService { + + private static final Logger log = LoggerFactory.getLogger(DbConsoleDecryptService.class); + + /** + * SafeDB 암호화 패턴 (16진수 문자열, 최소 32자 이상) + * - 암호화된 데이터는 대체로 긴 16진수 문자열 형태 + */ + private static final Pattern ENCRYPTED_PATTERN = Pattern.compile("^[0-9A-Fa-f]{32,}$"); + + /** + * 단일 값 복호화 + */ + public String decryptValue(String encryptedValue) { + if (encryptedValue == null || encryptedValue.isEmpty()) { + return encryptedValue; + } + + try { + KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance(); + String decrypted = safedb.decryptNotRnno(encryptedValue); + log.debug("복호화 성공: {} -> {}", + encryptedValue.length() > 20 ? encryptedValue.substring(0, 20) + "..." : encryptedValue, + decrypted); + return decrypted; + } catch (Exception e) { + log.warn("복호화 실패: {}", e.getMessage()); + return "[복호화 실패: " + e.getMessage() + "]"; + } + } + + /** + * 여러 값 일괄 복호화 + */ + public Map decryptValues(List encryptedValues) { + Map result = new HashMap<>(); + + if (encryptedValues == null || encryptedValues.isEmpty()) { + return result; + } + + for (String encrypted : encryptedValues) { + if (encrypted != null && !encrypted.isEmpty()) { + result.put(encrypted, decryptValue(encrypted)); + } + } + + return result; + } + + /** + * 행 데이터에서 암호화 컬럼 복호화 + * @param rows 원본 행 데이터 + * @param columns 복호화할 컬럼명 목록 + * @return 복호화된 행 데이터 + */ + public List> decryptRows(List> rows, List columns) { + if (rows == null || rows.isEmpty() || columns == null || columns.isEmpty()) { + return rows; + } + + List> decryptedRows = new ArrayList<>(); + + for (Map row : rows) { + Map decryptedRow = new HashMap<>(row); + + for (String column : columns) { + Object value = row.get(column); + if (value != null && value instanceof String) { + String strValue = (String) value; + if (isEncrypted(strValue)) { + decryptedRow.put(column, decryptValue(strValue)); + } + } + } + + decryptedRows.add(decryptedRow); + } + + return decryptedRows; + } + + /** + * 값이 암호화된 것인지 확인 (휴리스틱) + * - 16진수 문자열 패턴 (32자 이상) + */ + public boolean isEncrypted(String value) { + if (value == null || value.length() < 32) { + return false; + } + return ENCRYPTED_PATTERN.matcher(value).matches(); + } + + /** + * 컬럼별로 암호화 여부 자동 감지 + * @param rows 조회 결과 행 + * @return 암호화된 것으로 추정되는 컬럼명 목록 + */ + public List detectEncryptedColumns(List> rows) { + List encryptedColumns = new ArrayList<>(); + + if (rows == null || rows.isEmpty()) { + return encryptedColumns; + } + + // 첫 번째 행 기준으로 검사 (모든 행을 검사하면 비용이 높음) + Map firstRow = rows.get(0); + + for (Map.Entry entry : firstRow.entrySet()) { + Object value = entry.getValue(); + if (value != null && value instanceof String) { + if (isEncrypted((String) value)) { + encryptedColumns.add(entry.getKey()); + } + } + } + + return encryptedColumns; + } +} diff --git a/src/main/java/com/eactive/eai/rms/common/dbconsole/service/DbConsoleService.java b/src/main/java/com/eactive/eai/rms/common/dbconsole/service/DbConsoleService.java new file mode 100644 index 0000000..9ae6b3a --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/common/dbconsole/service/DbConsoleService.java @@ -0,0 +1,1064 @@ +package com.eactive.eai.rms.common.dbconsole.service; + +import java.io.Reader; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.eactive.eai.rms.common.datasource.DataSourceType; +import com.eactive.eai.rms.common.datasource.DataSourceTypeManager; +import com.eactive.eai.rms.common.dbconsole.dto.ColumnInfoDto; +import com.eactive.eai.rms.common.dbconsole.dto.DatasourceInfoDto; +import com.eactive.eai.rms.common.dbconsole.dto.SqlRequestDto; +import com.eactive.eai.rms.common.dbconsole.dto.SqlResultDto; +import com.eactive.eai.rms.common.dbconsole.dto.TableInfoDto; +import com.eactive.eai.rms.common.util.ContainerUtil; + +/** + * DB Console 서비스 + * - SQL 실행, 트랜잭션 관리 (Auto Commit OFF) + * - 세션 타임아웃 관리 (30분) + */ +@Service +public class DbConsoleService { + + private static final Logger log = LoggerFactory.getLogger(DbConsoleService.class); + + /** + * 세션별 커넥션 관리 (트랜잭션 유지용) + */ + private final ConcurrentHashMap sessionConnections = new ConcurrentHashMap<>(); + + /** + * 세션별 마지막 활동 시간 관리 + */ + private final ConcurrentHashMap sessionLastActivity = new ConcurrentHashMap<>(); + + /** + * 세션 타임아웃 (30분, 밀리초) + */ + private static final long SESSION_TIMEOUT_MS = 30 * 60 * 1000; + + /** + * 사용 가능한 데이터소스 목록 반환 + * - DataSourceTypeManager에서 등록된 데이터소스 조회 + */ + public List getAvailableDatasources() { + List datasources = new ArrayList<>(); + + // DataSourceTypeManager에서 데이터소스 목록 조회 + List types = DataSourceTypeManager.getDataSourceTypes(); + for (DataSourceType type : types) { + datasources.add(DatasourceInfoDto.builder() + .displayName(type.getText() + " (" + type.getSchema() + ")") + .type("JNDI") + .description(type.getName() + " Database") + .jndiName(type.getJndiName()) + .schema(type.getSchema()) + .build()); + } + + // 직접 입력 옵션 (항상 추가) + datasources.add(DatasourceInfoDto.builder() + .displayName("직접 입력") + .type("DIRECT") + .description("JDBC URL을 직접 입력하여 연결") + .driverClassName("oracle.jdbc.OracleDriver") + .build()); + + return datasources; + } + + /** + * 새 세션 생성 + */ + public String createSession() { + return UUID.randomUUID().toString(); + } + + /** + * SQL 실행 + */ + public SqlResultDto executeSql(SqlRequestDto request) { + long startTime = System.currentTimeMillis(); + + try { + String action = request.getAction(); + if (action == null) { + action = "EXECUTE"; + } + + switch (action.toUpperCase()) { + case "COMMIT": + return commit(request.getSessionId()); + case "ROLLBACK": + return rollback(request.getSessionId()); + case "DISCONNECT": + return disconnect(request.getSessionId()); + default: + return executeQuery(request, startTime); + } + } catch (Exception e) { + log.error("SQL 실행 오류", e); + return SqlResultDto.error("SQL 실행 오류: " + e.getMessage()); + } + } + + /** + * 쿼리 실행 (여러 SQL문 지원 - 세미콜론 구분) + */ + private SqlResultDto executeQuery(SqlRequestDto request, long startTime) { + Connection conn = null; + Statement stmt = null; + ResultSet rs = null; + + try { + conn = getOrCreateConnection(request); + stmt = conn.createStatement(); + + if (request.getMaxRows() != null && request.getMaxRows() > 0) { + stmt.setMaxRows(request.getMaxRows()); + } + + String fullSql = request.getSql().trim(); + + // 여러 SQL문 분리 (세미콜론 기준, 문자열 리터럴 내부는 제외) + List sqlStatements = splitSqlStatements(fullSql); + + // 단일 SQL문인 경우 + if (sqlStatements.size() == 1) { + return executeSingleQuery(stmt, sqlStatements.get(0), request.getSessionId(), startTime); + } + + // 여러 SQL문인 경우 순차 실행 + return executeMultipleQueries(stmt, sqlStatements, request.getSessionId(), startTime); + + } catch (SQLException e) { + log.error("SQL 실행 오류: {}", e.getMessage()); + SqlResultDto result = SqlResultDto.error("SQL 오류: " + e.getMessage()); + result.setSessionId(request.getSessionId()); + result.setTransactionActive(isTransactionActive(request.getSessionId())); + return result; + } finally { + closeQuietly(rs); + closeQuietly(stmt); + // Connection은 닫지 않음 (트랜잭션 유지) + } + } + + /** + * SQL문 분리 (세미콜론 기준, 문자열 리터럴 내부 세미콜론은 무시) + */ + private List splitSqlStatements(String fullSql) { + List statements = new ArrayList<>(); + StringBuilder current = new StringBuilder(); + boolean inSingleQuote = false; + boolean inDoubleQuote = false; + + for (int i = 0; i < fullSql.length(); i++) { + char c = fullSql.charAt(i); + + // 문자열 리터럴 시작/종료 체크 + if (c == '\'' && !inDoubleQuote) { + // 이스케이프된 작은따옴표 체크 ('') + if (i + 1 < fullSql.length() && fullSql.charAt(i + 1) == '\'') { + current.append(c); + current.append(fullSql.charAt(i + 1)); + i++; + continue; + } + inSingleQuote = !inSingleQuote; + } else if (c == '"' && !inSingleQuote) { + inDoubleQuote = !inDoubleQuote; + } + + // 세미콜론이고 문자열 내부가 아닌 경우 + if (c == ';' && !inSingleQuote && !inDoubleQuote) { + String sql = current.toString().trim(); + if (!sql.isEmpty()) { + statements.add(sql); + } + current = new StringBuilder(); + } else { + current.append(c); + } + } + + // 마지막 SQL (세미콜론 없이 끝난 경우) + String lastSql = current.toString().trim(); + if (!lastSql.isEmpty()) { + statements.add(lastSql); + } + + return statements; + } + + /** + * 단일 쿼리 실행 + */ + private SqlResultDto executeSingleQuery(Statement stmt, String sql, String sessionId, long startTime) throws SQLException { + // SQL 끝의 세미콜론 제거 (JDBC에서는 세미콜론 없이 실행) + sql = sql.trim(); + if (sql.endsWith(";")) { + sql = sql.substring(0, sql.length() - 1).trim(); + } + + String queryType = detectQueryType(sql); + log.debug("SQL 실행: type={}, sql={}", queryType, sql); + + SqlResultDto result = new SqlResultDto(); + result.setSessionId(sessionId); + result.setQueryType(queryType); + + if ("SELECT".equals(queryType)) { + ResultSet rs = null; + try { + rs = stmt.executeQuery(sql); + populateSelectResult(result, rs); + } finally { + closeQuietly(rs); + } + } else { + int affected = stmt.executeUpdate(sql); + result.setAffectedRows(affected); + result.setMessage(queryType + " 실행 완료. 영향받은 행: " + affected); + } + + result.setSuccess(true); + result.setExecutionTime(System.currentTimeMillis() - startTime); + result.setTransactionActive(isTransactionActive(sessionId)); + + return result; + } + + /** + * 여러 쿼리 순차 실행 (오류 발생 시 중단) + */ + private SqlResultDto executeMultipleQueries(Statement stmt, List sqlStatements, String sessionId, long startTime) { + SqlResultDto lastSelectResult = null; + int totalAffected = 0; + int successCount = 0; + StringBuilder messages = new StringBuilder(); + + for (int i = 0; i < sqlStatements.size(); i++) { + String sql = sqlStatements.get(i); + String queryType = detectQueryType(sql); + + // SQL 끝의 세미콜론 제거 (JDBC에서는 세미콜론 없이 실행) + sql = sql.trim(); + if (sql.endsWith(";")) { + sql = sql.substring(0, sql.length() - 1).trim(); + } + + try { + if ("SELECT".equals(queryType)) { + // SELECT는 마지막 결과만 저장 + ResultSet rs = null; + try { + rs = stmt.executeQuery(sql); + lastSelectResult = new SqlResultDto(); + lastSelectResult.setSessionId(sessionId); + lastSelectResult.setQueryType(queryType); + populateSelectResult(lastSelectResult, rs); + lastSelectResult.setSuccess(true); + successCount++; + messages.append("[").append(i + 1).append("/").append(sqlStatements.size()).append("] SELECT 성공\n"); + } finally { + closeQuietly(rs); + } + } else { + int affected = stmt.executeUpdate(sql); + totalAffected += affected; + successCount++; + messages.append("[").append(i + 1).append("/").append(sqlStatements.size()).append("] ").append(queryType) + .append(" 성공 (").append(affected).append("행)\n"); + } + } catch (SQLException e) { + // 오류 발생 시 중단하고 오류 SQL 표시 + log.error("SQL #{} 실행 오류: {}", i + 1, e.getMessage()); + + SqlResultDto result = new SqlResultDto(); + result.setSessionId(sessionId); + result.setQueryType("ERROR"); + result.setAffectedRows(totalAffected); + result.setSuccess(false); + + // 오류 메시지에 실패한 SQL 포함 + String errorMsg = "[" + (i + 1) + "/" + sqlStatements.size() + "] 오류 발생 - 실행 중단\n\n" + + "성공: " + successCount + "개, 영향받은 행: " + totalAffected + "\n\n" + + messages.toString() + "\n" + + "========== 오류 발생 SQL ==========\n" + + sql + "\n" + + "===================================\n\n" + + "오류: " + e.getMessage(); + result.setMessage(errorMsg); + result.setExecutionTime(System.currentTimeMillis() - startTime); + result.setTransactionActive(isTransactionActive(sessionId)); + return result; + } + } + + // 모든 SQL 성공 + SqlResultDto result; + if (lastSelectResult != null) { + result = lastSelectResult; + result.setMessage("총 " + sqlStatements.size() + "개 SQL 실행 완료 (영향받은 행: " + totalAffected + ")\n\n" + + messages.toString() + "\n" + + (lastSelectResult.getMessage() != null ? lastSelectResult.getMessage() : "")); + } else { + result = new SqlResultDto(); + result.setSessionId(sessionId); + result.setQueryType("MULTI"); + result.setAffectedRows(totalAffected); + result.setSuccess(true); + result.setMessage("총 " + sqlStatements.size() + "개 SQL 실행 완료 (영향받은 행: " + totalAffected + ")\n\n" + messages.toString()); + } + + result.setExecutionTime(System.currentTimeMillis() - startTime); + result.setTransactionActive(isTransactionActive(sessionId)); + + return result; + } + + /** + * SELECT 결과를 DTO에 채움 (컬럼 메타정보 포함) + */ + private void populateSelectResult(SqlResultDto result, ResultSet rs) throws SQLException { + ResultSetMetaData metaData = rs.getMetaData(); + int columnCount = metaData.getColumnCount(); + + // 컬럼 정보 + List columns = new ArrayList<>(); + List columnMetas = new ArrayList<>(); + List columnTypes = new ArrayList<>(); + + for (int i = 1; i <= columnCount; i++) { + String colName = metaData.getColumnLabel(i); + columns.add(colName); + + int colType = metaData.getColumnType(i); + String typeName = metaData.getColumnTypeName(i); + columnTypes.add(colType); + + // LOB 타입 여부 확인 + boolean isLobType = colType == Types.CLOB || colType == Types.NCLOB || + colType == Types.BLOB || colType == Types.LONGVARCHAR || + "CLOB".equalsIgnoreCase(typeName) || "NCLOB".equalsIgnoreCase(typeName) || + "BLOB".equalsIgnoreCase(typeName); + + // 컬럼 메타정보 생성 (ResultSetMetaData에서 추출 가능한 정보) + ColumnInfoDto colMeta = ColumnInfoDto.builder() + .columnName(colName) + .dataType(typeName) + .dataLength(metaData.getPrecision(i)) + .nullable(metaData.isNullable(i) == ResultSetMetaData.columnNullable ? "Y" : "N") + .columnId(i) + .lobType(isLobType) + .build(); + columnMetas.add(colMeta); + } + result.setColumns(columns); + result.setColumnMetas(columnMetas); + + // 데이터 행 + List> rows = new ArrayList<>(); + int rowCount = 0; + while (rs.next()) { + Map row = new LinkedHashMap<>(); + for (int i = 1; i <= columnCount; i++) { + int colType = columnTypes.get(i - 1); + Object value; + + // CLOB/NCLOB 타입 처리 + if (colType == Types.CLOB || colType == Types.NCLOB || colType == Types.LONGVARCHAR) { + value = readClobValue(rs, i); + } else if (colType == Types.BLOB) { + // BLOB은 길이만 표시 (바이너리 데이터) + java.sql.Blob blob = rs.getBlob(i); + if (blob != null) { + value = "[BLOB: " + blob.length() + " bytes]"; + } else { + value = null; + } + } else { + value = rs.getObject(i); + value = value != null ? value.toString() : null; + } + row.put(columns.get(i - 1), value); + } + rows.add(row); + rowCount++; + } + result.setRows(rows); + result.setMessage("조회 완료. 총 " + rowCount + "건"); + } + + /** + * CLOB 값 읽기 + */ + private String readClobValue(ResultSet rs, int columnIndex) throws SQLException { + Clob clob = rs.getClob(columnIndex); + if (clob == null) { + return null; + } + + try { + long length = clob.length(); + if (length == 0) { + return ""; + } + + // CLOB 전체 읽기 (Reader 사용) + Reader reader = clob.getCharacterStream(); + StringBuilder sb = new StringBuilder(); + char[] buffer = new char[4096]; + int charsRead; + while ((charsRead = reader.read(buffer)) != -1) { + sb.append(buffer, 0, charsRead); + } + reader.close(); + return sb.toString(); + } catch (Exception e) { + log.warn("CLOB 읽기 오류: {}", e.getMessage()); + return "[CLOB 읽기 실패]"; + } + } + + /** + * COMMIT + */ + public SqlResultDto commit(String sessionId) { + Connection conn = sessionConnections.get(sessionId); + if (conn == null) { + return SqlResultDto.error("활성 세션이 없습니다."); + } + + try { + conn.commit(); + SqlResultDto result = SqlResultDto.success("COMMIT 완료"); + result.setSessionId(sessionId); + result.setTransactionActive(true); + return result; + } catch (SQLException e) { + log.error("COMMIT 오류", e); + return SqlResultDto.error("COMMIT 오류: " + e.getMessage()); + } + } + + /** + * ROLLBACK + */ + public SqlResultDto rollback(String sessionId) { + Connection conn = sessionConnections.get(sessionId); + if (conn == null) { + return SqlResultDto.error("활성 세션이 없습니다."); + } + + try { + conn.rollback(); + SqlResultDto result = SqlResultDto.success("ROLLBACK 완료"); + result.setSessionId(sessionId); + result.setTransactionActive(true); + return result; + } catch (SQLException e) { + log.error("ROLLBACK 오류", e); + return SqlResultDto.error("ROLLBACK 오류: " + e.getMessage()); + } + } + + /** + * 세션 종료 (커넥션 해제) + */ + public SqlResultDto disconnect(String sessionId) { + Connection conn = sessionConnections.remove(sessionId); + sessionLastActivity.remove(sessionId); + + if (conn == null) { + return SqlResultDto.success("세션이 이미 종료되었습니다."); + } + + try { + if (!conn.isClosed()) { + conn.rollback(); // 미커밋 트랜잭션 롤백 + conn.close(); + } + log.info("DB 세션 종료: {}", sessionId); + return SqlResultDto.success("세션 종료 완료"); + } catch (SQLException e) { + log.error("세션 종료 오류", e); + return SqlResultDto.error("세션 종료 오류: " + e.getMessage()); + } + } + + /** + * 세션별 커넥션 가져오기 또는 생성 + */ + private Connection getOrCreateConnection(SqlRequestDto request) throws SQLException { + String sessionId = request.getSessionId(); + + // 기존 커넥션 확인 + Connection existing = sessionConnections.get(sessionId); + if (existing != null && !existing.isClosed()) { + // 마지막 활동 시간 갱신 + updateLastActivity(sessionId); + return existing; + } + + // 새 커넥션 생성 + Connection conn; + if ("DIRECT".equals(request.getDatasourceType())) { + conn = createDirectConnection(request); + } else { + conn = createJndiConnection(request.getJndiName()); + } + + // Auto Commit OFF + conn.setAutoCommit(false); + + sessionConnections.put(sessionId, conn); + updateLastActivity(sessionId); + log.info("새 DB 세션 생성: {}", sessionId); + + return conn; + } + + /** + * 세션 활동 시간 갱신 + */ + private void updateLastActivity(String sessionId) { + sessionLastActivity.put(sessionId, System.currentTimeMillis()); + } + + /** + * 세션 하트비트 (활성 상태 유지) + */ + public SqlResultDto heartbeat(String sessionId) { + Connection conn = sessionConnections.get(sessionId); + if (conn == null) { + SqlResultDto result = new SqlResultDto(); + result.setSuccess(false); + result.setMessage("세션이 없습니다."); + result.setTransactionActive(false); + return result; + } + + try { + if (conn.isClosed()) { + sessionConnections.remove(sessionId); + sessionLastActivity.remove(sessionId); + SqlResultDto result = new SqlResultDto(); + result.setSuccess(false); + result.setMessage("커넥션이 종료되었습니다."); + result.setTransactionActive(false); + return result; + } + + // 활동 시간 갱신 + updateLastActivity(sessionId); + + SqlResultDto result = new SqlResultDto(); + result.setSuccess(true); + result.setSessionId(sessionId); + result.setTransactionActive(true); + result.setMessage("세션 활성 상태"); + return result; + } catch (SQLException e) { + log.error("하트비트 오류: {}", e.getMessage()); + return SqlResultDto.error("하트비트 오류: " + e.getMessage()); + } + } + + /** + * 타임아웃된 세션 정리 + */ + public void cleanupExpiredSessions() { + long now = System.currentTimeMillis(); + List expiredSessions = new ArrayList<>(); + + for (Map.Entry entry : sessionLastActivity.entrySet()) { + if (now - entry.getValue() > SESSION_TIMEOUT_MS) { + expiredSessions.add(entry.getKey()); + } + } + + for (String sessionId : expiredSessions) { + log.info("타임아웃된 세션 정리: {}", sessionId); + disconnect(sessionId); + } + } + + /** + * 세션 남은 시간 조회 (초 단위) + */ + public long getSessionRemainingTime(String sessionId) { + Long lastActivity = sessionLastActivity.get(sessionId); + if (lastActivity == null) { + return 0; + } + long elapsed = System.currentTimeMillis() - lastActivity; + long remaining = SESSION_TIMEOUT_MS - elapsed; + return Math.max(0, remaining / 1000); + } + + /** + * JNDI 커넥션 생성 + * - Tomcat: java:comp/env/ prefix 필요 + * - WebLogic/JBoss: prefix 불필요 + */ + private Connection createJndiConnection(String jndiName) throws SQLException { + log.info("JNDI 커넥션 생성 시도: jndiName={}", jndiName); + + try { + InitialContext ctx = new InitialContext(); + + // Tomcat인 경우 java:comp/env/ prefix 추가 + String lookupName = jndiName; + if (ContainerUtil.get() == ContainerUtil.TOMCAT) { + if (!jndiName.startsWith("java:")) { + lookupName = "java:comp/env/" + jndiName; + } + } + + log.info("JNDI lookup: {}", lookupName); + DataSource ds = (DataSource) ctx.lookup(lookupName); + Connection conn = ds.getConnection(); + log.info("JNDI 커넥션 생성 성공: jndiName={}", jndiName); + return conn; + } catch (NamingException e) { + log.error("JNDI 조회 실패: jndiName={}", jndiName, e); + throw new SQLException("JNDI 조회 실패: " + jndiName + " (" + e.getMessage() + ")", e); + } catch (SQLException e) { + log.error("JNDI 커넥션 생성 실패: jndiName={}", jndiName, e); + throw e; + } + } + + /** + * 직접 연결 커넥션 생성 + */ + private Connection createDirectConnection(SqlRequestDto request) throws SQLException { + String driverClassName = request.getDriverClassName(); + if (driverClassName != null && !driverClassName.isEmpty()) { + try { + Class.forName(driverClassName); + } catch (ClassNotFoundException e) { + throw new SQLException("드라이버 로드 실패: " + driverClassName, e); + } + } + + return DriverManager.getConnection( + request.getJdbcUrl(), + request.getUsername(), + request.getPassword() + ); + } + + /** + * 쿼리 타입 감지 + */ + private String detectQueryType(String sql) { + String upper = sql.toUpperCase().trim(); + + if (upper.startsWith("SELECT") || upper.startsWith("WITH")) { + return "SELECT"; + } else if (upper.startsWith("INSERT")) { + return "INSERT"; + } else if (upper.startsWith("UPDATE")) { + return "UPDATE"; + } else if (upper.startsWith("DELETE")) { + return "DELETE"; + } else if (upper.startsWith("CREATE") || upper.startsWith("ALTER") || + upper.startsWith("DROP") || upper.startsWith("TRUNCATE")) { + return "DDL"; + } else { + return "OTHER"; + } + } + + /** + * 트랜잭션 활성 상태 확인 + */ + private boolean isTransactionActive(String sessionId) { + Connection conn = sessionConnections.get(sessionId); + if (conn == null) { + return false; + } + try { + return !conn.isClosed(); + } catch (SQLException e) { + return false; + } + } + + /** + * 리소스 조용히 닫기 + */ + private void closeQuietly(AutoCloseable resource) { + if (resource != null) { + try { + resource.close(); + } catch (Exception e) { + // ignore + } + } + } + + /** + * 모든 세션 정리 (애플리케이션 종료 시) + */ + public void cleanupAllSessions() { + for (String sessionId : sessionConnections.keySet()) { + disconnect(sessionId); + } + } + + /** + * 스키마 목록 조회 (Oracle) + */ + public List getSchemas(SqlRequestDto request) { + List schemas = new ArrayList<>(); + Connection conn = null; + Statement stmt = null; + ResultSet rs = null; + + try { + conn = getOrCreateConnection(request); + stmt = conn.createStatement(); + + // Oracle 스키마(사용자) 목록 조회 + String sql = "SELECT username FROM all_users ORDER BY username"; + rs = stmt.executeQuery(sql); + + while (rs.next()) { + schemas.add(rs.getString("username")); + } + } catch (SQLException e) { + log.error("스키마 목록 조회 오류: {}", e.getMessage()); + } finally { + closeQuietly(rs); + closeQuietly(stmt); + } + + return schemas; + } + + /** + * 테이블 목록 조회 (Oracle) + */ + public List getTables(SqlRequestDto request) { + List tables = new ArrayList<>(); + Connection conn = null; + Statement stmt = null; + ResultSet rs = null; + + try { + conn = getOrCreateConnection(request); + stmt = conn.createStatement(); + + String schema = request.getSchemaName(); + if (schema == null || schema.isEmpty()) { + // 현재 사용자의 테이블 + schema = conn.getMetaData().getUserName(); + } + + // Oracle 테이블 목록 조회 (코멘트 포함) + String sql = "SELECT t.table_name, 'TABLE' as table_type, c.comments " + + "FROM all_tables t " + + "LEFT JOIN all_tab_comments c ON t.owner = c.owner AND t.table_name = c.table_name " + + "WHERE t.owner = '" + schema.toUpperCase() + "' " + + "UNION ALL " + + "SELECT v.view_name, 'VIEW' as table_type, c.comments " + + "FROM all_views v " + + "LEFT JOIN all_tab_comments c ON v.owner = c.owner AND v.view_name = c.table_name " + + "WHERE v.owner = '" + schema.toUpperCase() + "' " + + "ORDER BY table_name"; + + rs = stmt.executeQuery(sql); + + while (rs.next()) { + tables.add(TableInfoDto.builder() + .tableName(rs.getString("table_name")) + .tableType(rs.getString("table_type")) + .comments(rs.getString("comments")) + .build()); + } + } catch (SQLException e) { + log.error("테이블 목록 조회 오류: {}", e.getMessage()); + } finally { + closeQuietly(rs); + closeQuietly(stmt); + } + + return tables; + } + + /** + * 테이블 컬럼 정보 조회 (Oracle) - PK, Index, UK, FK 정보 포함 + */ + public List getColumns(SqlRequestDto request) { + List columns = new ArrayList<>(); + Connection conn = null; + Statement stmt = null; + ResultSet rs = null; + + try { + conn = getOrCreateConnection(request); + stmt = conn.createStatement(); + + String schema = request.getSchemaName(); + if (schema == null || schema.isEmpty()) { + schema = conn.getMetaData().getUserName(); + } + String tableName = request.getTableName(); + String schemaUpper = schema.toUpperCase(); + String tableUpper = tableName.toUpperCase(); + + // Oracle 컬럼 정보 조회 (PK, UK, FK, Index 포함) + String sql = "SELECT c.column_name, c.data_type, c.data_length, c.nullable, " + + "c.data_default, cc.comments, c.column_id, " + + "CASE WHEN pk.column_name IS NOT NULL THEN 'Y' ELSE 'N' END as is_pk, " + + "CASE WHEN uk.column_name IS NOT NULL THEN 'Y' ELSE 'N' END as is_uk, " + + "CASE WHEN fk.column_name IS NOT NULL THEN 'Y' ELSE 'N' END as is_fk, " + + "idx.index_names " + + "FROM all_tab_columns c " + + "LEFT JOIN all_col_comments cc ON c.owner = cc.owner AND c.table_name = cc.table_name AND c.column_name = cc.column_name " + + // PK 조인 + "LEFT JOIN (SELECT acc.owner, acc.table_name, acc.column_name " + + " FROM all_cons_columns acc " + + " JOIN all_constraints ac ON acc.constraint_name = ac.constraint_name AND acc.owner = ac.owner " + + " WHERE ac.constraint_type = 'P') pk " + + "ON c.owner = pk.owner AND c.table_name = pk.table_name AND c.column_name = pk.column_name " + + // UK 조인 + "LEFT JOIN (SELECT acc.owner, acc.table_name, acc.column_name " + + " FROM all_cons_columns acc " + + " JOIN all_constraints ac ON acc.constraint_name = ac.constraint_name AND acc.owner = ac.owner " + + " WHERE ac.constraint_type = 'U') uk " + + "ON c.owner = uk.owner AND c.table_name = uk.table_name AND c.column_name = uk.column_name " + + // FK 조인 + "LEFT JOIN (SELECT acc.owner, acc.table_name, acc.column_name " + + " FROM all_cons_columns acc " + + " JOIN all_constraints ac ON acc.constraint_name = ac.constraint_name AND acc.owner = ac.owner " + + " WHERE ac.constraint_type = 'R') fk " + + "ON c.owner = fk.owner AND c.table_name = fk.table_name AND c.column_name = fk.column_name " + + // Index 조인 (인덱스명 콤마로 연결) + "LEFT JOIN (SELECT ic.table_owner, ic.table_name, ic.column_name, " + + " LISTAGG(ic.index_name, ', ') WITHIN GROUP (ORDER BY ic.index_name) as index_names " + + " FROM all_ind_columns ic " + + " WHERE ic.table_owner = '" + schemaUpper + "' AND ic.table_name = '" + tableUpper + "' " + + " GROUP BY ic.table_owner, ic.table_name, ic.column_name) idx " + + "ON c.owner = idx.table_owner AND c.table_name = idx.table_name AND c.column_name = idx.column_name " + + "WHERE c.owner = '" + schemaUpper + "' " + + "AND c.table_name = '" + tableUpper + "' " + + "ORDER BY c.column_id"; + + rs = stmt.executeQuery(sql); + + while (rs.next()) { + String indexNames = rs.getString("index_names"); + columns.add(ColumnInfoDto.builder() + .columnName(rs.getString("column_name")) + .dataType(rs.getString("data_type")) + .dataLength(rs.getInt("data_length")) + .nullable(rs.getString("nullable")) + .defaultValue(rs.getString("data_default")) + .comments(rs.getString("comments")) + .columnId(rs.getInt("column_id")) + .primaryKey("Y".equals(rs.getString("is_pk"))) + .uniqueKey("Y".equals(rs.getString("is_uk"))) + .foreignKey("Y".equals(rs.getString("is_fk"))) + .indexed(indexNames != null && !indexNames.isEmpty()) + .indexName(indexNames) + .build()); + } + } catch (SQLException e) { + log.error("컬럼 정보 조회 오류: {}", e.getMessage()); + } finally { + closeQuietly(rs); + closeQuietly(stmt); + } + + return columns; + } + + /** + * 테이블 DDL 조회 (Oracle) - 컬럼 정보 기반으로 DDL 생성 + */ + public String getTableDdl(SqlRequestDto request) { + Connection conn = null; + Statement stmt = null; + ResultSet rs = null; + + try { + conn = getOrCreateConnection(request); + stmt = conn.createStatement(); + + String schema = request.getSchemaName(); + if (schema == null || schema.isEmpty()) { + schema = conn.getMetaData().getUserName(); + } + String tableName = request.getTableName(); + String schemaUpper = schema.toUpperCase(); + String tableUpper = tableName.toUpperCase(); + + StringBuilder ddl = new StringBuilder(); + ddl.append("CREATE TABLE ").append(schemaUpper).append(".").append(tableUpper).append(" (\n"); + + // 컬럼 정보 조회 + String colSql = "SELECT c.column_name, c.data_type, c.data_length, c.data_precision, c.data_scale, " + + "c.nullable, c.data_default, cc.comments " + + "FROM all_tab_columns c " + + "LEFT JOIN all_col_comments cc ON c.owner = cc.owner AND c.table_name = cc.table_name AND c.column_name = cc.column_name " + + "WHERE c.owner = '" + schemaUpper + "' AND c.table_name = '" + tableUpper + "' " + + "ORDER BY c.column_id"; + + rs = stmt.executeQuery(colSql); + List columnDefs = new ArrayList<>(); + List columnComments = new ArrayList<>(); + + while (rs.next()) { + StringBuilder colDef = new StringBuilder(); + String colName = rs.getString("column_name"); + String dataType = rs.getString("data_type"); + int dataLength = rs.getInt("data_length"); + int dataPrecision = rs.getInt("data_precision"); + int dataScale = rs.getInt("data_scale"); + String nullable = rs.getString("nullable"); + String defaultVal = rs.getString("data_default"); + String comment = rs.getString("comments"); + + colDef.append(" ").append(colName).append(" "); + + // 데이터 타입 + if ("NUMBER".equals(dataType)) { + if (dataPrecision > 0) { + colDef.append(dataType).append("(").append(dataPrecision); + if (dataScale > 0) { + colDef.append(",").append(dataScale); + } + colDef.append(")"); + } else { + colDef.append(dataType); + } + } else if ("VARCHAR2".equals(dataType) || "CHAR".equals(dataType) || "NVARCHAR2".equals(dataType)) { + colDef.append(dataType).append("(").append(dataLength).append(")"); + } else if ("RAW".equals(dataType)) { + colDef.append(dataType).append("(").append(dataLength).append(")"); + } else { + colDef.append(dataType); + } + + // DEFAULT + if (defaultVal != null && !defaultVal.trim().isEmpty()) { + colDef.append(" DEFAULT ").append(defaultVal.trim()); + } + + // NOT NULL + if ("N".equals(nullable)) { + colDef.append(" NOT NULL"); + } + + columnDefs.add(colDef.toString()); + + // 컬럼 코멘트 + if (comment != null && !comment.trim().isEmpty()) { + columnComments.add("COMMENT ON COLUMN " + schemaUpper + "." + tableUpper + "." + colName + + " IS '" + comment.replace("'", "''") + "';"); + } + } + closeQuietly(rs); + + // PK 제약조건 조회 + String pkSql = "SELECT acc.column_name FROM all_cons_columns acc " + + "JOIN all_constraints ac ON acc.constraint_name = ac.constraint_name AND acc.owner = ac.owner " + + "WHERE ac.owner = '" + schemaUpper + "' AND ac.table_name = '" + tableUpper + "' " + + "AND ac.constraint_type = 'P' ORDER BY acc.position"; + rs = stmt.executeQuery(pkSql); + List pkCols = new ArrayList<>(); + while (rs.next()) { + pkCols.add(rs.getString("column_name")); + } + closeQuietly(rs); + + // DDL 조합 + ddl.append(String.join(",\n", columnDefs)); + if (!pkCols.isEmpty()) { + ddl.append(",\n CONSTRAINT ").append(tableUpper).append("_PK PRIMARY KEY (") + .append(String.join(", ", pkCols)).append(")"); + } + ddl.append("\n);\n"); + + // 테이블 코멘트 + String tblCommentSql = "SELECT comments FROM all_tab_comments WHERE owner = '" + schemaUpper + + "' AND table_name = '" + tableUpper + "'"; + rs = stmt.executeQuery(tblCommentSql); + if (rs.next()) { + String tblComment = rs.getString("comments"); + if (tblComment != null && !tblComment.trim().isEmpty()) { + ddl.append("\nCOMMENT ON TABLE ").append(schemaUpper).append(".").append(tableUpper) + .append(" IS '").append(tblComment.replace("'", "''")).append("';\n"); + } + } + closeQuietly(rs); + + // 컬럼 코멘트 + if (!columnComments.isEmpty()) { + ddl.append("\n").append(String.join("\n", columnComments)).append("\n"); + } + + // 인덱스 조회 + String idxSql = "SELECT i.index_name, i.uniqueness, " + + "LISTAGG(ic.column_name, ', ') WITHIN GROUP (ORDER BY ic.column_position) as columns " + + "FROM all_indexes i " + + "JOIN all_ind_columns ic ON i.owner = ic.index_owner AND i.index_name = ic.index_name " + + "WHERE i.table_owner = '" + schemaUpper + "' AND i.table_name = '" + tableUpper + "' " + + "AND i.index_name NOT IN (SELECT constraint_name FROM all_constraints WHERE owner = '" + schemaUpper + "' AND table_name = '" + tableUpper + "' AND constraint_type = 'P') " + + "GROUP BY i.index_name, i.uniqueness ORDER BY i.index_name"; + rs = stmt.executeQuery(idxSql); + boolean hasIndex = false; + while (rs.next()) { + if (!hasIndex) { + ddl.append("\n"); + hasIndex = true; + } + String idxName = rs.getString("index_name"); + String uniqueness = rs.getString("uniqueness"); + String idxColumns = rs.getString("columns"); + ddl.append("CREATE "); + if ("UNIQUE".equals(uniqueness)) { + ddl.append("UNIQUE "); + } + ddl.append("INDEX ").append(schemaUpper).append(".").append(idxName) + .append(" ON ").append(schemaUpper).append(".").append(tableUpper) + .append(" (").append(idxColumns).append(");\n"); + } + + return ddl.toString(); + + } catch (SQLException e) { + log.error("DDL 조회 오류: {}", e.getMessage()); + return "-- DDL 조회 실패: " + e.getMessage(); + } finally { + closeQuietly(rs); + closeQuietly(stmt); + } + } +} diff --git a/src/main/java/com/eactive/eai/rms/data/entity/man/menu/MenuService.java b/src/main/java/com/eactive/eai/rms/data/entity/man/menu/MenuService.java index 17350ee..73dc650 100644 --- a/src/main/java/com/eactive/eai/rms/data/entity/man/menu/MenuService.java +++ b/src/main/java/com/eactive/eai/rms/data/entity/man/menu/MenuService.java @@ -90,7 +90,7 @@ public class MenuService extends AbstractEMSDataSerivce