@freegridjs/core 1.1.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,29 @@
1
- var No={code:"en",noRows:"No rows to show",filter:"Filter",apply:"Apply",reset:"Reset",selectAll:"(Select all)",search:"Search\u2026",blanks:"(Blanks)",value:"Value",valueTo:"To",sortAsc:"Sort ascending",sortDesc:"Sort descending",clearSort:"Clear sort",pinLeft:"Pin left",pinRight:"Pin right",unpin:"Unpin",columnMenu:"Column menu",selectRow:"Select row",selectAllRows:"Select all rows",chooseColumns:"Choose columns",columns:"Columns",autosizeThis:"Autosize this column",autosizeAll:"Autosize all columns",resetColumns:"Reset columns",hideColumn:"Hide column",close:"Close",copy:"Copy",cut:"Cut",copyWithHeaders:"Copy with headers",paste:"Paste",pasteHint:"Clipboard access was blocked. Press Ctrl+V to paste.",required:"This field is required",invalidValue:"Invalid value",and:"And",or:"Or",advancedFilter:"Advanced filter",addCondition:"Add condition",duplicate:"This value is already used",undo:"Undo",redo:"Redo",deleteRows:"Delete selected rows",copyRows:"Copy selected rows",statusRows:"{n} rows",statusFiltered:"{shown} of {total} rows",statusSelected:"{n} selected",count:"Count",sum:"Sum",avg:"Average",min:"Min",max:"Max",findPlaceholder:"Find in grid",noMatches:"No matches",findNext:"Next match",findPrevious:"Previous match",groupPanelHint:"Drag a column header here to group rows",groupByThis:"Group by this column",ungroup:"Remove grouping",expandAll:"Expand all",collapseAll:"Collapse all",pagerRange:"{from}\u2013{to} of {total}",pageOf:"Page {page} of {pages}",pageSize:"Rows per page",firstPage:"First page",previousPage:"Previous page",nextPage:"Next page",lastPage:"Last page",loading:"Loading\u2026",loadFailed:"Could not load rows",filters:"Filters",clearFilters:"Clear all filters",exportCsv:"Export CSV",exportExcel:"Export Excel",print:"Print\u2026",pivot:"Pivot",pivotMode:"Pivot mode",pivotRows:"Row groups",pivotColumns:"Column labels",pivotValues:"Values",total:"Total",addColumn:"Add a column\u2026",chartBar:"Bar chart",chartStacked:"Stacked bar chart",chartLine:"Line chart",chartArea:"Area chart",chartPie:"Pie chart",chartDonut:"Donut chart",chartCombo:"Bar and line chart",chartScatter:"Scatter chart",freeBadge:"Free version",ops:{contains:"Contains",equals:"Equals",notEquals:"Does not equal",startsWith:"Starts with",endsWith:"Ends with",blank:"Blank",notBlank:"Not blank",eq:"Equals",ne:"Does not equal",lt:"Less than",lte:"Less than or equal",gt:"Greater than",gte:"Greater than or equal",between:"Between",before:"Before",after:"After"}},se=No;var gn=new Set;function O(i){gn.has(i)||(gn.add(i),console.warn(`[FreeGrid] ${i}`))}var we=new Map([["en",se]]);function Et(i){we.set(i.code,i)}function mn(i){let e=i.toLowerCase();for(let n of we.keys())if(n.toLowerCase()===e)return n;let t=e.split("-")[0];if(t==="zh"){if(/-(tw|hk|mo|hant)(-|$)/.test(e)&&we.has("zh-TW"))return"zh-TW";if(we.has("zh-CN"))return"zh-CN"}for(let n of we.keys())if(n.toLowerCase().split("-")[0]===t)return n}function Oo(){return typeof navigator>"u"?[]:navigator.languages?.length?navigator.languages:navigator.language?[navigator.language]:[]}function Ho(i){return{...se,...i,code:i.code??"en",ops:{...se.ops,...i.ops??{}}}}function Ve(i,e=Oo()){if(i&&typeof i=="object")return Ho(i);if(typeof i=="string"){let t=mn(i);return t?we.get(t):(O(`locale "${i}" is not registered \u2014 import it from "@freegridjs/core/locales/${i}" and pass the pack (or call registerLocale). Falling back to "en".`),se)}for(let t of e){let n=mn(t);if(n)return we.get(n)}return se}var Bo={code:"de",noRows:"Keine Zeilen vorhanden",filter:"Filter",apply:"Anwenden",reset:"Zur\xFCcksetzen",selectAll:"(Alle ausw\xE4hlen)",search:"Suchen\u2026",blanks:"(Leer)",value:"Wert",valueTo:"Bis",sortAsc:"Aufsteigend sortieren",sortDesc:"Absteigend sortieren",clearSort:"Sortierung aufheben",pinLeft:"Links fixieren",pinRight:"Rechts fixieren",unpin:"Fixierung l\xF6sen",columnMenu:"Spaltenmen\xFC",selectRow:"Zeile ausw\xE4hlen",selectAllRows:"Alle Zeilen ausw\xE4hlen",chooseColumns:"Spalten ausw\xE4hlen",columns:"Spalten",autosizeThis:"Diese Spalte automatisch anpassen",autosizeAll:"Alle Spalten automatisch anpassen",resetColumns:"Spalten zur\xFCcksetzen",hideColumn:"Spalte ausblenden",close:"Schlie\xDFen",copy:"Kopieren",cut:"Ausschneiden",copyWithHeaders:"Mit \xDCberschriften kopieren",paste:"Einf\xFCgen",pasteHint:"Der Browser hat die Zwischenablage blockiert. Dr\xFCcken Sie Ctrl+V zum Einf\xFCgen.",required:"Dieses Feld ist erforderlich",invalidValue:"Ung\xFCltiger Wert",and:"Und",or:"Oder",advancedFilter:"Erweiterter Filter",addCondition:"Bedingung hinzuf\xFCgen",duplicate:"Dieser Wert wird bereits verwendet",undo:"R\xFCckg\xE4ngig",redo:"Wiederholen",deleteRows:"Ausgew\xE4hlte Zeilen l\xF6schen",copyRows:"Ausgew\xE4hlte Zeilen kopieren",statusRows:"{n} Zeilen",statusFiltered:"{shown} von {total} Zeilen",statusSelected:"{n} ausgew\xE4hlt",count:"Anzahl",sum:"Summe",avg:"Mittelwert",min:"Min",max:"Max",findPlaceholder:"Im Raster suchen",noMatches:"Keine Treffer",findNext:"N\xE4chster Treffer",findPrevious:"Vorheriger Treffer",groupPanelHint:"Spalten\xFCberschrift hierher ziehen, um zu gruppieren",groupByThis:"Nach dieser Spalte gruppieren",ungroup:"Gruppierung aufheben",expandAll:"Alle aufklappen",collapseAll:"Alle zuklappen",pagerRange:"{from}\u2013{to} von {total}",pageOf:"Seite {page} von {pages}",pageSize:"Zeilen pro Seite",firstPage:"Erste Seite",previousPage:"Vorherige Seite",nextPage:"N\xE4chste Seite",lastPage:"Letzte Seite",loading:"Wird geladen\u2026",loadFailed:"Zeilen konnten nicht geladen werden",filters:"Filter",clearFilters:"Alle Filter entfernen",exportCsv:"Als CSV exportieren",exportExcel:"Nach Excel exportieren",print:"Drucken\u2026",pivot:"Pivot",pivotMode:"Pivot-Modus",pivotRows:"Zeilengruppen",pivotColumns:"Spaltenbeschriftungen",pivotValues:"Werte",total:"Gesamt",addColumn:"Spalte hinzuf\xFCgen\u2026",chartBar:"Balkendiagramm",chartStacked:"Gestapelte Balken",chartLine:"Liniendiagramm",chartArea:"Fl\xE4chendiagramm",chartPie:"Kreisdiagramm",chartDonut:"Ringdiagramm",chartCombo:"Balken- und Liniendiagramm",chartScatter:"Streudiagramm",freeBadge:"Kostenlose Version",ops:{contains:"Enth\xE4lt",equals:"Gleich",notEquals:"Ungleich",startsWith:"Beginnt mit",endsWith:"Endet mit",blank:"Leer",notBlank:"Nicht leer",eq:"Gleich",ne:"Ungleich",lt:"Kleiner als",lte:"Kleiner oder gleich",gt:"Gr\xF6\xDFer als",gte:"Gr\xF6\xDFer oder gleich",between:"Zwischen",before:"Vor",after:"Nach"}},wn=Bo;var Go={code:"es",noRows:"No hay filas para mostrar",filter:"Filtro",apply:"Aplicar",reset:"Restablecer",selectAll:"(Seleccionar todo)",search:"Buscar\u2026",blanks:"(Vac\xEDos)",value:"Valor",valueTo:"Hasta",sortAsc:"Orden ascendente",sortDesc:"Orden descendente",clearSort:"Quitar orden",pinLeft:"Fijar a la izquierda",pinRight:"Fijar a la derecha",unpin:"Desfijar",columnMenu:"Men\xFA de columna",selectRow:"Seleccionar fila",selectAllRows:"Seleccionar todas las filas",chooseColumns:"Elegir columnas",columns:"Columnas",autosizeThis:"Ajustar esta columna",autosizeAll:"Ajustar todas las columnas",resetColumns:"Restablecer columnas",hideColumn:"Ocultar columna",close:"Cerrar",copy:"Copiar",cut:"Cortar",copyWithHeaders:"Copiar con encabezados",paste:"Pegar",pasteHint:"El navegador bloque\xF3 el portapapeles. Pulsa Ctrl+V para pegar.",required:"Este campo es obligatorio",invalidValue:"Valor no v\xE1lido",and:"Y",or:"O",advancedFilter:"Filtro avanzado",addCondition:"A\xF1adir condici\xF3n",duplicate:"Este valor ya est\xE1 en uso",undo:"Deshacer",redo:"Rehacer",deleteRows:"Eliminar filas seleccionadas",copyRows:"Copiar filas seleccionadas",statusRows:"{n} filas",statusFiltered:"{shown} de {total} filas",statusSelected:"{n} seleccionadas",count:"Recuento",sum:"Suma",avg:"Promedio",min:"M\xEDn.",max:"M\xE1x.",findPlaceholder:"Buscar en la tabla",noMatches:"Sin coincidencias",findNext:"Siguiente",findPrevious:"Anterior",groupPanelHint:"Arrastre aqu\xED un encabezado de columna para agrupar",groupByThis:"Agrupar por esta columna",ungroup:"Quitar agrupaci\xF3n",expandAll:"Expandir todo",collapseAll:"Contraer todo",pagerRange:"{from}\u2013{to} de {total}",pageOf:"P\xE1gina {page} de {pages}",pageSize:"Filas por p\xE1gina",firstPage:"Primera p\xE1gina",previousPage:"P\xE1gina anterior",nextPage:"P\xE1gina siguiente",lastPage:"\xDAltima p\xE1gina",loading:"Cargando\u2026",loadFailed:"No se pudieron cargar las filas",filters:"Filtros",clearFilters:"Quitar todos los filtros",exportCsv:"Exportar CSV",exportExcel:"Exportar a Excel",print:"Imprimir\u2026",pivot:"Tabla din\xE1mica",pivotMode:"Modo tabla din\xE1mica",pivotRows:"Grupos de filas",pivotColumns:"Etiquetas de columna",pivotValues:"Valores",total:"Total",addColumn:"A\xF1adir columna\u2026",chartBar:"Gr\xE1fico de barras",chartStacked:"Barras apiladas",chartLine:"Gr\xE1fico de l\xEDneas",chartArea:"Gr\xE1fico de \xE1reas",chartPie:"Gr\xE1fico circular",chartDonut:"Gr\xE1fico de anillo",chartCombo:"Gr\xE1fico de barras y l\xEDneas",chartScatter:"Gr\xE1fico de dispersi\xF3n",freeBadge:"Versi\xF3n gratuita",ops:{contains:"Contiene",equals:"Igual a",notEquals:"Distinto de",startsWith:"Empieza por",endsWith:"Termina en",blank:"Vac\xEDo",notBlank:"No vac\xEDo",eq:"Igual a",ne:"Distinto de",lt:"Menor que",lte:"Menor o igual que",gt:"Mayor que",gte:"Mayor o igual que",between:"Entre",before:"Antes de",after:"Despu\xE9s de"}},vn=Go;var zo={code:"fr",noRows:"Aucune ligne \xE0 afficher",filter:"Filtre",apply:"Appliquer",reset:"R\xE9initialiser",selectAll:"(Tout s\xE9lectionner)",search:"Rechercher\u2026",blanks:"(Vides)",value:"Valeur",valueTo:"\xC0",sortAsc:"Tri croissant",sortDesc:"Tri d\xE9croissant",clearSort:"Annuler le tri",pinLeft:"\xC9pingler \xE0 gauche",pinRight:"\xC9pingler \xE0 droite",unpin:"D\xE9s\xE9pingler",columnMenu:"Menu de colonne",selectRow:"S\xE9lectionner la ligne",selectAllRows:"S\xE9lectionner toutes les lignes",chooseColumns:"Choisir les colonnes",columns:"Colonnes",autosizeThis:"Ajuster cette colonne",autosizeAll:"Ajuster toutes les colonnes",resetColumns:"R\xE9initialiser les colonnes",hideColumn:"Masquer la colonne",close:"Fermer",copy:"Copier",cut:"Couper",copyWithHeaders:"Copier avec les en-t\xEAtes",paste:"Coller",pasteHint:"Le navigateur a bloqu\xE9 le presse-papiers. Appuyez sur Ctrl+V pour coller.",required:"Ce champ est obligatoire",invalidValue:"Valeur non valide",and:"Et",or:"Ou",advancedFilter:"Filtre avanc\xE9",addCondition:"Ajouter une condition",duplicate:"Cette valeur est d\xE9j\xE0 utilis\xE9e",undo:"Annuler",redo:"R\xE9tablir",deleteRows:"Supprimer les lignes s\xE9lectionn\xE9es",copyRows:"Copier les lignes s\xE9lectionn\xE9es",statusRows:"{n} lignes",statusFiltered:"{shown} sur {total} lignes",statusSelected:"{n} s\xE9lectionn\xE9es",count:"Nombre",sum:"Somme",avg:"Moyenne",min:"Min",max:"Max",findPlaceholder:"Rechercher dans la grille",noMatches:"Aucun r\xE9sultat",findNext:"Suivant",findPrevious:"Pr\xE9c\xE9dent",groupPanelHint:"Faites glisser un en-t\xEAte de colonne ici pour regrouper",groupByThis:"Regrouper par cette colonne",ungroup:"Supprimer le regroupement",expandAll:"Tout d\xE9velopper",collapseAll:"Tout r\xE9duire",pagerRange:"{from}\u2013{to} sur {total}",pageOf:"Page {page} sur {pages}",pageSize:"Lignes par page",firstPage:"Premi\xE8re page",previousPage:"Page pr\xE9c\xE9dente",nextPage:"Page suivante",lastPage:"Derni\xE8re page",loading:"Chargement\u2026",loadFailed:"Impossible de charger les lignes",filters:"Filtres",clearFilters:"Effacer tous les filtres",exportCsv:"Exporter en CSV",exportExcel:"Exporter vers Excel",print:"Imprimer\u2026",pivot:"Tableau crois\xE9",pivotMode:"Mode tableau crois\xE9",pivotRows:"Groupes de lignes",pivotColumns:"\xC9tiquettes de colonnes",pivotValues:"Valeurs",total:"Total",addColumn:"Ajouter une colonne\u2026",chartBar:"Histogramme",chartStacked:"Histogramme empil\xE9",chartLine:"Courbes",chartArea:"Aires",chartPie:"Secteurs",chartDonut:"Graphique en anneau",chartCombo:"Graphique barres et lignes",chartScatter:"Nuage de points",freeBadge:"Version gratuite",ops:{contains:"Contient",equals:"\xC9gal \xE0",notEquals:"Diff\xE9rent de",startsWith:"Commence par",endsWith:"Se termine par",blank:"Vide",notBlank:"Non vide",eq:"\xC9gal \xE0",ne:"Diff\xE9rent de",lt:"Inf\xE9rieur \xE0",lte:"Inf\xE9rieur ou \xE9gal \xE0",gt:"Sup\xE9rieur \xE0",gte:"Sup\xE9rieur ou \xE9gal \xE0",between:"Entre",before:"Avant",after:"Apr\xE8s"}},yn=zo;var Vo={code:"ja",noRows:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",filter:"\u30D5\u30A3\u30EB\u30BF\u30FC",apply:"\u9069\u7528",reset:"\u30EA\u30BB\u30C3\u30C8",selectAll:"(\u3059\u3079\u3066\u9078\u629E)",search:"\u691C\u7D22\u2026",blanks:"(\u7A7A\u767D)",value:"\u5024",valueTo:"\u7D42\u4E86\u5024",sortAsc:"\u6607\u9806\u3067\u4E26\u3079\u66FF\u3048",sortDesc:"\u964D\u9806\u3067\u4E26\u3079\u66FF\u3048",clearSort:"\u4E26\u3079\u66FF\u3048\u3092\u89E3\u9664",pinLeft:"\u5DE6\u306B\u56FA\u5B9A",pinRight:"\u53F3\u306B\u56FA\u5B9A",unpin:"\u56FA\u5B9A\u3092\u89E3\u9664",columnMenu:"\u5217\u30E1\u30CB\u30E5\u30FC",selectRow:"\u884C\u3092\u9078\u629E",selectAllRows:"\u3059\u3079\u3066\u306E\u884C\u3092\u9078\u629E",chooseColumns:"\u5217\u3092\u9078\u629E",columns:"\u5217",autosizeThis:"\u3053\u306E\u5217\u306E\u5E45\u3092\u81EA\u52D5\u8ABF\u6574",autosizeAll:"\u3059\u3079\u3066\u306E\u5217\u306E\u5E45\u3092\u81EA\u52D5\u8ABF\u6574",resetColumns:"\u5217\u3092\u30EA\u30BB\u30C3\u30C8",hideColumn:"\u5217\u3092\u975E\u8868\u793A",close:"\u9589\u3058\u308B",copy:"\u30B3\u30D4\u30FC",cut:"\u5207\u308A\u53D6\u308A",copyWithHeaders:"\u30D8\u30C3\u30C0\u30FC\u4ED8\u304D\u3067\u30B3\u30D4\u30FC",paste:"\u8CBC\u308A\u4ED8\u3051",pasteHint:"\u30D6\u30E9\u30A6\u30B6\u30FC\u304C\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u3092\u30D6\u30ED\u30C3\u30AF\u3057\u307E\u3057\u305F\u3002Ctrl+V \u3067\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u3002",required:"\u3053\u306E\u9805\u76EE\u306F\u5FC5\u9808\u3067\u3059",invalidValue:"\u7121\u52B9\u306A\u5024\u3067\u3059",and:"\u304B\u3064",or:"\u307E\u305F\u306F",advancedFilter:"\u8A73\u7D30\u30D5\u30A3\u30EB\u30BF\u30FC",addCondition:"\u6761\u4EF6\u3092\u8FFD\u52A0",duplicate:"\u3053\u306E\u5024\u306F\u3059\u3067\u306B\u4F7F\u308F\u308C\u3066\u3044\u307E\u3059",undo:"\u5143\u306B\u623B\u3059",redo:"\u3084\u308A\u76F4\u3057",deleteRows:"\u9078\u629E\u3057\u305F\u884C\u3092\u524A\u9664",copyRows:"\u9078\u629E\u3057\u305F\u884C\u3092\u30B3\u30D4\u30FC",statusRows:"{n} \u884C",statusFiltered:"{total} \u884C\u4E2D {shown} \u884C",statusSelected:"{n} \u4EF6\u9078\u629E",count:"\u30C7\u30FC\u30BF\u306E\u500B\u6570",sum:"\u5408\u8A08",avg:"\u5E73\u5747",min:"\u6700\u5C0F",max:"\u6700\u5927",findPlaceholder:"\u30B0\u30EA\u30C3\u30C9\u5185\u3092\u691C\u7D22",noMatches:"\u4E00\u81F4\u306A\u3057",findNext:"\u6B21\u3092\u691C\u7D22",findPrevious:"\u524D\u3092\u691C\u7D22",groupPanelHint:"\u5217\u898B\u51FA\u3057\u3092\u3053\u3053\u306B\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30B0\u30EB\u30FC\u30D7\u5316",groupByThis:"\u3053\u306E\u5217\u3067\u30B0\u30EB\u30FC\u30D7\u5316",ungroup:"\u30B0\u30EB\u30FC\u30D7\u5316\u3092\u89E3\u9664",expandAll:"\u3059\u3079\u3066\u5C55\u958B",collapseAll:"\u3059\u3079\u3066\u6298\u308A\u305F\u305F\u3080",pagerRange:"{total} \u4EF6\u4E2D {from}\u2013{to} \u4EF6",pageOf:"{pages} \u30DA\u30FC\u30B8\u4E2D {page} \u30DA\u30FC\u30B8",pageSize:"1 \u30DA\u30FC\u30B8\u306E\u884C\u6570",firstPage:"\u6700\u521D\u306E\u30DA\u30FC\u30B8",previousPage:"\u524D\u306E\u30DA\u30FC\u30B8",nextPage:"\u6B21\u306E\u30DA\u30FC\u30B8",lastPage:"\u6700\u5F8C\u306E\u30DA\u30FC\u30B8",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026",loadFailed:"\u884C\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F",filters:"\u30D5\u30A3\u30EB\u30BF\u30FC",clearFilters:"\u3059\u3079\u3066\u306E\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u89E3\u9664",exportCsv:"CSV \u306B\u66F8\u304D\u51FA\u3059",exportExcel:"Excel \u306B\u66F8\u304D\u51FA\u3059",print:"\u5370\u5237\u2026",pivot:"\u30D4\u30DC\u30C3\u30C8",pivotMode:"\u30D4\u30DC\u30C3\u30C8\u30E2\u30FC\u30C9",pivotRows:"\u884C\u30B0\u30EB\u30FC\u30D7",pivotColumns:"\u5217\u30E9\u30D9\u30EB",pivotValues:"\u5024",total:"\u5408\u8A08",addColumn:"\u5217\u3092\u8FFD\u52A0\u2026",chartBar:"\u68D2\u30B0\u30E9\u30D5",chartStacked:"\u7A4D\u307F\u4E0A\u3052\u68D2\u30B0\u30E9\u30D5",chartLine:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",chartArea:"\u9762\u30B0\u30E9\u30D5",chartPie:"\u5186\u30B0\u30E9\u30D5",chartDonut:"\u30C9\u30FC\u30CA\u30C4\u30B0\u30E9\u30D5",chartCombo:"\u68D2\u30FB\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",chartScatter:"\u6563\u5E03\u56F3",freeBadge:"\u7121\u6599\u7248\u3092\u4F7F\u7528\u4E2D",ops:{contains:"\u542B\u3080",equals:"\u7B49\u3057\u3044",notEquals:"\u7B49\u3057\u304F\u306A\u3044",startsWith:"\u3067\u59CB\u307E\u308B",endsWith:"\u3067\u7D42\u308F\u308B",blank:"\u7A7A\u767D",notBlank:"\u7A7A\u767D\u4EE5\u5916",eq:"\u7B49\u3057\u3044",ne:"\u7B49\u3057\u304F\u306A\u3044",lt:"\u3088\u308A\u5C0F\u3055\u3044",lte:"\u4EE5\u4E0B",gt:"\u3088\u308A\u5927\u304D\u3044",gte:"\u4EE5\u4E0A",between:"\u7BC4\u56F2\u5185",before:"\u3088\u308A\u524D",after:"\u3088\u308A\u5F8C"}},bn=Vo;var qo={code:"ko",noRows:"\uD45C\uC2DC\uD560 \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",filter:"\uD544\uD130",apply:"\uC801\uC6A9",reset:"\uCD08\uAE30\uD654",selectAll:"(\uC804\uCCB4 \uC120\uD0DD)",search:"\uAC80\uC0C9\u2026",blanks:"(\uBE48 \uAC12)",value:"\uAC12",valueTo:"\uB05D \uAC12",sortAsc:"\uC624\uB984\uCC28\uC21C \uC815\uB82C",sortDesc:"\uB0B4\uB9BC\uCC28\uC21C \uC815\uB82C",clearSort:"\uC815\uB82C \uD574\uC81C",pinLeft:"\uC67C\uCABD \uACE0\uC815",pinRight:"\uC624\uB978\uCABD \uACE0\uC815",unpin:"\uACE0\uC815 \uD574\uC81C",columnMenu:"\uCEEC\uB7FC \uBA54\uB274",selectRow:"\uD589 \uC120\uD0DD",selectAllRows:"\uC804\uCCB4 \uD589 \uC120\uD0DD",chooseColumns:"\uCEEC\uB7FC \uC120\uD0DD",columns:"\uCEEC\uB7FC",autosizeThis:"\uC774 \uCEEC\uB7FC \uB108\uBE44 \uC790\uB3D9 \uB9DE\uCDA4",autosizeAll:"\uBAA8\uB4E0 \uCEEC\uB7FC \uB108\uBE44 \uC790\uB3D9 \uB9DE\uCDA4",resetColumns:"\uCEEC\uB7FC \uCD08\uAE30\uD654",hideColumn:"\uCEEC\uB7FC \uC228\uAE30\uAE30",close:"\uB2EB\uAE30",copy:"\uBCF5\uC0AC",cut:"\uC798\uB77C\uB0B4\uAE30",copyWithHeaders:"\uD5E4\uB354 \uD3EC\uD568 \uBCF5\uC0AC",paste:"\uBD99\uC5EC\uB123\uAE30",pasteHint:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uD074\uB9BD\uBCF4\uB4DC \uC811\uADFC\uC744 \uB9C9\uC558\uC2B5\uB2C8\uB2E4. Ctrl+V\uB85C \uBD99\uC5EC\uB123\uC73C\uC138\uC694.",required:"\uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4",invalidValue:"\uC62C\uBC14\uB978 \uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4",and:"\uADF8\uB9AC\uACE0",or:"\uB610\uB294",advancedFilter:"\uACE0\uAE09 \uD544\uD130",addCondition:"\uC870\uAC74 \uCD94\uAC00",duplicate:"\uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC778 \uAC12\uC785\uB2C8\uB2E4",undo:"\uC2E4\uD589 \uCDE8\uC18C",redo:"\uB2E4\uC2DC \uC2E4\uD589",deleteRows:"\uC120\uD0DD\uD55C \uD589 \uC0AD\uC81C",copyRows:"\uC120\uD0DD\uD55C \uD589 \uBCF5\uC0AC",statusRows:"{n}\uD589",statusFiltered:"{total}\uD589 \uC911 {shown}\uD589",statusSelected:"{n}\uAC1C \uC120\uD0DD",count:"\uAC1C\uC218",sum:"\uD569\uACC4",avg:"\uD3C9\uADE0",min:"\uCD5C\uC18C",max:"\uCD5C\uB300",findPlaceholder:"\uADF8\uB9AC\uB4DC\uC5D0\uC11C \uCC3E\uAE30",noMatches:"\uC77C\uCE58 \uD56D\uBAA9 \uC5C6\uC74C",findNext:"\uB2E4\uC74C \uCC3E\uAE30",findPrevious:"\uC774\uC804 \uCC3E\uAE30",groupPanelHint:"\uC5F4 \uBA38\uB9AC\uAE00\uC744 \uC5EC\uAE30\uB85C \uB04C\uC5B4\uC640 \uD589\uC744 \uBB36\uC73C\uC138\uC694",groupByThis:"\uC774 \uC5F4\uB85C \uBB36\uAE30",ungroup:"\uBB36\uAE30 \uD574\uC81C",expandAll:"\uBAA8\uB450 \uD3BC\uCE58\uAE30",collapseAll:"\uBAA8\uB450 \uC811\uAE30",pagerRange:"{total}\uAC1C \uC911 {from}\u2013{to}",pageOf:"{pages}\uCABD \uC911 {page}\uCABD",pageSize:"\uCABD\uB2F9 \uD589 \uC218",firstPage:"\uCCAB \uCABD",previousPage:"\uC774\uC804 \uCABD",nextPage:"\uB2E4\uC74C \uCABD",lastPage:"\uB9C8\uC9C0\uB9C9 \uCABD",loading:"\uBD88\uB7EC\uC624\uB294 \uC911\u2026",loadFailed:"\uD589\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",filters:"\uD544\uD130",clearFilters:"\uD544\uD130 \uBAA8\uB450 \uC9C0\uC6B0\uAE30",exportCsv:"CSV\uB85C \uB0B4\uBCF4\uB0B4\uAE30",exportExcel:"\uC5D1\uC140\uB85C \uB0B4\uBCF4\uB0B4\uAE30",print:"\uC778\uC1C4\u2026",pivot:"\uD53C\uBC97",pivotMode:"\uD53C\uBC97 \uBAA8\uB4DC",pivotRows:"\uD589 \uADF8\uB8F9",pivotColumns:"\uC5F4 \uB808\uC774\uBE14",pivotValues:"\uAC12",total:"\uD569\uACC4",addColumn:"\uCEEC\uB7FC \uCD94\uAC00\u2026",chartBar:"\uB9C9\uB300 \uCC28\uD2B8",chartStacked:"\uB204\uC801 \uB9C9\uB300 \uCC28\uD2B8",chartLine:"\uAEBE\uC740\uC120 \uCC28\uD2B8",chartArea:"\uC601\uC5ED \uCC28\uD2B8",chartPie:"\uC6D0\uD615 \uCC28\uD2B8",chartDonut:"\uB3C4\uB11B \uCC28\uD2B8",chartCombo:"\uB9C9\uB300\xB7\uAEBE\uC740\uC120 \uCC28\uD2B8",chartScatter:"\uBD84\uC0B0\uD615 \uCC28\uD2B8",freeBadge:"\uBB34\uB8CC \uC0AC\uC6A9 \uC911",ops:{contains:"\uD3EC\uD568",equals:"\uAC19\uC74C",notEquals:"\uAC19\uC9C0 \uC54A\uC74C",startsWith:"\uC2DC\uC791 \uBB38\uC790",endsWith:"\uB05D \uBB38\uC790",blank:"\uBE48 \uAC12",notBlank:"\uBE48 \uAC12 \uC544\uB2D8",eq:"\uAC19\uC74C",ne:"\uAC19\uC9C0 \uC54A\uC74C",lt:"\uBBF8\uB9CC",lte:"\uC774\uD558",gt:"\uCD08\uACFC",gte:"\uC774\uC0C1",between:"\uBC94\uC704",before:"\uC774\uC804",after:"\uC774\uD6C4"}},xn=qo;var Wo={code:"zh-CN",noRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u6570\u636E",filter:"\u7B5B\u9009",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",selectAll:"(\u5168\u9009)",search:"\u641C\u7D22\u2026",blanks:"(\u7A7A\u767D)",value:"\u503C",valueTo:"\u81F3",sortAsc:"\u5347\u5E8F\u6392\u5E8F",sortDesc:"\u964D\u5E8F\u6392\u5E8F",clearSort:"\u6E05\u9664\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5728\u5DE6\u4FA7",pinRight:"\u56FA\u5B9A\u5728\u53F3\u4FA7",unpin:"\u53D6\u6D88\u56FA\u5B9A",columnMenu:"\u5217\u83DC\u5355",selectRow:"\u9009\u62E9\u884C",selectAllRows:"\u9009\u62E9\u6240\u6709\u884C",chooseColumns:"\u9009\u62E9\u5217",columns:"\u5217",autosizeThis:"\u81EA\u52A8\u8C03\u6574\u6B64\u5217\u5BBD\u5EA6",autosizeAll:"\u81EA\u52A8\u8C03\u6574\u6240\u6709\u5217\u5BBD\u5EA6",resetColumns:"\u91CD\u7F6E\u5217",hideColumn:"\u9690\u85CF\u5217",close:"\u5173\u95ED",copy:"\u590D\u5236",cut:"\u526A\u5207",copyWithHeaders:"\u8FDE\u540C\u6807\u9898\u590D\u5236",paste:"\u7C98\u8D34",pasteHint:"\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u526A\u8D34\u677F\u8BBF\u95EE\u3002\u8BF7\u6309 Ctrl+V \u7C98\u8D34\u3002",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879",invalidValue:"\u503C\u65E0\u6548",and:"\u4E14",or:"\u6216",advancedFilter:"\u9AD8\u7EA7\u7B5B\u9009",addCondition:"\u6DFB\u52A0\u6761\u4EF6",duplicate:"\u8BE5\u503C\u5DF2\u88AB\u4F7F\u7528",undo:"\u64A4\u9500",redo:"\u91CD\u505A",deleteRows:"\u5220\u9664\u6240\u9009\u884C",copyRows:"\u590D\u5236\u6240\u9009\u884C",statusRows:"{n} \u884C",statusFiltered:"{total} \u884C\u4E2D\u7684 {shown} \u884C",statusSelected:"\u5DF2\u9009 {n} \u884C",count:"\u8BA1\u6570",sum:"\u6C42\u548C",avg:"\u5E73\u5747\u503C",min:"\u6700\u5C0F\u503C",max:"\u6700\u5927\u503C",findPlaceholder:"\u5728\u8868\u683C\u4E2D\u67E5\u627E",noMatches:"\u65E0\u5339\u914D\u9879",findNext:"\u4E0B\u4E00\u4E2A",findPrevious:"\u4E0A\u4E00\u4E2A",groupPanelHint:"\u5C06\u5217\u6807\u9898\u62D6\u5230\u6B64\u5904\u4EE5\u5206\u7EC4",groupByThis:"\u6309\u6B64\u5217\u5206\u7EC4",ungroup:"\u53D6\u6D88\u5206\u7EC4",expandAll:"\u5168\u90E8\u5C55\u5F00",collapseAll:"\u5168\u90E8\u6298\u53E0",pagerRange:"\u7B2C {from}\u2013{to} \u6761\uFF0C\u5171 {total} \u6761",pageOf:"\u7B2C {page} \u9875\uFF0C\u5171 {pages} \u9875",pageSize:"\u6BCF\u9875\u884C\u6570",firstPage:"\u9996\u9875",previousPage:"\u4E0A\u4E00\u9875",nextPage:"\u4E0B\u4E00\u9875",lastPage:"\u672B\u9875",loading:"\u52A0\u8F7D\u4E2D\u2026",loadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u6570\u636E",filters:"\u7B5B\u9009",clearFilters:"\u6E05\u9664\u6240\u6709\u7B5B\u9009",exportCsv:"\u5BFC\u51FA CSV",exportExcel:"\u5BFC\u51FA Excel",print:"\u6253\u5370\u2026",pivot:"\u6570\u636E\u900F\u89C6",pivotMode:"\u900F\u89C6\u6A21\u5F0F",pivotRows:"\u884C\u5206\u7EC4",pivotColumns:"\u5217\u6807\u7B7E",pivotValues:"\u503C",total:"\u603B\u8BA1",addColumn:"\u6DFB\u52A0\u5217\u2026",chartBar:"\u67F1\u72B6\u56FE",chartStacked:"\u5806\u79EF\u67F1\u72B6\u56FE",chartLine:"\u6298\u7EBF\u56FE",chartArea:"\u9762\u79EF\u56FE",chartPie:"\u997C\u56FE",chartDonut:"\u73AF\u5F62\u56FE",chartCombo:"\u67F1\u7EBF\u7EC4\u5408\u56FE",chartScatter:"\u6563\u70B9\u56FE",freeBadge:"\u514D\u8D39\u4F7F\u7528\u4E2D",ops:{contains:"\u5305\u542B",equals:"\u7B49\u4E8E",notEquals:"\u4E0D\u7B49\u4E8E",startsWith:"\u5F00\u5934\u662F",endsWith:"\u7ED3\u5C3E\u662F",blank:"\u4E3A\u7A7A",notBlank:"\u4E0D\u4E3A\u7A7A",eq:"\u7B49\u4E8E",ne:"\u4E0D\u7B49\u4E8E",lt:"\u5C0F\u4E8E",lte:"\u5C0F\u4E8E\u6216\u7B49\u4E8E",gt:"\u5927\u4E8E",gte:"\u5927\u4E8E\u6216\u7B49\u4E8E",between:"\u4ECB\u4E8E",before:"\u65E9\u4E8E",after:"\u665A\u4E8E"}},Cn=Wo;var Uo={code:"zh-TW",noRows:"\u6C92\u6709\u53EF\u986F\u793A\u7684\u8CC7\u6599",filter:"\u7BE9\u9078",apply:"\u5957\u7528",reset:"\u91CD\u8A2D",selectAll:"(\u5168\u9078)",search:"\u641C\u5C0B\u2026",blanks:"(\u7A7A\u767D)",value:"\u503C",valueTo:"\u81F3",sortAsc:"\u905E\u589E\u6392\u5E8F",sortDesc:"\u905E\u6E1B\u6392\u5E8F",clearSort:"\u6E05\u9664\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5728\u5DE6\u5074",pinRight:"\u56FA\u5B9A\u5728\u53F3\u5074",unpin:"\u53D6\u6D88\u56FA\u5B9A",columnMenu:"\u6B04\u4F4D\u9078\u55AE",selectRow:"\u9078\u53D6\u5217",selectAllRows:"\u9078\u53D6\u6240\u6709\u5217",chooseColumns:"\u9078\u64C7\u6B04\u4F4D",columns:"\u6B04\u4F4D",autosizeThis:"\u81EA\u52D5\u8ABF\u6574\u6B64\u6B04\u5BEC",autosizeAll:"\u81EA\u52D5\u8ABF\u6574\u6240\u6709\u6B04\u5BEC",resetColumns:"\u91CD\u8A2D\u6B04\u4F4D",hideColumn:"\u96B1\u85CF\u6B04\u4F4D",close:"\u95DC\u9589",copy:"\u8907\u88FD",cut:"\u526A\u4E0B",copyWithHeaders:"\u9023\u540C\u6A19\u984C\u8907\u88FD",paste:"\u8CBC\u4E0A",pasteHint:"\u7121\u6CD5\u5B58\u53D6\u526A\u8CBC\u7C3F\u3002\u8ACB\u6309 Ctrl+V \u8CBC\u4E0A\u3002",required:"\u6B64\u6B04\u4F4D\u70BA\u5FC5\u586B",invalidValue:"\u503C\u7121\u6548",and:"\u4E14",or:"\u6216",advancedFilter:"\u9032\u968E\u7BE9\u9078",addCondition:"\u65B0\u589E\u689D\u4EF6",duplicate:"\u6B64\u503C\u5DF2\u88AB\u4F7F\u7528",undo:"\u5FA9\u539F",redo:"\u91CD\u505A",deleteRows:"\u522A\u9664\u9078\u53D6\u7684\u5217",copyRows:"\u8907\u88FD\u9078\u53D6\u7684\u5217",statusRows:"{n} \u5217",statusFiltered:"{total} \u5217\u4E2D\u7684 {shown} \u5217",statusSelected:"\u5DF2\u9078\u53D6 {n} \u5217",count:"\u7B46\u6578",sum:"\u5408\u8A08",avg:"\u5E73\u5747",min:"\u6700\u5C0F",max:"\u6700\u5927",findPlaceholder:"\u5728\u8868\u683C\u4E2D\u5C0B\u627E",noMatches:"\u6C92\u6709\u7B26\u5408\u7684\u7D50\u679C",findNext:"\u4E0B\u4E00\u500B",findPrevious:"\u4E0A\u4E00\u500B",groupPanelHint:"\u5C07\u6B04\u4F4D\u6A19\u984C\u62D6\u66F3\u5230\u9019\u88E1\u4EE5\u5206\u7D44",groupByThis:"\u4F9D\u6B64\u6B04\u4F4D\u5206\u7D44",ungroup:"\u53D6\u6D88\u5206\u7D44",expandAll:"\u5168\u90E8\u5C55\u958B",collapseAll:"\u5168\u90E8\u647A\u758A",pagerRange:"{from}\u2013{to}\uFF0C\u5171 {total} \u7B46",pageOf:"\u7B2C {page} \u9801\uFF0C\u5171 {pages} \u9801",pageSize:"\u6BCF\u9801\u5217\u6578",firstPage:"\u7B2C\u4E00\u9801",previousPage:"\u4E0A\u4E00\u9801",nextPage:"\u4E0B\u4E00\u9801",lastPage:"\u6700\u5F8C\u4E00\u9801",loading:"\u8F09\u5165\u4E2D\u2026",loadFailed:"\u7121\u6CD5\u8F09\u5165\u8CC7\u6599",filters:"\u7BE9\u9078",clearFilters:"\u6E05\u9664\u6240\u6709\u7BE9\u9078",exportCsv:"\u532F\u51FA CSV",exportExcel:"\u532F\u51FA Excel",print:"\u5217\u5370\u2026",pivot:"\u6A1E\u7D10\u5206\u6790",pivotMode:"\u6A1E\u7D10\u5206\u6790\u6A21\u5F0F",pivotRows:"\u5217\u7FA4\u7D44",pivotColumns:"\u6B04\u6A19\u7C64",pivotValues:"\u503C",total:"\u7E3D\u8A08",addColumn:"\u65B0\u589E\u6B04\u4F4D\u2026",chartBar:"\u76F4\u689D\u5716",chartStacked:"\u5806\u758A\u76F4\u689D\u5716",chartLine:"\u6298\u7DDA\u5716",chartArea:"\u5340\u57DF\u5716",chartPie:"\u5713\u5F62\u5716",chartDonut:"\u74B0\u5708\u5716",chartCombo:"\u76F4\u689D\u8207\u6298\u7DDA\u5716",chartScatter:"\u6563\u4F48\u5716",freeBadge:"\u514D\u8CBB\u7248",ops:{contains:"\u5305\u542B",equals:"\u7B49\u65BC",notEquals:"\u4E0D\u7B49\u65BC",startsWith:"\u958B\u982D\u70BA",endsWith:"\u7D50\u5C3E\u70BA",blank:"\u7A7A\u767D",notBlank:"\u975E\u7A7A\u767D",eq:"\u7B49\u65BC",ne:"\u4E0D\u7B49\u65BC",lt:"\u5C0F\u65BC",lte:"\u5C0F\u65BC\u6216\u7B49\u65BC",gt:"\u5927\u65BC",gte:"\u5927\u65BC\u6216\u7B49\u65BC",between:"\u4ECB\u65BC",before:"\u65E9\u65BC",after:"\u665A\u65BC"}},Rn=Uo;var Ko={code:"vi",noRows:"Kh\xF4ng c\xF3 d\u1EEF li\u1EC7u",filter:"L\u1ECDc",apply:"\xC1p d\u1EE5ng",reset:"\u0110\u1EB7t l\u1EA1i",selectAll:"(Ch\u1ECDn t\u1EA5t c\u1EA3)",search:"T\xECm\u2026",blanks:"(Tr\u1ED1ng)",value:"Gi\xE1 tr\u1ECB",valueTo:"\u0110\u1EBFn",sortAsc:"S\u1EAFp x\u1EBFp t\u0103ng d\u1EA7n",sortDesc:"S\u1EAFp x\u1EBFp gi\u1EA3m d\u1EA7n",clearSort:"B\u1ECF s\u1EAFp x\u1EBFp",pinLeft:"Ghim tr\xE1i",pinRight:"Ghim ph\u1EA3i",unpin:"B\u1ECF ghim",columnMenu:"Menu c\u1ED9t",selectRow:"Ch\u1ECDn d\xF2ng",selectAllRows:"Ch\u1ECDn t\u1EA5t c\u1EA3 d\xF2ng",chooseColumns:"Ch\u1ECDn c\u1ED9t",columns:"C\u1ED9t",autosizeThis:"T\u1EF1 \u0111\u1ED9ng ch\u1EC9nh \u0111\u1ED9 r\u1ED9ng c\u1ED9t n\xE0y",autosizeAll:"T\u1EF1 \u0111\u1ED9ng ch\u1EC9nh \u0111\u1ED9 r\u1ED9ng t\u1EA5t c\u1EA3 c\u1ED9t",resetColumns:"\u0110\u1EB7t l\u1EA1i c\u1ED9t",hideColumn:"\u1EA8n c\u1ED9t",close:"\u0110\xF3ng",copy:"Sao ch\xE9p",cut:"C\u1EAFt",copyWithHeaders:"Sao ch\xE9p k\xE8m ti\xEAu \u0111\u1EC1",paste:"D\xE1n",pasteHint:"Kh\xF4ng truy c\u1EADp \u0111\u01B0\u1EE3c b\u1ED9 nh\u1EDB t\u1EA1m. Nh\u1EA5n Ctrl+V \u0111\u1EC3 d\xE1n.",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c",invalidValue:"Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7",and:"V\xE0",or:"Ho\u1EB7c",advancedFilter:"L\u1ECDc n\xE2ng cao",addCondition:"Th\xEAm \u0111i\u1EC1u ki\u1EC7n",duplicate:"Gi\xE1 tr\u1ECB n\xE0y \u0111\xE3 \u0111\u01B0\u1EE3c d\xF9ng",undo:"Ho\xE0n t\xE1c",redo:"L\xE0m l\u1EA1i",deleteRows:"X\xF3a c\xE1c d\xF2ng \u0111\xE3 ch\u1ECDn",copyRows:"Sao ch\xE9p c\xE1c d\xF2ng \u0111\xE3 ch\u1ECDn",statusRows:"{n} d\xF2ng",statusFiltered:"{shown} / {total} d\xF2ng",statusSelected:"\u0110\xE3 ch\u1ECDn {n}",count:"S\u1ED1 l\u01B0\u1EE3ng",sum:"T\u1ED5ng",avg:"Trung b\xECnh",min:"Nh\u1ECF nh\u1EA5t",max:"L\u1EDBn nh\u1EA5t",findPlaceholder:"T\xECm trong b\u1EA3ng",noMatches:"Kh\xF4ng t\xECm th\u1EA5y",findNext:"K\u1EBFt qu\u1EA3 ti\u1EBFp",findPrevious:"K\u1EBFt qu\u1EA3 tr\u01B0\u1EDBc",groupPanelHint:"K\xE9o ti\xEAu \u0111\u1EC1 c\u1ED9t v\xE0o \u0111\xE2y \u0111\u1EC3 nh\xF3m d\xF2ng",groupByThis:"Nh\xF3m theo c\u1ED9t n\xE0y",ungroup:"B\u1ECF nh\xF3m",expandAll:"M\u1EDF r\u1ED9ng t\u1EA5t c\u1EA3",collapseAll:"Thu g\u1ECDn t\u1EA5t c\u1EA3",pagerRange:"{from}\u2013{to} / {total}",pageOf:"Trang {page} / {pages}",pageSize:"S\u1ED1 d\xF2ng m\u1ED7i trang",firstPage:"Trang \u0111\u1EA7u",previousPage:"Trang tr\u01B0\u1EDBc",nextPage:"Trang sau",lastPage:"Trang cu\u1ED1i",loading:"\u0110ang t\u1EA3i\u2026",loadFailed:"Kh\xF4ng t\u1EA3i \u0111\u01B0\u1EE3c d\u1EEF li\u1EC7u",filters:"B\u1ED9 l\u1ECDc",clearFilters:"X\xF3a t\u1EA5t c\u1EA3 b\u1ED9 l\u1ECDc",exportCsv:"Xu\u1EA5t CSV",exportExcel:"Xu\u1EA5t Excel",print:"In\u2026",pivot:"Pivot",pivotMode:"Ch\u1EBF \u0111\u1ED9 pivot",pivotRows:"Nh\xF3m d\xF2ng",pivotColumns:"Nh\xE3n c\u1ED9t",pivotValues:"Gi\xE1 tr\u1ECB",total:"T\u1ED5ng c\u1ED9ng",addColumn:"Th\xEAm c\u1ED9t\u2026",chartBar:"Bi\u1EC3u \u0111\u1ED3 c\u1ED9t",chartStacked:"Bi\u1EC3u \u0111\u1ED3 c\u1ED9t ch\u1ED3ng",chartLine:"Bi\u1EC3u \u0111\u1ED3 \u0111\u01B0\u1EDDng",chartArea:"Bi\u1EC3u \u0111\u1ED3 v\xF9ng",chartPie:"Bi\u1EC3u \u0111\u1ED3 tr\xF2n",chartDonut:"Bi\u1EC3u \u0111\u1ED3 v\xE0nh khuy\xEAn",chartCombo:"Bi\u1EC3u \u0111\u1ED3 c\u1ED9t v\xE0 \u0111\u01B0\u1EDDng",chartScatter:"Bi\u1EC3u \u0111\u1ED3 ph\xE2n t\xE1n",freeBadge:"B\u1EA3n mi\u1EC5n ph\xED",ops:{contains:"Ch\u1EE9a",equals:"B\u1EB1ng",notEquals:"Kh\xE1c",startsWith:"B\u1EAFt \u0111\u1EA7u b\u1EB1ng",endsWith:"K\u1EBFt th\xFAc b\u1EB1ng",blank:"Tr\u1ED1ng",notBlank:"Kh\xF4ng tr\u1ED1ng",eq:"B\u1EB1ng",ne:"Kh\xE1c",lt:"Nh\u1ECF h\u01A1n",lte:"Nh\u1ECF h\u01A1n ho\u1EB7c b\u1EB1ng",gt:"L\u1EDBn h\u01A1n",gte:"L\u1EDBn h\u01A1n ho\u1EB7c b\u1EB1ng",between:"Trong kho\u1EA3ng",before:"Tr\u01B0\u1EDBc",after:"Sau"}},kn=Ko;var jo={code:"th",noRows:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",filter:"\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",apply:"\u0E43\u0E0A\u0E49",reset:"\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15",selectAll:"(\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14)",search:"\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",blanks:"(\u0E27\u0E48\u0E32\u0E07)",value:"\u0E04\u0E48\u0E32",valueTo:"\u0E16\u0E36\u0E07",sortAsc:"\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01",sortDesc:"\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22",clearSort:"\u0E25\u0E49\u0E32\u0E07\u0E01\u0E32\u0E23\u0E40\u0E23\u0E35\u0E22\u0E07",pinLeft:"\u0E15\u0E23\u0E36\u0E07\u0E0B\u0E49\u0E32\u0E22",pinRight:"\u0E15\u0E23\u0E36\u0E07\u0E02\u0E27\u0E32",unpin:"\u0E40\u0E25\u0E34\u0E01\u0E15\u0E23\u0E36\u0E07",columnMenu:"\u0E40\u0E21\u0E19\u0E39\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",selectRow:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E16\u0E27",selectAllRows:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",chooseColumns:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",columns:"\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",autosizeThis:"\u0E1B\u0E23\u0E31\u0E1A\u0E04\u0E27\u0E32\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E19\u0E35\u0E49\u0E2D\u0E31\u0E15\u0E42\u0E19\u0E21\u0E31\u0E15\u0E34",autosizeAll:"\u0E1B\u0E23\u0E31\u0E1A\u0E04\u0E27\u0E32\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07\u0E17\u0E38\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E2D\u0E31\u0E15\u0E42\u0E19\u0E21\u0E31\u0E15\u0E34",resetColumns:"\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",hideColumn:"\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",close:"\u0E1B\u0E34\u0E14",copy:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01",cut:"\u0E15\u0E31\u0E14",copyWithHeaders:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01\u0E1E\u0E23\u0E49\u0E2D\u0E21\u0E2B\u0E31\u0E27\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",paste:"\u0E27\u0E32\u0E07",pasteHint:"\u0E40\u0E02\u0E49\u0E32\u0E16\u0E36\u0E07\u0E04\u0E25\u0E34\u0E1B\u0E1A\u0E2D\u0E23\u0E4C\u0E14\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E01\u0E14 Ctrl+V \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E27\u0E32\u0E07",required:"\u0E15\u0E49\u0E2D\u0E07\u0E01\u0E23\u0E2D\u0E01\u0E0A\u0E48\u0E2D\u0E07\u0E19\u0E35\u0E49",invalidValue:"\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07",and:"\u0E41\u0E25\u0E30",or:"\u0E2B\u0E23\u0E37\u0E2D",advancedFilter:"\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E02\u0E31\u0E49\u0E19\u0E2A\u0E39\u0E07",addCondition:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E07\u0E37\u0E48\u0E2D\u0E19\u0E44\u0E02",duplicate:"\u0E04\u0E48\u0E32\u0E19\u0E35\u0E49\u0E16\u0E39\u0E01\u0E43\u0E0A\u0E49\u0E41\u0E25\u0E49\u0E27",undo:"\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33",redo:"\u0E17\u0E33\u0E0B\u0E49\u0E33",deleteRows:"\u0E25\u0E1A\u0E41\u0E16\u0E27\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01",copyRows:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01\u0E41\u0E16\u0E27\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01",statusRows:"{n} \u0E41\u0E16\u0E27",statusFiltered:"{shown} \u0E08\u0E32\u0E01 {total} \u0E41\u0E16\u0E27",statusSelected:"\u0E40\u0E25\u0E37\u0E2D\u0E01 {n} \u0E41\u0E16\u0E27",count:"\u0E08\u0E33\u0E19\u0E27\u0E19",sum:"\u0E1C\u0E25\u0E23\u0E27\u0E21",avg:"\u0E04\u0E48\u0E32\u0E40\u0E09\u0E25\u0E35\u0E48\u0E22",min:"\u0E15\u0E48\u0E33\u0E2A\u0E38\u0E14",max:"\u0E2A\u0E39\u0E07\u0E2A\u0E38\u0E14",findPlaceholder:"\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E43\u0E19\u0E15\u0E32\u0E23\u0E32\u0E07",noMatches:"\u0E44\u0E21\u0E48\u0E1E\u0E1A",findNext:"\u0E16\u0E31\u0E14\u0E44\u0E1B",findPrevious:"\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",groupPanelHint:"\u0E25\u0E32\u0E01\u0E2B\u0E31\u0E27\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E21\u0E32\u0E17\u0E35\u0E48\u0E19\u0E35\u0E48\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E08\u0E31\u0E14\u0E01\u0E25\u0E38\u0E48\u0E21",groupByThis:"\u0E08\u0E31\u0E14\u0E01\u0E25\u0E38\u0E48\u0E21\u0E15\u0E32\u0E21\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E19\u0E35\u0E49",ungroup:"\u0E40\u0E25\u0E34\u0E01\u0E08\u0E31\u0E14\u0E01\u0E25\u0E38\u0E48\u0E21",expandAll:"\u0E02\u0E22\u0E32\u0E22\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",collapseAll:"\u0E22\u0E38\u0E1A\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",pagerRange:"{from}\u2013{to} \u0E08\u0E32\u0E01 {total}",pageOf:"\u0E2B\u0E19\u0E49\u0E32 {page} \u0E08\u0E32\u0E01 {pages}",pageSize:"\u0E41\u0E16\u0E27\u0E15\u0E48\u0E2D\u0E2B\u0E19\u0E49\u0E32",firstPage:"\u0E2B\u0E19\u0E49\u0E32\u0E41\u0E23\u0E01",previousPage:"\u0E2B\u0E19\u0E49\u0E32\u0E01\u0E48\u0E2D\u0E19",nextPage:"\u0E2B\u0E19\u0E49\u0E32\u0E16\u0E31\u0E14\u0E44\u0E1B",lastPage:"\u0E2B\u0E19\u0E49\u0E32\u0E2A\u0E38\u0E14\u0E17\u0E49\u0E32\u0E22",loading:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u2026",loadFailed:"\u0E42\u0E2B\u0E25\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08",filters:"\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",clearFilters:"\u0E25\u0E49\u0E32\u0E07\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",exportCsv:"\u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01 CSV",exportExcel:"\u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01 Excel",print:"\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u2026",pivot:"Pivot",pivotMode:"\u0E42\u0E2B\u0E21\u0E14 Pivot",pivotRows:"\u0E01\u0E25\u0E38\u0E48\u0E21\u0E41\u0E16\u0E27",pivotColumns:"\u0E1B\u0E49\u0E32\u0E22\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",pivotValues:"\u0E04\u0E48\u0E32",total:"\u0E23\u0E27\u0E21",addColumn:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u2026",chartBar:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07",chartStacked:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07\u0E0B\u0E49\u0E2D\u0E19",chartLine:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E2A\u0E49\u0E19",chartArea:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E1E\u0E37\u0E49\u0E19\u0E17\u0E35\u0E48",chartPie:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E27\u0E07\u0E01\u0E25\u0E21",chartDonut:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E42\u0E14\u0E19\u0E31\u0E17",chartCombo:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07\u0E41\u0E25\u0E30\u0E40\u0E2A\u0E49\u0E19",chartScatter:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E01\u0E23\u0E30\u0E08\u0E32\u0E22",freeBadge:"\u0E23\u0E38\u0E48\u0E19\u0E1F\u0E23\u0E35",ops:{contains:"\u0E21\u0E35\u0E04\u0E33\u0E27\u0E48\u0E32",equals:"\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",notEquals:"\u0E44\u0E21\u0E48\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",startsWith:"\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22",endsWith:"\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22",blank:"\u0E27\u0E48\u0E32\u0E07",notBlank:"\u0E44\u0E21\u0E48\u0E27\u0E48\u0E32\u0E07",eq:"\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",ne:"\u0E44\u0E21\u0E48\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",lt:"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",lte:"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E2B\u0E23\u0E37\u0E2D\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",gt:"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",gte:"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32\u0E2B\u0E23\u0E37\u0E2D\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",between:"\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07",before:"\u0E01\u0E48\u0E2D\u0E19",after:"\u0E2B\u0E25\u0E31\u0E07"}},Sn=jo;var _o={code:"id",noRows:"Tidak ada data",filter:"Filter",apply:"Terapkan",reset:"Atur ulang",selectAll:"(Pilih semua)",search:"Cari\u2026",blanks:"(Kosong)",value:"Nilai",valueTo:"Sampai",sortAsc:"Urutkan naik",sortDesc:"Urutkan turun",clearSort:"Hapus urutan",pinLeft:"Sematkan kiri",pinRight:"Sematkan kanan",unpin:"Lepas sematan",columnMenu:"Menu kolom",selectRow:"Pilih baris",selectAllRows:"Pilih semua baris",chooseColumns:"Pilih kolom",columns:"Kolom",autosizeThis:"Sesuaikan lebar kolom ini",autosizeAll:"Sesuaikan lebar semua kolom",resetColumns:"Atur ulang kolom",hideColumn:"Sembunyikan kolom",close:"Tutup",copy:"Salin",cut:"Potong",copyWithHeaders:"Salin dengan judul",paste:"Tempel",pasteHint:"Akses papan klip diblokir. Tekan Ctrl+V untuk menempel.",required:"Kolom ini wajib diisi",invalidValue:"Nilai tidak valid",and:"Dan",or:"Atau",advancedFilter:"Filter lanjutan",addCondition:"Tambah kondisi",duplicate:"Nilai ini sudah dipakai",undo:"Urungkan",redo:"Ulangi",deleteRows:"Hapus baris terpilih",copyRows:"Salin baris terpilih",statusRows:"{n} baris",statusFiltered:"{shown} dari {total} baris",statusSelected:"{n} dipilih",count:"Jumlah data",sum:"Total",avg:"Rata-rata",min:"Min",max:"Maks",findPlaceholder:"Cari di tabel",noMatches:"Tidak ditemukan",findNext:"Berikutnya",findPrevious:"Sebelumnya",groupPanelHint:"Seret judul kolom ke sini untuk mengelompokkan",groupByThis:"Kelompokkan menurut kolom ini",ungroup:"Hapus pengelompokan",expandAll:"Buka semua",collapseAll:"Tutup semua",pagerRange:"{from}\u2013{to} dari {total}",pageOf:"Halaman {page} dari {pages}",pageSize:"Baris per halaman",firstPage:"Halaman pertama",previousPage:"Halaman sebelumnya",nextPage:"Halaman berikutnya",lastPage:"Halaman terakhir",loading:"Memuat\u2026",loadFailed:"Gagal memuat data",filters:"Filter",clearFilters:"Hapus semua filter",exportCsv:"Ekspor CSV",exportExcel:"Ekspor Excel",print:"Cetak\u2026",pivot:"Pivot",pivotMode:"Mode pivot",pivotRows:"Grup baris",pivotColumns:"Label kolom",pivotValues:"Nilai",total:"Total",addColumn:"Tambah kolom\u2026",chartBar:"Diagram batang",chartStacked:"Diagram batang bertumpuk",chartLine:"Diagram garis",chartArea:"Diagram area",chartPie:"Diagram lingkaran",chartDonut:"Diagram donat",chartCombo:"Diagram batang dan garis",chartScatter:"Diagram sebar",freeBadge:"Versi gratis",ops:{contains:"Berisi",equals:"Sama dengan",notEquals:"Tidak sama dengan",startsWith:"Diawali",endsWith:"Diakhiri",blank:"Kosong",notBlank:"Tidak kosong",eq:"Sama dengan",ne:"Tidak sama dengan",lt:"Kurang dari",lte:"Kurang dari atau sama dengan",gt:"Lebih dari",gte:"Lebih dari atau sama dengan",between:"Di antara",before:"Sebelum",after:"Sesudah"}},Mn=_o;var Xo={code:"ru",noRows:"\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445",filter:"\u0424\u0438\u043B\u044C\u0442\u0440",apply:"\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C",reset:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C",selectAll:"(\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435)",search:"\u041F\u043E\u0438\u0441\u043A\u2026",blanks:"(\u041F\u0443\u0441\u0442\u044B\u0435)",value:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435",valueTo:"\u041F\u043E",sortAsc:"\u041F\u043E \u0432\u043E\u0437\u0440\u0430\u0441\u0442\u0430\u043D\u0438\u044E",sortDesc:"\u041F\u043E \u0443\u0431\u044B\u0432\u0430\u043D\u0438\u044E",clearSort:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0443",pinLeft:"\u0417\u0430\u043A\u0440\u0435\u043F\u0438\u0442\u044C \u0441\u043B\u0435\u0432\u0430",pinRight:"\u0417\u0430\u043A\u0440\u0435\u043F\u0438\u0442\u044C \u0441\u043F\u0440\u0430\u0432\u0430",unpin:"\u041E\u0442\u043A\u0440\u0435\u043F\u0438\u0442\u044C",columnMenu:"\u041C\u0435\u043D\u044E \u0441\u0442\u043E\u043B\u0431\u0446\u0430",selectRow:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443",selectAllRows:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435 \u0441\u0442\u0440\u043E\u043A\u0438",chooseColumns:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0446\u044B",columns:"\u0421\u0442\u043E\u043B\u0431\u0446\u044B",autosizeThis:"\u041F\u043E\u0434\u043E\u0431\u0440\u0430\u0442\u044C \u0448\u0438\u0440\u0438\u043D\u0443 \u0441\u0442\u043E\u043B\u0431\u0446\u0430",autosizeAll:"\u041F\u043E\u0434\u043E\u0431\u0440\u0430\u0442\u044C \u0448\u0438\u0440\u0438\u043D\u0443 \u0432\u0441\u0435\u0445 \u0441\u0442\u043E\u043B\u0431\u0446\u043E\u0432",resetColumns:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0446\u044B",hideColumn:"\u0421\u043A\u0440\u044B\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",copy:"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",cut:"\u0412\u044B\u0440\u0435\u0437\u0430\u0442\u044C",copyWithHeaders:"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430\u043C\u0438",paste:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C",pasteHint:"\u0414\u043E\u0441\u0442\u0443\u043F \u043A \u0431\u0443\u0444\u0435\u0440\u0443 \u043E\u0431\u043C\u0435\u043D\u0430 \u0437\u0430\u043F\u0440\u0435\u0449\u0451\u043D. \u041D\u0430\u0436\u043C\u0438\u0442\u0435 Ctrl+V, \u0447\u0442\u043E\u0431\u044B \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C.",required:"\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435",invalidValue:"\u041D\u0435\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435",and:"\u0418",or:"\u0418\u043B\u0438",advancedFilter:"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0439 \u0444\u0438\u043B\u044C\u0442\u0440",addCondition:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0443\u0441\u043B\u043E\u0432\u0438\u0435",duplicate:"\u042D\u0442\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0443\u0436\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F",undo:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",redo:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",deleteRows:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0441\u0442\u0440\u043E\u043A\u0438",copyRows:"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0441\u0442\u0440\u043E\u043A\u0438",statusRows:"\u0421\u0442\u0440\u043E\u043A: {n}",statusFiltered:"{shown} \u0438\u0437 {total} \u0441\u0442\u0440\u043E\u043A",statusSelected:"\u0412\u044B\u0431\u0440\u0430\u043D\u043E: {n}",count:"\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E",sum:"\u0421\u0443\u043C\u043C\u0430",avg:"\u0421\u0440\u0435\u0434\u043D\u0435\u0435",min:"\u041C\u0438\u043D.",max:"\u041C\u0430\u043A\u0441.",findPlaceholder:"\u041D\u0430\u0439\u0442\u0438 \u0432 \u0442\u0430\u0431\u043B\u0438\u0446\u0435",noMatches:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",findNext:"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0435",findPrevious:"\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0435",groupPanelHint:"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044E\u0434\u0430 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0441\u0442\u043E\u043B\u0431\u0446\u0430 \u0434\u043B\u044F \u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u043A\u0438",groupByThis:"\u0413\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E \u044D\u0442\u043E\u043C\u0443 \u0441\u0442\u043E\u043B\u0431\u0446\u0443",ungroup:"\u0423\u0431\u0440\u0430\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u043A\u0443",expandAll:"\u0420\u0430\u0437\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u0441\u0435",collapseAll:"\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u0441\u0435",pagerRange:"{from}\u2013{to} \u0438\u0437 {total}",pageOf:"\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 {page} \u0438\u0437 {pages}",pageSize:"\u0421\u0442\u0440\u043E\u043A \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435",firstPage:"\u041F\u0435\u0440\u0432\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",previousPage:"\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",nextPage:"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",lastPage:"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",loading:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",loadFailed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435",filters:"\u0424\u0438\u043B\u044C\u0442\u0440\u044B",clearFilters:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B",exportCsv:"\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 CSV",exportExcel:"\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 Excel",print:"\u041F\u0435\u0447\u0430\u0442\u044C\u2026",pivot:"\u0421\u0432\u043E\u0434\u043D\u0430\u044F",pivotMode:"\u0420\u0435\u0436\u0438\u043C \u0441\u0432\u043E\u0434\u043D\u043E\u0439 \u0442\u0430\u0431\u043B\u0438\u0446\u044B",pivotRows:"\u0413\u0440\u0443\u043F\u043F\u044B \u0441\u0442\u0440\u043E\u043A",pivotColumns:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 \u0441\u0442\u043E\u043B\u0431\u0446\u043E\u0432",pivotValues:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u044F",total:"\u0418\u0442\u043E\u0433\u043E",addColumn:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446\u2026",chartBar:"\u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u0430",chartStacked:"\u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u0430 \u0441 \u043D\u0430\u043A\u043E\u043F\u043B\u0435\u043D\u0438\u0435\u043C",chartLine:"\u0413\u0440\u0430\u0444\u0438\u043A",chartArea:"\u0414\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430 \u0441 \u043E\u0431\u043B\u0430\u0441\u0442\u044F\u043C\u0438",chartPie:"\u041A\u0440\u0443\u0433\u043E\u0432\u0430\u044F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430",chartDonut:"\u041A\u043E\u043B\u044C\u0446\u0435\u0432\u0430\u044F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430",chartCombo:"\u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u0430 \u0438 \u0433\u0440\u0430\u0444\u0438\u043A",chartScatter:"\u0422\u043E\u0447\u0435\u0447\u043D\u0430\u044F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430",freeBadge:"\u0411\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F",ops:{contains:"\u0421\u043E\u0434\u0435\u0440\u0436\u0438\u0442",equals:"\u0420\u0430\u0432\u043D\u043E",notEquals:"\u041D\u0435 \u0440\u0430\u0432\u043D\u043E",startsWith:"\u041D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441",endsWith:"\u0417\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u043D\u0430",blank:"\u041F\u0443\u0441\u0442\u043E",notBlank:"\u041D\u0435 \u043F\u0443\u0441\u0442\u043E",eq:"\u0420\u0430\u0432\u043D\u043E",ne:"\u041D\u0435 \u0440\u0430\u0432\u043D\u043E",lt:"\u041C\u0435\u043D\u044C\u0448\u0435",lte:"\u041C\u0435\u043D\u044C\u0448\u0435 \u0438\u043B\u0438 \u0440\u0430\u0432\u043D\u043E",gt:"\u0411\u043E\u043B\u044C\u0448\u0435",gte:"\u0411\u043E\u043B\u044C\u0448\u0435 \u0438\u043B\u0438 \u0440\u0430\u0432\u043D\u043E",between:"\u041C\u0435\u0436\u0434\u0443",before:"\u0414\u043E",after:"\u041F\u043E\u0441\u043B\u0435"}},En=Xo;var Yo={code:"pt-BR",noRows:"Nenhuma linha para mostrar",filter:"Filtro",apply:"Aplicar",reset:"Limpar",selectAll:"(Selecionar tudo)",search:"Pesquisar\u2026",blanks:"(Vazios)",value:"Valor",valueTo:"At\xE9",sortAsc:"Ordenar crescente",sortDesc:"Ordenar decrescente",clearSort:"Remover ordena\xE7\xE3o",pinLeft:"Fixar \xE0 esquerda",pinRight:"Fixar \xE0 direita",unpin:"Desafixar",columnMenu:"Menu da coluna",selectRow:"Selecionar linha",selectAllRows:"Selecionar todas as linhas",chooseColumns:"Escolher colunas",columns:"Colunas",autosizeThis:"Ajustar largura desta coluna",autosizeAll:"Ajustar largura de todas as colunas",resetColumns:"Redefinir colunas",hideColumn:"Ocultar coluna",close:"Fechar",copy:"Copiar",cut:"Recortar",copyWithHeaders:"Copiar com cabe\xE7alhos",paste:"Colar",pasteHint:"O acesso \xE0 \xE1rea de transfer\xEAncia foi bloqueado. Pressione Ctrl+V para colar.",required:"Campo obrigat\xF3rio",invalidValue:"Valor inv\xE1lido",and:"E",or:"Ou",advancedFilter:"Filtro avan\xE7ado",addCondition:"Adicionar condi\xE7\xE3o",duplicate:"Este valor j\xE1 est\xE1 em uso",undo:"Desfazer",redo:"Refazer",deleteRows:"Excluir linhas selecionadas",copyRows:"Copiar linhas selecionadas",statusRows:"{n} linhas",statusFiltered:"{shown} de {total} linhas",statusSelected:"{n} selecionadas",count:"Contagem",sum:"Soma",avg:"M\xE9dia",min:"M\xEDn.",max:"M\xE1x.",findPlaceholder:"Localizar na tabela",noMatches:"Nenhum resultado",findNext:"Pr\xF3ximo",findPrevious:"Anterior",groupPanelHint:"Arraste um cabe\xE7alho de coluna aqui para agrupar",groupByThis:"Agrupar por esta coluna",ungroup:"Remover agrupamento",expandAll:"Expandir tudo",collapseAll:"Recolher tudo",pagerRange:"{from}\u2013{to} de {total}",pageOf:"P\xE1gina {page} de {pages}",pageSize:"Linhas por p\xE1gina",firstPage:"Primeira p\xE1gina",previousPage:"P\xE1gina anterior",nextPage:"Pr\xF3xima p\xE1gina",lastPage:"\xDAltima p\xE1gina",loading:"Carregando\u2026",loadFailed:"N\xE3o foi poss\xEDvel carregar as linhas",filters:"Filtros",clearFilters:"Limpar todos os filtros",exportCsv:"Exportar CSV",exportExcel:"Exportar Excel",print:"Imprimir\u2026",pivot:"Piv\xF4",pivotMode:"Modo piv\xF4",pivotRows:"Grupos de linhas",pivotColumns:"R\xF3tulos de coluna",pivotValues:"Valores",total:"Total",addColumn:"Adicionar coluna\u2026",chartBar:"Gr\xE1fico de barras",chartStacked:"Gr\xE1fico de barras empilhadas",chartLine:"Gr\xE1fico de linhas",chartArea:"Gr\xE1fico de \xE1rea",chartPie:"Gr\xE1fico de pizza",chartDonut:"Gr\xE1fico de rosca",chartCombo:"Gr\xE1fico de barras e linhas",chartScatter:"Gr\xE1fico de dispers\xE3o",freeBadge:"Vers\xE3o gratuita",ops:{contains:"Cont\xE9m",equals:"Igual a",notEquals:"Diferente de",startsWith:"Come\xE7a com",endsWith:"Termina com",blank:"Vazio",notBlank:"N\xE3o vazio",eq:"Igual a",ne:"Diferente de",lt:"Menor que",lte:"Menor ou igual a",gt:"Maior que",gte:"Maior ou igual a",between:"Entre",before:"Antes de",after:"Depois de"}},Ln=Yo;var Jo={code:"it",noRows:"Nessuna riga da mostrare",filter:"Filtro",apply:"Applica",reset:"Reimposta",selectAll:"(Seleziona tutto)",search:"Cerca\u2026",blanks:"(Vuoti)",value:"Valore",valueTo:"A",sortAsc:"Ordine crescente",sortDesc:"Ordine decrescente",clearSort:"Rimuovi ordinamento",pinLeft:"Blocca a sinistra",pinRight:"Blocca a destra",unpin:"Sblocca",columnMenu:"Menu colonna",selectRow:"Seleziona riga",selectAllRows:"Seleziona tutte le righe",chooseColumns:"Scegli colonne",columns:"Colonne",autosizeThis:"Adatta larghezza di questa colonna",autosizeAll:"Adatta larghezza di tutte le colonne",resetColumns:"Ripristina colonne",hideColumn:"Nascondi colonna",close:"Chiudi",copy:"Copia",cut:"Taglia",copyWithHeaders:"Copia con intestazioni",paste:"Incolla",pasteHint:"Accesso agli appunti bloccato. Premi Ctrl+V per incollare.",required:"Campo obbligatorio",invalidValue:"Valore non valido",and:"E",or:"O",advancedFilter:"Filtro avanzato",addCondition:"Aggiungi condizione",duplicate:"Questo valore \xE8 gi\xE0 in uso",undo:"Annulla",redo:"Ripeti",deleteRows:"Elimina righe selezionate",copyRows:"Copia righe selezionate",statusRows:"{n} righe",statusFiltered:"{shown} di {total} righe",statusSelected:"{n} selezionate",count:"Conteggio",sum:"Somma",avg:"Media",min:"Min",max:"Max",findPlaceholder:"Trova nella tabella",noMatches:"Nessun risultato",findNext:"Successivo",findPrevious:"Precedente",groupPanelHint:"Trascina qui un'intestazione di colonna per raggruppare",groupByThis:"Raggruppa per questa colonna",ungroup:"Rimuovi raggruppamento",expandAll:"Espandi tutto",collapseAll:"Comprimi tutto",pagerRange:"{from}\u2013{to} di {total}",pageOf:"Pagina {page} di {pages}",pageSize:"Righe per pagina",firstPage:"Prima pagina",previousPage:"Pagina precedente",nextPage:"Pagina successiva",lastPage:"Ultima pagina",loading:"Caricamento\u2026",loadFailed:"Impossibile caricare le righe",filters:"Filtri",clearFilters:"Rimuovi tutti i filtri",exportCsv:"Esporta CSV",exportExcel:"Esporta Excel",print:"Stampa\u2026",pivot:"Pivot",pivotMode:"Modalit\xE0 pivot",pivotRows:"Gruppi di righe",pivotColumns:"Etichette di colonna",pivotValues:"Valori",total:"Totale",addColumn:"Aggiungi colonna\u2026",chartBar:"Grafico a barre",chartStacked:"Grafico a barre in pila",chartLine:"Grafico a linee",chartArea:"Grafico ad area",chartPie:"Grafico a torta",chartDonut:"Grafico ad anello",chartCombo:"Grafico a barre e linee",chartScatter:"Grafico a dispersione",freeBadge:"Versione gratuita",ops:{contains:"Contiene",equals:"Uguale a",notEquals:"Diverso da",startsWith:"Inizia con",endsWith:"Finisce con",blank:"Vuoto",notBlank:"Non vuoto",eq:"Uguale a",ne:"Diverso da",lt:"Minore di",lte:"Minore o uguale a",gt:"Maggiore di",gte:"Maggiore o uguale a",between:"Tra",before:"Prima di",after:"Dopo"}},Tn=Jo;var te="__fg_select__",In={id:te,header:"",width:44,minWidth:44,maxWidth:44,pinned:"left",sortable:!1,resizable:!1,filter:!1},ve="__fg_drag__",Dn={id:ve,header:"",width:28,minWidth:28,maxWidth:28,pinned:"left",sortable:!1,resizable:!1,filter:!1,chooser:!1},fe="__fg_rownum__",$n=(i=52,e="#")=>({id:fe,header:e,width:i,minWidth:i,maxWidth:i,pinned:"left",sortable:!1,resizable:!1,filter:!1,chooser:!1}),D=i=>i===te||i===ve||i===fe,Zo=120,Qo=40,er=["left","center","right"];function oe(i){if(D(i.id)||i.filter===!1)return null;if(i.filter)return i.filter;switch(i.type){case"number":return"number";case"date":return"date";case"boolean":return"set";default:return"text"}}function ae(i,e,t){let n=i.editable;if(typeof n!="function")return!!n;try{return!!n({value:i.valueGetter?i.valueGetter(e):i.field?e[i.field]:void 0,row:e,rowIndex:t,column:i})}catch{return!1}}var ye=i=>i.id!==te&&i.sortable!==!1,Ue=i=>i.id!==te&&i.resizable!==!1;function qe(i,e){let t=i.minWidth??Qo,n=i.maxWidth??1/0;return Math.round(Math.min(n,Math.max(t,e)))}function An(i){return i.children?1+Math.max(0,...i.children.map(An)):1}var We=class{constructor(e){this.depth=1;this.roots_=[];this.defs=[];this.byId=new Map;this.containerWidth=0;this.layout={left:[],center:[],right:[]};this.leafById=new Map;this.setDefs(e)}setDefs(e){this.defs=e,this.byId=new Map;let t=0,n=(r,s,a)=>{let l=Array.isArray(r.children)&&r.children.length>0,d=t++,c=r.id??(l?`g${d}`:r.field);if(c||(c=`c${d}`,O(`column #${d} has neither "field" nor "id"; using "${c}"`)),this.byId.has(c)){let g=1;for(;this.byId.has(`${c}_${g}`);)g++;O(`duplicate column id "${c}"; renamed to "${c}_${g}"`),c=`${c}_${g}`}let u={id:c,def:r,parent:s,children:null,depth:a,width:qe(r,r.width??Zo),flex:r.flex&&r.flex>0?r.flex:null,hide:r.hide??!1,pinned:r.pinned??s?.pinned??null,open:!!r.openByDefault};return this.byId.set(c,u),l&&(u.children=o(r.children).map(g=>n(g,u,a+1))),u},o=r=>{let s=r.filter(a=>a!==null&&typeof a=="object");return s.length!==r.length&&O("columns contain entries that are not objects; they were skipped"),s};this.roots_=o(e).map(r=>n(r,null,0)),this.depth=Math.max(1,...this.roots_.map(An)),this.relayout()}setContainerWidth(e){if(e===this.containerWidth)return!1;this.containerWidth=e;let t=this.displayed().map(n=>n.width).join();return this.relayout(),t!==this.displayed().map(n=>n.width).join()}roots(){return this.roots_}reset(){this.setDefs(this.defs)}region(e){return this.layout[e]}displayed(){return[...this.layout.left,...this.layout.center,...this.layout.right]}regionWidth(e){let t=this.layout[e],n=t[t.length-1];return n?n.left+n.width:0}getColumn(e){return this.leafById.get(e)}getNode(e){return this.byId.get(e)}siblings(e){let t=this.byId.get(e);return t?t.parent?t.parent.children:this.roots_:[]}setWidth(e,t){let n=this.byId.get(e);return!n||n.children?0:(n.flex=null,n.width=qe(n.def,t),this.relayout(),n.width)}setPinned(e,t){let n=this.byId.get(e);!n||n.children||D(e)||(n.pinned=t,this.relayout())}setHide(e,t){let n=this.byId.get(e);!n||n.children||(n.hide=t,this.relayout())}move(e,t){let n=this.siblings(e),o=n.findIndex(s=>s.id===e);if(o<0)return;let[r]=n.splice(o,1);n.splice(Math.max(0,Math.min(n.length,t)),0,r),this.relayout()}headerCells(e){let t=[],n=new Map;for(let o of this.layout[e]){let r=[];for(let s=o.node.parent;s;s=s.parent)r.unshift(s);for(let s of r){let a=n.get(s.id);if(a){a.width+=o.width;continue}let l={id:s.id,label:s.def.header??"",isGroup:!0,column:null,node:s,row:s.depth,rowSpan:1,left:o.left,width:o.width};n.set(s.id,l),t.push(l)}t.push({id:o.id,label:o.def.header??o.def.field??"",isGroup:!1,column:o,node:o.node,row:o.node.depth,rowSpan:this.depth-o.node.depth,left:o.left,width:o.width})}return t}getState(){return this.leafNodes().filter(e=>!D(e.id)).map(e=>({colId:e.id,width:this.leafById.get(e.id)?.width??e.width,hide:!!e.hide,pinned:e.pinned??null}))}applyState(e){let t=new Map;e.forEach((r,s)=>{t.set(r.colId,s);let a=this.byId.get(r.colId);!a||a.children||D(r.colId)||(typeof r.width=="number"&&Number.isFinite(r.width)&&(a.flex=null,a.width=qe(a.def,r.width)),typeof r.hide=="boolean"&&(a.hide=r.hide),"pinned"in r&&(a.pinned=r.pinned==="left"||r.pinned==="right"?r.pinned:null))}),t.set(fe,-3),t.set(ve,-2),t.set(te,-1);let n=r=>r.children?Math.min(1/0,...r.children.map(n)):t.get(r.id)??1/0,o=r=>{let s=r.map((a,l)=>({n:a,i:l,r:n(a)}));s.sort((a,l)=>a.r===l.r?a.i-l.i:a.r-l.r),r.splice(0,r.length,...s.map(a=>a.n));for(let a of r)a.children&&o(a.children)};o(this.roots_),this.relayout()}leafNodes(){let e=[],t=n=>n.children?n.children.forEach(t):e.push(n);return this.roots_.forEach(t),e}isCollapsible(e){return!!e.children?.some(t=>t.def.columnGroupShow==="open"||t.def.columnGroupShow==="closed")}setGroupOpen(e,t){let n=this.byId.get(e);return!n?.children||n.open===t?!1:(n.open=t,this.relayout(),!0)}groupOpenState(){let e={};for(let t of this.byId.values())this.isCollapsible(t)&&(e[t.id]=t.open);return e}shownByGroups(e){for(let t=e;t?.parent;t=t.parent){let n=t.def.columnGroupShow;if(n==="open"&&!t.parent.open||n==="closed"&&t.parent.open)return!1}return!0}relayout(){let e=this.leafNodes().filter(l=>!l.hide&&this.shownByGroups(l)),t=e.reduce((l,d)=>l+(d.flex?0:d.width),0),n=e.reduce((l,d)=>l+(d.flex??0),0),o=Math.max(0,this.containerWidth-t),r=l=>l.flex?qe(l.def,Math.floor(o*l.flex/n)):l.width,s={left:[],center:[],right:[]};this.leafById=new Map;let a=0;for(let l of er){let d=0;for(let c of e){if((c.pinned??"center")!==l)continue;let u={id:c.id,def:c.def,node:c,width:r(c),region:l,left:d,index:a++};d+=u.width,s[l].push(u),this.leafById.set(c.id,u)}}this.layout=s}};var X=class extends Error{constructor(t){super(t);this.code=t}};function tr(i){let e=[],t=0;for(;t<i.length;){let n=i[t];if(/\s/.test(n))t++;else if(/[0-9.]/.test(n)){let o=/^(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?/i.exec(i.slice(t));if(!o)throw new X("#ERROR!");e.push({t:"num",v:Number(o[0])}),t+=o[0].length}else if(n==='"'){let o="";for(t++;;){if(t>=i.length)throw new X("#ERROR!");if(i[t]==='"'){if(i[t+1]==='"'){o+='"',t+=2;continue}t++;break}o+=i[t++]}e.push({t:"str",v:o})}else if(n==="["){let o=i.indexOf("]",t);if(o<0)throw new X("#ERROR!");e.push({t:"id",v:i.slice(t+1,o)}),t=o+1}else if(/[A-Za-z_À-￿]/.test(n)){let o=/^[A-Za-z_À-￿][\wÀ-￿]*/.exec(i.slice(t));e.push({t:"id",v:o[0]}),t+=o[0].length}else{let o=i.slice(t,t+2);if(o==="<>"||o==="<="||o===">=")e.push({t:"op",v:o}),t+=2;else if("+-*/%^&=<>(),".includes(n))e.push({t:"op",v:n}),t++;else throw new X("#ERROR!")}}return e}var Ke=i=>i==null||i==="";function _(i){if(typeof i=="number")return i;if(typeof i=="boolean")return i?1:0;if(Ke(i))return 0;if(typeof i=="string"&&i.trim()!==""&&Number.isFinite(Number(i)))return Number(i);throw new X("#VALUE!")}var je=i=>Ke(i)?"":typeof i=="boolean"?i?"TRUE":"FALSE":String(i);function nr(i,e){let t=Math.trunc(e),n=+`${Math.round(+`${Math.abs(i)}e${t}`)}e${-t}`;return i<0?-n:n}var Pn={ROUND:i=>nr(_(i[0]),i.length>1?_(i[1]):0),ABS:i=>Math.abs(_(i[0])),MIN:i=>i.length?Math.min(...i.map(_)):0,MAX:i=>i.length?Math.max(...i.map(_)):0,SUM:i=>i.reduce((e,t)=>e+_(t),0),AVG:i=>{if(!i.length)throw new X("#DIV/0!");return i.reduce((e,t)=>e+_(t),0)/i.length}};function or(i,e){return(typeof i=="number"||Ke(i))&&(typeof e=="number"||Ke(e))?_(i)-_(e):je(i).localeCompare(je(e),void 0,{sensitivity:"accent"})}var Lt=class{constructor(e,t){this.tokens=e;this.resolve=t;this.i=0}parse(){let e=this.comparison();if(this.i<this.tokens.length)throw new X("#ERROR!");return e}peek(e){let t=this.tokens[this.i];return!!t&&t.t==="op"&&(e===void 0||t.v===e)}take(e){return this.peek(e)?(this.i++,!0):!1}comparison(){let e=this.concat();for(let t of["=","<>","<=",">=","<",">"])if(this.take(t)){let n=or(e,this.concat());return t==="="?n===0:t==="<>"?n!==0:t==="<"?n<0:t===">"?n>0:t==="<="?n<=0:n>=0}return e}concat(){let e=this.additive();for(;this.take("&");)e=je(e)+je(this.additive());return e}additive(){let e=this.multiplicative();for(;;)if(this.take("+"))e=_(e)+_(this.multiplicative());else if(this.take("-"))e=_(e)-_(this.multiplicative());else return e}multiplicative(){let e=this.unary();for(;;)if(this.take("*"))e=_(e)*_(this.unary());else if(this.take("/")||this.take("%")){let t=this.tokens[this.i-1].v,n=_(this.unary());if(n===0)throw new X("#DIV/0!");e=t==="/"?_(e)/n:_(e)%n}else return e}unary(){return this.take("-")?-_(this.unary()):this.take("+")?_(this.unary()):this.power()}power(){let e=this.primary();return this.take("^")?_(e)**_(this.unary()):e}primary(){let e=this.tokens[this.i++];if(!e)throw new X("#ERROR!");if(e.t==="num"||e.t==="str")return e.v;if(e.t==="op"){if(e.v!=="(")throw new X("#ERROR!");let n=this.comparison();if(!this.take(")"))throw new X("#ERROR!");return n}let t=e.v;if(this.peek("(")){this.i++;let n=[];if(!this.take(")")){do n.push(this.comparison());while(this.take(","));if(!this.take(")"))throw new X("#ERROR!")}let o=t.toUpperCase();if(o==="IF"){if(n.length<2)throw new X("#ERROR!");return(typeof n[0]=="boolean"?n[0]:_(n[0])!==0)?n[1]:n.length>2?n[2]:!1}let r=Object.hasOwn(Pn,o)?Pn[o]:void 0;if(!r)throw new X("#NAME?");return r(n)}return/^(true|false)$/i.test(t)?t.toLowerCase()==="true":this.resolve(t)}},rr=32;function Tt(i,e,t=new Set,n=0,o=new Map){try{let r=a=>{if(!e||!Object.hasOwn(e,a))throw new X("#REF!");let l=e[a];if(typeof l=="string"&&l.startsWith("=")){if(t.has(a)||n>=rr)throw new X("#CYCLE!");let d;if(o.has(a)?d=o.get(a):(d=Tt(l,e,new Set([...t,a]),n+1,o),o.set(a,d)),typeof d=="string"&&/^#[A-Z/0]+[!?]$/.test(d))throw new X(d);return d}return l},s=new Lt(tr(i.slice(1)),r).parse();return typeof s=="number"&&!Number.isFinite(s)?"#NUM!":s}catch(r){return r instanceof X?r.code:"#ERROR!"}}var Ce=i=>typeof i=="string"&&i.length>1&&i.startsWith("=");function B(i,e){if(i.valueGetter)try{return i.valueGetter(e)}catch{O(`valueGetter of column "${i.id??i.field}" threw; rendering an empty cell`);return}if(i.field==null)return;let t=e[i.field];return i.formulas&&Ce(t)?Tt(t,e,new Set([i.field])):t}var Ie=["left","center","right"],Fn=[[">=","gte"],["<=","lte"],["<>","ne"],["!=","ne"],[">","gt"],["<","lt"],["=","eq"]],Nn=[[">","after"],["<","before"],["=","equals"]],ir=/^(.+?)\s*(?:~|\.\.)\s*(.+)$/,It=i=>{let e=Number(i.replace(/[,\s₩$€¥]/g,""));return i.trim()!==""&&Number.isFinite(e)?e:null},Dt=i=>{let e=/^(\d{4})[-./]\s*(\d{1,2})[-./]\s*(\d{1,2})\.?$/.exec(i.trim());if(!e)return null;let t=Number(e[1]),n=Number(e[2]),o=Number(e[3]);return n<1||n>12||o<1||o>new Date(Date.UTC(t,n,0)).getUTCDate()?null:`${e[1]}-${e[2].padStart(2,"0")}-${e[3].padStart(2,"0")}`};function sr(i,e){let t=e.trim();if(!t)return null;if(i==="text")return{type:"text",op:"contains",value:t};let n=ir.exec(t);if(i==="number"){if(n){let l=It(n[1]),d=It(n[2]);return l===null||d===null?void 0:{type:"number",op:"between",value:Math.min(l,d),valueTo:Math.max(l,d)}}let s=Fn.find(([l])=>t.startsWith(l)),a=It(s?t.slice(s[0].length):t);return a===null?void 0:{type:"number",op:s?s[1]:"eq",value:a}}if(n){let s=Dt(n[1]),a=Dt(n[2]);return!s||!a?void 0:{type:"date",op:"between",value:s<a?s:a,valueTo:s<a?a:s}}let o=Nn.find(([s])=>t.startsWith(s)),r=Dt(o?t.slice(o[0].length):t);return r?{type:"date",op:o?o[1]:"equals",value:r}:void 0}function ar(i){if(!i)return"";if(i.type==="text")return i.op==="contains"?i.value??"":"";if(i.type==="number"){if(i.op==="between")return`${i.value}~${i.valueTo}`;let e=Fn.find(([,t])=>t===i.op)?.[0];return e&&i.value!==void 0?`${e==="="?"":e}${i.value}`:""}if(i.type==="date"){if(i.op==="between")return`${i.value}~${i.valueTo}`;let e=Nn.find(([,t])=>t===i.op)?.[0];return e&&i.value?`${e==="="?"":e}${i.value}`:""}return""}var _e=class{constructor(e,t){this.grid=e;this.layout="";this.timers=new Map;this.data=null;this.synced=null;this.rebuilt=!1;this.inners={};for(let n of Ie)this.inners[n]=x("div","fg-filter-row",{role:"row"}),t[n].append(this.inners[n])}get height(){return Math.round(this.grid.renderer.opts.rowHeight*.95)}render(){let{columns:e,store:t}=this.grid,n=this.height,o=e.displayed(),r=`${n}|${t.state.locale.code}|${o.map(s=>`${s.id}:${s.left}:${s.width}:${s.region}`).join(",")}`;if(r!==this.layout){this.layout=r;for(let s of Ie){let a=this.inners[s];a.style.width=`${e.regionWidth(s)}px`,a.style.height=`${n}px`,a.replaceChildren(...e.region(s).map(l=>this.cell(l,n)))}this.data=t.state.data,this.rebuilt=!0}else t.state.data!==this.data&&(this.data=t.state.data,this.refreshLists());this.sync()}sync(){let e=this.grid.store.state.filters;if(!(e===this.synced&&!this.rebuilt)){this.synced=e,this.rebuilt=!1;for(let t of Ie)for(let n of this.inners[t].querySelectorAll("[data-col]")){let o=n.dataset.col,r=e[o];if(n.closest(".fg-filter-cell").classList.toggle("fg-filter-active",!!r),!(n===n.ownerDocument.activeElement||n.getRootNode().activeElement===n)){if(n instanceof HTMLSelectElement){let s=r?.type==="set"&&r.values.length===1?JSON.stringify(r.values[0]):"";[...n.options].some(a=>a.value===s)&&(n.value=s)}else n.value=ar(r);n.classList.remove("fg-filter-bad")}}}}refreshLists(){for(let e of Ie)for(let t of this.inners[e].querySelectorAll("select[data-col]")){let n=this.grid.columns.getNode(t.dataset.col)?.def;if(!n)continue;let o=t.value;if(this.fillOptions(t,n),o&&![...t.options].some(r=>r.value===o)){let r=x("option","",{value:o});r.textContent=String(JSON.parse(o)),t.append(r)}t.value=o}}fillOptions(e,t){let n=x("option","",{value:""});n.textContent=this.grid.store.state.locale.selectAll;let o=this.distinct(t).map(r=>{let s=x("option","",{value:JSON.stringify(r)});return s.textContent=r===!0?"\u2713":r===!1?"\u2717":String(r),s});e.replaceChildren(n,...o)}cell(e,t){let n=x("div","fg-filter-cell");n.style.left=`${e.left}px`,n.style.width=`${e.width}px`,n.style.height=`${t}px`;let o=D(e.id)?null:oe(e.def);if(!o)return n;let s=`${this.grid.store.state.locale.filter}: ${e.def.header??e.def.field??e.id}`;if(o==="set"){let d=x("select","fg-filter-input",{"aria-label":s});return d.dataset.col=e.id,this.fillOptions(d,e.def),d.addEventListener("change",()=>{this.grid.setFilter(e.id,d.value?{type:"set",values:[JSON.parse(d.value)]}:null)}),n.append(d),n}let a=x("input","fg-filter-input",{type:"text","aria-label":s,spellcheck:"false",autocomplete:"off"});a.dataset.col=e.id,o==="number"&&(a.placeholder=">0, 10~20"),o==="date"&&(a.placeholder=">2026-01-01");let l=()=>{let d=sr(o,a.value);a.classList.toggle("fg-filter-bad",d===void 0),d!==void 0&&this.grid.setFilter(e.id,d)};return a.addEventListener("input",()=>{clearTimeout(this.timers.get(e.id)),this.timers.set(e.id,window.setTimeout(l,200))}),a.addEventListener("keydown",d=>{d.stopPropagation(),d.key==="Enter"?(clearTimeout(this.timers.get(e.id)),l()):d.key==="Escape"&&(a.value="",clearTimeout(this.timers.get(e.id)),l())}),n.append(a),n}distinct(e){let t=new Map;for(let n of this.grid.store.state.data){let o=B(e,n);if(o==null||o==="")continue;let r=JSON.stringify(o);if(t.has(r)||t.set(r,o),t.size>=200)break}return[...t.values()].sort((n,o)=>String(n).localeCompare(String(o)))}setTransform(e){this.inners.center.style.transform=`translateX(${-e}px)`}destroy(){for(let e of this.timers.values())clearTimeout(e);for(let e of Ie)this.inners[e].remove()}};function q(i){return i==null||typeof i=="string"&&i.trim()===""||typeof i=="number"&&Number.isNaN(i)}var On=i=>String(i).padStart(2,"0");function Q(i){if(q(i))return null;if(typeof i=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(i))return i;let e=i instanceof Date?i:new Date(i);return Number.isNaN(e.getTime())?null:`${e.getFullYear()}-${On(e.getMonth()+1)}-${On(e.getDate())}`}function Z(i){return q(i)?"":i instanceof Date?Q(i)??"":String(i)}var le=()=>!0;function Xe(i){switch(i.type){case"combined":{let e=(Array.isArray(i.conditions)?i.conditions:[]).map(Xe);return e.length?i.operator==="or"?t=>e.some(n=>n(t)):t=>e.every(n=>n(t)):le}case"text":{let e=(i.value??"").toLowerCase(),t=n=>q(n)?"":String(n).toLowerCase();switch(i.op){case"contains":return n=>t(n).includes(e);case"equals":return n=>t(n)===e;case"notEquals":return n=>t(n)!==e;case"startsWith":return n=>t(n).startsWith(e);case"endsWith":return n=>t(n).endsWith(e);case"blank":return q;case"notBlank":return n=>!q(n)}return le}case"number":{let e=n=>q(n)?NaN:Number(n);if(i.op==="blank")return n=>Number.isNaN(e(n));if(i.op==="notBlank")return n=>!Number.isNaN(e(n));let t=i.value;if(t==null||Number.isNaN(t))return le;switch(i.op){case"eq":return n=>e(n)===t;case"ne":return n=>e(n)!==t;case"lt":return n=>e(n)<t;case"lte":return n=>e(n)<=t;case"gt":return n=>e(n)>t;case"gte":return n=>e(n)>=t;case"between":{let n=i.valueTo;if(n==null||Number.isNaN(n))return le;let o=Math.min(t,n),r=Math.max(t,n);return s=>{let a=e(s);return a>=o&&a<=r}}}return le}case"date":{if(i.op==="blank")return n=>Q(n)===null;if(i.op==="notBlank")return n=>Q(n)!==null;let e=i.value;if(!e)return le;let t=n=>Q(n);switch(i.op){case"equals":return n=>t(n)===e;case"before":return n=>{let o=t(n);return o!==null&&o<e};case"after":return n=>{let o=t(n);return o!==null&&o>e};case"between":{let n=i.valueTo;if(!n)return le;let o=e<n?e:n,r=e<n?n:e;return s=>{let a=t(s);return a!==null&&a>=o&&a<=r}}}return le}case"set":{let e=new Set(i.values.map(Z));return t=>e.has(Z(t))}}return le}function Hn(i){let e=i.trim().toLowerCase();return e?e.split(/\s+/):[]}function Bn(i,e){return i.every(t=>e.includes(t))}function $t(i,e,t){let n=[];for(let o of Array.isArray(i?.conditions)?i.conditions:[]){if(!o||typeof o!="object")continue;if("conditions"in o){let a=$t(o,e,t);a&&n.push(a);continue}let r=e(o.colId);if(!r||!o.model)continue;let s=Xe(o.model);n.push(a=>s(t(r,a)))}return n.length?i.operator==="or"?o=>n.some(r=>r(o)):o=>n.every(r=>r(o)):null}var Gn=new Map;function lr(i){if(i==="integer")return{maximumFractionDigits:0};if(i==="percent")return{style:"percent"};if(i.startsWith("currency:"))return{style:"currency",currency:i.slice(9)};if(!/^[#0,]*(\.[#0]+)?%?$/.test(i)||!/[#0]/.test(i))return null;let e=i.endsWith("%"),t=e?i.slice(0,-1):i,n=t.includes(".")?t.split(".")[1]:"";return{useGrouping:t.includes(","),minimumFractionDigits:(n.match(/0/g)??[]).length,maximumFractionDigits:n.length,...e?{style:"percent"}:{}}}var Ye={date:{year:"numeric",month:"2-digit",day:"2-digit"},datetime:{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"},time:{hour:"2-digit",minute:"2-digit"},short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"}};function ie(i){if(q(i))return null;if(i instanceof Date)return Number.isNaN(i.getTime())?null:i;if(typeof i=="string"){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(i);if(t)return new Date(Number(t[1]),Number(t[2])-1,Number(t[3]))}if(typeof i!="string"&&typeof i!="number")return null;let e=new Date(i);return Number.isNaN(e.getTime())?null:e}function dr(i,e,t){switch(i){case"number":{let n={};if(typeof e=="string"){let r=lr(e);r||O(`unknown number format "${e}"`),n=r??{}}else e&&(n=e);let o=new Intl.NumberFormat(t,n);return r=>{if(q(r))return"";let s=typeof r=="number"?r:Number(r);return Number.isNaN(s)?String(r):o.format(s)}}case"date":{if(t.toLowerCase().startsWith("ko")&&(e===void 0||e==="date"||e==="datetime")){let r=a=>String(a).padStart(2,"0"),s=e==="datetime";return a=>{let l=ie(a);if(!l)return q(a)?"":String(a);let d=`${l.getFullYear()}-${r(l.getMonth()+1)}-${r(l.getDate())}`;return s?`${d} ${r(l.getHours())}:${r(l.getMinutes())}`:d}}let n=Ye.date;typeof e=="string"?(Ye[e]||O(`unknown date format "${e}"`),n=Ye[e]??Ye.date):e&&(n=e);let o=new Intl.DateTimeFormat(t,n);return r=>{let s=ie(r);return s?o.format(s):q(r)?"":String(r)}}case"boolean":return n=>n===!0?"\u2713":n===!1?"\u2717":"";default:return n=>q(n)?"":n instanceof Date?n.toISOString():String(n)}}function K(i,e){if(i.sparkline)return r=>Array.isArray(r)?r.join(", "):r==null?"":String(r);let t=i.format,n=`${e}|${i.type??"text"}|${typeof t=="string"?t:JSON.stringify(t??null)}`,o=Gn.get(n);return o||(o=dr(i.type,t,e),Gn.set(n,o)),o}function At(i){let e=[];for(let t of i){if(q(t)||t instanceof Date)continue;let n=typeof t=="number"?t:Number(t);Number.isNaN(n)||e.push(n)}return e}function zn(i,e){let t=i.filter(o=>o instanceof Date&&!Number.isNaN(o.getTime()));if(t.length)return t.reduce((o,r)=>(e?r>o:r<o)?r:o);let n=At(i);return n.length?e?Math.max(...n):Math.min(...n):null}function pe(i,e,t){if(typeof i=="function")return i(e,t);switch(i){case"sum":return At(e).reduce((n,o)=>n+o,0);case"avg":{let n=At(e);return n.length?n.reduce((o,r)=>o+r,0)/n.length:null}case"min":return zn(e,!1);case"max":return zn(e,!0);case"count":return t.length}return null}function De(i){return typeof i=="object"&&i!==null&&"agg"in i?i:{agg:i}}function Vn(i,e,t){let n=new Map,o=(r,s)=>{let a=n.get(r);return a||n.set(r,a=e.map(l=>B(s,l))),a};return i.map(r=>{let s={};for(let[a,l]of Object.entries(r.columns??{})){let d=t(a);d&&(s[a]=pe(De(l).agg,o(a,d),e))}return s})}function $e(i,e,t,n,o){if(!i)return 1;let r=1;try{r=Math.floor(Number(i({value:B(e,t),row:t,rowIndex:n})))}catch{r=1}return Number.isFinite(r)?Math.max(1,Math.min(o,r)):1}function Je(i,e){let t=i.length,n=new Int32Array(t),o=new Int32Array(t);if(e.rowSpan){for(let a=0;a<t;){let l=$e(e.rowSpan,e,i[a],a,t-a);for(let d=a;d<a+l;d++)n[d]=a,o[d]=a+l-1;a+=l}return{start:n,end:o}}let r=typeof e.merge=="function"?(a,l)=>{try{return!!e.merge(B(e,i[a]),B(e,i[l]),i[a],i[l])}catch{return!1}}:(()=>{let a=i.map(l=>{let d=B(e,l);return q(d)?null:Z(d)});return(l,d)=>a[l]!==null&&a[l]===a[d]})(),s=0;for(let a=1;a<=t;a++)if(!(a<t&&r(a-1,a))){for(let l=s;l<a;l++)n[l]=s,o[l]=a-1;s=a}return{start:n,end:o}}function qn(i,e,t,n,o=4){if(n<=0||t<=0)return{first:0,last:-1};let r=Math.max(0,Math.floor(i/t)-o),s=Math.floor((i+e)/t);return{first:Math.min(r,n-1),last:Math.min(n-1,s+o)}}function Ze(i,e,t,n,o=2){let r=i.length;if(!r)return{first:0,last:-1};let s=0,a=r-1;for(;s<a;){let c=s+a>>1;i[c]+e[c]<=t?s=c+1:a=c}let l=s,d=t+n;for(a=r-1;s<a;){let c=s+a+1>>1;i[c]<d?s=c:a=c-1}return{first:Math.max(0,l-o),last:Math.min(r-1,Math.max(l,s)+o)}}function Wn(i,e,t,n,o=4){if(n<=0)return{first:0,last:-1};let r=0,s=n-1;for(;r<s;){let d=r+s>>1;i[d+1]<=e?r=d+1:s=d}let a=r,l=e+t;for(s=n-1;r<s;){let d=r+s+1>>1;i[d]<l?r=d:s=d-1}return{first:Math.max(0,a-o),last:Math.min(n-1,r+o)}}var ee=["left","center","right"],Un=6,cr=8,Pt=2,ur='<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M3 4h10M3 8h10M3 12h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>',Ft='<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M6 3.5 10.5 8 6 12.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>';var hr='<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M2.5 3h11l-4.2 5v4.5l-2.6 1.2V8z" fill="currentColor"/></svg>';function x(i,e="",t={}){let n=document.createElement(i);e&&(n.className=e);for(let[o,r]of Object.entries(t))n.setAttribute(o,r);return n}var Qe=class{constructor(e,t,n){this.grid=t;this.opts=n;this.filterRow=null;this.activeCellId="";this.idBase=`fg${Math.random().toString(36).slice(2,8)}`;this.painted={left:new Map,center:new Map,right:new Map};this.pool={left:[],center:[],right:[]};this.frame=0;this.headerDirty=!0;this.version=0;this.lastRange={first:0,last:-1};this.summaryEl=null;this.summaryPanes=null;this.summaryInners=null;this.canvasSummary={left:[],center:[],right:[]};this.topOffset=0;this.pinnedTop=null;this.pinnedBottom=null;this.statusEl=null;this.statusKey="";this.pagerEl=null;this.cards=null;this.cardMode=!1;this.pagerKey="";this.offsets=null;this.details=new Map;this.firstDataId="";this.rowHeights=new Map;this.heightsVersion=0;this.groupLabelId="";this.onScroll=()=>{this.frame&&cancelAnimationFrame(this.frame),this.frame=0,this.render(),this.grid.events.emit("scroll",this.getScroll())};this.onSideWheel=e=>{e.deltaY&&(e.preventDefault(),this.scroller.scrollTop+=e.deltaY)};this.overlayKey="";this.heightFn=null;this.onCardClick=e=>{let t=e.target,n=t.closest(".fg-card");if(!n)return;let o=Number(n.dataset.row),r=this.grid.rowModel.getRow(o);if(!r||r.kind)return;if(t.closest(".fg-card-check")){this.grid.selectFromClick(o,!0,!1),this.invalidate({rows:!0});return}let s=t.closest(".fg-card-value")?.dataset.col,a=s?this.grid.columns.getColumn(s):void 0;a&&this.grid.events.emit("cellClick",{row:r.data,rowIndex:o,colId:a.id,value:B(a.def,r.data),event:e})};this.root=x("div","",{tabindex:"-1"}),this.root.addEventListener("focus",()=>this.gridEl.focus({preventScroll:!0})),this.gridEl=x("div","fg-grid",{role:"grid",tabindex:"0"}),this.headerEl=x("div","fg-header",{role:"rowgroup"}),this.bodyEl=x("div","fg-body",{role:"rowgroup"});let o=r=>({left:x("div",`${r} ${r}-left`),center:x("div",`${r} ${r}-center`),right:x("div",`${r} ${r}-right`)});this.headerPanes=o("fg-header-pane"),this.headerInners=o("fg-header-inner");for(let r of ee)this.headerInners[r].setAttribute("role","row");this.bodyPanes=o("fg-body-pane"),this.canvases=o("fg-canvas");for(let r of ee)this.headerPanes[r].dataset.region=r,this.bodyPanes[r].dataset.region=r,this.headerPanes[r].append(this.headerInners[r]),this.bodyPanes[r].append(this.canvases[r]),this.headerEl.append(this.headerPanes[r]),this.bodyEl.append(this.bodyPanes[r]);this.scroller=this.bodyPanes.center,t.options.filterRow&&(this.filterRow=new _e(t,this.headerPanes)),this.overlay=x("div","fg-overlay",{"aria-live":"polite"}),this.main=x("div","fg-main"),this.gridEl.append(this.headerEl,this.bodyEl),this.main.append(this.gridEl,this.overlay),this.root.append(this.main),e.append(this.root),this.applyTheme(),this.scroller.addEventListener("scroll",this.onScroll,{passive:!0}),this.bodyPanes.left.addEventListener("wheel",this.onSideWheel,{passive:!1}),this.bodyPanes.right.addEventListener("wheel",this.onSideWheel,{passive:!1})}get activeScroller(){return this.cards?.scroller??this.scroller}getScroll(){let e=this.activeScroller;return{top:e.scrollTop,left:e.scrollLeft}}setScroll(e){let t=this.activeScroller;typeof e?.top=="number"&&Number.isFinite(e.top)&&(t.scrollTop=Math.max(0,e.top)),typeof e?.left=="number"&&Number.isFinite(e.left)&&(t.scrollLeft=Math.max(0,e.left))}applyFont(e,t){e?this.root.style.setProperty("--fg-font-size",`${e}px`):this.root.style.removeProperty("--fg-font-size"),t?this.root.style.setProperty("--fg-font",t):this.root.style.removeProperty("--fg-font")}applyTheme(){let e=this.grid.options.direction==="rtl";this.root.className=`fg-root fg-theme-${this.grid.store.state.theme}${e?" fg-rtl":""}${this.cardMode?" fg-card-mode":""}${this.grid.density!=="normal"?` fg-density-${this.grid.density}`:""}`,this.root.setAttribute("dir",e?"rtl":"ltr")}get rtl(){return this.grid.options.direction==="rtl"}invalidate(e={}){e.header&&(this.headerDirty=!0),e.rows&&this.version++,this.schedule()}schedule(){this.frame||(this.frame=requestAnimationFrame(()=>{this.frame=0,this.render()}))}render(){let{columns:e,rowModel:t,store:n,options:o}=this.grid,{rowHeight:r,headerHeight:s}=this.opts,a=this.scroller.offsetWidth-this.scroller.clientWidth;e.setContainerWidth(Math.max(0,this.main.clientWidth-a))&&(this.headerDirty=!0,this.version++);let l=t.getRowCount(),d=!!this.grid.options.autoRowHeight&&!t.server,c=t.layout(r,this.detailHeight(),d?this.rowHeights:void 0,this.heightsVersion,t.server?void 0:this.heightOf);if(this.offsets=c.uniform?null:c.offsets,this.firstDataId=e.displayed().find(R=>!D(R.id))?.id??"",this.groupLabelId=e.region("center").find(R=>!D(R.id))?.id??this.firstDataId,this.useCards()){this.renderCards(l),this.renderStatusBar(t.dataCount()),this.renderPager(),this.orderSections(null),this.paintOverlay(l);return}let u=this.grid.summary(),g=u?u.opts.rows.length:0,f=u?.opts.position??"bottom",b=u?u.opts.pinned!==!1:!1;this.topOffset=u&&!b&&f==="top"?g*r:0;let w=u&&!b&&f==="bottom"?g*r:0;this.syncSummaryPane(u&&b?f:null,g*r);let m=e.depth*s+(this.filterRow?.height??0);this.headerEl.style.height=`${m}px`;for(let R of ee){let k=e.regionWidth(R);R!=="center"&&(this.headerPanes[R].style.width=this.bodyPanes[R].style.width=`${k}px`,this.headerPanes[R].hidden=this.bodyPanes[R].hidden=k===0),this.canvases[R].style.width=`${k}px`,this.canvases[R].style.height=`${this.rowsHeight(l)+this.topOffset+w}px`}o.autoHeight&&!this.useCards()&&(this.root.classList.add("fg-auto-height"),this.bodyEl.style.height=`${this.rowsHeight(l)+this.topOffset+w+Math.max(0,this.scroller.offsetHeight-this.scroller.clientHeight)}px`);let h=this.scroller.offsetHeight-this.scroller.clientHeight;this.bodyPanes.left.style.marginBottom=this.bodyPanes.right.style.marginBottom=`${h}px`;let p=this.gridEl;p.setAttribute("role",o.treeData||this.grid.getGroupBy().length?"treegrid":"grid"),p.setAttribute("aria-rowcount",String(l+e.depth+(this.filterRow?1:0))),p.setAttribute("aria-colcount",String(e.displayed().length)),o.rowSelection==="multiple"&&p.setAttribute("aria-multiselectable","true"),this.headerDirty&&(this.headerDirty=!1,this.renderHeader()),this.filterRow?.render(),this.renderRows(l),this.updateActiveCell(),d&&this.measureRows(),this.renderSummary(l,u&&u.opts.rows,u?.values??[],b,f),this.pinnedTop=this.renderPinned(this.pinnedTop,"top",this.grid.pinnedRows.top),this.pinnedBottom=this.renderPinned(this.pinnedBottom,"bottom",this.grid.pinnedRows.bottom),this.renderStatusBar(t.dataCount()),this.renderPager(),this.orderSections(u&&b?f:null),this.paintOverlay(l),this.overlay.style.top=`${m}px`;let{scrollTop:v,scrollLeft:y}=this.scroller;this.bodyPanes.left.scrollTop=this.bodyPanes.right.scrollTop=v,this.headerInners.center.style.transform=`translateX(${-y}px)`,this.filterRow?.setTransform(y),this.summaryInners&&(this.summaryInners.center.style.transform=`translateX(${-y}px)`);for(let R of[this.pinnedTop,this.pinnedBottom])R&&(R.inners.center.style.transform=`translateX(${-y}px)`);this.grid.fillHandle.update()}orderSections(e){let t=[e==="top"?this.summaryEl:null,this.pinnedTop?.el??null].filter(s=>!!s),n=[this.pinnedBottom?.el??null,e==="bottom"?this.summaryEl:null].filter(s=>!!s),o=[this.statusEl,this.pagerEl].filter(s=>!!s);for(let s of t)s.nextElementSibling!==this.bodyEl&&!t.includes(s.nextElementSibling)&&this.gridEl.insertBefore(s,this.bodyEl);let r=this.bodyEl;for(let s=t.length-1;s>=0;s--)r.previousElementSibling!==t[s]&&this.gridEl.insertBefore(t[s],r),r=t[s];r=this.bodyEl;for(let s of n)r.nextElementSibling!==s&&r.after(s),r=s;r=this.gridEl;for(let s of o)r.nextElementSibling!==s&&r.after(s),r=s}paintOverlay(e){let{grid:t}=this,{store:n,rowModel:o,options:r}=t,s=t.forcedOverlay??(e>0?null:o.loading()?"loading":"noRows");if(this.overlay.hidden=!s,!s){this.overlayKey="";return}let a=!o.server&&n.state.data.length>0,l=s==="loading"?r.loadingOverlay:r.noRowsOverlay,d=`${s}|${a}|${n.state.locale.code}`;if(d!==this.overlayKey)if(this.overlayKey=d,this.overlay.classList.toggle("fg-overlay-custom",typeof l=="function"),l==null)this.overlay.textContent=s==="loading"?n.state.locale.loading:n.state.locale.noRows;else if(typeof l=="string")this.overlay.textContent=l;else try{let c=l({filtered:a});typeof c=="string"?this.overlay.textContent=c:this.overlay.replaceChildren(c)}catch{O(`${s==="loading"?"loadingOverlay":"noRowsOverlay"} threw`),this.overlay.textContent=s==="loading"?n.state.locale.loading:n.state.locale.noRows}}updateActiveCell(){let e=this.activeCellId?this.root.getRootNode().getElementById?.(this.activeCellId)??null:null,t=this.gridEl.querySelector(".fg-body .fg-cell-focused, .fg-body .fg-row-group .fg-cell-focused");if(e&&e!==t&&e.removeAttribute("id"),!t){this.gridEl.removeAttribute("aria-activedescendant"),this.activeCellId="";return}t.id||(t.id=`${this.idBase}-cell`),this.activeCellId=t.id,this.gridEl.setAttribute("aria-activedescendant",t.id)}renderPinned(e,t,n){if(!n.length)return e?.el.remove(),null;let o=e??new Nt(`fg-pinned-rows fg-pinned-${t}`),{columns:r}=this.grid,s=this.opts.rowHeight;o.size(r,n.length*s,this.scroller.offsetWidth-this.scroller.clientWidth);let a=r.region("center"),l=Ze(a.map(d=>d.left),a.map(d=>d.width),this.scroller.scrollLeft,this.scroller.clientWidth,Pt);for(let d of ee){let c=d==="center"?a.slice(l.first,l.last+1):r.region(d);o.inners[d].replaceChildren(...n.map((u,g)=>{let f=x("div","fg-row fg-row-pinned",{role:"row"});f.style.transform=`translateY(${g*s}px)`,f.style.height=`${s}px`;let b={id:`pinned-${t}-${g}`,data:u,sourceIndex:-1};for(let w of c){let m=x("div","fg-cell",{role:"gridcell"});D(w.id)?(m.style.left=`${w.left}px`,m.style.width=`${w.width}px`):this.paintCell(m,b,-1,w,!1,!1),f.append(m)}return f}))}return o}renderStatusBar(e){if(!this.grid.options.statusBar){this.statusEl?.remove(),this.statusEl=null;return}let{grid:t}=this,n=t.store.state,o=t.rowModel.server?e:t.viewRows().length,r=`${this.version}|${e}|${o}|${n.selected.size}|${JSON.stringify(n.range)}|${n.locale.code}`;if(this.statusEl&&r===this.statusKey)return;this.statusKey=r,this.statusEl??(this.statusEl=x("div","fg-statusbar",{role:"status","aria-live":"polite"}));let s=n.locale,a=new Intl.NumberFormat(s.code,{maximumFractionDigits:2}),l=x("span","fg-status-rows");l.textContent=(e===o?s.statusRows.replace("{n}",a.format(o)):s.statusFiltered.replace("{shown}",a.format(e)).replace("{total}",a.format(o)))+(n.selected.size?` \xB7 ${s.statusSelected.replace("{n}",a.format(n.selected.size))}`:"");let d=x("span","fg-status-aggs"),c=t.rangeAggregates();if(c&&c.cells>1){let u=[`${s.count} ${a.format(c.count)}`];c.numbers&&u.push(`${s.sum} ${a.format(c.sum)}`,`${s.avg} ${a.format(c.sum/c.numbers)}`,`${s.min} ${a.format(c.min)}`,`${s.max} ${a.format(c.max)}`),d.textContent=u.join(" ")}this.statusEl.replaceChildren(l,d)}renderHeader(){let{columns:e,store:t}=this.grid,{sort:n,filters:o,locale:r}=t.state;for(let s of ee){let a=this.headerInners[s];a.style.width=`${e.regionWidth(s)}px`,a.style.height=`${e.depth*this.opts.headerHeight}px`,a.replaceChildren(...e.headerCells(s).map(l=>this.headerCell(l,n,o,r)))}}headerCell(e,t,n,o){let r=this.opts.headerHeight,s=x("div",e.isGroup?"fg-header-cell fg-header-group":"fg-header-cell",{role:"columnheader"});if(s.dataset.col=e.id,s.style.left=`${e.left}px`,s.style.top=`${e.row*r}px`,s.style.width=`${e.width}px`,s.style.height=`${e.rowSpan*r}px`,D(e.id))return e.id===fe&&(s.classList.add("fg-header-rownum"),s.textContent=e.label),e.id===te&&(s.classList.add("fg-header-select"),s.append(this.selectAllBox(o))),s;let a=x("span","fg-header-label"),l=e.node.def;if(a.textContent=e.label,l.headerRenderer)try{let g=l.headerRenderer({header:e.label,column:l});typeof g=="string"?a.innerHTML=g:a.replaceChildren(g)}catch{O(`headerRenderer of column "${e.id}" threw; showing the plain header`),a.textContent=e.label}let d=null;if(e.isGroup&&this.grid.columns.isCollapsible(e.node)){let g=e.node.open,f=x("button",g?"fg-colgroup-toggle fg-expanded":"fg-colgroup-toggle",{type:"button",tabindex:"-1","aria-expanded":String(g),"aria-label":g?o.collapseAll:o.expandAll});f.textContent=g?"\u2212":"+",f.addEventListener("click",b=>{b.stopPropagation(),this.grid.setColumnGroupOpened(e.id,!g)}),s.classList.add("fg-header-collapsible"),d=f}if(l.headerClass)try{let g=typeof l.headerClass=="function"?l.headerClass(l):l.headerClass;g&&s.classList.add(...g.split(/\s+/).filter(Boolean))}catch{O(`headerClass of column "${e.id}" threw`)}if(s.append(a),d&&s.append(d),e.isGroup||!e.column)return s;let c=e.node.def;(c.wrapHeaderText??this.grid.options.wrapHeaderText)&&s.classList.add("fg-header-wrap"),s.setAttribute("aria-colindex",String(e.column.index+1)),(c.align??(c.type==="number"?"right":"left"))==="right"&&s.classList.add("fg-align-right");let u=t.findIndex(g=>g.colId===e.id);if(s.setAttribute("aria-sort",u<0?"none":t[u].dir==="asc"?"ascending":"descending"),ye(c)&&s.classList.add("fg-sortable"),u>=0){let g=x("span","fg-sort-icon");if(g.textContent=t[u].dir==="asc"?"\u2191":"\u2193",t.length>1){let f=x("sup");f.textContent=String(u+1),g.append(f)}s.append(g)}if(ye(c)||oe(c)){let g=!!n[e.id],f=x("button",g?"fg-menu-btn fg-filter-active":"fg-menu-btn",{type:"button",tabindex:"-1","aria-label":o.columnMenu});f.innerHTML=g?hr:ur,s.append(f)}return Ue(c)&&s.append(x("div","fg-resize",{"aria-hidden":"true"})),s}selectAllBox(e){let t=this.grid.selectableRows(),n=this.grid.store.state.selected,o=0;for(let s of t)n.has(s.id)&&o++;let r=x("input","fg-checkbox fg-select-all",{type:"checkbox",tabindex:"-1","aria-label":e.selectAllRows});return r.checked=t.length>0&&o===t.length,r.indeterminate=o>0&&o<t.length,r.hidden=this.grid.options.rowSelection!=="multiple"||this.grid.options.headerCheckbox===!1,r}renderRows(e){let{columns:t,rowModel:n,store:o}=this.grid,{selected:r,focus:s}=o.state,a=this.grid.allRangeBounds(),l=this.grid.mergeSpans(),d=Math.max(0,this.scroller.scrollTop-this.topOffset),c=this.grid.options.autoHeight&&!n.server?{first:0,last:e-1}:this.offsets?Wn(this.offsets,d,this.scroller.clientHeight,e,Un):qn(d,this.scroller.clientHeight,this.opts.rowHeight,e,Un);this.lastRange=c;let u=t.region("center"),g=Ze(u.map(f=>f.left),u.map(f=>f.width),this.scroller.scrollLeft,this.scroller.clientWidth,Pt);u.some(f=>f.def.colSpan)&&(g.first=Math.max(0,g.first-cr));for(let f of ee){let b=f==="center"?u.slice(g.first,g.last+1):t.region(f),w=this.painted[f];for(let[h,p]of w)h>=c.first&&h<=c.last&&b.length||(p.el.remove(),this.pool[f].push(p.el),w.delete(h));if(!b.length)continue;let m=f==="center"?`${g.first}-${g.last}`:"";for(let h=c.first;h<=c.last;h++){let p=n.getRow(h),v=r.has(p.id),y=s&&s.rowIndex===h?s.colId:"",R=a.filter(S=>h>=S.r1&&h<=S.r2),k=R.map(S=>`${S.c1}-${S.c2}`).join(","),L=this.mergeState(l,b,h,c.first),C=p.kind==="detail"?`${this.scroller.scrollLeft}:${this.scroller.clientWidth}`:"",E=`${p.id}|${this.version}|${m}|${v?1:0}${p.kind==="group"?`:${this.grid.selectionVersion}`:""}|${y}|${k}|${L}|${C}`,M=w.get(h);if(!M){let S=this.pool[f].pop()??x("div","fg-row",{role:"row"});this.canvases[f].append(S),M={el:S,key:""},w.set(h,M)}M.key!==E&&(M.key=E,M.el.dataset.kind!==(p.kind??"")&&(M.el.replaceChildren(),M.el.dataset.kind=p.kind??""),p.kind==="group"?this.paintGroupRow(M.el,p,h,b,y):p.kind==="detail"?this.paintDetailRow(M.el,p,h,f):p.kind==="loading"?this.paintLoadingRow(M.el,h,b):this.paintRow(M.el,p,h,b,v,y,R,l,c.first))}}}mergeState(e,t,n,o){if(!e.size)return"";let r="";for(let s of t){let a=e.get(s.id);if(!a)continue;let l=a.start[n],d=a.end[n];r+=l===d?"n":n===Math.max(l,o)?`d${l}`:"h"}return r}paintRow(e,t,n,o,r,s,a,l=new Map,d=0){let c=this.opts.rowHeight;for(e.className=`fg-row${n%2?" fg-row-odd":""}${r?" fg-row-selected":""}${this.grid.tracker.created.has(t.data)?" fg-row-created":""}${this.grid.editor.editingRow(t.id)?" fg-row-editing":""}`,this.placeRow(e,n),this.grid.options.rowSelection&&e.setAttribute("aria-selected",String(r)),t.level!==void 0?e.setAttribute("aria-level",String(t.level+1)):e.removeAttribute("aria-level"),t.hasChildren?e.setAttribute("aria-expanded",String(!!t.expanded)):e.removeAttribute("aria-expanded");e.childElementCount>o.length;)e.lastElementChild.remove();for(;e.childElementCount<o.length;)e.append(x("div","fg-cell",{role:"gridcell"}));let u=!1,g=o.length?this.grid.columns.region(o[0].region):[],f=g.some(m=>m.def.colSpan),b=-1,w=f?new Map(g.map((m,h)=>[m.id,h])):null;o.forEach((m,h)=>{let p=e.children[h];if(this.paintCell(p,t,n,m,r,s===m.id),w){let y=w.get(m.id);if(y<=b)p.classList.add("fg-cell-span-hidden");else if(m.def.colSpan&&!D(m.id)){let R=$e(m.def.colSpan,m.def,t.data,n,g.length-y);if(R>1){b=y+R-1;let k=0;for(let L=y;L<=b;L++)k+=g[L].width;p.style.width=`${k}px`,p.classList.add("fg-cell-colspan")}}}m.id===this.firstDataId&&this.decorate(p,t),p.style.top=p.style.height=p.style.bottom="";let v=l.get(m.id);v&&v.start[n]!==v.end[n]&&(n===Math.max(v.start[n],d)?(p.classList.add("fg-cell-merged"),p.style.top=`${-(this.rowTop(n)-this.rowTop(v.start[n]))}px`,p.style.height=`${this.rowTop(v.end[n])+this.rowH(v.end[n])-this.rowTop(v.start[n])}px`,p.style.bottom="auto",u=!0):p.classList.add("fg-cell-merge-hidden")),!D(m.id)&&a.some(y=>m.index>=y.c1&&m.index<=y.c2)&&p.classList.add("fg-cell-range")}),e.style.zIndex=u?"1":""}paintCell(e,t,n,o,r,s){let a=this.grid.store.state.locale;e.style.left=`${o.left}px`,e.style.width=`${o.width}px`,e.dataset.col=o.id,e.setAttribute("aria-colindex",String(o.index+1));let l=s?"fg-cell fg-cell-focused":"fg-cell";if(o.id===fe){e.className=`${l} fg-cell-rownum`;let f=n>=0&&!t.kind?this.grid.rowNumber(n):null;e.textContent=f===null?"":String(f);return}if(o.id===ve){e.className=`${l} fg-cell-drag`;let f=x("span",this.grid.canMoveRows()?"fg-drag-handle":"fg-drag-handle fg-drag-disabled",{"aria-hidden":"true"});f.textContent="\u22EE\u22EE",e.replaceChildren(f);return}if(o.id===te){e.className=`${l} fg-cell-select`;let f=x("input","fg-checkbox",{type:"checkbox",tabindex:"-1","aria-label":a.selectRow});f.checked=r,n>=0&&!t.kind&&!this.grid.rowSelectable(t.data)&&(f.disabled=!0,e.classList.add("fg-cell-select-locked")),e.replaceChildren(f);return}let d=o.def,c=B(d,t.data),u=K(d,a.code)(c);l+=` fg-align-${d.align??(d.type==="number"?"right":d.type==="boolean"?"center":"left")}`;let g={value:c,formatted:u,row:t.data,rowIndex:n,column:d};if(d.cellClass)try{let f=typeof d.cellClass=="function"?d.cellClass(g):d.cellClass;f&&(l+=` ${f}`)}catch{O(`cellClass of column "${o.id}" threw`)}if(this.grid.tracker.isDirty(t.data,d.field)&&(l+=" fg-cell-dirty"),d.wrapText&&(l+=" fg-cell-wrap"),typeof d.editable=="function"&&n>=0&&!ae(d,t.data,n)&&(l+=" fg-cell-readonly"),n>=0&&(l+=this.grid.finder.classFor(n,o.id)),this.grid.isFlashing(t.id,o.id)&&(l+=" fg-cell-flash"),e.className=l,d.sparkline&&!d.renderer){let f=Array.isArray(c)?c.map(Number).filter(Number.isFinite):[];f.length?e.replaceChildren(fr(f,d.sparkline===!0?{}:d.sparkline,o.width,this.opts.rowHeight)):e.replaceChildren(),e.setAttribute("aria-label",Array.isArray(c)?c.join(", "):"");return}if(!d.renderer){e.textContent=u;return}try{let f=d.renderer(g);typeof f=="string"?e.innerHTML=f:e.replaceChildren(f)}catch{O(`renderer of column "${o.id}" threw; rendering an empty cell`),e.textContent=""}}cellAt(e){let t=e instanceof Element?e.closest(".fg-cell"):null,n=t?.parentElement;return!t||!n?.dataset.row||!t.dataset.col||t.closest(".fg-root")!==this.root?null:{rowIndex:Number(n.dataset.row),colId:t.dataset.col}}ensureVisible(e,t){let n=this.scroller,o=this.rowTop(e),r=o+Math.min(this.rowH(e),n.clientHeight||1/0);o<n.scrollTop?n.scrollTop=o:r>n.scrollTop+n.clientHeight&&(n.scrollTop=r-n.clientHeight);let s=t?this.grid.columns.getColumn(t):void 0;s?.region==="center"&&(s.left<n.scrollLeft?n.scrollLeft=s.left:s.left+s.width>n.scrollLeft+n.clientWidth&&(n.scrollLeft=s.left+s.width-n.clientWidth))}syncSummaryPane(e,t){if(!e){this.summaryEl?.remove(),this.summaryEl=this.summaryPanes=this.summaryInners=null;return}if(!this.summaryEl){let o=r=>({left:x("div",`${r} ${r}-left`),center:x("div",`${r} ${r}-center`),right:x("div",`${r} ${r}-right`)});this.summaryEl=x("div","fg-summary",{role:"rowgroup"}),this.summaryPanes=o("fg-summary-pane"),this.summaryInners=o("fg-summary-inner");for(let r of ee)this.summaryPanes[r].append(this.summaryInners[r]),this.summaryEl.append(this.summaryPanes[r])}this.summaryEl.className=`fg-summary fg-summary-${e}`,this.summaryEl.style.height=`${t}px`;for(let o of ee){let r=this.grid.columns.regionWidth(o);o!=="center"&&(this.summaryPanes[o].style.width=`${r}px`,this.summaryPanes[o].hidden=r===0),this.summaryInners[o].style.width=`${r}px`,this.summaryInners[o].style.height=`${t}px`}let n=this.scroller.offsetWidth-this.scroller.clientWidth;this.summaryPanes.center.style.marginRight=`${n}px`}renderSummary(e,t,n,o,r){for(let u of ee){for(let g of this.canvasSummary[u])g.remove();this.canvasSummary[u]=[]}if(!t)return;let{columns:s}=this.grid,a=this.opts.rowHeight,l=s.region("center"),d=Ze(l.map(u=>u.left),l.map(u=>u.width),this.scroller.scrollLeft,this.scroller.clientWidth,Pt),c=s.displayed().filter(u=>!D(u.id));for(let u of ee){let g=u==="center"?l.slice(d.first,d.last+1):s.region(u),f=t.map((b,w)=>{let m=b.label!=null?c.find(v=>!(v.id in(b.columns??{})))?.id??null:null,h=x("div","fg-row fg-summary-row",{role:"row"}),p=o||r==="top"?w*a:this.rowsHeight(e)+w*a;h.style.transform=`translateY(${p}px)`,h.style.height=`${a}px`;for(let v of g)h.append(this.summaryCell(v,b,n[w]??{},m));return h});o?this.summaryInners[u].replaceChildren(...f):(this.canvases[u].append(...f),this.canvasSummary[u]=f)}}summaryCell(e,t,n,o){let r=x("div","fg-cell",{role:"gridcell"});r.style.left=`${e.left}px`,r.style.width=`${e.width}px`,r.dataset.col=e.id;let s=e.def,a=s.align??(s.type==="number"?"right":s.type==="boolean"?"center":"left");r.className=`fg-cell fg-align-${a}`;let l=t.columns?.[e.id];if(l===void 0)return e.id===o&&(r.textContent=t.label??"",r.classList.add("fg-summary-label")),r;let d=n[e.id],c=De(l),u=this.grid.store.state.locale.code,g;if(d==null||d==="")g="";else if(typeof d=="string")g=d;else if(c.agg==="count")g=new Intl.NumberFormat(u).format(d);else{let f=s.type??(typeof d=="number"?"number":d instanceof Date?"date":void 0);g=K({...s,type:f,format:c.format??s.format},u)(d)}return r.textContent=c.prefix&&g?`${c.prefix} ${g}`:g,r}get heightOf(){let e=this.grid.options.getRowHeight;if(e)return this.heightFn??(this.heightFn=t=>{try{return e(t)??void 0}catch{return}})}invalidateHeights(){this.heightOf&&this.heightsVersion++,this.rowHeights.size&&(this.rowHeights.clear(),this.heightsVersion++)}measureRows(){let e=this.opts.rowHeight,t=new Map;for(let o of ee)for(let[r,s]of this.painted[o]){let a=this.grid.rowModel.getRow(r);if(!a||a.kind)continue;let l=t.get(r)??e;for(let d of s.el.querySelectorAll(".fg-cell-wrap"))d.classList.contains("fg-cell-merged")||d.classList.contains("fg-cell-merge-hidden")||(l=Math.max(l,Math.ceil(d.scrollHeight)));t.set(r,l)}let n=!1;for(let[o,r]of t){let s=this.grid.rowModel.getRow(o).id,a=this.rowHeights.get(s)??e;Math.abs(a-r)>1&&(r===e?this.rowHeights.delete(s):this.rowHeights.set(s,r),n=!0)}n&&(this.heightsVersion++,this.version++,this.schedule())}detailHeight(){let e=this.grid.options.detailHeight;return typeof e=="number"&&e>0?e:240}rowTop(e){return(this.offsets?this.offsets[e]:e*this.opts.rowHeight)+this.topOffset}rowH(e){return this.offsets?this.offsets[e+1]-this.offsets[e]:this.opts.rowHeight}rowsHeight(e){return this.offsets?this.offsets[e]:e*this.opts.rowHeight}placeRow(e,t){e.style.transform=`translateY(${this.rowTop(t)}px)`,e.style.height=`${this.rowH(t)}px`,e.dataset.row=String(t),e.setAttribute("aria-rowindex",String(t+1+this.grid.columns.depth+(this.filterRow?1:0)))}decorate(e,t){let{grid:n}=this,o=n.store.state.locale,r=t.level??0,s=!!n.options.treeData,a=n.canExpandDetail(t.data);if(!s&&!a&&!r)return;e.classList.add("fg-cell-lead"),e.style.setProperty("--fg-level",String(r));let l=[];if(s)if(t.hasChildren){let d=x("button",t.expanded?"fg-tree-toggle fg-expanded":t.loading?"fg-tree-toggle fg-tree-loading":"fg-tree-toggle",{type:"button",tabindex:"-1","aria-label":t.expanded?o.collapseAll:o.expandAll,"aria-expanded":String(!!t.expanded)});t.loading&&d.setAttribute("aria-busy","true"),d.innerHTML=Ft,l.push(d)}else l.push(x("span","fg-tree-spacer",{"aria-hidden":"true"}));if(a){let d=n.isDetailExpanded(t.data),c=x("button",d?"fg-detail-toggle fg-expanded":"fg-detail-toggle",{type:"button",tabindex:"-1","aria-expanded":String(d),"aria-label":d?o.collapseAll:o.expandAll});c.innerHTML=Ft,l.push(c)}e.prepend(...l)}paintGroupRow(e,t,n,o,r){let s=t.group,{grid:a}=this,l=a.store.state.locale;for(e.className="fg-row fg-row-group",this.placeRow(e,n),e.setAttribute("aria-level",String((t.level??0)+1)),e.setAttribute("aria-expanded",String(s.expanded)),e.removeAttribute("aria-selected"),e.style.zIndex="";e.childElementCount>o.length;)e.lastElementChild.remove();for(;e.childElementCount<o.length;)e.append(x("div","fg-cell",{role:"gridcell"}));o.forEach((d,c)=>{let u=e.children[c];u.style.left=`${d.left}px`,u.style.width=`${d.width}px`,u.style.top=u.style.height=u.style.bottom="",u.style.removeProperty("--fg-level"),u.dataset.col=d.id,u.setAttribute("aria-colindex",String(d.index+1));let g=r===d.id?" fg-cell-focused":"";if(d.id===te){if(u.className=`fg-cell fg-cell-select${g}`,a.options.rowSelection!=="multiple"){u.replaceChildren();return}let m=a.groupSelection(t),h=x("input","fg-checkbox",{type:"checkbox",tabindex:"-1","aria-label":l.selectAllRows});h.checked=m==="all",h.indeterminate=m==="some",u.replaceChildren(h);return}if(d.id===this.groupLabelId){u.className=`fg-cell fg-group-cell${g}`,u.style.setProperty("--fg-level",String(t.level??0));let m=x("button",s.expanded?"fg-group-toggle fg-expanded":"fg-group-toggle",{type:"button",tabindex:"-1","aria-expanded":String(s.expanded),"aria-label":s.expanded?l.collapseAll:l.expandAll});m.innerHTML=Ft;let h=a.columns.getNode(s.colId)?.def,p=x("span","fg-group-label"),v=q(s.value)?l.blanks:h?K(h,l.code)(s.value):String(s.value),y=new Intl.NumberFormat(l.code),R=s.count??(s.aggregates?null:s.rows.length);p.textContent=`${h?.header??h?.field??s.colId}: ${v}${R==null?"":` (${y.format(R)})`}`,u.replaceChildren(m,p);return}let f=d.def,b=f.align??(f.type==="number"?"right":f.type==="boolean"?"center":"left");u.className=`fg-cell fg-align-${b}${g}`;let w=f.aggFunc&&!D(d.id)?a.groupAggregate(t,d.id):void 0;if(w==null||w==="")u.textContent="";else if(f.aggFunc==="count")u.textContent=new Intl.NumberFormat(l.code).format(w);else{let m=f.type??(typeof w=="number"?"number":w instanceof Date?"date":void 0);u.textContent=K({...f,type:m},l.code)(w)}u.textContent&&u.classList.add("fg-cell-agg")})}paintDetailRow(e,t,n,o){if(e.className="fg-row fg-row-detail",this.placeRow(e,n),e.style.zIndex="",o!=="center"){e.replaceChildren();return}let r=t.detailOf,s=this.details.get(r.id);if(!s){s=x("div","fg-detail");try{let a=this.grid.options.detailRenderer?.({row:r.data,rowIndex:n-1});typeof a=="string"?s.innerHTML=a:a&&s.append(a)}catch{O("detailRenderer threw; showing an empty panel")}this.details.set(r.id,s)}s.style.left=`${this.scroller.scrollLeft}px`,s.style.width=`${this.scroller.clientWidth||this.grid.columns.regionWidth("center")}px`,(e.firstChild!==s||e.childNodes.length!==1)&&e.replaceChildren(s)}paintLoadingRow(e,t,n){e.className="fg-row fg-row-loading",this.placeRow(e,t),e.setAttribute("aria-busy","true"),e.style.zIndex="",e.replaceChildren(...n.map(o=>{let r=x("div","fg-cell",{role:"gridcell"});return r.style.left=`${o.left}px`,r.style.width=`${o.width}px`,r.dataset.col=o.id,D(o.id)||r.append(x("span","fg-skeleton",{"aria-hidden":"true"})),r}))}renderPager(){let{grid:e}=this,t=e.options.pagination;if(!t){this.pagerEl?.remove(),this.pagerEl=null;return}let n=e.store.state.locale,o=e.getPage(),r=e.getPageSize(),s=e.getPageCount(),a=e.rowModel.fullCount(),l=typeof t=="object"&&Array.isArray(t.pageSizes)?t.pageSizes.filter(h=>Number.isInteger(h)&&h>0):[],d=`${o}|${r}|${s}|${a}|${n.code}|${l.join(",")}`;if(this.pagerEl&&d===this.pagerKey)return;this.pagerKey=d,this.pagerEl||(this.pagerEl=x("div","fg-pager",{role:"navigation"}),this.pagerEl.addEventListener("click",h=>{let p=h.target.closest("button[data-action]")?.dataset.action,v=e.getPage();p==="first"?e.setPage(0):p==="prev"?e.setPage(v-1):p==="next"?e.setPage(v+1):p==="last"&&e.setPage(e.getPageCount()-1)}),this.pagerEl.addEventListener("change",h=>{let p=h.target;p.classList.contains("fg-pager-size")&&e.setPageSize(Number(p.value))})),this.pagerEl.setAttribute("aria-label",n.pageSize);let c=new Intl.NumberFormat(n.code),u=a?o*r+1:0,g=Math.min(a,(o+1)*r),f=x("span","fg-pager-range");f.textContent=n.pagerRange.replace("{from}",c.format(u)).replace("{to}",c.format(g)).replace("{total}",c.format(a));let b=[f,x("span","fg-pager-spacer")];if(l.length){let h=x("label","fg-pager-size-label");h.textContent=n.pageSize;let p=x("select","fg-pager-size");for(let v of[...new Set([...l,r])].sort((y,R)=>y-R)){let y=x("option");y.value=String(v),y.textContent=c.format(v),y.selected=v===r,p.append(y)}h.append(p),b.push(h)}let w=(h,p,v,y)=>{let R=x("button","fg-pager-btn",{type:"button","aria-label":v,title:v});return R.dataset.action=h,R.textContent=p,R.disabled=y,R},m=x("span","fg-pager-page",{"aria-live":"polite"});m.textContent=n.pageOf.replace("{page}",c.format(o+1)).replace("{pages}",c.format(s)),b.push(w("first","\xAB",n.firstPage,o===0),w("prev","\u2039",n.previousPage,o===0),m,w("next","\u203A",n.nextPage,o>=s-1),w("last","\xBB",n.lastPage,o>=s-1)),this.pagerEl.replaceChildren(...b)}showFreeBadge(){if(this.root.querySelector(".fg-free-badge"))return;let e=x("a","fg-free-badge",{href:"https://freegrid.app/pricing/",target:"_blank",rel:"noopener"});e.innerHTML='<svg viewBox="0 0 32 32" width="14" height="14" aria-hidden="true"><rect width="32" height="32" rx="7" fill="#0E1726"/><path d="M7 11.5h18M7 16.5h18M7 21.5h18M13 7v18" stroke="#fff" stroke-width="2" stroke-linecap="round"/><rect x="14" y="12.5" width="11" height="3" rx="1" fill="#F2A900"/></svg>';let t=x("span");t.textContent=`FreeGrid \xB7 ${this.grid.store.state.locale.freeBadge}`,e.append(t),this.root.append(e)}useCards(){let e=this.grid.options.cardView,t=e===!0?640:typeof e=="number"?e:-1,n=t>0&&this.main.clientWidth<t;return n!==this.cardMode&&(this.cardMode=n,this.root.classList.toggle("fg-card-mode",n),!n&&this.cards&&(this.cards.scroller.remove(),this.cards=null),this.version++),n}renderCards(e){let{grid:t}=this;if(!this.cards){let w=x("div","fg-cards",{role:"list"}),m=x("div","fg-cards-canvas");w.append(m),this.main.insertBefore(w,this.overlay),w.addEventListener("scroll",()=>{this.schedule(),this.grid.events.emit("scroll",this.getScroll())},{passive:!0}),w.addEventListener("click",this.onCardClick),this.cards={scroller:w,canvas:m}}let{scroller:n,canvas:o}=this.cards,r=t.columns.displayed().filter(w=>!D(w.id)),s=Math.round(this.opts.rowHeight*.75),a=!!t.options.rowSelection,l=20+r.length*s+(a?s:0),d=10;o.style.height=`${e*(l+d)}px`;let c=Math.max(0,Math.floor(n.scrollTop/(l+d))-2),u=Math.min(e-1,Math.ceil((n.scrollTop+(n.clientHeight||800))/(l+d))+2),{selected:g,locale:f}=t.store.state,b=[];for(let w=c;w<=u;w++){let m=t.rowModel.getRow(w);if(!m)continue;let h=x("div",m.kind?"fg-card fg-card-other":g.has(m.id)?"fg-card fg-card-selected":"fg-card",{role:"listitem"});if(h.dataset.row=String(w),h.style.transform=`translateY(${w*(l+d)}px)`,h.style.height=`${l}px`,h.style.setProperty("--fg-card-line",`${s}px`),m.kind==="group"&&m.group){let p=t.columns.getNode(m.group.colId)?.def;h.textContent=`${p?.header??m.group.colId}: ${String(m.group.value??f.blanks)} (${m.group.rows.length})`}else if(!m.kind){if(a){let p=x("label","fg-card-head"),v=x("input","fg-card-check fg-checkbox",{type:"checkbox","aria-label":f.selectRow});v.checked=g.has(m.id),v.disabled=!t.rowSelectable(m.data),p.append(v,document.createTextNode(`#${w+1}`)),h.append(p)}for(let p of r){let v=x("div","fg-card-line"),y=x("span","fg-card-label");y.textContent=p.def.header??p.def.field??p.id;let R=x("span","fg-card-value");R.dataset.col=p.id;let k=B(p.def,m.data),L=K(p.def,f.code)(k);if(p.def.renderer)try{let C=p.def.renderer({value:k,formatted:L,row:m.data,rowIndex:w,column:p.def});typeof C=="string"?R.innerHTML=C:R.replaceChildren(C)}catch{R.textContent=L}else R.textContent=L;v.append(y,R),h.append(v)}}b.push(h)}o.replaceChildren(...b)}dropDetail(e){e===void 0?this.details.clear():this.details.delete(e)}renderedRange(){return this.lastRange}measureText(e,t){let n=getComputedStyle(this.main),o=parseFloat(getComputedStyle(this.root).getPropertyValue("--fg-font-size"))||13;this.measureCtx===void 0&&(this.measureCtx=document.createElement("canvas").getContext("2d"));let r=this.measureCtx;return r?(r.font=`${t?600:400} ${o}px ${n.fontFamily||"sans-serif"}`,r.measureText(e).width):e.length*o*.6}scrollToRow(e){this.scroller.scrollTop=this.rowTop(Math.max(0,Math.min(e,this.grid.rowModel.getRowCount())))}pageRows(){return Math.max(1,Math.floor(this.scroller.clientHeight/this.opts.rowHeight))}destroy(){this.filterRow?.destroy(),this.frame&&cancelAnimationFrame(this.frame),this.scroller.removeEventListener("scroll",this.onScroll),this.root.remove()}},Nt=class{constructor(e){let t=n=>({left:x("div",`${n} ${n}-left`),center:x("div",`${n} ${n}-center`),right:x("div",`${n} ${n}-right`)});this.el=x("div",e,{role:"rowgroup"}),this.panes=t("fg-section-pane"),this.inners=t("fg-section-inner");for(let n of ee)this.panes[n].append(this.inners[n]),this.el.append(this.panes[n])}size(e,t,n){this.el.style.height=`${t}px`;for(let o of ee){let r=e.regionWidth(o);o!=="center"&&(this.panes[o].style.width=`${r}px`,this.panes[o].hidden=r===0),this.inners[o].style.width=`${r}px`,this.inners[o].style.height=`${t}px`}this.panes.center.style.marginRight=`${n}px`}},Kn="http://www.w3.org/2000/svg";function fr(i,e,t,n){let o=Math.max(20,t-16),r=Math.max(10,n-14),s=document.createElementNS(Kn,"svg");s.setAttribute("class","fg-sparkline"),s.setAttribute("width",String(o)),s.setAttribute("height",String(r)),s.setAttribute("viewBox",`0 0 ${o} ${r}`),s.setAttribute("aria-hidden","true");let a=e.color??"var(--fg-accent)",l=e.type==="bar",d=l?Math.min(0,...i):Math.min(...i),c=l?Math.max(0,...i):Math.max(...i);d===c&&(d-=1,c+=1);let u=c-d,g=h=>r-1-(h-d)/u*(r-2),f=(h,p)=>{let v=document.createElementNS(Kn,h);for(let[y,R]of Object.entries(p))v.setAttribute(y,String(R));return s.append(v),v};if(e.type==="bar"){let h=o/i.length;return i.forEach((p,v)=>f("rect",{x:v*h+1,y:Math.min(g(p),g(0)),width:Math.max(1,h-2),height:Math.max(1,Math.abs(g(p)-g(0))),fill:p<0?"#ef4444":a})),s}let b=i.length>1?(o-2)/(i.length-1):0,w=i.map((h,p)=>`${1+p*b},${g(h)}`).join(" ");e.type==="area"&&f("polygon",{points:`1,${r} ${w} ${1+(i.length-1)*b},${r}`,fill:a,"fill-opacity":.2}),f("polyline",{points:w,fill:"none",stroke:a,"stroke-width":1.5,"stroke-linejoin":"round"});let m=i.length-1;return f("circle",{cx:1+m*b,cy:g(i[m]),r:2,fill:a}),s}var pr=4,et=class{constructor(e){this.grid=e;this.onClick=e=>{let n=e.target.closest(".fg-group-chip-remove")?.closest(".fg-group-chip")?.dataset.col;n&&this.grid.setGroupBy(this.grid.getGroupBy().filter(o=>o!==n))};this.onPointerDown=e=>{let t=e.target,n=t.closest(".fg-group-chip");if(e.button!==0||!n||t.closest("button"))return;let o=n.dataset.col,r=e.clientX,s=!1,a=d=>{!s&&Math.abs(d.clientX-r)<pr||(s=!0,n.classList.add("fg-dragging"))},l=d=>{if(window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",l),n.classList.remove("fg-dragging"),!s)return;let u=[...this.el.querySelectorAll(".fg-group-chip")].filter(f=>f!==n).filter(f=>{let b=f.getBoundingClientRect();return d.clientX>b.left+b.width/2}).length,g=this.grid.getGroupBy().filter(f=>f!==o);g.splice(u,0,o),this.grid.setGroupBy(g)};window.addEventListener("pointermove",a),window.addEventListener("pointerup",l)};this.el=x("div","fg-group-panel",{role:"toolbar"}),e.renderer.main.insertBefore(this.el,e.renderer.gridEl),this.el.addEventListener("click",this.onClick),this.el.addEventListener("pointerdown",this.onPointerDown),this.refresh()}contains(e,t){let n=this.el.getBoundingClientRect();return e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom}highlight(e){this.el.classList.toggle("fg-group-panel-over",e)}refresh(){let{grid:e}=this,t=e.store.state.locale;this.el.setAttribute("aria-label",t.groupByThis);let n=e.getGroupBy();if(!n.length){let o=x("span","fg-group-hint");o.textContent=t.groupPanelHint,this.el.replaceChildren(o);return}this.el.replaceChildren(...n.map((o,r)=>{let s=e.columns.getNode(o)?.def,a=x("span","fg-group-chip");a.dataset.col=o;let l=x("span","fg-group-chip-label");l.textContent=s?.header??s?.field??o;let d=x("button","fg-group-chip-remove",{type:"button","aria-label":`${t.ungroup}: ${l.textContent}`});if(d.textContent="\xD7",a.append(l,d),r<n.length-1){let c=x("span","fg-group-sep",{"aria-hidden":"true"});return c.textContent="\u203A",[a,c]}return[a]}).flat())}destroy(){this.el.removeEventListener("click",this.onClick),this.el.removeEventListener("pointerdown",this.onPointerDown),this.el.remove()}};var Re=class{constructor(){this.listeners=new Map}on(e,t){let n=this.listeners.get(e);return n||this.listeners.set(e,n=new Set),n.add(t),()=>{n.delete(t)}}emit(e,t){let n=this.listeners.get(e);if(n)for(let o of[...n])try{o(t)}catch(r){console.error("[FreeGrid] event listener threw",r)}}clear(){this.listeners.clear()}};function ne(i){let e=i.getRootNode();return typeof ShadowRoot<"u"&&e instanceof ShadowRoot?e:document.body}function Ae(i,e,t){let n=i.getRootNode();return(typeof n.elementFromPoint=="function"?n.elementFromPoint(e,t):null)??document.elementFromPoint(e,t)}function jn(i){return i.getRootNode().activeElement??document.activeElement}function ge(i,...e){let t=typeof i.composedPath=="function"?i.composedPath():[];return t.length?e.some(n=>!!n&&t.includes(n)):e.some(n=>!!n&&n.contains(i.target))}var Ot=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Home","End","PageUp","PageDown"]);function Ht(i,e,t,n){let o=s=>Math.max(0,Math.min(n.rows-1,s)),r=s=>Math.max(0,Math.min(n.cols-1,s));switch(i){case"ArrowUp":return{rowIndex:o(t.rowIndex-1),colIndex:t.colIndex};case"ArrowDown":return{rowIndex:o(t.rowIndex+1),colIndex:t.colIndex};case"ArrowLeft":return{rowIndex:t.rowIndex,colIndex:r(t.colIndex-1)};case"ArrowRight":return{rowIndex:t.rowIndex,colIndex:r(t.colIndex+1)};case"PageUp":return{rowIndex:o(t.rowIndex-n.pageRows),colIndex:t.colIndex};case"PageDown":return{rowIndex:o(t.rowIndex+n.pageRows),colIndex:t.colIndex};case"Home":return{rowIndex:e.ctrl?0:t.rowIndex,colIndex:0};case"End":return{rowIndex:e.ctrl?n.rows-1:t.rowIndex,colIndex:n.cols-1};case"Tab":{let s=t.rowIndex*n.cols+t.colIndex+(e.shift?-1:1);return s<0||s>=n.rows*n.cols?null:{rowIndex:Math.floor(s/n.cols),colIndex:s%n.cols}}default:return null}}var tt=new Map,_n=i=>i?tt.get(i):void 0;var gr={Enter:"edit",F2:"edit",Delete:"clear",Backspace:"clear","Ctrl+Z":"undo","Ctrl+Y":"redo","Ctrl+Shift+Z":"redo","Ctrl+F":"find"};function mr(i){let e=[];return(i.ctrlKey||i.metaKey)&&e.push("Ctrl"),i.altKey&&e.push("Alt"),i.shiftKey&&i.key.length>1&&e.push("Shift"),i.shiftKey&&i.key.length===1&&(i.ctrlKey||i.metaKey)&&e.push("Shift"),e.push(i.key.length===1?i.key.toUpperCase():i.key),e.join("+")}var wr=3;function vr(i,e){return i.renderer.rtl?e.key==="ArrowLeft"?"ArrowRight":e.key==="ArrowRight"?"ArrowLeft":e.key:e.key}function Xn(i){let{renderer:e}=i,t=e.bodyEl,n=e.root,o=C=>vr(i,C),r="mouse",s=0,a=!1,l=C=>{let E=e.cellAt(C.target);if(!E)return null;let M=i.rowModel.getRow(E.rowIndex),S=i.columns.getColumn(E.colId);if(!M||!S)return null;let I=D(S.id)?void 0:B(S.def,M.data);return{row:M.data,rowIndex:E.rowIndex,colId:E.colId,value:I,event:C}},d=C=>{let E=C.target.closest?.(".fg-group-toggle, .fg-tree-toggle, .fg-detail-toggle"),M=E&&e.cellAt(C.target);if(!M)return!1;e.gridEl.focus({preventScroll:!0}),i.setFocus(M.rowIndex,M.colId),i.setRange(null);let S=i.rowModel.getRow(M.rowIndex);return E.classList.contains("fg-detail-toggle")?i.setDetailExpanded(S.data,!i.isDetailExpanded(S.data)):i.toggleRow(M.rowIndex),!0},c=C=>{if(d(C))return;let E=i.store.state.focus,M=e.cellAt(C.target);if(M&&i.rowModel.getRow(M.rowIndex)?.kind){M.colId===te&&i.rowModel.getRow(M.rowIndex).kind==="group"&&i.toggleGroupSelection(i.rowModel.getRow(M.rowIndex)),e.gridEl.focus({preventScroll:!0}),i.setFocus(M.rowIndex,M.colId),i.setRange(null);return}let S=l(C);if(!S)return;if(e.gridEl.focus({preventScroll:!0}),S.colId===fe){let F=i.columns.displayed().filter(P=>!D(P.id));F.length&&(i.setFocus(S.rowIndex,F[0].id),i.setRange({start:{rowIndex:S.rowIndex,colId:F[0].id},end:{rowIndex:S.rowIndex,colId:F[F.length-1].id}}));return}let I=a;a=!1;let $=i.store.state.focus,A=S.colId===te;if(!I)if(C.shiftKey&&$&&!A&&!D($.colId)&&i.options.rangeSelection!==!1)i.setRange({start:$,end:{rowIndex:S.rowIndex,colId:S.colId}},!0);else if((C.ctrlKey||C.metaKey)&&!A&&!D(S.colId)&&i.options.rangeSelection!==!1){let F={rowIndex:S.rowIndex,colId:S.colId};i.addRange({start:F,end:F}),i.setFocus(S.rowIndex,S.colId)}else i.setFocus(S.rowIndex,S.colId),i.setRange(null);i.options.rowSelection&&!I&&i.selectFromClick(S.rowIndex,A||C.ctrlKey||C.metaKey,C.shiftKey),i.events.emit("cellClick",S),r==="touch"&&!I&&E&&E.rowIndex===S.rowIndex&&E.colId===S.colId&&i.editor.canEdit(S.rowIndex,S.colId)&&(i.columns.getColumn(S.colId).def.type==="boolean"?i.applyEdit(S.rowIndex,S.colId,S.value!==!0):i.editor.start(S.rowIndex,S.colId))},u=C=>{if(C.target.closest?.("button"))return;let E=e.cellAt(C.target),M=E&&i.rowModel.getRow(E.rowIndex);if(M?.kind==="group"){i.toggleRow(E.rowIndex);return}if(M?.kind)return;let S=l(C);if(!S||(i.events.emit("cellDoubleClick",S),!i.editor.canEdit(S.rowIndex,S.colId)))return;i.columns.getColumn(S.colId).def.type==="boolean"?i.applyEdit(S.rowIndex,S.colId,S.value!==!0):i.editor.start(S.rowIndex,S.colId)},g={...gr};for(let[C,E]of Object.entries(i.options.keymap??{}))g[C]=E===!1?"none":E;let f=C=>{let E=i.store.state.focus,M=g[mr(C)];if(M==="none")return!1;switch(M){case"edit":return!E||!i.editor.canEdit(E.rowIndex,E.colId)||i.columns.getColumn(E.colId).def.type==="boolean"?!1:(i.editor.start(E.rowIndex,E.colId),!0);case"clear":return i.clearCells(),!0;case"undo":return i.undo(),!0;case"redo":return i.redo(),!0;case"copy":return i.copyToClipboard(!1),!0;case"cut":return i.cutToClipboard(),!0;case"selectAll":return i.selectAllCells(),!0;case"find":return i.options.findBar===!1?!1:(i.finder.openBar(),!0);case"paste":return navigator.clipboard?.readText?.().then(I=>i.pasteText(I),()=>{}),!0}if(!E||!i.editor.canEdit(E.rowIndex,E.colId))return!1;let S=i.columns.getColumn(E.colId).def;if(C.key===" "&&S.type==="boolean"&&!C.ctrlKey&&!C.metaKey){let I=i.rowModel.getRow(E.rowIndex).data;return i.applyEdit(E.rowIndex,E.colId,I[S.field]!==!0),!0}return C.key.length===1&&C.key!==" "&&!C.ctrlKey&&!C.metaKey&&!C.altKey&&S.type!=="boolean"?(i.editor.start(E.rowIndex,E.colId,C.key),!0):!1},b=C=>{let E=i.store.state.focus;if(!E||C.ctrlKey||C.metaKey||C.altKey||C.shiftKey)return!1;let M=i.rowModel.getRow(E.rowIndex);if(!i.isExpandable(M))return!1;let S=M.kind==="group";if(!S&&E.colId!==i.columns.displayed().find(A=>!D(A.id))?.id)return!1;let I=!!(M.group?.expanded??M.expanded),$=i.expandKey(M);if(S&&(C.key==="Enter"||C.key===" "))i.setGroupExpanded($,!I);else if(o(C)==="ArrowRight"&&!I)i.setGroupExpanded($,!0);else if(o(C)==="ArrowLeft"&&I)i.setGroupExpanded($,!1);else return!1;return!0},w=C=>{let E=e.cellAt(C.target);if(!E||E.colId!==ve)return!1;C.preventDefault();let M=i.rowModel.getRow(E.rowIndex);if(!M||M.kind||!i.canMoveRows())return!0;let S=M.data,I=x("div","fg-row-drop-marker"),$=null;n.classList.add("fg-row-dragging");let A=P=>{let T=Ae(n,P.clientX,P.clientY),H=T?.closest(".fg-root"),N=H===n?i:_n(H),z=i.dragOptions.group;if($=null,I.remove(),!N||!H||N!==i&&(!z||N.dragOptions.group!==z||!N.options.rowDrag))return;let W=T.closest(".fg-row[data-row]"),G=W?.getBoundingClientRect(),V=null,U="after",Y;if(W&&G){let re=N.rowModel.getRow(Number(W.dataset.row));if(!re||re.kind==="group")return;V=re.detailOf?.data??re.data;let Te=(P.clientY-G.top)/G.height;re.kind==="detail"?U="after":N.options.treeData?U=Te<.25?"before":Te>.75?"after":"inside":U=Te<.5?"before":"after",Y=U==="before"?G.top:G.bottom}else{if(!T.closest(".fg-body"))return;let re=H.querySelectorAll(".fg-body-pane-center .fg-row[data-row]");Y=re.length?Math.max(...[...re].map(Te=>Te.getBoundingClientRect().bottom)):H.querySelector(".fg-body").getBoundingClientRect().top}if(!N.canDropRow(S,V,U,i))return;$={into:N,target:V,position:U};let J=H.getBoundingClientRect().top;I.classList.toggle("fg-row-drop-inside",U==="inside"),I.style.top=`${U==="inside"?G.top-J:Y-J-1}px`,I.style.height=U==="inside"?`${G.height}px`:"",H.append(I)},F=()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",F),window.removeEventListener("pointercancel",F),n.classList.remove("fg-row-dragging"),I.remove(),$&&$.into.dropRow(S,$.target,$.position,i)};return window.addEventListener("pointermove",A),window.addEventListener("pointerup",F),window.addEventListener("pointercancel",F),!0},m=C=>{let E=e.cellAt(C.target);if(!E)return;let M=C.clientX,S=C.clientY,I=()=>{clearTimeout(s),window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I)},$=A=>{Math.hypot(A.clientX-M,A.clientY-S)>8&&I()};clearTimeout(s),s=window.setTimeout(()=>{I(),i.options.contextMenu!==!1&&(a=!0,D(E.colId)||(i.setFocus(E.rowIndex,E.colId),i.rangeContains(E.rowIndex,E.colId)||i.setRange({start:E,end:E})),i.contextMenu.open(M,S,E.rowIndex,E.colId))},550),window.addEventListener("pointermove",$),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I)},h=C=>{if(r=C.pointerType||"mouse",r==="touch"){m(C);return}if(C.button===0&&w(C)||i.options.rangeSelection===!1||C.button!==0||C.shiftKey||C.target.closest("input, a, button"))return;let E=e.cellAt(C.target);if(!E||D(E.colId))return;let M=C.clientX,S=C.clientY,I=C.ctrlKey||C.metaKey,$=!1,A=P=>{if(!$&&Math.hypot(P.clientX-M,P.clientY-S)<wr)return;let T=e.cellAt(Ae(n,P.clientX,P.clientY));!T||D(T.colId)||($||($=!0,n.classList.add("fg-range-dragging"),I&&i.addRange({start:E,end:E}),i.setFocus(E.rowIndex,E.colId)),i.setRange({start:E,end:T},I))},F=()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",F),n.classList.remove("fg-range-dragging"),$&&(a=!0)};window.addEventListener("pointermove",A),window.addEventListener("pointerup",F)},p=C=>{if(C.target!==n&&C.target!==e.gridEl)return;let E=i.columns.displayed(),M=i.rowModel.getRowCount();if(!E.length||!M)return;if(b(C)){C.preventDefault();return}if(f(C)){C.preventDefault();return}let S=i.store.state.focus,I=C.ctrlKey||C.metaKey;if(C.key==="Escape"&&i.store.state.range){C.preventDefault(),i.setRange(null);return}if(I&&C.key.toLowerCase()==="a"&&i.options.rangeSelection!==!1){C.preventDefault(),i.selectAllCells();return}if(C.key==="ContextMenu"||C.key==="F10"&&C.shiftKey){C.preventDefault(),i.contextMenu.openAtFocus();return}if(C.key===" "&&S&&i.options.rowSelection){C.preventDefault(),i.selectFromClick(Math.min(S.rowIndex,M-1),!0,C.shiftKey);return}let $={rows:M,cols:E.length,pageRows:e.pageRows()},A=E.findIndex(H=>!D(H.id));if(i.options.rangeSelection!==!1&&C.shiftKey&&C.key!=="Tab"&&Ot.has(C.key)){let H=S??{rowIndex:0,colId:E[A].id},N=i.store.state.range,z=N?.end??H,W={rowIndex:Math.min(z.rowIndex,M-1),colIndex:Math.max(0,E.findIndex(U=>U.id===z.colId))},G=Ht(o(C),{ctrl:I,shift:!1},W,$);if(!G)return;C.preventDefault();let V=E[Math.max(A,G.colIndex)].id;S||i.setFocus(H.rowIndex,H.colId),i.setRange({start:N?.start??H,end:{rowIndex:G.rowIndex,colId:V}}),e.ensureVisible(G.rowIndex,V);return}let P;if(!S)P=Ot.has(C.key)&&C.key!=="Tab"?{rowIndex:0,colIndex:0}:null;else{let H=Math.max(0,E.findIndex(N=>N.id===S.colId));P=Ht(o(C),{ctrl:I,shift:C.shiftKey},{rowIndex:Math.min(S.rowIndex,M-1),colIndex:H},$)}if(!P)return;C.preventDefault();let T=E[P.colIndex].id;i.setFocus(P.rowIndex,T),i.setRange(null),e.ensureVisible(P.rowIndex,T)},v=C=>C.target?.closest?.(".fg-editor, input, textarea, select, [contenteditable]"),y=C=>C.target?.closest?.(".fg-root")!==n,R=C=>{if(v(C)||y(C))return;let E=i.selectionTSV(!1);!E||!C.clipboardData||(C.clipboardData.setData("text/plain",E),C.preventDefault())},k=C=>{if(v(C)||y(C))return;let E=i.selectionTSV(!1);!E||!C.clipboardData||(C.clipboardData.setData("text/plain",E),C.preventDefault(),i.clearCells(!0))},L=C=>{if(v(C)||y(C))return;let E=C.clipboardData?.getData("text/plain");E&&(C.preventDefault(),i.pasteText(E))};return t.addEventListener("click",c),t.addEventListener("dblclick",u),t.addEventListener("pointerdown",h),n.addEventListener("keydown",p),n.addEventListener("copy",R),n.addEventListener("paste",L),n.addEventListener("cut",k),()=>{t.removeEventListener("click",c),t.removeEventListener("dblclick",u),t.removeEventListener("pointerdown",h),n.removeEventListener("keydown",p),n.removeEventListener("copy",R),n.removeEventListener("paste",L),n.removeEventListener("cut",k)}}var nt=class{constructor(e){this.grid=e;this.open=new Set;this.el=x("div","fg-filters-panel")}refresh(){let{grid:e}=this,t=e.store.state.locale,n=e.store.state.filters,o=x("div","fg-filters-head"),r=x("span","fg-filters-title");r.textContent=t.filters;let s=x("button","fg-btn fg-filters-clear",{type:"button"});s.textContent=t.clearFilters,s.disabled=!Object.keys(n).length,s.addEventListener("click",()=>{for(let l of Object.keys(e.store.state.filters))e.setFilter(l,null)}),o.append(r,s);let a=x("div","fg-filters-list");for(let l of e.columns.displayed()){if(D(l.id)||!oe(l.def))continue;let d=x("details",n[l.id]?"fg-filters-item fg-filter-on":"fg-filters-item");d.dataset.col=l.id,d.open=this.open.has(l.id);let c=x("summary");c.textContent=l.def.header??l.def.field??l.id,d.append(c);let u=()=>{if(d.querySelector(".fg-filter"))return;let g=e.menu.filterSection(l.id,()=>{});g&&d.append(g)};d.open&&u(),d.addEventListener("toggle",()=>{d.open?(this.open.add(l.id),u()):this.open.delete(l.id)}),a.append(d)}this.el.replaceChildren(o,a)}};var yr=["sum","avg","min","max","count"],ot=class{constructor(e){this.grid=e;this.draft={rows:[],columns:[],values:[]};this.el=x("div","fg-pivot-panel")}apply(){this.grid.getPivot()?this.grid.setPivot(this.draft):this.refresh()}refresh(){let{grid:e}=this,t=e.store.state.locale,n=e.getPivot();n&&(this.draft={rows:[...n.rows],columns:[...n.columns??[]],values:n.values.map(d=>({colId:d.colId,aggFunc:typeof d.aggFunc=="string"?d.aggFunc:"sum"}))});let o=e.sourceLeaves(),r=d=>{let c=o.find(u=>u.id===d)?.def;return c?.header??c?.field??d},s=x("label","fg-pivot-mode"),a=x("input","fg-checkbox",{type:"checkbox"});a.checked=!!n,a.addEventListener("click",()=>e.setPivot(a.checked?this.draft:null)),s.append(a,document.createTextNode(t.pivotMode));let l=(d,c)=>{let u=x("div","fg-pivot-zone");u.dataset.zone=d;let g=x("div","fg-pivot-zone-title");g.textContent=c;let f=x("div","fg-pivot-chips"),b=d==="values"?this.draft.values.map(h=>h.colId):this.draft[d];b.forEach((h,p)=>{let v=x("span","fg-group-chip");v.dataset.col=h;let y=x("span","fg-group-chip-label");if(y.textContent=r(h),v.append(y),d==="values"){let k=x("select","fg-pivot-agg",{"aria-label":`${r(h)} ${t.pivotValues}`});for(let L of yr){let C=x("option");C.value=L,C.textContent=t[L],k.append(C)}k.value=this.draft.values[p].aggFunc,k.addEventListener("change",()=>{this.draft.values[p].aggFunc=k.value,this.apply()}),v.append(k)}let R=x("button","fg-group-chip-remove",{type:"button","aria-label":`${t.ungroup}: ${r(h)}`});R.textContent="\xD7",R.addEventListener("click",()=>{d==="values"?this.draft.values.splice(p,1):this.draft[d].splice(p,1),this.apply()}),v.append(R),f.append(v)});let w=x("select","fg-pivot-add",{"aria-label":`${c}: ${t.addColumn}`}),m=x("option");m.value="",m.textContent=t.addColumn,w.append(m);for(let h of o){if(b.includes(h.id)||d==="values"&&h.def.type!=="number")continue;let p=x("option");p.value=h.id,p.textContent=r(h.id),w.append(p)}return w.addEventListener("change",()=>{w.value&&(d==="values"?this.draft.values.push({colId:w.value,aggFunc:"sum"}):this.draft[d].push(w.value),this.apply())}),u.append(g,f,w),u};this.el.replaceChildren(s,l("rows",t.pivotRows),l("columns",t.pivotColumns),l("values",t.pivotValues))}};var br=4,rt=i=>!D(i.id)&&(i.children?i.children.some(rt):i.def.chooser!==!1),Bt=i=>i.def.header??i.def.field??i.id,it=class{constructor(e){this.grid=e;this.collapsed=new Set;this.el=x("div","fg-chooser"),this.search=x("input","fg-input fg-chooser-search",{type:"search"});let t=x("label","fg-chooser-all");this.allBox=x("input","fg-checkbox",{type:"checkbox"}),this.allText=x("span"),t.append(this.allBox,this.allText),this.list=x("div","fg-chooser-list",{role:"tree"}),this.el.append(this.search,t,this.list),this.search.addEventListener("input",()=>this.refresh()),this.allBox.addEventListener("change",()=>this.setVisible(this.matchingLeaves(),this.allBox.checked)),this.list.addEventListener("change",n=>{let o=n.target,r=this.nodeOf(o);r&&this.setVisible(this.leavesOf(r),o.checked)}),this.list.addEventListener("click",n=>{let o=n.target.closest(".fg-chooser-caret"),r=o&&this.nodeOf(o);r&&(this.collapsed.has(r.id)?this.collapsed.delete(r.id):this.collapsed.add(r.id),this.refresh())}),this.list.addEventListener("pointerdown",n=>this.onPointerDown(n)),this.refresh()}refresh(){let e=this.grid.store.state.locale;this.search.placeholder=e.search,this.search.setAttribute("aria-label",e.search),this.allText.textContent=e.selectAll;let t=this.query(),n=[],o=(a,l)=>{for(let d of a)!rt(d)||t&&!this.subtreeMatches(d,t)||(n.push(this.item(d,l)),d.children&&(t||!this.collapsed.has(d.id))&&o(d.children,l+1))};o(this.grid.columns.roots(),0),this.list.replaceChildren(...n);let r=this.matchingLeaves(),s=r.filter(a=>!a.hide).length;this.allBox.checked=r.length>0&&s===r.length,this.allBox.indeterminate=s>0&&s<r.length}query(){return this.search.value.trim().toLowerCase()}subtreeMatches(e,t){for(let n=e;n;n=n.parent)if(Bt(n).toLowerCase().includes(t))return!0;return!!e.children&&e.children.some(n=>rt(n)&&this.subtreeMatches(n,t))}leavesOf(e){return rt(e)?e.children?e.children.flatMap(t=>this.leavesOf(t)):[e]:[]}matchingLeaves(){let e=this.query(),t=this.grid.columns.roots().flatMap(n=>this.leavesOf(n));return e?t.filter(n=>this.subtreeMatches(n,e)):t}nodeOf(e){let t=e.closest(".fg-chooser-item")?.dataset.col;return t?this.grid.columns.getNode(t):void 0}setVisible(e,t){this.grid.setColumnsVisible(e.filter(n=>!n.def.lockVisible).map(n=>n.id),t)}item(e,t){let n=x("div",e.children?"fg-chooser-item fg-chooser-group":"fg-chooser-item",{role:"treeitem"});n.dataset.col=e.id,n.style.paddingLeft=`${6+t*16}px`;let o=x("span","fg-chooser-handle",{"aria-hidden":"true"});if(o.textContent="\u22EE\u22EE",n.append(o),e.children){let d=!this.collapsed.has(e.id),c=x("button","fg-chooser-caret",{type:"button",tabindex:"-1","aria-hidden":"true"});c.textContent=d?"\u25BE":"\u25B8",n.setAttribute("aria-expanded",String(d)),n.append(c)}let r=this.leavesOf(e),s=r.filter(d=>!d.hide).length,a=x("input","fg-checkbox",{type:"checkbox","aria-label":Bt(e)});a.checked=r.length>0&&s===r.length,a.indeterminate=s>0&&s<r.length,a.disabled=r.every(d=>d.def.lockVisible);let l=x("span","fg-chooser-label");if(l.textContent=Bt(e),n.append(a,l),!e.children&&e.pinned){let d=x("span","fg-chooser-pin");d.textContent=e.pinned==="left"?"\u21E4":"\u21E5",n.append(d)}return n}onPointerDown(e){let n=e.target.closest(".fg-chooser-handle")?.closest(".fg-chooser-item"),o=n&&this.nodeOf(n);if(!n||!o||e.button!==0)return;e.preventDefault();let r=new Set(this.grid.columns.siblings(o.id).map(f=>f.id).filter(f=>f!==o.id)),s=[...this.list.querySelectorAll(".fg-chooser-item")].filter(f=>r.has(f.dataset.col)),a=e.clientY,l=!1,d=-1,c=x("div","fg-chooser-marker"),u=f=>{if(!l){if(Math.abs(f.clientY-a)<br||!s.length)return;l=!0,n.classList.add("fg-dragging"),this.list.append(c)}d=s.filter(m=>{let h=m.getBoundingClientRect();return f.clientY>h.top+h.height/2}).length;let b=this.list.getBoundingClientRect().top-this.list.scrollTop,w=d<s.length?s[d].getBoundingClientRect().top:s[s.length-1].getBoundingClientRect().bottom;c.style.top=`${w-b-1}px`},g=()=>{if(window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",g),c.remove(),n.classList.remove("fg-dragging"),!l||d<0)return;let f=this.grid.columns.siblings(o.id).map(m=>m.id).filter(m=>m!==o.id),b=d<s.length?f.indexOf(s[d].dataset.col):f.indexOf(s[s.length-1].dataset.col)+1;b=Math.max(f.filter(D).length,b);let w=this.grid.columns.siblings(o.id).findIndex(m=>m.id===o.id);b!==w&&(this.grid.columns.move(o.id,b),this.grid.layoutChanged(),this.grid.events.emit("columnMove",{colId:o.id,toIndex:b}))};window.addEventListener("pointermove",u),window.addEventListener("pointerup",g)}},st=class{constructor(e){this.grid=e;this.popup=null;this.panel=null;this.off=[]}get isOpen(){return!!this.popup}open(){this.close();let e=this.grid.store.state.locale,t=x("div",`fg-menu fg-chooser-dialog fg-theme-${this.grid.store.state.theme}`,{role:"dialog","aria-label":e.chooseColumns});this.grid.applyFontTo(t);let n=x("div","fg-chooser-head"),o=x("span","fg-menu-title");o.textContent=e.chooseColumns;let r=x("button","fg-chooser-close",{type:"button","aria-label":e.close});r.textContent="\xD7",r.addEventListener("click",()=>this.close()),n.append(o,r),this.panel=new it(this.grid),t.append(n,this.panel.el),ne(this.grid.renderer.root).append(t);let s=this.grid.renderer.root.getBoundingClientRect(),a=t.offsetWidth||280;t.style.left=`${Math.max(4,Math.min(s.right-a-8,window.innerWidth-a-4))}px`,t.style.top=`${Math.max(4,s.top+8)}px`,this.popup=t;let l=c=>{ge(c,t)||this.close()},d=c=>{c.key==="Escape"&&this.close()};document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",d,!0),this.off.push(()=>document.removeEventListener("pointerdown",l,!0),()=>document.removeEventListener("keydown",d,!0)),t.querySelector(".fg-chooser-search").focus()}refresh(){this.panel?.refresh()}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null,this.panel=null}},at=class{constructor(e,t,n=["columns","filters"]){this.grid=e;this.tabs=new Map;this.el=x("div","fg-sidebar"),this.panelHost=x("div","fg-sidebar-panel"),this.columns=new it(e),this.filters=new nt(e),this.pivot=new ot(e);let o=n.filter(s=>s==="columns"||s==="filters"||s==="pivot");o.length||o.push("columns"),this.current=o[0];let r=x("div","fg-sidebar-tabs",{role:"tablist"});for(let s of o){let a=x("button","fg-sidebar-tab",{type:"button",role:"tab"});a.dataset.panel=s,a.addEventListener("click",()=>this.toggle(!(this.isOpen&&this.current===s),s)),this.tabs.set(s,a),r.append(a)}this.el.append(this.panelHost,r),e.renderer.root.append(this.el),this.panelHost.hidden=!t,this.show(),this.refresh()}get isOpen(){return!this.panelHost.hidden}show(){this.panelHost.replaceChildren(this.current==="filters"?this.filters.el:this.current==="pivot"?this.pivot.el:this.columns.el)}toggle(e=!this.isOpen,t){t&&this.tabs.has(t)&&t!==this.current&&(this.current=t,this.show()),this.panelHost.hidden=!e,this.syncTabs(),this.grid.renderer.invalidate({header:!0,rows:!0})}syncTabs(){for(let[e,t]of this.tabs){let n=this.isOpen&&e===this.current;t.setAttribute("aria-expanded",String(n)),t.setAttribute("aria-selected",String(n))}}refresh(){let e=this.grid.store.state.locale;for(let[t,n]of this.tabs)n.textContent=t==="filters"?e.filters:t==="pivot"?e.pivot:e.columns;this.syncTabs(),this.columns.refresh(),this.filters.refresh(),this.pivot.refresh()}};var xr=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||""),ke=i=>xr()?`\u2318${i}`:`Ctrl+${i}`,lt=class{constructor(e){this.grid=e;this.popup=null;this.off=[];let t=e.renderer.root,n=o=>this.onContextMenu(o);t.addEventListener("contextmenu",n),this.detach=()=>t.removeEventListener("contextmenu",n)}destroy(){this.close(),this.detach()}onContextMenu(e){let{grid:t}=this;if(t.options.contextMenu===!1)return;let n=e.target,o=n.closest(".fg-header-cell");if(o){let s=o.dataset.col;if(!s||D(s)||o.classList.contains("fg-header-group"))return;e.preventDefault(),this.close(),t.menu.open(s,o);return}let r=t.renderer.cellAt(n);r&&(e.preventDefault(),t.renderer.gridEl.focus({preventScroll:!0}),!D(r.colId)&&!t.rangeContains(r.rowIndex,r.colId)&&(t.setFocus(r.rowIndex,r.colId),t.setRange({start:r,end:r})),this.open(e.clientX,e.clientY,r.rowIndex,r.colId))}openAtFocus(){let e=this.grid.store.state.focus;if(!e||this.grid.options.contextMenu===!1)return;let t=this.grid.renderer.root.getBoundingClientRect(),o=this.grid.renderer.root.querySelector(`.fg-row[data-row="${e.rowIndex}"] .fg-cell[data-col="${CSS.escape(e.colId)}"]`)?.getBoundingClientRect()??t;this.open(o.left+8,o.bottom,e.rowIndex,e.colId)}defaultItems(e){let{grid:t}=this,n=t.store.state.locale,o=t.columns.getNode(e),r=o?.def,s=!!r&&!D(e),a=[{label:n.copy,shortcut:ke("C"),action:()=>t.copyToClipboard(!1)},{label:n.copyWithHeaders,action:()=>t.copyToClipboard(!0)},{label:n.cut,shortcut:ke("X"),action:()=>t.cutToClipboard()},...t.store.state.selected.size?[{label:n.copyRows,action:()=>t.copyToClipboard(!1,!0)}]:[],{label:n.paste,shortcut:ke("V"),action:()=>this.pasteFromClipboard()}];(t.history.canUndo()||t.history.canRedo())&&a.push("separator",{label:n.undo,shortcut:ke("Z"),action:()=>t.undo(),disabled:!t.history.canUndo()},{label:n.redo,shortcut:ke("Y"),action:()=>t.redo(),disabled:!t.history.canRedo()}),t.options.rowSelection&&t.store.state.selected.size&&a.push({label:n.deleteRows,action:()=>t.api.removeSelectedRows()}),s&&(a.push("separator",{label:n.autosizeThis,action:()=>t.autoSize([e])}),r.lockVisible||a.push({label:n.hideColumn,action:()=>t.setColumnsVisible([e],!1)}),a.push({label:n.pinLeft,action:()=>t.setPinned(e,"left"),disabled:o.pinned==="left"},{label:n.pinRight,action:()=>t.setPinned(e,"right"),disabled:o.pinned==="right"},{label:n.unpin,action:()=>t.setPinned(e,null),disabled:!o.pinned})),a.push("separator"),t.options.rowSelection==="multiple"&&a.push({label:n.selectAllRows,action:()=>t.api.selectAll()}),a.push({label:n.chooseColumns,action:()=>t.chooser.open()});let l=t.rangeBounds();return l&&(l.r2>l.r1||l.c2>l.c1)&&a.push("separator",{label:n.chartBar,action:()=>t.api.createChart({type:"bar"})},{label:n.chartLine,action:()=>t.api.createChart({type:"line"})},{label:n.chartPie,action:()=>t.api.createChart({type:"pie"})}),a.push("separator",{label:n.exportCsv,action:()=>t.api.exportCsv()},{label:n.exportExcel,action:()=>t.api.exportXlsx()}),t.options.advancedFilter!==!1&&!t.options.pivot&&a.push("separator",{label:`${n.advancedFilter}\u2026`,action:()=>t.filterBuilder.open()}),a.push("separator",{label:n.print,action:()=>t.api.print()}),a}pasteFromClipboard(){let e=typeof navigator<"u"?navigator.clipboard:void 0,t=()=>this.grid.toast(this.grid.store.state.locale.pasteHint.replace("Ctrl+V",ke("V")));if(!e?.readText)return t();e.readText().then(n=>this.grid.pasteText(n),t)}open(e,t,n,o){this.close(),this.grid.menu.close();let{grid:r}=this,s=r.rowModel.getRow(n),a=r.columns.getColumn(o),l=this.defaultItems(o),d={row:s?.data??null,rowIndex:n,colId:o,value:s&&a&&!D(o)?B(a.def,s.data):void 0,defaultItems:l},c=r.options.contextMenu,u=l;if(typeof c=="function")try{u=c(d)}catch{u=l}let g=r.store.state.locale,f=x("div",`fg-menu fg-context-menu fg-theme-${r.store.state.theme}`,{role:"menu","aria-label":g.columnMenu});r.applyFontTo(f);let b=!0;for(let y of u){if(y==="separator"){b||f.append(x("div","fg-cm-sep",{role:"separator"})),b=!0;continue}let R=x("button","fg-menu-item fg-cm-item",{type:"button",role:"menuitem"}),k=x("span","fg-cm-label");if(k.textContent=y.label,R.append(k),y.shortcut){let L=x("span","fg-cm-shortcut");L.textContent=y.shortcut,R.append(L)}R.disabled=!!y.disabled,R.addEventListener("click",()=>{this.close(),y.action()}),f.append(R),b=!1}f.lastElementChild?.classList.contains("fg-cm-sep")&&f.lastElementChild.remove(),ne(this.grid.renderer.root).append(f);let w=f.offsetWidth||220,m=f.offsetHeight||300;f.style.left=`${Math.max(4,Math.min(e,window.innerWidth-w-4))}px`,f.style.top=`${Math.max(4,Math.min(t,window.innerHeight-m-4))}px`,this.popup=f;let h=y=>{ge(y,f)||this.close()},p=y=>{if(y.key==="Escape"){this.close(),r.renderer.gridEl.focus();return}if(y.key!=="ArrowDown"&&y.key!=="ArrowUp")return;let R=[...f.querySelectorAll("button:not(:disabled)")],k=R.indexOf(jn(f));R[(k+(y.key==="ArrowDown"?1:R.length-1)+R.length)%R.length]?.focus(),y.preventDefault()},v=()=>this.close();document.addEventListener("pointerdown",h,!0),document.addEventListener("keydown",p,!0),r.renderer.scroller.addEventListener("scroll",v,{passive:!0}),this.off.push(()=>document.removeEventListener("pointerdown",h,!0),()=>document.removeEventListener("keydown",p,!0),()=>r.renderer.scroller.removeEventListener("scroll",v)),f.querySelector("button:not(:disabled)")?.focus()}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var dt=class{constructor(e){this.grid=e;this.onDown=e=>{if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=this.source();if(!t)return;let{grid:n}=this,o=null,r=n.renderer.root,s=l=>{let d=n.renderer.cellAt(Ae(n.renderer.root,l.clientX,l.clientY)),c=d&&n.columns.getColumn(d.colId);if(!d||!c||D(c.id))return;let u=d.rowIndex>t.r2?d.rowIndex-t.r2:d.rowIndex<t.r1?d.rowIndex-t.r1:0,g=c.index>t.c2?c.index-t.c2:c.index<t.c1?c.index-t.c1:0;!u&&!g?o=null:Math.abs(u)>=Math.abs(g)?o={r1:Math.min(t.r1,d.rowIndex),r2:Math.max(t.r2,d.rowIndex),c1:t.c1,c2:t.c2}:o={r1:t.r1,r2:t.r2,c1:Math.min(t.c1,c.index),c2:Math.max(t.c2,c.index)},this.showPreview(o)},a=()=>{if(window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",a),this.preview.remove(),r.classList.remove("fg-range-dragging"),!o)return;let l=n.columns.displayed();n.fillRange({start:{rowIndex:o.r1,colId:l[o.c1].id},end:{rowIndex:o.r2,colId:l[o.c2].id}})};r.classList.add("fg-range-dragging"),window.addEventListener("pointermove",s),window.addEventListener("pointerup",a)};this.handle=x("div","fg-fill-handle",{"aria-hidden":"true"}),this.preview=x("div","fg-fill-preview",{"aria-hidden":"true"}),this.handle.addEventListener("pointerdown",this.onDown)}enabled(){let e=this.grid.options;return e.fillHandle!==!1&&e.rangeSelection!==!1}source(){let e=this.grid.rangeBounds();if(e)return e;let t=this.grid.store.state.focus,n=t&&this.grid.columns.getColumn(t.colId);return!t||!n||D(n.id)?null:{r1:t.rowIndex,r2:t.rowIndex,c1:n.index,c2:n.index}}cellEl(e,t){let n=this.grid.columns.displayed()[t];return n?this.grid.renderer.root.querySelector(`.fg-body .fg-row[data-row="${e}"] .fg-cell[data-col="${CSS.escape(n.id)}"]`):null}update(){let e=this.enabled()?this.source():null,t=this.grid.columns.displayed(),o=!!e&&t.slice(e.c1,e.c2+1).some(a=>a.def.editable&&a.def.field)&&e?this.cellEl(e.r2,e.c2):null;if(!o){this.handle.remove();return}let r=this.grid.renderer.root.getBoundingClientRect(),s=o.getBoundingClientRect();this.handle.style.left=`${(this.grid.renderer.rtl?s.left:s.right)-r.left-4}px`,this.handle.style.top=`${s.bottom-r.top-4}px`,this.handle.isConnected||this.grid.renderer.root.append(this.handle)}showPreview(e){let t=e&&this.cellEl(e.r1,e.c1),n=e&&this.cellEl(e.r2,e.c2);if(!t||!n){this.preview.remove();return}let o=this.grid.renderer.root.getBoundingClientRect(),r=t.getBoundingClientRect(),s=n.getBoundingClientRect();Object.assign(this.preview.style,{left:`${r.left-o.left}px`,top:`${r.top-o.top}px`,width:`${s.right-r.left}px`,height:`${s.bottom-r.top}px`}),this.preview.isConnected||this.grid.renderer.root.append(this.preview)}destroy(){this.handle.remove(),this.preview.remove()}};var Cr=1e4,ct=class{constructor(e){this.grid=e;this.matches=[];this.lookup=new Map;this.index=-1;this.query="";this.bar=null;this.countEl=null}get active(){return!!this.query}classFor(e,t){if(!this.query)return"";let n=this.lookup.get(`${e}|${t}`);return n===void 0?"":n===this.index?" fg-cell-match fg-cell-match-current":" fg-cell-match"}find(e){if(this.query=e.trim().toLowerCase(),this.matches=[],this.lookup.clear(),this.index=-1,this.query){let{grid:t}=this,n=t.store.state.locale.code,o=t.columns.displayed().filter(a=>!D(a.id)),r=o.map(a=>K(a.def,n)),s=t.rowModel.rows();e:for(let a=0;a<s.length;a++)if(!s[a].kind){for(let l=0;l<o.length;l++)if(r[l](B(o[l].def,s[a].data)).toLowerCase().includes(this.query)&&(this.lookup.set(`${a}|${o[l].id}`,this.matches.length),this.matches.push({rowIndex:a,colId:o[l].id}),this.matches.length>=Cr))break e}this.matches.length&&this.go(0)}return this.updateCount(),this.grid.renderer.invalidate({rows:!0}),this.matches.length}refresh(){this.query&&this.find(this.query)}next(){this.matches.length&&this.go((this.index+1)%this.matches.length)}previous(){this.matches.length&&this.go((this.index-1+this.matches.length)%this.matches.length)}clear(){this.query="",this.matches=[],this.lookup.clear(),this.index=-1,this.grid.renderer.invalidate({rows:!0})}go(e){this.index=e;let t=this.matches[e];this.grid.setFocus(t.rowIndex,t.colId),this.grid.renderer.ensureVisible(t.rowIndex,t.colId),this.updateCount(),this.grid.renderer.invalidate({rows:!0})}updateCount(){if(!this.countEl)return;let e=this.grid.store.state.locale;this.countEl.textContent=this.query?this.matches.length?`${this.index+1}/${this.matches.length}`:e.noMatches:""}openBar(){if(this.grid.options.findBar===!1)return;if(this.bar){this.bar.querySelector("input").focus();return}let e=this.grid.store.state.locale,t=x("div","fg-findbar",{role:"search"}),n=x("input","fg-input",{type:"search",placeholder:e.findPlaceholder,"aria-label":e.findPlaceholder});this.countEl=x("span","fg-findbar-count",{"aria-live":"polite"});let o=(r,s,a)=>{let l=x("button","fg-findbar-btn",{type:"button","aria-label":r,title:r});return l.textContent=s,l.addEventListener("click",a),l};t.append(n,this.countEl,o(e.findPrevious,"\u2191",()=>this.previous()),o(e.findNext,"\u2193",()=>this.next()),o(e.close,"\xD7",()=>this.closeBar())),n.addEventListener("input",()=>this.find(n.value)),t.addEventListener("keydown",r=>{r.stopPropagation(),r.key==="Escape"?(r.preventDefault(),this.closeBar()):r.key==="Enter"&&(r.preventDefault(),r.shiftKey?this.previous():this.next())}),this.grid.renderer.root.append(t),this.bar=t,n.focus()}closeBar(){this.bar?.remove(),this.bar=null,this.countEl=null,this.clear(),this.grid.renderer.gridEl.focus({preventScroll:!0})}};var Rr=864e5;function Pe(i,e){if(!i.length||e<=0)return[];let t=()=>Array.from({length:e},(r,s)=>i[s%i.length]);if(i.every(r=>typeof r=="number"&&!Number.isNaN(r))){let r=i;if(r.length===1)return t();let s=r[1]-r[0];if(!r.every((l,d)=>d===0||Math.abs(l-r[d-1]-s)<1e-9))return t();let a=r[r.length-1];return Array.from({length:e},(l,d)=>Math.round((a+s*(d+1))*1e12)/1e12)}let n=i.map(r=>r instanceof Date||typeof r=="string"&&/^\d{4}-\d{2}-\d{2}/.test(r)?ie(r):null);if(n.every(Boolean)&&i.length>=2){let r=n.map(a=>Math.round(a.getTime()/Rr)),s=r[1]-r[0];if(r.every((a,l)=>l===0||a-r[l-1]===s)){let a=n[n.length-1],l=i[i.length-1]instanceof Date;return Array.from({length:e},(d,c)=>{let u=new Date(a.getFullYear(),a.getMonth(),a.getDate()+s*(c+1));return l?u:Q(u)})}return t()}let o=i[i.length-1];if(typeof o=="string"&&!q(o)&&i.every(r=>typeof r=="string")){let r=/^(.*?)(\d+)$/.exec(o);if(r){let s=r[2].length,a=Number(r[2]);return Array.from({length:e},(l,d)=>`${r[1]}${String(a+d+1).padStart(s,"0")}`)}}return t()}function Gt(i){let e=t=>/[\t\n\r"]/.test(t)?`"${t.replace(/"/g,'""')}"`:t;return i.map(t=>t.map(e).join(" ")).join(`\r
2
- `)}function Jn(i){return zt(i," ")}function zt(i,e){if(!i)return[];let t=[],n=[],o="",r=0,s=!1,a=!0;for(;r<i.length;){let l=i[r];if(s){if(l==='"'){if(i[r+1]==='"'){o+='"',r+=2;continue}s=!1,r++;continue}o+=l,r++;continue}if(l==='"'&&a){s=!0,a=!1,r++;continue}if(l===e){n.push(o),o="",a=!0,r++;continue}if(l==="\r"||l===`
3
- `){n.push(o),t.push(n),n=[],o="",a=!0,r+=l==="\r"&&i[r+1]===`
4
- `?2:1;continue}o+=l,a=!1,r++}return(o!==""||n.length||!a)&&(n.push(o),t.push(n)),t}function ut(i,e,t){if(q(e))return"";if(Array.isArray(e))return e.join(", ");switch(i.type){case"number":{let n=typeof e=="number"?e:Number(e);return Number.isNaN(n)?String(e):String(n)}case"date":return Q(e)??String(e);case"boolean":return e===!0?"TRUE":e===!1?"FALSE":String(e);default:return K(i,t)(e)}}var kr=new Set(["true","1","y","yes","\uC608","o","on"]),Sr=new Set(["false","0","n","no","\uC544\uB2C8\uC624","x","off"]);function Mr(i){let e=i.trim();if(!e)return{ok:!0,value:null};let t=!1;/^\(.*\)$/.test(e)&&(t=!0,e=e.slice(1,-1));let n=e.endsWith("%");if(n&&(e=e.slice(0,-1)),e=e.replace(/[\s,₩$€£¥원]/g,""),!/^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i.test(e))return{ok:!1};let o=Number(e);return n&&(o/=100),t&&(o=-o),{ok:!0,value:Math.round(o*1e12)/1e12}}function Yn(i,e,t){let n=new Date(i,e-1,t);return n.getFullYear()===i&&n.getMonth()===e-1&&n.getDate()===t?n:null}function Er(i,e){let t=i.trim();if(!t)return{ok:!0,value:null};let n=null,o=/^(\d{4})\s*[-./년]\s*(\d{1,2})\s*[-./월]\s*(\d{1,2})\s*[.일]?$/.exec(t);return o?n=Yn(+o[1],+o[2],+o[3]):(o=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(t))?n=Yn(+o[3],+o[1],+o[2]):/^\d{4}-\d{2}-\d{2}T/.test(t)&&(n=ie(t)),n?{ok:!0,value:e instanceof Date?n:Q(n)}:{ok:!1}}function ht(i,e,t){switch(i.type){case"number":return Mr(e);case"date":return Er(e,t);case"boolean":{let n=e.trim().toLowerCase();return n?kr.has(n)?{ok:!0,value:!0}:Sr.has(n)?{ok:!0,value:!1}:{ok:!1}:{ok:!0,value:null}}default:return{ok:!0,value:e}}}var Lr=i=>i.map(e=>e!==null&&typeof e=="object"&&"value"in e?e:{value:e,label:String(e),disabled:!1}),be=i=>String(i).padStart(2,"0");function Tr(i){let e=i instanceof Date?i:typeof i=="string"&&i?new Date(i):null;return!e||Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${be(e.getMonth()+1)}-${be(e.getDate())}T${be(e.getHours())}:${be(e.getMinutes())}`}function Ir(i){if(i instanceof Date)return`${be(i.getHours())}:${be(i.getMinutes())}`;let e=typeof i=="string"?/(\d{1,2}):(\d{2})/.exec(i):null;return e?`${be(Number(e[1]))}:${e[2]}`:""}var ft=class{constructor(e){this.grid=e;this.cur=null;this.session=null;e.events.on("focusChange",({rowIndex:t})=>{this.session&&!this.cur&&this.grid.rowModel.getRow(t)?.data!==this.session.row&&this.endRow(!0)})}get rowMode(){return this.grid.options.editType==="row"}editingRow(e){return this.session?.id===e}beginRow(e,t){this.session?.row!==e&&(this.session&&this.endRow(!0),this.session={row:e,id:this.grid.rowModel.idOf(e),before:{...e},undoMark:this.grid.history.mark()},this.grid.renderer.invalidate({rows:!0}),this.grid.events.emit("rowEditStart",{row:e,rowIndex:t}))}endRow(e){let t=this.session;if(!t)return;if(this.cur){if(e&&!this.commit(null))return;e||this.close(!1)}this.session=null;let{grid:n}=this,o=n.rowModel.indexOfId(t.id),r=n.columns.displayed().filter(a=>a.def.field&&!D(a.id));if(!e){let a=[];for(let l of r){let d=l.def.field;Object.is(t.row[d],t.before[d])||n.writeCell(a,t.row,d,l.id,o,t.before[d])}n.endCellTx(a),n.history.rollback(t.undoMark)}let s=r.filter(a=>!Object.is(t.row[a.def.field],t.before[a.def.field])).map(a=>({colId:a.id,oldValue:t.before[a.def.field],newValue:t.row[a.def.field]}));n.renderer.invalidate({rows:!0}),n.events.emit("rowEditStop",{row:t.row,rowIndex:o,committed:e,changes:s})}get active(){return this.cur&&{rowIndex:this.cur.rowIndex,colId:this.cur.colId}}canEdit(e,t){if(D(t))return!1;let n=this.grid.columns.getColumn(t);if(!n?.def.field||e<0||e>=this.grid.rowModel.getRowCount())return!1;let o=this.grid.rowModel.getRow(e);return!o.kind&&ae(n.def,o.data,e)}start(e,t,n){if(this.cur&&!this.commit(null)||!this.canEdit(e,t))return!1;let{grid:o}=this;if(o.veto("beforeEdit",{row:o.rowModel.getRow(e).data,rowIndex:e,colId:t}))return!1;let{renderer:r}=o,a=o.columns.getColumn(t).def,l=o.rowModel.getRow(e).data,d=l[a.field];this.rowMode&&this.beginRow(l,e),o.setFocus(e,t),r.ensureVisible(e,t),r.render();let c=x("div","fg-editor");this.place(c,e,t);let u,g,f=()=>{},b=a.editor;if(typeof b=="function"){let v=b({value:d,row:l,column:a,initialText:n});u=v.el,g=()=>({value:v.getValue()}),f=()=>v.destroy?.(),c.append(u),queueMicrotask(()=>v.focus?.())}else if(b?.type==="select"){let v=Lr(typeof b.options=="function"?b.options(l):b.options),y=x("select","fg-editor-control");v.forEach((R,k)=>{let L=x("option");L.value=String(k),L.textContent=R.label??String(R.value),L.disabled=!!R.disabled,y.append(L)}),y.selectedIndex=Math.max(0,v.findIndex(R=>Object.is(R.value,d))),u=y,g=()=>({value:v[y.selectedIndex]?.value??null}),c.append(y)}else if(b?.type==="time"||b?.type==="datetime"||!b&&a.type==="date"&&a.format==="datetime"){let v=b?.type==="time",y=x("input","fg-editor-control",{type:v?"time":"datetime-local"});y.value=v?Ir(d):Tr(d),u=y,g=()=>y.value?v?{value:y.value}:{value:d instanceof Date?new Date(y.value):y.value}:{value:null},c.append(y)}else{let y=b?.type==="textarea"?x("textarea","fg-editor-control"):x("input","fg-editor-control");y instanceof HTMLInputElement&&(y.type=a.type==="date"&&n===void 0?"date":"text",a.type==="number"&&(y.inputMode="decimal"));let R=a.type==="date"?Q(d)??"":q(d)?"":String(d);y.value=n??R,u=y,g=()=>({text:y.value}),c.append(y)}u.setAttribute("aria-label",a.header??a.field??t);let w=x("div","fg-editor-msg",{role:"alert"});c.append(w);let m=v=>{if(v.stopPropagation(),v.key==="Escape")v.preventDefault(),this.cancel();else if(v.key==="Enter"){if(u instanceof HTMLTextAreaElement&&!(v.ctrlKey||v.metaKey))return;v.preventDefault(),this.commit(v.shiftKey?"up":"down")}else v.key==="Tab"&&(v.preventDefault(),this.commit(v.shiftKey?"left":"right"))},h=v=>{this.cur?.wrap===c&&!c.contains(v.relatedTarget)&&this.commit(null)},p=()=>this.commit(null);return c.addEventListener("keydown",m),c.addEventListener("focusout",h),r.scroller.addEventListener("scroll",p,{passive:!0}),r.root.append(c),this.cur={rowIndex:e,colId:t,row:l,def:a,wrap:c,read:g,dispose:()=>{c.removeEventListener("keydown",m),c.removeEventListener("focusout",h),r.scroller.removeEventListener("scroll",p),f(),c.remove()}},typeof b!="function"&&(u.focus(),n===void 0&&u instanceof HTMLInputElement&&u.type==="text"&&u.select()),o.events.emit("editStart",{rowIndex:e,colId:t}),!0}place(e,t,n){let{renderer:o}=this.grid,r=o.root.querySelector(`.fg-row[data-row="${t}"] .fg-cell[data-col="${CSS.escape(n)}"]`),s=o.root.getBoundingClientRect(),a=r?.getBoundingClientRect();return e.style.left=`${(a?.left??s.left)-s.left}px`,e.style.top=`${(a?.top??s.top)-s.top}px`,e.style.width=`${a?.width||this.grid.columns.getColumn(n)?.width}px`,e.style.height=`${a?.height||o.opts.rowHeight}px`,!!r}indexOf(e){let t=this.grid.rowModel,n=t.indexOfId(t.idOf(e));return n>=0&&t.getRow(n)?.data===e?n:-1}sync(){let e=this.cur;if(!e)return;let t=this.indexOf(e.row);if(t<0)return this.cancel();t!==e.rowIndex&&(e.rowIndex=t,this.grid.setFocus(t,e.colId),this.grid.renderer.render(),this.place(e.wrap,t,e.colId)||this.commit(null))}commit(e){let t=this.cur;if(!t)return!1;let{grid:n}=this,o=n.store.state.locale,r=t.def.field,s=t.row[r],a=t.read(),l;if("text"in a&&t.def.formulas&&Ce(a.text.trim()))l=a.text.trim();else if("text"in a){let u=ht(t.def,a.text,s);if(!u.ok)return this.fail(a.text,o.invalidValue);l=u.value}else l=a.value;let d=n.cellError(t.def,t.row,l);if(d!==null)return this.fail(l,d);let c=this.indexOf(t.row);return c<0?(this.cancel(),!1):(t.rowIndex=c,this.close(!0),n.applyEdit(c,t.colId,l),this.session&&(e==="down"||e==="up")&&this.endRow(!0),this.move(c,t.colId,e),!0)}cancel(){this.close(!1),this.session&&this.endRow(!1)}destroy(){this.cur?.dispose(),this.cur=null,this.session=null}fail(e,t){let n=this.cur;return n.wrap.classList.add("fg-editor-invalid"),n.wrap.querySelector(".fg-editor-msg").textContent=t,this.grid.events.emit("validationFailed",{rowIndex:n.rowIndex,colId:n.colId,value:e,message:t}),!1}close(e){let t=this.cur;t&&(this.cur=null,t.dispose(),this.grid.renderer.gridEl.focus({preventScroll:!0}),this.grid.events.emit("editStop",{rowIndex:t.rowIndex,colId:t.colId,committed:e}))}move(e,t,n){if(!n)return;let{grid:o}=this,r=o.rowModel.getRowCount();if(n==="down"||n==="up"){let c=Math.max(0,Math.min(r-1,e+(n==="down"?1:-1)));o.setFocus(c,t),o.renderer.ensureVisible(c,t);return}let s=o.columns.displayed().filter(c=>this.canEdit(e,c.id)||c.def.editable);if(!s.length)return;let a=n==="right"?1:-1,l=e,d=s.findIndex(c=>c.id===t)+a;d>=s.length&&(d=0,this.session||l++),d<0&&(d=s.length-1,this.session||l--),!(l<0||l>=r)&&this.start(l,s[d].id)}};var pt=class{constructor(e=200){this.limit=e;this.entries=[];this.index=0}push(e){this.entries.splice(this.index),this.entries.push(e),this.entries.length>this.limit&&this.entries.shift(),this.index=this.entries.length}canUndo(){return this.index>0}canRedo(){return this.index<this.entries.length}undo(){return this.canUndo()?(this.entries[--this.index].undo(),!0):!1}redo(){return this.canRedo()?(this.entries[this.index++].redo(),!0):!1}mark(){return this.entries[this.index-1]??null}rollback(e){let t=e?this.entries.indexOf(e)+1:0;this.entries.splice(t),this.index=Math.min(this.index,t)}clear(){this.entries=[],this.index=0}};var Zn=(i,e)=>i instanceof Date&&e instanceof Date?i.getTime()===e.getTime():Object.is(i,e),gt=class{constructor(){this.originals=new Map;this.created=new Set;this.deleted=new Map}beforeChange(e){!this.created.has(e)&&!this.originals.has(e)&&this.originals.set(e,{...e})}isDirty(e,t){if(!t||this.created.has(e))return!1;let n=this.originals.get(e);return!!n&&!Zn(n[t],e[t])}diff(e,t){let n=this.originals.get(e);return n?t.filter(o=>!Zn(n[o],e[o])):[]}commit(e,t){for(let n of t)this.deleted.delete(n);for(let[n,o]of e)this.created.delete(n),this.originals.set(n,{...o})}get size(){return this.originals.size+this.created.size+this.deleted.size}reset(){this.originals.clear(),this.created.clear(),this.deleted.clear()}};function Fe(i){return{r1:Math.min(i.start.rowIndex,i.end.rowIndex),r2:Math.max(i.start.rowIndex,i.end.rowIndex),c1:Math.min(i.start.colIndex,i.end.colIndex),c2:Math.max(i.start.colIndex,i.end.colIndex)}}function Qn(i,e,t){return e>=i.r1&&e<=i.r2&&t>=i.c1&&t<=i.c2}var Dr=5;function eo(i,e){let t=o=>i(o),n=o=>{window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n),e(o)};window.addEventListener("pointermove",t),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n)}function $r(i,e,t){let n=i.columns.getColumn(t);if(!n)return;let o=e.clientX,r=n.width;i.renderer.root.classList.add("fg-resizing"),eo(s=>{i.columns.setWidth(t,r+(s.clientX-o)*(i.renderer.rtl?-1:1)),i.layoutChanged()},()=>{i.renderer.root.classList.remove("fg-resizing");let s=i.columns.getColumn(t)?.width??r;s!==r&&i.events.emit("columnResize",{colId:t,width:s})})}function Ar(i,e){let t=i.columns.getNode(e);return!!i.groupPanel&&!!t&&!t.children&&!i.options.treeData&&!i.getGroupBy().includes(e)}function Pr(i,e,t,n){let o=new Set(i.columns.siblings(e).map(l=>l.id).filter(l=>l!==e&&!D(l))),r=[...n.querySelectorAll(".fg-header-cell")].filter(l=>o.has(l.dataset.col)).map(l=>({id:l.dataset.col,el:l})),s=x("div",`fg-drag-ghost fg-theme-${i.store.state.theme}`);s.textContent=t.querySelector(".fg-header-label")?.textContent??"",i.applyFontTo(s),ne(i.renderer.root).append(s);let a=x("div","fg-drop-marker");return a.style.height=`${i.renderer.headerEl.offsetHeight}px`,i.renderer.root.append(a),t.classList.add("fg-dragging"),{ghost:s,marker:a,cell:t,sibs:r,target:-1,overPanel:!1}}function Fr(i,e,t,n,o){t.ghost.style.transform=`translate(${n+12}px, ${o+8}px)`,t.overPanel=Ar(i,e)&&!!i.groupPanel?.contains(n,o),i.groupPanel?.highlight(t.overPanel),t.marker.hidden=t.overPanel;let r=0;for(let c of t.sibs){let u=c.el.getBoundingClientRect();(i.renderer.rtl?n<u.left+u.width/2:n>u.left+u.width/2)&&r++}t.target=r;let s=i.renderer.root.getBoundingClientRect().left,a=c=>i.renderer.rtl?c.getBoundingClientRect().right:c.getBoundingClientRect().left,l=c=>i.renderer.rtl?c.getBoundingClientRect().left:c.getBoundingClientRect().right,d=r<t.sibs.length?a(t.sibs[r].el):t.sibs.length?l(t.sibs[t.sibs.length-1].el):a(t.cell);t.marker.style.left=`${d-s-1}px`}function Nr(i,e,t){if(t.ghost.remove(),t.marker.remove(),t.cell.classList.remove("fg-dragging"),t.overPanel){i.groupPanel?.highlight(!1),i.setGroupBy([...i.getGroupBy(),e]);return}if(t.target<0||!t.sibs.length)return;let n=i.columns.siblings(e),o=n.findIndex(a=>a.id===e),r=n.map(a=>a.id).filter(a=>a!==e),s=t.target<t.sibs.length?r.indexOf(t.sibs[t.target].id):r.indexOf(t.sibs[t.sibs.length-1].id)+1;s=Math.max(r.filter(D).length,s),s!==o&&(i.columns.move(e,s),i.layoutChanged(),i.events.emit("columnMove",{colId:e,toIndex:s}))}function Or(i,e,t,n){let o=i.columns.getNode(t),r=n.closest(".fg-header-pane");if(!o||!r)return;let s=e.clientX,a=null;eo(l=>{if(!a){if(Math.abs(l.clientX-s)<Dr)return;a=Pr(i,t,n,r)}Fr(i,t,a,l.clientX,l.clientY)},l=>{a?Nr(i,t,a):!o.children&&ye(o.def)&&i.toggleSort(t,l.shiftKey||l.ctrlKey||l.metaKey)})}function to(i){let e=i.renderer.headerEl,t=o=>{if(o.button!==0)return;let r=o.target,s=r.closest(".fg-header-cell"),a=s?.dataset.col;!s||!a||D(a)||r.closest(".fg-menu-btn")||r.closest("button, a, input, select, textarea, [data-fg-no-sort]")&&r.closest(".fg-header-label")||(o.preventDefault(),r.closest(".fg-resize")?$r(i,o,a):Or(i,o,a,s))},n=o=>{let r=o.target,s=r.closest(".fg-menu-btn");if(s){let a=s.closest(".fg-header-cell")?.dataset.col;a&&i.menu.toggle(a,s);return}r.closest(".fg-select-all")&&i.toggleSelectAll()};return e.addEventListener("pointerdown",t),e.addEventListener("click",n),()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("click",n)}}function no(i,e,t){return typeof i=="number"&&typeof e=="number"?i-e:i instanceof Date&&e instanceof Date?i.getTime()-e.getTime():typeof i=="boolean"&&typeof e=="boolean"?Number(i)-Number(e):t.compare(String(i),String(e))}function Hr(i,e){if(q(e))return null;if(i.type==="number"){let t=typeof e=="number"?e:Number(e);return Number.isNaN(t)?null:t}return i.type==="date"?ie(e)?.getTime()??null:e}function de(i,e,t){let n=q(i),o=q(e);return n||o?n===o?0:n?1:-1:no(i,e,t)}function oo(i,e,t,n){let o=e.map(a=>({def:t(a.colId),mul:a.dir==="desc"?-1:1})).filter(a=>!!a.def);if(!o.length)return i;let r=o.map(a=>i.map(l=>{let d=B(a.def,l.data);return a.def.comparator?d:Hr(a.def,d)})),s=i.map((a,l)=>l);return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let{def:c,mul:u}=o[d],g=r[d][a],f=r[d][l],b;if(c.comparator)try{b=(Number(c.comparator(g,f,i[a].data,i[l].data))||0)*u}catch{O(`comparator of column "${c.id??c.field}" threw; treating values as equal`),b=0}else{let w=q(g),m=q(f);b=w||m?w===m?0:w?1:-1:no(g,f,n)*u}if(b)return b}return a-l}),s.map(a=>i[a])}var Br=/^[=+\-@\t\r]/;function ro(i,e=","){let t=n=>{let o=n.value;return n.text&&Br.test(o)&&(o=`'${o}`),o.includes(e)||/["\r\n]/.test(o)||/^\s|\s$/.test(o)?`"${o.replace(/"/g,'""')}"`:o};return i.map(n=>n.map(t).join(e)).join(`\r
5
- `)}function Vt(i){let e=i.slice(0,i.search(/\r?\n|$/)),t=s=>e.split(s).length-1,n=t(" "),o=t(";"),r=t(",");return n&&n>=r&&n>=o?" ":o>r?";":","}function qt(i,e=Vt(i)){return zt(i.replace(/^\uFEFF/,""),e)}var Gr=(()=>{let i=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;i[e]=t>>>0}return i})();function zr(i){let e=4294967295;for(let t=0;t<i.length;t++)e=Gr[(e^i[t])&255]^e>>>8;return(e^4294967295)>>>0}var io=new TextEncoder;function so(i){let e=i.map(c=>{let u=io.encode(c.name),g=typeof c.data=="string"?io.encode(c.data):c.data;return{name:u,data:g,crc:zr(g),offset:0}}),t=e.reduce((c,u)=>c+30+u.name.length+u.data.length,0),n=e.reduce((c,u)=>c+46+u.name.length,0),o=new Uint8Array(t+n+22),r=new DataView(o.buffer),s=0,a=0,l=33;for(let c of e)c.offset=s,r.setUint32(s,67324752,!0),r.setUint16(s+4,20,!0),r.setUint16(s+6,2048,!0),r.setUint16(s+8,0,!0),r.setUint16(s+10,a,!0),r.setUint16(s+12,l,!0),r.setUint32(s+14,c.crc,!0),r.setUint32(s+18,c.data.length,!0),r.setUint32(s+22,c.data.length,!0),r.setUint16(s+26,c.name.length,!0),r.setUint16(s+28,0,!0),o.set(c.name,s+30),o.set(c.data,s+30+c.name.length),s+=30+c.name.length+c.data.length;let d=s;for(let c of e)r.setUint32(s,33639248,!0),r.setUint16(s+4,20,!0),r.setUint16(s+6,20,!0),r.setUint16(s+8,2048,!0),r.setUint16(s+10,0,!0),r.setUint16(s+12,a,!0),r.setUint16(s+14,l,!0),r.setUint32(s+16,c.crc,!0),r.setUint32(s+20,c.data.length,!0),r.setUint32(s+24,c.data.length,!0),r.setUint16(s+28,c.name.length,!0),r.setUint16(s+30,0,!0),r.setUint16(s+32,0,!0),r.setUint16(s+34,0,!0),r.setUint16(s+36,0,!0),r.setUint32(s+38,0,!0),r.setUint32(s+42,c.offset,!0),o.set(c.name,s+46),s+=46+c.name.length;return r.setUint32(s,101010256,!0),r.setUint16(s+8,e.length,!0),r.setUint16(s+10,e.length,!0),r.setUint32(s+12,s-d,!0),r.setUint32(s+16,d,!0),o}var mt=i=>i.length>4&&i[0]===80&&i[1]===75&&i[2]===3&&i[3]===4,ao=i=>new Error(`Zip file is too large: it unpacks to more than ${i>=1048576?`${Math.round(i/1048576)} MB`:`${i} bytes`}`);async function Vr(i,e){if(typeof DecompressionStream>"u")throw new Error("This browser cannot read compressed xlsx files (no DecompressionStream)");let n=new Response(i).body.pipeThrough(new DecompressionStream("deflate-raw")).getReader(),o=[],r=0;for(;;){let{done:l,value:d}=await n.read();if(l)break;if(r+=d.length,r>e)throw await n.cancel().catch(()=>{}),ao(e);o.push(d)}let s=new Uint8Array(r),a=0;for(let l of o)s.set(l,a),a+=l.length;return s}async function lo(i,e={}){let t=e.maxBytes??209715200,n=e.maxEntries??1e4,o=new DataView(i.buffer,i.byteOffset,i.byteLength),r=-1;for(let u=i.length-22;u>=Math.max(0,i.length-65557);u--)if(o.getUint32(u,!0)===101010256){r=u;break}if(r<0)throw new Error("Not a zip file");let s=o.getUint16(r+10,!0);if(s>n)throw new Error(`Zip file has too many entries (${s}, at most ${n})`);let a=o.getUint32(r+16,!0),l=new TextDecoder,d=new Map,c=0;for(let u=0;u<s;u++){if(o.getUint32(a,!0)!==33639248)throw new Error("Broken zip directory");let g=o.getUint16(a+10,!0),f=o.getUint32(a+20,!0),b=o.getUint16(a+28,!0),w=o.getUint16(a+30,!0),m=o.getUint16(a+32,!0),h=o.getUint32(a+42,!0),p=l.decode(i.subarray(a+46,a+46+b)),v=o.getUint16(h+26,!0),y=o.getUint16(h+28,!0),R=h+30+v+y,k=i.subarray(R,R+f),L;if(g===0)L=k;else if(g===8)L=await Vr(k,t-c);else throw new Error(`Unsupported zip compression ${g}`);if(c+=L.length,c>t)throw ao(t);d.set(p,L),a+=46+b+w+m}return d}function Wt(i){let e="";for(let t=i+1;t>0;t=Math.floor((t-1)/26))e=String.fromCharCode(65+(t-1)%26)+e;return e}var co=Date.UTC(1899,11,30),uo=864e5;function qr(i){return(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())-co)/uo}function Wr(i){let e=new Date(Math.round(i*uo)+co);return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())}var Ur=/[\u0000-\u0008\u000b\u000c\u000e-\u001f￾￿]/g,wt=i=>i.replace(Ur,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Se=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
6
- `,Ut="http://schemas.openxmlformats.org/spreadsheetml/2006/main",Me="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Kr(i){let e=new Set;return i.map((t,n)=>{let o=(t.name??`Sheet${n+1}`).replace(/[[\]:*?/\\]/g," ").slice(0,31).trim()||`Sheet${n+1}`,r=o;for(let s=2;e.has(r.toLowerCase());s++)r=`${o.slice(0,28)} (${s})`;return e.add(r.toLowerCase()),r})}function Ee(i){let e=new Map([["General",0]]),t=[],n=['<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>'],o=new Map([["General||||",0]]),r=['<font><sz val="11"/><name val="Calibri"/></font>','<font><b/><sz val="11"/><name val="Calibri"/></font>'],s=new Map([["0|",0],["1|",1]]),a=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>','<fill><patternFill patternType="solid"><fgColor rgb="FFF2F4F7"/><bgColor indexed="64"/></patternFill></fill>'],l=new Map([["FFF2F4F7",2]]),d=h=>h&&/^[0-9a-f]{8}$/i.test(h)?h.toUpperCase():h&&/^[0-9a-f]{6}$/i.test(h)?`FF${h.toUpperCase()}`:"",c=(h,p)=>{let v=`${h?1:0}|${p}`,y=s.get(v);return y===void 0&&(y=r.length,r.push(`<font>${h?"<b/>":""}<sz val="11"/>${p?`<color rgb="${p}"/>`:""}<name val="Calibri"/></font>`),s.set(v,y)),y},u=h=>{if(!h)return 0;let p=l.get(h);return p===void 0&&(p=a.length,a.push(`<fill><patternFill patternType="solid"><fgColor rgb="${h}"/><bgColor indexed="64"/></patternFill></fill>`),l.set(h,p)),p},g=(h,p)=>{let v=d(p.color),y=p.header?"FFF2F4F7":d(p.fill),R=!!(p.bold||p.header),k=p.align==="left"||p.align==="center"||p.align==="right"?p.align:"",L=`${h}|${R?1:""}|${v}|${y}|${k}`,C=o.get(L);if(C!==void 0)return C;let E=e.get(h);E===void 0&&(E=164+t.length,t.push(h),e.set(h,E));let M=c(R,v),S=u(y),I=`numFmtId="${E}" fontId="${M}" fillId="${S}" borderId="0" xfId="0"`+(E?' applyNumberFormat="1"':"")+(M?' applyFont="1"':"")+(S?' applyFill="1"':"")+(k?' applyAlignment="1"':"");return C=n.length,n.push(k?`<xf ${I}><alignment horizontal="${k}"/></xf>`:`<xf ${I}/>`),o.set(L,C),C},f=Kr(i),b=i.map(h=>{let p=h.rows.map((M,S)=>{let I=M.map(($,A)=>{let F=$!==null&&typeof $=="object"&&!($ instanceof Date)?$:{v:$},P=`${Wt(A)}${S+1}`,T=F.v,H=F.fmt??"General";T instanceof Date&&(Number.isNaN(T.getTime())?T=null:(H==="General"&&(H="yyyy-mm-dd"),T=qr(T)));let N=g(H,F),z=N?` s="${N}"`:"";return T==null||T===""?z?`<c r="${P}"${z}/>`:"":typeof T=="number"?Number.isFinite(T)?`<c r="${P}"${z}><v>${T}</v></c>`:"":typeof T=="boolean"?`<c r="${P}"${z} t="b"><v>${T?1:0}</v></c>`:`<c r="${P}"${z} t="inlineStr"><is><t xml:space="preserve">${wt(String(T))}</t></is></c>`}).join("");return`<row r="${S+1}">${I}</row>`}).join(""),v=Math.max(0,...h.rows.map(M=>M.length)),y=h.freezeRows??0,R=y?`<sheetViews><sheetView workbookViewId="0"><pane ySplit="${y}" topLeftCell="A${y+1}" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>`:'<sheetViews><sheetView workbookViewId="0"/></sheetViews>',k=h.widths?.length?`<cols>${h.widths.map((M,S)=>`<col min="${S+1}" max="${S+1}" width="${Math.max(4,Math.min(120,M)).toFixed(1)}" customWidth="1"/>`).join("")}</cols>`:"",L=h.autoFilter&&v&&y&&h.rows.length>=y?`<autoFilter ref="A${y}:${Wt(v-1)}${h.rows.length}"/>`:"",C=(h.merges??[]).filter(M=>typeof M=="string"&&/^[A-Z]{1,3}\d{1,7}:[A-Z]{1,3}\d{1,7}$/.test(M)),E=C.length?`<mergeCells count="${C.length}">${C.map(M=>`<mergeCell ref="${M}"/>`).join("")}</mergeCells>`:"";return`${Se}<worksheet xmlns="${Ut}" xmlns:r="${Me}">${R}<sheetFormatPr defaultRowHeight="15"/>${k}<sheetData>${p}</sheetData>${L}${E}</worksheet>`}),w=`${Se}<styleSheet xmlns="${Ut}">`+(t.length?`<numFmts count="${t.length}">${t.map((h,p)=>`<numFmt numFmtId="${164+p}" formatCode="${wt(h)}"/>`).join("")}</numFmts>`:"")+`<fonts count="${r.length}">${r.join("")}</fonts><fills count="${a.length}">${a.join("")}</fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="${n.length}">${n.join("")}</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`,m=[{name:"[Content_Types].xml",data:`${Se}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>`+i.map((h,p)=>`<Override PartName="/xl/worksheets/sheet${p+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")+"</Types>"},{name:"_rels/.rels",data:`${Se}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${Me}/officeDocument" Target="xl/workbook.xml"/></Relationships>`},{name:"xl/workbook.xml",data:`${Se}<workbook xmlns="${Ut}" xmlns:r="${Me}"><sheets>`+f.map((h,p)=>`<sheet name="${wt(h)}" sheetId="${p+1}" r:id="rId${p+1}"/>`).join("")+"</sheets>"+(i.some(h=>h.autoFilter&&h.freezeRows)?`<definedNames>${i.map((h,p)=>{let v=Math.max(0,...h.rows.map(y=>y.length));return h.autoFilter&&h.freezeRows&&v?`<definedName name="_xlnm._FilterDatabase" localSheetId="${p}" hidden="1">'${wt(f[p].replace(/'/g,"''"))}'!$A$${h.freezeRows}:$${Wt(v-1)}$${h.rows.length}</definedName>`:""}).join("")}</definedNames>`:"")+"</workbook>"},{name:"xl/_rels/workbook.xml.rels",data:`${Se}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`+i.map((h,p)=>`<Relationship Id="rId${p+1}" Type="${Me}/worksheet" Target="worksheets/sheet${p+1}.xml"/>`).join("")+`<Relationship Id="rId${i.length+1}" Type="${Me}/styles" Target="styles.xml"/></Relationships>`},{name:"xl/styles.xml",data:w},...b.map((h,p)=>({name:`xl/worksheets/sheet${p+1}.xml`,data:h}))];return so(m)}var jr=new Set([14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57]);function _r(i){let e=i.replace(/"[^"]*"/g,"").replace(/\[[^\]]*\]/g,"").replace(/\\./g,"");return/[dmyhs]/i.test(e)&&!/^[#0.,%\s]*$/.test(e)}function Ne(i){return i?new DOMParser().parseFromString(new TextDecoder().decode(i),"application/xml"):null}var ce=(i,e)=>[...i.getElementsByTagNameNS("*",e)];function Xr(i){let e=0;for(let t of i){let n=t.charCodeAt(0);if(n<65||n>90)break;e=e*26+(n-64)}return e-1}var Yr=1048576,Jr=16384;async function Kt(i){let e=i instanceof Uint8Array?i:new Uint8Array(i);if(!mt(e))throw new Error("Not an xlsx file");let t=await lo(e),n=Ne(t.get("xl/workbook.xml"));if(!n)throw new Error("xlsx has no workbook");let o=Ne(t.get("xl/_rels/workbook.xml.rels")),r=new Map(o?ce(o,"Relationship").map(f=>[f.getAttribute("Id")??"",f.getAttribute("Target")??""]):[]),s=Ne(t.get("xl/sharedStrings.xml")),a=s?ce(s,"si").map(f=>ce(f,"t").map(b=>b.textContent??"").join("")):[],l=Ne(t.get("xl/styles.xml")),d=new Map(l?ce(l,"numFmt").map(f=>[Number(f.getAttribute("numFmtId")),f.getAttribute("formatCode")??""]):[]),c=l?ce(l,"cellXfs")[0]:void 0,u=(c?[...c.children].filter(f=>f.localName==="xf"):[]).map(f=>{let b=Number(f.getAttribute("numFmtId")??0);return jr.has(b)||d.has(b)&&_r(d.get(b))}),g=[];for(let f of ce(n,"sheet")){let b=f.getAttribute("r:id")??f.getAttributeNS(Me,"id")??"",w=r.get(b)??"";w=w.startsWith("/")?w.slice(1):`xl/${w}`;let m=Ne(t.get(w)),h=[];if(m){for(let p of ce(m,"row")){let v=Number(p.getAttribute("r")??h.length+1)-1;if(!Number.isInteger(v)||v<0||v>=Yr)continue;let y=[],R=0;for(let k of[...p.children].filter(L=>L.localName==="c")){let L=k.getAttribute("r"),C=L?Xr(L):R;if(C<0||C>=Jr)continue;R=C+1;let E=k.getAttribute("t"),M=ce(k,"v")[0]?.textContent??null,S=null;if(E==="s")S=M===null?null:a[Number(M)]??"";else if(E==="inlineStr")S=ce(k,"t").map(I=>I.textContent??"").join("");else if(E==="b")S=M==="1";else if(E==="str"||E==="e")S=M;else if(M!==null&&M!==""){let I=Number(M);S=u[Number(k.getAttribute("s")??0)]?Wr(I):I}y[C]=S}for(let k=0;k<y.length;k++)y[k]===void 0&&(y[k]=null);h[v]=y}for(let p=0;p<h.length;p++)h[p]||(h[p]=[])}g.push({name:f.getAttribute("name")??`Sheet${g.length+1}`,rows:h})}return g}function jt(i,e){return Array.isArray(e)?e.flatMap(t=>{let n=i.columns.getNode(t);return!n||n.children||D(t)?(O(`export: unknown column "${t}"`),[]):[{id:t,def:n.def,node:n,width:i.columns.getColumn(t)?.width??n.width}]}):i.columns.displayed().filter(t=>!D(t.id)).map(t=>({id:t.id,def:t.def,node:t.node,width:t.width}))}function _t(i,e){return e==="selected"?i.selectedRows():e==="all"?i.rowModel.server?i.rowModel.dataRows().map(t=>t.data):i.viewRows():i.rowModel.dataRows().map(t=>t.data)}var Le=(i,e)=>i.header??i.field??e,Zr=["left","center","right"],Qr=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i,ue=i=>String(i??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e]),ei=["A4","A3","A5","B4","B5","letter","legal"],ti=760,ni=i=>`"${i.replace(/[\\"<\n\r]/g,e=>e===`
7
- `?"\\A ":e==="\r"?"":`\\${e.charCodeAt(0).toString(16)} `)}"`,ho=i=>i?`#${i.slice(2)}`:"";function oi(i,e,t){let n=[],o=0,r=i.store.state.sort,s=i.collator(),a=(l,d)=>{if(d>=t.length){for(let b of l)n.push({kind:"row",row:b,n:++o});return}let c=t[d],u=i.columns.getNode(c)?.def;if(!u)return a(l,d+1);let g=new Map;for(let b of l){let w=B(u,b),m=q(w)?"":Z(w),h=g.get(m);h||g.set(m,h={value:w,rows:[]}),h.rows.push(b)}let f=r.find(b=>b.colId===c)?.dir==="desc"?-1:1;for(let b of[...g.values()].sort((w,m)=>de(w.value,m.value,s)*f))n.push({kind:"group",colId:c,value:b.value,rows:b.rows,level:d}),a(b.rows,d+1)};return a(e,0),n}var ri=`
1
+ var Qr={code:"en",noRows:"No rows to show",filter:"Filter",apply:"Apply",reset:"Reset",selectAll:"(Select all)",search:"Search\u2026",blanks:"(Blanks)",value:"Value",valueTo:"To",sortAsc:"Sort ascending",sortDesc:"Sort descending",clearSort:"Clear sort",pinLeft:"Pin left",pinRight:"Pin right",unpin:"Unpin",columnMenu:"Column menu",selectRow:"Select row",selectAllRows:"Select all rows",chooseColumns:"Choose columns",columns:"Columns",autosizeThis:"Autosize this column",autosizeAll:"Autosize all columns",resetColumns:"Reset columns",hideColumn:"Hide column",close:"Close",copy:"Copy",cut:"Cut",copyWithHeaders:"Copy with headers",paste:"Paste",pasteHint:"Clipboard access was blocked. Press Ctrl+V to paste.",required:"This field is required",invalidValue:"Invalid value",and:"And",or:"Or",advancedFilter:"Advanced filter",addCondition:"Add condition",duplicate:"This value is already used",undo:"Undo",redo:"Redo",deleteRows:"Delete selected rows",copyRows:"Copy selected rows",statusRows:"{n} rows",statusFiltered:"{shown} of {total} rows",statusSelected:"{n} selected",count:"Count",sum:"Sum",avg:"Average",min:"Min",max:"Max",findPlaceholder:"Find in grid",noMatches:"No matches",findNext:"Next match",findPrevious:"Previous match",groupPanelHint:"Drag a column header here to group rows",groupByThis:"Group by this column",ungroup:"Remove grouping",expandAll:"Expand all",collapseAll:"Collapse all",pagerRange:"{from}\u2013{to} of {total}",pageOf:"Page {page} of {pages}",pageSize:"Rows per page",firstPage:"First page",previousPage:"Previous page",nextPage:"Next page",lastPage:"Last page",loading:"Loading\u2026",loadFailed:"Could not load rows",filters:"Filters",clearFilters:"Clear all filters",exportCsv:"Export CSV",exportExcel:"Export Excel",print:"Print\u2026",pivot:"Pivot",pivotMode:"Pivot mode",pivotRows:"Row groups",pivotColumns:"Column labels",pivotValues:"Values",total:"Total",addColumn:"Add a column\u2026",chartBar:"Bar chart",chartStacked:"Stacked bar chart",chartLine:"Line chart",chartArea:"Area chart",chartPie:"Pie chart",chartDonut:"Donut chart",chartCombo:"Bar and line chart",chartScatter:"Scatter chart",freeBadge:"Free version",exportPdf:"Export PDF",exportJson:"Export JSON",ai:{title:"AI assistant",placeholder:"Ask about the data or tell the grid what to do",send:"Send",thinking:"Working\u2026",undo:"Undo",undone:"Undone",failed:"The assistant did not answer",skipped:"Skipped",done:"Done"},cf:{title:"Conditional formatting",add:"Add rule",clear:"Clear rules",none:"No rules for this column",type:"Rule",style:"Format",wholeRow:"Whole row",count:"Count",types:{value:"Cell value",formula:"Formula",top:"Top",bottom:"Bottom",aboveAverage:"Above average",belowAverage:"Below average",duplicate:"Duplicate values",unique:"Unique values",dataBar:"Data bars",colorScale:"Color scale",iconSet:"Icon set"},ops:{notBetween:"Not between",notContains:"Does not contain"},styles:{red:"Light red fill",yellow:"Yellow fill",green:"Green fill",blue:"Blue fill",redText:"Red text",bold:"Bold"}},ops:{contains:"Contains",equals:"Equals",notEquals:"Does not equal",startsWith:"Starts with",endsWith:"Ends with",blank:"Blank",notBlank:"Not blank",eq:"Equals",ne:"Does not equal",lt:"Less than",lte:"Less than or equal",gt:"Greater than",gte:"Greater than or equal",between:"Between",before:"Before",after:"After"}},fe=Qr;var co=new Set;function B(o){co.has(o)||(co.add(o),console.warn(`[FreeGrid] ${o}`))}var Me=new Map([["en",fe]]);function pn(o){Me.set(o.code,o)}function uo(o){let e=o.toLowerCase();for(let n of Me.keys())if(n.toLowerCase()===e)return n;let t=e.split("-")[0];if(t==="zh"){if(/-(tw|hk|mo|hant)(-|$)/.test(e)&&Me.has("zh-TW"))return"zh-TW";if(Me.has("zh-CN"))return"zh-CN"}for(let n of Me.keys())if(n.toLowerCase().split("-")[0]===t)return n}function es(){return typeof navigator>"u"?[]:navigator.languages?.length?navigator.languages:navigator.language?[navigator.language]:[]}function ts(o){return{...fe,...o,code:o.code??"en",ops:{...fe.ops,...o.ops??{}}}}function ct(o,e=es()){if(o&&typeof o=="object")return ts(o);if(typeof o=="string"){let t=uo(o);return t?Me.get(t):(B(`locale "${o}" is not registered \u2014 import it from "@freegridjs/core/locales/${o}" and pass the pack (or call registerLocale). Falling back to "en".`),fe)}for(let t of e){let n=uo(t);if(n)return Me.get(n)}return fe}var ns={code:"de",noRows:"Keine Zeilen vorhanden",filter:"Filter",apply:"Anwenden",reset:"Zur\xFCcksetzen",selectAll:"(Alle ausw\xE4hlen)",search:"Suchen\u2026",blanks:"(Leer)",value:"Wert",valueTo:"Bis",sortAsc:"Aufsteigend sortieren",sortDesc:"Absteigend sortieren",clearSort:"Sortierung aufheben",pinLeft:"Links fixieren",pinRight:"Rechts fixieren",unpin:"Fixierung l\xF6sen",columnMenu:"Spaltenmen\xFC",selectRow:"Zeile ausw\xE4hlen",selectAllRows:"Alle Zeilen ausw\xE4hlen",chooseColumns:"Spalten ausw\xE4hlen",columns:"Spalten",autosizeThis:"Diese Spalte automatisch anpassen",autosizeAll:"Alle Spalten automatisch anpassen",resetColumns:"Spalten zur\xFCcksetzen",hideColumn:"Spalte ausblenden",close:"Schlie\xDFen",copy:"Kopieren",cut:"Ausschneiden",copyWithHeaders:"Mit \xDCberschriften kopieren",paste:"Einf\xFCgen",pasteHint:"Der Browser hat die Zwischenablage blockiert. Dr\xFCcken Sie Ctrl+V zum Einf\xFCgen.",required:"Dieses Feld ist erforderlich",invalidValue:"Ung\xFCltiger Wert",and:"Und",or:"Oder",advancedFilter:"Erweiterter Filter",addCondition:"Bedingung hinzuf\xFCgen",duplicate:"Dieser Wert wird bereits verwendet",undo:"R\xFCckg\xE4ngig",redo:"Wiederholen",deleteRows:"Ausgew\xE4hlte Zeilen l\xF6schen",copyRows:"Ausgew\xE4hlte Zeilen kopieren",statusRows:"{n} Zeilen",statusFiltered:"{shown} von {total} Zeilen",statusSelected:"{n} ausgew\xE4hlt",count:"Anzahl",sum:"Summe",avg:"Mittelwert",min:"Min",max:"Max",findPlaceholder:"Im Raster suchen",noMatches:"Keine Treffer",findNext:"N\xE4chster Treffer",findPrevious:"Vorheriger Treffer",groupPanelHint:"Spalten\xFCberschrift hierher ziehen, um zu gruppieren",groupByThis:"Nach dieser Spalte gruppieren",ungroup:"Gruppierung aufheben",expandAll:"Alle aufklappen",collapseAll:"Alle zuklappen",pagerRange:"{from}\u2013{to} von {total}",pageOf:"Seite {page} von {pages}",pageSize:"Zeilen pro Seite",firstPage:"Erste Seite",previousPage:"Vorherige Seite",nextPage:"N\xE4chste Seite",lastPage:"Letzte Seite",loading:"Wird geladen\u2026",loadFailed:"Zeilen konnten nicht geladen werden",filters:"Filter",clearFilters:"Alle Filter entfernen",exportCsv:"Als CSV exportieren",exportExcel:"Nach Excel exportieren",print:"Drucken\u2026",pivot:"Pivot",pivotMode:"Pivot-Modus",pivotRows:"Zeilengruppen",pivotColumns:"Spaltenbeschriftungen",pivotValues:"Werte",total:"Gesamt",addColumn:"Spalte hinzuf\xFCgen\u2026",chartBar:"Balkendiagramm",chartStacked:"Gestapelte Balken",chartLine:"Liniendiagramm",chartArea:"Fl\xE4chendiagramm",chartPie:"Kreisdiagramm",chartDonut:"Ringdiagramm",chartCombo:"Balken- und Liniendiagramm",chartScatter:"Streudiagramm",freeBadge:"Kostenlose Version",exportPdf:"Als PDF exportieren",exportJson:"Als JSON exportieren",ai:{title:"KI-Assistent",placeholder:"Fragen Sie zu den Daten oder sagen Sie der Tabelle, was sie tun soll",send:"Senden",thinking:"Wird bearbeitet\u2026",undo:"R\xFCckg\xE4ngig",undone:"R\xFCckg\xE4ngig gemacht",failed:"Der Assistent hat nicht geantwortet",skipped:"\xDCbersprungen",done:"Fertig"},cf:{title:"Bedingte Formatierung",add:"Regel hinzuf\xFCgen",clear:"Regeln l\xF6schen",none:"Keine Regeln f\xFCr diese Spalte",type:"Regel",style:"Format",wholeRow:"Ganze Zeile",count:"Anzahl",types:{value:"Zellwert",formula:"Formel",top:"Obere",bottom:"Untere",aboveAverage:"\xDCber dem Durchschnitt",belowAverage:"Unter dem Durchschnitt",duplicate:"Doppelte Werte",unique:"Eindeutige Werte",dataBar:"Datenbalken",colorScale:"Farbskala",iconSet:"Symbolsatz"},ops:{notBetween:"Nicht zwischen",notContains:"Enth\xE4lt nicht"},styles:{red:"Hellrote F\xFCllung",yellow:"Gelbe F\xFCllung",green:"Gr\xFCne F\xFCllung",blue:"Blaue F\xFCllung",redText:"Roter Text",bold:"Fett"}},ops:{contains:"Enth\xE4lt",equals:"Gleich",notEquals:"Ungleich",startsWith:"Beginnt mit",endsWith:"Endet mit",blank:"Leer",notBlank:"Nicht leer",eq:"Gleich",ne:"Ungleich",lt:"Kleiner als",lte:"Kleiner oder gleich",gt:"Gr\xF6\xDFer als",gte:"Gr\xF6\xDFer oder gleich",between:"Zwischen",before:"Vor",after:"Nach"}},fo=ns;var os={code:"es",noRows:"No hay filas para mostrar",filter:"Filtro",apply:"Aplicar",reset:"Restablecer",selectAll:"(Seleccionar todo)",search:"Buscar\u2026",blanks:"(Vac\xEDos)",value:"Valor",valueTo:"Hasta",sortAsc:"Orden ascendente",sortDesc:"Orden descendente",clearSort:"Quitar orden",pinLeft:"Fijar a la izquierda",pinRight:"Fijar a la derecha",unpin:"Desfijar",columnMenu:"Men\xFA de columna",selectRow:"Seleccionar fila",selectAllRows:"Seleccionar todas las filas",chooseColumns:"Elegir columnas",columns:"Columnas",autosizeThis:"Ajustar esta columna",autosizeAll:"Ajustar todas las columnas",resetColumns:"Restablecer columnas",hideColumn:"Ocultar columna",close:"Cerrar",copy:"Copiar",cut:"Cortar",copyWithHeaders:"Copiar con encabezados",paste:"Pegar",pasteHint:"El navegador bloque\xF3 el portapapeles. Pulsa Ctrl+V para pegar.",required:"Este campo es obligatorio",invalidValue:"Valor no v\xE1lido",and:"Y",or:"O",advancedFilter:"Filtro avanzado",addCondition:"A\xF1adir condici\xF3n",duplicate:"Este valor ya est\xE1 en uso",undo:"Deshacer",redo:"Rehacer",deleteRows:"Eliminar filas seleccionadas",copyRows:"Copiar filas seleccionadas",statusRows:"{n} filas",statusFiltered:"{shown} de {total} filas",statusSelected:"{n} seleccionadas",count:"Recuento",sum:"Suma",avg:"Promedio",min:"M\xEDn.",max:"M\xE1x.",findPlaceholder:"Buscar en la tabla",noMatches:"Sin coincidencias",findNext:"Siguiente",findPrevious:"Anterior",groupPanelHint:"Arrastre aqu\xED un encabezado de columna para agrupar",groupByThis:"Agrupar por esta columna",ungroup:"Quitar agrupaci\xF3n",expandAll:"Expandir todo",collapseAll:"Contraer todo",pagerRange:"{from}\u2013{to} de {total}",pageOf:"P\xE1gina {page} de {pages}",pageSize:"Filas por p\xE1gina",firstPage:"Primera p\xE1gina",previousPage:"P\xE1gina anterior",nextPage:"P\xE1gina siguiente",lastPage:"\xDAltima p\xE1gina",loading:"Cargando\u2026",loadFailed:"No se pudieron cargar las filas",filters:"Filtros",clearFilters:"Quitar todos los filtros",exportCsv:"Exportar CSV",exportExcel:"Exportar a Excel",print:"Imprimir\u2026",pivot:"Tabla din\xE1mica",pivotMode:"Modo tabla din\xE1mica",pivotRows:"Grupos de filas",pivotColumns:"Etiquetas de columna",pivotValues:"Valores",total:"Total",addColumn:"A\xF1adir columna\u2026",chartBar:"Gr\xE1fico de barras",chartStacked:"Barras apiladas",chartLine:"Gr\xE1fico de l\xEDneas",chartArea:"Gr\xE1fico de \xE1reas",chartPie:"Gr\xE1fico circular",chartDonut:"Gr\xE1fico de anillo",chartCombo:"Gr\xE1fico de barras y l\xEDneas",chartScatter:"Gr\xE1fico de dispersi\xF3n",freeBadge:"Versi\xF3n gratuita",exportPdf:"Exportar PDF",exportJson:"Exportar JSON",ai:{title:"Asistente de IA",placeholder:"Pregunte por los datos o diga a la tabla qu\xE9 hacer",send:"Enviar",thinking:"Procesando\u2026",undo:"Deshacer",undone:"Deshecho",failed:"El asistente no respondi\xF3",skipped:"Omitido",done:"Hecho"},cf:{title:"Formato condicional",add:"A\xF1adir regla",clear:"Borrar reglas",none:"No hay reglas para esta columna",type:"Regla",style:"Formato",wholeRow:"Fila completa",count:"Cantidad",types:{value:"Valor de celda",formula:"F\xF3rmula",top:"Superiores",bottom:"Inferiores",aboveAverage:"Por encima del promedio",belowAverage:"Por debajo del promedio",duplicate:"Valores duplicados",unique:"Valores \xFAnicos",dataBar:"Barras de datos",colorScale:"Escala de color",iconSet:"Conjunto de iconos"},ops:{notBetween:"No est\xE1 entre",notContains:"No contiene"},styles:{red:"Relleno rojo claro",yellow:"Relleno amarillo",green:"Relleno verde",blue:"Relleno azul",redText:"Texto rojo",bold:"Negrita"}},ops:{contains:"Contiene",equals:"Igual a",notEquals:"Distinto de",startsWith:"Empieza por",endsWith:"Termina en",blank:"Vac\xEDo",notBlank:"No vac\xEDo",eq:"Igual a",ne:"Distinto de",lt:"Menor que",lte:"Menor o igual que",gt:"Mayor que",gte:"Mayor o igual que",between:"Entre",before:"Antes de",after:"Despu\xE9s de"}},po=os;var rs={code:"fr",noRows:"Aucune ligne \xE0 afficher",filter:"Filtre",apply:"Appliquer",reset:"R\xE9initialiser",selectAll:"(Tout s\xE9lectionner)",search:"Rechercher\u2026",blanks:"(Vides)",value:"Valeur",valueTo:"\xC0",sortAsc:"Tri croissant",sortDesc:"Tri d\xE9croissant",clearSort:"Annuler le tri",pinLeft:"\xC9pingler \xE0 gauche",pinRight:"\xC9pingler \xE0 droite",unpin:"D\xE9s\xE9pingler",columnMenu:"Menu de colonne",selectRow:"S\xE9lectionner la ligne",selectAllRows:"S\xE9lectionner toutes les lignes",chooseColumns:"Choisir les colonnes",columns:"Colonnes",autosizeThis:"Ajuster cette colonne",autosizeAll:"Ajuster toutes les colonnes",resetColumns:"R\xE9initialiser les colonnes",hideColumn:"Masquer la colonne",close:"Fermer",copy:"Copier",cut:"Couper",copyWithHeaders:"Copier avec les en-t\xEAtes",paste:"Coller",pasteHint:"Le navigateur a bloqu\xE9 le presse-papiers. Appuyez sur Ctrl+V pour coller.",required:"Ce champ est obligatoire",invalidValue:"Valeur non valide",and:"Et",or:"Ou",advancedFilter:"Filtre avanc\xE9",addCondition:"Ajouter une condition",duplicate:"Cette valeur est d\xE9j\xE0 utilis\xE9e",undo:"Annuler",redo:"R\xE9tablir",deleteRows:"Supprimer les lignes s\xE9lectionn\xE9es",copyRows:"Copier les lignes s\xE9lectionn\xE9es",statusRows:"{n} lignes",statusFiltered:"{shown} sur {total} lignes",statusSelected:"{n} s\xE9lectionn\xE9es",count:"Nombre",sum:"Somme",avg:"Moyenne",min:"Min",max:"Max",findPlaceholder:"Rechercher dans la grille",noMatches:"Aucun r\xE9sultat",findNext:"Suivant",findPrevious:"Pr\xE9c\xE9dent",groupPanelHint:"Faites glisser un en-t\xEAte de colonne ici pour regrouper",groupByThis:"Regrouper par cette colonne",ungroup:"Supprimer le regroupement",expandAll:"Tout d\xE9velopper",collapseAll:"Tout r\xE9duire",pagerRange:"{from}\u2013{to} sur {total}",pageOf:"Page {page} sur {pages}",pageSize:"Lignes par page",firstPage:"Premi\xE8re page",previousPage:"Page pr\xE9c\xE9dente",nextPage:"Page suivante",lastPage:"Derni\xE8re page",loading:"Chargement\u2026",loadFailed:"Impossible de charger les lignes",filters:"Filtres",clearFilters:"Effacer tous les filtres",exportCsv:"Exporter en CSV",exportExcel:"Exporter vers Excel",print:"Imprimer\u2026",pivot:"Tableau crois\xE9",pivotMode:"Mode tableau crois\xE9",pivotRows:"Groupes de lignes",pivotColumns:"\xC9tiquettes de colonnes",pivotValues:"Valeurs",total:"Total",addColumn:"Ajouter une colonne\u2026",chartBar:"Histogramme",chartStacked:"Histogramme empil\xE9",chartLine:"Courbes",chartArea:"Aires",chartPie:"Secteurs",chartDonut:"Graphique en anneau",chartCombo:"Graphique barres et lignes",chartScatter:"Nuage de points",freeBadge:"Version gratuite",exportPdf:"Exporter en PDF",exportJson:"Exporter en JSON",ai:{title:"Assistant IA",placeholder:"Posez une question sur les donn\xE9es ou dites \xE0 la grille quoi faire",send:"Envoyer",thinking:"En cours\u2026",undo:"Annuler",undone:"Annul\xE9",failed:"L'assistant n'a pas r\xE9pondu",skipped:"Ignor\xE9",done:"Termin\xE9"},cf:{title:"Mise en forme conditionnelle",add:"Ajouter une r\xE8gle",clear:"Effacer les r\xE8gles",none:"Aucune r\xE8gle pour cette colonne",type:"R\xE8gle",style:"Format",wholeRow:"Ligne enti\xE8re",count:"Nombre",types:{value:"Valeur de la cellule",formula:"Formule",top:"Premiers",bottom:"Derniers",aboveAverage:"Au-dessus de la moyenne",belowAverage:"En dessous de la moyenne",duplicate:"Valeurs en double",unique:"Valeurs uniques",dataBar:"Barres de donn\xE9es",colorScale:"Nuances de couleurs",iconSet:"Jeu d'ic\xF4nes"},ops:{notBetween:"Pas entre",notContains:"Ne contient pas"},styles:{red:"Remplissage rouge clair",yellow:"Remplissage jaune",green:"Remplissage vert",blue:"Remplissage bleu",redText:"Texte rouge",bold:"Gras"}},ops:{contains:"Contient",equals:"\xC9gal \xE0",notEquals:"Diff\xE9rent de",startsWith:"Commence par",endsWith:"Se termine par",blank:"Vide",notBlank:"Non vide",eq:"\xC9gal \xE0",ne:"Diff\xE9rent de",lt:"Inf\xE9rieur \xE0",lte:"Inf\xE9rieur ou \xE9gal \xE0",gt:"Sup\xE9rieur \xE0",gte:"Sup\xE9rieur ou \xE9gal \xE0",between:"Entre",before:"Avant",after:"Apr\xE8s"}},ho=rs;var ss={code:"ja",noRows:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",filter:"\u30D5\u30A3\u30EB\u30BF\u30FC",apply:"\u9069\u7528",reset:"\u30EA\u30BB\u30C3\u30C8",selectAll:"(\u3059\u3079\u3066\u9078\u629E)",search:"\u691C\u7D22\u2026",blanks:"(\u7A7A\u767D)",value:"\u5024",valueTo:"\u7D42\u4E86\u5024",sortAsc:"\u6607\u9806\u3067\u4E26\u3079\u66FF\u3048",sortDesc:"\u964D\u9806\u3067\u4E26\u3079\u66FF\u3048",clearSort:"\u4E26\u3079\u66FF\u3048\u3092\u89E3\u9664",pinLeft:"\u5DE6\u306B\u56FA\u5B9A",pinRight:"\u53F3\u306B\u56FA\u5B9A",unpin:"\u56FA\u5B9A\u3092\u89E3\u9664",columnMenu:"\u5217\u30E1\u30CB\u30E5\u30FC",selectRow:"\u884C\u3092\u9078\u629E",selectAllRows:"\u3059\u3079\u3066\u306E\u884C\u3092\u9078\u629E",chooseColumns:"\u5217\u3092\u9078\u629E",columns:"\u5217",autosizeThis:"\u3053\u306E\u5217\u306E\u5E45\u3092\u81EA\u52D5\u8ABF\u6574",autosizeAll:"\u3059\u3079\u3066\u306E\u5217\u306E\u5E45\u3092\u81EA\u52D5\u8ABF\u6574",resetColumns:"\u5217\u3092\u30EA\u30BB\u30C3\u30C8",hideColumn:"\u5217\u3092\u975E\u8868\u793A",close:"\u9589\u3058\u308B",copy:"\u30B3\u30D4\u30FC",cut:"\u5207\u308A\u53D6\u308A",copyWithHeaders:"\u30D8\u30C3\u30C0\u30FC\u4ED8\u304D\u3067\u30B3\u30D4\u30FC",paste:"\u8CBC\u308A\u4ED8\u3051",pasteHint:"\u30D6\u30E9\u30A6\u30B6\u30FC\u304C\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u3092\u30D6\u30ED\u30C3\u30AF\u3057\u307E\u3057\u305F\u3002Ctrl+V \u3067\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u3002",required:"\u3053\u306E\u9805\u76EE\u306F\u5FC5\u9808\u3067\u3059",invalidValue:"\u7121\u52B9\u306A\u5024\u3067\u3059",and:"\u304B\u3064",or:"\u307E\u305F\u306F",advancedFilter:"\u8A73\u7D30\u30D5\u30A3\u30EB\u30BF\u30FC",addCondition:"\u6761\u4EF6\u3092\u8FFD\u52A0",duplicate:"\u3053\u306E\u5024\u306F\u3059\u3067\u306B\u4F7F\u308F\u308C\u3066\u3044\u307E\u3059",undo:"\u5143\u306B\u623B\u3059",redo:"\u3084\u308A\u76F4\u3057",deleteRows:"\u9078\u629E\u3057\u305F\u884C\u3092\u524A\u9664",copyRows:"\u9078\u629E\u3057\u305F\u884C\u3092\u30B3\u30D4\u30FC",statusRows:"{n} \u884C",statusFiltered:"{total} \u884C\u4E2D {shown} \u884C",statusSelected:"{n} \u4EF6\u9078\u629E",count:"\u30C7\u30FC\u30BF\u306E\u500B\u6570",sum:"\u5408\u8A08",avg:"\u5E73\u5747",min:"\u6700\u5C0F",max:"\u6700\u5927",findPlaceholder:"\u30B0\u30EA\u30C3\u30C9\u5185\u3092\u691C\u7D22",noMatches:"\u4E00\u81F4\u306A\u3057",findNext:"\u6B21\u3092\u691C\u7D22",findPrevious:"\u524D\u3092\u691C\u7D22",groupPanelHint:"\u5217\u898B\u51FA\u3057\u3092\u3053\u3053\u306B\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30B0\u30EB\u30FC\u30D7\u5316",groupByThis:"\u3053\u306E\u5217\u3067\u30B0\u30EB\u30FC\u30D7\u5316",ungroup:"\u30B0\u30EB\u30FC\u30D7\u5316\u3092\u89E3\u9664",expandAll:"\u3059\u3079\u3066\u5C55\u958B",collapseAll:"\u3059\u3079\u3066\u6298\u308A\u305F\u305F\u3080",pagerRange:"{total} \u4EF6\u4E2D {from}\u2013{to} \u4EF6",pageOf:"{pages} \u30DA\u30FC\u30B8\u4E2D {page} \u30DA\u30FC\u30B8",pageSize:"1 \u30DA\u30FC\u30B8\u306E\u884C\u6570",firstPage:"\u6700\u521D\u306E\u30DA\u30FC\u30B8",previousPage:"\u524D\u306E\u30DA\u30FC\u30B8",nextPage:"\u6B21\u306E\u30DA\u30FC\u30B8",lastPage:"\u6700\u5F8C\u306E\u30DA\u30FC\u30B8",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026",loadFailed:"\u884C\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F",filters:"\u30D5\u30A3\u30EB\u30BF\u30FC",clearFilters:"\u3059\u3079\u3066\u306E\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u89E3\u9664",exportCsv:"CSV \u306B\u66F8\u304D\u51FA\u3059",exportExcel:"Excel \u306B\u66F8\u304D\u51FA\u3059",print:"\u5370\u5237\u2026",pivot:"\u30D4\u30DC\u30C3\u30C8",pivotMode:"\u30D4\u30DC\u30C3\u30C8\u30E2\u30FC\u30C9",pivotRows:"\u884C\u30B0\u30EB\u30FC\u30D7",pivotColumns:"\u5217\u30E9\u30D9\u30EB",pivotValues:"\u5024",total:"\u5408\u8A08",addColumn:"\u5217\u3092\u8FFD\u52A0\u2026",chartBar:"\u68D2\u30B0\u30E9\u30D5",chartStacked:"\u7A4D\u307F\u4E0A\u3052\u68D2\u30B0\u30E9\u30D5",chartLine:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",chartArea:"\u9762\u30B0\u30E9\u30D5",chartPie:"\u5186\u30B0\u30E9\u30D5",chartDonut:"\u30C9\u30FC\u30CA\u30C4\u30B0\u30E9\u30D5",chartCombo:"\u68D2\u30FB\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",chartScatter:"\u6563\u5E03\u56F3",freeBadge:"\u7121\u6599\u7248\u3092\u4F7F\u7528\u4E2D",exportPdf:"PDF \u306B\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8",exportJson:"JSON \u306B\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8",ai:{title:"AI \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",placeholder:"\u30C7\u30FC\u30BF\u306B\u3064\u3044\u3066\u8CEA\u554F\u3059\u308B\u304B\u3001\u30B0\u30EA\u30C3\u30C9\u3078\u306E\u6307\u793A\u3092\u5165\u529B",send:"\u9001\u4FE1",thinking:"\u51E6\u7406\u4E2D\u2026",undo:"\u5143\u306B\u623B\u3059",undone:"\u5143\u306B\u623B\u3057\u307E\u3057\u305F",failed:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u304B\u3089\u5FDC\u7B54\u304C\u3042\u308A\u307E\u305B\u3093",skipped:"\u30B9\u30AD\u30C3\u30D7",done:"\u5B8C\u4E86"},cf:{title:"\u6761\u4EF6\u4ED8\u304D\u66F8\u5F0F",add:"\u30EB\u30FC\u30EB\u3092\u8FFD\u52A0",clear:"\u30EB\u30FC\u30EB\u3092\u30AF\u30EA\u30A2",none:"\u3053\u306E\u5217\u306B\u30EB\u30FC\u30EB\u306F\u3042\u308A\u307E\u305B\u3093",type:"\u30EB\u30FC\u30EB",style:"\u66F8\u5F0F",wholeRow:"\u884C\u5168\u4F53",count:"\u4EF6\u6570",types:{value:"\u30BB\u30EB\u306E\u5024",formula:"\u6570\u5F0F",top:"\u4E0A\u4F4D",bottom:"\u4E0B\u4F4D",aboveAverage:"\u5E73\u5747\u3088\u308A\u4E0A",belowAverage:"\u5E73\u5747\u3088\u308A\u4E0B",duplicate:"\u91CD\u8907\u3059\u308B\u5024",unique:"\u4E00\u610F\u306E\u5024",dataBar:"\u30C7\u30FC\u30BF\u30D0\u30FC",colorScale:"\u30AB\u30E9\u30FC\u30B9\u30B1\u30FC\u30EB",iconSet:"\u30A2\u30A4\u30B3\u30F3\u30BB\u30C3\u30C8"},ops:{notBetween:"\u7BC4\u56F2\u5916",notContains:"\u542B\u307E\u306A\u3044"},styles:{red:"\u8584\u3044\u8D64\u306E\u5857\u308A\u3064\u3076\u3057",yellow:"\u9EC4\u8272\u306E\u5857\u308A\u3064\u3076\u3057",green:"\u7DD1\u306E\u5857\u308A\u3064\u3076\u3057",blue:"\u9752\u306E\u5857\u308A\u3064\u3076\u3057",redText:"\u8D64\u306E\u6587\u5B57",bold:"\u592A\u5B57"}},ops:{contains:"\u542B\u3080",equals:"\u7B49\u3057\u3044",notEquals:"\u7B49\u3057\u304F\u306A\u3044",startsWith:"\u3067\u59CB\u307E\u308B",endsWith:"\u3067\u7D42\u308F\u308B",blank:"\u7A7A\u767D",notBlank:"\u7A7A\u767D\u4EE5\u5916",eq:"\u7B49\u3057\u3044",ne:"\u7B49\u3057\u304F\u306A\u3044",lt:"\u3088\u308A\u5C0F\u3055\u3044",lte:"\u4EE5\u4E0B",gt:"\u3088\u308A\u5927\u304D\u3044",gte:"\u4EE5\u4E0A",between:"\u7BC4\u56F2\u5185",before:"\u3088\u308A\u524D",after:"\u3088\u308A\u5F8C"}},mo=ss;var is={code:"ko",noRows:"\uD45C\uC2DC\uD560 \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",filter:"\uD544\uD130",apply:"\uC801\uC6A9",reset:"\uCD08\uAE30\uD654",selectAll:"(\uC804\uCCB4 \uC120\uD0DD)",search:"\uAC80\uC0C9\u2026",blanks:"(\uBE48 \uAC12)",value:"\uAC12",valueTo:"\uB05D \uAC12",sortAsc:"\uC624\uB984\uCC28\uC21C \uC815\uB82C",sortDesc:"\uB0B4\uB9BC\uCC28\uC21C \uC815\uB82C",clearSort:"\uC815\uB82C \uD574\uC81C",pinLeft:"\uC67C\uCABD \uACE0\uC815",pinRight:"\uC624\uB978\uCABD \uACE0\uC815",unpin:"\uACE0\uC815 \uD574\uC81C",columnMenu:"\uCEEC\uB7FC \uBA54\uB274",selectRow:"\uD589 \uC120\uD0DD",selectAllRows:"\uC804\uCCB4 \uD589 \uC120\uD0DD",chooseColumns:"\uCEEC\uB7FC \uC120\uD0DD",columns:"\uCEEC\uB7FC",autosizeThis:"\uC774 \uCEEC\uB7FC \uB108\uBE44 \uC790\uB3D9 \uB9DE\uCDA4",autosizeAll:"\uBAA8\uB4E0 \uCEEC\uB7FC \uB108\uBE44 \uC790\uB3D9 \uB9DE\uCDA4",resetColumns:"\uCEEC\uB7FC \uCD08\uAE30\uD654",hideColumn:"\uCEEC\uB7FC \uC228\uAE30\uAE30",close:"\uB2EB\uAE30",copy:"\uBCF5\uC0AC",cut:"\uC798\uB77C\uB0B4\uAE30",copyWithHeaders:"\uD5E4\uB354 \uD3EC\uD568 \uBCF5\uC0AC",paste:"\uBD99\uC5EC\uB123\uAE30",pasteHint:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uD074\uB9BD\uBCF4\uB4DC \uC811\uADFC\uC744 \uB9C9\uC558\uC2B5\uB2C8\uB2E4. Ctrl+V\uB85C \uBD99\uC5EC\uB123\uC73C\uC138\uC694.",required:"\uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4",invalidValue:"\uC62C\uBC14\uB978 \uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4",and:"\uADF8\uB9AC\uACE0",or:"\uB610\uB294",advancedFilter:"\uACE0\uAE09 \uD544\uD130",addCondition:"\uC870\uAC74 \uCD94\uAC00",duplicate:"\uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC778 \uAC12\uC785\uB2C8\uB2E4",undo:"\uC2E4\uD589 \uCDE8\uC18C",redo:"\uB2E4\uC2DC \uC2E4\uD589",deleteRows:"\uC120\uD0DD\uD55C \uD589 \uC0AD\uC81C",copyRows:"\uC120\uD0DD\uD55C \uD589 \uBCF5\uC0AC",statusRows:"{n}\uD589",statusFiltered:"{total}\uD589 \uC911 {shown}\uD589",statusSelected:"{n}\uAC1C \uC120\uD0DD",count:"\uAC1C\uC218",sum:"\uD569\uACC4",avg:"\uD3C9\uADE0",min:"\uCD5C\uC18C",max:"\uCD5C\uB300",findPlaceholder:"\uADF8\uB9AC\uB4DC\uC5D0\uC11C \uCC3E\uAE30",noMatches:"\uC77C\uCE58 \uD56D\uBAA9 \uC5C6\uC74C",findNext:"\uB2E4\uC74C \uCC3E\uAE30",findPrevious:"\uC774\uC804 \uCC3E\uAE30",groupPanelHint:"\uC5F4 \uBA38\uB9AC\uAE00\uC744 \uC5EC\uAE30\uB85C \uB04C\uC5B4\uC640 \uD589\uC744 \uBB36\uC73C\uC138\uC694",groupByThis:"\uC774 \uC5F4\uB85C \uBB36\uAE30",ungroup:"\uBB36\uAE30 \uD574\uC81C",expandAll:"\uBAA8\uB450 \uD3BC\uCE58\uAE30",collapseAll:"\uBAA8\uB450 \uC811\uAE30",pagerRange:"{total}\uAC1C \uC911 {from}\u2013{to}",pageOf:"{pages}\uCABD \uC911 {page}\uCABD",pageSize:"\uCABD\uB2F9 \uD589 \uC218",firstPage:"\uCCAB \uCABD",previousPage:"\uC774\uC804 \uCABD",nextPage:"\uB2E4\uC74C \uCABD",lastPage:"\uB9C8\uC9C0\uB9C9 \uCABD",loading:"\uBD88\uB7EC\uC624\uB294 \uC911\u2026",loadFailed:"\uD589\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",filters:"\uD544\uD130",clearFilters:"\uD544\uD130 \uBAA8\uB450 \uC9C0\uC6B0\uAE30",exportCsv:"CSV\uB85C \uB0B4\uBCF4\uB0B4\uAE30",exportExcel:"\uC5D1\uC140\uB85C \uB0B4\uBCF4\uB0B4\uAE30",print:"\uC778\uC1C4\u2026",pivot:"\uD53C\uBC97",pivotMode:"\uD53C\uBC97 \uBAA8\uB4DC",pivotRows:"\uD589 \uADF8\uB8F9",pivotColumns:"\uC5F4 \uB808\uC774\uBE14",pivotValues:"\uAC12",total:"\uD569\uACC4",addColumn:"\uCEEC\uB7FC \uCD94\uAC00\u2026",chartBar:"\uB9C9\uB300 \uCC28\uD2B8",chartStacked:"\uB204\uC801 \uB9C9\uB300 \uCC28\uD2B8",chartLine:"\uAEBE\uC740\uC120 \uCC28\uD2B8",chartArea:"\uC601\uC5ED \uCC28\uD2B8",chartPie:"\uC6D0\uD615 \uCC28\uD2B8",chartDonut:"\uB3C4\uB11B \uCC28\uD2B8",chartCombo:"\uB9C9\uB300\xB7\uAEBE\uC740\uC120 \uCC28\uD2B8",chartScatter:"\uBD84\uC0B0\uD615 \uCC28\uD2B8",freeBadge:"\uBB34\uB8CC \uC0AC\uC6A9 \uC911",exportPdf:"PDF\uB85C \uB0B4\uBCF4\uB0B4\uAE30",exportJson:"JSON\uC73C\uB85C \uB0B4\uBCF4\uB0B4\uAE30",ai:{title:"AI \uC5B4\uC2DC\uC2A4\uD134\uD2B8",placeholder:"\uB370\uC774\uD130\uC5D0 \uB300\uD574 \uBB3B\uAC70\uB098 \uADF8\uB9AC\uB4DC\uC5D0 \uD560 \uC77C\uC744 \uB9D0\uD574 \uBCF4\uC138\uC694",send:"\uBCF4\uB0B4\uAE30",thinking:"\uCC98\uB9AC \uC911\u2026",undo:"\uB418\uB3CC\uB9AC\uAE30",undone:"\uB418\uB3CC\uB838\uC2B5\uB2C8\uB2E4",failed:"\uC5B4\uC2DC\uC2A4\uD134\uD2B8\uAC00 \uC751\uB2F5\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4",skipped:"\uAC74\uB108\uB700",done:"\uC644\uB8CC"},cf:{title:"\uC870\uAC74\uBD80 \uC11C\uC2DD",add:"\uADDC\uCE59 \uCD94\uAC00",clear:"\uADDC\uCE59 \uC9C0\uC6B0\uAE30",none:"\uC774 \uCEEC\uB7FC\uC5D0 \uADDC\uCE59\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",type:"\uADDC\uCE59",style:"\uC11C\uC2DD",wholeRow:"\uD589 \uC804\uCCB4",count:"\uAC1C\uC218",types:{value:"\uC140 \uAC12",formula:"\uC218\uC2DD",top:"\uC0C1\uC704",bottom:"\uD558\uC704",aboveAverage:"\uD3C9\uADE0 \uCD08\uACFC",belowAverage:"\uD3C9\uADE0 \uBBF8\uB9CC",duplicate:"\uC911\uBCF5 \uAC12",unique:"\uACE0\uC720 \uAC12",dataBar:"\uB370\uC774\uD130 \uB9C9\uB300",colorScale:"\uC0C9\uC870",iconSet:"\uC544\uC774\uCF58 \uC9D1\uD569"},ops:{notBetween:"\uBC94\uC704 \uBC16",notContains:"\uD3EC\uD568\uD558\uC9C0 \uC54A\uC74C"},styles:{red:"\uC5F0\uD55C \uBE68\uAC15 \uCC44\uC6B0\uAE30",yellow:"\uB178\uB791 \uCC44\uC6B0\uAE30",green:"\uCD08\uB85D \uCC44\uC6B0\uAE30",blue:"\uD30C\uB791 \uCC44\uC6B0\uAE30",redText:"\uBE68\uAC15 \uAE00\uC790",bold:"\uAD75\uAC8C"}},ops:{contains:"\uD3EC\uD568",equals:"\uAC19\uC74C",notEquals:"\uAC19\uC9C0 \uC54A\uC74C",startsWith:"\uC2DC\uC791 \uBB38\uC790",endsWith:"\uB05D \uBB38\uC790",blank:"\uBE48 \uAC12",notBlank:"\uBE48 \uAC12 \uC544\uB2D8",eq:"\uAC19\uC74C",ne:"\uAC19\uC9C0 \uC54A\uC74C",lt:"\uBBF8\uB9CC",lte:"\uC774\uD558",gt:"\uCD08\uACFC",gte:"\uC774\uC0C1",between:"\uBC94\uC704",before:"\uC774\uC804",after:"\uC774\uD6C4"}},go=is;var as={code:"zh-CN",noRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u6570\u636E",filter:"\u7B5B\u9009",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",selectAll:"(\u5168\u9009)",search:"\u641C\u7D22\u2026",blanks:"(\u7A7A\u767D)",value:"\u503C",valueTo:"\u81F3",sortAsc:"\u5347\u5E8F\u6392\u5E8F",sortDesc:"\u964D\u5E8F\u6392\u5E8F",clearSort:"\u6E05\u9664\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5728\u5DE6\u4FA7",pinRight:"\u56FA\u5B9A\u5728\u53F3\u4FA7",unpin:"\u53D6\u6D88\u56FA\u5B9A",columnMenu:"\u5217\u83DC\u5355",selectRow:"\u9009\u62E9\u884C",selectAllRows:"\u9009\u62E9\u6240\u6709\u884C",chooseColumns:"\u9009\u62E9\u5217",columns:"\u5217",autosizeThis:"\u81EA\u52A8\u8C03\u6574\u6B64\u5217\u5BBD\u5EA6",autosizeAll:"\u81EA\u52A8\u8C03\u6574\u6240\u6709\u5217\u5BBD\u5EA6",resetColumns:"\u91CD\u7F6E\u5217",hideColumn:"\u9690\u85CF\u5217",close:"\u5173\u95ED",copy:"\u590D\u5236",cut:"\u526A\u5207",copyWithHeaders:"\u8FDE\u540C\u6807\u9898\u590D\u5236",paste:"\u7C98\u8D34",pasteHint:"\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u526A\u8D34\u677F\u8BBF\u95EE\u3002\u8BF7\u6309 Ctrl+V \u7C98\u8D34\u3002",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879",invalidValue:"\u503C\u65E0\u6548",and:"\u4E14",or:"\u6216",advancedFilter:"\u9AD8\u7EA7\u7B5B\u9009",addCondition:"\u6DFB\u52A0\u6761\u4EF6",duplicate:"\u8BE5\u503C\u5DF2\u88AB\u4F7F\u7528",undo:"\u64A4\u9500",redo:"\u91CD\u505A",deleteRows:"\u5220\u9664\u6240\u9009\u884C",copyRows:"\u590D\u5236\u6240\u9009\u884C",statusRows:"{n} \u884C",statusFiltered:"{total} \u884C\u4E2D\u7684 {shown} \u884C",statusSelected:"\u5DF2\u9009 {n} \u884C",count:"\u8BA1\u6570",sum:"\u6C42\u548C",avg:"\u5E73\u5747\u503C",min:"\u6700\u5C0F\u503C",max:"\u6700\u5927\u503C",findPlaceholder:"\u5728\u8868\u683C\u4E2D\u67E5\u627E",noMatches:"\u65E0\u5339\u914D\u9879",findNext:"\u4E0B\u4E00\u4E2A",findPrevious:"\u4E0A\u4E00\u4E2A",groupPanelHint:"\u5C06\u5217\u6807\u9898\u62D6\u5230\u6B64\u5904\u4EE5\u5206\u7EC4",groupByThis:"\u6309\u6B64\u5217\u5206\u7EC4",ungroup:"\u53D6\u6D88\u5206\u7EC4",expandAll:"\u5168\u90E8\u5C55\u5F00",collapseAll:"\u5168\u90E8\u6298\u53E0",pagerRange:"\u7B2C {from}\u2013{to} \u6761\uFF0C\u5171 {total} \u6761",pageOf:"\u7B2C {page} \u9875\uFF0C\u5171 {pages} \u9875",pageSize:"\u6BCF\u9875\u884C\u6570",firstPage:"\u9996\u9875",previousPage:"\u4E0A\u4E00\u9875",nextPage:"\u4E0B\u4E00\u9875",lastPage:"\u672B\u9875",loading:"\u52A0\u8F7D\u4E2D\u2026",loadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u6570\u636E",filters:"\u7B5B\u9009",clearFilters:"\u6E05\u9664\u6240\u6709\u7B5B\u9009",exportCsv:"\u5BFC\u51FA CSV",exportExcel:"\u5BFC\u51FA Excel",print:"\u6253\u5370\u2026",pivot:"\u6570\u636E\u900F\u89C6",pivotMode:"\u900F\u89C6\u6A21\u5F0F",pivotRows:"\u884C\u5206\u7EC4",pivotColumns:"\u5217\u6807\u7B7E",pivotValues:"\u503C",total:"\u603B\u8BA1",addColumn:"\u6DFB\u52A0\u5217\u2026",chartBar:"\u67F1\u72B6\u56FE",chartStacked:"\u5806\u79EF\u67F1\u72B6\u56FE",chartLine:"\u6298\u7EBF\u56FE",chartArea:"\u9762\u79EF\u56FE",chartPie:"\u997C\u56FE",chartDonut:"\u73AF\u5F62\u56FE",chartCombo:"\u67F1\u7EBF\u7EC4\u5408\u56FE",chartScatter:"\u6563\u70B9\u56FE",freeBadge:"\u514D\u8D39\u4F7F\u7528\u4E2D",exportPdf:"\u5BFC\u51FA PDF",exportJson:"\u5BFC\u51FA JSON",ai:{title:"AI \u52A9\u624B",placeholder:"\u8BE2\u95EE\u6570\u636E\uFF0C\u6216\u544A\u8BC9\u8868\u683C\u8981\u505A\u4EC0\u4E48",send:"\u53D1\u9001",thinking:"\u5904\u7406\u4E2D\u2026",undo:"\u64A4\u9500",undone:"\u5DF2\u64A4\u9500",failed:"\u52A9\u624B\u6CA1\u6709\u56DE\u5E94",skipped:"\u5DF2\u8DF3\u8FC7",done:"\u5B8C\u6210"},cf:{title:"\u6761\u4EF6\u683C\u5F0F",add:"\u6DFB\u52A0\u89C4\u5219",clear:"\u6E05\u9664\u89C4\u5219",none:"\u6B64\u5217\u6CA1\u6709\u89C4\u5219",type:"\u89C4\u5219",style:"\u683C\u5F0F",wholeRow:"\u6574\u884C",count:"\u6570\u91CF",types:{value:"\u5355\u5143\u683C\u503C",formula:"\u516C\u5F0F",top:"\u524D",bottom:"\u540E",aboveAverage:"\u9AD8\u4E8E\u5E73\u5747\u503C",belowAverage:"\u4F4E\u4E8E\u5E73\u5747\u503C",duplicate:"\u91CD\u590D\u503C",unique:"\u552F\u4E00\u503C",dataBar:"\u6570\u636E\u6761",colorScale:"\u8272\u9636",iconSet:"\u56FE\u6807\u96C6"},ops:{notBetween:"\u4E0D\u4ECB\u4E8E",notContains:"\u4E0D\u5305\u542B"},styles:{red:"\u6D45\u7EA2\u8272\u586B\u5145",yellow:"\u9EC4\u8272\u586B\u5145",green:"\u7EFF\u8272\u586B\u5145",blue:"\u84DD\u8272\u586B\u5145",redText:"\u7EA2\u8272\u6587\u672C",bold:"\u52A0\u7C97"}},ops:{contains:"\u5305\u542B",equals:"\u7B49\u4E8E",notEquals:"\u4E0D\u7B49\u4E8E",startsWith:"\u5F00\u5934\u662F",endsWith:"\u7ED3\u5C3E\u662F",blank:"\u4E3A\u7A7A",notBlank:"\u4E0D\u4E3A\u7A7A",eq:"\u7B49\u4E8E",ne:"\u4E0D\u7B49\u4E8E",lt:"\u5C0F\u4E8E",lte:"\u5C0F\u4E8E\u6216\u7B49\u4E8E",gt:"\u5927\u4E8E",gte:"\u5927\u4E8E\u6216\u7B49\u4E8E",between:"\u4ECB\u4E8E",before:"\u65E9\u4E8E",after:"\u665A\u4E8E"}},wo=as;var ls={code:"zh-TW",noRows:"\u6C92\u6709\u53EF\u986F\u793A\u7684\u8CC7\u6599",filter:"\u7BE9\u9078",apply:"\u5957\u7528",reset:"\u91CD\u8A2D",selectAll:"(\u5168\u9078)",search:"\u641C\u5C0B\u2026",blanks:"(\u7A7A\u767D)",value:"\u503C",valueTo:"\u81F3",sortAsc:"\u905E\u589E\u6392\u5E8F",sortDesc:"\u905E\u6E1B\u6392\u5E8F",clearSort:"\u6E05\u9664\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5728\u5DE6\u5074",pinRight:"\u56FA\u5B9A\u5728\u53F3\u5074",unpin:"\u53D6\u6D88\u56FA\u5B9A",columnMenu:"\u6B04\u4F4D\u9078\u55AE",selectRow:"\u9078\u53D6\u5217",selectAllRows:"\u9078\u53D6\u6240\u6709\u5217",chooseColumns:"\u9078\u64C7\u6B04\u4F4D",columns:"\u6B04\u4F4D",autosizeThis:"\u81EA\u52D5\u8ABF\u6574\u6B64\u6B04\u5BEC",autosizeAll:"\u81EA\u52D5\u8ABF\u6574\u6240\u6709\u6B04\u5BEC",resetColumns:"\u91CD\u8A2D\u6B04\u4F4D",hideColumn:"\u96B1\u85CF\u6B04\u4F4D",close:"\u95DC\u9589",copy:"\u8907\u88FD",cut:"\u526A\u4E0B",copyWithHeaders:"\u9023\u540C\u6A19\u984C\u8907\u88FD",paste:"\u8CBC\u4E0A",pasteHint:"\u7121\u6CD5\u5B58\u53D6\u526A\u8CBC\u7C3F\u3002\u8ACB\u6309 Ctrl+V \u8CBC\u4E0A\u3002",required:"\u6B64\u6B04\u4F4D\u70BA\u5FC5\u586B",invalidValue:"\u503C\u7121\u6548",and:"\u4E14",or:"\u6216",advancedFilter:"\u9032\u968E\u7BE9\u9078",addCondition:"\u65B0\u589E\u689D\u4EF6",duplicate:"\u6B64\u503C\u5DF2\u88AB\u4F7F\u7528",undo:"\u5FA9\u539F",redo:"\u91CD\u505A",deleteRows:"\u522A\u9664\u9078\u53D6\u7684\u5217",copyRows:"\u8907\u88FD\u9078\u53D6\u7684\u5217",statusRows:"{n} \u5217",statusFiltered:"{total} \u5217\u4E2D\u7684 {shown} \u5217",statusSelected:"\u5DF2\u9078\u53D6 {n} \u5217",count:"\u7B46\u6578",sum:"\u5408\u8A08",avg:"\u5E73\u5747",min:"\u6700\u5C0F",max:"\u6700\u5927",findPlaceholder:"\u5728\u8868\u683C\u4E2D\u5C0B\u627E",noMatches:"\u6C92\u6709\u7B26\u5408\u7684\u7D50\u679C",findNext:"\u4E0B\u4E00\u500B",findPrevious:"\u4E0A\u4E00\u500B",groupPanelHint:"\u5C07\u6B04\u4F4D\u6A19\u984C\u62D6\u66F3\u5230\u9019\u88E1\u4EE5\u5206\u7D44",groupByThis:"\u4F9D\u6B64\u6B04\u4F4D\u5206\u7D44",ungroup:"\u53D6\u6D88\u5206\u7D44",expandAll:"\u5168\u90E8\u5C55\u958B",collapseAll:"\u5168\u90E8\u647A\u758A",pagerRange:"{from}\u2013{to}\uFF0C\u5171 {total} \u7B46",pageOf:"\u7B2C {page} \u9801\uFF0C\u5171 {pages} \u9801",pageSize:"\u6BCF\u9801\u5217\u6578",firstPage:"\u7B2C\u4E00\u9801",previousPage:"\u4E0A\u4E00\u9801",nextPage:"\u4E0B\u4E00\u9801",lastPage:"\u6700\u5F8C\u4E00\u9801",loading:"\u8F09\u5165\u4E2D\u2026",loadFailed:"\u7121\u6CD5\u8F09\u5165\u8CC7\u6599",filters:"\u7BE9\u9078",clearFilters:"\u6E05\u9664\u6240\u6709\u7BE9\u9078",exportCsv:"\u532F\u51FA CSV",exportExcel:"\u532F\u51FA Excel",print:"\u5217\u5370\u2026",pivot:"\u6A1E\u7D10\u5206\u6790",pivotMode:"\u6A1E\u7D10\u5206\u6790\u6A21\u5F0F",pivotRows:"\u5217\u7FA4\u7D44",pivotColumns:"\u6B04\u6A19\u7C64",pivotValues:"\u503C",total:"\u7E3D\u8A08",addColumn:"\u65B0\u589E\u6B04\u4F4D\u2026",chartBar:"\u76F4\u689D\u5716",chartStacked:"\u5806\u758A\u76F4\u689D\u5716",chartLine:"\u6298\u7DDA\u5716",chartArea:"\u5340\u57DF\u5716",chartPie:"\u5713\u5F62\u5716",chartDonut:"\u74B0\u5708\u5716",chartCombo:"\u76F4\u689D\u8207\u6298\u7DDA\u5716",chartScatter:"\u6563\u4F48\u5716",freeBadge:"\u514D\u8CBB\u7248",exportPdf:"\u532F\u51FA PDF",exportJson:"\u532F\u51FA JSON",ai:{title:"AI \u52A9\u7406",placeholder:"\u8A62\u554F\u8CC7\u6599\uFF0C\u6216\u544A\u8A34\u8868\u683C\u8981\u505A\u4EC0\u9EBC",send:"\u50B3\u9001",thinking:"\u8655\u7406\u4E2D\u2026",undo:"\u5FA9\u539F",undone:"\u5DF2\u5FA9\u539F",failed:"\u52A9\u7406\u6C92\u6709\u56DE\u61C9",skipped:"\u5DF2\u7565\u904E",done:"\u5B8C\u6210"},cf:{title:"\u8A2D\u5B9A\u683C\u5F0F\u5316\u7684\u689D\u4EF6",add:"\u65B0\u589E\u898F\u5247",clear:"\u6E05\u9664\u898F\u5247",none:"\u6B64\u6B04\u6C92\u6709\u898F\u5247",type:"\u898F\u5247",style:"\u683C\u5F0F",wholeRow:"\u6574\u5217",count:"\u6578\u91CF",types:{value:"\u5132\u5B58\u683C\u503C",formula:"\u516C\u5F0F",top:"\u524D",bottom:"\u5F8C",aboveAverage:"\u9AD8\u65BC\u5E73\u5747",belowAverage:"\u4F4E\u65BC\u5E73\u5747",duplicate:"\u91CD\u8907\u503C",unique:"\u552F\u4E00\u503C",dataBar:"\u8CC7\u6599\u6A6B\u689D",colorScale:"\u8272\u968E",iconSet:"\u5716\u793A\u96C6"},ops:{notBetween:"\u4E0D\u4ECB\u65BC",notContains:"\u4E0D\u5305\u542B"},styles:{red:"\u6DFA\u7D05\u8272\u586B\u6EFF",yellow:"\u9EC3\u8272\u586B\u6EFF",green:"\u7DA0\u8272\u586B\u6EFF",blue:"\u85CD\u8272\u586B\u6EFF",redText:"\u7D05\u8272\u6587\u5B57",bold:"\u7C97\u9AD4"}},ops:{contains:"\u5305\u542B",equals:"\u7B49\u65BC",notEquals:"\u4E0D\u7B49\u65BC",startsWith:"\u958B\u982D\u70BA",endsWith:"\u7D50\u5C3E\u70BA",blank:"\u7A7A\u767D",notBlank:"\u975E\u7A7A\u767D",eq:"\u7B49\u65BC",ne:"\u4E0D\u7B49\u65BC",lt:"\u5C0F\u65BC",lte:"\u5C0F\u65BC\u6216\u7B49\u65BC",gt:"\u5927\u65BC",gte:"\u5927\u65BC\u6216\u7B49\u65BC",between:"\u4ECB\u65BC",before:"\u65E9\u65BC",after:"\u665A\u65BC"}},yo=ls;var ds={code:"vi",noRows:"Kh\xF4ng c\xF3 d\u1EEF li\u1EC7u",filter:"L\u1ECDc",apply:"\xC1p d\u1EE5ng",reset:"\u0110\u1EB7t l\u1EA1i",selectAll:"(Ch\u1ECDn t\u1EA5t c\u1EA3)",search:"T\xECm\u2026",blanks:"(Tr\u1ED1ng)",value:"Gi\xE1 tr\u1ECB",valueTo:"\u0110\u1EBFn",sortAsc:"S\u1EAFp x\u1EBFp t\u0103ng d\u1EA7n",sortDesc:"S\u1EAFp x\u1EBFp gi\u1EA3m d\u1EA7n",clearSort:"B\u1ECF s\u1EAFp x\u1EBFp",pinLeft:"Ghim tr\xE1i",pinRight:"Ghim ph\u1EA3i",unpin:"B\u1ECF ghim",columnMenu:"Menu c\u1ED9t",selectRow:"Ch\u1ECDn d\xF2ng",selectAllRows:"Ch\u1ECDn t\u1EA5t c\u1EA3 d\xF2ng",chooseColumns:"Ch\u1ECDn c\u1ED9t",columns:"C\u1ED9t",autosizeThis:"T\u1EF1 \u0111\u1ED9ng ch\u1EC9nh \u0111\u1ED9 r\u1ED9ng c\u1ED9t n\xE0y",autosizeAll:"T\u1EF1 \u0111\u1ED9ng ch\u1EC9nh \u0111\u1ED9 r\u1ED9ng t\u1EA5t c\u1EA3 c\u1ED9t",resetColumns:"\u0110\u1EB7t l\u1EA1i c\u1ED9t",hideColumn:"\u1EA8n c\u1ED9t",close:"\u0110\xF3ng",copy:"Sao ch\xE9p",cut:"C\u1EAFt",copyWithHeaders:"Sao ch\xE9p k\xE8m ti\xEAu \u0111\u1EC1",paste:"D\xE1n",pasteHint:"Kh\xF4ng truy c\u1EADp \u0111\u01B0\u1EE3c b\u1ED9 nh\u1EDB t\u1EA1m. Nh\u1EA5n Ctrl+V \u0111\u1EC3 d\xE1n.",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c",invalidValue:"Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7",and:"V\xE0",or:"Ho\u1EB7c",advancedFilter:"L\u1ECDc n\xE2ng cao",addCondition:"Th\xEAm \u0111i\u1EC1u ki\u1EC7n",duplicate:"Gi\xE1 tr\u1ECB n\xE0y \u0111\xE3 \u0111\u01B0\u1EE3c d\xF9ng",undo:"Ho\xE0n t\xE1c",redo:"L\xE0m l\u1EA1i",deleteRows:"X\xF3a c\xE1c d\xF2ng \u0111\xE3 ch\u1ECDn",copyRows:"Sao ch\xE9p c\xE1c d\xF2ng \u0111\xE3 ch\u1ECDn",statusRows:"{n} d\xF2ng",statusFiltered:"{shown} / {total} d\xF2ng",statusSelected:"\u0110\xE3 ch\u1ECDn {n}",count:"S\u1ED1 l\u01B0\u1EE3ng",sum:"T\u1ED5ng",avg:"Trung b\xECnh",min:"Nh\u1ECF nh\u1EA5t",max:"L\u1EDBn nh\u1EA5t",findPlaceholder:"T\xECm trong b\u1EA3ng",noMatches:"Kh\xF4ng t\xECm th\u1EA5y",findNext:"K\u1EBFt qu\u1EA3 ti\u1EBFp",findPrevious:"K\u1EBFt qu\u1EA3 tr\u01B0\u1EDBc",groupPanelHint:"K\xE9o ti\xEAu \u0111\u1EC1 c\u1ED9t v\xE0o \u0111\xE2y \u0111\u1EC3 nh\xF3m d\xF2ng",groupByThis:"Nh\xF3m theo c\u1ED9t n\xE0y",ungroup:"B\u1ECF nh\xF3m",expandAll:"M\u1EDF r\u1ED9ng t\u1EA5t c\u1EA3",collapseAll:"Thu g\u1ECDn t\u1EA5t c\u1EA3",pagerRange:"{from}\u2013{to} / {total}",pageOf:"Trang {page} / {pages}",pageSize:"S\u1ED1 d\xF2ng m\u1ED7i trang",firstPage:"Trang \u0111\u1EA7u",previousPage:"Trang tr\u01B0\u1EDBc",nextPage:"Trang sau",lastPage:"Trang cu\u1ED1i",loading:"\u0110ang t\u1EA3i\u2026",loadFailed:"Kh\xF4ng t\u1EA3i \u0111\u01B0\u1EE3c d\u1EEF li\u1EC7u",filters:"B\u1ED9 l\u1ECDc",clearFilters:"X\xF3a t\u1EA5t c\u1EA3 b\u1ED9 l\u1ECDc",exportCsv:"Xu\u1EA5t CSV",exportExcel:"Xu\u1EA5t Excel",print:"In\u2026",pivot:"Pivot",pivotMode:"Ch\u1EBF \u0111\u1ED9 pivot",pivotRows:"Nh\xF3m d\xF2ng",pivotColumns:"Nh\xE3n c\u1ED9t",pivotValues:"Gi\xE1 tr\u1ECB",total:"T\u1ED5ng c\u1ED9ng",addColumn:"Th\xEAm c\u1ED9t\u2026",chartBar:"Bi\u1EC3u \u0111\u1ED3 c\u1ED9t",chartStacked:"Bi\u1EC3u \u0111\u1ED3 c\u1ED9t ch\u1ED3ng",chartLine:"Bi\u1EC3u \u0111\u1ED3 \u0111\u01B0\u1EDDng",chartArea:"Bi\u1EC3u \u0111\u1ED3 v\xF9ng",chartPie:"Bi\u1EC3u \u0111\u1ED3 tr\xF2n",chartDonut:"Bi\u1EC3u \u0111\u1ED3 v\xE0nh khuy\xEAn",chartCombo:"Bi\u1EC3u \u0111\u1ED3 c\u1ED9t v\xE0 \u0111\u01B0\u1EDDng",chartScatter:"Bi\u1EC3u \u0111\u1ED3 ph\xE2n t\xE1n",freeBadge:"B\u1EA3n mi\u1EC5n ph\xED",exportPdf:"Xu\u1EA5t PDF",exportJson:"Xu\u1EA5t JSON",ai:{title:"Tr\u1EE3 l\xFD AI",placeholder:"H\u1ECFi v\u1EC1 d\u1EEF li\u1EC7u ho\u1EB7c b\u1EA3o b\u1EA3ng c\u1EA7n l\xE0m g\xEC",send:"G\u1EEDi",thinking:"\u0110ang x\u1EED l\xFD\u2026",undo:"Ho\xE0n t\xE1c",undone:"\u0110\xE3 ho\xE0n t\xE1c",failed:"Tr\u1EE3 l\xFD kh\xF4ng ph\u1EA3n h\u1ED3i",skipped:"\u0110\xE3 b\u1ECF qua",done:"Xong"},cf:{title:"\u0110\u1ECBnh d\u1EA1ng c\xF3 \u0111i\u1EC1u ki\u1EC7n",add:"Th\xEAm quy t\u1EAFc",clear:"X\xF3a quy t\u1EAFc",none:"C\u1ED9t n\xE0y ch\u01B0a c\xF3 quy t\u1EAFc",type:"Quy t\u1EAFc",style:"\u0110\u1ECBnh d\u1EA1ng",wholeRow:"C\u1EA3 h\xE0ng",count:"S\u1ED1 l\u01B0\u1EE3ng",types:{value:"Gi\xE1 tr\u1ECB \xF4",formula:"C\xF4ng th\u1EE9c",top:"Cao nh\u1EA5t",bottom:"Th\u1EA5p nh\u1EA5t",aboveAverage:"Tr\xEAn trung b\xECnh",belowAverage:"D\u01B0\u1EDBi trung b\xECnh",duplicate:"Gi\xE1 tr\u1ECB tr\xF9ng l\u1EB7p",unique:"Gi\xE1 tr\u1ECB duy nh\u1EA5t",dataBar:"Thanh d\u1EEF li\u1EC7u",colorScale:"Thang m\xE0u",iconSet:"B\u1ED9 bi\u1EC3u t\u01B0\u1EE3ng"},ops:{notBetween:"Kh\xF4ng n\u1EB1m gi\u1EEFa",notContains:"Kh\xF4ng ch\u1EE9a"},styles:{red:"T\xF4 \u0111\u1ECF nh\u1EA1t",yellow:"T\xF4 v\xE0ng",green:"T\xF4 xanh l\xE1",blue:"T\xF4 xanh d\u01B0\u01A1ng",redText:"Ch\u1EEF \u0111\u1ECF",bold:"In \u0111\u1EADm"}},ops:{contains:"Ch\u1EE9a",equals:"B\u1EB1ng",notEquals:"Kh\xE1c",startsWith:"B\u1EAFt \u0111\u1EA7u b\u1EB1ng",endsWith:"K\u1EBFt th\xFAc b\u1EB1ng",blank:"Tr\u1ED1ng",notBlank:"Kh\xF4ng tr\u1ED1ng",eq:"B\u1EB1ng",ne:"Kh\xE1c",lt:"Nh\u1ECF h\u01A1n",lte:"Nh\u1ECF h\u01A1n ho\u1EB7c b\u1EB1ng",gt:"L\u1EDBn h\u01A1n",gte:"L\u1EDBn h\u01A1n ho\u1EB7c b\u1EB1ng",between:"Trong kho\u1EA3ng",before:"Tr\u01B0\u1EDBc",after:"Sau"}},bo=ds;var cs={code:"th",noRows:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",filter:"\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",apply:"\u0E43\u0E0A\u0E49",reset:"\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15",selectAll:"(\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14)",search:"\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",blanks:"(\u0E27\u0E48\u0E32\u0E07)",value:"\u0E04\u0E48\u0E32",valueTo:"\u0E16\u0E36\u0E07",sortAsc:"\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01",sortDesc:"\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22",clearSort:"\u0E25\u0E49\u0E32\u0E07\u0E01\u0E32\u0E23\u0E40\u0E23\u0E35\u0E22\u0E07",pinLeft:"\u0E15\u0E23\u0E36\u0E07\u0E0B\u0E49\u0E32\u0E22",pinRight:"\u0E15\u0E23\u0E36\u0E07\u0E02\u0E27\u0E32",unpin:"\u0E40\u0E25\u0E34\u0E01\u0E15\u0E23\u0E36\u0E07",columnMenu:"\u0E40\u0E21\u0E19\u0E39\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",selectRow:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E16\u0E27",selectAllRows:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",chooseColumns:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",columns:"\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",autosizeThis:"\u0E1B\u0E23\u0E31\u0E1A\u0E04\u0E27\u0E32\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E19\u0E35\u0E49\u0E2D\u0E31\u0E15\u0E42\u0E19\u0E21\u0E31\u0E15\u0E34",autosizeAll:"\u0E1B\u0E23\u0E31\u0E1A\u0E04\u0E27\u0E32\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07\u0E17\u0E38\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E2D\u0E31\u0E15\u0E42\u0E19\u0E21\u0E31\u0E15\u0E34",resetColumns:"\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",hideColumn:"\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",close:"\u0E1B\u0E34\u0E14",copy:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01",cut:"\u0E15\u0E31\u0E14",copyWithHeaders:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01\u0E1E\u0E23\u0E49\u0E2D\u0E21\u0E2B\u0E31\u0E27\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",paste:"\u0E27\u0E32\u0E07",pasteHint:"\u0E40\u0E02\u0E49\u0E32\u0E16\u0E36\u0E07\u0E04\u0E25\u0E34\u0E1B\u0E1A\u0E2D\u0E23\u0E4C\u0E14\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E01\u0E14 Ctrl+V \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E27\u0E32\u0E07",required:"\u0E15\u0E49\u0E2D\u0E07\u0E01\u0E23\u0E2D\u0E01\u0E0A\u0E48\u0E2D\u0E07\u0E19\u0E35\u0E49",invalidValue:"\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07",and:"\u0E41\u0E25\u0E30",or:"\u0E2B\u0E23\u0E37\u0E2D",advancedFilter:"\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E02\u0E31\u0E49\u0E19\u0E2A\u0E39\u0E07",addCondition:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E07\u0E37\u0E48\u0E2D\u0E19\u0E44\u0E02",duplicate:"\u0E04\u0E48\u0E32\u0E19\u0E35\u0E49\u0E16\u0E39\u0E01\u0E43\u0E0A\u0E49\u0E41\u0E25\u0E49\u0E27",undo:"\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33",redo:"\u0E17\u0E33\u0E0B\u0E49\u0E33",deleteRows:"\u0E25\u0E1A\u0E41\u0E16\u0E27\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01",copyRows:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01\u0E41\u0E16\u0E27\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01",statusRows:"{n} \u0E41\u0E16\u0E27",statusFiltered:"{shown} \u0E08\u0E32\u0E01 {total} \u0E41\u0E16\u0E27",statusSelected:"\u0E40\u0E25\u0E37\u0E2D\u0E01 {n} \u0E41\u0E16\u0E27",count:"\u0E08\u0E33\u0E19\u0E27\u0E19",sum:"\u0E1C\u0E25\u0E23\u0E27\u0E21",avg:"\u0E04\u0E48\u0E32\u0E40\u0E09\u0E25\u0E35\u0E48\u0E22",min:"\u0E15\u0E48\u0E33\u0E2A\u0E38\u0E14",max:"\u0E2A\u0E39\u0E07\u0E2A\u0E38\u0E14",findPlaceholder:"\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E43\u0E19\u0E15\u0E32\u0E23\u0E32\u0E07",noMatches:"\u0E44\u0E21\u0E48\u0E1E\u0E1A",findNext:"\u0E16\u0E31\u0E14\u0E44\u0E1B",findPrevious:"\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",groupPanelHint:"\u0E25\u0E32\u0E01\u0E2B\u0E31\u0E27\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E21\u0E32\u0E17\u0E35\u0E48\u0E19\u0E35\u0E48\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E08\u0E31\u0E14\u0E01\u0E25\u0E38\u0E48\u0E21",groupByThis:"\u0E08\u0E31\u0E14\u0E01\u0E25\u0E38\u0E48\u0E21\u0E15\u0E32\u0E21\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E19\u0E35\u0E49",ungroup:"\u0E40\u0E25\u0E34\u0E01\u0E08\u0E31\u0E14\u0E01\u0E25\u0E38\u0E48\u0E21",expandAll:"\u0E02\u0E22\u0E32\u0E22\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",collapseAll:"\u0E22\u0E38\u0E1A\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",pagerRange:"{from}\u2013{to} \u0E08\u0E32\u0E01 {total}",pageOf:"\u0E2B\u0E19\u0E49\u0E32 {page} \u0E08\u0E32\u0E01 {pages}",pageSize:"\u0E41\u0E16\u0E27\u0E15\u0E48\u0E2D\u0E2B\u0E19\u0E49\u0E32",firstPage:"\u0E2B\u0E19\u0E49\u0E32\u0E41\u0E23\u0E01",previousPage:"\u0E2B\u0E19\u0E49\u0E32\u0E01\u0E48\u0E2D\u0E19",nextPage:"\u0E2B\u0E19\u0E49\u0E32\u0E16\u0E31\u0E14\u0E44\u0E1B",lastPage:"\u0E2B\u0E19\u0E49\u0E32\u0E2A\u0E38\u0E14\u0E17\u0E49\u0E32\u0E22",loading:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u2026",loadFailed:"\u0E42\u0E2B\u0E25\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08",filters:"\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",clearFilters:"\u0E25\u0E49\u0E32\u0E07\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",exportCsv:"\u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01 CSV",exportExcel:"\u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01 Excel",print:"\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u2026",pivot:"Pivot",pivotMode:"\u0E42\u0E2B\u0E21\u0E14 Pivot",pivotRows:"\u0E01\u0E25\u0E38\u0E48\u0E21\u0E41\u0E16\u0E27",pivotColumns:"\u0E1B\u0E49\u0E32\u0E22\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",pivotValues:"\u0E04\u0E48\u0E32",total:"\u0E23\u0E27\u0E21",addColumn:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u2026",chartBar:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07",chartStacked:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07\u0E0B\u0E49\u0E2D\u0E19",chartLine:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E2A\u0E49\u0E19",chartArea:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E1E\u0E37\u0E49\u0E19\u0E17\u0E35\u0E48",chartPie:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E27\u0E07\u0E01\u0E25\u0E21",chartDonut:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E42\u0E14\u0E19\u0E31\u0E17",chartCombo:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07\u0E41\u0E25\u0E30\u0E40\u0E2A\u0E49\u0E19",chartScatter:"\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E01\u0E23\u0E30\u0E08\u0E32\u0E22",freeBadge:"\u0E23\u0E38\u0E48\u0E19\u0E1F\u0E23\u0E35",exportPdf:"\u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01 PDF",exportJson:"\u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01 JSON",ai:{title:"\u0E1C\u0E39\u0E49\u0E0A\u0E48\u0E27\u0E22 AI",placeholder:"\u0E16\u0E32\u0E21\u0E40\u0E01\u0E35\u0E48\u0E22\u0E27\u0E01\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25 \u0E2B\u0E23\u0E37\u0E2D\u0E1A\u0E2D\u0E01\u0E15\u0E32\u0E23\u0E32\u0E07\u0E27\u0E48\u0E32\u0E15\u0E49\u0E2D\u0E07\u0E17\u0E33\u0E2D\u0E30\u0E44\u0E23",send:"\u0E2A\u0E48\u0E07",thinking:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E17\u0E33\u0E07\u0E32\u0E19\u2026",undo:"\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33",undone:"\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33\u0E41\u0E25\u0E49\u0E27",failed:"\u0E1C\u0E39\u0E49\u0E0A\u0E48\u0E27\u0E22\u0E44\u0E21\u0E48\u0E15\u0E2D\u0E1A\u0E01\u0E25\u0E31\u0E1A",skipped:"\u0E02\u0E49\u0E32\u0E21",done:"\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E41\u0E25\u0E49\u0E27"},cf:{title:"\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E15\u0E32\u0E21\u0E40\u0E07\u0E37\u0E48\u0E2D\u0E19\u0E44\u0E02",add:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E01\u0E0E",clear:"\u0E25\u0E49\u0E32\u0E07\u0E01\u0E0E",none:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E01\u0E0E\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E19\u0E35\u0E49",type:"\u0E01\u0E0E",style:"\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A",wholeRow:"\u0E17\u0E31\u0E49\u0E07\u0E41\u0E16\u0E27",count:"\u0E08\u0E33\u0E19\u0E27\u0E19",types:{value:"\u0E04\u0E48\u0E32\u0E43\u0E19\u0E40\u0E0B\u0E25\u0E25\u0E4C",formula:"\u0E2A\u0E39\u0E15\u0E23",top:"\u0E2A\u0E39\u0E07\u0E2A\u0E38\u0E14",bottom:"\u0E15\u0E48\u0E33\u0E2A\u0E38\u0E14",aboveAverage:"\u0E2A\u0E39\u0E07\u0E01\u0E27\u0E48\u0E32\u0E04\u0E48\u0E32\u0E40\u0E09\u0E25\u0E35\u0E48\u0E22",belowAverage:"\u0E15\u0E48\u0E33\u0E01\u0E27\u0E48\u0E32\u0E04\u0E48\u0E32\u0E40\u0E09\u0E25\u0E35\u0E48\u0E22",duplicate:"\u0E04\u0E48\u0E32\u0E17\u0E35\u0E48\u0E0B\u0E49\u0E33\u0E01\u0E31\u0E19",unique:"\u0E04\u0E48\u0E32\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E0B\u0E49\u0E33",dataBar:"\u0E41\u0E16\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",colorScale:"\u0E23\u0E30\u0E14\u0E31\u0E1A\u0E2A\u0E35",iconSet:"\u0E0A\u0E38\u0E14\u0E44\u0E2D\u0E04\u0E2D\u0E19"},ops:{notBetween:"\u0E44\u0E21\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07",notContains:"\u0E44\u0E21\u0E48\u0E21\u0E35"},styles:{red:"\u0E40\u0E15\u0E34\u0E21\u0E2A\u0E35\u0E41\u0E14\u0E07\u0E2D\u0E48\u0E2D\u0E19",yellow:"\u0E40\u0E15\u0E34\u0E21\u0E2A\u0E35\u0E40\u0E2B\u0E25\u0E37\u0E2D\u0E07",green:"\u0E40\u0E15\u0E34\u0E21\u0E2A\u0E35\u0E40\u0E02\u0E35\u0E22\u0E27",blue:"\u0E40\u0E15\u0E34\u0E21\u0E2A\u0E35\u0E19\u0E49\u0E33\u0E40\u0E07\u0E34\u0E19",redText:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E2A\u0E35\u0E41\u0E14\u0E07",bold:"\u0E15\u0E31\u0E27\u0E2B\u0E19\u0E32"}},ops:{contains:"\u0E21\u0E35\u0E04\u0E33\u0E27\u0E48\u0E32",equals:"\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",notEquals:"\u0E44\u0E21\u0E48\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",startsWith:"\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22",endsWith:"\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22",blank:"\u0E27\u0E48\u0E32\u0E07",notBlank:"\u0E44\u0E21\u0E48\u0E27\u0E48\u0E32\u0E07",eq:"\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",ne:"\u0E44\u0E21\u0E48\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",lt:"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",lte:"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E2B\u0E23\u0E37\u0E2D\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",gt:"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",gte:"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32\u0E2B\u0E23\u0E37\u0E2D\u0E40\u0E17\u0E48\u0E32\u0E01\u0E31\u0E1A",between:"\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07",before:"\u0E01\u0E48\u0E2D\u0E19",after:"\u0E2B\u0E25\u0E31\u0E07"}},vo=cs;var us={code:"id",noRows:"Tidak ada data",filter:"Filter",apply:"Terapkan",reset:"Atur ulang",selectAll:"(Pilih semua)",search:"Cari\u2026",blanks:"(Kosong)",value:"Nilai",valueTo:"Sampai",sortAsc:"Urutkan naik",sortDesc:"Urutkan turun",clearSort:"Hapus urutan",pinLeft:"Sematkan kiri",pinRight:"Sematkan kanan",unpin:"Lepas sematan",columnMenu:"Menu kolom",selectRow:"Pilih baris",selectAllRows:"Pilih semua baris",chooseColumns:"Pilih kolom",columns:"Kolom",autosizeThis:"Sesuaikan lebar kolom ini",autosizeAll:"Sesuaikan lebar semua kolom",resetColumns:"Atur ulang kolom",hideColumn:"Sembunyikan kolom",close:"Tutup",copy:"Salin",cut:"Potong",copyWithHeaders:"Salin dengan judul",paste:"Tempel",pasteHint:"Akses papan klip diblokir. Tekan Ctrl+V untuk menempel.",required:"Kolom ini wajib diisi",invalidValue:"Nilai tidak valid",and:"Dan",or:"Atau",advancedFilter:"Filter lanjutan",addCondition:"Tambah kondisi",duplicate:"Nilai ini sudah dipakai",undo:"Urungkan",redo:"Ulangi",deleteRows:"Hapus baris terpilih",copyRows:"Salin baris terpilih",statusRows:"{n} baris",statusFiltered:"{shown} dari {total} baris",statusSelected:"{n} dipilih",count:"Jumlah data",sum:"Total",avg:"Rata-rata",min:"Min",max:"Maks",findPlaceholder:"Cari di tabel",noMatches:"Tidak ditemukan",findNext:"Berikutnya",findPrevious:"Sebelumnya",groupPanelHint:"Seret judul kolom ke sini untuk mengelompokkan",groupByThis:"Kelompokkan menurut kolom ini",ungroup:"Hapus pengelompokan",expandAll:"Buka semua",collapseAll:"Tutup semua",pagerRange:"{from}\u2013{to} dari {total}",pageOf:"Halaman {page} dari {pages}",pageSize:"Baris per halaman",firstPage:"Halaman pertama",previousPage:"Halaman sebelumnya",nextPage:"Halaman berikutnya",lastPage:"Halaman terakhir",loading:"Memuat\u2026",loadFailed:"Gagal memuat data",filters:"Filter",clearFilters:"Hapus semua filter",exportCsv:"Ekspor CSV",exportExcel:"Ekspor Excel",print:"Cetak\u2026",pivot:"Pivot",pivotMode:"Mode pivot",pivotRows:"Grup baris",pivotColumns:"Label kolom",pivotValues:"Nilai",total:"Total",addColumn:"Tambah kolom\u2026",chartBar:"Diagram batang",chartStacked:"Diagram batang bertumpuk",chartLine:"Diagram garis",chartArea:"Diagram area",chartPie:"Diagram lingkaran",chartDonut:"Diagram donat",chartCombo:"Diagram batang dan garis",chartScatter:"Diagram sebar",freeBadge:"Versi gratis",exportPdf:"Ekspor PDF",exportJson:"Ekspor JSON",ai:{title:"Asisten AI",placeholder:"Tanyakan tentang data atau beri tahu grid apa yang harus dilakukan",send:"Kirim",thinking:"Memproses\u2026",undo:"Urungkan",undone:"Diurungkan",failed:"Asisten tidak menjawab",skipped:"Dilewati",done:"Selesai"},cf:{title:"Pemformatan bersyarat",add:"Tambah aturan",clear:"Hapus aturan",none:"Tidak ada aturan untuk kolom ini",type:"Aturan",style:"Format",wholeRow:"Seluruh baris",count:"Jumlah",types:{value:"Nilai sel",formula:"Rumus",top:"Teratas",bottom:"Terbawah",aboveAverage:"Di atas rata-rata",belowAverage:"Di bawah rata-rata",duplicate:"Nilai duplikat",unique:"Nilai unik",dataBar:"Bilah data",colorScale:"Skala warna",iconSet:"Set ikon"},ops:{notBetween:"Tidak di antara",notContains:"Tidak berisi"},styles:{red:"Isian merah muda",yellow:"Isian kuning",green:"Isian hijau",blue:"Isian biru",redText:"Teks merah",bold:"Tebal"}},ops:{contains:"Berisi",equals:"Sama dengan",notEquals:"Tidak sama dengan",startsWith:"Diawali",endsWith:"Diakhiri",blank:"Kosong",notBlank:"Tidak kosong",eq:"Sama dengan",ne:"Tidak sama dengan",lt:"Kurang dari",lte:"Kurang dari atau sama dengan",gt:"Lebih dari",gte:"Lebih dari atau sama dengan",between:"Di antara",before:"Sebelum",after:"Sesudah"}},xo=us;var fs={code:"ru",noRows:"\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445",filter:"\u0424\u0438\u043B\u044C\u0442\u0440",apply:"\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C",reset:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C",selectAll:"(\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435)",search:"\u041F\u043E\u0438\u0441\u043A\u2026",blanks:"(\u041F\u0443\u0441\u0442\u044B\u0435)",value:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435",valueTo:"\u041F\u043E",sortAsc:"\u041F\u043E \u0432\u043E\u0437\u0440\u0430\u0441\u0442\u0430\u043D\u0438\u044E",sortDesc:"\u041F\u043E \u0443\u0431\u044B\u0432\u0430\u043D\u0438\u044E",clearSort:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0443",pinLeft:"\u0417\u0430\u043A\u0440\u0435\u043F\u0438\u0442\u044C \u0441\u043B\u0435\u0432\u0430",pinRight:"\u0417\u0430\u043A\u0440\u0435\u043F\u0438\u0442\u044C \u0441\u043F\u0440\u0430\u0432\u0430",unpin:"\u041E\u0442\u043A\u0440\u0435\u043F\u0438\u0442\u044C",columnMenu:"\u041C\u0435\u043D\u044E \u0441\u0442\u043E\u043B\u0431\u0446\u0430",selectRow:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443",selectAllRows:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435 \u0441\u0442\u0440\u043E\u043A\u0438",chooseColumns:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0446\u044B",columns:"\u0421\u0442\u043E\u043B\u0431\u0446\u044B",autosizeThis:"\u041F\u043E\u0434\u043E\u0431\u0440\u0430\u0442\u044C \u0448\u0438\u0440\u0438\u043D\u0443 \u0441\u0442\u043E\u043B\u0431\u0446\u0430",autosizeAll:"\u041F\u043E\u0434\u043E\u0431\u0440\u0430\u0442\u044C \u0448\u0438\u0440\u0438\u043D\u0443 \u0432\u0441\u0435\u0445 \u0441\u0442\u043E\u043B\u0431\u0446\u043E\u0432",resetColumns:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0446\u044B",hideColumn:"\u0421\u043A\u0440\u044B\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",copy:"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",cut:"\u0412\u044B\u0440\u0435\u0437\u0430\u0442\u044C",copyWithHeaders:"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430\u043C\u0438",paste:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C",pasteHint:"\u0414\u043E\u0441\u0442\u0443\u043F \u043A \u0431\u0443\u0444\u0435\u0440\u0443 \u043E\u0431\u043C\u0435\u043D\u0430 \u0437\u0430\u043F\u0440\u0435\u0449\u0451\u043D. \u041D\u0430\u0436\u043C\u0438\u0442\u0435 Ctrl+V, \u0447\u0442\u043E\u0431\u044B \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C.",required:"\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435",invalidValue:"\u041D\u0435\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435",and:"\u0418",or:"\u0418\u043B\u0438",advancedFilter:"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0439 \u0444\u0438\u043B\u044C\u0442\u0440",addCondition:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0443\u0441\u043B\u043E\u0432\u0438\u0435",duplicate:"\u042D\u0442\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0443\u0436\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F",undo:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",redo:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",deleteRows:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0441\u0442\u0440\u043E\u043A\u0438",copyRows:"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0441\u0442\u0440\u043E\u043A\u0438",statusRows:"\u0421\u0442\u0440\u043E\u043A: {n}",statusFiltered:"{shown} \u0438\u0437 {total} \u0441\u0442\u0440\u043E\u043A",statusSelected:"\u0412\u044B\u0431\u0440\u0430\u043D\u043E: {n}",count:"\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E",sum:"\u0421\u0443\u043C\u043C\u0430",avg:"\u0421\u0440\u0435\u0434\u043D\u0435\u0435",min:"\u041C\u0438\u043D.",max:"\u041C\u0430\u043A\u0441.",findPlaceholder:"\u041D\u0430\u0439\u0442\u0438 \u0432 \u0442\u0430\u0431\u043B\u0438\u0446\u0435",noMatches:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",findNext:"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0435",findPrevious:"\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0435",groupPanelHint:"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044E\u0434\u0430 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0441\u0442\u043E\u043B\u0431\u0446\u0430 \u0434\u043B\u044F \u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u043A\u0438",groupByThis:"\u0413\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E \u044D\u0442\u043E\u043C\u0443 \u0441\u0442\u043E\u043B\u0431\u0446\u0443",ungroup:"\u0423\u0431\u0440\u0430\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u043A\u0443",expandAll:"\u0420\u0430\u0437\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u0441\u0435",collapseAll:"\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u0441\u0435",pagerRange:"{from}\u2013{to} \u0438\u0437 {total}",pageOf:"\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 {page} \u0438\u0437 {pages}",pageSize:"\u0421\u0442\u0440\u043E\u043A \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435",firstPage:"\u041F\u0435\u0440\u0432\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",previousPage:"\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",nextPage:"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",lastPage:"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",loading:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",loadFailed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435",filters:"\u0424\u0438\u043B\u044C\u0442\u0440\u044B",clearFilters:"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B",exportCsv:"\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 CSV",exportExcel:"\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 Excel",print:"\u041F\u0435\u0447\u0430\u0442\u044C\u2026",pivot:"\u0421\u0432\u043E\u0434\u043D\u0430\u044F",pivotMode:"\u0420\u0435\u0436\u0438\u043C \u0441\u0432\u043E\u0434\u043D\u043E\u0439 \u0442\u0430\u0431\u043B\u0438\u0446\u044B",pivotRows:"\u0413\u0440\u0443\u043F\u043F\u044B \u0441\u0442\u0440\u043E\u043A",pivotColumns:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 \u0441\u0442\u043E\u043B\u0431\u0446\u043E\u0432",pivotValues:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u044F",total:"\u0418\u0442\u043E\u0433\u043E",addColumn:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446\u2026",chartBar:"\u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u0430",chartStacked:"\u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u0430 \u0441 \u043D\u0430\u043A\u043E\u043F\u043B\u0435\u043D\u0438\u0435\u043C",chartLine:"\u0413\u0440\u0430\u0444\u0438\u043A",chartArea:"\u0414\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430 \u0441 \u043E\u0431\u043B\u0430\u0441\u0442\u044F\u043C\u0438",chartPie:"\u041A\u0440\u0443\u0433\u043E\u0432\u0430\u044F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430",chartDonut:"\u041A\u043E\u043B\u044C\u0446\u0435\u0432\u0430\u044F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430",chartCombo:"\u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u0430 \u0438 \u0433\u0440\u0430\u0444\u0438\u043A",chartScatter:"\u0422\u043E\u0447\u0435\u0447\u043D\u0430\u044F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430",freeBadge:"\u0411\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F",exportPdf:"\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 PDF",exportJson:"\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 JSON",ai:{title:"\u0418\u0418-\u043F\u043E\u043C\u043E\u0449\u043D\u0438\u043A",placeholder:"\u0421\u043F\u0440\u043E\u0441\u0438\u0442\u0435 \u043E \u0434\u0430\u043D\u043D\u044B\u0445 \u0438\u043B\u0438 \u0441\u043A\u0430\u0436\u0438\u0442\u0435 \u0442\u0430\u0431\u043B\u0438\u0446\u0435, \u0447\u0442\u043E \u0441\u0434\u0435\u043B\u0430\u0442\u044C",send:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thinking:"\u041E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430\u2026",undo:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",undone:"\u041E\u0442\u043C\u0435\u043D\u0435\u043D\u043E",failed:"\u041F\u043E\u043C\u043E\u0449\u043D\u0438\u043A \u043D\u0435 \u043E\u0442\u0432\u0435\u0442\u0438\u043B",skipped:"\u041F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043E",done:"\u0413\u043E\u0442\u043E\u0432\u043E"},cf:{title:"\u0423\u0441\u043B\u043E\u0432\u043D\u043E\u0435 \u0444\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435",add:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u0440\u0430\u0432\u0438\u043B\u043E",clear:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043F\u0440\u0430\u0432\u0438\u043B\u0430",none:"\u0414\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u0441\u0442\u043E\u043B\u0431\u0446\u0430 \u043D\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B",type:"\u041F\u0440\u0430\u0432\u0438\u043B\u043E",style:"\u0424\u043E\u0440\u043C\u0430\u0442",wholeRow:"\u0412\u0441\u044F \u0441\u0442\u0440\u043E\u043A\u0430",count:"\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E",types:{value:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u044F\u0447\u0435\u0439\u043A\u0438",formula:"\u0424\u043E\u0440\u043C\u0443\u043B\u0430",top:"\u041F\u0435\u0440\u0432\u044B\u0435",bottom:"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435",aboveAverage:"\u0412\u044B\u0448\u0435 \u0441\u0440\u0435\u0434\u043D\u0435\u0433\u043E",belowAverage:"\u041D\u0438\u0436\u0435 \u0441\u0440\u0435\u0434\u043D\u0435\u0433\u043E",duplicate:"\u041F\u043E\u0432\u0442\u043E\u0440\u044F\u044E\u0449\u0438\u0435\u0441\u044F \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F",unique:"\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F",dataBar:"\u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u044B",colorScale:"\u0426\u0432\u0435\u0442\u043E\u0432\u0430\u044F \u0448\u043A\u0430\u043B\u0430",iconSet:"\u041D\u0430\u0431\u043E\u0440\u044B \u0437\u043D\u0430\u0447\u043A\u043E\u0432"},ops:{notBetween:"\u0412\u043D\u0435 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0430",notContains:"\u041D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442"},styles:{red:"\u0421\u0432\u0435\u0442\u043B\u043E-\u043A\u0440\u0430\u0441\u043D\u0430\u044F \u0437\u0430\u043B\u0438\u0432\u043A\u0430",yellow:"\u0416\u0451\u043B\u0442\u0430\u044F \u0437\u0430\u043B\u0438\u0432\u043A\u0430",green:"\u0417\u0435\u043B\u0451\u043D\u0430\u044F \u0437\u0430\u043B\u0438\u0432\u043A\u0430",blue:"\u0421\u0438\u043D\u044F\u044F \u0437\u0430\u043B\u0438\u0432\u043A\u0430",redText:"\u041A\u0440\u0430\u0441\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442",bold:"\u041F\u043E\u043B\u0443\u0436\u0438\u0440\u043D\u044B\u0439"}},ops:{contains:"\u0421\u043E\u0434\u0435\u0440\u0436\u0438\u0442",equals:"\u0420\u0430\u0432\u043D\u043E",notEquals:"\u041D\u0435 \u0440\u0430\u0432\u043D\u043E",startsWith:"\u041D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441",endsWith:"\u0417\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u043D\u0430",blank:"\u041F\u0443\u0441\u0442\u043E",notBlank:"\u041D\u0435 \u043F\u0443\u0441\u0442\u043E",eq:"\u0420\u0430\u0432\u043D\u043E",ne:"\u041D\u0435 \u0440\u0430\u0432\u043D\u043E",lt:"\u041C\u0435\u043D\u044C\u0448\u0435",lte:"\u041C\u0435\u043D\u044C\u0448\u0435 \u0438\u043B\u0438 \u0440\u0430\u0432\u043D\u043E",gt:"\u0411\u043E\u043B\u044C\u0448\u0435",gte:"\u0411\u043E\u043B\u044C\u0448\u0435 \u0438\u043B\u0438 \u0440\u0430\u0432\u043D\u043E",between:"\u041C\u0435\u0436\u0434\u0443",before:"\u0414\u043E",after:"\u041F\u043E\u0441\u043B\u0435"}},Co=fs;var ps={code:"pt-BR",noRows:"Nenhuma linha para mostrar",filter:"Filtro",apply:"Aplicar",reset:"Limpar",selectAll:"(Selecionar tudo)",search:"Pesquisar\u2026",blanks:"(Vazios)",value:"Valor",valueTo:"At\xE9",sortAsc:"Ordenar crescente",sortDesc:"Ordenar decrescente",clearSort:"Remover ordena\xE7\xE3o",pinLeft:"Fixar \xE0 esquerda",pinRight:"Fixar \xE0 direita",unpin:"Desafixar",columnMenu:"Menu da coluna",selectRow:"Selecionar linha",selectAllRows:"Selecionar todas as linhas",chooseColumns:"Escolher colunas",columns:"Colunas",autosizeThis:"Ajustar largura desta coluna",autosizeAll:"Ajustar largura de todas as colunas",resetColumns:"Redefinir colunas",hideColumn:"Ocultar coluna",close:"Fechar",copy:"Copiar",cut:"Recortar",copyWithHeaders:"Copiar com cabe\xE7alhos",paste:"Colar",pasteHint:"O acesso \xE0 \xE1rea de transfer\xEAncia foi bloqueado. Pressione Ctrl+V para colar.",required:"Campo obrigat\xF3rio",invalidValue:"Valor inv\xE1lido",and:"E",or:"Ou",advancedFilter:"Filtro avan\xE7ado",addCondition:"Adicionar condi\xE7\xE3o",duplicate:"Este valor j\xE1 est\xE1 em uso",undo:"Desfazer",redo:"Refazer",deleteRows:"Excluir linhas selecionadas",copyRows:"Copiar linhas selecionadas",statusRows:"{n} linhas",statusFiltered:"{shown} de {total} linhas",statusSelected:"{n} selecionadas",count:"Contagem",sum:"Soma",avg:"M\xE9dia",min:"M\xEDn.",max:"M\xE1x.",findPlaceholder:"Localizar na tabela",noMatches:"Nenhum resultado",findNext:"Pr\xF3ximo",findPrevious:"Anterior",groupPanelHint:"Arraste um cabe\xE7alho de coluna aqui para agrupar",groupByThis:"Agrupar por esta coluna",ungroup:"Remover agrupamento",expandAll:"Expandir tudo",collapseAll:"Recolher tudo",pagerRange:"{from}\u2013{to} de {total}",pageOf:"P\xE1gina {page} de {pages}",pageSize:"Linhas por p\xE1gina",firstPage:"Primeira p\xE1gina",previousPage:"P\xE1gina anterior",nextPage:"Pr\xF3xima p\xE1gina",lastPage:"\xDAltima p\xE1gina",loading:"Carregando\u2026",loadFailed:"N\xE3o foi poss\xEDvel carregar as linhas",filters:"Filtros",clearFilters:"Limpar todos os filtros",exportCsv:"Exportar CSV",exportExcel:"Exportar Excel",print:"Imprimir\u2026",pivot:"Piv\xF4",pivotMode:"Modo piv\xF4",pivotRows:"Grupos de linhas",pivotColumns:"R\xF3tulos de coluna",pivotValues:"Valores",total:"Total",addColumn:"Adicionar coluna\u2026",chartBar:"Gr\xE1fico de barras",chartStacked:"Gr\xE1fico de barras empilhadas",chartLine:"Gr\xE1fico de linhas",chartArea:"Gr\xE1fico de \xE1rea",chartPie:"Gr\xE1fico de pizza",chartDonut:"Gr\xE1fico de rosca",chartCombo:"Gr\xE1fico de barras e linhas",chartScatter:"Gr\xE1fico de dispers\xE3o",freeBadge:"Vers\xE3o gratuita",exportPdf:"Exportar PDF",exportJson:"Exportar JSON",ai:{title:"Assistente de IA",placeholder:"Pergunte sobre os dados ou diga \xE0 grade o que fazer",send:"Enviar",thinking:"Processando\u2026",undo:"Desfazer",undone:"Desfeito",failed:"O assistente n\xE3o respondeu",skipped:"Ignorado",done:"Pronto"},cf:{title:"Formata\xE7\xE3o condicional",add:"Adicionar regra",clear:"Limpar regras",none:"Nenhuma regra para esta coluna",type:"Regra",style:"Formato",wholeRow:"Linha inteira",count:"Quantidade",types:{value:"Valor da c\xE9lula",formula:"F\xF3rmula",top:"Primeiros",bottom:"\xDAltimos",aboveAverage:"Acima da m\xE9dia",belowAverage:"Abaixo da m\xE9dia",duplicate:"Valores duplicados",unique:"Valores \xFAnicos",dataBar:"Barras de dados",colorScale:"Escala de cor",iconSet:"Conjunto de \xEDcones"},ops:{notBetween:"N\xE3o est\xE1 entre",notContains:"N\xE3o cont\xE9m"},styles:{red:"Preenchimento vermelho claro",yellow:"Preenchimento amarelo",green:"Preenchimento verde",blue:"Preenchimento azul",redText:"Texto vermelho",bold:"Negrito"}},ops:{contains:"Cont\xE9m",equals:"Igual a",notEquals:"Diferente de",startsWith:"Come\xE7a com",endsWith:"Termina com",blank:"Vazio",notBlank:"N\xE3o vazio",eq:"Igual a",ne:"Diferente de",lt:"Menor que",lte:"Menor ou igual a",gt:"Maior que",gte:"Maior ou igual a",between:"Entre",before:"Antes de",after:"Depois de"}},ko=ps;var hs={code:"it",noRows:"Nessuna riga da mostrare",filter:"Filtro",apply:"Applica",reset:"Reimposta",selectAll:"(Seleziona tutto)",search:"Cerca\u2026",blanks:"(Vuoti)",value:"Valore",valueTo:"A",sortAsc:"Ordine crescente",sortDesc:"Ordine decrescente",clearSort:"Rimuovi ordinamento",pinLeft:"Blocca a sinistra",pinRight:"Blocca a destra",unpin:"Sblocca",columnMenu:"Menu colonna",selectRow:"Seleziona riga",selectAllRows:"Seleziona tutte le righe",chooseColumns:"Scegli colonne",columns:"Colonne",autosizeThis:"Adatta larghezza di questa colonna",autosizeAll:"Adatta larghezza di tutte le colonne",resetColumns:"Ripristina colonne",hideColumn:"Nascondi colonna",close:"Chiudi",copy:"Copia",cut:"Taglia",copyWithHeaders:"Copia con intestazioni",paste:"Incolla",pasteHint:"Accesso agli appunti bloccato. Premi Ctrl+V per incollare.",required:"Campo obbligatorio",invalidValue:"Valore non valido",and:"E",or:"O",advancedFilter:"Filtro avanzato",addCondition:"Aggiungi condizione",duplicate:"Questo valore \xE8 gi\xE0 in uso",undo:"Annulla",redo:"Ripeti",deleteRows:"Elimina righe selezionate",copyRows:"Copia righe selezionate",statusRows:"{n} righe",statusFiltered:"{shown} di {total} righe",statusSelected:"{n} selezionate",count:"Conteggio",sum:"Somma",avg:"Media",min:"Min",max:"Max",findPlaceholder:"Trova nella tabella",noMatches:"Nessun risultato",findNext:"Successivo",findPrevious:"Precedente",groupPanelHint:"Trascina qui un'intestazione di colonna per raggruppare",groupByThis:"Raggruppa per questa colonna",ungroup:"Rimuovi raggruppamento",expandAll:"Espandi tutto",collapseAll:"Comprimi tutto",pagerRange:"{from}\u2013{to} di {total}",pageOf:"Pagina {page} di {pages}",pageSize:"Righe per pagina",firstPage:"Prima pagina",previousPage:"Pagina precedente",nextPage:"Pagina successiva",lastPage:"Ultima pagina",loading:"Caricamento\u2026",loadFailed:"Impossibile caricare le righe",filters:"Filtri",clearFilters:"Rimuovi tutti i filtri",exportCsv:"Esporta CSV",exportExcel:"Esporta Excel",print:"Stampa\u2026",pivot:"Pivot",pivotMode:"Modalit\xE0 pivot",pivotRows:"Gruppi di righe",pivotColumns:"Etichette di colonna",pivotValues:"Valori",total:"Totale",addColumn:"Aggiungi colonna\u2026",chartBar:"Grafico a barre",chartStacked:"Grafico a barre in pila",chartLine:"Grafico a linee",chartArea:"Grafico ad area",chartPie:"Grafico a torta",chartDonut:"Grafico ad anello",chartCombo:"Grafico a barre e linee",chartScatter:"Grafico a dispersione",freeBadge:"Versione gratuita",exportPdf:"Esporta PDF",exportJson:"Esporta JSON",ai:{title:"Assistente IA",placeholder:"Chiedi qualcosa sui dati o di\u2019 alla griglia cosa fare",send:"Invia",thinking:"In corso\u2026",undo:"Annulla",undone:"Annullato",failed:"L'assistente non ha risposto",skipped:"Saltato",done:"Fatto"},cf:{title:"Formattazione condizionale",add:"Aggiungi regola",clear:"Cancella regole",none:"Nessuna regola per questa colonna",type:"Regola",style:"Formato",wholeRow:"Intera riga",count:"Numero",types:{value:"Valore cella",formula:"Formula",top:"Primi",bottom:"Ultimi",aboveAverage:"Sopra la media",belowAverage:"Sotto la media",duplicate:"Valori duplicati",unique:"Valori univoci",dataBar:"Barre dei dati",colorScale:"Scala di colori",iconSet:"Set di icone"},ops:{notBetween:"Non compreso tra",notContains:"Non contiene"},styles:{red:"Riempimento rosso chiaro",yellow:"Riempimento giallo",green:"Riempimento verde",blue:"Riempimento blu",redText:"Testo rosso",bold:"Grassetto"}},ops:{contains:"Contiene",equals:"Uguale a",notEquals:"Diverso da",startsWith:"Inizia con",endsWith:"Finisce con",blank:"Vuoto",notBlank:"Non vuoto",eq:"Uguale a",ne:"Diverso da",lt:"Minore di",lte:"Minore o uguale a",gt:"Maggiore di",gte:"Maggiore o uguale a",between:"Tra",before:"Prima di",after:"Dopo"}},Ro=hs;var re="__fg_select__",So={id:re,header:"",width:44,minWidth:44,maxWidth:44,pinned:"left",sortable:!1,resizable:!1,filter:!1},Ee="__fg_drag__",Mo={id:Ee,header:"",width:28,minWidth:28,maxWidth:28,pinned:"left",sortable:!1,resizable:!1,filter:!1,chooser:!1},be="__fg_rownum__",Eo=(o=52,e="#")=>({id:be,header:e,width:o,minWidth:o,maxWidth:o,pinned:"left",sortable:!1,resizable:!1,filter:!1,chooser:!1}),$=o=>o===re||o===Ee||o===be,ms=120,gs=40,ws=["left","center","right"];function le(o){if($(o.id)||o.filter===!1)return null;if(o.filter)return o.filter;switch(o.type){case"number":return"number";case"date":return"date";case"boolean":return"set";default:return"text"}}function pe(o,e,t){let n=o.editable;if(typeof n!="function")return!!n;try{return!!n({value:o.valueGetter?o.valueGetter(e):o.field?e[o.field]:void 0,row:e,rowIndex:t,column:o})}catch{return!1}}var Ae=o=>o.id!==re&&o.sortable!==!1,pt=o=>o.id!==re&&o.resizable!==!1;function ut(o,e){let t=o.minWidth??gs,n=o.maxWidth??1/0;return Math.round(Math.min(n,Math.max(t,e)))}function Ao(o){return o.children?1+Math.max(0,...o.children.map(Ao)):1}var ft=class{constructor(e){this.depth=1;this.roots_=[];this.defs=[];this.byId=new Map;this.containerWidth=0;this.layout={left:[],center:[],right:[]};this.leafById=new Map;this.setDefs(e)}setDefs(e){this.defs=e,this.byId=new Map;let t=0,n=(s,i,a)=>{let l=Array.isArray(s.children)&&s.children.length>0,d=t++,c=s.id??(l?`g${d}`:s.field);if(c||(c=`c${d}`,B(`column #${d} has neither "field" nor "id"; using "${c}"`)),this.byId.has(c)){let f=1;for(;this.byId.has(`${c}_${f}`);)f++;B(`duplicate column id "${c}"; renamed to "${c}_${f}"`),c=`${c}_${f}`}let u={id:c,def:s,parent:i,children:null,depth:a,width:ut(s,s.width??ms),flex:s.flex&&s.flex>0?s.flex:null,hide:s.hide??!1,pinned:s.pinned??i?.pinned??null,open:!!s.openByDefault};return this.byId.set(c,u),l&&(u.children=r(s.children).map(f=>n(f,u,a+1))),u},r=s=>{let i=s.filter(a=>a!==null&&typeof a=="object");return i.length!==s.length&&B("columns contain entries that are not objects; they were skipped"),i};this.roots_=r(e).map(s=>n(s,null,0)),this.depth=Math.max(1,...this.roots_.map(Ao)),this.relayout()}setContainerWidth(e){if(e===this.containerWidth)return!1;this.containerWidth=e;let t=this.displayed().map(n=>n.width).join();return this.relayout(),t!==this.displayed().map(n=>n.width).join()}roots(){return this.roots_}reset(){this.setDefs(this.defs)}region(e){return this.layout[e]}displayed(){return[...this.layout.left,...this.layout.center,...this.layout.right]}regionWidth(e){let t=this.layout[e],n=t[t.length-1];return n?n.left+n.width:0}getColumn(e){return this.leafById.get(e)}getNode(e){return this.byId.get(e)}siblings(e){let t=this.byId.get(e);return t?t.parent?t.parent.children:this.roots_:[]}setWidth(e,t){let n=this.byId.get(e);return!n||n.children?0:(n.flex=null,n.width=ut(n.def,t),this.relayout(),n.width)}setPinned(e,t){let n=this.byId.get(e);!n||n.children||$(e)||(n.pinned=t,this.relayout())}setHide(e,t){let n=this.byId.get(e);!n||n.children||(n.hide=t,this.relayout())}move(e,t){let n=this.siblings(e),r=n.findIndex(i=>i.id===e);if(r<0)return;let[s]=n.splice(r,1);n.splice(Math.max(0,Math.min(n.length,t)),0,s),this.relayout()}headerCells(e){let t=[],n=new Map;for(let r of this.layout[e]){let s=[];for(let i=r.node.parent;i;i=i.parent)s.unshift(i);for(let i of s){let a=n.get(i.id);if(a){a.width+=r.width;continue}let l={id:i.id,label:i.def.header??"",isGroup:!0,column:null,node:i,row:i.depth,rowSpan:1,left:r.left,width:r.width};n.set(i.id,l),t.push(l)}t.push({id:r.id,label:r.def.header??r.def.field??"",isGroup:!1,column:r,node:r.node,row:r.node.depth,rowSpan:this.depth-r.node.depth,left:r.left,width:r.width})}return t}getState(){return this.leafNodes().filter(e=>!$(e.id)).map(e=>({colId:e.id,width:this.leafById.get(e.id)?.width??e.width,hide:!!e.hide,pinned:e.pinned??null}))}applyState(e){let t=new Map;e.forEach((s,i)=>{t.set(s.colId,i);let a=this.byId.get(s.colId);!a||a.children||$(s.colId)||(typeof s.width=="number"&&Number.isFinite(s.width)&&(a.flex=null,a.width=ut(a.def,s.width)),typeof s.hide=="boolean"&&(a.hide=s.hide),"pinned"in s&&(a.pinned=s.pinned==="left"||s.pinned==="right"?s.pinned:null))}),t.set(be,-3),t.set(Ee,-2),t.set(re,-1);let n=s=>s.children?Math.min(1/0,...s.children.map(n)):t.get(s.id)??1/0,r=s=>{let i=s.map((a,l)=>({n:a,i:l,r:n(a)}));i.sort((a,l)=>a.r===l.r?a.i-l.i:a.r-l.r),s.splice(0,s.length,...i.map(a=>a.n));for(let a of s)a.children&&r(a.children)};r(this.roots_),this.relayout()}leafNodes(){let e=[],t=n=>n.children?n.children.forEach(t):e.push(n);return this.roots_.forEach(t),e}isCollapsible(e){return!!e.children?.some(t=>t.def.columnGroupShow==="open"||t.def.columnGroupShow==="closed")}setGroupOpen(e,t){let n=this.byId.get(e);return!n?.children||n.open===t?!1:(n.open=t,this.relayout(),!0)}groupOpenState(){let e={};for(let t of this.byId.values())this.isCollapsible(t)&&(e[t.id]=t.open);return e}shownByGroups(e){for(let t=e;t?.parent;t=t.parent){let n=t.def.columnGroupShow;if(n==="open"&&!t.parent.open||n==="closed"&&t.parent.open)return!1}return!0}relayout(){let e=this.leafNodes().filter(l=>!l.hide&&this.shownByGroups(l)),t=e.reduce((l,d)=>l+(d.flex?0:d.width),0),n=e.reduce((l,d)=>l+(d.flex??0),0),r=Math.max(0,this.containerWidth-t),s=l=>l.flex?ut(l.def,Math.floor(r*l.flex/n)):l.width,i={left:[],center:[],right:[]};this.leafById=new Map;let a=0;for(let l of ws){let d=0;for(let c of e){if((c.pinned??"center")!==l)continue;let u={id:c.id,def:c.def,node:c,width:s(c),region:l,left:d,index:a++};d+=u.width,i[l].push(u),this.leafById.set(c.id,u)}}this.layout=i}};var q=class extends Error{constructor(t){super(t);this.code=t}},ys=/^#[A-Z/0]+[!?]$/,ze=o=>typeof o=="string"&&ys.test(o);function bs(o){let e=[],t=0;for(;t<o.length;){let n=o[t];if(/\s/.test(n))t++;else if(/[0-9.]/.test(n)){let r=/^(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?/i.exec(o.slice(t));if(!r)throw new q("#ERROR!");e.push({t:"num",v:Number(r[0])}),t+=r[0].length}else if(n==='"'){let r="";for(t++;;){if(t>=o.length)throw new q("#ERROR!");if(o[t]==='"'){if(o[t+1]==='"'){r+='"',t+=2;continue}t++;break}r+=o[t++]}e.push({t:"str",v:r})}else if(n==="["){let r=o.indexOf("]",t);if(r<0)throw new q("#ERROR!");e.push({t:"id",v:o.slice(t+1,r)}),t=r+1}else if(/[A-Za-z_À-￿]/.test(n)){let r=/^[A-Za-z_À-￿][\wÀ-￿.]*/.exec(o.slice(t));e.push({t:"id",v:r[0]}),t+=r[0].length}else{let r=o.slice(t,t+2);if(r==="<>"||r==="<="||r===">=")e.push({t:"op",v:r}),t+=2;else if("+-*/%^&=<>(),;".includes(n))e.push({t:"op",v:n===";"?",":n}),t++;else throw new q("#ERROR!")}}return e}var se=o=>o==null||o==="";function H(o){if(typeof o=="number")return o;if(typeof o=="boolean")return o?1:0;if(se(o))return 0;if(o instanceof Date)return o.getTime();if(typeof o=="string"&&o.trim()!==""&&Number.isFinite(Number(o)))return Number(o);throw new q("#VALUE!")}var _=o=>se(o)?"":typeof o=="boolean"?o?"TRUE":"FALSE":o instanceof Date?_e(o):String(o),xe=o=>typeof o=="boolean"?o:typeof o=="string"&&/^(true|false)$/i.test(o)?o.toLowerCase()==="true":H(o)!==0;function ht(o,e,t="near"){let n=Math.trunc(e),s=+`${(t==="near"?Math.round:t==="up"?Math.ceil:Math.floor)(+`${Math.abs(o)}e${n}`)}e${-n}`;return o<0?-s:s}function Xe(o,e){let t=n=>typeof n=="number"||typeof n=="boolean"||se(n);return t(o)&&t(e)?H(o)-H(e):o instanceof Date||e instanceof Date?H(de(o))-H(de(e)):_(o).localeCompare(_(e),void 0,{sensitivity:"accent"})}var ve=o=>o.flatMap(e=>Array.isArray(e)?e:[e]);var Te=o=>o.flatMap(e=>Array.isArray(e)?No(e).filter(t=>typeof t=="number"&&Number.isFinite(t)):se(e)?[]:[H(e)]);function No(o){let e=o.find(ze);if(e!==void 0)throw new q(e);return o}function de(o){if(o instanceof Date)return o;if(typeof o=="number")return new Date(o);if(typeof o=="string"){let e=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?/.exec(o.trim());if(e)return new Date(+e[1],+e[2]-1,+e[3],+(e[4]??0),+(e[5]??0),+(e[6]??0))}throw new q("#VALUE!")}var gt=o=>String(o).padStart(2,"0");function _e(o){return`${o.getFullYear()}-${gt(o.getMonth()+1)}-${gt(o.getDate())}`}var vs=864e5,To=o=>Math.round(Date.UTC(o.getFullYear(),o.getMonth(),o.getDate())/vs);function Oo(o){if(typeof o!="string")return s=>Xe(s,o)===0&&!se(s)==!se(o);let e=/^(<=|>=|<>|<|>|=)?(.*)$/s.exec(o),t=e[1]??"=",n=e[2],r=n.trim()!==""&&Number.isFinite(Number(n))?Number(n):n;if((t==="="||t==="<>")&&typeof r=="string"&&/[*?]/.test(r)){let s=new RegExp(`^${r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")}$`,"i");return t==="="?i=>s.test(_(i)):i=>!s.test(_(i))}return s=>{if(t==="="&&r==="")return se(s);if(t==="<>"&&r==="")return!se(s);if(typeof r=="number"&&typeof s!="number"&&!(typeof s=="string"&&s.trim()!==""&&Number.isFinite(Number(s))))return t==="<>";let i;try{i=Xe(s,r)}catch{return!1}return t==="="?i===0:t==="<>"?i!==0:t==="<"?i<0:t===">"?i>0:t==="<="?i<=0:i>=0}}function Ce(o){if(Array.isArray(o))return o;throw new q("#VALUE!")}function Lo(o,e,t){let n=Ce(e),r=Oo(t),s=[],i=No(o.length?Ce(o[0]):n);return n.forEach((a,l)=>{let d=i[l];r(a)&&typeof d=="number"&&Number.isFinite(d)&&s.push(d)}),s}var ce={SUM:o=>Te(o).reduce((e,t)=>e+t,0),AVG:o=>{let e=Te(o);if(!e.length)throw new q("#DIV/0!");return e.reduce((t,n)=>t+n,0)/e.length},MIN:o=>{let e=Te(o);return e.length?Math.min(...e):0},MAX:o=>{let e=Te(o);return e.length?Math.max(...e):0},MEDIAN:o=>{let e=Te(o).sort((n,r)=>n-r);if(!e.length)throw new q("#NUM!");let t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2},COUNT:o=>ve(o).filter(e=>typeof e=="number"&&Number.isFinite(e)).length,COUNTA:o=>ve(o).filter(e=>!se(e)).length,COUNTBLANK:o=>ve(o).filter(se).length,PRODUCT:o=>Te(o).reduce((e,t)=>e*t,1),ROUND:o=>ht(H(o[0]),o.length>1?H(o[1]):0),ROUNDUP:o=>ht(H(o[0]),o.length>1?H(o[1]):0,"up"),ROUNDDOWN:o=>ht(H(o[0]),o.length>1?H(o[1]):0,"down"),INT:o=>Math.floor(H(o[0])),TRUNC:o=>ht(H(o[0]),o.length>1?H(o[1]):0,H(o[0])<0?"up":"down"),ABS:o=>Math.abs(H(o[0])),SIGN:o=>Math.sign(H(o[0])),SQRT:o=>{let e=H(o[0]);if(e<0)throw new q("#NUM!");return Math.sqrt(e)},POWER:o=>H(o[0])**H(o[1]),EXP:o=>Math.exp(H(o[0])),LN:o=>{let e=H(o[0]);if(e<=0)throw new q("#NUM!");return Math.log(e)},LOG10:o=>{let e=H(o[0]);if(e<=0)throw new q("#NUM!");return Math.log10(e)},MOD:o=>{let e=H(o[1]);if(e===0)throw new q("#DIV/0!");let t=H(o[0]);return t-e*Math.floor(t/e)},CEILING:o=>{let e=o.length>1?H(o[1]):1;return e===0?0:Math.ceil(H(o[0])/e)*e},FLOOR:o=>{let e=o.length>1?H(o[1]):1;return e===0?0:Math.floor(H(o[0])/e)*e},PI:()=>Math.PI,CONCAT:o=>ve(o).map(_).join(""),TEXTJOIN:o=>ve(o.slice(2)).filter(e=>!xe(o[1])||!se(e)).map(_).join(_(o[0])),LEN:o=>_(o[0]).length,LEFT:o=>_(o[0]).slice(0,o.length>1?Math.max(0,H(o[1])):1),RIGHT:o=>{let e=_(o[0]),t=o.length>1?Math.max(0,H(o[1])):1;return t?e.slice(-t):""},MID:o=>_(o[0]).substr(Math.max(0,H(o[1])-1),Math.max(0,H(o[2]))),UPPER:o=>_(o[0]).toUpperCase(),LOWER:o=>_(o[0]).toLowerCase(),PROPER:o=>_(o[0]).toLowerCase().replace(/(^|[^\p{L}])(\p{L})/gu,(e,t,n)=>t+n.toUpperCase()),TRIM:o=>_(o[0]).trim().replace(/\s+/g," "),SUBSTITUTE:o=>_(o[0]).split(_(o[1])).join(_(o[2])),REPLACE:o=>{let e=_(o[0]),t=Math.max(0,H(o[1])-1);return e.slice(0,t)+_(o[3])+e.slice(t+Math.max(0,H(o[2])))},REPT:o=>_(o[0]).repeat(Math.max(0,Math.min(1e4,H(o[1])))),FIND:o=>{let e=_(o[1]).indexOf(_(o[0]),o.length>2?H(o[2])-1:0);if(e<0)throw new q("#VALUE!");return e+1},SEARCH:o=>{let e=_(o[1]).toLowerCase().indexOf(_(o[0]).toLowerCase(),o.length>2?H(o[2])-1:0);if(e<0)throw new q("#VALUE!");return e+1},VALUE:o=>H(_(o[0]).replace(/,/g,"")),TEXT:o=>{let e=o[0],t=_(o[1]),n=/0\.(0+)/.exec(t)?.[1].length??0;if(/[yd]/i.test(t)){let i=de(e);return t.replace(/yyyy/gi,String(i.getFullYear())).replace(/mm/g,gt(i.getMonth()+1)).replace(/dd/gi,gt(i.getDate()))}let r=H(e);return t.includes("%")?(r*100).toFixed(n)+"%":t.includes(",")?r.toLocaleString("en-US",{minimumFractionDigits:n,maximumFractionDigits:n}):r.toFixed(n)},AND:o=>ve(o).every(xe),OR:o=>ve(o).some(xe),XOR:o=>ve(o).filter(xe).length%2===1,NOT:o=>!xe(o[0]),ISBLANK:o=>se(o[0]),ISNUMBER:o=>typeof o[0]=="number"&&Number.isFinite(o[0]),ISTEXT:o=>typeof o[0]=="string"&&!ze(o[0]),ISERROR:o=>ze(o[0]),TODAY:()=>_e(new Date),NOW:()=>new Date,DATE:o=>_e(new Date(H(o[0]),H(o[1])-1,H(o[2]))),YEAR:o=>de(o[0]).getFullYear(),MONTH:o=>de(o[0]).getMonth()+1,DAY:o=>de(o[0]).getDate(),WEEKDAY:o=>de(o[0]).getDay()+1,DAYS:o=>To(de(o[0]))-To(de(o[1])),EDATE:o=>{let e=de(o[0]),t=e.getDate(),n=new Date(e.getFullYear(),e.getMonth()+H(o[1]),1);return n.setDate(Math.min(t,new Date(n.getFullYear(),n.getMonth()+1,0).getDate())),_e(n)},EOMONTH:o=>{let e=de(o[0]);return _e(new Date(e.getFullYear(),e.getMonth()+H(o[1])+1,0))},SUMIF:o=>Lo(o.slice(2),Ce(o[0]),o[1]).reduce((e,t)=>e+t,0),COUNTIF:o=>{let e=Oo(o[1]);return Ce(o[0]).filter(e).length},AVERAGEIF:o=>{let e=Lo(o.slice(2),Ce(o[0]),o[1]);if(!e.length)throw new q("#DIV/0!");return e.reduce((t,n)=>t+n,0)/e.length},LOOKUP:o=>{let e=Ce(o[1]),t=o.length>2?Ce(o[2]):e,n=e.findIndex(r=>{try{return Xe(r,o[0])===0}catch{return!1}});if(n<0){if(o.length>3)return o[3];throw new q("#N/A")}return t[n]},RANK:o=>{let e=H(o[0]),t=Te([Ce(o[1])]),n=o.length>2&&xe(o[2]);return 1+t.filter(r=>n?r<e:r>e).length}};ce.AVERAGE=ce.AVG;ce.XLOOKUP=ce.LOOKUP;ce.CONCATENATE=ce.CONCAT;var wt=new Map;function xs(o,e){typeof o!="string"||!/^[A-Za-z_][\w.]*$/.test(o)||typeof e!="function"||(wt.set(o.toUpperCase(),e),He.clear())}function Cs(){return[...new Set([...Object.keys(ce),...ks,...Rs,...wt.keys()])].sort()}var ks=["IF","IFS","IFERROR","IFNA","SWITCH","CHOOSE"],Rs=["COL","PREV","NEXT","ROW"],hn=class{constructor(e){this.tokens=e;this.i=0}parse(){let e=this.comparison();if(this.i<this.tokens.length)throw new q("#ERROR!");return e}peek(e){let t=this.tokens[this.i];return!!t&&t.t==="op"&&(e===void 0||t.v===e)}take(e){return this.peek(e)?(this.i++,!0):!1}comparison(){let e=this.concat();for(let t of["=","<>","<=",">=","<",">"])if(this.take(t))return{k:"bin",op:t,a:e,b:this.concat()};return e}concat(){let e=this.additive();for(;this.take("&");)e={k:"bin",op:"&",a:e,b:this.additive()};return e}additive(){let e=this.multiplicative();for(;;)if(this.take("+"))e={k:"bin",op:"+",a:e,b:this.multiplicative()};else if(this.take("-"))e={k:"bin",op:"-",a:e,b:this.multiplicative()};else return e}multiplicative(){let e=this.unary();for(;;)if(this.take("*"))e={k:"bin",op:"*",a:e,b:this.unary()};else if(this.take("/"))e={k:"bin",op:"/",a:e,b:this.unary()};else if(this.take("%"))e={k:"bin",op:"%",a:e,b:this.unary()};else return e}unary(){return this.take("-")?{k:"un",op:"-",a:this.unary()}:this.take("+")?{k:"un",op:"+",a:this.unary()}:this.power()}power(){let e=this.primary();return this.take("^")?{k:"bin",op:"^",a:e,b:this.unary()}:e}primary(){let e=this.tokens[this.i++];if(!e)throw new q("#ERROR!");if(e.t==="num"||e.t==="str")return{k:"lit",v:e.v};if(e.t==="op"){if(e.v!=="(")throw new q("#ERROR!");let n=this.comparison();if(!this.take(")"))throw new q("#ERROR!");return n}let t=e.v;if(this.peek("(")){this.i++;let n=[];if(!this.take(")")){do n.push(this.comparison());while(this.take(","));if(!this.take(")"))throw new q("#ERROR!")}let r=t.toUpperCase();if((r==="COL"||r==="PREV"||r==="NEXT")&&(!n.length||n[0].k!=="ref"))throw new q("#ERROR!");let s=r!=="PREV"&&r!=="NEXT"&&r!=="ROW"&&n.every(i=>mt(i,r==="COL"));return{k:"call",name:r,args:n,rowFree:s}}return/^(true|false)$/i.test(t)?{k:"lit",v:t.toLowerCase()==="true"}:{k:"ref",name:t}}};function mt(o,e=!1){return o.k==="lit"?!0:o.k==="ref"?e:o.k==="un"?mt(o.a):o.k==="bin"?mt(o.a)&&mt(o.b):o.rowFree}var He=new Map,Ss=2e3;function Bo(o){let e=He.get(o);if(!e){try{e=new hn(bs(o.slice(1))).parse()}catch(t){e=t instanceof q?t:new q("#ERROR!")}He.size>=Ss&&He.delete(He.keys().next().value),He.set(o,e)}if(e instanceof q)throw e;return e}var Po=new WeakMap;function ke(o){let e=o.rows(),t=o.version(),n=Po.get(o);return(!n||n.data!==e||n.version!==t)&&(n={data:e,version:t,index:null,cols:new Map,values:new WeakMap,rowFree:new Map,filled:new Map},Po.set(o,n)),n}var Ho=new WeakMap;function Go(o,e){for(let t of o)t&&typeof t=="object"&&Ho.set(t,e)}var zo=32;function mn(o,e){let{row:t,scope:n}=o;if(t&&Object.hasOwn(t,e)){let s=t[e];return typeof s=="string"&&s.startsWith("=")&&s.length>1?Fo(o,e,s):s}let r=n?.computed(e);if(r!==void 0)return Fo(o,e,r);throw new q("#REF!")}function Fo(o,e,t){if(o.seen.has(e)||o.depth>=zo)throw new q("#CYCLE!");let n;if(o.memo.has(e))n=o.memo.get(e);else{let r=o.scope?ke(o.scope).values.get(o.row):void 0;r?.has(e)?n=r.get(e):(n=yt(t,{...o,seen:new Set([...o.seen,e]),depth:o.depth+1}),o.memo.set(e,n))}if(ze(n))throw new q(n);return n}function Ms(o,e,t){let n=o.scope;if(!n)throw new q("#REF!");let r=ke(n);if(e<0||e>=r.data.length)return null;let s=r.data[e],i=r.filled.get(t)??-1;if(e>i+1&&e-i>1)for(let l=i+1;l<e;l++)Je(n,r,r.data[l],t);let a=Je(n,r,s,t);if(e>(r.filled.get(t)??-1)&&r.filled.set(t,e),ze(a))throw new q(a);return a}function Je(o,e,t,n){let r=e.values.get(t);if(r?.has(n))return r.get(n);let s;try{s=mn({row:t,scope:o,seen:new Set,depth:0,memo:new Map},n)}catch(i){s=i instanceof q?i.code:"#ERROR!"}return r||e.values.set(t,r=new Map),r.set(n,s),s}function Do(o){if(!o.scope)throw new q("#REF!");let e=ke(o.scope);e.index||(e.index=new Map(e.data.map((n,r)=>[n,r])));let t=e.index.get(o.row);if(t===void 0)throw new q("#REF!");return t}function Es(o,e){if(!o.scope)throw new q("#REF!");let t=o.scope,n=ke(t),r=n.cols.get(e);if(r||(n.cols.set(e,Io),r=n.data.map(s=>Je(t,n,s,e)),n.cols.set(e,r)),r===Io)throw new q("#CYCLE!");return r}var Io=[];function Ge(o,e){switch(o.k){case"lit":return o.v;case"ref":return mn(e,o.name);case"un":return o.op==="-"?-H(Ge(o.a,e)):H(Ge(o.a,e));case"bin":{let t=Ge(o.a,e),n=Ge(o.b,e);switch(o.op){case"+":return H(t)+H(n);case"-":return H(t)-H(n);case"*":return H(t)*H(n);case"/":case"%":{let r=H(n);if(r===0)throw new q("#DIV/0!");return o.op==="/"?H(t)/r:H(t)%r}case"^":return H(t)**H(n);case"&":return _(t)+_(n);default:{let r=Xe(t,n);return o.op==="="?r===0:o.op==="<>"?r!==0:o.op==="<"?r<0:o.op===">"?r>0:o.op==="<="?r<=0:r>=0}}}case"call":{if(o.rowFree&&e.scope){let t=ke(e.scope);if(t.rowFree.has(o)){let n=t.rowFree.get(o);if(n instanceof q)throw n;return n}try{let n=$o(o,e);return t.rowFree.set(o,n),n}catch(n){throw n instanceof q&&t.rowFree.set(o,n),n}}return $o(o,e)}}}function $o(o,e){let{name:t,args:n}=o,r=a=>Ge(n[a],e);switch(t){case"IF":{if(n.length<2)throw new q("#ERROR!");return xe(r(0))?r(1):n.length>2?r(2):!1}case"IFS":for(let a=0;a+1<n.length;a+=2)if(xe(r(a)))return r(a+1);throw new q("#N/A");case"IFERROR":case"IFNA":try{let a=r(0);return ze(a)&&(t==="IFERROR"||a==="#N/A")?n.length>1?r(1):"":a}catch(a){if(!(a instanceof q)||t==="IFNA"&&a.code!=="#N/A")throw a;return n.length>1?r(1):""}case"SWITCH":{let a=r(0);for(let l=1;l+1<n.length;l+=2)if(Xe(a,r(l))===0)return r(l+1);if(n.length%2===0)return r(n.length-1);throw new q("#N/A")}case"CHOOSE":{let a=Math.trunc(H(r(0)));if(a<1||a>=n.length)throw new q("#VALUE!");return r(a)}case"COL":return Es(e,n[0].name);case"ROW":return Do(e)+1;case"PREV":case"NEXT":{let a=n.length>1?Math.trunc(H(r(1))):1,l=Do(e)+(t==="PREV"?-a:a),d=n[0].name;if(t==="NEXT"&&e.depth>=zo)throw new q("#CYCLE!");return t==="PREV"?Ms(e,l,d):As(e,l,d)}}let s=(Object.hasOwn(ce,t)?ce[t]:void 0)??wt.get(t);if(!s)throw new q("#NAME?");let i=n.map((a,l)=>r(l));if(wt.has(t)&&!Object.hasOwn(ce,t))try{return s(i)}catch(a){throw a instanceof q?a:new q("#VALUE!")}return s(i)}function As(o,e,t){let n=o.scope?ke(o.scope):null;if(!n)throw new q("#REF!");return e<0||e>=n.data.length?null:mn({...o,row:n.data[e],seen:new Set,depth:o.depth+1,memo:new Map},t)}function yt(o,e){try{let t=Ge(Bo(o),e);return typeof t=="number"&&!Number.isFinite(t)?"#NUM!":Array.isArray(t)?"#VALUE!":t}catch(t){return t instanceof RangeError?"#CYCLE!":t instanceof q?t.code:"#ERROR!"}}function gn(o,e,t=new Set,n=0,r=new Map,s=null){return yt(o,{row:e,scope:s,seen:t,depth:n,memo:r})}function wn(o,e){let t=Ho.get(o)??null,n=o.id??o.field;if(o.formula){if(t&&n){let r=ke(t);return Je(t,r,e,n)}return yt(o.formula,{row:e,scope:t,seen:new Set(n?[n]:[]),depth:0,memo:new Map})}return t?Je(t,ke(t),e,o.field):yt(e[o.field],{row:e,scope:t,seen:new Set([o.field]),depth:0,memo:new Map})}var Le=o=>typeof o=="string"&&o.length>1&&o.startsWith("=");function Vo(o){let e;try{e=Bo(o)}catch{return null}let t=new Set,n=r=>{r.k==="ref"?t.add(r.name):r.k==="un"?n(r.a):r.k==="bin"?(n(r.a),n(r.b)):r.k==="call"&&r.args.forEach(n)};return n(e),[...t]}function G(o,e){if(o.valueGetter)try{return o.valueGetter(e)}catch{B(`valueGetter of column "${o.id??o.field}" threw; rendering an empty cell`);return}if(typeof o.formula=="string"&&Le(o.formula))return wn(o,e);if(o.field==null)return;let t=e[o.field];return o.formulas&&Le(t)?wn(o,e):t}var Ye=["left","center","right"],qo=[[">=","gte"],["<=","lte"],["<>","ne"],["!=","ne"],[">","gt"],["<","lt"],["=","eq"]],Wo=[[">","after"],["<","before"],["=","equals"]],Ts=/^(.+?)\s*(?:~|\.\.)\s*(.+)$/,yn=o=>{let e=Number(o.replace(/[,\s₩$€¥]/g,""));return o.trim()!==""&&Number.isFinite(e)?e:null},bn=o=>{let e=/^(\d{4})[-./]\s*(\d{1,2})[-./]\s*(\d{1,2})\.?$/.exec(o.trim());if(!e)return null;let t=Number(e[1]),n=Number(e[2]),r=Number(e[3]);return n<1||n>12||r<1||r>new Date(Date.UTC(t,n,0)).getUTCDate()?null:`${e[1]}-${e[2].padStart(2,"0")}-${e[3].padStart(2,"0")}`};function Ls(o,e){let t=e.trim();if(!t)return null;if(o==="text")return{type:"text",op:"contains",value:t};let n=Ts.exec(t);if(o==="number"){if(n){let l=yn(n[1]),d=yn(n[2]);return l===null||d===null?void 0:{type:"number",op:"between",value:Math.min(l,d),valueTo:Math.max(l,d)}}let i=qo.find(([l])=>t.startsWith(l)),a=yn(i?t.slice(i[0].length):t);return a===null?void 0:{type:"number",op:i?i[1]:"eq",value:a}}if(n){let i=bn(n[1]),a=bn(n[2]);return!i||!a?void 0:{type:"date",op:"between",value:i<a?i:a,valueTo:i<a?a:i}}let r=Wo.find(([i])=>t.startsWith(i)),s=bn(r?t.slice(r[0].length):t);return s?{type:"date",op:r?r[1]:"equals",value:s}:void 0}function Ps(o){if(!o)return"";if(o.type==="text")return o.op==="contains"?o.value??"":"";if(o.type==="number"){if(o.op==="between")return`${o.value}~${o.valueTo}`;let e=qo.find(([,t])=>t===o.op)?.[0];return e&&o.value!==void 0?`${e==="="?"":e}${o.value}`:""}if(o.type==="date"){if(o.op==="between")return`${o.value}~${o.valueTo}`;let e=Wo.find(([,t])=>t===o.op)?.[0];return e&&o.value?`${e==="="?"":e}${o.value}`:""}return""}var bt=class{constructor(e,t){this.grid=e;this.layout="";this.timers=new Map;this.data=null;this.synced=null;this.rebuilt=!1;this.inners={};for(let n of Ye)this.inners[n]=x("div","fg-filter-row",{role:"row"}),t[n].append(this.inners[n])}get height(){return Math.round(this.grid.renderer.opts.rowHeight*.95)}render(){let{columns:e,store:t}=this.grid,n=this.height,r=e.displayed(),s=`${n}|${t.state.locale.code}|${r.map(i=>`${i.id}:${i.left}:${i.width}:${i.region}`).join(",")}`;if(s!==this.layout){this.layout=s;for(let i of Ye){let a=this.inners[i];a.style.width=`${e.regionWidth(i)}px`,a.style.height=`${n}px`,a.replaceChildren(...e.region(i).map(l=>this.cell(l,n)))}this.data=t.state.data,this.rebuilt=!0}else t.state.data!==this.data&&(this.data=t.state.data,this.refreshLists());this.sync()}sync(){let e=this.grid.store.state.filters;if(!(e===this.synced&&!this.rebuilt)){this.synced=e,this.rebuilt=!1;for(let t of Ye)for(let n of this.inners[t].querySelectorAll("[data-col]")){let r=n.dataset.col,s=e[r];if(n.closest(".fg-filter-cell").classList.toggle("fg-filter-active",!!s),!(n===n.ownerDocument.activeElement||n.getRootNode().activeElement===n)){if(n instanceof HTMLSelectElement){let i=s?.type==="set"&&s.values.length===1?JSON.stringify(s.values[0]):"";[...n.options].some(a=>a.value===i)&&(n.value=i)}else n.value=Ps(s);n.classList.remove("fg-filter-bad")}}}}refreshLists(){for(let e of Ye)for(let t of this.inners[e].querySelectorAll("select[data-col]")){let n=this.grid.columns.getNode(t.dataset.col)?.def;if(!n)continue;let r=t.value;if(this.fillOptions(t,n),r&&![...t.options].some(s=>s.value===r)){let s=x("option","",{value:r});s.textContent=String(JSON.parse(r)),t.append(s)}t.value=r}}fillOptions(e,t){let n=x("option","",{value:""});n.textContent=this.grid.store.state.locale.selectAll;let r=this.distinct(t).map(s=>{let i=x("option","",{value:JSON.stringify(s)});return i.textContent=s===!0?"\u2713":s===!1?"\u2717":String(s),i});e.replaceChildren(n,...r)}cell(e,t){let n=x("div","fg-filter-cell");n.style.left=`${e.left}px`,n.style.width=`${e.width}px`,n.style.height=`${t}px`;let r=$(e.id)?null:le(e.def);if(!r)return n;let i=`${this.grid.store.state.locale.filter}: ${e.def.header??e.def.field??e.id}`;if(r==="set"){let d=x("select","fg-filter-input",{"aria-label":i});return d.dataset.col=e.id,this.fillOptions(d,e.def),d.addEventListener("change",()=>{this.grid.setFilter(e.id,d.value?{type:"set",values:[JSON.parse(d.value)]}:null)}),n.append(d),n}let a=x("input","fg-filter-input",{type:"text","aria-label":i,spellcheck:"false",autocomplete:"off"});a.dataset.col=e.id,r==="number"&&(a.placeholder=">0, 10~20"),r==="date"&&(a.placeholder=">2026-01-01");let l=()=>{let d=Ls(r,a.value);a.classList.toggle("fg-filter-bad",d===void 0),d!==void 0&&this.grid.setFilter(e.id,d)};return a.addEventListener("input",()=>{clearTimeout(this.timers.get(e.id)),this.timers.set(e.id,window.setTimeout(l,200))}),a.addEventListener("keydown",d=>{d.stopPropagation(),d.key==="Enter"?(clearTimeout(this.timers.get(e.id)),l()):d.key==="Escape"&&(a.value="",clearTimeout(this.timers.get(e.id)),l())}),n.append(a),n}distinct(e){let t=new Map;for(let n of this.grid.store.state.data){let r=G(e,n);if(r==null||r==="")continue;let s=JSON.stringify(r);if(t.has(s)||t.set(s,r),t.size>=200)break}return[...t.values()].sort((n,r)=>String(n).localeCompare(String(r)))}setTransform(e){this.inners.center.style.transform=`translateX(${-e}px)`}destroy(){for(let e of this.timers.values())clearTimeout(e);for(let e of Ye)this.inners[e].remove()}};function W(o){return o==null||typeof o=="string"&&o.trim()===""||typeof o=="number"&&Number.isNaN(o)}var Uo=o=>String(o).padStart(2,"0");function ne(o){if(W(o))return null;if(typeof o=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(o))return o;let e=o instanceof Date?o:new Date(o);return Number.isNaN(e.getTime())?null:`${e.getFullYear()}-${Uo(e.getMonth()+1)}-${Uo(e.getDate())}`}function Y(o){return W(o)?"":o instanceof Date?ne(o)??"":String(o)}var he=()=>!0;function vt(o){switch(o.type){case"combined":{let e=(Array.isArray(o.conditions)?o.conditions:[]).map(vt);return e.length?o.operator==="or"?t=>e.some(n=>n(t)):t=>e.every(n=>n(t)):he}case"text":{let e=(o.value??"").toLowerCase(),t=n=>W(n)?"":String(n).toLowerCase();switch(o.op){case"contains":return n=>t(n).includes(e);case"equals":return n=>t(n)===e;case"notEquals":return n=>t(n)!==e;case"startsWith":return n=>t(n).startsWith(e);case"endsWith":return n=>t(n).endsWith(e);case"blank":return W;case"notBlank":return n=>!W(n)}return he}case"number":{let e=n=>W(n)?NaN:Number(n);if(o.op==="blank")return n=>Number.isNaN(e(n));if(o.op==="notBlank")return n=>!Number.isNaN(e(n));let t=o.value;if(t==null||Number.isNaN(t))return he;switch(o.op){case"eq":return n=>e(n)===t;case"ne":return n=>e(n)!==t;case"lt":return n=>e(n)<t;case"lte":return n=>e(n)<=t;case"gt":return n=>e(n)>t;case"gte":return n=>e(n)>=t;case"between":{let n=o.valueTo;if(n==null||Number.isNaN(n))return he;let r=Math.min(t,n),s=Math.max(t,n);return i=>{let a=e(i);return a>=r&&a<=s}}}return he}case"date":{if(o.op==="blank")return n=>ne(n)===null;if(o.op==="notBlank")return n=>ne(n)!==null;let e=o.value;if(!e)return he;let t=n=>ne(n);switch(o.op){case"equals":return n=>t(n)===e;case"before":return n=>{let r=t(n);return r!==null&&r<e};case"after":return n=>{let r=t(n);return r!==null&&r>e};case"between":{let n=o.valueTo;if(!n)return he;let r=e<n?e:n,s=e<n?n:e;return i=>{let a=t(i);return a!==null&&a>=r&&a<=s}}}return he}case"set":{let e=new Set(o.values.map(Y));return t=>e.has(Y(t))}}return he}function jo(o){let e=o.trim().toLowerCase();return e?e.split(/\s+/):[]}function Ko(o,e){return o.every(t=>e.includes(t))}function vn(o,e,t){let n=[];for(let r of Array.isArray(o?.conditions)?o.conditions:[]){if(!r||typeof r!="object")continue;if("conditions"in r){let a=vn(r,e,t);a&&n.push(a);continue}let s=e(r.colId);if(!s||!r.model)continue;let i=vt(r.model);n.push(a=>i(t(s,a)))}return n.length?o.operator==="or"?r=>n.some(s=>s(r)):r=>n.every(s=>s(r)):null}var _o=new Map;function Fs(o){if(o==="integer")return{maximumFractionDigits:0};if(o==="percent")return{style:"percent"};if(o.startsWith("currency:"))return{style:"currency",currency:o.slice(9)};if(!/^[#0,]*(\.[#0]+)?%?$/.test(o)||!/[#0]/.test(o))return null;let e=o.endsWith("%"),t=e?o.slice(0,-1):o,n=t.includes(".")?t.split(".")[1]:"";return{useGrouping:t.includes(","),minimumFractionDigits:(n.match(/0/g)??[]).length,maximumFractionDigits:n.length,...e?{style:"percent"}:{}}}var xt={date:{year:"numeric",month:"2-digit",day:"2-digit"},datetime:{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"},time:{hour:"2-digit",minute:"2-digit"},short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"}};function ue(o){if(W(o))return null;if(o instanceof Date)return Number.isNaN(o.getTime())?null:o;if(typeof o=="string"){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(o);if(t)return new Date(Number(t[1]),Number(t[2])-1,Number(t[3]))}if(typeof o!="string"&&typeof o!="number")return null;let e=new Date(o);return Number.isNaN(e.getTime())?null:e}function Ds(o,e,t){switch(o){case"number":{let n={};if(typeof e=="string"){let s=Fs(e);s||B(`unknown number format "${e}"`),n=s??{}}else e&&(n=e);let r=new Intl.NumberFormat(t,n);return s=>{if(W(s))return"";let i=typeof s=="number"?s:Number(s);return Number.isNaN(i)?String(s):r.format(i)}}case"date":{if(t.toLowerCase().startsWith("ko")&&(e===void 0||e==="date"||e==="datetime")){let s=a=>String(a).padStart(2,"0"),i=e==="datetime";return a=>{let l=ue(a);if(!l)return W(a)?"":String(a);let d=`${l.getFullYear()}-${s(l.getMonth()+1)}-${s(l.getDate())}`;return i?`${d} ${s(l.getHours())}:${s(l.getMinutes())}`:d}}let n=xt.date;typeof e=="string"?(xt[e]||B(`unknown date format "${e}"`),n=xt[e]??xt.date):e&&(n=e);let r=new Intl.DateTimeFormat(t,n);return s=>{let i=ue(s);return i?r.format(i):W(s)?"":String(s)}}case"boolean":return n=>n===!0?"\u2713":n===!1?"\u2717":"";default:return n=>W(n)?"":n instanceof Date?n.toISOString():String(n)}}function X(o,e){if(o.sparkline)return s=>Array.isArray(s)?s.join(", "):s==null?"":String(s);let t=o.format,n=`${e}|${o.type??"text"}|${typeof t=="string"?t:JSON.stringify(t??null)}`,r=_o.get(n);return r||(r=Ds(o.type,t,e),_o.set(n,r)),r}function xn(o){let e=[];for(let t of o){if(W(t)||t instanceof Date)continue;let n=typeof t=="number"?t:Number(t);Number.isNaN(n)||e.push(n)}return e}function Xo(o,e){let t=o.filter(r=>r instanceof Date&&!Number.isNaN(r.getTime()));if(t.length)return t.reduce((r,s)=>(e?s>r:s<r)?s:r);let n=xn(o);return n.length?e?Math.max(...n):Math.min(...n):null}function Re(o,e,t){if(typeof o=="function")return o(e,t);switch(o){case"sum":return xn(e).reduce((n,r)=>n+r,0);case"avg":{let n=xn(e);return n.length?n.reduce((r,s)=>r+s,0)/n.length:null}case"min":return Xo(e,!1);case"max":return Xo(e,!0);case"count":return t.length}return null}function Ze(o){return typeof o=="object"&&o!==null&&"agg"in o?o:{agg:o}}function Jo(o,e,t){let n=new Map,r=(s,i)=>{let a=n.get(s);return a||n.set(s,a=e.map(l=>G(i,l))),a};return o.map(s=>{let i={};for(let[a,l]of Object.entries(s.columns??{})){let d=t(a);d&&(i[a]=Re(Ze(l).agg,r(a,d),e))}return i})}function Qe(o,e,t,n,r){if(!o)return 1;let s=1;try{s=Math.floor(Number(o({value:G(e,t),row:t,rowIndex:n})))}catch{s=1}return Number.isFinite(s)?Math.max(1,Math.min(r,s)):1}function Ct(o,e){let t=o.length,n=new Int32Array(t),r=new Int32Array(t);if(e.rowSpan){for(let a=0;a<t;){let l=Qe(e.rowSpan,e,o[a],a,t-a);for(let d=a;d<a+l;d++)n[d]=a,r[d]=a+l-1;a+=l}return{start:n,end:r}}let s=typeof e.merge=="function"?(a,l)=>{try{return!!e.merge(G(e,o[a]),G(e,o[l]),o[a],o[l])}catch{return!1}}:(()=>{let a=o.map(l=>{let d=G(e,l);return W(d)?null:Y(d)});return(l,d)=>a[l]!==null&&a[l]===a[d]})(),i=0;for(let a=1;a<=t;a++)if(!(a<t&&s(a-1,a))){for(let l=i;l<a;l++)n[l]=i,r[l]=a-1;i=a}return{start:n,end:r}}function Yo(o,e,t,n,r=4){if(n<=0||t<=0)return{first:0,last:-1};let s=Math.max(0,Math.floor(o/t)-r),i=Math.floor((o+e)/t);return{first:Math.min(s,n-1),last:Math.min(n-1,i+r)}}function kt(o,e,t,n,r=2){let s=o.length;if(!s)return{first:0,last:-1};let i=0,a=s-1;for(;i<a;){let c=i+a>>1;o[c]+e[c]<=t?i=c+1:a=c}let l=i,d=t+n;for(a=s-1;i<a;){let c=i+a+1>>1;o[c]<d?i=c:a=c-1}return{first:Math.max(0,l-r),last:Math.min(s-1,Math.max(l,i)+r)}}function Zo(o,e,t,n,r=4){if(n<=0)return{first:0,last:-1};let s=0,i=n-1;for(;s<i;){let d=s+i>>1;o[d+1]<=e?s=d+1:i=d}let a=s,l=e+t;for(i=n-1;s<i;){let d=s+i+1>>1;o[d]<l?s=d:i=d-1}return{first:Math.max(0,a-r),last:Math.min(n-1,s+r)}}var oe=["left","center","right"],Qo=6,Is=8,Cn=2,$s='<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M3 4h10M3 8h10M3 12h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>',kn='<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M6 3.5 10.5 8 6 12.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>';var Ns='<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M2.5 3h11l-4.2 5v4.5l-2.6 1.2V8z" fill="currentColor"/></svg>';function x(o,e="",t={}){let n=document.createElement(o);e&&(n.className=e);for(let[r,s]of Object.entries(t))n.setAttribute(r,s);return n}var Rt=class{constructor(e,t,n){this.grid=t;this.opts=n;this.filterRow=null;this.activeCellId="";this.idBase=`fg${Math.random().toString(36).slice(2,8)}`;this.painted={left:new Map,center:new Map,right:new Map};this.pool={left:[],center:[],right:[]};this.frame=0;this.headerDirty=!0;this.version=0;this.rowVersions=new Map;this.lastRange={first:0,last:-1};this.summaryEl=null;this.summaryPanes=null;this.summaryInners=null;this.canvasSummary={left:[],center:[],right:[]};this.topOffset=0;this.pinnedTop=null;this.pinnedBottom=null;this.statusEl=null;this.statusKey="";this.pagerEl=null;this.cards=null;this.cardMode=!1;this.pagerKey="";this.offsets=null;this.details=new Map;this.firstDataId="";this.rowHeights=new Map;this.heightsVersion=0;this.groupLabelId="";this.onScroll=()=>{this.frame&&cancelAnimationFrame(this.frame),this.frame=0,this.render(),this.grid.events.emit("scroll",this.getScroll())};this.onSideWheel=e=>{e.deltaY&&(e.preventDefault(),this.scroller.scrollTop+=e.deltaY)};this.overlayKey="";this.heightFn=null;this.onCardClick=e=>{let t=e.target,n=t.closest(".fg-card");if(!n)return;let r=Number(n.dataset.row),s=this.grid.rowModel.getRow(r);if(!s||s.kind)return;if(t.closest(".fg-card-check")){this.grid.selectFromClick(r,!0,!1),this.invalidate({rows:!0});return}let i=t.closest(".fg-card-value")?.dataset.col,a=i?this.grid.columns.getColumn(i):void 0;a&&this.grid.events.emit("cellClick",{row:s.data,rowIndex:r,colId:a.id,value:G(a.def,s.data),event:e})};this.root=x("div","",{tabindex:"-1"}),this.root.addEventListener("focus",()=>this.gridEl.focus({preventScroll:!0})),this.gridEl=x("div","fg-grid",{role:"grid",tabindex:"0"}),this.headerEl=x("div","fg-header",{role:"rowgroup"}),this.bodyEl=x("div","fg-body",{role:"rowgroup"});let r=s=>({left:x("div",`${s} ${s}-left`),center:x("div",`${s} ${s}-center`),right:x("div",`${s} ${s}-right`)});this.headerPanes=r("fg-header-pane"),this.headerInners=r("fg-header-inner");for(let s of oe)this.headerInners[s].setAttribute("role","row");this.bodyPanes=r("fg-body-pane"),this.canvases=r("fg-canvas");for(let s of oe)this.headerPanes[s].dataset.region=s,this.bodyPanes[s].dataset.region=s,this.headerPanes[s].append(this.headerInners[s]),this.bodyPanes[s].append(this.canvases[s]),this.headerEl.append(this.headerPanes[s]),this.bodyEl.append(this.bodyPanes[s]);this.scroller=this.bodyPanes.center,t.options.filterRow&&(this.filterRow=new bt(t,this.headerPanes)),this.overlay=x("div","fg-overlay",{"aria-live":"polite"}),this.main=x("div","fg-main"),this.gridEl.append(this.headerEl,this.bodyEl),this.main.append(this.gridEl,this.overlay),this.root.append(this.main),e.append(this.root),this.applyTheme(),this.scroller.addEventListener("scroll",this.onScroll,{passive:!0}),this.bodyPanes.left.addEventListener("wheel",this.onSideWheel,{passive:!1}),this.bodyPanes.right.addEventListener("wheel",this.onSideWheel,{passive:!1})}get activeScroller(){return this.cards?.scroller??this.scroller}getScroll(){let e=this.activeScroller;return{top:e.scrollTop,left:e.scrollLeft}}setScroll(e){let t=this.activeScroller;typeof e?.top=="number"&&Number.isFinite(e.top)&&(t.scrollTop=Math.max(0,e.top)),typeof e?.left=="number"&&Number.isFinite(e.left)&&(t.scrollLeft=Math.max(0,e.left))}applyFont(e,t){e?this.root.style.setProperty("--fg-font-size",`${e}px`):this.root.style.removeProperty("--fg-font-size"),t?this.root.style.setProperty("--fg-font",t):this.root.style.removeProperty("--fg-font")}applyTheme(){let e=this.grid.options.direction==="rtl";this.root.className=`fg-root fg-theme-${this.grid.store.state.theme}${e?" fg-rtl":""}${this.cardMode?" fg-card-mode":""}${this.grid.density!=="normal"?` fg-density-${this.grid.density}`:""}`,this.root.setAttribute("dir",e?"rtl":"ltr")}get rtl(){return this.grid.options.direction==="rtl"}invalidate(e={}){e.header&&(this.headerDirty=!0),e.rows&&(this.version++,this.rowVersions.clear()),this.schedule()}invalidateRowIds(e){for(let t of e)this.rowVersions.set(t,(this.rowVersions.get(t)??0)+1);this.schedule()}schedule(){this.frame||(this.frame=requestAnimationFrame(()=>{this.frame=0,this.render()}))}render(){let{columns:e,rowModel:t,store:n,options:r}=this.grid,{rowHeight:s,headerHeight:i}=this.opts,a=this.scroller.offsetWidth-this.scroller.clientWidth;e.setContainerWidth(Math.max(0,this.main.clientWidth-a))&&(this.headerDirty=!0,this.version++);let l=t.getRowCount(),d=!!this.grid.options.autoRowHeight&&!t.server,c=t.layout(s,this.detailHeight(),d?this.rowHeights:void 0,this.heightsVersion,t.server?void 0:this.heightOf);if(this.offsets=c.uniform?null:c.offsets,this.firstDataId=e.displayed().find(C=>!$(C.id))?.id??"",this.groupLabelId=e.region("center").find(C=>!$(C.id))?.id??this.firstDataId,this.useCards()){this.renderCards(l),this.renderStatusBar(t.dataCount()),this.renderPager(),this.orderSections(null),this.paintOverlay(l);return}let u=this.grid.summary(),f=u?u.opts.rows.length:0,p=u?.opts.position??"bottom",g=u?u.opts.pinned!==!1:!1;this.topOffset=u&&!g&&p==="top"?f*s:0;let y=u&&!g&&p==="bottom"?f*s:0;this.syncSummaryPane(u&&g?p:null,f*s);let w=e.depth*i+(this.filterRow?.height??0);this.headerEl.style.height=`${w}px`;for(let C of oe){let S=e.regionWidth(C);C!=="center"&&(this.headerPanes[C].style.width=this.bodyPanes[C].style.width=`${S}px`,this.headerPanes[C].hidden=this.bodyPanes[C].hidden=S===0),this.canvases[C].style.width=`${S}px`,this.canvases[C].style.height=`${this.rowsHeight(l)+this.topOffset+y}px`}r.autoHeight&&!this.useCards()&&(this.root.classList.add("fg-auto-height"),this.bodyEl.style.height=`${this.rowsHeight(l)+this.topOffset+y+Math.max(0,this.scroller.offsetHeight-this.scroller.clientHeight)}px`);let h=this.scroller.offsetHeight-this.scroller.clientHeight;this.bodyPanes.left.style.marginBottom=this.bodyPanes.right.style.marginBottom=`${h}px`;let m=this.gridEl;m.setAttribute("role",r.treeData||this.grid.getGroupBy().length?"treegrid":"grid"),m.setAttribute("aria-rowcount",String(l+e.depth+(this.filterRow?1:0))),m.setAttribute("aria-colcount",String(e.displayed().length)),r.rowSelection==="multiple"&&m.setAttribute("aria-multiselectable","true"),this.headerDirty&&(this.headerDirty=!1,this.renderHeader()),this.filterRow?.render(),this.renderRows(l),this.updateActiveCell(),d&&this.measureRows(),this.renderSummary(l,u&&u.opts.rows,u?.values??[],g,p),this.pinnedTop=this.renderPinned(this.pinnedTop,"top",this.grid.pinnedRows.top),this.pinnedBottom=this.renderPinned(this.pinnedBottom,"bottom",this.grid.pinnedRows.bottom),this.renderStatusBar(t.dataCount()),this.renderPager(),this.orderSections(u&&g?p:null),this.paintOverlay(l),this.overlay.style.top=`${w}px`;let{scrollTop:b,scrollLeft:v}=this.scroller;this.bodyPanes.left.scrollTop=this.bodyPanes.right.scrollTop=b,this.headerInners.center.style.transform=`translateX(${-v}px)`,this.filterRow?.setTransform(v),this.summaryInners&&(this.summaryInners.center.style.transform=`translateX(${-v}px)`);for(let C of[this.pinnedTop,this.pinnedBottom])C&&(C.inners.center.style.transform=`translateX(${-v}px)`);this.grid.fillHandle.update()}orderSections(e){let t=[e==="top"?this.summaryEl:null,this.pinnedTop?.el??null].filter(i=>!!i),n=[this.pinnedBottom?.el??null,e==="bottom"?this.summaryEl:null].filter(i=>!!i),r=[this.statusEl,this.pagerEl].filter(i=>!!i);for(let i of t)i.nextElementSibling!==this.bodyEl&&!t.includes(i.nextElementSibling)&&this.gridEl.insertBefore(i,this.bodyEl);let s=this.bodyEl;for(let i=t.length-1;i>=0;i--)s.previousElementSibling!==t[i]&&this.gridEl.insertBefore(t[i],s),s=t[i];s=this.bodyEl;for(let i of n)s.nextElementSibling!==i&&s.after(i),s=i;s=this.gridEl;for(let i of r)s.nextElementSibling!==i&&s.after(i),s=i}paintOverlay(e){let{grid:t}=this,{store:n,rowModel:r,options:s}=t,i=t.forcedOverlay??(e>0?null:r.loading()?"loading":"noRows");if(this.overlay.hidden=!i,!i){this.overlayKey="";return}let a=!r.server&&n.state.data.length>0,l=i==="loading"?s.loadingOverlay:s.noRowsOverlay,d=`${i}|${a}|${n.state.locale.code}`;if(d!==this.overlayKey)if(this.overlayKey=d,this.overlay.classList.toggle("fg-overlay-custom",typeof l=="function"),l==null)this.overlay.textContent=i==="loading"?n.state.locale.loading:n.state.locale.noRows;else if(typeof l=="string")this.overlay.textContent=l;else try{let c=l({filtered:a});typeof c=="string"?this.overlay.textContent=c:this.overlay.replaceChildren(c)}catch{B(`${i==="loading"?"loadingOverlay":"noRowsOverlay"} threw`),this.overlay.textContent=i==="loading"?n.state.locale.loading:n.state.locale.noRows}}updateActiveCell(){let e=this.activeCellId?this.root.getRootNode().getElementById?.(this.activeCellId)??null:null,t=this.gridEl.querySelector(".fg-body .fg-cell-focused, .fg-body .fg-row-group .fg-cell-focused");if(e&&e!==t&&e.removeAttribute("id"),!t){this.gridEl.removeAttribute("aria-activedescendant"),this.activeCellId="";return}t.id||(t.id=`${this.idBase}-cell`),this.activeCellId=t.id,this.gridEl.setAttribute("aria-activedescendant",t.id)}renderPinned(e,t,n){if(!n.length)return e?.el.remove(),null;let r=e??new Rn(`fg-pinned-rows fg-pinned-${t}`),{columns:s}=this.grid,i=this.opts.rowHeight;r.size(s,n.length*i,this.scroller.offsetWidth-this.scroller.clientWidth);let a=s.region("center"),l=kt(a.map(d=>d.left),a.map(d=>d.width),this.scroller.scrollLeft,this.scroller.clientWidth,Cn);for(let d of oe){let c=d==="center"?a.slice(l.first,l.last+1):s.region(d);r.inners[d].replaceChildren(...n.map((u,f)=>{let p=x("div","fg-row fg-row-pinned",{role:"row"});p.style.transform=`translateY(${f*i}px)`,p.style.height=`${i}px`;let g={id:`pinned-${t}-${f}`,data:u,sourceIndex:-1};for(let y of c){let w=x("div","fg-cell",{role:"gridcell"});$(y.id)?(w.style.left=`${y.left}px`,w.style.width=`${y.width}px`):this.paintCell(w,g,-1,y,!1,!1),p.append(w)}return p}))}return r}renderStatusBar(e){if(!this.grid.options.statusBar){this.statusEl?.remove(),this.statusEl=null;return}let{grid:t}=this,n=t.store.state,r=t.rowModel.server?e:t.viewRows().length,s=`${this.version}|${e}|${r}|${n.selected.size}|${JSON.stringify(n.range)}|${n.locale.code}`;if(this.statusEl&&s===this.statusKey)return;this.statusKey=s,this.statusEl??(this.statusEl=x("div","fg-statusbar",{role:"status","aria-live":"polite"}));let i=n.locale,a=new Intl.NumberFormat(i.code,{maximumFractionDigits:2}),l=x("span","fg-status-rows");l.textContent=(e===r?i.statusRows.replace("{n}",a.format(r)):i.statusFiltered.replace("{shown}",a.format(e)).replace("{total}",a.format(r)))+(n.selected.size?` \xB7 ${i.statusSelected.replace("{n}",a.format(n.selected.size))}`:"");let d=x("span","fg-status-aggs"),c=t.rangeAggregates();if(c&&c.cells>1){let u=[`${i.count} ${a.format(c.count)}`];c.numbers&&u.push(`${i.sum} ${a.format(c.sum)}`,`${i.avg} ${a.format(c.sum/c.numbers)}`,`${i.min} ${a.format(c.min)}`,`${i.max} ${a.format(c.max)}`),d.textContent=u.join(" ")}this.statusEl.replaceChildren(l,d)}renderHeader(){let{columns:e,store:t}=this.grid,{sort:n,filters:r,locale:s}=t.state;for(let i of oe){let a=this.headerInners[i];a.style.width=`${e.regionWidth(i)}px`,a.style.height=`${e.depth*this.opts.headerHeight}px`,a.replaceChildren(...e.headerCells(i).map(l=>this.headerCell(l,n,r,s)))}}headerCell(e,t,n,r){let s=this.opts.headerHeight,i=x("div",e.isGroup?"fg-header-cell fg-header-group":"fg-header-cell",{role:"columnheader"});if(i.dataset.col=e.id,i.style.left=`${e.left}px`,i.style.top=`${e.row*s}px`,i.style.width=`${e.width}px`,i.style.height=`${e.rowSpan*s}px`,$(e.id))return e.id===be&&(i.classList.add("fg-header-rownum"),i.textContent=e.label),e.id===re&&(i.classList.add("fg-header-select"),i.append(this.selectAllBox(r))),i;let a=x("span","fg-header-label"),l=e.node.def;if(a.textContent=e.label,l.headerRenderer)try{let f=l.headerRenderer({header:e.label,column:l});typeof f=="string"?a.innerHTML=f:a.replaceChildren(f)}catch{B(`headerRenderer of column "${e.id}" threw; showing the plain header`),a.textContent=e.label}let d=null;if(e.isGroup&&this.grid.columns.isCollapsible(e.node)){let f=e.node.open,p=x("button",f?"fg-colgroup-toggle fg-expanded":"fg-colgroup-toggle",{type:"button",tabindex:"-1","aria-expanded":String(f),"aria-label":f?r.collapseAll:r.expandAll});p.textContent=f?"\u2212":"+",p.addEventListener("click",g=>{g.stopPropagation(),this.grid.setColumnGroupOpened(e.id,!f)}),i.classList.add("fg-header-collapsible"),d=p}if(l.headerClass)try{let f=typeof l.headerClass=="function"?l.headerClass(l):l.headerClass;f&&i.classList.add(...f.split(/\s+/).filter(Boolean))}catch{B(`headerClass of column "${e.id}" threw`)}if(i.append(a),d&&i.append(d),e.isGroup||!e.column)return i;let c=e.node.def;(c.wrapHeaderText??this.grid.options.wrapHeaderText)&&i.classList.add("fg-header-wrap"),i.setAttribute("aria-colindex",String(e.column.index+1)),(c.align??(c.type==="number"?"right":"left"))==="right"&&i.classList.add("fg-align-right");let u=t.findIndex(f=>f.colId===e.id);if(i.setAttribute("aria-sort",u<0?"none":t[u].dir==="asc"?"ascending":"descending"),Ae(c)&&i.classList.add("fg-sortable"),u>=0){let f=x("span","fg-sort-icon");if(f.textContent=t[u].dir==="asc"?"\u2191":"\u2193",t.length>1){let p=x("sup");p.textContent=String(u+1),f.append(p)}i.append(f)}if(Ae(c)||le(c)){let f=!!n[e.id],p=x("button",f?"fg-menu-btn fg-filter-active":"fg-menu-btn",{type:"button",tabindex:"-1","aria-label":r.columnMenu});p.innerHTML=f?Ns:$s,i.append(p)}return pt(c)&&i.append(x("div","fg-resize",{"aria-hidden":"true"})),i}selectAllBox(e){let t=this.grid.selectableRows(),n=this.grid.store.state.selected,r=0;for(let i of t)n.has(i.id)&&r++;let s=x("input","fg-checkbox fg-select-all",{type:"checkbox",tabindex:"-1","aria-label":e.selectAllRows});return s.checked=t.length>0&&r===t.length,s.indeterminate=r>0&&r<t.length,s.hidden=this.grid.options.rowSelection!=="multiple"||this.grid.options.headerCheckbox===!1,s}renderRows(e){let{columns:t,rowModel:n,store:r}=this.grid,{selected:s,focus:i}=r.state,a=this.grid.allRangeBounds(),l=this.grid.mergeSpans(),d=Math.max(0,this.scroller.scrollTop-this.topOffset),c=this.grid.options.autoHeight&&!n.server?{first:0,last:e-1}:this.offsets?Zo(this.offsets,d,this.scroller.clientHeight,e,Qo):Yo(d,this.scroller.clientHeight,this.opts.rowHeight,e,Qo);this.lastRange=c;let u=t.region("center"),f=kt(u.map(p=>p.left),u.map(p=>p.width),this.scroller.scrollLeft,this.scroller.clientWidth,Cn);u.some(p=>p.def.colSpan)&&(f.first=Math.max(0,f.first-Is));for(let p of oe){let g=p==="center"?u.slice(f.first,f.last+1):t.region(p),y=this.painted[p];for(let[h,m]of y)h>=c.first&&h<=c.last&&g.length||(m.el.remove(),this.pool[p].push(m.el),y.delete(h));if(!g.length)continue;let w=p==="center"?`${f.first}-${f.last}`:"";for(let h=c.first;h<=c.last;h++){let m=n.getRow(h),b=s.has(m.id),v=i&&i.rowIndex===h?i.colId:"",C=a.filter(M=>h>=M.r1&&h<=M.r2),S=C.map(M=>`${M.c1}-${M.c2}`).join(","),T=this.mergeState(l,g,h,c.first),k=m.kind==="detail"?`${this.scroller.scrollLeft}:${this.scroller.clientWidth}`:"",E=`${m.id}|${this.version}.${this.rowVersions.get(m.id)??0}|${w}|${b?1:0}${m.kind==="group"?`:${this.grid.selectionVersion}`:""}|${v}|${S}|${T}|${k}`,R=y.get(h);if(!R){let M=this.pool[p].pop()??x("div","fg-row",{role:"row"});this.canvases[p].append(M),R={el:M,key:""},y.set(h,R)}R.key!==E&&(R.key=E,R.el.dataset.kind!==(m.kind??"")&&(R.el.replaceChildren(),R.el.dataset.kind=m.kind??""),m.kind==="group"?this.paintGroupRow(R.el,m,h,g,v):m.kind==="detail"?this.paintDetailRow(R.el,m,h,p):m.kind==="loading"?this.paintLoadingRow(R.el,h,g):this.paintRow(R.el,m,h,g,b,v,C,l,c.first))}}}mergeState(e,t,n,r){if(!e.size)return"";let s="";for(let i of t){let a=e.get(i.id);if(!a)continue;let l=a.start[n],d=a.end[n];s+=l===d?"n":n===Math.max(l,r)?`d${l}`:"h"}return s}paintRow(e,t,n,r,s,i,a,l=new Map,d=0){let c=this.opts.rowHeight;for(e.className=`fg-row${n%2?" fg-row-odd":""}${s?" fg-row-selected":""}${this.grid.tracker.created.has(t.data)?" fg-row-created":""}${this.grid.editor.editingRow(t.id)?" fg-row-editing":""}`,this.placeRow(e,n),this.grid.options.rowSelection&&e.setAttribute("aria-selected",String(s)),t.level!==void 0?e.setAttribute("aria-level",String(t.level+1)):e.removeAttribute("aria-level"),t.hasChildren?e.setAttribute("aria-expanded",String(!!t.expanded)):e.removeAttribute("aria-expanded");e.childElementCount>r.length;)e.lastElementChild.remove();for(;e.childElementCount<r.length;)e.append(x("div","fg-cell",{role:"gridcell"}));let u=!1,f=r.length?this.grid.columns.region(r[0].region):[],p=f.some(w=>w.def.colSpan),g=-1,y=p?new Map(f.map((w,h)=>[w.id,h])):null;r.forEach((w,h)=>{let m=e.children[h];if(this.paintCell(m,t,n,w,s,i===w.id),y){let v=y.get(w.id);if(v<=g)m.classList.add("fg-cell-span-hidden");else if(w.def.colSpan&&!$(w.id)){let C=Qe(w.def.colSpan,w.def,t.data,n,f.length-v);if(C>1){g=v+C-1;let S=0;for(let T=v;T<=g;T++)S+=f[T].width;m.style.width=`${S}px`,m.classList.add("fg-cell-colspan")}}}w.id===this.firstDataId&&this.decorate(m,t),m.style.top=m.style.height=m.style.bottom="";let b=l.get(w.id);b&&b.start[n]!==b.end[n]&&(n===Math.max(b.start[n],d)?(m.classList.add("fg-cell-merged"),m.style.top=`${-(this.rowTop(n)-this.rowTop(b.start[n]))}px`,m.style.height=`${this.rowTop(b.end[n])+this.rowH(b.end[n])-this.rowTop(b.start[n])}px`,m.style.bottom="auto",u=!0):m.classList.add("fg-cell-merge-hidden")),!$(w.id)&&a.some(v=>w.index>=v.c1&&w.index<=v.c2)&&m.classList.add("fg-cell-range")}),e.style.zIndex=u?"1":""}paintCell(e,t,n,r,s,i){let a=this.grid.store.state.locale;e.style.left=`${r.left}px`,e.style.width=`${r.width}px`,e.dataset.col=r.id,e.setAttribute("aria-colindex",String(r.index+1));let l=i?"fg-cell fg-cell-focused":"fg-cell";if(r.id===be){e.className=`${l} fg-cell-rownum`;let g=n>=0&&!t.kind?this.grid.rowNumber(n):null;e.textContent=g===null?"":String(g);return}if(r.id===Ee){e.className=`${l} fg-cell-drag`;let g=x("span",this.grid.canMoveRows()?"fg-drag-handle":"fg-drag-handle fg-drag-disabled",{"aria-hidden":"true"});g.textContent="\u22EE\u22EE",e.replaceChildren(g);return}if(r.id===re){e.className=`${l} fg-cell-select`;let g=x("input","fg-checkbox",{type:"checkbox",tabindex:"-1","aria-label":a.selectRow});g.checked=s,n>=0&&!t.kind&&!this.grid.rowSelectable(t.data)&&(g.disabled=!0,e.classList.add("fg-cell-select-locked")),e.replaceChildren(g);return}let d=r.def,c=G(d,t.data),u=X(d,a.code)(c);l+=` fg-align-${d.align??(d.type==="number"?"right":d.type==="boolean"?"center":"left")}`;let f={value:c,formatted:u,row:t.data,rowIndex:n,column:d};if(d.cellClass)try{let g=typeof d.cellClass=="function"?d.cellClass(f):d.cellClass;g&&(l+=` ${g}`)}catch{B(`cellClass of column "${r.id}" threw`)}this.grid.tracker.isDirty(t.data,d.field)&&(l+=" fg-cell-dirty"),d.wrapText&&(l+=" fg-cell-wrap"),typeof d.editable=="function"&&n>=0&&!pe(d,t.data,n)&&(l+=" fg-cell-readonly"),n>=0&&(l+=this.grid.finder.classFor(n,r.id)),l+=this.grid.flashClass(t.id,r.id);let p=n>=0&&!t.kind?this.grid.cellFormat(t.data,r.id,c):null;if(p?.bar&&(l+=" fg-cf-bar"),e.className=l,this.applyFormat(e,p),d.sparkline&&!d.renderer){let g=Array.isArray(c)?c.map(Number).filter(Number.isFinite):[];g.length?e.replaceChildren(Os(g,d.sparkline===!0?{}:d.sparkline,r.width,this.opts.rowHeight)):e.replaceChildren(),e.setAttribute("aria-label",Array.isArray(c)?c.join(", "):"");return}if(!d.renderer){if(e.textContent=u,p?.icon){let g=x("span","fg-cf-icon",{"aria-hidden":"true"});g.textContent=p.icon.char,g.style.color=p.icon.color,e.prepend(g)}return}try{let g=d.renderer(f);typeof g=="string"?e.innerHTML=g:e.replaceChildren(g)}catch{B(`renderer of column "${r.id}" threw; rendering an empty cell`),e.textContent=""}}applyFormat(e,t){let n=e.style;if(!t){e.dataset.cf&&(n.color=n.background=n.fontWeight=n.fontStyle=n.textDecoration="",n.removeProperty("--fg-bar-from"),n.removeProperty("--fg-bar-to"),n.removeProperty("--fg-bar-color"),delete e.dataset.cf);return}e.dataset.cf="1";let r=t.style;n.color=r.color??"",n.background=r.background??"",n.fontWeight=r.bold?"600":"",n.fontStyle=r.italic?"italic":"",n.textDecoration=r.strike?"line-through":"",t.bar?(n.setProperty("--fg-bar-from",`${(t.bar.from*100).toFixed(2)}%`),n.setProperty("--fg-bar-to",`${(t.bar.to*100).toFixed(2)}%`),n.setProperty("--fg-bar-color",t.bar.color)):(n.removeProperty("--fg-bar-from"),n.removeProperty("--fg-bar-to"),n.removeProperty("--fg-bar-color"))}cellAt(e){let t=e instanceof Element?e.closest(".fg-cell"):null,n=t?.parentElement;return!t||!n?.dataset.row||!t.dataset.col||t.closest(".fg-root")!==this.root?null:{rowIndex:Number(n.dataset.row),colId:t.dataset.col}}ensureVisible(e,t){let n=this.scroller,r=this.rowTop(e),s=r+Math.min(this.rowH(e),n.clientHeight||1/0);r<n.scrollTop?n.scrollTop=r:s>n.scrollTop+n.clientHeight&&(n.scrollTop=s-n.clientHeight);let i=t?this.grid.columns.getColumn(t):void 0;i?.region==="center"&&(i.left<n.scrollLeft?n.scrollLeft=i.left:i.left+i.width>n.scrollLeft+n.clientWidth&&(n.scrollLeft=i.left+i.width-n.clientWidth))}syncSummaryPane(e,t){if(!e){this.summaryEl?.remove(),this.summaryEl=this.summaryPanes=this.summaryInners=null;return}if(!this.summaryEl){let r=s=>({left:x("div",`${s} ${s}-left`),center:x("div",`${s} ${s}-center`),right:x("div",`${s} ${s}-right`)});this.summaryEl=x("div","fg-summary",{role:"rowgroup"}),this.summaryPanes=r("fg-summary-pane"),this.summaryInners=r("fg-summary-inner");for(let s of oe)this.summaryPanes[s].append(this.summaryInners[s]),this.summaryEl.append(this.summaryPanes[s])}this.summaryEl.className=`fg-summary fg-summary-${e}`,this.summaryEl.style.height=`${t}px`;for(let r of oe){let s=this.grid.columns.regionWidth(r);r!=="center"&&(this.summaryPanes[r].style.width=`${s}px`,this.summaryPanes[r].hidden=s===0),this.summaryInners[r].style.width=`${s}px`,this.summaryInners[r].style.height=`${t}px`}let n=this.scroller.offsetWidth-this.scroller.clientWidth;this.summaryPanes.center.style.marginRight=`${n}px`}renderSummary(e,t,n,r,s){for(let u of oe){for(let f of this.canvasSummary[u])f.remove();this.canvasSummary[u]=[]}if(!t)return;let{columns:i}=this.grid,a=this.opts.rowHeight,l=i.region("center"),d=kt(l.map(u=>u.left),l.map(u=>u.width),this.scroller.scrollLeft,this.scroller.clientWidth,Cn),c=i.displayed().filter(u=>!$(u.id));for(let u of oe){let f=u==="center"?l.slice(d.first,d.last+1):i.region(u),p=t.map((g,y)=>{let w=g.label!=null?c.find(b=>!(b.id in(g.columns??{})))?.id??null:null,h=x("div","fg-row fg-summary-row",{role:"row"}),m=r||s==="top"?y*a:this.rowsHeight(e)+y*a;h.style.transform=`translateY(${m}px)`,h.style.height=`${a}px`;for(let b of f)h.append(this.summaryCell(b,g,n[y]??{},w));return h});r?this.summaryInners[u].replaceChildren(...p):(this.canvases[u].append(...p),this.canvasSummary[u]=p)}}summaryCell(e,t,n,r){let s=x("div","fg-cell",{role:"gridcell"});s.style.left=`${e.left}px`,s.style.width=`${e.width}px`,s.dataset.col=e.id;let i=e.def,a=i.align??(i.type==="number"?"right":i.type==="boolean"?"center":"left");s.className=`fg-cell fg-align-${a}`;let l=t.columns?.[e.id];if(l===void 0)return e.id===r&&(s.textContent=t.label??"",s.classList.add("fg-summary-label")),s;let d=n[e.id],c=Ze(l),u=this.grid.store.state.locale.code,f;if(d==null||d==="")f="";else if(typeof d=="string")f=d;else if(c.agg==="count")f=new Intl.NumberFormat(u).format(d);else{let p=i.type??(typeof d=="number"?"number":d instanceof Date?"date":void 0);f=X({...i,type:p,format:c.format??i.format},u)(d)}return s.textContent=c.prefix&&f?`${c.prefix} ${f}`:f,s}get heightOf(){let e=this.grid.options.getRowHeight;if(e)return this.heightFn??(this.heightFn=t=>{try{return e(t)??void 0}catch{return}})}invalidateHeights(){this.heightOf&&this.heightsVersion++,this.rowHeights.size&&(this.rowHeights.clear(),this.heightsVersion++)}measureRows(){let e=this.opts.rowHeight,t=new Map;for(let r of oe)for(let[s,i]of this.painted[r]){let a=this.grid.rowModel.getRow(s);if(!a||a.kind)continue;let l=t.get(s)??e;for(let d of i.el.querySelectorAll(".fg-cell-wrap"))d.classList.contains("fg-cell-merged")||d.classList.contains("fg-cell-merge-hidden")||(l=Math.max(l,Math.ceil(d.scrollHeight)));t.set(s,l)}let n=!1;for(let[r,s]of t){let i=this.grid.rowModel.getRow(r).id,a=this.rowHeights.get(i)??e;Math.abs(a-s)>1&&(s===e?this.rowHeights.delete(i):this.rowHeights.set(i,s),n=!0)}n&&(this.heightsVersion++,this.version++,this.schedule())}detailHeight(){let e=this.grid.options.detailHeight;return typeof e=="number"&&e>0?e:240}rowTop(e){return(this.offsets?this.offsets[e]:e*this.opts.rowHeight)+this.topOffset}rowH(e){return this.offsets?this.offsets[e+1]-this.offsets[e]:this.opts.rowHeight}rowsHeight(e){return this.offsets?this.offsets[e]:e*this.opts.rowHeight}placeRow(e,t){e.style.transform=`translateY(${this.rowTop(t)}px)`,e.style.height=`${this.rowH(t)}px`,e.dataset.row=String(t),e.setAttribute("aria-rowindex",String(t+1+this.grid.columns.depth+(this.filterRow?1:0)))}decorate(e,t){let{grid:n}=this,r=n.store.state.locale,s=t.level??0,i=!!n.options.treeData,a=n.canExpandDetail(t.data);if(!i&&!a&&!s)return;e.classList.add("fg-cell-lead"),e.style.setProperty("--fg-level",String(s));let l=[];if(i)if(t.hasChildren){let d=x("button",t.expanded?"fg-tree-toggle fg-expanded":t.loading?"fg-tree-toggle fg-tree-loading":"fg-tree-toggle",{type:"button",tabindex:"-1","aria-label":t.expanded?r.collapseAll:r.expandAll,"aria-expanded":String(!!t.expanded)});t.loading&&d.setAttribute("aria-busy","true"),d.innerHTML=kn,l.push(d)}else l.push(x("span","fg-tree-spacer",{"aria-hidden":"true"}));if(a){let d=n.isDetailExpanded(t.data),c=x("button",d?"fg-detail-toggle fg-expanded":"fg-detail-toggle",{type:"button",tabindex:"-1","aria-expanded":String(d),"aria-label":d?r.collapseAll:r.expandAll});c.innerHTML=kn,l.push(c)}e.prepend(...l)}paintGroupRow(e,t,n,r,s){let i=t.group,{grid:a}=this,l=a.store.state.locale;for(e.className="fg-row fg-row-group",this.placeRow(e,n),e.setAttribute("aria-level",String((t.level??0)+1)),e.setAttribute("aria-expanded",String(i.expanded)),e.removeAttribute("aria-selected"),e.style.zIndex="";e.childElementCount>r.length;)e.lastElementChild.remove();for(;e.childElementCount<r.length;)e.append(x("div","fg-cell",{role:"gridcell"}));r.forEach((d,c)=>{let u=e.children[c];u.style.left=`${d.left}px`,u.style.width=`${d.width}px`,u.style.top=u.style.height=u.style.bottom="",u.style.removeProperty("--fg-level"),u.dataset.col=d.id,u.setAttribute("aria-colindex",String(d.index+1));let f=s===d.id?" fg-cell-focused":"";if(d.id===re){if(u.className=`fg-cell fg-cell-select${f}`,a.options.rowSelection!=="multiple"){u.replaceChildren();return}let w=a.groupSelection(t),h=x("input","fg-checkbox",{type:"checkbox",tabindex:"-1","aria-label":l.selectAllRows});h.checked=w==="all",h.indeterminate=w==="some",u.replaceChildren(h);return}if(d.id===this.groupLabelId){u.className=`fg-cell fg-group-cell${f}`,u.style.setProperty("--fg-level",String(t.level??0));let w=x("button",i.expanded?"fg-group-toggle fg-expanded":"fg-group-toggle",{type:"button",tabindex:"-1","aria-expanded":String(i.expanded),"aria-label":i.expanded?l.collapseAll:l.expandAll});w.innerHTML=kn;let h=a.columns.getNode(i.colId)?.def,m=x("span","fg-group-label"),b=W(i.value)?l.blanks:h?X(h,l.code)(i.value):String(i.value),v=new Intl.NumberFormat(l.code),C=i.count??(i.aggregates?null:i.rows.length);m.textContent=`${h?.header??h?.field??i.colId}: ${b}${C==null?"":` (${v.format(C)})`}`,u.replaceChildren(w,m);return}let p=d.def,g=p.align??(p.type==="number"?"right":p.type==="boolean"?"center":"left");u.className=`fg-cell fg-align-${g}${f}`;let y=p.aggFunc&&!$(d.id)?a.groupAggregate(t,d.id):void 0;if(y==null||y==="")u.textContent="";else if(p.aggFunc==="count")u.textContent=new Intl.NumberFormat(l.code).format(y);else{let w=p.type??(typeof y=="number"?"number":y instanceof Date?"date":void 0);u.textContent=X({...p,type:w},l.code)(y)}u.textContent&&u.classList.add("fg-cell-agg")})}paintDetailRow(e,t,n,r){if(e.className="fg-row fg-row-detail",this.placeRow(e,n),e.style.zIndex="",r!=="center"){e.replaceChildren();return}let s=t.detailOf,i=this.details.get(s.id);if(!i){i=x("div","fg-detail");try{let a=this.grid.options.detailRenderer?.({row:s.data,rowIndex:n-1});typeof a=="string"?i.innerHTML=a:a&&i.append(a)}catch{B("detailRenderer threw; showing an empty panel")}this.details.set(s.id,i)}i.style.left=`${this.scroller.scrollLeft}px`,i.style.width=`${this.scroller.clientWidth||this.grid.columns.regionWidth("center")}px`,(e.firstChild!==i||e.childNodes.length!==1)&&e.replaceChildren(i)}paintLoadingRow(e,t,n){e.className="fg-row fg-row-loading",this.placeRow(e,t),e.setAttribute("aria-busy","true"),e.style.zIndex="",e.replaceChildren(...n.map(r=>{let s=x("div","fg-cell",{role:"gridcell"});return s.style.left=`${r.left}px`,s.style.width=`${r.width}px`,s.dataset.col=r.id,$(r.id)||s.append(x("span","fg-skeleton",{"aria-hidden":"true"})),s}))}renderPager(){let{grid:e}=this,t=e.options.pagination;if(!t){this.pagerEl?.remove(),this.pagerEl=null;return}let n=e.store.state.locale,r=e.getPage(),s=e.getPageSize(),i=e.getPageCount(),a=e.rowModel.fullCount(),l=typeof t=="object"&&Array.isArray(t.pageSizes)?t.pageSizes.filter(h=>Number.isInteger(h)&&h>0):[],d=`${r}|${s}|${i}|${a}|${n.code}|${l.join(",")}`;if(this.pagerEl&&d===this.pagerKey)return;this.pagerKey=d,this.pagerEl||(this.pagerEl=x("div","fg-pager",{role:"navigation"}),this.pagerEl.addEventListener("click",h=>{let m=h.target.closest("button[data-action]")?.dataset.action,b=e.getPage();m==="first"?e.setPage(0):m==="prev"?e.setPage(b-1):m==="next"?e.setPage(b+1):m==="last"&&e.setPage(e.getPageCount()-1)}),this.pagerEl.addEventListener("change",h=>{let m=h.target;m.classList.contains("fg-pager-size")&&e.setPageSize(Number(m.value))})),this.pagerEl.setAttribute("aria-label",n.pageSize);let c=new Intl.NumberFormat(n.code),u=a?r*s+1:0,f=Math.min(a,(r+1)*s),p=x("span","fg-pager-range");p.textContent=n.pagerRange.replace("{from}",c.format(u)).replace("{to}",c.format(f)).replace("{total}",c.format(a));let g=[p,x("span","fg-pager-spacer")];if(l.length){let h=x("label","fg-pager-size-label");h.textContent=n.pageSize;let m=x("select","fg-pager-size");for(let b of[...new Set([...l,s])].sort((v,C)=>v-C)){let v=x("option");v.value=String(b),v.textContent=c.format(b),v.selected=b===s,m.append(v)}h.append(m),g.push(h)}let y=(h,m,b,v)=>{let C=x("button","fg-pager-btn",{type:"button","aria-label":b,title:b});return C.dataset.action=h,C.textContent=m,C.disabled=v,C},w=x("span","fg-pager-page",{"aria-live":"polite"});w.textContent=n.pageOf.replace("{page}",c.format(r+1)).replace("{pages}",c.format(i)),g.push(y("first","\xAB",n.firstPage,r===0),y("prev","\u2039",n.previousPage,r===0),w,y("next","\u203A",n.nextPage,r>=i-1),y("last","\xBB",n.lastPage,r>=i-1)),this.pagerEl.replaceChildren(...g)}showFreeBadge(){if(this.root.querySelector(".fg-free-badge"))return;let e=x("a","fg-free-badge",{href:"https://freegrid.app/pricing/",target:"_blank",rel:"noopener"});e.innerHTML='<svg viewBox="0 0 32 32" width="14" height="14" aria-hidden="true"><rect width="32" height="32" rx="7" fill="#0E1726"/><path d="M7 11.5h18M7 16.5h18M7 21.5h18M13 7v18" stroke="#fff" stroke-width="2" stroke-linecap="round"/><rect x="14" y="12.5" width="11" height="3" rx="1" fill="#F2A900"/></svg>';let t=x("span");t.textContent=`FreeGrid \xB7 ${this.grid.store.state.locale.freeBadge}`,e.append(t),this.root.append(e)}useCards(){let e=this.grid.options.cardView,t=e===!0?640:typeof e=="number"?e:-1,n=t>0&&this.main.clientWidth<t;return n!==this.cardMode&&(this.cardMode=n,this.root.classList.toggle("fg-card-mode",n),!n&&this.cards&&(this.cards.scroller.remove(),this.cards=null),this.version++),n}renderCards(e){let{grid:t}=this;if(!this.cards){let y=x("div","fg-cards",{role:"list"}),w=x("div","fg-cards-canvas");y.append(w),this.main.insertBefore(y,this.overlay),y.addEventListener("scroll",()=>{this.schedule(),this.grid.events.emit("scroll",this.getScroll())},{passive:!0}),y.addEventListener("click",this.onCardClick),this.cards={scroller:y,canvas:w}}let{scroller:n,canvas:r}=this.cards,s=t.columns.displayed().filter(y=>!$(y.id)),i=Math.round(this.opts.rowHeight*.75),a=!!t.options.rowSelection,l=20+s.length*i+(a?i:0),d=10;r.style.height=`${e*(l+d)}px`;let c=Math.max(0,Math.floor(n.scrollTop/(l+d))-2),u=Math.min(e-1,Math.ceil((n.scrollTop+(n.clientHeight||800))/(l+d))+2),{selected:f,locale:p}=t.store.state,g=[];for(let y=c;y<=u;y++){let w=t.rowModel.getRow(y);if(!w)continue;let h=x("div",w.kind?"fg-card fg-card-other":f.has(w.id)?"fg-card fg-card-selected":"fg-card",{role:"listitem"});if(h.dataset.row=String(y),h.style.transform=`translateY(${y*(l+d)}px)`,h.style.height=`${l}px`,h.style.setProperty("--fg-card-line",`${i}px`),w.kind==="group"&&w.group){let m=t.columns.getNode(w.group.colId)?.def;h.textContent=`${m?.header??w.group.colId}: ${String(w.group.value??p.blanks)} (${w.group.rows.length})`}else if(!w.kind){if(a){let m=x("label","fg-card-head"),b=x("input","fg-card-check fg-checkbox",{type:"checkbox","aria-label":p.selectRow});b.checked=f.has(w.id),b.disabled=!t.rowSelectable(w.data),m.append(b,document.createTextNode(`#${y+1}`)),h.append(m)}for(let m of s){let b=x("div","fg-card-line"),v=x("span","fg-card-label");v.textContent=m.def.header??m.def.field??m.id;let C=x("span","fg-card-value");C.dataset.col=m.id;let S=G(m.def,w.data),T=X(m.def,p.code)(S);if(m.def.renderer)try{let k=m.def.renderer({value:S,formatted:T,row:w.data,rowIndex:y,column:m.def});typeof k=="string"?C.innerHTML=k:C.replaceChildren(k)}catch{C.textContent=T}else C.textContent=T;b.append(v,C),h.append(b)}}g.push(h)}r.replaceChildren(...g)}dropDetail(e){e===void 0?this.details.clear():this.details.delete(e)}renderedRange(){return this.lastRange}measureText(e,t){let n=getComputedStyle(this.main),r=parseFloat(getComputedStyle(this.root).getPropertyValue("--fg-font-size"))||13;this.measureCtx===void 0&&(this.measureCtx=document.createElement("canvas").getContext("2d"));let s=this.measureCtx;return s?(s.font=`${t?600:400} ${r}px ${n.fontFamily||"sans-serif"}`,s.measureText(e).width):e.length*r*.6}scrollToRow(e){this.scroller.scrollTop=this.rowTop(Math.max(0,Math.min(e,this.grid.rowModel.getRowCount())))}pageRows(){return Math.max(1,Math.floor(this.scroller.clientHeight/this.opts.rowHeight))}destroy(){this.filterRow?.destroy(),this.frame&&cancelAnimationFrame(this.frame),this.scroller.removeEventListener("scroll",this.onScroll),this.root.remove()}},Rn=class{constructor(e){let t=n=>({left:x("div",`${n} ${n}-left`),center:x("div",`${n} ${n}-center`),right:x("div",`${n} ${n}-right`)});this.el=x("div",e,{role:"rowgroup"}),this.panes=t("fg-section-pane"),this.inners=t("fg-section-inner");for(let n of oe)this.panes[n].append(this.inners[n]),this.el.append(this.panes[n])}size(e,t,n){this.el.style.height=`${t}px`;for(let r of oe){let s=e.regionWidth(r);r!=="center"&&(this.panes[r].style.width=`${s}px`,this.panes[r].hidden=s===0),this.inners[r].style.width=`${s}px`,this.inners[r].style.height=`${t}px`}this.panes.center.style.marginRight=`${n}px`}},er="http://www.w3.org/2000/svg";function Os(o,e,t,n){let r=Math.max(20,t-16),s=Math.max(10,n-14),i=document.createElementNS(er,"svg");i.setAttribute("class","fg-sparkline"),i.setAttribute("width",String(r)),i.setAttribute("height",String(s)),i.setAttribute("viewBox",`0 0 ${r} ${s}`),i.setAttribute("aria-hidden","true");let a=e.color??"var(--fg-accent)",l=e.type==="bar",d=l?Math.min(0,...o):Math.min(...o),c=l?Math.max(0,...o):Math.max(...o);d===c&&(d-=1,c+=1);let u=c-d,f=h=>s-1-(h-d)/u*(s-2),p=(h,m)=>{let b=document.createElementNS(er,h);for(let[v,C]of Object.entries(m))b.setAttribute(v,String(C));return i.append(b),b};if(e.type==="bar"){let h=r/o.length;return o.forEach((m,b)=>p("rect",{x:b*h+1,y:Math.min(f(m),f(0)),width:Math.max(1,h-2),height:Math.max(1,Math.abs(f(m)-f(0))),fill:m<0?"#ef4444":a})),i}let g=o.length>1?(r-2)/(o.length-1):0,y=o.map((h,m)=>`${1+m*g},${f(h)}`).join(" ");e.type==="area"&&p("polygon",{points:`1,${s} ${y} ${1+(o.length-1)*g},${s}`,fill:a,"fill-opacity":.2}),p("polyline",{points:y,fill:"none",stroke:a,"stroke-width":1.5,"stroke-linejoin":"round"});let w=o.length-1;return p("circle",{cx:1+w*g,cy:f(o[w]),r:2,fill:a}),i}var Bs=4,St=class{constructor(e){this.grid=e;this.onClick=e=>{let n=e.target.closest(".fg-group-chip-remove")?.closest(".fg-group-chip")?.dataset.col;n&&this.grid.setGroupBy(this.grid.getGroupBy().filter(r=>r!==n))};this.onPointerDown=e=>{let t=e.target,n=t.closest(".fg-group-chip");if(e.button!==0||!n||t.closest("button"))return;let r=n.dataset.col,s=e.clientX,i=!1,a=d=>{!i&&Math.abs(d.clientX-s)<Bs||(i=!0,n.classList.add("fg-dragging"))},l=d=>{if(window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",l),n.classList.remove("fg-dragging"),!i)return;let u=[...this.el.querySelectorAll(".fg-group-chip")].filter(p=>p!==n).filter(p=>{let g=p.getBoundingClientRect();return d.clientX>g.left+g.width/2}).length,f=this.grid.getGroupBy().filter(p=>p!==r);f.splice(u,0,r),this.grid.setGroupBy(f)};window.addEventListener("pointermove",a),window.addEventListener("pointerup",l)};this.el=x("div","fg-group-panel",{role:"toolbar"}),e.renderer.main.insertBefore(this.el,e.renderer.gridEl),this.el.addEventListener("click",this.onClick),this.el.addEventListener("pointerdown",this.onPointerDown),this.refresh()}contains(e,t){let n=this.el.getBoundingClientRect();return e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom}highlight(e){this.el.classList.toggle("fg-group-panel-over",e)}refresh(){let{grid:e}=this,t=e.store.state.locale;this.el.setAttribute("aria-label",t.groupByThis);let n=e.getGroupBy();if(!n.length){let r=x("span","fg-group-hint");r.textContent=t.groupPanelHint,this.el.replaceChildren(r);return}this.el.replaceChildren(...n.map((r,s)=>{let i=e.columns.getNode(r)?.def,a=x("span","fg-group-chip");a.dataset.col=r;let l=x("span","fg-group-chip-label");l.textContent=i?.header??i?.field??r;let d=x("button","fg-group-chip-remove",{type:"button","aria-label":`${t.ungroup}: ${l.textContent}`});if(d.textContent="\xD7",a.append(l,d),s<n.length-1){let c=x("span","fg-group-sep",{"aria-hidden":"true"});return c.textContent="\u203A",[a,c]}return[a]}).flat())}destroy(){this.el.removeEventListener("click",this.onClick),this.el.removeEventListener("pointerdown",this.onPointerDown),this.el.remove()}};var Ve=class{constructor(){this.listeners=new Map}on(e,t){let n=this.listeners.get(e);return n||this.listeners.set(e,n=new Set),n.add(t),()=>{n.delete(t)}}emit(e,t){let n=this.listeners.get(e);if(n)for(let r of[...n])try{r(t)}catch(s){console.error("[FreeGrid] event listener threw",s)}}clear(){this.listeners.clear()}};function ee(o){let e=o.getRootNode();return typeof ShadowRoot<"u"&&e instanceof ShadowRoot?e:document.body}function et(o,e,t){let n=o.getRootNode();return(typeof n.elementFromPoint=="function"?n.elementFromPoint(e,t):null)??document.elementFromPoint(e,t)}function tr(o){return o.getRootNode().activeElement??document.activeElement}function ie(o,...e){let t=typeof o.composedPath=="function"?o.composedPath():[];return t.length?e.some(n=>!!n&&t.includes(n)):e.some(n=>!!n&&n.contains(o.target))}var Sn=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Home","End","PageUp","PageDown"]);function Mn(o,e,t,n){let r=i=>Math.max(0,Math.min(n.rows-1,i)),s=i=>Math.max(0,Math.min(n.cols-1,i));switch(o){case"ArrowUp":return{rowIndex:r(t.rowIndex-1),colIndex:t.colIndex};case"ArrowDown":return{rowIndex:r(t.rowIndex+1),colIndex:t.colIndex};case"ArrowLeft":return{rowIndex:t.rowIndex,colIndex:s(t.colIndex-1)};case"ArrowRight":return{rowIndex:t.rowIndex,colIndex:s(t.colIndex+1)};case"PageUp":return{rowIndex:r(t.rowIndex-n.pageRows),colIndex:t.colIndex};case"PageDown":return{rowIndex:r(t.rowIndex+n.pageRows),colIndex:t.colIndex};case"Home":return{rowIndex:e.ctrl?0:t.rowIndex,colIndex:0};case"End":return{rowIndex:e.ctrl?n.rows-1:t.rowIndex,colIndex:n.cols-1};case"Tab":{let i=t.rowIndex*n.cols+t.colIndex+(e.shift?-1:1);return i<0||i>=n.rows*n.cols?null:{rowIndex:Math.floor(i/n.cols),colIndex:i%n.cols}}default:return null}}var Mt=new Map,nr=o=>o?Mt.get(o):void 0;var Hs={Enter:"edit",F2:"edit",Delete:"clear",Backspace:"clear","Ctrl+Z":"undo","Ctrl+Y":"redo","Ctrl+Shift+Z":"redo","Ctrl+F":"find"};function Gs(o){let e=[];return(o.ctrlKey||o.metaKey)&&e.push("Ctrl"),o.altKey&&e.push("Alt"),o.shiftKey&&o.key.length>1&&e.push("Shift"),o.shiftKey&&o.key.length===1&&(o.ctrlKey||o.metaKey)&&e.push("Shift"),e.push(o.key.length===1?o.key.toUpperCase():o.key),e.join("+")}var zs=3;function Vs(o,e){return o.renderer.rtl?e.key==="ArrowLeft"?"ArrowRight":e.key==="ArrowRight"?"ArrowLeft":e.key:e.key}function or(o){let{renderer:e}=o,t=e.bodyEl,n=e.root,r=k=>Vs(o,k),s="mouse",i=0,a=!1,l=k=>{let E=e.cellAt(k.target);if(!E)return null;let R=o.rowModel.getRow(E.rowIndex),M=o.columns.getColumn(E.colId);if(!R||!M)return null;let A=$(M.id)?void 0:G(M.def,R.data);return{row:R.data,rowIndex:E.rowIndex,colId:E.colId,value:A,event:k}},d=k=>{let E=k.target.closest?.(".fg-group-toggle, .fg-tree-toggle, .fg-detail-toggle"),R=E&&e.cellAt(k.target);if(!R)return!1;e.gridEl.focus({preventScroll:!0}),o.setFocus(R.rowIndex,R.colId),o.setRange(null);let M=o.rowModel.getRow(R.rowIndex);return E.classList.contains("fg-detail-toggle")?o.setDetailExpanded(M.data,!o.isDetailExpanded(M.data)):o.toggleRow(R.rowIndex),!0},c=k=>{if(d(k))return;let E=o.store.state.focus,R=e.cellAt(k.target);if(R&&o.rowModel.getRow(R.rowIndex)?.kind){R.colId===re&&o.rowModel.getRow(R.rowIndex).kind==="group"&&o.toggleGroupSelection(o.rowModel.getRow(R.rowIndex)),e.gridEl.focus({preventScroll:!0}),o.setFocus(R.rowIndex,R.colId),o.setRange(null);return}let M=l(k);if(!M)return;if(e.gridEl.focus({preventScroll:!0}),M.colId===be){let D=o.columns.displayed().filter(I=>!$(I.id));D.length&&(o.setFocus(M.rowIndex,D[0].id),o.setRange({start:{rowIndex:M.rowIndex,colId:D[0].id},end:{rowIndex:M.rowIndex,colId:D[D.length-1].id}}));return}let A=a;a=!1;let L=o.store.state.focus,F=M.colId===re;if(!A)if(k.shiftKey&&L&&!F&&!$(L.colId)&&o.options.rangeSelection!==!1)o.setRange({start:L,end:{rowIndex:M.rowIndex,colId:M.colId}},!0);else if((k.ctrlKey||k.metaKey)&&!F&&!$(M.colId)&&o.options.rangeSelection!==!1){let D={rowIndex:M.rowIndex,colId:M.colId};o.addRange({start:D,end:D}),o.setFocus(M.rowIndex,M.colId)}else o.setFocus(M.rowIndex,M.colId),o.setRange(null);o.options.rowSelection&&!A&&o.selectFromClick(M.rowIndex,F||k.ctrlKey||k.metaKey,k.shiftKey),o.events.emit("cellClick",M),s==="touch"&&!A&&E&&E.rowIndex===M.rowIndex&&E.colId===M.colId&&o.editor.canEdit(M.rowIndex,M.colId)&&(o.columns.getColumn(M.colId).def.type==="boolean"?o.applyEdit(M.rowIndex,M.colId,M.value!==!0):o.editor.start(M.rowIndex,M.colId))},u=k=>{if(k.target.closest?.("button"))return;let E=e.cellAt(k.target),R=E&&o.rowModel.getRow(E.rowIndex);if(R?.kind==="group"){o.toggleRow(E.rowIndex);return}if(R?.kind)return;let M=l(k);if(!M||(o.events.emit("cellDoubleClick",M),!o.editor.canEdit(M.rowIndex,M.colId)))return;o.columns.getColumn(M.colId).def.type==="boolean"?o.applyEdit(M.rowIndex,M.colId,M.value!==!0):o.editor.start(M.rowIndex,M.colId)},f={...Hs};for(let[k,E]of Object.entries(o.options.keymap??{}))f[k]=E===!1?"none":E;let p=k=>{let E=o.store.state.focus,R=f[Gs(k)];if(R==="none")return!1;switch(R){case"edit":return!E||!o.editor.canEdit(E.rowIndex,E.colId)||o.columns.getColumn(E.colId).def.type==="boolean"?!1:(o.editor.start(E.rowIndex,E.colId),!0);case"clear":return o.clearCells(),!0;case"undo":return o.undo(),!0;case"redo":return o.redo(),!0;case"copy":return o.copyToClipboard(!1),!0;case"cut":return o.cutToClipboard(),!0;case"selectAll":return o.selectAllCells(),!0;case"find":return o.options.findBar===!1?!1:(o.finder.openBar(),!0);case"paste":return navigator.clipboard?.readText?.().then(A=>o.pasteText(A),()=>{}),!0}if(!E||!o.editor.canEdit(E.rowIndex,E.colId))return!1;let M=o.columns.getColumn(E.colId).def;if(k.key===" "&&M.type==="boolean"&&!k.ctrlKey&&!k.metaKey){let A=o.rowModel.getRow(E.rowIndex).data;return o.applyEdit(E.rowIndex,E.colId,A[M.field]!==!0),!0}return k.key.length===1&&k.key!==" "&&!k.ctrlKey&&!k.metaKey&&!k.altKey&&M.type!=="boolean"?(o.editor.start(E.rowIndex,E.colId,k.key),!0):!1},g=k=>{let E=o.store.state.focus;if(!E||k.ctrlKey||k.metaKey||k.altKey||k.shiftKey)return!1;let R=o.rowModel.getRow(E.rowIndex);if(!o.isExpandable(R))return!1;let M=R.kind==="group";if(!M&&E.colId!==o.columns.displayed().find(F=>!$(F.id))?.id)return!1;let A=!!(R.group?.expanded??R.expanded),L=o.expandKey(R);if(M&&(k.key==="Enter"||k.key===" "))o.setGroupExpanded(L,!A);else if(r(k)==="ArrowRight"&&!A)o.setGroupExpanded(L,!0);else if(r(k)==="ArrowLeft"&&A)o.setGroupExpanded(L,!1);else return!1;return!0},y=k=>{let E=e.cellAt(k.target);if(!E||E.colId!==Ee)return!1;k.preventDefault();let R=o.rowModel.getRow(E.rowIndex);if(!R||R.kind||!o.canMoveRows())return!0;let M=R.data,A=x("div","fg-row-drop-marker"),L=null;n.classList.add("fg-row-dragging");let F=I=>{let N=et(n,I.clientX,I.clientY),z=N?.closest(".fg-root"),U=z===n?o:nr(z),K=o.dragOptions.group;if(L=null,A.remove(),!U||!z||U!==o&&(!K||U.dragOptions.group!==K||!U.options.rowDrag))return;let Z=N.closest(".fg-row[data-row]"),P=Z?.getBoundingClientRect(),O=null,V="after",j;if(Z&&P){let Q=U.rowModel.getRow(Number(Z.dataset.row));if(!Q||Q.kind==="group")return;O=Q.detailOf?.data??Q.data;let ae=(I.clientY-P.top)/P.height;Q.kind==="detail"?V="after":U.options.treeData?V=ae<.25?"before":ae>.75?"after":"inside":V=ae<.5?"before":"after",j=V==="before"?P.top:P.bottom}else{if(!N.closest(".fg-body"))return;let Q=z.querySelectorAll(".fg-body-pane-center .fg-row[data-row]");j=Q.length?Math.max(...[...Q].map(ae=>ae.getBoundingClientRect().bottom)):z.querySelector(".fg-body").getBoundingClientRect().top}if(!U.canDropRow(M,O,V,o))return;L={into:U,target:O,position:V};let te=z.getBoundingClientRect().top;A.classList.toggle("fg-row-drop-inside",V==="inside"),A.style.top=`${V==="inside"?P.top-te:j-te-1}px`,A.style.height=V==="inside"?`${P.height}px`:"",z.append(A)},D=()=>{window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D),n.classList.remove("fg-row-dragging"),A.remove(),L&&L.into.dropRow(M,L.target,L.position,o)};return window.addEventListener("pointermove",F),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),!0},w=k=>{let E=e.cellAt(k.target);if(!E)return;let R=k.clientX,M=k.clientY,A=()=>{clearTimeout(i),window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",A)},L=F=>{Math.hypot(F.clientX-R,F.clientY-M)>8&&A()};clearTimeout(i),i=window.setTimeout(()=>{A(),o.options.contextMenu!==!1&&(a=!0,$(E.colId)||(o.setFocus(E.rowIndex,E.colId),o.rangeContains(E.rowIndex,E.colId)||o.setRange({start:E,end:E})),o.contextMenu.open(R,M,E.rowIndex,E.colId))},550),window.addEventListener("pointermove",L),window.addEventListener("pointerup",A),window.addEventListener("pointercancel",A)},h=k=>{if(s=k.pointerType||"mouse",s==="touch"){w(k);return}if(k.button===0&&y(k)||o.options.rangeSelection===!1||k.button!==0||k.shiftKey||k.target.closest("input, a, button"))return;let E=e.cellAt(k.target);if(!E||$(E.colId))return;let R=k.clientX,M=k.clientY,A=k.ctrlKey||k.metaKey,L=!1,F=I=>{if(!L&&Math.hypot(I.clientX-R,I.clientY-M)<zs)return;let N=e.cellAt(et(n,I.clientX,I.clientY));!N||$(N.colId)||(L||(L=!0,n.classList.add("fg-range-dragging"),A&&o.addRange({start:E,end:E}),o.setFocus(E.rowIndex,E.colId)),o.setRange({start:E,end:N},A))},D=()=>{window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",D),n.classList.remove("fg-range-dragging"),L&&(a=!0)};window.addEventListener("pointermove",F),window.addEventListener("pointerup",D)},m=k=>{if(k.target!==n&&k.target!==e.gridEl)return;let E=o.columns.displayed(),R=o.rowModel.getRowCount();if(!E.length||!R)return;if(g(k)){k.preventDefault();return}if(p(k)){k.preventDefault();return}let M=o.store.state.focus,A=k.ctrlKey||k.metaKey;if(k.key==="Escape"&&o.store.state.range){k.preventDefault(),o.setRange(null);return}if(A&&k.key.toLowerCase()==="a"&&o.options.rangeSelection!==!1){k.preventDefault(),o.selectAllCells();return}if(k.key==="ContextMenu"||k.key==="F10"&&k.shiftKey){k.preventDefault(),o.contextMenu.openAtFocus();return}if(k.key===" "&&M&&o.options.rowSelection){k.preventDefault(),o.selectFromClick(Math.min(M.rowIndex,R-1),!0,k.shiftKey);return}let L={rows:R,cols:E.length,pageRows:e.pageRows()},F=E.findIndex(z=>!$(z.id));if(o.options.rangeSelection!==!1&&k.shiftKey&&k.key!=="Tab"&&Sn.has(k.key)){let z=M??{rowIndex:0,colId:E[F].id},U=o.store.state.range,K=U?.end??z,Z={rowIndex:Math.min(K.rowIndex,R-1),colIndex:Math.max(0,E.findIndex(V=>V.id===K.colId))},P=Mn(r(k),{ctrl:A,shift:!1},Z,L);if(!P)return;k.preventDefault();let O=E[Math.max(F,P.colIndex)].id;M||o.setFocus(z.rowIndex,z.colId),o.setRange({start:U?.start??z,end:{rowIndex:P.rowIndex,colId:O}}),e.ensureVisible(P.rowIndex,O);return}let I;if(!M)I=Sn.has(k.key)&&k.key!=="Tab"?{rowIndex:0,colIndex:0}:null;else{let z=Math.max(0,E.findIndex(U=>U.id===M.colId));I=Mn(r(k),{ctrl:A,shift:k.shiftKey},{rowIndex:Math.min(M.rowIndex,R-1),colIndex:z},L)}if(!I)return;k.preventDefault();let N=E[I.colIndex].id;o.setFocus(I.rowIndex,N),o.setRange(null),e.ensureVisible(I.rowIndex,N)},b=k=>k.target?.closest?.(".fg-editor, input, textarea, select, [contenteditable]"),v=k=>k.target?.closest?.(".fg-root")!==n,C=k=>{if(b(k)||v(k))return;let E=o.selectionTSV(!1);!E||!k.clipboardData||(k.clipboardData.setData("text/plain",E),k.preventDefault())},S=k=>{if(b(k)||v(k))return;let E=o.selectionTSV(!1);!E||!k.clipboardData||(k.clipboardData.setData("text/plain",E),k.preventDefault(),o.clearCells(!0))},T=k=>{if(b(k)||v(k))return;let E=k.clipboardData?.getData("text/plain");E&&(k.preventDefault(),o.pasteText(E))};return t.addEventListener("click",c),t.addEventListener("dblclick",u),t.addEventListener("pointerdown",h),n.addEventListener("keydown",m),n.addEventListener("copy",C),n.addEventListener("paste",T),n.addEventListener("cut",S),()=>{t.removeEventListener("click",c),t.removeEventListener("dblclick",u),t.removeEventListener("pointerdown",h),n.removeEventListener("keydown",m),n.removeEventListener("copy",C),n.removeEventListener("paste",T),n.removeEventListener("cut",S)}}var Et=class{constructor(e){this.grid=e;this.open=new Set;this.el=x("div","fg-filters-panel")}refresh(){let{grid:e}=this,t=e.store.state.locale,n=e.store.state.filters,r=x("div","fg-filters-head"),s=x("span","fg-filters-title");s.textContent=t.filters;let i=x("button","fg-btn fg-filters-clear",{type:"button"});i.textContent=t.clearFilters,i.disabled=!Object.keys(n).length,i.addEventListener("click",()=>{for(let l of Object.keys(e.store.state.filters))e.setFilter(l,null)}),r.append(s,i);let a=x("div","fg-filters-list");for(let l of e.columns.displayed()){if($(l.id)||!le(l.def))continue;let d=x("details",n[l.id]?"fg-filters-item fg-filter-on":"fg-filters-item");d.dataset.col=l.id,d.open=this.open.has(l.id);let c=x("summary");c.textContent=l.def.header??l.def.field??l.id,d.append(c);let u=()=>{if(d.querySelector(".fg-filter"))return;let f=e.menu.filterSection(l.id,()=>{});f&&d.append(f)};d.open&&u(),d.addEventListener("toggle",()=>{d.open?(this.open.add(l.id),u()):this.open.delete(l.id)}),a.append(d)}this.el.replaceChildren(r,a)}};var qs=["sum","avg","min","max","count"],At=class{constructor(e){this.grid=e;this.draft={rows:[],columns:[],values:[]};this.el=x("div","fg-pivot-panel")}apply(){this.grid.getPivot()?this.grid.setPivot(this.draft):this.refresh()}refresh(){let{grid:e}=this,t=e.store.state.locale,n=e.getPivot();n&&(this.draft={rows:[...n.rows],columns:[...n.columns??[]],values:n.values.map(d=>({colId:d.colId,aggFunc:typeof d.aggFunc=="string"?d.aggFunc:"sum"}))});let r=e.sourceLeaves(),s=d=>{let c=r.find(u=>u.id===d)?.def;return c?.header??c?.field??d},i=x("label","fg-pivot-mode"),a=x("input","fg-checkbox",{type:"checkbox"});a.checked=!!n,a.addEventListener("click",()=>e.setPivot(a.checked?this.draft:null)),i.append(a,document.createTextNode(t.pivotMode));let l=(d,c)=>{let u=x("div","fg-pivot-zone");u.dataset.zone=d;let f=x("div","fg-pivot-zone-title");f.textContent=c;let p=x("div","fg-pivot-chips"),g=d==="values"?this.draft.values.map(h=>h.colId):this.draft[d];g.forEach((h,m)=>{let b=x("span","fg-group-chip");b.dataset.col=h;let v=x("span","fg-group-chip-label");if(v.textContent=s(h),b.append(v),d==="values"){let S=x("select","fg-pivot-agg",{"aria-label":`${s(h)} ${t.pivotValues}`});for(let T of qs){let k=x("option");k.value=T,k.textContent=t[T],S.append(k)}S.value=this.draft.values[m].aggFunc,S.addEventListener("change",()=>{this.draft.values[m].aggFunc=S.value,this.apply()}),b.append(S)}let C=x("button","fg-group-chip-remove",{type:"button","aria-label":`${t.ungroup}: ${s(h)}`});C.textContent="\xD7",C.addEventListener("click",()=>{d==="values"?this.draft.values.splice(m,1):this.draft[d].splice(m,1),this.apply()}),b.append(C),p.append(b)});let y=x("select","fg-pivot-add",{"aria-label":`${c}: ${t.addColumn}`}),w=x("option");w.value="",w.textContent=t.addColumn,y.append(w);for(let h of r){if(g.includes(h.id)||d==="values"&&h.def.type!=="number")continue;let m=x("option");m.value=h.id,m.textContent=s(h.id),y.append(m)}return y.addEventListener("change",()=>{y.value&&(d==="values"?this.draft.values.push({colId:y.value,aggFunc:"sum"}):this.draft[d].push(y.value),this.apply())}),u.append(f,p,y),u};this.el.replaceChildren(i,l("rows",t.pivotRows),l("columns",t.pivotColumns),l("values",t.pivotValues))}};var Ws=4,Tt=o=>!$(o.id)&&(o.children?o.children.some(Tt):o.def.chooser!==!1),En=o=>o.def.header??o.def.field??o.id,Lt=class{constructor(e){this.grid=e;this.collapsed=new Set;this.el=x("div","fg-chooser"),this.search=x("input","fg-input fg-chooser-search",{type:"search"});let t=x("label","fg-chooser-all");this.allBox=x("input","fg-checkbox",{type:"checkbox"}),this.allText=x("span"),t.append(this.allBox,this.allText),this.list=x("div","fg-chooser-list",{role:"tree"}),this.el.append(this.search,t,this.list),this.search.addEventListener("input",()=>this.refresh()),this.allBox.addEventListener("change",()=>this.setVisible(this.matchingLeaves(),this.allBox.checked)),this.list.addEventListener("change",n=>{let r=n.target,s=this.nodeOf(r);s&&this.setVisible(this.leavesOf(s),r.checked)}),this.list.addEventListener("click",n=>{let r=n.target.closest(".fg-chooser-caret"),s=r&&this.nodeOf(r);s&&(this.collapsed.has(s.id)?this.collapsed.delete(s.id):this.collapsed.add(s.id),this.refresh())}),this.list.addEventListener("pointerdown",n=>this.onPointerDown(n)),this.refresh()}refresh(){let e=this.grid.store.state.locale;this.search.placeholder=e.search,this.search.setAttribute("aria-label",e.search),this.allText.textContent=e.selectAll;let t=this.query(),n=[],r=(a,l)=>{for(let d of a)!Tt(d)||t&&!this.subtreeMatches(d,t)||(n.push(this.item(d,l)),d.children&&(t||!this.collapsed.has(d.id))&&r(d.children,l+1))};r(this.grid.columns.roots(),0),this.list.replaceChildren(...n);let s=this.matchingLeaves(),i=s.filter(a=>!a.hide).length;this.allBox.checked=s.length>0&&i===s.length,this.allBox.indeterminate=i>0&&i<s.length}query(){return this.search.value.trim().toLowerCase()}subtreeMatches(e,t){for(let n=e;n;n=n.parent)if(En(n).toLowerCase().includes(t))return!0;return!!e.children&&e.children.some(n=>Tt(n)&&this.subtreeMatches(n,t))}leavesOf(e){return Tt(e)?e.children?e.children.flatMap(t=>this.leavesOf(t)):[e]:[]}matchingLeaves(){let e=this.query(),t=this.grid.columns.roots().flatMap(n=>this.leavesOf(n));return e?t.filter(n=>this.subtreeMatches(n,e)):t}nodeOf(e){let t=e.closest(".fg-chooser-item")?.dataset.col;return t?this.grid.columns.getNode(t):void 0}setVisible(e,t){this.grid.setColumnsVisible(e.filter(n=>!n.def.lockVisible).map(n=>n.id),t)}item(e,t){let n=x("div",e.children?"fg-chooser-item fg-chooser-group":"fg-chooser-item",{role:"treeitem"});n.dataset.col=e.id,n.style.paddingLeft=`${6+t*16}px`;let r=x("span","fg-chooser-handle",{"aria-hidden":"true"});if(r.textContent="\u22EE\u22EE",n.append(r),e.children){let d=!this.collapsed.has(e.id),c=x("button","fg-chooser-caret",{type:"button",tabindex:"-1","aria-hidden":"true"});c.textContent=d?"\u25BE":"\u25B8",n.setAttribute("aria-expanded",String(d)),n.append(c)}let s=this.leavesOf(e),i=s.filter(d=>!d.hide).length,a=x("input","fg-checkbox",{type:"checkbox","aria-label":En(e)});a.checked=s.length>0&&i===s.length,a.indeterminate=i>0&&i<s.length,a.disabled=s.every(d=>d.def.lockVisible);let l=x("span","fg-chooser-label");if(l.textContent=En(e),n.append(a,l),!e.children&&e.pinned){let d=x("span","fg-chooser-pin");d.textContent=e.pinned==="left"?"\u21E4":"\u21E5",n.append(d)}return n}onPointerDown(e){let n=e.target.closest(".fg-chooser-handle")?.closest(".fg-chooser-item"),r=n&&this.nodeOf(n);if(!n||!r||e.button!==0)return;e.preventDefault();let s=new Set(this.grid.columns.siblings(r.id).map(p=>p.id).filter(p=>p!==r.id)),i=[...this.list.querySelectorAll(".fg-chooser-item")].filter(p=>s.has(p.dataset.col)),a=e.clientY,l=!1,d=-1,c=x("div","fg-chooser-marker"),u=p=>{if(!l){if(Math.abs(p.clientY-a)<Ws||!i.length)return;l=!0,n.classList.add("fg-dragging"),this.list.append(c)}d=i.filter(w=>{let h=w.getBoundingClientRect();return p.clientY>h.top+h.height/2}).length;let g=this.list.getBoundingClientRect().top-this.list.scrollTop,y=d<i.length?i[d].getBoundingClientRect().top:i[i.length-1].getBoundingClientRect().bottom;c.style.top=`${y-g-1}px`},f=()=>{if(window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",f),c.remove(),n.classList.remove("fg-dragging"),!l||d<0)return;let p=this.grid.columns.siblings(r.id).map(w=>w.id).filter(w=>w!==r.id),g=d<i.length?p.indexOf(i[d].dataset.col):p.indexOf(i[i.length-1].dataset.col)+1;g=Math.max(p.filter($).length,g);let y=this.grid.columns.siblings(r.id).findIndex(w=>w.id===r.id);g!==y&&(this.grid.columns.move(r.id,g),this.grid.layoutChanged(),this.grid.events.emit("columnMove",{colId:r.id,toIndex:g}))};window.addEventListener("pointermove",u),window.addEventListener("pointerup",f)}},Pt=class{constructor(e){this.grid=e;this.popup=null;this.panel=null;this.off=[]}get isOpen(){return!!this.popup}open(){this.close();let e=this.grid.store.state.locale,t=x("div",`fg-menu fg-chooser-dialog fg-theme-${this.grid.store.state.theme}`,{role:"dialog","aria-label":e.chooseColumns});this.grid.applyFontTo(t);let n=x("div","fg-chooser-head"),r=x("span","fg-menu-title");r.textContent=e.chooseColumns;let s=x("button","fg-chooser-close",{type:"button","aria-label":e.close});s.textContent="\xD7",s.addEventListener("click",()=>this.close()),n.append(r,s),this.panel=new Lt(this.grid),t.append(n,this.panel.el),ee(this.grid.renderer.root).append(t);let i=this.grid.renderer.root.getBoundingClientRect(),a=t.offsetWidth||280;t.style.left=`${Math.max(4,Math.min(i.right-a-8,window.innerWidth-a-4))}px`,t.style.top=`${Math.max(4,i.top+8)}px`,this.popup=t;let l=c=>{ie(c,t)||this.close()},d=c=>{c.key==="Escape"&&this.close()};document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",d,!0),this.off.push(()=>document.removeEventListener("pointerdown",l,!0),()=>document.removeEventListener("keydown",d,!0)),t.querySelector(".fg-chooser-search").focus()}refresh(){this.panel?.refresh()}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null,this.panel=null}},Ft=class{constructor(e,t,n=["columns","filters"]){this.grid=e;this.tabs=new Map;this.el=x("div","fg-sidebar"),this.panelHost=x("div","fg-sidebar-panel"),this.columns=new Lt(e),this.filters=new Et(e),this.pivot=new At(e);let r=n.filter(i=>i==="columns"||i==="filters"||i==="pivot");r.length||r.push("columns"),this.current=r[0];let s=x("div","fg-sidebar-tabs",{role:"tablist"});for(let i of r){let a=x("button","fg-sidebar-tab",{type:"button",role:"tab"});a.dataset.panel=i,a.addEventListener("click",()=>this.toggle(!(this.isOpen&&this.current===i),i)),this.tabs.set(i,a),s.append(a)}this.el.append(this.panelHost,s),e.renderer.root.append(this.el),this.panelHost.hidden=!t,this.show(),this.refresh()}get isOpen(){return!this.panelHost.hidden}show(){this.panelHost.replaceChildren(this.current==="filters"?this.filters.el:this.current==="pivot"?this.pivot.el:this.columns.el)}toggle(e=!this.isOpen,t){t&&this.tabs.has(t)&&t!==this.current&&(this.current=t,this.show()),this.panelHost.hidden=!e,this.syncTabs(),this.grid.renderer.invalidate({header:!0,rows:!0})}syncTabs(){this.el.classList.toggle("fg-sidebar-open",this.isOpen);for(let[e,t]of this.tabs){let n=this.isOpen&&e===this.current;t.setAttribute("aria-expanded",String(n)),t.setAttribute("aria-selected",String(n))}}refresh(){let e=this.grid.store.state.locale;for(let[t,n]of this.tabs)n.textContent=t==="filters"?e.filters:t==="pivot"?e.pivot:e.columns;this.syncTabs(),this.columns.refresh(),this.filters.refresh(),this.pivot.refresh()}};var Us=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||""),qe=o=>Us()?`\u2318${o}`:`Ctrl+${o}`,Dt=class{constructor(e){this.grid=e;this.popup=null;this.off=[];let t=e.renderer.root,n=r=>this.onContextMenu(r);t.addEventListener("contextmenu",n),this.detach=()=>t.removeEventListener("contextmenu",n)}destroy(){this.close(),this.detach()}onContextMenu(e){let{grid:t}=this;if(t.options.contextMenu===!1)return;let n=e.target,r=n.closest(".fg-header-cell");if(r){let i=r.dataset.col;if(!i||$(i)||r.classList.contains("fg-header-group"))return;e.preventDefault(),this.close(),t.menu.open(i,r);return}let s=t.renderer.cellAt(n);s&&(e.preventDefault(),t.renderer.gridEl.focus({preventScroll:!0}),!$(s.colId)&&!t.rangeContains(s.rowIndex,s.colId)&&(t.setFocus(s.rowIndex,s.colId),t.setRange({start:s,end:s})),this.open(e.clientX,e.clientY,s.rowIndex,s.colId))}openAtFocus(){let e=this.grid.store.state.focus;if(!e||this.grid.options.contextMenu===!1)return;let t=this.grid.renderer.root.getBoundingClientRect(),r=this.grid.renderer.root.querySelector(`.fg-row[data-row="${e.rowIndex}"] .fg-cell[data-col="${CSS.escape(e.colId)}"]`)?.getBoundingClientRect()??t;this.open(r.left+8,r.bottom,e.rowIndex,e.colId)}defaultItems(e){let{grid:t}=this,n=t.store.state.locale,r=t.columns.getNode(e),s=r?.def,i=!!s&&!$(e),a=[{label:n.copy,shortcut:qe("C"),action:()=>t.copyToClipboard(!1)},{label:n.copyWithHeaders,action:()=>t.copyToClipboard(!0)},{label:n.cut,shortcut:qe("X"),action:()=>t.cutToClipboard()},...t.store.state.selected.size?[{label:n.copyRows,action:()=>t.copyToClipboard(!1,!0)}]:[],{label:n.paste,shortcut:qe("V"),action:()=>this.pasteFromClipboard()}];(t.history.canUndo()||t.history.canRedo())&&a.push("separator",{label:n.undo,shortcut:qe("Z"),action:()=>t.undo(),disabled:!t.history.canUndo()},{label:n.redo,shortcut:qe("Y"),action:()=>t.redo(),disabled:!t.history.canRedo()}),t.options.rowSelection&&t.store.state.selected.size&&a.push({label:n.deleteRows,action:()=>t.api.removeSelectedRows()}),i&&(a.push("separator",{label:n.autosizeThis,action:()=>t.autoSize([e])}),s.lockVisible||a.push({label:n.hideColumn,action:()=>t.setColumnsVisible([e],!1)}),a.push({label:n.pinLeft,action:()=>t.setPinned(e,"left"),disabled:r.pinned==="left"},{label:n.pinRight,action:()=>t.setPinned(e,"right"),disabled:r.pinned==="right"},{label:n.unpin,action:()=>t.setPinned(e,null),disabled:!r.pinned})),a.push("separator"),t.options.rowSelection==="multiple"&&a.push({label:n.selectAllRows,action:()=>t.api.selectAll()}),a.push({label:n.chooseColumns,action:()=>t.chooser.open()});let l=t.rangeBounds();return l&&(l.r2>l.r1||l.c2>l.c1)&&a.push("separator",{label:n.chartBar,action:()=>t.api.createChart({type:"bar"})},{label:n.chartLine,action:()=>t.api.createChart({type:"line"})},{label:n.chartPie,action:()=>t.api.createChart({type:"pie"})}),a.push("separator",{label:n.exportCsv,action:()=>t.api.exportCsv()},{label:n.exportExcel,action:()=>t.api.exportXlsx()},{label:n.exportJson,action:()=>t.api.exportJson()},...t.options.assistant?.url?[{label:`${n.ai.title}\u2026`,action:()=>t.api.openAssistant()}]:[],{label:n.exportPdf,action:()=>t.api.exportPdf()}),t.options.advancedFilter!==!1&&!t.options.pivot&&a.push("separator",{label:`${n.advancedFilter}\u2026`,action:()=>t.filterBuilder.open()}),a.push("separator",{label:n.print,action:()=>t.api.print()}),a}pasteFromClipboard(){let e=typeof navigator<"u"?navigator.clipboard:void 0,t=()=>this.grid.toast(this.grid.store.state.locale.pasteHint.replace("Ctrl+V",qe("V")));if(!e?.readText)return t();e.readText().then(n=>this.grid.pasteText(n),t)}open(e,t,n,r){this.close(),this.grid.menu.close();let{grid:s}=this,i=s.rowModel.getRow(n),a=s.columns.getColumn(r),l=this.defaultItems(r),d={row:i?.data??null,rowIndex:n,colId:r,value:i&&a&&!$(r)?G(a.def,i.data):void 0,defaultItems:l},c=s.options.contextMenu,u=l;if(typeof c=="function")try{u=c(d)}catch{u=l}let f=s.store.state.locale,p=x("div",`fg-menu fg-context-menu fg-theme-${s.store.state.theme}`,{role:"menu","aria-label":f.columnMenu});s.applyFontTo(p);let g=!0;for(let v of u){if(v==="separator"){g||p.append(x("div","fg-cm-sep",{role:"separator"})),g=!0;continue}let C=x("button","fg-menu-item fg-cm-item",{type:"button",role:"menuitem"}),S=x("span","fg-cm-label");if(S.textContent=v.label,C.append(S),v.shortcut){let T=x("span","fg-cm-shortcut");T.textContent=v.shortcut,C.append(T)}C.disabled=!!v.disabled,C.addEventListener("click",()=>{this.close(),v.action()}),p.append(C),g=!1}p.lastElementChild?.classList.contains("fg-cm-sep")&&p.lastElementChild.remove(),ee(this.grid.renderer.root).append(p);let y=p.offsetWidth||220,w=p.offsetHeight||300;p.style.left=`${Math.max(4,Math.min(e,window.innerWidth-y-4))}px`,p.style.top=`${Math.max(4,Math.min(t,window.innerHeight-w-4))}px`,this.popup=p;let h=v=>{ie(v,p)||this.close()},m=v=>{if(v.key==="Escape"){this.close(),s.renderer.gridEl.focus();return}if(v.key!=="ArrowDown"&&v.key!=="ArrowUp")return;let C=[...p.querySelectorAll("button:not(:disabled)")],S=C.indexOf(tr(p));C[(S+(v.key==="ArrowDown"?1:C.length-1)+C.length)%C.length]?.focus(),v.preventDefault()},b=()=>this.close();document.addEventListener("pointerdown",h,!0),document.addEventListener("keydown",m,!0),s.renderer.scroller.addEventListener("scroll",b,{passive:!0}),this.off.push(()=>document.removeEventListener("pointerdown",h,!0),()=>document.removeEventListener("keydown",m,!0),()=>s.renderer.scroller.removeEventListener("scroll",b)),p.querySelector("button:not(:disabled)")?.focus()}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var It=class{constructor(e){this.grid=e;this.onDown=e=>{if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=this.source();if(!t)return;let{grid:n}=this,r=null,s=n.renderer.root,i=l=>{let d=n.renderer.cellAt(et(n.renderer.root,l.clientX,l.clientY)),c=d&&n.columns.getColumn(d.colId);if(!d||!c||$(c.id))return;let u=d.rowIndex>t.r2?d.rowIndex-t.r2:d.rowIndex<t.r1?d.rowIndex-t.r1:0,f=c.index>t.c2?c.index-t.c2:c.index<t.c1?c.index-t.c1:0;!u&&!f?r=null:Math.abs(u)>=Math.abs(f)?r={r1:Math.min(t.r1,d.rowIndex),r2:Math.max(t.r2,d.rowIndex),c1:t.c1,c2:t.c2}:r={r1:t.r1,r2:t.r2,c1:Math.min(t.c1,c.index),c2:Math.max(t.c2,c.index)},this.showPreview(r)},a=()=>{if(window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",a),this.preview.remove(),s.classList.remove("fg-range-dragging"),!r)return;let l=n.columns.displayed();n.fillRange({start:{rowIndex:r.r1,colId:l[r.c1].id},end:{rowIndex:r.r2,colId:l[r.c2].id}})};s.classList.add("fg-range-dragging"),window.addEventListener("pointermove",i),window.addEventListener("pointerup",a)};this.handle=x("div","fg-fill-handle",{"aria-hidden":"true"}),this.preview=x("div","fg-fill-preview",{"aria-hidden":"true"}),this.handle.addEventListener("pointerdown",this.onDown)}enabled(){let e=this.grid.options;return e.fillHandle!==!1&&e.rangeSelection!==!1}source(){let e=this.grid.rangeBounds();if(e)return e;let t=this.grid.store.state.focus,n=t&&this.grid.columns.getColumn(t.colId);return!t||!n||$(n.id)?null:{r1:t.rowIndex,r2:t.rowIndex,c1:n.index,c2:n.index}}cellEl(e,t){let n=this.grid.columns.displayed()[t];return n?this.grid.renderer.root.querySelector(`.fg-body .fg-row[data-row="${e}"] .fg-cell[data-col="${CSS.escape(n.id)}"]`):null}update(){let e=this.enabled()?this.source():null,t=this.grid.columns.displayed(),r=!!e&&t.slice(e.c1,e.c2+1).some(a=>a.def.editable&&a.def.field)&&e?this.cellEl(e.r2,e.c2):null;if(!r){this.handle.remove();return}let s=this.grid.renderer.root.getBoundingClientRect(),i=r.getBoundingClientRect();this.handle.style.left=`${(this.grid.renderer.rtl?i.left:i.right)-s.left-4}px`,this.handle.style.top=`${i.bottom-s.top-4}px`,this.handle.isConnected||this.grid.renderer.root.append(this.handle)}showPreview(e){let t=e&&this.cellEl(e.r1,e.c1),n=e&&this.cellEl(e.r2,e.c2);if(!t||!n){this.preview.remove();return}let r=this.grid.renderer.root.getBoundingClientRect(),s=t.getBoundingClientRect(),i=n.getBoundingClientRect();Object.assign(this.preview.style,{left:`${s.left-r.left}px`,top:`${s.top-r.top}px`,width:`${i.right-s.left}px`,height:`${i.bottom-s.top}px`}),this.preview.isConnected||this.grid.renderer.root.append(this.preview)}destroy(){this.handle.remove(),this.preview.remove()}};var js=1e4,$t=class{constructor(e){this.grid=e;this.matches=[];this.lookup=new Map;this.index=-1;this.query="";this.bar=null;this.countEl=null}get active(){return!!this.query}classFor(e,t){if(!this.query)return"";let n=this.lookup.get(`${e}|${t}`);return n===void 0?"":n===this.index?" fg-cell-match fg-cell-match-current":" fg-cell-match"}find(e){if(this.query=e.trim().toLowerCase(),this.matches=[],this.lookup.clear(),this.index=-1,this.query){let{grid:t}=this,n=t.store.state.locale.code,r=t.columns.displayed().filter(a=>!$(a.id)),s=r.map(a=>X(a.def,n)),i=t.rowModel.rows();e:for(let a=0;a<i.length;a++)if(!i[a].kind){for(let l=0;l<r.length;l++)if(s[l](G(r[l].def,i[a].data)).toLowerCase().includes(this.query)&&(this.lookup.set(`${a}|${r[l].id}`,this.matches.length),this.matches.push({rowIndex:a,colId:r[l].id}),this.matches.length>=js))break e}this.matches.length&&this.go(0)}return this.updateCount(),this.grid.renderer.invalidate({rows:!0}),this.matches.length}refresh(){this.query&&this.find(this.query)}next(){this.matches.length&&this.go((this.index+1)%this.matches.length)}previous(){this.matches.length&&this.go((this.index-1+this.matches.length)%this.matches.length)}clear(){this.query="",this.matches=[],this.lookup.clear(),this.index=-1,this.grid.renderer.invalidate({rows:!0})}go(e){this.index=e;let t=this.matches[e];this.grid.setFocus(t.rowIndex,t.colId),this.grid.renderer.ensureVisible(t.rowIndex,t.colId),this.updateCount(),this.grid.renderer.invalidate({rows:!0})}updateCount(){if(!this.countEl)return;let e=this.grid.store.state.locale;this.countEl.textContent=this.query?this.matches.length?`${this.index+1}/${this.matches.length}`:e.noMatches:""}openBar(){if(this.grid.options.findBar===!1)return;if(this.bar){this.bar.querySelector("input").focus();return}let e=this.grid.store.state.locale,t=x("div","fg-findbar",{role:"search"}),n=x("input","fg-input",{type:"search",placeholder:e.findPlaceholder,"aria-label":e.findPlaceholder});this.countEl=x("span","fg-findbar-count",{"aria-live":"polite"});let r=(s,i,a)=>{let l=x("button","fg-findbar-btn",{type:"button","aria-label":s,title:s});return l.textContent=i,l.addEventListener("click",a),l};t.append(n,this.countEl,r(e.findPrevious,"\u2191",()=>this.previous()),r(e.findNext,"\u2193",()=>this.next()),r(e.close,"\xD7",()=>this.closeBar())),n.addEventListener("input",()=>this.find(n.value)),t.addEventListener("keydown",s=>{s.stopPropagation(),s.key==="Escape"?(s.preventDefault(),this.closeBar()):s.key==="Enter"&&(s.preventDefault(),s.shiftKey?this.previous():this.next())}),this.grid.renderer.root.append(t),this.bar=t,n.focus()}closeBar(){this.bar?.remove(),this.bar=null,this.countEl=null,this.clear(),this.grid.renderer.gridEl.focus({preventScroll:!0})}};var Ks=864e5;function tt(o,e){if(!o.length||e<=0)return[];let t=()=>Array.from({length:e},(s,i)=>o[i%o.length]);if(o.every(s=>typeof s=="number"&&!Number.isNaN(s))){let s=o;if(s.length===1)return t();let i=s[1]-s[0];if(!s.every((l,d)=>d===0||Math.abs(l-s[d-1]-i)<1e-9))return t();let a=s[s.length-1];return Array.from({length:e},(l,d)=>Math.round((a+i*(d+1))*1e12)/1e12)}let n=o.map(s=>s instanceof Date||typeof s=="string"&&/^\d{4}-\d{2}-\d{2}/.test(s)?ue(s):null);if(n.every(Boolean)&&o.length>=2){let s=n.map(a=>Math.round(a.getTime()/Ks)),i=s[1]-s[0];if(s.every((a,l)=>l===0||a-s[l-1]===i)){let a=n[n.length-1],l=o[o.length-1]instanceof Date;return Array.from({length:e},(d,c)=>{let u=new Date(a.getFullYear(),a.getMonth(),a.getDate()+i*(c+1));return l?u:ne(u)})}return t()}let r=o[o.length-1];if(typeof r=="string"&&!W(r)&&o.every(s=>typeof s=="string")){let s=/^(.*?)(\d+)$/.exec(r);if(s){let i=s[2].length,a=Number(s[2]);return Array.from({length:e},(l,d)=>`${s[1]}${String(a+d+1).padStart(i,"0")}`)}}return t()}function An(o){let e=t=>/[\t\n\r"]/.test(t)?`"${t.replace(/"/g,'""')}"`:t;return o.map(t=>t.map(e).join(" ")).join(`\r
2
+ `)}function sr(o){return Tn(o," ")}function Tn(o,e){if(!o)return[];let t=[],n=[],r="",s=0,i=!1,a=!0;for(;s<o.length;){let l=o[s];if(i){if(l==='"'){if(o[s+1]==='"'){r+='"',s+=2;continue}i=!1,s++;continue}r+=l,s++;continue}if(l==='"'&&a){i=!0,a=!1,s++;continue}if(l===e){n.push(r),r="",a=!0,s++;continue}if(l==="\r"||l===`
3
+ `){n.push(r),t.push(n),n=[],r="",a=!0,s+=l==="\r"&&o[s+1]===`
4
+ `?2:1;continue}r+=l,a=!1,s++}return(r!==""||n.length||!a)&&(n.push(r),t.push(n)),t}function Nt(o,e,t){if(W(e))return"";if(Array.isArray(e))return e.join(", ");switch(o.type){case"number":{let n=typeof e=="number"?e:Number(e);return Number.isNaN(n)?String(e):String(n)}case"date":return ne(e)??String(e);case"boolean":return e===!0?"TRUE":e===!1?"FALSE":String(e);default:return X(o,t)(e)}}var _s=new Set(["true","1","y","yes","\uC608","o","on"]),Xs=new Set(["false","0","n","no","\uC544\uB2C8\uC624","x","off"]);function Js(o){let e=o.trim();if(!e)return{ok:!0,value:null};let t=!1;/^\(.*\)$/.test(e)&&(t=!0,e=e.slice(1,-1));let n=e.endsWith("%");if(n&&(e=e.slice(0,-1)),e=e.replace(/[\s,₩$€£¥원]/g,""),!/^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i.test(e))return{ok:!1};let r=Number(e);return n&&(r/=100),t&&(r=-r),{ok:!0,value:Math.round(r*1e12)/1e12}}function rr(o,e,t){let n=new Date(o,e-1,t);return n.getFullYear()===o&&n.getMonth()===e-1&&n.getDate()===t?n:null}function Ys(o,e){let t=o.trim();if(!t)return{ok:!0,value:null};let n=null,r=/^(\d{4})\s*[-./년]\s*(\d{1,2})\s*[-./월]\s*(\d{1,2})\s*[.일]?$/.exec(t);return r?n=rr(+r[1],+r[2],+r[3]):(r=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(t))?n=rr(+r[3],+r[1],+r[2]):/^\d{4}-\d{2}-\d{2}T/.test(t)&&(n=ue(t)),n?{ok:!0,value:e instanceof Date?n:ne(n)}:{ok:!1}}function Ot(o,e,t){switch(o.type){case"number":return Js(e);case"date":return Ys(e,t);case"boolean":{let n=e.trim().toLowerCase();return n?_s.has(n)?{ok:!0,value:!0}:Xs.has(n)?{ok:!0,value:!1}:{ok:!1}:{ok:!0,value:null}}default:return{ok:!0,value:e}}}var Zs=o=>o.map(e=>e!==null&&typeof e=="object"&&"value"in e?e:{value:e,label:String(e),disabled:!1}),Pe=o=>String(o).padStart(2,"0");function Qs(o){let e=o instanceof Date?o:typeof o=="string"&&o?new Date(o):null;return!e||Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Pe(e.getMonth()+1)}-${Pe(e.getDate())}T${Pe(e.getHours())}:${Pe(e.getMinutes())}`}function ei(o){if(o instanceof Date)return`${Pe(o.getHours())}:${Pe(o.getMinutes())}`;let e=typeof o=="string"?/(\d{1,2}):(\d{2})/.exec(o):null;return e?`${Pe(Number(e[1]))}:${e[2]}`:""}var Bt=class{constructor(e){this.grid=e;this.cur=null;this.session=null;e.events.on("focusChange",({rowIndex:t})=>{this.session&&!this.cur&&this.grid.rowModel.getRow(t)?.data!==this.session.row&&this.endRow(!0)})}get rowMode(){return this.grid.options.editType==="row"}editingRow(e){return this.session?.id===e}beginRow(e,t){this.session?.row!==e&&(this.session&&this.endRow(!0),this.session={row:e,id:this.grid.rowModel.idOf(e),before:{...e},undoMark:this.grid.history.mark()},this.grid.renderer.invalidate({rows:!0}),this.grid.events.emit("rowEditStart",{row:e,rowIndex:t}))}endRow(e){let t=this.session;if(!t)return;if(this.cur){if(e&&!this.commit(null))return;e||this.close(!1)}this.session=null;let{grid:n}=this,r=n.rowModel.indexOfId(t.id),s=n.columns.displayed().filter(a=>a.def.field&&!$(a.id));if(!e){let a=[];for(let l of s){let d=l.def.field;Object.is(t.row[d],t.before[d])||n.writeCell(a,t.row,d,l.id,r,t.before[d])}n.endCellTx(a),n.history.rollback(t.undoMark)}let i=s.filter(a=>!Object.is(t.row[a.def.field],t.before[a.def.field])).map(a=>({colId:a.id,oldValue:t.before[a.def.field],newValue:t.row[a.def.field]}));n.renderer.invalidate({rows:!0}),n.events.emit("rowEditStop",{row:t.row,rowIndex:r,committed:e,changes:i})}get active(){return this.cur&&{rowIndex:this.cur.rowIndex,colId:this.cur.colId}}canEdit(e,t){if($(t))return!1;let n=this.grid.columns.getColumn(t);if(!n?.def.field||e<0||e>=this.grid.rowModel.getRowCount())return!1;let r=this.grid.rowModel.getRow(e);return!r.kind&&pe(n.def,r.data,e)}start(e,t,n){if(this.cur&&!this.commit(null)||!this.canEdit(e,t))return!1;let{grid:r}=this;if(r.veto("beforeEdit",{row:r.rowModel.getRow(e).data,rowIndex:e,colId:t}))return!1;let{renderer:s}=r,a=r.columns.getColumn(t).def,l=r.rowModel.getRow(e).data,d=l[a.field];this.rowMode&&this.beginRow(l,e),r.setFocus(e,t),s.ensureVisible(e,t),s.render();let c=x("div","fg-editor");this.place(c,e,t);let u,f,p=()=>{},g=a.editor;if(typeof g=="function"){let b=g({value:d,row:l,column:a,initialText:n});u=b.el,f=()=>({value:b.getValue()}),p=()=>b.destroy?.(),c.append(u),queueMicrotask(()=>b.focus?.())}else if(g?.type==="select"){let b=Zs(typeof g.options=="function"?g.options(l):g.options),v=x("select","fg-editor-control");b.forEach((C,S)=>{let T=x("option");T.value=String(S),T.textContent=C.label??String(C.value),T.disabled=!!C.disabled,v.append(T)}),v.selectedIndex=Math.max(0,b.findIndex(C=>Object.is(C.value,d))),u=v,f=()=>({value:b[v.selectedIndex]?.value??null}),c.append(v)}else if(g?.type==="time"||g?.type==="datetime"||!g&&a.type==="date"&&a.format==="datetime"){let b=g?.type==="time",v=x("input","fg-editor-control",{type:b?"time":"datetime-local"});v.value=b?ei(d):Qs(d),u=v,f=()=>v.value?b?{value:v.value}:{value:d instanceof Date?new Date(v.value):v.value}:{value:null},c.append(v)}else{let v=g?.type==="textarea"?x("textarea","fg-editor-control"):x("input","fg-editor-control");v instanceof HTMLInputElement&&(v.type=a.type==="date"&&n===void 0?"date":"text",a.type==="number"&&(v.inputMode="decimal"));let C=a.type==="date"?ne(d)??"":W(d)?"":String(d);v.value=n??C,u=v,f=()=>({text:v.value}),c.append(v)}u.setAttribute("aria-label",a.header??a.field??t);let y=x("div","fg-editor-msg",{role:"alert"});c.append(y);let w=b=>{if(b.stopPropagation(),b.key==="Escape")b.preventDefault(),this.cancel();else if(b.key==="Enter"){if(u instanceof HTMLTextAreaElement&&!(b.ctrlKey||b.metaKey))return;b.preventDefault(),this.commit(b.shiftKey?"up":"down")}else b.key==="Tab"&&(b.preventDefault(),this.commit(b.shiftKey?"left":"right"))},h=b=>{this.cur?.wrap===c&&!c.contains(b.relatedTarget)&&this.commit(null)},m=()=>this.commit(null);return c.addEventListener("keydown",w),c.addEventListener("focusout",h),s.scroller.addEventListener("scroll",m,{passive:!0}),s.root.append(c),this.cur={rowIndex:e,colId:t,row:l,def:a,wrap:c,read:f,dispose:()=>{c.removeEventListener("keydown",w),c.removeEventListener("focusout",h),s.scroller.removeEventListener("scroll",m),p(),c.remove()}},typeof g!="function"&&(u.focus(),n===void 0&&u instanceof HTMLInputElement&&u.type==="text"&&u.select()),r.events.emit("editStart",{rowIndex:e,colId:t}),!0}place(e,t,n){let{renderer:r}=this.grid,s=r.root.querySelector(`.fg-row[data-row="${t}"] .fg-cell[data-col="${CSS.escape(n)}"]`),i=r.root.getBoundingClientRect(),a=s?.getBoundingClientRect();return e.style.left=`${(a?.left??i.left)-i.left}px`,e.style.top=`${(a?.top??i.top)-i.top}px`,e.style.width=`${a?.width||this.grid.columns.getColumn(n)?.width}px`,e.style.height=`${a?.height||r.opts.rowHeight}px`,!!s}indexOf(e){let t=this.grid.rowModel,n=t.indexOfId(t.idOf(e));return n>=0&&t.getRow(n)?.data===e?n:-1}sync(){let e=this.cur;if(!e)return;let t=this.indexOf(e.row);if(t<0)return this.cancel();t!==e.rowIndex&&(e.rowIndex=t,this.grid.setFocus(t,e.colId),this.grid.renderer.render(),this.place(e.wrap,t,e.colId)||this.commit(null))}commit(e){let t=this.cur;if(!t)return!1;let{grid:n}=this,r=n.store.state.locale,s=t.def.field,i=t.row[s],a=t.read(),l;if("text"in a&&t.def.formulas&&Le(a.text.trim()))l=a.text.trim();else if("text"in a){let u=Ot(t.def,a.text,i);if(!u.ok)return this.fail(a.text,r.invalidValue);l=u.value}else l=a.value;let d=n.cellError(t.def,t.row,l);if(d!==null)return this.fail(l,d);let c=this.indexOf(t.row);return c<0?(this.cancel(),!1):(t.rowIndex=c,this.close(!0),n.applyEdit(c,t.colId,l),this.session&&(e==="down"||e==="up")&&this.endRow(!0),this.move(c,t.colId,e),!0)}cancel(){this.close(!1),this.session&&this.endRow(!1)}destroy(){this.cur?.dispose(),this.cur=null,this.session=null}fail(e,t){let n=this.cur;return n.wrap.classList.add("fg-editor-invalid"),n.wrap.querySelector(".fg-editor-msg").textContent=t,this.grid.events.emit("validationFailed",{rowIndex:n.rowIndex,colId:n.colId,value:e,message:t}),!1}close(e){let t=this.cur;t&&(this.cur=null,t.dispose(),this.grid.renderer.gridEl.focus({preventScroll:!0}),this.grid.events.emit("editStop",{rowIndex:t.rowIndex,colId:t.colId,committed:e}))}move(e,t,n){if(!n)return;let{grid:r}=this,s=r.rowModel.getRowCount();if(n==="down"||n==="up"){let c=Math.max(0,Math.min(s-1,e+(n==="down"?1:-1)));r.setFocus(c,t),r.renderer.ensureVisible(c,t);return}let i=r.columns.displayed().filter(c=>this.canEdit(e,c.id)||c.def.editable);if(!i.length)return;let a=n==="right"?1:-1,l=e,d=i.findIndex(c=>c.id===t)+a;d>=i.length&&(d=0,this.session||l++),d<0&&(d=i.length-1,this.session||l--),!(l<0||l>=s)&&this.start(l,i[d].id)}};var Ht=class{constructor(e=200){this.limit=e;this.entries=[];this.index=0}push(e){this.entries.splice(this.index),this.entries.push(e),this.entries.length>this.limit&&this.entries.shift(),this.index=this.entries.length}canUndo(){return this.index>0}canRedo(){return this.index<this.entries.length}undo(){return this.canUndo()?(this.entries[--this.index].undo(),!0):!1}redo(){return this.canRedo()?(this.entries[this.index++].redo(),!0):!1}mark(){return this.entries[this.index-1]??null}rollback(e){let t=e?this.entries.indexOf(e)+1:0;this.entries.splice(t),this.index=Math.min(this.index,t)}clear(){this.entries=[],this.index=0}};var ir=(o,e)=>o instanceof Date&&e instanceof Date?o.getTime()===e.getTime():Object.is(o,e),Gt=class{constructor(){this.originals=new Map;this.created=new Set;this.deleted=new Map}beforeChange(e){!this.created.has(e)&&!this.originals.has(e)&&this.originals.set(e,{...e})}isDirty(e,t){if(!t||this.created.has(e))return!1;let n=this.originals.get(e);return!!n&&!ir(n[t],e[t])}diff(e,t){let n=this.originals.get(e);return n?t.filter(r=>!ir(n[r],e[r])):[]}commit(e,t){for(let n of t)this.deleted.delete(n);for(let[n,r]of e)this.created.delete(n),this.originals.set(n,{...r})}get size(){return this.originals.size+this.created.size+this.deleted.size}reset(){this.originals.clear(),this.created.clear(),this.deleted.clear()}};function nt(o){return{r1:Math.min(o.start.rowIndex,o.end.rowIndex),r2:Math.max(o.start.rowIndex,o.end.rowIndex),c1:Math.min(o.start.colIndex,o.end.colIndex),c2:Math.max(o.start.colIndex,o.end.colIndex)}}function ar(o,e,t){return e>=o.r1&&e<=o.r2&&t>=o.c1&&t<=o.c2}var ti=5;function lr(o,e){let t=r=>o(r),n=r=>{window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n),e(r)};window.addEventListener("pointermove",t),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n)}function ni(o,e,t){let n=o.columns.getColumn(t);if(!n)return;let r=e.clientX,s=n.width;o.renderer.root.classList.add("fg-resizing"),lr(i=>{o.columns.setWidth(t,s+(i.clientX-r)*(o.renderer.rtl?-1:1)),o.layoutChanged()},()=>{o.renderer.root.classList.remove("fg-resizing");let i=o.columns.getColumn(t)?.width??s;i!==s&&o.events.emit("columnResize",{colId:t,width:i})})}function oi(o,e){let t=o.columns.getNode(e);return!!o.groupPanel&&!!t&&!t.children&&!o.options.treeData&&!o.getGroupBy().includes(e)}function ri(o,e,t,n){let r=new Set(o.columns.siblings(e).map(l=>l.id).filter(l=>l!==e&&!$(l))),s=[...n.querySelectorAll(".fg-header-cell")].filter(l=>r.has(l.dataset.col)).map(l=>({id:l.dataset.col,el:l})),i=x("div",`fg-drag-ghost fg-theme-${o.store.state.theme}`);i.textContent=t.querySelector(".fg-header-label")?.textContent??"",o.applyFontTo(i),ee(o.renderer.root).append(i);let a=x("div","fg-drop-marker");return a.style.height=`${o.renderer.headerEl.offsetHeight}px`,o.renderer.root.append(a),t.classList.add("fg-dragging"),{ghost:i,marker:a,cell:t,sibs:s,target:-1,overPanel:!1}}function si(o,e,t,n,r){t.ghost.style.transform=`translate(${n+12}px, ${r+8}px)`,t.overPanel=oi(o,e)&&!!o.groupPanel?.contains(n,r),o.groupPanel?.highlight(t.overPanel),t.marker.hidden=t.overPanel;let s=0;for(let c of t.sibs){let u=c.el.getBoundingClientRect();(o.renderer.rtl?n<u.left+u.width/2:n>u.left+u.width/2)&&s++}t.target=s;let i=o.renderer.root.getBoundingClientRect().left,a=c=>o.renderer.rtl?c.getBoundingClientRect().right:c.getBoundingClientRect().left,l=c=>o.renderer.rtl?c.getBoundingClientRect().left:c.getBoundingClientRect().right,d=s<t.sibs.length?a(t.sibs[s].el):t.sibs.length?l(t.sibs[t.sibs.length-1].el):a(t.cell);t.marker.style.left=`${d-i-1}px`}function ii(o,e,t){if(t.ghost.remove(),t.marker.remove(),t.cell.classList.remove("fg-dragging"),t.overPanel){o.groupPanel?.highlight(!1),o.setGroupBy([...o.getGroupBy(),e]);return}if(t.target<0||!t.sibs.length)return;let n=o.columns.siblings(e),r=n.findIndex(a=>a.id===e),s=n.map(a=>a.id).filter(a=>a!==e),i=t.target<t.sibs.length?s.indexOf(t.sibs[t.target].id):s.indexOf(t.sibs[t.sibs.length-1].id)+1;i=Math.max(s.filter($).length,i),i!==r&&(o.columns.move(e,i),o.layoutChanged(),o.events.emit("columnMove",{colId:e,toIndex:i}))}function ai(o,e,t,n){let r=o.columns.getNode(t),s=n.closest(".fg-header-pane");if(!r||!s)return;let i=e.clientX,a=null;lr(l=>{if(!a){if(Math.abs(l.clientX-i)<ti)return;a=ri(o,t,n,s)}si(o,t,a,l.clientX,l.clientY)},l=>{a?ii(o,t,a):!r.children&&Ae(r.def)&&o.toggleSort(t,l.shiftKey||l.ctrlKey||l.metaKey)})}function dr(o){let e=o.renderer.headerEl,t=r=>{if(r.button!==0)return;let s=r.target,i=s.closest(".fg-header-cell"),a=i?.dataset.col;!i||!a||$(a)||s.closest(".fg-menu-btn")||s.closest("button, a, input, select, textarea, [data-fg-no-sort]")&&s.closest(".fg-header-label")||(r.preventDefault(),s.closest(".fg-resize")?ni(o,r,a):ai(o,r,a,i))},n=r=>{let s=r.target,i=s.closest(".fg-menu-btn");if(i){let a=i.closest(".fg-header-cell")?.dataset.col;a&&o.menu.toggle(a,i);return}s.closest(".fg-select-all")&&o.toggleSelectAll()};return e.addEventListener("pointerdown",t),e.addEventListener("click",n),()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("click",n)}}var Vt={A4:[210,297],A3:[297,420],A5:[148,210],B4:[250,353],B5:[176,250],letter:[215.9,279.4],legal:[215.9,355.6]},ot=96/25.4,cr=72/25.4,li="system-ui, 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans CJK KR', sans-serif",di=10.5,De=15,qt=7,We=4,zt=8;function ci(o){let e=atob(o),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}var Wt={surface(o,e){if(typeof document>"u")return null;let t=document.createElement("canvas");t.width=o,t.height=e;let n=null;try{n=t.getContext("2d")}catch{n=null}return n?{ctx:n,jpeg:r=>ci(t.toDataURL("image/jpeg",r).split(",")[1]??"")}:null}},Ie=(o,e=di)=>`${o} ${e}px ${li}`;function fr(o,e,t){if(!e)return[""];let n=[];for(let r of e.split(/\r?\n/)){let s="",i=r.match(/[ -鿿가-힯＀-￯]|[^\s -鿿가-힯＀-￯]+\s*|\s+/g)??[""];for(let a of i){let l=s+a;if(!s||o.measureText(l.trimEnd()).width<=t)if(!s&&o.measureText(a.trimEnd()).width>t)for(let d of a)s&&o.measureText(s+d).width>t&&(n.push(s),s=""),s+=d;else s=l;else n.push(s.trimEnd()),s=a.trimStart();if(n.length>=zt)break}if(n.push(s.trimEnd()),n.length>=zt)break}return n.length>zt&&(n.length=zt),n}function ui(o){let[e,t]=Vt[o.paper]??Vt.A4,[n,r]=o.orientation==="landscape"?[t,e]:[e,t],s=n*ot,i=r*ot,a=12*ot,l=14*ot,d=s-a*2,c=o.numbered?40:0,u=o.widths.slice(o.numbered?1:0),f=u.reduce((h,m)=>h+m,0)||1,p=o.fit?(d-c)/f:Math.min(1,(d-c)/f),g=[...o.numbered?[c]:[],...u.map(h=>h*p)],y=[],w=a;for(let h of g)y.push(w),w+=h;return{pageW:s,pageH:i,margin:a,marginBottom:l,colX:y,colW:g}}function ur(o,e,t,n,r){let s={cells:[],kind:n,level:r,y:0,h:0},i=0,a=22;for(let l of t){let d=Math.max(1,l.span??1),c=e.colX[i]??e.margin,u=0;for(let g=i;g<i+d&&g<e.colW.length;g++)u+=e.colW[g];i+=d,o.font=Ie(n==="group"?600:n==="total"||l.bold?700:400);let f=(l.indent??0)*14,p=fr(o,l.text,Math.max(8,u-qt*2-f-(l.icon?14:0)));a=Math.max(a,p.length*De+We*2),s.cells.push({cell:l,x:c,w:u,y:0,h:0,lines:p})}return s.h=a,s}function fi(o,e,t){let n=t.map(()=>({cells:[],kind:"head",y:0,h:22})),r=t.map(()=>e.colW.map(()=>!1)),s=[];o.font=Ie(600),t.forEach((i,a)=>{let l=0;for(let d of i){for(;l<e.colW.length&&r[a][l];)l++;let c=Math.max(1,d.span??1),u=Math.max(1,Math.min(t.length-a,d.rowspan??1));for(let g=a;g<a+u;g++)for(let y=l;y<l+c&&y<e.colW.length;y++)r[g][y]=!0;let f=0;for(let g=l;g<l+c&&g<e.colW.length;g++)f+=e.colW[g];let p=fr(o,d.text,Math.max(8,f-qt*2));s.push({cell:d,r:a,col:l,span:c,rs:u,lines:p,x:e.colX[l]??e.margin,w:f}),l+=c}});for(let i of s){let l=(i.lines.length*De+We*2)/i.rs;for(let d=i.r;d<i.r+i.rs;d++)n[d].h=Math.max(n[d].h,l)}for(let i of s)n[i.r].cells.push({cell:i.cell,x:i.x,w:i.w,y:0,h:n.slice(i.r,i.r+i.rs).reduce((a,l)=>a+l.h,0),lines:i.lines});return n}function pr(o){return!o.title&&!o.subtitle&&!o.printed?0:(o.title?24:12)+(o.subtitle?17:0)+18}function pi(o,e){let t=ui(e),n=fi(o,t,e.head),r=0,s=e.body.map(y=>{let w=ur(o,t,y.cells,y.kind,y.level);return y.kind==="row"&&(w.odd=r++%2===1),w}),i=s.slice(0,e.repeatRows),a=s.slice(e.repeatRows),l=e.foot.map(y=>ur(o,t,y.cells,y.kind,y.level)),d=t.pageH-t.marginBottom,c=pr(e),u=[],f=[...a,...l],p=y=>({...y,cells:y.cells.map(w=>({...w}))}),g=0;do{let y=u.length===0,w={rows:[],title:y||e.repeatTitle},h=t.margin+(w.title?c:0),m=v=>{let C=p(v);C.y=h;for(let S of C.cells)S.y=h,C.kind!=="head"&&(S.h=C.h);w.rows.push(C),h+=C.h};(y||e.repeatHeader)&&n.forEach(m),i.forEach(m);let b=h;for(;g<f.length;){let v=f[g],C=v.kind==="group"&&g+1<f.length?v.h+f[g+1].h:v.h;if(h+C>d&&h>b)break;m(v),g++}u.push(w)}while(g<f.length&&u.length<5e3);return{pages:u,g:t}}function Fe(o,e,t,n,r,s,i){o.strokeStyle=s,o.lineWidth=i,o.beginPath(),o.moveTo(e,t),o.lineTo(n,r),o.stroke()}function hi(o,e,t,n){let r=n.colX.length?n.colX[n.colX.length-1]+n.colW[n.colW.length-1]:n.pageW-n.margin,s=e.kind==="head"?"#f3f4f6":e.kind==="group"?e.level?"#eef2f7":"#e2e8f0":e.kind==="total"?"#f3f4f6":t.striped&&e.odd?"#f9fafb":"";for(let i of e.cells){let a=i.cell.fill||s;a&&(o.fillStyle=a,o.fillRect(i.x,i.y,i.w,i.h)),i.cell.bar&&(o.save(),o.globalAlpha=.4,o.fillStyle=i.cell.bar.color,o.fillRect(i.x+i.w*i.cell.bar.from,i.y+i.h*.15,i.w*(i.cell.bar.to-i.cell.bar.from),i.h*.7),o.restore());let l=e.kind==="head"||e.kind==="group"?600:e.kind==="total"?700:i.cell.bold?600:400;o.font=`${i.cell.italic?"italic ":""}${Ie(l)}`,o.fillStyle=i.cell.num?"#9ca3af":i.cell.color||(e.kind==="head"?"#374151":"#111827"),o.textBaseline="middle",o.save(),o.beginPath(),o.rect(i.x,i.y,i.w,i.h),o.clip();let d=(i.cell.indent??0)*14,c=i.lines.length*De,u=e.kind==="head"?i.y+i.h-We-c+De/2:i.y+We+De/2;e.kind!=="head"&&i.h>c+We*2&&(u=i.y+We+De/2);for(let[f,p]of i.lines.entries()){let g=i.x+qt+d,y=o.measureText(p).width+(i.cell.icon&&f===0?14:0),w=i.cell.group?"center":i.cell.align;if(w==="right"?g=i.x+i.w-qt-y:w==="center"&&(g=i.x+(i.w-y)/2),o.textAlign="left",i.cell.icon&&f===0){let h=o.fillStyle;o.fillStyle=i.cell.icon.color,o.fillText(i.cell.icon.char,g,u),o.fillStyle=h,g+=14}o.fillText(p,g,u),i.cell.strike&&Fe(o,g,u,g+o.measureText(p).width,u,String(o.fillStyle),1),u+=De}o.restore(),e.kind==="head"&&i.x>n.margin+.5&&Fe(o,i.x,i.y,i.x,i.y+i.h,"#e5e7eb",1),e.kind==="head"&&Fe(o,i.x,i.y+i.h,i.x+i.w,i.y+i.h,"#9ca3af",1.5)}e.kind==="group"&&Fe(o,n.margin,e.y,r,e.y,"#cbd5e1",1),e.kind==="total"?Fe(o,n.margin,e.y,r,e.y,"#111827",1.5):e.kind!=="head"&&Fe(o,n.margin,e.y+e.h,r,e.y+e.h,"#e5e7eb",1)}function mi(o,e,t){let n=pr(e);if(!n)return;let r=t.pageW-t.margin,s=t.margin;if(o.textAlign="left",o.textBaseline="top",e.title&&(o.font=Ie(700,17),o.fillStyle="#111827",o.fillText(e.title,t.margin,s),s+=24),e.subtitle&&(o.font=Ie(400,11),o.fillStyle="#4b5563",o.fillText(e.subtitle,t.margin,s),s+=17),e.printed){o.font=Ie(400,9.5),o.fillStyle="#6b7280";let i=o.measureText(e.printed).width;o.fillText(e.printed,r-i,t.margin+n-18-13)}Fe(o,t.margin,t.margin+n-10,r,t.margin+n-10,"#111827",2)}function gi(o,e,t,n,r){let s=t.pageH-7*ot;if(o.font=Ie(400,8.5),o.fillStyle="#6b7280",o.textBaseline="middle",o.textAlign="left",e.footer&&o.fillText(e.footer,t.margin,s),e.pageNumbers){let i=`${n+1} / ${r}`;o.fillText(i,t.pageW-t.margin-o.measureText(i).width,s)}}function Ln(o,e=Wt,t={}){let n=typeof t.scale=="number"&&t.scale>0?Math.min(4,t.scale):2,r=typeof t.quality=="number"&&t.quality>0&&t.quality<=1?t.quality:.92,s=e.surface(8,8);if(!s)return null;let{pages:i,g:a}=pi(s.ctx,o),l=Math.round(a.pageW*n),d=Math.round(a.pageH*n),c=[];i.forEach((y,w)=>{let h=e.surface(l,d);if(!h)return;let m=h.ctx;m.setTransform(n,0,0,n,0,0),m.fillStyle="#ffffff",m.fillRect(0,0,a.pageW,a.pageH),y.title&&mi(m,o,a);for(let b of y.rows)hi(m,b,o,a);gi(m,o,a,w,i.length),c.push(h.jpeg(r))});let[u,f]=Vt[o.paper]??Vt.A4,[p,g]=o.orientation==="landscape"?[f,u]:[u,f];return yi(c.map(y=>({jpeg:y,width:l,height:d})),p*cr,g*cr,o.title)}function wi(o){if(/^[\x20-\x7e]*$/.test(o))return`(${o.replace(/[\\()]/g,t=>`\\${t}`)})`;let e="FEFF";for(let t=0;t<o.length;t++)e+=o.charCodeAt(t).toString(16).padStart(4,"0").toUpperCase();return`<${e}>`}function yi(o,e,t,n=""){let r=new TextEncoder,s=[],i=[],a=0,l=b=>{let v=typeof b=="string"?r.encode(b):b;s.push(v),a+=v.length},d=(b,v)=>{i[b]=a,l(`${b} 0 obj
5
+ `),typeof v=="string"?l(v):v(),l(`
6
+ endobj
7
+ `)};l(`%PDF-1.4
8
+ `),l(new Uint8Array([37,226,227,207,211,10]));let c=o.length,u=o.map((b,v)=>4+v*3),f=e.toFixed(2),p=t.toFixed(2);d(1,"<< /Type /Catalog /Pages 2 0 R >>"),d(2,`<< /Type /Pages /Count ${c} /Kids [${u.map(b=>`${b} 0 R`).join(" ")}] >>`),d(3,`<< /Producer (FreeGrid)${n?` /Title ${wi(n)}`:""} >>`),o.forEach((b,v)=>{let C=u[v],S=`q ${f} 0 0 ${p} 0 0 cm /Im0 Do Q`;d(C,`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${f} ${p}] /Resources << /XObject << /Im0 ${C+2} 0 R >> >> /Contents ${C+1} 0 R >>`),d(C+1,`<< /Length ${S.length} >>
9
+ stream
10
+ ${S}
11
+ endstream`),d(C+2,()=>{l(`<< /Type /XObject /Subtype /Image /Width ${b.width} /Height ${b.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${b.jpeg.length} >>
12
+ stream
13
+ `),l(b.jpeg),l(`
14
+ endstream`)})});let g=4+c*3,y=a,w=`xref
15
+ 0 ${g}
16
+ 0000000000 65535 f
17
+ `;for(let b=1;b<g;b++)w+=`${String(i[b]??0).padStart(10,"0")} 00000 n
18
+ `;l(`${w}trailer
19
+ << /Size ${g} /Root 1 0 R /Info 3 0 R >>
20
+ startxref
21
+ ${y}
22
+ %%EOF
23
+ `);let h=new Uint8Array(a),m=0;for(let b of s)h.set(b,m),m+=b.length;return h}var $e=o=>typeof o=="number"?Number.isFinite(o)?o:null:typeof o=="string"&&o.trim()!==""&&Number.isFinite(Number(o))?Number(o):o instanceof Date?o.getTime():null,bi=new Set(["top","bottom","aboveAverage","belowAverage","duplicate","unique","dataBar","colorScale","iconSet"]),hr={arrows:[{char:"\u25B2",color:"#16a34a",label:"up"},{char:"\u25B6",color:"#d97706",label:"level"},{char:"\u25BC",color:"#dc2626",label:"down"}],traffic:[{char:"\u25CF",color:"#16a34a",label:"good"},{char:"\u25CF",color:"#f59e0b",label:"fair"},{char:"\u25CF",color:"#dc2626",label:"poor"}],signs:[{char:"\u2714",color:"#16a34a",label:"good"},{char:"!",color:"#d97706",label:"fair"},{char:"\u2716",color:"#dc2626",label:"poor"}]};function Fn(o){let e=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(o.trim());if(!e)return null;let t=e[1].length===3?[...e[1]].map(n=>n+n).join(""):e[1];return[0,2,4].map(n=>parseInt(t.slice(n,n+2),16))}function Pn(o,e,t){let n=Fn(o),r=Fn(e);return!n||!r?t<.5?o:e:`#${n.map((i,a)=>Math.round(i+(r[a]-i)*Math.max(0,Math.min(1,t)))).map(i=>i.toString(16).padStart(2,"0")).join("")}`}function rt(o){return o==null?"":o instanceof Date?o.toISOString():String(o)}function vi(o,e){let t=o.op??"eq";if(t==="blank")return W(e);if(t==="notBlank")return!W(e);if(t==="contains"||t==="notContains"||t==="startsWith"||t==="endsWith"){let d=rt(e).toLowerCase(),c=rt(o.value).toLowerCase(),u=t==="startsWith"?d.startsWith(c):t==="endsWith"?d.endsWith(c):d.includes(c);return t==="notContains"?!u:u}if(W(e))return t==="ne";let n=$e(e),r=$e(o.value),s=$e(o.valueTo);if(n!==null&&r!==null)switch(t){case"eq":return n===r;case"ne":return n!==r;case"gt":return n>r;case"gte":return n>=r;case"lt":return n<r;case"lte":return n<=r;case"between":case"notBetween":{if(s===null)return!1;let d=n>=Math.min(r,s)&&n<=Math.max(r,s);return t==="between"?d:!d}}let i=rt(e).toLowerCase(),a=rt(o.value).toLowerCase(),l=rt(o.valueTo).toLowerCase();switch(t){case"eq":return i===a;case"ne":return i!==a;case"gt":return i>a;case"gte":return i>=a;case"lt":return i<a;case"lte":return i<=a;case"between":return i>=a&&i<=l;case"notBetween":return i<a||i>l}return!1}var Ut=class{constructor(e){this.deps=e;this.stats=new Map;this.statsKey=[];this.rowCache=new WeakMap}dependsOnOtherRows(){return this.deps.rules().some(e=>e&&(bi.has(e.type??"value")||e.type==="formula"))}fresh(){let e=[this.deps.rows(),this.deps.version(),this.deps.rules()];e.every((t,n)=>t===this.statsKey[n])||(this.statsKey=e,this.stats.clear(),this.rowCache=new WeakMap)}statsOf(e){let t=this.stats.get(e);if(!t){let n=[],r=new Map;for(let i of this.deps.rows()){let a=this.deps.value(e,i),l=$e(a);if(l!==null&&n.push(l),!W(a)){let d=Y(a);r.set(d,(r.get(d)??0)+1)}}n.sort((i,a)=>i-a);let s=n.reduce((i,a)=>i+a,0);t={min:n[0]??0,max:n[n.length-1]??0,avg:n.length?s/n.length:0,sorted:n,counts:r},this.stats.set(e,t)}return t}test(e,t,n,r){let s=e.type??"value";switch(s){case"value":return vi(e,n);case"formula":{if(typeof e.formula!="string")return!1;let i=this.deps.formula(e.formula.startsWith("=")?e.formula:`=${e.formula}`,r);return i===!0||typeof i=="number"&&i!==0}case"top":case"bottom":{let i=$e(n);if(i===null)return!1;let a=this.statsOf(t);if(!a.sorted.length)return!1;let l=Math.max(1,e.percent?Math.ceil(a.sorted.length*(e.rank??10)/100):Math.floor(e.rank??10));return s==="top"?i>=a.sorted[Math.max(0,a.sorted.length-l)]:i<=a.sorted[Math.min(a.sorted.length-1,l-1)]}case"aboveAverage":case"belowAverage":{let i=$e(n);if(i===null)return!1;let a=this.statsOf(t).avg;return s==="aboveAverage"?i>a:i<a}case"duplicate":case"unique":{if(W(n))return!1;let i=this.statsOf(t).counts.get(Y(n))??0;return s==="duplicate"?i>1:i===1}}return!1}rowStyle(e){if(this.rowCache.has(e))return this.rowCache.get(e);let t=null;for(let n of this.deps.rules()){if(!n?.row||!Array.isArray(n.columns)||!n.columns.length)continue;let r=n.columns[0];if(this.test(n,r,this.deps.value(r,e),e)&&(t={...t??{},...n.style},n.stopIfTrue))break}return this.rowCache.set(e,t),t}cell(e,t,n){let r=this.deps.rules();if(!r.length)return null;this.fresh();let s=null,i=this.rowStyle(t);i&&(s={style:{...i}});for(let a of r){if(!a||a.row||!Array.isArray(a.columns)||!a.columns.includes(e))continue;let l=a.type??"value";if(l==="dataBar"||l==="colorScale"||l==="iconSet"){let d=$e(n);if(d===null)continue;let c=this.statsOf(e),u=typeof a.min=="number"?a.min:c.min,f=typeof a.max=="number"?a.max:c.max,p=f===u?1:Math.max(0,Math.min(1,(d-u)/(f-u)));if(s??(s={style:{}}),l==="dataBar"){let g=u<0&&f>0?-u/(f-u):u>=0?0:1,y=f===u?1:p;s.bar={from:Math.min(g,y),to:Math.max(g,y),color:a.color||"var(--fg-accent)"}}else if(l==="colorScale"){let g=Array.isArray(a.colors)&&a.colors.length>=2?a.colors:["#f8696b","#ffeb84","#63be7b"],y=g.length>=3?p<.5?Pn(g[0],g[1],p*2):Pn(g[1],g[2],(p-.5)*2):Pn(g[0],g[1],p);s.style={...s.style,background:y}}else{let g=hr[a.icons??"arrows"]??hr.arrows;s.icon=p>=2/3?g[0]:p>=1/3?g[1]:g[2]}continue}if(this.test(a,e,n,t)&&(s??(s={style:{}}),s.style={...s.style,...a.style},a.stopIfTrue))break}return s}};function Dn(o){let e=o?Fn(o):null;return e?`FF${e.map(t=>t.toString(16).padStart(2,"0")).join("").toUpperCase()}`:void 0}function mr(o,e,t){return typeof o=="number"&&typeof e=="number"?o-e:o instanceof Date&&e instanceof Date?o.getTime()-e.getTime():typeof o=="boolean"&&typeof e=="boolean"?Number(o)-Number(e):t.compare(String(o),String(e))}function xi(o,e){if(W(e))return null;if(o.type==="number"){let t=typeof e=="number"?e:Number(e);return Number.isNaN(t)?null:t}return o.type==="date"?ue(e)?.getTime()??null:e}function me(o,e,t){let n=W(o),r=W(e);return n||r?n===r?0:n?1:-1:mr(o,e,t)}function gr(o,e,t,n){let r=e.map(a=>({def:t(a.colId),mul:a.dir==="desc"?-1:1})).filter(a=>!!a.def);if(!r.length)return o;let s=r.map(a=>o.map(l=>{let d=G(a.def,l.data);return a.def.comparator?d:xi(a.def,d)})),i=o.map((a,l)=>l);return i.sort((a,l)=>{for(let d=0;d<r.length;d++){let{def:c,mul:u}=r[d],f=s[d][a],p=s[d][l],g;if(c.comparator)try{g=(Number(c.comparator(f,p,o[a].data,o[l].data))||0)*u}catch{B(`comparator of column "${c.id??c.field}" threw; treating values as equal`),g=0}else{let y=W(f),w=W(p);g=y||w?y===w?0:y?1:-1:mr(f,p,n)*u}if(g)return g}return a-l}),i.map(a=>o[a])}var Ci=/^[=+\-@\t\r]/;function wr(o,e=","){let t=n=>{let r=n.value;return n.text&&Ci.test(r)&&(r=`'${r}`),r.includes(e)||/["\r\n]/.test(r)||/^\s|\s$/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return o.map(n=>n.map(t).join(e)).join(`\r
24
+ `)}function In(o){let e=o.slice(0,o.search(/\r?\n|$/)),t=i=>e.split(i).length-1,n=t(" "),r=t(";"),s=t(",");return n&&n>=s&&n>=r?" ":r>s?";":","}function $n(o,e=In(o)){return Tn(o.replace(/^\uFEFF/,""),e)}var ki=(()=>{let o=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;o[e]=t>>>0}return o})();function Ri(o){let e=4294967295;for(let t=0;t<o.length;t++)e=ki[(e^o[t])&255]^e>>>8;return(e^4294967295)>>>0}var yr=new TextEncoder;function br(o){let e=o.map(c=>{let u=yr.encode(c.name),f=typeof c.data=="string"?yr.encode(c.data):c.data;return{name:u,data:f,crc:Ri(f),offset:0}}),t=e.reduce((c,u)=>c+30+u.name.length+u.data.length,0),n=e.reduce((c,u)=>c+46+u.name.length,0),r=new Uint8Array(t+n+22),s=new DataView(r.buffer),i=0,a=0,l=33;for(let c of e)c.offset=i,s.setUint32(i,67324752,!0),s.setUint16(i+4,20,!0),s.setUint16(i+6,2048,!0),s.setUint16(i+8,0,!0),s.setUint16(i+10,a,!0),s.setUint16(i+12,l,!0),s.setUint32(i+14,c.crc,!0),s.setUint32(i+18,c.data.length,!0),s.setUint32(i+22,c.data.length,!0),s.setUint16(i+26,c.name.length,!0),s.setUint16(i+28,0,!0),r.set(c.name,i+30),r.set(c.data,i+30+c.name.length),i+=30+c.name.length+c.data.length;let d=i;for(let c of e)s.setUint32(i,33639248,!0),s.setUint16(i+4,20,!0),s.setUint16(i+6,20,!0),s.setUint16(i+8,2048,!0),s.setUint16(i+10,0,!0),s.setUint16(i+12,a,!0),s.setUint16(i+14,l,!0),s.setUint32(i+16,c.crc,!0),s.setUint32(i+20,c.data.length,!0),s.setUint32(i+24,c.data.length,!0),s.setUint16(i+28,c.name.length,!0),s.setUint16(i+30,0,!0),s.setUint16(i+32,0,!0),s.setUint16(i+34,0,!0),s.setUint16(i+36,0,!0),s.setUint32(i+38,0,!0),s.setUint32(i+42,c.offset,!0),r.set(c.name,i+46),i+=46+c.name.length;return s.setUint32(i,101010256,!0),s.setUint16(i+8,e.length,!0),s.setUint16(i+10,e.length,!0),s.setUint32(i+12,i-d,!0),s.setUint32(i+16,d,!0),r}var jt=o=>o.length>4&&o[0]===80&&o[1]===75&&o[2]===3&&o[3]===4,vr=o=>new Error(`Zip file is too large: it unpacks to more than ${o>=1048576?`${Math.round(o/1048576)} MB`:`${o} bytes`}`);async function Si(o,e){if(typeof DecompressionStream>"u")throw new Error("This browser cannot read compressed xlsx files (no DecompressionStream)");let n=new Response(o).body.pipeThrough(new DecompressionStream("deflate-raw")).getReader(),r=[],s=0;for(;;){let{done:l,value:d}=await n.read();if(l)break;if(s+=d.length,s>e)throw await n.cancel().catch(()=>{}),vr(e);r.push(d)}let i=new Uint8Array(s),a=0;for(let l of r)i.set(l,a),a+=l.length;return i}async function xr(o,e={}){let t=e.maxBytes??209715200,n=e.maxEntries??1e4,r=new DataView(o.buffer,o.byteOffset,o.byteLength),s=-1;for(let u=o.length-22;u>=Math.max(0,o.length-65557);u--)if(r.getUint32(u,!0)===101010256){s=u;break}if(s<0)throw new Error("Not a zip file");let i=r.getUint16(s+10,!0);if(i>n)throw new Error(`Zip file has too many entries (${i}, at most ${n})`);let a=r.getUint32(s+16,!0),l=new TextDecoder,d=new Map,c=0;for(let u=0;u<i;u++){if(r.getUint32(a,!0)!==33639248)throw new Error("Broken zip directory");let f=r.getUint16(a+10,!0),p=r.getUint32(a+20,!0),g=r.getUint16(a+28,!0),y=r.getUint16(a+30,!0),w=r.getUint16(a+32,!0),h=r.getUint32(a+42,!0),m=l.decode(o.subarray(a+46,a+46+g)),b=r.getUint16(h+26,!0),v=r.getUint16(h+28,!0),C=h+30+b+v,S=o.subarray(C,C+p),T;if(f===0)T=S;else if(f===8)T=await Si(S,t-c);else throw new Error(`Unsupported zip compression ${f}`);if(c+=T.length,c>t)throw vr(t);d.set(m,T),a+=46+g+y+w}return d}function Nn(o){let e="";for(let t=o+1;t>0;t=Math.floor((t-1)/26))e=String.fromCharCode(65+(t-1)%26)+e;return e}var Cr=Date.UTC(1899,11,30),kr=864e5;function Mi(o){return(Date.UTC(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds(),o.getMilliseconds())-Cr)/kr}function Ei(o){let e=new Date(Math.round(o*kr)+Cr);return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())}var Ai=/[\u0000-\u0008\u000b\u000c\u000e-\u001f￾￿]/g,Kt=o=>o.replace(Ai,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ue=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
25
+ `,On="http://schemas.openxmlformats.org/spreadsheetml/2006/main",je="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Ti(o){let e=new Set;return o.map((t,n)=>{let r=(t.name??`Sheet${n+1}`).replace(/[[\]:*?/\\]/g," ").slice(0,31).trim()||`Sheet${n+1}`,s=r;for(let i=2;e.has(s.toLowerCase());i++)s=`${r.slice(0,28)} (${i})`;return e.add(s.toLowerCase()),s})}function Ke(o){let e=new Map([["General",0]]),t=[],n=['<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>'],r=new Map([["General||||",0]]),s=['<font><sz val="11"/><name val="Calibri"/></font>','<font><b/><sz val="11"/><name val="Calibri"/></font>'],i=new Map([["0|",0],["1|",1]]),a=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>','<fill><patternFill patternType="solid"><fgColor rgb="FFF2F4F7"/><bgColor indexed="64"/></patternFill></fill>'],l=new Map([["FFF2F4F7",2]]),d=h=>h&&/^[0-9a-f]{8}$/i.test(h)?h.toUpperCase():h&&/^[0-9a-f]{6}$/i.test(h)?`FF${h.toUpperCase()}`:"",c=(h,m)=>{let b=`${h?1:0}|${m}`,v=i.get(b);return v===void 0&&(v=s.length,s.push(`<font>${h?"<b/>":""}<sz val="11"/>${m?`<color rgb="${m}"/>`:""}<name val="Calibri"/></font>`),i.set(b,v)),v},u=h=>{if(!h)return 0;let m=l.get(h);return m===void 0&&(m=a.length,a.push(`<fill><patternFill patternType="solid"><fgColor rgb="${h}"/><bgColor indexed="64"/></patternFill></fill>`),l.set(h,m)),m},f=(h,m)=>{let b=d(m.color),v=m.header?"FFF2F4F7":d(m.fill),C=!!(m.bold||m.header),S=m.align==="left"||m.align==="center"||m.align==="right"?m.align:"",T=`${h}|${C?1:""}|${b}|${v}|${S}`,k=r.get(T);if(k!==void 0)return k;let E=e.get(h);E===void 0&&(E=164+t.length,t.push(h),e.set(h,E));let R=c(C,b),M=u(v),A=`numFmtId="${E}" fontId="${R}" fillId="${M}" borderId="0" xfId="0"`+(E?' applyNumberFormat="1"':"")+(R?' applyFont="1"':"")+(M?' applyFill="1"':"")+(S?' applyAlignment="1"':"");return k=n.length,n.push(S?`<xf ${A}><alignment horizontal="${S}"/></xf>`:`<xf ${A}/>`),r.set(T,k),k},p=Ti(o),g=o.map(h=>{let m=h.rows.map((R,M)=>{let A=R.map((L,F)=>{let D=L!==null&&typeof L=="object"&&!(L instanceof Date)?L:{v:L},I=`${Nn(F)}${M+1}`,N=D.v,z=D.fmt??"General";N instanceof Date&&(Number.isNaN(N.getTime())?N=null:(z==="General"&&(z="yyyy-mm-dd"),N=Mi(N)));let U=f(z,D),K=U?` s="${U}"`:"";return N==null||N===""?K?`<c r="${I}"${K}/>`:"":typeof N=="number"?Number.isFinite(N)?`<c r="${I}"${K}><v>${N}</v></c>`:"":typeof N=="boolean"?`<c r="${I}"${K} t="b"><v>${N?1:0}</v></c>`:`<c r="${I}"${K} t="inlineStr"><is><t xml:space="preserve">${Kt(String(N))}</t></is></c>`}).join("");return`<row r="${M+1}">${A}</row>`}).join(""),b=Math.max(0,...h.rows.map(R=>R.length)),v=h.freezeRows??0,C=v?`<sheetViews><sheetView workbookViewId="0"><pane ySplit="${v}" topLeftCell="A${v+1}" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>`:'<sheetViews><sheetView workbookViewId="0"/></sheetViews>',S=h.widths?.length?`<cols>${h.widths.map((R,M)=>`<col min="${M+1}" max="${M+1}" width="${Math.max(4,Math.min(120,R)).toFixed(1)}" customWidth="1"/>`).join("")}</cols>`:"",T=h.autoFilter&&b&&v&&h.rows.length>=v?`<autoFilter ref="A${v}:${Nn(b-1)}${h.rows.length}"/>`:"",k=(h.merges??[]).filter(R=>typeof R=="string"&&/^[A-Z]{1,3}\d{1,7}:[A-Z]{1,3}\d{1,7}$/.test(R)),E=k.length?`<mergeCells count="${k.length}">${k.map(R=>`<mergeCell ref="${R}"/>`).join("")}</mergeCells>`:"";return`${Ue}<worksheet xmlns="${On}" xmlns:r="${je}">${C}<sheetFormatPr defaultRowHeight="15"/>${S}<sheetData>${m}</sheetData>${T}${E}</worksheet>`}),y=`${Ue}<styleSheet xmlns="${On}">`+(t.length?`<numFmts count="${t.length}">${t.map((h,m)=>`<numFmt numFmtId="${164+m}" formatCode="${Kt(h)}"/>`).join("")}</numFmts>`:"")+`<fonts count="${s.length}">${s.join("")}</fonts><fills count="${a.length}">${a.join("")}</fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="${n.length}">${n.join("")}</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`,w=[{name:"[Content_Types].xml",data:`${Ue}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>`+o.map((h,m)=>`<Override PartName="/xl/worksheets/sheet${m+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")+"</Types>"},{name:"_rels/.rels",data:`${Ue}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${je}/officeDocument" Target="xl/workbook.xml"/></Relationships>`},{name:"xl/workbook.xml",data:`${Ue}<workbook xmlns="${On}" xmlns:r="${je}"><sheets>`+p.map((h,m)=>`<sheet name="${Kt(h)}" sheetId="${m+1}" r:id="rId${m+1}"/>`).join("")+"</sheets>"+(o.some(h=>h.autoFilter&&h.freezeRows||h.printTitleRows)?`<definedNames>${o.map((h,m)=>{let b=Math.max(0,...h.rows.map(k=>k.length)),v=`'${Kt(p[m].replace(/'/g,"''"))}'`,C=h.autoFilter&&h.freezeRows&&b?`<definedName name="_xlnm._FilterDatabase" localSheetId="${m}" hidden="1">${v}!$A$${h.freezeRows}:$${Nn(b-1)}$${h.rows.length}</definedName>`:"",S=Math.min(h.printTitleRows??0,h.rows.length),T=S>0&&Number.isInteger(S)?`<definedName name="_xlnm.Print_Titles" localSheetId="${m}">${v}!$1:$${S}</definedName>`:"";return C+T}).join("")}</definedNames>`:"")+"</workbook>"},{name:"xl/_rels/workbook.xml.rels",data:`${Ue}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`+o.map((h,m)=>`<Relationship Id="rId${m+1}" Type="${je}/worksheet" Target="worksheets/sheet${m+1}.xml"/>`).join("")+`<Relationship Id="rId${o.length+1}" Type="${je}/styles" Target="styles.xml"/></Relationships>`},{name:"xl/styles.xml",data:y},...g.map((h,m)=>({name:`xl/worksheets/sheet${m+1}.xml`,data:h}))];return br(w)}var Li=new Set([14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57]);function Pi(o){let e=o.replace(/"[^"]*"/g,"").replace(/\[[^\]]*\]/g,"").replace(/\\./g,"");return/[dmyhs]/i.test(e)&&!/^[#0.,%\s]*$/.test(e)}function st(o){return o?new DOMParser().parseFromString(new TextDecoder().decode(o),"application/xml"):null}var ge=(o,e)=>[...o.getElementsByTagNameNS("*",e)];function Fi(o){let e=0;for(let t of o){let n=t.charCodeAt(0);if(n<65||n>90)break;e=e*26+(n-64)}return e-1}var Di=1048576,Ii=16384;async function Bn(o){let e=o instanceof Uint8Array?o:new Uint8Array(o);if(!jt(e))throw new Error("Not an xlsx file");let t=await xr(e),n=st(t.get("xl/workbook.xml"));if(!n)throw new Error("xlsx has no workbook");let r=st(t.get("xl/_rels/workbook.xml.rels")),s=new Map(r?ge(r,"Relationship").map(p=>[p.getAttribute("Id")??"",p.getAttribute("Target")??""]):[]),i=st(t.get("xl/sharedStrings.xml")),a=i?ge(i,"si").map(p=>ge(p,"t").map(g=>g.textContent??"").join("")):[],l=st(t.get("xl/styles.xml")),d=new Map(l?ge(l,"numFmt").map(p=>[Number(p.getAttribute("numFmtId")),p.getAttribute("formatCode")??""]):[]),c=l?ge(l,"cellXfs")[0]:void 0,u=(c?[...c.children].filter(p=>p.localName==="xf"):[]).map(p=>{let g=Number(p.getAttribute("numFmtId")??0);return Li.has(g)||d.has(g)&&Pi(d.get(g))}),f=[];for(let p of ge(n,"sheet")){let g=p.getAttribute("r:id")??p.getAttributeNS(je,"id")??"",y=s.get(g)??"";y=y.startsWith("/")?y.slice(1):`xl/${y}`;let w=st(t.get(y)),h=[];if(w){for(let m of ge(w,"row")){let b=Number(m.getAttribute("r")??h.length+1)-1;if(!Number.isInteger(b)||b<0||b>=Di)continue;let v=[],C=0;for(let S of[...m.children].filter(T=>T.localName==="c")){let T=S.getAttribute("r"),k=T?Fi(T):C;if(k<0||k>=Ii)continue;C=k+1;let E=S.getAttribute("t"),R=ge(S,"v")[0]?.textContent??null,M=null;if(E==="s")M=R===null?null:a[Number(R)]??"";else if(E==="inlineStr")M=ge(S,"t").map(A=>A.textContent??"").join("");else if(E==="b")M=R==="1";else if(E==="str"||E==="e")M=R;else if(R!==null&&R!==""){let A=Number(R);M=u[Number(S.getAttribute("s")??0)]?Ei(A):A}v[k]=M}for(let S=0;S<v.length;S++)v[S]===void 0&&(v[S]=null);h[b]=v}for(let m=0;m<h.length;m++)h[m]||(h[m]=[])}f.push({name:p.getAttribute("name")??`Sheet${f.length+1}`,rows:h})}return f}function Yt(o,e){return Array.isArray(e)?e.flatMap(t=>{let n=o.columns.getNode(t);return!n||n.children||$(t)?(B(`export: unknown column "${t}"`),[]):[{id:t,def:n.def,node:n,width:o.columns.getColumn(t)?.width??n.width}]}):o.columns.displayed().filter(t=>!$(t.id)).map(t=>({id:t.id,def:t.def,node:t.node,width:t.width}))}function Zt(o,e){return e==="selected"?o.selectedRows():e==="all"?o.rowModel.server?o.rowModel.dataRows().map(t=>t.data):o.viewRows():o.rowModel.dataRows().map(t=>t.data)}var Ne=(o,e)=>o.header??o.field??e,$i=["left","center","right"],Ni=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i,we=o=>String(o??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e]),Oi=["A4","A3","A5","B4","B5","letter","legal"],Bi=760,Hi=o=>`"${o.replace(/[\\"<\n\r]/g,e=>e===`
26
+ `?"\\A ":e==="\r"?"":`\\${e.charCodeAt(0).toString(16)} `)}"`,Rr=o=>o?`#${o.slice(2)}`:"";function Gi(o,e,t){let n=[],r=0,s=o.store.state.sort,i=o.collator(),a=(l,d)=>{if(d>=t.length){for(let g of l)n.push({kind:"row",row:g,n:++r});return}let c=t[d],u=o.columns.getNode(c)?.def;if(!u)return a(l,d+1);let f=new Map;for(let g of l){let y=G(u,g),w=W(y)?"":Y(y),h=f.get(w);h||f.set(w,h={value:y,rows:[]}),h.rows.push(g)}let p=s.find(g=>g.colId===c)?.dir==="desc"?-1:1;for(let g of[...f.values()].sort((y,w)=>me(y.value,w.value,i)*p))n.push({kind:"group",colId:c,value:g.value,rows:g.rows,level:d}),a(g.rows,d+1)};return a(e,0),n}var zi=`
8
27
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
9
28
  body { font: 10.5px/1.45 system-ui, 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; color: #111827; margin: 0; }
10
29
  header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 2px solid #111827; }
@@ -22,9 +41,11 @@ tr { break-inside: avoid; page-break-inside: avoid; }
22
41
  .num { text-align: right; color: #9ca3af; }
23
42
  tr.group td { background: #eef2f7; font-weight: 600; border-top: 1px solid #cbd5e1; break-after: avoid; page-break-after: avoid; }
24
43
  tr.group.level-0 td { background: #e2e8f0; }
44
+ tr.title td { border: 0; padding: 0 0 4px; background: none; }
25
45
  tr.total td { font-weight: 700; background: #f3f4f6; border-top: 1.5px solid #111827; border-bottom: 0; }
26
- `;function Xt(i,e={}){let t=jt(i,e.columns),n=i.store.state.locale,o=n.code,r=t.map(T=>K(T.def,o)),s=new Intl.NumberFormat(o),a=e.rowNumbers??!!i.options.rowNumbers,l=T=>Zr.includes(T.align)?T.align:T.type==="number"?"right":T.type==="boolean"?"center":"left",d=t.map(T=>{let H=[];for(let N=T.node;N;N=N.parent)H.unshift(N);return H}),c=Math.max(1,...d.map(T=>T.length)),u=[];for(let T=0;T<c;T++){let H=T===0&&a?`<th class="num" rowspan="${c}">#</th>`:"";for(let N=0;N<t.length;N++){let z=d[N],W=z.length-1;if(T<W){let G=z[T];if(N>0&&d[N-1][T]===G)continue;let V=1;for(;N+V<t.length&&d[N+V][T]===G;)V++;H+=`<th colspan="${V}"${V>1?' class="span"':""}>${ue(Le(G.def,G.id))}</th>`}else if(T===W){let G=l(t[N].def);H+=`<th colspan="1" rowspan="${c-T}"${G==="left"?"":` style="text-align:${G}"`}>${ue(Le(t[N].def,t[N].id))}</th>`}}u.push(`<tr>${H}</tr>`)}let g=(T,H,N,z)=>{if(N==null||N==="")return"";if(z==="count")return s.format(N);let W=T.def.type??(typeof N=="number"?"number":N instanceof Date?"date":void 0);return W===T.def.type?r[H](N):K({...T.def,type:W},o)(N)},f=(T,H,N,z=0)=>{let W=0;for(;W<t.length-1&&!N[W];)W++;W=Math.max(1,W);let G=a?'<td class="num"></td>':"";G+=`<td colspan="${W}"${z?` style="padding-left:${7+z*14}px"`:""}>${ue(H)}</td>`;for(let V=W;V<t.length;V++)G+=`<td style="text-align:${l(t[V].def)}">${ue(N[V]??"")}</td>`;return`<tr class="${T}">${G}</tr>`},b=_t(i,e.rows),w=e.groups!==!1&&!i.rowModel.server&&!i.options.treeData?i.getGroupBy():[],m=e.styles!==!1&&t.some(T=>T.def.cellClass)?po(i):null,h="";try{for(let T of oi(i,b,w)){if(T.kind==="group"){let z=i.columns.getNode(T.colId)?.def,W=q(T.value)?n.blanks:z?K(z,o)(T.value):String(T.value),G=`${z?Le(z,T.colId):T.colId}: ${W} (${s.format(T.rows.length)})`,V=t.map((U,Y)=>{if(!(!U.def.aggFunc||w.includes(U.id)))try{return g(U,Y,pe(U.def.aggFunc,T.rows.map(J=>B(U.def,J)),T.rows),U.def.aggFunc)||void 0}catch{return}});h+=f(`group level-${Math.min(T.level,5)}`,G,V,T.level);continue}let H=T.row,N=a?`<td class="num">${T.n}</td>`:"";t.forEach((z,W)=>{let G=B(z.def,H),V=q(G)?"":r[W](G),U=`text-align:${l(z.def)}`;if(m&&z.def.cellClass){let Y;try{Y=typeof z.def.cellClass=="function"?z.def.cellClass({value:G,formatted:V,row:H,rowIndex:T.n-1,column:z.def}):z.def.cellClass}catch{Y=void 0}if(Y){let J=m.of(Y);J.color&&(U+=`;color:${ho(J.color)}`),J.fill&&(U+=`;background:${ho(J.fill)}`),J.bold&&(U+=";font-weight:600")}}N+=`<td style="${U}">${ue(V)}</td>`}),h+=`<tr>${N}</tr>`}}finally{m?.dispose()}let p="",v=e.summary!==!1?i.summary():null;v&&v.opts.rows.forEach((T,H)=>{let N=t.map((z,W)=>{let G=T.columns?.[z.id];return G===void 0?void 0:g(z,W,v.values[H]?.[z.id],De(G).agg)||void 0});p+=f("total",T.label??"",N)});let y=t.map(T=>Math.max(1,T.width)),R=y.reduce((T,H)=>T+H,0),k=ei.includes(e.paper)?e.paper:"A4",L=e.orientation==="portrait"||e.orientation==="landscape"?e.orientation:R+(a?40:0)>ti?"landscape":"portrait",C=e.fitToWidth!==!1,E=C?`<colgroup>${a?'<col style="width:40px">':""}${y.map(T=>`<col style="width:${Math.round(T/R*1e3)/10}%">`).join("")}</colgroup>`:"",M=ue(e.title??document.title??""),S=e.printedAt!==!1?new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(new Date):"",I=e.title||e.subtitle?`<div>${e.title?`<h1>${M}</h1>`:""}${e.subtitle?`<p class="sub">${ue(e.subtitle)}</p>`:""}</div>`:"<div></div>",$=e.title||e.subtitle||S?`<header>${I}${S?`<p class="printed">${ue(S)}</p>`:""}</header>`:"",A="font: 8.5px system-ui, sans-serif; color: #6b7280;",F=[`size: ${k} ${L}; margin: 12mm 12mm 14mm;`,e.footer?`@bottom-left { content: ${ni(e.footer)}; ${A} }`:"",e.pageNumbers!==!1?`@bottom-right { content: counter(page) " / " counter(pages); ${A} }`:""].join(" "),P=e.striped!==!1?"tbody tr:not(.group):nth-child(even) td { background: #f9fafb; }":"";return`<!doctype html><html lang="${ue(o)}"><head><meta charset="utf-8"><title>${M}</title><style>
27
- @page { ${F} }${ri}${P}
28
- </style></head><body>${$}<table${C?' class="fit"':""}>${E}<thead>${e.headers===!1?"":u.join("")}</thead><tbody>${h}</tbody>${p?`<tfoot>${p}</tfoot>`:""}</table></body></html>`}function fo(i){if(typeof document>"u")return;let e=document.createElement("iframe");e.style.cssText="position:fixed;right:0;bottom:0;width:0;height:0;border:0",document.body.append(e);let t=e.contentDocument;if(!t||!e.contentWindow){e.remove(),O("printing is not supported in this environment");return}t.open(),t.write(i),t.close();let n=e.contentWindow,o=()=>setTimeout(()=>e.remove(),1e3);n.addEventListener("afterprint",o),setTimeout(()=>{try{n.focus(),n.print()}catch{O("printing is not supported in this environment")}o()},50)}function Yt(i,e={}){let t=jt(i,e.columns),n=i.store.state.locale.code,o=typeof e.separator=="string"&&e.separator.length===1?e.separator:",",r=_t(i,e.rows).map(s=>t.map(a=>{let l=B(a.def,s),d=a.def.type,c=ut(a.def,l,n);return{value:c,text:!(d==="number"||d==="date"||d==="boolean")||typeof l=="string"&&!Qr.test(c)}}));return e.headers!==!1&&r.unshift(t.map(s=>({value:Le(s.def,s.id),text:!0}))),ro(r,o)}function ii(i){let e=i.format;if(i.type==="date")return e==="datetime"?"yyyy-mm-dd hh:mm":e==="time"?"hh:mm":"yyyy-mm-dd";if(i.type!=="number"||e==null)return null;if(typeof e=="string")return e==="integer"?"#,##0":e==="percent"?"0%":e.startsWith("currency:")?"#,##0.##":/^[#0,.%]+$/.test(e)?e:null;let t=e,n=t.maximumFractionDigits??t.minimumFractionDigits,o=n?`.${"0".repeat(Math.min(10,n))}`:"";return t.style==="percent"?`0${o}%`:`${t.useGrouping===!1?"0":"#,##0"}${o}`}function vt(i){let e=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(i.trim());if(e)return`FF${(e[1].length===3?[...e[1]].map(r=>r+r).join(""):e[1]).toUpperCase()}`;let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,/]+([\d.]+%?))?\s*\)$/i.exec(i.trim());return!t||!((t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]))>0)?"":`FF${[t[1],t[2],t[3]].map(o=>Math.min(255,Number(o)).toString(16).padStart(2,"0")).join("").toUpperCase()}`}function po(i){let e=i.renderer.root;if(typeof getComputedStyle!="function"||!e.isConnected)return{of:()=>({}),dispose:()=>{}};let t=document.createElement("div");t.className="fg-row",t.style.cssText="position:absolute;left:-9999px;top:0;visibility:hidden;pointer-events:none";let n=document.createElement("div");t.append(n),e.append(t);let o=a=>{n.className=a?`fg-cell ${a}`:"fg-cell";let l=getComputedStyle(n),d=l.fontWeight;return{color:l.color,fill:l.backgroundColor,bold:d==="bold"||Number(d)>=600}},r=o(""),s=new Map;return{of(a){let l=s.get(a);if(!l){let d=o(a);l={},d.color!==r.color&&vt(d.color)&&(l.color=vt(d.color)),d.fill!==r.fill&&vt(d.fill)&&(l.fill=vt(d.fill)),d.bold&&!r.bold&&(l.bold=!0),s.set(a,l)}return l},dispose:()=>t.remove()}}function Jt(i,e={}){return Ee([Zt(i,e)])}function Zt(i,e={}){let t=jt(i,e.columns),n=i.store.state.locale.code,o=[],r=[],s=0;if(e.headers!==!1){let m=t.map(p=>{let v=[];for(let y=p.node;y;y=y.parent)v.unshift(y);return v});s=Math.max(1,...m.map(p=>p.length));let h=p=>{let v="";for(let y=p+1;y>0;y=Math.floor((y-1)/26))v=String.fromCharCode(65+(y-1)%26)+v;return v};for(let p=0;p<s;p++){let v=[];for(let y=0;y<t.length;y++){let R=m[y],k=R.length-1;if(p<k){let L=R[p],C=y>0?m[y-1][p]:null;if(v.push({v:C===L?null:Le(L.def,L.id),header:!0}),C!==L){let E=y;for(;E+1<t.length&&m[E+1][p]===L;)E++;E>y&&r.push(`${h(y)}${p+1}:${h(E)}${p+1}`)}}else p===k?(v.push({v:Le(t[y].def,t[y].id),header:!0}),s-1>p&&r.push(`${h(y)}${p+1}:${h(y)}${s}`)):v.push({v:null,header:!0})}o.push(v)}}let a=t.map(m=>ii(m.def)),l=t.map(m=>K(m.def,n)),d=_t(i,e.rows),c=e.styles!==!1,u=c&&t.some(m=>m.def.cellClass)?po(i):null,g=(m,h,p)=>{if(q(p))return null;let v=a[h]??void 0;switch(m.def.type){case"number":{let y=typeof p=="number"?p:Number(p);return Number.isFinite(y)?{v:y,fmt:v}:String(p)}case"date":{let y=ie(p);return y?{v:y,fmt:v}:String(p)}case"boolean":return typeof p=="boolean"?p:String(p);default:return l[h](p)}};try{d.forEach((m,h)=>{o.push(t.map((p,v)=>{let y=B(p.def,m),R=g(p,v,y);if(!c)return R;let k=p.def.align?{align:p.def.align}:{};if(u&&p.def.cellClass){let L;try{L=typeof p.def.cellClass=="function"?p.def.cellClass({value:y,formatted:l[v](y),row:m,rowIndex:h,column:p.def}):p.def.cellClass}catch{L=void 0}L&&(k={...k,...u.of(L)})}return Object.keys(k).length?R!==null&&typeof R=="object"&&!(R instanceof Date)?{...R,...k}:{v:R,...k}:R}))})}finally{u?.dispose()}let f=new Set,b=m=>{let h="";for(let p=m+1;p>0;p=Math.floor((p-1)/26))h=String.fromCharCode(65+(p-1)%26)+h;return h},w=(m,h,p,v)=>{for(let y=m;y<=p;y++)for(let R=h;R<=v;R++)if(f.has(`${y},${R}`))return;for(let y=m;y<=p;y++)for(let R=h;R<=v;R++)f.add(`${y},${R}`);r.push(`${b(h)}${s+m+1}:${b(v)}${s+p+1}`)};return d.forEach((m,h)=>t.forEach((p,v)=>{let y=p.def.colSpan?$e(p.def.colSpan,p.def,m,h,t.length-v):1;y>1&&w(h,v,h,v+y-1)})),t.forEach((m,h)=>{if(!m.def.merge&&!m.def.rowSpan)return;let p=Je(d,m.def);for(let v=0;v<d.length;v++)p.start[v]===v&&p.end[v]>v&&w(v,h,p.end[v],h)}),{name:e.sheetName??"Sheet1",rows:o,widths:t.map(m=>Math.round(m.width/7)),merges:r,freezeRows:s,autoFilter:s>0}}function Oe(i,e,t){if(typeof URL>"u"||typeof URL.createObjectURL!="function"||typeof document>"u"){O("downloads are not supported in this environment");return}let n=URL.createObjectURL(new Blob(e,{type:t})),o=document.createElement("a");o.href=n,o.download=i,o.style.display="none",document.body.append(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}var yt=i=>String(i??"").trim().toLowerCase();function si(i){return i==null?"":i instanceof Date?i.getHours()||i.getMinutes()||i.getSeconds()?i.toISOString():Q(i)??"":String(i)}async function go(i,e,t={}){let n=e instanceof Uint8Array?e:new Uint8Array(e instanceof ArrayBuffer?e:await e.arrayBuffer()),o;if(mt(n)){let w=await Kt(n),m=typeof t.sheet=="string"?w.find(h=>h.name===t.sheet):w[typeof t.sheet=="number"?t.sheet:0];if(!m)throw new Error(`Sheet ${String(t.sheet)} not found`);o=m.rows}else{let w=new TextDecoder().decode(n);o=qt(w,Vt(w))}if(!o.length)return{rows:[],skipped:0};let r=[],s=w=>w.forEach(m=>m.children?s(m.children):!D(m.id)&&m.def.field&&r.push(m));s(i.columns.roots());let a=w=>{let m=yt(w);return m?r.find(h=>yt(h.def.header)===m)??r.find(h=>yt(h.def.field)===m||yt(h.id)===m)??null:null},l=1,d=new Set(o[0].map(a).filter(Boolean));for(;l<Math.min(o.length,5);){let m=(o[l]??[]).filter(p=>p!=null&&String(p).trim()!==""),h=m.map(a).filter(p=>p&&!d.has(p));if(!m.length||!m.every(p=>typeof p=="string")||!h.length)break;h.forEach(p=>d.add(p)),l++}let c=Math.max(...o.slice(0,l).map(w=>w?.length??0)),u=Array.from({length:c},(w,m)=>{for(let h=l-1;h>=0;h--){let p=o[h]?.[m];if(p!=null&&String(p).trim()!=="")return a(p)}return null}),g=i.store.state.data[0],f=0,b=[];for(let w of o.slice(l)){if(!w||w.every(h=>h==null||String(h).trim()===""))continue;let m={};u.forEach((h,p)=>{if(!h)return;let v=h.def,y=si(w[p]),R=i.acceptText(v,m,y,g?.[v.field]);R.ok?y===""&&(R.value===null||R.value==="")||(m[v.field]=R.value):f++}),b.push(m)}return t.mode==="replace"?i.setData(b):i.addRows(b),{rows:b,skipped:f}}var ai="http://www.w3.org/2000/svg";var Qt=["var(--fg-accent, #2563eb)","#f59e0b","#10b981","#ef4444","#8b5cf6","#06b6d4","#ec4899","#84cc16","#f97316","#64748b","#14b8a6","#a855f7"],me=i=>Qt[i%Qt.length];function j(i,e={},t=""){let n=document.createElementNS(ai,i);t&&n.setAttribute("class",t);for(let[o,r]of Object.entries(e))n.setAttribute(o,String(r));return n}function He(i,e){let t=j("title");t.textContent=e,i.append(t)}function en(i,e,t=5){let n=Math.min(0,i),o=Math.max(0,e);n===o&&(o=n+1);let r=(o-n)/t,s=10**Math.floor(Math.log10(r)),a=[1,2,5,10].map(d=>d*s).find(d=>d>=r);n=Math.floor(n/a)*a,o=Math.ceil(o/a)*a;let l=[];for(let d=n;d<=o+a/2;d+=a)l.push(Math.round(d/a)*a);return l}function tn(i,e){let t=new Intl.NumberFormat(e.locale,{maximumFractionDigits:2}),n=new Intl.NumberFormat(e.locale,{notation:"compact",maximumFractionDigits:1}),o=j("svg",{viewBox:"0 0 640 360",role:"img",preserveAspectRatio:"xMidYMid meet"},`fg-chart fg-chart-is-${e.type}`);e.title&&o.setAttribute("aria-label",e.title);let r=e.series.slice(0,Qt.length),s=e.categories,a=16;if(e.title){let S=j("text",{x:320,y:22,"text-anchor":"middle"},"fg-chart-title");S.textContent=e.title,o.append(S),a=36}let l=j("g",{},"fg-chart-legend"),d=e.type==="pie"||e.type==="donut",c=d?s:e.type==="scatter"?r.slice(1).map(S=>S.name):r.map(S=>S.name),u=16;c.forEach((S,I)=>{let $=j("g",{transform:`translate(${u},350)`},"fg-chart-legend-item");$.append(j("rect",{x:0,y:-9,width:10,height:10,rx:2,fill:me(I)}));let A=j("text",{x:14,y:0});A.textContent=S,$.append(A),l.append($),u+=24+Math.min(140,S.length*7)});let g=308;if(e.type==="scatter"){li(o,e,r,a,g,t,n),o.append(l),i.replaceChildren(o);return}if(d){let S=(r[0]?.values??[]).map(T=>T!==null&&T>0?T:0),I=S.reduce((T,H)=>T+H,0),$=640/2,A=(a+g)/2,F=Math.max(10,(g-a)/2-6),P=-Math.PI/2;S.forEach((T,H)=>{if(!T||!I)return;let N=P+T/I*Math.PI*2,z=N-P>Math.PI?1:0,W=U=>`${$+F*Math.cos(U)},${A+F*Math.sin(U)}`,G=T===I?`M${$-F},${A}a${F},${F} 0 1,0 ${2*F},0a${F},${F} 0 1,0 ${-2*F},0`:`M${$},${A}L${W(P)}A${F},${F} 0 ${z} 1 ${W(N)}Z`,V=j("path",{d:G,fill:me(H)},"fg-chart-slice");He(V,`${s[H]}: ${t.format(T)} (${Math.round(T/I*1e3)/10}%)`),o.append(V),P=N}),e.type==="donut"&&o.append(j("circle",{cx:$,cy:A,r:F*.58,fill:"var(--fg-bg, #fff)"},"fg-chart-donut-hole")),o.append(l),i.replaceChildren(o);return}let f=e.type==="stackedBar",b=0,w=0;s.forEach((S,I)=>{let $=0,A=0;for(let F of r){let P=F.values[I];P==null||!Number.isFinite(P)||(f?P>=0?$+=P:A+=P:(w=Math.max(w,P),b=Math.min(b,P)))}f&&(w=Math.max(w,$),b=Math.min(b,A))});let m=en(b,w),h=m[0],p=m[m.length-1],v=56,y=624,R=S=>g-(S-h)/(p-h)*(g-a),k=j("g",{},"fg-chart-axis");for(let S of m){k.append(j("line",{x1:v,x2:y,y1:R(S),y2:R(S)},S===0?"fg-chart-zero":"fg-chart-grid"));let I=j("text",{x:v-6,y:R(S)+4,"text-anchor":"end"});I.textContent=n.format(S),k.append(I)}let L=(y-v)/Math.max(1,s.length),C=Math.max(1,Math.ceil(s.length/Math.floor((y-v)/56)));s.forEach((S,I)=>{if(I%C)return;let $=j("text",{x:v+L*(I+.5),y:g+16,"text-anchor":"middle"}),A=Math.max(3,Math.min(12,Math.floor(L*C/10)));$.textContent=S.length>A?`${S.slice(0,A-1)}\u2026`:S,k.append($)}),o.append(k);let E=j("g",{},"fg-chart-plot"),M=e.type==="combo";if(M){let S=L*.6,I=r[0];s.forEach(($,A)=>{let F=I?.values[A];if(F==null||!Number.isFinite(F))return;let P=v+L*A+(L-S)/2,T=j("rect",{x:P,y:Math.min(R(0),R(F)),width:Math.max(1,S-2),height:Math.max(.5,Math.abs(R(F)-R(0))),fill:me(0),rx:2},"fg-chart-bar");He(T,`${I.name} \xB7 ${$}: ${t.format(F)}`),E.append(T)})}if(e.type==="bar"||f){let S=L*.72,I=f?S:S/Math.max(1,r.length);s.forEach(($,A)=>{let F=0,P=0;r.forEach((T,H)=>{let N=T.values[A];if(N==null||!Number.isFinite(N))return;let z=0,W=N;f&&(z=N>=0?F:P,W=z+N,N>=0?F=W:P=W);let G=v+L*A+(L-S)/2+(f?0:I*H),V=j("rect",{x:G,y:Math.min(R(z),R(W)),width:Math.max(1,I-2),height:Math.max(.5,Math.abs(R(W)-R(z))),fill:me(H),rx:2},"fg-chart-bar");He(V,`${T.name} \xB7 ${$}: ${t.format(N)}`),E.append(V)})})}else r.forEach((S,I)=>{if(M&&I===0)return;let $=S.values.map((P,T)=>P==null||!Number.isFinite(P)?null:[v+L*(T+.5),R(P),P]),A="",F=!1;for(let P of $){if(!P){F=!1;continue}A+=`${F?"L":"M"}${P[0]},${P[1]}`,F=!0}if(e.type==="area"){let P=$.filter(T=>!!T);if(P.length){let T=`M${P[0][0]},${R(0)}${P.map(H=>`L${H[0]},${H[1]}`).join("")}L${P[P.length-1][0]},${R(0)}Z`;E.append(j("path",{d:T,fill:me(I),"fill-opacity":.18},"fg-chart-area"))}}E.append(j("path",{d:A,fill:"none",stroke:me(I),"stroke-width":2.2,"stroke-linejoin":"round"},"fg-chart-line")),$.forEach((P,T)=>{if(!P)return;let H=j("circle",{cx:P[0],cy:P[1],r:3.5,fill:me(I)},"fg-chart-point");He(H,`${S.name} \xB7 ${s[T]}: ${t.format(P[2])}`),E.append(H)})});o.append(E,l),i.replaceChildren(o)}function li(i,e,t,n,o,r,s){let a=t[0]?.values??[],l=t.slice(1),d=R=>R!=null&&Number.isFinite(R),c=a.filter(d),u=l.flatMap(R=>R.values.filter(d));if(!c.length||!u.length)return;let g=en(Math.min(...c),Math.max(...c)),f=en(Math.min(...u),Math.max(...u)),b=56,w=624,m=R=>b+(R-g[0])/(g[g.length-1]-g[0])*(w-b),h=R=>o-(R-f[0])/(f[f.length-1]-f[0])*(o-n),p=j("g",{},"fg-chart-axis");for(let R of f){p.append(j("line",{x1:b,x2:w,y1:h(R),y2:h(R)},R===0?"fg-chart-zero":"fg-chart-grid"));let k=j("text",{x:b-6,y:h(R)+4,"text-anchor":"end"});k.textContent=s.format(R),p.append(k)}g.forEach((R,k)=>{let L=k===0?"start":k===g.length-1?"end":"middle",C=j("text",{x:m(R),y:o+16,"text-anchor":L});C.textContent=s.format(R),p.append(C)});let v=j("text",{x:w,y:o+32,"text-anchor":"end"},"fg-chart-axis-name");v.textContent=`${t[0]?.name??""} \u2192`,p.append(v),i.append(p);let y=j("g",{},"fg-chart-plot");a.forEach((R,k)=>{d(R)&&l.forEach((L,C)=>{let E=L.values[k];if(!d(E))return;let M=j("circle",{cx:m(R),cy:h(E),r:4,fill:me(C),"fill-opacity":.8},"fg-chart-point");He(M,`${e.categories[k]??""}: ${t[0].name} ${r.format(R)}, ${L.name} ${r.format(E)}`),y.append(M)})}),i.append(y)}var di=12,mo=500,nn=["bar","stackedBar","line","area","combo","pie","donut","scatter"],bt=class{constructor(e){this.grid=e;this.handles=new Set}create(e={}){let{grid:t}=this,n=nn.includes(e.type)?e.type:"bar",o=()=>t.store.state.locale,r=e.range??t.store.state.range,s=null;if(r){let w=t.columns.getColumn(r.start.colId),m=t.columns.getColumn(r.end.colId);if(w&&m){let h=Fe({start:{rowIndex:r.start.rowIndex,colIndex:w.index},end:{rowIndex:r.end.rowIndex,colIndex:m.index}}),p=[];for(let v=h.r1;v<=h.r2&&p.length<mo;v++){let y=t.rowModel.getRow(v);y&&!y.kind&&p.push(y.data)}s={rows:p,colIds:t.columns.displayed().slice(h.c1,h.c2+1).filter(v=>!D(v.id)).map(v=>v.id)}}}let a=()=>{let w=s?s.rows:t.rowModel.dataRows().slice(0,mo).map(k=>k.data),m=(s?s.colIds.map(k=>t.columns.getColumn(k)):t.columns.displayed().filter(k=>!D(k.id))).filter(k=>!!k),h=m[0]&&m[0].def.type!=="number"?m[0]:s?null:m.find(k=>k.def.type!=="number")??null,p=k=>!!k.node.parent&&k.node.parent.id==="pivotgroup|total",v=m.filter(k=>k!==h&&k.def.type==="number"&&(s||!p(k))).slice(0,di),y=k=>{let L=[];for(let C=k.node.parent;C;C=C.parent)L.unshift(C.def.header??C.id);return L.push(k.def.header??k.def.field??k.id),L.join(" \xB7 ")},R=h?K(h.def,o().code):null;return{categories:w.map((k,L)=>h&&R?R(B(h.def,k)):String(L+1)),series:v.map(k=>({name:y(k),values:w.map(L=>{let C=B(k.def,L),E=typeof C=="number"?C:C==null||C===""?NaN:Number(C);return Number.isFinite(E)?E:null})}))}},l=x("div","fg-chart-body"),d=null,c=()=>tn(l,{type:n,title:e.title,locale:o().code,...a()}),u=w=>({bar:o().chartBar,stackedBar:o().chartStacked,line:o().chartLine,area:o().chartArea,pie:o().chartPie,donut:o().chartDonut,combo:o().chartCombo,scatter:o().chartScatter})[w],g=()=>d?.querySelectorAll(".fg-chart-type").forEach(w=>w.setAttribute("aria-pressed",String(w.dataset.type===n)));if(e.container)e.container.append(l);else{d=x("div","fg-chart-panel",{role:"dialog","aria-label":e.title??u(n)});let w=x("div","fg-chart-head");for(let h of nn){let p=x("button","fg-chart-type",{type:"button",title:u(h)});p.dataset.type=h,p.textContent=u(h),p.addEventListener("click",()=>b.setType(h)),w.append(p)}let m=x("button","fg-chooser-close",{type:"button","aria-label":o().close});m.textContent="\xD7",m.addEventListener("click",()=>b.destroy()),w.append(x("span","fg-chart-spacer"),m),d.append(w,l),t.renderer.root.append(d)}let f=[t.events.on("cellValueChanged",()=>c()),t.events.on("rowsAdded",()=>c()),t.events.on("rowsRemoved",()=>c())];s||f.push(t.events.on("sortChange",()=>c()),t.events.on("filterChange",()=>c()));let b={el:l,setType:w=>{nn.includes(w)&&(n=w,g(),c())},update:()=>c(),destroy:()=>{f.forEach(w=>w()),(d??l).remove(),this.handles.delete(b)}};return this.handles.add(b),g(),c(),b}destroy(){for(let e of[...this.handles])e.destroy()}};var wo=new WeakMap,ci=i=>typeof i=="function"?"custom":i;function on(i,e){return{rows:(i.rows??[]).filter(e),columns:(i.columns??[]).filter(e),values:(i.values??[]).filter(t=>t&&e(t.colId)).map(t=>({colId:t.colId,aggFunc:t.aggFunc??"sum"})),totals:i.totals!==!1}}function vo(i,e,t,n,o){let r=on(e,v=>!!t(v)),s=new Intl.Collator(o,{numeric:!0,sensitivity:"base"}),a=v=>t(v),l=(v,y)=>v.map(R=>Z(B(a(R),y))).join(""),d=new Map;for(let v of i){let y=l(r.columns,v);d.has(y)||d.set(y,r.columns.map(R=>B(a(R),v)))}let c=[...d.entries()].sort((v,y)=>{for(let R=0;R<r.columns.length;R++){let k=de(v[1][R],y[1][R],s);if(k)return k}return 0});r.columns.length||c.splice(0,c.length,["",[]]);let u=[],g=(v,y,R)=>{let k=r.values[y],L=a(k.colId),C=`pivot|${R}|${y}`;u.push({id:C,comboKey:v,valueIndex:y});let E=S=>v===null||l(r.columns,S)===v,M=k.aggFunc;return{id:C,field:C,header:`${L.header??L.field??k.colId} (${n.agg(ci(M))})`,type:"number",format:M==="count"?"integer":L.format,width:130,aggFunc:(S,I)=>{let $=I.flatMap(A=>wo.get(A)??[]).filter(E);return $.length?pe(M,$.map(A=>B(L,A)),$):null}}},f=[],b=(v,y)=>{if(q(y))return n.blank;let R=a(v);return R.type==="number"&&!R.format?String(y):K(R,o)(y)};if(!r.columns.length)r.values.forEach((v,y)=>f.push(g("",y,0)));else{let v=(y,R,k)=>{let L=[],C=0;for(;C<y.length;){let E=y[C][1][R],M=Z(E),S=C;for(;S<y.length&&Z(y[S][1][R])===M;)S++;let I=y.slice(C,S),$=R===r.columns.length-1?r.values.map((A,F)=>g(I[0][0],F,k+C)):v(I,R+1,k+C);L.push({id:`pivotgroup|${R}|${k+C}`,header:b(r.columns[R],E),children:$}),C=S}return L};f.push(...v(c,0,0)),r.totals&&r.values.length&&f.push({id:"pivotgroup|total",header:n.total,children:r.values.map((y,R)=>g(null,R,"total"))})}let w=new Map;for(let v of i){let y=l(r.rows,v),R=w.get(y);R||w.set(y,R={values:r.rows.map(k=>B(a(k),v)),src:[]}),R.src.push(v)}let h=[...w.values()].sort((v,y)=>{for(let R=0;R<r.rows.length;R++){let k=de(v.values[R],y.values[R],s);if(k)return k}return 0}).map(v=>{let y={};r.rows.forEach((k,L)=>{y[a(k).field??k]=v.values[L]});let R=new Map;if(r.columns.length)for(let k of v.src){let L=l(r.columns,k),C=R.get(L);C||R.set(L,C=[]),C.push(k)}for(let k of u){let L=r.values[k.valueIndex],C=k.comboKey===null||!r.columns.length?v.src:R.get(k.comboKey)??[],E=a(L.colId);y[k.id]=C.length?pe(L.aggFunc,C.map(M=>B(E,M)),C):null}return wo.set(y,v.src),y});return{columns:[...r.rows.map(v=>{let y=a(v);return{id:v,field:y.field??v,header:y.header??y.field??v,type:y.type,format:y.format,width:y.width??140}}),...f],rows:h,groupBy:r.rows.slice(0,-1)}}var xt="1.1.0";var ui={kty:"EC",crv:"P-256",x:"sUTKkglZmk-HMKPNub8p7AeLBKesHCU8irIkw9rJlbE",y:"j0U_aKRDR7iApY9UpaD3hUemhBLZJwDv9-QiT_hUyw8"},rn="https://freegrid.app/pricing/",yo="https://freegrid.app/api/usage",hi="https://freegrid.app/api/domain-status",bo=i=>{let e=atob(i.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-i.length%4)%4));return Uint8Array.from(e,t=>t.charCodeAt(0))};function an(i){let e=i.toLowerCase().replace(/^\[|\]$/g,"");return!e||e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="0.0.0.0"||e.endsWith(".localhost")||e.endsWith(".test")||e.endsWith(".local")||/^(10|192\.168|172\.(1[6-9]|2\d|3[01]))\./.test(e)}function fi(i,e){let t=i.toLowerCase().replace(/\.$/,"");return e.some(n=>{let o=n.toLowerCase().replace(/\.$/,""),r=o.startsWith("*."),s=r?o.slice(2):o;return s?t===s||t===`www.${s}`?!0:r&&t.endsWith(`.${s}`):!1})}var pi=i=>{let e=typeof i=="string"?/^(\d{4})-(\d{2})-(\d{2})$/.exec(i):null;if(!e)return!1;let t=new Date(Date.UTC(Number(e[1]),Number(e[2])-1,Number(e[3])));return t.getUTCMonth()===Number(e[2])-1&&t.getUTCDate()===Number(e[3])},gi=i=>`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`;async function ko(i,e,t={}){let n=typeof i=="string"?i.trim().split("."):[];if(n.length!==3||n[0]!=="FG1")return{ok:!1,reason:"format"};let o;try{if(o=JSON.parse(new TextDecoder().decode(bo(n[1]))),!Array.isArray(o.domains)||!pi(o.expires))return{ok:!1,reason:"format"}}catch{return{ok:!1,reason:"format"}}let r=typeof crypto<"u"?crypto.subtle:void 0;if(!r)return{ok:!1,reason:"unsupported",info:o};try{let s=await r.importKey("jwk",t.publicKey??ui,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]),a=new TextEncoder().encode(`${n[0]}.${n[1]}`);if(!await r.verify({name:"ECDSA",hash:"SHA-256"},s,bo(n[2]),a))return{ok:!1,reason:"signature",info:o}}catch{return{ok:!1,reason:"signature",info:o}}return gi(t.now??new Date)>o.expires?{ok:!1,reason:"expired",info:o}:fi(e,o.domains)?{ok:!0,info:o}:{ok:!1,reason:"domain",info:o}}var sn,xo=new Map,Be=null;function mi(i){sn=i}var Co={missing:`FreeGrid is free for personal use. Company use needs a domain license (\u20A9200,000 per domain per year): ${rn}
29
- FreeGrid\uB294 \uAC1C\uC778\uC5D0\uAC8C \uBB34\uB8CC\uC785\uB2C8\uB2E4. \uD68C\uC0AC\uC5D0\uC11C \uC4F0\uB824\uBA74 \uB3C4\uBA54\uC778 \uB77C\uC774\uC120\uC2A4(\uB3C4\uBA54\uC778\uB2F9 \uC5F0 20\uB9CC \uC6D0)\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4: ${rn}`,format:"FreeGrid: the license key is not in the right format. / \uB77C\uC774\uC120\uC2A4 \uD0A4 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",signature:"FreeGrid: the license key could not be verified. / \uB77C\uC774\uC120\uC2A4 \uD0A4\uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",expired:"FreeGrid: the license key has expired. / \uB77C\uC774\uC120\uC2A4 \uAE30\uAC04\uC774 \uB05D\uB0AC\uC2B5\uB2C8\uB2E4.",domain:"FreeGrid: the license key is for a different domain. / \uB2E4\uB978 \uB3C4\uBA54\uC778\uC6A9 \uB77C\uC774\uC120\uC2A4 \uD0A4\uC785\uB2C8\uB2E4."};function Ro(i,e=typeof location<"u"?location.hostname:""){try{if(an(e)||typeof navigator>"u")return;let t=new Date().toISOString().slice(0,10),n=`${e}|${t}|${i.licensed?1:0}`,o=typeof localStorage<"u"?localStorage:null;if(o?.getItem("freegrid:usage")===n)return;o?.setItem("freegrid:usage",n);let r=JSON.stringify({version:i.version,licensed:i.licensed,company:i.company,url:`${location.origin}${location.pathname}`});typeof navigator.sendBeacon=="function"?navigator.sendBeacon(yo,r):typeof fetch=="function"&&fetch(yo,{method:"POST",body:r,mode:"no-cors",keepalive:!0}).catch(()=>{})}catch{}}function wi(i=sn,e=typeof location<"u"?location.hostname:""){if(an(e))return Promise.resolve(!0);let t=i??sn,n=`${t??""}@${e}`,o=xo.get(n);return o||(t?o=ko(t,e).then(r=>{if(Ro({version:xt,licensed:r.ok,company:r.ok?r.info.company:void 0},e),r.ok||r.reason==="unsupported")return r.ok||r.reason==="unsupported";let s=r.info?` (${r.info.domains.join(", ")}, ${r.info.expires})`:"";return console.warn(`${Co[r.reason]}${s}
30
- ${rn}`),!1},()=>!1):(console.info(Co.missing),Ro({version:xt,licensed:!1},e),o=Promise.resolve(!1)),xo.set(n,o),o)}function vi(i=typeof location<"u"?location.hostname:""){if(an(i)||typeof fetch!="function")return Promise.resolve(!1);if(Be)return Be;let e=new Date().toISOString().slice(0,10),t=null;try{t=typeof localStorage<"u"?localStorage:null;let n=JSON.parse(t?.getItem("freegrid:badge")??"null");if(n&&n.host===i&&n.day===e)return Be=Promise.resolve(n.show)}catch{}return Be=fetch(hi,{mode:"cors",credentials:"omit"}).then(n=>n.ok?n.json():{badge:!1}).then(n=>{let o=n.badge===!0;try{t?.setItem("freegrid:badge",JSON.stringify({host:i,day:e,show:o}))}catch{}return o},()=>!1),Be}async function So(i,e=typeof location<"u"?location.hostname:""){return await wi(i,e)?!1:vi(e)}var Ge={text:["contains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["eq","ne","lt","lte","gt","gte","between","blank","notBlank"],date:["equals","before","after","between","blank","notBlank"]},Mo=["blank","notBlank"],ln=500,Ct=class{constructor(e){this.grid=e;this.popup=null;this.colId=null;this.off=[]}get openColumn(){return this.colId}toggle(e,t){this.colId===e?this.close():this.open(e,t)}open(e,t){this.close();let n=this.grid.columns.getNode(e);if(!n||n.children||D(e))return;let o=this.grid.store.state.locale,r=n.def,s=x("div",`fg-menu fg-theme-${this.grid.store.state.theme}`,{role:"dialog","aria-label":o.columnMenu});this.grid.applyFontTo(s),ye(r)&&s.append(this.section([[o.sortAsc,()=>this.grid.setSort([{colId:e,dir:"asc"}])],[o.sortDesc,()=>this.grid.setSort([{colId:e,dir:"desc"}])],[o.clearSort,()=>this.grid.setSort(this.grid.store.state.sort.filter(w=>w.colId!==e))]])),s.append(this.section([[o.pinLeft,()=>this.grid.setPinned(e,"left")],[o.pinRight,()=>this.grid.setPinned(e,"right")],[o.unpin,()=>this.grid.setPinned(e,null)]]));let a=this.grid.getGroupBy();if(!this.grid.options.treeData&&(this.grid.options.groupPanel||a.length)){let w=a.includes(e)?[[o.ungroup,()=>this.grid.setGroupBy(a.filter(m=>m!==e))]]:[[o.groupByThis,()=>this.grid.setGroupBy([...a,e])]];a.length&&w.push([o.expandAll,()=>this.grid.expandAll(!0)],[o.collapseAll,()=>this.grid.expandAll(!1)]),s.append(this.section(w))}let l=[[o.autosizeThis,()=>this.grid.autoSize([e])],[o.autosizeAll,()=>this.grid.autoSize()]];r.lockVisible||l.push([o.hideColumn,()=>this.grid.setColumnsVisible([e],!1)]),l.push([o.chooseColumns,()=>this.grid.chooser.open()],[o.resetColumns,()=>this.grid.resetColumns()]),s.append(this.section(l));let d=this.filterSection(e,()=>this.close());d&&s.append(d),ne(this.grid.renderer.root).append(s);let c=t.getBoundingClientRect(),u=s.offsetWidth||248;s.style.left=`${Math.max(4,Math.min(c.right-u,window.innerWidth-u-4))}px`;let g=Math.max(4,Math.min(c.bottom+4,window.innerHeight-240));s.style.top=`${g}px`,s.style.maxHeight=`${Math.max(160,window.innerHeight-g-8)}px`,this.popup=s,this.colId=e;let f=w=>{ge(w,s,t)||this.close()},b=w=>{w.key==="Escape"&&(this.close(),this.grid.renderer.gridEl.focus())};document.addEventListener("pointerdown",f,!0),document.addEventListener("keydown",b,!0),this.off.push(()=>document.removeEventListener("pointerdown",f,!0),()=>document.removeEventListener("keydown",b,!0)),s.querySelector(".fg-filter-value:not([hidden]), .fg-set-search, .fg-menu-item")?.focus()}filterSection(e,t){let n=this.grid.columns.getNode(e);if(!n||n.children)return null;let o=this.grid.store.state.locale,r=oe(n.def);return r==="set"?this.setFilter(e,o,t):r?this.conditionFilter(e,r,o,t):null}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null,this.colId=null}section(e){let t=x("div","fg-menu-section");for(let[n,o]of e){let r=x("button","fg-menu-item",{type:"button"});r.textContent=n,r.addEventListener("click",()=>{o(),this.close()}),t.append(r)}return t}actions(e,t,n,o){let r=x("div","fg-menu-actions"),s=x("button","fg-btn",{type:"button"});s.textContent=t.reset,s.addEventListener("click",()=>{this.grid.setFilter(e,null),o()});let a=x("button","fg-btn fg-btn-primary",{type:"button"});return a.textContent=t.apply,a.addEventListener("click",n),r.append(s,a),r}title(e){let t=x("div","fg-menu-title");return t.textContent=e.filter,t}conditionRow(e,t,n,o,r){let s=x("div","fg-filter-cond"),a=x("select","fg-filter-op",{"aria-label":t.filter});if(o){let f=x("option");f.value="",f.textContent="\u2014",a.append(f)}for(let f of Ge[e]){let b=x("option");b.value=f,b.textContent=t.ops[f],a.append(b)}a.value=n?.op??(o?"":Ge[e][0]);let l=e==="text"?"text":e,d=x("input","fg-input fg-filter-value",{type:l,placeholder:t.value,"aria-label":t.value}),c=x("input","fg-input fg-filter-value-to",{type:l,placeholder:t.valueTo,"aria-label":t.valueTo});n&&(d.value=n.value!=null?String(n.value):"",c.value="valueTo"in n&&n.valueTo!=null?String(n.valueTo):"");let u=()=>{d.hidden=!a.value||Mo.includes(a.value),c.hidden=a.value!=="between"};a.addEventListener("change",u),u();for(let f of[d,c])f.addEventListener("keydown",b=>b.key==="Enter"&&r());return s.append(a,d,c),{row:s,read:()=>{let f=a.value;if(!f)return null;let b=!Mo.includes(f);if(e==="number"){let w=d.value===""?void 0:Number(d.value),m=c.value===""?void 0:Number(c.value);return!b||w!==void 0?{type:e,op:f,value:w,valueTo:m}:null}return e==="date"?!b||d.value?{type:e,op:f,value:d.value||void 0,valueTo:c.value||void 0}:null:!b||d.value?{type:e,op:f,value:d.value}:null}}}conditionFilter(e,t,n,o){let r=this.grid.store.state.filters[e],s=r?.type==="combined"?r.conditions:r?[r]:[],a=s[0]?.type===t?s[0]:void 0,l=s[1]?.type===t?s[1]:void 0,d=x("div","fg-menu-section fg-filter"),c=()=>{let w=u.read(),m=g.read(),h=f.querySelector("input:checked")?.value==="or"?"or":"and",p=w&&m?{type:"combined",operator:h,conditions:[w,m]}:w??m;this.grid.setFilter(e,p),o()},u=this.conditionRow(t,n,a,!1,c),g=this.conditionRow(t,n,l,!0,c),f=x("div","fg-filter-join",{role:"radiogroup"}),b=`fg-join-${e}-${Math.random().toString(36).slice(2,7)}`;for(let w of["and","or"]){let m=x("label"),h=x("input","",{type:"radio",name:b,value:w});h.checked=(r?.type==="combined"?r.operator:"and")===w,m.append(h,` ${n[w]}`),f.append(m)}return d.append(this.title(n),u.row,f,g.row,this.actions(e,n,c,o)),d}setFilter(e,t,n){let{grid:o}=this,r=o.columns.getNode(e).def,s=K(r,t.code),a=o.collator(),l=new Map;for(let k of o.rowModel.allNodes()){let L=B(r,k.data),C=Z(L);l.has(C)||l.set(C,L)}let d=[...l.entries()].sort((k,L)=>de(k[1],L[1],a)),c=o.store.state.filters[e],u=new Set(c?.type==="set"?c.values.map(Z).filter(k=>l.has(k)):l.keys()),g=(k,L)=>k===""?t.blanks:s(L),f=x("div","fg-menu-section fg-filter fg-set-filter"),b=x("input","fg-input fg-set-search",{type:"search",placeholder:t.search,"aria-label":t.search}),w=x("label","fg-set-item fg-set-all"),m=x("input","fg-checkbox",{type:"checkbox"});w.append(m,document.createTextNode(t.selectAll));let h=x("div","fg-set-list"),p=()=>{let k=b.value.trim().toLowerCase();return k?d.filter(([L,C])=>g(L,C).toLowerCase().includes(k)):d},v=()=>{let k=p(),L=k.filter(([C])=>u.has(C)).length;m.checked=L>0&&L===k.length,m.indeterminate=L>0&&L<k.length},y=()=>{let k=p();if(h.replaceChildren(...k.slice(0,ln).map(([L,C])=>{let E=x("label","fg-set-item"),M=x("input","fg-checkbox",{type:"checkbox"});return M.checked=u.has(L),M.addEventListener("change",()=>{M.checked?u.add(L):u.delete(L),v()}),E.append(M,document.createTextNode(g(L,C))),E})),k.length>ln){let L=x("div","fg-set-more");L.textContent=`\u2026 +${k.length-ln}`,h.append(L)}v()};m.addEventListener("change",()=>{for(let[k]of p())m.checked?u.add(k):u.delete(k);y()}),b.addEventListener("input",y);let R=()=>{o.setFilter(e,u.size===l.size?null:{type:"set",values:d.filter(([k])=>u.has(k)).map(([,k])=>k)}),n()};return b.addEventListener("keydown",k=>k.key==="Enter"&&R()),y(),f.append(this.title(t),b,w,h,this.actions(e,t,R,n)),f}};var Eo=new WeakMap,yi=0;function xe(i){let e=Eo.get(i);return e||Eo.set(i,e=`r${++yi}`),e}var Rt=class{constructor(e){this.deps=e;this.stats={filterRuns:0,sortRuns:0};this.server=!1;this.full=[];this.last={};this.nodes=[];this.filtered=[];this.sorted=[];this.display=[];this.indexById=null;this.layoutCache=null}update(e){let t=this.deps.collator(),n=e.display,o=!!n?.getParentId!=!!this.last.display?.getParentId,r=e.data!==this.last.data,s=r||o||e.filters!==this.last.filters||e.quickFilter!==this.last.quickFilter||e.advancedFilter!==this.last.advancedFilter,a=s||e.sort!==this.last.sort||t!==this.last.collator,l=a||n?.version!==this.last.displayVersion||n?.groupBy!==this.last.display?.groupBy;if(r){let u=this.deps.getRowId;this.nodes=e.data.map((g,f)=>({id:u?String(u(g)):xe(g),data:g,sourceIndex:f}))}s&&(this.filtered=this.filter(e),this.stats.filterRuns++),a&&(this.sorted=oo(this.filtered,e.sort,u=>this.deps.columnDef(u),t),this.stats.sortRuns++),l&&(this.full=n?this.buildDisplay(n,e.sort,t):this.sorted);let d=e.page??null,c=this.last.page??null;(l||d?.index!==c?.index||d?.size!==c?.size)&&(this.display=d?this.full.slice(d.index*d.size,(d.index+1)*d.size):this.full,this.indexById=null,this.layoutCache=null),this.last={...e,collator:t,displayVersion:n?.version}}invalidate(){this.last={}}fullCount(){return this.full.length}dataCount(){return this.sorted.length}loading(){return!1}getRowCount(){return this.display.length}getRow(e){return this.display[e]}rows(){return this.display}dataRows(){return this.sorted}allNodes(){return this.nodes}idOf(e){return this.deps.getRowId?String(this.deps.getRowId(e)):xe(e)}indexOfId(e){return this.indexById||(this.indexById=new Map(this.display.map((t,n)=>[t.id,n]))),this.indexById.get(e)??-1}layout(e,t,n,o=0,r){let s=this.layoutCache;if(s&&s.rows===this.display&&s.rh===e&&s.dh===t&&s.hv===o)return s;let a=this.display.length,l=new Float64Array(a+1),d=!0,c=n&&n.size?n:null;for(let u=0;u<a;u++){let g=this.display[u],f=e;if(g.kind==="detail")f=t;else if(!g.kind){c&&(f=c.get(g.id)??e);let b=r?.(g.data);typeof b=="number"&&b>0&&(f=c?Math.max(f,b):b)}f!==e&&(d=!1),l[u+1]=l[u]+f}return this.layoutCache={rows:this.display,rh:e,dh:t,hv:o,offsets:l,uniform:d},this.layoutCache}filter(e){let t=Object.entries(e.filters).map(([c,u])=>({def:this.deps.columnDef(c),pred:Xe(u)})).filter(c=>!!c.def),n=Hn(e.quickFilter),o=n.length?this.deps.quickColumns():[],r=e.advancedFilter?$t(e.advancedFilter,c=>this.deps.columnDef(c),B):null;if(!t.length&&!n.length&&!r)return this.nodes;let s=this.nodes.filter(c=>{for(let u of t)if(!u.pred(B(u.def,c.data)))return!1;if(r&&!r(c.data))return!1;if(n.length){let u=o.map(g=>this.deps.format(g,B(g,c.data))).join("").toLowerCase();if(!Bn(n,u))return!1}return!0}),a=e.display?.getParentId;if(!a)return s;let l=new Map(this.nodes.map(c=>[c.id,c])),d=new Set(s);for(let c of s){let u=a(c.data),g=new Set;for(;u!=null&&!g.has(u);){g.add(u);let f=l.get(String(u));if(!f)break;d.add(f),u=a(f.data)}}return this.nodes.filter(c=>d.has(c))}isOpen(e,t,n){let o=e.expanded.get(t);return o!==void 0?o:e.defaultExpanded===-1||n<e.defaultExpanded}withDetails(e,t,n){for(let o of t)n.push(o),e.detailOpen.has(o.id)&&(!e.isMaster||e.isMaster(o.data))&&n.push({id:`detail:${o.id}`,data:{},sourceIndex:-1,kind:"detail",detailOf:o})}buildDisplay(e,t,n){let o=[];if(e.getParentId)return this.buildTree(e,o),o;let r=e.groupBy.filter(a=>this.deps.columnDef(a));if(!r.length)return e.detailOpen.size?(this.withDetails(e,this.sorted,o),o):this.sorted;let s=(a,l,d)=>{let c=r[l],u=this.deps.columnDef(c),g=new Map;for(let w of a){let m=B(u,w.data),h=q(m)?"":Z(m),p=g.get(h);p||g.set(h,p={value:m,nodes:[]}),p.nodes.push(w)}let f=t.find(w=>w.colId===c)?.dir==="desc"?-1:1,b=[...g.entries()].sort((w,m)=>de(w[1].value,m[1].value,n)*f);for(let[w,m]of b){let h=`${d}${c}:${w}`,p=this.isOpen(e,h,l);o.push({id:`group:${h}`,data:{},sourceIndex:-1,kind:"group",level:l,group:{key:h,colId:c,value:m.value,rows:m.nodes.map(v=>v.data),expanded:p}}),p&&(l+1<r.length?s(m.nodes,l+1,`${h}|`):this.withDetails(e,m.nodes.map(v=>({...v,level:l+1})),o))}};return s(this.sorted,0,""),o}buildTree(e,t){let n=new Set(this.sorted.map(a=>a.id)),o=new Map,r=[];for(let a of this.sorted){let l=e.getParentId(a.data),d=l==null?null:String(l);if(d!==null&&n.has(d)&&d!==a.id){let c=o.get(d);c||o.set(d,c=[]),c.push(a)}else r.push(a)}let s=(a,l,d)=>{for(let c of a){if(d.has(c.id))continue;let u=o.get(c.id)??[],g=!u.length&&!!e.lazyChildren?.(c.id,c.data),f=u.length>0&&this.isOpen(e,c.id,l),b={...c,level:l,hasChildren:u.length>0||g,expanded:f};g&&e.loading?.has(c.id)&&(b.loading=!0),this.withDetails(e,[b],t),f&&s(u,l+1,new Set([...d,c.id]))}};s(r,0,new Set)}};var bi=1e4,dn=1e5,xi=4,cn=3e3,kt=class{constructor(e,t,n,o,r,s){this.datasource=e;this.getRowId=t;this.groupBy=n;this.query=o;this.onChange=r;this.onFailed=s;this.levels=new Map;this.gen=0;this.display=null;this.ids=null;this.queue=[];this.inFlight=0;this.retryAt=0;this.version=0;this.builtFor=-1}matches(e,t){return e.join("")===this.groupBy.join("")&&t.sort===this.query.sort&&t.filters===this.query.filters&&t.quickFilter===this.query.quickFilter&&t.advancedFilter===this.query.advancedFilter}purge(){this.gen++,this.queue=[],this.levels.clear(),this.touch()}dispose(){this.gen++,this.queue=[]}touch(){this.version++,this.display=null,this.ids=null}load(e,t,n){this.levels.has(e)||(this.levels.set(e,{state:"loading",nodes:[]}),this.fetch({path:e,keys:t,level:n,start:0,gen:this.gen}))}fetch(e){this.queue.push(e),this.pump()}pump(){for(;this.inFlight<xi&&this.queue.length;){let e=this.queue.shift();e.gen===this.gen&&(this.inFlight++,this.request(e).finally(()=>{this.inFlight--,this.pump()}))}}request({path:e,keys:t,level:n,start:o,gen:r}){let s=n>=this.groupBy.length,a=this.query,l=o+bi,d;try{d=Promise.resolve(this.datasource.getRows({start:o,end:l,sort:[...a.sort],filters:{...a.filters},quickFilter:a.quickFilter,advancedFilter:a.advancedFilter,groupBy:[...this.groupBy],groupKeys:[...t]}))}catch(c){d=Promise.reject(c)}return d.then(c=>{if(r!==this.gen)return;let u=Array.isArray(c?.rows)?c.rows.filter(m=>m!==null&&typeof m=="object"):[];Array.isArray(c?.rows)||O("datasource.getRows must resolve to { rows: Row[] }");let g=s?u.map((m,h)=>({id:this.getRowId?String(this.getRowId(m)):xe(m),data:m,sourceIndex:o+h,level:n})):u.map(m=>{let h=this.groupBy[n],p=m[h],v=`${e?`${e}|`:""}${h}:${Z(p)}`,y=typeof m.count=="number"?m.count:typeof m.childCount=="number"?m.childCount:void 0;return{id:`group:${v}`,data:{},sourceIndex:-1,kind:"group",level:n,group:{key:v,colId:h,value:p,rows:[],expanded:!1,count:y,aggregates:m,keys:[...t,p]}}}),f=o?[...this.levels.get(e)?.nodes??[],...g]:g,b=typeof c?.total=="number"&&c.total>=0?c.total:null,w=u.length>0&&(b!==null?f.length<b:u.length>=l-o);w&&f.length<dn?(this.levels.set(e,{state:"loading",nodes:f}),this.fetch({path:e,keys:t,level:n,start:f.length,gen:r})):(w&&O(`a server group level has more than ${dn} rows; only the first ${dn} are shown`),this.levels.set(e,{state:"loaded",nodes:f})),this.touch(),this.onChange()},c=>{r===this.gen&&(this.levels.set(e,{state:"failed",nodes:[],retryAt:Date.now()+cn}),this.touch(),this.onFailed(o,l,c))})}isOpen(e,t,n){let o=e.expanded.get(t);return o!==void 0?o:e.defaultExpanded===-1||n<e.defaultExpanded}rows(e,t){let n=Date.now();if(this.display&&this.builtFor===t&&!(this.retryAt&&n>=this.retryAt))return this.display;let o=[],r=0,s=(a,l,d)=>{let c=this.levels.get(a);if(c?.state==="failed"&&n>=(c.retryAt??0)&&(this.levels.delete(a),c=void 0),!c){this.load(a,l,d),o.push({id:`loading:${a}`,data:{},sourceIndex:-1,kind:"loading",level:d});return}if(c.state==="failed"){let u=c.retryAt??0;r=r?Math.min(r,u):u;return}for(let u of c.nodes){if(u.kind!=="group"){o.push(u);continue}let g=u.group,f=this.isOpen(e,g.key,d),b={...u,group:{...g,expanded:f}};o.push(b),f&&s(g.key,g.keys??[],d+1)}c.state==="loading"&&o.push({id:`loading:${a}`,data:{},sourceIndex:-1,kind:"loading",level:d})};return s("",[],0),this.retryAt=r,this.display=o,this.builtFor=t,this.ids=null,o}dataRows(){let e=[];for(let t of this.levels.values())for(let n of t.nodes)n.kind||e.push(n);return e}dataCount(){let e=this.levels.get("");return e?.state==="loaded"&&e.nodes.every(t=>typeof t.group?.count=="number")?e.nodes.reduce((t,n)=>t+(n.group?.count??0),0):this.dataRows().length}loading(){for(let e of this.levels.values())if(e.state==="loading")return!0;return!1}indexOf(e){return this.display?(this.ids||(this.ids=new Map,this.display.forEach((t,n)=>this.ids.set(t.id,n))),this.ids.get(e)??-1):-1}};var Ci=new Float64Array(0),ze=class{constructor(e){this.deps=e;this.stats={filterRuns:0,sortRuns:0};this.server=!0;this.blocks=new Map;this.total=null;this.loadedEnd=0;this.gen=0;this.query=null;this.page=null;this.lastBlock=0;this.version=0;this.cache=null;this.groups=null;this.displayIn=null}get bs(){return this.page?this.page.size:this.deps.blockSize}get base(){return this.page?this.page.index*this.page.size:0}update(e){let t=e.display?.groupBy??[];if(t.length&&!e.display?.getParentId){let a={sort:e.sort,filters:e.filters,quickFilter:e.quickFilter,advancedFilter:e.advancedFilter??null};(!this.groups||!this.groups.matches(t,a))&&(this.groups?.dispose(),this.groups=new kt(this.deps.datasource,this.deps.getRowId,[...t],a,()=>this.deps.onLoaded(0,0,null),(l,d,c)=>this.deps.onFailed(l,d,c)),this.touch()),this.displayIn=e.display??null,this.query=null;return}this.groups&&(this.groups.dispose(),this.groups=null,this.query=null,this.touch());let n=this.query,o=!n||n.sort!==e.sort||n.filters!==e.filters||n.quickFilter!==e.quickFilter||n.advancedFilter!==(e.advancedFilter??null),r=e.page??null,s=(r?.size??0)!==(this.page?.size??0);this.query={sort:e.sort,filters:e.filters,quickFilter:e.quickFilter,advancedFilter:e.advancedFilter??null},this.page=r?{...r}:null,(o||s)&&this.purge(),this.ensure(Math.floor(this.base/this.bs))}invalidate(){}purge(){if(this.groups){this.groups.purge();return}this.gen++,this.blocks.clear(),this.total=null,this.loadedEnd=0,this.touch(),this.query&&this.ensure(Math.floor(this.base/this.bs))}touch(){this.version++,this.cache=null}fullCount(){if(this.total!==null)return this.total;if(!this.loadedEnd)return 0;let e=this.blocks.get(Math.floor((this.loadedEnd-1)/this.bs));return this.loadedEnd+(e&&e.nodes.length<this.bs?0:this.bs)}getRowCount(){if(this.groups)return this.groupRows().length;let e=this.fullCount();return this.page?Math.max(0,Math.min(this.page.size,e-this.base)):e}dataCount(){return this.groups?this.groups.dataCount():this.fullCount()}loading(){if(this.groups)return this.groups.loading();for(let e of this.blocks.values())if(e.state==="loading")return!0;return!1}placeholder(e){return{id:`loading:${e}`,data:{},sourceIndex:-1,kind:"loading"}}peek(e){let t=Math.floor(e/this.bs),n=this.blocks.get(t);return n?.state==="loaded"?n.nodes[e-t*this.bs]??null:null}groupRows(){return this.groups.rows(this.displayIn,this.displayIn.version*1e6+this.groups.version)}getRow(e){if(this.groups)return this.groupRows()[e];let t=this.base+e,n=this.peek(t);return n||(e>=0&&e<this.getRowCount()&&this.ensure(Math.floor(t/this.bs)),this.placeholder(t))}ensure(e){let t=this.blocks.get(e);if(t&&(t.state!=="failed"||Date.now()<(t.retryAt??0))||this.total!==null&&e*this.bs>=this.total&&e>0)return;let n=e*this.bs,o=n+this.bs,r=this.gen;this.lastBlock=e,this.blocks.set(e,{state:"loading",nodes:[]});let s=this.query,a=d=>{r===this.gen&&(this.blocks.set(e,{state:"failed",nodes:[],retryAt:Date.now()+cn}),this.deps.onFailed(n,o,d))},l;try{l=Promise.resolve(this.deps.datasource.getRows({start:n,end:o,sort:[...s.sort],filters:{...s.filters},quickFilter:s.quickFilter,advancedFilter:s.advancedFilter}))}catch(d){l=Promise.reject(d)}l.then(d=>{if(r!==this.gen)return;let c=Array.isArray(d?.rows)?d.rows.filter(f=>f!==null&&typeof f=="object"):null;if(!c){O("datasource.getRows must resolve to { rows: Row[], total?: number }"),a(new Error("invalid datasource response"));return}let u=this.deps.getRowId,g=c.slice(0,this.bs).map((f,b)=>({id:u?String(u(f)):xe(f),data:f,sourceIndex:n+b}));this.blocks.set(e,{state:"loaded",nodes:g}),typeof d.total=="number"&&d.total>=0?this.total=d.total:g.length<this.bs&&(this.total=n+g.length),this.loadedEnd=Math.max(this.loadedEnd,n+g.length),this.evict(),this.touch(),this.deps.onLoaded(n,n+g.length,this.total)},a)}evict(){let e=Math.max(2,this.deps.maxBlocks);if(this.blocks.size<=e)return;let t=[...this.blocks.keys()].sort((n,o)=>Math.abs(o-this.lastBlock)-Math.abs(n-this.lastBlock));for(let n of t){if(this.blocks.size<=e)break;this.blocks.get(n).state!=="loading"&&this.blocks.delete(n)}}built(){if(this.cache?.ver===this.version)return this.cache;let e=[];for(let n of[...this.blocks.keys()].sort((o,r)=>o-r)){let o=this.blocks.get(n);o.state==="loaded"&&e.push(...o.nodes)}let t=new Map;for(let n of e)t.set(n.id,n.sourceIndex);return this.cache={ver:this.version,data:e,rows:null,ids:t},this.cache}rows(){if(this.groups)return this.groupRows();let e=this.built();if(!e.rows){let t=this.getRowCount();e.rows=new Array(t);for(let n=0;n<t;n++)e.rows[n]=this.peek(this.base+n)??this.placeholder(this.base+n)}return e.rows}dataRows(){return this.groups?this.groups.dataRows():this.built().data}allNodes(){return this.groups?this.groups.dataRows():this.built().data}idOf(e){return this.deps.getRowId?String(this.deps.getRowId(e)):xe(e)}indexOfId(e){if(this.groups)return this.groupRows(),this.groups.indexOf(e);let t=this.built().ids.get(e);if(t===void 0)return-1;let n=t-this.base;return n>=0&&n<this.getRowCount()?n:-1}layout(){return{offsets:Ci,uniform:!0}}};function Lo(i){let e=i.idAt(i.index);if(i.mode==="single"){let t=new Set;return i.toggle&&i.selected.has(e)||t.add(e),{selected:t,anchorIndex:i.index}}if(i.range&&i.anchorIndex!=null){let t=i.toggle?new Set(i.selected):new Set,n=Math.min(i.anchorIndex,i.index),o=Math.max(i.anchorIndex,i.index);for(let r=n;r<=o;r++)t.add(i.idAt(r));return{selected:t,anchorIndex:i.anchorIndex}}if(i.toggle){let t=new Set(i.selected);return t.has(e)?t.delete(e):t.add(e),{selected:t,anchorIndex:i.index}}return{selected:new Set([e]),anchorIndex:i.index}}var St=class{constructor(e){this.bus=new Re;this.current=e}get state(){return this.current}set(e){let t=Object.keys(e).filter(n=>e[n]!==this.current[n]);t.length&&(this.current={...this.current,...e},this.bus.emit("change",t))}};var Ri=500;function To(i){let e=i.renderer.root,t=0,n=null,o=null,r=()=>{clearTimeout(t),n?.remove(),n=null,o=null},s=c=>{let u=c.dataset.col;if(!u||D(u))return null;let g=i.columns.getNode(u);if(!g)return null;if(c.classList.contains("fg-header-cell"))return g.def.headerTooltip??null;let f=c.closest(".fg-row[data-row]");if(!f||!c.closest(".fg-body"))return null;let b=Number(f.dataset.row),w=i.rowModel.getRow(b);if(!w||w.kind)return null;let m=g.def,h=B(m,w.data),p=K(m,i.store.state.locale.code)(h);if(typeof m.tooltip=="function")try{let v=m.tooltip({value:h,formatted:p,row:w.data,rowIndex:b,column:m});return v?String(v):null}catch{return O(`tooltip of column "${u}" threw`),null}return m.tooltip===!0?p||null:i.options.overflowTooltip!==!1&&m.tooltip!==!1&&c.scrollWidth>c.clientWidth+1&&c.textContent||null},a=(c,u)=>{n?.remove(),n=x("div",`fg-tooltip fg-theme-${i.store.state.theme}`,{role:"tooltip"}),n.textContent=u,i.applyFontTo(n),ne(e).append(n);let g=c.getBoundingClientRect(),f=n.offsetWidth,b=n.offsetHeight,w=window.innerWidth||1024,m=window.innerHeight||768,h=g.bottom+6+b>m?g.top-b-6:g.bottom+6;n.style.left=`${Math.max(4,Math.min(w-f-4,g.left))}px`,n.style.top=`${Math.max(4,h)}px`},l=c=>{let u=c.target.closest?.(".fg-cell, .fg-header-cell");!u||u===o||!e.contains(u)||(r(),o=u,t=window.setTimeout(()=>{if(o!==u||!u.isConnected)return;let g=s(u);g&&a(u,g)},Ri))},d=c=>{let u=c.relatedTarget;o&&u&&o.contains(u)||r()};return e.addEventListener("pointerover",l),e.addEventListener("pointerout",d),e.addEventListener("pointerdown",r),e.addEventListener("keydown",r),e.addEventListener("wheel",r,{passive:!0}),()=>{r(),e.removeEventListener("pointerover",l),e.removeEventListener("pointerout",d),e.removeEventListener("pointerdown",r),e.removeEventListener("keydown",r),e.removeEventListener("wheel",r)}}var Io=["blank","notBlank"],Mt=class{constructor(e){this.grid=e;this.popup=null;this.off=[]}get isOpen(){return!!this.popup}columns(){return this.grid.columns.getState().map(e=>this.grid.columns.getNode(e.colId)).filter(e=>e&&!e.children&&!D(e.id)&&oe(e.def)).map(e=>{let t=oe(e.def),n=t==="number"?"number":t==="date"?"date":"text";return{id:e.id,label:e.def.header??e.def.field??e.id,kind:n}})}open(){this.close();let{grid:e}=this,t=e.store.state.locale,n=this.columns(),o=x("div",`fg-menu fg-filter-builder fg-theme-${e.store.state.theme}`,{role:"dialog","aria-label":t.advancedFilter});e.applyFontTo(o);let r=x("div","fg-chooser-head"),s=x("span","fg-menu-title");s.textContent=t.advancedFilter;let a=x("button","fg-chooser-close",{type:"button","aria-label":t.close});a.textContent="\xD7",a.addEventListener("click",()=>this.close()),r.append(s,a);let l=e.store.state.advancedFilter,d=x("div","fg-filter-join",{role:"radiogroup"}),c=`fg-fb-join-${Math.random().toString(36).slice(2,7)}`;for(let M of["and","or"]){let S=x("label"),I=x("input","",{type:"radio",name:c,value:M});I.checked=(l?.operator??"and")===M,S.append(I,` ${t[M]}`),d.append(S)}let u=x("div","fg-fb-list"),g=[],f=M=>{g.splice(g.indexOf(M),1),M.el.remove()},b=M=>{let S=x("div","fg-fb-row"),I=x("select","fg-filter-op fg-fb-col",{"aria-label":t.columns});for(let G of n){let V=x("option");V.value=G.id,V.textContent=G.label,I.append(V)}let $=x("select","fg-filter-op fg-fb-op",{"aria-label":t.filter}),A=x("input","fg-input fg-fb-value",{type:"text",placeholder:t.value,"aria-label":t.value}),F=x("input","fg-input fg-fb-value-to",{type:"text",placeholder:t.valueTo,"aria-label":t.valueTo}),P=x("button","fg-chooser-close fg-fb-remove",{type:"button","aria-label":t.close});P.textContent="\xD7";let T=()=>n.find(G=>G.id===I.value)?.kind??"text",H=G=>{let V=T();$.replaceChildren(...Ge[V].map(Y=>{let J=x("option");return J.value=Y,J.textContent=t.ops[Y],J})),G&&Ge[V].includes(G)&&($.value=G);let U=V==="text"?"text":V;A.type=F.type=U,N()},N=()=>{A.hidden=Io.includes($.value),F.hidden=$.value!=="between"};I.addEventListener("change",()=>H($.value)),$.addEventListener("change",N),M&&n.some(G=>G.id===M.colId)&&(I.value=M.colId);let z=M?.model;H(z?.op),z?.value!=null&&(A.value=String(z.value)),z?.valueTo!=null&&(F.value=String(z.valueTo)),S.append(I,$,A,F,P);let W={el:S,read:()=>{let G=T(),V=$.value,U=!Io.includes(V),Y=null;if(G==="number"){let J=A.value===""?void 0:Number(A.value),re=F.value===""?void 0:Number(F.value);(!U||J!==void 0&&!Number.isNaN(J))&&(Y=V==="between"?{type:"number",op:V,value:J,valueTo:re}:{type:"number",op:V,value:J})}else G==="date"?(!U||A.value)&&(Y=V==="between"?{type:"date",op:V,value:A.value,valueTo:F.value}:{type:"date",op:V,value:A.value||void 0}):(!U||A.value)&&(Y={type:"text",op:V,value:A.value});return Y?{colId:I.value,model:Y}:null}};return P.addEventListener("click",()=>f(W)),W},w=(M,S)=>{let I=x("div","fg-fb-row fg-fb-group"),$=x("span","fg-fb-group-label");$.textContent=S;let A=x("button","fg-chooser-close fg-fb-remove",{type:"button","aria-label":t.close});A.textContent="\xD7",I.append($,A);let F={el:I,read:()=>M};return A.addEventListener("click",()=>f(F)),F},m=M=>{if("conditions"in M)return w(M,`( ${M.conditions.length} \xD7 ${t[M.operator]} )`);let S=n.find(A=>A.id===M.colId),I=M.model;if(S&&I&&(I.type==="text"||I.type==="number"||I.type==="date"))return b(M);let $=I?.type==="set"?I.values.map(String).join(", "):I?.type==="combined"?`( ${I.conditions.length} \xD7 ${t[I.operator]} )`:"";return w(M,`${S?.label??M.colId}: ${$}`)},h=M=>{g.push(M),u.append(M.el)};for(let M of l?.conditions??[])h(m(M));let p=x("button","fg-btn fg-fb-add",{type:"button"});p.textContent=`+ ${t.addCondition}`,p.addEventListener("click",()=>{let M=b();h(M),M.el.querySelector(".fg-fb-value").focus()});let v=x("div","fg-menu-actions"),y=x("button","fg-btn",{type:"button"});y.textContent=t.reset,y.addEventListener("click",()=>{e.setAdvancedFilter(null),this.close()});let R=x("button","fg-btn fg-btn-primary",{type:"button"});R.textContent=t.apply,R.addEventListener("click",()=>{let M=g.map(I=>I.read()).filter(I=>!!I),S=d.querySelector("input:checked")?.value==="or"?"or":"and";e.setAdvancedFilter(M.length?{operator:S,conditions:M}:null),this.close()}),v.append(y,R),o.append(r,d,u,p,v),ne(e.renderer.root).append(o);let k=e.renderer.root.getBoundingClientRect(),L=o.offsetWidth||460;o.style.left=`${Math.max(4,Math.min(k.left+24,(window.innerWidth||1024)-L-4))}px`,o.style.top=`${Math.max(4,k.top+24)}px`,this.popup=o,g.length||p.click();let C=M=>{ge(M,o)||this.close()},E=M=>{M.key==="Escape"&&this.close()};document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",E,!0),this.off.push(()=>document.removeEventListener("pointerdown",C,!0),()=>document.removeEventListener("keydown",E,!0))}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var Do=i=>Math.round(i*2.75),$o=i=>Math.round(i*3.1),un=13,hn={compact:[.8,.85],normal:[1,1],comfortable:[1.25,1.15]},ki=[],Si=100,Mi=new Map;function he(i){return i.every(e=>e!==null&&typeof e=="object")?i:(O("data contains entries that are not objects; they were skipped"),i.filter(e=>e!==null&&typeof e=="object"))}var fn=class{constructor(e,t){this.options=t;this.events=new Re;this.pinnedRows={top:[],bottom:[]};this.spanCache=null;this.editVersion=0;this.tracker=new gt;this.history=new pt;this.disposers=[];this.collatorCache=null;this.destroyed=!1;this.summaryOpts=null;this.summaryValues=[];this.groupBy=[];this.expanded=new Map;this.defaultExpanded=0;this.detailOpen=new Set;this.displayVersion=0;this.aggCache={ver:-1,map:new WeakMap};this.charts=new bt(this);this.sourceDefs=[];this.pivotCfg=null;this.pivotData=null;this.savedGroup=null;this.page=0;this.pageSize=Si;this.forcedOverlay=null;this.filterBuilder=new Mt(this);this.flashing=new Map;this.flashTimer=0;this.txQueue=[];this.txTimer=0;this.keepRange=!1;this.rowNumberCache=null;this.treeLoaded=new Set;this.treeLoading=new Set;this.lazyChildren=(e,t)=>{if(this.treeLoaded.has(e))return!1;try{return!!this.options.treeData?.hasChildren?.(t)}catch{return!1}};this.density="normal";this.selectionVersion=0;Array.isArray(t.columns)||O("options.columns must be an array"),t.data!=null&&!Array.isArray(t.data)&&O("options.data must be an array"),this.store=new St({data:Array.isArray(t.data)?he(t.data):[],sort:[],filters:{},quickFilter:"",selected:new Set,anchorId:null,focus:null,range:null,extraRanges:[],advancedFilter:null,locale:Ve(t.locale),theme:t.theme??"light"}),this.sourceDefs=Array.isArray(t.columns)?t.columns:[],this.columns=new We(this.withSelect(this.sourceDefs));let n=t.pagination;n&&typeof n=="object"&&n.pageSize!==void 0&&(Number.isInteger(n.pageSize)&&n.pageSize>0?this.pageSize=n.pageSize:O("pagination.pageSize must be a positive integer")),t.datasource&&typeof t.datasource.getRows!="function"&&O("datasource.getRows must be a function"),this.rowModel=t.datasource&&typeof t.datasource.getRows=="function"?new ze({datasource:t.datasource,blockSize:Number.isInteger(t.blockSize)&&t.blockSize>0?t.blockSize:100,maxBlocks:Number.isInteger(t.maxBlocks)&&t.maxBlocks>0?t.maxBlocks:100,getRowId:t.getRowId,onLoaded:(s,a,l)=>this.serverLoaded(s,a,l),onFailed:(s,a,l)=>this.serverFailed(s,a,l)}):new Rt({getRowId:t.getRowId,columnDef:s=>this.columns.getNode(s)?.def,quickColumns:()=>this.columns.displayed().filter(s=>!D(s.id)).map(s=>s.def),format:(s,a)=>K(s,this.store.state.locale.code)(a),collator:()=>this.collator()}),this.groupBy=this.validGroupBy(t.groupBy??[]),this.defaultExpanded=t.groupDefaultExpanded??0,t.treeData&&!t.getRowId&&O("treeData needs getRowId so parent ids can be matched"),this.updateRows(),this.summaryOpts=t.summary??null,this.refreshSummary();let o=t.fontSize!=null&&t.fontSize>0?t.fontSize:null;t.fontSize!=null&&!(t.fontSize>0)&&O("fontSize must be a positive number"),this.font={size:o,family:t.fontFamily??null};let r=o??un;if(this.renderer=new Qe(e,this,{rowHeight:t.rowHeight??Math.round(Do(r)*hn[this.densityOf(t.density)][0]),headerHeight:t.headerHeight??Math.round($o(r)*hn[this.densityOf(t.density)][1])}),this.density=this.densityOf(t.density),this.renderer.applyTheme(),this.renderer.applyFont(this.font.size,this.font.family),this.menu=new Ct(this),this.chooser=new st(this),this.contextMenu=new lt(this),this.editor=new ft(this),this.finder=new ct(this),this.fillHandle=new dt(this),this.groupPanel=t.groupPanel?new et(this):null,this.pinnedRows={top:he(t.pinnedTopRows??[]),bottom:he(t.pinnedBottomRows??[])},this.sideBar=t.sideBar?new at(this,typeof t.sideBar=="object"&&!!t.sideBar.open,(typeof t.sideBar=="object"?t.sideBar.panels:void 0)??(t.pivot||t.pivotPanel?["columns","filters","pivot"]:void 0)):null,this.disposers.push(this.store.bus.on("change",s=>this.onChange(s)),to(this),Xn(this),()=>this.menu.close(),()=>this.chooser.close(),()=>this.contextMenu.destroy(),()=>this.editor.destroy(),()=>this.fillHandle.destroy(),()=>this.groupPanel?.destroy(),()=>this.charts.destroy(),()=>this.filterBuilder.close(),To(this)),typeof ResizeObserver<"u"){let s=new ResizeObserver(()=>this.renderer.schedule());s.observe(this.renderer.main),this.disposers.push(()=>s.disconnect())}t.pivot&&this.setPivot(t.pivot),So(t.licenseKey).then(s=>{s&&!this.destroyed&&this.renderer.showFreeBadge()}),this.renderer.render(),this.api=this.createApi(),tt.set(this.renderer.root,this)}collator(){let e=this.store.state.locale.code;return this.collatorCache?.code!==e&&(this.collatorCache={code:e,collator:new Intl.Collator(e,{numeric:!0,sensitivity:"base"})}),this.collatorCache.collator}layoutChanged(){this.renderer.invalidateHeights(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers()}columnsChanged(){this.rowModel.invalidate(),this.updateRows(),this.refreshSummary(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers()}display(){return{groupBy:this.options.treeData?ki:this.groupBy,getParentId:this.options.treeData?.getParentId,expanded:this.expanded,defaultExpanded:this.defaultExpanded,detailOpen:this.options.detailRenderer?this.detailOpen:new Set,isMaster:this.options.isRowMaster,lazyChildren:this.options.treeData?.hasChildren?this.lazyChildren:void 0,loading:this.treeLoading,version:this.displayVersion}}updateRows(){let e=!!this.options.pagination,t=this.pivotData??this.store.state.data;this.rowModel.update({...this.store.state,data:t,display:this.display(),page:e?{index:this.page,size:this.pageSize}:null}),e&&this.page>=this.getPageCount()&&(this.page=this.getPageCount()-1,this.rowModel.update({...this.store.state,data:t,display:this.display(),page:{index:this.page,size:this.pageSize}}))}viewRows(){return this.pivotData??this.store.state.data}sourceLeaves(){let e=[],t=n=>{for(let o of n)!o||typeof o!="object"||(Array.isArray(o.children)?t(o.children):(o.id??o.field)&&e.push({id:o.id??o.field,def:o}))};return t(this.sourceDefs),e}getPivot(){let e=this.pivotCfg;if(!e)return null;let t={rows:[...e.rows],columns:[...e.columns],values:e.values.map(n=>({...n}))};return e.totals||(t.totals=!1),t}setPivot(e){if(e&&this.clientOnly("pivot"))return;if(e&&(typeof e!="object"||!Array.isArray(e.rows)||!Array.isArray(e.values))){O("setPivot: expected { rows: string[], values: [...] }");return}if(this.editor.cancel(),!e){if(!this.pivotCfg)return;this.pivotCfg=null,this.pivotData=null,this.columns.setDefs(this.withSelect(this.sourceDefs)),this.savedGroup&&(this.groupBy=this.savedGroup.groupBy,this.expanded=this.savedGroup.expanded,this.defaultExpanded=this.savedGroup.defaultExpanded,this.savedGroup=null),this.afterPivotSwitch();return}let t=new Set(this.sourceLeaves().map(n=>n.id));this.pivotCfg||(this.savedGroup={groupBy:this.groupBy,expanded:this.expanded,defaultExpanded:this.defaultExpanded}),this.pivotCfg=on(e,n=>t.has(n)),this.expanded=new Map,this.defaultExpanded=-1,this.rebuildPivot(!1),this.afterPivotSwitch()}afterPivotSwitch(){this.page=0,this.store.set({sort:[],filters:{},range:null,focus:null}),this.rowModel.invalidate(),this.updateRows(),this.displayVersion++,this.updateRows(),this.groupPanel?.refresh(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers(),this.events.emit("pivotChange",{pivot:this.getPivot()})}rebuildPivot(e=!0){let t=this.pivotCfg;if(!t)return;let n=this.store.state.locale,o=new Map(this.sourceLeaves().map(d=>[d.id,d.def])),r={sum:n.sum,avg:n.avg,min:n.min,max:n.max,count:n.count},s=vo(this.store.state.data,t,d=>o.get(d),{total:n.total,blank:n.blanks,agg:d=>r[d]??d},n.code);if(this.pivotData=s.rows,this.columns.setDefs(this.withSelect(s.columns)),this.groupBy=s.groupBy,!e)return;let a=d=>!!this.columns.getNode(d),l=this.store.state;(l.sort.some(d=>!a(d.colId))||Object.keys(l.filters).some(d=>!a(d)))&&this.store.set({sort:l.sort.filter(d=>a(d.colId)),filters:Object.fromEntries(Object.entries(l.filters).filter(([d])=>a(d)))}),this.rowModel.invalidate(),this.displayVersion++,this.updateRows(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers()}isFlashing(e,t){return this.flashing.size>0&&this.flashing.has(`${e}\0${t}`)}flash(e){let t=Date.now()+1e3;for(let o of e)this.flashing.set(o,t);if(this.flashTimer)return;let n=()=>{let o=Date.now();for(let[r,s]of this.flashing)s<=o&&this.flashing.delete(r);this.renderer.invalidate({rows:!0}),this.flashTimer=this.flashing.size&&!this.destroyed?window.setTimeout(n,250):0};this.flashTimer=window.setTimeout(n,1e3)}applyTransaction(e){return!e||typeof e!="object"?{added:[],updated:[],removed:[],notFound:[]}:this.applyTransactions([e])}applyTransactions(e){let t={added:[],updated:[],removed:[],notFound:[]};if(this.clientOnly("applyTransaction"))return t;let n=new Map;for(let l of this.columns.getState()){let d=this.columns.getNode(l.colId)?.def.field;d&&n.set(d,[...n.get(d)??[],l.colId])}let o=[],r=this.store.state.data,s=new Set(r),a=new Map(r.map(l=>[this.rowModel.idOf(l),l]));for(let l of e)l&&typeof l=="object"&&(r=this.txStep(l,r,{present:s,byId:a},t,o,n));if(!t.added.length&&!t.updated.length&&!t.removed.length)return t.notFound.length&&this.events.emit("transactionApplied",t),t;this.editVersion++,this.renderer.invalidateHeights(),this.keepRange=!0;try{this.replaceData(r===this.store.state.data?[...r]:r)}finally{this.keepRange=!1}return this.editor.sync(),o.length&&this.options.flashCells!==!1&&this.flash(o),this.events.emit("transactionApplied",t),t}txStep(e,t,n,o,r,s){let a=this.options.getRowId,{present:l,byId:d}=n,c=w=>{if(!w||typeof w!="object")return null;if(l.has(w))return this.rowModel.idOf(w);try{return a?String(a(w)):null}catch{return null}},u=new Set;for(let w of e.remove??[]){let m=c(w),h=m===null?void 0:d.get(m);h&&!u.has(h)?(u.add(h),l.delete(h),d.delete(m),o.removed.push(h),this.tracker.created.delete(h),this.tracker.originals.delete(h)):h||o.notFound.push(w)}for(let w of e.update??[]){let m=c(w),h=m===null?void 0:d.get(m);if(!h||u.has(h)){o.notFound.push(w);continue}let p=this.tracker.originals.get(h);for(let[v,y]of Object.entries(w))if(p&&(p[v]=y),!Object.is(h[v],y)){h[v]=y;for(let R of s.get(v)??[])r.push(`${m}\0${R}`)}o.updated.push(h)}let g=he(Array.isArray(e.add)?e.add:[]);o.added.push(...g);for(let w of g)l.add(w),d.set(this.rowModel.idOf(w),w);if(!u.size&&!g.length)return t;let f=u.size?t.filter(w=>!u.has(w)):[...t],b=typeof e.addIndex=="number"?Math.max(0,Math.min(f.length,Math.floor(e.addIndex))):f.length;return f.splice(b,0,...g),f}applyTransactionAsync(e){!e||typeof e!="object"||(this.txQueue.push(e),!this.txTimer&&(this.txTimer=window.setTimeout(()=>{this.txTimer=0;let t=this.txQueue;this.txQueue=[],!(this.destroyed||!t.length)&&this.applyTransactions(t)},50)))}setAdvancedFilter(e){let t=e&&typeof e=="object"&&Array.isArray(e.conditions)&&e.conditions.length?e:null;t!==this.store.state.advancedFilter&&(this.store.set({advancedFilter:t}),this.events.emit("advancedFilterChange",{advancedFilter:t}))}setColumnGroupOpened(e,t){this.columns.setGroupOpen(e,!!t)&&(this.layoutChanged(),this.events.emit("columnGroupOpened",{groupId:e,open:!!t}))}getState(){let e=this.store.state,t=this.savedGroup?.groupBy??this.groupBy,n=this.savedGroup?.expanded??this.expanded,o={columns:this.columns.getState(),columnGroups:this.columns.groupOpenState(),advancedFilter:e.advancedFilter?JSON.parse(JSON.stringify(e.advancedFilter)):null,sort:e.sort.map(r=>({...r})),filters:JSON.parse(JSON.stringify(e.filters)),quickFilter:e.quickFilter,groupBy:[...t],pivot:this.pivotCfg?JSON.parse(JSON.stringify(this.pivotCfg)):null,expanded:Object.fromEntries(n),selected:[...e.selected]};return this.options.pagination&&(o.page=this.page,o.pageSize=this.pageSize),o}setState(e,t={}){if(!e||typeof e!="object")return;let n=r=>e[r]!==void 0&&(!t.parts||t.parts.includes(r)),o=r=>!!this.columns.getNode(r);if(n("columns")&&Array.isArray(e.columns)&&(this.columns.applyState(e.columns.filter(r=>r&&o(r.colId))),this.columnsChanged()),n("columnGroups")&&e.columnGroups&&typeof e.columnGroups=="object")for(let[r,s]of Object.entries(e.columnGroups))typeof s=="boolean"&&this.setColumnGroupOpened(r,s);if(n("groupBy")&&Array.isArray(e.groupBy)&&this.setGroupBy(e.groupBy.filter(o)),n("pivot")&&this.setPivot(e.pivot??null),n("sort")&&Array.isArray(e.sort)&&this.setSort(e.sort.filter(r=>r&&o(r.colId))),n("filters")&&e.filters&&typeof e.filters=="object"){let r=Object.fromEntries(Object.entries(e.filters).filter(([s])=>o(s)));this.store.set({filters:r}),this.events.emit("filterChange",{filters:{...r}})}if(n("advancedFilter")&&this.setAdvancedFilter(e.advancedFilter??null),n("quickFilter")&&typeof e.quickFilter=="string"&&this.store.set({quickFilter:e.quickFilter}),n("expanded")&&e.expanded&&typeof e.expanded=="object"){let r=new Map(Object.entries(e.expanded).filter(([,s])=>typeof s=="boolean"));this.savedGroup?this.savedGroup.expanded=r:(this.expanded=r,this.displayChanged())}if(n("pageSize")&&typeof e.pageSize=="number"&&this.setPageSize(e.pageSize),n("page")&&typeof e.page=="number"&&this.setPage(e.page),n("selected")&&Array.isArray(e.selected)){let r=new Set(this.rowModel.allNodes().map(s=>s.id));this.setSelected(new Set(e.selected.map(String).filter(s=>r.has(s))))}}rowNumber(e){let t=this.rowModel.rows();if(this.rowNumberCache?.rows!==t){let o=new Int32Array(t.length),r=0;t.forEach((s,a)=>{o[a]=s.kind?0:++r}),this.rowNumberCache={rows:t,nums:o}}let n=this.rowNumberCache.nums[e];return n?n+(this.options.pagination&&!this.rowModel.server?this.page*this.pageSize:0):null}getPage(){return this.options.pagination?this.page:0}getPageSize(){return this.options.pagination?this.pageSize:this.rowModel.fullCount()}getPageCount(){return this.options.pagination?Math.max(1,Math.ceil(this.rowModel.fullCount()/this.pageSize)):1}setPage(e){if(!this.options.pagination||!Number.isFinite(e))return;let t=Math.max(0,Math.min(this.getPageCount()-1,Math.floor(e)));t!==this.page&&(this.veto("beforePageChange",{page:t,pageSize:this.pageSize})||(this.page=t,this.pageMoved()))}setPageSize(e){if(!this.options.pagination)return;if(!Number.isInteger(e)||e<=0){O("setPageSize: size must be a positive integer");return}if(e===this.pageSize)return;let t=this.page*this.pageSize;this.veto("beforePageChange",{page:Math.floor(t/e),pageSize:e})||(this.pageSize=e,this.page=Math.floor(t/e),this.pageMoved())}pageMoved(){this.editor.cancel(),this.updateRows(),this.store.state.range&&this.setRange(null);let e=this.rowModel.getRowCount(),t=this.store.state.focus;t&&t.rowIndex>=e&&this.store.set({focus:e?{...t,rowIndex:e-1}:null}),this.renderer.scroller.scrollTop=0,this.finder.refresh(),this.renderer.invalidate({header:!0,rows:!0}),this.emitPage()}emitPage(){this.events.emit("pageChange",{page:this.page,pageSize:this.pageSize,pageCount:this.getPageCount()})}refreshRows(){this.rowModel instanceof ze&&(this.rowModel.purge(),this.renderer.invalidate({rows:!0}))}serverLoaded(e,t,n){this.destroyed||(this.renderer.invalidate({header:!0,rows:!0}),this.events.emit("rowsLoaded",n===null?{start:e,end:t}:{start:e,end:t,total:n}))}serverFailed(e,t,n){this.destroyed||(O(`datasource.getRows failed for rows ${e}\u2013${t}`),this.toast(this.store.state.locale.loadFailed),this.renderer.invalidate({rows:!0}),this.events.emit("rowsLoadFailed",{start:e,end:t,error:n}))}syncScroll(e,t){if(!e||typeof e.setScrollPosition!="function"||e===this.api)return()=>{};let n=new Map,o=a=>`${a.top},${a.left}`,r=(a,l)=>a.on("scroll",d=>{if(n.get(a)===o(d)){n.delete(a);return}l.setScrollPosition(t==="vertical"?{top:d.top}:t==="horizontal"?{left:d.left}:d),n.set(l,o(l.getScrollPosition()))}),s=[r(this.api,e),r(e,this.api)];return()=>{for(let a of s)a()}}veto(e,t){let n=!1;return this.events.emit(e,{...t,cancel:()=>{n=!0}}),n}clientOnly(e){return this.rowModel.server?(O(`${e} is not available with a datasource`),!0):!1}displayChanged(){this.displayVersion++,this.updateRows(),this.store.state.range&&this.setRange(null);let e=this.rowModel.getRowCount(),t=this.store.state.focus;t&&t.rowIndex>=e&&this.store.set({focus:e?{...t,rowIndex:e-1}:null}),this.finder.refresh(),this.renderer.invalidate({header:!0,rows:!0})}validGroupBy(e){return Array.isArray(e)?[...new Set(e)].filter(t=>{let n=this.columns.getNode(t);return!n||n.children||D(t)?(O(`groupBy: unknown column "${t}"`),!1):!0}):[]}getGroupBy(){return[...this.groupBy]}setGroupBy(e){let t=this.validGroupBy(e);t.join("")!==this.groupBy.join("")&&(this.groupBy=t,this.page=0,this.groupPanel?.refresh(),this.displayChanged(),this.events.emit("groupChange",{groupBy:[...t]}))}isExpandable(e){return!!e&&(e.kind==="group"||!!e.hasChildren)}expandKey(e){return e.group?e.group.key:e.id}loadChildren(e){let t=this.options.treeData,n=e.id;if(this.treeLoading.has(n))return;if(typeof t.loadChildren!="function"){O("treeData.hasChildren needs treeData.loadChildren");return}this.treeLoading.add(n),this.displayChanged();let o=()=>(this.treeLoading.delete(n),!this.destroyed&&this.store.state.data.includes(e.data));Promise.resolve().then(()=>t.loadChildren(e.data)).then(r=>{if(!o())return;let s=he(Array.isArray(r)?r:[]);this.treeLoaded.add(n),this.expanded.set(n,!0),s.length&&this.replaceData([...this.store.state.data,...s]),this.displayChanged(),this.events.emit("childrenLoaded",{row:e.data,rows:s}),this.events.emit("groupToggle",{key:n,expanded:!0})},r=>{o()&&(O(`treeData.loadChildren failed for row "${n}"`),this.displayChanged(),this.events.emit("childrenLoadFailed",{row:e.data,error:r}))})}setGroupExpanded(e,t){let n=this.rowModel.rows().find(r=>this.isExpandable(r)&&this.expandKey(r)===e);if((n?!!(n.group?.expanded??n.expanded):this.expanded.get(e))!==t){if(t&&n&&!n.group&&this.options.treeData&&this.lazyChildren(n.id,n.data)){this.loadChildren(n);return}this.expanded.set(e,t),this.displayChanged(),this.events.emit("groupToggle",{key:e,expanded:t})}}toggleRow(e){let t=this.rowModel.getRow(e);this.isExpandable(t)&&this.setGroupExpanded(this.expandKey(t),!(t.group?.expanded??t.expanded))}expandAll(e=!0){this.expanded.clear(),this.defaultExpanded=e?-1:0,this.displayChanged()}groupAggregate(e,t){let n=this.columns.getNode(t)?.def;if(!e.group||!n?.aggFunc)return;if(e.group.aggregates)return e.group.aggregates[t]??(n.field?e.group.aggregates[n.field]:void 0);this.aggCache.ver!==this.editVersion&&(this.aggCache={ver:this.editVersion,map:new WeakMap});let o=this.aggCache.map.get(e.group);if(o||this.aggCache.map.set(e.group,o=new Map),!o.has(t)){let r=e.group.rows;try{o.set(t,pe(n.aggFunc,r.map(s=>B(n,s)),r))}catch{O(`aggFunc of column "${t}" threw`),o.set(t,null)}}return o.get(t)}canExpandDetail(e){if(!this.options.detailRenderer)return!1;try{return!this.options.isRowMaster||!!this.options.isRowMaster(e)}catch{return!1}}isDetailExpanded(e){return!!e&&typeof e=="object"&&this.detailOpen.has(this.rowModel.idOf(e))}setDetailExpanded(e,t){if(!e||typeof e!="object"||t&&!this.canExpandDetail(e))return;let n=this.rowModel.idOf(e);this.detailOpen.has(n)!==t&&(t?this.detailOpen.add(n):(this.detailOpen.delete(n),this.renderer.dropDetail(n)),this.displayChanged(),this.events.emit("detailToggle",{row:e,expanded:t}))}canMoveRows(){let e=this.store.state,t=this.options.treeData;return!this.rowModel.server&&!e.sort.length&&!Object.keys(e.filters).length&&!e.quickFilter.trim()&&!this.groupBy.length&&(!t||typeof t.setParentId=="function")}get dragOptions(){let e=this.options.rowDrag;return e&&typeof e=="object"?e:{}}parentOf(e){let t=null;try{t=this.options.treeData.getParentId(e)}catch{t=null}return t==null?null:String(t)}rawParent(e){try{return this.options.treeData.getParentId(e)??null}catch{return null}}idValue(e){let t=this.rowModel.idOf(e);for(let o of this.store.state.data){let r=this.rawParent(o);if(r!==null&&String(r)===t)return r}return this.store.state.data.some(o=>typeof this.rawParent(o)=="number")&&t.trim()!==""&&Number.isFinite(Number(t))?Number(t):t}canDropRow(e,t,n,o=this){if(!this.canMoveRows()||t===e)return!1;if(o===this&&this.options.treeData&&t){let s=this.rowModel.idOf(e),a=new Set;for(let l=this.rowModel.idOf(t);l!==null&&!a.has(l);){if(l===s)return!1;a.add(l);let d=this.rowModel.allNodes().find(c=>c.id===l);l=d?this.parentOf(d.data):null}}let r=this.dragOptions.canDrop;if(!r)return!0;try{return r({row:e,target:t,position:n,fromOtherGrid:o!==this})!==!1}catch{return O("rowDrag.canDrop threw; the drop was refused"),!1}}dropRow(e,t,n="after",o=this){if(this.clientOnly("dropRow")||!e||typeof e!="object")return!1;let r=this.options.treeData;!r&&n==="inside"&&(n="after");let s=this.store.state.data,a=o!==this,l=a?-1:s.indexOf(e);if(!a&&l<0||t&&!s.includes(t)||a&&(!o.canMoveRows()||s.includes(e))||!this.canDropRow(e,t,n,o))return!1;let d=r?this.rawParent(e):null,c=!r||!t?null:n==="inside"?t:this.store.state.data.find(h=>this.rowModel.idOf(h)===this.parentOf(t))??null,u=c?this.idValue(c):null,g=s.filter(h=>h!==e),f=!t||n==="inside"?g.length:g.indexOf(t)+(n==="after"?1:0);g.splice(f,0,e);let b=g.some((h,p)=>h!==s[p]);if(!a&&!b&&String(d??"")===String(u??""))return!1;let w=(h,p)=>{try{r.setParentId(e,h,p)}catch{O("treeData.setParentId threw")}},m=r?this.store.state.data.find(h=>this.rowModel.idOf(h)===this.parentOf(e))??null:null;return a?(o.removeRows([e]),r&&w(u,c),this.addRows([e],f)):(r&&w(u,c),this.replaceData(g),this.history.push({undo:()=>{r&&w(d,m),this.replaceData(s)},redo:()=>{r&&w(u,c),this.replaceData(g)}}),this.events.emit("rowDragEnd",{row:e,fromIndex:l,toIndex:f})),this.events.emit("rowDrop",{row:e,target:t,position:n,fromOtherGrid:a,fromGrid:a?o.api:null}),!0}moveRow(e,t,n=!0){if(this.clientOnly("moveRow")||!this.canMoveRows())return!1;let o=this.store.state.data,r=o.indexOf(e);if(r<0||!Number.isFinite(t))return!1;let s=Math.max(0,Math.min(o.length-1,Math.floor(t)));if(s===r)return!1;let a=[...o];return a.splice(r,1),a.splice(s,0,e),this.replaceData(a),n&&this.history.push({undo:()=>this.moveRow(e,r,!1),redo:()=>this.moveRow(e,s,!1)}),this.events.emit("rowDragEnd",{row:e,fromIndex:r,toIndex:s}),!0}setFont(e){let t=this.font.size;e.size!==void 0&&(typeof e.size=="number"&&e.size>0?t=e.size:O("setFont: size must be a positive number"));let n=e.family===void 0?this.font.family:e.family||null;this.font={size:t,family:n};let o=t??un;this.applyAutoHeights(o),this.renderer.applyFont(t,n),this.renderer.invalidateHeights(),this.menu.close(),this.layoutChanged()}densityOf(e){return e==="compact"||e==="comfortable"?e:"normal"}applyAutoHeights(e){let[t,n]=hn[this.density];this.options.rowHeight==null&&(this.renderer.opts.rowHeight=Math.round(Do(e)*t)),this.options.headerHeight==null&&(this.renderer.opts.headerHeight=Math.round($o(e)*n))}setDensity(e){let t=this.densityOf(e);t!==this.density&&(this.density=t,this.renderer.applyTheme(),this.applyAutoHeights(this.font.size??un),this.renderer.invalidateHeights(),this.layoutChanged())}applyFontTo(e){this.font.size&&e.style.setProperty("--fg-font-size",`${this.font.size}px`),this.font.family&&e.style.setProperty("--fg-font",this.font.family)}summary(){return this.summaryOpts&&this.summaryOpts.rows?.length?{opts:this.summaryOpts,values:this.summaryValues}:null}setSummary(e){if(e&&!Array.isArray(e.rows)){O("setSummary: summary.rows must be an array");return}this.summaryOpts=e,this.refreshSummary(),this.renderer.invalidate({header:!0,rows:!0})}refreshSummary(){let e=this.summaryOpts;if(!e?.rows?.length){this.summaryValues=[];return}let t=e.scope??"filtered",n=t==="all"?this.rowModel.allNodes().map(o=>o.data):t==="selected"?this.selectedRows():this.rowModel.dataRows().map(o=>o.data);this.summaryValues=Vn(e.rows,n,o=>this.columns.getNode(o)?.def)}dataColumns(){return this.columns.displayed().filter(e=>!D(e.id))}validRange(e){if(!e||this.options.rangeSelection===!1)return null;let t=this.rowModel.getRowCount(),n=o=>!!o&&!D(o.colId)&&!!this.columns.getColumn(o.colId)&&o.rowIndex>=0&&o.rowIndex<t;return n(e.start)&&n(e.end)?{start:{...e.start},end:{...e.end}}:null}setRange(e,t=!1){let n=this.validRange(e),o=t||!this.store.state.extraRanges.length?this.store.state.extraRanges:[],r=this.store.state.range;JSON.stringify(r)===JSON.stringify(n)&&o===this.store.state.extraRanges||(this.store.set({range:n,extraRanges:o}),this.events.emit("rangeChange",{range:n&&{start:{...n.start},end:{...n.end}}}))}addRange(e){let{range:t,focus:n}=this.store.state,o=this.validRange(t??(n?{start:n,end:n}:null));o&&this.store.set({extraRanges:[...this.store.state.extraRanges,o]}),this.setRange(e,!0)}getRanges(){let e=[...this.store.state.extraRanges];return this.store.state.range&&e.push(this.store.state.range),e.map(t=>({start:{...t.start},end:{...t.end}}))}setRanges(e){let t=(Array.isArray(e)?e:[]).map(n=>this.validRange(n)).filter(n=>!!n);this.store.set({extraRanges:t.slice(0,-1)}),this.setRange(t[t.length-1]??null,!0)}boundsOf(e){if(!e)return null;let t=this.columns.getColumn(e.start.colId),n=this.columns.getColumn(e.end.colId);return!t||!n?null:Fe({start:{rowIndex:e.start.rowIndex,colIndex:t.index},end:{rowIndex:e.end.rowIndex,colIndex:n.index}})}rangeBounds(){return this.boundsOf(this.store.state.range)}allRangeBounds(){return[...this.store.state.extraRanges,this.store.state.range].map(e=>this.boundsOf(e)).filter(e=>!!e)}rangeContains(e,t){let n=this.columns.getColumn(t);return!!n&&this.allRangeBounds().some(o=>Qn(o,e,n.index))}selectAllCells(){let e=this.dataColumns(),t=this.rowModel.getRowCount();!e.length||!t||(this.store.state.focus||this.setFocus(0,e[0].id),this.setRange({start:{rowIndex:0,colId:e[0].id},end:{rowIndex:t-1,colId:e[e.length-1].id}}))}selectionTSV(e,t=!1){let n=this.store.state.locale.code,o=this.columns.displayed(),r=t?null:this.rangeBounds(),s=t,a,l,d=t?[]:this.allRangeBounds();if(d.length>1){let u=d.every(f=>f.c1===d[0].c1&&f.c2===d[0].c2),g=d.every(f=>f.r1===d[0].r1&&f.r2===d[0].r2);if(this.rangesStack(d)){let f=[...d].sort((m,h)=>u?m.r1-h.r1:m.c1-h.c1),b=f.map(m=>this.rangeMatrix(m)),w=u?b.flat():b[0].map((m,h)=>b.flatMap(p=>p[h]??[]));return e&&w.unshift((u?f.slice(0,1):f).flatMap(m=>this.rangeHeaders(m))),Gt(w)}}if(r){a=[];for(let u=r.r1;u<=r.r2;u++){let g=this.rowModel.getRow(u);g.kind||a.push(g.data)}l=o.slice(r.c1,r.c2+1).filter(u=>!D(u.id))}else if(s){let u=this.store.state.selected;a=this.rowModel.dataRows().filter(g=>u.has(g.id)).map(g=>g.data),l=this.dataColumns()}else{let u=this.store.state.focus,g=u&&this.columns.getColumn(u.colId),f=u&&this.rowModel.getRow(u.rowIndex);if(!g||!f||f.kind||D(g.id))return"";a=[f.data],l=[g]}let c=a.map(u=>l.map(g=>this.copyCell(g.def,u,n)));return e&&c.unshift(l.map(u=>u.def.header??u.def.field??u.id)),Gt(c)}rangesStack(e){return e.length>1&&(e.every(t=>t.c1===e[0].c1&&t.c2===e[0].c2)||e.every(t=>t.r1===e[0].r1&&t.r2===e[0].r2))}rangeHeaders(e){return this.columns.displayed().slice(e.c1,e.c2+1).filter(t=>!D(t.id)).map(t=>t.def.header??t.def.field??t.id)}rangeMatrix(e){let t=this.columns.displayed().slice(e.c1,e.c2+1).filter(r=>!D(r.id)),n=this.store.state.locale.code,o=[];for(let r=e.r1;r<=e.r2;r++){let s=this.rowModel.getRow(r);s&&!s.kind&&o.push(t.map(a=>this.copyCell(a.def,s.data,n)))}return o}copyCell(e,t,n){return this.copyAllowed(e,t)?ut(e,B(e,t),n):""}copyAllowed(e,t){let n=e.copyable;if(typeof n!="function")return n!==!1;try{return n({value:B(e,t),row:t,column:e})!==!1}catch{return!1}}cutToClipboard(){let e=this.copyToClipboard(!1);return e&&this.clearCells(!0),e}copyToClipboard(e,t=!1){let n=this.selectionTSV(e,t);if(n&&typeof navigator<"u"&&navigator.clipboard?.writeText)try{navigator.clipboard.writeText(n)?.catch?.(()=>{})}catch{}return n}pasteText(e){let t=Jn(e),n={changed:0,skipped:0};if(!t.length)return n;let o=this.columns.displayed(),r=this.rowModel.getRowCount(),s=this.rangeBounds(),a=this.store.state.focus,l=a&&this.columns.getColumn(a.colId),d,c;if(s)d=s.r1,c=s.c1;else if(a&&l&&!D(l.id))d=a.rowIndex,c=l.index;else return n;let u=[],g=t.length===1&&t[0].length===1,f=g&&s?s.r2-s.r1+1:t.length,b=g&&s?s.c2-s.c1+1:Math.max(...t.map(w=>w.length));for(let w=0;w<f;w++){let m=d+w;if(m>=r)break;let h=this.rowModel.getRow(m);if(!h.kind)for(let p=0;p<b;p++){let v=o[c+p];if(!v)break;if(D(v.id))continue;let y=g&&s?t[0][0]:t[w]?.[p];if(y===void 0)continue;let R=v.def;if(!R.field||!ae(R,h.data,m)){n.skipped++;continue}let k=h.data[R.field],L=this.acceptText(R,h.data,y,k);if(!L.ok){n.skipped++;continue}this.writeCell(u,h.data,R.field,v.id,m,L.value)&&n.changed++}}return this.endCellTx(u),this.events.emit("paste",{...n}),n}acceptText(e,t,n,o){let r,s=e.editor;if(s&&typeof s=="object"&&s.type==="select"){let a=(typeof s.options=="function"?s.options(t):s.options)??[],l=n.trim().toLowerCase(),d=a.map(c=>c!==null&&typeof c=="object"&&"value"in c?c:{value:c,label:String(c),disabled:!1}).find(c=>String(c.value).toLowerCase()===l||(c.label??"").toLowerCase()===l);if(!d||d.disabled)return{ok:!1};r=d.value}else if(e.formulas&&Ce(n.trim()))r=n.trim();else{let a=ht(e,n,o);if(!a.ok)return a;r=a.value}return this.cellError(e,t,r)!==null?{ok:!1}:{ok:!0,value:r}}cellError(e,t,n){let o=this.store.state.locale;if(e.required&&q(n))return o.required;if(e.unique&&e.field&&!q(n)){let r=n instanceof Date?n.getTime():String(n),s=e.field;if(this.store.state.data.some(a=>{if(a===t)return!1;let l=a[s];return!q(l)&&(l instanceof Date?l.getTime():String(l))===r}))return o.duplicate}if(e.validate){let r;try{r=e.validate(n,t)}catch{r=o.invalidValue}if(r!==!0)return typeof r=="string"&&r?r:o.invalidValue}return null}validateAll(){let e=[],t=this.columns.getState().map(n=>({id:n.colId,def:this.columns.getNode(n.colId).def})).filter(n=>n.def.field&&n.def.editable&&(n.def.required||n.def.unique||n.def.validate));return this.store.state.data.forEach((n,o)=>{let r=this.rowModel.idOf(n),s=this.rowModel.indexOfId(r);for(let a of t){if(!ae(a.def,n,s<0?o:s))continue;let l=this.cellError(a.def,n,n[a.def.field]);l!==null&&e.push({row:n,rowIndex:s,colId:a.id,message:l})}}),e}mergeSpans(){if(this.rowModel.server||!this.columns.displayed().some(r=>r.def.merge||r.def.rowSpan))return Mi;let e=this.rowModel.rows(),t=this.editVersion*1e6+this.columns.displayed().length;if(this.spanCache&&this.spanCache.rows===e&&this.spanCache.ver===t)return this.spanCache.spans;let n=new Map,o=this.columns.displayed().filter(r=>r.def.merge||r.def.rowSpan);if(o.length&&!e.some(r=>r.kind)){let r=e.map(s=>s.data);for(let s of o)n.set(s.id,Je(r,s.def))}return this.spanCache={rows:e,ver:t,spans:n},n}rangeAggregates(){let e=this.allRangeBounds();if(!e.length)return null;let t=this.columns.displayed(),n={cells:0,count:0,numbers:0,sum:0,min:1/0,max:-1/0},o=e.length>1?new Set:null;for(let r of e)for(let s=r.r1;s<=r.r2;s++){let a=this.rowModel.getRow(s);if(!a||a.kind)continue;let l=a.data;for(let d of t.slice(r.c1,r.c2+1)){if(D(d.id))continue;if(o){let u=`${s},${d.index}`;if(o.has(u))continue;o.add(u)}n.cells++;let c=B(d.def,l);if(!q(c)&&(n.count++,typeof c=="number"||d.def.type==="number"&&!Number.isNaN(Number(c)))){let u=Number(c);n.numbers++,n.sum+=u,u<n.min&&(n.min=u),u>n.max&&(n.max=u)}}}return n}fillRange(e){let t=this.rangeBounds()??(()=>{let u=this.store.state.focus,g=u&&this.columns.getColumn(u.colId);return u&&g&&!D(g.id)?{r1:u.rowIndex,r2:u.rowIndex,c1:g.index,c2:g.index}:null})(),n=this.columns.getColumn(e.start.colId),o=this.columns.getColumn(e.end.colId);if(!t||!n||!o)return;let r=Fe({start:{rowIndex:e.start.rowIndex,colIndex:n.index},end:{rowIndex:e.end.rowIndex,colIndex:o.index}}),s=this.rowModel.getRowCount();r.r1=Math.max(0,r.r1),r.r2=Math.min(s-1,r.r2);let a=this.columns.displayed(),l=[],d=(u,g,f)=>{let b=a[g],w=this.rowModel.getRow(u),m=b?.def;!w||w.kind||!m?.field||D(b.id)||!ae(m,w.data,u)||this.cellError(m,w.data,f)===null&&this.writeCell(l,w.data,m.field,b.id,u,f)},c=(u,g)=>B(a[g].def,this.rowModel.getRow(u).data);if(r.r1<t.r1||r.r2>t.r2)for(let u=t.c1;u<=t.c2;u++){let g=[],f=[];for(let b=t.r1;b<=t.r2;b++)g.push(c(b,u));for(let b=t.r2;b>=t.r1;b--)f.push(c(b,u));Pe(g,r.r2-t.r2).forEach((b,w)=>d(t.r2+1+w,u,b)),Pe(f,t.r1-r.r1).forEach((b,w)=>d(t.r1-1-w,u,b))}else if(r.c1<t.c1||r.c2>t.c2)for(let u=t.r1;u<=t.r2;u++){let g=[],f=[];for(let b=t.c1;b<=t.c2;b++)g.push(c(u,b));for(let b=t.c2;b>=t.c1;b--)f.push(c(u,b));Pe(g,r.c2-t.c2).forEach((b,w)=>d(u,t.c2+1+w,b)),Pe(f,t.c1-r.c1).forEach((b,w)=>d(u,t.c1-1-w,b))}else return;this.endCellTx(l),this.setRange({start:{rowIndex:r.r1,colId:a[r.c1].id},end:{rowIndex:r.r2,colId:a[r.c2].id}})}setPinnedRows(e){e.top&&(this.pinnedRows.top=he(e.top)),e.bottom&&(this.pinnedRows.bottom=he(e.bottom)),this.renderer.invalidate({rows:!0})}writeCell(e,t,n,o,r,s){let a=t[n];return Object.is(a,s)||this.veto("beforeCellChange",{row:t,rowIndex:r,colId:o,oldValue:a,newValue:s})?!1:(this.tracker.beforeChange(t),t[n]=s,e.push({row:t,field:n,colId:o,oldValue:a,newValue:s}),this.events.emit("cellValueChanged",{row:t,rowIndex:r,colId:o,oldValue:a,newValue:s}),!0)}endCellTx(e){if(!e.length)return;let t=(n,o)=>{for(let r of n){let s=r.row[r.field];r.row[r.field]=r[o],this.events.emit("cellValueChanged",{row:r.row,rowIndex:this.rowModel.indexOfId(this.rowModel.idOf(r.row)),colId:r.colId,oldValue:s,newValue:r[o]})}this.afterDataEdit()};this.history.push({undo:()=>t([...e].reverse(),"oldValue"),redo:()=>t(e,"newValue")}),this.afterDataEdit()}afterDataEdit(){this.renderer.invalidateHeights(),this.editVersion++,this.refreshSummary(),this.renderer.invalidate({rows:!0})}applyEdit(e,t,n){let o=this.rowModel.getRow(e),r=this.columns.getColumn(t)?.def;if(!o||!r?.field)return;let s=[];this.writeCell(s,o.data,r.field,t,e,n),this.endCellTx(s)}clearCells(e=!1){let t=this.columns.displayed(),n=this.allRangeBounds();if(e&&!this.rangesStack(n)){let l=this.rangeBounds();n=l?[l]:[]}let o=this.store.state.focus,r=o?this.columns.getColumn(o.colId)?.index:void 0,s=n.length?n:o&&r!==void 0?[{r1:o.rowIndex,r2:o.rowIndex,c1:r,c2:r}]:[];if(!s.length)return;let a=[];for(let l of s)for(let d=l.r1;d<=l.r2;d++){let c=this.rowModel.getRow(d);for(let u=l.c1;u<=l.c2;u++){let g=t[u]?.def;c&&!c.kind&&g?.field&&ae(g,c.data,d)&&(!e||this.copyAllowed(g,c.data))&&this.writeCell(a,c.data,g.field,t[u].id,d,null)}}this.endCellTx(a)}replaceData(e){this.store.set({data:e});let t=new Set(this.rowModel.allNodes().map(s=>s.id)),n=this.store.state.selected;[...n].some(s=>!t.has(s))&&this.setSelected(new Set([...n].filter(s=>t.has(s))));let o=this.rowModel.getRowCount(),r=this.store.state.focus;r&&r.rowIndex>=o&&this.store.set({focus:o?{...r,rowIndex:o-1}:null})}addRows(e,t,n=!0){if(this.clientOnly("addRows"))return[];let o=he(Array.isArray(e)?e:[]);if(!o.length)return[];let r=[...this.store.state.data],s=t===void 0?r.length:Math.max(0,Math.min(r.length,t));r.splice(s,0,...o);for(let a of o)this.tracker.created.add(a);return this.replaceData(r),n&&this.history.push({undo:()=>this.removeRows(o,!1),redo:()=>this.addRows(o,s,!1)}),this.events.emit("rowsAdded",{rows:[...o]}),o}removeRows(e,t=!0){if(this.clientOnly("removeRows"))return[];let n=this.store.state.data,o=typeof e=="function"?e:(l=>d=>l.has(d))(new Set(e)),r=[];if(n.forEach((l,d)=>{let c=!1;try{c=!!o(l)}catch{c=!1}c&&r.push({row:l,index:d})}),!r.length)return[];let s=new Set(r.map(l=>l.row)),a=new Set(r.filter(l=>this.tracker.created.has(l.row)).map(l=>l.row));for(let{row:l,index:d}of r)a.has(l)?this.tracker.created.delete(l):this.tracker.deleted.set(l,d);return this.replaceData(n.filter(l=>!s.has(l))),t&&this.history.push({undo:()=>{let l=[...this.store.state.data];for(let{row:d,index:c}of r)l.splice(Math.min(c,l.length),0,d),this.tracker.deleted.delete(d),a.has(d)&&this.tracker.created.add(d);this.replaceData(l)},redo:()=>this.removeRows([...s],!1)}),this.events.emit("rowsRemoved",{rows:r.map(l=>l.row)}),r.map(l=>l.row)}trackedFields(){let e=[],t=n=>{for(let o of n)o.children?t(o.children):o.def.field&&!D(o.id)&&e.push({field:o.def.field,colId:o.id})};return t(this.columns.roots()),e}getChanges(){let e=this.trackedFields(),t=[];for(let[n,o]of this.tracker.originals)if(!this.tracker.deleted.has(n))for(let r of this.tracker.diff(n,e.map(s=>s.field)))t.push({row:n,colId:e.find(s=>s.field===r).colId,oldValue:o[r],newValue:n[r]});return t}getModifiedRows(){let e=this.trackedFields().map(n=>n.field),t=this.store.state.data;return{created:t.filter(n=>this.tracker.created.has(n)),updated:t.filter(n=>this.tracker.originals.has(n)&&this.tracker.diff(n,e).length>0),deleted:[...this.tracker.deleted.keys()]}}hasChanges(){let e=this.getModifiedRows();return e.created.length+e.updated.length+e.deleted.length>0}commitChanges(e){e&&e.rows instanceof Map?this.tracker.commit(e.rows,Array.isArray(e.deleted)?e.deleted:[]):this.tracker.reset(),this.renderer.invalidate({rows:!0})}revertChanges(){this.editor.cancel();for(let[n,o]of this.tracker.originals)Object.assign(n,o);let e=this.store.state.data.filter(n=>!this.tracker.created.has(n)),t=[...this.tracker.deleted.entries()].sort((n,o)=>n[1]-o[1]);e=[...e];for(let[n,o]of t)e.splice(Math.min(o,e.length),0,n);this.tracker.reset(),this.history.clear(),this.replaceData(e),this.afterDataEdit()}undo(){this.editor.cancel(),this.history.undo()}redo(){this.editor.cancel(),this.history.redo()}toast(e){let t=x("div","fg-toast",{role:"status"});t.textContent=e,this.renderer.root.append(t),setTimeout(()=>t.remove(),3500)}refreshChoosers(){this.chooser.refresh(),this.sideBar?.refresh()}setColumnsVisible(e,t){let n=[];for(let o of e){let r=this.columns.getNode(o);!r||r.children||r.hide===!t||(this.columns.setHide(o,!t),n.push(o))}if(n.length){this.columnsChanged();for(let o of n)this.events.emit("columnVisible",{colId:o,visible:t})}}autoSize(e){let t=(e?e.map(l=>this.columns.getColumn(l)):this.columns.displayed()).filter(l=>!!l&&Ue(l.def)),{first:n,last:o}=this.renderer.renderedRange(),r=this.store.state.locale.code,s=66,a=24;for(let l of t){let d=this.renderer.measureText(l.def.header??l.def.field??"",!0)+s,c=K(l.def,r);for(let g=n;g<=o;g++){let f=this.rowModel.getRow(g);f&&(d=Math.max(d,this.renderer.measureText(c(B(l.def,f.data)),!1)+a))}let u=this.columns.setWidth(l.id,Math.ceil(d));this.events.emit("columnResize",{colId:l.id,width:u})}this.layoutChanged()}resetColumns(){this.columns.reset(),this.columnsChanged()}setSort(e){let t=e.filter(n=>{let o=this.columns.getNode(n.colId);return!o||o.children?(O(`setSort: unknown column "${n.colId}"`),!1):n.dir==="asc"||n.dir==="desc"});this.veto("beforeSort",{sort:t.map(n=>({...n}))})||(this.store.set({sort:t}),this.events.emit("sortChange",{sort:[...t]}))}toggleSort(e,t){let n=this.store.state.sort,o=n.find(a=>a.colId===e),r=o?o.dir==="asc"?"desc":null:"asc",s;t?r?o?s=n.map(a=>a.colId===e?{colId:e,dir:r}:a):s=[...n,{colId:e,dir:r}]:s=n.filter(a=>a.colId!==e):s=r?[{colId:e,dir:r}]:[],this.setSort(s)}setFilter(e,t){let n=this.columns.getNode(e);if(!n||n.children){O(`setFilter: unknown column "${e}"`);return}if(this.veto("beforeFilter",{colId:e,model:t}))return;let o={...this.store.state.filters};t?o[e]=t:delete o[e],this.store.set({filters:o}),this.events.emit("filterChange",{filters:{...o}})}setPinned(e,t){this.columns.setPinned(e,t),this.layoutChanged()}setFocus(e,t){let n=this.store.state.focus;n&&n.rowIndex===e&&n.colId===t||(this.store.set({focus:{rowIndex:e,colId:t}}),this.events.emit("focusChange",{rowIndex:e,colId:t}))}setSelected(e,t=this.store.state.anchorId){this.selectionVersion++,this.store.set({selected:e,anchorId:t}),this.events.emit("selectionChange",{selected:this.selectedRows()})}rowSelectable(e){let t=this.options.isRowSelectable;if(!t)return!0;try{return!!t(e)}catch{return!1}}groupMemberIds(e){if(e.group)return e.group.rows.filter(a=>this.rowSelectable(a)).map(a=>this.rowModel.idOf(a));let t=this.options.treeData?.getParentId;if(!t)return[];let n=new Map;for(let a of this.store.state.data){let l=null;try{l=t(a)}catch{l=null}if(l==null)continue;let d=String(l),c=n.get(d);c?c.push(a):n.set(d,[a])}let o=[],r=new Set([e.id]),s=[e.id];for(;s.length;)for(let a of n.get(s.shift())??[]){let l=this.rowModel.idOf(a);r.has(l)||(r.add(l),s.push(l),this.rowSelectable(a)&&o.push(l))}return o}groupSelection(e){let t=this.groupMemberIds(e),n=this.store.state.selected,o=t.filter(r=>n.has(r)).length;return o===0?"none":o===t.length?"all":"some"}toggleGroupSelection(e){if(this.options.rowSelection!=="multiple")return;let t=this.groupMemberIds(e),n=new Set(this.store.state.selected),o=t.length>0&&t.every(r=>n.has(r));for(let r of t)o?n.delete(r):n.add(r);this.setSelected(n)}selectFromClick(e,t,n){let o=this.options.rowSelection;if(!o||e<0||e>=this.rowModel.getRowCount())return;let r=this.rowModel.getRow(e);if(r.kind||!this.rowSelectable(r.data))return;let s=Lo({selected:this.store.state.selected,anchorIndex:this.anchorIndex(),mode:o,index:e,idAt:a=>this.rowModel.getRow(a).id,toggle:t,range:n});if(this.rowModel.rows()!==this.rowModel.dataRows()||this.options.isRowSelectable)for(let a of s.selected){if(this.store.state.selected.has(a))continue;let l=this.rowModel.indexOfId(a),d=l>=0?this.rowModel.getRow(l):null;d&&(d.kind||!this.rowSelectable(d.data))&&s.selected.delete(a)}if(o==="multiple"&&this.options.groupSelectsChildren&&this.options.treeData&&r.hasChildren){let a=s.selected.has(r.id);for(let l of this.groupMemberIds(r))a?s.selected.add(l):s.selected.delete(l)}this.setSelected(s.selected,this.rowModel.getRow(s.anchorIndex)?.id??null)}anchorIndex(){let e=this.store.state.anchorId;if(e==null)return null;let t=this.rowModel.indexOfId(e);return t<0?null:t}selectableRows(){let e=this.rowModel.dataRows();return this.options.isRowSelectable?e.filter(t=>this.rowSelectable(t.data)):e}toggleSelectAll(){let e=this.selectableRows(),t=this.store.state.selected,n=e.length>0&&e.every(r=>t.has(r.id)),o=new Set(t);for(let r of e)n?o.delete(r.id):o.add(r.id);this.setSelected(o)}selectedRows(){let e=this.store.state.selected;return e.size?this.rowModel.allNodes().filter(t=>e.has(t.id)).map(t=>t.data):[]}withSelect(e){let t=[],n=this.options.rowNumbers;if(n){let o=typeof n=="object"?n:{};t.push($n(typeof o.width=="number"&&o.width>0?o.width:void 0,typeof o.header=="string"?o.header:void 0))}return this.options.rowDrag&&t.push(Dn),this.options.rowSelection&&t.push(In),[...t,...e]}setData(e,t){if(this.clientOnly("setData"))return;if(!Array.isArray(e)){O("setData: rows must be an array");return}this.editor.cancel(),this.tracker.reset(),this.history.clear(),this.detailOpen.clear(),this.treeLoaded.clear(),this.treeLoading.clear(),this.renderer.dropDetail(),this.store.set({data:he(e)}),t?.scrollToTop&&this.renderer.setScroll({top:0,left:0});let n=this.store.state.selected;if(n.size)if(this.options.getRowId){let s=new Set(this.rowModel.allNodes().map(l=>l.id)),a=new Set([...n].filter(l=>s.has(l)));a.size!==n.size&&this.setSelected(a)}else this.setSelected(new Set,null);let o=this.rowModel.getRowCount(),r=this.store.state.focus;r&&r.rowIndex>=o&&this.store.set({focus:o?{...r,rowIndex:o-1}:null})}setColumns(e){if(!Array.isArray(e)){O("setColumns: columns must be an array");return}if(this.menu.close(),this.sourceDefs=e,this.pivotCfg){this.rebuildPivot();return}this.columns.setDefs(this.withSelect(e));let t=o=>!!this.columns.getNode(o),n=this.groupBy.filter(t);n.length!==this.groupBy.length&&(this.groupBy=n,this.groupPanel?.refresh(),this.events.emit("groupChange",{groupBy:[...n]})),this.store.set({sort:this.store.state.sort.filter(o=>t(o.colId)),filters:Object.fromEntries(Object.entries(this.store.state.filters).filter(([o])=>t(o))),focus:null}),this.columnsChanged()}onChange(e){let t=(...o)=>o.some(r=>e.includes(r));this.pivotCfg&&t("data","locale")&&this.rebuildPivot(!1),t("locale")&&(this.menu.close(),this.chooser.close(),this.sideBar?.refresh(),this.rowModel.invalidate());let n=t("sort","filters","quickFilter","advancedFilter")&&this.page!==0;n&&(this.page=0),t("data","sort","filters","quickFilter","advancedFilter","locale")&&this.updateRows(),n&&this.emitPage(),t("data","sort","filters","quickFilter","advancedFilter")&&this.store.state.range&&!this.keepRange&&this.setRange(null),t("data","sort","filters","quickFilter","advancedFilter","locale")&&this.finder.refresh(),(t("data","filters","quickFilter","advancedFilter","locale")||t("selected")&&this.summaryOpts?.scope==="selected")&&this.refreshSummary(),t("locale")&&this.groupPanel?.refresh(),t("filters")&&this.sideBar?.refresh(),t("theme")&&this.renderer.applyTheme(),this.renderer.invalidate({header:t("sort","filters","quickFilter","advancedFilter","locale","selected","data"),rows:t("data","sort","filters","quickFilter","advancedFilter","locale")})}createApi(){let e=t=>((...n)=>{if(this.destroyed){O("API called after destroy()");return}return t(...n)});return{setData:e((t,n)=>this.setData(t,n)),getData:e(()=>this.store.state.data),setColumns:e(t=>this.setColumns(t)),getColumnState:e(()=>this.columns.getState()),applyColumnState:e(t=>{this.columns.applyState(t),this.columnsChanged()}),setSort:e(t=>this.setSort(t)),getSort:e(()=>[...this.store.state.sort]),setFilter:e((t,n)=>this.setFilter(t,n)),getFilterModel:e(()=>({...this.store.state.filters})),setQuickFilter:e(t=>this.store.set({quickFilter:t??""})),getSelectedRows:e(()=>this.selectedRows()),selectAll:e(()=>this.setSelected(new Set([...this.store.state.selected,...this.selectableRows().map(t=>t.id)]))),deselectAll:e(()=>this.setSelected(new Set,null)),getDisplayedRowCount:e(()=>this.rowModel.getRowCount()),scrollToRow:e(t=>this.renderer.scrollToRow(t)),validate:e(()=>this.validateAll()),setDensity:e(t=>this.setDensity(t)),getDensity:e(()=>this.density),showOverlay:e(t=>{this.forcedOverlay=t==="loading"||t==="noRows"?t:null,this.renderer.invalidate()}),getXlsxSheet:e(t=>Zt(this,t)),print:e(t=>fo(Xt(this,t))),getPrintHtml:e(t=>Xt(this,t)),setColumnGroupOpened:e((t,n)=>this.setColumnGroupOpened(t,n)),setAdvancedFilter:e(t=>this.setAdvancedFilter(t)),getAdvancedFilter:e(()=>this.store.state.advancedFilter?JSON.parse(JSON.stringify(this.store.state.advancedFilter)):null),openFilterBuilder:e(()=>this.filterBuilder.open()),isColumnGroupOpened:e(t=>!!this.columns.getNode(t)?.open),applyTransaction:e(t=>this.applyTransaction(t)),applyTransactionAsync:e(t=>this.applyTransactionAsync(t)),getState:e(()=>this.getState()),setState:e((t,n)=>this.setState(t,n)),getScrollPosition:e(()=>this.renderer.getScroll()),setScrollPosition:e(t=>this.renderer.setScroll(t??{})),syncScroll:e((t,n="both")=>this.syncScroll(t,n)),setTheme:e(t=>this.store.set({theme:t})),setLocale:e(t=>this.store.set({locale:Ve(t)})),setFont:e(t=>this.setFont(t)),setColumnVisible:e((t,n)=>this.setColumnsVisible([t],n)),autoSizeColumns:e(t=>this.autoSize(t)),resetColumnState:e(()=>this.resetColumns()),openColumnChooser:e(()=>this.chooser.open()),closeColumnChooser:e(()=>this.chooser.close()),toggleSideBar:e((t,n)=>this.sideBar?.toggle(t,n)),setSummary:e(t=>this.setSummary(t)),getSummaryValues:e(()=>this.summaryValues.map(t=>({...t}))),getRange:e(()=>{let t=this.store.state.range;return t&&{start:{...t.start},end:{...t.end}}}),setRange:e(t=>this.setRange(t)),getRanges:e(()=>this.getRanges()),setRanges:e(t=>this.setRanges(t)),copySelection:e(t=>this.copyToClipboard(!!t?.headers,!!t?.rows)),pasteText:e(t=>this.pasteText(t)),cutSelection:e(()=>this.cutToClipboard()),stopRowEdit:e(t=>this.editor.endRow(!t)),startEdit:e((t,n)=>this.editor.start(t,n)),stopEdit:e(t=>t?this.editor.cancel():void this.editor.commit(null)),addRows:e((t,n)=>this.addRows(t,n)),removeRows:e(t=>this.removeRows(t)),removeSelectedRows:e(()=>this.removeRows(this.selectedRows())),getModifiedRows:e(()=>this.getModifiedRows()),getChanges:e(()=>this.getChanges()),hasChanges:e(()=>this.hasChanges()),commitChanges:e(t=>this.commitChanges(t)),revertChanges:e(()=>this.revertChanges()),undo:e(()=>this.undo()),redo:e(()=>this.redo()),canUndo:e(()=>this.history.canUndo()),canRedo:e(()=>this.history.canRedo()),fillRange:e(t=>this.fillRange(t)),setPinnedRows:e(t=>this.setPinnedRows(t)),find:e(t=>this.finder.find(t)),findNext:e(()=>this.finder.next()),findPrevious:e(()=>this.finder.previous()),clearFind:e(()=>this.finder.clear()),setGroupBy:e(t=>this.setGroupBy(t)),getGroupBy:e(()=>this.getGroupBy()),setGroupExpanded:e((t,n)=>this.setGroupExpanded(t,n)),expandAll:e(()=>this.expandAll(!0)),collapseAll:e(()=>this.expandAll(!1)),setDetailExpanded:e((t,n)=>this.setDetailExpanded(t,n)),isDetailExpanded:e(t=>this.isDetailExpanded(t)),moveRow:e((t,n)=>this.moveRow(t,n)),dropRow:e((t,n,o)=>this.dropRow(t,n,o)),setPage:e(t=>this.setPage(t)),getPage:e(()=>this.getPage()),getPageCount:e(()=>this.getPageCount()),setPageSize:e(t=>this.setPageSize(t)),getPageSize:e(()=>this.getPageSize()),refreshRows:e(()=>this.refreshRows()),setPivot:e(t=>this.setPivot(t)),getPivot:e(()=>this.getPivot()),createChart:e(t=>this.charts.create(t)),getCsv:e(t=>Yt(this,t)),exportCsv:e((t="export.csv",n)=>Oe(t,["\uFEFF",Yt(this,n)],"text/csv;charset=utf-8")),getXlsx:e(t=>Jt(this,t)),exportXlsx:e((t="export.xlsx",n)=>Oe(t,[Jt(this,n)],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")),importFile:e((t,n)=>go(this,t,n)),on:e((t,n)=>this.events.on(t,n)),destroy:()=>this.destroy()}}destroy(){if(!this.destroyed){this.destroyed=!0,tt.delete(this.renderer.root),clearTimeout(this.flashTimer),clearTimeout(this.txTimer);for(let e of this.disposers)e();this.renderer.destroy(),this.events.clear()}}};function Ei(i,e){return new fn(i,e).api}function Ao(i){let e=(Array.isArray(i)?i:[]).filter(t=>t&&t.grid&&typeof t.grid.getXlsxSheet=="function");return e.length?Ee(e.map((t,n)=>t.grid.getXlsxSheet({...t.options,sheetName:t.sheetName??t.options?.sheetName??`Sheet${n+1}`}))):(O("buildWorkbook: no grids given; the file has one empty sheet"),Ee([{name:"Sheet1",rows:[]}]))}function Li(i,e){Oe(i||"export.xlsx",[Ao(e)],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")}var Ti=i=>typeof i=="function"?i():i??{};async function Po(i,e,t,n){let o=i,r=i.split(/[?#]/)[0],s={method:e,credentials:n.credentials??"same-origin",headers:{Accept:"application/json",...Ti(n.headers)}};if(e==="GET"){let d=new URLSearchParams;for(let[c,u]of Object.entries(t))u!==void 0&&d.set(c,typeof u=="string"?u:JSON.stringify(u));o+=(i.includes("?")?"&":"?")+d.toString()}else s.headers["Content-Type"]="application/json",s.body=JSON.stringify(t);let a=await fetch(o,s);if(!a.ok)throw new Error(`HTTP ${a.status} from ${r}`);let l=await a.text();if(!l)return null;try{return JSON.parse(l)}catch{throw new Error(`HTTP ${a.status} from ${r}: the response is not JSON`)}}function Ii(i){if(Array.isArray(i))return{rows:i};let e=i??{},t=[e.rows,e.list,e.content,e.data,e.items,e.resultList].find(Array.isArray),n=[e.total,e.totalCount,e.totalElements,e.totCnt,e.count].find(o=>typeof o=="number");return{rows:(t??[]).filter(o=>o!==null&&typeof o=="object"),total:n}}function Fo(i,e={}){return{async getRows(t){let n=Math.max(1,t.end-t.start),o={start:t.start,end:t.end,page:Math.floor(t.start/n),size:n,sort:t.sort,filters:t.filters,quickFilter:t.quickFilter,advancedFilter:t.advancedFilter??void 0,groupBy:t.groupBy,groupKeys:t.groupKeys,...e.params?.()??{}},r=await Po(i,e.method??"POST",o,e);return(e.transform??Ii)(r)}}}var pn=new WeakMap;function Di(i,e,t={}){let n=pn.get(i);if(n)return n;if(!i.hasChanges())return Promise.resolve(null);let{created:o,updated:r,deleted:s}=i.getModifiedRows(),a=new Map([...o,...r].map(d=>[d,{...d}])),l=(async()=>{let d=await Po(e,"POST",{created:o,updated:r,deleted:s,...t.params?.()??{}},t);return i.commitChanges({rows:a,deleted:s}),d})().finally(()=>pn.delete(i));return pn.set(i,l),l}async function $i(i,e,t={}){let{rows:n}=await Fo(e,t).getRows({start:0,end:t.maxRows??1e4,sort:[],filters:{},quickFilter:""});return i.setData(n),n}function Ai(i=document){let e=i.querySelector('meta[name="_csrf"]')?.content,t=i.querySelector('meta[name="_csrf_header"]')?.content||"X-CSRF-TOKEN";return e?{[t]:e}:{}}var Pi={en:se,ko:xn,"zh-CN":Cn,"zh-TW":Rn,ja:bn,es:vn,fr:yn,de:wn,vi:kn,th:Sn,id:Mn,ru:En,"pt-BR":Ln,it:Tn};for(let i of Object.values(Pi))Et(i);export{Ao as buildWorkbook,Ei as createGrid,Ai as csrfHeaders,se as en,Li as exportWorkbook,$i as loadData,Pi as locales,qt as parseCsv,Kt as readXlsx,Et as registerLocale,tn as renderChart,Ve as resolveLocale,Fo as restDatasource,Di as saveChanges,mi as setLicenseKey,ko as verifyLicense,xt as version,Ee as writeXlsx};
46
+ `,_t=o=>typeof o=="string"&&/^(#[0-9a-f]{3,8}|[a-z]+|rgba?\([\d\s.,%]+\)|hsla?\([\d\s.,%deg]+\))$/i.test(o.trim())?o.trim():void 0;function Qt(o,e={}){let t=Yt(o,e.columns),n=o.store.state.locale,r=n.code,s=t.map(R=>X(R.def,r)),i=new Intl.NumberFormat(r),a=e.rowNumbers??!!o.options.rowNumbers,l=R=>$i.includes(R.align)?R.align:R.type==="number"?"right":R.type==="boolean"?"center":"left",d=t.map(R=>{let M=[];for(let A=R.node;A;A=A.parent)M.unshift(A);return M}),c=Math.max(1,...d.map(R=>R.length)),u=[];if(e.headers!==!1)for(let R=0;R<c;R++){let M=R===0&&a?[{text:"#",align:"right",num:!0,rowspan:c}]:[];for(let A=0;A<t.length;A++){let L=d[A],F=L.length-1;if(R<F){let D=L[R];if(A>0&&d[A-1][R]===D)continue;let I=1;for(;A+I<t.length&&d[A+I][R]===D;)I++;M.push({text:Ne(D.def,D.id),align:I>1?"center":"left",span:I,group:!0})}else R===F&&M.push({text:Ne(t[A].def,t[A].id),align:l(t[A].def),span:1,rowspan:c-R})}u.push(M)}let f=(R,M,A,L)=>{if(A==null||A==="")return"";if(L==="count")return i.format(A);let F=R.def.type??(typeof A=="number"?"number":A instanceof Date?"date":void 0);return F===R.def.type?s[M](A):X({...R.def,type:F},r)(A)},p=(R,M,A,L=0)=>{let F=0;for(;F<t.length-1&&!A[F];)F++;F=Math.max(1,F);let D=a?[{text:"",align:"right",num:!0}]:[];D.push({text:M,align:"left",span:F,indent:L});for(let I=F;I<t.length;I++)D.push({text:A[I]??"",align:l(t[I].def)});return{kind:R,level:L,cells:D}},g=Zt(o,e.rows),y=e.groups!==!1&&!o.rowModel.server&&!o.options.treeData?o.getGroupBy():[],w=e.styles!==!1&&t.some(R=>R.def.cellClass)?Er(o):null,h=[];try{for(let R of Gi(o,g,y)){if(R.kind==="group"){let L=o.columns.getNode(R.colId)?.def,F=W(R.value)?n.blanks:L?X(L,r)(R.value):String(R.value),D=`${L?Ne(L,R.colId):R.colId}: ${F} (${i.format(R.rows.length)})`,I=t.map((N,z)=>{if(!(!N.def.aggFunc||y.includes(N.id)))try{return f(N,z,Re(N.def.aggFunc,R.rows.map(U=>G(N.def,U)),R.rows),N.def.aggFunc)||void 0}catch{return}});h.push(p("group",D,I,R.level));continue}let M=R.row,A=a?[{text:String(R.n),align:"right",num:!0}]:[];t.forEach((L,F)=>{let D=G(L.def,M),I=W(D)?"":s[F](D),N={text:I,align:l(L.def)};if(w&&L.def.cellClass){let U;try{U=typeof L.def.cellClass=="function"?L.def.cellClass({value:D,formatted:I,row:M,rowIndex:R.n-1,column:L.def}):L.def.cellClass}catch{U=void 0}if(U){let K=w.of(U);K.color&&(N.color=Rr(K.color)),K.fill&&(N.fill=Rr(K.fill)),K.bold&&(N.bold=!0)}}let z=e.styles!==!1?o.cellFormat(M,L.id,D):null;if(z){let U=z.style;_t(U.color)&&(N.color=_t(U.color)),_t(U.background)&&(N.fill=_t(U.background)),U.bold&&(N.bold=!0),U.italic&&(N.italic=!0),U.strike&&(N.strike=!0),z.bar&&(N.bar={from:z.bar.from,to:z.bar.to,color:/^#[0-9a-f]{3,8}$/i.test(z.bar.color)?z.bar.color:"#93c5fd"}),z.icon&&(N.icon={char:z.icon.char,color:z.icon.color})}A.push(N)}),h.push({kind:"row",cells:A})}}finally{w?.dispose()}let m=[],b=e.summary!==!1?o.summary():null;b&&b.opts.rows.forEach((R,M)=>{let A=t.map((L,F)=>{let D=R.columns?.[L.id];return D===void 0?void 0:f(L,F,b.values[M]?.[L.id],Ze(D).agg)||void 0});m.push(p("total",R.label??"",A))});let v=t.map(R=>Math.max(1,R.width)),C=v.reduce((R,M)=>R+M,0),S=Oi.includes(e.paper)?e.paper:"A4",T=e.orientation==="portrait"||e.orientation==="landscape"?e.orientation:C+(a?40:0)>Bi?"landscape":"portrait",k=e.printedAt!==!1?new Intl.DateTimeFormat(r,{dateStyle:"medium",timeStyle:"short"}).format(new Date):"",E=Number.isInteger(e.repeatRows)&&e.repeatRows>0?Math.min(e.repeatRows,h.length):0;return{lang:r,title:e.title??"",subtitle:e.subtitle??"",printed:k,footer:e.footer??"",paper:S,orientation:T,fit:e.fitToWidth!==!1,numbered:a,widths:a?[40,...v]:v,head:u,body:h,foot:m,striped:e.striped!==!1,pageNumbers:e.pageNumbers!==!1,repeatHeader:e.repeatHeader!==!1,repeatTitle:!!e.repeatTitle,repeatRows:E}}function Vi(o,e=!1){let t=e?o.align==="left"||o.group?"":`text-align:${o.align}`:`text-align:${o.align}`,n=r=>{t+=t?`;${r}`:r};if(o.indent&&n(`padding-left:${7+o.indent*14}px`),o.color&&n(`color:${o.color}`),o.fill&&n(`background:${o.fill}`),o.bold&&n("font-weight:600"),o.italic&&n("font-style:italic"),o.strike&&n("text-decoration:line-through"),o.bar){let r=(o.bar.from*100).toFixed(1),s=(o.bar.to*100).toFixed(1);n(`background-image:linear-gradient(to right,transparent ${r}%,${o.bar.color}66 ${r}%,${o.bar.color}66 ${s}%,transparent ${s}%)`)}return t}function Sr(o,e){let t=[o.num?' class="num"':o.group&&(o.span??1)>1?' class="span"':"",o.span!==void 0&&(e==="th"||o.span>1)?` colspan="${o.span}"`:"",o.rowspan!==void 0&&e==="th"?` rowspan="${o.rowspan}"`:""].join("");if(o.num)return`<${e}${t}>${we(o.text)}</${e}>`;let n=Vi(o,e==="th"),r=o.icon?`<span style="color:${we(o.icon.color)};margin-right:5px">${we(o.icon.char)}</span>`:"";return`<${e}${t}${n?` style="${we(n)}"`:""}>${r}${we(o.text)}</${e}>`}var Hn=o=>`<tr${o.kind==="group"?` class="group level-${Math.min(o.level??0,5)}"`:o.kind==="total"?' class="total"':""}>${o.cells.map(e=>Sr(e,"td")).join("")}</tr>`;function Gn(o,e={}){let t=Qt(o,e),n=t.widths.slice(t.numbered?1:0).reduce((m,b)=>m+b,0),r=t.fit?`<colgroup>${t.numbered?'<col style="width:40px">':""}${t.widths.slice(t.numbered?1:0).map(m=>`<col style="width:${Math.round(m/n*1e3)/10}%">`).join("")}</colgroup>`:"",s=we(t.title||(typeof document<"u"?document.title:"")||""),i=t.title||t.subtitle?`<div>${t.title?`<h1>${s}</h1>`:""}${t.subtitle?`<p class="sub">${we(t.subtitle)}</p>`:""}</div>`:"<div></div>",a=t.title||t.subtitle||t.printed?`<header>${i}${t.printed?`<p class="printed">${we(t.printed)}</p>`:""}</header>`:"",l="font: 8.5px system-ui, sans-serif; color: #6b7280;",d=[`size: ${t.paper} ${t.orientation}; margin: 12mm 12mm 14mm;`,t.footer?`@bottom-left { content: ${Hi(t.footer)}; ${l} }`:"",t.pageNumbers?`@bottom-right { content: counter(page) " / " counter(pages); ${l} }`:""].join(" "),c=t.striped?"tbody tr:not(.group):nth-child(even) td { background: #f9fafb; }":"",u=t.head.map(m=>`<tr>${m.map(b=>Sr(b,"th")).join("")}</tr>`).join(""),f=t.body.slice(0,t.repeatRows).map(Hn).join(""),p=Math.max(1,t.widths.length),g=t.repeatTitle&&a?`<tr class="title"><td colspan="${p}">${a}</td></tr>`:"",y=t.repeatHeader?`${g}${u}${f}`:`${g}${f}`,w=(t.repeatHeader?"":u)+t.body.slice(t.repeatRows).map(Hn).join(""),h=t.foot.map(Hn).join("");return`<!doctype html><html lang="${we(t.lang)}"><head><meta charset="utf-8"><title>${s}</title><style>
47
+ @page { ${d} }${zi}${c}
48
+ </style></head><body>${t.repeatTitle?"":a}<table${t.fit?' class="fit"':""}>${r}<thead>${y}</thead><tbody>${w}</tbody>${h?`<tfoot>${h}</tfoot>`:""}</table></body></html>`}function Mr(o){if(typeof document>"u")return;let e=document.createElement("iframe");e.style.cssText="position:fixed;right:0;bottom:0;width:0;height:0;border:0",document.body.append(e);let t=e.contentDocument;if(!t||!e.contentWindow){e.remove(),B("printing is not supported in this environment");return}t.open(),t.write(o),t.close();let n=e.contentWindow,r=()=>setTimeout(()=>e.remove(),1e3);n.addEventListener("afterprint",r),setTimeout(()=>{try{n.focus(),n.print()}catch{B("printing is not supported in this environment")}r()},50)}function zn(o,e={}){let t=Yt(o,e.columns),n=o.store.state.locale.code,r=typeof e.separator=="string"&&e.separator.length===1?e.separator:",",s=Zt(o,e.rows).map(i=>t.map(a=>{let l=G(a.def,i),d=a.def.type,c=Nt(a.def,l,n);return{value:c,text:!(d==="number"||d==="date"||d==="boolean")||typeof l=="string"&&!Ni.test(c)}}));return e.headers!==!1&&s.unshift(t.map(i=>({value:Ne(i.def,i.id),text:!0}))),wr(s,r)}function Vn(o,e={}){let t=Yt(o,e.columns),n=o.store.state.locale.code,r=e.formatted?t.map(l=>X(l.def,n)):null,s=t.map(l=>e.keys==="header"?Ne(l.def,l.id):l.id),i=Zt(o,e.rows).map(l=>{let d={};return t.forEach((c,u)=>{let f=G(c.def,l);d[s[u]]=r?W(f)?"":r[u](f):f===void 0?null:f}),d}),a=typeof e.space=="number"&&e.space>=0?Math.min(10,e.space):2;return JSON.stringify(i,null,a)}function qi(o){let e=o.format;if(o.type==="date")return e==="datetime"?"yyyy-mm-dd hh:mm":e==="time"?"hh:mm":"yyyy-mm-dd";if(o.type!=="number"||e==null)return null;if(typeof e=="string")return e==="integer"?"#,##0":e==="percent"?"0%":e.startsWith("currency:")?"#,##0.##":/^[#0,.%]+$/.test(e)?e:null;let t=e,n=t.maximumFractionDigits??t.minimumFractionDigits,r=n?`.${"0".repeat(Math.min(10,n))}`:"";return t.style==="percent"?`0${r}%`:`${t.useGrouping===!1?"0":"#,##0"}${r}`}function Xt(o){let e=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(o.trim());if(e)return`FF${(e[1].length===3?[...e[1]].map(s=>s+s).join(""):e[1]).toUpperCase()}`;let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,/]+([\d.]+%?))?\s*\)$/i.exec(o.trim());return!t||!((t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]))>0)?"":`FF${[t[1],t[2],t[3]].map(r=>Math.min(255,Number(r)).toString(16).padStart(2,"0")).join("").toUpperCase()}`}function Er(o){let e=o.renderer.root;if(typeof getComputedStyle!="function"||!e.isConnected)return{of:()=>({}),dispose:()=>{}};let t=document.createElement("div");t.className="fg-row",t.style.cssText="position:absolute;left:-9999px;top:0;visibility:hidden;pointer-events:none";let n=document.createElement("div");t.append(n),e.append(t);let r=a=>{n.className=a?`fg-cell ${a}`:"fg-cell";let l=getComputedStyle(n),d=l.fontWeight;return{color:l.color,fill:l.backgroundColor,bold:d==="bold"||Number(d)>=600}},s=r(""),i=new Map;return{of(a){let l=i.get(a);if(!l){let d=r(a);l={},d.color!==s.color&&Xt(d.color)&&(l.color=Xt(d.color)),d.fill!==s.fill&&Xt(d.fill)&&(l.fill=Xt(d.fill)),d.bold&&!s.bold&&(l.bold=!0),i.set(a,l)}return l},dispose:()=>t.remove()}}function qn(o,e={}){return Ke([Wn(o,e)])}function Wn(o,e={}){let t=Yt(o,e.columns),n=o.store.state.locale.code,r=[],s=[],i=0;if(e.headers!==!1){let w=t.map(m=>{let b=[];for(let v=m.node;v;v=v.parent)b.unshift(v);return b});i=Math.max(1,...w.map(m=>m.length));let h=m=>{let b="";for(let v=m+1;v>0;v=Math.floor((v-1)/26))b=String.fromCharCode(65+(v-1)%26)+b;return b};for(let m=0;m<i;m++){let b=[];for(let v=0;v<t.length;v++){let C=w[v],S=C.length-1;if(m<S){let T=C[m],k=v>0?w[v-1][m]:null;if(b.push({v:k===T?null:Ne(T.def,T.id),header:!0}),k!==T){let E=v;for(;E+1<t.length&&w[E+1][m]===T;)E++;E>v&&s.push(`${h(v)}${m+1}:${h(E)}${m+1}`)}}else m===S?(b.push({v:Ne(t[v].def,t[v].id),header:!0}),i-1>m&&s.push(`${h(v)}${m+1}:${h(v)}${i}`)):b.push({v:null,header:!0})}r.push(b)}}let a=t.map(w=>qi(w.def)),l=t.map(w=>X(w.def,n)),d=Zt(o,e.rows),c=e.styles!==!1,u=c&&t.some(w=>w.def.cellClass)?Er(o):null,f=(w,h,m)=>{if(W(m))return null;let b=a[h]??void 0;switch(w.def.type){case"number":{let v=typeof m=="number"?m:Number(m);return Number.isFinite(v)?{v,fmt:b}:String(m)}case"date":{let v=ue(m);return v?{v,fmt:b}:String(m)}case"boolean":return typeof m=="boolean"?m:String(m);default:return l[h](m)}};try{d.forEach((w,h)=>{r.push(t.map((m,b)=>{let v=G(m.def,w),C=f(m,b,v);if(!c)return C;let S=m.def.align?{align:m.def.align}:{};if(u&&m.def.cellClass){let k;try{k=typeof m.def.cellClass=="function"?m.def.cellClass({value:v,formatted:l[b](v),row:w,rowIndex:h,column:m.def}):m.def.cellClass}catch{k=void 0}k&&(S={...S,...u.of(k)})}let T=o.cellFormat(w,m.id,v);if(T){let k=Dn(T.style.color),E=Dn(T.style.background);k&&(S.color=k),E&&(S.fill=E),T.style.bold&&(S.bold=!0)}return Object.keys(S).length?C!==null&&typeof C=="object"&&!(C instanceof Date)?{...C,...S}:{v:C,...S}:C}))})}finally{u?.dispose()}let p=new Set,g=w=>{let h="";for(let m=w+1;m>0;m=Math.floor((m-1)/26))h=String.fromCharCode(65+(m-1)%26)+h;return h},y=(w,h,m,b)=>{for(let v=w;v<=m;v++)for(let C=h;C<=b;C++)if(p.has(`${v},${C}`))return;for(let v=w;v<=m;v++)for(let C=h;C<=b;C++)p.add(`${v},${C}`);s.push(`${g(h)}${i+w+1}:${g(b)}${i+m+1}`)};return d.forEach((w,h)=>t.forEach((m,b)=>{let v=m.def.colSpan?Qe(m.def.colSpan,m.def,w,h,t.length-b):1;v>1&&y(h,b,h,b+v-1)})),t.forEach((w,h)=>{if(!w.def.merge&&!w.def.rowSpan)return;let m=Ct(d,w.def);for(let b=0;b<d.length;b++)m.start[b]===b&&m.end[b]>b&&y(b,h,m.end[b],h)}),{name:e.sheetName??"Sheet1",rows:r,widths:t.map(w=>Math.round(w.width/7)),merges:s,freezeRows:i,printTitleRows:e.repeatHeader===!1?0:i+(Number.isInteger(e.repeatRows)&&e.repeatRows>0?e.repeatRows:0),autoFilter:i>0}}function Oe(o,e,t){if(typeof URL>"u"||typeof URL.createObjectURL!="function"||typeof document>"u"){B("downloads are not supported in this environment");return}let n=URL.createObjectURL(new Blob(e,{type:t})),r=document.createElement("a");r.href=n,r.download=o,r.style.display="none",document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}var Jt=o=>String(o??"").trim().toLowerCase();function Wi(o){return o==null?"":o instanceof Date?o.getHours()||o.getMinutes()||o.getSeconds()?o.toISOString():ne(o)??"":String(o)}async function Ar(o,e,t={}){let n=e instanceof Uint8Array?e:new Uint8Array(e instanceof ArrayBuffer?e:await e.arrayBuffer()),r;if(jt(n)){let y=await Bn(n),w=typeof t.sheet=="string"?y.find(h=>h.name===t.sheet):y[typeof t.sheet=="number"?t.sheet:0];if(!w)throw new Error(`Sheet ${String(t.sheet)} not found`);r=w.rows}else{let y=new TextDecoder().decode(n);r=$n(y,In(y))}if(!r.length)return{rows:[],skipped:0};let s=[],i=y=>y.forEach(w=>w.children?i(w.children):!$(w.id)&&w.def.field&&s.push(w));i(o.columns.roots());let a=y=>{let w=Jt(y);return w?s.find(h=>Jt(h.def.header)===w)??s.find(h=>Jt(h.def.field)===w||Jt(h.id)===w)??null:null},l=1,d=new Set(r[0].map(a).filter(Boolean));for(;l<Math.min(r.length,5);){let w=(r[l]??[]).filter(m=>m!=null&&String(m).trim()!==""),h=w.map(a).filter(m=>m&&!d.has(m));if(!w.length||!w.every(m=>typeof m=="string")||!h.length)break;h.forEach(m=>d.add(m)),l++}let c=Math.max(...r.slice(0,l).map(y=>y?.length??0)),u=Array.from({length:c},(y,w)=>{for(let h=l-1;h>=0;h--){let m=r[h]?.[w];if(m!=null&&String(m).trim()!=="")return a(m)}return null}),f=o.store.state.data[0],p=0,g=[];for(let y of r.slice(l)){if(!y||y.every(h=>h==null||String(h).trim()===""))continue;let w={};u.forEach((h,m)=>{if(!h)return;let b=h.def,v=Wi(y[m]),C=o.acceptText(b,w,v,f?.[b.field]);C.ok?v===""&&(C.value===null||C.value==="")||(w[b.field]=C.value):p++}),g.push(w)}return t.mode==="replace"?o.setData(g):o.addRows(g),{rows:g,skipped:p}}var Ui="http://www.w3.org/2000/svg";var Un=["var(--fg-accent, #2563eb)","#f59e0b","#10b981","#ef4444","#8b5cf6","#06b6d4","#ec4899","#84cc16","#f97316","#64748b","#14b8a6","#a855f7"],Se=o=>Un[o%Un.length];function J(o,e={},t=""){let n=document.createElementNS(Ui,o);t&&n.setAttribute("class",t);for(let[r,s]of Object.entries(e))n.setAttribute(r,String(s));return n}function it(o,e){let t=J("title");t.textContent=e,o.append(t)}function jn(o,e,t=5){let n=Math.min(0,o),r=Math.max(0,e);n===r&&(r=n+1);let s=(r-n)/t,i=10**Math.floor(Math.log10(s)),a=[1,2,5,10].map(d=>d*i).find(d=>d>=s);n=Math.floor(n/a)*a,r=Math.ceil(r/a)*a;let l=[];for(let d=n;d<=r+a/2;d+=a)l.push(Math.round(d/a)*a);return l}function Kn(o,e){let t=new Intl.NumberFormat(e.locale,{maximumFractionDigits:2}),n=new Intl.NumberFormat(e.locale,{notation:"compact",maximumFractionDigits:1}),r=J("svg",{viewBox:"0 0 640 360",role:"img",preserveAspectRatio:"xMidYMid meet"},`fg-chart fg-chart-is-${e.type}`);e.title&&r.setAttribute("aria-label",e.title);let s=e.series.slice(0,Un.length),i=e.categories,a=16;if(e.title){let M=J("text",{x:320,y:22,"text-anchor":"middle"},"fg-chart-title");M.textContent=e.title,r.append(M),a=36}let l=J("g",{},"fg-chart-legend"),d=e.type==="pie"||e.type==="donut",c=d?i:e.type==="scatter"?s.slice(1).map(M=>M.name):s.map(M=>M.name),u=16;c.forEach((M,A)=>{let L=J("g",{transform:`translate(${u},350)`},"fg-chart-legend-item");L.append(J("rect",{x:0,y:-9,width:10,height:10,rx:2,fill:Se(A)}));let F=J("text",{x:14,y:0});F.textContent=M,L.append(F),l.append(L),u+=24+Math.min(140,M.length*7)});let f=308;if(e.type==="scatter"){ji(r,e,s,a,f,t,n),r.append(l),o.replaceChildren(r);return}if(d){let M=(s[0]?.values??[]).map(N=>N!==null&&N>0?N:0),A=M.reduce((N,z)=>N+z,0),L=640/2,F=(a+f)/2,D=Math.max(10,(f-a)/2-6),I=-Math.PI/2;M.forEach((N,z)=>{if(!N||!A)return;let U=I+N/A*Math.PI*2,K=U-I>Math.PI?1:0,Z=V=>`${L+D*Math.cos(V)},${F+D*Math.sin(V)}`,P=N===A?`M${L-D},${F}a${D},${D} 0 1,0 ${2*D},0a${D},${D} 0 1,0 ${-2*D},0`:`M${L},${F}L${Z(I)}A${D},${D} 0 ${K} 1 ${Z(U)}Z`,O=J("path",{d:P,fill:Se(z)},"fg-chart-slice");it(O,`${i[z]}: ${t.format(N)} (${Math.round(N/A*1e3)/10}%)`),r.append(O),I=U}),e.type==="donut"&&r.append(J("circle",{cx:L,cy:F,r:D*.58,fill:"var(--fg-bg, #fff)"},"fg-chart-donut-hole")),r.append(l),o.replaceChildren(r);return}let p=e.type==="stackedBar",g=0,y=0;i.forEach((M,A)=>{let L=0,F=0;for(let D of s){let I=D.values[A];I==null||!Number.isFinite(I)||(p?I>=0?L+=I:F+=I:(y=Math.max(y,I),g=Math.min(g,I)))}p&&(y=Math.max(y,L),g=Math.min(g,F))});let w=jn(g,y),h=w[0],m=w[w.length-1],b=56,v=624,C=M=>f-(M-h)/(m-h)*(f-a),S=J("g",{},"fg-chart-axis");for(let M of w){S.append(J("line",{x1:b,x2:v,y1:C(M),y2:C(M)},M===0?"fg-chart-zero":"fg-chart-grid"));let A=J("text",{x:b-6,y:C(M)+4,"text-anchor":"end"});A.textContent=n.format(M),S.append(A)}let T=(v-b)/Math.max(1,i.length),k=Math.max(1,Math.ceil(i.length/Math.floor((v-b)/56)));i.forEach((M,A)=>{if(A%k)return;let L=J("text",{x:b+T*(A+.5),y:f+16,"text-anchor":"middle"}),F=Math.max(3,Math.min(12,Math.floor(T*k/10)));L.textContent=M.length>F?`${M.slice(0,F-1)}\u2026`:M,S.append(L)}),r.append(S);let E=J("g",{},"fg-chart-plot"),R=e.type==="combo";if(R){let M=T*.6,A=s[0];i.forEach((L,F)=>{let D=A?.values[F];if(D==null||!Number.isFinite(D))return;let I=b+T*F+(T-M)/2,N=J("rect",{x:I,y:Math.min(C(0),C(D)),width:Math.max(1,M-2),height:Math.max(.5,Math.abs(C(D)-C(0))),fill:Se(0),rx:2},"fg-chart-bar");it(N,`${A.name} \xB7 ${L}: ${t.format(D)}`),E.append(N)})}if(e.type==="bar"||p){let M=T*.72,A=p?M:M/Math.max(1,s.length);i.forEach((L,F)=>{let D=0,I=0;s.forEach((N,z)=>{let U=N.values[F];if(U==null||!Number.isFinite(U))return;let K=0,Z=U;p&&(K=U>=0?D:I,Z=K+U,U>=0?D=Z:I=Z);let P=b+T*F+(T-M)/2+(p?0:A*z),O=J("rect",{x:P,y:Math.min(C(K),C(Z)),width:Math.max(1,A-2),height:Math.max(.5,Math.abs(C(Z)-C(K))),fill:Se(z),rx:2},"fg-chart-bar");it(O,`${N.name} \xB7 ${L}: ${t.format(U)}`),E.append(O)})})}else s.forEach((M,A)=>{if(R&&A===0)return;let L=M.values.map((I,N)=>I==null||!Number.isFinite(I)?null:[b+T*(N+.5),C(I),I]),F="",D=!1;for(let I of L){if(!I){D=!1;continue}F+=`${D?"L":"M"}${I[0]},${I[1]}`,D=!0}if(e.type==="area"){let I=L.filter(N=>!!N);if(I.length){let N=`M${I[0][0]},${C(0)}${I.map(z=>`L${z[0]},${z[1]}`).join("")}L${I[I.length-1][0]},${C(0)}Z`;E.append(J("path",{d:N,fill:Se(A),"fill-opacity":.18},"fg-chart-area"))}}E.append(J("path",{d:F,fill:"none",stroke:Se(A),"stroke-width":2.2,"stroke-linejoin":"round"},"fg-chart-line")),L.forEach((I,N)=>{if(!I)return;let z=J("circle",{cx:I[0],cy:I[1],r:3.5,fill:Se(A)},"fg-chart-point");it(z,`${M.name} \xB7 ${i[N]}: ${t.format(I[2])}`),E.append(z)})});r.append(E,l),o.replaceChildren(r)}function ji(o,e,t,n,r,s,i){let a=t[0]?.values??[],l=t.slice(1),d=C=>C!=null&&Number.isFinite(C),c=a.filter(d),u=l.flatMap(C=>C.values.filter(d));if(!c.length||!u.length)return;let f=jn(Math.min(...c),Math.max(...c)),p=jn(Math.min(...u),Math.max(...u)),g=56,y=624,w=C=>g+(C-f[0])/(f[f.length-1]-f[0])*(y-g),h=C=>r-(C-p[0])/(p[p.length-1]-p[0])*(r-n),m=J("g",{},"fg-chart-axis");for(let C of p){m.append(J("line",{x1:g,x2:y,y1:h(C),y2:h(C)},C===0?"fg-chart-zero":"fg-chart-grid"));let S=J("text",{x:g-6,y:h(C)+4,"text-anchor":"end"});S.textContent=i.format(C),m.append(S)}f.forEach((C,S)=>{let T=S===0?"start":S===f.length-1?"end":"middle",k=J("text",{x:w(C),y:r+16,"text-anchor":T});k.textContent=i.format(C),m.append(k)});let b=J("text",{x:y,y:r+32,"text-anchor":"end"},"fg-chart-axis-name");b.textContent=`${t[0]?.name??""} \u2192`,m.append(b),o.append(m);let v=J("g",{},"fg-chart-plot");a.forEach((C,S)=>{d(C)&&l.forEach((T,k)=>{let E=T.values[S];if(!d(E))return;let R=J("circle",{cx:w(C),cy:h(E),r:4,fill:Se(k),"fill-opacity":.8},"fg-chart-point");it(R,`${e.categories[S]??""}: ${t[0].name} ${s.format(C)}, ${T.name} ${s.format(E)}`),v.append(R)})}),o.append(v)}var Ki=12,Tr=500,_n=["bar","stackedBar","line","area","combo","pie","donut","scatter"],en=class{constructor(e){this.grid=e;this.handles=new Set}create(e={}){let{grid:t}=this,n=_n.includes(e.type)?e.type:"bar",r=()=>t.store.state.locale,s=e.range??t.store.state.range,i=null;if(s){let y=t.columns.getColumn(s.start.colId),w=t.columns.getColumn(s.end.colId);if(y&&w){let h=nt({start:{rowIndex:s.start.rowIndex,colIndex:y.index},end:{rowIndex:s.end.rowIndex,colIndex:w.index}}),m=[];for(let b=h.r1;b<=h.r2&&m.length<Tr;b++){let v=t.rowModel.getRow(b);v&&!v.kind&&m.push(v.data)}i={rows:m,colIds:t.columns.displayed().slice(h.c1,h.c2+1).filter(b=>!$(b.id)).map(b=>b.id)}}}let a=()=>{let y=i?i.rows:t.rowModel.dataRows().slice(0,Tr).map(S=>S.data),w=(i?i.colIds.map(S=>t.columns.getColumn(S)):t.columns.displayed().filter(S=>!$(S.id))).filter(S=>!!S),h=w[0]&&w[0].def.type!=="number"?w[0]:i?null:w.find(S=>S.def.type!=="number")??null,m=S=>!!S.node.parent&&S.node.parent.id==="pivotgroup|total",b=w.filter(S=>S!==h&&S.def.type==="number"&&(i||!m(S))).slice(0,Ki),v=S=>{let T=[];for(let k=S.node.parent;k;k=k.parent)T.unshift(k.def.header??k.id);return T.push(S.def.header??S.def.field??S.id),T.join(" \xB7 ")},C=h?X(h.def,r().code):null;return{categories:y.map((S,T)=>h&&C?C(G(h.def,S)):String(T+1)),series:b.map(S=>({name:v(S),values:y.map(T=>{let k=G(S.def,T),E=typeof k=="number"?k:k==null||k===""?NaN:Number(k);return Number.isFinite(E)?E:null})}))}},l=x("div","fg-chart-body"),d=null,c=()=>Kn(l,{type:n,title:e.title,locale:r().code,...a()}),u=y=>({bar:r().chartBar,stackedBar:r().chartStacked,line:r().chartLine,area:r().chartArea,pie:r().chartPie,donut:r().chartDonut,combo:r().chartCombo,scatter:r().chartScatter})[y],f=()=>d?.querySelectorAll(".fg-chart-type").forEach(y=>y.setAttribute("aria-pressed",String(y.dataset.type===n)));if(e.container)e.container.append(l);else{d=x("div","fg-chart-panel",{role:"dialog","aria-label":e.title??u(n)});let y=x("div","fg-chart-head");for(let h of _n){let m=x("button","fg-chart-type",{type:"button",title:u(h)});m.dataset.type=h,m.textContent=u(h),m.addEventListener("click",()=>g.setType(h)),y.append(m)}let w=x("button","fg-chooser-close",{type:"button","aria-label":r().close});w.textContent="\xD7",w.addEventListener("click",()=>g.destroy()),y.append(x("span","fg-chart-spacer"),w),d.append(y,l),t.renderer.root.append(d)}let p=[t.events.on("cellValueChanged",()=>c()),t.events.on("rowsAdded",()=>c()),t.events.on("rowsRemoved",()=>c())];i||p.push(t.events.on("sortChange",()=>c()),t.events.on("filterChange",()=>c()));let g={el:l,setType:y=>{_n.includes(y)&&(n=y,f(),c())},update:()=>c(),destroy:()=>{p.forEach(y=>y()),(d??l).remove(),this.handles.delete(g)}};return this.handles.add(g),f(),c(),g}destroy(){for(let e of[...this.handles])e.destroy()}};var Lr=new WeakMap,_i=o=>typeof o=="function"?"custom":o;function Xn(o,e){return{rows:(o.rows??[]).filter(e),columns:(o.columns??[]).filter(e),values:(o.values??[]).filter(t=>t&&e(t.colId)).map(t=>({colId:t.colId,aggFunc:t.aggFunc??"sum"})),totals:o.totals!==!1}}function Pr(o,e,t,n,r){let s=Xn(e,b=>!!t(b)),i=new Intl.Collator(r,{numeric:!0,sensitivity:"base"}),a=b=>t(b),l=(b,v)=>b.map(C=>Y(G(a(C),v))).join(""),d=new Map;for(let b of o){let v=l(s.columns,b);d.has(v)||d.set(v,s.columns.map(C=>G(a(C),b)))}let c=[...d.entries()].sort((b,v)=>{for(let C=0;C<s.columns.length;C++){let S=me(b[1][C],v[1][C],i);if(S)return S}return 0});s.columns.length||c.splice(0,c.length,["",[]]);let u=[],f=(b,v,C)=>{let S=s.values[v],T=a(S.colId),k=`pivot|${C}|${v}`;u.push({id:k,comboKey:b,valueIndex:v});let E=M=>b===null||l(s.columns,M)===b,R=S.aggFunc;return{id:k,field:k,header:`${T.header??T.field??S.colId} (${n.agg(_i(R))})`,type:"number",format:R==="count"?"integer":T.format,width:130,aggFunc:(M,A)=>{let L=A.flatMap(F=>Lr.get(F)??[]).filter(E);return L.length?Re(R,L.map(F=>G(T,F)),L):null}}},p=[],g=(b,v)=>{if(W(v))return n.blank;let C=a(b);return C.type==="number"&&!C.format?String(v):X(C,r)(v)};if(!s.columns.length)s.values.forEach((b,v)=>p.push(f("",v,0)));else{let b=(v,C,S)=>{let T=[],k=0;for(;k<v.length;){let E=v[k][1][C],R=Y(E),M=k;for(;M<v.length&&Y(v[M][1][C])===R;)M++;let A=v.slice(k,M),L=C===s.columns.length-1?s.values.map((F,D)=>f(A[0][0],D,S+k)):b(A,C+1,S+k);T.push({id:`pivotgroup|${C}|${S+k}`,header:g(s.columns[C],E),children:L}),k=M}return T};p.push(...b(c,0,0)),s.totals&&s.values.length&&p.push({id:"pivotgroup|total",header:n.total,children:s.values.map((v,C)=>f(null,C,"total"))})}let y=new Map;for(let b of o){let v=l(s.rows,b),C=y.get(v);C||y.set(v,C={values:s.rows.map(S=>G(a(S),b)),src:[]}),C.src.push(b)}let h=[...y.values()].sort((b,v)=>{for(let C=0;C<s.rows.length;C++){let S=me(b.values[C],v.values[C],i);if(S)return S}return 0}).map(b=>{let v={};s.rows.forEach((S,T)=>{v[a(S).field??S]=b.values[T]});let C=new Map;if(s.columns.length)for(let S of b.src){let T=l(s.columns,S),k=C.get(T);k||C.set(T,k=[]),k.push(S)}for(let S of u){let T=s.values[S.valueIndex],k=S.comboKey===null||!s.columns.length?b.src:C.get(S.comboKey)??[],E=a(T.colId);v[S.id]=k.length?Re(T.aggFunc,k.map(R=>G(E,R)),k):null}return Lr.set(v,b.src),v});return{columns:[...s.rows.map(b=>{let v=a(b);return{id:b,field:v.field??b,header:v.header??v.field??b,type:v.type,format:v.format,width:v.width??140}}),...p],rows:h,groupBy:s.rows.slice(0,-1)}}var tn="1.6.0";var Xi={kty:"EC",crv:"P-256",x:"sUTKkglZmk-HMKPNub8p7AeLBKesHCU8irIkw9rJlbE",y:"j0U_aKRDR7iApY9UpaD3hUemhBLZJwDv9-QiT_hUyw8"},Jn="https://freegrid.app/pricing/",Fr="https://freegrid.app/api/usage",Ji="https://freegrid.app/api/domain-status",Dr=o=>{let e=atob(o.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-o.length%4)%4));return Uint8Array.from(e,t=>t.charCodeAt(0))};function Zn(o){let e=o.toLowerCase().replace(/^\[|\]$/g,"");return!e||e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="0.0.0.0"||e.endsWith(".localhost")||e.endsWith(".test")||e.endsWith(".local")||/^(10|192\.168|172\.(1[6-9]|2\d|3[01]))\./.test(e)}function Yi(o,e){let t=o.toLowerCase().replace(/\.$/,"");return e.some(n=>{let r=n.toLowerCase().replace(/\.$/,""),s=r.startsWith("*."),i=s?r.slice(2):r;return i?t===i||t===`www.${i}`?!0:s&&t.endsWith(`.${i}`):!1})}var Zi=o=>{let e=typeof o=="string"?/^(\d{4})-(\d{2})-(\d{2})$/.exec(o):null;if(!e)return!1;let t=new Date(Date.UTC(Number(e[1]),Number(e[2])-1,Number(e[3])));return t.getUTCMonth()===Number(e[2])-1&&t.getUTCDate()===Number(e[3])},Qi=o=>`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}`;async function Or(o,e,t={}){let n=typeof o=="string"?o.trim().split("."):[];if(n.length!==3||n[0]!=="FG1")return{ok:!1,reason:"format"};let r;try{if(r=JSON.parse(new TextDecoder().decode(Dr(n[1]))),!Array.isArray(r.domains)||!Zi(r.expires))return{ok:!1,reason:"format"}}catch{return{ok:!1,reason:"format"}}let s=typeof crypto<"u"?crypto.subtle:void 0;if(!s)return{ok:!1,reason:"unsupported",info:r};try{let i=await s.importKey("jwk",t.publicKey??Xi,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]),a=new TextEncoder().encode(`${n[0]}.${n[1]}`);if(!await s.verify({name:"ECDSA",hash:"SHA-256"},i,Dr(n[2]),a))return{ok:!1,reason:"signature",info:r}}catch{return{ok:!1,reason:"signature",info:r}}return Qi(t.now??new Date)>r.expires?{ok:!1,reason:"expired",info:r}:Yi(e,r.domains)?{ok:!0,info:r}:{ok:!1,reason:"domain",info:r}}var Yn,Ir=new Map,at=null;function ea(o){Yn=o}var $r={missing:`FreeGrid is free for personal use. Company use needs a domain license (\u20A9200,000 per domain per year): ${Jn}
49
+ FreeGrid\uB294 \uAC1C\uC778\uC5D0\uAC8C \uBB34\uB8CC\uC785\uB2C8\uB2E4. \uD68C\uC0AC\uC5D0\uC11C \uC4F0\uB824\uBA74 \uB3C4\uBA54\uC778 \uB77C\uC774\uC120\uC2A4(\uB3C4\uBA54\uC778\uB2F9 \uC5F0 20\uB9CC \uC6D0)\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4: ${Jn}`,format:"FreeGrid: the license key is not in the right format. / \uB77C\uC774\uC120\uC2A4 \uD0A4 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",signature:"FreeGrid: the license key could not be verified. / \uB77C\uC774\uC120\uC2A4 \uD0A4\uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",expired:"FreeGrid: the license key has expired. / \uB77C\uC774\uC120\uC2A4 \uAE30\uAC04\uC774 \uB05D\uB0AC\uC2B5\uB2C8\uB2E4.",domain:"FreeGrid: the license key is for a different domain. / \uB2E4\uB978 \uB3C4\uBA54\uC778\uC6A9 \uB77C\uC774\uC120\uC2A4 \uD0A4\uC785\uB2C8\uB2E4."};function Nr(o,e=typeof location<"u"?location.hostname:""){try{if(Zn(e)||typeof navigator>"u")return;let t=new Date().toISOString().slice(0,10),n=`${e}|${t}|${o.licensed?1:0}`,r=typeof localStorage<"u"?localStorage:null;if(r?.getItem("freegrid:usage")===n)return;r?.setItem("freegrid:usage",n);let s=JSON.stringify({version:o.version,licensed:o.licensed,company:o.company,url:`${location.origin}${location.pathname}`});typeof navigator.sendBeacon=="function"?navigator.sendBeacon(Fr,s):typeof fetch=="function"&&fetch(Fr,{method:"POST",body:s,mode:"no-cors",keepalive:!0}).catch(()=>{})}catch{}}function ta(o=Yn,e=typeof location<"u"?location.hostname:""){if(Zn(e))return Promise.resolve(!0);let t=o??Yn,n=`${t??""}@${e}`,r=Ir.get(n);return r||(t?r=Or(t,e).then(s=>{if(Nr({version:tn,licensed:s.ok,company:s.ok?s.info.company:void 0},e),s.ok||s.reason==="unsupported")return s.ok||s.reason==="unsupported";let i=s.info?` (${s.info.domains.join(", ")}, ${s.info.expires})`:"";return console.warn(`${$r[s.reason]}${i}
50
+ ${Jn}`),!1},()=>!1):(console.info($r.missing),Nr({version:tn,licensed:!1},e),r=Promise.resolve(!1)),Ir.set(n,r),r)}function na(o=typeof location<"u"?location.hostname:""){if(Zn(o)||typeof fetch!="function")return Promise.resolve(!1);if(at)return at;let e=new Date().toISOString().slice(0,10),t=null;try{t=typeof localStorage<"u"?localStorage:null;let n=JSON.parse(t?.getItem("freegrid:badge")??"null");if(n&&n.host===o&&n.day===e)return at=Promise.resolve(n.show)}catch{}return at=fetch(Ji,{mode:"cors",credentials:"omit"}).then(n=>n.ok?n.json():{badge:!1}).then(n=>{let r=n.badge===!0;try{t?.setItem("freegrid:badge",JSON.stringify({host:o,day:e,show:r}))}catch{}return r},()=>!1),at}async function Br(o,e=typeof location<"u"?location.hostname:""){return await ta(o,e)?!1:na(e)}var lt={text:["contains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["eq","ne","lt","lte","gt","gte","between","blank","notBlank"],date:["equals","before","after","between","blank","notBlank"]},Hr=["blank","notBlank"],Qn=500,nn=class{constructor(e){this.grid=e;this.popup=null;this.colId=null;this.off=[]}get openColumn(){return this.colId}toggle(e,t){this.colId===e?this.close():this.open(e,t)}open(e,t){this.close();let n=this.grid.columns.getNode(e);if(!n||n.children||$(e))return;let r=this.grid.store.state.locale,s=n.def,i=x("div",`fg-menu fg-theme-${this.grid.store.state.theme}`,{role:"dialog","aria-label":r.columnMenu});this.grid.applyFontTo(i),Ae(s)&&i.append(this.section([[r.sortAsc,()=>this.grid.setSort([{colId:e,dir:"asc"}])],[r.sortDesc,()=>this.grid.setSort([{colId:e,dir:"desc"}])],[r.clearSort,()=>this.grid.setSort(this.grid.store.state.sort.filter(y=>y.colId!==e))]])),i.append(this.section([[r.pinLeft,()=>this.grid.setPinned(e,"left")],[r.pinRight,()=>this.grid.setPinned(e,"right")],[r.unpin,()=>this.grid.setPinned(e,null)]]));let a=this.grid.getGroupBy();if(!this.grid.options.treeData&&(this.grid.options.groupPanel||a.length)){let y=a.includes(e)?[[r.ungroup,()=>this.grid.setGroupBy(a.filter(w=>w!==e))]]:[[r.groupByThis,()=>this.grid.setGroupBy([...a,e])]];a.length&&y.push([r.expandAll,()=>this.grid.expandAll(!0)],[r.collapseAll,()=>this.grid.expandAll(!1)]),i.append(this.section(y))}let l=[[r.autosizeThis,()=>this.grid.autoSize([e])],[r.autosizeAll,()=>this.grid.autoSize()]];s.lockVisible||l.push([r.hideColumn,()=>this.grid.setColumnsVisible([e],!1)]),l.push([r.chooseColumns,()=>this.grid.chooser.open()],[r.resetColumns,()=>this.grid.resetColumns()]),this.grid.options.conditionalFormatMenu!==!1&&l.push([`${r.cf.title}\u2026`,()=>this.grid.formatDialog.open(e)]),i.append(this.section(l));let d=this.filterSection(e,()=>this.close());d&&i.append(d),ee(this.grid.renderer.root).append(i);let c=t.getBoundingClientRect(),u=i.offsetWidth||248;i.style.left=`${Math.max(4,Math.min(c.right-u,window.innerWidth-u-4))}px`;let f=Math.max(4,Math.min(c.bottom+4,window.innerHeight-240));i.style.top=`${f}px`,i.style.maxHeight=`${Math.max(160,window.innerHeight-f-8)}px`,this.popup=i,this.colId=e;let p=y=>{ie(y,i,t)||this.close()},g=y=>{y.key==="Escape"&&(this.close(),this.grid.renderer.gridEl.focus())};document.addEventListener("pointerdown",p,!0),document.addEventListener("keydown",g,!0),this.off.push(()=>document.removeEventListener("pointerdown",p,!0),()=>document.removeEventListener("keydown",g,!0)),i.querySelector(".fg-filter-value:not([hidden]), .fg-set-search, .fg-menu-item")?.focus()}filterSection(e,t){let n=this.grid.columns.getNode(e);if(!n||n.children)return null;let r=this.grid.store.state.locale,s=le(n.def);return s==="set"?this.setFilter(e,r,t):s?this.conditionFilter(e,s,r,t):null}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null,this.colId=null}section(e){let t=x("div","fg-menu-section");for(let[n,r]of e){let s=x("button","fg-menu-item",{type:"button"});s.textContent=n,s.addEventListener("click",()=>{r(),this.close()}),t.append(s)}return t}actions(e,t,n,r){let s=x("div","fg-menu-actions"),i=x("button","fg-btn",{type:"button"});i.textContent=t.reset,i.addEventListener("click",()=>{this.grid.setFilter(e,null),r()});let a=x("button","fg-btn fg-btn-primary",{type:"button"});return a.textContent=t.apply,a.addEventListener("click",n),s.append(i,a),s}title(e){let t=x("div","fg-menu-title");return t.textContent=e.filter,t}conditionRow(e,t,n,r,s){let i=x("div","fg-filter-cond"),a=x("select","fg-filter-op",{"aria-label":t.filter});if(r){let p=x("option");p.value="",p.textContent="\u2014",a.append(p)}for(let p of lt[e]){let g=x("option");g.value=p,g.textContent=t.ops[p],a.append(g)}a.value=n?.op??(r?"":lt[e][0]);let l=e==="text"?"text":e,d=x("input","fg-input fg-filter-value",{type:l,placeholder:t.value,"aria-label":t.value}),c=x("input","fg-input fg-filter-value-to",{type:l,placeholder:t.valueTo,"aria-label":t.valueTo});n&&(d.value=n.value!=null?String(n.value):"",c.value="valueTo"in n&&n.valueTo!=null?String(n.valueTo):"");let u=()=>{d.hidden=!a.value||Hr.includes(a.value),c.hidden=a.value!=="between"};a.addEventListener("change",u),u();for(let p of[d,c])p.addEventListener("keydown",g=>g.key==="Enter"&&s());return i.append(a,d,c),{row:i,read:()=>{let p=a.value;if(!p)return null;let g=!Hr.includes(p);if(e==="number"){let y=d.value===""?void 0:Number(d.value),w=c.value===""?void 0:Number(c.value);return!g||y!==void 0?{type:e,op:p,value:y,valueTo:w}:null}return e==="date"?!g||d.value?{type:e,op:p,value:d.value||void 0,valueTo:c.value||void 0}:null:!g||d.value?{type:e,op:p,value:d.value}:null}}}conditionFilter(e,t,n,r){let s=this.grid.store.state.filters[e],i=s?.type==="combined"?s.conditions:s?[s]:[],a=i[0]?.type===t?i[0]:void 0,l=i[1]?.type===t?i[1]:void 0,d=x("div","fg-menu-section fg-filter"),c=()=>{let y=u.read(),w=f.read(),h=p.querySelector("input:checked")?.value==="or"?"or":"and",m=y&&w?{type:"combined",operator:h,conditions:[y,w]}:y??w;this.grid.setFilter(e,m),r()},u=this.conditionRow(t,n,a,!1,c),f=this.conditionRow(t,n,l,!0,c),p=x("div","fg-filter-join",{role:"radiogroup"}),g=`fg-join-${e}-${Math.random().toString(36).slice(2,7)}`;for(let y of["and","or"]){let w=x("label"),h=x("input","",{type:"radio",name:g,value:y});h.checked=(s?.type==="combined"?s.operator:"and")===y,w.append(h,` ${n[y]}`),p.append(w)}return d.append(this.title(n),u.row,p,f.row,this.actions(e,n,c,r)),d}setFilter(e,t,n){let{grid:r}=this,s=r.columns.getNode(e).def,i=X(s,t.code),a=r.collator(),l=new Map;for(let S of r.rowModel.allNodes()){let T=G(s,S.data),k=Y(T);l.has(k)||l.set(k,T)}let d=[...l.entries()].sort((S,T)=>me(S[1],T[1],a)),c=r.store.state.filters[e],u=new Set(c?.type==="set"?c.values.map(Y).filter(S=>l.has(S)):l.keys()),f=(S,T)=>S===""?t.blanks:i(T),p=x("div","fg-menu-section fg-filter fg-set-filter"),g=x("input","fg-input fg-set-search",{type:"search",placeholder:t.search,"aria-label":t.search}),y=x("label","fg-set-item fg-set-all"),w=x("input","fg-checkbox",{type:"checkbox"});y.append(w,document.createTextNode(t.selectAll));let h=x("div","fg-set-list"),m=()=>{let S=g.value.trim().toLowerCase();return S?d.filter(([T,k])=>f(T,k).toLowerCase().includes(S)):d},b=()=>{let S=m(),T=S.filter(([k])=>u.has(k)).length;w.checked=T>0&&T===S.length,w.indeterminate=T>0&&T<S.length},v=()=>{let S=m();if(h.replaceChildren(...S.slice(0,Qn).map(([T,k])=>{let E=x("label","fg-set-item"),R=x("input","fg-checkbox",{type:"checkbox"});return R.checked=u.has(T),R.addEventListener("change",()=>{R.checked?u.add(T):u.delete(T),b()}),E.append(R,document.createTextNode(f(T,k))),E})),S.length>Qn){let T=x("div","fg-set-more");T.textContent=`\u2026 +${S.length-Qn}`,h.append(T)}b()};w.addEventListener("change",()=>{for(let[S]of m())w.checked?u.add(S):u.delete(S);v()}),g.addEventListener("input",v);let C=()=>{r.setFilter(e,u.size===l.size?null:{type:"set",values:d.filter(([S])=>u.has(S)).map(([,S])=>S)}),n()};return g.addEventListener("keydown",S=>S.key==="Enter"&&C()),v(),p.append(this.title(t),g,y,h,this.actions(e,t,C,n)),p}};var Gr=new WeakMap,oa=0;function Be(o){let e=Gr.get(o);return e||Gr.set(o,e=`r${++oa}`),e}var on=class{constructor(e){this.deps=e;this.stats={filterRuns:0,sortRuns:0};this.server=!1;this.full=[];this.last={};this.nodes=[];this.filtered=[];this.sorted=[];this.display=[];this.indexById=null;this.layoutCache=null}update(e){let t=this.deps.collator(),n=e.display,r=!!n?.getParentId!=!!this.last.display?.getParentId,s=e.data!==this.last.data,i=s||r||e.filters!==this.last.filters||e.quickFilter!==this.last.quickFilter||e.advancedFilter!==this.last.advancedFilter,a=i||e.sort!==this.last.sort||t!==this.last.collator,l=a||n?.version!==this.last.displayVersion||n?.groupBy!==this.last.display?.groupBy;if(s){let u=this.deps.getRowId;this.nodes=e.data.map((f,p)=>({id:u?String(u(f)):Be(f),data:f,sourceIndex:p}))}i&&(this.filtered=this.filter(e),this.stats.filterRuns++),a&&(this.sorted=gr(this.filtered,e.sort,u=>this.deps.columnDef(u),t),this.stats.sortRuns++),l&&(this.full=n?this.buildDisplay(n,e.sort,t):this.sorted);let d=e.page??null,c=this.last.page??null;(l||d?.index!==c?.index||d?.size!==c?.size)&&(this.display=d?this.full.slice(d.index*d.size,(d.index+1)*d.size):this.full,this.indexById=null,this.layoutCache=null),this.last={...e,collator:t,displayVersion:n?.version}}invalidate(){this.last={}}fullCount(){return this.full.length}dataCount(){return this.sorted.length}loading(){return!1}getRowCount(){return this.display.length}getRow(e){return this.display[e]}rows(){return this.display}dataRows(){return this.sorted}allNodes(){return this.nodes}idOf(e){return this.deps.getRowId?String(this.deps.getRowId(e)):Be(e)}indexOfId(e){return this.indexById||(this.indexById=new Map(this.display.map((t,n)=>[t.id,n]))),this.indexById.get(e)??-1}layout(e,t,n,r=0,s){let i=this.layoutCache;if(i&&i.rows===this.display&&i.rh===e&&i.dh===t&&i.hv===r)return i;let a=this.display.length,l=new Float64Array(a+1),d=!0,c=n&&n.size?n:null;for(let u=0;u<a;u++){let f=this.display[u],p=e;if(f.kind==="detail")p=t;else if(!f.kind){c&&(p=c.get(f.id)??e);let g=s?.(f.data);typeof g=="number"&&g>0&&(p=c?Math.max(p,g):g)}p!==e&&(d=!1),l[u+1]=l[u]+p}return this.layoutCache={rows:this.display,rh:e,dh:t,hv:r,offsets:l,uniform:d},this.layoutCache}filter(e){let t=Object.entries(e.filters).map(([c,u])=>({def:this.deps.columnDef(c),pred:vt(u)})).filter(c=>!!c.def),n=jo(e.quickFilter),r=n.length?this.deps.quickColumns():[],s=e.advancedFilter?vn(e.advancedFilter,c=>this.deps.columnDef(c),G):null;if(!t.length&&!n.length&&!s)return this.nodes;let i=this.nodes.filter(c=>{for(let u of t)if(!u.pred(G(u.def,c.data)))return!1;if(s&&!s(c.data))return!1;if(n.length){let u=r.map(f=>this.deps.format(f,G(f,c.data))).join("").toLowerCase();if(!Ko(n,u))return!1}return!0}),a=e.display?.getParentId;if(!a)return i;let l=new Map(this.nodes.map(c=>[c.id,c])),d=new Set(i);for(let c of i){let u=a(c.data),f=new Set;for(;u!=null&&!f.has(u);){f.add(u);let p=l.get(String(u));if(!p)break;d.add(p),u=a(p.data)}}return this.nodes.filter(c=>d.has(c))}isOpen(e,t,n){let r=e.expanded.get(t);return r!==void 0?r:e.defaultExpanded===-1||n<e.defaultExpanded}withDetails(e,t,n){for(let r of t)n.push(r),e.detailOpen.has(r.id)&&(!e.isMaster||e.isMaster(r.data))&&n.push({id:`detail:${r.id}`,data:{},sourceIndex:-1,kind:"detail",detailOf:r})}buildDisplay(e,t,n){let r=[];if(e.getParentId)return this.buildTree(e,r),r;let s=e.groupBy.filter(a=>this.deps.columnDef(a));if(!s.length)return e.detailOpen.size?(this.withDetails(e,this.sorted,r),r):this.sorted;let i=(a,l,d)=>{let c=s[l],u=this.deps.columnDef(c),f=new Map;for(let y of a){let w=G(u,y.data),h=W(w)?"":Y(w),m=f.get(h);m||f.set(h,m={value:w,nodes:[]}),m.nodes.push(y)}let p=t.find(y=>y.colId===c)?.dir==="desc"?-1:1,g=[...f.entries()].sort((y,w)=>me(y[1].value,w[1].value,n)*p);for(let[y,w]of g){let h=`${d}${c}:${y}`,m=this.isOpen(e,h,l);r.push({id:`group:${h}`,data:{},sourceIndex:-1,kind:"group",level:l,group:{key:h,colId:c,value:w.value,rows:w.nodes.map(b=>b.data),expanded:m}}),m&&(l+1<s.length?i(w.nodes,l+1,`${h}|`):this.withDetails(e,w.nodes.map(b=>({...b,level:l+1})),r))}};return i(this.sorted,0,""),r}buildTree(e,t){let n=new Set(this.sorted.map(a=>a.id)),r=new Map,s=[];for(let a of this.sorted){let l=e.getParentId(a.data),d=l==null?null:String(l);if(d!==null&&n.has(d)&&d!==a.id){let c=r.get(d);c||r.set(d,c=[]),c.push(a)}else s.push(a)}let i=(a,l,d)=>{for(let c of a){if(d.has(c.id))continue;let u=r.get(c.id)??[],f=!u.length&&!!e.lazyChildren?.(c.id,c.data),p=u.length>0&&this.isOpen(e,c.id,l),g={...c,level:l,hasChildren:u.length>0||f,expanded:p};f&&e.loading?.has(c.id)&&(g.loading=!0),this.withDetails(e,[g],t),p&&i(u,l+1,new Set([...d,c.id]))}};i(s,0,new Set)}};var ra=1e4,eo=1e5,sa=4,to=3e3,rn=class{constructor(e,t,n,r,s,i){this.datasource=e;this.getRowId=t;this.groupBy=n;this.query=r;this.onChange=s;this.onFailed=i;this.levels=new Map;this.gen=0;this.display=null;this.ids=null;this.queue=[];this.inFlight=0;this.retryAt=0;this.version=0;this.builtFor=-1}matches(e,t){return e.join("")===this.groupBy.join("")&&t.sort===this.query.sort&&t.filters===this.query.filters&&t.quickFilter===this.query.quickFilter&&t.advancedFilter===this.query.advancedFilter}purge(){this.gen++,this.queue=[],this.levels.clear(),this.touch()}dispose(){this.gen++,this.queue=[]}touch(){this.version++,this.display=null,this.ids=null}load(e,t,n){this.levels.has(e)||(this.levels.set(e,{state:"loading",nodes:[]}),this.fetch({path:e,keys:t,level:n,start:0,gen:this.gen}))}fetch(e){this.queue.push(e),this.pump()}pump(){for(;this.inFlight<sa&&this.queue.length;){let e=this.queue.shift();e.gen===this.gen&&(this.inFlight++,this.request(e).finally(()=>{this.inFlight--,this.pump()}))}}request({path:e,keys:t,level:n,start:r,gen:s}){let i=n>=this.groupBy.length,a=this.query,l=r+ra,d;try{d=Promise.resolve(this.datasource.getRows({start:r,end:l,sort:[...a.sort],filters:{...a.filters},quickFilter:a.quickFilter,advancedFilter:a.advancedFilter,groupBy:[...this.groupBy],groupKeys:[...t]}))}catch(c){d=Promise.reject(c)}return d.then(c=>{if(s!==this.gen)return;let u=Array.isArray(c?.rows)?c.rows.filter(w=>w!==null&&typeof w=="object"):[];Array.isArray(c?.rows)||B("datasource.getRows must resolve to { rows: Row[] }");let f=i?u.map((w,h)=>({id:this.getRowId?String(this.getRowId(w)):Be(w),data:w,sourceIndex:r+h,level:n})):u.map(w=>{let h=this.groupBy[n],m=w[h],b=`${e?`${e}|`:""}${h}:${Y(m)}`,v=typeof w.count=="number"?w.count:typeof w.childCount=="number"?w.childCount:void 0;return{id:`group:${b}`,data:{},sourceIndex:-1,kind:"group",level:n,group:{key:b,colId:h,value:m,rows:[],expanded:!1,count:v,aggregates:w,keys:[...t,m]}}}),p=r?[...this.levels.get(e)?.nodes??[],...f]:f,g=typeof c?.total=="number"&&c.total>=0?c.total:null,y=u.length>0&&(g!==null?p.length<g:u.length>=l-r);y&&p.length<eo?(this.levels.set(e,{state:"loading",nodes:p}),this.fetch({path:e,keys:t,level:n,start:p.length,gen:s})):(y&&B(`a server group level has more than ${eo} rows; only the first ${eo} are shown`),this.levels.set(e,{state:"loaded",nodes:p})),this.touch(),this.onChange()},c=>{s===this.gen&&(this.levels.set(e,{state:"failed",nodes:[],retryAt:Date.now()+to}),this.touch(),this.onFailed(r,l,c))})}isOpen(e,t,n){let r=e.expanded.get(t);return r!==void 0?r:e.defaultExpanded===-1||n<e.defaultExpanded}rows(e,t){let n=Date.now();if(this.display&&this.builtFor===t&&!(this.retryAt&&n>=this.retryAt))return this.display;let r=[],s=0,i=(a,l,d)=>{let c=this.levels.get(a);if(c?.state==="failed"&&n>=(c.retryAt??0)&&(this.levels.delete(a),c=void 0),!c){this.load(a,l,d),r.push({id:`loading:${a}`,data:{},sourceIndex:-1,kind:"loading",level:d});return}if(c.state==="failed"){let u=c.retryAt??0;s=s?Math.min(s,u):u;return}for(let u of c.nodes){if(u.kind!=="group"){r.push(u);continue}let f=u.group,p=this.isOpen(e,f.key,d),g={...u,group:{...f,expanded:p}};r.push(g),p&&i(f.key,f.keys??[],d+1)}c.state==="loading"&&r.push({id:`loading:${a}`,data:{},sourceIndex:-1,kind:"loading",level:d})};return i("",[],0),this.retryAt=s,this.display=r,this.builtFor=t,this.ids=null,r}dataRows(){let e=[];for(let t of this.levels.values())for(let n of t.nodes)n.kind||e.push(n);return e}dataCount(){let e=this.levels.get("");return e?.state==="loaded"&&e.nodes.every(t=>typeof t.group?.count=="number")?e.nodes.reduce((t,n)=>t+(n.group?.count??0),0):this.dataRows().length}loading(){for(let e of this.levels.values())if(e.state==="loading")return!0;return!1}indexOf(e){return this.display?(this.ids||(this.ids=new Map,this.display.forEach((t,n)=>this.ids.set(t.id,n))),this.ids.get(e)??-1):-1}};var ia=new Float64Array(0),dt=class{constructor(e){this.deps=e;this.stats={filterRuns:0,sortRuns:0};this.server=!0;this.blocks=new Map;this.total=null;this.loadedEnd=0;this.gen=0;this.query=null;this.page=null;this.lastBlock=0;this.version=0;this.cache=null;this.groups=null;this.displayIn=null}get bs(){return this.page?this.page.size:this.deps.blockSize}get base(){return this.page?this.page.index*this.page.size:0}update(e){let t=e.display?.groupBy??[];if(t.length&&!e.display?.getParentId){let a={sort:e.sort,filters:e.filters,quickFilter:e.quickFilter,advancedFilter:e.advancedFilter??null};(!this.groups||!this.groups.matches(t,a))&&(this.groups?.dispose(),this.groups=new rn(this.deps.datasource,this.deps.getRowId,[...t],a,()=>this.deps.onLoaded(0,0,null),(l,d,c)=>this.deps.onFailed(l,d,c)),this.touch()),this.displayIn=e.display??null,this.query=null;return}this.groups&&(this.groups.dispose(),this.groups=null,this.query=null,this.touch());let n=this.query,r=!n||n.sort!==e.sort||n.filters!==e.filters||n.quickFilter!==e.quickFilter||n.advancedFilter!==(e.advancedFilter??null),s=e.page??null,i=(s?.size??0)!==(this.page?.size??0);this.query={sort:e.sort,filters:e.filters,quickFilter:e.quickFilter,advancedFilter:e.advancedFilter??null},this.page=s?{...s}:null,(r||i)&&this.purge(),this.ensure(Math.floor(this.base/this.bs))}invalidate(){}purge(){if(this.groups){this.groups.purge();return}this.gen++,this.blocks.clear(),this.total=null,this.loadedEnd=0,this.touch(),this.query&&this.ensure(Math.floor(this.base/this.bs))}touch(){this.version++,this.cache=null}fullCount(){if(this.total!==null)return this.total;if(!this.loadedEnd)return 0;let e=this.blocks.get(Math.floor((this.loadedEnd-1)/this.bs));return this.loadedEnd+(e&&e.nodes.length<this.bs?0:this.bs)}getRowCount(){if(this.groups)return this.groupRows().length;let e=this.fullCount();return this.page?Math.max(0,Math.min(this.page.size,e-this.base)):e}dataCount(){return this.groups?this.groups.dataCount():this.fullCount()}loading(){if(this.groups)return this.groups.loading();for(let e of this.blocks.values())if(e.state==="loading")return!0;return!1}placeholder(e){return{id:`loading:${e}`,data:{},sourceIndex:-1,kind:"loading"}}peek(e){let t=Math.floor(e/this.bs),n=this.blocks.get(t);return n?.state==="loaded"?n.nodes[e-t*this.bs]??null:null}groupRows(){return this.groups.rows(this.displayIn,this.displayIn.version*1e6+this.groups.version)}getRow(e){if(this.groups)return this.groupRows()[e];let t=this.base+e,n=this.peek(t);return n||(e>=0&&e<this.getRowCount()&&this.ensure(Math.floor(t/this.bs)),this.placeholder(t))}ensure(e){let t=this.blocks.get(e);if(t&&(t.state!=="failed"||Date.now()<(t.retryAt??0))||this.total!==null&&e*this.bs>=this.total&&e>0)return;let n=e*this.bs,r=n+this.bs,s=this.gen;this.lastBlock=e,this.blocks.set(e,{state:"loading",nodes:[]});let i=this.query,a=d=>{s===this.gen&&(this.blocks.set(e,{state:"failed",nodes:[],retryAt:Date.now()+to}),this.deps.onFailed(n,r,d))},l;try{l=Promise.resolve(this.deps.datasource.getRows({start:n,end:r,sort:[...i.sort],filters:{...i.filters},quickFilter:i.quickFilter,advancedFilter:i.advancedFilter}))}catch(d){l=Promise.reject(d)}l.then(d=>{if(s!==this.gen)return;let c=Array.isArray(d?.rows)?d.rows.filter(p=>p!==null&&typeof p=="object"):null;if(!c){B("datasource.getRows must resolve to { rows: Row[], total?: number }"),a(new Error("invalid datasource response"));return}let u=this.deps.getRowId,f=c.slice(0,this.bs).map((p,g)=>({id:u?String(u(p)):Be(p),data:p,sourceIndex:n+g}));this.blocks.set(e,{state:"loaded",nodes:f}),typeof d.total=="number"&&d.total>=0?this.total=d.total:f.length<this.bs&&(this.total=n+f.length),this.loadedEnd=Math.max(this.loadedEnd,n+f.length),this.evict(),this.touch(),this.deps.onLoaded(n,n+f.length,this.total)},a)}evict(){let e=Math.max(2,this.deps.maxBlocks);if(this.blocks.size<=e)return;let t=[...this.blocks.keys()].sort((n,r)=>Math.abs(r-this.lastBlock)-Math.abs(n-this.lastBlock));for(let n of t){if(this.blocks.size<=e)break;this.blocks.get(n).state!=="loading"&&this.blocks.delete(n)}}built(){if(this.cache?.ver===this.version)return this.cache;let e=[];for(let n of[...this.blocks.keys()].sort((r,s)=>r-s)){let r=this.blocks.get(n);r.state==="loaded"&&e.push(...r.nodes)}let t=new Map;for(let n of e)t.set(n.id,n.sourceIndex);return this.cache={ver:this.version,data:e,rows:null,ids:t},this.cache}rows(){if(this.groups)return this.groupRows();let e=this.built();if(!e.rows){let t=this.getRowCount();e.rows=new Array(t);for(let n=0;n<t;n++)e.rows[n]=this.peek(this.base+n)??this.placeholder(this.base+n)}return e.rows}dataRows(){return this.groups?this.groups.dataRows():this.built().data}allNodes(){return this.groups?this.groups.dataRows():this.built().data}idOf(e){return this.deps.getRowId?String(this.deps.getRowId(e)):Be(e)}indexOfId(e){if(this.groups)return this.groupRows(),this.groups.indexOf(e);let t=this.built().ids.get(e);if(t===void 0)return-1;let n=t-this.base;return n>=0&&n<this.getRowCount()?n:-1}layout(){return{offsets:ia,uniform:!0}}};function zr(o){let e=o.idAt(o.index);if(o.mode==="single"){let t=new Set;return o.toggle&&o.selected.has(e)||t.add(e),{selected:t,anchorIndex:o.index}}if(o.range&&o.anchorIndex!=null){let t=o.toggle?new Set(o.selected):new Set,n=Math.min(o.anchorIndex,o.index),r=Math.max(o.anchorIndex,o.index);for(let s=n;s<=r;s++)t.add(o.idAt(s));return{selected:t,anchorIndex:o.anchorIndex}}if(o.toggle){let t=new Set(o.selected);return t.has(e)?t.delete(e):t.add(e),{selected:t,anchorIndex:o.index}}return{selected:new Set([e]),anchorIndex:o.index}}var sn=class{constructor(e){this.bus=new Ve;this.current=e}get state(){return this.current}set(e){let t=Object.keys(e).filter(n=>e[n]!==this.current[n]);t.length&&(this.current={...this.current,...e},this.bus.emit("change",t))}};var aa=500;function Vr(o){let e=o.renderer.root,t=0,n=null,r=null,s=()=>{clearTimeout(t),n?.remove(),n=null,r=null},i=c=>{let u=c.dataset.col;if(!u||$(u))return null;let f=o.columns.getNode(u);if(!f)return null;if(c.classList.contains("fg-header-cell"))return f.def.headerTooltip??null;let p=c.closest(".fg-row[data-row]");if(!p||!c.closest(".fg-body"))return null;let g=Number(p.dataset.row),y=o.rowModel.getRow(g);if(!y||y.kind)return null;let w=f.def,h=G(w,y.data),m=X(w,o.store.state.locale.code)(h);if(typeof w.tooltip=="function")try{let b=w.tooltip({value:h,formatted:m,row:y.data,rowIndex:g,column:w});return b?String(b):null}catch{return B(`tooltip of column "${u}" threw`),null}return w.tooltip===!0?m||null:o.options.overflowTooltip!==!1&&w.tooltip!==!1&&c.scrollWidth>c.clientWidth+1&&c.textContent||null},a=(c,u)=>{n?.remove(),n=x("div",`fg-tooltip fg-theme-${o.store.state.theme}`,{role:"tooltip"}),n.textContent=u,o.applyFontTo(n),ee(e).append(n);let f=c.getBoundingClientRect(),p=n.offsetWidth,g=n.offsetHeight,y=window.innerWidth||1024,w=window.innerHeight||768,h=f.bottom+6+g>w?f.top-g-6:f.bottom+6;n.style.left=`${Math.max(4,Math.min(y-p-4,f.left))}px`,n.style.top=`${Math.max(4,h)}px`},l=c=>{let u=c.target.closest?.(".fg-cell, .fg-header-cell");!u||u===r||!e.contains(u)||(s(),r=u,t=window.setTimeout(()=>{if(r!==u||!u.isConnected)return;let f=i(u);f&&a(u,f)},aa))},d=c=>{let u=c.relatedTarget;r&&u&&r.contains(u)||s()};return e.addEventListener("pointerover",l),e.addEventListener("pointerout",d),e.addEventListener("pointerdown",s),e.addEventListener("keydown",s),e.addEventListener("wheel",s,{passive:!0}),()=>{s(),e.removeEventListener("pointerover",l),e.removeEventListener("pointerout",d),e.removeEventListener("pointerdown",s),e.removeEventListener("keydown",s),e.removeEventListener("wheel",s)}}var qr=["blank","notBlank"],an=class{constructor(e){this.grid=e;this.popup=null;this.off=[]}get isOpen(){return!!this.popup}columns(){return this.grid.columns.getState().map(e=>this.grid.columns.getNode(e.colId)).filter(e=>e&&!e.children&&!$(e.id)&&le(e.def)).map(e=>{let t=le(e.def),n=t==="number"?"number":t==="date"?"date":"text";return{id:e.id,label:e.def.header??e.def.field??e.id,kind:n}})}open(){this.close();let{grid:e}=this,t=e.store.state.locale,n=this.columns(),r=x("div",`fg-menu fg-filter-builder fg-theme-${e.store.state.theme}`,{role:"dialog","aria-label":t.advancedFilter});e.applyFontTo(r);let s=x("div","fg-chooser-head"),i=x("span","fg-menu-title");i.textContent=t.advancedFilter;let a=x("button","fg-chooser-close",{type:"button","aria-label":t.close});a.textContent="\xD7",a.addEventListener("click",()=>this.close()),s.append(i,a);let l=e.store.state.advancedFilter,d=x("div","fg-filter-join",{role:"radiogroup"}),c=`fg-fb-join-${Math.random().toString(36).slice(2,7)}`;for(let R of["and","or"]){let M=x("label"),A=x("input","",{type:"radio",name:c,value:R});A.checked=(l?.operator??"and")===R,M.append(A,` ${t[R]}`),d.append(M)}let u=x("div","fg-fb-list"),f=[],p=R=>{f.splice(f.indexOf(R),1),R.el.remove()},g=R=>{let M=x("div","fg-fb-row"),A=x("select","fg-filter-op fg-fb-col",{"aria-label":t.columns});for(let P of n){let O=x("option");O.value=P.id,O.textContent=P.label,A.append(O)}let L=x("select","fg-filter-op fg-fb-op",{"aria-label":t.filter}),F=x("input","fg-input fg-fb-value",{type:"text",placeholder:t.value,"aria-label":t.value}),D=x("input","fg-input fg-fb-value-to",{type:"text",placeholder:t.valueTo,"aria-label":t.valueTo}),I=x("button","fg-chooser-close fg-fb-remove",{type:"button","aria-label":t.close});I.textContent="\xD7";let N=()=>n.find(P=>P.id===A.value)?.kind??"text",z=P=>{let O=N();L.replaceChildren(...lt[O].map(j=>{let te=x("option");return te.value=j,te.textContent=t.ops[j],te})),P&&lt[O].includes(P)&&(L.value=P);let V=O==="text"?"text":O;F.type=D.type=V,U()},U=()=>{F.hidden=qr.includes(L.value),D.hidden=L.value!=="between"};A.addEventListener("change",()=>z(L.value)),L.addEventListener("change",U),R&&n.some(P=>P.id===R.colId)&&(A.value=R.colId);let K=R?.model;z(K?.op),K?.value!=null&&(F.value=String(K.value)),K?.valueTo!=null&&(D.value=String(K.valueTo)),M.append(A,L,F,D,I);let Z={el:M,read:()=>{let P=N(),O=L.value,V=!qr.includes(O),j=null;if(P==="number"){let te=F.value===""?void 0:Number(F.value),Q=D.value===""?void 0:Number(D.value);(!V||te!==void 0&&!Number.isNaN(te))&&(j=O==="between"?{type:"number",op:O,value:te,valueTo:Q}:{type:"number",op:O,value:te})}else P==="date"?(!V||F.value)&&(j=O==="between"?{type:"date",op:O,value:F.value,valueTo:D.value}:{type:"date",op:O,value:F.value||void 0}):(!V||F.value)&&(j={type:"text",op:O,value:F.value});return j?{colId:A.value,model:j}:null}};return I.addEventListener("click",()=>p(Z)),Z},y=(R,M)=>{let A=x("div","fg-fb-row fg-fb-group"),L=x("span","fg-fb-group-label");L.textContent=M;let F=x("button","fg-chooser-close fg-fb-remove",{type:"button","aria-label":t.close});F.textContent="\xD7",A.append(L,F);let D={el:A,read:()=>R};return F.addEventListener("click",()=>p(D)),D},w=R=>{if("conditions"in R)return y(R,`( ${R.conditions.length} \xD7 ${t[R.operator]} )`);let M=n.find(F=>F.id===R.colId),A=R.model;if(M&&A&&(A.type==="text"||A.type==="number"||A.type==="date"))return g(R);let L=A?.type==="set"?A.values.map(String).join(", "):A?.type==="combined"?`( ${A.conditions.length} \xD7 ${t[A.operator]} )`:"";return y(R,`${M?.label??R.colId}: ${L}`)},h=R=>{f.push(R),u.append(R.el)};for(let R of l?.conditions??[])h(w(R));let m=x("button","fg-btn fg-fb-add",{type:"button"});m.textContent=`+ ${t.addCondition}`,m.addEventListener("click",()=>{let R=g();h(R),R.el.querySelector(".fg-fb-value").focus()});let b=x("div","fg-menu-actions"),v=x("button","fg-btn",{type:"button"});v.textContent=t.reset,v.addEventListener("click",()=>{e.setAdvancedFilter(null),this.close()});let C=x("button","fg-btn fg-btn-primary",{type:"button"});C.textContent=t.apply,C.addEventListener("click",()=>{let R=f.map(A=>A.read()).filter(A=>!!A),M=d.querySelector("input:checked")?.value==="or"?"or":"and";e.setAdvancedFilter(R.length?{operator:M,conditions:R}:null),this.close()}),b.append(v,C),r.append(s,d,u,m,b),ee(e.renderer.root).append(r);let S=e.renderer.root.getBoundingClientRect(),T=r.offsetWidth||460;r.style.left=`${Math.max(4,Math.min(S.left+24,(window.innerWidth||1024)-T-4))}px`,r.style.top=`${Math.max(4,S.top+24)}px`,this.popup=r,f.length||m.click();let k=R=>{ie(R,r)||this.close()},E=R=>{R.key==="Escape"&&this.close()};document.addEventListener("pointerdown",k,!0),document.addEventListener("keydown",E,!0),this.off.push(()=>document.removeEventListener("pointerdown",k,!0),()=>document.removeEventListener("keydown",E,!0))}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var Wr=[{key:"red",style:{background:"#ffc7ce",color:"#9c0006"}},{key:"yellow",style:{background:"#ffeb9c",color:"#9c5700"}},{key:"green",style:{background:"#c6efce",color:"#006100"}},{key:"blue",style:{background:"#dbeafe",color:"#1e3a8a"}},{key:"redText",style:{color:"#dc2626"}},{key:"bold",style:{bold:!0}}],la=["value","formula","top","bottom","aboveAverage","belowAverage","duplicate","unique","dataBar","colorScale","iconSet"],da=["gt","gte","lt","lte","eq","ne","between","notBetween","contains","notContains","startsWith","endsWith","blank","notBlank"],no=["blank","notBlank"],Ur=["dataBar","colorScale","iconSet"],ln=class{constructor(e){this.grid=e;this.popup=null;this.off=[]}get isOpen(){return!!this.popup}open(e){this.close();let{grid:t}=this,n=t.columns.getNode(e);if(!n||n.children||$(e))return;let r=t.store.state.locale,s=r.cf,i=n.def.header??n.def.field??e,a=x("div",`fg-menu fg-cf-dialog fg-theme-${t.store.state.theme}`,{role:"dialog","aria-label":`${s.title}: ${i}`});t.applyFontTo(a);let l=x("div","fg-chooser-head"),d=x("span","fg-menu-title");d.textContent=`${s.title} \xB7 ${i}`;let c=x("button","fg-chooser-close",{type:"button","aria-label":r.close});c.textContent="\xD7",c.addEventListener("click",()=>this.close()),l.append(d,c);let u=x("div","fg-cf-list"),f=P=>s.ops[P]??r.ops[P]??P,p=P=>{let O=P.type??"value",V=s.types[O];if(O==="value"){let j=P.op??"eq";return no.includes(j)?f(j):`${f(j)} ${String(P.value??"")}${j==="between"||j==="notBetween"?` \u2013 ${String(P.valueTo??"")}`:""}`}return O==="formula"?`${V}: ${P.formula??""}`:O==="top"||O==="bottom"?`${V} ${P.rank??10}${P.percent?"%":""}`:V},g=()=>{u.replaceChildren();let O=t.getConditionalFormats().map((V,j)=>({r:V,i:j})).filter(({r:V})=>V.columns.includes(e));if(!O.length){let V=x("div","fg-cf-empty");V.textContent=s.none,u.append(V);return}for(let{r:V,i:j}of O){let te=x("div","fg-cf-rule"),Q=x("span","fg-cf-sample",{"aria-hidden":"true"});Q.textContent=V.type==="iconSet"?"\u25B2":V.type==="dataBar"?"\u25AC":"Aa",V.style?.background&&(Q.style.background=V.style.background),V.style?.color&&(Q.style.color=V.style.color),V.style?.bold&&(Q.style.fontWeight="700"),V.type==="colorScale"&&(Q.style.background=`linear-gradient(to right, ${(V.colors??["#f8696b","#ffeb84","#63be7b"]).join(",")})`);let ae=x("span","fg-cf-rule-text");ae.textContent=`${p(V)}${V.row?` \xB7 ${s.wholeRow}`:""}`,ae.title=ae.textContent;let un=x("button","fg-chooser-close",{type:"button","aria-label":`${r.close}: ${ae.textContent}`});un.textContent="\xD7",un.addEventListener("click",()=>{let ao=t.getConditionalFormats(),lo=ao[j];lo.columns=lo.columns.filter(fn=>fn!==e),t.setConditionalFormats(ao.filter(fn=>fn.columns.length)),g()}),te.append(Q,ae,un),u.append(te)}};g();let y=x("div","fg-cf-form"),w=x("select","fg-filter-op fg-cf-wide fg-cf-type",{"aria-label":s.type});for(let P of la){let O=x("option");O.value=P,O.textContent=s.types[P],w.append(O)}let h=x("select","fg-filter-op fg-cf-wide fg-cf-op",{"aria-label":r.filter});for(let P of da){let O=x("option");O.value=P,O.textContent=f(P),h.append(O)}let m=n.def.type==="number",b=x("input","fg-input fg-cf-value",{type:m?"number":"text",placeholder:r.value,"aria-label":r.value}),v=x("input","fg-input fg-cf-value-to",{type:m?"number":"text",placeholder:r.valueTo,"aria-label":r.valueTo}),C=x("input","fg-input fg-cf-wide fg-cf-formula",{type:"text",placeholder:`=${n.def.field??e} > 100`,"aria-label":s.types.formula,spellcheck:"false"}),S=x("input","fg-input fg-cf-rank",{type:"number",min:"1",value:"10","aria-label":s.count}),T=x("label","fg-cf-pct"),k=x("input","",{type:"checkbox"});T.append(k," %");let E=x("div","fg-cf-swatches fg-cf-wide",{role:"group","aria-label":s.style}),R=0;Wr.forEach((P,O)=>{let V=x("button","fg-cf-swatch",{type:"button","aria-label":s.styles[P.key],title:s.styles[P.key],"aria-pressed":String(O===R)});V.textContent=P.key==="bold"?"B":"Aa",P.style.background&&(V.style.background=P.style.background),P.style.color&&(V.style.color=P.style.color),V.addEventListener("click",()=>{R=O;for(let j of E.children)j.setAttribute("aria-pressed",String(j===V))}),E.append(V)});let M=x("label","fg-cf-wide fg-cf-row"),A=x("input","",{type:"checkbox"});M.append(A,` ${s.wholeRow}`),y.append(w,h,b,v,C,S,T,E,M);let L=()=>{let P=w.value,O=h.value;h.hidden=P!=="value",b.hidden=P!=="value"||no.includes(O),v.hidden=P!=="value"||O!=="between"&&O!=="notBetween",C.hidden=P!=="formula",S.hidden=T.hidden=P!=="top"&&P!=="bottom",E.hidden=Ur.includes(P),M.hidden=P!=="value"&&P!=="formula"};w.addEventListener("change",L),h.addEventListener("change",L),L();let F=()=>{let P=w.value,O={columns:[e],type:P},V=j=>m&&j.value!==""?Number(j.value):j.value;if(P==="value"){if(O.op=h.value,!no.includes(O.op)){if(b.value==="")return null;if(O.value=V(b),O.op==="between"||O.op==="notBetween"){if(v.value==="")return null;O.valueTo=V(v)}}}else if(P==="formula"){let j=C.value.trim();if(!j)return null;O.formula=j.startsWith("=")?j:`=${j}`}else(P==="top"||P==="bottom")&&(O.rank=Math.max(1,Math.floor(Number(S.value)||10)),k.checked&&(O.percent=!0));return Ur.includes(P)||(O.style={...Wr[R].style}),A.checked&&(P==="value"||P==="formula")&&(O.row=!0),O},D=x("div","fg-menu-actions"),I=x("button","fg-btn",{type:"button"});I.textContent=s.clear,I.addEventListener("click",()=>{t.setConditionalFormats(t.getConditionalFormats().map(P=>({...P,columns:P.columns.filter(O=>O!==e)})).filter(P=>P.columns.length)),g()});let N=x("button","fg-btn fg-btn-primary",{type:"button"});N.textContent=s.add,N.addEventListener("click",()=>{let P=F();if(!P){(w.value==="formula"?C:b).focus();return}t.setConditionalFormats([...t.getConditionalFormats(),P]),b.value=v.value=C.value="",g()}),D.append(I,N),a.append(l,u,y,D),ee(t.renderer.root).append(a);let z=t.renderer.root.getBoundingClientRect(),U=a.offsetWidth||340;a.style.left=`${Math.max(4,Math.min(z.left+24,(window.innerWidth||1024)-U-4))}px`,a.style.top=`${Math.max(4,z.top+24)}px`,this.popup=a,w.focus();let K=P=>{ie(P,a)||this.close()},Z=P=>{P.key==="Escape"&&this.close()};document.addEventListener("pointerdown",K,!0),document.addEventListener("keydown",Z,!0),this.off.push(()=>document.removeEventListener("pointerdown",K,!0),()=>document.removeEventListener("keydown",Z,!0))}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var ca=["text","number","date","set","combined"],ua=["bar","stackedBar","line","area","pie","donut","combo","scatter"],fa=30;function pa(o,e,t,n){let r={id:e,header:t.header??t.field??e};t.type&&(r.type=t.type),t.formula&&(r.formula=t.formula),t.aggFunc&&typeof t.aggFunc=="string"&&(r.aggFunc=t.aggFunc);let s=0,i=new Map,a=1/0,l=-1/0,d=0,c=0,u="",f="";for(let p of n){let g=G(t,p);if(W(g)){s++;continue}if(typeof g=="number"&&Number.isFinite(g))c++,d+=g,g<a&&(a=g),g>l&&(l=g);else if(t.type==="date"){let y=g instanceof Date?g.toISOString().slice(0,10):String(g);(!u||y<u)&&(u=y),(!f||y>f)&&(f=y)}if(i.size<5e3){let y=Y(g),w=i.get(y);w?w.n++:i.set(y,{value:g,n:1})}}return r.blanks=s,r.distinct=i.size,c&&Object.assign(r,{min:a,max:l,avg:Math.round(d/c*1e3)/1e3}),u&&Object.assign(r,{min:u,max:f}),!c&&i.size&&(r.top=[...i.values()].sort((p,g)=>g.n-p.n).slice(0,12).map(p=>({value:String(p.value).slice(0,80),count:p.n}))),r}function ha(o,e,t){let n=o.rowModel.dataRows().map(d=>d.data),r=o.columns.getState().map(d=>o.columns.getNode(d.colId)).filter(d=>d&&!d.children&&!$(d.id)),s=r.map(d=>({...pa(o,d.id,d.def,n),hidden:o.columns.getState().find(c=>c.colId===d.id)?.hide||void 0})),i=typeof t.sampleRows=="number"&&t.sampleRows>=0?Math.min(50,t.sampleRows):5,a=n.slice(0,i).map(d=>Object.fromEntries(r.map(c=>[c.id,G(c.def,d)]))),l=o.store.state;return{prompt:String(e).slice(0,2e3),locale:l.locale.code,rowCount:n.length,totalRows:o.rowModel.server?n.length:o.store.state.data.length,columns:s,sample:a,state:{sort:l.sort,filters:l.filters,quickFilter:l.quickFilter,advancedFilter:l.advancedFilter,groupBy:o.getGroupBy(),pivot:o.getPivot(),conditionalFormats:o.getConditionalFormats()},...t.context?{context:t.context()}:{}}}function ma(o,e){let t={state:o.api.getState(),defs:o.columnDefs(),summary:o.summaryOptions()},n=[],r=[],s=[],i=Array.isArray(e)?e.slice(0,fa):[],a=u=>typeof u=="string"&&!!o.columns.getNode(u)&&!o.columns.getNode(u).children&&!$(u),l=u=>n.push(u),d=(u,f)=>r.push({action:u,reason:f});for(let u of i){let f=u;if(!f||typeof f!="object"||typeof f.type!="string"){d(u,"not an action");continue}try{switch(f.type){case"sort":{let p=(Array.isArray(f.sort)?f.sort:[]).filter(g=>!!g&&a(g.colId)&&(g.dir==="asc"||g.dir==="desc"));Array.isArray(f.sort)&&p.length!==f.sort.length&&d(f,"unknown column in sort"),o.setSort(p.map(g=>({colId:g.colId,dir:g.dir}))),l(f);break}case"filter":{if(!a(f.colId)){d(f,"unknown column");break}let p=f.model;if(p!==null&&(!p||typeof p!="object"||!ca.includes(p.type))){d(f,"bad filter model");break}o.setFilter(f.colId,p),l(f);break}case"clearFilters":for(let p of Object.keys(o.store.state.filters))o.setFilter(p,null);o.setAdvancedFilter(null),o.api.setQuickFilter(""),l(f);break;case"quickFilter":o.api.setQuickFilter(typeof f.text=="string"?f.text.slice(0,200):""),l(f);break;case"advancedFilter":{let p=f.filter,g=[],y=w=>{let h=w;Array.isArray(h?.conditions)?h.conditions.forEach(y):g.push(h?.colId)};if(p&&y(p),p&&(!Array.isArray(p.conditions)||!g.every(a))){d(f,"unknown column in advanced filter");break}o.setAdvancedFilter(p??null),l(f);break}case"groupBy":{let p=Array.isArray(f.colIds)?f.colIds.filter(a):[];o.setGroupBy(p),f.expand&&o.expandAll(!0),l(f);break}case"pivot":{let p=f.pivot;if(p&&(!Array.isArray(p.rows)||!Array.isArray(p.values)||!p.rows.every(a)||!(p.columns??[]).every(a)||!p.values.every(g=>g&&a(g.colId)))){d(f,"unknown column in pivot");break}o.setPivot(p??null),l(f);break}case"showColumns":case"hideColumns":{let p=Array.isArray(f.colIds)?f.colIds.filter(a):[];p.length&&o.setColumnsVisible(p,f.type==="showColumns"),l(f);break}case"conditionalFormat":{let p=f.format;if(!p||!Array.isArray(p.columns)||!p.columns.length||!p.columns.every(a)){d(f,"unknown column in format");break}o.setConditionalFormats([...o.getConditionalFormats(),p]),l(f);break}case"clearConditionalFormats":o.setConditionalFormats([]),l(f);break;case"addColumn":{let p=f.column;if(!p||typeof p.id!="string"||!/^[\w.-]{1,40}$/.test(p.id)||o.columns.getNode(p.id)){d(f,"bad or taken column id");break}let g=typeof p.formula=="string"?p.formula.startsWith("=")?p.formula:`=${p.formula}`:"";if(!(g?Vo(g):null)){d(f,"formula does not parse");break}let w={id:p.id,header:typeof p.header=="string"?p.header.slice(0,80):p.id,formula:g};(p.type==="number"||p.type==="date"||p.type==="text")&&(w.type=p.type),o.api.setColumns([...o.columnDefs(),w]),l(f);break}case"summary":{let p=f.summary;if(p&&(!Array.isArray(p.rows)||!p.rows.every(g=>g&&Object.keys(g.columns??{}).every(a)))){d(f,"unknown column in summary");break}o.setSummary(p??null),l(f);break}case"chart":{let p=Array.isArray(f.colIds)?f.colIds.filter(a):[],g=o.columns.displayed().map(m=>m.id),y=p.map(m=>g.indexOf(m)).filter(m=>m>=0),w=o.rowModel.getRowCount();if(!y.length||!w){d(f,"nothing to chart");break}let h={start:{rowIndex:0,colId:g[Math.min(...y)]},end:{rowIndex:Math.min(w,200)-1,colId:g[Math.max(...y)]}};s.push(o.api.createChart({type:ua.includes(f.chartType)?f.chartType:"bar",range:h,title:typeof f.title=="string"?f.title.slice(0,80):void 0})),l(f);break}case"message":l(f);break;default:d(f,"unknown action")}}catch{d(f,"failed")}}return{applied:n,skipped:r,undo:()=>{for(let u of s)u.destroy();(o.columnDefs().length!==t.defs.length||o.columnDefs().some((u,f)=>u!==t.defs[f]))&&o.api.setColumns(t.defs),o.setSummary(t.summary),o.api.setState(t.state),t.state.conditionalFormats||o.setConditionalFormats([])}}}async function dn(o,e,t,n){if(!t?.url)throw new Error("assistant.url is not set");let r=typeof t.headers=="function"?t.headers():t.headers??{},s=await fetch(t.url,{method:"POST",credentials:t.credentials??"same-origin",headers:{"Content-Type":"application/json",Accept:"application/json",...r},body:JSON.stringify(ha(o,e,t)),signal:n});if(!s.ok)throw new Error(`HTTP ${s.status} from the assistant`);let i=await s.json(),a=ma(o,Array.isArray(i?.actions)?i.actions:[]),l=typeof i?.message=="string"?i.message:a.applied.filter(d=>d.type==="message").map(d=>d.text??"").join(`
51
+ `);return{...a,message:l.slice(0,4e3)}}var cn=class{constructor(e){this.grid=e;this.popup=null;this.log=null;this.off=[];this.busy=null}get isOpen(){return!!this.popup}open(){if(this.popup){this.popup.querySelector(".fg-ai-input")?.focus();return}let{grid:e}=this,t=e.store.state.locale,n=e.options.assistant,r=x("div",`fg-menu fg-ai-panel fg-theme-${e.store.state.theme}`,{role:"dialog","aria-label":t.ai.title});e.applyFontTo(r);let s=x("div","fg-chooser-head"),i=x("span","fg-menu-title");i.textContent=t.ai.title;let a=x("button","fg-chooser-close",{type:"button","aria-label":t.close});a.textContent="\xD7",a.addEventListener("click",()=>this.close()),s.append(i,a);let l=x("div","fg-ai-log",{role:"log","aria-live":"polite"});this.log=l;let d=x("form","fg-ai-form"),c=x("textarea","fg-input fg-ai-input",{rows:"2",placeholder:t.ai.placeholder,"aria-label":t.ai.placeholder,maxlength:"2000"}),u=x("button","fg-btn fg-btn-primary fg-ai-send",{type:"submit"});u.textContent=t.ai.send,d.append(c,u);let f=x("div","fg-ai-tips");for(let h of(n?.suggestions??[]).slice(0,6)){let m=x("button","fg-ai-tip",{type:"button"});m.textContent=h,m.addEventListener("click",()=>{c.value=h,c.focus()}),f.append(m)}c.addEventListener("keydown",h=>{h.key==="Enter"&&!h.shiftKey&&!h.isComposing&&(h.preventDefault(),d.requestSubmit?.()??d.dispatchEvent(new Event("submit",{cancelable:!0})))}),d.addEventListener("submit",h=>{h.preventDefault();let m=c.value.trim();!m||this.busy||(c.value="",this.ask(m,u))}),r.append(s,l,d),f.childElementCount&&r.append(f),ee(e.renderer.root).append(r);let p=e.renderer.root.getBoundingClientRect(),g=r.offsetWidth||360;r.style.left=`${Math.max(4,Math.min(p.right-g-16,(window.innerWidth||1024)-g-4))}px`,r.style.top=`${Math.max(4,p.top+16)}px`,this.popup=r,c.focus();let y=h=>{!ie(h,r)&&!this.busy&&this.close()},w=h=>{h.key==="Escape"&&this.close()};document.addEventListener("pointerdown",y,!0),document.addEventListener("keydown",w,!0),this.off.push(()=>document.removeEventListener("pointerdown",y,!0),()=>document.removeEventListener("keydown",w,!0))}say(e,t){let n=x("div",`fg-ai-msg fg-ai-${e}`);return n.textContent=t,this.log?.append(n),this.log&&(this.log.scrollTop=this.log.scrollHeight),n}async ask(e,t){let n=this.grid.store.state.locale;this.say("user",e);let r=this.say("ai",n.ai.thinking);r.classList.add("fg-ai-wait"),this.busy=new AbortController,t.disabled=!0;try{let s=await dn(this.grid,e,this.grid.options.assistant,this.busy.signal);r.classList.remove("fg-ai-wait");let i=s.applied.filter(a=>a.type!=="message").length;if(r.textContent=s.message||(i?n.ai.done:""),s.skipped.length){let a=x("div","fg-ai-note");a.textContent=`${n.ai.skipped}: ${s.skipped.map(l=>l.reason).join(", ")}`,r.append(a)}if(i){let a=x("button","fg-btn fg-ai-undo",{type:"button"});a.textContent=n.ai.undo,a.addEventListener("click",()=>{s.undo(),a.disabled=!0,a.textContent=n.ai.undone}),r.append(a)}this.grid.events.emit("assistantAnswer",{prompt:e,message:s.message,applied:s.applied,skipped:s.skipped})}catch(s){if(s?.name==="AbortError")return;r.remove(),this.say("error",n.ai.failed)}finally{this.busy=null,t.disabled=!1}}close(){this.busy?.abort(),this.busy=null;for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null,this.log=null}};var jr=o=>Math.round(o*2.75),Kr=o=>Math.round(o*3.1),oo=13,ro={compact:[.8,.85],normal:[1,1],comfortable:[1.25,1.15]},ga=[],wa=100,ya=new Map;function ye(o){return o.every(e=>e!==null&&typeof e=="object")?o:(B("data contains entries that are not objects; they were skipped"),o.filter(e=>e!==null&&typeof e=="object"))}var so=class{constructor(e,t){this.options=t;this.events=new Ve;this.pinnedRows={top:[],bottom:[]};this.spanCache=null;this.editVersion=0;this.tracker=new Gt;this.history=new Ht;this.disposers=[];this.collatorCache=null;this.destroyed=!1;this.summaryOpts=null;this.summaryValues=[];this.groupBy=[];this.expanded=new Map;this.defaultExpanded=0;this.detailOpen=new Set;this.displayVersion=0;this.aggCache={ver:-1,map:new WeakMap};this.charts=new en(this);this.sourceDefs=[];this.pivotCfg=null;this.pivotData=null;this.savedGroup=null;this.page=0;this.pageSize=wa;this.formulaScope={rows:()=>this.store.state.data,version:()=>this.editVersion,computed:e=>{let t=this.columns.getNode(e)?.def;return t&&typeof t.formula=="string"&&t.formula.startsWith("=")?t.formula:void 0}};this.cfRules=[];this.formats=new Ut({rules:()=>this.cfRules,rows:()=>this.rowModel.dataRows().map(e=>e.data),value:(e,t)=>{let n=this.columns.getNode(e)?.def;return n?G(n,t):void 0},version:()=>this.editVersion,formula:(e,t)=>gn(e,t,new Set,0,new Map,this.formulaScope)});this.formatDialog=new ln(this);this.assistantPanel=new cn(this);this.forcedOverlay=null;this.filterBuilder=new an(this);this.flashing=new Map;this.flashTimer=0;this.txQueue=[];this.txTimer=0;this.keepRange=!1;this.rowNumberCache=null;this.treeLoaded=new Set;this.treeLoading=new Set;this.lazyChildren=(e,t)=>{if(this.treeLoaded.has(e))return!1;try{return!!this.options.treeData?.hasChildren?.(t)}catch{return!1}};this.density="normal";this.selectionVersion=0;Array.isArray(t.columns)||B("options.columns must be an array"),t.data!=null&&!Array.isArray(t.data)&&B("options.data must be an array"),this.store=new sn({data:Array.isArray(t.data)?ye(t.data):[],sort:[],filters:{},quickFilter:"",selected:new Set,anchorId:null,focus:null,range:null,extraRanges:[],advancedFilter:null,locale:ct(t.locale),theme:t.theme??"light"}),this.sourceDefs=Array.isArray(t.columns)?t.columns:[],this.columns=new ft(this.withSelect(this.sourceDefs)),this.bindFormulas();let n=t.pagination;n&&typeof n=="object"&&n.pageSize!==void 0&&(Number.isInteger(n.pageSize)&&n.pageSize>0?this.pageSize=n.pageSize:B("pagination.pageSize must be a positive integer")),t.datasource&&typeof t.datasource.getRows!="function"&&B("datasource.getRows must be a function"),this.rowModel=t.datasource&&typeof t.datasource.getRows=="function"?new dt({datasource:t.datasource,blockSize:Number.isInteger(t.blockSize)&&t.blockSize>0?t.blockSize:100,maxBlocks:Number.isInteger(t.maxBlocks)&&t.maxBlocks>0?t.maxBlocks:100,getRowId:t.getRowId,onLoaded:(i,a,l)=>this.serverLoaded(i,a,l),onFailed:(i,a,l)=>this.serverFailed(i,a,l)}):new on({getRowId:t.getRowId,columnDef:i=>this.columns.getNode(i)?.def,quickColumns:()=>this.columns.displayed().filter(i=>!$(i.id)).map(i=>i.def),format:(i,a)=>X(i,this.store.state.locale.code)(a),collator:()=>this.collator()}),this.groupBy=this.validGroupBy(t.groupBy??[]),Array.isArray(t.conditionalFormats)&&(this.cfRules=t.conditionalFormats.filter(i=>i&&typeof i=="object"&&Array.isArray(i.columns)).map(i=>({...i,columns:[...i.columns]}))),this.defaultExpanded=t.groupDefaultExpanded??0,t.treeData&&!t.getRowId&&B("treeData needs getRowId so parent ids can be matched"),this.updateRows(),this.summaryOpts=t.summary??null,this.refreshSummary();let r=t.fontSize!=null&&t.fontSize>0?t.fontSize:null;t.fontSize!=null&&!(t.fontSize>0)&&B("fontSize must be a positive number"),this.font={size:r,family:t.fontFamily??null};let s=r??oo;if(this.renderer=new Rt(e,this,{rowHeight:t.rowHeight??Math.round(jr(s)*ro[this.densityOf(t.density)][0]),headerHeight:t.headerHeight??Math.round(Kr(s)*ro[this.densityOf(t.density)][1])}),this.density=this.densityOf(t.density),this.renderer.applyTheme(),t.flashDuration&&this.renderer.root.style.setProperty("--fg-flash-duration",`${this.flashMs()}ms`),this.renderer.applyFont(this.font.size,this.font.family),this.menu=new nn(this),this.chooser=new Pt(this),this.contextMenu=new Dt(this),this.editor=new Bt(this),this.finder=new $t(this),this.fillHandle=new It(this),this.groupPanel=t.groupPanel?new St(this):null,this.pinnedRows={top:ye(t.pinnedTopRows??[]),bottom:ye(t.pinnedBottomRows??[])},this.sideBar=t.sideBar?new Ft(this,typeof t.sideBar=="object"&&!!t.sideBar.open,(typeof t.sideBar=="object"?t.sideBar.panels:void 0)??(t.pivot||t.pivotPanel?["columns","filters","pivot"]:void 0)):null,this.disposers.push(this.store.bus.on("change",i=>this.onChange(i)),dr(this),or(this),()=>this.menu.close(),()=>this.chooser.close(),()=>this.contextMenu.destroy(),()=>this.editor.destroy(),()=>this.fillHandle.destroy(),()=>this.groupPanel?.destroy(),()=>this.charts.destroy(),()=>this.filterBuilder.close(),()=>this.formatDialog.close(),()=>this.assistantPanel.close(),Vr(this)),typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>this.renderer.schedule());i.observe(this.renderer.main),this.disposers.push(()=>i.disconnect())}t.pivot&&this.setPivot(t.pivot),Br(t.licenseKey).then(i=>{i&&!this.destroyed&&this.renderer.showFreeBadge()}),this.renderer.render(),this.api=this.createApi(),Mt.set(this.renderer.root,this)}columnDefs(){return[...this.sourceDefs]}summaryOptions(){return this.summaryOpts?JSON.parse(JSON.stringify(this.summaryOpts)):null}setConditionalFormats(e){if(!Array.isArray(e)){B("setConditionalFormats: formats must be an array");return}this.cfRules=e.filter(t=>t&&typeof t=="object"&&Array.isArray(t.columns)).map(t=>({...t,columns:[...t.columns]})),this.renderer.invalidate({rows:!0}),this.events.emit("conditionalFormatsChange",{formats:this.getConditionalFormats()})}getConditionalFormats(){return JSON.parse(JSON.stringify(this.cfRules))}cellFormat(e,t,n){return this.cfRules.length?this.formats.cell(t,e,n):null}bindFormulas(){let e=[],t=n=>{for(let r of n)!r||typeof r!="object"||(e.push(r),Array.isArray(r.children)&&t(r.children))};t(this.sourceDefs);for(let n of this.columns.getState()){let r=this.columns.getNode(n.colId)?.def;r&&e.push(r)}Go(e,this.formulaScope)}collator(){let e=this.store.state.locale.code;return this.collatorCache?.code!==e&&(this.collatorCache={code:e,collator:new Intl.Collator(e,{numeric:!0,sensitivity:"base"})}),this.collatorCache.collator}layoutChanged(){this.renderer.invalidateHeights(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers()}columnsChanged(){this.rowModel.invalidate(),this.updateRows(),this.refreshSummary(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers()}display(){return{groupBy:this.options.treeData?ga:this.groupBy,getParentId:this.options.treeData?.getParentId,expanded:this.expanded,defaultExpanded:this.defaultExpanded,detailOpen:this.options.detailRenderer?this.detailOpen:new Set,isMaster:this.options.isRowMaster,lazyChildren:this.options.treeData?.hasChildren?this.lazyChildren:void 0,loading:this.treeLoading,version:this.displayVersion}}updateRows(){let e=!!this.options.pagination,t=this.pivotData??this.store.state.data;this.rowModel.update({...this.store.state,data:t,display:this.display(),page:e?{index:this.page,size:this.pageSize}:null}),e&&this.page>=this.getPageCount()&&(this.page=this.getPageCount()-1,this.rowModel.update({...this.store.state,data:t,display:this.display(),page:{index:this.page,size:this.pageSize}}))}viewRows(){return this.pivotData??this.store.state.data}sourceLeaves(){let e=[],t=n=>{for(let r of n)!r||typeof r!="object"||(Array.isArray(r.children)?t(r.children):(r.id??r.field)&&e.push({id:r.id??r.field,def:r}))};return t(this.sourceDefs),e}getPivot(){let e=this.pivotCfg;if(!e)return null;let t={rows:[...e.rows],columns:[...e.columns],values:e.values.map(n=>({...n}))};return e.totals||(t.totals=!1),t}setPivot(e){if(e&&this.clientOnly("pivot"))return;if(e&&(typeof e!="object"||!Array.isArray(e.rows)||!Array.isArray(e.values))){B("setPivot: expected { rows: string[], values: [...] }");return}if(this.editor.cancel(),!e){if(!this.pivotCfg)return;this.pivotCfg=null,this.pivotData=null,this.columns.setDefs(this.withSelect(this.sourceDefs)),this.savedGroup&&(this.groupBy=this.savedGroup.groupBy,this.expanded=this.savedGroup.expanded,this.defaultExpanded=this.savedGroup.defaultExpanded,this.savedGroup=null),this.afterPivotSwitch();return}let t=new Set(this.sourceLeaves().map(n=>n.id));this.pivotCfg||(this.savedGroup={groupBy:this.groupBy,expanded:this.expanded,defaultExpanded:this.defaultExpanded}),this.pivotCfg=Xn(e,n=>t.has(n)),this.expanded=new Map,this.defaultExpanded=-1,this.rebuildPivot(!1),this.afterPivotSwitch()}afterPivotSwitch(){this.page=0,this.store.set({sort:[],filters:{},range:null,focus:null}),this.rowModel.invalidate(),this.updateRows(),this.displayVersion++,this.updateRows(),this.groupPanel?.refresh(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers(),this.events.emit("pivotChange",{pivot:this.getPivot()})}rebuildPivot(e=!0){let t=this.pivotCfg;if(!t)return;let n=this.store.state.locale,r=new Map(this.sourceLeaves().map(d=>[d.id,d.def])),s={sum:n.sum,avg:n.avg,min:n.min,max:n.max,count:n.count},i=Pr(this.store.state.data,t,d=>r.get(d),{total:n.total,blank:n.blanks,agg:d=>s[d]??d},n.code);if(this.pivotData=i.rows,this.columns.setDefs(this.withSelect(i.columns)),this.groupBy=i.groupBy,!e)return;let a=d=>!!this.columns.getNode(d),l=this.store.state;(l.sort.some(d=>!a(d.colId))||Object.keys(l.filters).some(d=>!a(d)))&&this.store.set({sort:l.sort.filter(d=>a(d.colId)),filters:Object.fromEntries(Object.entries(l.filters).filter(([d])=>a(d)))}),this.rowModel.invalidate(),this.displayVersion++,this.updateRows(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers()}isFlashing(e,t){return this.flashing.size>0&&this.flashing.has(`${e}\0${t}`)}flashClass(e,t){if(!this.flashing.size)return"";let n=this.flashing.get(`${e}\0${t}`);return n?n.dir?` fg-cell-flash fg-cell-flash-${n.dir}`:" fg-cell-flash":""}flashMs(){let e=this.options.flashDuration;return typeof e=="number"&&e>0?e:1e3}flash(e){let t=this.flashMs(),n=Date.now()+t;for(let[s,i]of e)this.flashing.set(s,{until:n,dir:i});if(this.flashTimer)return;let r=()=>{let s=Date.now(),i=new Set,a=1/0;for(let[l,d]of this.flashing)d.until<=s?(this.flashing.delete(l),i.add(l.slice(0,l.indexOf("\0")))):a=Math.min(a,d.until);i.size&&this.renderer.invalidateRowIds(i),this.flashTimer=this.flashing.size&&!this.destroyed?window.setTimeout(r,Math.max(16,a-s)):0};this.flashTimer=window.setTimeout(r,t)}applyTransaction(e){return!e||typeof e!="object"?{added:[],updated:[],removed:[],notFound:[]}:this.applyTransactions([e])}applyTransactions(e){let t={added:[],updated:[],removed:[],notFound:[]};if(this.clientOnly("applyTransaction"))return t;let n=new Map;for(let d of this.columns.getState()){let c=this.columns.getNode(d.colId)?.def.field;c&&n.set(c,[...n.get(c)??[],d.colId])}let r=new Map,s={fields:new Set,ids:new Set},i=this.store.state.data,a=new Set(i),l=new Map(i.map(d=>[this.rowModel.idOf(d),d]));for(let d of e)d&&typeof d=="object"&&(i=this.txStep(d,i,{present:a,byId:l},t,r,n,s));if(!t.added.length&&!t.updated.length&&!t.removed.length)return t.notFound.length&&this.events.emit("transactionApplied",t),t;if(this.editVersion++,i===this.store.state.data&&!this.viewReads(s.fields))(this.options.autoRowHeight||this.options.getRowHeight)&&this.renderer.invalidateHeights(),this.refreshSummary(),this.finder.refresh(),this.columns.displayed().some(d=>d.def.merge||d.def.rowSpan||d.def.formula||d.def.formulas)||this.formats.dependsOnOtherRows()?this.renderer.invalidate({rows:!0}):this.renderer.invalidateRowIds(s.ids);else{this.renderer.invalidateHeights(),this.keepRange=!0;try{this.replaceData(i===this.store.state.data?[...i]:i)}finally{this.keepRange=!1}}return this.editor.sync(),r.size&&this.options.flashCells!==!1&&this.flash(r),this.events.emit("transactionApplied",t),t}viewReads(e){if(!e.size)return!1;let t=this.store.state;return this.pivotCfg||this.options.treeData||t.quickFilter||t.advancedFilter||this.groupBy.length?!0:[...t.sort.map(r=>r.colId),...Object.keys(t.filters)].some(r=>{let s=this.columns.getNode(r)?.def;return s?s.valueGetter||s.formulas||s.formula?!0:s.field!=null&&e.has(s.field):!1})}txStep(e,t,n,r,s,i,a){let l=this.options.getRowId,{present:d,byId:c}=n,u=m=>{if(!m||typeof m!="object")return null;if(d.has(m))return this.rowModel.idOf(m);try{return l?String(l(m)):null}catch{return null}},f=new Set;for(let m of e.remove??[]){let b=u(m),v=b===null?void 0:c.get(b);v&&!f.has(v)?(f.add(v),d.delete(v),c.delete(b),r.removed.push(v),this.tracker.created.delete(v),this.tracker.originals.delete(v)):v||r.notFound.push(m)}let p=(m,b,v)=>{let C=this.tracker.originals.get(v);for(let[S,T]of Object.entries(m)){C&&(C[S]=T);let k=v[S];if(Object.is(k,T))continue;v[S]=T,a.fields.add(S),a.ids.add(b);let E=typeof k=="number"&&typeof T=="number"?T>k?"up":"down":"";for(let R of i.get(S)??[])s.set(`${b}\0${R}`,E)}r.updated.push(v)};for(let m of e.update??[]){let b=u(m),v=b===null?void 0:c.get(b);if(!v||f.has(v)){r.notFound.push(m);continue}p(m,b,v)}let g=Array.isArray(e.add)?[...e.add]:[];for(let m of Array.isArray(e.upsert)?e.upsert:[]){let b=u(m),v=b===null?void 0:c.get(b);v&&!f.has(v)?p(m,b,v):m&&typeof m=="object"&&g.push(m)}let y=ye(g);r.added.push(...y);for(let m of y)d.add(m),c.set(this.rowModel.idOf(m),m);if(!f.size&&!y.length)return t;let w=f.size?t.filter(m=>!f.has(m)):[...t],h=typeof e.addIndex=="number"?Math.max(0,Math.min(w.length,Math.floor(e.addIndex))):w.length;return w.splice(h,0,...y),w}applyTransactionAsync(e){if(!e||typeof e!="object"||(this.txQueue.push(e),this.txTimer))return;let t=this.options.asyncTransactionWait;this.txTimer=window.setTimeout(()=>this.flushAsyncTransactions(),typeof t=="number"&&t>=0?t:50)}flushAsyncTransactions(){clearTimeout(this.txTimer),this.txTimer=0;let e=this.txQueue;this.txQueue=[],!(this.destroyed||!e.length)&&this.applyTransactions(e)}setAdvancedFilter(e){let t=e&&typeof e=="object"&&Array.isArray(e.conditions)&&e.conditions.length?e:null;t!==this.store.state.advancedFilter&&(this.store.set({advancedFilter:t}),this.events.emit("advancedFilterChange",{advancedFilter:t}))}setColumnGroupOpened(e,t){this.columns.setGroupOpen(e,!!t)&&(this.layoutChanged(),this.events.emit("columnGroupOpened",{groupId:e,open:!!t}))}getState(){let e=this.store.state,t=this.savedGroup?.groupBy??this.groupBy,n=this.savedGroup?.expanded??this.expanded,r={columns:this.columns.getState(),columnGroups:this.columns.groupOpenState(),advancedFilter:e.advancedFilter?JSON.parse(JSON.stringify(e.advancedFilter)):null,sort:e.sort.map(s=>({...s})),filters:JSON.parse(JSON.stringify(e.filters)),quickFilter:e.quickFilter,groupBy:[...t],pivot:this.pivotCfg?JSON.parse(JSON.stringify(this.pivotCfg)):null,expanded:Object.fromEntries(n),selected:[...e.selected]};return this.cfRules.length&&(r.conditionalFormats=this.getConditionalFormats()),this.options.pagination&&(r.page=this.page,r.pageSize=this.pageSize),r}setState(e,t={}){if(!e||typeof e!="object")return;let n=s=>e[s]!==void 0&&(!t.parts||t.parts.includes(s)),r=s=>!!this.columns.getNode(s);if(n("columns")&&Array.isArray(e.columns)&&(this.columns.applyState(e.columns.filter(s=>s&&r(s.colId))),this.columnsChanged()),n("columnGroups")&&e.columnGroups&&typeof e.columnGroups=="object")for(let[s,i]of Object.entries(e.columnGroups))typeof i=="boolean"&&this.setColumnGroupOpened(s,i);if(n("groupBy")&&Array.isArray(e.groupBy)&&this.setGroupBy(e.groupBy.filter(r)),n("pivot")&&this.setPivot(e.pivot??null),n("sort")&&Array.isArray(e.sort)&&this.setSort(e.sort.filter(s=>s&&r(s.colId))),n("filters")&&e.filters&&typeof e.filters=="object"){let s=Object.fromEntries(Object.entries(e.filters).filter(([i])=>r(i)));this.store.set({filters:s}),this.events.emit("filterChange",{filters:{...s}})}if(n("advancedFilter")&&this.setAdvancedFilter(e.advancedFilter??null),n("quickFilter")&&typeof e.quickFilter=="string"&&this.store.set({quickFilter:e.quickFilter}),n("expanded")&&e.expanded&&typeof e.expanded=="object"){let s=new Map(Object.entries(e.expanded).filter(([,i])=>typeof i=="boolean"));this.savedGroup?this.savedGroup.expanded=s:(this.expanded=s,this.displayChanged())}if(n("pageSize")&&typeof e.pageSize=="number"&&this.setPageSize(e.pageSize),n("page")&&typeof e.page=="number"&&this.setPage(e.page),n("conditionalFormats")&&Array.isArray(e.conditionalFormats)&&this.setConditionalFormats(e.conditionalFormats),n("selected")&&Array.isArray(e.selected)){let s=new Set(this.rowModel.allNodes().map(i=>i.id));this.setSelected(new Set(e.selected.map(String).filter(i=>s.has(i))))}}rowNumber(e){let t=this.rowModel.rows();if(this.rowNumberCache?.rows!==t){let r=new Int32Array(t.length),s=0;t.forEach((i,a)=>{r[a]=i.kind?0:++s}),this.rowNumberCache={rows:t,nums:r}}let n=this.rowNumberCache.nums[e];return n?n+(this.options.pagination&&!this.rowModel.server?this.page*this.pageSize:0):null}getPage(){return this.options.pagination?this.page:0}getPageSize(){return this.options.pagination?this.pageSize:this.rowModel.fullCount()}getPageCount(){return this.options.pagination?Math.max(1,Math.ceil(this.rowModel.fullCount()/this.pageSize)):1}setPage(e){if(!this.options.pagination||!Number.isFinite(e))return;let t=Math.max(0,Math.min(this.getPageCount()-1,Math.floor(e)));t!==this.page&&(this.veto("beforePageChange",{page:t,pageSize:this.pageSize})||(this.page=t,this.pageMoved()))}setPageSize(e){if(!this.options.pagination)return;if(!Number.isInteger(e)||e<=0){B("setPageSize: size must be a positive integer");return}if(e===this.pageSize)return;let t=this.page*this.pageSize;this.veto("beforePageChange",{page:Math.floor(t/e),pageSize:e})||(this.pageSize=e,this.page=Math.floor(t/e),this.pageMoved())}pageMoved(){this.editor.cancel(),this.updateRows(),this.store.state.range&&this.setRange(null);let e=this.rowModel.getRowCount(),t=this.store.state.focus;t&&t.rowIndex>=e&&this.store.set({focus:e?{...t,rowIndex:e-1}:null}),this.renderer.scroller.scrollTop=0,this.finder.refresh(),this.renderer.invalidate({header:!0,rows:!0}),this.emitPage()}emitPage(){this.events.emit("pageChange",{page:this.page,pageSize:this.pageSize,pageCount:this.getPageCount()})}refreshRows(){this.rowModel instanceof dt&&(this.rowModel.purge(),this.renderer.invalidate({rows:!0}))}serverLoaded(e,t,n){this.destroyed||(this.renderer.invalidate({header:!0,rows:!0}),this.events.emit("rowsLoaded",n===null?{start:e,end:t}:{start:e,end:t,total:n}))}serverFailed(e,t,n){this.destroyed||(B(`datasource.getRows failed for rows ${e}\u2013${t}`),this.toast(this.store.state.locale.loadFailed),this.renderer.invalidate({rows:!0}),this.events.emit("rowsLoadFailed",{start:e,end:t,error:n}))}syncScroll(e,t){if(!e||typeof e.setScrollPosition!="function"||e===this.api)return()=>{};let n=new Map,r=a=>`${a.top},${a.left}`,s=(a,l)=>a.on("scroll",d=>{if(n.get(a)===r(d)){n.delete(a);return}l.setScrollPosition(t==="vertical"?{top:d.top}:t==="horizontal"?{left:d.left}:d),n.set(l,r(l.getScrollPosition()))}),i=[s(this.api,e),s(e,this.api)];return()=>{for(let a of i)a()}}veto(e,t){let n=!1;return this.events.emit(e,{...t,cancel:()=>{n=!0}}),n}clientOnly(e){return this.rowModel.server?(B(`${e} is not available with a datasource`),!0):!1}displayChanged(){this.displayVersion++,this.updateRows(),this.store.state.range&&this.setRange(null);let e=this.rowModel.getRowCount(),t=this.store.state.focus;t&&t.rowIndex>=e&&this.store.set({focus:e?{...t,rowIndex:e-1}:null}),this.finder.refresh(),this.renderer.invalidate({header:!0,rows:!0})}validGroupBy(e){return Array.isArray(e)?[...new Set(e)].filter(t=>{let n=this.columns.getNode(t);return!n||n.children||$(t)?(B(`groupBy: unknown column "${t}"`),!1):!0}):[]}getGroupBy(){return[...this.groupBy]}setGroupBy(e){let t=this.validGroupBy(e);t.join("")!==this.groupBy.join("")&&(this.groupBy=t,this.page=0,this.groupPanel?.refresh(),this.displayChanged(),this.events.emit("groupChange",{groupBy:[...t]}))}isExpandable(e){return!!e&&(e.kind==="group"||!!e.hasChildren)}expandKey(e){return e.group?e.group.key:e.id}loadChildren(e){let t=this.options.treeData,n=e.id;if(this.treeLoading.has(n))return;if(typeof t.loadChildren!="function"){B("treeData.hasChildren needs treeData.loadChildren");return}this.treeLoading.add(n),this.displayChanged();let r=()=>(this.treeLoading.delete(n),!this.destroyed&&this.store.state.data.includes(e.data));Promise.resolve().then(()=>t.loadChildren(e.data)).then(s=>{if(!r())return;let i=ye(Array.isArray(s)?s:[]);this.treeLoaded.add(n),this.expanded.set(n,!0),i.length&&this.replaceData([...this.store.state.data,...i]),this.displayChanged(),this.events.emit("childrenLoaded",{row:e.data,rows:i}),this.events.emit("groupToggle",{key:n,expanded:!0})},s=>{r()&&(B(`treeData.loadChildren failed for row "${n}"`),this.displayChanged(),this.events.emit("childrenLoadFailed",{row:e.data,error:s}))})}setGroupExpanded(e,t){let n=this.rowModel.rows().find(s=>this.isExpandable(s)&&this.expandKey(s)===e);if((n?!!(n.group?.expanded??n.expanded):this.expanded.get(e))!==t){if(t&&n&&!n.group&&this.options.treeData&&this.lazyChildren(n.id,n.data)){this.loadChildren(n);return}this.expanded.set(e,t),this.displayChanged(),this.events.emit("groupToggle",{key:e,expanded:t})}}toggleRow(e){let t=this.rowModel.getRow(e);this.isExpandable(t)&&this.setGroupExpanded(this.expandKey(t),!(t.group?.expanded??t.expanded))}expandAll(e=!0){this.expanded.clear(),this.defaultExpanded=e?-1:0,this.displayChanged()}groupAggregate(e,t){let n=this.columns.getNode(t)?.def;if(!e.group||!n?.aggFunc)return;if(e.group.aggregates)return e.group.aggregates[t]??(n.field?e.group.aggregates[n.field]:void 0);this.aggCache.ver!==this.editVersion&&(this.aggCache={ver:this.editVersion,map:new WeakMap});let r=this.aggCache.map.get(e.group);if(r||this.aggCache.map.set(e.group,r=new Map),!r.has(t)){let s=e.group.rows;try{r.set(t,Re(n.aggFunc,s.map(i=>G(n,i)),s))}catch{B(`aggFunc of column "${t}" threw`),r.set(t,null)}}return r.get(t)}canExpandDetail(e){if(!this.options.detailRenderer)return!1;try{return!this.options.isRowMaster||!!this.options.isRowMaster(e)}catch{return!1}}isDetailExpanded(e){return!!e&&typeof e=="object"&&this.detailOpen.has(this.rowModel.idOf(e))}setDetailExpanded(e,t){if(!e||typeof e!="object"||t&&!this.canExpandDetail(e))return;let n=this.rowModel.idOf(e);this.detailOpen.has(n)!==t&&(t?this.detailOpen.add(n):(this.detailOpen.delete(n),this.renderer.dropDetail(n)),this.displayChanged(),this.events.emit("detailToggle",{row:e,expanded:t}))}canMoveRows(){let e=this.store.state,t=this.options.treeData;return!this.rowModel.server&&!e.sort.length&&!Object.keys(e.filters).length&&!e.quickFilter.trim()&&!this.groupBy.length&&(!t||typeof t.setParentId=="function")}get dragOptions(){let e=this.options.rowDrag;return e&&typeof e=="object"?e:{}}parentOf(e){let t=null;try{t=this.options.treeData.getParentId(e)}catch{t=null}return t==null?null:String(t)}rawParent(e){try{return this.options.treeData.getParentId(e)??null}catch{return null}}idValue(e){let t=this.rowModel.idOf(e);for(let r of this.store.state.data){let s=this.rawParent(r);if(s!==null&&String(s)===t)return s}return this.store.state.data.some(r=>typeof this.rawParent(r)=="number")&&t.trim()!==""&&Number.isFinite(Number(t))?Number(t):t}canDropRow(e,t,n,r=this){if(!this.canMoveRows()||t===e)return!1;if(r===this&&this.options.treeData&&t){let i=this.rowModel.idOf(e),a=new Set;for(let l=this.rowModel.idOf(t);l!==null&&!a.has(l);){if(l===i)return!1;a.add(l);let d=this.rowModel.allNodes().find(c=>c.id===l);l=d?this.parentOf(d.data):null}}let s=this.dragOptions.canDrop;if(!s)return!0;try{return s({row:e,target:t,position:n,fromOtherGrid:r!==this})!==!1}catch{return B("rowDrag.canDrop threw; the drop was refused"),!1}}dropRow(e,t,n="after",r=this){if(this.clientOnly("dropRow")||!e||typeof e!="object")return!1;let s=this.options.treeData;!s&&n==="inside"&&(n="after");let i=this.store.state.data,a=r!==this,l=a?-1:i.indexOf(e);if(!a&&l<0||t&&!i.includes(t)||a&&(!r.canMoveRows()||i.includes(e))||!this.canDropRow(e,t,n,r))return!1;let d=s?this.rawParent(e):null,c=!s||!t?null:n==="inside"?t:this.store.state.data.find(h=>this.rowModel.idOf(h)===this.parentOf(t))??null,u=c?this.idValue(c):null,f=i.filter(h=>h!==e),p=!t||n==="inside"?f.length:f.indexOf(t)+(n==="after"?1:0);f.splice(p,0,e);let g=f.some((h,m)=>h!==i[m]);if(!a&&!g&&String(d??"")===String(u??""))return!1;let y=(h,m)=>{try{s.setParentId(e,h,m)}catch{B("treeData.setParentId threw")}},w=s?this.store.state.data.find(h=>this.rowModel.idOf(h)===this.parentOf(e))??null:null;return a?(r.removeRows([e]),s&&y(u,c),this.addRows([e],p)):(s&&y(u,c),this.replaceData(f),this.history.push({undo:()=>{s&&y(d,w),this.replaceData(i)},redo:()=>{s&&y(u,c),this.replaceData(f)}}),this.events.emit("rowDragEnd",{row:e,fromIndex:l,toIndex:p})),this.events.emit("rowDrop",{row:e,target:t,position:n,fromOtherGrid:a,fromGrid:a?r.api:null}),!0}moveRow(e,t,n=!0){if(this.clientOnly("moveRow")||!this.canMoveRows())return!1;let r=this.store.state.data,s=r.indexOf(e);if(s<0||!Number.isFinite(t))return!1;let i=Math.max(0,Math.min(r.length-1,Math.floor(t)));if(i===s)return!1;let a=[...r];return a.splice(s,1),a.splice(i,0,e),this.replaceData(a),n&&this.history.push({undo:()=>this.moveRow(e,s,!1),redo:()=>this.moveRow(e,i,!1)}),this.events.emit("rowDragEnd",{row:e,fromIndex:s,toIndex:i}),!0}setFont(e){let t=this.font.size;e.size!==void 0&&(typeof e.size=="number"&&e.size>0?t=e.size:B("setFont: size must be a positive number"));let n=e.family===void 0?this.font.family:e.family||null;this.font={size:t,family:n};let r=t??oo;this.applyAutoHeights(r),this.renderer.applyFont(t,n),this.renderer.invalidateHeights(),this.menu.close(),this.layoutChanged()}densityOf(e){return e==="compact"||e==="comfortable"?e:"normal"}applyAutoHeights(e){let[t,n]=ro[this.density];this.options.rowHeight==null&&(this.renderer.opts.rowHeight=Math.round(jr(e)*t)),this.options.headerHeight==null&&(this.renderer.opts.headerHeight=Math.round(Kr(e)*n))}setDensity(e){let t=this.densityOf(e);t!==this.density&&(this.density=t,this.renderer.applyTheme(),this.applyAutoHeights(this.font.size??oo),this.renderer.invalidateHeights(),this.layoutChanged())}applyFontTo(e){this.font.size&&e.style.setProperty("--fg-font-size",`${this.font.size}px`),this.font.family&&e.style.setProperty("--fg-font",this.font.family)}summary(){return this.summaryOpts&&this.summaryOpts.rows?.length?{opts:this.summaryOpts,values:this.summaryValues}:null}setSummary(e){if(e&&!Array.isArray(e.rows)){B("setSummary: summary.rows must be an array");return}this.summaryOpts=e,this.refreshSummary(),this.renderer.invalidate({header:!0,rows:!0})}refreshSummary(){let e=this.summaryOpts;if(!e?.rows?.length){this.summaryValues=[];return}let t=e.scope??"filtered",n=t==="all"?this.rowModel.allNodes().map(r=>r.data):t==="selected"?this.selectedRows():this.rowModel.dataRows().map(r=>r.data);this.summaryValues=Jo(e.rows,n,r=>this.columns.getNode(r)?.def)}dataColumns(){return this.columns.displayed().filter(e=>!$(e.id))}validRange(e){if(!e||this.options.rangeSelection===!1)return null;let t=this.rowModel.getRowCount(),n=r=>!!r&&!$(r.colId)&&!!this.columns.getColumn(r.colId)&&r.rowIndex>=0&&r.rowIndex<t;return n(e.start)&&n(e.end)?{start:{...e.start},end:{...e.end}}:null}setRange(e,t=!1){let n=this.validRange(e),r=t||!this.store.state.extraRanges.length?this.store.state.extraRanges:[],s=this.store.state.range;JSON.stringify(s)===JSON.stringify(n)&&r===this.store.state.extraRanges||(this.store.set({range:n,extraRanges:r}),this.events.emit("rangeChange",{range:n&&{start:{...n.start},end:{...n.end}}}))}addRange(e){let{range:t,focus:n}=this.store.state,r=this.validRange(t??(n?{start:n,end:n}:null));r&&this.store.set({extraRanges:[...this.store.state.extraRanges,r]}),this.setRange(e,!0)}getRanges(){let e=[...this.store.state.extraRanges];return this.store.state.range&&e.push(this.store.state.range),e.map(t=>({start:{...t.start},end:{...t.end}}))}setRanges(e){let t=(Array.isArray(e)?e:[]).map(n=>this.validRange(n)).filter(n=>!!n);this.store.set({extraRanges:t.slice(0,-1)}),this.setRange(t[t.length-1]??null,!0)}boundsOf(e){if(!e)return null;let t=this.columns.getColumn(e.start.colId),n=this.columns.getColumn(e.end.colId);return!t||!n?null:nt({start:{rowIndex:e.start.rowIndex,colIndex:t.index},end:{rowIndex:e.end.rowIndex,colIndex:n.index}})}rangeBounds(){return this.boundsOf(this.store.state.range)}allRangeBounds(){return[...this.store.state.extraRanges,this.store.state.range].map(e=>this.boundsOf(e)).filter(e=>!!e)}rangeContains(e,t){let n=this.columns.getColumn(t);return!!n&&this.allRangeBounds().some(r=>ar(r,e,n.index))}selectAllCells(){let e=this.dataColumns(),t=this.rowModel.getRowCount();!e.length||!t||(this.store.state.focus||this.setFocus(0,e[0].id),this.setRange({start:{rowIndex:0,colId:e[0].id},end:{rowIndex:t-1,colId:e[e.length-1].id}}))}selectionTSV(e,t=!1){let n=this.store.state.locale.code,r=this.columns.displayed(),s=t?null:this.rangeBounds(),i=t,a,l,d=t?[]:this.allRangeBounds();if(d.length>1){let u=d.every(p=>p.c1===d[0].c1&&p.c2===d[0].c2),f=d.every(p=>p.r1===d[0].r1&&p.r2===d[0].r2);if(this.rangesStack(d)){let p=[...d].sort((w,h)=>u?w.r1-h.r1:w.c1-h.c1),g=p.map(w=>this.rangeMatrix(w)),y=u?g.flat():g[0].map((w,h)=>g.flatMap(m=>m[h]??[]));return e&&y.unshift((u?p.slice(0,1):p).flatMap(w=>this.rangeHeaders(w))),An(y)}}if(s){a=[];for(let u=s.r1;u<=s.r2;u++){let f=this.rowModel.getRow(u);f.kind||a.push(f.data)}l=r.slice(s.c1,s.c2+1).filter(u=>!$(u.id))}else if(i){let u=this.store.state.selected;a=this.rowModel.dataRows().filter(f=>u.has(f.id)).map(f=>f.data),l=this.dataColumns()}else{let u=this.store.state.focus,f=u&&this.columns.getColumn(u.colId),p=u&&this.rowModel.getRow(u.rowIndex);if(!f||!p||p.kind||$(f.id))return"";a=[p.data],l=[f]}let c=a.map(u=>l.map(f=>this.copyCell(f.def,u,n)));return e&&c.unshift(l.map(u=>u.def.header??u.def.field??u.id)),An(c)}rangesStack(e){return e.length>1&&(e.every(t=>t.c1===e[0].c1&&t.c2===e[0].c2)||e.every(t=>t.r1===e[0].r1&&t.r2===e[0].r2))}rangeHeaders(e){return this.columns.displayed().slice(e.c1,e.c2+1).filter(t=>!$(t.id)).map(t=>t.def.header??t.def.field??t.id)}rangeMatrix(e){let t=this.columns.displayed().slice(e.c1,e.c2+1).filter(s=>!$(s.id)),n=this.store.state.locale.code,r=[];for(let s=e.r1;s<=e.r2;s++){let i=this.rowModel.getRow(s);i&&!i.kind&&r.push(t.map(a=>this.copyCell(a.def,i.data,n)))}return r}copyCell(e,t,n){return this.copyAllowed(e,t)?Nt(e,G(e,t),n):""}copyAllowed(e,t){let n=e.copyable;if(typeof n!="function")return n!==!1;try{return n({value:G(e,t),row:t,column:e})!==!1}catch{return!1}}cutToClipboard(){let e=this.copyToClipboard(!1);return e&&this.clearCells(!0),e}copyToClipboard(e,t=!1){let n=this.selectionTSV(e,t);if(n&&typeof navigator<"u"&&navigator.clipboard?.writeText)try{navigator.clipboard.writeText(n)?.catch?.(()=>{})}catch{}return n}pasteText(e){let t=sr(e),n={changed:0,skipped:0};if(!t.length)return n;let r=this.columns.displayed(),s=this.rowModel.getRowCount(),i=this.rangeBounds(),a=this.store.state.focus,l=a&&this.columns.getColumn(a.colId),d,c;if(i)d=i.r1,c=i.c1;else if(a&&l&&!$(l.id))d=a.rowIndex,c=l.index;else return n;let u=[],f=t.length===1&&t[0].length===1,p=f&&i?i.r2-i.r1+1:t.length,g=f&&i?i.c2-i.c1+1:Math.max(...t.map(y=>y.length));for(let y=0;y<p;y++){let w=d+y;if(w>=s)break;let h=this.rowModel.getRow(w);if(!h.kind)for(let m=0;m<g;m++){let b=r[c+m];if(!b)break;if($(b.id))continue;let v=f&&i?t[0][0]:t[y]?.[m];if(v===void 0)continue;let C=b.def;if(!C.field||!pe(C,h.data,w)){n.skipped++;continue}let S=h.data[C.field],T=this.acceptText(C,h.data,v,S);if(!T.ok){n.skipped++;continue}this.writeCell(u,h.data,C.field,b.id,w,T.value)&&n.changed++}}return this.endCellTx(u),this.events.emit("paste",{...n}),n}acceptText(e,t,n,r){let s,i=e.editor;if(i&&typeof i=="object"&&i.type==="select"){let a=(typeof i.options=="function"?i.options(t):i.options)??[],l=n.trim().toLowerCase(),d=a.map(c=>c!==null&&typeof c=="object"&&"value"in c?c:{value:c,label:String(c),disabled:!1}).find(c=>String(c.value).toLowerCase()===l||(c.label??"").toLowerCase()===l);if(!d||d.disabled)return{ok:!1};s=d.value}else if(e.formulas&&Le(n.trim()))s=n.trim();else{let a=Ot(e,n,r);if(!a.ok)return a;s=a.value}return this.cellError(e,t,s)!==null?{ok:!1}:{ok:!0,value:s}}cellError(e,t,n){let r=this.store.state.locale;if(e.required&&W(n))return r.required;if(e.unique&&e.field&&!W(n)){let s=n instanceof Date?n.getTime():String(n),i=e.field;if(this.store.state.data.some(a=>{if(a===t)return!1;let l=a[i];return!W(l)&&(l instanceof Date?l.getTime():String(l))===s}))return r.duplicate}if(e.validate){let s;try{s=e.validate(n,t)}catch{s=r.invalidValue}if(s!==!0)return typeof s=="string"&&s?s:r.invalidValue}return null}validateAll(){let e=[],t=this.columns.getState().map(n=>({id:n.colId,def:this.columns.getNode(n.colId).def})).filter(n=>n.def.field&&n.def.editable&&(n.def.required||n.def.unique||n.def.validate));return this.store.state.data.forEach((n,r)=>{let s=this.rowModel.idOf(n),i=this.rowModel.indexOfId(s);for(let a of t){if(!pe(a.def,n,i<0?r:i))continue;let l=this.cellError(a.def,n,n[a.def.field]);l!==null&&e.push({row:n,rowIndex:i,colId:a.id,message:l})}}),e}mergeSpans(){if(this.rowModel.server||!this.columns.displayed().some(s=>s.def.merge||s.def.rowSpan))return ya;let e=this.rowModel.rows(),t=this.editVersion*1e6+this.columns.displayed().length;if(this.spanCache&&this.spanCache.rows===e&&this.spanCache.ver===t)return this.spanCache.spans;let n=new Map,r=this.columns.displayed().filter(s=>s.def.merge||s.def.rowSpan);if(r.length&&!e.some(s=>s.kind)){let s=e.map(i=>i.data);for(let i of r)n.set(i.id,Ct(s,i.def))}return this.spanCache={rows:e,ver:t,spans:n},n}rangeAggregates(){let e=this.allRangeBounds();if(!e.length)return null;let t=this.columns.displayed(),n={cells:0,count:0,numbers:0,sum:0,min:1/0,max:-1/0},r=e.length>1?new Set:null;for(let s of e)for(let i=s.r1;i<=s.r2;i++){let a=this.rowModel.getRow(i);if(!a||a.kind)continue;let l=a.data;for(let d of t.slice(s.c1,s.c2+1)){if($(d.id))continue;if(r){let u=`${i},${d.index}`;if(r.has(u))continue;r.add(u)}n.cells++;let c=G(d.def,l);if(!W(c)&&(n.count++,typeof c=="number"||d.def.type==="number"&&!Number.isNaN(Number(c)))){let u=Number(c);n.numbers++,n.sum+=u,u<n.min&&(n.min=u),u>n.max&&(n.max=u)}}}return n}fillRange(e){let t=this.rangeBounds()??(()=>{let u=this.store.state.focus,f=u&&this.columns.getColumn(u.colId);return u&&f&&!$(f.id)?{r1:u.rowIndex,r2:u.rowIndex,c1:f.index,c2:f.index}:null})(),n=this.columns.getColumn(e.start.colId),r=this.columns.getColumn(e.end.colId);if(!t||!n||!r)return;let s=nt({start:{rowIndex:e.start.rowIndex,colIndex:n.index},end:{rowIndex:e.end.rowIndex,colIndex:r.index}}),i=this.rowModel.getRowCount();s.r1=Math.max(0,s.r1),s.r2=Math.min(i-1,s.r2);let a=this.columns.displayed(),l=[],d=(u,f,p)=>{let g=a[f],y=this.rowModel.getRow(u),w=g?.def;!y||y.kind||!w?.field||$(g.id)||!pe(w,y.data,u)||this.cellError(w,y.data,p)===null&&this.writeCell(l,y.data,w.field,g.id,u,p)},c=(u,f)=>G(a[f].def,this.rowModel.getRow(u).data);if(s.r1<t.r1||s.r2>t.r2)for(let u=t.c1;u<=t.c2;u++){let f=[],p=[];for(let g=t.r1;g<=t.r2;g++)f.push(c(g,u));for(let g=t.r2;g>=t.r1;g--)p.push(c(g,u));tt(f,s.r2-t.r2).forEach((g,y)=>d(t.r2+1+y,u,g)),tt(p,t.r1-s.r1).forEach((g,y)=>d(t.r1-1-y,u,g))}else if(s.c1<t.c1||s.c2>t.c2)for(let u=t.r1;u<=t.r2;u++){let f=[],p=[];for(let g=t.c1;g<=t.c2;g++)f.push(c(u,g));for(let g=t.c2;g>=t.c1;g--)p.push(c(u,g));tt(f,s.c2-t.c2).forEach((g,y)=>d(u,t.c2+1+y,g)),tt(p,t.c1-s.c1).forEach((g,y)=>d(u,t.c1-1-y,g))}else return;this.endCellTx(l),this.setRange({start:{rowIndex:s.r1,colId:a[s.c1].id},end:{rowIndex:s.r2,colId:a[s.c2].id}})}setPinnedRows(e){e.top&&(this.pinnedRows.top=ye(e.top)),e.bottom&&(this.pinnedRows.bottom=ye(e.bottom)),this.renderer.invalidate({rows:!0})}writeCell(e,t,n,r,s,i){let a=t[n];return Object.is(a,i)||this.veto("beforeCellChange",{row:t,rowIndex:s,colId:r,oldValue:a,newValue:i})?!1:(this.tracker.beforeChange(t),t[n]=i,e.push({row:t,field:n,colId:r,oldValue:a,newValue:i}),this.events.emit("cellValueChanged",{row:t,rowIndex:s,colId:r,oldValue:a,newValue:i}),!0)}endCellTx(e){if(!e.length)return;let t=(n,r)=>{for(let s of n){let i=s.row[s.field];s.row[s.field]=s[r],this.events.emit("cellValueChanged",{row:s.row,rowIndex:this.rowModel.indexOfId(this.rowModel.idOf(s.row)),colId:s.colId,oldValue:i,newValue:s[r]})}this.afterDataEdit()};this.history.push({undo:()=>t([...e].reverse(),"oldValue"),redo:()=>t(e,"newValue")}),this.afterDataEdit()}afterDataEdit(){this.renderer.invalidateHeights(),this.editVersion++,this.refreshSummary(),this.renderer.invalidate({rows:!0})}applyEdit(e,t,n){let r=this.rowModel.getRow(e),s=this.columns.getColumn(t)?.def;if(!r||!s?.field)return;let i=[];this.writeCell(i,r.data,s.field,t,e,n),this.endCellTx(i)}clearCells(e=!1){let t=this.columns.displayed(),n=this.allRangeBounds();if(e&&!this.rangesStack(n)){let l=this.rangeBounds();n=l?[l]:[]}let r=this.store.state.focus,s=r?this.columns.getColumn(r.colId)?.index:void 0,i=n.length?n:r&&s!==void 0?[{r1:r.rowIndex,r2:r.rowIndex,c1:s,c2:s}]:[];if(!i.length)return;let a=[];for(let l of i)for(let d=l.r1;d<=l.r2;d++){let c=this.rowModel.getRow(d);for(let u=l.c1;u<=l.c2;u++){let f=t[u]?.def;c&&!c.kind&&f?.field&&pe(f,c.data,d)&&(!e||this.copyAllowed(f,c.data))&&this.writeCell(a,c.data,f.field,t[u].id,d,null)}}this.endCellTx(a)}replaceData(e){this.store.set({data:e});let t=new Set(this.rowModel.allNodes().map(i=>i.id)),n=this.store.state.selected;[...n].some(i=>!t.has(i))&&this.setSelected(new Set([...n].filter(i=>t.has(i))));let r=this.rowModel.getRowCount(),s=this.store.state.focus;s&&s.rowIndex>=r&&this.store.set({focus:r?{...s,rowIndex:r-1}:null})}addRows(e,t,n=!0){if(this.clientOnly("addRows"))return[];let r=ye(Array.isArray(e)?e:[]);if(!r.length)return[];let s=[...this.store.state.data],i=t===void 0?s.length:Math.max(0,Math.min(s.length,t));s.splice(i,0,...r);for(let a of r)this.tracker.created.add(a);return this.replaceData(s),n&&this.history.push({undo:()=>this.removeRows(r,!1),redo:()=>this.addRows(r,i,!1)}),this.events.emit("rowsAdded",{rows:[...r]}),r}removeRows(e,t=!0){if(this.clientOnly("removeRows"))return[];let n=this.store.state.data,r=typeof e=="function"?e:(l=>d=>l.has(d))(new Set(e)),s=[];if(n.forEach((l,d)=>{let c=!1;try{c=!!r(l)}catch{c=!1}c&&s.push({row:l,index:d})}),!s.length)return[];let i=new Set(s.map(l=>l.row)),a=new Set(s.filter(l=>this.tracker.created.has(l.row)).map(l=>l.row));for(let{row:l,index:d}of s)a.has(l)?this.tracker.created.delete(l):this.tracker.deleted.set(l,d);return this.replaceData(n.filter(l=>!i.has(l))),t&&this.history.push({undo:()=>{let l=[...this.store.state.data];for(let{row:d,index:c}of s)l.splice(Math.min(c,l.length),0,d),this.tracker.deleted.delete(d),a.has(d)&&this.tracker.created.add(d);this.replaceData(l)},redo:()=>this.removeRows([...i],!1)}),this.events.emit("rowsRemoved",{rows:s.map(l=>l.row)}),s.map(l=>l.row)}trackedFields(){let e=[],t=n=>{for(let r of n)r.children?t(r.children):r.def.field&&!$(r.id)&&e.push({field:r.def.field,colId:r.id})};return t(this.columns.roots()),e}getChanges(){let e=this.trackedFields(),t=[];for(let[n,r]of this.tracker.originals)if(!this.tracker.deleted.has(n))for(let s of this.tracker.diff(n,e.map(i=>i.field)))t.push({row:n,colId:e.find(i=>i.field===s).colId,oldValue:r[s],newValue:n[s]});return t}getModifiedRows(){let e=this.trackedFields().map(n=>n.field),t=this.store.state.data;return{created:t.filter(n=>this.tracker.created.has(n)),updated:t.filter(n=>this.tracker.originals.has(n)&&this.tracker.diff(n,e).length>0),deleted:[...this.tracker.deleted.keys()]}}hasChanges(){let e=this.getModifiedRows();return e.created.length+e.updated.length+e.deleted.length>0}commitChanges(e){e&&e.rows instanceof Map?this.tracker.commit(e.rows,Array.isArray(e.deleted)?e.deleted:[]):this.tracker.reset(),this.renderer.invalidate({rows:!0})}revertChanges(){this.editor.cancel();for(let[n,r]of this.tracker.originals)Object.assign(n,r);let e=this.store.state.data.filter(n=>!this.tracker.created.has(n)),t=[...this.tracker.deleted.entries()].sort((n,r)=>n[1]-r[1]);e=[...e];for(let[n,r]of t)e.splice(Math.min(r,e.length),0,n);this.tracker.reset(),this.history.clear(),this.replaceData(e),this.afterDataEdit()}undo(){this.editor.cancel(),this.history.undo()}redo(){this.editor.cancel(),this.history.redo()}toast(e){let t=x("div","fg-toast",{role:"status"});t.textContent=e,this.renderer.root.append(t),setTimeout(()=>t.remove(),3500)}refreshChoosers(){this.chooser.refresh(),this.sideBar?.refresh()}setColumnsVisible(e,t){let n=[];for(let r of e){let s=this.columns.getNode(r);!s||s.children||s.hide===!t||(this.columns.setHide(r,!t),n.push(r))}if(n.length){this.columnsChanged();for(let r of n)this.events.emit("columnVisible",{colId:r,visible:t})}}autoSize(e){let t=(e?e.map(l=>this.columns.getColumn(l)):this.columns.displayed()).filter(l=>!!l&&pt(l.def)),{first:n,last:r}=this.renderer.renderedRange(),s=this.store.state.locale.code,i=66,a=24;for(let l of t){let d=this.renderer.measureText(l.def.header??l.def.field??"",!0)+i,c=X(l.def,s);for(let f=n;f<=r;f++){let p=this.rowModel.getRow(f);p&&(d=Math.max(d,this.renderer.measureText(c(G(l.def,p.data)),!1)+a))}let u=this.columns.setWidth(l.id,Math.ceil(d));this.events.emit("columnResize",{colId:l.id,width:u})}this.layoutChanged()}resetColumns(){this.columns.reset(),this.columnsChanged()}setSort(e){let t=e.filter(n=>{let r=this.columns.getNode(n.colId);return!r||r.children?(B(`setSort: unknown column "${n.colId}"`),!1):n.dir==="asc"||n.dir==="desc"});this.veto("beforeSort",{sort:t.map(n=>({...n}))})||(this.store.set({sort:t}),this.events.emit("sortChange",{sort:[...t]}))}toggleSort(e,t){let n=this.store.state.sort,r=n.find(a=>a.colId===e),s=r?r.dir==="asc"?"desc":null:"asc",i;t?s?r?i=n.map(a=>a.colId===e?{colId:e,dir:s}:a):i=[...n,{colId:e,dir:s}]:i=n.filter(a=>a.colId!==e):i=s?[{colId:e,dir:s}]:[],this.setSort(i)}setFilter(e,t){let n=this.columns.getNode(e);if(!n||n.children){B(`setFilter: unknown column "${e}"`);return}if(this.veto("beforeFilter",{colId:e,model:t}))return;let r={...this.store.state.filters};t?r[e]=t:delete r[e],this.store.set({filters:r}),this.events.emit("filterChange",{filters:{...r}})}setPinned(e,t){this.columns.setPinned(e,t),this.layoutChanged()}setFocus(e,t){let n=this.store.state.focus;n&&n.rowIndex===e&&n.colId===t||(this.store.set({focus:{rowIndex:e,colId:t}}),this.events.emit("focusChange",{rowIndex:e,colId:t}))}setSelected(e,t=this.store.state.anchorId){this.selectionVersion++,this.store.set({selected:e,anchorId:t}),this.events.emit("selectionChange",{selected:this.selectedRows()})}rowSelectable(e){let t=this.options.isRowSelectable;if(!t)return!0;try{return!!t(e)}catch{return!1}}groupMemberIds(e){if(e.group)return e.group.rows.filter(a=>this.rowSelectable(a)).map(a=>this.rowModel.idOf(a));let t=this.options.treeData?.getParentId;if(!t)return[];let n=new Map;for(let a of this.store.state.data){let l=null;try{l=t(a)}catch{l=null}if(l==null)continue;let d=String(l),c=n.get(d);c?c.push(a):n.set(d,[a])}let r=[],s=new Set([e.id]),i=[e.id];for(;i.length;)for(let a of n.get(i.shift())??[]){let l=this.rowModel.idOf(a);s.has(l)||(s.add(l),i.push(l),this.rowSelectable(a)&&r.push(l))}return r}groupSelection(e){let t=this.groupMemberIds(e),n=this.store.state.selected,r=t.filter(s=>n.has(s)).length;return r===0?"none":r===t.length?"all":"some"}toggleGroupSelection(e){if(this.options.rowSelection!=="multiple")return;let t=this.groupMemberIds(e),n=new Set(this.store.state.selected),r=t.length>0&&t.every(s=>n.has(s));for(let s of t)r?n.delete(s):n.add(s);this.setSelected(n)}selectFromClick(e,t,n){let r=this.options.rowSelection;if(!r||e<0||e>=this.rowModel.getRowCount())return;let s=this.rowModel.getRow(e);if(s.kind||!this.rowSelectable(s.data))return;let i=zr({selected:this.store.state.selected,anchorIndex:this.anchorIndex(),mode:r,index:e,idAt:a=>this.rowModel.getRow(a).id,toggle:t,range:n});if(this.rowModel.rows()!==this.rowModel.dataRows()||this.options.isRowSelectable)for(let a of i.selected){if(this.store.state.selected.has(a))continue;let l=this.rowModel.indexOfId(a),d=l>=0?this.rowModel.getRow(l):null;d&&(d.kind||!this.rowSelectable(d.data))&&i.selected.delete(a)}if(r==="multiple"&&this.options.groupSelectsChildren&&this.options.treeData&&s.hasChildren){let a=i.selected.has(s.id);for(let l of this.groupMemberIds(s))a?i.selected.add(l):i.selected.delete(l)}this.setSelected(i.selected,this.rowModel.getRow(i.anchorIndex)?.id??null)}anchorIndex(){let e=this.store.state.anchorId;if(e==null)return null;let t=this.rowModel.indexOfId(e);return t<0?null:t}selectableRows(){let e=this.rowModel.dataRows();return this.options.isRowSelectable?e.filter(t=>this.rowSelectable(t.data)):e}toggleSelectAll(){let e=this.selectableRows(),t=this.store.state.selected,n=e.length>0&&e.every(s=>t.has(s.id)),r=new Set(t);for(let s of e)n?r.delete(s.id):r.add(s.id);this.setSelected(r)}selectedRows(){let e=this.store.state.selected;return e.size?this.rowModel.allNodes().filter(t=>e.has(t.id)).map(t=>t.data):[]}withSelect(e){let t=[],n=this.options.rowNumbers;if(n){let r=typeof n=="object"?n:{};t.push(Eo(typeof r.width=="number"&&r.width>0?r.width:void 0,typeof r.header=="string"?r.header:void 0))}return this.options.rowDrag&&t.push(Mo),this.options.rowSelection&&t.push(So),[...t,...e]}setData(e,t){if(this.clientOnly("setData"))return;if(!Array.isArray(e)){B("setData: rows must be an array");return}this.editor.cancel(),this.tracker.reset(),this.history.clear(),this.detailOpen.clear(),this.treeLoaded.clear(),this.treeLoading.clear(),this.renderer.dropDetail(),this.store.set({data:ye(e)}),t?.scrollToTop&&this.renderer.setScroll({top:0,left:0});let n=this.store.state.selected;if(n.size)if(this.options.getRowId){let i=new Set(this.rowModel.allNodes().map(l=>l.id)),a=new Set([...n].filter(l=>i.has(l)));a.size!==n.size&&this.setSelected(a)}else this.setSelected(new Set,null);let r=this.rowModel.getRowCount(),s=this.store.state.focus;s&&s.rowIndex>=r&&this.store.set({focus:r?{...s,rowIndex:r-1}:null})}setColumns(e){if(!Array.isArray(e)){B("setColumns: columns must be an array");return}if(this.menu.close(),this.sourceDefs=e,this.pivotCfg){this.rebuildPivot();return}this.columns.setDefs(this.withSelect(e)),this.bindFormulas();let t=r=>!!this.columns.getNode(r),n=this.groupBy.filter(t);n.length!==this.groupBy.length&&(this.groupBy=n,this.groupPanel?.refresh(),this.events.emit("groupChange",{groupBy:[...n]})),this.store.set({sort:this.store.state.sort.filter(r=>t(r.colId)),filters:Object.fromEntries(Object.entries(this.store.state.filters).filter(([r])=>t(r))),focus:null}),this.columnsChanged()}onChange(e){let t=(...r)=>r.some(s=>e.includes(s));this.pivotCfg&&t("data","locale")&&this.rebuildPivot(!1),t("locale")&&(this.menu.close(),this.chooser.close(),this.sideBar?.refresh(),this.rowModel.invalidate());let n=t("sort","filters","quickFilter","advancedFilter")&&this.page!==0;n&&(this.page=0),t("data","sort","filters","quickFilter","advancedFilter","locale")&&this.updateRows(),n&&this.emitPage(),t("data","sort","filters","quickFilter","advancedFilter")&&this.store.state.range&&!this.keepRange&&this.setRange(null),t("data","sort","filters","quickFilter","advancedFilter","locale")&&this.finder.refresh(),(t("data","filters","quickFilter","advancedFilter","locale")||t("selected")&&this.summaryOpts?.scope==="selected")&&this.refreshSummary(),t("locale")&&this.groupPanel?.refresh(),t("filters")&&this.sideBar?.refresh(),t("theme")&&this.renderer.applyTheme(),this.renderer.invalidate({header:t("sort","filters","quickFilter","advancedFilter","locale","selected","data"),rows:t("data","sort","filters","quickFilter","advancedFilter","locale")})}createApi(){let e=t=>((...n)=>{if(this.destroyed){B("API called after destroy()");return}return t(...n)});return{setData:e((t,n)=>this.setData(t,n)),getData:e(()=>this.store.state.data),setColumns:e(t=>this.setColumns(t)),getColumnState:e(()=>this.columns.getState()),applyColumnState:e(t=>{this.columns.applyState(t),this.columnsChanged()}),setSort:e(t=>this.setSort(t)),getSort:e(()=>[...this.store.state.sort]),setFilter:e((t,n)=>this.setFilter(t,n)),getFilterModel:e(()=>({...this.store.state.filters})),setQuickFilter:e(t=>this.store.set({quickFilter:t??""})),getSelectedRows:e(()=>this.selectedRows()),selectAll:e(()=>this.setSelected(new Set([...this.store.state.selected,...this.selectableRows().map(t=>t.id)]))),deselectAll:e(()=>this.setSelected(new Set,null)),getDisplayedRowCount:e(()=>this.rowModel.getRowCount()),scrollToRow:e(t=>this.renderer.scrollToRow(t)),validate:e(()=>this.validateAll()),setDensity:e(t=>this.setDensity(t)),getDensity:e(()=>this.density),showOverlay:e(t=>{this.forcedOverlay=t==="loading"||t==="noRows"?t:null,this.renderer.invalidate()}),getXlsxSheet:e(t=>Wn(this,t)),print:e(t=>Mr(Gn(this,t))),getPrintHtml:e(t=>Gn(this,t)),getPdf:e(t=>Ln(Qt(this,t),Wt,{scale:t?.resolution,quality:t?.quality})),exportPdf:e((t="export.pdf",n)=>{let r=Ln(Qt(this,n),Wt,{scale:n?.resolution,quality:n?.quality});r?Oe(t,[r],"application/pdf"):B("exportPdf: this browser cannot draw on a canvas")}),setColumnGroupOpened:e((t,n)=>this.setColumnGroupOpened(t,n)),setAdvancedFilter:e(t=>this.setAdvancedFilter(t)),getAdvancedFilter:e(()=>this.store.state.advancedFilter?JSON.parse(JSON.stringify(this.store.state.advancedFilter)):null),openFilterBuilder:e(()=>this.filterBuilder.open()),isColumnGroupOpened:e(t=>!!this.columns.getNode(t)?.open),applyTransaction:e(t=>this.applyTransaction(t)),applyTransactionAsync:e(t=>this.applyTransactionAsync(t)),flushAsyncTransactions:e(()=>this.flushAsyncTransactions()),setConditionalFormats:e(t=>this.setConditionalFormats(t)),getConditionalFormats:e(()=>this.getConditionalFormats()),openConditionalFormats:e(t=>this.formatDialog.open(t)),askAssistant:e(t=>dn(this,t,this.options.assistant)),openAssistant:e(()=>this.assistantPanel.open()),getState:e(()=>this.getState()),setState:e((t,n)=>this.setState(t,n)),getScrollPosition:e(()=>this.renderer.getScroll()),setScrollPosition:e(t=>this.renderer.setScroll(t??{})),syncScroll:e((t,n="both")=>this.syncScroll(t,n)),setTheme:e(t=>this.store.set({theme:t})),setLocale:e(t=>this.store.set({locale:ct(t)})),setFont:e(t=>this.setFont(t)),setColumnVisible:e((t,n)=>this.setColumnsVisible([t],n)),autoSizeColumns:e(t=>this.autoSize(t)),resetColumnState:e(()=>this.resetColumns()),openColumnChooser:e(()=>this.chooser.open()),closeColumnChooser:e(()=>this.chooser.close()),toggleSideBar:e((t,n)=>this.sideBar?.toggle(t,n)),setSummary:e(t=>this.setSummary(t)),getSummaryValues:e(()=>this.summaryValues.map(t=>({...t}))),getRange:e(()=>{let t=this.store.state.range;return t&&{start:{...t.start},end:{...t.end}}}),setRange:e(t=>this.setRange(t)),getRanges:e(()=>this.getRanges()),setRanges:e(t=>this.setRanges(t)),copySelection:e(t=>this.copyToClipboard(!!t?.headers,!!t?.rows)),pasteText:e(t=>this.pasteText(t)),cutSelection:e(()=>this.cutToClipboard()),stopRowEdit:e(t=>this.editor.endRow(!t)),startEdit:e((t,n)=>this.editor.start(t,n)),stopEdit:e(t=>t?this.editor.cancel():void this.editor.commit(null)),addRows:e((t,n)=>this.addRows(t,n)),removeRows:e(t=>this.removeRows(t)),removeSelectedRows:e(()=>this.removeRows(this.selectedRows())),getModifiedRows:e(()=>this.getModifiedRows()),getChanges:e(()=>this.getChanges()),hasChanges:e(()=>this.hasChanges()),commitChanges:e(t=>this.commitChanges(t)),revertChanges:e(()=>this.revertChanges()),undo:e(()=>this.undo()),redo:e(()=>this.redo()),canUndo:e(()=>this.history.canUndo()),canRedo:e(()=>this.history.canRedo()),fillRange:e(t=>this.fillRange(t)),setPinnedRows:e(t=>this.setPinnedRows(t)),find:e(t=>this.finder.find(t)),findNext:e(()=>this.finder.next()),findPrevious:e(()=>this.finder.previous()),clearFind:e(()=>this.finder.clear()),setGroupBy:e(t=>this.setGroupBy(t)),getGroupBy:e(()=>this.getGroupBy()),setGroupExpanded:e((t,n)=>this.setGroupExpanded(t,n)),expandAll:e(()=>this.expandAll(!0)),collapseAll:e(()=>this.expandAll(!1)),setDetailExpanded:e((t,n)=>this.setDetailExpanded(t,n)),isDetailExpanded:e(t=>this.isDetailExpanded(t)),moveRow:e((t,n)=>this.moveRow(t,n)),dropRow:e((t,n,r)=>this.dropRow(t,n,r)),setPage:e(t=>this.setPage(t)),getPage:e(()=>this.getPage()),getPageCount:e(()=>this.getPageCount()),setPageSize:e(t=>this.setPageSize(t)),getPageSize:e(()=>this.getPageSize()),refreshRows:e(()=>this.refreshRows()),setPivot:e(t=>this.setPivot(t)),getPivot:e(()=>this.getPivot()),createChart:e(t=>this.charts.create(t)),getCsv:e(t=>zn(this,t)),getJson:e(t=>Vn(this,t)),exportJson:e((t="export.json",n)=>Oe(t,[Vn(this,n)],"application/json;charset=utf-8")),exportCsv:e((t="export.csv",n)=>Oe(t,["\uFEFF",zn(this,n)],"text/csv;charset=utf-8")),getXlsx:e(t=>qn(this,t)),exportXlsx:e((t="export.xlsx",n)=>Oe(t,[qn(this,n)],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")),importFile:e((t,n)=>Ar(this,t,n)),on:e((t,n)=>this.events.on(t,n)),destroy:()=>this.destroy()}}destroy(){if(!this.destroyed){this.destroyed=!0,Mt.delete(this.renderer.root),clearTimeout(this.flashTimer),clearTimeout(this.txTimer);for(let e of this.disposers)e();this.renderer.destroy(),this.events.clear()}}};function ba(o,e){return new so(o,e).api}function _r(o){let e=(Array.isArray(o)?o:[]).filter(t=>t&&t.grid&&typeof t.grid.getXlsxSheet=="function");return e.length?Ke(e.map((t,n)=>t.grid.getXlsxSheet({...t.options,sheetName:t.sheetName??t.options?.sheetName??`Sheet${n+1}`}))):(B("buildWorkbook: no grids given; the file has one empty sheet"),Ke([{name:"Sheet1",rows:[]}]))}function va(o,e){Oe(o||"export.xlsx",[_r(e)],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")}var xa=o=>typeof o=="function"?o():o??{};async function Xr(o,e,t,n){let r=o,s=o.split(/[?#]/)[0],i={method:e,credentials:n.credentials??"same-origin",headers:{Accept:"application/json",...xa(n.headers)}};if(e==="GET"){let d=new URLSearchParams;for(let[c,u]of Object.entries(t))u!==void 0&&d.set(c,typeof u=="string"?u:JSON.stringify(u));r+=(o.includes("?")?"&":"?")+d.toString()}else i.headers["Content-Type"]="application/json",i.body=JSON.stringify(t);let a=await fetch(r,i);if(!a.ok)throw new Error(`HTTP ${a.status} from ${s}`);let l=await a.text();if(!l)return null;try{return JSON.parse(l)}catch{throw new Error(`HTTP ${a.status} from ${s}: the response is not JSON`)}}function Ca(o){if(Array.isArray(o))return{rows:o};let e=o??{},t=[e.rows,e.list,e.content,e.data,e.items,e.resultList].find(Array.isArray),n=[e.total,e.totalCount,e.totalElements,e.totCnt,e.count].find(r=>typeof r=="number");return{rows:(t??[]).filter(r=>r!==null&&typeof r=="object"),total:n}}function Jr(o,e={}){return{async getRows(t){let n=Math.max(1,t.end-t.start),r={start:t.start,end:t.end,page:Math.floor(t.start/n),size:n,sort:t.sort,filters:t.filters,quickFilter:t.quickFilter,advancedFilter:t.advancedFilter??void 0,groupBy:t.groupBy,groupKeys:t.groupKeys,...e.params?.()??{}},s=await Xr(o,e.method??"POST",r,e);return(e.transform??Ca)(s)}}}var io=new WeakMap;function ka(o,e,t={}){let n=io.get(o);if(n)return n;if(!o.hasChanges())return Promise.resolve(null);let{created:r,updated:s,deleted:i}=o.getModifiedRows(),a=new Map([...r,...s].map(d=>[d,{...d}])),l=(async()=>{let d=await Xr(e,"POST",{created:r,updated:s,deleted:i,...t.params?.()??{}},t);return o.commitChanges({rows:a,deleted:i}),d})().finally(()=>io.delete(o));return io.set(o,l),l}async function Ra(o,e,t={}){let{rows:n}=await Jr(e,t).getRows({start:0,end:t.maxRows??1e4,sort:[],filters:{},quickFilter:""});return o.setData(n),n}function Sa(o=document){let e=o.querySelector('meta[name="_csrf"]')?.content,t=o.querySelector('meta[name="_csrf_header"]')?.content||"X-CSRF-TOKEN";return e?{[t]:e}:{}}var Yr=["add","update","remove","upsert"];function Zr(o){let e=o;if(typeof e=="string"){if(!e.trim())return null;e=JSON.parse(e)}if(Array.isArray(e))return{upsert:e.filter(n=>n&&typeof n=="object")};if(!e||typeof e!="object")return null;let t=e;return Yr.some(n=>Array.isArray(t[n]))?t:Array.isArray(t.rows)?{rows:t.rows}:null}function Ma(o,e){let t=e??{},n="connecting",r=!1,s=!1,i=[],a=null,l=0,d=0,c=w=>{if(n!==w){n=w;try{t.onStatus?.(w)}catch{}}},u=w=>{"rows"in w&&Array.isArray(w.rows)&&!Yr.some(h=>h in w)?(o.flushAsyncTransactions(),o.setData(w.rows)):t.immediate?o.applyTransaction(w):o.applyTransactionAsync(w)},f=w=>{if(r)return;let h;try{h=t.parse?t.parse(w):Zr(w),Array.isArray(h)&&(h={upsert:h})}catch(m){t.onError?t.onError(m):B("connectLive: a message could not be read");return}!h||typeof h!="object"||(s?i.push(h):u(h))},p=()=>{if(r||t.reconnect===!1){c("closed");return}let w=typeof t.maxDelay=="number"&&t.maxDelay>0?t.maxDelay:3e4,h=Math.min(w,500*2**Math.min(d++,10))*(.8+Math.random()*.4);c("connecting"),l=window.setTimeout(g,h)},g=()=>{if(r)return;if(l=0,t.poll){y();return}let w=t.url;if(!w){B("connectLive: give a url or a poll function"),c("error");return}c(s?"paused":"connecting");try{if(/^wss?:/i.test(w)){if(typeof WebSocket>"u")throw new Error("no WebSocket");let h=new WebSocket(w,t.protocols);a=h,h.onopen=()=>{d=0,c(s?"paused":"open")},h.onmessage=m=>f(m.data),h.onerror=()=>c("error"),h.onclose=()=>{a===h&&(a=null),r||p()}}else{if(typeof EventSource>"u")throw new Error("no EventSource");let h=new EventSource(w,{withCredentials:!!t.withCredentials});a=h,h.onopen=()=>{d=0,c(s?"paused":"open")},h.addEventListener(t.event||"message",m=>f(m.data)),h.onerror=()=>{h.readyState===2?(a===h&&(a=null),r||p()):c("connecting")}}}catch{c("error"),p()}},y=async()=>{if(!r)try{let w=await t.poll();if(r)return;d=0,c(s?"paused":"open"),f(w);let h=typeof t.interval=="number"&&t.interval>0?t.interval:2e3;l=window.setTimeout(y,h)}catch{if(r)return;c("error"),p()}};return g(),{get status(){return n},pause(){r||s||(s=!0,c("paused"))},resume(){if(r||!s)return;s=!1;let w=i;i=[];for(let h of w)u(h);c(a||t.poll?"open":"connecting")},close(){r||(r=!0,clearTimeout(l),a?.close(),a=null,i=[],c("closed"))},send(w){let h=a;return!h||typeof h.send!="function"||h.readyState!==1?!1:(h.send(w),!0)}}}var Ea={en:fe,ko:go,"zh-CN":wo,"zh-TW":yo,ja:mo,es:po,fr:ho,de:fo,vi:bo,th:vo,id:xo,ru:Co,"pt-BR":ko,it:Ro};for(let o of Object.values(Ea))pn(o);export{_r as buildWorkbook,Ma as connectLive,ba as createGrid,Sa as csrfHeaders,fe as en,gn as evaluateFormula,va as exportWorkbook,Cs as formulaFunctions,Ra as loadData,Ea as locales,Zr as messageToTransaction,$n as parseCsv,Bn as readXlsx,xs as registerFormulaFunction,pn as registerLocale,Kn as renderChart,ct as resolveLocale,Jr as restDatasource,ka as saveChanges,ea as setLicenseKey,Or as verifyLicense,tn as version,Ke as writeXlsx};