ag-grid-enterprise
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
1,470 lines (1,447 loc) • 1.86 MB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/ag-grid-enterprise/src/main.ts
var main_exports = {};
__export(main_exports, {
AdvancedFilterModule: () => AdvancedFilterModule,
AggregationModule: () => AggregationModule,
AllEnterpriseModule: () => AllEnterpriseModule,
CellSelectionModule: () => CellSelectionModule,
ClipboardModule: () => ClipboardModule,
ColumnMenuModule: () => ColumnMenuModule,
ColumnsToolPanelModule: () => ColumnsToolPanelModule,
ContextMenuModule: () => ContextMenuModule,
ExcelExportModule: () => ExcelExportModule,
FiltersToolPanelModule: () => FiltersToolPanelModule,
FindModule: () => FindModule,
GridChartsModule: () => GridChartsModule,
GroupFilterModule: () => GroupFilterModule,
IntegratedChartsModule: () => IntegratedChartsModule,
LicenseManager: () => GridLicenseManager,
MasterDetailModule: () => MasterDetailModule,
MenuModule: () => MenuModule,
MultiFilterModule: () => MultiFilterModule,
PivotModule: () => PivotModule,
RangeSelectionModule: () => RangeSelectionModule,
RichSelectModule: () => RichSelectModule,
RowGroupingModule: () => RowGroupingModule,
RowGroupingPanelModule: () => RowGroupingPanelModule,
RowNumbersModule: () => RowNumbersModule,
ServerSideRowModelApiModule: () => ServerSideRowModelApiModule,
ServerSideRowModelModule: () => ServerSideRowModelModule,
SetFilterModule: () => SetFilterModule,
SideBarModule: () => SideBarModule,
SparklinesModule: () => SparklinesModule,
StatusBarModule: () => StatusBarModule,
TreeDataModule: () => TreeDataModule,
ViewportRowModelModule: () => ViewportRowModelModule,
exportMultipleSheetsAsExcel: () => exportMultipleSheetsAsExcel,
getMultipleSheetsAsExcel: () => getMultipleSheetsAsExcel
});
module.exports = __toCommonJS(main_exports);
// packages/ag-grid-enterprise/src/license/gridLicenseManager.ts
var import_ag_grid_community2 = require("ag-grid-community");
// packages/ag-grid-enterprise/src/license/shared/md5.ts
var MD5 = class {
constructor() {
this.ieCompatibility = false;
}
init() {
this.ieCompatibility = this.md5("hello") != "5d41402abc4b2a76b9719d911017c592";
}
md5cycle(x, k) {
let a = x[0], b = x[1], c = x[2], d = x[3];
a = this.ff(a, b, c, d, k[0], 7, -680876936);
d = this.ff(d, a, b, c, k[1], 12, -389564586);
c = this.ff(c, d, a, b, k[2], 17, 606105819);
b = this.ff(b, c, d, a, k[3], 22, -1044525330);
a = this.ff(a, b, c, d, k[4], 7, -176418897);
d = this.ff(d, a, b, c, k[5], 12, 1200080426);
c = this.ff(c, d, a, b, k[6], 17, -1473231341);
b = this.ff(b, c, d, a, k[7], 22, -45705983);
a = this.ff(a, b, c, d, k[8], 7, 1770035416);
d = this.ff(d, a, b, c, k[9], 12, -1958414417);
c = this.ff(c, d, a, b, k[10], 17, -42063);
b = this.ff(b, c, d, a, k[11], 22, -1990404162);
a = this.ff(a, b, c, d, k[12], 7, 1804603682);
d = this.ff(d, a, b, c, k[13], 12, -40341101);
c = this.ff(c, d, a, b, k[14], 17, -1502002290);
b = this.ff(b, c, d, a, k[15], 22, 1236535329);
a = this.gg(a, b, c, d, k[1], 5, -165796510);
d = this.gg(d, a, b, c, k[6], 9, -1069501632);
c = this.gg(c, d, a, b, k[11], 14, 643717713);
b = this.gg(b, c, d, a, k[0], 20, -373897302);
a = this.gg(a, b, c, d, k[5], 5, -701558691);
d = this.gg(d, a, b, c, k[10], 9, 38016083);
c = this.gg(c, d, a, b, k[15], 14, -660478335);
b = this.gg(b, c, d, a, k[4], 20, -405537848);
a = this.gg(a, b, c, d, k[9], 5, 568446438);
d = this.gg(d, a, b, c, k[14], 9, -1019803690);
c = this.gg(c, d, a, b, k[3], 14, -187363961);
b = this.gg(b, c, d, a, k[8], 20, 1163531501);
a = this.gg(a, b, c, d, k[13], 5, -1444681467);
d = this.gg(d, a, b, c, k[2], 9, -51403784);
c = this.gg(c, d, a, b, k[7], 14, 1735328473);
b = this.gg(b, c, d, a, k[12], 20, -1926607734);
a = this.hh(a, b, c, d, k[5], 4, -378558);
d = this.hh(d, a, b, c, k[8], 11, -2022574463);
c = this.hh(c, d, a, b, k[11], 16, 1839030562);
b = this.hh(b, c, d, a, k[14], 23, -35309556);
a = this.hh(a, b, c, d, k[1], 4, -1530992060);
d = this.hh(d, a, b, c, k[4], 11, 1272893353);
c = this.hh(c, d, a, b, k[7], 16, -155497632);
b = this.hh(b, c, d, a, k[10], 23, -1094730640);
a = this.hh(a, b, c, d, k[13], 4, 681279174);
d = this.hh(d, a, b, c, k[0], 11, -358537222);
c = this.hh(c, d, a, b, k[3], 16, -722521979);
b = this.hh(b, c, d, a, k[6], 23, 76029189);
a = this.hh(a, b, c, d, k[9], 4, -640364487);
d = this.hh(d, a, b, c, k[12], 11, -421815835);
c = this.hh(c, d, a, b, k[15], 16, 530742520);
b = this.hh(b, c, d, a, k[2], 23, -995338651);
a = this.ii(a, b, c, d, k[0], 6, -198630844);
d = this.ii(d, a, b, c, k[7], 10, 1126891415);
c = this.ii(c, d, a, b, k[14], 15, -1416354905);
b = this.ii(b, c, d, a, k[5], 21, -57434055);
a = this.ii(a, b, c, d, k[12], 6, 1700485571);
d = this.ii(d, a, b, c, k[3], 10, -1894986606);
c = this.ii(c, d, a, b, k[10], 15, -1051523);
b = this.ii(b, c, d, a, k[1], 21, -2054922799);
a = this.ii(a, b, c, d, k[8], 6, 1873313359);
d = this.ii(d, a, b, c, k[15], 10, -30611744);
c = this.ii(c, d, a, b, k[6], 15, -1560198380);
b = this.ii(b, c, d, a, k[13], 21, 1309151649);
a = this.ii(a, b, c, d, k[4], 6, -145523070);
d = this.ii(d, a, b, c, k[11], 10, -1120210379);
c = this.ii(c, d, a, b, k[2], 15, 718787259);
b = this.ii(b, c, d, a, k[9], 21, -343485551);
x[0] = this.add32(a, x[0]);
x[1] = this.add32(b, x[1]);
x[2] = this.add32(c, x[2]);
x[3] = this.add32(d, x[3]);
}
cmn(q, a, b, x, s, t) {
a = this.add32(this.add32(a, q), this.add32(x, t));
return this.add32(a << s | a >>> 32 - s, b);
}
ff(a, b, c, d, x, s, t) {
return this.cmn(b & c | ~b & d, a, b, x, s, t);
}
gg(a, b, c, d, x, s, t) {
return this.cmn(b & d | c & ~d, a, b, x, s, t);
}
hh(a, b, c, d, x, s, t) {
return this.cmn(b ^ c ^ d, a, b, x, s, t);
}
ii(a, b, c, d, x, s, t) {
return this.cmn(c ^ (b | ~d), a, b, x, s, t);
}
md51(s) {
const n = s.length;
const state = [1732584193, -271733879, -1732584194, 271733878];
let i;
for (i = 64; i <= s.length; i += 64) {
this.md5cycle(state, this.md5blk(s.substring(i - 64, i)));
}
s = s.substring(i - 64);
const tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (i = 0; i < s.length; i++) {
tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
}
tail[i >> 2] |= 128 << (i % 4 << 3);
if (i > 55) {
this.md5cycle(state, tail);
for (i = 0; i < 16; i++) {
tail[i] = 0;
}
}
tail[14] = n * 8;
this.md5cycle(state, tail);
return state;
}
/* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5
* algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and
* shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character
* was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched?
* There is no way to standardize text to something like UTF-8 before transformation; speed cost is
* utterly prohibitive. The JavaScript standard itself needs to look at this: it should start
* providing access to strings as preformed UTF-8 8-bit unsigned value arrays.
*/
md5blk(s) {
const md5blks = [];
for (let i = 0; i < 64; i += 4) {
md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
}
return md5blks;
}
rhex(n) {
const hex_chr = "0123456789abcdef".split("");
let s = "", j = 0;
for (; j < 4; j++) {
s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];
}
return s;
}
hex(x) {
for (let i = 0; i < x.length; i++) {
x[i] = this.rhex(x[i]);
}
return x.join("");
}
md5(s) {
return this.hex(this.md51(s));
}
add32(a, b) {
return this.ieCompatibility ? this.add32Compat(a, b) : this.add32Std(a, b);
}
/* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that
need the idiotic second function, generated by an if clause. */
add32Std(a, b) {
return a + b & 4294967295;
}
add32Compat(x, y) {
const lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return msw << 16 | lsw & 65535;
}
};
// packages/ag-grid-enterprise/src/license/shared/licenseManager.ts
var LICENSE_TYPES = {
"01": "GRID",
"02": "CHARTS",
"0102": "BOTH"
};
var LICENSING_HELP_URL = "https://www.ag-grid.com/licensing/";
var _LicenseManager = class _LicenseManager {
constructor(document2) {
this.watermarkMessage = void 0;
this.totalMessageLength = 124;
this.document = document2;
this.md5 = new MD5();
this.md5.init();
}
validateLicense() {
const licenseDetails = this.getLicenseDetails(_LicenseManager.licenseKey);
const currentLicenseName = `AG Grid ${licenseDetails.currentLicenseType === "BOTH" ? "and AG Charts " : ""}Enterprise`;
const suppliedLicenseName = licenseDetails.suppliedLicenseType === void 0 ? "" : `AG ${licenseDetails.suppliedLicenseType === "BOTH" ? "Grid and AG Charts" : licenseDetails.suppliedLicenseType === "GRID" ? "Grid" : "Charts"} Enterprise`;
if (licenseDetails.missing) {
if (!this.isWebsiteUrl() || this.isForceWatermark()) {
this.outputMissingLicenseKey(currentLicenseName);
}
} else if (licenseDetails.expired) {
const gridReleaseDate = _LicenseManager.getGridReleaseDate();
const formattedReleaseDate = _LicenseManager.formatDate(gridReleaseDate);
this.outputExpiredKey(licenseDetails.expiry, formattedReleaseDate, currentLicenseName, suppliedLicenseName);
} else if (!licenseDetails.valid) {
this.outputInvalidLicenseKey(
!!licenseDetails.incorrectLicenseType,
currentLicenseName,
suppliedLicenseName
);
} else if (licenseDetails.isTrial && licenseDetails.trialExpired) {
this.outputExpiredTrialKey(licenseDetails.expiry, currentLicenseName, suppliedLicenseName);
}
}
static extractExpiry(license) {
const restrictionHashed = license.substring(license.lastIndexOf("_") + 1, license.length);
return new Date(parseInt(_LicenseManager.decode(restrictionHashed), 10));
}
static extractLicenseComponents(licenseKey) {
let cleanedLicenseKey = licenseKey.replace(/[\u200B-\u200D\uFEFF]/g, "");
cleanedLicenseKey = cleanedLicenseKey.replace(/\r?\n|\r/g, "");
if (licenseKey.length <= 32) {
return { md5: null, license: licenseKey, version: null, isTrial: null };
}
const hashStart = cleanedLicenseKey.length - 32;
const md5 = cleanedLicenseKey.substring(hashStart);
const license = cleanedLicenseKey.substring(0, hashStart);
const [version, isTrial, type] = _LicenseManager.extractBracketedInformation(cleanedLicenseKey);
return { md5, license, version, isTrial, type };
}
getLicenseDetails(licenseKey) {
const currentLicenseType = _LicenseManager.chartsLicenseManager ? "BOTH" : "GRID";
if (!licenseKey?.length) {
return {
licenseKey,
valid: false,
missing: true,
currentLicenseType
};
}
const gridReleaseDate = _LicenseManager.getGridReleaseDate();
const { md5, license, version, isTrial, type } = _LicenseManager.extractLicenseComponents(licenseKey);
let valid = md5 === this.md5.md5(license) && licenseKey.indexOf("For_Trialing_ag-Grid_Only") === -1;
let trialExpired = void 0;
let expired = void 0;
let expiry = null;
let incorrectLicenseType = false;
let suppliedLicenseType = void 0;
function handleTrial() {
const now = /* @__PURE__ */ new Date();
trialExpired = expiry < now;
expired = void 0;
}
if (valid) {
expiry = _LicenseManager.extractExpiry(license);
valid = !isNaN(expiry.getTime());
if (valid) {
expired = gridReleaseDate > expiry;
switch (version) {
case "legacy":
case "2": {
if (isTrial) {
handleTrial();
}
break;
}
case "3": {
if (!type?.length) {
valid = false;
} else {
suppliedLicenseType = type;
if (type !== LICENSE_TYPES["01"] && type !== LICENSE_TYPES["0102"] || currentLicenseType === "BOTH" && suppliedLicenseType !== "BOTH") {
valid = false;
incorrectLicenseType = true;
} else if (isTrial) {
handleTrial();
}
}
}
}
}
}
if (!valid) {
return {
licenseKey,
valid,
incorrectLicenseType,
currentLicenseType,
suppliedLicenseType
};
}
return {
licenseKey,
valid,
expiry: _LicenseManager.formatDate(expiry),
expired,
version,
isTrial,
trialExpired,
incorrectLicenseType,
currentLicenseType,
suppliedLicenseType
};
}
isDisplayWatermark() {
return this.isForceWatermark() || !this.isLocalhost() && !this.isWebsiteUrl() && !!this.watermarkMessage?.length;
}
getWatermarkMessage() {
return this.watermarkMessage || "";
}
getHostname() {
const win = this.document.defaultView || window;
const loc = win.location;
const { hostname = "" } = loc;
return hostname;
}
isForceWatermark() {
const win = this.document.defaultView || window;
const loc = win.location;
const { pathname } = loc;
return pathname ? pathname.indexOf("forceWatermark") !== -1 : false;
}
isWebsiteUrl() {
const hostname = this.getHostname();
return hostname.match(/^((?:[\w-]+\.)?ag-grid\.com)$/) !== null;
}
isLocalhost() {
const hostname = this.getHostname();
return hostname.match(/^(?:127\.0\.0\.1|localhost)$/) !== null;
}
static formatDate(date) {
const monthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
const day = date.getDate();
const monthIndex = date.getMonth();
const year = date.getFullYear();
return day + " " + monthNames[monthIndex] + " " + year;
}
static getGridReleaseDate() {
return new Date(parseInt(_LicenseManager.decode(_LicenseManager.RELEASE_INFORMATION), 10));
}
static decode(input) {
const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
let t = "";
let n, r, i;
let s, o, u, a;
let f = 0;
const e = input.replace(/[^A-Za-z0-9+/=]/g, "");
while (f < e.length) {
s = keystr.indexOf(e.charAt(f++));
o = keystr.indexOf(e.charAt(f++));
u = keystr.indexOf(e.charAt(f++));
a = keystr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r);
}
if (a != 64) {
t = t + String.fromCharCode(i);
}
}
t = _LicenseManager.utf8_decode(t);
return t;
}
static utf8_decode(input) {
input = input.replace(/rn/g, "n");
let t = "";
for (let n = 0; n < input.length; n++) {
const r = input.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128);
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128);
}
}
return t;
}
static setChartsLicenseManager(dependantLicenseManager) {
this.chartsLicenseManager = dependantLicenseManager;
}
static setLicenseKey(licenseKey) {
this.licenseKey = licenseKey;
this.chartsLicenseManager?.setLicenseKey(licenseKey, true);
}
static extractBracketedInformation(licenseKey) {
if (!licenseKey.includes("[")) {
return ["legacy", false, void 0];
}
const matches = licenseKey.match(/\[(.*?)\]/g).map((match) => match.replace("[", "").replace("]", ""));
if (!matches || matches.length === 0) {
return ["legacy", false, void 0];
}
const isTrial = matches.filter((match) => match === "TRIAL").length === 1;
const rawVersion = matches.filter((match) => match.indexOf("v") === 0)[0];
const version = rawVersion ? rawVersion.replace("v", "") : "legacy";
const type = LICENSE_TYPES[matches.filter((match) => LICENSE_TYPES[match])[0]];
return [version, isTrial, type];
}
centerPadAndOutput(input) {
const paddingRequired = this.totalMessageLength - input.length;
console.error(input.padStart(paddingRequired / 2 + input.length, "*").padEnd(this.totalMessageLength, "*"));
}
padAndOutput(input, padding = "*", terminateWithPadding = "") {
console.error(
input.padEnd(this.totalMessageLength - terminateWithPadding.length, padding) + terminateWithPadding
);
}
outputInvalidLicenseKey(incorrectLicenseType, currentLicenseName, suppliedLicenseName) {
if (incorrectLicenseType) {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" Incompatible License Key ");
this.padAndOutput(
`* Your license key is for ${suppliedLicenseName} only and does not cover you for ${currentLicenseName}.`,
" ",
"*"
);
this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*");
this.centerPadAndOutput("");
this.centerPadAndOutput("");
} else {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" Invalid License Key ");
this.padAndOutput(`* Your license key is not valid.`, " ", "*");
this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*");
this.centerPadAndOutput("");
this.centerPadAndOutput("");
}
this.watermarkMessage = "Invalid License";
}
outputExpiredTrialKey(formattedExpiryDate, currentLicenseName, suppliedLicenseName) {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" Trial Period Expired. ");
this.padAndOutput(
`* Your trial only license for ${suppliedLicenseName} expired on ${formattedExpiryDate}.`,
" ",
"*"
);
this.padAndOutput("* Please email info@ag-grid.com to purchase a license.", " ", "*");
this.centerPadAndOutput("");
this.centerPadAndOutput("");
this.watermarkMessage = "Trial Period Expired";
}
outputMissingLicenseKey(currentLicenseName) {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" License Key Not Found ");
this.padAndOutput(`* All ${currentLicenseName} features are unlocked for trial.`, " ", "*");
this.padAndOutput(
"* If you want to hide the watermark please email info@ag-grid.com for a trial license key.",
" ",
"*"
);
this.centerPadAndOutput("");
this.centerPadAndOutput("");
this.watermarkMessage = "For Trial Use Only";
}
outputExpiredKey(formattedExpiryDate, formattedReleaseDate, currentLicenseName, suppliedLicenseName) {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" Incompatible Software Version ");
this.padAndOutput(
`* Your license key works with versions of ${suppliedLicenseName} released before ${formattedExpiryDate}.`,
" ",
"*"
);
this.padAndOutput(`* The version you are trying to use was released on ${formattedReleaseDate}.`, " ", "*");
this.padAndOutput("* Please contact info@ag-grid.com to renew your license key.", " ", "*");
this.centerPadAndOutput("");
this.centerPadAndOutput("");
this.watermarkMessage = "License Expired";
}
};
_LicenseManager.RELEASE_INFORMATION = "MTc0MjU0ODYxMzc0Nw==";
var LicenseManager = _LicenseManager;
// packages/ag-grid-enterprise/src/license/watermark.ts
var import_ag_grid_community = require("ag-grid-community");
// packages/ag-grid-enterprise/src/license/watermark.css-GENERATED.ts
var watermarkCSS = (
/*css*/
`.ag-watermark{bottom:20px;color:#9b9b9b;opacity:.7;position:absolute;transition:opacity 1s ease-out 3s;&:before{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDkiIGhlaWdodD0iMzYiIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyMDkgMzYiPjxwYXRoIGZpbGw9IiM5QjlCOUIiIGQ9Ik0xOTIuOTkzIDIzLjY1OHYtNy45NDZoLTEzLjU0MWwtNy45NDcgNy45NDZ6TTIwOC4yNSAzLjk1aC0xNi45NzRsLTguMDEgNy45NDdoMjQuOTg0ek0xNjMuNjIyIDMxLjYwNWw0LjA2OS00LjA2OWgxMy43MzJ2Ny45NDdoLTE3LjgwMXoiLz48cGF0aCBmaWxsPSIjOUI5QjlCIiBkPSJNMTY2LjYxIDE5Ljc4aDguNzczbDguMDEtNy45NDZ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M4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1OCAxLjAxNyAyLjAzNCAwIDMuODc4LS4zMTggNS41My0xLjAxNyAxLjY1My0uNyAzLjA1Mi0xLjU5IDQuMTk2LTIuNzk3cTEuNzE4LTEuODEyIDIuNjctNC4zODdjLjYzNi0xLjcxNi45NTQtMy42MjMuOTU0LTUuNjU4di0uODI2Yy0uMTktLjEyNy0uMjU1LS40NDUtLjI1NS0uNyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-size:170px 40px;content:"";display:block;height:40px;width:170px}}:where(.ag-ltr) .ag-watermark{right:25px}:where(.ag-rtl) .ag-watermark{left:25px}.ag-watermark-text{font-family:Impact,sans-serif;font-size:19px;font-weight:700;opacity:.5}:where(.ag-ltr) .ag-watermark-text{padding-left:.7rem}:where(.ag-rtl) .ag-watermark-text{padding-right:.7rem}`
);
// packages/ag-grid-enterprise/src/license/watermark.ts
var WatermarkElement = {
tag: "div",
cls: "ag-watermark",
children: [{ tag: "div", ref: "eLicenseTextRef", cls: "ag-watermark-text" }]
};
var AgWatermark = class extends import_ag_grid_community.Component {
constructor() {
super(WatermarkElement);
this.eLicenseTextRef = import_ag_grid_community.RefPlaceholder;
this.registerCSS(watermarkCSS);
}
wireBeans(beans) {
this.licenseManager = beans.licenseManager;
}
postConstruct() {
const show = this.shouldDisplayWatermark();
this.setDisplayed(show);
if (show) {
this.eLicenseTextRef.textContent = this.licenseManager.getWatermarkMessage();
window.setTimeout(() => this.addCssClass("ag-opacity-zero"), 0);
window.setTimeout(() => this.setDisplayed(false), 5e3);
}
}
shouldDisplayWatermark() {
return this.licenseManager.isDisplayWatermark();
}
};
var AgWatermarkSelector = {
selector: "AG-WATERMARK",
component: AgWatermark
};
// packages/ag-grid-enterprise/src/license/gridLicenseManager.ts
var GridLicenseManager = class extends import_ag_grid_community2.BeanStub {
constructor() {
super(...arguments);
this.beanName = "licenseManager";
}
postConstruct() {
this.validateLicense();
}
validateLicense() {
this.licenseManager = new LicenseManager((0, import_ag_grid_community2._getDocument)(this.beans));
this.licenseManager.validateLicense();
}
static getLicenseDetails(licenseKey) {
return new LicenseManager(null).getLicenseDetails(licenseKey);
}
getWatermarkSelector() {
return AgWatermarkSelector;
}
isDisplayWatermark() {
return this.licenseManager.isDisplayWatermark();
}
getWatermarkMessage() {
return this.licenseManager.getWatermarkMessage();
}
static setLicenseKey(licenseKey) {
LicenseManager.setLicenseKey(licenseKey);
}
static setChartsLicenseManager(chartsLicenseManager) {
LicenseManager.setChartsLicenseManager(chartsLicenseManager);
}
};
// packages/ag-grid-enterprise/src/excelExport/excelCreator.ts
var import_ag_grid_community10 = require("ag-grid-community");
// packages/ag-grid-enterprise/src/excelExport/excelSerializingSession.ts
var import_ag_grid_community8 = require("ag-grid-community");
// packages/ag-grid-enterprise/src/excelExport/assets/excelUtils.ts
var import_ag_grid_community3 = require("ag-grid-community");
// packages/ag-grid-enterprise/src/excelExport/assets/excelConstants.ts
var INCH_TO_EMU = 9525;
var numberFormatMap = {
"0": 1,
"0.00": 2,
"#,##0": 3,
"#,##0.00": 4,
"0%": 9,
"0.00%": 10,
"0.00E+00": 11,
"# ?/?": 12,
"# ??/??": 13,
"mm-dd-yy": 14,
"d-mmm-yy": 15,
"d-mmm": 16,
"mmm-yy": 17,
"h:mm AM/PM": 18,
"h:mm:ss AM/PM": 19,
"h:mm": 20,
"h:mm:ss": 21,
"m/d/yy h:mm": 22,
"#,##0 ;(#,##0)": 37,
"#,##0 ;[Red](#,##0)": 38,
"#,##0.00;(#,##0.00)": 39,
"#,##0.00;[Red](#,##0.00)": 40,
"mm:ss": 45,
"[h]:mm:ss": 46,
"mmss.0": 47,
"##0.0E+0": 48,
"@": 49
};
// packages/ag-grid-enterprise/src/excelExport/assets/xmlFactory.ts
var LINE_SEPARATOR = "\r\n";
function returnAttributeIfPopulated(key, value, booleanTransformer) {
if (!value && value !== "" && value !== 0) {
return "";
}
let xmlValue = value;
if (typeof value === "boolean") {
if (booleanTransformer) {
xmlValue = booleanTransformer(value);
}
}
return ` ${key}="${xmlValue}"`;
}
function createXmlHeader(headerElement = {}) {
const headerStart = "<?";
const headerEnd = "?>";
const keys = ["version"];
if (!headerElement.version) {
headerElement.version = "1.0";
}
if (headerElement.encoding) {
keys.push("encoding");
}
if (headerElement.standalone) {
keys.push("standalone");
}
const att = keys.map((key) => `${key}="${headerElement[key]}"`).join(" ");
return `${headerStart}xml ${att} ${headerEnd}`;
}
function createXml(xmlElement, booleanTransformer) {
let props = "";
if (xmlElement.properties) {
if (xmlElement.properties.prefixedAttributes) {
xmlElement.properties.prefixedAttributes.forEach((prefixedSet) => {
Object.keys(prefixedSet.map).forEach((key) => {
props += returnAttributeIfPopulated(
prefixedSet.prefix + key,
prefixedSet.map[key],
booleanTransformer
);
});
});
}
if (xmlElement.properties.rawMap) {
Object.keys(xmlElement.properties.rawMap).forEach((key) => {
props += returnAttributeIfPopulated(key, xmlElement.properties.rawMap[key], booleanTransformer);
});
}
}
let result = "<" + xmlElement.name + props;
if (!xmlElement.children && xmlElement.textNode == null) {
return result + "/>" + LINE_SEPARATOR;
}
if (xmlElement.textNode != null) {
return result + ">" + xmlElement.textNode + "</" + xmlElement.name + ">" + LINE_SEPARATOR;
}
result += ">" + LINE_SEPARATOR;
if (xmlElement.children) {
xmlElement.children.forEach((it) => {
result += createXml(it, booleanTransformer);
});
}
return result + "</" + xmlElement.name + ">" + LINE_SEPARATOR;
}
// packages/ag-grid-enterprise/src/excelExport/assets/excelUtils.ts
var pointsToPixel = (points) => {
return Math.round(points * 96 / 72);
};
var pixelsToEMU = (value) => {
return Math.ceil(value * INCH_TO_EMU);
};
var getFontFamilyId = (name) => {
if (name === void 0) {
return;
}
const families = ["Automatic", "Roman", "Swiss", "Modern", "Script", "Decorative"];
const pos = families.indexOf(name || "Automatic");
return Math.max(pos, 0);
};
var getHeightFromProperty = (rowIndex, height) => {
if (!height) {
return;
}
let finalHeight;
if (typeof height === "number") {
finalHeight = height;
} else {
const heightFunc = height;
finalHeight = heightFunc({ rowIndex });
}
return finalHeight;
};
var setExcelImageTotalWidth = (image, columnsToExport) => {
const { colSpan, column } = image.position;
if (!image.width) {
return;
}
if (colSpan) {
const columnsInSpan = columnsToExport.slice(column - 1, column + colSpan - 1);
let totalWidth = 0;
for (let i = 0; i < columnsInSpan.length; i++) {
const colWidth = columnsInSpan[i].getActualWidth();
if (image.width < totalWidth + colWidth) {
image.position.colSpan = i + 1;
image.totalWidth = image.width;
image.width = image.totalWidth - totalWidth;
break;
}
totalWidth += colWidth;
}
} else {
image.totalWidth = image.width;
}
};
var setExcelImageTotalHeight = (image, rowHeight) => {
const { rowSpan, row } = image.position;
if (!image.height) {
return;
}
if (rowSpan) {
let totalHeight = 0;
let counter = 0;
for (let i = row; i < row + rowSpan; i++) {
const nextRowHeight = pointsToPixel(getHeightFromProperty(i, rowHeight) || 20);
if (image.height < totalHeight + nextRowHeight) {
image.position.rowSpan = counter + 1;
image.totalHeight = image.height;
image.height = image.totalHeight - totalHeight;
break;
}
totalHeight += nextRowHeight;
counter++;
}
} else {
image.totalHeight = image.height;
}
};
var createXmlPart = (body, skipHeader) => {
const header = createXmlHeader({
encoding: "UTF-8",
standalone: "yes"
});
const xmlBody = createXml(body);
if (skipHeader) {
return xmlBody;
}
return `${header}${xmlBody}`;
};
var getExcelColumnName = (colIdx) => {
const startCode = 65;
const tableWidth = 26;
const fromCharCode = String.fromCharCode;
const pos = Math.floor(colIdx / tableWidth);
const tableIdx = colIdx % tableWidth;
if (!pos || colIdx === tableWidth) {
return fromCharCode(startCode + colIdx - 1);
}
if (!tableIdx) {
return getExcelColumnName(pos - 1) + "Z";
}
if (pos < tableWidth) {
return fromCharCode(startCode + pos - 1) + fromCharCode(startCode + tableIdx - 1);
}
return getExcelColumnName(pos) + fromCharCode(startCode + tableIdx - 1);
};
var sanitizeTableName = (name) => {
return name.replaceAll("\n", "_x000a_");
};
var replaceInvisibleCharacters = (str) => {
if (str == null) {
return null;
}
let newString = "";
for (let i = 0; i < str.length; i++) {
const point = str.charCodeAt(i);
if (point >= 0 && point <= 31 && point !== 10) {
const convertedCode = point.toString(16).toUpperCase();
const paddedCode = convertedCode.padStart(4, "0");
const newValue = `_x${paddedCode}_`;
newString += newValue;
} else {
newString += str[i];
}
}
return newString;
};
var buildSharedString = (strMap) => {
const ret = [];
for (const key of strMap.keys()) {
const textNode = key.toString();
const child = {
name: "t",
textNode: (0, import_ag_grid_community3._escapeString)(replaceInvisibleCharacters(textNode), false)
};
const preserveSpaces = textNode.trim().length !== textNode.length;
if (preserveSpaces) {
child.properties = {
rawMap: {
"xml:space": "preserve"
}
};
}
ret.push({
name: "si",
children: [child]
});
}
return ret;
};
// packages/ag-grid-enterprise/src/excelExport/excelXlsxFactory.ts
var import_ag_grid_community7 = require("ag-grid-community");
// packages/ag-grid-enterprise/src/excelExport/files/ooxml/contentType.ts
var contentTypeFactory = {
getTemplate(config) {
const { name, ContentType, Extension, PartName } = config;
return {
name,
properties: {
rawMap: {
Extension,
PartName,
ContentType
}
}
};
}
};
var contentType_default = contentTypeFactory;
// packages/ag-grid-enterprise/src/excelExport/files/ooxml/contentTypes.ts
var _normaliseImageExtension = (ext) => ext === "jpg" ? "jpeg" : ext;
var contentTypesFactory = {
getTemplate(sheetLen) {
const worksheets = new Array(sheetLen).fill(void 0).map((v, i) => ({
name: "Override",
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
PartName: `/xl/worksheets/sheet${i + 1}.xml`
}));
const sheetsWithImages = XLSX_WORKSHEET_IMAGES.size;
const headerFooterImages = XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.size;
const imageTypesObject = {};
XLSX_WORKBOOK_IMAGE_IDS.forEach((v) => {
imageTypesObject[_normaliseImageExtension(v.type)] = true;
});
const imageDocs = new Array(sheetsWithImages).fill(void 0).map((v, i) => ({
name: "Override",
ContentType: "application/vnd.openxmlformats-officedocument.drawing+xml",
PartName: `/xl/drawings/drawing${i + 1}.xml`
}));
const tableDocs = [];
XLSX_WORKSHEET_DATA_TABLES.forEach(({ name }) => {
tableDocs.push({
name: "Override",
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
PartName: `/xl/tables/${name}.xml`
});
});
const imageTypes = Object.keys(imageTypesObject).map((ext) => ({
name: "Default",
ContentType: `image/${ext}`,
Extension: ext
}));
if (headerFooterImages) {
imageTypes.push({
name: "Default",
Extension: "vml",
ContentType: "application/vnd.openxmlformats-officedocument.vmlDrawing"
});
}
const children = [
...imageTypes,
{
name: "Default",
Extension: "rels",
ContentType: "application/vnd.openxmlformats-package.relationships+xml"
},
{
name: "Default",
ContentType: "application/xml",
Extension: "xml"
},
{
name: "Override",
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
PartName: "/xl/workbook.xml"
},
...worksheets,
{
name: "Override",
ContentType: "application/vnd.openxmlformats-officedocument.theme+xml",
PartName: "/xl/theme/theme1.xml"
},
{
name: "Override",
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
PartName: "/xl/styles.xml"
},
{
name: "Override",
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
PartName: "/xl/sharedStrings.xml"
},
...imageDocs,
...tableDocs,
{
name: "Override",
ContentType: "application/vnd.openxmlformats-package.core-properties+xml",
PartName: "/docProps/core.xml"
}
].map((contentType) => contentType_default.getTemplate(contentType));
return {
name: "Types",
properties: {
rawMap: {
xmlns: "http://schemas.openxmlformats.org/package/2006/content-types"
}
},
children
};
}
};
var contentTypes_default = contentTypesFactory;
// packages/ag-grid-enterprise/src/excelExport/files/ooxml/core.ts
var coreFactory = {
getTemplate(author) {
const dt = /* @__PURE__ */ new Date();
const jsonDate = dt.toJSON();
return {
name: "cp:coreProperties",
properties: {
prefixedAttributes: [
{
prefix: "xmlns:",
map: {
cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
dc: "http://purl.org/dc/elements/1.1/",
dcterms: "http://purl.org/dc/terms/",
dcmitype: "http://purl.org/dc/dcmitype/",
xsi: "http://www.w3.org/2001/XMLSchema-instance"
}
}
]
},
children: [
{
name: "dc:creator",
textNode: author
},
{
name: "dc:title",
textNode: "Workbook"
},
{
name: "dcterms:created",
properties: {
rawMap: {
"xsi:type": "dcterms:W3CDTF"
}
},
textNode: jsonDate
},
{
name: "dcterms:modified",
properties: {
rawMap: {
"xsi:type": "dcterms:W3CDTF"
}
},
textNode: jsonDate
}
]
};
}
};
var core_default = coreFactory;
// packages/ag-grid-enterprise/src/excelExport/files/ooxml/drawing.ts
var getAnchor = (name, imageAnchor) => ({
name: `xdr:${name}`,
children: [
{
name: "xdr:col",
textNode: imageAnchor.col.toString()
},
{
name: "xdr:colOff",
textNode: imageAnchor.offsetX.toString()
},
{
name: "xdr:row",
textNode: imageAnchor.row.toString()
},
{
name: "xdr:rowOff",
textNode: imageAnchor.offsetY.toString()
}
]
});
var getExt = (image) => {
const children = [
{
name: "a:ext",
properties: {
rawMap: {
uri: "{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"
}
},
children: [
{
name: "a16:creationId",
properties: {
rawMap: {
id: "{822E6D20-D7BC-2841-A643-D49A6EF008A2}",
"xmlns:a16": "http://schemas.microsoft.com/office/drawing/2014/main"
}
}
}
]
}
];
const recolor = image.recolor && image.recolor.toLowerCase();
switch (recolor) {
case "grayscale":
case "sepia":
case "washout":
children.push({
name: "a:ext",
properties: {
rawMap: {
uri: "{C183D7F6-B498-43B3-948B-1728B52AA6E4}"
}
},
children: [
{
name: "adec:decorative",
properties: {
rawMap: {
val: "0",
"xmlns:adec": "http://schemas.microsoft.com/office/drawing/2017/decorative"
}
}
}
]
});
}
return {
name: "a:extLst",
children
};
};
var getNvPicPr = (image, index) => ({
name: "xdr:nvPicPr",
children: [
{
name: "xdr:cNvPr",
properties: {
rawMap: {
id: index,
name: image.id,
descr: image.altText != null ? image.altText : void 0
}
},
children: [getExt(image)]
},
{
name: "xdr:cNvPicPr",
properties: {
rawMap: {
preferRelativeResize: "0"
}
},
children: [
{
name: "a:picLocks"
}
]
}
]
});
var getColorDetails = (color) => {
if (!color.saturation && !color.tint) {
return;
}
const ret = [];
if (color.saturation) {
ret.push({
name: "a:satMod",
properties: {
rawMap: {
val: color.saturation * 1e3
}
}
});
}
if (color.tint) {
ret.push({
name: "a:tint",
properties: {
rawMap: {
val: color.tint * 1e3
}
}
});
}
return ret;
};
var getDuoTone = (primaryColor, secondaryColor) => {
return {
name: "a:duotone",
children: [
{
name: "a:prstClr",
properties: {
rawMap: {
val: primaryColor.color
}
},
children: getColorDetails(primaryColor)
},
{
name: "a:srgbClr",
properties: {
rawMap: {
val: secondaryColor.color
}
},
children: getColorDetails(secondaryColor)
}
]
};
};
var getBlipFill = (image, index) => {
let blipChildren;
if (image.transparency) {
const transparency = Math.min(Math.max(image.transparency, 0), 100);
blipChildren = [
{
name: "a:alphaModFix",
properties: {
rawMap: {
amt: 1e5 - Math.round(transparency * 1e3)
}
}
}
];
}
if (image.recolor) {
if (!blipChildren) {
blipChildren = [];
}
switch (image.recolor.toLocaleLowerCase()) {
case "grayscale":
blipChildren.push({ name: "a:grayscl" });
break;
case "sepia":
blipChildren.push(getDuoTone({ color: "black" }, { color: "D9C3A5", tint: 50, saturation: 180 }));
break;
case "washout":
blipChildren.push({
name: "a:lum",
properties: {
rawMap: {
bright: "70000",
contrast: "-70000"
}
}
});
break;
default:
}
}
return {
name: "xdr:blipFill",
children: [
{
name: "a:blip",
properties: {
rawMap: {
cstate: "print",
"r:embed": `rId${index}`,
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
}
},
children: blipChildren
},
{
name: "a:stretch",
children: [
{
name: "a:fillRect"
}
]
}
]
};
};
var getSpPr = (image, imageBoxSize) => {
const xfrm = {
name: "a:xfrm",
children: [
{
name: "a:off",
properties: {
rawMap: {
x: 0,
y: 0
}
}
},
{
name: "a:ext",
properties: {
rawMap: {
cx: imageBoxSize.width,
cy: imageBoxSize.height
}
}
}
]
};
if (image.rotation) {
const rotation = image.rotation;
xfrm.properties = {
rawMap: {
rot: Math.min(Math.max(rotation, 0), 360) * 6e4
}
};
}
const prstGeom = {
name: "a:prstGeom",
properties: {
rawMap: {
prst: "rect"
}
},
children: [{ name: "a:avLst" }]
};
const ret = {
name: "xdr:spPr",
children: [xfrm, prstGeom]
};
return ret;
};
var getImageBoxSize = (image) => {
image.fitCell = !!image.fitCell || !image.width || !image.height;
const { position = {}, fitCell, width = 0, height = 0, totalHeight, totalWidth } = image;
const { offsetX = 0, offsetY = 0, row = 1, rowSpan = 1, column = 1, colSpan = 1 } = position;
return {
from: {
row: row - 1,
col: column - 1,
offsetX: pixelsToEMU(offsetX),
offsetY: pixelsToEMU(offsetY)
},
to: {
row: row - 1 + (fitCell ? 1 : rowSpan - 1),
col: column - 1 + (fitCell ? 1 : colSpan - 1),
offsetX: pixelsToEMU(width + offsetX),
offsetY: pixelsToEMU(height + offsetY)
},
height: pixelsToEMU(totalHeight || height),
width: pixelsToEMU(totalWidth || width)
};
};
var getPicture = (image, currentIndex, worksheetImageIndex, imageBoxSize) => {
return {
name: "xdr:pic",
children: [
getNvPicPr(image, currentIndex + 1),
getBlipFill(image, worksheetImageIndex + 1),
getSpPr(image, imageBoxSize)
]
};
};
var drawingFactory = {
getTemplate(config) {
const { sheetIndex } = config;
const sheetImages = XLSX_WORKSHEET_IMAGES.get(sheetIndex);
const sheetImageIds = XLSX_WORKSHEET_IMAGE_IDS.get(sheetIndex);
const children = sheetImages.map((image, idx) => {
const boxSize = getImageBoxSize(image);
return {
name: "xdr:twoCellAnchor",
properties: {
rawMap: {
editAs: "absolute"
}
},
children: [
getAnchor("from", boxSize.from),
getAnchor("to", boxSize.to),
getPicture(image, idx, sheetImageIds.get(image.id).index, boxSize),
{ name: "xdr:clientData" }
]
};
});
return {
name: "xdr:wsDr",
properties: {
rawMap: {
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
"xmlns:xdr": "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
}
},
children
};
}
};
var drawing_default = drawingFactory;
// packages/ag-grid-enterprise/src/excelExport/files/ooxml/relationship.ts
var relationshipFactory = {
getTemplate(config) {
const { Id, Type, Target } = config;
return {
name: "Relationship",
properties: {
rawMap: {
Id,
Type,
Target
}
}
};
}
};
var relationship_default = relationshipFactory;
// packages/ag-grid-enterprise/src/excelExport/files/ooxml/relationships.ts
var relationshipsFactory = {
getTemplate(c) {
const children = c.map((relationship) => relationship_default.getTemplate(relationship));
return {
name: "Relationships",
properties: {
rawMap: {
xmlns: "http://schemas.openxmlformats.org/package/2006/relationships"
}
},
children
};
}
};
var relationships_default = relationshipsFactory;
// packages/ag-grid-enterprise/src/excelExport/files/ooxml/sharedStrings.ts
var sharedStrings = {
getTemplate(strings) {
return {
name: "sst",
properties: {
rawMap: {
xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
count: strings.size,
uniqueCount: strings.size
}
},
children: buildSharedString(strings)
};
}
};
var sharedStrings_default = sharedStrings;
// packages/ag-grid-enterprise/src/excelExport/assets/excelLegacyConvert.ts
var getWeightName = (value) => {
switch (value) {
case 1:
return "thin";
case 2:
return "medium";
case 3:
return "thick";
default:
return "hair";
}
};
var mappedBorderNames = {
None: "None",
Dot: "Dotted",
Dash: "Dashed",
Double: "Double",
DashDot: "DashDot",
DashDotDot: "DashDotDot",
SlantDashDot: "SlantDashDot",
Continuous: "Continuous"
};
var mediumBorders = ["Dashed", "DashDot", "DashDotDot"];
var colorMap = {
None: "none",
Solid: "solid",
Gray50: "mediumGray",
Gray75: "darkGray",
Gray25: "lightGray",
HorzStripe: "darkHorizontal",
VertStripe: "darkVertical",
ReverseDiagStripe: "darkDown",
DiagStripe: "darkUp",
DiagCross: "darkGrid",
ThickDiagCross: "darkTrellis",
ThinHorzStripe: "lightHorizontal",
ThinVertStripe: "lightVertical",
ThinReverseDiagStripe: "lightDown",