@freegridjs/core 1.10.0 → 1.11.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,29 +1,29 @@
1
- var Xs={code:"en",noRows:"No rows to show",filter:"Filter",apply:"Apply",reset:"Reset",selectAll:"(Select all)",setSelected:"({n} selected)",noAggregate:"No aggregate",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",printLimited:"Printed the first {n} of {total} rows. Export to Excel or CSV for all of them.",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",align:"Align",aligns:{none:"Default",left:"Left",center:"Center",right:"Right"},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"}},ae=Xs;var Bo=new Set;function O(o){Bo.has(o)||(Bo.add(o),console.warn(`[FreeGrid] ${o}`))}var Pe=new Map([["en",ae]]);function Fn(o){Pe.set(o.code,o)}function Ho(o){let e=o.toLowerCase();for(let n of Pe.keys())if(n.toLowerCase()===e)return n;let t=e.split("-")[0];if(t==="zh"){if(/-(tw|hk|mo|hant)(-|$)/.test(e)&&Pe.has("zh-TW"))return"zh-TW";if(Pe.has("zh-CN"))return"zh-CN"}for(let n of Pe.keys())if(n.toLowerCase().split("-")[0]===t)return n}function Js(){return typeof navigator>"u"?[]:navigator.languages?.length?navigator.languages:navigator.language?[navigator.language]:[]}function Ys(o){return{...ae,...o,code:o.code??"en",ops:{...ae.ops,...o.ops??{}}}}function Mt(o,e=Js()){if(o&&typeof o=="object")return Ys(o);if(typeof o=="string"){let t=Ho(o);return t?Pe.get(t):(O(`locale "${o}" is not registered \u2014 import it from "@freegridjs/core/locales/${o}" and pass the pack (or call registerLocale). Falling back to "en".`),ae)}for(let t of e){let n=Ho(t);if(n)return Pe.get(n)}return ae}var Zs={code:"de",noRows:"Keine Zeilen vorhanden",filter:"Filter",apply:"Anwenden",reset:"Zur\xFCcksetzen",selectAll:"(Alle ausw\xE4hlen)",setSelected:"({n} ausgew\xE4hlt)",noAggregate:"Keine Aggregation",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",printLimited:"Die ersten {n} von {total} Zeilen wurden gedruckt. F\xFCr alle Zeilen nach Excel oder CSV exportieren.",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",align:"Ausrichtung",aligns:{none:"Standard",left:"Links",center:"Zentriert",right:"Rechts"},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"}},Go=Zs;var Qs={code:"es",noRows:"No hay filas para mostrar",filter:"Filtro",apply:"Aplicar",reset:"Restablecer",selectAll:"(Seleccionar todo)",setSelected:"({n} seleccionados)",noAggregate:"Sin agregaci\xF3n",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",printLimited:"Se imprimieron las primeras {n} de {total} filas. Exporte a Excel o CSV para obtenerlas todas.",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",align:"Alineaci\xF3n",aligns:{none:"Predeterminada",left:"Izquierda",center:"Centro",right:"Derecha"},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"}},zo=Qs;var ei={code:"fr",noRows:"Aucune ligne \xE0 afficher",filter:"Filtre",apply:"Appliquer",reset:"R\xE9initialiser",selectAll:"(Tout s\xE9lectionner)",setSelected:"({n} s\xE9lectionn\xE9s)",noAggregate:"Aucune agr\xE9gation",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",printLimited:"Les {n} premi\xE8res lignes sur {total} ont \xE9t\xE9 imprim\xE9es. Exportez vers Excel ou CSV pour toutes les avoir.",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",align:"Alignement",aligns:{none:"Par d\xE9faut",left:"Gauche",center:"Centre",right:"Droite"},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"}},Vo=ei;var ti={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)",setSelected:"({n} \u4EF6\u9078\u629E)",noAggregate:"\u96C6\u8A08\u3057\u306A\u3044",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",printLimited:"\u5168 {total} \u884C\u306E\u3046\u3061\u6700\u521D\u306E {n} \u884C\u306E\u307F\u5370\u5237\u3057\u307E\u3057\u305F\u3002\u3059\u3079\u3066\u306E\u884C\u306F Excel \u307E\u305F\u306F CSV \u306B\u66F8\u304D\u51FA\u3057\u3066\u304F\u3060\u3055\u3044\u3002",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",align:"\u914D\u7F6E",aligns:{none:"\u65E2\u5B9A",left:"\u5DE6\u63C3\u3048",center:"\u4E2D\u592E\u63C3\u3048",right:"\u53F3\u63C3\u3048"},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"}},qo=ti;var ni={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)",setSelected:"({n}\uAC1C \uC120\uD0DD\uB428)",noAggregate:"\uC9D1\uACC4 \uC548 \uD568",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",printLimited:"\uC804\uCCB4 {total}\uD589 \uC911 \uCC98\uC74C {n}\uD589\uB9CC \uC778\uC1C4\uD588\uC2B5\uB2C8\uB2E4. \uC804\uCCB4\uB294 \uC5D1\uC140\uC774\uB098 CSV\uB85C \uB0B4\uBCF4\uB0B4\uC138\uC694.",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",align:"\uC815\uB82C",aligns:{none:"\uAE30\uBCF8",left:"\uC67C\uCABD",center:"\uAC00\uC6B4\uB370",right:"\uC624\uB978\uCABD"},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"}},Wo=ni;var oi={code:"zh-CN",noRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u6570\u636E",filter:"\u7B5B\u9009",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",selectAll:"(\u5168\u9009)",setSelected:"(\u5DF2\u9009 {n} \u9879)",noAggregate:"\u4E0D\u6C47\u603B",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",printLimited:"\u4EC5\u6253\u5370\u4E86 {total} \u884C\u4E2D\u7684\u524D {n} \u884C\u3002\u5982\u9700\u5168\u90E8\uFF0C\u8BF7\u5BFC\u51FA\u4E3A Excel \u6216 CSV\u3002",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",align:"\u5BF9\u9F50",aligns:{none:"\u9ED8\u8BA4",left:"\u5DE6\u5BF9\u9F50",center:"\u5C45\u4E2D",right:"\u53F3\u5BF9\u9F50"},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"}},jo=oi;var ri={code:"zh-TW",noRows:"\u6C92\u6709\u53EF\u986F\u793A\u7684\u8CC7\u6599",filter:"\u7BE9\u9078",apply:"\u5957\u7528",reset:"\u91CD\u8A2D",selectAll:"(\u5168\u9078)",setSelected:"(\u5DF2\u9078 {n} \u9805)",noAggregate:"\u4E0D\u5F59\u7E3D",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",printLimited:"\u50C5\u5217\u5370\u4E86 {total} \u5217\u4E2D\u7684\u524D {n} \u5217\u3002\u5982\u9700\u5168\u90E8\uFF0C\u8ACB\u532F\u51FA\u70BA Excel \u6216 CSV\u3002",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",align:"\u5C0D\u9F4A",aligns:{none:"\u9810\u8A2D",left:"\u9760\u5DE6\u5C0D\u9F4A",center:"\u7F6E\u4E2D",right:"\u9760\u53F3\u5C0D\u9F4A"},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"}},Uo=ri;var si={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)",setSelected:"(\u0111\xE3 ch\u1ECDn {n})",noAggregate:"Kh\xF4ng t\u1ED5ng h\u1EE3p",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",printLimited:"\u0110\xE3 in {n} h\xE0ng \u0111\u1EA7u ti\xEAn trong t\u1ED5ng s\u1ED1 {total} h\xE0ng. Xu\u1EA5t sang Excel ho\u1EB7c CSV \u0111\u1EC3 c\xF3 t\u1EA5t c\u1EA3.",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",align:"C\u0103n l\u1EC1",aligns:{none:"M\u1EB7c \u0111\u1ECBnh",left:"Tr\xE1i",center:"Gi\u1EEFa",right:"Ph\u1EA3i"},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"}},Ko=si;var ii={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)",setSelected:"(\u0E40\u0E25\u0E37\u0E2D\u0E01 {n} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23)",noAggregate:"\u0E44\u0E21\u0E48\u0E23\u0E27\u0E21\u0E04\u0E48\u0E32",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",printLimited:"\u0E1E\u0E34\u0E21\u0E1E\u0E4C {n} \u0E41\u0E16\u0E27\u0E41\u0E23\u0E01\u0E08\u0E32\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14 {total} \u0E41\u0E16\u0E27 \u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01\u0E40\u0E1B\u0E47\u0E19 Excel \u0E2B\u0E23\u0E37\u0E2D CSV \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E23\u0E31\u0E1A\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",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",align:"\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E41\u0E19\u0E27",aligns:{none:"\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",left:"\u0E0B\u0E49\u0E32\u0E22",center:"\u0E01\u0E36\u0E48\u0E07\u0E01\u0E25\u0E32\u0E07",right:"\u0E02\u0E27\u0E32"},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"}},_o=ii;var ai={code:"id",noRows:"Tidak ada data",filter:"Filter",apply:"Terapkan",reset:"Atur ulang",selectAll:"(Pilih semua)",setSelected:"({n} dipilih)",noAggregate:"Tanpa agregasi",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",printLimited:"Dicetak {n} baris pertama dari {total}. Ekspor ke Excel atau CSV untuk semua baris.",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",align:"Perataan",aligns:{none:"Bawaan",left:"Kiri",center:"Tengah",right:"Kanan"},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=ai;var li={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)",setSelected:"(\u0432\u044B\u0431\u0440\u0430\u043D\u043E: {n})",noAggregate:"\u0411\u0435\u0437 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F",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",printLimited:"\u041D\u0430\u043F\u0435\u0447\u0430\u0442\u0430\u043D\u044B \u043F\u0435\u0440\u0432\u044B\u0435 {n} \u0438\u0437 {total} \u0441\u0442\u0440\u043E\u043A. \u0427\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0432\u0441\u0435, \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0432 Excel \u0438\u043B\u0438 CSV.",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",align:"\u0412\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435",aligns:{none:"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",left:"\u041F\u043E \u043B\u0435\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E",center:"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443",right:"\u041F\u043E \u043F\u0440\u0430\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E"},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"}},Jo=li;var di={code:"pt-BR",noRows:"Nenhuma linha para mostrar",filter:"Filtro",apply:"Aplicar",reset:"Limpar",selectAll:"(Selecionar tudo)",setSelected:"({n} selecionados)",noAggregate:"Sem agrega\xE7\xE3o",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",printLimited:"Foram impressas as primeiras {n} de {total} linhas. Exporte para Excel ou CSV para obter todas.",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",align:"Alinhamento",aligns:{none:"Padr\xE3o",left:"Esquerda",center:"Centro",right:"Direita"},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"}},Yo=di;var ci={code:"it",noRows:"Nessuna riga da mostrare",filter:"Filtro",apply:"Applica",reset:"Reimposta",selectAll:"(Seleziona tutto)",setSelected:"({n} selezionati)",noAggregate:"Nessuna aggregazione",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",printLimited:"Stampate le prime {n} di {total} righe. Esporta in Excel o CSV per averle tutte.",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",align:"Allineamento",aligns:{none:"Predefinito",left:"Sinistra",center:"Centro",right:"Destra"},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"}},Zo=ci;function V(o){return o==null||typeof o=="string"&&o.trim()===""||typeof o=="number"&&Number.isNaN(o)}var Qo=o=>String(o).padStart(2,"0");function ie(o){if(V(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()}-${Qo(e.getMonth()+1)}-${Qo(e.getDate())}`}function te(o){return V(o)?"":o instanceof Date?ie(o)??"":String(o)}var ge=()=>!0;function Et(o){switch(o.type){case"combined":{let e=(Array.isArray(o.conditions)?o.conditions:[]).map(Et);return e.length?o.operator==="or"?t=>e.some(n=>n(t)):t=>e.every(n=>n(t)):ge}case"text":{let e=(o.value??"").toLowerCase(),t=n=>V(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 V;case"notBlank":return n=>!V(n)}return ge}case"number":{let e=n=>V(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 ge;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 ge;let r=Math.min(t,n),s=Math.max(t,n);return i=>{let a=e(i);return a>=r&&a<=s}}}return ge}case"date":{if(o.op==="blank")return n=>ie(n)===null;if(o.op==="notBlank")return n=>ie(n)!==null;let e=o.value;if(!e)return ge;let t=n=>ie(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 ge;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 ge}case"set":{let e=new Set(o.values.map(te));return t=>e.has(te(t))}}return ge}function er(o){let e=o.trim().toLowerCase();return e?e.split(/\s+/):[]}function tr(o,e){return o.every(t=>e.includes(t))}function Dn(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=Dn(r,e,t);a&&n.push(a);continue}let s=e(r.colId);if(!s||!r.model)continue;let i=Et(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 nr=new Map,or=new Map;function Ce(o,e){let t=`${o}|${e??""}`,n=or.get(t);return n||(n=new Intl.NumberFormat(o,e==null?void 0:{maximumFractionDigits:e}),or.set(t,n)),n}function ui(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 At={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 fe(o){if(V(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 fi(o,e,t){switch(o){case"number":{let n={};if(typeof e=="string"){let s=ui(e);s||O(`unknown number format "${e}"`),n=s??{}}else e&&(n=e);let r=new Intl.NumberFormat(t,n);return s=>{if(V(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=fe(a);if(!l)return V(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=At.date;typeof e=="string"?(At[e]||O(`unknown date format "${e}"`),n=At[e]??At.date):e&&(n=e);let r=new Intl.DateTimeFormat(t,n);return s=>{let i=fe(s);return i?r.format(i):V(s)?"":String(s)}}case"boolean":return n=>n===!0?"\u2713":n===!1?"\u2717":"";default:return n=>V(n)?"":n instanceof Date?n.toISOString():String(n)}}var pi=o=>Array.isArray(o)?o.join(", "):o==null?"":String(o),$n=new WeakMap,Nn=new WeakMap;function rr(){$n=new WeakMap,Nn=new WeakMap}function it(o,e,t,n=o.format){if(e===o.type&&n===o.format)return Q(o,t);if(n!==o.format&&typeof n!="string")return Q({...o,type:e,format:n},t);let r=Nn.get(o);r||Nn.set(o,r=new Map);let s=`${e??""}|${n===o.format?"":`=${n}`}`,i=r.get(s);return i||r.set(s,i={...o,type:e,format:n}),Q(i,t)}function Q(o,e){if(o.sparkline)return pi;let t=o.format,n=$n.get(o);if(n&&n.locale===e&&n.type===o.type&&n.format===t)return n.fmt;let r=`${e}|${o.type??"text"}|${typeof t=="string"?t:JSON.stringify(t??null)}`,s=nr.get(r);return s||(s=fi(o.type,t,e),nr.set(r,s)),$n.set(o,{locale:e,type:o.type,format:t,fmt:s}),s}var ne="__fg_select__",sr={id:ne,header:"",width:44,minWidth:44,maxWidth:44,pinned:"left",sortable:!1,resizable:!1,filter:!1},Le="__fg_drag__",ir={id:Le,header:"",width:28,minWidth:28,maxWidth:28,pinned:"left",sortable:!1,resizable:!1,filter:!1,chooser:!1},Re="__fg_rownum__",ar=(o=52,e="#")=>({id:Re,header:e,width:o,minWidth:o,maxWidth:o,pinned:"left",sortable:!1,resizable:!1,filter:!1,chooser:!1}),$=o=>o===ne||o===Le||o===Re,hi=120,gi=40,mi=["left","center","right"];function ce(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 Pt(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 Ie=o=>o.id!==ne&&o.sortable!==!1,Lt=o=>o.id!==ne&&o.resizable!==!1;function ke(o,e){let t=o.minWidth??gi,n=o.maxWidth??1/0;return Math.round(Math.min(n,Math.max(t,e)))}function lr(o){return o.children?1+Math.max(0,...o.children.map(lr)):1}var Tt=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.declared=[];this.setDefs(e)}setDefs(e){rr(),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}`,O(`column #${d} has neither "field" nor "id"; using "${c}"`)),this.byId.has(c)){let h=1;for(;this.byId.has(`${c}_${h}`);)h++;O(`duplicate column id "${c}"; renamed to "${c}_${h}"`),c=`${c}_${h}`}let u={id:c,def:s,parent:i,children:null,depth:a,width:ke(s,s.width??hi),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(h=>n(h,u,a+1))),u},r=s=>{let i=s.filter(a=>a!==null&&typeof a=="object");return i.length!==s.length&&O("columns contain entries that are not objects; they were skipped"),i};this.roots_=r(e).map(s=>n(s,null,0)),this.declared=this.leafNodes().map(s=>s.id),this.depth=Math.max(1,...this.roots_.map(lr)),this.relayout()}updateDefs(e){let t=new Map(this.byId),n=this.declared,r=this.leafNodes().map(i=>i.id);this.setDefs(e);for(let[i,a]of this.byId){let l=t.get(i);if(!l||!!l.children!=!!a.children)continue;let d=l.def,c=a.def;d.width===c.width&&d.flex===c.flex&&d.minWidth===c.minWidth&&d.maxWidth===c.maxWidth&&(a.width=l.width,a.flex=l.flex),(d.hide??!1)===(c.hide??!1)&&(a.hide=l.hide),d.pinned===c.pinned&&l.parent?.def.pinned===a.parent?.def.pinned&&(a.pinned=l.pinned),!!d.openByDefault==!!c.openByDefault&&(a.open=l.open)}let s=(i,a)=>i.length===a.length&&i.every((l,d)=>l===a[d]);s(n,this.declared)&&!s(r,n)?this.applyState(r.map(i=>({colId:i}))):this.relayout()}setContainerWidth(e){if(e===this.containerWidth)return!1;this.containerWidth=e;let t=()=>this.displayed().map(r=>`${r.width}${r.region}`).join(),n=t();return this.relayout(),n!==t()}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=ke(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=ke(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(Re,-3),t.set(Le,-2),t.set(ne,-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(h=>!h.hide&&this.shownByGroups(h)),t=e.reduce((h,p)=>h+(p.flex?0:p.width),0),n=new Map,r=e.filter(h=>h.flex),s=Math.max(0,this.containerWidth-t);for(;r.length;){let h=r.reduce((f,m)=>f+m.flex,0),p=f=>Math.floor(s*f.flex/h),g=r.reduce((f,m)=>f+ke(m.def,p(m))-p(m),0),y=r.filter(f=>{let m=ke(f.def,p(f))-p(f);return g>0?m>0:g<0?m<0:!1});if(!y.length){let f=s;for(let m of r){let b=ke(m.def,p(m));n.set(m,b),f-=b}for(let m of r){if(f<1)break;let b=n.get(m);ke(m.def,b+1)===b+1&&(n.set(m,b+1),f--)}break}let w=0;for(let f of y){let m=ke(f.def,p(f));n.set(f,m),w+=m}s=Math.max(0,s-w),r=r.filter(f=>!y.includes(f))}let i=h=>n.get(h)??h.width,a={left:[],center:[],right:[]};this.leafById=new Map;let l=0,d=e.reduce((h,p)=>h+(p.pinned?i(p):0),0),c=this.containerWidth>0&&d>this.containerWidth*.75,u={left:0,center:0,right:0};for(let h of mi){let p=c?"center":h;for(let g of e){if((g.pinned??"center")!==h)continue;let y={id:g.id,def:g.def,node:g,width:i(g),region:p,left:u[p],index:l++};u[p]+=y.width,a[p].push(y),this.leafById.set(g.id,y)}}this.layout=a}};var q=class extends Error{constructor(t){super(t);this.code=t}},wi=/^#(?:[A-Z/0]+[!?]|N\/A)$/,Ue=o=>typeof o=="string"&&wi.test(o);function yi(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 le=o=>o==null||o==="";function H(o){if(typeof o=="number")return o;if(typeof o=="boolean")return o?1:0;if(le(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 Y=o=>le(o)?"":typeof o=="boolean"?o?"TRUE":"FALSE":o instanceof Date?at(o):String(o),Me=o=>typeof o=="boolean"?o:typeof o=="string"&&/^(true|false)$/i.test(o)?o.toLowerCase()==="true":H(o)!==0;function It(o,e,t="near"){let n=Math.trunc(e),r=t==="near"?Math.round:t==="up"?Math.ceil:Math.floor,s=(a,l)=>{let[d,c="0"]=String(a).split("e");return+`${d}e${Number(c)+l}`},i=s(r(s(Math.abs(o),n)),-n);return o<0?-i:i}function lt(o,e){let t=n=>typeof n=="number"||typeof n=="boolean"||le(n);return t(o)&&t(e)?H(o)-H(e):o instanceof Date||e instanceof Date?H(ue(o))-H(ue(e)):Y(o).localeCompare(Y(e),void 0,{sensitivity:"accent"})}var Se=o=>o.flatMap(e=>Array.isArray(e)?e:[e]);var Fe=o=>o.flatMap(e=>Array.isArray(e)?mr(e).filter(t=>typeof t=="number"&&Number.isFinite(t)):le(e)?[]:[H(e)]);function mr(o){let e=o.find(Ue);if(e!==void 0)throw new q(e);return o}function ue(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 Dt=o=>String(o).padStart(2,"0");function at(o){return`${o.getFullYear()}-${Dt(o.getMonth()+1)}-${Dt(o.getDate())}`}var bi=864e5,dr=o=>Math.round(Date.UTC(o.getFullYear(),o.getMonth(),o.getDate())/bi);function wr(o){if(typeof o!="string")return s=>lt(s,o)===0&&!le(s)==!le(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(Y(i)):i=>!s.test(Y(i))}return s=>{if(t==="="&&r==="")return le(s);if(t==="<>"&&r==="")return!le(s);if(typeof r=="number"&&typeof s!="number"&&!(typeof s=="string"&&s.trim()!==""&&Number.isFinite(Number(s))))return t==="<>";let i;try{i=lt(s,r)}catch{return!1}return t==="="?i===0:t==="<>"?i!==0:t==="<"?i<0:t===">"?i>0:t==="<="?i<=0:i>=0}}function Ee(o){if(Array.isArray(o))return o;throw new q("#VALUE!")}function cr(o,e,t){let n=Ee(e),r=wr(t),s=[],i=mr(o.length?Ee(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 pe={SUM:o=>Fe(o).reduce((e,t)=>e+t,0),AVG:o=>{let e=Fe(o);if(!e.length)throw new q("#DIV/0!");return e.reduce((t,n)=>t+n,0)/e.length},MIN:o=>{let e=Fe(o);return e.length?e.reduce((t,n)=>Math.min(t,n)):0},MAX:o=>{let e=Fe(o);return e.length?e.reduce((t,n)=>Math.max(t,n)):0},MEDIAN:o=>{let e=Fe(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=>Se(o).filter(e=>typeof e=="number"&&Number.isFinite(e)).length,COUNTA:o=>Se(o).filter(e=>!le(e)).length,COUNTBLANK:o=>Se(o).filter(le).length,PRODUCT:o=>Fe(o).reduce((e,t)=>e*t,1),ROUND:o=>It(H(o[0]),o.length>1?H(o[1]):0),ROUNDUP:o=>It(H(o[0]),o.length>1?H(o[1]):0,"up"),ROUNDDOWN:o=>It(H(o[0]),o.length>1?H(o[1]):0,"down"),INT:o=>Math.floor(H(o[0])),TRUNC:o=>It(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=>Se(o).map(Y).join(""),TEXTJOIN:o=>Se(o.slice(2)).filter(e=>!Me(o[1])||!le(e)).map(Y).join(Y(o[0])),LEN:o=>Y(o[0]).length,LEFT:o=>Y(o[0]).slice(0,o.length>1?Math.max(0,H(o[1])):1),RIGHT:o=>{let e=Y(o[0]),t=o.length>1?Math.max(0,H(o[1])):1;return t?e.slice(-t):""},MID:o=>Y(o[0]).substr(Math.max(0,H(o[1])-1),Math.max(0,H(o[2]))),UPPER:o=>Y(o[0]).toUpperCase(),LOWER:o=>Y(o[0]).toLowerCase(),PROPER:o=>Y(o[0]).toLowerCase().replace(/(^|[^\p{L}])(\p{L})/gu,(e,t,n)=>t+n.toUpperCase()),TRIM:o=>Y(o[0]).trim().replace(/\s+/g," "),SUBSTITUTE:o=>Y(o[0]).split(Y(o[1])).join(Y(o[2])),REPLACE:o=>{let e=Y(o[0]),t=Math.max(0,H(o[1])-1);return e.slice(0,t)+Y(o[3])+e.slice(t+Math.max(0,H(o[2])))},REPT:o=>Y(o[0]).repeat(Math.max(0,Math.min(1e4,H(o[1])))),FIND:o=>{let e=Y(o[1]).indexOf(Y(o[0]),o.length>2?H(o[2])-1:0);if(e<0)throw new q("#VALUE!");return e+1},SEARCH:o=>{let e=Y(o[1]).toLowerCase().indexOf(Y(o[0]).toLowerCase(),o.length>2?H(o[2])-1:0);if(e<0)throw new q("#VALUE!");return e+1},VALUE:o=>H(Y(o[0]).replace(/,/g,"")),TEXT:o=>{let e=o[0],t=Y(o[1]),n=/0\.(0+)/.exec(t)?.[1].length??0;if(/[yd]/i.test(t)){let i=ue(e);return t.replace(/yyyy/gi,String(i.getFullYear())).replace(/mm/g,Dt(i.getMonth()+1)).replace(/dd/gi,Dt(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=>Se(o).every(Me),OR:o=>Se(o).some(Me),XOR:o=>Se(o).filter(Me).length%2===1,NOT:o=>!Me(o[0]),ISBLANK:o=>le(o[0]),ISNUMBER:o=>typeof o[0]=="number"&&Number.isFinite(o[0]),ISTEXT:o=>typeof o[0]=="string"&&!Ue(o[0]),ISERROR:o=>Ue(o[0]),TODAY:()=>at(new Date),NOW:()=>new Date,DATE:o=>at(new Date(H(o[0]),H(o[1])-1,H(o[2]))),YEAR:o=>ue(o[0]).getFullYear(),MONTH:o=>ue(o[0]).getMonth()+1,DAY:o=>ue(o[0]).getDate(),WEEKDAY:o=>ue(o[0]).getDay()+1,DAYS:o=>dr(ue(o[0]))-dr(ue(o[1])),EDATE:o=>{let e=ue(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())),at(n)},EOMONTH:o=>{let e=ue(o[0]);return at(new Date(e.getFullYear(),e.getMonth()+H(o[1])+1,0))},SUMIF:o=>cr(o.slice(2),Ee(o[0]),o[1]).reduce((e,t)=>e+t,0),COUNTIF:o=>{let e=wr(o[1]);return Ee(o[0]).filter(e).length},AVERAGEIF:o=>{let e=cr(o.slice(2),Ee(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=Ee(o[1]),t=o.length>2?Ee(o[2]):e,n=e.findIndex(r=>{try{return lt(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=Fe([Ee(o[1])]),n=o.length>2&&Me(o[2]);return 1+t.filter(r=>n?r<e:r>e).length}};pe.AVERAGE=pe.AVG;pe.XLOOKUP=pe.LOOKUP;pe.CONCATENATE=pe.CONCAT;var $t=new Map;function vi(o,e){typeof o!="string"||!/^[A-Za-z_][\w.]*$/.test(o)||typeof e!="function"||($t.set(o.toUpperCase(),e),We.clear())}function xi(){return[...new Set([...Object.keys(pe),...Ci,...ki,...$t.keys()])].sort()}var Ci=["IF","IFS","IFERROR","IFNA","SWITCH","CHOOSE"],ki=["COL","PREV","NEXT","ROW"],On=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=>Ft(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 Ft(o,e=!1){return o.k==="lit"?!0:o.k==="ref"?e:o.k==="un"?Ft(o.a):o.k==="bin"?Ft(o.a)&&Ft(o.b):o.rowFree}var We=new Map,Ri=2e3;function yr(o){let e=We.get(o);if(!e){try{e=new On(yi(o.slice(1))).parse()}catch(t){e=t instanceof q?t:new q("#ERROR!")}We.size>=Ri&&We.delete(We.keys().next().value),We.set(o,e)}if(e instanceof q)throw e;return e}var ur=new WeakMap;function Ae(o){let e=o.rows(),t=o.version(),n=ur.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},ur.set(o,n)),n}var Bn=new WeakMap;function br(o,e){for(let t of o)t&&typeof t=="object"&&Bn.set(t,e)}var vr=32;function Hn(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?fr(o,e,s):s}let r=n?.computed(e);if(r!==void 0)return fr(o,e,r);throw new q("#REF!")}function fr(o,e,t){if(o.seen.has(e)||o.depth>=vr)throw new q("#CYCLE!");let n;if(o.memo.has(e))n=o.memo.get(e);else{let r=o.scope?Ae(o.scope).values.get(o.row):void 0;r?.has(e)?n=r.get(e):(n=Nt(t,{...o,seen:new Set([...o.seen,e]),depth:o.depth+1}),o.memo.set(e,n))}if(Ue(n))throw new q(n);return n}function Si(o,e,t){let n=o.scope;if(!n)throw new q("#REF!");let r=Ae(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++)dt(n,r,r.data[l],t);let a=dt(n,r,s,t);if(e>(r.filled.get(t)??-1)&&r.filled.set(t,e),Ue(a))throw new q(a);return a}function dt(o,e,t,n){let r=e.values.get(t);if(r?.has(n))return r.get(n);let s;try{s=Hn({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 pr(o){if(!o.scope)throw new q("#REF!");let e=Ae(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 Mi(o,e){if(!o.scope)throw new q("#REF!");let t=o.scope,n=Ae(t),r=n.cols.get(e);if(r||(n.cols.set(e,hr),r=n.data.map(s=>dt(t,n,s,e)),n.cols.set(e,r)),r===hr)throw new q("#CYCLE!");return r}var hr=[];function je(o,e){switch(o.k){case"lit":return o.v;case"ref":return Hn(e,o.name);case"un":return o.op==="-"?-H(je(o.a,e)):H(je(o.a,e));case"bin":{let t=je(o.a,e),n=je(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 Y(t)+Y(n);default:{let r=lt(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=Ae(e.scope);if(t.rowFree.has(o)){let n=t.rowFree.get(o);if(n instanceof q)throw n;return n}try{let n=gr(o,e);return t.rowFree.set(o,n),n}catch(n){throw n instanceof q&&t.rowFree.set(o,n),n}}return gr(o,e)}}}function gr(o,e){let{name:t,args:n}=o,r=a=>je(n[a],e);switch(t){case"IF":{if(n.length<2)throw new q("#ERROR!");return Me(r(0))?r(1):n.length>2?r(2):!1}case"IFS":for(let a=0;a+1<n.length;a+=2)if(Me(r(a)))return r(a+1);throw new q("#N/A");case"IFERROR":case"IFNA":try{let a=r(0);return Ue(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(lt(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 Mi(e,n[0].name);case"ROW":return pr(e)+1;case"PREV":case"NEXT":{let a=n.length>1?Math.trunc(H(r(1))):1,l=pr(e)+(t==="PREV"?-a:a),d=n[0].name;if(t==="NEXT"&&e.depth>=vr)throw new q("#CYCLE!");return t==="PREV"?Si(e,l,d):Ei(e,l,d)}}let s=(Object.hasOwn(pe,t)?pe[t]:void 0)??$t.get(t);if(!s)throw new q("#NAME?");let i=n.map((a,l)=>r(l));if($t.has(t)&&!Object.hasOwn(pe,t))try{return s(i)}catch(a){throw a instanceof q?a:new q("#VALUE!")}return s(i)}function Ei(o,e,t){let n=o.scope?Ae(o.scope):null;if(!n)throw new q("#REF!");return e<0||e>=n.data.length?null:Hn({...o,row:n.data[e],seen:new Set,depth:o.depth+1,memo:new Map},t)}function Nt(o,e){try{let t=je(yr(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 Nt(o,{row:e,scope:s,seen:t,depth:n,memo:r})}function zn(o,e){let t=Bn.get(o)??null,n=o.id??o.field;if(o.formula){if(t&&n){let r=Ae(t);return dt(t,r,e,n)}return Nt(o.formula,{row:e,scope:t,seen:new Set(n?[n]:[]),depth:0,memo:new Map})}return t?dt(t,Ae(t),e,o.field):Nt(e[o.field],{row:e,scope:t,seen:new Set([o.field]),depth:0,memo:new Map})}var Vn=o=>!!Bn.get(o)?.off?.(),De=o=>typeof o=="string"&&o.length>1&&o.startsWith("=");function xr(o){let e;try{e=yr(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{O(`valueGetter of column "${o.id??o.field}" threw; rendering an empty cell`);return}if(typeof o.formula=="string"&&De(o.formula)&&!Vn(o))return zn(o,e);if(o.field==null)return;let t=e[o.field];return o.formulas&&De(t)&&!Vn(o)?zn(o,e):t}var ct=["left","center","right"],Cr=[[">=","gte"],["<=","lte"],["<>","ne"],["!=","ne"],[">","gt"],["<","lt"],["=","eq"]],kr=[[">","after"],["<","before"],["=","equals"]],Ai=/^(.+?)\s*(?:~|\.\.)\s*(.+)$/,Ot="~many",qn=o=>{let e=Number(o.replace(/[,\s₩$€¥]/g,""));return o.trim()!==""&&Number.isFinite(e)?e:null},Wn=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 Ti(o,e){let t=e.trim();if(!t)return null;if(o==="text")return{type:"text",op:"contains",value:t};let n=Ai.exec(t);if(o==="number"){if(n){let l=qn(n[1]),d=qn(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=Cr.find(([l])=>t.startsWith(l)),a=qn(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=Wn(n[1]),a=Wn(n[2]);return!i||!a?void 0:{type:"date",op:"between",value:i<a?i:a,valueTo:i<a?a:i}}let r=kr.find(([i])=>t.startsWith(i)),s=Wn(r?t.slice(r[0].length):t);return s?{type:"date",op:r?r[1]:"equals",value:s}:void 0}function Pi(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=Cr.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=kr.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 ct)this.inners[n]=v("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 ct){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 ct)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?s.values.length:0,a=n.querySelector(`option[value="${Ot}"]`);if(i)a||(a=v("option","",{value:Ot}),a.disabled=!0,n.options[0].after(a)),a.textContent=this.grid.store.state.locale.setSelected.replace("{n}",String(i)),n.value=Ot;else{a?.remove();let l=s?.type==="set"&&s.values.length===1?JSON.stringify(s.values[0]):"";[...n.options].some(d=>d.value===l)&&(n.value=l)}}else n.value=Pi(s);n.classList.remove("fg-filter-bad")}}}}refreshLists(){for(let e of ct)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===Ot){this.rebuilt=!0;continue}if(r&&![...t.options].some(s=>s.value===r)){let s=v("option","",{value:r});s.textContent=String(JSON.parse(r)),t.append(s)}t.value=r}}fillOptions(e,t){let n=v("option","",{value:""});n.textContent=this.grid.store.state.locale.selectAll;let r=this.distinct(t).map(s=>{let i=v("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=v("div","fg-filter-cell",{role:"gridcell"});n.style.left=`${e.left}px`,n.style.width=`${e.width}px`,n.style.height=`${t}px`;let r=$(e.id)?null:ce(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=v("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=v("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=Ti(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 ct)this.inners[e].remove()}};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,Li=new Set(["top","bottom","aboveAverage","belowAverage","duplicate","unique","dataBar","colorScale","iconSet"]),Rr={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 Un(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 jn(o,e,t){let n=Un(o),r=Un(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 ut(o){return o==null?"":o instanceof Date?o.toISOString():String(o)}function Ii(o,e){let t=o.op??"eq";if(t==="blank")return V(e);if(t==="notBlank")return!V(e);if(t==="contains"||t==="notContains"||t==="startsWith"||t==="endsWith"){let d=ut(e).toLowerCase(),c=ut(o.value).toLowerCase(),u=t==="startsWith"?d.startsWith(c):t==="endsWith"?d.endsWith(c):d.includes(c);return t==="notContains"?!u:u}if(V(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=ut(e).toLowerCase(),a=ut(o.value).toLowerCase(),l=ut(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 Ht=class{constructor(e){this.deps=e;this.stats=new Map;this.statsKey=[];this.rowCache=new WeakMap}dependsOnOtherRows(){return this.deps.rules().some(e=>e&&(Li.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),!V(a)){let d=te(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 Ii(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(V(n))return!1;let i=this.statsOf(t).counts.get(te(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=Sr(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,h=typeof a.max=="number"?a.max:c.max,p=h===u?1:Math.max(0,Math.min(1,(d-u)/(h-u)));if(s??(s={style:{}}),l==="dataBar"){let g=u<0&&h>0?-u/(h-u):u>=0?0:1,y=h===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?jn(g[0],g[1],p*2):jn(g[1],g[2],(p-.5)*2):jn(g[0],g[1],p);s.style={...s.style,background:y}}else{let g=Rr[a.icons??"arrows"]??Rr.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=Sr(s.style,a.style),a.stopIfTrue))break}return s}};function he(o){let e=o?.align;return e==="left"||e==="center"||e==="right"?e:void 0}function Sr(o,e){if(!e||typeof e!="object")return{...o};let t={...o,...e};return he(e)||(he(o)?t.align=o.align:delete t.align),t}function Kn(o){let e=o?Un(o):null;return e?`FF${e.map(t=>t.toString(16).padStart(2,"0")).join("").toUpperCase()}`:void 0}function _n(o){let e=[];for(let t of o){if(V(t)||t instanceof Date)continue;let n=typeof t=="number"?t:Number(t);Number.isNaN(n)||e.push(n)}return e}function Mr(o,e){let t=o.filter(s=>s instanceof Date&&!Number.isNaN(s.getTime()));if(t.length)return t.reduce((s,i)=>(e?i>s:i<s)?i:s);let n=_n(o);if(!n.length)return null;let r=n[0];for(let s of n)(e?s>r:s<r)&&(r=s);return r}function me(o,e,t){if(typeof o=="function")return o(e,t);switch(o){case"sum":return _n(e).reduce((n,r)=>n+r,0);case"avg":{let n=_n(e);return n.length?n.reduce((r,s)=>r+s,0)/n.length:null}case"min":return Mr(e,!1);case"max":return Mr(e,!0);case"count":return t.length}return null}function ft(o){return typeof o=="object"&&o!==null&&"agg"in o?o:{agg:o}}function Er(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]=me(ft(l).agg,r(a,d),e))}return i})}function pt(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 Ke(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=pt(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 V(d)?null:te(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 Xn(o,e){let t=new Int32Array(e),n=new Int32Array(e),r=0;for(let s=1;s<=e;s++)if(!(s<e&&!o.some(i=>i.start[s]===s))){for(let i=r;i<s;i++)t[i]=r,n[i]=s-1;r=s}return{start:t,end:n}}function Ar(o,e){let t=o.length,n=new Int32Array(t);if(!t||!e.length)return n;let{start:r}=Xn(e.map(s=>Ke(o,s)),t);for(let s=1;s<t;s++)n[s]=n[s-1]+(r[s]===s?1:0);return n}function Tr(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 Gt(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 Pr(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"],Lr=6,Fi=8,Jn=2,Di='<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>',Yn='<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 $i='<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 v(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 zt=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.geo={top:0,left:0,cw:0,ch:0,ow:0,oh:0};this.layoutSig="";this.touched=new Set;this.measureAll=!1;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.summaryKey=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.cards?this.getScroll():{top:this.geo.top,left:this.geo.left})};this.onSideWheel=e=>{e.deltaY&&(e.preventDefault(),this.scroller.scrollTop+=e.deltaY)};this.overlayKey="";this.heightFn=null;this.freeBadge=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=v("div","",{tabindex:"-1"}),this.root.addEventListener("focus",()=>this.gridEl.focus({preventScroll:!0})),this.gridEl=v("div","fg-grid",{role:"grid",tabindex:"0"}),this.headerEl=v("div","fg-header",{role:"rowgroup"}),this.bodyEl=v("div","fg-body",{role:"rowgroup"});let r=s=>({left:v("div",`${s} ${s}-left`),center:v("div",`${s} ${s}-center`),right:v("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=v("div","fg-overlay",{"aria-live":"polite"}),this.main=v("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}readGeo(){let e=this.scroller;this.geo={top:e.scrollTop,left:e.scrollLeft,cw:e.clientWidth,ch:e.clientHeight,ow:e.offsetWidth,oh:e.offsetHeight}}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;this.readGeo();let a=this.geo.ow-this.geo.cw;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(x=>!$(x.id))?.id??"",this.groupLabelId=e.region("center").find(x=>!$(x.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(),h=u?u.opts.rows.length:0,p=u?.opts.position??"bottom",g=u?u.opts.pinned!==!1:!1;this.topOffset=u&&!g&&p==="top"?h*s:0;let y=u&&!g&&p==="bottom"?h*s:0;this.syncSummaryPane(u&&g?p:null,h*s);let w=e.depth*i+(this.filterRow?.height??0);this.headerEl.style.height=`${w}px`;for(let x of oe){let R=e.regionWidth(x);x!=="center"&&(this.headerPanes[x].style.width=this.bodyPanes[x].style.width=`${R}px`,this.headerPanes[x].hidden=this.bodyPanes[x].hidden=R===0),this.canvases[x].style.width=`${R}px`,this.canvases[x].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 f=`${w}|${oe.map(x=>e.regionWidth(x)).join(",")}|${this.rowsHeight(l)+this.topOffset+y}|${u&&g?p:""}|${h}|${r.autoHeight?1:0}`;f!==this.layoutSig&&(this.layoutSig=f,this.readGeo());let m=this.geo.oh-this.geo.ch;this.bodyPanes.left.style.marginBottom=this.bodyPanes.right.style.marginBottom=`${m}px`;let b=this.gridEl;b.setAttribute("role",r.treeData||this.grid.getGroupBy().length?"treegrid":"grid"),b.setAttribute("aria-rowcount",String(l+e.depth+(this.filterRow?1:0))),b.setAttribute("aria-colcount",String(e.displayed().length)),r.rowSelection==="multiple"&&b.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{top:C,left:S}=this.geo;this.bodyPanes.left.scrollTop=this.bodyPanes.right.scrollTop=C,this.headerInners.center.style.transform=`translateX(${-S}px)`,this.filterRow?.setTransform(S),this.summaryInners&&(this.summaryInners.center.style.transform=`translateX(${-S}px)`);for(let x of[this.pinnedTop,this.pinnedBottom])x&&(x.inners.center.style.transform=`translateX(${-S}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;this.placeFreeBadge()}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{O(`${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 Zn(`fg-pinned-rows fg-pinned-${t}`),{columns:s}=this.grid,i=this.opts.rowHeight;r.size(s,n.length*i,this.geo.ow-this.geo.cw);let a=s.region("center"),l=Gt(a.map(c=>c.left),a.map(c=>c.width),this.geo.left,this.geo.cw,Jn),d=[n,n.length,this.version,this.grid.valuesVersion,l.first,l.last,i,this.grid.store.state.locale.code];if(e&&Ir(d,r.key))return r;r.key=d;for(let c of oe){let u=c==="center"?a.slice(l.first,l.last+1):s.region(c);r.inners[c].replaceChildren(...n.map((h,p)=>{let g=v("div","fg-row fg-row-pinned",{role:"row"});g.style.transform=`translateY(${p*i}px)`,g.style.height=`${i}px`;let y={id:`pinned-${t}-${p}`,data:h,sourceIndex:-1};for(let w of u){let f=v("div","fg-cell",{role:"gridcell"});$(w.id)?(f.style.left=`${w.left}px`,f.style.width=`${w.width}px`):this.paintCell(f,y,-1,w,!1,!1),g.append(f)}return g}))}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}.${t.valuesVersion}|${e}|${r}|${n.selected.size}|${JSON.stringify(n.range)}|${JSON.stringify(n.extraRanges)}|${n.locale.code}`;if(this.statusEl&&s===this.statusKey)return;this.statusKey=s,this.statusEl??(this.statusEl=v("div","fg-statusbar",{role:"status","aria-live":"polite"}));let i=n.locale,a=Ce(i.code,2),l=v("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=v("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=v("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===Re&&(i.classList.add("fg-header-rownum"),i.textContent=e.label),e.id===ne&&(i.classList.add("fg-header-select"),i.append(this.selectAllBox(r))),i;let a=v("span","fg-header-label"),l=e.node.def;if(a.textContent=e.label,l.headerRenderer)try{let p=l.headerRenderer({header:e.label,column:l});typeof p=="string"?a.innerHTML=p:a.replaceChildren(p)}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 p=e.node.open,g=v("button",p?"fg-colgroup-toggle fg-expanded":"fg-colgroup-toggle",{type:"button",tabindex:"-1","aria-expanded":String(p),"aria-label":p?r.collapseAll:r.expandAll});g.textContent=p?"\u2212":"+",g.addEventListener("click",y=>{y.stopPropagation(),this.grid.setColumnGroupOpened(e.id,!p)}),i.classList.add("fg-header-collapsible"),d=g}if(l.headerClass)try{let p=typeof l.headerClass=="function"?l.headerClass(l):l.headerClass;p&&i.classList.add(...p.split(/\s+/).filter(Boolean))}catch{O(`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));let u=c.align??(c.type==="number"?"right":"left");u==="right"?i.classList.add("fg-align-right"):u==="center"&&i.classList.add("fg-align-center");let h=t.findIndex(p=>p.colId===e.id);if(i.setAttribute("aria-sort",h<0?"none":t[h].dir==="asc"?"ascending":"descending"),Ie(c)&&i.classList.add("fg-sortable"),h>=0){let p=v("span","fg-sort-icon");if(p.textContent=t[h].dir==="asc"?"\u2191":"\u2193",t.length>1){let g=v("sup");g.textContent=String(h+1),p.append(g)}i.append(p)}if(Ie(c)||ce(c)){let p=!!n[e.id],g=v("button",p?"fg-menu-btn fg-filter-active":"fg-menu-btn",{type:"button",tabindex:"-1","aria-label":r.columnMenu});g.innerHTML=p?$i:Di,i.append(g)}return Lt(c)&&i.append(v("div","fg-resize",{"aria-hidden":"true"})),i}selectAllBox(e){let t=v("input","fg-checkbox fg-select-all",{type:"checkbox",tabindex:"-1","aria-label":e.selectAllRows});return this.paintSelectAll(t),t.hidden=this.grid.options.rowSelection!=="multiple"||this.grid.options.headerCheckbox===!1,t}paintSelectAll(e){let t=this.grid.selectableIds(),n=0;for(let r of this.grid.store.state.selected)t.has(r)&&n++;e.checked=t.size>0&&n===t.size,e.indeterminate=n>0&&n<t.size}selectionChanged(){let e=this.headerEl.querySelectorAll(".fg-select-all");if(e.length)for(let t of e)this.paintSelectAll(t)}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=l.has(ne),{geo:c}=this,u=Math.max(0,c.top-this.topOffset),h=this.grid.options.autoHeight&&!n.server?{first:0,last:e-1}:this.offsets?Pr(this.offsets,u,c.ch,e,Lr):Tr(u,c.ch,this.opts.rowHeight,e,Lr);this.lastRange=h;let p=t.region("center"),g=Gt(p.map(f=>f.left),p.map(f=>f.width),this.geo.left,this.geo.cw,Jn),y=p.some(f=>f.def.colSpan);y&&(g.first=Math.max(0,g.first-Fi));let w=!y&&!l.size;this.touched.clear();for(let f of oe){let m=f==="center"?p.slice(g.first,g.last+1):t.region(f),b=this.painted[f];for(let[S,x]of b)S>=h.first&&S<=h.last&&m.length||(x.el.remove(),this.pool[f].push(x.el),b.delete(S));if(!m.length)continue;let C=f==="center"?`${g.first}-${g.last}`:"";for(let S=h.first;S<=h.last;S++){let x=n.getRow(S),R=s.has(x.id),A=i&&i.rowIndex===S?i.colId:"",k=a.filter(F=>S>=F.r1&&S<=F.r2),E=k.map(F=>`${F.c1}-${F.c2}`).join(","),T=this.mergeState(l,m,S,h.first),L=d&&!x.kind?this.grid.blockSelection(S)??"":"",M=x.kind==="detail"?`${c.left}:${c.cw}`:"",D=`${x.id}|${this.version}.${this.rowVersions.get(x.id)??0}|${R?1:0}${x.kind==="group"?`:${this.grid.selectionVersion}`:""}${L}|${A}|${E}|${T}|${M}`,I=`${C}|${D}`,P=b.get(S);if(!P){let F=this.pool[f].pop()??v("div","fg-row",{role:"row"});this.canvases[f].append(F),P={el:F,key:""},b.set(S,P)}if(P.key!==I){if(this.touched.add(S),w&&f==="center"&&!x.kind&&P.base===D&&this.slideCells(P,x,S,p,g,R,A,k)){P.key=I;continue}P.key=I,P.base=f==="center"&&!x.kind?D:void 0,P.first=g.first,P.last=g.last,P.el.dataset.kind!==(x.kind??"")&&(P.el.replaceChildren(),P.el.dataset.kind=x.kind??""),x.kind==="group"?this.paintGroupRow(P.el,x,S,m,A):x.kind==="detail"?this.paintDetailRow(P.el,x,S,f):x.kind==="loading"?this.paintLoadingRow(P.el,S,m):this.paintRow(P.el,x,S,m,R,A,k,l,h.first)}}}l.size&&this.stickMergedText(c.top,c.ch||Number.MAX_SAFE_INTEGER/4)}stickMergedText(e,t){for(let n of oe){let r=new Map;for(let[i,a]of this.painted[n]){let l=-1;for(let d of a.el.querySelectorAll(".fg-cell-merged"))l=Math.max(l,Number(d.dataset.mergeEnd));l>i&&r.set(i,l)}let s=new Map;for(let i of[...r.keys()].sort((a,l)=>l-a)){let a=0;for(let[l,d]of s)l>i&&l<=r.get(i)&&(a=Math.max(a,d));s.set(i,a+1)}for(let[i,a]of this.painted[n]){let l=s.has(i)?String(s.get(i)):"";a.el.style.zIndex!==l&&(l||a.el.querySelector(".fg-cell-merged, .fg-cell-merge-hidden"))&&(a.el.style.zIndex=l)}for(let i of this.painted[n].values())for(let a of i.el.querySelectorAll(".fg-cell-merged")){let l=Number(a.dataset.mergeTop),d=Number(a.dataset.mergeLast);if(!Number.isFinite(l)||!Number.isFinite(d))continue;let c=Math.min(d,Math.max(0,e-l)),u=0;if(a.classList.contains("fg-cell-merged-middle")||a.classList.contains("fg-cell-merged-bottom")){let g=Number(a.dataset.mergeHeight),y=g-d;u=Math.max(0,Math.min(g-c-y,l+g-(e+t))),c=Math.min(c,g-u-y)}let h=`${Math.round(c)}px`;a.style.getPropertyValue("--fg-merge-shift")!==h&&a.style.setProperty("--fg-merge-shift",h);let p=`${Math.round(u)}px`;a.style.getPropertyValue("--fg-merge-shift-bottom")!==p&&a.style.setProperty("--fg-merge-shift-bottom",p)}}}slideCells(e,t,n,r,s,i,a,l){let d=e.first,c=e.last;if(s.first>c||s.last<d||e.el.childElementCount!==c-d+1)return!1;let u=e.el;for(let p=d;p<s.first;p++)u.firstElementChild.remove();for(let p=c;p>s.last;p--)u.lastElementChild.remove();let h=p=>{let g=v("div","fg-cell",{role:"gridcell"});return this.paintCell(g,t,n,p,i,a===p.id),p.id===this.firstDataId&&this.decorate(g,t),!$(p.id)&&l.some(y=>p.index>=y.c1&&p.index<=y.c2)&&g.classList.add("fg-cell-range"),g};return s.first<d&&u.prepend(...r.slice(s.first,d).map(h)),s.last>c&&u.append(...r.slice(c+1,s.last+1).map(h)),e.first=s.first,e.last=s.last,!0}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(v("div","fg-cell",{role:"gridcell"}));let u=!1,h=r.length?this.grid.columns.region(r[0].region):[],p=h.some(w=>w.def.colSpan),g=-1,y=p?new Map(h.map((w,f)=>[w.id,f])):null;r.forEach((w,f)=>{let m=e.children[f];if(this.paintCell(m,t,n,w,s,i===w.id),y){let C=y.get(w.id);if(C<=g)m.classList.add("fg-cell-span-hidden");else if(w.def.colSpan&&!$(w.id)){let S=pt(w.def.colSpan,w.def,t.data,n,h.length-C);if(S>1){g=C+S-1;let x=0;for(let R=C;R<=g;R++)x+=h[R].width;m.style.width=`${x}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",m.dataset.mergeTop=String(this.rowTop(b.start[n])),m.dataset.mergeLast=String(this.rowTop(b.end[n])-this.rowTop(b.start[n])),m.dataset.mergeEnd=String(b.end[n]),m.dataset.mergeHeight=String(this.rowTop(b.end[n])+this.rowH(b.end[n])-this.rowTop(b.start[n])),m.classList.toggle("fg-cell-merged-middle",w.def.mergeAlign==="middle"),m.classList.toggle("fg-cell-merged-bottom",w.def.mergeAlign==="bottom"),u=!0):m.classList.add("fg-cell-merge-hidden")),!m.classList.contains("fg-cell-merged")&&m.dataset.mergeTop!==void 0&&(delete m.dataset.mergeTop,delete m.dataset.mergeLast,delete m.dataset.mergeEnd,delete m.dataset.mergeHeight,m.classList.remove("fg-cell-merged-middle","fg-cell-merged-bottom"),m.style.removeProperty("--fg-merge-shift"),m.style.removeProperty("--fg-merge-shift-bottom")),!$(w.id)&&a.some(C=>w.index>=C.c1&&w.index<=C.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===Re){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===Le){e.className=`${l} fg-cell-drag`;let g=v("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===ne){e.className=`${l} fg-cell-select`;let g=v("input","fg-checkbox",{type:"checkbox",tabindex:"-1","aria-label":a.selectRow});g.checked=s;let y=n>=0&&!t.kind?this.grid.blockSelection(n):null;y?(g.checked=y==="all",g.indeterminate=y==="some",y==="off"&&(g.disabled=!0,e.classList.add("fg-cell-select-locked"))):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=Q(d,a.code)(c),h=n>=0&&!t.kind?this.grid.cellFormat(t.data,r.id,c):null;l+=` fg-align-${he(h?.style)??d.align??(d.type==="number"?"right":d.type==="boolean"?"center":"left")}`;let p={value:c,formatted:u,row:t.data,rowIndex:n,column:d};if(d.cellClass)try{let g=typeof d.cellClass=="function"?d.cellClass(p):d.cellClass;g&&(l+=` ${g}`)}catch{O(`cellClass of column "${r.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&&!Pt(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),h?.bar&&(l+=" fg-cf-bar"),e.className=l,this.applyFormat(e,h),d.sparkline&&!d.renderer){let g=Array.isArray(c)?c.map(Number).filter(Number.isFinite):[];g.length?e.replaceChildren(Ni(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,h?.icon){let g=v("span","fg-cf-icon",{"aria-hidden":"true"});g.textContent=h.icon.char,g.style.color=h.icon.color,e.prepend(g)}return}try{let g=d.renderer(p);typeof g=="string"?e.innerHTML=g:e.replaceChildren(g)}catch{O(`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:v("div",`${s} ${s}-left`),center:v("div",`${s} ${s}-center`),right:v("div",`${s} ${s}-right`)});this.summaryEl=v("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.geo.ow-this.geo.cw;this.summaryPanes.center.style.marginRight=`${n}px`}renderSummary(e,t,n,r,s){if(!t&&!this.summaryKey)return;let i=this.grid.columns.region("center"),a=Gt(i.map(h=>h.left),i.map(h=>h.width),this.geo.left,this.geo.cw,Jn),l=[t,n,r,s,this.summaryInners,this.version,a.first,a.last,this.opts.rowHeight,r?0:this.rowsHeight(e),this.grid.store.state.locale.code];if(Ir(l,this.summaryKey))return;this.summaryKey=l;for(let h of oe){for(let p of this.canvasSummary[h])p.remove();this.canvasSummary[h]=[]}if(!t){this.summaryKey=null;return}let{columns:d}=this.grid,c=this.opts.rowHeight,u=d.displayed().filter(h=>!$(h.id));for(let h of oe){let p=h==="center"?i.slice(a.first,a.last+1):d.region(h),g=t.map((y,w)=>{let f=y.label!=null?u.find(C=>!(C.id in(y.columns??{})))?.id??null:null,m=v("div","fg-row fg-summary-row",{role:"row"}),b=r||s==="top"?w*c:this.rowsHeight(e)+w*c;m.style.transform=`translateY(${b}px)`,m.style.height=`${c}px`;for(let C of p)m.append(this.summaryCell(C,y,n[w]??{},f));return m});r?this.summaryInners[h].replaceChildren(...g):(this.canvases[h].append(...g),this.canvasSummary[h]=g)}}summaryCell(e,t,n,r){let s=v("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=ft(l),u=this.grid.store.state.locale.code,h;if(d==null||d==="")h="";else if(typeof d=="string")h=d;else if(c.agg==="count")h=Ce(u).format(d);else{let p=i.type??(typeof d=="number"?"number":d instanceof Date?"date":void 0);h=it(i,p,u,c.format??i.format)(d)}return s.textContent=c.prefix&&h?`${c.prefix} ${h}`:h,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.measureAll=!0,this.heightsVersion++)}measureRows(){let e=this.opts.rowHeight,t=new Map,n=this.measureAll?new Set(oe.flatMap(s=>[...this.painted[s].keys()])):this.touched;this.measureAll=!1;for(let s of n){let i=this.grid.rowModel.getRow(s);if(!i||i.kind)continue;let a=e;for(let l of oe){let d=this.painted[l].get(s);if(d)for(let c of d.el.querySelectorAll(".fg-cell-wrap"))c.classList.contains("fg-cell-merged")||c.classList.contains("fg-cell-merge-hidden")||(a=Math.max(a,Math.ceil(c.scrollHeight)))}t.set(s,a)}this.touched.clear();let r=!1;for(let[s,i]of t){let a=this.grid.rowModel.getRow(s).id,l=this.rowHeights.get(a)??e;Math.abs(l-i)>1&&(i===e?this.rowHeights.delete(a):this.rowHeights.set(a,i),r=!0)}r&&(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=v("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=Yn,l.push(d)}else l.push(v("span","fg-tree-spacer",{"aria-hidden":"true"}));if(a){let d=n.isDetailExpanded(t.data),c=v("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=Yn,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(v("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 h=s===d.id?" fg-cell-focused":"";if(d.id===ne){if(u.className=`fg-cell fg-cell-select${h}`,a.options.rowSelection!=="multiple"){u.replaceChildren();return}let w=a.groupSelection(t),f=v("input","fg-checkbox",{type:"checkbox",tabindex:"-1","aria-label":l.selectAllRows});f.checked=w==="all",f.indeterminate=w==="some",u.replaceChildren(f);return}if(d.id===this.groupLabelId){u.className=`fg-cell fg-group-cell${h}`,u.style.setProperty("--fg-level",String(t.level??0));let w=v("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=Yn;let f=a.columns.getNode(i.colId)?.def,m=v("span","fg-group-label"),b=V(i.value)?l.blanks:f?Q(f,l.code)(i.value):String(i.value),C=Ce(l.code),S=i.count??(i.aggregates?null:i.rows.length);m.textContent=`${f?.header??f?.field??i.colId}: ${b}${S==null?"":` (${C.format(S)})`}`,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}${h}`;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=Ce(l.code).format(y);else{let w=p.type??(typeof y=="number"?"number":y instanceof Date?"date":void 0);u.textContent=it(p,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=v("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{O("detailRenderer threw; showing an empty panel")}this.details.set(s.id,i)}i.style.left=`${this.geo.left}px`,i.style.width=`${this.geo.cw||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=v("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(v("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(f=>Number.isInteger(f)&&f>0):[],d=`${r}|${s}|${i}|${a}|${n.code}|${l.join(",")}`;if(this.pagerEl&&d===this.pagerKey)return;this.pagerKey=d,this.pagerEl||(this.pagerEl=v("div","fg-pager",{role:"navigation"}),this.pagerEl.addEventListener("click",f=>{let m=f.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",f=>{let m=f.target;m.classList.contains("fg-pager-size")&&e.setPageSize(Number(m.value))})),this.pagerEl.setAttribute("aria-label",n.pageSize);let c=Ce(n.code),u=a?r*s+1:0,h=Math.min(a,(r+1)*s),p=v("span","fg-pager-range");p.textContent=n.pagerRange.replace("{from}",c.format(u)).replace("{to}",c.format(h)).replace("{total}",c.format(a));let g=[p,v("span","fg-pager-spacer")];if(l.length){let f=v("label","fg-pager-size-label");f.textContent=n.pageSize;let m=v("select","fg-pager-size");for(let b of[...new Set([...l,s])].sort((C,S)=>C-S)){let C=v("option");C.value=String(b),C.textContent=c.format(b),C.selected=b===s,m.append(C)}f.append(m),g.push(f)}let y=(f,m,b,C)=>{let S=v("button","fg-pager-btn",{type:"button","aria-label":b,title:b});return S.dataset.action=f,S.textContent=m,S.disabled=C,S},w=v("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=v("div","fg-free-badge",{"aria-hidden":"true"});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=v("span");t.textContent=`FreeGrid \xB7 ${this.grid.store.state.locale.freeBadge}`,e.append(t),this.root.append(e),this.freeBadge=e,this.placeFreeBadge()}placeFreeBadge(){if(!this.freeBadge)return;let e=(this.statusEl?.isConnected?this.statusEl.offsetHeight:0)+(this.pagerEl?.isConnected?this.pagerEl.offsetHeight:0),t=e?`${e+22}px`:"";this.freeBadge.style.bottom!==t&&(this.freeBadge.style.bottom=t)}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=v("div","fg-cards",{role:"list"}),w=v("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:h,locale:p}=t.store.state,g=[];for(let y=c;y<=u;y++){let w=t.rowModel.getRow(y);if(!w)continue;let f=v("div",w.kind?"fg-card fg-card-other":h.has(w.id)?"fg-card fg-card-selected":"fg-card",{role:"listitem"});if(f.dataset.row=String(y),f.style.transform=`translateY(${y*(l+d)}px)`,f.style.height=`${l}px`,f.style.setProperty("--fg-card-line",`${i}px`),w.kind==="group"&&w.group){let m=t.columns.getNode(w.group.colId)?.def;f.textContent=`${m?.header??w.group.colId}: ${String(w.group.value??p.blanks)} (${w.group.rows.length})`}else if(!w.kind){if(a){let m=v("label","fg-card-head"),b=v("input","fg-card-check fg-checkbox",{type:"checkbox","aria-label":p.selectRow});b.checked=h.has(w.id),b.disabled=!t.rowSelectable(w.data),m.append(b,document.createTextNode(`#${y+1}`)),f.append(m)}for(let m of s){let b=v("div","fg-card-line"),C=v("span","fg-card-label");C.textContent=m.def.header??m.def.field??m.id;let S=v("span","fg-card-value");S.dataset.col=m.id;let x=G(m.def,w.data),R=Q(m.def,p.code)(x);if(m.def.renderer)try{let A=m.def.renderer({value:x,formatted:R,row:w.data,rowIndex:y,column:m.def});typeof A=="string"?S.innerHTML=A:S.replaceChildren(A)}catch{S.textContent=R}else S.textContent=R;b.append(C,S),f.append(b)}}g.push(f)}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()}},Zn=class{constructor(e){this.key=null;let t=n=>({left:v("div",`${n} ${n}-left`),center:v("div",`${n} ${n}-center`),right:v("div",`${n} ${n}-right`)});this.el=v("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`}};function Ir(o,e){return!!e&&o.length===e.length&&o.every((t,n)=>t===e[n])}var Fr="http://www.w3.org/2000/svg";function Ni(o,e,t,n){let r=Math.max(20,t-16),s=Math.max(10,n-14),i=document.createElementNS(Fr,"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=o.reduce((f,m)=>Math.min(f,m),l?0:1/0),c=o.reduce((f,m)=>Math.max(f,m),l?0:-1/0);d===c&&(d-=1,c+=1);let u=c-d,h=f=>s-1-(f-d)/u*(s-2),p=(f,m)=>{let b=document.createElementNS(Fr,f);for(let[C,S]of Object.entries(m))b.setAttribute(C,String(S));return i.append(b),b};if(e.type==="bar"){let f=r/o.length;return o.forEach((m,b)=>p("rect",{x:b*f+1,y:Math.min(h(m),h(0)),width:Math.max(1,f-2),height:Math.max(1,Math.abs(h(m)-h(0))),fill:m<0?"#ef4444":a})),i}let g=o.length>1?(r-2)/(o.length-1):0,y=o.map((f,m)=>`${1+m*g},${h(f)}`).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:h(o[w]),r:2,fill:a}),i}var Oi=4,Vt=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)<Oi||(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,h=this.grid.getGroupBy().filter(p=>p!==r);h.splice(u,0,r),this.grid.setGroupBy(h)};window.addEventListener("pointermove",a),window.addEventListener("pointerup",l)};this.el=v("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=v("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=v("span","fg-group-chip");a.dataset.col=r;let l=v("span","fg-group-chip-label");l.textContent=i?.header??i?.field??r;let d=v("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=v("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 _e=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 re(o){let e=o.getRootNode();return typeof ShadowRoot<"u"&&e instanceof ShadowRoot?e:document.body}function ht(o,e,t){let n=o.getRootNode();return(typeof n.elementFromPoint=="function"?n.elementFromPoint(e,t):null)??document.elementFromPoint(e,t)}function qt(o){return o.getRootNode().activeElement??document.activeElement}function de(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 Qn=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Home","End","PageUp","PageDown"]);function eo(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 Wt=new Map,to=new WeakMap,Dr=o=>o?to.get(o):void 0,$r=o=>o?Wt.get(o):void 0;var Bi={Enter:"edit",F2:"edit",Delete:"clear",Backspace:"clear","Ctrl+Z":"undo","Ctrl+Y":"redo","Ctrl+Shift+Z":"redo","Ctrl+F":"find","Alt+ArrowDown":"columnMenu"};function Hi(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 Gi=3;function zi(o,e){return o.renderer.rtl?e.key==="ArrowLeft"?"ArrowRight":e.key==="ArrowRight"?"ArrowLeft":e.key:e.key}function Nr(o){let{renderer:e}=o,t=e.bodyEl,n=e.root,r=k=>zi(o,k),s="mouse",i=0,a=null,l=!1,d=k=>{let E=e.cellAt(k.target);if(!E)return null;let T=o.rowModel.getRow(E.rowIndex),L=o.columns.getColumn(E.colId);if(!T||!L)return null;let M=$(L.id)?void 0:G(L.def,T.data);return{row:T.data,rowIndex:E.rowIndex,colId:E.colId,value:M,event:k}},c=k=>{let E=k.target.closest?.(".fg-group-toggle, .fg-tree-toggle, .fg-detail-toggle"),T=E&&e.cellAt(k.target);if(!T)return!1;e.gridEl.focus({preventScroll:!0}),o.setFocus(T.rowIndex,T.colId),o.setRange(null);let L=o.rowModel.getRow(T.rowIndex);return E.classList.contains("fg-detail-toggle")?o.setDetailExpanded(L.data,!o.isDetailExpanded(L.data)):o.toggleRow(T.rowIndex),!0},u=k=>{if(c(k))return;let E=o.store.state.focus,T=e.cellAt(k.target);if(T&&o.rowModel.getRow(T.rowIndex)?.kind){T.colId===ne&&o.rowModel.getRow(T.rowIndex).kind==="group"&&o.toggleGroupSelection(o.rowModel.getRow(T.rowIndex)),e.gridEl.focus({preventScroll:!0}),o.setFocus(T.rowIndex,T.colId),o.setRange(null);return}let L=d(k);if(!L)return;if(e.gridEl.focus({preventScroll:!0}),L.colId===Re){let P=o.columns.displayed().filter(F=>!$(F.id));P.length&&(o.setFocus(L.rowIndex,P[0].id),o.rangesOn()&&o.setRange({start:{rowIndex:L.rowIndex,colId:P[0].id},end:{rowIndex:L.rowIndex,colId:P[P.length-1].id}}));return}let M=l;l=!1;let D=o.store.state.focus,I=L.colId===ne;if(!M)if(k.shiftKey&&D&&!I&&!$(D.colId)&&o.rangesOn())o.setRange({start:D,end:{rowIndex:L.rowIndex,colId:L.colId}},!0);else if((k.ctrlKey||k.metaKey)&&!I&&!$(L.colId)&&o.rangesOn()){let P={rowIndex:L.rowIndex,colId:L.colId};o.addRange({start:P,end:P}),o.setFocus(L.rowIndex,L.colId)}else o.setFocus(L.rowIndex,L.colId),o.setRange(null);o.options.rowSelection&&!M&&(I||o.options.rowClickSelection!==!1)&&o.selectFromClick(L.rowIndex,I||k.ctrlKey||k.metaKey,k.shiftKey),o.events.emit("cellClick",L),s==="touch"&&!M&&E&&E.rowIndex===L.rowIndex&&E.colId===L.colId&&o.editor.canEdit(L.rowIndex,L.colId)&&(o.columns.getColumn(L.colId).def.type==="boolean"?o.applyEdit(L.rowIndex,L.colId,L.value!==!0):o.editor.start(L.rowIndex,L.colId))},h=k=>{if(k.target.closest?.("button"))return;let E=e.cellAt(k.target),T=E&&o.rowModel.getRow(E.rowIndex);if(T?.kind==="group"){o.toggleRow(E.rowIndex);return}if(T?.kind)return;let L=d(k);if(!L||(o.events.emit("cellDoubleClick",L),!o.editor.canEdit(L.rowIndex,L.colId)))return;o.columns.getColumn(L.colId).def.type==="boolean"?o.applyEdit(L.rowIndex,L.colId,L.value!==!0):o.editor.start(L.rowIndex,L.colId)},p={...Bi};for(let[k,E]of Object.entries(o.options.keymap??{}))p[k]=E===!1?"none":E;let g=k=>{let E=o.store.state.focus,T=p[Hi(k)];if(T==="none")return!1;switch(T){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||!o.paid?!1:(o.finder.openBar(),!0);case"paste":return navigator.clipboard?.readText?.().then(M=>o.pasteText(M),()=>{}),!0;case"columnMenu":return o.menu.openAtFocus()}if(!E||!o.editor.canEdit(E.rowIndex,E.colId))return!1;let L=o.columns.getColumn(E.colId).def;if(k.key===" "&&L.type==="boolean"&&!k.ctrlKey&&!k.metaKey){let M=o.rowModel.getRow(E.rowIndex).data;return o.applyEdit(E.rowIndex,E.colId,M[L.field]!==!0),!0}return k.key.length===1&&k.key!==" "&&!k.ctrlKey&&!k.metaKey&&!k.altKey&&L.type!=="boolean"?(o.editor.start(E.rowIndex,E.colId,k.key),!0):!1},y=k=>{let E=o.store.state.focus;if(!E||k.ctrlKey||k.metaKey||k.altKey||k.shiftKey)return!1;let T=o.rowModel.getRow(E.rowIndex);if(!o.isExpandable(T))return!1;let L=T.kind==="group";if(!L&&E.colId!==o.columns.displayed().find(I=>!$(I.id))?.id)return!1;let M=!!(T.group?.expanded??T.expanded),D=o.expandKey(T);if(L&&(k.key==="Enter"||k.key===" "))o.setGroupExpanded(D,!M);else if(r(k)==="ArrowRight"&&!M)o.setGroupExpanded(D,!0);else if(r(k)==="ArrowLeft"&&M)o.setGroupExpanded(D,!1);else return!1;return!0},w=k=>{let E=e.cellAt(k.target);if(!E||E.colId!==Le)return!1;k.preventDefault();let T=o.rowModel.getRow(E.rowIndex);if(!T||T.kind||!o.canMoveRows())return!0;let L=T.data,M=v("div","fg-row-drop-marker"),D=null;n.classList.add("fg-row-dragging");let I=F=>{let B=ht(n,F.clientX,F.clientY),z=B?.closest(".fg-root"),j=z===n?o:$r(z),X=o.dragOptions.group;if(D=null,M.remove(),!j||!z||j!==o&&(!X||j.dragOptions.group!==X||!j.options.rowDrag))return;let J=B.closest(".fg-row[data-row]"),_=J?.getBoundingClientRect(),se=null,Z="after",N;if(J&&_){let U=j.rowModel.getRow(Number(J.dataset.row));if(!U||U.kind==="group")return;se=U.detailOf?.data??U.data;let K=(F.clientY-_.top)/_.height;U.kind==="detail"?Z="after":j.options.treeData?Z=K<.25?"before":K>.75?"after":"inside":Z=K<.5?"before":"after",N=Z==="before"?_.top:_.bottom}else{if(!B.closest(".fg-body"))return;let U=z.querySelectorAll(".fg-body-pane-center .fg-row[data-row]");N=U.length?Math.max(...[...U].map(K=>K.getBoundingClientRect().bottom)):z.querySelector(".fg-body").getBoundingClientRect().top}if(!j.canDropRow(L,se,Z,o))return;D={into:j,target:se,position:Z};let W=z.getBoundingClientRect().top;M.classList.toggle("fg-row-drop-inside",Z==="inside"),M.style.top=`${Z==="inside"?_.top-W:N-W-1}px`,M.style.height=Z==="inside"?`${_.height}px`:"",z.append(M)},P=()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P),n.classList.remove("fg-row-dragging"),M.remove(),D&&D.into.dropRow(L,D.target,D.position,o)};return window.addEventListener("pointermove",I),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P),!0},f=k=>{let E=e.cellAt(k.target);if(!E)return;let T=k.clientX,L=k.clientY,M=()=>{clearTimeout(i),window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M),a===M&&(a=null)},D=I=>{Math.hypot(I.clientX-T,I.clientY-L)>8&&M()};clearTimeout(i),i=window.setTimeout(()=>{M(),o.contextMenu.enabled()&&(l=!0,$(E.colId)||(o.setFocus(E.rowIndex,E.colId),o.rangeContains(E.rowIndex,E.colId)||o.setRange({start:E,end:E})),o.contextMenu.open(T,L,E.rowIndex,E.colId))},550),a?.(),a=M,window.addEventListener("pointermove",D),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M)},m=k=>{if(s=k.pointerType||"mouse",s==="touch"){f(k);return}if(k.button===0&&w(k)||!o.rangesOn()||k.button!==0||k.shiftKey||k.target.closest("input, a, button"))return;let E=e.cellAt(k.target);if(!E||$(E.colId))return;let T=k.clientX,L=k.clientY,M=k.ctrlKey||k.metaKey,D=!1,I=F=>{if(!D&&Math.hypot(F.clientX-T,F.clientY-L)<Gi)return;let B=e.cellAt(ht(n,F.clientX,F.clientY));!B||$(B.colId)||(D||(D=!0,n.classList.add("fg-range-dragging"),M&&o.addRange({start:E,end:E}),o.setFocus(E.rowIndex,E.colId)),o.setRange({start:E,end:B},M))},P=()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P),n.classList.remove("fg-range-dragging"),D&&(l=!0),a===P&&(a=null)};a?.(),a=P,window.addEventListener("pointermove",I),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P)},b=k=>{if(k.target!==n&&k.target!==e.gridEl)return;let E=o.columns.displayed(),T=o.rowModel.getRowCount();if(!E.length||!T)return;if(y(k)){k.preventDefault();return}if(g(k)){k.preventDefault();return}let L=o.store.state.focus,M=k.ctrlKey||k.metaKey;if(k.key==="Escape"&&o.store.state.range){k.preventDefault(),o.setRange(null);return}if(M&&k.key.toLowerCase()==="a"&&o.rangesOn()){k.preventDefault(),o.selectAllCells();return}if(k.key==="ContextMenu"||k.key==="F10"&&k.shiftKey){k.preventDefault(),o.contextMenu.openAtFocus();return}if(k.key===" "&&L&&o.options.rowSelection){k.preventDefault(),o.selectFromClick(Math.min(L.rowIndex,T-1),!0,k.shiftKey);return}let D={rows:T,cols:E.length,pageRows:e.pageRows()},I=E.findIndex(z=>!$(z.id));if(o.rangesOn()&&k.shiftKey&&k.key!=="Tab"&&Qn.has(k.key)){let z=L??{rowIndex:0,colId:E[I].id},j=o.store.state.range,X=j?.end??z,J={rowIndex:Math.min(X.rowIndex,T-1),colIndex:Math.max(0,E.findIndex(Z=>Z.id===X.colId))},_=eo(r(k),{ctrl:M,shift:!1},J,D);if(!_)return;k.preventDefault();let se=E[Math.max(I,_.colIndex)].id;L||o.setFocus(z.rowIndex,z.colId),o.setRange({start:j?.start??z,end:{rowIndex:_.rowIndex,colId:se}}),e.ensureVisible(_.rowIndex,se);return}let F;if(!L)F=Qn.has(k.key)&&k.key!=="Tab"?{rowIndex:0,colIndex:0}:null;else{let z=Math.max(0,E.findIndex(j=>j.id===L.colId));F=eo(r(k),{ctrl:M,shift:k.shiftKey},{rowIndex:Math.min(L.rowIndex,T-1),colIndex:z},D)}if(!F)return;k.preventDefault();let B=E[F.colIndex].id;o.setFocus(F.rowIndex,B),o.setRange(null),e.ensureVisible(F.rowIndex,B)},C=k=>k.target?.closest?.(".fg-editor, input, textarea, select, [contenteditable]"),S=k=>k.target?.closest?.(".fg-root")!==n,x=k=>{if(C(k)||S(k))return;let E=o.copyText(!1);!E||!k.clipboardData||(k.clipboardData.setData("text/plain",E),k.preventDefault())},R=k=>{if(C(k)||S(k))return;let E=o.copyText(!1);!E||!k.clipboardData||(k.clipboardData.setData("text/plain",E),k.preventDefault(),o.clearCells(!0))},A=k=>{if(C(k)||S(k))return;let E=k.clipboardData?.getData("text/plain");E&&(k.preventDefault(),o.pasteText(E))};return t.addEventListener("click",u),t.addEventListener("dblclick",h),t.addEventListener("pointerdown",m),n.addEventListener("keydown",b),n.addEventListener("copy",x),n.addEventListener("paste",A),n.addEventListener("cut",R),()=>{clearTimeout(i),a?.(),t.removeEventListener("click",u),t.removeEventListener("dblclick",h),t.removeEventListener("pointerdown",m),n.removeEventListener("keydown",b),n.removeEventListener("copy",x),n.removeEventListener("paste",A),n.removeEventListener("cut",R)}}var jt=class{constructor(e){this.grid=e;this.open=new Set;this.el=v("div","fg-filters-panel")}refresh(){let{grid:e}=this,t=e.store.state.locale,n=e.store.state.filters,r=v("div","fg-filters-head"),s=v("span","fg-filters-title");s.textContent=t.filters;let i=v("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=v("div","fg-filters-list");for(let l of e.columns.displayed()){if($(l.id)||!ce(l.def))continue;let d=v("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=v("summary");c.textContent=l.def.header??l.def.field??l.id,d.append(c);let u=()=>{if(d.querySelector(".fg-filter"))return;let h=e.menu.filterSection(l.id,()=>{});h&&d.append(h)};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 Vi=["sum","avg","min","max","count"],Ut=class{constructor(e){this.grid=e;this.draft={rows:[],columns:[],values:[]};this.el=v("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=v("label","fg-pivot-mode"),a=v("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=v("div","fg-pivot-zone");u.dataset.zone=d;let h=v("div","fg-pivot-zone-title");h.textContent=c;let p=v("div","fg-pivot-chips"),g=d==="values"?this.draft.values.map(f=>f.colId):this.draft[d];g.forEach((f,m)=>{let b=v("span","fg-group-chip");b.dataset.col=f;let C=v("span","fg-group-chip-label");if(C.textContent=s(f),b.append(C),d==="values"){let x=v("select","fg-pivot-agg",{"aria-label":`${s(f)} ${t.pivotValues}`});for(let R of Vi){let A=v("option");A.value=R,A.textContent=t[R],x.append(A)}x.value=this.draft.values[m].aggFunc,x.addEventListener("change",()=>{this.draft.values[m].aggFunc=x.value,this.apply()}),b.append(x)}let S=v("button","fg-group-chip-remove",{type:"button","aria-label":`${t.ungroup}: ${s(f)}`});S.textContent="\xD7",S.addEventListener("click",()=>{d==="values"?this.draft.values.splice(m,1):this.draft[d].splice(m,1),this.apply()}),b.append(S),p.append(b)});let y=v("select","fg-pivot-add",{"aria-label":`${c}: ${t.addColumn}`}),w=v("option");w.value="",w.textContent=t.addColumn,y.append(w);for(let f of r){if(g.includes(f.id)||d==="values"&&f.def.type!=="number")continue;let m=v("option");m.value=f.id,m.textContent=s(f.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(h,p,y),u};this.el.replaceChildren(i,l("rows",t.pivotRows),l("columns",t.pivotColumns),l("values",t.pivotValues))}};var qi=4,Kt=o=>!$(o.id)&&(o.children?o.children.some(Kt):o.def.chooser!==!1),no=o=>o.def.header??o.def.field??o.id,_t=class{constructor(e){this.grid=e;this.collapsed=new Set;this.el=v("div","fg-chooser"),this.search=v("input","fg-input fg-chooser-search",{type:"search"});let t=v("label","fg-chooser-all");this.allBox=v("input","fg-checkbox",{type:"checkbox"}),this.allText=v("span"),t.append(this.allBox,this.allText),this.list=v("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)!Kt(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(no(n).toLowerCase().includes(t))return!0;return!!e.children&&e.children.some(n=>Kt(n)&&this.subtreeMatches(n,t))}leavesOf(e){return Kt(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=v("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=v("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=v("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=v("input","fg-checkbox",{type:"checkbox","aria-label":no(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=v("span","fg-chooser-label");if(l.textContent=no(e),n.append(a,l),!e.children&&e.pinned){let d=v("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=v("div","fg-chooser-marker"),u=p=>{if(!l){if(Math.abs(p.clientY-a)<qi||!i.length)return;l=!0,n.classList.add("fg-dragging"),this.list.append(c)}d=i.filter(w=>{let f=w.getBoundingClientRect();return p.clientY>f.top+f.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`},h=()=>{if(window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",h),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",h)}},Xt=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=v("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=v("div","fg-chooser-head"),r=v("span","fg-menu-title");r.textContent=e.chooseColumns;let s=v("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 _t(this.grid),t.append(n,this.panel.el),re(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=>{de(c,t)||this.close()},d=c=>{c.key==="Escape"&&(this.close(),this.grid.renderer.gridEl.focus())};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}},Jt=class{constructor(e,t,n=["columns","filters"]){this.grid=e;this.tabs=new Map;this.el=v("div","fg-sidebar"),this.panelHost=v("div","fg-sidebar-panel"),this.columns=new _t(e),this.filters=new jt(e),this.pivot=new Ut(e);let r=n.filter(i=>i==="columns"||i==="filters"||i==="pivot");r.length||r.push("columns"),this.current=r[0];let s=v("div","fg-sidebar-tabs",{role:"tablist"});for(let i of r){let a=v("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 Wi=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||""),Xe=o=>Wi()?`\u2318${o}`:`Ctrl+${o}`,Yt=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()}enabled(){return this.grid.options.contextMenu!==!1&&this.grid.allow("contextMenu")}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||!this.enabled()||(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.enabled())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=t.store.state.selected.size?t.shownSelectedRows():[],l=[{label:n.copy,shortcut:Xe("C"),action:()=>t.copyToClipboard(!1)},{label:n.copyWithHeaders,action:()=>t.copyToClipboard(!0)},{label:n.cut,shortcut:Xe("X"),action:()=>t.cutToClipboard()},...a.length?[{label:n.copyRows,action:()=>t.copyToClipboard(!1,!0)}]:[],{label:n.paste,shortcut:Xe("V"),action:()=>this.pasteFromClipboard()}];(t.history.canUndo()||t.history.canRedo())&&l.push("separator",{label:n.undo,shortcut:Xe("Z"),action:()=>t.undo(),disabled:!t.history.canUndo()},{label:n.redo,shortcut:Xe("Y"),action:()=>t.redo(),disabled:!t.history.canRedo()}),t.options.rowSelection&&a.length&&l.push({label:n.deleteRows,action:()=>t.removeRows(a)}),i&&(l.push("separator",{label:n.autosizeThis,action:()=>t.autoSize([e])}),s.lockVisible||l.push({label:n.hideColumn,action:()=>t.setColumnsVisible([e],!1)}),l.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})),l.push("separator"),t.options.rowSelection==="multiple"&&l.push({label:n.selectAllRows,action:()=>t.api.selectAll()}),l.push({label:n.chooseColumns,action:()=>t.chooser.open()});let d=t.rangeBounds();return d&&(d.r2>d.r1||d.c2>d.c1)&&t.paid&&l.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"})}),l.push("separator",{label:n.exportCsv,action:()=>t.api.exportCsv()},...t.paid?[{label:n.exportExcel,action:()=>t.api.exportXlsx()}]:[],{label:n.exportJson,action:()=>t.api.exportJson()},...t.options.assistant?.url&&t.paid?[{label:`${n.ai.title}\u2026`,action:()=>t.api.openAssistant()}]:[],...t.paid?[{label:n.exportPdf,action:()=>t.api.exportPdf()}]:[]),t.options.advancedFilter!==!1&&!t.options.pivot&&t.paid&&l.push("separator",{label:`${n.advancedFilter}\u2026`,action:()=>t.filterBuilder.open()}),l.push("separator",{label:n.print,action:()=>t.api.print()}),l}pasteFromClipboard(){let e=typeof navigator<"u"?navigator.clipboard:void 0,t=()=>this.grid.toast(this.grid.store.state.locale.pasteHint.replace("Ctrl+V",Xe("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 h=s.store.state.locale,p=v("div",`fg-menu fg-context-menu fg-theme-${s.store.state.theme}`,{role:"menu","aria-label":h.columnMenu});s.applyFontTo(p);let g=!0;for(let S of u){if(S==="separator"){g||p.append(v("div","fg-cm-sep",{role:"separator"})),g=!0;continue}let x=v("button","fg-menu-item fg-cm-item",{type:"button",role:"menuitem"}),R=v("span","fg-cm-label");if(R.textContent=S.label,x.append(R),S.shortcut){let A=v("span","fg-cm-shortcut");A.textContent=S.shortcut,x.append(A)}x.disabled=!!S.disabled,x.addEventListener("click",()=>{this.close(),S.action()}),p.append(x),g=!1}p.lastElementChild?.classList.contains("fg-cm-sep")&&p.lastElementChild.remove(),re(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`;let f=Math.max(4,Math.min(t,window.innerHeight-w-4));p.style.top=`${f}px`,p.style.maxHeight=`${Math.max(120,window.innerHeight-f-8)}px`,this.popup=p;let m=S=>{de(S,p)||this.close()},b=S=>{if(S.key==="Escape"){this.close(),s.renderer.gridEl.focus();return}if(S.key!=="ArrowDown"&&S.key!=="ArrowUp")return;let x=[...p.querySelectorAll("button:not(:disabled)")],R=x.indexOf(qt(p));x[(R+(S.key==="ArrowDown"?1:x.length-1)+x.length)%x.length]?.focus(),S.preventDefault()},C=()=>this.close();document.addEventListener("pointerdown",m,!0),document.addEventListener("keydown",b,!0),s.renderer.scroller.addEventListener("scroll",C,{passive:!0}),this.off.push(()=>document.removeEventListener("pointerdown",m,!0),()=>document.removeEventListener("keydown",b,!0),()=>s.renderer.scroller.removeEventListener("scroll",C)),p.querySelector("button:not(:disabled)")?.focus()}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var Zt=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(ht(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,h=c.index>t.c2?c.index-t.c2:c.index<t.c1?c.index-t.c1:0;!u&&!h?r=null:Math.abs(u)>=Math.abs(h)?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=v("div","fg-fill-handle",{"aria-hidden":"true"}),this.preview=v("div","fg-fill-preview",{"aria-hidden":"true"}),this.handle.addEventListener("pointerdown",this.onDown)}enabled(){return this.grid.options.fillHandle!==!1&&this.grid.rangesOn()}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 Qt=1e4,en=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 t=this.grid.rowModel.rows(),n=this.scanner();for(let r=0;r<t.length&&this.matches.length<Qt;r++)n(r,this.matches);this.matches.length=Math.min(this.matches.length,Qt),this.reindex(),this.matches.length&&this.go(0)}return this.updateCount(),this.grid.renderer.invalidate({rows:!0}),this.matches.length}scanner(){let{grid:e}=this,t=e.store.state.locale.code,n=e.columns.displayed().filter(i=>!$(i.id)),r=n.map(i=>Q(i.def,t)),s=e.rowModel.rows();return(i,a)=>{let l=s[i];if(!(!l||l.kind))for(let d=0;d<n.length;d++)r[d](G(n[d].def,l.data)).toLowerCase().includes(this.query)&&a.push({rowIndex:i,colId:n[d].id})}}reindex(){this.lookup.clear(),this.matches.forEach((e,t)=>this.lookup.set(`${e.rowIndex}|${e.colId}`,t))}refreshRows(e){if(!this.query)return;if(this.matches.length>=Qt)return this.refresh();let{rowModel:t}=this.grid,n=new Set;for(let p of e){let g=t.indexOfId(p);g>=0&&n.add(g)}if(!n.size)return;let r=this.matches[this.index],s=this.scanner(),i=[];for(let p of n)s(p,i);let a=this.matches.length,l=this.matches.filter(p=>n.has(p.rowIndex)),d=p=>p.map(g=>`${g.rowIndex}|${g.colId}`).sort().join(",");if(d(l)===d(i))return;let c=new Map(this.grid.columns.displayed().map((p,g)=>[p.id,g]));this.matches=[...this.matches.filter(p=>!n.has(p.rowIndex)),...i].sort((p,g)=>p.rowIndex-g.rowIndex||(c.get(p.colId)??0)-(c.get(g.colId)??0)).slice(0,Qt),this.reindex();let u=r?this.lookup.get(`${r.rowIndex}|${r.colId}`):void 0,h=this.index;u!==void 0?this.index=u:this.matches.length?this.index=Math.min(Math.max(this.index,0),this.matches.length-1):this.index=-1,(a!==this.matches.length||h!==this.index||u===void 0)&&this.updateCount(),this.grid.renderer.invalidate({rows:!0})}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||!this.grid.paid)return;if(this.bar){this.bar.querySelector("input").focus();return}let e=this.grid.store.state.locale,t=v("div","fg-findbar",{role:"search"}),n=v("input","fg-input",{type:"search",placeholder:e.findPlaceholder,"aria-label":e.findPlaceholder});this.countEl=v("span","fg-findbar-count",{"aria-live":"polite"});let r=(u,h,p)=>{let g=v("button","fg-findbar-btn",{type:"button","aria-label":u,title:u});return g.textContent=h,g.addEventListener("click",p),g};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",u=>{u.stopPropagation(),u.key==="Escape"?(u.preventDefault(),this.closeBar()):u.key==="Enter"&&(u.preventDefault(),u.shiftKey?this.previous():this.next())});let{root:s,headerEl:i,main:a}=this.grid.renderer;s.append(t);let l=s.getBoundingClientRect(),d=i.getBoundingClientRect(),c=a.getBoundingClientRect();d.height&&(t.style.top=`${Math.round(d.bottom-l.top)+6}px`),c.width&&(t.style.right=`${Math.max(0,Math.round(l.right-c.right))+18}px`),this.bar=t,n.focus()}relabel(){if(!this.bar)return;let e=this.grid.store.state.locale,t=this.bar.querySelector("input");t.placeholder=e.findPlaceholder,t.setAttribute("aria-label",e.findPlaceholder);let n=[e.findPrevious,e.findNext,e.close];this.bar.querySelectorAll(".fg-findbar-btn").forEach((r,s)=>{r.setAttribute("aria-label",n[s]),r.title=n[s]}),this.updateCount()}closeBar(){this.bar?.remove(),this.bar=null,this.countEl=null,this.clear(),this.grid.renderer.gridEl.focus({preventScroll:!0})}};var ji=864e5;function gt(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)?fe(s):null);if(n.every(Boolean)&&o.length>=2){let s=n.map(a=>Math.round(a.getTime()/ji)),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:ie(u)})}return t()}let r=o[o.length-1];if(typeof r=="string"&&!V(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 oo(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 Br(o){return ro(o," ")}function ro(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 tn(o,e,t){if(V(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 ie(e)??String(e);case"boolean":return e===!0?"TRUE":e===!1?"FALSE":String(e);default:return Q(o,t)(e)}}var Ui=new Set(["true","1","y","yes","\uC608","o","on"]),Ki=new Set(["false","0","n","no","\uC544\uB2C8\uC624","x","off"]);function _i(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),Number.isFinite(r)?{ok:!0,value:Math.abs(r)<1e15?Math.round(r*1e12)/1e12:r}:{ok:!1}}function Or(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 Xi(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=Or(+r[1],+r[2],+r[3]):(r=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(t))?n=Or(+r[3],+r[1],+r[2]):/^\d{4}-\d{2}-\d{2}T/.test(t)&&(n=fe(t)),n?{ok:!0,value:e instanceof Date?n:ie(n)}:{ok:!1}}function nn(o,e,t){switch(o.type){case"number":return _i(e);case"date":return Xi(e,t);case"boolean":{let n=e.trim().toLowerCase();return n?Ui.has(n)?{ok:!0,value:!0}:Ki.has(n)?{ok:!0,value:!1}:{ok:!1}:{ok:!0,value:null}}default:return{ok:!0,value:e}}}var Ji=o=>o.map(e=>e!==null&&typeof e=="object"&&"value"in e?e:{value:e,label:String(e),disabled:!1}),Ne=o=>String(o).padStart(2,"0");function Yi(o){let e=o instanceof Date?o:typeof o=="string"&&o?new Date(o):null;return!e||Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Ne(e.getMonth()+1)}-${Ne(e.getDate())}T${Ne(e.getHours())}:${Ne(e.getMinutes())}`}function Zi(o){if(o instanceof Date)return`${Ne(o.getHours())}:${Ne(o.getMinutes())}`;let e=typeof o=="string"?/(\d{1,2}):(\d{2})/.exec(o):null;return e?`${Ne(Number(e[1]))}:${e[2]}`:""}var on=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&&this.grid.cellEditable(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=v("div","fg-editor");this.place(c,e,t);let u,h,p=()=>{},g=a.editor;if(typeof g=="function"){let b=g({value:d,row:l,column:a,initialText:n});u=b.el,h=()=>({value:b.getValue()}),p=()=>b.destroy?.(),c.append(u),queueMicrotask(()=>b.focus?.())}else if(g?.type==="select"){let b=Ji(typeof g.options=="function"?g.options(l):g.options),C=v("select","fg-editor-control");b.forEach((S,x)=>{let R=v("option");R.value=String(x),R.textContent=S.label??String(S.value),R.disabled=!!S.disabled,C.append(R)}),C.selectedIndex=Math.max(0,b.findIndex(S=>Object.is(S.value,d))),u=C,h=()=>({value:b[C.selectedIndex]?.value??null}),c.append(C)}else if(g?.type==="time"||g?.type==="datetime"||!g&&a.type==="date"&&a.format==="datetime"){let b=g?.type==="time",C=v("input","fg-editor-control",{type:b?"time":"datetime-local"});C.value=b?Zi(d):Yi(d),u=C,h=()=>C.value?b?{value:C.value}:{value:d instanceof Date?new Date(C.value):C.value}:{value:null},c.append(C)}else{let C=g?.type==="textarea"?v("textarea","fg-editor-control"):v("input","fg-editor-control");C instanceof HTMLInputElement&&(C.type=a.type==="date"&&n===void 0?"date":"text",a.type==="number"&&(C.inputMode="decimal"));let S=a.type==="date"?ie(d)??"":V(d)?"":String(d);C.value=n??S,u=C,h=()=>({text:C.value}),c.append(C)}u.setAttribute("aria-label",a.header??a.field??t);let y=v("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"))},f=b=>{this.cur?.wrap===c&&!c.contains(b.relatedTarget)&&this.commit(null)},m=()=>this.commit(null);return c.addEventListener("keydown",w),c.addEventListener("focusout",f),s.scroller.addEventListener("scroll",m,{passive:!0}),s.root.append(c),this.cur={rowIndex:e,colId:t,row:l,def:a,wrap:c,read:h,dispose:()=>{c.removeEventListener("keydown",w),c.removeEventListener("focusout",f),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&&De(a.text.trim()))l=a.text.trim();else if("text"in a){let u=nn(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;for(d>=i.length&&(d=0,this.session||l++),d<0&&(d=i.length-1,this.session||l--);l!==e&&l>=0&&l<s&&r.rowModel.getRow(l)?.kind;)l+=a;l<0||l>=s||this.start(l,i[d].id)}};var rn=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 Hr=(o,e)=>o instanceof Date&&e instanceof Date?o.getTime()===e.getTime():Object.is(o,e),sn=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&&!Hr(n[t],e[t])}diff(e,t){let n=this.originals.get(e);return n?t.filter(r=>!Hr(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 mt(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 Gr(o,e,t){return e>=o.r1&&e<=o.r2&&t>=o.c1&&t<=o.c2}var Qi=5;function zr(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 ea(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"),zr(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 ta(o,e){let t=o.columns.getNode(e);return!!o.groupPanel&&!!t&&!t.children&&!o.options.treeData&&!o.getGroupBy().includes(e)}function na(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=v("div",`fg-drag-ghost fg-theme-${o.store.state.theme}`);i.textContent=t.querySelector(".fg-header-label")?.textContent??"",o.applyFontTo(i),re(o.renderer.root).append(i);let a=v("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 oa(o,e,t,n,r){t.ghost.style.transform=`translate(${n+12}px, ${r+8}px)`,t.overPanel=ta(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 ra(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 sa(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;zr(l=>{if(!a){if(Math.abs(l.clientX-i)<Qi)return;a=na(o,t,n,s)}oa(o,t,a,l.clientX,l.clientY)},l=>{a?ra(o,t,a):!r.children&&Ie(r.def)&&o.toggleSort(t,l.shiftKey||l.ctrlKey||l.metaKey)})}function Vr(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")?ea(o,r,a):sa(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 ln={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]},wt=96/25.4,qr=72/25.4,ia="system-ui, 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans CJK KR', sans-serif",aa=10.5,Be=15,dn=7,Je=4,an=8;function la(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 cn={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=>la(t.toDataURL("image/jpeg",r).split(",")[1]??"")}:null}},He=(o,e=aa)=>`${o} ${e}px ${ia}`;function jr(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>=an)break}if(n.push(s.trimEnd()),n.length>=an)break}return n.length>an&&(n.length=an),n}function da(o){let[e,t]=ln[o.paper]??ln.A4,[n,r]=o.orientation==="landscape"?[t,e]:[e,t],s=n*wt,i=r*wt,a=12*wt,l=14*wt,d=s-a*2,c=o.numbered?40:0,u=o.widths.slice(o.numbered?1:0),h=u.reduce((f,m)=>f+m,0)||1,p=o.fit?(d-c)/h:Math.min(1,(d-c)/h),g=[...o.numbered?[c]:[],...u.map(f=>f*p)],y=[],w=a;for(let f of g)y.push(w),w+=f;return{pageW:s,pageH:i,margin:a,marginBottom:l,colX:y,colW:g}}function Wr(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=He(n==="group"?600:n==="total"||l.bold?700:400);let h=(l.indent??0)*14,p=jr(o,l.text,Math.max(8,u-dn*2-h-(l.icon?14:0)));a=Math.max(a,p.length*Be+Je*2),s.cells.push({cell:l,x:c,w:u,y:0,h:0,lines:p})}return s.h=a,s}function ca(o,e,t){let n=t.map(()=>({cells:[],kind:"head",y:0,h:22})),r=t.map(()=>e.colW.map(()=>!1)),s=[];o.font=He(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 h=0;for(let g=l;g<l+c&&g<e.colW.length;g++)h+=e.colW[g];let p=jr(o,d.text,Math.max(8,h-dn*2));s.push({cell:d,r:a,col:l,span:c,rs:u,lines:p,x:e.colX[l]??e.margin,w:h}),l+=c}});for(let i of s){let l=(i.lines.length*Be+Je*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 Ur(o){return!o.title&&!o.subtitle&&!o.printed?0:(o.title?24:12)+(o.subtitle?17:0)+18}function ua(o,e){let t=da(e),n=ca(o,t,e.head),r=0,s=e.body.map(y=>{let w=Wr(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=>Wr(o,t,y.cells,y.kind,y.level)),d=t.pageH-t.marginBottom,c=Ur(e),u=[],h=[...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},f=t.margin+(w.title?c:0),m=C=>{let S=p(C);S.y=f;for(let x of S.cells)x.y=f,S.kind!=="head"&&(x.h=S.h);w.rows.push(S),f+=S.h};(y||e.repeatHeader)&&n.forEach(m),i.forEach(m);let b=f;for(;g<h.length;){let C=h[g],S=C.kind==="group"&&g+1<h.length?C.h+h[g+1].h:C.h;if(f+S>d&&f>b)break;m(C),g++}u.push(w)}while(g<h.length&&u.length<5e3);return{pages:u,g:t}}function Oe(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 fa(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 ":""}${He(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*Be,u=e.kind==="head"?i.y+i.h-Je-c+Be/2:i.y+Je+Be/2;e.kind!=="head"&&i.h>c+Je*2&&(u=i.y+Je+Be/2);for(let[h,p]of i.lines.entries()){let g=i.x+dn+d,y=o.measureText(p).width+(i.cell.icon&&h===0?14:0),w=i.cell.group?"center":i.cell.align;if(w==="right"?g=i.x+i.w-dn-y:w==="center"&&(g=i.x+(i.w-y)/2),o.textAlign="left",i.cell.icon&&h===0){let f=o.fillStyle;o.fillStyle=i.cell.icon.color,o.fillText(i.cell.icon.char,g,u),o.fillStyle=f,g+=14}o.fillText(p,g,u),i.cell.strike&&Oe(o,g,u,g+o.measureText(p).width,u,String(o.fillStyle),1),u+=Be}o.restore(),e.kind==="head"&&i.x>n.margin+.5&&Oe(o,i.x,i.y,i.x,i.y+i.h,"#e5e7eb",1),e.kind==="head"&&Oe(o,i.x,i.y+i.h,i.x+i.w,i.y+i.h,"#9ca3af",1.5)}e.kind==="group"&&Oe(o,n.margin,e.y,r,e.y,"#cbd5e1",1),e.kind==="total"?Oe(o,n.margin,e.y,r,e.y,"#111827",1.5):e.kind!=="head"&&Oe(o,n.margin,e.y+e.h,r,e.y+e.h,"#e5e7eb",1)}function pa(o,e,t){let n=Ur(e);if(!n)return;let r=t.pageW-t.margin,s=t.margin;if(o.textAlign="left",o.textBaseline="top",e.title&&(o.font=He(700,17),o.fillStyle="#111827",o.fillText(e.title,t.margin,s),s+=24),e.subtitle&&(o.font=He(400,11),o.fillStyle="#4b5563",o.fillText(e.subtitle,t.margin,s),s+=17),e.printed){o.font=He(400,9.5),o.fillStyle="#6b7280";let i=o.measureText(e.printed).width;o.fillText(e.printed,r-i,t.margin+n-18-13)}Oe(o,t.margin,t.margin+n-10,r,t.margin+n-10,"#111827",2)}function ha(o,e,t,n,r){let s=t.pageH-7*wt;if(o.font=He(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 so(o,e=cn,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}=ua(s.ctx,o),l=Math.round(a.pageW*n),d=Math.round(a.pageH*n),c=[];i.forEach((y,w)=>{let f=e.surface(l,d);if(!f)return;let m=f.ctx;m.setTransform(n,0,0,n,0,0),m.fillStyle="#ffffff",m.fillRect(0,0,a.pageW,a.pageH),y.title&&pa(m,o,a);for(let b of y.rows)fa(m,b,o,a);ha(m,o,a,w,i.length),c.push(f.jpeg(r))});let[u,h]=ln[o.paper]??ln.A4,[p,g]=o.orientation==="landscape"?[h,u]:[u,h];return ma(c.map(y=>({jpeg:y,width:l,height:d})),p*qr,g*qr,o.title)}function ga(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 ma(o,e,t,n=""){let r=new TextEncoder,s=[],i=[],a=0,l=b=>{let C=typeof b=="string"?r.encode(b):b;s.push(C),a+=C.length},d=(b,C)=>{i[b]=a,l(`${b} 0 obj
1
+ var Ui={code:"en",noRows:"No rows to show",filter:"Filter",apply:"Apply",reset:"Reset",selectAll:"(Select all)",setSelected:"({n} selected)",noAggregate:"No aggregate",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",printLimited:"Printed the first {n} of {total} rows. Export to Excel or CSV for all of them.",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",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",align:"Align",aligns:{none:"Default",left:"Left",center:"Center",right:"Right"},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"}},ae=Ui;var Bo=new Set;function O(o){Bo.has(o)||(Bo.add(o),console.warn(`[FreeGrid] ${o}`))}var Fe=new Map([["en",ae]]);function In(o){Fe.set(o.code,o)}function Ho(o){let e=o.toLowerCase();for(let n of Fe.keys())if(n.toLowerCase()===e)return n;let t=e.split("-")[0];if(t==="zh"){if(/-(tw|hk|mo|hant)(-|$)/.test(e)&&Fe.has("zh-TW"))return"zh-TW";if(Fe.has("zh-CN"))return"zh-CN"}for(let n of Fe.keys())if(n.toLowerCase().split("-")[0]===t)return n}function Ki(){return typeof navigator>"u"?[]:navigator.languages?.length?navigator.languages:navigator.language?[navigator.language]:[]}function _i(o){return{...ae,...o,code:o.code??"en",ops:{...ae.ops,...o.ops??{}}}}function At(o,e=Ki()){if(o&&typeof o=="object")return _i(o);if(typeof o=="string"){let t=Ho(o);return t?Fe.get(t):(O(`locale "${o}" is not registered \u2014 import it from "@freegridjs/core/locales/${o}" and pass the pack (or call registerLocale). Falling back to "en".`),ae)}for(let t of e){let n=Ho(t);if(n)return Fe.get(n)}return ae}var Xi={code:"de",noRows:"Keine Zeilen vorhanden",filter:"Filter",apply:"Anwenden",reset:"Zur\xFCcksetzen",selectAll:"(Alle ausw\xE4hlen)",setSelected:"({n} ausgew\xE4hlt)",noAggregate:"Keine Aggregation",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",printLimited:"Die ersten {n} von {total} Zeilen wurden gedruckt. F\xFCr alle Zeilen nach Excel oder CSV exportieren.",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",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",align:"Ausrichtung",aligns:{none:"Standard",left:"Links",center:"Zentriert",right:"Rechts"},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"}},Go=Xi;var Ji={code:"es",noRows:"No hay filas para mostrar",filter:"Filtro",apply:"Aplicar",reset:"Restablecer",selectAll:"(Seleccionar todo)",setSelected:"({n} seleccionados)",noAggregate:"Sin agregaci\xF3n",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",printLimited:"Se imprimieron las primeras {n} de {total} filas. Exporte a Excel o CSV para obtenerlas todas.",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",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",align:"Alineaci\xF3n",aligns:{none:"Predeterminada",left:"Izquierda",center:"Centro",right:"Derecha"},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"}},zo=Ji;var Yi={code:"fr",noRows:"Aucune ligne \xE0 afficher",filter:"Filtre",apply:"Appliquer",reset:"R\xE9initialiser",selectAll:"(Tout s\xE9lectionner)",setSelected:"({n} s\xE9lectionn\xE9s)",noAggregate:"Aucune agr\xE9gation",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",printLimited:"Les {n} premi\xE8res lignes sur {total} ont \xE9t\xE9 imprim\xE9es. Exportez vers Excel ou CSV pour toutes les avoir.",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",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",align:"Alignement",aligns:{none:"Par d\xE9faut",left:"Gauche",center:"Centre",right:"Droite"},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"}},Vo=Yi;var Zi={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)",setSelected:"({n} \u4EF6\u9078\u629E)",noAggregate:"\u96C6\u8A08\u3057\u306A\u3044",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",printLimited:"\u5168 {total} \u884C\u306E\u3046\u3061\u6700\u521D\u306E {n} \u884C\u306E\u307F\u5370\u5237\u3057\u307E\u3057\u305F\u3002\u3059\u3079\u3066\u306E\u884C\u306F Excel \u307E\u305F\u306F CSV \u306B\u66F8\u304D\u51FA\u3057\u3066\u304F\u3060\u3055\u3044\u3002",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",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",align:"\u914D\u7F6E",aligns:{none:"\u65E2\u5B9A",left:"\u5DE6\u63C3\u3048",center:"\u4E2D\u592E\u63C3\u3048",right:"\u53F3\u63C3\u3048"},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"}},qo=Zi;var Qi={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)",setSelected:"({n}\uAC1C \uC120\uD0DD\uB428)",noAggregate:"\uC9D1\uACC4 \uC548 \uD568",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",printLimited:"\uC804\uCCB4 {total}\uD589 \uC911 \uCC98\uC74C {n}\uD589\uB9CC \uC778\uC1C4\uD588\uC2B5\uB2C8\uB2E4. \uC804\uCCB4\uB294 \uC5D1\uC140\uC774\uB098 CSV\uB85C \uB0B4\uBCF4\uB0B4\uC138\uC694.",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",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",align:"\uC815\uB82C",aligns:{none:"\uAE30\uBCF8",left:"\uC67C\uCABD",center:"\uAC00\uC6B4\uB370",right:"\uC624\uB978\uCABD"},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"}},Wo=Qi;var es={code:"zh-CN",noRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u6570\u636E",filter:"\u7B5B\u9009",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",selectAll:"(\u5168\u9009)",setSelected:"(\u5DF2\u9009 {n} \u9879)",noAggregate:"\u4E0D\u6C47\u603B",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",printLimited:"\u4EC5\u6253\u5370\u4E86 {total} \u884C\u4E2D\u7684\u524D {n} \u884C\u3002\u5982\u9700\u5168\u90E8\uFF0C\u8BF7\u5BFC\u51FA\u4E3A Excel \u6216 CSV\u3002",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",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",align:"\u5BF9\u9F50",aligns:{none:"\u9ED8\u8BA4",left:"\u5DE6\u5BF9\u9F50",center:"\u5C45\u4E2D",right:"\u53F3\u5BF9\u9F50"},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"}},jo=es;var ts={code:"zh-TW",noRows:"\u6C92\u6709\u53EF\u986F\u793A\u7684\u8CC7\u6599",filter:"\u7BE9\u9078",apply:"\u5957\u7528",reset:"\u91CD\u8A2D",selectAll:"(\u5168\u9078)",setSelected:"(\u5DF2\u9078 {n} \u9805)",noAggregate:"\u4E0D\u5F59\u7E3D",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",printLimited:"\u50C5\u5217\u5370\u4E86 {total} \u5217\u4E2D\u7684\u524D {n} \u5217\u3002\u5982\u9700\u5168\u90E8\uFF0C\u8ACB\u532F\u51FA\u70BA Excel \u6216 CSV\u3002",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",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",align:"\u5C0D\u9F4A",aligns:{none:"\u9810\u8A2D",left:"\u9760\u5DE6\u5C0D\u9F4A",center:"\u7F6E\u4E2D",right:"\u9760\u53F3\u5C0D\u9F4A"},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"}},Uo=ts;var ns={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)",setSelected:"(\u0111\xE3 ch\u1ECDn {n})",noAggregate:"Kh\xF4ng t\u1ED5ng h\u1EE3p",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",printLimited:"\u0110\xE3 in {n} h\xE0ng \u0111\u1EA7u ti\xEAn trong t\u1ED5ng s\u1ED1 {total} h\xE0ng. Xu\u1EA5t sang Excel ho\u1EB7c CSV \u0111\u1EC3 c\xF3 t\u1EA5t c\u1EA3.",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",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",align:"C\u0103n l\u1EC1",aligns:{none:"M\u1EB7c \u0111\u1ECBnh",left:"Tr\xE1i",center:"Gi\u1EEFa",right:"Ph\u1EA3i"},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"}},Ko=ns;var os={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)",setSelected:"(\u0E40\u0E25\u0E37\u0E2D\u0E01 {n} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23)",noAggregate:"\u0E44\u0E21\u0E48\u0E23\u0E27\u0E21\u0E04\u0E48\u0E32",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",printLimited:"\u0E1E\u0E34\u0E21\u0E1E\u0E4C {n} \u0E41\u0E16\u0E27\u0E41\u0E23\u0E01\u0E08\u0E32\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14 {total} \u0E41\u0E16\u0E27 \u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01\u0E40\u0E1B\u0E47\u0E19 Excel \u0E2B\u0E23\u0E37\u0E2D CSV \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E23\u0E31\u0E1A\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",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",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",align:"\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E41\u0E19\u0E27",aligns:{none:"\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",left:"\u0E0B\u0E49\u0E32\u0E22",center:"\u0E01\u0E36\u0E48\u0E07\u0E01\u0E25\u0E32\u0E07",right:"\u0E02\u0E27\u0E32"},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"}},_o=os;var rs={code:"id",noRows:"Tidak ada data",filter:"Filter",apply:"Terapkan",reset:"Atur ulang",selectAll:"(Pilih semua)",setSelected:"({n} dipilih)",noAggregate:"Tanpa agregasi",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",printLimited:"Dicetak {n} baris pertama dari {total}. Ekspor ke Excel atau CSV untuk semua baris.",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",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",align:"Perataan",aligns:{none:"Bawaan",left:"Kiri",center:"Tengah",right:"Kanan"},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=rs;var is={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)",setSelected:"(\u0432\u044B\u0431\u0440\u0430\u043D\u043E: {n})",noAggregate:"\u0411\u0435\u0437 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F",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",printLimited:"\u041D\u0430\u043F\u0435\u0447\u0430\u0442\u0430\u043D\u044B \u043F\u0435\u0440\u0432\u044B\u0435 {n} \u0438\u0437 {total} \u0441\u0442\u0440\u043E\u043A. \u0427\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0432\u0441\u0435, \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0432 Excel \u0438\u043B\u0438 CSV.",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",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",align:"\u0412\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435",aligns:{none:"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",left:"\u041F\u043E \u043B\u0435\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E",center:"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443",right:"\u041F\u043E \u043F\u0440\u0430\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E"},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"}},Jo=is;var ss={code:"pt-BR",noRows:"Nenhuma linha para mostrar",filter:"Filtro",apply:"Aplicar",reset:"Limpar",selectAll:"(Selecionar tudo)",setSelected:"({n} selecionados)",noAggregate:"Sem agrega\xE7\xE3o",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",printLimited:"Foram impressas as primeiras {n} de {total} linhas. Exporte para Excel ou CSV para obter todas.",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",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",align:"Alinhamento",aligns:{none:"Padr\xE3o",left:"Esquerda",center:"Centro",right:"Direita"},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"}},Yo=ss;var as={code:"it",noRows:"Nessuna riga da mostrare",filter:"Filtro",apply:"Applica",reset:"Reimposta",selectAll:"(Seleziona tutto)",setSelected:"({n} selezionati)",noAggregate:"Nessuna aggregazione",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",printLimited:"Stampate le prime {n} di {total} righe. Esporta in Excel o CSV per averle tutte.",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",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",align:"Allineamento",aligns:{none:"Predefinito",left:"Sinistra",center:"Centro",right:"Destra"},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"}},Zo=as;function q(o){return o==null||typeof o=="string"&&o.trim()===""||typeof o=="number"&&Number.isNaN(o)}var Qo=o=>String(o).padStart(2,"0");function se(o){if(q(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()}-${Qo(e.getMonth()+1)}-${Qo(e.getDate())}`}function te(o){return q(o)?"":o instanceof Date?se(o)??"":String(o)}var we=()=>!0;function Tt(o){switch(o.type){case"combined":{let e=(Array.isArray(o.conditions)?o.conditions:[]).map(Tt);return e.length?o.operator==="or"?t=>e.some(n=>n(t)):t=>e.every(n=>n(t)):we}case"text":{let e=(o.value??"").toLowerCase(),t=n=>q(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 q;case"notBlank":return n=>!q(n)}return we}case"number":{let e=n=>q(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 we;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 we;let r=Math.min(t,n),i=Math.max(t,n);return s=>{let a=e(s);return a>=r&&a<=i}}}return we}case"date":{if(o.op==="blank")return n=>se(n)===null;if(o.op==="notBlank")return n=>se(n)!==null;let e=o.value;if(!e)return we;let t=n=>se(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 we;let r=e<n?e:n,i=e<n?n:e;return s=>{let a=t(s);return a!==null&&a>=r&&a<=i}}}return we}case"set":{let e=new Set(o.values.map(te));return t=>e.has(te(t))}}return we}function er(o){let e=o.trim().toLowerCase();return e?e.split(/\s+/):[]}function tr(o,e){return o.every(t=>e.includes(t))}function Dn(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=Dn(r,e,t);a&&n.push(a);continue}let i=e(r.colId);if(!i||!r.model)continue;let s=Tt(r.model);n.push(a=>s(t(i,a)))}return n.length?o.operator==="or"?r=>n.some(i=>i(r)):r=>n.every(i=>i(r)):null}var nr=new Map,or=new Map;function ke(o,e){let t=`${o}|${e??""}`,n=or.get(t);return n||(n=new Intl.NumberFormat(o,e==null?void 0:{maximumFractionDigits:e}),or.set(t,n)),n}function ls(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 Pt={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 he(o){if(q(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 i=ls(e);i||O(`unknown number format "${e}"`),n=i??{}}else e&&(n=e);let r=new Intl.NumberFormat(t,n);return i=>{if(q(i))return"";let s=typeof i=="number"?i:Number(i);return Number.isNaN(s)?String(i):r.format(s)}}case"date":{if(t.toLowerCase().startsWith("ko")&&(e===void 0||e==="date"||e==="datetime")){let i=a=>String(a).padStart(2,"0"),s=e==="datetime";return a=>{let l=he(a);if(!l)return q(a)?"":String(a);let d=`${l.getFullYear()}-${i(l.getMonth()+1)}-${i(l.getDate())}`;return s?`${d} ${i(l.getHours())}:${i(l.getMinutes())}`:d}}let n=Pt.date;typeof e=="string"?(Pt[e]||O(`unknown date format "${e}"`),n=Pt[e]??Pt.date):e&&(n=e);let r=new Intl.DateTimeFormat(t,n);return i=>{let s=he(i);return s?r.format(s):q(i)?"":String(i)}}case"boolean":return n=>n===!0?"\u2713":n===!1?"\u2717":"";default:return n=>q(n)?"":n instanceof Date?n.toISOString():String(n)}}var cs=o=>Array.isArray(o)?o.join(", "):o==null?"":String(o),$n=new WeakMap,Nn=new WeakMap;function rr(){$n=new WeakMap,Nn=new WeakMap}function lt(o,e,t,n=o.format){if(e===o.type&&n===o.format)return Z(o,t);if(n!==o.format&&typeof n!="string")return Z({...o,type:e,format:n},t);let r=Nn.get(o);r||Nn.set(o,r=new Map);let i=`${e??""}|${n===o.format?"":`=${n}`}`,s=r.get(i);return s||r.set(i,s={...o,type:e,format:n}),Z(s,t)}function Z(o,e){if(o.sparkline)return cs;let t=o.format,n=$n.get(o);if(n&&n.locale===e&&n.type===o.type&&n.format===t)return n.fmt;let r=`${e}|${o.type??"text"}|${typeof t=="string"?t:JSON.stringify(t??null)}`,i=nr.get(r);return i||(i=ds(o.type,t,e),nr.set(r,i)),$n.set(o,{locale:e,type:o.type,format:t,fmt:i}),i}var oe="__fg_select__",ir={id:oe,header:"",width:44,minWidth:44,maxWidth:44,pinned:"left",sortable:!1,resizable:!1,filter:!1},Ie="__fg_drag__",sr={id:Ie,header:"",width:28,minWidth:28,maxWidth:28,pinned:"left",sortable:!1,resizable:!1,filter:!1,chooser:!1},Me="__fg_rownum__",ar=(o=52,e="#")=>({id:Me,header:e,width:o,minWidth:o,maxWidth:o,pinned:"left",sortable:!1,resizable:!1,filter:!1,chooser:!1}),N=o=>o===oe||o===Ie||o===Me,us=120,fs=40,hs=["left","center","right"];function de(o){if(N(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 Ft(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 De=o=>o.id!==oe&&o.sortable!==!1,It=o=>o.id!==oe&&o.resizable!==!1;function Se(o,e){let t=o.minWidth??fs,n=o.maxWidth??1/0;return Math.round(Math.min(n,Math.max(t,e)))}function lr(o){return o.children?1+Math.max(0,...o.children.map(lr)):1}var Lt=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.declared=[];this.setDefs(e)}setDefs(e){rr(),this.defs=e,this.byId=new Map;let t=0,n=(i,s,a)=>{let l=Array.isArray(i.children)&&i.children.length>0,d=t++,c=i.id??(l?`g${d}`:i.field);if(c||(c=`c${d}`,O(`column #${d} has neither "field" nor "id"; using "${c}"`)),this.byId.has(c)){let p=1;for(;this.byId.has(`${c}_${p}`);)p++;O(`duplicate column id "${c}"; renamed to "${c}_${p}"`),c=`${c}_${p}`}let u={id:c,def:i,parent:s,children:null,depth:a,width:Se(i,i.width??us),flex:i.flex&&i.flex>0?i.flex:null,hide:i.hide??!1,pinned:i.pinned??s?.pinned??null,open:!!i.openByDefault};return this.byId.set(c,u),l&&(u.children=r(i.children).map(p=>n(p,u,a+1))),u},r=i=>{let s=i.filter(a=>a!==null&&typeof a=="object");return s.length!==i.length&&O("columns contain entries that are not objects; they were skipped"),s};this.roots_=r(e).map(i=>n(i,null,0)),this.declared=this.leafNodes().map(i=>i.id),this.depth=Math.max(1,...this.roots_.map(lr)),this.relayout()}updateDefs(e){let t=new Map(this.byId),n=this.declared,r=this.leafNodes().map(s=>s.id);this.setDefs(e);for(let[s,a]of this.byId){let l=t.get(s);if(!l||!!l.children!=!!a.children)continue;let d=l.def,c=a.def;d.width===c.width&&d.flex===c.flex&&d.minWidth===c.minWidth&&d.maxWidth===c.maxWidth&&(a.width=l.width,a.flex=l.flex),(d.hide??!1)===(c.hide??!1)&&(a.hide=l.hide),d.pinned===c.pinned&&l.parent?.def.pinned===a.parent?.def.pinned&&(a.pinned=l.pinned),!!d.openByDefault==!!c.openByDefault&&(a.open=l.open)}let i=(s,a)=>s.length===a.length&&s.every((l,d)=>l===a[d]);i(n,this.declared)&&!i(r,n)?this.applyState(r.map(s=>({colId:s}))):this.relayout()}setContainerWidth(e){if(e===this.containerWidth)return!1;this.containerWidth=e;let t=()=>this.displayed().map(r=>`${r.width}${r.region}`).join(),n=t();return this.relayout(),n!==t()}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=Se(n.def,t),this.relayout(),n.width)}setPinned(e,t){let n=this.byId.get(e);!n||n.children||N(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(s=>s.id===e);if(r<0)return;let[i]=n.splice(r,1);n.splice(Math.max(0,Math.min(n.length,t)),0,i),this.relayout()}headerCells(e){let t=[],n=new Map;for(let r of this.layout[e]){let i=[];for(let s=r.node.parent;s;s=s.parent)i.unshift(s);for(let s of i){let a=n.get(s.id);if(a){a.width+=r.width;continue}let l={id:s.id,label:s.def.header??"",isGroup:!0,column:null,node:s,row:s.depth,rowSpan:1,left:r.left,width:r.width};n.set(s.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=>!N(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((i,s)=>{t.set(i.colId,s);let a=this.byId.get(i.colId);!a||a.children||N(i.colId)||(typeof i.width=="number"&&Number.isFinite(i.width)&&(a.flex=null,a.width=Se(a.def,i.width)),typeof i.hide=="boolean"&&(a.hide=i.hide),"pinned"in i&&(a.pinned=i.pinned==="left"||i.pinned==="right"?i.pinned:null))}),t.set(Me,-3),t.set(Ie,-2),t.set(oe,-1);let n=i=>i.children?Math.min(1/0,...i.children.map(n)):t.get(i.id)??1/0,r=i=>{let s=i.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),i.splice(0,i.length,...s.map(a=>a.n));for(let a of i)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(p=>!p.hide&&this.shownByGroups(p)),t=e.reduce((p,m)=>p+(m.flex?0:m.width),0),n=new Map,r=e.filter(p=>p.flex),i=Math.max(0,this.containerWidth-t);for(;r.length;){let p=r.reduce((f,h)=>f+h.flex,0),m=f=>Math.floor(i*f.flex/p),g=r.reduce((f,h)=>f+Se(h.def,m(h))-m(h),0),y=r.filter(f=>{let h=Se(f.def,m(f))-m(f);return g>0?h>0:g<0?h<0:!1});if(!y.length){let f=i;for(let h of r){let b=Se(h.def,m(h));n.set(h,b),f-=b}for(let h of r){if(f<1)break;let b=n.get(h);Se(h.def,b+1)===b+1&&(n.set(h,b+1),f--)}break}let w=0;for(let f of y){let h=Se(f.def,m(f));n.set(f,h),w+=h}i=Math.max(0,i-w),r=r.filter(f=>!y.includes(f))}let s=p=>n.get(p)??p.width,a={left:[],center:[],right:[]};this.leafById=new Map;let l=0,d=e.reduce((p,m)=>p+(m.pinned?s(m):0),0),c=this.containerWidth>0&&d>this.containerWidth*.75,u={left:0,center:0,right:0};for(let p of hs){let m=c?"center":p;for(let g of e){if((g.pinned??"center")!==p)continue;let y={id:g.id,def:g.def,node:g,width:s(g),region:m,left:u[m],index:l++};u[m]+=y.width,a[m].push(y),this.leafById.set(g.id,y)}}this.layout=a}};var ce=o=>o.isComposing||o.keyCode===229,On=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Home","End","PageUp","PageDown"]);function Bn(o,e,t,n){let r=s=>Math.max(0,Math.min(n.rows-1,s)),i=s=>Math.max(0,Math.min(n.cols-1,s));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:i(t.colIndex-1)};case"ArrowRight":return{rowIndex:t.rowIndex,colIndex:i(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 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 W=class extends Error{constructor(t){super(t);this.code=t}},ps=/^#(?:[A-Z/0]+[!?]|N\/A)$/,_e=o=>typeof o=="string"&&ps.test(o);function gs(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 W("#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 W("#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 W("#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 W("#ERROR!")}}return e}var le=o=>o==null||o==="";function H(o){if(typeof o=="number")return o;if(typeof o=="boolean")return o?1:0;if(le(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 W("#VALUE!")}var Y=o=>le(o)?"":typeof o=="boolean"?o?"TRUE":"FALSE":o instanceof Date?dt(o):String(o),Ae=o=>typeof o=="boolean"?o:typeof o=="string"&&/^(true|false)$/i.test(o)?o.toLowerCase()==="true":H(o)!==0;function Dt(o,e,t="near"){let n=Math.trunc(e),r=t==="near"?Math.round:t==="up"?Math.ceil:Math.floor,i=(a,l)=>{let[d,c="0"]=String(a).split("e");return+`${d}e${Number(c)+l}`},s=i(r(i(Math.abs(o),n)),-n);return o<0?-s:s}function ct(o,e){let t=n=>typeof n=="number"||typeof n=="boolean"||le(n);return t(o)&&t(e)?H(o)-H(e):o instanceof Date||e instanceof Date?H(ue(o))-H(ue(e)):Y(o).localeCompare(Y(e),void 0,{sensitivity:"accent"})}var Ee=o=>o.flatMap(e=>Array.isArray(e)?e:[e]);var $e=o=>o.flatMap(e=>Array.isArray(e)?mr(e).filter(t=>typeof t=="number"&&Number.isFinite(t)):le(e)?[]:[H(e)]);function mr(o){let e=o.find(_e);if(e!==void 0)throw new W(e);return o}function ue(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 W("#VALUE!")}var Nt=o=>String(o).padStart(2,"0");function dt(o){return`${o.getFullYear()}-${Nt(o.getMonth()+1)}-${Nt(o.getDate())}`}var ms=864e5,dr=o=>Math.round(Date.UTC(o.getFullYear(),o.getMonth(),o.getDate())/ms);function wr(o){if(typeof o!="string")return i=>ct(i,o)===0&&!le(i)==!le(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 i=new RegExp(`^${r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")}$`,"i");return t==="="?s=>i.test(Y(s)):s=>!i.test(Y(s))}return i=>{if(t==="="&&r==="")return le(i);if(t==="<>"&&r==="")return!le(i);if(typeof r=="number"&&typeof i!="number"&&!(typeof i=="string"&&i.trim()!==""&&Number.isFinite(Number(i))))return t==="<>";let s;try{s=ct(i,r)}catch{return!1}return t==="="?s===0:t==="<>"?s!==0:t==="<"?s<0:t===">"?s>0:t==="<="?s<=0:s>=0}}function Te(o){if(Array.isArray(o))return o;throw new W("#VALUE!")}function cr(o,e,t){let n=Te(e),r=wr(t),i=[],s=mr(o.length?Te(o[0]):n);return n.forEach((a,l)=>{let d=s[l];r(a)&&typeof d=="number"&&Number.isFinite(d)&&i.push(d)}),i}var pe={SUM:o=>$e(o).reduce((e,t)=>e+t,0),AVG:o=>{let e=$e(o);if(!e.length)throw new W("#DIV/0!");return e.reduce((t,n)=>t+n,0)/e.length},MIN:o=>{let e=$e(o);return e.length?e.reduce((t,n)=>Math.min(t,n)):0},MAX:o=>{let e=$e(o);return e.length?e.reduce((t,n)=>Math.max(t,n)):0},MEDIAN:o=>{let e=$e(o).sort((n,r)=>n-r);if(!e.length)throw new W("#NUM!");let t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2},COUNT:o=>Ee(o).filter(e=>typeof e=="number"&&Number.isFinite(e)).length,COUNTA:o=>Ee(o).filter(e=>!le(e)).length,COUNTBLANK:o=>Ee(o).filter(le).length,PRODUCT:o=>$e(o).reduce((e,t)=>e*t,1),ROUND:o=>Dt(H(o[0]),o.length>1?H(o[1]):0),ROUNDUP:o=>Dt(H(o[0]),o.length>1?H(o[1]):0,"up"),ROUNDDOWN:o=>Dt(H(o[0]),o.length>1?H(o[1]):0,"down"),INT:o=>Math.floor(H(o[0])),TRUNC:o=>Dt(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 W("#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 W("#NUM!");return Math.log(e)},LOG10:o=>{let e=H(o[0]);if(e<=0)throw new W("#NUM!");return Math.log10(e)},MOD:o=>{let e=H(o[1]);if(e===0)throw new W("#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=>Ee(o).map(Y).join(""),TEXTJOIN:o=>Ee(o.slice(2)).filter(e=>!Ae(o[1])||!le(e)).map(Y).join(Y(o[0])),LEN:o=>Y(o[0]).length,LEFT:o=>Y(o[0]).slice(0,o.length>1?Math.max(0,H(o[1])):1),RIGHT:o=>{let e=Y(o[0]),t=o.length>1?Math.max(0,H(o[1])):1;return t?e.slice(-t):""},MID:o=>Y(o[0]).substr(Math.max(0,H(o[1])-1),Math.max(0,H(o[2]))),UPPER:o=>Y(o[0]).toUpperCase(),LOWER:o=>Y(o[0]).toLowerCase(),PROPER:o=>Y(o[0]).toLowerCase().replace(/(^|[^\p{L}])(\p{L})/gu,(e,t,n)=>t+n.toUpperCase()),TRIM:o=>Y(o[0]).trim().replace(/\s+/g," "),SUBSTITUTE:o=>Y(o[0]).split(Y(o[1])).join(Y(o[2])),REPLACE:o=>{let e=Y(o[0]),t=Math.max(0,H(o[1])-1);return e.slice(0,t)+Y(o[3])+e.slice(t+Math.max(0,H(o[2])))},REPT:o=>Y(o[0]).repeat(Math.max(0,Math.min(1e4,H(o[1])))),FIND:o=>{let e=Y(o[1]).indexOf(Y(o[0]),o.length>2?H(o[2])-1:0);if(e<0)throw new W("#VALUE!");return e+1},SEARCH:o=>{let e=Y(o[1]).toLowerCase().indexOf(Y(o[0]).toLowerCase(),o.length>2?H(o[2])-1:0);if(e<0)throw new W("#VALUE!");return e+1},VALUE:o=>H(Y(o[0]).replace(/,/g,"")),TEXT:o=>{let e=o[0],t=Y(o[1]),n=/0\.(0+)/.exec(t)?.[1].length??0;if(/[yd]/i.test(t)){let s=ue(e);return t.replace(/yyyy/gi,String(s.getFullYear())).replace(/mm/g,Nt(s.getMonth()+1)).replace(/dd/gi,Nt(s.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=>Ee(o).every(Ae),OR:o=>Ee(o).some(Ae),XOR:o=>Ee(o).filter(Ae).length%2===1,NOT:o=>!Ae(o[0]),ISBLANK:o=>le(o[0]),ISNUMBER:o=>typeof o[0]=="number"&&Number.isFinite(o[0]),ISTEXT:o=>typeof o[0]=="string"&&!_e(o[0]),ISERROR:o=>_e(o[0]),TODAY:()=>dt(new Date),NOW:()=>new Date,DATE:o=>dt(new Date(H(o[0]),H(o[1])-1,H(o[2]))),YEAR:o=>ue(o[0]).getFullYear(),MONTH:o=>ue(o[0]).getMonth()+1,DAY:o=>ue(o[0]).getDate(),WEEKDAY:o=>ue(o[0]).getDay()+1,DAYS:o=>dr(ue(o[0]))-dr(ue(o[1])),EDATE:o=>{let e=ue(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())),dt(n)},EOMONTH:o=>{let e=ue(o[0]);return dt(new Date(e.getFullYear(),e.getMonth()+H(o[1])+1,0))},SUMIF:o=>cr(o.slice(2),Te(o[0]),o[1]).reduce((e,t)=>e+t,0),COUNTIF:o=>{let e=wr(o[1]);return Te(o[0]).filter(e).length},AVERAGEIF:o=>{let e=cr(o.slice(2),Te(o[0]),o[1]);if(!e.length)throw new W("#DIV/0!");return e.reduce((t,n)=>t+n,0)/e.length},LOOKUP:o=>{let e=Te(o[1]),t=o.length>2?Te(o[2]):e,n=e.findIndex(r=>{try{return ct(r,o[0])===0}catch{return!1}});if(n<0){if(o.length>3)return o[3];throw new W("#N/A")}return t[n]},RANK:o=>{let e=H(o[0]),t=$e([Te(o[1])]),n=o.length>2&&Ae(o[2]);return 1+t.filter(r=>n?r<e:r>e).length}};pe.AVERAGE=pe.AVG;pe.XLOOKUP=pe.LOOKUP;pe.CONCATENATE=pe.CONCAT;var Ot=new Map;function ws(o,e){typeof o!="string"||!/^[A-Za-z_][\w.]*$/.test(o)||typeof e!="function"||(Ot.set(o.toUpperCase(),e),Ue.clear())}function ys(){return[...new Set([...Object.keys(pe),...bs,...vs,...Ot.keys()])].sort()}var bs=["IF","IFS","IFERROR","IFNA","SWITCH","CHOOSE"],vs=["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 W("#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 W("#ERROR!");if(e.t==="num"||e.t==="str")return{k:"lit",v:e.v};if(e.t==="op"){if(e.v!=="(")throw new W("#ERROR!");let n=this.comparison();if(!this.take(")"))throw new W("#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 W("#ERROR!")}let r=t.toUpperCase();if((r==="COL"||r==="PREV"||r==="NEXT")&&(!n.length||n[0].k!=="ref"))throw new W("#ERROR!");let i=r!=="PREV"&&r!=="NEXT"&&r!=="ROW"&&n.every(s=>$t(s,r==="COL"));return{k:"call",name:r,args:n,rowFree:i}}return/^(true|false)$/i.test(t)?{k:"lit",v:t.toLowerCase()==="true"}:{k:"ref",name:t}}};function $t(o,e=!1){return o.k==="lit"?!0:o.k==="ref"?e:o.k==="un"?$t(o.a):o.k==="bin"?$t(o.a)&&$t(o.b):o.rowFree}var Ue=new Map,xs=2e3;function Cs(o){let e=Ue.get(o);if(!e){try{e=new Hn(gs(o.slice(1))).parse()}catch(t){e=t instanceof W?t:new W("#ERROR!")}Ue.size>=xs&&Ue.delete(Ue.keys().next().value),Ue.set(o,e)}if(e instanceof W)throw e;return e}var ur=new WeakMap;function Pe(o){let e=o.rows(),t=o.version(),n=ur.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},ur.set(o,n)),n}var Gn=new WeakMap;function yr(o,e){for(let t of o)t&&typeof t=="object"&&Gn.set(t,e)}var br=32;function zn(o,e){let{row:t,scope:n}=o;if(t&&Object.hasOwn(t,e)){let i=t[e];return typeof i=="string"&&i.startsWith("=")&&i.length>1?fr(o,e,i):i}let r=n?.computed(e);if(r!==void 0)return fr(o,e,r);throw new W("#REF!")}function fr(o,e,t){if(o.seen.has(e)||o.depth>=br)throw new W("#CYCLE!");let n;if(o.memo.has(e))n=o.memo.get(e);else{let r=o.scope?Pe(o.scope).values.get(o.row):void 0;r?.has(e)?n=r.get(e):(n=Bt(t,{...o,seen:new Set([...o.seen,e]),depth:o.depth+1}),o.memo.set(e,n))}if(_e(n))throw new W(n);return n}function Rs(o,e,t){let n=o.scope;if(!n)throw new W("#REF!");let r=Pe(n);if(e<0||e>=r.data.length)return null;let i=r.data[e],s=r.filled.get(t)??-1;if(e>s+1&&e-s>1)for(let l=s+1;l<e;l++)ut(n,r,r.data[l],t);let a=ut(n,r,i,t);if(e>(r.filled.get(t)??-1)&&r.filled.set(t,e),_e(a))throw new W(a);return a}function ut(o,e,t,n){let r=e.values.get(t);if(r?.has(n))return r.get(n);let i;try{i=zn({row:t,scope:o,seen:new Set,depth:0,memo:new Map},n)}catch(s){i=s instanceof W?s.code:"#ERROR!"}return r||e.values.set(t,r=new Map),r.set(n,i),i}function hr(o){if(!o.scope)throw new W("#REF!");let e=Pe(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 W("#REF!");return t}function ks(o,e){if(!o.scope)throw new W("#REF!");let t=o.scope,n=Pe(t),r=n.cols.get(e);if(r||(n.cols.set(e,pr),r=n.data.map(i=>ut(t,n,i,e)),n.cols.set(e,r)),r===pr)throw new W("#CYCLE!");return r}var pr=[];function Ke(o,e){switch(o.k){case"lit":return o.v;case"ref":return zn(e,o.name);case"un":return o.op==="-"?-H(Ke(o.a,e)):H(Ke(o.a,e));case"bin":{let t=Ke(o.a,e),n=Ke(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 W("#DIV/0!");return o.op==="/"?H(t)/r:H(t)%r}case"^":return H(t)**H(n);case"&":return Y(t)+Y(n);default:{let r=ct(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=Pe(e.scope);if(t.rowFree.has(o)){let n=t.rowFree.get(o);if(n instanceof W)throw n;return n}try{let n=gr(o,e);return t.rowFree.set(o,n),n}catch(n){throw n instanceof W&&t.rowFree.set(o,n),n}}return gr(o,e)}}}function gr(o,e){let{name:t,args:n}=o,r=a=>Ke(n[a],e);switch(t){case"IF":{if(n.length<2)throw new W("#ERROR!");return Ae(r(0))?r(1):n.length>2?r(2):!1}case"IFS":for(let a=0;a+1<n.length;a+=2)if(Ae(r(a)))return r(a+1);throw new W("#N/A");case"IFERROR":case"IFNA":try{let a=r(0);return _e(a)&&(t==="IFERROR"||a==="#N/A")?n.length>1?r(1):"":a}catch(a){if(!(a instanceof W)||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(ct(a,r(l))===0)return r(l+1);if(n.length%2===0)return r(n.length-1);throw new W("#N/A")}case"CHOOSE":{let a=Math.trunc(H(r(0)));if(a<1||a>=n.length)throw new W("#VALUE!");return r(a)}case"COL":return ks(e,n[0].name);case"ROW":return hr(e)+1;case"PREV":case"NEXT":{let a=n.length>1?Math.trunc(H(r(1))):1,l=hr(e)+(t==="PREV"?-a:a),d=n[0].name;if(t==="NEXT"&&e.depth>=br)throw new W("#CYCLE!");return t==="PREV"?Rs(e,l,d):Ss(e,l,d)}}let i=(Object.hasOwn(pe,t)?pe[t]:void 0)??Ot.get(t);if(!i)throw new W("#NAME?");let s=n.map((a,l)=>r(l));if(Ot.has(t)&&!Object.hasOwn(pe,t))try{return i(s)}catch(a){throw a instanceof W?a:new W("#VALUE!")}return i(s)}function Ss(o,e,t){let n=o.scope?Pe(o.scope):null;if(!n)throw new W("#REF!");return e<0||e>=n.data.length?null:zn({...o,row:n.data[e],seen:new Set,depth:o.depth+1,memo:new Map},t)}function Bt(o,e){try{let t=Ke(Cs(o),e);return typeof t=="number"&&!Number.isFinite(t)?"#NUM!":Array.isArray(t)?"#VALUE!":t}catch(t){return t instanceof RangeError?"#CYCLE!":t instanceof W?t.code:"#ERROR!"}}function Vn(o,e,t=new Set,n=0,r=new Map,i=null){return Bt(o,{row:e,scope:i,seen:t,depth:n,memo:r})}function qn(o,e){let t=Gn.get(o)??null,n=o.id??o.field;if(o.formula){if(t&&n){let r=Pe(t);return ut(t,r,e,n)}return Bt(o.formula,{row:e,scope:t,seen:new Set(n?[n]:[]),depth:0,memo:new Map})}return t?ut(t,Pe(t),e,o.field):Bt(e[o.field],{row:e,scope:t,seen:new Set([o.field]),depth:0,memo:new Map})}var Wn=o=>!!Gn.get(o)?.off?.(),Ne=o=>typeof o=="string"&&o.length>1&&o.startsWith("=");function G(o,e){if(o.valueGetter)try{return o.valueGetter(e)}catch{O(`valueGetter of column "${o.id??o.field}" threw; rendering an empty cell`);return}if(typeof o.formula=="string"&&Ne(o.formula)&&!Wn(o))return qn(o,e);if(o.field==null)return;let t=e[o.field];return o.formulas&&Ne(t)&&!Wn(o)?qn(o,e):t}var ft=["left","center","right"],vr=[[">=","gte"],["<=","lte"],["<>","ne"],["!=","ne"],[">","gt"],["<","lt"],["=","eq"]],xr=[[">","after"],["<","before"],["=","equals"]],Ms=/^(.+?)\s*(?:~|\.\.)\s*(.+)$/,Ht="~many",jn=o=>{let e=Number(o.replace(/[,\s₩$€¥]/g,""));return o.trim()!==""&&Number.isFinite(e)?e:null},Un=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 Es(o,e){let t=e.trim();if(!t)return null;if(o==="text")return{type:"text",op:"contains",value:t};let n=Ms.exec(t);if(o==="number"){if(n){let l=jn(n[1]),d=jn(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=vr.find(([l])=>t.startsWith(l)),a=jn(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=Un(n[1]),a=Un(n[2]);return!s||!a?void 0:{type:"date",op:"between",value:s<a?s:a,valueTo:s<a?a:s}}let r=xr.find(([s])=>t.startsWith(s)),i=Un(r?t.slice(r[0].length):t);return i?{type:"date",op:r?r[1]:"equals",value:i}:void 0}function As(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=vr.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=xr.find(([,t])=>t===o.op)?.[0];return e&&o.value?`${e==="="?"":e}${o.value}`:""}return""}var Gt=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 ft)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(),i=`${n}|${t.state.locale.code}|${r.map(s=>`${s.id}:${s.left}:${s.width}:${s.region}`).join(",")}`;if(i!==this.layout){this.layout=i;for(let s of ft){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 ft)for(let n of this.inners[t].querySelectorAll("[data-col]")){let r=n.dataset.col,i=e[r];if(n.closest(".fg-filter-cell").classList.toggle("fg-filter-active",!!i),!(n===n.ownerDocument.activeElement||n.getRootNode().activeElement===n)){if(n instanceof HTMLSelectElement){let s=i?.type==="set"&&i.values.length>1?i.values.length:0,a=n.querySelector(`option[value="${Ht}"]`);if(s)a||(a=x("option","",{value:Ht}),a.disabled=!0,n.options[0].after(a)),a.textContent=this.grid.store.state.locale.setSelected.replace("{n}",String(s)),n.value=Ht;else{a?.remove();let l=i?.type==="set"&&i.values.length===1?JSON.stringify(i.values[0]):"";[...n.options].some(d=>d.value===l)&&(n.value=l)}}else n.value=As(i);n.classList.remove("fg-filter-bad")}}}}refreshLists(){for(let e of ft)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===Ht){this.rebuilt=!0;continue}if(r&&![...t.options].some(i=>i.value===r)){let i=x("option","",{value:r});i.textContent=String(JSON.parse(r)),t.append(i)}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(i=>{let s=x("option","",{value:JSON.stringify(i)});return s.textContent=i===!0?"\u2713":i===!1?"\u2717":String(i),s});e.replaceChildren(n,...r)}cell(e,t){let n=x("div","fg-filter-cell",{role:"gridcell"});n.style.left=`${e.left}px`,n.style.width=`${e.width}px`,n.style.height=`${t}px`;let r=N(e.id)?null:de(e.def);if(!r)return n;let s=`${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":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,r==="number"&&(a.placeholder=">0, 10~20"),r==="date"&&(a.placeholder=">2026-01-01");let l=()=>{let d=Es(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(),!ce(d)&&(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 i=JSON.stringify(r);if(t.has(i)||t.set(i,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 ft)this.inners[e].remove()}};var Oe=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,Ts=new Set(["top","bottom","aboveAverage","belowAverage","duplicate","unique","dataBar","colorScale","iconSet"]),Cr={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 _n(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 Kn(o,e,t){let n=_n(o),r=_n(e);return!n||!r?t<.5?o:e:`#${n.map((s,a)=>Math.round(s+(r[a]-s)*Math.max(0,Math.min(1,t)))).map(s=>s.toString(16).padStart(2,"0")).join("")}`}function ht(o){return o==null?"":o instanceof Date?o.toISOString():String(o)}function Ps(o,e){let t=o.op??"eq";if(t==="blank")return q(e);if(t==="notBlank")return!q(e);if(t==="contains"||t==="notContains"||t==="startsWith"||t==="endsWith"){let d=ht(e).toLowerCase(),c=ht(o.value).toLowerCase(),u=t==="startsWith"?d.startsWith(c):t==="endsWith"?d.endsWith(c):d.includes(c);return t==="notContains"?!u:u}if(q(e))return t==="ne";let n=Oe(e),r=Oe(o.value),i=Oe(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(i===null)return!1;let d=n>=Math.min(r,i)&&n<=Math.max(r,i);return t==="between"?d:!d}}let s=ht(e).toLowerCase(),a=ht(o.value).toLowerCase(),l=ht(o.valueTo).toLowerCase();switch(t){case"eq":return s===a;case"ne":return s!==a;case"gt":return s>a;case"gte":return s>=a;case"lt":return s<a;case"lte":return s<=a;case"between":return s>=a&&s<=l;case"notBetween":return s<a||s>l}return!1}var zt=class{constructor(e){this.deps=e;this.stats=new Map;this.statsKey=[];this.rowCache=new WeakMap}dependsOnOtherRows(){return this.deps.rules().some(e=>e&&(Ts.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 s of this.deps.rows()){let a=this.deps.value(e,s),l=Oe(a);if(l!==null&&n.push(l),!q(a)){let d=te(a);r.set(d,(r.get(d)??0)+1)}}n.sort((s,a)=>s-a);let i=n.reduce((s,a)=>s+a,0);t={min:n[0]??0,max:n[n.length-1]??0,avg:n.length?i/n.length:0,sorted:n,counts:r},this.stats.set(e,t)}return t}test(e,t,n,r){let i=e.type??"value";switch(i){case"value":return Ps(e,n);case"formula":{if(typeof e.formula!="string")return!1;let s=this.deps.formula(e.formula.startsWith("=")?e.formula:`=${e.formula}`,r);return s===!0||typeof s=="number"&&s!==0}case"top":case"bottom":{let s=Oe(n);if(s===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 i==="top"?s>=a.sorted[Math.max(0,a.sorted.length-l)]:s<=a.sorted[Math.min(a.sorted.length-1,l-1)]}case"aboveAverage":case"belowAverage":{let s=Oe(n);if(s===null)return!1;let a=this.statsOf(t).avg;return i==="aboveAverage"?s>a:s<a}case"duplicate":case"unique":{if(q(n))return!1;let s=this.statsOf(t).counts.get(te(n))??0;return i==="duplicate"?s>1:s===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=Rr(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 i=null,s=this.rowStyle(t);s&&(i={style:{...s}});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=Oe(n);if(d===null)continue;let c=this.statsOf(e),u=typeof a.min=="number"?a.min:c.min,p=typeof a.max=="number"?a.max:c.max,m=p===u?1:Math.max(0,Math.min(1,(d-u)/(p-u)));if(i??(i={style:{}}),l==="dataBar"){let g=u<0&&p>0?-u/(p-u):u>=0?0:1,y=p===u?1:m;i.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?m<.5?Kn(g[0],g[1],m*2):Kn(g[1],g[2],(m-.5)*2):Kn(g[0],g[1],m);i.style={...i.style,background:y}}else{let g=Cr[a.icons??"arrows"]??Cr.arrows;i.icon=m>=2/3?g[0]:m>=1/3?g[1]:g[2]}continue}if(this.test(a,e,n,t)&&(i??(i={style:{}}),i.style=Rr(i.style,a.style),a.stopIfTrue))break}return i}};function ge(o){let e=o?.align;return e==="left"||e==="center"||e==="right"?e:void 0}function Rr(o,e){if(!e||typeof e!="object")return{...o};let t={...o,...e};return ge(e)||(ge(o)?t.align=o.align:delete t.align),t}function Xn(o){let e=o?_n(o):null;return e?`FF${e.map(t=>t.toString(16).padStart(2,"0")).join("").toUpperCase()}`:void 0}function Jn(o){let e=[];for(let t of o){if(q(t)||t instanceof Date)continue;let n=typeof t=="number"?t:Number(t);Number.isNaN(n)||e.push(n)}return e}function kr(o,e){let t=o.filter(i=>i instanceof Date&&!Number.isNaN(i.getTime()));if(t.length)return t.reduce((i,s)=>(e?s>i:s<i)?s:i);let n=Jn(o);if(!n.length)return null;let r=n[0];for(let i of n)(e?i>r:i<r)&&(r=i);return r}function ye(o,e,t){if(typeof o=="function")return o(e,t);switch(o){case"sum":{let n=Jn(e);return n.length||!e.length?n.reduce((r,i)=>r+i,0):null}case"avg":{let n=Jn(e);return n.length?n.reduce((r,i)=>r+i,0)/n.length:null}case"min":return kr(e,!1);case"max":return kr(e,!0);case"count":return t.length}return null}function pt(o){return typeof o=="object"&&o!==null&&"agg"in o?o:{agg:o}}function Sr(o,e,t){let n=new Map,r=(i,s)=>{let a=n.get(i);return a||n.set(i,a=e.map(l=>G(s,l))),a};return o.map(i=>{let s={};for(let[a,l]of Object.entries(i.columns??{})){let d=t(a);d&&(s[a]=ye(pt(l).agg,r(a,d),e))}return s})}function gt(o,e,t,n,r){if(!o)return 1;let i=1;try{i=Math.floor(Number(o({value:G(e,t),row:t,rowIndex:n})))}catch{i=1}return Number.isFinite(i)?Math.max(1,Math.min(r,i)):1}function Xe(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=gt(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 i=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 q(d)?null:te(d)});return(l,d)=>a[l]!==null&&a[l]===a[d]})(),s=0;for(let a=1;a<=t;a++)if(!(a<t&&i(a-1,a))){for(let l=s;l<a;l++)n[l]=s,r[l]=a-1;s=a}return{start:n,end:r}}function Yn(o,e){let t=new Int32Array(e),n=new Int32Array(e),r=0;for(let i=1;i<=e;i++)if(!(i<e&&!o.some(s=>s.start[i]===i))){for(let s=r;s<i;s++)t[s]=r,n[s]=i-1;r=i}return{start:t,end:n}}function Mr(o,e){let t=o.length,n=new Int32Array(t);if(!t||!e.length)return n;let{start:r}=Yn(e.map(i=>Xe(o,i)),t);for(let i=1;i<t;i++)n[i]=n[i-1]+(r[i]===i?1:0);return n}function Er(o,e,t,n,r=4){if(n<=0||t<=0)return{first:0,last:-1};let i=Math.max(0,Math.floor(o/t)-r),s=Math.floor((o+e)/t);return{first:Math.min(i,n-1),last:Math.min(n-1,s+r)}}function Vt(o,e,t,n,r=2){let i=o.length;if(!i)return{first:0,last:-1};let s=0,a=i-1;for(;s<a;){let c=s+a>>1;o[c]+e[c]<=t?s=c+1:a=c}let l=s,d=t+n;for(a=i-1;s<a;){let c=s+a+1>>1;o[c]<d?s=c:a=c-1}return{first:Math.max(0,l-r),last:Math.min(i-1,Math.max(l,s)+r)}}function Ar(o,e,t,n,r=4){if(n<=0)return{first:0,last:-1};let i=0,s=n-1;for(;i<s;){let d=i+s>>1;o[d+1]<=e?i=d+1:s=d}let a=i,l=e+t;for(s=n-1;i<s;){let d=i+s+1>>1;o[d]<l?i=d:s=d-1}return{first:Math.max(0,a-r),last:Math.min(n-1,i+r)}}var re=["left","center","right"],Tr=6,Ls=8,Zn=2,Fs='<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>',Qn='<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 Is='<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,i]of Object.entries(t))n.setAttribute(r,i);return n}var qt=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.geo={top:0,left:0,cw:0,ch:0,ow:0,oh:0};this.layoutSig="";this.touched=new Set;this.measureAll=!1;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.summaryKey=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.cards?this.getScroll():{top:this.geo.top,left:this.geo.left})};this.onSideWheel=e=>{e.deltaY&&(e.preventDefault(),this.scroller.scrollTop+=e.deltaY)};this.overlayKey="";this.heightFn=null;this.freeBadge=null;this.onCardClick=e=>{let t=e.target,n=t.closest(".fg-card");if(!n)return;let r=Number(n.dataset.row),i=this.grid.rowModel.getRow(r);if(!i||i.kind)return;if(t.closest(".fg-card-check")){this.grid.selectFromClick(r,!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:i.data,rowIndex:r,colId:a.id,value:G(a.def,i.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=i=>({left:x("div",`${i} ${i}-left`),center:x("div",`${i} ${i}-center`),right:x("div",`${i} ${i}-right`)});this.headerPanes=r("fg-header-pane"),this.headerInners=r("fg-header-inner");for(let i of re)this.headerInners[i].setAttribute("role","row");this.bodyPanes=r("fg-body-pane"),this.canvases=r("fg-canvas");for(let i of re)this.headerPanes[i].dataset.region=i,this.bodyPanes[i].dataset.region=i,this.headerPanes[i].append(this.headerInners[i]),this.bodyPanes[i].append(this.canvases[i]),this.headerEl.append(this.headerPanes[i]),this.bodyEl.append(this.bodyPanes[i]);this.scroller=this.bodyPanes.center,t.options.filterRow&&(this.filterRow=new Gt(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}readGeo(){let e=this.scroller;this.geo={top:e.scrollTop,left:e.scrollLeft,cw:e.clientWidth,ch:e.clientHeight,ow:e.offsetWidth,oh:e.offsetHeight}}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:i,headerHeight:s}=this.opts;this.readGeo();let a=this.geo.ow-this.geo.cw;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(i,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(v=>!N(v.id))?.id??"",this.groupLabelId=e.region("center").find(v=>!N(v.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(),p=u?u.opts.rows.length:0,m=u?.opts.position??"bottom",g=u?u.opts.pinned!==!1:!1;this.topOffset=u&&!g&&m==="top"?p*i:0;let y=u&&!g&&m==="bottom"?p*i:0;this.syncSummaryPane(u&&g?m:null,p*i);let w=e.depth*s+(this.filterRow?.height??0);this.headerEl.style.height=`${w}px`;for(let v of re){let S=e.regionWidth(v);v!=="center"&&(this.headerPanes[v].style.width=this.bodyPanes[v].style.width=`${S}px`,this.headerPanes[v].hidden=this.bodyPanes[v].hidden=S===0),this.canvases[v].style.width=`${S}px`,this.canvases[v].style.height=`${this.rowsHeight(l)+this.topOffset+y}px`}if(r.autoHeight&&!this.useCards()){this.root.classList.add("fg-auto-height");let v=l>0?this.rowsHeight(l):Math.max(this.rowsHeight(l),3*i);this.bodyEl.style.height=`${v+this.topOffset+y+Math.max(0,this.scroller.offsetHeight-this.scroller.clientHeight)}px`}let f=`${w}|${re.map(v=>e.regionWidth(v)).join(",")}|${this.rowsHeight(l)+this.topOffset+y}|${u&&g?m:""}|${p}|${r.autoHeight?1:0}`;f!==this.layoutSig&&(this.layoutSig=f,this.readGeo());let h=this.geo.oh-this.geo.ch;this.bodyPanes.left.style.marginBottom=this.bodyPanes.right.style.marginBottom=`${h}px`;let b=this.gridEl;b.setAttribute("role",r.treeData||this.grid.getGroupBy().length?"treegrid":"grid"),b.setAttribute("aria-rowcount",String(l+e.depth+(this.filterRow?1:0))),b.setAttribute("aria-colcount",String(e.displayed().length)),r.rowSelection==="multiple"&&b.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,m),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?m:null),this.paintOverlay(l),this.overlay.style.top=`${w}px`;let{top:C,left:M}=this.geo;this.bodyPanes.left.scrollTop=this.bodyPanes.right.scrollTop=C,this.headerInners.center.style.transform=`translateX(${-M}px)`,this.filterRow?.setTransform(M),this.summaryInners&&(this.summaryInners.center.style.transform=`translateX(${-M}px)`);for(let v of[this.pinnedTop,this.pinnedBottom])v&&(v.inners.center.style.transform=`translateX(${-M}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),r=[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 i=this.bodyEl;for(let s=t.length-1;s>=0;s--)i.previousElementSibling!==t[s]&&this.gridEl.insertBefore(t[s],i),i=t[s];i=this.bodyEl;for(let s of n)i.nextElementSibling!==s&&i.after(s),i=s;i=this.gridEl;for(let s of r)i.nextElementSibling!==s&&i.after(s),i=s;this.placeFreeBadge()}paintOverlay(e){let{grid:t}=this,{store:n,rowModel:r,options:i}=t,s=t.forcedOverlay??(e>0?null:r.loading()?"loading":"noRows");if(this.overlay.hidden=!s,!s){this.overlayKey="";return}let a=!r.server&&n.state.data.length>0,l=s==="loading"?i.loadingOverlay:i.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 r=e??new eo(`fg-pinned-rows fg-pinned-${t}`),{columns:i}=this.grid,s=this.opts.rowHeight;r.size(i,n.length*s,this.geo.ow-this.geo.cw);let a=i.region("center"),l=Vt(a.map(c=>c.left),a.map(c=>c.width),this.geo.left,this.geo.cw,Zn),d=[n,n.length,this.version,this.grid.valuesVersion,l.first,l.last,s,this.grid.store.state.locale.code];if(e&&Pr(d,r.key))return r;r.key=d;for(let c of re){let u=c==="center"?a.slice(l.first,l.last+1):i.region(c);r.inners[c].replaceChildren(...n.map((p,m)=>{let g=x("div","fg-row fg-row-pinned",{role:"row"});g.style.transform=`translateY(${m*s}px)`,g.style.height=`${s}px`;let y={id:`pinned-${t}-${m}`,data:p,sourceIndex:-1};for(let w of u){let f=x("div","fg-cell",{role:"gridcell"});N(w.id)?(f.style.left=`${w.left}px`,f.style.width=`${w.width}px`):this.paintCell(f,y,-1,w,!1,!1),g.append(f)}return g}))}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,i=`${this.version}.${t.valuesVersion}|${e}|${r}|${n.selected.size}|${JSON.stringify(n.range)}|${JSON.stringify(n.extraRanges)}|${n.locale.code}`;if(this.statusEl&&i===this.statusKey)return;this.statusKey=i,this.statusEl??(this.statusEl=x("div","fg-statusbar",{role:"status","aria-live":"polite"}));let s=n.locale,a=ke(s.code,2),l=x("span","fg-status-rows");l.textContent=(e===r?s.statusRows.replace("{n}",a.format(r)):s.statusFiltered.replace("{shown}",a.format(e)).replace("{total}",a.format(r)))+(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:r,locale:i}=t.state;for(let s of re){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,r,i)))}}headerCell(e,t,n,r){let i=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*i}px`,s.style.width=`${e.width}px`,s.style.height=`${e.rowSpan*i}px`,N(e.id))return e.id===Me&&(s.classList.add("fg-header-rownum"),s.textContent=e.label),e.id===oe&&(s.classList.add("fg-header-select"),s.append(this.selectAllBox(r))),s;let a=x("span","fg-header-label"),l=e.node.def;if(a.textContent=e.label,l.headerRenderer)try{let m=l.headerRenderer({header:e.label,column:l});typeof m=="string"?a.innerHTML=m:a.replaceChildren(m)}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 m=e.node.open,g=x("button",m?"fg-colgroup-toggle fg-expanded":"fg-colgroup-toggle",{type:"button",tabindex:"-1","aria-expanded":String(m),"aria-label":m?r.collapseAll:r.expandAll});g.textContent=m?"\u2212":"+",g.addEventListener("click",y=>{y.stopPropagation(),this.grid.setColumnGroupOpened(e.id,!m)}),s.classList.add("fg-header-collapsible"),d=g}if(l.headerClass)try{let m=typeof l.headerClass=="function"?l.headerClass(l):l.headerClass;m&&s.classList.add(...m.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));let u=c.align??(c.type==="number"?"right":"left");u==="right"?s.classList.add("fg-align-right"):u==="center"&&s.classList.add("fg-align-center");let p=t.findIndex(m=>m.colId===e.id);if(s.setAttribute("aria-sort",p<0?"none":t[p].dir==="asc"?"ascending":"descending"),De(c)&&s.classList.add("fg-sortable"),p>=0){let m=x("span","fg-sort-icon");if(m.textContent=t[p].dir==="asc"?"\u2191":"\u2193",t.length>1){let g=x("sup");g.textContent=String(p+1),m.append(g)}s.append(m)}if(De(c)||de(c)){let m=!!n[e.id],g=x("button",m?"fg-menu-btn fg-filter-active":"fg-menu-btn",{type:"button",tabindex:"-1","aria-label":r.columnMenu});g.innerHTML=m?Is:Fs,s.append(g)}return It(c)&&s.append(x("div","fg-resize",{"aria-hidden":"true"})),s}selectAllBox(e){let t=x("input","fg-checkbox fg-select-all",{type:"checkbox",tabindex:"-1","aria-label":e.selectAllRows});return this.paintSelectAll(t),t.hidden=this.grid.options.rowSelection!=="multiple"||this.grid.options.headerCheckbox===!1,t}paintSelectAll(e){let t=this.grid.selectableIds(),n=0;for(let r of this.grid.store.state.selected)t.has(r)&&n++;e.checked=t.size>0&&n===t.size,e.indeterminate=n>0&&n<t.size}selectionChanged(){let e=this.headerEl.querySelectorAll(".fg-select-all");if(e.length)for(let t of e)this.paintSelectAll(t)}renderRows(e){let{columns:t,rowModel:n,store:r}=this.grid,{selected:i,focus:s}=r.state,a=this.grid.allRangeBounds(),l=this.grid.mergeSpans(),d=l.has(oe),{geo:c}=this,u=Math.max(0,c.top-this.topOffset),p=this.grid.options.autoHeight&&!n.server?{first:0,last:e-1}:this.offsets?Ar(this.offsets,u,c.ch,e,Tr):Er(u,c.ch,this.opts.rowHeight,e,Tr);this.lastRange=p;let m=t.region("center"),g=Vt(m.map(f=>f.left),m.map(f=>f.width),this.geo.left,this.geo.cw,Zn),y=m.some(f=>f.def.colSpan);y&&(g.first=Math.max(0,g.first-Ls));let w=!y&&!l.size;this.touched.clear();for(let f of re){let h=f==="center"?m.slice(g.first,g.last+1):t.region(f),b=this.painted[f];for(let[M,v]of b)M>=p.first&&M<=p.last&&h.length||(v.el.remove(),this.pool[f].push(v.el),b.delete(M));if(!h.length)continue;let C=f==="center"?`${g.first}-${g.last}`:"";for(let M=p.first;M<=p.last;M++){let v=n.getRow(M),S=i.has(v.id),A=s&&s.rowIndex===M?s.colId:"",D=a.filter(L=>M>=L.r1&&M<=L.r2),k=D.map(L=>`${L.c1}-${L.c2}`).join(","),E=this.mergeState(l,h,M,p.first),I=d&&!v.kind?this.grid.blockSelection(M)??"":"",R=v.kind==="detail"?`${c.left}:${c.cw}`:"",F=`${v.id}|${this.version}.${this.rowVersions.get(v.id)??0}|${S?1:0}${v.kind==="group"?`:${this.grid.selectionVersion}`:""}${I}|${A}|${k}|${E}|${R}`,P=`${C}|${F}`,T=b.get(M);if(!T){let L=this.pool[f].pop()??x("div","fg-row",{role:"row"});this.canvases[f].append(L),T={el:L,key:""},b.set(M,T)}if(T.key!==P){if(this.touched.add(M),w&&f==="center"&&!v.kind&&T.base===F&&this.slideCells(T,v,M,m,g,S,A,D)){T.key=P;continue}T.key=P,T.base=f==="center"&&!v.kind?F:void 0,T.first=g.first,T.last=g.last,T.el.dataset.kind!==(v.kind??"")&&(T.el.replaceChildren(),T.el.dataset.kind=v.kind??""),v.kind==="group"?this.paintGroupRow(T.el,v,M,h,A):v.kind==="detail"?this.paintDetailRow(T.el,v,M,f):v.kind==="loading"?this.paintLoadingRow(T.el,M,h):this.paintRow(T.el,v,M,h,S,A,D,l,p.first)}}}l.size&&this.stickMergedText(c.top,c.ch||Number.MAX_SAFE_INTEGER/4)}stickMergedText(e,t){for(let n of re){let r=new Map;for(let[s,a]of this.painted[n]){let l=-1;for(let d of a.el.querySelectorAll(".fg-cell-merged"))l=Math.max(l,Number(d.dataset.mergeEnd));l>s&&r.set(s,l)}let i=new Map;for(let s of[...r.keys()].sort((a,l)=>l-a)){let a=0;for(let[l,d]of i)l>s&&l<=r.get(s)&&(a=Math.max(a,d));i.set(s,a+1)}for(let[s,a]of this.painted[n]){let l=i.has(s)?String(i.get(s)):"";a.el.style.zIndex!==l&&(l||a.el.querySelector(".fg-cell-merged, .fg-cell-merge-hidden"))&&(a.el.style.zIndex=l)}for(let s of this.painted[n].values())for(let a of s.el.querySelectorAll(".fg-cell-merged")){let l=Number(a.dataset.mergeTop),d=Number(a.dataset.mergeLast);if(!Number.isFinite(l)||!Number.isFinite(d))continue;let c=Math.min(d,Math.max(0,e-l)),u=0;if(a.classList.contains("fg-cell-merged-middle")||a.classList.contains("fg-cell-merged-bottom")){let g=Number(a.dataset.mergeHeight),y=g-d;u=Math.max(0,Math.min(g-c-y,l+g-(e+t))),c=Math.min(c,g-u-y)}let p=`${Math.round(c)}px`;a.style.getPropertyValue("--fg-merge-shift")!==p&&a.style.setProperty("--fg-merge-shift",p);let m=`${Math.round(u)}px`;a.style.getPropertyValue("--fg-merge-shift-bottom")!==m&&a.style.setProperty("--fg-merge-shift-bottom",m)}}}slideCells(e,t,n,r,i,s,a,l){let d=e.first,c=e.last;if(i.first>c||i.last<d||e.el.childElementCount!==c-d+1)return!1;let u=e.el;for(let m=d;m<i.first;m++)u.firstElementChild.remove();for(let m=c;m>i.last;m--)u.lastElementChild.remove();let p=m=>{let g=x("div","fg-cell",{role:"gridcell"});return this.paintCell(g,t,n,m,s,a===m.id),m.id===this.firstDataId&&this.decorate(g,t),!N(m.id)&&l.some(y=>m.index>=y.c1&&m.index<=y.c2)&&g.classList.add("fg-cell-range"),g};return i.first<d&&u.prepend(...r.slice(i.first,d).map(p)),i.last>c&&u.append(...r.slice(c+1,i.last+1).map(p)),e.first=i.first,e.last=i.last,!0}mergeState(e,t,n,r){if(!e.size)return"";let i="";for(let s of t){let a=e.get(s.id);if(!a)continue;let l=a.start[n],d=a.end[n];i+=l===d?"n":n===Math.max(l,r)?`d${l}`:"h"}return i}paintRow(e,t,n,r,i,s,a,l=new Map,d=0){let c=this.opts.rowHeight;for(e.className=`fg-row${n%2?" fg-row-odd":""}${i?" 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(i)),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,p=r.length?this.grid.columns.region(r[0].region):[],m=p.some(w=>w.def.colSpan),g=-1,y=m?new Map(p.map((w,f)=>[w.id,f])):null;r.forEach((w,f)=>{let h=e.children[f];if(this.paintCell(h,t,n,w,i,s===w.id),y){let C=y.get(w.id);if(C<=g)h.classList.add("fg-cell-span-hidden");else if(w.def.colSpan&&!N(w.id)){let M=gt(w.def.colSpan,w.def,t.data,n,p.length-C);if(M>1){g=C+M-1;let v=0;for(let S=C;S<=g;S++)v+=p[S].width;h.style.width=`${v}px`,h.classList.add("fg-cell-colspan")}}}w.id===this.firstDataId&&this.decorate(h,t),h.style.top=h.style.height=h.style.bottom="";let b=l.get(w.id);b&&b.start[n]!==b.end[n]&&(n===Math.max(b.start[n],d)?(h.classList.add("fg-cell-merged"),h.style.top=`${-(this.rowTop(n)-this.rowTop(b.start[n]))}px`,h.style.height=`${this.rowTop(b.end[n])+this.rowH(b.end[n])-this.rowTop(b.start[n])}px`,h.style.bottom="auto",h.dataset.mergeTop=String(this.rowTop(b.start[n])),h.dataset.mergeLast=String(this.rowTop(b.end[n])-this.rowTop(b.start[n])),h.dataset.mergeEnd=String(b.end[n]),h.dataset.mergeHeight=String(this.rowTop(b.end[n])+this.rowH(b.end[n])-this.rowTop(b.start[n])),h.classList.toggle("fg-cell-merged-middle",w.def.mergeAlign==="middle"),h.classList.toggle("fg-cell-merged-bottom",w.def.mergeAlign==="bottom"),u=!0):h.classList.add("fg-cell-merge-hidden")),!h.classList.contains("fg-cell-merged")&&h.dataset.mergeTop!==void 0&&(delete h.dataset.mergeTop,delete h.dataset.mergeLast,delete h.dataset.mergeEnd,delete h.dataset.mergeHeight,h.classList.remove("fg-cell-merged-middle","fg-cell-merged-bottom"),h.style.removeProperty("--fg-merge-shift"),h.style.removeProperty("--fg-merge-shift-bottom")),!N(w.id)&&a.some(C=>w.index>=C.c1&&w.index<=C.c2)&&h.classList.add("fg-cell-range")}),e.style.zIndex=u?"1":""}paintCell(e,t,n,r,i,s){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=s?"fg-cell fg-cell-focused":"fg-cell";if(r.id===Me){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===Ie){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===oe){e.className=`${l} fg-cell-select`;let g=x("input","fg-checkbox",{type:"checkbox",tabindex:"-1","aria-label":a.selectRow});g.checked=i;let y=n>=0&&!t.kind?this.grid.blockSelection(n):null;y?(g.checked=y==="all",g.indeterminate=y==="some",y==="off"&&(g.disabled=!0,e.classList.add("fg-cell-select-locked"))):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=Z(d,a.code)(c),p=n>=0&&!t.kind?this.grid.cellFormat(t.data,r.id,c):null;l+=` fg-align-${ge(p?.style)??d.align??(d.type==="number"?"right":d.type==="boolean"?"center":"left")}`;let m={value:c,formatted:u,row:t.data,rowIndex:n,column:d};if(d.cellClass)try{let g=typeof d.cellClass=="function"?d.cellClass(m):d.cellClass;g&&(l+=` ${g}`)}catch{O(`cellClass of column "${r.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&&!Ft(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),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(Ds(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(m);typeof g=="string"?e.innerHTML=g:e.replaceChildren(g)}catch{O(`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),i=r+Math.min(this.rowH(e),n.clientHeight||1/0);r<n.scrollTop?n.scrollTop=r:i>n.scrollTop+n.clientHeight&&(n.scrollTop=i-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 r=i=>({left:x("div",`${i} ${i}-left`),center:x("div",`${i} ${i}-center`),right:x("div",`${i} ${i}-right`)});this.summaryEl=x("div","fg-summary",{role:"rowgroup"}),this.summaryPanes=r("fg-summary-pane"),this.summaryInners=r("fg-summary-inner");for(let i of re)this.summaryPanes[i].append(this.summaryInners[i]),this.summaryEl.append(this.summaryPanes[i])}this.summaryEl.className=`fg-summary fg-summary-${e}`,this.summaryEl.style.height=`${t}px`;for(let r of re){let i=this.grid.columns.regionWidth(r);r!=="center"&&(this.summaryPanes[r].style.width=`${i}px`,this.summaryPanes[r].hidden=i===0),this.summaryInners[r].style.width=`${i}px`,this.summaryInners[r].style.height=`${t}px`}let n=this.geo.ow-this.geo.cw;this.summaryPanes.center.style.marginRight=`${n}px`}renderSummary(e,t,n,r,i){if(!t&&!this.summaryKey)return;let s=this.grid.columns.region("center"),a=Vt(s.map(p=>p.left),s.map(p=>p.width),this.geo.left,this.geo.cw,Zn),l=[t,n,r,i,this.summaryInners,this.version,a.first,a.last,this.opts.rowHeight,r?0:this.rowsHeight(e),this.grid.store.state.locale.code];if(Pr(l,this.summaryKey))return;this.summaryKey=l;for(let p of re){for(let m of this.canvasSummary[p])m.remove();this.canvasSummary[p]=[]}if(!t){this.summaryKey=null;return}let{columns:d}=this.grid,c=this.opts.rowHeight,u=d.displayed().filter(p=>!N(p.id));for(let p of re){let m=p==="center"?s.slice(a.first,a.last+1):d.region(p),g=t.map((y,w)=>{let f=y.label!=null?u.find(C=>!(C.id in(y.columns??{})))?.id??null:null,h=x("div","fg-row fg-summary-row",{role:"row"}),b=r||i==="top"?w*c:this.rowsHeight(e)+w*c;h.style.transform=`translateY(${b}px)`,h.style.height=`${c}px`;for(let C of m)h.append(this.summaryCell(C,y,n[w]??{},f));return h});r?this.summaryInners[p].replaceChildren(...g):(this.canvases[p].append(...g),this.canvasSummary[p]=g)}}summaryCell(e,t,n,r){let i=x("div","fg-cell",{role:"gridcell"});i.style.left=`${e.left}px`,i.style.width=`${e.width}px`,i.dataset.col=e.id;let s=e.def,a=s.align??(s.type==="number"?"right":s.type==="boolean"?"center":"left");i.className=`fg-cell fg-align-${a}`;let l=t.columns?.[e.id];if(l===void 0)return e.id===r&&(i.textContent=t.label??"",i.classList.add("fg-summary-label")),i;let d=n[e.id],c=pt(l),u=this.grid.store.state.locale.code,p;if(d==null||d==="")p="";else if(typeof d=="string")p=d;else if(c.agg==="count")p=ke(u).format(d);else{let m=s.type??(typeof d=="number"?"number":d instanceof Date?"date":void 0);p=lt(s,m,u,c.format??s.format)(d)}return i.textContent=c.prefix&&p?`${c.prefix} ${p}`:p,i}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.measureAll=!0,this.heightsVersion++)}measureRows(){let e=this.opts.rowHeight,t=new Map,n=this.measureAll?new Set(re.flatMap(i=>[...this.painted[i].keys()])):this.touched;this.measureAll=!1;for(let i of n){let s=this.grid.rowModel.getRow(i);if(!s||s.kind)continue;let a=e;for(let l of re){let d=this.painted[l].get(i);if(d)for(let c of d.el.querySelectorAll(".fg-cell-wrap"))c.classList.contains("fg-cell-merged")||c.classList.contains("fg-cell-merge-hidden")||(a=Math.max(a,Math.ceil(c.scrollHeight)))}t.set(i,a)}this.touched.clear();let r=!1;for(let[i,s]of t){let a=this.grid.rowModel.getRow(i).id,l=this.rowHeights.get(a)??e;Math.abs(l-s)>1&&(s===e?this.rowHeights.delete(a):this.rowHeights.set(a,s),r=!0)}r&&(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,i=t.level??0,s=!!n.options.treeData,a=n.canExpandDetail(t.data);if(!s&&!a&&!i)return;e.classList.add("fg-cell-lead"),e.style.setProperty("--fg-level",String(i));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?r.collapseAll:r.expandAll,"aria-expanded":String(!!t.expanded)});t.loading&&d.setAttribute("aria-busy","true"),d.innerHTML=Qn,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=Qn,l.push(c)}e.prepend(...l)}paintGroupRow(e,t,n,r,i){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>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 p=i===d.id?" fg-cell-focused":"";if(d.id===oe){if(u.className=`fg-cell fg-cell-select${p}`,a.options.rowSelection!=="multiple"){u.replaceChildren();return}let w=a.groupSelection(t),f=x("input","fg-checkbox",{type:"checkbox",tabindex:"-1","aria-label":l.selectAllRows});f.checked=w==="all",f.indeterminate=w==="some",u.replaceChildren(f);return}if(d.id===this.groupLabelId){u.className=`fg-cell fg-group-cell${p}`,u.style.setProperty("--fg-level",String(t.level??0));let w=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});w.innerHTML=Qn;let f=a.columns.getNode(s.colId)?.def,h=x("span","fg-group-label"),b=q(s.value)?l.blanks:f?Z(f,l.code)(s.value):String(s.value),C=ke(l.code),M=s.count??(s.aggregates?null:s.rows.length);h.textContent=`${f?.header??f?.field??s.colId}: ${b}${M==null?"":` (${C.format(M)})`}`,u.replaceChildren(w,h);return}let m=d.def,g=m.align??(m.type==="number"?"right":m.type==="boolean"?"center":"left");u.className=`fg-cell fg-align-${g}${p}`;let y=m.aggFunc&&!N(d.id)?a.groupAggregate(t,d.id):void 0;if(y==null||y==="")u.textContent="";else if(m.aggFunc==="count")u.textContent=ke(l.code).format(y);else{let w=m.type??(typeof y=="number"?"number":y instanceof Date?"date":void 0);u.textContent=lt(m,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 i=t.detailOf,s=this.details.get(i.id);if(!s){s=x("div","fg-detail");try{let a=this.grid.options.detailRenderer?.({row:i.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(i.id,s)}s.style.left=`${this.geo.left}px`,s.style.width=`${this.geo.cw||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(r=>{let i=x("div","fg-cell",{role:"gridcell"});return i.style.left=`${r.left}px`,i.style.width=`${r.width}px`,i.dataset.col=r.id,N(r.id)||i.append(x("span","fg-skeleton",{"aria-hidden":"true"})),i}))}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(),i=e.getPageSize(),s=e.getPageCount(),a=e.rowModel.fullCount(),l=typeof t=="object"&&Array.isArray(t.pageSizes)?t.pageSizes.filter(f=>Number.isInteger(f)&&f>0):[],d=`${r}|${i}|${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",f=>{let h=f.target.closest("button[data-action]")?.dataset.action,b=e.getPage();h==="first"?e.setPage(0):h==="prev"?e.setPage(b-1):h==="next"?e.setPage(b+1):h==="last"&&e.setPage(e.getPageCount()-1)}),this.pagerEl.addEventListener("change",f=>{let h=f.target;h.classList.contains("fg-pager-size")&&e.setPageSize(Number(h.value))})),this.pagerEl.setAttribute("aria-label",n.pageSize);let c=ke(n.code),u=a?r*i+1:0,p=Math.min(a,(r+1)*i),m=x("span","fg-pager-range");m.textContent=n.pagerRange.replace("{from}",c.format(u)).replace("{to}",c.format(p)).replace("{total}",c.format(a));let g=[m,x("span","fg-pager-spacer")];if(l.length){let f=x("label","fg-pager-size-label");f.textContent=n.pageSize;let h=x("select","fg-pager-size");for(let b of[...new Set([...l,i])].sort((C,M)=>C-M)){let C=x("option");C.value=String(b),C.textContent=c.format(b),C.selected=b===i,h.append(C)}f.append(h),g.push(f)}let y=(f,h,b,C)=>{let M=x("button","fg-pager-btn",{type:"button","aria-label":b,title:b});return M.dataset.action=f,M.textContent=h,M.disabled=C,M},w=x("span","fg-pager-page",{"aria-live":"polite"});w.textContent=n.pageOf.replace("{page}",c.format(r+1)).replace("{pages}",c.format(s)),g.push(y("first","\xAB",n.firstPage,r===0),y("prev","\u2039",n.previousPage,r===0),w,y("next","\u203A",n.nextPage,r>=s-1),y("last","\xBB",n.lastPage,r>=s-1)),this.pagerEl.replaceChildren(...g)}showFreeBadge(){if(this.root.querySelector(".fg-free-badge"))return;let e=x("div","fg-free-badge",{"aria-hidden":"true"});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),this.freeBadge=e,this.placeFreeBadge()}placeFreeBadge(){if(!this.freeBadge)return;let e=(this.statusEl?.isConnected?this.statusEl.offsetHeight:0)+(this.pagerEl?.isConnected?this.pagerEl.offsetHeight:0),t=e?`${e+22}px`:"";this.freeBadge.style.bottom!==t&&(this.freeBadge.style.bottom=t)}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,i=t.columns.displayed().filter(y=>!N(y.id)),s=Math.round(this.opts.rowHeight*.75),a=!!t.options.rowSelection,l=20+i.length*s+(a?s: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:p,locale:m}=t.store.state,g=[];for(let y=c;y<=u;y++){let w=t.rowModel.getRow(y);if(!w)continue;let f=x("div",w.kind?"fg-card fg-card-other":p.has(w.id)?"fg-card fg-card-selected":"fg-card",{role:"listitem"});if(f.dataset.row=String(y),f.style.transform=`translateY(${y*(l+d)}px)`,f.style.height=`${l}px`,f.style.setProperty("--fg-card-line",`${s}px`),w.kind==="group"&&w.group){let h=t.columns.getNode(w.group.colId)?.def;f.textContent=`${h?.header??w.group.colId}: ${String(w.group.value??m.blanks)} (${w.group.rows.length})`}else if(!w.kind){if(a){let h=x("label","fg-card-head"),b=x("input","fg-card-check fg-checkbox",{type:"checkbox","aria-label":m.selectRow});b.checked=p.has(w.id),b.disabled=!t.rowSelectable(w.data),h.append(b,document.createTextNode(`#${y+1}`)),f.append(h)}for(let h of i){let b=x("div","fg-card-line"),C=x("span","fg-card-label");C.textContent=h.def.header??h.def.field??h.id;let M=x("span","fg-card-value");M.dataset.col=h.id;let v=G(h.def,w.data),S=Z(h.def,m.code)(v);if(h.def.renderer)try{let A=h.def.renderer({value:v,formatted:S,row:w.data,rowIndex:y,column:h.def});typeof A=="string"?M.innerHTML=A:M.replaceChildren(A)}catch{M.textContent=S}else M.textContent=S;b.append(C,M),f.append(b)}}g.push(f)}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 i=this.measureCtx;return i?(i.font=`${t?600:400} ${r}px ${n.fontFamily||"sans-serif"}`,i.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()}},eo=class{constructor(e){this.key=null;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 re)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 re){let i=e.regionWidth(r);r!=="center"&&(this.panes[r].style.width=`${i}px`,this.panes[r].hidden=i===0),this.inners[r].style.width=`${i}px`,this.inners[r].style.height=`${t}px`}this.panes.center.style.marginRight=`${n}px`}};function Pr(o,e){return!!e&&o.length===e.length&&o.every((t,n)=>t===e[n])}var Lr="http://www.w3.org/2000/svg";function Ds(o,e,t,n){let r=Math.max(20,t-16),i=Math.max(10,n-14),s=document.createElementNS(Lr,"svg");s.setAttribute("class","fg-sparkline"),s.setAttribute("width",String(r)),s.setAttribute("height",String(i)),s.setAttribute("viewBox",`0 0 ${r} ${i}`),s.setAttribute("aria-hidden","true");let a=e.color??"var(--fg-accent)",l=e.type==="bar",d=o.reduce((f,h)=>Math.min(f,h),l?0:1/0),c=o.reduce((f,h)=>Math.max(f,h),l?0:-1/0);d===c&&(d-=1,c+=1);let u=c-d,p=f=>i-1-(f-d)/u*(i-2),m=(f,h)=>{let b=document.createElementNS(Lr,f);for(let[C,M]of Object.entries(h))b.setAttribute(C,String(M));return s.append(b),b};if(e.type==="bar"){let f=r/o.length;return o.forEach((h,b)=>m("rect",{x:b*f+1,y:Math.min(p(h),p(0)),width:Math.max(1,f-2),height:Math.max(1,Math.abs(p(h)-p(0))),fill:h<0?"#ef4444":a})),s}let g=o.length>1?(r-2)/(o.length-1):0,y=o.map((f,h)=>`${1+h*g},${p(f)}`).join(" ");e.type==="area"&&m("polygon",{points:`1,${i} ${y} ${1+(o.length-1)*g},${i}`,fill:a,"fill-opacity":.2}),m("polyline",{points:y,fill:"none",stroke:a,"stroke-width":1.5,"stroke-linejoin":"round"});let w=o.length-1;return m("circle",{cx:1+w*g,cy:p(o[w]),r:2,fill:a}),s}var $s=4,Wt=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,i=e.clientX,s=!1,a=d=>{!s&&Math.abs(d.clientX-i)<$s||(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(m=>m!==n).filter(m=>{let g=m.getBoundingClientRect();return d.clientX>g.left+g.width/2}).length,p=this.grid.getGroupBy().filter(m=>m!==r);p.splice(u,0,r),this.grid.setGroupBy(p)};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,i)=>{let s=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=s?.header??s?.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),i<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 Je=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(i){console.error("[FreeGrid] event listener threw",i)}}clear(){this.listeners.clear()}};function ie(o){let e=o.getRootNode();return typeof ShadowRoot<"u"&&e instanceof ShadowRoot?e:document.body}function mt(o,e,t){let n=o.getRootNode();return(typeof n.elementFromPoint=="function"?n.elementFromPoint(e,t):null)??document.elementFromPoint(e,t)}function jt(o){return o.getRootNode().activeElement??document.activeElement}function me(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 Ut=new Map,to=new WeakMap,Fr=o=>o?to.get(o):void 0,Ir=o=>o?Ut.get(o):void 0;var Ns={Enter:"edit",F2:"edit",Delete:"clear",Backspace:"clear","Ctrl+Z":"undo","Ctrl+Y":"redo","Ctrl+Shift+Z":"redo","Ctrl+F":"find","Alt+ArrowDown":"columnMenu"};function Os(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 Bs=3;function Hs(o,e){return o.renderer.rtl?e.key==="ArrowLeft"?"ArrowRight":e.key==="ArrowRight"?"ArrowLeft":e.key:e.key}function Dr(o){let{renderer:e}=o,t=e.bodyEl,n=e.root,r=k=>Hs(o,k),i="mouse",s=0,a=null,l=!1,d=k=>{let E=e.cellAt(k.target);if(!E)return null;let I=o.rowModel.getRow(E.rowIndex),R=o.columns.getColumn(E.colId);if(!I||!R)return null;let F=N(R.id)?void 0:G(R.def,I.data);return{row:I.data,rowIndex:E.rowIndex,colId:E.colId,value:F,event:k}},c=k=>{let E=k.target.closest?.(".fg-group-toggle, .fg-tree-toggle, .fg-detail-toggle"),I=E&&e.cellAt(k.target);if(!I)return!1;e.gridEl.focus({preventScroll:!0}),o.setFocus(I.rowIndex,I.colId),o.setRange(null);let R=o.rowModel.getRow(I.rowIndex);return E.classList.contains("fg-detail-toggle")?o.setDetailExpanded(R.data,!o.isDetailExpanded(R.data)):o.toggleRow(I.rowIndex),!0},u=k=>{if(c(k))return;let E=o.store.state.focus,I=e.cellAt(k.target);if(I&&o.rowModel.getRow(I.rowIndex)?.kind){I.colId===oe&&o.rowModel.getRow(I.rowIndex).kind==="group"&&o.toggleGroupSelection(o.rowModel.getRow(I.rowIndex)),e.gridEl.focus({preventScroll:!0}),o.setFocus(I.rowIndex,I.colId),o.setRange(null);return}let R=d(k);if(!R)return;if(e.gridEl.focus({preventScroll:!0}),R.colId===Me){let L=o.columns.displayed().filter(B=>!N(B.id));L.length&&(o.setFocus(R.rowIndex,L[0].id),o.rangesOn()&&o.setRange({start:{rowIndex:R.rowIndex,colId:L[0].id},end:{rowIndex:R.rowIndex,colId:L[L.length-1].id}}));return}let F=l;l=!1;let P=o.store.state.focus,T=R.colId===oe;if(!F)if(k.shiftKey&&P&&!T&&!N(P.colId)&&o.rangesOn())o.setRange({start:P,end:{rowIndex:R.rowIndex,colId:R.colId}},!0);else if((k.ctrlKey||k.metaKey)&&!T&&!N(R.colId)&&o.rangesOn()){let L={rowIndex:R.rowIndex,colId:R.colId};o.addRange({start:L,end:L}),o.setFocus(R.rowIndex,R.colId)}else o.setFocus(R.rowIndex,R.colId),o.setRange(null);o.options.rowSelection&&!F&&(T||o.options.rowClickSelection!==!1)&&o.selectFromClick(R.rowIndex,T||k.ctrlKey||k.metaKey,k.shiftKey),o.events.emit("cellClick",R),i==="touch"&&!F&&E&&E.rowIndex===R.rowIndex&&E.colId===R.colId&&o.editor.canEdit(R.rowIndex,R.colId)&&(o.columns.getColumn(R.colId).def.type==="boolean"?o.applyEdit(R.rowIndex,R.colId,R.value!==!0):o.editor.start(R.rowIndex,R.colId))},p=k=>{if(k.target.closest?.("button"))return;let E=e.cellAt(k.target),I=E&&o.rowModel.getRow(E.rowIndex);if(I?.kind==="group"){o.toggleRow(E.rowIndex);return}if(I?.kind)return;let R=d(k);if(!R||(o.events.emit("cellDoubleClick",R),!o.editor.canEdit(R.rowIndex,R.colId)))return;o.columns.getColumn(R.colId).def.type==="boolean"?o.applyEdit(R.rowIndex,R.colId,R.value!==!0):o.editor.start(R.rowIndex,R.colId)},m={...Ns};for(let[k,E]of Object.entries(o.options.keymap??{}))m[k]=E===!1?"none":E;let g=k=>{let E=o.store.state.focus,I=m[Os(k)];if(I==="none")return!1;switch(I){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||!o.paid?!1:(o.finder.openBar(),!0);case"paste":return navigator.clipboard?.readText?.().then(F=>o.pasteText(F),()=>{}),!0;case"columnMenu":return o.menu.openAtFocus()}if(!E||!o.editor.canEdit(E.rowIndex,E.colId))return!1;let R=o.columns.getColumn(E.colId).def;if(k.key===" "&&R.type==="boolean"&&!k.ctrlKey&&!k.metaKey){let F=o.rowModel.getRow(E.rowIndex).data;return o.applyEdit(E.rowIndex,E.colId,F[R.field]!==!0),!0}return k.key.length===1&&k.key!==" "&&!k.ctrlKey&&!k.metaKey&&!k.altKey&&R.type!=="boolean"?(o.editor.start(E.rowIndex,E.colId,k.key),!0):!1},y=k=>{let E=o.store.state.focus;k.isComposing||k.key!=="Process"||k.ctrlKey||k.metaKey||k.altKey||!E||!o.editor.canEdit(E.rowIndex,E.colId)||o.columns.getColumn(E.colId).def.type!=="boolean"&&o.editor.start(E.rowIndex,E.colId,"")},w=k=>{let E=o.store.state.focus;if(!E||k.ctrlKey||k.metaKey||k.altKey||k.shiftKey)return!1;let I=o.rowModel.getRow(E.rowIndex);if(!o.isExpandable(I))return!1;let R=I.kind==="group";if(!R&&E.colId!==o.columns.displayed().find(T=>!N(T.id))?.id)return!1;let F=!!(I.group?.expanded??I.expanded),P=o.expandKey(I);if(R&&(k.key==="Enter"||k.key===" "))o.setGroupExpanded(P,!F);else if(r(k)==="ArrowRight"&&!F)o.setGroupExpanded(P,!0);else if(r(k)==="ArrowLeft"&&F)o.setGroupExpanded(P,!1);else return!1;return!0},f=k=>{let E=e.cellAt(k.target);if(!E||E.colId!==Ie)return!1;k.preventDefault();let I=o.rowModel.getRow(E.rowIndex);if(!I||I.kind||!o.canMoveRows())return!0;let R=I.data,F=x("div","fg-row-drop-marker"),P=null;n.classList.add("fg-row-dragging");let T=B=>{let j=mt(n,B.clientX,B.clientY),z=j?.closest(".fg-root"),_=z===n?o:Ir(z),X=o.dragOptions.group;if(P=null,F.remove(),!_||!z||_!==o&&(!X||_.dragOptions.group!==X||!_.options.rowDrag))return;let J=j.closest(".fg-row[data-row]"),ne=J?.getBoundingClientRect(),ee=null,$="after",V;if(J&&ne){let K=_.rowModel.getRow(Number(J.dataset.row));if(!K||K.kind==="group")return;ee=K.detailOf?.data??K.data;let fe=(B.clientY-ne.top)/ne.height;K.kind==="detail"?$="after":_.options.treeData?$=fe<.25?"before":fe>.75?"after":"inside":$=fe<.5?"before":"after",V=$==="before"?ne.top:ne.bottom}else{if(!j.closest(".fg-body"))return;let K=z.querySelectorAll(".fg-body-pane-center .fg-row[data-row]");V=K.length?Math.max(...[...K].map(fe=>fe.getBoundingClientRect().bottom)):z.querySelector(".fg-body").getBoundingClientRect().top}if(!_.canDropRow(R,ee,$,o))return;P={into:_,target:ee,position:$};let U=z.getBoundingClientRect().top;F.classList.toggle("fg-row-drop-inside",$==="inside"),F.style.top=`${$==="inside"?ne.top-U:V-U-1}px`,F.style.height=$==="inside"?`${ne.height}px`:"",z.append(F)},L=()=>{window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",L),n.classList.remove("fg-row-dragging"),F.remove(),P&&P.into.dropRow(R,P.target,P.position,o)};return window.addEventListener("pointermove",T),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",L),!0},h=k=>{let E=e.cellAt(k.target);if(!E)return;let I=k.clientX,R=k.clientY,F=()=>{clearTimeout(s),window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",F),window.removeEventListener("pointercancel",F),a===F&&(a=null)},P=T=>{Math.hypot(T.clientX-I,T.clientY-R)>8&&F()};clearTimeout(s),s=window.setTimeout(()=>{F(),o.contextMenu.enabled()&&(l=!0,N(E.colId)||(o.setFocus(E.rowIndex,E.colId),o.rangeContains(E.rowIndex,E.colId)||o.setRange({start:E,end:E})),o.contextMenu.open(I,R,E.rowIndex,E.colId))},550),a?.(),a=F,window.addEventListener("pointermove",P),window.addEventListener("pointerup",F),window.addEventListener("pointercancel",F)},b=k=>{if(i=k.pointerType||"mouse",i==="touch"){h(k);return}if(k.button===0&&f(k)||!o.rangesOn()||k.button!==0||k.shiftKey||k.target.closest("input, a, button"))return;let E=e.cellAt(k.target);if(!E||N(E.colId))return;let I=k.clientX,R=k.clientY,F=k.ctrlKey||k.metaKey,P=!1,T=B=>{if(!P&&Math.hypot(B.clientX-I,B.clientY-R)<Bs)return;let j=e.cellAt(mt(n,B.clientX,B.clientY));!j||N(j.colId)||(P||(P=!0,n.classList.add("fg-range-dragging"),F&&o.addRange({start:E,end:E}),o.setFocus(E.rowIndex,E.colId)),o.setRange({start:E,end:j},F))},L=()=>{window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",L),n.classList.remove("fg-range-dragging"),P&&(l=!0),a===L&&(a=null)};a?.(),a=L,window.addEventListener("pointermove",T),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",L)},C=k=>{if(k.target!==n&&k.target!==e.gridEl)return;let E=o.columns.displayed(),I=o.rowModel.getRowCount();if(!E.length||!I)return;if(ce(k)){y(k);return}if(w(k)){k.preventDefault();return}if(g(k)){k.preventDefault();return}let R=o.store.state.focus,F=k.ctrlKey||k.metaKey;if(k.key==="Escape"&&o.store.state.range){k.preventDefault(),o.setRange(null);return}if(F&&k.key.toLowerCase()==="a"&&o.rangesOn()){k.preventDefault(),o.selectAllCells();return}if(k.key==="ContextMenu"||k.key==="F10"&&k.shiftKey){k.preventDefault(),o.contextMenu.openAtFocus();return}if(k.key===" "&&R&&o.options.rowSelection){k.preventDefault(),o.selectFromClick(Math.min(R.rowIndex,I-1),!0,k.shiftKey);return}let P={rows:I,cols:E.length,pageRows:e.pageRows()},T=E.findIndex(z=>!N(z.id));if(o.rangesOn()&&k.shiftKey&&k.key!=="Tab"&&On.has(k.key)){let z=R??{rowIndex:0,colId:E[T].id},_=o.store.state.range,X=_?.end??z,J={rowIndex:Math.min(X.rowIndex,I-1),colIndex:Math.max(0,E.findIndex($=>$.id===X.colId))},ne=Bn(r(k),{ctrl:F,shift:!1},J,P);if(!ne)return;k.preventDefault();let ee=E[Math.max(T,ne.colIndex)].id;R||o.setFocus(z.rowIndex,z.colId),o.setRange({start:_?.start??z,end:{rowIndex:ne.rowIndex,colId:ee}}),e.ensureVisible(ne.rowIndex,ee);return}let B;if(!R)B=On.has(k.key)&&k.key!=="Tab"?{rowIndex:0,colIndex:0}:null;else{let z=Math.max(0,E.findIndex(_=>_.id===R.colId));B=Bn(r(k),{ctrl:F,shift:k.shiftKey},{rowIndex:Math.min(R.rowIndex,I-1),colIndex:z},P)}if(!B)return;k.preventDefault();let j=E[B.colIndex].id;o.setFocus(B.rowIndex,j),o.setRange(null),e.ensureVisible(B.rowIndex,j)},M=k=>k.target?.closest?.(".fg-editor, input, textarea, select, [contenteditable]"),v=k=>k.target?.closest?.(".fg-root")!==n,S=k=>{if(M(k)||v(k))return;let E=o.copyText(!1);!E||!k.clipboardData||(k.clipboardData.setData("text/plain",E),k.preventDefault())},A=k=>{if(M(k)||v(k))return;let E=o.copyText(!1);!E||!k.clipboardData||(k.clipboardData.setData("text/plain",E),k.preventDefault(),o.clearCells(!0))},D=k=>{if(M(k)||v(k))return;let E=k.clipboardData?.getData("text/plain");E&&(k.preventDefault(),o.pasteText(E))};return t.addEventListener("click",u),t.addEventListener("dblclick",p),t.addEventListener("pointerdown",b),n.addEventListener("keydown",C),n.addEventListener("copy",S),n.addEventListener("paste",D),n.addEventListener("cut",A),()=>{clearTimeout(s),a?.(),t.removeEventListener("click",u),t.removeEventListener("dblclick",p),t.removeEventListener("pointerdown",b),n.removeEventListener("keydown",C),n.removeEventListener("copy",S),n.removeEventListener("paste",D),n.removeEventListener("cut",A)}}var Kt=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"),i=x("span","fg-filters-title");i.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)}),r.append(i,s);let a=x("div","fg-filters-list");for(let l of e.columns.displayed()){if(N(l.id)||!de(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 p=e.menu.filterSection(l.id,()=>{});p&&d.append(p)};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 Gs=["sum","avg","min","max","count"],_t=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(),i=d=>{let c=r.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 p=x("div","fg-pivot-zone-title");p.textContent=c;let m=x("div","fg-pivot-chips"),g=d==="values"?this.draft.values.map(f=>f.colId):this.draft[d];g.forEach((f,h)=>{let b=x("span","fg-group-chip");b.dataset.col=f;let C=x("span","fg-group-chip-label");if(C.textContent=i(f),b.append(C),d==="values"){let v=x("select","fg-pivot-agg",{"aria-label":`${i(f)} ${t.pivotValues}`});for(let S of Gs){let A=x("option");A.value=S,A.textContent=t[S],v.append(A)}v.value=this.draft.values[h].aggFunc,v.addEventListener("change",()=>{this.draft.values[h].aggFunc=v.value,this.apply()}),b.append(v)}let M=x("button","fg-group-chip-remove",{type:"button","aria-label":`${t.ungroup}: ${i(f)}`});M.textContent="\xD7",M.addEventListener("click",()=>{d==="values"?this.draft.values.splice(h,1):this.draft[d].splice(h,1),this.apply()}),b.append(M),m.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 f of r){if(g.includes(f.id)||d==="values"&&f.def.type!=="number")continue;let h=x("option");h.value=f.id,h.textContent=i(f.id),y.append(h)}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(p,m,y),u};this.el.replaceChildren(s,l("rows",t.pivotRows),l("columns",t.pivotColumns),l("values",t.pivotValues))}};var zs=4,Xt=o=>!N(o.id)&&(o.children?o.children.some(Xt):o.def.chooser!==!1),no=o=>o.def.header??o.def.field??o.id,Jt=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,i=this.nodeOf(r);i&&this.setVisible(this.leavesOf(i),r.checked)}),this.list.addEventListener("click",n=>{let r=n.target.closest(".fg-chooser-caret"),i=r&&this.nodeOf(r);i&&(this.collapsed.has(i.id)?this.collapsed.delete(i.id):this.collapsed.add(i.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)!Xt(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 i=this.matchingLeaves(),s=i.filter(a=>!a.hide).length;this.allBox.checked=i.length>0&&s===i.length,this.allBox.indeterminate=s>0&&s<i.length}query(){return this.search.value.trim().toLowerCase()}subtreeMatches(e,t){for(let n=e;n;n=n.parent)if(no(n).toLowerCase().includes(t))return!0;return!!e.children&&e.children.some(n=>Xt(n)&&this.subtreeMatches(n,t))}leavesOf(e){return Xt(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 i=this.leavesOf(e),s=i.filter(d=>!d.hide).length,a=x("input","fg-checkbox",{type:"checkbox","aria-label":no(e)});a.checked=i.length>0&&s===i.length,a.indeterminate=s>0&&s<i.length,a.disabled=i.every(d=>d.def.lockVisible);let l=x("span","fg-chooser-label");if(l.textContent=no(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 i=new Set(this.grid.columns.siblings(r.id).map(m=>m.id).filter(m=>m!==r.id)),s=[...this.list.querySelectorAll(".fg-chooser-item")].filter(m=>i.has(m.dataset.col)),a=e.clientY,l=!1,d=-1,c=x("div","fg-chooser-marker"),u=m=>{if(!l){if(Math.abs(m.clientY-a)<zs||!s.length)return;l=!0,n.classList.add("fg-dragging"),this.list.append(c)}d=s.filter(w=>{let f=w.getBoundingClientRect();return m.clientY>f.top+f.height/2}).length;let g=this.list.getBoundingClientRect().top-this.list.scrollTop,y=d<s.length?s[d].getBoundingClientRect().top:s[s.length-1].getBoundingClientRect().bottom;c.style.top=`${y-g-1}px`},p=()=>{if(window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",p),c.remove(),n.classList.remove("fg-dragging"),!l||d<0)return;let m=this.grid.columns.siblings(r.id).map(w=>w.id).filter(w=>w!==r.id),g=d<s.length?m.indexOf(s[d].dataset.col):m.indexOf(s[s.length-1].dataset.col)+1;g=Math.max(m.filter(N).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",p)}},Yt=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 i=x("button","fg-chooser-close",{type:"button","aria-label":e.close});i.textContent="\xD7",i.addEventListener("click",()=>this.close()),n.append(r,i),this.panel=new Jt(this.grid),t.append(n,this.panel.el),ie(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=>{me(c,t)||this.close()},d=c=>{c.key==="Escape"&&(this.close(),this.grid.renderer.gridEl.focus())};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}},Zt=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 Jt(e),this.filters=new Kt(e),this.pivot=new _t(e);let r=n.filter(s=>s==="columns"||s==="filters"||s==="pivot");r.length||r.push("columns"),this.current=r[0];let i=x("div","fg-sidebar-tabs",{role:"tablist"});for(let s of r){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),i.append(a)}this.el.append(this.panelHost,i),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 Vs=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||""),Ye=o=>Vs()?`\u2318${o}`:`Ctrl+${o}`,Qt=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()}enabled(){return this.grid.options.contextMenu!==!1&&this.grid.allow("contextMenu")}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 s=r.dataset.col;if(!s||N(s)||r.classList.contains("fg-header-group"))return;e.preventDefault(),this.close(),t.menu.open(s,r);return}let i=t.renderer.cellAt(n);!i||!this.enabled()||(e.preventDefault(),t.renderer.gridEl.focus({preventScroll:!0}),!N(i.colId)&&!t.rangeContains(i.rowIndex,i.colId)&&(t.setFocus(i.rowIndex,i.colId),t.setRange({start:i,end:i})),this.open(e.clientX,e.clientY,i.rowIndex,i.colId))}openAtFocus(){let e=this.grid.store.state.focus;if(!e||!this.enabled())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),i=r?.def,s=!!i&&!N(e),a=t.store.state.selected.size?t.shownSelectedRows():[],l=[{label:n.copy,shortcut:Ye("C"),action:()=>t.copyToClipboard(!1)},{label:n.copyWithHeaders,action:()=>t.copyToClipboard(!0)},{label:n.cut,shortcut:Ye("X"),action:()=>t.cutToClipboard()},...a.length?[{label:n.copyRows,action:()=>t.copyToClipboard(!1,!0)}]:[],{label:n.paste,shortcut:Ye("V"),action:()=>this.pasteFromClipboard()}];(t.history.canUndo()||t.history.canRedo())&&l.push("separator",{label:n.undo,shortcut:Ye("Z"),action:()=>t.undo(),disabled:!t.history.canUndo()},{label:n.redo,shortcut:Ye("Y"),action:()=>t.redo(),disabled:!t.history.canRedo()}),t.options.rowSelection&&a.length&&l.push({label:n.deleteRows,action:()=>t.removeRows(a)}),s&&(l.push("separator",{label:n.autosizeThis,action:()=>t.autoSize([e])}),i.lockVisible||l.push({label:n.hideColumn,action:()=>t.setColumnsVisible([e],!1)}),l.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})),l.push("separator"),t.options.rowSelection==="multiple"&&l.push({label:n.selectAllRows,action:()=>t.api.selectAll()}),l.push({label:n.chooseColumns,action:()=>t.chooser.open()});let d=t.rangeBounds();return d&&(d.r2>d.r1||d.c2>d.c1)&&t.paid&&l.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"})}),l.push("separator",{label:n.exportCsv,action:()=>t.api.exportCsv()},...t.paid?[{label:n.exportExcel,action:()=>t.api.exportXlsx()}]:[],{label:n.exportJson,action:()=>t.api.exportJson()},...t.paid?[{label:n.exportPdf,action:()=>t.api.exportPdf()}]:[]),t.options.advancedFilter!==!1&&!t.options.pivot&&t.paid&&l.push("separator",{label:`${n.advancedFilter}\u2026`,action:()=>t.filterBuilder.open()}),l.push("separator",{label:n.print,action:()=>t.api.print()}),l}pasteFromClipboard(){let e=typeof navigator<"u"?navigator.clipboard:void 0,t=()=>this.grid.toast(this.grid.store.state.locale.pasteHint.replace("Ctrl+V",Ye("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:i}=this,s=i.rowModel.getRow(n),a=i.columns.getColumn(r),l=this.defaultItems(r),d={row:s?.data??null,rowIndex:n,colId:r,value:s&&a&&!N(r)?G(a.def,s.data):void 0,defaultItems:l},c=i.options.contextMenu,u=l;if(typeof c=="function")try{u=c(d)}catch{u=l}let p=i.store.state.locale,m=x("div",`fg-menu fg-context-menu fg-theme-${i.store.state.theme}`,{role:"menu","aria-label":p.columnMenu});i.applyFontTo(m);let g=!0;for(let M of u){if(M==="separator"){g||m.append(x("div","fg-cm-sep",{role:"separator"})),g=!0;continue}let v=x("button","fg-menu-item fg-cm-item",{type:"button",role:"menuitem"}),S=x("span","fg-cm-label");if(S.textContent=M.label,v.append(S),M.shortcut){let A=x("span","fg-cm-shortcut");A.textContent=M.shortcut,v.append(A)}v.disabled=!!M.disabled,v.addEventListener("click",()=>{this.close(),M.action()}),m.append(v),g=!1}m.lastElementChild?.classList.contains("fg-cm-sep")&&m.lastElementChild.remove(),ie(this.grid.renderer.root).append(m);let y=m.offsetWidth||220,w=m.offsetHeight||300;m.style.left=`${Math.max(4,Math.min(e,window.innerWidth-y-4))}px`;let f=Math.max(4,Math.min(t,window.innerHeight-w-4));m.style.top=`${f}px`,m.style.maxHeight=`${Math.max(120,window.innerHeight-f-8)}px`,this.popup=m;let h=M=>{me(M,m)||this.close()},b=M=>{if(M.key==="Escape"){this.close(),i.renderer.gridEl.focus();return}if(M.key!=="ArrowDown"&&M.key!=="ArrowUp")return;let v=[...m.querySelectorAll("button:not(:disabled)")],S=v.indexOf(jt(m));v[(S+(M.key==="ArrowDown"?1:v.length-1)+v.length)%v.length]?.focus(),M.preventDefault()},C=()=>this.close();document.addEventListener("pointerdown",h,!0),document.addEventListener("keydown",b,!0),i.renderer.scroller.addEventListener("scroll",C,{passive:!0}),this.off.push(()=>document.removeEventListener("pointerdown",h,!0),()=>document.removeEventListener("keydown",b,!0),()=>i.renderer.scroller.removeEventListener("scroll",C)),m.querySelector("button:not(:disabled)")?.focus()}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var en=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,i=n.renderer.root,s=l=>{let d=n.renderer.cellAt(mt(n.renderer.root,l.clientX,l.clientY)),c=d&&n.columns.getColumn(d.colId);if(!d||!c||N(c.id))return;let u=d.rowIndex>t.r2?d.rowIndex-t.r2:d.rowIndex<t.r1?d.rowIndex-t.r1:0,p=c.index>t.c2?c.index-t.c2:c.index<t.c1?c.index-t.c1:0;!u&&!p?r=null:Math.abs(u)>=Math.abs(p)?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",s),window.removeEventListener("pointerup",a),this.preview.remove(),i.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}})};i.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(){return this.grid.options.fillHandle!==!1&&this.grid.rangesOn()}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(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 i=this.grid.renderer.root.getBoundingClientRect(),s=r.getBoundingClientRect();this.handle.style.left=`${(this.grid.renderer.rtl?s.left:s.right)-i.left-4}px`,this.handle.style.top=`${s.bottom-i.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(),i=t.getBoundingClientRect(),s=n.getBoundingClientRect();Object.assign(this.preview.style,{left:`${i.left-r.left}px`,top:`${i.top-r.top}px`,width:`${s.right-i.left}px`,height:`${s.bottom-i.top}px`}),this.preview.isConnected||this.grid.renderer.root.append(this.preview)}destroy(){this.handle.remove(),this.preview.remove()}};var tn=1e4,nn=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 t=this.grid.rowModel.rows(),n=this.scanner();for(let r=0;r<t.length&&this.matches.length<tn;r++)n(r,this.matches);this.matches.length=Math.min(this.matches.length,tn),this.reindex(),this.matches.length&&this.go(0)}return this.updateCount(),this.grid.renderer.invalidate({rows:!0}),this.matches.length}scanner(){let{grid:e}=this,t=e.store.state.locale.code,n=e.columns.displayed().filter(s=>!N(s.id)),r=n.map(s=>Z(s.def,t)),i=e.rowModel.rows();return(s,a)=>{let l=i[s];if(!(!l||l.kind))for(let d=0;d<n.length;d++)r[d](G(n[d].def,l.data)).toLowerCase().includes(this.query)&&a.push({rowIndex:s,colId:n[d].id})}}reindex(){this.lookup.clear(),this.matches.forEach((e,t)=>this.lookup.set(`${e.rowIndex}|${e.colId}`,t))}refreshRows(e){if(!this.query)return;if(this.matches.length>=tn)return this.refresh();let{rowModel:t}=this.grid,n=new Set;for(let m of e){let g=t.indexOfId(m);g>=0&&n.add(g)}if(!n.size)return;let r=this.matches[this.index],i=this.scanner(),s=[];for(let m of n)i(m,s);let a=this.matches.length,l=this.matches.filter(m=>n.has(m.rowIndex)),d=m=>m.map(g=>`${g.rowIndex}|${g.colId}`).sort().join(",");if(d(l)===d(s))return;let c=new Map(this.grid.columns.displayed().map((m,g)=>[m.id,g]));this.matches=[...this.matches.filter(m=>!n.has(m.rowIndex)),...s].sort((m,g)=>m.rowIndex-g.rowIndex||(c.get(m.colId)??0)-(c.get(g.colId)??0)).slice(0,tn),this.reindex();let u=r?this.lookup.get(`${r.rowIndex}|${r.colId}`):void 0,p=this.index;u!==void 0?this.index=u:this.matches.length?this.index=Math.min(Math.max(this.index,0),this.matches.length-1):this.index=-1,(a!==this.matches.length||p!==this.index||u===void 0)&&this.updateCount(),this.grid.renderer.invalidate({rows:!0})}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||!this.grid.paid)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=(u,p,m)=>{let g=x("button","fg-findbar-btn",{type:"button","aria-label":u,title:u});return g.textContent=p,g.addEventListener("click",m),g};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",u=>{u.stopPropagation(),!ce(u)&&(u.key==="Escape"?(u.preventDefault(),this.closeBar()):u.key==="Enter"&&(u.preventDefault(),u.shiftKey?this.previous():this.next()))});let{root:i,headerEl:s,main:a}=this.grid.renderer;i.append(t);let l=i.getBoundingClientRect(),d=s.getBoundingClientRect(),c=a.getBoundingClientRect();d.height&&(t.style.top=`${Math.round(d.bottom-l.top)+6}px`),c.width&&(t.style.right=`${Math.max(0,Math.round(l.right-c.right))+18}px`),this.bar=t,n.focus()}relabel(){if(!this.bar)return;let e=this.grid.store.state.locale,t=this.bar.querySelector("input");t.placeholder=e.findPlaceholder,t.setAttribute("aria-label",e.findPlaceholder);let n=[e.findPrevious,e.findNext,e.close];this.bar.querySelectorAll(".fg-findbar-btn").forEach((r,i)=>{r.setAttribute("aria-label",n[i]),r.title=n[i]}),this.updateCount()}closeBar(){this.bar?.remove(),this.bar=null,this.countEl=null,this.clear(),this.grid.renderer.gridEl.focus({preventScroll:!0})}};var qs=864e5;function wt(o,e){if(!o.length||e<=0)return[];let t=()=>Array.from({length:e},(i,s)=>o[s%o.length]);if(o.every(i=>typeof i=="number"&&!Number.isNaN(i))){let i=o;if(i.length===1)return t();let s=i[1]-i[0];if(!i.every((l,d)=>d===0||Math.abs(l-i[d-1]-s)<1e-9))return t();let a=i[i.length-1];return Array.from({length:e},(l,d)=>Math.round((a+s*(d+1))*1e12)/1e12)}let n=o.map(i=>i instanceof Date||typeof i=="string"&&/^\d{4}-\d{2}-\d{2}/.test(i)?he(i):null);if(n.every(Boolean)&&o.length>=2){let i=n.map(a=>Math.round(a.getTime()/qs)),s=i[1]-i[0];if(i.every((a,l)=>l===0||a-i[l-1]===s)){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()+s*(c+1));return l?u:se(u)})}return t()}let r=o[o.length-1];if(typeof r=="string"&&!q(r)&&o.every(i=>typeof i=="string")){let i=/^(.*?)(\d+)$/.exec(r);if(i){let s=i[2].length,a=Number(i[2]);return Array.from({length:e},(l,d)=>`${i[1]}${String(a+d+1).padStart(s,"0")}`)}}return t()}function oo(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 Nr(o){return ro(o," ")}function ro(o,e){if(!o)return[];let t=[],n=[],r="",i=0,s=!1,a=!0;for(;i<o.length;){let l=o[i];if(s){if(l==='"'){if(o[i+1]==='"'){r+='"',i+=2;continue}s=!1,i++;continue}r+=l,i++;continue}if(l==='"'&&a){s=!0,a=!1,i++;continue}if(l===e){n.push(r),r="",a=!0,i++;continue}if(l==="\r"||l===`
3
+ `){n.push(r),t.push(n),n=[],r="",a=!0,i+=l==="\r"&&o[i+1]===`
4
+ `?2:1;continue}r+=l,a=!1,i++}return(r!==""||n.length||!a)&&(n.push(r),t.push(n)),t}function on(o,e,t){if(q(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 se(e)??String(e);case"boolean":return e===!0?"TRUE":e===!1?"FALSE":String(e);default:return Z(o,t)(e)}}var Ws=new Set(["true","1","y","yes","\uC608","o","on"]),js=new Set(["false","0","n","no","\uC544\uB2C8\uC624","x","off"]);function Us(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),Number.isFinite(r)?{ok:!0,value:Math.abs(r)<1e15?Math.round(r*1e12)/1e12:r}:{ok:!1}}function $r(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 Ks(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=$r(+r[1],+r[2],+r[3]):(r=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(t))?n=$r(+r[3],+r[1],+r[2]):/^\d{4}-\d{2}-\d{2}T/.test(t)&&(n=he(t)),n?{ok:!0,value:e instanceof Date?n:se(n)}:{ok:!1}}function rn(o,e,t){switch(o.type){case"number":return Us(e);case"date":return Ks(e,t);case"boolean":{let n=e.trim().toLowerCase();return n?Ws.has(n)?{ok:!0,value:!0}:js.has(n)?{ok:!0,value:!1}:{ok:!1}:{ok:!0,value:null}}default:return{ok:!0,value:e}}}var _s=o=>o.map(e=>e!==null&&typeof e=="object"&&"value"in e?e:{value:e,label:String(e),disabled:!1}),Be=o=>String(o).padStart(2,"0");function Xs(o){let e=o instanceof Date?o:typeof o=="string"&&o?new Date(o):null;return!e||Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Be(e.getMonth()+1)}-${Be(e.getDate())}T${Be(e.getHours())}:${Be(e.getMinutes())}`}function Js(o){if(o instanceof Date)return`${Be(o.getHours())}:${Be(o.getMinutes())}`;let e=typeof o=="string"?/(\d{1,2}):(\d{2})/.exec(o):null;return e?`${Be(Number(e[1]))}:${e[2]}`:""}var sn=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),i=n.columns.displayed().filter(a=>a.def.field&&!N(a.id));if(!e){let a=[];for(let l of i){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 s=i.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:s})}get active(){return this.cur&&{rowIndex:this.cur.rowIndex,colId:this.cur.colId}}canEdit(e,t){if(N(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&&this.grid.cellEditable(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:i}=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),i.ensureVisible(e,t),i.render();let c=x("div","fg-editor");this.place(c,e,t);let u,p,m=()=>{},g=a.editor;if(typeof g=="function"){let b=g({value:d,row:l,column:a,initialText:n});u=b.el,p=()=>({value:b.getValue()}),m=()=>b.destroy?.(),c.append(u),queueMicrotask(()=>b.focus?.())}else if(g?.type==="select"){let b=_s(typeof g.options=="function"?g.options(l):g.options),C=x("select","fg-editor-control");b.forEach((M,v)=>{let S=x("option");S.value=String(v),S.textContent=M.label??String(M.value),S.disabled=!!M.disabled,C.append(S)}),C.selectedIndex=Math.max(0,b.findIndex(M=>Object.is(M.value,d))),u=C,p=()=>({value:b[C.selectedIndex]?.value??null}),c.append(C)}else if(g?.type==="time"||g?.type==="datetime"||!g&&a.type==="date"&&a.format==="datetime"){let b=g?.type==="time",C=x("input","fg-editor-control",{type:b?"time":"datetime-local"});C.value=b?Js(d):Xs(d),u=C,p=()=>C.value?b?{value:C.value}:{value:d instanceof Date?new Date(C.value):C.value}:{value:null},c.append(C)}else{let C=g?.type==="textarea"?x("textarea","fg-editor-control"):x("input","fg-editor-control");C instanceof HTMLInputElement&&(C.type=a.type==="date"&&n===void 0?"date":"text",a.type==="number"&&(C.inputMode="decimal"));let M=a.type==="date"?se(d)??"":q(d)?"":String(d);C.value=n??M,u=C,p=()=>({text:C.value}),c.append(C)}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(),!ce(b))if(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"))},f=b=>{this.cur?.wrap===c&&!c.contains(b.relatedTarget)&&this.commit(null)},h=()=>this.commit(null);return c.addEventListener("keydown",w),c.addEventListener("focusout",f),i.scroller.addEventListener("scroll",h,{passive:!0}),i.root.append(c),this.cur={rowIndex:e,colId:t,row:l,def:a,wrap:c,read:p,dispose:()=>{c.removeEventListener("keydown",w),c.removeEventListener("focusout",f),i.scroller.removeEventListener("scroll",h),m(),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,i=r.root.querySelector(`.fg-row[data-row="${t}"] .fg-cell[data-col="${CSS.escape(n)}"]`),s=r.root.getBoundingClientRect(),a=i?.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||r.opts.rowHeight}px`,!!i}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,i=t.def.field,s=t.row[i],a=t.read(),l;if("text"in a&&t.def.formulas&&Ne(a.text.trim()))l=a.text.trim();else if("text"in a){let u=rn(t.def,a.text,s);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,i=r.rowModel.getRowCount();if(n==="down"||n==="up"){let c=Math.max(0,Math.min(i-1,e+(n==="down"?1:-1)));r.setFocus(c,t),r.renderer.ensureVisible(c,t);return}let s=r.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;for(d>=s.length&&(d=0,this.session||l++),d<0&&(d=s.length-1,this.session||l--);l!==e&&l>=0&&l<i&&r.rowModel.getRow(l)?.kind;)l+=a;l<0||l>=i||this.start(l,s[d].id)}};var an=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 Or=(o,e)=>o instanceof Date&&e instanceof Date?o.getTime()===e.getTime():Object.is(o,e),ln=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&&!Or(n[t],e[t])}diff(e,t){let n=this.originals.get(e);return n?t.filter(r=>!Or(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 yt(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 Br(o,e,t){return e>=o.r1&&e<=o.r2&&t>=o.c1&&t<=o.c2}var Ys=5;function Hr(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 Zs(o,e,t){let n=o.columns.getColumn(t);if(!n)return;let r=e.clientX,i=n.width;o.renderer.root.classList.add("fg-resizing"),Hr(s=>{o.columns.setWidth(t,i+(s.clientX-r)*(o.renderer.rtl?-1:1)),o.layoutChanged()},()=>{o.renderer.root.classList.remove("fg-resizing");let s=o.columns.getColumn(t)?.width??i;s!==i&&o.events.emit("columnResize",{colId:t,width:s})})}function Qs(o,e){let t=o.columns.getNode(e);return!!o.groupPanel&&!!t&&!t.children&&!o.options.treeData&&!o.getGroupBy().includes(e)}function ea(o,e,t,n){let r=new Set(o.columns.siblings(e).map(l=>l.id).filter(l=>l!==e&&!N(l))),i=[...n.querySelectorAll(".fg-header-cell")].filter(l=>r.has(l.dataset.col)).map(l=>({id:l.dataset.col,el:l})),s=x("div",`fg-drag-ghost fg-theme-${o.store.state.theme}`);s.textContent=t.querySelector(".fg-header-label")?.textContent??"",o.applyFontTo(s),ie(o.renderer.root).append(s);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:s,marker:a,cell:t,sibs:i,target:-1,overPanel:!1}}function ta(o,e,t,n,r){t.ghost.style.transform=`translate(${n+12}px, ${r+8}px)`,t.overPanel=Qs(o,e)&&!!o.groupPanel?.contains(n,r),o.groupPanel?.highlight(t.overPanel),t.marker.hidden=t.overPanel;let i=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)&&i++}t.target=i;let s=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=i<t.sibs.length?a(t.sibs[i].el):t.sibs.length?l(t.sibs[t.sibs.length-1].el):a(t.cell);t.marker.style.left=`${d-s-1}px`}function na(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),i=n.map(a=>a.id).filter(a=>a!==e),s=t.target<t.sibs.length?i.indexOf(t.sibs[t.target].id):i.indexOf(t.sibs[t.sibs.length-1].id)+1;s=Math.max(i.filter(N).length,s),s!==r&&(o.columns.move(e,s),o.layoutChanged(),o.events.emit("columnMove",{colId:e,toIndex:s}))}function oa(o,e,t,n){let r=o.columns.getNode(t),i=n.closest(".fg-header-pane");if(!r||!i)return;let s=e.clientX,a=null;Hr(l=>{if(!a){if(Math.abs(l.clientX-s)<Ys)return;a=ea(o,t,n,i)}ta(o,t,a,l.clientX,l.clientY)},l=>{a?na(o,t,a):!r.children&&De(r.def)&&o.toggleSort(t,l.shiftKey||l.ctrlKey||l.metaKey)})}function Gr(o){let e=o.renderer.headerEl,t=r=>{if(r.button!==0)return;let i=r.target,s=i.closest(".fg-header-cell"),a=s?.dataset.col;!s||!a||N(a)||i.closest(".fg-menu-btn")||i.closest("button, a, input, select, textarea, [data-fg-no-sort]")&&i.closest(".fg-header-label")||(r.preventDefault(),i.closest(".fg-resize")?Zs(o,r,a):oa(o,r,a,s))},n=r=>{let i=r.target,s=i.closest(".fg-menu-btn");if(s){let a=s.closest(".fg-header-cell")?.dataset.col;a&&o.menu.toggle(a,s);return}i.closest(".fg-select-all")&&o.toggleSelectAll()};return e.addEventListener("pointerdown",t),e.addEventListener("click",n),()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("click",n)}}var cn={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]},bt=96/25.4,zr=72/25.4,ra="system-ui, 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans CJK KR', sans-serif",ia=10.5,Ge=15,un=7,Ze=4,dn=8;function sa(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 fn={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=>sa(t.toDataURL("image/jpeg",r).split(",")[1]??"")}:null}},ze=(o,e=ia)=>`${o} ${e}px ${ra}`;function qr(o,e,t){if(!e)return[""];let n=[];for(let r of e.split(/\r?\n/)){let i="",s=r.match(/[ -鿿가-힯＀-￯]|[^\s -鿿가-힯＀-￯]+\s*|\s+/g)??[""];for(let a of s){let l=i+a;if(!i||o.measureText(l.trimEnd()).width<=t)if(!i&&o.measureText(a.trimEnd()).width>t)for(let d of a)i&&o.measureText(i+d).width>t&&(n.push(i),i=""),i+=d;else i=l;else n.push(i.trimEnd()),i=a.trimStart();if(n.length>=dn)break}if(n.push(i.trimEnd()),n.length>=dn)break}return n.length>dn&&(n.length=dn),n}function aa(o){let[e,t]=cn[o.paper]??cn.A4,[n,r]=o.orientation==="landscape"?[t,e]:[e,t],i=n*bt,s=r*bt,a=12*bt,l=14*bt,d=i-a*2,c=o.numbered?40:0,u=o.widths.slice(o.numbered?1:0),p=u.reduce((f,h)=>f+h,0)||1,m=o.fit?(d-c)/p:Math.min(1,(d-c)/p),g=[...o.numbered?[c]:[],...u.map(f=>f*m)],y=[],w=a;for(let f of g)y.push(w),w+=f;return{pageW:i,pageH:s,margin:a,marginBottom:l,colX:y,colW:g}}function Vr(o,e,t,n,r){let i={cells:[],kind:n,level:r,y:0,h:0},s=0,a=22;for(let l of t){let d=Math.max(1,l.span??1),c=e.colX[s]??e.margin,u=0;for(let g=s;g<s+d&&g<e.colW.length;g++)u+=e.colW[g];s+=d,o.font=ze(n==="group"?600:n==="total"||l.bold?700:400);let p=(l.indent??0)*14,m=qr(o,l.text,Math.max(8,u-un*2-p-(l.icon?14:0)));a=Math.max(a,m.length*Ge+Ze*2),i.cells.push({cell:l,x:c,w:u,y:0,h:0,lines:m})}return i.h=a,i}function la(o,e,t){let n=t.map(()=>({cells:[],kind:"head",y:0,h:22})),r=t.map(()=>e.colW.map(()=>!1)),i=[];o.font=ze(600),t.forEach((s,a)=>{let l=0;for(let d of s){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 p=0;for(let g=l;g<l+c&&g<e.colW.length;g++)p+=e.colW[g];let m=qr(o,d.text,Math.max(8,p-un*2));i.push({cell:d,r:a,col:l,span:c,rs:u,lines:m,x:e.colX[l]??e.margin,w:p}),l+=c}});for(let s of i){let l=(s.lines.length*Ge+Ze*2)/s.rs;for(let d=s.r;d<s.r+s.rs;d++)n[d].h=Math.max(n[d].h,l)}for(let s of i)n[s.r].cells.push({cell:s.cell,x:s.x,w:s.w,y:0,h:n.slice(s.r,s.r+s.rs).reduce((a,l)=>a+l.h,0),lines:s.lines});return n}function Wr(o){return!o.title&&!o.subtitle&&!o.printed?0:(o.title?24:12)+(o.subtitle?17:0)+18}function da(o,e){let t=aa(e),n=la(o,t,e.head),r=0,i=e.body.map(y=>{let w=Vr(o,t,y.cells,y.kind,y.level);return y.kind==="row"&&(w.odd=r++%2===1),w}),s=i.slice(0,e.repeatRows),a=i.slice(e.repeatRows),l=e.foot.map(y=>Vr(o,t,y.cells,y.kind,y.level)),d=t.pageH-t.marginBottom,c=Wr(e),u=[],p=[...a,...l],m=y=>({...y,cells:y.cells.map(w=>({...w}))}),g=0;do{let y=u.length===0,w={rows:[],title:y||e.repeatTitle},f=t.margin+(w.title?c:0),h=C=>{let M=m(C);M.y=f;for(let v of M.cells)v.y=f,M.kind!=="head"&&(v.h=M.h);w.rows.push(M),f+=M.h};(y||e.repeatHeader)&&n.forEach(h),s.forEach(h);let b=f;for(;g<p.length;){let C=p[g],M=C.kind==="group"&&g+1<p.length?C.h+p[g+1].h:C.h;if(f+M>d&&f>b)break;h(C),g++}u.push(w)}while(g<p.length&&u.length<5e3);return{pages:u,g:t}}function He(o,e,t,n,r,i,s){o.strokeStyle=i,o.lineWidth=s,o.beginPath(),o.moveTo(e,t),o.lineTo(n,r),o.stroke()}function ca(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,i=e.kind==="head"?"#f3f4f6":e.kind==="group"?e.level?"#eef2f7":"#e2e8f0":e.kind==="total"?"#f3f4f6":t.striped&&e.odd?"#f9fafb":"";for(let s of e.cells){let a=s.cell.fill||i;a&&(o.fillStyle=a,o.fillRect(s.x,s.y,s.w,s.h)),s.cell.bar&&(o.save(),o.globalAlpha=.4,o.fillStyle=s.cell.bar.color,o.fillRect(s.x+s.w*s.cell.bar.from,s.y+s.h*.15,s.w*(s.cell.bar.to-s.cell.bar.from),s.h*.7),o.restore());let l=e.kind==="head"||e.kind==="group"?600:e.kind==="total"?700:s.cell.bold?600:400;o.font=`${s.cell.italic?"italic ":""}${ze(l)}`,o.fillStyle=s.cell.num?"#9ca3af":s.cell.color||(e.kind==="head"?"#374151":"#111827"),o.textBaseline="middle",o.save(),o.beginPath(),o.rect(s.x,s.y,s.w,s.h),o.clip();let d=(s.cell.indent??0)*14,c=s.lines.length*Ge,u=e.kind==="head"?s.y+s.h-Ze-c+Ge/2:s.y+Ze+Ge/2;e.kind!=="head"&&s.h>c+Ze*2&&(u=s.y+Ze+Ge/2);for(let[p,m]of s.lines.entries()){let g=s.x+un+d,y=o.measureText(m).width+(s.cell.icon&&p===0?14:0),w=s.cell.group?"center":s.cell.align;if(w==="right"?g=s.x+s.w-un-y:w==="center"&&(g=s.x+(s.w-y)/2),o.textAlign="left",s.cell.icon&&p===0){let f=o.fillStyle;o.fillStyle=s.cell.icon.color,o.fillText(s.cell.icon.char,g,u),o.fillStyle=f,g+=14}o.fillText(m,g,u),s.cell.strike&&He(o,g,u,g+o.measureText(m).width,u,String(o.fillStyle),1),u+=Ge}o.restore(),e.kind==="head"&&s.x>n.margin+.5&&He(o,s.x,s.y,s.x,s.y+s.h,"#e5e7eb",1),e.kind==="head"&&He(o,s.x,s.y+s.h,s.x+s.w,s.y+s.h,"#9ca3af",1.5)}e.kind==="group"&&He(o,n.margin,e.y,r,e.y,"#cbd5e1",1),e.kind==="total"?He(o,n.margin,e.y,r,e.y,"#111827",1.5):e.kind!=="head"&&He(o,n.margin,e.y+e.h,r,e.y+e.h,"#e5e7eb",1)}function ua(o,e,t){let n=Wr(e);if(!n)return;let r=t.pageW-t.margin,i=t.margin;if(o.textAlign="left",o.textBaseline="top",e.title&&(o.font=ze(700,17),o.fillStyle="#111827",o.fillText(e.title,t.margin,i),i+=24),e.subtitle&&(o.font=ze(400,11),o.fillStyle="#4b5563",o.fillText(e.subtitle,t.margin,i),i+=17),e.printed){o.font=ze(400,9.5),o.fillStyle="#6b7280";let s=o.measureText(e.printed).width;o.fillText(e.printed,r-s,t.margin+n-18-13)}He(o,t.margin,t.margin+n-10,r,t.margin+n-10,"#111827",2)}function fa(o,e,t,n,r){let i=t.pageH-7*bt;if(o.font=ze(400,8.5),o.fillStyle="#6b7280",o.textBaseline="middle",o.textAlign="left",e.footer&&o.fillText(e.footer,t.margin,i),e.pageNumbers){let s=`${n+1} / ${r}`;o.fillText(s,t.pageW-t.margin-o.measureText(s).width,i)}}function io(o,e=fn,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,i=e.surface(8,8);if(!i)return null;let{pages:s,g:a}=da(i.ctx,o),l=Math.round(a.pageW*n),d=Math.round(a.pageH*n),c=[];s.forEach((y,w)=>{let f=e.surface(l,d);if(!f)return;let h=f.ctx;h.setTransform(n,0,0,n,0,0),h.fillStyle="#ffffff",h.fillRect(0,0,a.pageW,a.pageH),y.title&&ua(h,o,a);for(let b of y.rows)ca(h,b,o,a);fa(h,o,a,w,s.length),c.push(f.jpeg(r))});let[u,p]=cn[o.paper]??cn.A4,[m,g]=o.orientation==="landscape"?[p,u]:[u,p];return pa(c.map(y=>({jpeg:y,width:l,height:d})),m*zr,g*zr,o.title)}function ha(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 pa(o,e,t,n=""){let r=new TextEncoder,i=[],s=[],a=0,l=b=>{let C=typeof b=="string"?r.encode(b):b;i.push(C),a+=C.length},d=(b,C)=>{s[b]=a,l(`${b} 0 obj
5
5
  `),typeof C=="string"?l(C):C(),l(`
6
6
  endobj
7
7
  `)};l(`%PDF-1.4
8
- `),l(new Uint8Array([37,226,227,207,211,10]));let c=o.length,u=o.map((b,C)=>4+C*3),h=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 ${ga(n)}`:""} >>`),o.forEach((b,C)=>{let S=u[C],x=`q ${h} 0 0 ${p} 0 0 cm /Im0 Do Q`;d(S,`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${h} ${p}] /Resources << /XObject << /Im0 ${S+2} 0 R >> >> /Contents ${S+1} 0 R >>`),d(S+1,`<< /Length ${x.length} >>
8
+ `),l(new Uint8Array([37,226,227,207,211,10]));let c=o.length,u=o.map((b,C)=>4+C*3),p=e.toFixed(2),m=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 ${ha(n)}`:""} >>`),o.forEach((b,C)=>{let M=u[C],v=`q ${p} 0 0 ${m} 0 0 cm /Im0 Do Q`;d(M,`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${p} ${m}] /Resources << /XObject << /Im0 ${M+2} 0 R >> >> /Contents ${M+1} 0 R >>`),d(M+1,`<< /Length ${v.length} >>
9
9
  stream
10
- ${x}
11
- endstream`),d(S+2,()=>{l(`<< /Type /XObject /Subtype /Image /Width ${b.width} /Height ${b.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${b.jpeg.length} >>
10
+ ${v}
11
+ endstream`),d(M+2,()=>{l(`<< /Type /XObject /Subtype /Image /Width ${b.width} /Height ${b.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${b.jpeg.length} >>
12
12
  stream
13
13
  `),l(b.jpeg),l(`
14
14
  endstream`)})});let g=4+c*3,y=a,w=`xref
15
15
  0 ${g}
16
16
  0000000000 65535 f
17
- `;for(let b=1;b<g;b++)w+=`${String(i[b]??0).padStart(10,"0")} 00000 n
17
+ `;for(let b=1;b<g;b++)w+=`${String(s[b]??0).padStart(10,"0")} 00000 n
18
18
  `;l(`${w}trailer
19
19
  << /Size ${g} /Root 1 0 R /Info 3 0 R >>
20
20
  startxref
21
21
  ${y}
22
22
  %%EOF
23
- `);let f=new Uint8Array(a),m=0;for(let b of s)f.set(b,m),m+=b.length;return f}var wa=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;function un(o){if(typeof o=="number")return o;if(typeof o!="string"||!o)return NaN;let e=o.charCodeAt(0);return e>=48&&e<=57||e===43||e===45||e===46?wa.test(o)?Number(o):NaN:NaN}function io(o,e,t){if(typeof o=="number"&&typeof e=="number")return o-e;if(typeof o=="number"||typeof e=="number"){let n=un(o),r=un(e),s=!Number.isNaN(n),i=!Number.isNaN(r);if(s&&i)return n-r;if(s!==i)return s?-1:1}else if(typeof o=="string"&&typeof e=="string"){let n=un(o),r=un(e);if(!Number.isNaN(n)&&!Number.isNaN(r))return n-r;if(!Number.isNaN(n)||!Number.isNaN(r))return Number.isNaN(n)?1:-1}return 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 ya(o,e){if(V(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"?fe(e)?.getTime()??null:e}function yt(o,e,t){let n=V(o),r=V(e);return n||r?n===r?0:n?1:-1:io(o,e,t)}function fn(o,e,t,n){let r=V(o),s=V(e);return r||s?r===s?0:r?1:-1:io(o,e,t)*n}function Kr(o,e,t,n,r){let s=e.map(l=>({def:t(l.colId),mul:l.dir==="desc"?-1:1})).filter(l=>!!l.def);if(!s.length)return o;let i=s.map(l=>o.map(d=>{let c=G(l.def,d.data);return l.def.comparator?c:ya(l.def,c)})),a=o.map((l,d)=>d);return a.sort((l,d)=>{if(r&&r[l]!==r[d])return r[l]-r[d];for(let c=0;c<s.length;c++){let{def:u,mul:h}=s[c],p=i[c][l],g=i[c][d],y;if(u.comparator)try{y=(Number(u.comparator(p,g,o[l].data,o[d].data))||0)*h}catch{O(`comparator of column "${u.id??u.field}" threw; treating values as equal`),y=0}else{let w=V(p),f=V(g);y=w||f?w===f?0:w?1:-1:io(p,g,n)*h}if(y)return y}return l-d}),a.map(l=>o[l])}var ba=/^[=+\-@\t\r]/;function _r(o,e=","){let t=n=>{let r=n.value;return n.text&&ba.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 ao(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 lo(o,e=ao(o)){return ro(o.replace(/^\uFEFF/,""),e)}var va=(()=>{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 xa(o){let e=4294967295;for(let t=0;t<o.length;t++)e=va[(e^o[t])&255]^e>>>8;return(e^4294967295)>>>0}var Xr=new TextEncoder;function Jr(o){let e=o.map(c=>{let u=Xr.encode(c.name),h=typeof c.data=="string"?Xr.encode(c.data):c.data;return{name:u,data:h,crc:xa(h),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 pn=o=>o.length>4&&o[0]===80&&o[1]===75&&o[2]===3&&o[3]===4,Yr=o=>new Error(`Zip file is too large: it unpacks to more than ${o>=1048576?`${Math.round(o/1048576)} MB`:`${o} bytes`}`);async function Ca(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(()=>{}),Yr(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 Zr(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 h=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),f=r.getUint32(a+42,!0),m=l.decode(o.subarray(a+46,a+46+g)),b=r.getUint16(f+26,!0),C=r.getUint16(f+28,!0),S=f+30+b+C,x=o.subarray(S,S+p),R;if(h===0)R=x;else if(h===8)R=await Ca(x,t-c);else throw new Error(`Unsupported zip compression ${h}`);if(c+=R.length,c>t)throw Yr(t);d.set(m,R),a+=46+g+y+w}return d}function co(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 Qr=Date.UTC(1899,11,30),es=864e5;function ka(o){return(Date.UTC(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds(),o.getMilliseconds())-Qr)/es}function Ra(o){let e=new Date(Math.round(o*es)+Qr);return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())}var Sa=/[\u0000-\u0008\u000b\u000c\u000e-\u001f￾￿]/g,hn=o=>o.replace(Sa,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ye=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
25
- `,uo="http://schemas.openxmlformats.org/spreadsheetml/2006/main",Ze="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Ma(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,31-` (${i})`.length)} (${i})`;return e.add(s.toLowerCase()),s})}function Qe(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=f=>f&&/^[0-9a-f]{8}$/i.test(f)?f.toUpperCase():f&&/^[0-9a-f]{6}$/i.test(f)?`FF${f.toUpperCase()}`:"",c=(f,m)=>{let b=`${f?1:0}|${m}`,C=i.get(b);return C===void 0&&(C=s.length,s.push(`<font>${f?"<b/>":""}<sz val="11"/>${m?`<color rgb="${m}"/>`:""}<name val="Calibri"/></font>`),i.set(b,C)),C},u=f=>{if(!f)return 0;let m=l.get(f);return m===void 0&&(m=a.length,a.push(`<fill><patternFill patternType="solid"><fgColor rgb="${f}"/><bgColor indexed="64"/></patternFill></fill>`),l.set(f,m)),m},h=(f,m)=>{let b=d(m.color),C=m.header?"FFF2F4F7":d(m.fill),S=!!(m.bold||m.header),x=m.align==="left"||m.align==="center"||m.align==="right"?m.align:"",R=`${f}|${S?1:""}|${b}|${C}|${x}`,A=r.get(R);if(A!==void 0)return A;let k=e.get(f);k===void 0&&(k=164+t.length,t.push(f),e.set(f,k));let E=c(S,b),T=u(C),L=`numFmtId="${k}" fontId="${E}" fillId="${T}" borderId="0" xfId="0"`+(k?' applyNumberFormat="1"':"")+(E?' applyFont="1"':"")+(T?' applyFill="1"':"")+(x?' applyAlignment="1"':"");return A=n.length,n.push(x?`<xf ${L}><alignment horizontal="${x}"/></xf>`:`<xf ${L}/>`),r.set(R,A),A},p=Ma(o),g=o.map(f=>{let m=f.rows.map((E,T)=>{let L=E.map((M,D)=>{let I=M!==null&&typeof M=="object"&&!(M instanceof Date)?M:{v:M},P=`${co(D)}${T+1}`,F=I.v,B=I.fmt??"General";F instanceof Date&&(Number.isNaN(F.getTime())?F=null:(B==="General"&&(B="yyyy-mm-dd"),F=ka(F)));let z=h(B,I),j=z?` s="${z}"`:"";return F==null||F===""?j?`<c r="${P}"${j}/>`:"":typeof F=="number"?Number.isFinite(F)?`<c r="${P}"${j}><v>${F}</v></c>`:"":typeof F=="boolean"?`<c r="${P}"${j} t="b"><v>${F?1:0}</v></c>`:`<c r="${P}"${j} t="inlineStr"><is><t xml:space="preserve">${hn(String(F))}</t></is></c>`}).join("");return`<row r="${T+1}">${L}</row>`}).join(""),b=Math.max(0,...f.rows.map(E=>E.length)),C=f.freezeRows??0,S=C?`<sheetViews><sheetView workbookViewId="0"><pane ySplit="${C}" topLeftCell="A${C+1}" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>`:'<sheetViews><sheetView workbookViewId="0"/></sheetViews>',x=f.widths?.length?`<cols>${f.widths.map((E,T)=>`<col min="${T+1}" max="${T+1}" width="${Math.max(4,Math.min(120,E)).toFixed(1)}" customWidth="1"/>`).join("")}</cols>`:"",R=f.autoFilter&&b&&C&&f.rows.length>=C?`<autoFilter ref="A${C}:${co(b-1)}${f.rows.length}"/>`:"",A=(f.merges??[]).filter(E=>typeof E=="string"&&/^[A-Z]{1,3}\d{1,7}:[A-Z]{1,3}\d{1,7}$/.test(E)),k=A.length?`<mergeCells count="${A.length}">${A.map(E=>`<mergeCell ref="${E}"/>`).join("")}</mergeCells>`:"";return`${Ye}<worksheet xmlns="${uo}" xmlns:r="${Ze}">${S}<sheetFormatPr defaultRowHeight="15"/>${x}<sheetData>${m}</sheetData>${R}${k}</worksheet>`}),y=`${Ye}<styleSheet xmlns="${uo}">`+(t.length?`<numFmts count="${t.length}">${t.map((f,m)=>`<numFmt numFmtId="${164+m}" formatCode="${hn(f)}"/>`).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:`${Ye}<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((f,m)=>`<Override PartName="/xl/worksheets/sheet${m+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")+"</Types>"},{name:"_rels/.rels",data:`${Ye}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${Ze}/officeDocument" Target="xl/workbook.xml"/></Relationships>`},{name:"xl/workbook.xml",data:`${Ye}<workbook xmlns="${uo}" xmlns:r="${Ze}"><sheets>`+p.map((f,m)=>`<sheet name="${hn(f)}" sheetId="${m+1}" r:id="rId${m+1}"/>`).join("")+"</sheets>"+(o.some(f=>f.autoFilter&&f.freezeRows||f.printTitleRows)?`<definedNames>${o.map((f,m)=>{let b=Math.max(0,...f.rows.map(A=>A.length)),C=`'${hn(p[m].replace(/'/g,"''"))}'`,S=f.autoFilter&&f.freezeRows&&b?`<definedName name="_xlnm._FilterDatabase" localSheetId="${m}" hidden="1">${C}!$A$${f.freezeRows}:$${co(b-1)}$${f.rows.length}</definedName>`:"",x=Math.min(f.printTitleRows??0,f.rows.length),R=x>0&&Number.isInteger(x)?`<definedName name="_xlnm.Print_Titles" localSheetId="${m}">${C}!$1:$${x}</definedName>`:"";return S+R}).join("")}</definedNames>`:"")+"</workbook>"},{name:"xl/_rels/workbook.xml.rels",data:`${Ye}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`+o.map((f,m)=>`<Relationship Id="rId${m+1}" Type="${Ze}/worksheet" Target="worksheets/sheet${m+1}.xml"/>`).join("")+`<Relationship Id="rId${o.length+1}" Type="${Ze}/styles" Target="styles.xml"/></Relationships>`},{name:"xl/styles.xml",data:y},...g.map((f,m)=>({name:`xl/worksheets/sheet${m+1}.xml`,data:f}))];return Jr(w)}var Ea=new Set([14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57]);function Aa(o){let e=o.replace(/"[^"]*"/g,"").replace(/\[[^\]]*\]/g,"").replace(/\\./g,"");return/[dmyhs]/i.test(e)&&!/^[#0.,%\s]*$/.test(e)}function bt(o){return o?new DOMParser().parseFromString(new TextDecoder().decode(o),"application/xml"):null}var we=(o,e)=>[...o.getElementsByTagNameNS("*",e)];function Ta(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 Pa=1048576,La=16384;async function fo(o){let e=o instanceof Uint8Array?o:new Uint8Array(o);if(!pn(e))throw new Error("Not an xlsx file");let t=await Zr(e),n=bt(t.get("xl/workbook.xml"));if(!n)throw new Error("xlsx has no workbook");let r=bt(t.get("xl/_rels/workbook.xml.rels")),s=new Map(r?we(r,"Relationship").map(p=>[p.getAttribute("Id")??"",p.getAttribute("Target")??""]):[]),i=bt(t.get("xl/sharedStrings.xml")),a=i?we(i,"si").map(p=>we(p,"t").map(g=>g.textContent??"").join("")):[],l=bt(t.get("xl/styles.xml")),d=new Map(l?we(l,"numFmt").map(p=>[Number(p.getAttribute("numFmtId")),p.getAttribute("formatCode")??""]):[]),c=l?we(l,"cellXfs")[0]:void 0,u=(c?[...c.children].filter(p=>p.localName==="xf"):[]).map(p=>{let g=Number(p.getAttribute("numFmtId")??0);return Ea.has(g)||d.has(g)&&Aa(d.get(g))}),h=[];for(let p of we(n,"sheet")){let g=p.getAttribute("r:id")??p.getAttributeNS(Ze,"id")??"",y=s.get(g)??"";y=y.startsWith("/")?y.slice(1):`xl/${y}`;let w=bt(t.get(y)),f=[];if(w){for(let m of we(w,"row")){let b=Number(m.getAttribute("r")??f.length+1)-1;if(!Number.isInteger(b)||b<0||b>=Pa)continue;let C=[],S=0;for(let x of[...m.children].filter(R=>R.localName==="c")){let R=x.getAttribute("r"),A=R?Ta(R):S;if(A<0||A>=La)continue;S=A+1;let k=x.getAttribute("t"),E=we(x,"v")[0]?.textContent??null,T=null;if(k==="s")T=E===null?null:a[Number(E)]??"";else if(k==="inlineStr")T=we(x,"t").map(L=>L.textContent??"").join("");else if(k==="b")T=E==="1";else if(k==="str"||k==="e")T=E;else if(E!==null&&E!==""){let L=Number(E);T=u[Number(x.getAttribute("s")??0)]?Ra(L):L}C[A]=T}for(let x=0;x<C.length;x++)C[x]===void 0&&(C[x]=null);f[b]=C}for(let m=0;m<f.length;m++)f[m]||(f[m]=[])}h.push({name:p.getAttribute("name")??`Sheet${h.length+1}`,rows:f})}return h}function yn(o,e){return Array.isArray(e)?e.flatMap(t=>{let n=o.columns.getNode(t);return!n||n.children||$(t)?(O(`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 bn(o,e){return e==="selected"?o.shownSelectedRows():e==="all"?o.rowModel.server?o.rowModel.dataRows().map(t=>t.data):o.viewRows():o.orderedDataRows().map(t=>t.data)}var Ge=(o,e)=>o.header??o.field??e,Ia=["left","center","right"],Fa=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i,ye=o=>String(o??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e]),Da=["A4","A3","A5","B4","B5","letter","legal"],$a=760,Na=o=>`"${o.replace(/[\\"<\n\r]/g,e=>e===`
26
- `?"\\A ":e==="\r"?"":`\\${e.charCodeAt(0).toString(16)} `)}"`,ts=o=>o?`#${o.slice(2)}`:"";function Oa(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 h=new Map;for(let g of l){let y=G(u,g),w=V(y)?"":te(y),f=h.get(w);f||h.set(w,f={value:y,rows:[]}),f.rows.push(g)}let p=s.find(g=>g.colId===c)?.dir==="desc"?-1:1;for(let g of[...h.values()].sort((y,w)=>fn(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 Ba=`
23
+ `);let f=new Uint8Array(a),h=0;for(let b of i)f.set(b,h),h+=b.length;return f}var ga=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;function hn(o){if(typeof o=="number")return o;if(typeof o!="string"||!o)return NaN;let e=o.charCodeAt(0);return e>=48&&e<=57||e===43||e===45||e===46?ga.test(o)?Number(o):NaN:NaN}function so(o,e,t){if(typeof o=="number"&&typeof e=="number")return o-e;if(typeof o=="number"||typeof e=="number"){let n=hn(o),r=hn(e),i=!Number.isNaN(n),s=!Number.isNaN(r);if(i&&s)return n-r;if(i!==s)return i?-1:1}else if(typeof o=="string"&&typeof e=="string"){let n=hn(o),r=hn(e);if(!Number.isNaN(n)&&!Number.isNaN(r))return n-r;if(!Number.isNaN(n)||!Number.isNaN(r))return Number.isNaN(n)?1:-1}return 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 ma(o,e){if(q(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"?he(e)?.getTime()??null:e}function vt(o,e,t){let n=q(o),r=q(e);return n||r?n===r?0:n?1:-1:so(o,e,t)}function pn(o,e,t,n){let r=q(o),i=q(e);return r||i?r===i?0:r?1:-1:so(o,e,t)*n}function jr(o,e,t,n,r){let i=e.map(l=>({def:t(l.colId),mul:l.dir==="desc"?-1:1})).filter(l=>!!l.def);if(!i.length)return o;let s=i.map(l=>o.map(d=>{let c=G(l.def,d.data);return l.def.comparator?c:ma(l.def,c)})),a=o.map((l,d)=>d);return a.sort((l,d)=>{if(r&&r[l]!==r[d])return r[l]-r[d];for(let c=0;c<i.length;c++){let{def:u,mul:p}=i[c],m=s[c][l],g=s[c][d],y;if(u.comparator)try{y=(Number(u.comparator(m,g,o[l].data,o[d].data))||0)*p}catch{O(`comparator of column "${u.id??u.field}" threw; treating values as equal`),y=0}else{let w=q(m),f=q(g);y=w||f?w===f?0:w?1:-1:so(m,g,n)*p}if(y)return y}return l-d}),a.map(l=>o[l])}var wa=/^[=+\-@\t\r]/;function Ur(o,e=","){let t=n=>{let r=n.value;return n.text&&wa.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 ao(o){let e=o.slice(0,o.search(/\r?\n|$/)),t=s=>e.split(s).length-1,n=t(" "),r=t(";"),i=t(",");return n&&n>=i&&n>=r?" ":r>i?";":","}function lo(o,e=ao(o)){return ro(o.replace(/^\uFEFF/,""),e)}var ya=(()=>{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 ba(o){let e=4294967295;for(let t=0;t<o.length;t++)e=ya[(e^o[t])&255]^e>>>8;return(e^4294967295)>>>0}var Kr=new TextEncoder;function _r(o){let e=o.map(c=>{let u=Kr.encode(c.name),p=typeof c.data=="string"?Kr.encode(c.data):c.data;return{name:u,data:p,crc:ba(p),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),i=new DataView(r.buffer),s=0,a=0,l=33;for(let c of e)c.offset=s,i.setUint32(s,67324752,!0),i.setUint16(s+4,20,!0),i.setUint16(s+6,2048,!0),i.setUint16(s+8,0,!0),i.setUint16(s+10,a,!0),i.setUint16(s+12,l,!0),i.setUint32(s+14,c.crc,!0),i.setUint32(s+18,c.data.length,!0),i.setUint32(s+22,c.data.length,!0),i.setUint16(s+26,c.name.length,!0),i.setUint16(s+28,0,!0),r.set(c.name,s+30),r.set(c.data,s+30+c.name.length),s+=30+c.name.length+c.data.length;let d=s;for(let c of e)i.setUint32(s,33639248,!0),i.setUint16(s+4,20,!0),i.setUint16(s+6,20,!0),i.setUint16(s+8,2048,!0),i.setUint16(s+10,0,!0),i.setUint16(s+12,a,!0),i.setUint16(s+14,l,!0),i.setUint32(s+16,c.crc,!0),i.setUint32(s+20,c.data.length,!0),i.setUint32(s+24,c.data.length,!0),i.setUint16(s+28,c.name.length,!0),i.setUint16(s+30,0,!0),i.setUint16(s+32,0,!0),i.setUint16(s+34,0,!0),i.setUint16(s+36,0,!0),i.setUint32(s+38,0,!0),i.setUint32(s+42,c.offset,!0),r.set(c.name,s+46),s+=46+c.name.length;return i.setUint32(s,101010256,!0),i.setUint16(s+8,e.length,!0),i.setUint16(s+10,e.length,!0),i.setUint32(s+12,s-d,!0),i.setUint32(s+16,d,!0),r}var gn=o=>o.length>4&&o[0]===80&&o[1]===75&&o[2]===3&&o[3]===4,Xr=o=>new Error(`Zip file is too large: it unpacks to more than ${o>=1048576?`${Math.round(o/1048576)} MB`:`${o} bytes`}`);async function va(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=[],i=0;for(;;){let{done:l,value:d}=await n.read();if(l)break;if(i+=d.length,i>e)throw await n.cancel().catch(()=>{}),Xr(e);r.push(d)}let s=new Uint8Array(i),a=0;for(let l of r)s.set(l,a),a+=l.length;return s}async function Jr(o,e={}){let t=e.maxBytes??209715200,n=e.maxEntries??1e4,r=new DataView(o.buffer,o.byteOffset,o.byteLength),i=-1;for(let u=o.length-22;u>=Math.max(0,o.length-65557);u--)if(r.getUint32(u,!0)===101010256){i=u;break}if(i<0)throw new Error("Not a zip file");let s=r.getUint16(i+10,!0);if(s>n)throw new Error(`Zip file has too many entries (${s}, at most ${n})`);let a=r.getUint32(i+16,!0),l=new TextDecoder,d=new Map,c=0;for(let u=0;u<s;u++){if(r.getUint32(a,!0)!==33639248)throw new Error("Broken zip directory");let p=r.getUint16(a+10,!0),m=r.getUint32(a+20,!0),g=r.getUint16(a+28,!0),y=r.getUint16(a+30,!0),w=r.getUint16(a+32,!0),f=r.getUint32(a+42,!0),h=l.decode(o.subarray(a+46,a+46+g)),b=r.getUint16(f+26,!0),C=r.getUint16(f+28,!0),M=f+30+b+C,v=o.subarray(M,M+m),S;if(p===0)S=v;else if(p===8)S=await va(v,t-c);else throw new Error(`Unsupported zip compression ${p}`);if(c+=S.length,c>t)throw Xr(t);d.set(h,S),a+=46+g+y+w}return d}function co(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 Yr=Date.UTC(1899,11,30),Zr=864e5;function xa(o){return(Date.UTC(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds(),o.getMilliseconds())-Yr)/Zr}function Ca(o){let e=new Date(Math.round(o*Zr)+Yr);return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())}var Ra=/[\u0000-\u0008\u000b\u000c\u000e-\u001f￾￿]/g,mn=o=>o.replace(Ra,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Qe=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
25
+ `,uo="http://schemas.openxmlformats.org/spreadsheetml/2006/main",et="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function ka(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}`,i=r;for(let s=2;e.has(i.toLowerCase());s++)i=`${r.slice(0,31-` (${s})`.length)} (${s})`;return e.add(i.toLowerCase()),i})}function tt(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]]),i=['<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=f=>f&&/^[0-9a-f]{8}$/i.test(f)?f.toUpperCase():f&&/^[0-9a-f]{6}$/i.test(f)?`FF${f.toUpperCase()}`:"",c=(f,h)=>{let b=`${f?1:0}|${h}`,C=s.get(b);return C===void 0&&(C=i.length,i.push(`<font>${f?"<b/>":""}<sz val="11"/>${h?`<color rgb="${h}"/>`:""}<name val="Calibri"/></font>`),s.set(b,C)),C},u=f=>{if(!f)return 0;let h=l.get(f);return h===void 0&&(h=a.length,a.push(`<fill><patternFill patternType="solid"><fgColor rgb="${f}"/><bgColor indexed="64"/></patternFill></fill>`),l.set(f,h)),h},p=(f,h)=>{let b=d(h.color),C=h.header?"FFF2F4F7":d(h.fill),M=!!(h.bold||h.header),v=h.align==="left"||h.align==="center"||h.align==="right"?h.align:"",S=`${f}|${M?1:""}|${b}|${C}|${v}`,A=r.get(S);if(A!==void 0)return A;let D=e.get(f);D===void 0&&(D=164+t.length,t.push(f),e.set(f,D));let k=c(M,b),E=u(C),I=`numFmtId="${D}" fontId="${k}" fillId="${E}" borderId="0" xfId="0"`+(D?' applyNumberFormat="1"':"")+(k?' applyFont="1"':"")+(E?' applyFill="1"':"")+(v?' applyAlignment="1"':"");return A=n.length,n.push(v?`<xf ${I}><alignment horizontal="${v}"/></xf>`:`<xf ${I}/>`),r.set(S,A),A},m=ka(o),g=o.map(f=>{let h=f.rows.map((k,E)=>{let I=k.map((R,F)=>{let P=R!==null&&typeof R=="object"&&!(R instanceof Date)?R:{v:R},T=`${co(F)}${E+1}`,L=P.v,B=P.fmt??"General";L instanceof Date&&(Number.isNaN(L.getTime())?L=null:(B==="General"&&(B="yyyy-mm-dd"),L=xa(L)));let j=p(B,P),z=j?` s="${j}"`:"";return L==null||L===""?z?`<c r="${T}"${z}/>`:"":typeof L=="number"?Number.isFinite(L)?`<c r="${T}"${z}><v>${L}</v></c>`:"":typeof L=="boolean"?`<c r="${T}"${z} t="b"><v>${L?1:0}</v></c>`:`<c r="${T}"${z} t="inlineStr"><is><t xml:space="preserve">${mn(String(L))}</t></is></c>`}).join("");return`<row r="${E+1}">${I}</row>`}).join(""),b=Math.max(0,...f.rows.map(k=>k.length)),C=f.freezeRows??0,M=C?`<sheetViews><sheetView workbookViewId="0"><pane ySplit="${C}" topLeftCell="A${C+1}" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>`:'<sheetViews><sheetView workbookViewId="0"/></sheetViews>',v=f.widths?.length?`<cols>${f.widths.map((k,E)=>`<col min="${E+1}" max="${E+1}" width="${Math.max(4,Math.min(120,k)).toFixed(1)}" customWidth="1"/>`).join("")}</cols>`:"",S=f.autoFilter&&b&&C&&f.rows.length>=C?`<autoFilter ref="A${C}:${co(b-1)}${f.rows.length}"/>`:"",A=(f.merges??[]).filter(k=>typeof k=="string"&&/^[A-Z]{1,3}\d{1,7}:[A-Z]{1,3}\d{1,7}$/.test(k)),D=A.length?`<mergeCells count="${A.length}">${A.map(k=>`<mergeCell ref="${k}"/>`).join("")}</mergeCells>`:"";return`${Qe}<worksheet xmlns="${uo}" xmlns:r="${et}">${M}<sheetFormatPr defaultRowHeight="15"/>${v}<sheetData>${h}</sheetData>${S}${D}</worksheet>`}),y=`${Qe}<styleSheet xmlns="${uo}">`+(t.length?`<numFmts count="${t.length}">${t.map((f,h)=>`<numFmt numFmtId="${164+h}" formatCode="${mn(f)}"/>`).join("")}</numFmts>`:"")+`<fonts count="${i.length}">${i.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:`${Qe}<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((f,h)=>`<Override PartName="/xl/worksheets/sheet${h+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")+"</Types>"},{name:"_rels/.rels",data:`${Qe}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${et}/officeDocument" Target="xl/workbook.xml"/></Relationships>`},{name:"xl/workbook.xml",data:`${Qe}<workbook xmlns="${uo}" xmlns:r="${et}"><sheets>`+m.map((f,h)=>`<sheet name="${mn(f)}" sheetId="${h+1}" r:id="rId${h+1}"/>`).join("")+"</sheets>"+(o.some(f=>f.autoFilter&&f.freezeRows||f.printTitleRows)?`<definedNames>${o.map((f,h)=>{let b=Math.max(0,...f.rows.map(A=>A.length)),C=`'${mn(m[h].replace(/'/g,"''"))}'`,M=f.autoFilter&&f.freezeRows&&b?`<definedName name="_xlnm._FilterDatabase" localSheetId="${h}" hidden="1">${C}!$A$${f.freezeRows}:$${co(b-1)}$${f.rows.length}</definedName>`:"",v=Math.min(f.printTitleRows??0,f.rows.length),S=v>0&&Number.isInteger(v)?`<definedName name="_xlnm.Print_Titles" localSheetId="${h}">${C}!$1:$${v}</definedName>`:"";return M+S}).join("")}</definedNames>`:"")+"</workbook>"},{name:"xl/_rels/workbook.xml.rels",data:`${Qe}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`+o.map((f,h)=>`<Relationship Id="rId${h+1}" Type="${et}/worksheet" Target="worksheets/sheet${h+1}.xml"/>`).join("")+`<Relationship Id="rId${o.length+1}" Type="${et}/styles" Target="styles.xml"/></Relationships>`},{name:"xl/styles.xml",data:y},...g.map((f,h)=>({name:`xl/worksheets/sheet${h+1}.xml`,data:f}))];return _r(w)}var Sa=new Set([14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57]);function Ma(o){let e=o.replace(/"[^"]*"/g,"").replace(/\[[^\]]*\]/g,"").replace(/\\./g,"");return/[dmyhs]/i.test(e)&&!/^[#0.,%\s]*$/.test(e)}function xt(o){return o?new DOMParser().parseFromString(new TextDecoder().decode(o),"application/xml"):null}var be=(o,e)=>[...o.getElementsByTagNameNS("*",e)];function Ea(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 Aa=1048576,Ta=16384;async function fo(o){let e=o instanceof Uint8Array?o:new Uint8Array(o);if(!gn(e))throw new Error("Not an xlsx file");let t=await Jr(e),n=xt(t.get("xl/workbook.xml"));if(!n)throw new Error("xlsx has no workbook");let r=xt(t.get("xl/_rels/workbook.xml.rels")),i=new Map(r?be(r,"Relationship").map(m=>[m.getAttribute("Id")??"",m.getAttribute("Target")??""]):[]),s=xt(t.get("xl/sharedStrings.xml")),a=s?be(s,"si").map(m=>be(m,"t").map(g=>g.textContent??"").join("")):[],l=xt(t.get("xl/styles.xml")),d=new Map(l?be(l,"numFmt").map(m=>[Number(m.getAttribute("numFmtId")),m.getAttribute("formatCode")??""]):[]),c=l?be(l,"cellXfs")[0]:void 0,u=(c?[...c.children].filter(m=>m.localName==="xf"):[]).map(m=>{let g=Number(m.getAttribute("numFmtId")??0);return Sa.has(g)||d.has(g)&&Ma(d.get(g))}),p=[];for(let m of be(n,"sheet")){let g=m.getAttribute("r:id")??m.getAttributeNS(et,"id")??"",y=i.get(g)??"";y=y.startsWith("/")?y.slice(1):`xl/${y}`;let w=xt(t.get(y)),f=[];if(w){for(let h of be(w,"row")){let b=Number(h.getAttribute("r")??f.length+1)-1;if(!Number.isInteger(b)||b<0||b>=Aa)continue;let C=[],M=0;for(let v of[...h.children].filter(S=>S.localName==="c")){let S=v.getAttribute("r"),A=S?Ea(S):M;if(A<0||A>=Ta)continue;M=A+1;let D=v.getAttribute("t"),k=be(v,"v")[0]?.textContent??null,E=null;if(D==="s")E=k===null?null:a[Number(k)]??"";else if(D==="inlineStr")E=be(v,"t").map(I=>I.textContent??"").join("");else if(D==="b")E=k==="1";else if(D==="str"||D==="e")E=k;else if(k!==null&&k!==""){let I=Number(k);E=u[Number(v.getAttribute("s")??0)]?Ca(I):I}C[A]=E}for(let v=0;v<C.length;v++)C[v]===void 0&&(C[v]=null);f[b]=C}for(let h=0;h<f.length;h++)f[h]||(f[h]=[])}p.push({name:m.getAttribute("name")??`Sheet${p.length+1}`,rows:f})}return p}function vn(o,e){return Array.isArray(e)?e.flatMap(t=>{let n=o.columns.getNode(t);return!n||n.children||N(t)?(O(`export: unknown column "${t}"`),[]):[{id:t,def:n.def,node:n,width:o.columns.getColumn(t)?.width??n.width}]}):o.columns.displayed().filter(t=>!N(t.id)).map(t=>({id:t.id,def:t.def,node:t.node,width:t.width}))}function xn(o,e){return e==="selected"?o.shownSelectedRows():e==="all"?o.rowModel.server?o.rowModel.dataRows().map(t=>t.data):o.viewRows():o.orderedDataRows().map(t=>t.data)}var Ve=(o,e)=>o.header??o.field??e,Pa=["left","center","right"],La=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i,ve=o=>String(o??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e]),Fa=["A4","A3","A5","B4","B5","letter","legal"],Ia=760,Da=o=>`"${o.replace(/[\\"<\n\r]/g,e=>e===`
26
+ `?"\\A ":e==="\r"?"":`\\${e.charCodeAt(0).toString(16)} `)}"`,Qr=o=>o?`#${o.slice(2)}`:"";function $a(o,e,t){let n=[],r=0,i=o.store.state.sort,s=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 p=new Map;for(let g of l){let y=G(u,g),w=q(y)?"":te(y),f=p.get(w);f||p.set(w,f={value:y,rows:[]}),f.rows.push(g)}let m=i.find(g=>g.colId===c)?.dir==="desc"?-1:1;for(let g of[...p.values()].sort((y,w)=>pn(y.value,w.value,s,m)))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 Na=`
27
27
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
28
28
  body { font: 10.5px/1.45 system-ui, 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; color: #111827; margin: 0; }
29
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; }
@@ -43,11 +43,10 @@ tr.group td { background: #eef2f7; font-weight: 600; border-top: 1px solid #cbd5
43
43
  tr.group.level-0 td { background: #e2e8f0; }
44
44
  tr.title td { border: 0; padding: 0 0 4px; background: none; }
45
45
  tr.total td { font-weight: 700; background: #f3f4f6; border-top: 1.5px solid #111827; border-bottom: 0; }
46
- `,gn=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,Ha=1e3;function vn(o,e={}){let t=yn(o,e.columns),n=o.store.state.locale,r=n.code,s=t.map(M=>Q(M.def,r)),i=Ce(r),a=e.rowNumbers??!!o.options.rowNumbers,l=M=>Ia.includes(M.align)?M.align:M.type==="number"?"right":M.type==="boolean"?"center":"left",d=t.map(M=>{let D=[];for(let I=M.node;I;I=I.parent)D.unshift(I);return D}),c=Math.max(1,...d.map(M=>M.length)),u=[];if(e.headers!==!1)for(let M=0;M<c;M++){let D=M===0&&a?[{text:"#",align:"right",num:!0,rowspan:c}]:[];for(let I=0;I<t.length;I++){let P=d[I],F=P.length-1;if(M<F){let B=P[M];if(I>0&&d[I-1][M]===B)continue;let z=1;for(;I+z<t.length&&d[I+z][M]===B;)z++;D.push({text:Ge(B.def,B.id),align:z>1?"center":"left",span:z,group:!0})}else M===F&&D.push({text:Ge(t[I].def,t[I].id),align:l(t[I].def),span:1,rowspan:c-M})}u.push(D)}let h=(M,D,I,P)=>{if(I==null||I==="")return"";if(P==="count")return i.format(I);let F=M.def.type??(typeof I=="number"?"number":I instanceof Date?"date":void 0);return F===M.def.type?s[D](I):it(M.def,F,r)(I)},p=(M,D,I,P=0)=>{let F=0;for(;F<t.length-1&&!I[F];)F++;F=Math.max(1,F);let B=a?[{text:"",align:"right",num:!0}]:[];B.push({text:D,align:"left",span:F,indent:P});for(let z=F;z<t.length;z++)B.push({text:I[z]??"",align:l(t[z].def)});return{kind:M,level:P,cells:B}},g=bn(o,e.rows),y=e.groups!==!1&&!o.rowModel.server&&!o.options.treeData?o.getGroupBy():[],w=e.styles!==!1&&t.some(M=>M.def.cellClass)?rs(o):null,f=[],m=typeof e.maxRows=="number"&&e.maxRows>=1?Math.floor(e.maxRows):Ha,b=0;try{for(let M of Oa(o,g,y)){if(M.kind==="row"&&b>=m)break;if(M.kind==="group"){let P=o.columns.getNode(M.colId)?.def,F=V(M.value)?n.blanks:P?Q(P,r)(M.value):String(M.value),B=`${P?Ge(P,M.colId):M.colId}: ${F} (${i.format(M.rows.length)})`,z=t.map((j,X)=>{if(!(!j.def.aggFunc||y.includes(j.id)))try{return h(j,X,me(j.def.aggFunc,M.rows.map(J=>G(j.def,J)),M.rows),j.def.aggFunc)||void 0}catch{return}});f.push(p("group",B,z,M.level));continue}let D=M.row,I=a?[{text:String(M.n),align:"right",num:!0}]:[];t.forEach((P,F)=>{let B=G(P.def,D),z=V(B)?"":s[F](B),j={text:z,align:l(P.def)};if(w&&P.def.cellClass){let J;try{J=typeof P.def.cellClass=="function"?P.def.cellClass({value:B,formatted:z,row:D,rowIndex:M.n-1,column:P.def}):P.def.cellClass}catch{J=void 0}if(J){let _=w.of(J);_.color&&(j.color=ts(_.color)),_.fill&&(j.fill=ts(_.fill)),_.bold&&(j.bold=!0)}}let X=e.styles!==!1?o.cellFormat(D,P.id,B):null;if(X){let J=X.style;gn(J.color)&&(j.color=gn(J.color)),gn(J.background)&&(j.fill=gn(J.background)),J.bold&&(j.bold=!0),J.italic&&(j.italic=!0),J.strike&&(j.strike=!0);let _=he(J);_&&(j.align=_),X.bar&&(j.bar={from:X.bar.from,to:X.bar.to,color:/^#[0-9a-f]{3,8}$/i.test(X.bar.color)?X.bar.color:"#93c5fd"}),X.icon&&(j.icon={char:X.icon.char,color:X.icon.color})}I.push(j)}),f.push({kind:"row",cells:I}),b++}}finally{w?.dispose()}let C=[],S=e.summary!==!1?o.summary():null;S&&S.opts.rows.forEach((M,D)=>{let I=t.map((P,F)=>{let B=M.columns?.[P.id];return B===void 0?void 0:h(P,F,S.values[D]?.[P.id],ft(B).agg)||void 0});C.push(p("total",M.label??"",I))});let x=t.map(M=>Math.max(1,M.width)),R=x.reduce((M,D)=>M+D,0),A=Da.includes(e.paper)?e.paper:"A4",k=e.orientation==="portrait"||e.orientation==="landscape"?e.orientation:R+(a?40:0)>$a?"landscape":"portrait",E=e.printedAt!==!1?new Intl.DateTimeFormat(r,{dateStyle:"medium",timeStyle:"short"}).format(new Date):"",T=Number.isInteger(e.repeatRows)&&e.repeatRows>0?Math.min(e.repeatRows,f.length):0,L=g.length>b?n.printLimited.replace("{n}",i.format(b)).replace("{total}",i.format(g.length)):"";return L&&C.push({kind:"total",cells:[{text:L,align:"left",span:t.length+(a?1:0),italic:!0}]}),{lang:r,limited:L,title:e.title??"",subtitle:e.subtitle??"",printed:E,footer:e.footer??"",paper:A,orientation:k,fit:e.fitToWidth!==!1,numbered:a,widths:a?[40,...x]:x,head:u,body:f,foot:C,striped:e.striped!==!1,pageNumbers:e.pageNumbers!==!1,repeatHeader:e.repeatHeader!==!1,repeatTitle:!!e.repeatTitle,repeatRows:T}}function Ga(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 ns(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}>${ye(o.text)}</${e}>`;let n=Ga(o,e==="th"),r=o.icon?`<span style="color:${ye(o.icon.color)};margin-right:5px">${ye(o.icon.char)}</span>`:"";return`<${e}${t}${n?` style="${ye(n)}"`:""}>${r}${ye(o.text)}</${e}>`}var po=o=>`<tr${o.kind==="group"?` class="group level-${Math.min(o.level??0,5)}"`:o.kind==="total"?' class="total"':""}>${o.cells.map(e=>ns(e,"td")).join("")}</tr>`;function ho(o,e={}){let t=vn(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=ye(t.title||(typeof document<"u"?document.title:"")||""),i=t.title||t.subtitle?`<div>${t.title?`<h1>${s}</h1>`:""}${t.subtitle?`<p class="sub">${ye(t.subtitle)}</p>`:""}</div>`:"<div></div>",a=t.title||t.subtitle||t.printed?`<header>${i}${t.printed?`<p class="printed">${ye(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: ${Na(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=>ns(b,"th")).join("")}</tr>`).join(""),h=t.body.slice(0,t.repeatRows).map(po).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}${h}`:`${g}${h}`,w=(t.repeatHeader?"":u)+t.body.slice(t.repeatRows).map(po).join(""),f=t.foot.map(po).join("");return`<!doctype html><html lang="${ye(t.lang)}"><head><meta charset="utf-8"><title>${s}</title><style>
47
- @page { ${d} }${Ba}${c}
48
- </style></head><body>${t.repeatTitle?"":a}<table${t.fit?' class="fit"':""}>${r}<thead>${y}</thead><tbody>${w}</tbody>${f?`<tfoot>${f}</tfoot>`:""}</table></body></html>`}function os(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(),O("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{O("printing is not supported in this environment")}r()},50)}function go(o,e={}){let t=yn(o,e.columns),n=o.store.state.locale.code,r=typeof e.separator=="string"&&e.separator.length===1?e.separator:",",s=bn(o,e.rows).map(i=>t.map(a=>{let l=G(a.def,i),d=a.def.type,c=tn(a.def,l,n);return{value:c,text:typeof l!="number"&&(!(d==="number"||d==="date"||d==="boolean")||typeof l=="string"&&!Fa.test(c))}}));return e.headers!==!1&&s.unshift(t.map(i=>({value:Ge(i.def,i.id),text:!0}))),_r(s,r)}function mo(o,e={}){let t=yn(o,e.columns),n=o.store.state.locale.code,r=e.formatted?t.map(l=>Q(l.def,n)):null,s=t.map(l=>e.keys==="header"?Ge(l.def,l.id):l.id),i=bn(o,e.rows).map(l=>{let d={};return t.forEach((c,u)=>{let h=G(c.def,l);d[s[u]]=r?V(h)?"":r[u](h):h===void 0?null:h}),d}),a=typeof e.space=="number"&&e.space>=0?Math.min(10,e.space):2;return JSON.stringify(i,null,a)}function za(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 mn(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 rs(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&&mn(d.color)&&(l.color=mn(d.color)),d.fill!==s.fill&&mn(d.fill)&&(l.fill=mn(d.fill)),d.bold&&!s.bold&&(l.bold=!0),i.set(a,l)}return l},dispose:()=>t.remove()}}function wo(o,e={}){return Qe([yo(o,e)])}function yo(o,e={}){let t=yn(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 C=m.node;C;C=C.parent)b.unshift(C);return b});i=Math.max(1,...w.map(m=>m.length));let f=m=>{let b="";for(let C=m+1;C>0;C=Math.floor((C-1)/26))b=String.fromCharCode(65+(C-1)%26)+b;return b};for(let m=0;m<i;m++){let b=[];for(let C=0;C<t.length;C++){let S=w[C],x=S.length-1;if(m<x){let R=S[m],A=C>0?w[C-1][m]:null;if(b.push({v:A===R?null:Ge(R.def,R.id),header:!0}),A!==R){let k=C;for(;k+1<t.length&&w[k+1][m]===R;)k++;k>C&&s.push(`${f(C)}${m+1}:${f(k)}${m+1}`)}}else m===x?(b.push({v:Ge(t[C].def,t[C].id),header:!0}),i-1>m&&s.push(`${f(C)}${m+1}:${f(C)}${i}`)):b.push({v:null,header:!0})}r.push(b)}}let a=t.map(w=>za(w.def)),l=t.map(w=>Q(w.def,n)),d=bn(o,e.rows),c=e.styles!==!1,u=c&&t.some(w=>w.def.cellClass)?rs(o):null,h=(w,f,m)=>{if(V(m))return null;let b=a[f]??void 0;switch(w.def.type){case"number":{let C=typeof m=="number"?m:Number(m);return Number.isFinite(C)?{v:C,fmt:b}:String(m)}case"date":{let C=fe(m);return C?{v:C,fmt:b}:String(m)}case"boolean":return typeof m=="boolean"?m:String(m);default:return l[f](m)}};try{d.forEach((w,f)=>{r.push(t.map((m,b)=>{let C=G(m.def,w),S=h(m,b,C);if(!c)return S;let x=m.def.align?{align:m.def.align}:{};if(u&&m.def.cellClass){let A;try{A=typeof m.def.cellClass=="function"?m.def.cellClass({value:C,formatted:l[b](C),row:w,rowIndex:f,column:m.def}):m.def.cellClass}catch{A=void 0}A&&(x={...x,...u.of(A)})}let R=o.cellFormat(w,m.id,C);if(R){let A=Kn(R.style.color),k=Kn(R.style.background);A&&(x.color=A),k&&(x.fill=k),R.style.bold&&(x.bold=!0);let E=he(R.style);E&&(x.align=E)}return Object.keys(x).length?S!==null&&typeof S=="object"&&!(S instanceof Date)?{...S,...x}:{v:S,...x}:S}))})}finally{u?.dispose()}let p=new Set,g=w=>{let f="";for(let m=w+1;m>0;m=Math.floor((m-1)/26))f=String.fromCharCode(65+(m-1)%26)+f;return f},y=(w,f,m,b)=>{for(let C=w;C<=m;C++)for(let S=f;S<=b;S++)if(p.has(`${C},${S}`))return;for(let C=w;C<=m;C++)for(let S=f;S<=b;S++)p.add(`${C},${S}`);s.push(`${g(f)}${i+w+1}:${g(b)}${i+m+1}`)};return d.forEach((w,f)=>t.forEach((m,b)=>{let C=m.def.colSpan?pt(m.def.colSpan,m.def,w,f,t.length-b):1;C>1&&y(f,b,f,b+C-1)})),t.forEach((w,f)=>{if(!w.def.merge&&!w.def.rowSpan)return;let m=Ke(d,w.def);for(let b=0;b<d.length;b++)m.start[b]===b&&m.end[b]>b&&y(b,f,m.end[b],f)}),{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 ze(o,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})),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 wn=o=>String(o??"").trim().toLowerCase();function Va(o){return o==null?"":o instanceof Date?o.getHours()||o.getMinutes()||o.getSeconds()?o.toISOString():ie(o)??"":String(o)}async function ss(o,e,t={}){let n=e instanceof Uint8Array?e:new Uint8Array(e instanceof ArrayBuffer?e:await e.arrayBuffer()),r;if(pn(n)){let y=await fo(n),w=typeof t.sheet=="string"?y.find(f=>f.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=lo(y,ao(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=wn(y);return w?s.find(f=>wn(f.def.header)===w)??s.find(f=>wn(f.def.field)===w||wn(f.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()!==""),f=w.map(a).filter(m=>m&&!d.has(m));if(!w.length||!w.every(m=>typeof m=="string")||!f.length)break;f.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 f=l-1;f>=0;f--){let m=r[f]?.[w];if(m!=null&&String(m).trim()!=="")return a(m)}return null}),h=o.store.state.data[0],p=0,g=[];for(let y of r.slice(l)){if(!y||y.every(f=>f==null||String(f).trim()===""))continue;let w={};u.forEach((f,m)=>{if(!f)return;let b=f.def,C=Va(y[m]),S=o.acceptText(b,w,C,h?.[b.field]);S.ok?C===""&&(S.value===null||S.value==="")||(w[b.field]=S.value):p++}),g.push(w)}return t.mode==="replace"?o.setData(g):o.addRows(g),{rows:g,skipped:p}}var qa="http://www.w3.org/2000/svg";var bo=["var(--fg-accent, #2563eb)","#f59e0b","#10b981","#ef4444","#8b5cf6","#06b6d4","#ec4899","#84cc16","#f97316","#64748b","#14b8a6","#a855f7"],Te=o=>bo[o%bo.length];function ee(o,e={},t=""){let n=document.createElementNS(qa,o);t&&n.setAttribute("class",t);for(let[r,s]of Object.entries(e))n.setAttribute(r,String(s));return n}function vt(o,e){let t=ee("title");t.textContent=e,o.append(t)}function vo(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 xo(o,e){let t=new Intl.NumberFormat(e.locale,{maximumFractionDigits:2}),n=new Intl.NumberFormat(e.locale,{notation:"compact",maximumFractionDigits:1}),r=ee("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,bo.length),i=e.categories,a=16;if(e.title){let T=ee("text",{x:320,y:22,"text-anchor":"middle"},"fg-chart-title");T.textContent=e.title,r.append(T),a=36}let l=ee("g",{},"fg-chart-legend"),d=e.type==="pie"||e.type==="donut",c=d?i:e.type==="scatter"?s.slice(1).map(T=>T.name):s.map(T=>T.name),u=16;c.forEach((T,L)=>{let M=ee("g",{transform:`translate(${u},350)`},"fg-chart-legend-item");M.append(ee("rect",{x:0,y:-9,width:10,height:10,rx:2,fill:Te(L)}));let D=ee("text",{x:14,y:0});D.textContent=T,M.append(D),l.append(M),u+=24+Math.min(140,T.length*7)});let h=308;if(e.type==="scatter"){Wa(r,e,s,a,h,t,n),r.append(l),o.replaceChildren(r);return}if(d){let T=(s[0]?.values??[]).map(F=>F!==null&&F>0?F:0),L=T.reduce((F,B)=>F+B,0),M=640/2,D=(a+h)/2,I=Math.max(10,(h-a)/2-6),P=-Math.PI/2;T.forEach((F,B)=>{if(!F||!L)return;let z=P+F/L*Math.PI*2,j=z-P>Math.PI?1:0,X=se=>`${M+I*Math.cos(se)},${D+I*Math.sin(se)}`,J=F===L?`M${M-I},${D}a${I},${I} 0 1,0 ${2*I},0a${I},${I} 0 1,0 ${-2*I},0`:`M${M},${D}L${X(P)}A${I},${I} 0 ${j} 1 ${X(z)}Z`,_=ee("path",{d:J,fill:Te(B)},"fg-chart-slice");vt(_,`${i[B]}: ${t.format(F)} (${Math.round(F/L*1e3)/10}%)`),r.append(_),P=z}),e.type==="donut"&&r.append(ee("circle",{cx:M,cy:D,r:I*.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((T,L)=>{let M=0,D=0;for(let I of s){let P=I.values[L];P==null||!Number.isFinite(P)||(p?P>=0?M+=P:D+=P:(y=Math.max(y,P),g=Math.min(g,P)))}p&&(y=Math.max(y,M),g=Math.min(g,D))});let w=vo(g,y),f=w[0],m=w[w.length-1],b=56,C=624,S=T=>h-(T-f)/(m-f)*(h-a),x=ee("g",{},"fg-chart-axis");for(let T of w){x.append(ee("line",{x1:b,x2:C,y1:S(T),y2:S(T)},T===0?"fg-chart-zero":"fg-chart-grid"));let L=ee("text",{x:b-6,y:S(T)+4,"text-anchor":"end"});L.textContent=n.format(T),x.append(L)}let R=(C-b)/Math.max(1,i.length),A=Math.max(1,Math.ceil(i.length/Math.floor((C-b)/56)));i.forEach((T,L)=>{if(L%A)return;let M=ee("text",{x:b+R*(L+.5),y:h+16,"text-anchor":"middle"}),D=Math.max(3,Math.min(12,Math.floor(R*A/10)));M.textContent=T.length>D?`${T.slice(0,D-1)}\u2026`:T,x.append(M)}),r.append(x);let k=ee("g",{},"fg-chart-plot"),E=e.type==="combo";if(E){let T=R*.6,L=s[0];i.forEach((M,D)=>{let I=L?.values[D];if(I==null||!Number.isFinite(I))return;let P=b+R*D+(R-T)/2,F=ee("rect",{x:P,y:Math.min(S(0),S(I)),width:Math.max(1,T-2),height:Math.max(.5,Math.abs(S(I)-S(0))),fill:Te(0),rx:2},"fg-chart-bar");vt(F,`${L.name} \xB7 ${M}: ${t.format(I)}`),k.append(F)})}if(e.type==="bar"||p){let T=R*.72,L=p?T:T/Math.max(1,s.length);i.forEach((M,D)=>{let I=0,P=0;s.forEach((F,B)=>{let z=F.values[D];if(z==null||!Number.isFinite(z))return;let j=0,X=z;p&&(j=z>=0?I:P,X=j+z,z>=0?I=X:P=X);let J=b+R*D+(R-T)/2+(p?0:L*B),_=ee("rect",{x:J,y:Math.min(S(j),S(X)),width:Math.max(1,L-2),height:Math.max(.5,Math.abs(S(X)-S(j))),fill:Te(B),rx:2},"fg-chart-bar");vt(_,`${F.name} \xB7 ${M}: ${t.format(z)}`),k.append(_)})})}else s.forEach((T,L)=>{if(E&&L===0)return;let M=T.values.map((P,F)=>P==null||!Number.isFinite(P)?null:[b+R*(F+.5),S(P),P]),D="",I=!1;for(let P of M){if(!P){I=!1;continue}D+=`${I?"L":"M"}${P[0]},${P[1]}`,I=!0}if(e.type==="area"){let P=M.filter(F=>!!F);if(P.length){let F=`M${P[0][0]},${S(0)}${P.map(B=>`L${B[0]},${B[1]}`).join("")}L${P[P.length-1][0]},${S(0)}Z`;k.append(ee("path",{d:F,fill:Te(L),"fill-opacity":.18},"fg-chart-area"))}}k.append(ee("path",{d:D,fill:"none",stroke:Te(L),"stroke-width":2.2,"stroke-linejoin":"round"},"fg-chart-line")),M.forEach((P,F)=>{if(!P)return;let B=ee("circle",{cx:P[0],cy:P[1],r:3.5,fill:Te(L)},"fg-chart-point");vt(B,`${T.name} \xB7 ${i[F]}: ${t.format(P[2])}`),k.append(B)})});r.append(k,l),o.replaceChildren(r)}function Wa(o,e,t,n,r,s,i){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 h=R=>R.reduce((A,k)=>Math.min(A,k)),p=R=>R.reduce((A,k)=>Math.max(A,k)),g=vo(h(c),p(c)),y=vo(h(u),p(u)),w=56,f=624,m=R=>w+(R-g[0])/(g[g.length-1]-g[0])*(f-w),b=R=>r-(R-y[0])/(y[y.length-1]-y[0])*(r-n),C=ee("g",{},"fg-chart-axis");for(let R of y){C.append(ee("line",{x1:w,x2:f,y1:b(R),y2:b(R)},R===0?"fg-chart-zero":"fg-chart-grid"));let A=ee("text",{x:w-6,y:b(R)+4,"text-anchor":"end"});A.textContent=i.format(R),C.append(A)}g.forEach((R,A)=>{let k=A===0?"start":A===g.length-1?"end":"middle",E=ee("text",{x:m(R),y:r+16,"text-anchor":k});E.textContent=i.format(R),C.append(E)});let S=ee("text",{x:f,y:r+32,"text-anchor":"end"},"fg-chart-axis-name");S.textContent=`${t[0]?.name??""} \u2192`,C.append(S),o.append(C);let x=ee("g",{},"fg-chart-plot");a.forEach((R,A)=>{d(R)&&l.forEach((k,E)=>{let T=k.values[A];if(!d(T))return;let L=ee("circle",{cx:m(R),cy:b(T),r:4,fill:Te(E),"fill-opacity":.8},"fg-chart-point");vt(L,`${e.categories[A]??""}: ${t[0].name} ${s.format(R)}, ${k.name} ${s.format(T)}`),x.append(L)})}),o.append(x)}var ja=12,is=500,Co=["bar","stackedBar","line","area","combo","pie","donut","scatter"],xn=class{constructor(e){this.grid=e;this.handles=new Set}create(e={}){let{grid:t}=this,n=Co.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 f=mt({start:{rowIndex:s.start.rowIndex,colIndex:y.index},end:{rowIndex:s.end.rowIndex,colIndex:w.index}}),m=[];for(let b=f.r1;b<=f.r2&&m.length<is;b++){let C=t.rowModel.getRow(b);C&&!C.kind&&m.push(C.data)}i={rows:m,colIds:t.columns.displayed().slice(f.c1,f.c2+1).filter(b=>!$(b.id)).map(b=>b.id)}}}let a=()=>{let y=i?i.rows:t.rowModel.dataRows().slice(0,is).map(x=>x.data),w=(i?i.colIds.map(x=>t.columns.getColumn(x)):t.columns.displayed().filter(x=>!$(x.id))).filter(x=>!!x),f=w[0]&&w[0].def.type!=="number"?w[0]:i?null:w.find(x=>x.def.type!=="number")??null,m=x=>!!x.node.parent&&x.node.parent.id==="pivotgroup|total",b=w.filter(x=>x!==f&&x.def.type==="number"&&(i||!m(x))).slice(0,ja),C=x=>{let R=[];for(let A=x.node.parent;A;A=A.parent)R.unshift(A.def.header??A.id);return R.push(x.def.header??x.def.field??x.id),R.join(" \xB7 ")},S=f?Q(f.def,r().code):null;return{categories:y.map((x,R)=>f&&S?S(G(f.def,x)):String(R+1)),series:b.map(x=>({name:C(x),values:y.map(R=>{let A=G(x.def,R),k=typeof A=="number"?A:A==null||A===""?NaN:Number(A);return Number.isFinite(k)?k:null})}))}},l=v("div","fg-chart-body"),d=null,c=()=>xo(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],h=()=>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=v("div","fg-chart-panel",{role:"dialog","aria-label":e.title??u(n)});let y=v("div","fg-chart-head");for(let f of Co){let m=v("button","fg-chart-type",{type:"button",title:u(f)});m.dataset.type=f,m.textContent=u(f),m.addEventListener("click",()=>g.setType(f)),y.append(m)}let w=v("button","fg-chooser-close",{type:"button","aria-label":r().close});w.textContent="\xD7",w.addEventListener("click",()=>g.destroy()),y.append(v("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=>{Co.includes(y)&&(n=y,h(),c())},update:()=>c(),destroy:()=>{p.forEach(y=>y()),(d??l).remove(),this.handles.delete(g)}};return this.handles.add(g),h(),c(),g}destroy(){for(let e of[...this.handles])e.destroy()}};var as=new WeakMap,Ua=o=>typeof o=="function"?"custom":o;function ko(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 ls(o,e){let t=(n,r)=>n.length===r.length&&n.every((s,i)=>s===r[i]);return o.totals===e.totals&&t(o.rows,e.rows)&&t(o.columns,e.columns)&&o.values.length===e.values.length&&o.values.every((n,r)=>n.colId===e.values[r].colId&&n.aggFunc===e.values[r].aggFunc)}function ds(o,e,t,n,r){let s=ko(e,x=>!!t(x)),i=new Intl.Collator(r,{numeric:!0,sensitivity:"base"}),a=x=>t(x),l=(x,R)=>x.map(A=>te(G(a(A),R))).join(""),d=new Map,c=new WeakMap;for(let x of o){let R=l(s.columns,x);c.set(x,R),d.has(R)||d.set(R,s.columns.map(A=>G(a(A),x)))}let u=new WeakMap,h=x=>{let R=u.get(x);if(!R){let A=x.flatMap(E=>as.get(E)??[]),k=new Map;for(let E of A){let T=c.get(E)??l(s.columns,E),L=k.get(T);L||k.set(T,L=[]),L.push(E)}u.set(x,R={all:A,byCombo:k})}return R},p=[...d.entries()].sort((x,R)=>{for(let A=0;A<s.columns.length;A++){let k=yt(x[1][A],R[1][A],i);if(k)return k}return 0});s.columns.length||p.splice(0,p.length,["",[]]);let g=[],y=(x,R,A)=>{let k=s.values[R],E=a(k.colId),T=`pivot|${A}|${R}`;g.push({id:T,comboKey:x,valueIndex:R});let L=k.aggFunc;return{id:T,field:T,header:`${E.header??E.field??k.colId} (${n.agg(Ua(L))})`,type:"number",format:L==="count"?"integer":E.format,width:130,aggFunc:(M,D)=>{let I=h(D),P=x===null?I.all:I.byCombo.get(x)??[];return P.length?me(L,P.map(F=>G(E,F)),P):null}}},w=[],f=(x,R)=>{if(V(R))return n.blank;let A=a(x);return A.type==="number"&&!A.format?String(R):Q(A,r)(R)};if(!s.columns.length)s.values.forEach((x,R)=>w.push(y("",R,0)));else{let x=(R,A,k)=>{let E=[],T=0;for(;T<R.length;){let L=R[T][1][A],M=te(L),D=T;for(;D<R.length&&te(R[D][1][A])===M;)D++;let I=R.slice(T,D),P=A===s.columns.length-1?s.values.map((F,B)=>y(I[0][0],B,k+T)):x(I,A+1,k+T);E.push({id:`pivotgroup|${A}|${k+T}`,header:f(s.columns[A],L),children:P}),T=D}return E};w.push(...x(p,0,0)),s.totals&&s.values.length&&w.push({id:"pivotgroup|total",header:n.total,children:s.values.map((R,A)=>y(null,A,"total"))})}let m=new Map;for(let x of o){let R=l(s.rows,x),A=m.get(R);A||m.set(R,A={values:s.rows.map(k=>G(a(k),x)),src:[]}),A.src.push(x)}let C=[...m.values()].sort((x,R)=>{for(let A=0;A<s.rows.length;A++){let k=yt(x.values[A],R.values[A],i);if(k)return k}return 0}).map(x=>{let R={};s.rows.forEach((k,E)=>{R[a(k).field??k]=x.values[E]});let A=new Map;if(s.columns.length)for(let k of x.src){let E=l(s.columns,k),T=A.get(E);T||A.set(E,T=[]),T.push(k)}for(let k of g){let E=s.values[k.valueIndex],T=k.comboKey===null||!s.columns.length?x.src:A.get(k.comboKey)??[],L=a(E.colId);R[k.id]=T.length?me(E.aggFunc,T.map(M=>G(L,M)),T):null}return as.set(R,x.src),R});return{columns:[...s.rows.map(x=>{let R=a(x);return{id:x,field:R.field??x,header:R.header??R.field??x,type:R.type,format:R.format,width:R.width??140}}),...w],rows:C,groupBy:s.rows.slice(0,-1)}}var cs=new WeakMap;function us(o){return cs.get(o)}function fs(o,e){let t=e.filter(i=>!i.aggFunc),n=e.filter(i=>i.aggFunc&&i.field&&!i.valueGetter),r=new Map;for(let i of o){let a=t.map(d=>te(G(d,i))).join(""),l=r.get(a);l||r.set(a,l=[]),l.push(i)}let s=[];for(let i of r.values()){let a={...i[0]};for(let l of n)try{a[l.field]=me(l.aggFunc,i.map(d=>G(l,d)),i)}catch{a[l.field]=null}cs.set(a,i),s.push(a)}return s}var ps={grouping:{en:"Row grouping and aggregation",ko:"\uD589 \uADF8\uB8F9\xB7\uC9D1\uACC4"},pivot:{en:"Pivot",ko:"\uD53C\uBC97"},charts:{en:"Charts",ko:"\uCC28\uD2B8"},range:{en:"Cell range selection",ko:"\uC140 \uBC94\uC704 \uC120\uD0DD"},clipboard:{en:"Range copy and paste",ko:"\uBC94\uC704 \uBCF5\uC0AC\xB7\uBD99\uC5EC\uB123\uAE30"},fill:{en:"Fill handle",ko:"\uCC44\uC6B0\uAE30 \uD578\uB4E4"},excel:{en:"Excel export",ko:"\uC5D1\uC140 \uB0B4\uBCF4\uB0B4\uAE30"},pdf:{en:"PDF export",ko:"PDF \uB0B4\uBCF4\uB0B4\uAE30"},serverGroups:{en:"Server-side groups",ko:"\uC11C\uBC84 \uADF8\uB8F9"},advancedFilter:{en:"Advanced filter",ko:"\uACE0\uAE09 \uD544\uD130"},sideBar:{en:"Side bar panels",ko:"\uC0AC\uC774\uB4DC\uBC14 \uD328\uB110"},contextMenu:{en:"Context menu",ko:"\uCEE8\uD14D\uC2A4\uD2B8 \uBA54\uB274"},summary:{en:"Summary rows",ko:"\uD569\uACC4 \uD589"},formulas:{en:"Formulas",ko:"\uC218\uC2DD"},find:{en:"Find",ko:"\uCC3E\uAE30"},conditional:{en:"Conditional formatting",ko:"\uC870\uAC74\uBD80 \uC11C\uC2DD"},assistant:{en:"AI assistant",ko:"AI \uC5B4\uC2DC\uC2A4\uD134\uD2B8"},merge:{en:"Merged cells",ko:"\uC140 \uBCD1\uD569"},workbook:{en:"Workbook",ko:"\uC6CC\uD06C\uBD81"}};var et="1.10.0";var Ka={kty:"EC",crv:"P-256",x:"sUTKkglZmk-HMKPNub8p7AeLBKesHCU8irIkw9rJlbE",y:"j0U_aKRDR7iApY9UpaD3hUemhBLZJwDv9-QiT_hUyw8"},Ve="https://freegrid.app/pricing/",tt="https://freegrid.app/license/personal/",hs="https://freegrid.app/api/usage",_a="https://freegrid.app/api/domain-status",Xa=o=>Number.parseInt(String(o).split(".")[0],10),xs=o=>{let e=atob(o.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-o.length%4)%4));return Uint8Array.from(e,t=>t.charCodeAt(0))};function Ct(o){let e=o.toLowerCase().replace(/^\[|\]$/g,"");if(!e||e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="0.0.0.0"||e.endsWith(".localhost")||e.endsWith(".test")||e.endsWith(".local"))return!0;let t=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(e);if(!t)return!1;let[n,r,s,i]=t.slice(1).map(Number);return[n,r,s,i].some(a=>a>255)?!1:n===10||n===192&&r===168||n===172&&r>=16&&r<=31}function Ja(o,e){let t=o.toLowerCase().replace(/\.$/,"");return e.some(n=>{if(typeof n!="string")return!1;let r=n.toLowerCase().replace(/\.$/,""),s=r.startsWith("*.")?r.slice(2):r;return s?t===s||t.endsWith(`.${s}`):!1})}var So=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])},Ya=o=>`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}`;function Cs(o,e,t={}){let n=typeof o=="string"?o.trim().split("."):[];if(n.length!==3||n[0]!=="FG1")return{fail:{ok:!1,reason:"format"}};let r;try{if(r=JSON.parse(new TextDecoder().decode(xs(n[1]))),!r||!Array.isArray(r.domains)||!r.domains.every(i=>typeof i=="string")||!So(r.expires))return{fail:{ok:!1,reason:"format"}};if(r.major!==void 0&&!(Number.isInteger(r.major)&&r.major>0))return{fail:{ok:!1,reason:"format"}};if(r.plan!==void 0&&r.plan!=="company"&&r.plan!=="personal")return{fail:{ok:!1,reason:"format"}}}catch{return{fail:{ok:!1,reason:"format"}}}let s=null;return Ya(t.now??new Date)>r.expires?s={ok:!1,reason:"expired",info:r}:Ja(e,r.domains)?r.major!==void 0&&Xa(t.version??et)>r.major&&(s={ok:!1,reason:"version",info:r}):s={ok:!1,reason:"domain",info:r},{parts:n,info:r,fail:s}}var ks=()=>typeof crypto<"u"&&!!crypto.subtle;async function Rs(o,e,t={}){let n=Cs(o,e,t);if(!("info"in n))return n.fail;let{parts:r,info:s}=n,i=()=>n.fail;if(!ks())return i()??{ok:!1,reason:"unsupported",info:s};let a=crypto.subtle;try{let l=await a.importKey("jwk",t.publicKey??Ka,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]),d=new TextEncoder().encode(`${r[0]}.${r[1]}`);if(!await a.verify({name:"ECDSA",hash:"SHA-256"},l,xs(r[2]),d))return{ok:!1,reason:"signature",info:s}}catch{return{ok:!1,reason:"signature",info:s}}return i()??{ok:!0,info:s}}var xt,gs=new Map,Ro=new Map,ms=new Set,ws=new Set;function Za(o){xt=o}var Cn={missing:`FreeGrid: every feature is free for 30 days on a domain. After that, paid features need a free personal key (${tt}) or a company key: ${Ve}
49
- FreeGrid: \uB3C4\uBA54\uC778\uB9C8\uB2E4 30\uC77C \uB3D9\uC548 \uBAA8\uB4E0 \uAE30\uB2A5\uC744 \uBB34\uB8CC\uB85C \uC4F8 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uADF8 \uB4A4 \uC720\uB8CC \uAE30\uB2A5\uC5D0\uB294 \uBB34\uB8CC \uAC1C\uC778 \uD0A4(${tt}) \uB610\uB294 \uD68C\uC0AC \uD0A4\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4: ${Ve}`,trial:o=>`FreeGrid: the 30-day trial of paid features on this domain ends ${o}. / \uC774 \uB3C4\uBA54\uC778\uC758 \uC720\uB8CC \uAE30\uB2A5 30\uC77C \uCCB4\uD5D8\uC740 ${o}\uC5D0 \uB05D\uB0A9\uB2C8\uB2E4.`,ended:`FreeGrid: the 30-day trial on this domain has ended, so paid features are now off. Get a free personal key (${tt}) or a company key: ${Ve}
50
- FreeGrid: \uC774 \uB3C4\uBA54\uC778\uC758 30\uC77C \uCCB4\uD5D8\uC774 \uB05D\uB098 \uC720\uB8CC \uAE30\uB2A5\uC774 \uAEBC\uC84C\uC2B5\uB2C8\uB2E4. \uBB34\uB8CC \uAC1C\uC778 \uD0A4(${tt}) \uB610\uB294 \uD68C\uC0AC \uD0A4\uB97C \uBC1B\uC73C\uC138\uC694: ${Ve}`,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.",version:`FreeGrid ${et}: this perpetual license covers an earlier major version. / \uC774 \uC601\uAD6C \uB77C\uC774\uC120\uC2A4\uB294 \uC774\uC804 \uBA54\uC774\uC800 \uBC84\uC804\uC6A9\uC785\uB2C8\uB2E4.`};function ys(o,e=typeof location<"u"?location.hostname:""){try{if(Ct(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(hs,s):typeof fetch=="function"&&fetch(hs,{method:"POST",body:s,mode:"no-cors",keepalive:!0}).catch(()=>{})}catch{}}function Qa(o=xt,e=typeof location<"u"?location.hostname:""){return Ct(e)?Promise.resolve(!0):Ss(o??xt,e).then(t=>t==="ok"||t==="unsupported")}function Ss(o,e){let t=`${o??""}@${e}`,n=gs.get(t);return n||(o?n=Rs(o,e).then(r=>{if(ys({version:et,licensed:r.ok,company:r.ok?r.info.company:void 0},e),r.ok)return"ok";if(r.reason==="unsupported")return"unsupported";let s=r.info?` (${r.info.domains.join(", ")}, ${r.info.major?`${r.info.major}.x`:r.info.expires})`:"";return console.warn(`${Cn[r.reason]}${s}
51
- ${Ve}`),"bad"},()=>"bad"):(console.info(Cn.missing),ys({version:et,licensed:!1},e),n=Promise.resolve("none")),gs.set(t,n),n)}var el;var kt=()=>el??(typeof location<"u"?location.hostname:""),bs=o=>{if(!o||typeof o!="object")return null;let{badge:e,trial:t}=o,n=!!t&&typeof t=="object"&&So(t.started)&&So(t.ends)&&typeof t.active=="boolean";return{badge:e===!0,trial:n?{started:t.started,ends:t.ends,active:t.active}:null}};function Ms(o=kt()){if(Ct(o)||typeof fetch!="function")return Promise.resolve(null);let e=Ro.get(o);if(e)return e;let t=new Date().toISOString().slice(0,10),n=null;try{n=typeof localStorage<"u"?localStorage:null;let s=JSON.parse(n?.getItem("freegrid:status")??"null"),i=s&&s.host===o&&s.day===t?bs(s.status):null;if(i){let a=Promise.resolve(i);return Ro.set(o,a),a}}catch{}let r=fetch(_a,{mode:"cors",credentials:"omit"}).then(s=>s.ok?s.json():null).then(s=>{let i=bs(s);if(i)try{n?.setItem("freegrid:status",JSON.stringify({host:o,day:t,status:i}))}catch{}return i}).catch(()=>null);return Ro.set(o,r),r}function tl(o=kt()){return Ms(o).then(e=>e?.badge===!0)}async function Es(o,e=kt()){return await Promise.resolve(),await Qa(o,e)?!1:tl(e)}var As="freegrid:gate",nl=5,Ts=o=>{if(!o)return"";let e=o.trim().split(".");return e[e.length-1].slice(-16)},Ps=o=>{let e=JSON.parse(localStorage.getItem(As)??"null");return!e||typeof e!="object"||e.host!==o||typeof e.trialEnded!="boolean"||!Array.isArray(e.verifiedKeys)||!e.verifiedKeys.every(t=>typeof t=="string")?null:{host:o,trialEnded:e.trialEnded,...typeof e.trialEnds=="string"?{trialEnds:e.trialEnds}:{},verifiedKeys:e.verifiedKeys}};function Ls(o,e=kt()){if(Ct(e))return!0;let t=o??xt;if(t&&!ks()){let n=Cs(t,e);if("info"in n&&!n.fail)return!0}try{let n=Ps(e);if(!n)return!0;let r=Ts(t);return r&&n.verifiedKeys.includes(r)?!0:!n.trialEnded}catch{return!0}}var vs=(o,e)=>{try{let t=null;try{t=Ps(o)}catch{}localStorage.setItem(As,JSON.stringify(e(t??{host:o,trialEnded:!1,verifiedKeys:[]})))}catch{}};async function Is(o,e=kt()){if(Ct(e))return!0;await Promise.resolve();let t=o??xt,n=await Ss(t,e);if(n==="ok"){let i=Ts(t);return vs(e,a=>({...a,verifiedKeys:[i,...a.verifiedKeys.filter(l=>l!==i)].slice(0,nl)})),!0}if(n==="unsupported")return!0;let r=(await Ms(e))?.trial;if(!r)return!0;vs(e,i=>({...i,trialEnded:!r.active,trialEnds:r.ends}));let s=`${r.active?"trial":"ended"}@${e}`;return ms.has(s)||(ms.add(s),r.active?console.info(Cn.trial(r.ends)):console.warn(Cn.ended)),r.active}function Fs(o){if(ws.has(o))return;ws.add(o);let e=ps[o]??{en:o,ko:o};console.warn(`FreeGrid: ${e.en} is a paid feature and is off on this domain. Get a free personal key (${tt}) or a company key: ${Ve}
52
- FreeGrid: ${e.ko}\uC740(\uB294) \uC720\uB8CC \uAE30\uB2A5\uC774\uB77C \uC774 \uB3C4\uBA54\uC778\uC5D0\uC11C \uAEBC\uC838 \uC788\uC2B5\uB2C8\uB2E4. \uBB34\uB8CC \uAC1C\uC778 \uD0A4(${tt}) \uB610\uB294 \uD68C\uC0AC \uD0A4\uB97C \uBC1B\uC73C\uC138\uC694: ${Ve}`)}var Rt={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"]},Ds=["blank","notBlank"],Mo=500,kn=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=v("div",`fg-menu fg-theme-${this.grid.store.state.theme}`,{role:"dialog","aria-label":r.columnMenu});this.grid.applyFontTo(i),Ie(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(f=>f.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.paid&&(this.grid.options.groupPanel||a.length)){let f=a.includes(e)?[[r.ungroup,()=>this.grid.setGroupBy(a.filter(m=>m!==e))]]:[[r.groupByThis,()=>this.grid.setGroupBy([...a,e])]];a.length&&f.push([r.expandAll,()=>this.grid.expandAll(!0)],[r.collapseAll,()=>this.grid.expandAll(!1)]),i.append(this.section(f))}if(this.grid.getRollup()){let f=s.aggFunc??null,m=(C,S)=>`${C?"\u2713 ":""}${S}`,b=["sum","avg","min","max","count"].map(C=>[m(f===C,r[C]),()=>this.grid.setColumnAggFunc(e,C)]);i.append(this.section([[m(!f,r.noAggregate),()=>this.grid.setColumnAggFunc(e,null)],...b]))}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&&this.grid.paid&&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),re(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 h=Math.max(4,Math.min(c.bottom+4,window.innerHeight-240));i.style.top=`${h}px`,i.style.maxHeight=`${Math.max(160,window.innerHeight-h-8)}px`,this.popup=i,this.colId=e;let p=f=>{de(f,i,t)||this.close()},g=f=>{f.key==="Escape"&&(this.close(),this.grid.renderer.gridEl.focus())},y=()=>this.close(),w=this.grid.renderer.scroller;document.addEventListener("pointerdown",p,!0),document.addEventListener("keydown",g,!0),w.addEventListener("scroll",y,{passive:!0}),this.off.push(()=>document.removeEventListener("pointerdown",p,!0),()=>document.removeEventListener("keydown",g,!0),()=>w.removeEventListener("scroll",y)),i.querySelector(".fg-filter-value:not([hidden]), .fg-set-search, .fg-menu-item")?.focus()}openAtFocus(){let{grid:e}=this,t=e.store.state.focus,n=t&&!$(t.colId)?t.colId:e.columns.displayed().find(a=>!$(a.id))?.id;if(!n)return!1;let r=e.renderer.root,s=CSS.escape(n),i=r.querySelector(`.fg-header-cell:not(.fg-header-group)[data-col="${s}"]`)??(t?r.querySelector(`.fg-row[data-row="${t.rowIndex}"] .fg-cell[data-col="${s}"]`):null)??e.renderer.gridEl;return this.open(n,i),!0}filterSection(e,t){let n=this.grid.columns.getNode(e);if(!n||n.children)return null;let r=this.grid.store.state.locale,s=ce(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=v("div","fg-menu-section");for(let[n,r]of e){let s=v("button","fg-menu-item",{type:"button"});s.textContent=n,s.addEventListener("click",()=>{r(),this.close();let i=qt(this.grid.renderer.root);(!i||i===document.body||!i.isConnected)&&this.grid.renderer.gridEl.focus({preventScroll:!0})}),t.append(s)}return t}actions(e,t,n,r){let s=v("div","fg-menu-actions"),i=v("button","fg-btn",{type:"button"});i.textContent=t.reset,i.addEventListener("click",()=>{this.grid.setFilter(e,null),r()});let a=v("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=v("div","fg-menu-title");return t.textContent=e.filter,t}conditionRow(e,t,n,r,s){let i=v("div","fg-filter-cond"),a=v("select","fg-filter-op",{"aria-label":t.filter});if(r){let p=v("option");p.value="",p.textContent="\u2014",a.append(p)}for(let p of Rt[e]){let g=v("option");g.value=p,g.textContent=t.ops[p],a.append(g)}a.value=n?.op??(r?"":Rt[e][0]);let l=e==="text"?"text":e,d=v("input","fg-input fg-filter-value",{type:l,placeholder:t.value,"aria-label":t.value}),c=v("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||Ds.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=!Ds.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=v("div","fg-menu-section fg-filter"),c=()=>{let y=u.read(),w=h.read(),f=p.querySelector("input:checked")?.value==="or"?"or":"and",m=y&&w?{type:"combined",operator:f,conditions:[y,w]}:y??w;this.grid.setFilter(e,m),r()},u=this.conditionRow(t,n,a,!1,c),h=this.conditionRow(t,n,l,!0,c),p=v("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=v("label"),f=v("input","",{type:"radio",name:g,value:y});f.checked=(s?.type==="combined"?s.operator:"and")===y,w.append(f,` ${n[y]}`),p.append(w)}return d.append(this.title(n),u.row,p,h.row,this.actions(e,n,c,r)),d}setFilter(e,t,n){let{grid:r}=this,s=r.columns.getNode(e).def,i=Q(s,t.code),a=r.collator(),l=new Map;for(let x of r.rowModel.allNodes()){let R=G(s,x.data),A=te(R);l.has(A)||l.set(A,R)}let d=[...l.entries()].sort((x,R)=>yt(x[1],R[1],a)),c=r.store.state.filters[e],u=new Set(c?.type==="set"?c.values.map(te).filter(x=>l.has(x)):l.keys()),h=(x,R)=>x===""?t.blanks:i(R),p=v("div","fg-menu-section fg-filter fg-set-filter"),g=v("input","fg-input fg-set-search",{type:"search",placeholder:t.search,"aria-label":t.search}),y=v("label","fg-set-item fg-set-all"),w=v("input","fg-checkbox",{type:"checkbox"});y.append(w,document.createTextNode(t.selectAll));let f=v("div","fg-set-list"),m=()=>{let x=g.value.trim().toLowerCase();return x?d.filter(([R,A])=>h(R,A).toLowerCase().includes(x)):d},b=()=>{let x=m(),R=x.filter(([A])=>u.has(A)).length;w.checked=R>0&&R===x.length,w.indeterminate=R>0&&R<x.length},C=()=>{let x=m();if(f.replaceChildren(...x.slice(0,Mo).map(([R,A])=>{let k=v("label","fg-set-item"),E=v("input","fg-checkbox",{type:"checkbox"});return E.checked=u.has(R),E.addEventListener("change",()=>{E.checked?u.add(R):u.delete(R),b()}),k.append(E,document.createTextNode(h(R,A))),k})),x.length>Mo){let R=v("div","fg-set-more");R.textContent=`\u2026 +${x.length-Mo}`,f.append(R)}b()};w.addEventListener("change",()=>{for(let[x]of m())w.checked?u.add(x):u.delete(x);C()}),g.addEventListener("input",C);let S=()=>{r.setFilter(e,u.size===l.size?null:{type:"set",values:d.filter(([x])=>u.has(x)).map(([,x])=>x)}),n()};return g.addEventListener("keydown",x=>x.key==="Enter"&&S()),C(),p.append(this.title(t),g,y,f,this.actions(e,t,S,n)),p}};var $s=new WeakMap,ol=0;function qe(o){let e=$s.get(o);return e||$s.set(o,e=`r${++ol}`),e}var Rn=class{constructor(e){this.deps=e;this.stats={filterRuns:0,sortRuns:0};this.server=!1;this.full=[];this.last={};this.nodes=[];this.assignedIds=new WeakMap;this.filtered=[];this.sorted=[];this.display=[];this.indexById=null;this.orderedCache=null;this.layoutCache=null;this.quickCache=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;if(u){let h=new Set,p=null;this.assignedIds=new WeakMap,this.nodes=e.data.map((g,y)=>{let w=String(u(g)),f=w;if(h.has(f)){p??(p=w);for(let m=2;h.has(f);m++)f=`${w}#${m}`}return h.add(f),this.assignedIds.set(g,f),{id:f,data:g,sourceIndex:y}}),p!==null&&O(`getRowId returned "${p}" for more than one row; inside the grid the repeats are told apart as "${p}#2" and so on, and updates by id reach the first of them. Return a unique id per row.`)}else this.nodes=e.data.map((h,p)=>({id:qe(h),data:h,sourceIndex:p}))}if(i&&(this.filtered=this.filter(e),this.stats.filterRuns++),a){let u=e.sort.length?this.deps.sortBlocks?.(e.sort):null,h=u?.length?Ar(this.filtered.map(p=>p.data),u):void 0;this.sorted=Kr(this.filtered,e.sort,p=>this.deps.columnDef(p),t,h),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}dataRowsBefore(e){let t=Math.min(e,this.full.length);if(this.full===this.sorted)return t;let n=0;for(let r=0;r<t;r++)this.full[r].kind||n++;return n}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}orderedDataRows(){let e=this.orderedCache;if(e&&e.full===this.full)return e.rows;let t=this.last.display,n=this.sorted;if(t&&(t.getParentId||t.groupBy.length)){let r={...t,expanded:new Map,defaultExpanded:-1,detailOpen:new Set,lazyChildren:void 0};n=this.buildDisplay(r,this.last.sort??[],this.last.collator??this.deps.collator()).filter(s=>!s.kind)}return this.orderedCache={full:this.full,rows:n},n}allNodes(){return this.nodes}idOf(e){return this.deps.getRowId?this.assignedIds.get(e)??String(this.deps.getRowId(e)):qe(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 h=this.display[u],p=e;if(h.kind==="detail")p=t;else if(!h.kind){c&&(p=c.get(h.id)??e);let g=s?.(h.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}quickTexts(e){let t=[this.nodes,this.deps.textVersion?.()??"",...e],n=this.quickCache;return n&&n.key.length===t.length&&n.key.every((r,s)=>r===t[s])?n.texts:(this.quickCache={key:t,texts:new WeakMap},this.quickCache.texts)}filter(e){let t=Object.entries(e.filters).map(([u,h])=>({def:this.deps.columnDef(u),pred:Et(h)})).filter(u=>!!u.def),n=er(e.quickFilter),r=n.length?this.deps.quickColumns():[],s=e.advancedFilter?Dn(e.advancedFilter,u=>this.deps.columnDef(u),G):null;if(!t.length&&!n.length&&!s)return this.nodes;let i=n.length?this.quickTexts(r):null,a=this.nodes.filter(u=>{for(let h of t)if(!h.pred(G(h.def,u.data)))return!1;if(s&&!s(u.data))return!1;if(i){let h=i.get(u.data);if(h===void 0&&(h=r.map(p=>this.deps.format(p,G(p,u.data))).join("").toLowerCase(),i.set(u.data,h)),!tr(n,h))return!1}return!0}),l=e.display?.getParentId;if(!l)return a;let d=new Map(this.nodes.map(u=>[u.id,u])),c=new Set(a);for(let u of a){let h=l(u.data),p=new Set;for(;h!=null&&!p.has(h);){p.add(h);let g=d.get(String(h));if(!g)break;c.add(g),h=l(g.data)}}return this.nodes.filter(u=>c.has(u))}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),h=new Map;for(let y of a){let w=G(u,y.data),f=V(w)?"":te(w),m=h.get(f);m||h.set(f,m={value:w,nodes:[]}),m.nodes.push(y)}let p=t.find(y=>y.colId===c)?.dir==="desc"?-1:1,g=[...h.entries()].sort((y,w)=>fn(y[1].value,w[1].value,n,p));for(let[y,w]of g){let f=`${d}${c}:${y}`,m=this.isOpen(e,f,l);r.push({id:`group:${f}`,data:{},sourceIndex:-1,kind:"group",level:l,group:{key:f,colId:c,value:w.value,rows:w.nodes.map(b=>b.data),expanded:m}}),m&&(l+1<s.length?i(w.nodes,l+1,`${f}|`):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(d=>d.id)),r=new Map,s=[];for(let d of this.sorted){let c=e.getParentId(d.data),u=c==null?null:String(c);if(u!==null&&n.has(u)&&u!==d.id){let h=r.get(u);h||r.set(u,h=[]),h.push(d)}else s.push(d)}let i=new Set,a=d=>{let c=[d];for(;c.length;){let u=c.pop();if(!i.has(u.id)){i.add(u.id);for(let h of r.get(u.id)??[])c.push(h)}}};for(let d of s)a(d);for(let d of this.sorted){if(i.has(d.id))continue;let c=r.get(String(e.getParentId(d.data))),u=c?c.indexOf(d):-1;u>=0&&c.splice(u,1),s.push(d),a(d)}let l=(d,c,u)=>{for(let h of d){if(u.has(h.id))continue;let p=r.get(h.id)??[],g=!p.length&&!!e.lazyChildren?.(h.id,h.data),y=p.length>0&&this.isOpen(e,h.id,c),w={...h,level:c,hasChildren:p.length>0||g,expanded:y};g&&e.loading?.has(h.id)&&(w.loading=!0),this.withDetails(e,[w],t),y&&l(p,c+1,new Set([...u,h.id]))}};l(s,0,new Set)}};var rl=1e4,Eo=1e5,sl=4,Ao=3e3,Sn=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<sl&&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+rl,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)||O("datasource.getRows must resolve to { rows: Row[] }");let h=i?u.map((w,f)=>({id:this.getRowId?String(this.getRowId(w)):qe(w),data:w,sourceIndex:r+f,level:n})):u.map(w=>{let f=this.groupBy[n],m=w[f],b=`${e?`${e}|`:""}${f}:${te(m)}`,C=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:f,value:m,rows:[],expanded:!1,count:C,aggregates:w,keys:[...t,m]}}}),p=r?[...this.levels.get(e)?.nodes??[],...h]:h,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&&O(`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()+Ao}),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 h=u.group,p=this.isOpen(e,h.key,d),g={...u,group:{...h,expanded:p}};r.push(g),p&&i(h.key,h.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 il=new Float64Array(0),nt=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;this.quiet=!1}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 Sn(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||(!this.quiet&&e>=0&&e<this.getRowCount()&&this.ensure(Math.floor(t/this.bs)),this.placeholder(t))}withoutLoading(e){let t=this.quiet;this.quiet=!0;try{return e()}finally{this.quiet=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()+Ao}),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){O("datasource.getRows must resolve to { rows: Row[], total?: number }"),a(new Error("invalid datasource response"));return}let u=this.deps.getRowId,h=c.slice(0,this.bs).map((p,g)=>({id:u?String(u(p)):qe(p),data:p,sourceIndex:n+g}));this.blocks.set(e,{state:"loaded",nodes:h}),typeof d.total=="number"&&d.total>=0?this.total=d.total:h.length<this.bs&&(this.total=n+h.length),this.loadedEnd=Math.max(this.loadedEnd,n+h.length),this.evict(),this.touch(),this.deps.onLoaded(n,n+h.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)):qe(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:il,uniform:!0}}};function Ns(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 Mn=class{constructor(e){this.bus=new _e;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 To=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&Object.getPrototypeOf(o)===Object.prototype;function be(o,e=0,t=new Map){if(e>8||!(Array.isArray(o)||To(o)))return o;let n=t.get(o);if(n)return n;if(Array.isArray(o)){let s=[];t.set(o,s);for(let i of o)s.push(be(i,e+1,t));return s}let r={};t.set(o,r);for(let[s,i]of Object.entries(o))r[s]=be(i,e+1,t);return r}function ot(o,e,t=0,n=new Map){if(o===e)return!0;if(t>8||!o||!e||typeof o!="object"||typeof e!="object")return!1;let r=n.get(o);if(r?.has(e))return!0;if(r?r.add(e):n.set(o,new Set([e])),Array.isArray(o)||Array.isArray(e))return Array.isArray(o)&&Array.isArray(e)&&o.length===e.length&&o.every((i,a)=>ot(i,e[a],t+1,n));if(!To(o)||!To(e))return!1;let s=Object.keys(o);return s.length===Object.keys(e).length&&s.every(i=>i in e&&ot(o[i],e[i],t+1,n))}function al(o){let e=be(o);return t=>ot(t,e)?!1:(e=be(t),!0)}var ll=500;function Os(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 h=o.columns.getNode(u);if(!h)return null;if(c.classList.contains("fg-header-cell"))return h.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=h.def,f=G(w,y.data),m=Q(w,o.store.state.locale.code)(f);if(typeof w.tooltip=="function")try{let b=w.tooltip({value:f,formatted:m,row:y.data,rowIndex:g,column:w});return b?String(b):null}catch{return O(`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=v("div",`fg-tooltip fg-theme-${o.store.state.theme}`,{role:"tooltip"}),n.textContent=u,o.applyFontTo(n),re(e).append(n);let h=c.getBoundingClientRect(),p=n.offsetWidth,g=n.offsetHeight,y=window.innerWidth||1024,w=window.innerHeight||768,f=h.bottom+6+g>w?h.top-g-6:h.bottom+6;n.style.left=`${Math.max(4,Math.min(y-p-4,h.left))}px`,n.style.top=`${Math.max(4,f)}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 h=i(u);h&&a(u,h)},ll))},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 Bs=["blank","notBlank"],En=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)&&ce(e.def)).map(e=>{let t=ce(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=v("div",`fg-menu fg-filter-builder fg-theme-${e.store.state.theme}`,{role:"dialog","aria-label":t.advancedFilter});e.applyFontTo(r);let s=v("div","fg-chooser-head"),i=v("span","fg-menu-title");i.textContent=t.advancedFilter;let a=v("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=v("div","fg-filter-join",{role:"radiogroup"}),c=`fg-fb-join-${Math.random().toString(36).slice(2,7)}`;for(let M of["and","or"]){let D=v("label"),I=v("input","",{type:"radio",name:c,value:M});I.checked=(l?.operator??"and")===M,D.append(I,` ${t[M]}`),d.append(D)}let u=v("div","fg-fb-list"),h=[],p=M=>{h.splice(h.indexOf(M),1),M.el.remove()},g=M=>{let D=v("div","fg-fb-row"),I=v("select","fg-filter-op fg-fb-col",{"aria-label":t.columns});for(let Z of n){let N=v("option");N.value=Z.id,N.textContent=Z.label,I.append(N)}let P=v("select","fg-filter-op fg-fb-op",{"aria-label":t.filter}),F=v("input","fg-input fg-fb-value",{type:"text",placeholder:t.value,"aria-label":t.value}),B=v("input","fg-input fg-fb-value-to",{type:"text",placeholder:t.valueTo,"aria-label":t.valueTo}),z=v("button","fg-chooser-close fg-fb-remove",{type:"button","aria-label":t.close});z.textContent="\xD7";let j=()=>n.find(Z=>Z.id===I.value)?.kind??"text",X=Z=>{let N=j();P.replaceChildren(...Rt[N].map(U=>{let K=v("option");return K.value=U,K.textContent=t.ops[U],K})),Z&&Rt[N].includes(Z)&&(P.value=Z);let W=N==="text"?"text":N;F.type=B.type=W,J()},J=()=>{F.hidden=Bs.includes(P.value),B.hidden=P.value!=="between"};I.addEventListener("change",()=>X(P.value)),P.addEventListener("change",J),M&&n.some(Z=>Z.id===M.colId)&&(I.value=M.colId);let _=M?.model;X(_?.op),_?.value!=null&&(F.value=String(_.value)),_?.valueTo!=null&&(B.value=String(_.valueTo)),D.append(I,P,F,B,z);let se={el:D,read:()=>{let Z=j(),N=P.value,W=!Bs.includes(N),U=null;if(Z==="number"){let K=F.value===""?void 0:Number(F.value),St=B.value===""?void 0:Number(B.value);(!W||K!==void 0&&!Number.isNaN(K))&&(U=N==="between"?{type:"number",op:N,value:K,valueTo:St}:{type:"number",op:N,value:K})}else Z==="date"?(!W||F.value)&&(U=N==="between"?{type:"date",op:N,value:F.value,valueTo:B.value}:{type:"date",op:N,value:F.value||void 0}):(!W||F.value)&&(U={type:"text",op:N,value:F.value});return U?{colId:I.value,model:U}:null}};return z.addEventListener("click",()=>p(se)),se},y=(M,D)=>{let I=v("div","fg-fb-row fg-fb-group"),P=v("span","fg-fb-group-label");P.textContent=D;let F=v("button","fg-chooser-close fg-fb-remove",{type:"button","aria-label":t.close});F.textContent="\xD7",I.append(P,F);let B={el:I,read:()=>M};return F.addEventListener("click",()=>p(B)),B},w=M=>{if("conditions"in M)return y(M,`( ${M.conditions.length} \xD7 ${t[M.operator]} )`);let D=n.find(F=>F.id===M.colId),I=M.model;if(D&&I&&(I.type==="text"||I.type==="number"||I.type==="date"))return g(M);let P=I?.type==="set"?I.values.map(String).join(", "):I?.type==="combined"?`( ${I.conditions.length} \xD7 ${t[I.operator]} )`:"";return y(M,`${D?.label??M.colId}: ${P}`)},f=M=>{h.push(M),u.append(M.el)};for(let M of l?.conditions??[])f(w(M));let m=v("button","fg-btn fg-fb-add",{type:"button"});m.textContent=`+ ${t.addCondition}`,m.addEventListener("click",()=>{let M=g();f(M),M.el.querySelector(".fg-fb-value").focus()});let b=v("div","fg-menu-actions"),C=v("button","fg-btn",{type:"button"});C.textContent=t.reset,C.addEventListener("click",()=>{e.setAdvancedFilter(null),this.close()});let S=v("button","fg-btn fg-btn-primary",{type:"button"});S.textContent=t.apply,S.addEventListener("click",()=>{let M=h.map(I=>I.read()).filter(I=>!!I),D=d.querySelector("input:checked")?.value==="or"?"or":"and";e.setAdvancedFilter(M.length?{operator:D,conditions:M}:null),this.close()}),b.append(C,S),r.append(s,d,u,m,b),re(e.renderer.root).append(r),h.length||m.click();let x=e.renderer.root.getBoundingClientRect(),R=r.offsetWidth||460;r.style.left=`${Math.max(4,Math.min(x.left+24,(window.innerWidth||1024)-R-4))}px`;let A=e.renderer.headerEl.getBoundingClientRect(),k=window.innerHeight||768,E=Math.max(4,Math.min((A.height?A.bottom:x.top)+8,k-(r.offsetHeight||0)-4));r.style.top=`${E}px`,r.style.maxHeight=`${Math.max(160,k-E-8)}px`,this.popup=r;let T=M=>{de(M,r)||this.close()},L=M=>{M.key==="Escape"&&(this.close(),e.renderer.gridEl.focus())};document.addEventListener("pointerdown",T,!0),document.addEventListener("keydown",L,!0),this.off.push(()=>document.removeEventListener("pointerdown",T,!0),()=>document.removeEventListener("keydown",L,!0))}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var Hs=[{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}}],dl=["value","formula","top","bottom","aboveAverage","belowAverage","duplicate","unique","dataBar","colorScale","iconSet"],cl=["gt","gte","lt","lte","eq","ne","between","notBetween","contains","notContains","startsWith","endsWith","blank","notBlank"],Po=["blank","notBlank"],Gs=["dataBar","colorScale","iconSet"],An=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={...ae.cf,...r.cf,aligns:{...ae.cf.aligns,...r.cf?.aligns}},i=n.def.header??n.def.field??e,a=v("div",`fg-menu fg-cf-dialog fg-theme-${t.store.state.theme}`,{role:"dialog","aria-label":`${s.title}: ${i}`});t.applyFontTo(a);let l=v("div","fg-chooser-head"),d=v("span","fg-menu-title");d.textContent=`${s.title} \xB7 ${i}`;let c=v("button","fg-chooser-close",{type:"button","aria-label":r.close});c.textContent="\xD7",c.addEventListener("click",()=>this.close()),l.append(d,c);let u=v("div","fg-cf-list"),h=N=>s.ops[N]??r.ops[N]??N,p=N=>{let W=N.type??"value",U=s.types[W];if(W==="value"){let K=N.op??"eq";return Po.includes(K)?h(K):`${h(K)} ${String(N.value??"")}${K==="between"||K==="notBetween"?` \u2013 ${String(N.valueTo??"")}`:""}`}return W==="formula"?`${U}: ${N.formula??""}`:W==="top"||W==="bottom"?`${U} ${N.rank??10}${N.percent?"%":""}`:U},g=()=>{u.replaceChildren();let W=t.getConditionalFormats().map((U,K)=>({r:U,i:K})).filter(({r:U})=>U.columns.includes(e));if(!W.length){let U=v("div","fg-cf-empty");U.textContent=s.none,u.append(U);return}for(let{r:U,i:K}of W){let St=v("div","fg-cf-rule"),xe=v("span","fg-cf-sample",{"aria-hidden":"true"});xe.textContent=U.type==="iconSet"?"\u25B2":U.type==="dataBar"?"\u25AC":"Aa",U.style?.background&&(xe.style.background=U.style.background),U.style?.color&&(xe.style.color=U.style.color),U.style?.bold&&(xe.style.fontWeight="700");let rt=he(U.style);rt&&rt!=="center"&&(xe.style.justifyItems=rt==="left"?"start":"end",xe.style.padding="0 3px"),U.type==="colorScale"&&(xe.style.background=`linear-gradient(to right, ${(U.colors??["#f8696b","#ffeb84","#63be7b"]).join(",")})`);let st=v("span","fg-cf-rule-text");st.textContent=`${p(U)}${U.row?` \xB7 ${s.wholeRow}`:""}${rt?` \xB7 ${s.align}: ${s.aligns[rt]}`:""}`,st.title=st.textContent;let Ln=v("button","fg-chooser-close",{type:"button","aria-label":`${r.close}: ${st.textContent}`});Ln.textContent="\xD7",Ln.addEventListener("click",()=>{let No=t.getConditionalFormats(),Oo=No[K];Oo.columns=Oo.columns.filter(In=>In!==e),t.setConditionalFormats(No.filter(In=>In.columns.length)),g()}),St.append(xe,st,Ln),u.append(St)}};g();let y=v("div","fg-cf-form"),w=v("select","fg-filter-op fg-cf-wide fg-cf-type",{"aria-label":s.type});for(let N of dl){let W=v("option");W.value=N,W.textContent=s.types[N],w.append(W)}let f=v("select","fg-filter-op fg-cf-wide fg-cf-op",{"aria-label":r.filter});for(let N of cl){let W=v("option");W.value=N,W.textContent=h(N),f.append(W)}let m=n.def.type==="number",b=v("input","fg-input fg-cf-value",{type:m?"number":"text",placeholder:r.value,"aria-label":r.value}),C=v("input","fg-input fg-cf-value-to",{type:m?"number":"text",placeholder:r.valueTo,"aria-label":r.valueTo}),S=v("input","fg-input fg-cf-wide fg-cf-formula",{type:"text",placeholder:`=${n.def.field??e} > 100`,"aria-label":s.types.formula,spellcheck:"false"}),x=v("input","fg-input fg-cf-rank",{type:"number",min:"1",value:"10","aria-label":s.count}),R=v("label","fg-cf-pct"),A=v("input","",{type:"checkbox"});R.append(A," %");let k=v("div","fg-cf-swatches fg-cf-wide",{role:"group","aria-label":s.style}),E=0;Hs.forEach((N,W)=>{let U=v("button","fg-cf-swatch",{type:"button","aria-label":s.styles[N.key],title:s.styles[N.key],"aria-pressed":String(W===E)});U.textContent=N.key==="bold"?"B":"Aa",U.style.background=N.style.background??"#ffffff",U.style.color=N.style.color??"#1f2430",U.addEventListener("click",()=>{E=W;for(let K of k.children)K.setAttribute("aria-pressed",String(K===U))}),k.append(U)});let T=v("select","fg-filter-op fg-cf-wide fg-cf-align",{"aria-label":s.align,title:s.align});for(let N of["","left","center","right"]){let W=v("option");W.value=N,W.textContent=N?`${s.align}: ${s.aligns[N]}`:`${s.align}: ${s.aligns.none}`,T.append(W)}let L=v("label","fg-cf-wide fg-cf-row"),M=v("input","",{type:"checkbox"});L.append(M,` ${s.wholeRow}`),y.append(w,f,b,C,S,x,R,k,T,L);let D=()=>{let N=w.value,W=f.value;f.hidden=N!=="value",b.hidden=N!=="value"||Po.includes(W),C.hidden=N!=="value"||W!=="between"&&W!=="notBetween",S.hidden=N!=="formula",x.hidden=R.hidden=N!=="top"&&N!=="bottom",k.hidden=T.hidden=Gs.includes(N),L.hidden=N!=="value"&&N!=="formula"};w.addEventListener("change",D),f.addEventListener("change",D),D();let I=()=>{let N=w.value,W={columns:[e],type:N},U=K=>m&&K.value!==""?Number(K.value):K.value;if(N==="value"){if(W.op=f.value,!Po.includes(W.op)){if(b.value==="")return null;if(W.value=U(b),W.op==="between"||W.op==="notBetween"){if(C.value==="")return null;W.valueTo=U(C)}}}else if(N==="formula"){let K=S.value.trim();if(!K)return null;W.formula=K.startsWith("=")?K:`=${K}`}else(N==="top"||N==="bottom")&&(W.rank=Math.max(1,Math.floor(Number(x.value)||10)),A.checked&&(W.percent=!0));if(!Gs.includes(N)){W.style={...Hs[E].style};let K=he({align:T.value});K&&(W.style.align=K)}return M.checked&&(N==="value"||N==="formula")&&(W.row=!0),W},P=v("div","fg-menu-actions"),F=v("button","fg-btn",{type:"button"});F.textContent=s.clear,F.addEventListener("click",()=>{t.setConditionalFormats(t.getConditionalFormats().map(N=>({...N,columns:N.columns.filter(W=>W!==e)})).filter(N=>N.columns.length)),g()});let B=v("button","fg-btn fg-btn-primary",{type:"button"});B.textContent=s.add,B.addEventListener("click",()=>{let N=I();if(!N){(w.value==="formula"?S:b).focus();return}t.setConditionalFormats([...t.getConditionalFormats(),N]),b.value=C.value=S.value="",g()}),P.append(F,B),a.append(l,u,y,P),re(t.renderer.root).append(a);let z=t.renderer.root.getBoundingClientRect(),j=a.offsetWidth||340;a.style.left=`${Math.max(4,Math.min(z.left+24,(window.innerWidth||1024)-j-4))}px`;let X=window.innerHeight||768,J=a.offsetHeight||0,_=Math.max(4,Math.min(z.top+24,X-J-4));a.style.top=`${_}px`,a.style.maxHeight=`${Math.max(160,X-_-8)}px`,a.style.overflowY="auto",this.popup=a,w.focus();let se=N=>{de(N,a)||this.close()},Z=N=>{N.key==="Escape"&&(this.close(),t.renderer.gridEl.focus())};document.addEventListener("pointerdown",se,!0),document.addEventListener("keydown",Z,!0),this.off.push(()=>document.removeEventListener("pointerdown",se,!0),()=>document.removeEventListener("keydown",Z,!0))}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var ul=["text","number","date","set","combined"],fl=["bar","stackedBar","line","area","pie","donut","combo","scatter"],pl=30;function hl(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="",h="";for(let p of n){let g=G(t,p);if(V(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),(!h||y>h)&&(h=y)}if(i.size<5e3){let y=te(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:h}),!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 gl(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=>({...hl(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 ml(o,e){let t={state:o.api.getState(),defs:o.columnDefs(),summary:o.summaryOptions()},n=[],r=[],s=[],i=Array.isArray(e)?e.slice(0,pl):[],a=u=>typeof u=="string"&&!!o.columns.getNode(u)&&!o.columns.getNode(u).children&&!$(u),l=u=>n.push(u),d=(u,h)=>r.push({action:u,reason:h});for(let u of i){let h=u;if(!h||typeof h!="object"||typeof h.type!="string"){d(u,"not an action");continue}try{switch(h.type){case"sort":{let p=(Array.isArray(h.sort)?h.sort:[]).filter(g=>!!g&&a(g.colId)&&(g.dir==="asc"||g.dir==="desc"));Array.isArray(h.sort)&&p.length!==h.sort.length&&d(h,"unknown column in sort"),o.setSort(p.map(g=>({colId:g.colId,dir:g.dir}))),l(h);break}case"filter":{if(!a(h.colId)){d(h,"unknown column");break}let p=h.model;if(p!==null&&(!p||typeof p!="object"||!ul.includes(p.type))){d(h,"bad filter model");break}o.setFilter(h.colId,p),l(h);break}case"clearFilters":for(let p of Object.keys(o.store.state.filters))o.setFilter(p,null);o.setAdvancedFilter(null),o.api.setQuickFilter(""),l(h);break;case"quickFilter":o.api.setQuickFilter(typeof h.text=="string"?h.text.slice(0,200):""),l(h);break;case"advancedFilter":{let p=h.filter,g=[],y=w=>{let f=w;Array.isArray(f?.conditions)?f.conditions.forEach(y):g.push(f?.colId)};if(p&&y(p),p&&(!Array.isArray(p.conditions)||!g.every(a))){d(h,"unknown column in advanced filter");break}o.setAdvancedFilter(p??null),l(h);break}case"groupBy":{let p=Array.isArray(h.colIds)?h.colIds.filter(a):[];o.setGroupBy(p),h.expand&&o.expandAll(!0),l(h);break}case"pivot":{let p=h.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(h,"unknown column in pivot");break}o.setPivot(p??null),l(h);break}case"showColumns":case"hideColumns":{let p=Array.isArray(h.colIds)?h.colIds.filter(a):[];p.length&&o.setColumnsVisible(p,h.type==="showColumns"),l(h);break}case"conditionalFormat":{let p=h.format;if(!p||!Array.isArray(p.columns)||!p.columns.length||!p.columns.every(a)){d(h,"unknown column in format");break}o.setConditionalFormats([...o.getConditionalFormats(),p]),l(h);break}case"clearConditionalFormats":o.setConditionalFormats([]),l(h);break;case"addColumn":{let p=h.column;if(!p||typeof p.id!="string"||!/^[\w.-]{1,40}$/.test(p.id)||o.columns.getNode(p.id)){d(h,"bad or taken column id");break}let g=typeof p.formula=="string"?p.formula.startsWith("=")?p.formula:`=${p.formula}`:"";if(!(g?xr(g):null)){d(h,"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(h);break}case"summary":{let p=h.summary;if(p&&(!Array.isArray(p.rows)||!p.rows.every(g=>g&&Object.keys(g.columns??{}).every(a)))){d(h,"unknown column in summary");break}o.setSummary(p??null),l(h);break}case"chart":{let p=Array.isArray(h.colIds)?h.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(h,"nothing to chart");break}let f={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:fl.includes(h.chartType)?h.chartType:"bar",range:f,title:typeof h.title=="string"?h.title.slice(0,80):void 0})),l(h);break}case"message":l(h);break;default:d(h,"unknown action")}}catch{d(h,"failed")}}return{applied:n,skipped:r,undo:()=>{for(let u of s)u.destroy();(o.columnDefs().length!==t.defs.length||o.columnDefs().some((u,h)=>u!==t.defs[h]))&&o.api.setColumns(t.defs),o.setSummary(t.summary),o.api.setState(t.state),t.state.conditionalFormats||o.setConditionalFormats([])}}}async function Tn(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(gl(o,e,t)),signal:n});if(!s.ok)throw new Error(`HTTP ${s.status} from the assistant`);let i=await s.json(),a=ml(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(`
53
- `);return{...a,message:l.slice(0,4e3)}}var Pn=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=v("div",`fg-menu fg-ai-panel fg-theme-${e.store.state.theme}`,{role:"dialog","aria-label":t.ai.title});e.applyFontTo(r);let s=v("div","fg-chooser-head"),i=v("span","fg-menu-title");i.textContent=t.ai.title;let a=v("button","fg-chooser-close",{type:"button","aria-label":t.close});a.textContent="\xD7",a.addEventListener("click",()=>this.close()),s.append(i,a);let l=v("div","fg-ai-log",{role:"log","aria-live":"polite"});this.log=l;let d=v("form","fg-ai-form"),c=v("textarea","fg-input fg-ai-input",{rows:"2",placeholder:t.ai.placeholder,"aria-label":t.ai.placeholder,maxlength:"2000"}),u=v("button","fg-btn fg-btn-primary fg-ai-send",{type:"submit"});u.textContent=t.ai.send,d.append(c,u);let h=v("div","fg-ai-tips");for(let f of(n?.suggestions??[]).slice(0,6)){let m=v("button","fg-ai-tip",{type:"button"});m.textContent=f,m.addEventListener("click",()=>{c.value=f,c.focus()}),h.append(m)}c.addEventListener("keydown",f=>{f.key==="Enter"&&!f.shiftKey&&!f.isComposing&&(f.preventDefault(),d.requestSubmit?.()??d.dispatchEvent(new Event("submit",{cancelable:!0})))}),d.addEventListener("submit",f=>{f.preventDefault();let m=c.value.trim();!m||this.busy||(c.value="",this.ask(m,u))}),r.append(s,l,d),h.childElementCount&&r.append(h),re(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=f=>{!de(f,r)&&!this.busy&&this.close()},w=f=>{f.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=v("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 Tn(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=v("div","fg-ai-note");a.textContent=`${n.ai.skipped}: ${s.skipped.map(l=>l.reason).join(", ")}`,r.append(a)}if(i){let a=v("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 zs=o=>Math.round(o*2.75),Vs=o=>Math.round(o*3.1),Lo=13,Io={compact:[.8,.85],normal:[1,1],comfortable:[1.25,1.15]},wl=[],yl=100,qs=new Map;function ve(o){return o.every(e=>e!==null&&typeof e=="object")?o:(O("data contains entries that are not objects; they were skipped"),o.filter(e=>e!==null&&typeof e=="object"))}var Fo=class{constructor(e,t){this.options=t;this.events=new _e;this.pinnedRows={top:[],bottom:[]};this.spanCache=null;this.editVersion=0;this.tracker=new sn;this.history=new rn;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 xn(this);this.sourceDefs=[];this.pivotCfg=null;this.pivotData=null;this.rollupOn=!1;this.rollupData=null;this.savedGroup=null;this.page=0;this.pageSize=yl;this.formulaScope={off:()=>!this.allow("formulas"),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.cfRowsSrc=null;this.sourceSnapshot=void 0;this.summarySnapshot=null;this.cfRows=[];this.formats=new Ht({rules:()=>this.cfRules,rows:()=>{let e=this.rowModel.dataRows();return this.cfRowsSrc!==e&&(this.cfRowsSrc=e,this.cfRows=e.map(t=>t.data)),this.cfRows},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 An(this);this.assistantPanel=new Pn(this);this.forcedOverlay=null;this.filterBuilder=new En(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.cellPadding=null;this.sortWithin=!1;this.mergeSel="rows";this.selBlockCache=null;this.blockStateCache=null;this.aggMemo=null;this.selectionVersion=0;this.selectableCache=null;this.paid=Ls(t.licenseKey),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 Mn({data:Array.isArray(t.data)?ve(t.data):[],sort:[],filters:{},quickFilter:"",selected:new Set,anchorId:null,focus:null,range:null,extraRanges:[],advancedFilter:null,locale:Mt(t.locale),theme:t.theme??"light"}),this.sourceDefs=Array.isArray(t.columns)?t.columns:[],this.sourceSnapshot=be(this.sourceDefs),this.columns=new Tt(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: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 nt({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 Rn({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)=>Q(i,this.store.state.locale.code)(a),collator:()=>this.collator(),textVersion:()=>`${this.store.state.locale.code}|${this.editVersion}`,sortBlocks:i=>this.sortBlocks(i)}),this.sortWithin=!!t.sortWithinMerges,this.mergeSel=this.validMergeSelection(t.mergeSelection),this.sortWithin&&this.rowModel.server&&O("sortWithinMerges is ignored with a datasource: the server sorts the rows"),t.groupBy?.length&&this.allow(this.rowModel.server?"serverGroups":"grouping")&&(this.groupBy=this.validGroupBy(t.groupBy)),Array.isArray(t.conditionalFormats)&&t.conditionalFormats.length&&this.allow("conditional")&&(this.cfRules=t.conditionalFormats.filter(i=>i&&typeof i=="object"&&Array.isArray(i.columns)).map(i=>({...i,columns:[...i.columns]}))),this.defaultExpanded=t.treeData||this.paid?t.groupDefaultExpanded??0:0,t.treeData&&!t.getRowId&&O("treeData needs getRowId so parent ids can be matched"),this.updateRows(),this.summaryOpts=t.summary&&this.allow("summary")?t.summary:null,this.summarySnapshot=be(this.summaryOpts),this.refreshSummary();let r=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:r,family:t.fontFamily??null};let s=r??Lo;if(this.renderer=new zt(e,this,{rowHeight:t.rowHeight??Math.round(zs(s)*Io[this.densityOf(t.density)][0]),headerHeight:t.headerHeight??Math.round(Vs(s)*Io[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),t.cellPadding!=null&&this.applyCellPadding(t.cellPadding),this.menu=new kn(this),this.chooser=new Xt(this),this.contextMenu=new Yt(this),this.editor=new on(this),this.finder=new en(this),this.fillHandle=new Zt(this),this.groupPanel=t.groupPanel&&this.allow("grouping")?new Vt(this):null,this.pinnedRows={top:ve(t.pinnedTopRows??[]),bottom:ve(t.pinnedBottomRows??[])},this.sideBar=t.sideBar&&this.allow("sideBar")?new Jt(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)),Vr(this),Nr(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(),Os(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),t.rollup&&this.setRollup(!0),Es(t.licenseKey).then(i=>{i&&!this.destroyed&&this.renderer.showFreeBadge()}),this.renderer.render(),this.api=this.createApi(),Wt.set(this.renderer.root,this),to.set(this.api,this),Is(t.licenseKey)}get valuesVersion(){return this.editVersion}rangesOn(){return this.options.rangeSelection!==!1&&this.paid}allow(e){return this.paid?!0:(Fs(e),!1)}columnDefs(){return[...this.sourceDefs]}summaryOptions(){return this.summaryOpts?JSON.parse(JSON.stringify(this.summaryOpts)):null}setConditionalFormats(e){if(!Array.isArray(e)){O("setConditionalFormats: formats must be an array");return}e.length&&!this.allow("conditional")||(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)}br(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.rebuildRollup(),this.rowModel.invalidate(),this.updateRows(),this.refreshSummary(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers()}display(){return{groupBy:this.options.treeData?wl: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.viewRows();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.rollupData??this.store.state.data}getRollup(){return this.rollupOn}setRollup(e){if(e=!!e,!(e&&!this.allow("pivot"))&&!(e&&this.clientOnly("rollup"))){if(e&&this.options.treeData){O("rollup is not available with treeData");return}e!==this.rollupOn&&(this.editor.cancel(),this.rollupOn=e,this.store.set({range:null,focus:null}),this.columnsChanged())}}rebuildRollup(){this.rollupData=this.rollupOn&&!this.pivotCfg?fs(this.store.state.data,this.dataColumns().map(e=>e.def)):null}sourceRowsOf(e){return this.rollupData?e.flatMap(t=>us(t)??[t]):e}cellEditable(e,t,n){return!this.rollupData&&Pt(e,t,n)}setColumnAggFunc(e,t){if(t!==null&&typeof t!="function"&&!["sum","avg","min","max","count"].includes(t)){O(`setColumnAggFunc: unknown aggFunc "${String(t)}"`);return}let n=!1,r=i=>i.map(a=>{if(!a||typeof a!="object")return a;if(Array.isArray(a.children))return{...a,children:r(a.children)};if((a.id??a.field)!==e)return a;n=!0;let l={...a};return t?l.aggFunc=t:delete l.aggFunc,l}),s=r(this.sourceDefs);if(!n){O(`setColumnAggFunc: no column "${e}"`);return}this.setColumns(s)}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.allow("pivot")||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(r=>r.id));this.pivotCfg||(this.savedGroup={groupBy:this.groupBy,expanded:this.expanded,defaultExpanded:this.defaultExpanded});let n=ko(e,r=>t.has(r));this.pivotCfg&&ls(n,this.pivotCfg)||(this.pivotCfg=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.rebuildRollup(),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=ds(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();let d=this.columns.displayed().some(c=>c.def.formula||c.def.formulas);d?this.finder.refresh():this.finder.refreshRows(s.ids),this.options.getRowHeight||d||this.columns.displayed().some(c=>c.def.merge||c.def.rowSpan)||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}this.clampRanges()}return this.editor.sync(),r.size&&this.options.flashCells!==!1&&this.flash(r),this.events.emit("transactionApplied",t),t}clampRanges(){let e=this.rowModel.getRowCount(),{range:t,extraRanges:n,focus:r}=this.store.state,s=l=>!l||l.start.rowIndex<e&&l.end.rowIndex<e?l:Math.min(l.start.rowIndex,l.end.rowIndex)>=e?null:{start:{...l.start,rowIndex:Math.min(l.start.rowIndex,e-1)},end:{...l.end,rowIndex:Math.min(l.end.rowIndex,e-1)}},i=n.map(s).filter(l=>!!l);(i.length!==n.length||i.some((l,d)=>l!==n[d]))&&this.store.set({extraRanges:i}),r&&r.rowIndex>=e&&this.store.set({focus:e?{...r,rowIndex:e-1}:null});let a=s(t);a!==t&&(this.store.set({range:a}),this.events.emit("rangeChange",{range:a&&{start:{...a.start},end:{...a.end}}}))}viewReads(e){if(!e.size)return!1;let t=this.store.state;if(this.pivotCfg||this.options.treeData||t.quickFilter||t.advancedFilter||this.groupBy.length)return!0;let r=[...t.sort.map(s=>s.colId),...Object.keys(t.filters)].map(s=>this.columns.getNode(s)?.def);return t.sort.length&&r.push(...this.sortBlocks(t.sort)??[]),r.some(s=>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}},h=new Set;for(let m of e.remove??[]){let b=u(m),C=b===null?void 0:c.get(b);C&&!h.has(C)?(h.add(C),d.delete(C),c.delete(b),r.removed.push(C),this.tracker.created.delete(C),this.tracker.originals.delete(C)):C||r.notFound.push(m)}let p=(m,b,C)=>{let S=this.tracker.originals.get(C);if(m===C){for(let x of Object.keys(m))S&&(S[x]=m[x]),a.fields.add(x);a.ids.add(b),r.updated.push(C);return}for(let[x,R]of Object.entries(m)){S&&(S[x]=R);let A=C[x];if(Object.is(A,R))continue;C[x]=R,a.fields.add(x),a.ids.add(b);let k=typeof A=="number"&&typeof R=="number"?R>A?"up":"down":"";for(let E of i.get(x)??[])s.set(`${b}\0${E}`,k)}r.updated.push(C)};for(let m of e.update??[]){let b=u(m),C=b===null?void 0:c.get(b);if(!C||h.has(C)){r.notFound.push(m);continue}p(m,b,C)}let g=Array.isArray(e.add)?[...e.add]:[];for(let m of Array.isArray(e.upsert)?e.upsert:[]){let b=u(m),C=b===null?void 0:c.get(b);C&&!h.has(C)?p(m,b,C):m&&typeof m=="object"&&g.push(m)}let y=ve(g);r.added.push(...y);for(let m of y)d.add(m),c.set(this.rowModel.idOf(m),m);if(!h.size&&!y.length)return t;let w=h.size?t.filter(m=>!h.has(m)):[...t],f=typeof e.addIndex=="number"?Math.max(0,Math.min(w.length,Math.floor(e.addIndex))):w.length;return w.splice(f,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.allow("advancedFilter")||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=i=>e[i]!==void 0&&(!t.parts||t.parts.includes(i)),r=i=>!!this.columns.getNode(i);if(n("columns")&&Array.isArray(e.columns)&&(this.columns.applyState(e.columns.filter(i=>i&&r(i.colId))),this.columnsChanged()),n("columnGroups")&&e.columnGroups&&typeof e.columnGroups=="object")for(let[i,a]of Object.entries(e.columnGroups))typeof a=="boolean"&&this.setColumnGroupOpened(i,a);n("groupBy")&&Array.isArray(e.groupBy)&&this.setGroupBy(e.groupBy.filter(r)),n("pivot")&&this.setPivot(e.pivot??null);let s={};if(n("sort")&&Array.isArray(e.sort)){let i=this.checkSort(e.sort.filter(a=>a&&r(a.colId)));i&&(s.sort=i)}if(n("filters")&&e.filters&&typeof e.filters=="object"&&(s.filters=Object.fromEntries(Object.entries(e.filters).filter(([i])=>r(i)))),n("advancedFilter")){let i=e.advancedFilter,a=i&&typeof i=="object"&&Array.isArray(i.conditions)&&i.conditions.length?i:null;a!==this.store.state.advancedFilter&&(!a||this.allow("advancedFilter"))&&(s.advancedFilter=a)}if(n("quickFilter")&&typeof e.quickFilter=="string"&&(s.quickFilter=e.quickFilter),this.store.set(s),s.sort&&this.events.emit("sortChange",{sort:[...s.sort]}),s.filters&&this.events.emit("filterChange",{filters:{...s.filters}}),"advancedFilter"in s&&this.events.emit("advancedFilterChange",{advancedFilter:s.advancedFilter??null}),n("expanded")&&e.expanded&&typeof e.expanded=="object"){let i=new Map(Object.entries(e.expanded).filter(([,a])=>typeof a=="boolean"));this.savedGroup?this.savedGroup.expanded=i:(this.expanded=i,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 i=new Set(this.rowModel.allNodes().map(a=>a.id));this.setSelected(new Set(e.selected.map(String).filter(a=>i.has(a))))}}rowNumber(e){let t=this.rowModel.rows();if(this.rowNumberCache?.rows!==t){let r=new Int32Array(t.length),s=0;t.forEach((l,d)=>{r[d]=l.kind?0:++s});let i=this.page*this.pageSize,a=this.options.pagination&&!this.rowModel.server?this.rowModel.dataRowsBefore?.(i)??i:0;this.rowNumberCache={rows:t,nums:r,offset:a}}let n=this.rowNumberCache.nums[e];return n?n+this.rowNumberCache.offset: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 nt&&(this.saveEditBeforeReload(),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}))}saveEditBeforeReload(){this.rowModel.server&&(this.editor.endRow(!0),this.editor.active&&!this.editor.commit(null)&&this.editor.cancel())}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,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?(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||$(t)?(O(`groupBy: unknown column "${t}"`),!1):!0}):[]}getGroupBy(){return[...this.groupBy]}setGroupBy(e){if(Array.isArray(e)&&e.length&&!this.allow(this.rowModel.server?"serverGroups":"grouping"))return;let t=this.validGroupBy(e);t.join("")!==this.groupBy.join("")&&(this.groupBy=t,this.page=0,this.groupPanel?.refresh(),this.sortWithin&&this.rowModel.invalidate(),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 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=ve(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()&&(O(`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=this.sourceRowsOf(e.group.rows);try{r.set(t,me(n.aggFunc,s.map(i=>G(n,i)),s))}catch{O(`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 O("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(f=>this.rowModel.idOf(f)===this.parentOf(t))??null,u=c?this.idValue(c):null,h=i.filter(f=>f!==e),p=!t||n==="inside"?h.length:h.indexOf(t)+(n==="after"?1:0);h.splice(p,0,e);let g=h.some((f,m)=>f!==i[m]);if(!a&&!g&&String(d??"")===String(u??""))return!1;let y=(f,m)=>{try{s.setParentId(e,f,m)}catch{O("treeData.setParentId threw")}},w=s?this.store.state.data.find(f=>this.rowModel.idOf(f)===this.parentOf(e))??null:null;return a?(r.removeRows([e]),s&&y(u,c),this.addRows([e],p)):(s&&y(u,c),this.replaceData(h),this.history.push({undo:()=>{s&&y(d,w),this.replaceData(i)},redo:()=>{s&&y(u,c),this.replaceData(h)}}),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: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 r=t??Lo;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]=Io[this.density];this.options.rowHeight==null&&(this.renderer.opts.rowHeight=Math.round(zs(e)*t)),this.options.headerHeight==null&&(this.renderer.opts.headerHeight=Math.round(Vs(e)*n))}setDensity(e){let t=this.densityOf(e);t!==this.density&&(this.density=t,this.renderer.applyTheme(),this.applyAutoHeights(this.font.size??Lo),this.renderer.invalidateHeights(),this.layoutChanged())}applyCellPadding(e){return e!=null&&!(typeof e=="number"&&Number.isFinite(e)&&e>=0)?(O("cellPadding must be a number of px, 0 or more"),!1):(this.cellPadding=e,e==null?this.renderer.root.style.removeProperty("--fg-cell-px"):this.renderer.root.style.setProperty("--fg-cell-px",`${e}px`),!0)}setCellPadding(e){e===this.cellPadding||!this.applyCellPadding(e)||(this.menu.close(),this.layoutChanged())}getCellPadding(){if(this.cellPadding!=null)return this.cellPadding;let e=parseFloat(getComputedStyle(this.renderer.root).getPropertyValue("--fg-cell-px"));return Number.isFinite(e)?e:12}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),this.cellPadding!=null&&e.style.setProperty("--fg-cell-px",`${this.cellPadding}px`)}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}if(!(e&&!this.allow("summary"))){if(ot(e,this.summarySnapshot)){this.summaryOpts=e;return}this.summarySnapshot=be(e),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=Er(e.rows,this.sourceRowsOf(n),r=>this.columns.getNode(r)?.def)}dataColumns(){return this.columns.displayed().filter(e=>!$(e.id))}validRange(e){if(!e||!this.rangesOn())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){if(e&&(e.start?.rowIndex!==e.end?.rowIndex||e.start?.colId!==e.end?.colId)&&!this.allow("range"))return;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){if(!this.allow("range"))return;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){if(Array.isArray(e)&&e.length&&!this.allow("range"))return;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:mt({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=>Gr(r,e,n.index))}selectAllCells(){if(!this.allow("range"))return;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){if(!t&&this.multiCell()&&!this.allow("clipboard"))return"";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),h=d.every(p=>p.r1===d[0].r1&&p.r2===d[0].r2);if(this.rangesStack(d)){let p=[...d].sort((w,f)=>u?w.r1-f.r1:w.c1-f.c1),g=p.map(w=>this.rangeMatrix(w)),y=u?g.flat():g[0].map((w,f)=>g.flatMap(m=>m[f]??[]));return e&&y.unshift((u?p.slice(0,1):p).flatMap(w=>this.rangeHeaders(w))),oo(y)}}if(s){a=[];for(let u=s.r1;u<=s.r2;u++){let h=this.rowModel.getRow(u);h&&!h.kind&&a.push(h.data)}l=r.slice(s.c1,s.c2+1).filter(u=>!$(u.id))}else if(i)a=this.shownSelectedRows(),l=this.dataColumns();else{let u=this.store.state.focus,h=u&&this.columns.getColumn(u.colId),p=u&&this.rowModel.getRow(u.rowIndex);if(!h||!p||p.kind||$(h.id))return"";a=[p.data],l=[h]}let c=a.map(u=>l.map(h=>this.copyCell(h.def,u,n)));return e&&c.unshift(l.map(u=>u.def.header??u.def.field??u.id)),oo(c)}multiCell(){let e=this.allRangeBounds();return e.length>1||e.some(t=>t.r1!==t.r2||t.c1!==t.c2)}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)?tn(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}copyText(e,t=!1){let n=this.rowModel;if(!(n instanceof nt))return this.selectionTSV(e,t);let r=n.withoutLoading(()=>this.selectionTSV(e,t)),s=t?0:n.withoutLoading(()=>this.unloadedInRanges());return s&&O(`copy: ${s} row${s>1?"s":""} of the range ${s>1?"are":"is"} not loaded and ${s>1?"were":"was"} not copied`),r}copyToClipboard(e,t=!1){let n=this.copyText(e,t);if(n&&typeof navigator<"u"&&navigator.clipboard?.writeText)try{navigator.clipboard.writeText(n)?.catch?.(()=>{})}catch{}return n}unloadedInRanges(){let e=new Set;for(let t of this.allRangeBounds())for(let n=t.r1;n<=t.r2;n++)this.rowModel.getRow(n)?.kind==="loading"&&e.add(n);return e.size}pasteText(e){let t=Br(e),n={changed:0,skipped:0};if(!t.length||(t.length>1||t[0].length>1)&&!this.allow("clipboard"))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=[],h=t.length===1&&t[0].length===1,p=h&&i?i.r2-i.r1+1:t.length,g=h&&i?i.c2-i.c1+1:Math.max(...t.map(y=>y.length));for(let y=d,w=0;y<s&&w<p;y++){let f=this.rowModel.getRow(y);if(f.kind){h&&i&&w++;continue}let m=w++;for(let b=0;b<g;b++){let C=r[c+b];if(!C)break;if($(C.id))continue;let S=h&&i?t[0][0]:t[m]?.[b];if(S===void 0)continue;let x=C.def;if(!x.field||!this.cellEditable(x,f.data,y)){n.skipped++;continue}let R=f.data[x.field],A=this.acceptText(x,f.data,S,R);if(!A.ok){n.skipped++;continue}this.writeCell(u,f.data,x.field,C.id,y,A.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&&De(n.trim()))s=n.trim();else{let a=nn(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&&V(n))return r.required;if(e.unique&&e.field&&!V(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!V(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(!this.cellEditable(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}sortBlocks(e){if(!this.sortWithin||!this.paid)return null;if(this.pivotCfg||this.options.treeData||this.groupBy.length)return O("sortWithinMerges is ignored while rows are grouped, pivoted or shown as a tree"),null;let t=new Set(e.map(n=>n.colId));return this.columns.displayed().filter(n=>n.def.merge&&!n.def.rowSpan&&!$(n.id)&&!t.has(n.id)).map(n=>n.def)}setSortWithinMerges(e){let t=!!e;if(t!==this.sortWithin){if(this.sortWithin=t,this.rowModel.server){t&&O("sortWithinMerges is ignored with a datasource: the server sorts the rows");return}this.rowModel.invalidate(),this.updateRows(),this.renderer.invalidate({rows:!0})}}mergeSpans(){if(this.rowModel.server||!this.columns.displayed().some(i=>i.def.merge||i.def.rowSpan)||!this.allow("merge"))return qs;let e=this.rowModel.rows(),t=this.editVersion*1e6+this.columns.displayed().length,n=this.columns.getColumn(ne)?this.selectionBlocks():null;if(this.spanCache&&this.spanCache.rows===e&&this.spanCache.ver===t&&this.spanCache.sel===n)return this.spanCache.spans;let r=new Map,s=this.columns.displayed().filter(i=>i.def.merge||i.def.rowSpan);if(s.length&&!e.some(i=>i.kind)){let i=e.map(a=>a.data);for(let a of s)r.set(a.id,Ke(i,a.def));if(n){let a=e.length,l=new Int32Array(a),d=new Int32Array(a);for(let c=0;c<a;c++){let u=n.index.get(e[c].id)??-1;l[c]=u<0?c:Math.max(0,c-(u-n.spans.start[u])),d[c]=u<0?c:Math.min(a-1,c+(n.spans.end[u]-u))}r.set(ne,{start:l,end:d})}}return this.spanCache={rows:e,ver:t,sel:n,spans:r},r}validMergeSelection(e){return e==null||e==="rows"?"rows":typeof e=="number"&&Number.isInteger(e)&&e>=1?e:(O("mergeSelection must be 'rows' or a whole number from 1; one checkbox per row is used"),"rows")}setMergeSelection(e){let t=this.validMergeSelection(e);t!==this.mergeSel&&(this.mergeSel=t,this.renderer.invalidate({rows:!0}))}getMergeSelection(){return this.mergeSel}mergeLevelColumns(){return this.columns.displayed().filter(e=>e.def.merge&&!e.def.rowSpan&&!$(e.id))}mergeSelectionLevel(){if(this.mergeSel==="rows")return 0;if(!this.options.rowSelection)return O("mergeSelection needs rowSelection 'multiple' or 'single'"),0;if(!this.paid)return 0;if(this.rowModel.server||this.pivotCfg||this.options.treeData||this.groupBy.length)return O("mergeSelection is ignored while rows are grouped, pivoted, shown as a tree or loaded from a datasource: one checkbox per row"),0;let e=this.mergeLevelColumns().length;return e?this.mergeSel>e?(O(`mergeSelection: level ${this.mergeSel} asked for, but only ${e} merge column${e>1?"s are":" is"} shown; level ${e} is used`),e):this.mergeSel:0}selectionBlocks(){let e=this.mergeSelectionLevel();if(!e)return null;let t=this.rowModel.dataRows(),n=this.rowModel.rows(),r=this.mergeLevelColumns().slice(0,e),s=`${e}|${this.editVersion}|${r.map(l=>l.id).join("")}`,i=this.selBlockCache;if(i&&i.rows===t&&i.disp===n&&i.key===s)return i.blocks;let a=null;if(!n.some(l=>l.kind)){let l=t.map(d=>d.data);a={level:e,cols:r,spans:Xn(r.map(d=>Ke(l,d.def)),t.length),index:new Map(t.map((d,c)=>[d.id,c]))}}return this.selBlockCache={rows:t,disp:n,key:s,blocks:a},a}blockSelection(e){let t=this.selectionBlocks(),n=t&&this.rowModel.getRow(e),r=n?t.index.get(n.id):void 0;if(!t||r===void 0)return null;let s=this.store.state.selected,i=this.blockStateCache;(!i||i.sel!==s||i.blocks!==t||i.ver!==this.editVersion)&&(i=this.blockStateCache={sel:s,blocks:t,ver:this.editVersion,map:new Map});let a=t.spans.start[r],l=i.map.get(a);if(l===void 0){let d=this.rowModel.dataRows(),c=0,u=0;for(let h=a;h<=t.spans.end[a];h++)this.rowSelectable(d[h].data)&&(c++,s.has(d[h].id)&&u++);l=c?u===0?"none":u===c?"all":"some":"off",i.map.set(a,l)}return l}blockIds(e,t){let n=this.rowModel.dataRows(),r=[];for(let s=e;s<=t;s++)this.rowSelectable(n[s].data)&&r.push(n[s].id);return r}selectBlockFromClick(e,t,n,r){let s=this.options.rowSelection,i=e.index.get(this.rowModel.getRow(t).id);if(i===void 0)return;let{start:a,end:l}=e.spans,d=a[i],c=l[i],u=this.blockIds(d,c);if(!u.length)return;let h=this.store.state.selected,p=this.rowModel.dataRows()[d].id;if(s==="single"){let y=u.every(w=>h.has(w));this.setSelected(n&&y?new Set:new Set(u),p);return}let g=this.store.state.anchorId==null?void 0:e.index.get(this.store.state.anchorId);if(r&&g!==void 0){let y=n?new Set(h):new Set;for(let w of this.blockIds(Math.min(a[g],d),Math.max(l[g],c)))y.add(w);this.setSelected(y);return}if(n){let y=new Set(h),w=u.every(f=>y.has(f));for(let f of u)w?y.delete(f):y.add(f);this.setSelected(y,p);return}this.setSelected(new Set(u),p)}selectedGroups(e=!1){let t=this.selectionBlocks(),n=this.store.state.selected;if(!t||!n.size)return[];let r=this.rowModel.dataRows(),s=[];for(let i=0;i<r.length;i=t.spans.end[i]+1){let a=[],l=!1;for(let c=i;c<=t.spans.end[i];c++){let u=n.has(r[c].id);l||(l=u),(u||e)&&a.push(r[c].data)}if(!l)continue;let d={};for(let c of t.cols)d[c.def.field??c.id]=G(c.def,r[i].data);s.push({level:t.level,values:d,rows:a})}return s}rangeAggregates(){let e=this.allRangeBounds();if(!e.length||!this.paid)return null;let t=this.columns.displayed(),n=[JSON.stringify(e),this.rowModel.rows(),this.editVersion,...t.map(l=>l.def)],r=this.aggMemo;if(r&&r.key.length===n.length&&r.key.every((l,d)=>l===n[d]))return r.value&&{...r.value};let s={cells:0,count:0,numbers:0,sum:0,min:1/0,max:-1/0},i=e.length>1?new Set:null,a=t.length;for(let l of e){let d=t.slice(l.c1,l.c2+1).filter(c=>!$(c.id));for(let c=l.r1;c<=l.r2;c++){let u=this.rowModel.getRow(c);if(!u||u.kind)continue;let h=u.data;for(let p of d){if(i){let y=c*a+p.index;if(i.has(y))continue;i.add(y)}s.cells++;let g=G(p.def,h);if(!V(g)&&(s.count++,typeof g=="number"||p.def.type==="number"&&!Number.isNaN(Number(g)))){let y=Number(g);s.numbers++,s.sum+=y,y<s.min&&(s.min=y),y>s.max&&(s.max=y)}}}}return this.aggMemo={key:n,value:s},{...s}}fillRange(e){if(!this.allow("fill"))return;let t=this.rangeBounds()??(()=>{let g=this.store.state.focus,y=g&&this.columns.getColumn(g.colId);return g&&y&&!$(y.id)?{r1:g.rowIndex,r2:g.rowIndex,c1:y.index,c2:y.index}:null})(),n=this.columns.getColumn(e.start.colId),r=this.columns.getColumn(e.end.colId);if(!t||!n||!r)return;let s=mt({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=(g,y,w)=>{let f=a[y],m=this.rowModel.getRow(g),b=f?.def;!m||m.kind||!b?.field||$(f.id)||!this.cellEditable(b,m.data,g)||this.cellError(b,m.data,w)===null&&this.writeCell(l,m.data,b.field,f.id,g,w)},c=(g,y)=>G(a[y].def,this.rowModel.getRow(g).data),u=g=>{let y=this.rowModel.getRow(g);return!!y&&!y.kind},h=(g,y,w)=>{let f=[];for(let m=g;m<=y;m++)w(m)&&f.push(m);return f},p=g=>!!a[g]&&!$(a[g].id);if(s.r1<t.r1||s.r2>t.r2){let g=h(t.r2+1,s.r2,u),y=h(s.r1,t.r1-1,u).reverse(),w=h(t.r1,t.r2,u);for(let f=t.c1;f<=t.c2;f++){let m=w.map(b=>c(b,f));gt(m,g.length).forEach((b,C)=>d(g[C],f,b)),gt([...m].reverse(),y.length).forEach((b,C)=>d(y[C],f,b))}}else if(s.c1<t.c1||s.c2>t.c2){let g=h(t.c2+1,s.c2,p),y=h(s.c1,t.c1-1,p).reverse(),w=h(t.c1,t.c2,p);for(let f of h(t.r1,t.r2,u)){let m=w.map(b=>c(f,b));gt(m,g.length).forEach((b,C)=>d(f,g[C],b)),gt([...m].reverse(),y.length).forEach((b,C)=>d(f,y[C],b))}}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=ve(e.top)),e.bottom&&(this.pinnedRows.bottom=ve(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,rowIndex:s,oldValue:a,newValue:i}),!0)}endCellTx(e){if(!e.length)return;let t=(n,r)=>{let s=n.map(i=>{let a=i.row[i.field];return i.row[i.field]=i[r],{row:i.row,rowIndex:this.rowModel.indexOfId(this.rowModel.idOf(i.row)),colId:i.colId,oldValue:a,newValue:i[r]}});this.afterDataEdit();for(let i of s)this.events.emit("cellValueChanged",i)};this.history.push({undo:()=>t([...e].reverse(),"oldValue"),redo:()=>t(e,"newValue")}),this.afterDataEdit();for(let n of e)this.events.emit("cellValueChanged",{row:n.row,rowIndex:n.rowIndex,colId:n.colId,oldValue:n.oldValue,newValue:n.newValue})}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 h=t[u]?.def;c&&!c.kind&&h?.field&&this.cellEditable(h,c.data,d)&&(!e||this.copyAllowed(h,c.data))&&this.writeCell(a,c.data,h.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=ve(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=v("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(d=>this.columns.getColumn(d)):this.columns.displayed()).filter(d=>!!d&&Lt(d.def)),{first:n,last:r}=this.renderer.renderedRange(),s=this.store.state.locale.code,i=this.getCellPadding()*2,a=i+22+6+14,l=i;for(let d of t){let c=this.renderer.measureText(d.def.header??d.def.field??"",!0)+a,u=Q(d.def,s);for(let p=n;p<=r;p++){let g=this.rowModel.getRow(p);g&&(c=Math.max(c,this.renderer.measureText(u(G(d.def,g.data)),!1)+l))}let h=this.columns.setWidth(d.id,Math.ceil(c));this.events.emit("columnResize",{colId:d.id,width:h})}this.layoutChanged()}resetColumns(){this.columns.reset(),this.columnsChanged()}setSort(e){let t=this.checkSort(e);t&&(this.store.set({sort:t}),this.events.emit("sortChange",{sort:[...t]}))}checkSort(e){let t=e.filter(n=>{let r=this.columns.getNode(n.colId);return!r||r.children?(O(`setSort: unknown column "${n.colId}"`),!1):n.dir==="asc"||n.dir==="desc"});return this.veto("beforeSort",{sort:t.map(n=>({...n}))})?null: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){O(`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)return;let i=this.selectionBlocks();if(i){this.selectBlockFromClick(i,e,t,n);return}if(!this.rowSelectable(s.data))return;let a=Ns({selected:this.store.state.selected,anchorIndex:this.anchorIndex(),mode:r,index:e,idAt:l=>this.rowModel.getRow(l).id,toggle:t,range:n});if(this.rowModel.rows()!==this.rowModel.dataRows()||this.options.isRowSelectable)for(let l of a.selected){if(this.store.state.selected.has(l))continue;let d=this.rowModel.indexOfId(l),c=d>=0?this.rowModel.getRow(d):null;c&&(c.kind||!this.rowSelectable(c.data))&&a.selected.delete(l)}if(r==="multiple"&&this.options.groupSelectsChildren&&this.options.treeData&&s.hasChildren){let l=a.selected.has(s.id);for(let d of this.groupMemberIds(s))l?a.selected.add(d):a.selected.delete(d)}this.setSelected(a.selected,this.rowModel.getRow(a.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}selectableIds(){let e=this.rowModel.dataRows(),t=this.options.isRowSelectable,n=this.selectableCache;if(n&&n.rows===e&&n.fn===t&&n.ver===this.editVersion)return n.ids;let r=new Set(this.selectableRows().map(s=>s.id));return this.selectableCache={rows:e,fn:t,ver:this.editVersion,ids:r},r}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):[]}orderedDataRows(){return this.rowModel.orderedDataRows?.()??this.rowModel.dataRows()}shownSelectedRows(){let e=this.store.state.selected;return e.size?this.orderedDataRows().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(ar(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(ir),this.options.rowSelection&&t.push(sr),[...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();let n=ve(e);this.store.set({data:n===this.store.state.data?[...n]:n}),t?.scrollToTop&&this.renderer.setScroll({top:0,left:0});let r=this.store.state.selected;if(r.size)if(this.options.getRowId){let a=new Set(this.rowModel.allNodes().map(d=>d.id)),l=new Set([...r].filter(d=>a.has(d)));l.size!==r.size&&this.setSelected(l)}else this.setSelected(new Set,null);let s=this.rowModel.getRowCount(),i=this.store.state.focus;i&&i.rowIndex>=s&&this.store.set({focus:s?{...i,rowIndex:s-1}:null})}setColumns(e){if(!Array.isArray(e)){O("setColumns: columns must be an array");return}if(ot(e,this.sourceSnapshot)){this.sourceDefs=e;return}if(this.menu.close(),this.sourceDefs=e,this.sourceSnapshot=be(e),this.pivotCfg){this.rebuildPivot();return}this.columns.updateDefs(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:this.store.state.focus&&t(this.store.state.focus.colId)?this.store.state.focus:null}),this.columnsChanged()}closePopups(){let t=!!(this.renderer.root.getRootNode().activeElement??document.activeElement)?.closest(".fg-menu");this.menu.close(),this.chooser.close(),this.contextMenu.close(),this.filterBuilder.close(),this.formatDialog.close(),this.assistantPanel.close(),t&&this.renderer.gridEl.focus({preventScroll:!0})}onChange(e){let t=(...s)=>s.some(i=>e.includes(i));t("sort","filters","quickFilter","advancedFilter")&&this.saveEditBeforeReload(),this.pivotCfg&&t("data","locale")&&this.rebuildPivot(!1),this.rollupOn&&t("data")&&this.rebuildRollup(),t("locale","theme")&&this.closePopups(),t("locale")&&(this.finder.relabel(),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();let r=t("sort","filters","quickFilter","advancedFilter","locale","data");!r&&t("selected")&&this.renderer.selectionChanged(),this.renderer.invalidate({header:r,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),setSortWithinMerges:e(t=>this.setSortWithinMerges(t)),getSortWithinMerges:e(()=>this.sortWithin),setMergeSelection:e(t=>this.setMergeSelection(t)),getMergeSelection:e(()=>this.getMergeSelection()),getSelectedGroups:e(()=>this.selectedGroups()),getSelectedGroupsAllRows:e(()=>this.selectedGroups(!0)),showOverlay:e(t=>{this.forcedOverlay=t==="loading"||t==="noRows"?t:null,this.renderer.invalidate()}),getXlsxSheet:e(t=>this.allow("excel")?yo(this,t):{name:t?.sheetName??"Sheet1",rows:[]}),print:e(t=>os(ho(this,t))),getPrintHtml:e(t=>ho(this,t)),getPdf:e(t=>this.allow("pdf")?so(vn(this,t),cn,{scale:t?.resolution,quality:t?.quality}):null),exportPdf:e((t="export.pdf",n)=>{if(!this.allow("pdf"))return;let r=so(vn(this,n),cn,{scale:n?.resolution,quality:n?.quality});r?ze(t,[r],"application/pdf"):O("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.allow("advancedFilter")&&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.allow("conditional")&&this.formatDialog.open(t)}),askAssistant:e(t=>Tn(this,t,this.allow("assistant")?this.options.assistant:void 0)),openAssistant:e(()=>{this.allow("assistant")&&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:Mt(t)})),setFont:e(t=>this.setFont(t)),setCellPadding:e(t=>this.setCellPadding(t)),getCellPadding:e(()=>this.getCellPadding()),setRollup:e(t=>this.setRollup(t)),getRollup:e(()=>this.getRollup()),setColumnAggFunc:e((t,n)=>this.setColumnAggFunc(t,n)),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.allow("sideBar")&&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.allow("find")?this.finder.find(t):0),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.allow("charts")?this.charts.create(t):{el:v("div","fg-chart-body"),setType:()=>{},update:()=>{},destroy:()=>{}}),getCsv:e(t=>go(this,t)),getJson:e(t=>mo(this,t)),exportJson:e((t="export.json",n)=>ze(t,[mo(this,n)],"application/json;charset=utf-8")),exportCsv:e((t="export.csv",n)=>ze(t,["\uFEFF",go(this,n)],"text/csv;charset=utf-8")),getXlsx:e(t=>this.allow("excel")?wo(this,t):new Uint8Array(0)),exportXlsx:e((t="export.xlsx",n)=>{this.allow("excel")&&ze(t,[wo(this,n)],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")}),importFile:e((t,n)=>ss(this,t,n)),on:e((t,n)=>this.events.on(t,n)),destroy:()=>this.destroy()}}destroy(){if(!this.destroyed){this.destroyed=!0,Wt.delete(this.renderer.root),clearTimeout(this.flashTimer),clearTimeout(this.txTimer);for(let e of this.disposers)e();this.renderer.destroy(),this.events.clear()}}};function bl(o,e){return new Fo(o,e).api}function Ws(o){let e=(Array.isArray(o)?o:[]).filter(t=>t&&t.grid&&typeof t.grid.getXlsxSheet=="function");return e.length?e.some(t=>Dr(t.grid)?.allow("workbook")===!1)?new Uint8Array(0):Qe(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"),Qe([{name:"Sheet1",rows:[]}]))}function vl(o,e){let t=Ws(e);t.length&&ze(o||"export.xlsx",[t],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")}var xl=o=>typeof o=="function"?o():o??{};async function js(o,e,t,n){let r=o,s=o.split(/[?#]/)[0],i={method:e,credentials:n.credentials??"same-origin",headers:{Accept:"application/json",...xl(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 Cl(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 Us(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 js(o,e.method??"POST",r,e);return(e.transform??Cl)(s)}}}var Do=new WeakMap;function kl(o,e,t={}){let n=Do.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 js(e,"POST",{created:r,updated:s,deleted:i,...t.params?.()??{}},t);return o.commitChanges({rows:a,deleted:i}),d})().finally(()=>Do.delete(o));return Do.set(o,l),l}var $o=new WeakMap;async function Rl(o,e,t={}){let n=($o.get(o)??0)+1;$o.set(o,n);let{rows:r}=await Us(e,t).getRows({start:0,end:t.maxRows??1e4,sort:[],filters:{},quickFilter:""});return $o.get(o)===n&&o.setData(r),r}function Sl(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 Ks=["add","update","remove","upsert"];function _s(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 Ks.some(n=>Array.isArray(t[n]))?t:Array.isArray(t.rows)?{rows:t.rows}:null}function Ml(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)&&!Ks.some(f=>f in w)?(o.flushAsyncTransactions(),o.setData(w.rows)):t.immediate?o.applyTransaction(w):o.applyTransactionAsync(w)},h=w=>{if(r)return;let f;try{f=t.parse?t.parse(w):_s(w),Array.isArray(f)&&(f={upsert:f})}catch(m){t.onError?t.onError(m):O("connectLive: a message could not be read");return}!f||typeof f!="object"||(s?i.push(f):u(f))},p=()=>{if(r||t.reconnect===!1){c("closed");return}let w=typeof t.maxDelay=="number"&&t.maxDelay>0?t.maxDelay:3e4,f=Math.min(w,500*2**Math.min(d++,10))*(.8+Math.random()*.4);c("connecting"),l=window.setTimeout(g,f)},g=()=>{if(r)return;if(l=0,t.poll){y();return}let w=t.url;if(!w){O("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 f=new WebSocket(w,t.protocols);a=f,f.onopen=()=>{d=0,c(s?"paused":"open")},f.onmessage=m=>h(m.data),f.onerror=()=>c("error"),f.onclose=()=>{a===f&&(a=null),r||p()}}else{if(typeof EventSource>"u")throw new Error("no EventSource");let f=new EventSource(w,{withCredentials:!!t.withCredentials});a=f,f.onopen=()=>{d=0,c(s?"paused":"open")},f.addEventListener(t.event||"message",m=>h(m.data)),f.onerror=()=>{f.readyState===2?(a===f&&(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"),h(w);let f=typeof t.interval=="number"&&t.interval>0?t.interval:2e3;l=window.setTimeout(y,f)}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 f of w)u(f);c(a||t.poll?"open":"connecting")},close(){r||(r=!0,clearTimeout(l),a?.close(),a=null,i=[],c("closed"))},send(w){let f=a;return!f||typeof f.send!="function"||f.readyState!==1?!1:(f.send(w),!0)}}}var El={en:ae,ko:Wo,"zh-CN":jo,"zh-TW":Uo,ja:qo,es:zo,fr:Vo,de:Go,vi:Ko,th:_o,id:Xo,ru:Jo,"pt-BR":Yo,it:Zo};for(let o of Object.values(El))Fn(o);export{Ws as buildWorkbook,al as changeTracker,Ml as connectLive,bl as createGrid,Sl as csrfHeaders,ae as en,Gn as evaluateFormula,vl as exportWorkbook,xi as formulaFunctions,Rl as loadData,El as locales,_s as messageToTransaction,lo as parseCsv,fo as readXlsx,vi as registerFormulaFunction,Fn as registerLocale,xo as renderChart,Mt as resolveLocale,Us as restDatasource,kl as saveChanges,Za as setLicenseKey,Rs as verifyLicense,et as version,Qe as writeXlsx};
46
+ `,wn=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,Oa=1e3;function Cn(o,e={}){let t=vn(o,e.columns),n=o.store.state.locale,r=n.code,i=t.map(R=>Z(R.def,r)),s=ke(r),a=e.rowNumbers??!!o.options.rowNumbers,l=R=>Pa.includes(R.align)?R.align:R.type==="number"?"right":R.type==="boolean"?"center":"left",d=t.map(R=>{let F=[];for(let P=R.node;P;P=P.parent)F.unshift(P);return F}),c=Math.max(1,...d.map(R=>R.length)),u=[];if(e.headers!==!1)for(let R=0;R<c;R++){let F=R===0&&a?[{text:"#",align:"right",num:!0,rowspan:c}]:[];for(let P=0;P<t.length;P++){let T=d[P],L=T.length-1;if(R<L){let B=T[R];if(P>0&&d[P-1][R]===B)continue;let j=1;for(;P+j<t.length&&d[P+j][R]===B;)j++;F.push({text:Ve(B.def,B.id),align:j>1?"center":"left",span:j,group:!0})}else R===L&&F.push({text:Ve(t[P].def,t[P].id),align:l(t[P].def),span:1,rowspan:c-R})}u.push(F)}let p=(R,F,P,T)=>{if(P==null||P==="")return"";if(T==="count")return s.format(P);let L=R.def.type??(typeof P=="number"?"number":P instanceof Date?"date":void 0);return L===R.def.type?i[F](P):lt(R.def,L,r)(P)},m=(R,F,P,T=0)=>{let L=0;for(;L<t.length-1&&!P[L];)L++;L=Math.max(1,L);let B=a?[{text:"",align:"right",num:!0}]:[];B.push({text:F,align:"left",span:L,indent:T});for(let j=L;j<t.length;j++)B.push({text:P[j]??"",align:l(t[j].def)});return{kind:R,level:T,cells:B}},g=xn(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)?ni(o):null,f=[],h=typeof e.maxRows=="number"&&e.maxRows>=1?Math.floor(e.maxRows):Oa,b=0;try{for(let R of $a(o,g,y)){if(R.kind==="row"&&b>=h)break;if(R.kind==="group"){let T=o.columns.getNode(R.colId)?.def,L=q(R.value)?n.blanks:T?Z(T,r)(R.value):String(R.value),B=`${T?Ve(T,R.colId):R.colId}: ${L} (${s.format(R.rows.length)})`,j=t.map((z,_)=>{if(!(!z.def.aggFunc||y.includes(z.id)))try{return p(z,_,ye(z.def.aggFunc,R.rows.map(X=>G(z.def,X)),R.rows),z.def.aggFunc)||void 0}catch{return}});f.push(m("group",B,j,R.level));continue}let F=R.row,P=a?[{text:String(R.n),align:"right",num:!0}]:[];t.forEach((T,L)=>{let B=G(T.def,F),j=q(B)?"":i[L](B),z={text:j,align:l(T.def)};if(w&&T.def.cellClass){let X;try{X=typeof T.def.cellClass=="function"?T.def.cellClass({value:B,formatted:j,row:F,rowIndex:R.n-1,column:T.def}):T.def.cellClass}catch{X=void 0}if(X){let J=w.of(X);J.color&&(z.color=Qr(J.color)),J.fill&&(z.fill=Qr(J.fill)),J.bold&&(z.bold=!0)}}let _=e.styles!==!1?o.cellFormat(F,T.id,B):null;if(_){let X=_.style;wn(X.color)&&(z.color=wn(X.color)),wn(X.background)&&(z.fill=wn(X.background)),X.bold&&(z.bold=!0),X.italic&&(z.italic=!0),X.strike&&(z.strike=!0);let J=ge(X);J&&(z.align=J),_.bar&&(z.bar={from:_.bar.from,to:_.bar.to,color:/^#[0-9a-f]{3,8}$/i.test(_.bar.color)?_.bar.color:"#93c5fd"}),_.icon&&(z.icon={char:_.icon.char,color:_.icon.color})}P.push(z)}),f.push({kind:"row",cells:P}),b++}}finally{w?.dispose()}let C=[],M=e.summary!==!1?o.summary():null;M&&M.opts.rows.forEach((R,F)=>{let P=t.map((T,L)=>{let B=R.columns?.[T.id];return B===void 0?void 0:p(T,L,M.values[F]?.[T.id],pt(B).agg)||void 0});C.push(m("total",R.label??"",P))});let v=t.map(R=>Math.max(1,R.width)),S=v.reduce((R,F)=>R+F,0),A=Fa.includes(e.paper)?e.paper:"A4",D=e.orientation==="portrait"||e.orientation==="landscape"?e.orientation:S+(a?40:0)>Ia?"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,f.length):0,I=g.length>b?n.printLimited.replace("{n}",s.format(b)).replace("{total}",s.format(g.length)):"";return I&&C.push({kind:"total",cells:[{text:I,align:"left",span:t.length+(a?1:0),italic:!0}]}),{lang:r,limited:I,title:e.title??"",subtitle:e.subtitle??"",printed:k,footer:e.footer??"",paper:A,orientation:D,fit:e.fitToWidth!==!1,numbered:a,widths:a?[40,...v]:v,head:u,body:f,foot:C,striped:e.striped!==!1,pageNumbers:e.pageNumbers!==!1,repeatHeader:e.repeatHeader!==!1,repeatTitle:!!e.repeatTitle,repeatRows:E}}function Ba(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),i=(o.bar.to*100).toFixed(1);n(`background-image:linear-gradient(to right,transparent ${r}%,${o.bar.color}66 ${r}%,${o.bar.color}66 ${i}%,transparent ${i}%)`)}return t}function ei(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}>${ve(o.text)}</${e}>`;let n=Ba(o,e==="th"),r=o.icon?`<span style="color:${ve(o.icon.color)};margin-right:5px">${ve(o.icon.char)}</span>`:"";return`<${e}${t}${n?` style="${ve(n)}"`:""}>${r}${ve(o.text)}</${e}>`}var ho=o=>`<tr${o.kind==="group"?` class="group level-${Math.min(o.level??0,5)}"`:o.kind==="total"?' class="total"':""}>${o.cells.map(e=>ei(e,"td")).join("")}</tr>`;function po(o,e={}){let t=Cn(o,e),n=t.widths.slice(t.numbered?1:0).reduce((h,b)=>h+b,0),r=t.fit?`<colgroup>${t.numbered?'<col style="width:40px">':""}${t.widths.slice(t.numbered?1:0).map(h=>`<col style="width:${Math.round(h/n*1e3)/10}%">`).join("")}</colgroup>`:"",i=ve(t.title||(typeof document<"u"?document.title:"")||""),s=t.title||t.subtitle?`<div>${t.title?`<h1>${i}</h1>`:""}${t.subtitle?`<p class="sub">${ve(t.subtitle)}</p>`:""}</div>`:"<div></div>",a=t.title||t.subtitle||t.printed?`<header>${s}${t.printed?`<p class="printed">${ve(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: ${Da(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(h=>`<tr>${h.map(b=>ei(b,"th")).join("")}</tr>`).join(""),p=t.body.slice(0,t.repeatRows).map(ho).join(""),m=Math.max(1,t.widths.length),g=t.repeatTitle&&a?`<tr class="title"><td colspan="${m}">${a}</td></tr>`:"",y=t.repeatHeader?`${g}${u}${p}`:`${g}${p}`,w=(t.repeatHeader?"":u)+t.body.slice(t.repeatRows).map(ho).join(""),f=t.foot.map(ho).join("");return`<!doctype html><html lang="${ve(t.lang)}"><head><meta charset="utf-8"><title>${i}</title><style>
47
+ @page { ${d} }${Na}${c}
48
+ </style></head><body>${t.repeatTitle?"":a}<table${t.fit?' class="fit"':""}>${r}<thead>${y}</thead><tbody>${w}</tbody>${f?`<tfoot>${f}</tfoot>`:""}</table></body></html>`}function ti(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(),O("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{O("printing is not supported in this environment")}r()},50)}function go(o,e={}){let t=vn(o,e.columns),n=o.store.state.locale.code,r=typeof e.separator=="string"&&e.separator.length===1?e.separator:",",i=xn(o,e.rows).map(s=>t.map(a=>{let l=G(a.def,s),d=a.def.type,c=on(a.def,l,n);return{value:c,text:typeof l!="number"&&(!(d==="number"||d==="date"||d==="boolean")||typeof l=="string"&&!La.test(c))}}));return e.headers!==!1&&i.unshift(t.map(s=>({value:Ve(s.def,s.id),text:!0}))),Ur(i,r)}function mo(o,e={}){let t=vn(o,e.columns),n=o.store.state.locale.code,r=e.formatted?t.map(l=>Z(l.def,n)):null,i=t.map(l=>e.keys==="header"?Ve(l.def,l.id):l.id),s=xn(o,e.rows).map(l=>{let d={};return t.forEach((c,u)=>{let p=G(c.def,l);d[i[u]]=r?q(p)?"":r[u](p):p===void 0?null:p}),d}),a=typeof e.space=="number"&&e.space>=0?Math.min(10,e.space):2;return JSON.stringify(s,null,a)}function Ha(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 yn(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(i=>i+i).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 ni(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}},i=r(""),s=new Map;return{of(a){let l=s.get(a);if(!l){let d=r(a);l={},d.color!==i.color&&yn(d.color)&&(l.color=yn(d.color)),d.fill!==i.fill&&yn(d.fill)&&(l.fill=yn(d.fill)),d.bold&&!i.bold&&(l.bold=!0),s.set(a,l)}return l},dispose:()=>t.remove()}}function wo(o,e={}){return tt([yo(o,e)])}function yo(o,e={}){let t=vn(o,e.columns),n=o.store.state.locale.code,r=[],i=[],s=0;if(e.headers!==!1){let w=t.map(h=>{let b=[];for(let C=h.node;C;C=C.parent)b.unshift(C);return b});s=Math.max(1,...w.map(h=>h.length));let f=h=>{let b="";for(let C=h+1;C>0;C=Math.floor((C-1)/26))b=String.fromCharCode(65+(C-1)%26)+b;return b};for(let h=0;h<s;h++){let b=[];for(let C=0;C<t.length;C++){let M=w[C],v=M.length-1;if(h<v){let S=M[h],A=C>0?w[C-1][h]:null;if(b.push({v:A===S?null:Ve(S.def,S.id),header:!0}),A!==S){let D=C;for(;D+1<t.length&&w[D+1][h]===S;)D++;D>C&&i.push(`${f(C)}${h+1}:${f(D)}${h+1}`)}}else h===v?(b.push({v:Ve(t[C].def,t[C].id),header:!0}),s-1>h&&i.push(`${f(C)}${h+1}:${f(C)}${s}`)):b.push({v:null,header:!0})}r.push(b)}}let a=t.map(w=>Ha(w.def)),l=t.map(w=>Z(w.def,n)),d=xn(o,e.rows),c=e.styles!==!1,u=c&&t.some(w=>w.def.cellClass)?ni(o):null,p=(w,f,h)=>{if(q(h))return null;let b=a[f]??void 0;switch(w.def.type){case"number":{let C=typeof h=="number"?h:Number(h);return Number.isFinite(C)?{v:C,fmt:b}:String(h)}case"date":{let C=he(h);return C?{v:C,fmt:b}:String(h)}case"boolean":return typeof h=="number"&&Number.isFinite(h)||typeof h=="boolean"?h:String(h);default:return typeof h=="number"&&Number.isFinite(h)?h:l[f](h)}};try{d.forEach((w,f)=>{r.push(t.map((h,b)=>{let C=G(h.def,w),M=p(h,b,C);if(!c)return M;let v=h.def.align?{align:h.def.align}:{};if(u&&h.def.cellClass){let A;try{A=typeof h.def.cellClass=="function"?h.def.cellClass({value:C,formatted:l[b](C),row:w,rowIndex:f,column:h.def}):h.def.cellClass}catch{A=void 0}A&&(v={...v,...u.of(A)})}let S=o.cellFormat(w,h.id,C);if(S){let A=Xn(S.style.color),D=Xn(S.style.background);A&&(v.color=A),D&&(v.fill=D),S.style.bold&&(v.bold=!0);let k=ge(S.style);k&&(v.align=k)}return Object.keys(v).length?M!==null&&typeof M=="object"&&!(M instanceof Date)?{...M,...v}:{v:M,...v}:M}))})}finally{u?.dispose()}let m=new Set,g=w=>{let f="";for(let h=w+1;h>0;h=Math.floor((h-1)/26))f=String.fromCharCode(65+(h-1)%26)+f;return f},y=(w,f,h,b)=>{for(let C=w;C<=h;C++)for(let M=f;M<=b;M++)if(m.has(`${C},${M}`))return;for(let C=w;C<=h;C++)for(let M=f;M<=b;M++)m.add(`${C},${M}`);i.push(`${g(f)}${s+w+1}:${g(b)}${s+h+1}`)};return d.forEach((w,f)=>t.forEach((h,b)=>{let C=h.def.colSpan?gt(h.def.colSpan,h.def,w,f,t.length-b):1;C>1&&y(f,b,f,b+C-1)})),t.forEach((w,f)=>{if(!w.def.merge&&!w.def.rowSpan)return;let h=Xe(d,w.def);for(let b=0;b<d.length;b++)h.start[b]===b&&h.end[b]>b&&y(b,f,h.end[b],f)}),{name:e.sheetName??"Sheet1",rows:r,widths:t.map(w=>Math.round(w.width/7)),merges:i,freezeRows:s,printTitleRows:e.repeatHeader===!1?0:s+(Number.isInteger(e.repeatRows)&&e.repeatRows>0?e.repeatRows:0),autoFilter:s>0}}function qe(o,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})),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 bn=o=>String(o??"").trim().toLowerCase();function Ga(o){return o==null?"":o instanceof Date?o.getHours()||o.getMinutes()||o.getSeconds()?o.toISOString():se(o)??"":String(o)}async function oi(o,e,t={}){let n=e instanceof Uint8Array?e:new Uint8Array(e instanceof ArrayBuffer?e:await e.arrayBuffer()),r;if(gn(n)){let y=await fo(n),w=typeof t.sheet=="string"?y.find(f=>f.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=lo(y,ao(y))}if(!r.length)return{rows:[],skipped:0};let i=[],s=y=>y.forEach(w=>w.children?s(w.children):!N(w.id)&&w.def.field&&i.push(w));s(o.columns.roots());let a=y=>{let w=bn(y);return w?i.find(f=>bn(f.def.header)===w)??i.find(f=>bn(f.def.field)===w||bn(f.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(h=>h!=null&&String(h).trim()!==""),f=w.map(a).filter(h=>h&&!d.has(h));if(!w.length||!w.every(h=>typeof h=="string")||!f.length)break;f.forEach(h=>d.add(h)),l++}let c=Math.max(...r.slice(0,l).map(y=>y?.length??0)),u=Array.from({length:c},(y,w)=>{for(let f=l-1;f>=0;f--){let h=r[f]?.[w];if(h!=null&&String(h).trim()!=="")return a(h)}return null}),p=o.store.state.data[0],m=0,g=[];for(let y of r.slice(l)){if(!y||y.every(f=>f==null||String(f).trim()===""))continue;let w={};u.forEach((f,h)=>{if(!f)return;let b=f.def,C=Ga(y[h]),M=o.acceptText(b,w,C,p?.[b.field]);M.ok?C===""&&(M.value===null||M.value==="")||(w[b.field]=M.value):m++}),g.push(w)}return t.mode==="replace"?o.setData(g):o.addRows(g),{rows:g,skipped:m}}var za="http://www.w3.org/2000/svg";var bo=["var(--fg-accent, #2563eb)","#f59e0b","#10b981","#ef4444","#8b5cf6","#06b6d4","#ec4899","#84cc16","#f97316","#64748b","#14b8a6","#a855f7"],Le=o=>bo[o%bo.length];function Q(o,e={},t=""){let n=document.createElementNS(za,o);t&&n.setAttribute("class",t);for(let[r,i]of Object.entries(e))n.setAttribute(r,String(i));return n}function Ct(o,e){let t=Q("title");t.textContent=e,o.append(t)}function vo(o,e,t=5){let n=Math.min(0,o),r=Math.max(0,e);n===r&&(r=n+1);let i=(r-n)/t,s=10**Math.floor(Math.log10(i)),a=[1,2,5,10].map(d=>d*s).find(d=>d>=i);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 xo(o,e){let t=new Intl.NumberFormat(e.locale,{maximumFractionDigits:2}),n=new Intl.NumberFormat(e.locale,{notation:"compact",maximumFractionDigits:1}),r=Q("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 i=e.series.slice(0,bo.length),s=e.categories,a=16;if(e.title){let E=Q("text",{x:320,y:22,"text-anchor":"middle"},"fg-chart-title");E.textContent=e.title,r.append(E),a=36}let l=Q("g",{},"fg-chart-legend"),d=e.type==="pie"||e.type==="donut",c=d?s:e.type==="scatter"?i.slice(1).map(E=>E.name):i.map(E=>E.name),u=16;c.forEach((E,I)=>{let R=Q("g",{transform:`translate(${u},350)`},"fg-chart-legend-item");R.append(Q("rect",{x:0,y:-9,width:10,height:10,rx:2,fill:Le(I)}));let F=Q("text",{x:14,y:0});F.textContent=E,R.append(F),l.append(R),u+=24+Math.min(140,E.length*7)});let p=308;if(e.type==="scatter"){Va(r,e,i,a,p,t,n),r.append(l),o.replaceChildren(r);return}if(d){let E=(i[0]?.values??[]).map(L=>L!==null&&L>0?L:0),I=E.reduce((L,B)=>L+B,0),R=640/2,F=(a+p)/2,P=Math.max(10,(p-a)/2-6),T=-Math.PI/2;E.forEach((L,B)=>{if(!L||!I)return;let j=T+L/I*Math.PI*2,z=j-T>Math.PI?1:0,_=ne=>`${R+P*Math.cos(ne)},${F+P*Math.sin(ne)}`,X=L===I?`M${R-P},${F}a${P},${P} 0 1,0 ${2*P},0a${P},${P} 0 1,0 ${-2*P},0`:`M${R},${F}L${_(T)}A${P},${P} 0 ${z} 1 ${_(j)}Z`,J=Q("path",{d:X,fill:Le(B)},"fg-chart-slice");Ct(J,`${s[B]}: ${t.format(L)} (${Math.round(L/I*1e3)/10}%)`),r.append(J),T=j}),e.type==="donut"&&r.append(Q("circle",{cx:R,cy:F,r:P*.58,fill:"var(--fg-bg, #fff)"},"fg-chart-donut-hole")),r.append(l),o.replaceChildren(r);return}let m=e.type==="stackedBar",g=0,y=0;s.forEach((E,I)=>{let R=0,F=0;for(let P of i){let T=P.values[I];T==null||!Number.isFinite(T)||(m?T>=0?R+=T:F+=T:(y=Math.max(y,T),g=Math.min(g,T)))}m&&(y=Math.max(y,R),g=Math.min(g,F))});let w=vo(g,y),f=w[0],h=w[w.length-1],b=56,C=624,M=E=>p-(E-f)/(h-f)*(p-a),v=Q("g",{},"fg-chart-axis");for(let E of w){v.append(Q("line",{x1:b,x2:C,y1:M(E),y2:M(E)},E===0?"fg-chart-zero":"fg-chart-grid"));let I=Q("text",{x:b-6,y:M(E)+4,"text-anchor":"end"});I.textContent=n.format(E),v.append(I)}let S=(C-b)/Math.max(1,s.length),A=Math.max(1,Math.ceil(s.length/Math.floor((C-b)/56)));s.forEach((E,I)=>{if(I%A)return;let R=Q("text",{x:b+S*(I+.5),y:p+16,"text-anchor":"middle"}),F=Math.max(3,Math.min(12,Math.floor(S*A/10)));R.textContent=E.length>F?`${E.slice(0,F-1)}\u2026`:E,v.append(R)}),r.append(v);let D=Q("g",{},"fg-chart-plot"),k=e.type==="combo";if(k){let E=S*.6,I=i[0];s.forEach((R,F)=>{let P=I?.values[F];if(P==null||!Number.isFinite(P))return;let T=b+S*F+(S-E)/2,L=Q("rect",{x:T,y:Math.min(M(0),M(P)),width:Math.max(1,E-2),height:Math.max(.5,Math.abs(M(P)-M(0))),fill:Le(0),rx:2},"fg-chart-bar");Ct(L,`${I.name} \xB7 ${R}: ${t.format(P)}`),D.append(L)})}if(e.type==="bar"||m){let E=S*.72,I=m?E:E/Math.max(1,i.length);s.forEach((R,F)=>{let P=0,T=0;i.forEach((L,B)=>{let j=L.values[F];if(j==null||!Number.isFinite(j))return;let z=0,_=j;m&&(z=j>=0?P:T,_=z+j,j>=0?P=_:T=_);let X=b+S*F+(S-E)/2+(m?0:I*B),J=Q("rect",{x:X,y:Math.min(M(z),M(_)),width:Math.max(1,I-2),height:Math.max(.5,Math.abs(M(_)-M(z))),fill:Le(B),rx:2},"fg-chart-bar");Ct(J,`${L.name} \xB7 ${R}: ${t.format(j)}`),D.append(J)})})}else i.forEach((E,I)=>{if(k&&I===0)return;let R=E.values.map((T,L)=>T==null||!Number.isFinite(T)?null:[b+S*(L+.5),M(T),T]),F="",P=!1;for(let T of R){if(!T){P=!1;continue}F+=`${P?"L":"M"}${T[0]},${T[1]}`,P=!0}if(e.type==="area"){let T=R.filter(L=>!!L);if(T.length){let L=`M${T[0][0]},${M(0)}${T.map(B=>`L${B[0]},${B[1]}`).join("")}L${T[T.length-1][0]},${M(0)}Z`;D.append(Q("path",{d:L,fill:Le(I),"fill-opacity":.18},"fg-chart-area"))}}D.append(Q("path",{d:F,fill:"none",stroke:Le(I),"stroke-width":2.2,"stroke-linejoin":"round"},"fg-chart-line")),R.forEach((T,L)=>{if(!T)return;let B=Q("circle",{cx:T[0],cy:T[1],r:3.5,fill:Le(I)},"fg-chart-point");Ct(B,`${E.name} \xB7 ${s[L]}: ${t.format(T[2])}`),D.append(B)})});r.append(D,l),o.replaceChildren(r)}function Va(o,e,t,n,r,i,s){let a=t[0]?.values??[],l=t.slice(1),d=S=>S!=null&&Number.isFinite(S),c=a.filter(d),u=l.flatMap(S=>S.values.filter(d));if(!c.length||!u.length)return;let p=S=>S.reduce((A,D)=>Math.min(A,D)),m=S=>S.reduce((A,D)=>Math.max(A,D)),g=vo(p(c),m(c)),y=vo(p(u),m(u)),w=56,f=624,h=S=>w+(S-g[0])/(g[g.length-1]-g[0])*(f-w),b=S=>r-(S-y[0])/(y[y.length-1]-y[0])*(r-n),C=Q("g",{},"fg-chart-axis");for(let S of y){C.append(Q("line",{x1:w,x2:f,y1:b(S),y2:b(S)},S===0?"fg-chart-zero":"fg-chart-grid"));let A=Q("text",{x:w-6,y:b(S)+4,"text-anchor":"end"});A.textContent=s.format(S),C.append(A)}g.forEach((S,A)=>{let D=A===0?"start":A===g.length-1?"end":"middle",k=Q("text",{x:h(S),y:r+16,"text-anchor":D});k.textContent=s.format(S),C.append(k)});let M=Q("text",{x:f,y:r+32,"text-anchor":"end"},"fg-chart-axis-name");M.textContent=`${t[0]?.name??""} \u2192`,C.append(M),o.append(C);let v=Q("g",{},"fg-chart-plot");a.forEach((S,A)=>{d(S)&&l.forEach((D,k)=>{let E=D.values[A];if(!d(E))return;let I=Q("circle",{cx:h(S),cy:b(E),r:4,fill:Le(k),"fill-opacity":.8},"fg-chart-point");Ct(I,`${e.categories[A]??""}: ${t[0].name} ${i.format(S)}, ${D.name} ${i.format(E)}`),v.append(I)})}),o.append(v)}var qa=12,ri=500,Co=["bar","stackedBar","line","area","combo","pie","donut","scatter"],Rn=class{constructor(e){this.grid=e;this.handles=new Set}create(e={}){let{grid:t}=this,n=Co.includes(e.type)?e.type:"bar",r=()=>t.store.state.locale,i=e.range??t.store.state.range,s=null;if(i){let y=t.columns.getColumn(i.start.colId),w=t.columns.getColumn(i.end.colId);if(y&&w){let f=yt({start:{rowIndex:i.start.rowIndex,colIndex:y.index},end:{rowIndex:i.end.rowIndex,colIndex:w.index}}),h=[];for(let b=f.r1;b<=f.r2&&h.length<ri;b++){let C=t.rowModel.getRow(b);C&&!C.kind&&h.push(C.data)}s={rows:h,colIds:t.columns.displayed().slice(f.c1,f.c2+1).filter(b=>!N(b.id)).map(b=>b.id)}}}let a=()=>{let y=s?s.rows:t.rowModel.dataRows().slice(0,ri).map(v=>v.data),w=(s?s.colIds.map(v=>t.columns.getColumn(v)):t.columns.displayed().filter(v=>!N(v.id))).filter(v=>!!v),f=w[0]&&w[0].def.type!=="number"?w[0]:s?null:w.find(v=>v.def.type!=="number")??null,h=v=>!!v.node.parent&&v.node.parent.id==="pivotgroup|total",b=w.filter(v=>v!==f&&v.def.type==="number"&&(s||!h(v))).slice(0,qa),C=v=>{let S=[];for(let A=v.node.parent;A;A=A.parent)S.unshift(A.def.header??A.id);return S.push(v.def.header??v.def.field??v.id),S.join(" \xB7 ")},M=f?Z(f.def,r().code):null;return{categories:y.map((v,S)=>f&&M?M(G(f.def,v)):String(S+1)),series:b.map(v=>({name:C(v),values:y.map(S=>{let A=G(v.def,S),D=typeof A=="number"?A:A==null||A===""?NaN:Number(A);return Number.isFinite(D)?D:null})}))}},l=x("div","fg-chart-body"),d=null,c=()=>xo(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],p=()=>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 f of Co){let h=x("button","fg-chart-type",{type:"button",title:u(f)});h.dataset.type=f,h.textContent=u(f),h.addEventListener("click",()=>g.setType(f)),y.append(h)}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 m=[t.events.on("cellValueChanged",()=>c()),t.events.on("rowsAdded",()=>c()),t.events.on("rowsRemoved",()=>c())];s||m.push(t.events.on("sortChange",()=>c()),t.events.on("filterChange",()=>c()));let g={el:l,setType:y=>{Co.includes(y)&&(n=y,p(),c())},update:()=>c(),destroy:()=>{m.forEach(y=>y()),(d??l).remove(),this.handles.delete(g)}};return this.handles.add(g),p(),c(),g}destroy(){for(let e of[...this.handles])e.destroy()}};var ii=new WeakMap,Wa=o=>typeof o=="function"?"custom":o;function Ro(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 si(o,e){let t=(n,r)=>n.length===r.length&&n.every((i,s)=>i===r[s]);return o.totals===e.totals&&t(o.rows,e.rows)&&t(o.columns,e.columns)&&o.values.length===e.values.length&&o.values.every((n,r)=>n.colId===e.values[r].colId&&n.aggFunc===e.values[r].aggFunc)}function ai(o,e,t,n,r){let i=Ro(e,v=>!!t(v)),s=new Intl.Collator(r,{numeric:!0,sensitivity:"base"}),a=v=>t(v),l=(v,S)=>v.map(A=>te(G(a(A),S))).join(""),d=new Map,c=new WeakMap;for(let v of o){let S=l(i.columns,v);c.set(v,S),d.has(S)||d.set(S,i.columns.map(A=>G(a(A),v)))}let u=new WeakMap,p=v=>{let S=u.get(v);if(!S){let A=v.flatMap(k=>ii.get(k)??[]),D=new Map;for(let k of A){let E=c.get(k)??l(i.columns,k),I=D.get(E);I||D.set(E,I=[]),I.push(k)}u.set(v,S={all:A,byCombo:D})}return S},m=[...d.entries()].sort((v,S)=>{for(let A=0;A<i.columns.length;A++){let D=vt(v[1][A],S[1][A],s);if(D)return D}return 0});i.columns.length||m.splice(0,m.length,["",[]]);let g=[],y=(v,S,A)=>{let D=i.values[S],k=a(D.colId),E=`pivot|${A}|${S}`;g.push({id:E,comboKey:v,valueIndex:S});let I=D.aggFunc;return{id:E,field:E,header:`${k.header??k.field??D.colId} (${n.agg(Wa(I))})`,type:"number",format:I==="count"?"integer":k.format,width:130,aggFunc:(R,F)=>{let P=p(F),T=v===null?P.all:P.byCombo.get(v)??[];return T.length?ye(I,T.map(L=>G(k,L)),T):null}}},w=[],f=(v,S)=>{if(q(S))return n.blank;let A=a(v);return A.type==="number"&&!A.format?String(S):Z(A,r)(S)};if(!i.columns.length)i.values.forEach((v,S)=>w.push(y("",S,0)));else{let v=(S,A,D)=>{let k=[],E=0;for(;E<S.length;){let I=S[E][1][A],R=te(I),F=E;for(;F<S.length&&te(S[F][1][A])===R;)F++;let P=S.slice(E,F),T=A===i.columns.length-1?i.values.map((L,B)=>y(P[0][0],B,D+E)):v(P,A+1,D+E);k.push({id:`pivotgroup|${A}|${D+E}`,header:f(i.columns[A],I),children:T}),E=F}return k};w.push(...v(m,0,0)),i.totals&&i.values.length&&w.push({id:"pivotgroup|total",header:n.total,children:i.values.map((S,A)=>y(null,A,"total"))})}let h=new Map;for(let v of o){let S=l(i.rows,v),A=h.get(S);A||h.set(S,A={values:i.rows.map(D=>G(a(D),v)),src:[]}),A.src.push(v)}let C=[...h.values()].sort((v,S)=>{for(let A=0;A<i.rows.length;A++){let D=vt(v.values[A],S.values[A],s);if(D)return D}return 0}).map(v=>{let S={};i.rows.forEach((D,k)=>{S[a(D).field??D]=v.values[k]});let A=new Map;if(i.columns.length)for(let D of v.src){let k=l(i.columns,D),E=A.get(k);E||A.set(k,E=[]),E.push(D)}for(let D of g){let k=i.values[D.valueIndex],E=D.comboKey===null||!i.columns.length?v.src:A.get(D.comboKey)??[],I=a(k.colId);S[D.id]=E.length?ye(k.aggFunc,E.map(R=>G(I,R)),E):null}return ii.set(S,v.src),S});return{columns:[...i.rows.map(v=>{let S=a(v);return{id:v,field:S.field??v,header:S.header??S.field??v,type:S.type,format:S.format,width:S.width??140}}),...w],rows:C,groupBy:i.rows.slice(0,-1)}}var li=new WeakMap;function Rt(o){return li.get(o)}function di(o,e,t){let n=c=>t?t.includes(c.id):!c.def.aggFunc,r=e.filter(n).map(c=>c.def),i=e.filter(c=>!n(c)&&c.def.field&&!c.def.valueGetter).map(c=>c.def),s=i.filter(c=>c.aggFunc),a=i.filter(c=>!c.aggFunc),l=new Map;for(let c of o){let u=r.map(m=>te(G(m,c))).join(""),p=l.get(u);p||l.set(u,p=[]),p.push(c)}let d=[];for(let c of l.values()){let u={...c[0]};for(let p of s)try{u[p.field]=ye(p.aggFunc,c.map(m=>G(p,m)),c)}catch{u[p.field]=null}if(c.length>1)for(let p of a){let m=te(G(p,c[0]));c.some(g=>te(G(p,g))!==m)&&(u[p.field]=null)}li.set(u,c),d.push(u)}return d}var ci={grouping:{en:"Row grouping and aggregation",ko:"\uD589 \uADF8\uB8F9\xB7\uC9D1\uACC4"},pivot:{en:"Pivot",ko:"\uD53C\uBC97"},charts:{en:"Charts",ko:"\uCC28\uD2B8"},range:{en:"Cell range selection",ko:"\uC140 \uBC94\uC704 \uC120\uD0DD"},clipboard:{en:"Range copy and paste",ko:"\uBC94\uC704 \uBCF5\uC0AC\xB7\uBD99\uC5EC\uB123\uAE30"},fill:{en:"Fill handle",ko:"\uCC44\uC6B0\uAE30 \uD578\uB4E4"},excel:{en:"Excel export",ko:"\uC5D1\uC140 \uB0B4\uBCF4\uB0B4\uAE30"},pdf:{en:"PDF export",ko:"PDF \uB0B4\uBCF4\uB0B4\uAE30"},serverGroups:{en:"Server-side groups",ko:"\uC11C\uBC84 \uADF8\uB8F9"},advancedFilter:{en:"Advanced filter",ko:"\uACE0\uAE09 \uD544\uD130"},sideBar:{en:"Side bar panels",ko:"\uC0AC\uC774\uB4DC\uBC14 \uD328\uB110"},contextMenu:{en:"Context menu",ko:"\uCEE8\uD14D\uC2A4\uD2B8 \uBA54\uB274"},summary:{en:"Summary rows",ko:"\uD569\uACC4 \uD589"},formulas:{en:"Formulas",ko:"\uC218\uC2DD"},find:{en:"Find",ko:"\uCC3E\uAE30"},conditional:{en:"Conditional formatting",ko:"\uC870\uAC74\uBD80 \uC11C\uC2DD"},merge:{en:"Merged cells",ko:"\uC140 \uBCD1\uD569"},workbook:{en:"Workbook",ko:"\uC6CC\uD06C\uBD81"}};var nt="1.11.0";var ja={kty:"EC",crv:"P-256",x:"sUTKkglZmk-HMKPNub8p7AeLBKesHCU8irIkw9rJlbE",y:"j0U_aKRDR7iApY9UpaD3hUemhBLZJwDv9-QiT_hUyw8"},We="https://freegrid.app/pricing/",ot="https://freegrid.app/license/personal/",ui="https://freegrid.app/api/usage",Ua="https://freegrid.app/api/domain-status",Ka=o=>Number.parseInt(String(o).split(".")[0],10),yi=o=>{let e=atob(o.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-o.length%4)%4));return Uint8Array.from(e,t=>t.charCodeAt(0))};function St(o){let e=o.toLowerCase().replace(/^\[|\]$/g,"");if(!e||e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="0.0.0.0"||e.endsWith(".localhost")||e.endsWith(".test")||e.endsWith(".local"))return!0;let t=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(e);if(!t)return!1;let[n,r,i,s]=t.slice(1).map(Number);return[n,r,i,s].some(a=>a>255)?!1:n===10||n===192&&r===168||n===172&&r>=16&&r<=31}function _a(o,e){let t=o.toLowerCase().replace(/\.$/,"");return e.some(n=>{if(typeof n!="string")return!1;let r=n.toLowerCase().replace(/\.$/,""),i=r.startsWith("*.")?r.slice(2):r;return i?t===i||t.endsWith(`.${i}`):!1})}var So=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])},Xa=o=>`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}`;function bi(o,e,t={}){let n=typeof o=="string"?o.trim().split("."):[];if(n.length!==3||n[0]!=="FG1")return{fail:{ok:!1,reason:"format"}};let r;try{if(r=JSON.parse(new TextDecoder().decode(yi(n[1]))),!r||!Array.isArray(r.domains)||!r.domains.every(s=>typeof s=="string")||!So(r.expires))return{fail:{ok:!1,reason:"format"}};if(r.major!==void 0&&!(Number.isInteger(r.major)&&r.major>0))return{fail:{ok:!1,reason:"format"}};if(r.plan!==void 0&&r.plan!=="company"&&r.plan!=="personal")return{fail:{ok:!1,reason:"format"}}}catch{return{fail:{ok:!1,reason:"format"}}}let i=null;return Xa(t.now??new Date)>r.expires?i={ok:!1,reason:"expired",info:r}:_a(e,r.domains)?r.major!==void 0&&Ka(t.version??nt)>r.major&&(i={ok:!1,reason:"version",info:r}):i={ok:!1,reason:"domain",info:r},{parts:n,info:r,fail:i}}var vi=()=>typeof crypto<"u"&&!!crypto.subtle;async function xi(o,e,t={}){let n=bi(o,e,t);if(!("info"in n))return n.fail;let{parts:r,info:i}=n,s=()=>n.fail;if(!vi())return s()??{ok:!1,reason:"unsupported",info:i};let a=crypto.subtle;try{let l=await a.importKey("jwk",t.publicKey??ja,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]),d=new TextEncoder().encode(`${r[0]}.${r[1]}`);if(!await a.verify({name:"ECDSA",hash:"SHA-256"},l,yi(r[2]),d))return{ok:!1,reason:"signature",info:i}}catch{return{ok:!1,reason:"signature",info:i}}return s()??{ok:!0,info:i}}var kt,fi=new Map,ko=new Map,hi=new Set,pi=new Set;function Ja(o){kt=o}var kn={missing:`FreeGrid: every feature is free for 30 days on a domain. After that, paid features need a free personal key (${ot}) or a company key: ${We}
49
+ FreeGrid: \uB3C4\uBA54\uC778\uB9C8\uB2E4 30\uC77C \uB3D9\uC548 \uBAA8\uB4E0 \uAE30\uB2A5\uC744 \uBB34\uB8CC\uB85C \uC4F8 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uADF8 \uB4A4 \uC720\uB8CC \uAE30\uB2A5\uC5D0\uB294 \uBB34\uB8CC \uAC1C\uC778 \uD0A4(${ot}) \uB610\uB294 \uD68C\uC0AC \uD0A4\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4: ${We}`,trial:o=>`FreeGrid: the 30-day trial of paid features on this domain ends ${o}. / \uC774 \uB3C4\uBA54\uC778\uC758 \uC720\uB8CC \uAE30\uB2A5 30\uC77C \uCCB4\uD5D8\uC740 ${o}\uC5D0 \uB05D\uB0A9\uB2C8\uB2E4.`,ended:`FreeGrid: the 30-day trial on this domain has ended, so paid features are now off. Get a free personal key (${ot}) or a company key: ${We}
50
+ FreeGrid: \uC774 \uB3C4\uBA54\uC778\uC758 30\uC77C \uCCB4\uD5D8\uC774 \uB05D\uB098 \uC720\uB8CC \uAE30\uB2A5\uC774 \uAEBC\uC84C\uC2B5\uB2C8\uB2E4. \uBB34\uB8CC \uAC1C\uC778 \uD0A4(${ot}) \uB610\uB294 \uD68C\uC0AC \uD0A4\uB97C \uBC1B\uC73C\uC138\uC694: ${We}`,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.",version:`FreeGrid ${nt}: this perpetual license covers an earlier major version. / \uC774 \uC601\uAD6C \uB77C\uC774\uC120\uC2A4\uB294 \uC774\uC804 \uBA54\uC774\uC800 \uBC84\uC804\uC6A9\uC785\uB2C8\uB2E4.`};function gi(o,e=typeof location<"u"?location.hostname:""){try{if(St(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 i=JSON.stringify({version:o.version,licensed:o.licensed,company:o.company,url:`${location.origin}${location.pathname}`});typeof navigator.sendBeacon=="function"?navigator.sendBeacon(ui,i):typeof fetch=="function"&&fetch(ui,{method:"POST",body:i,mode:"no-cors",keepalive:!0}).catch(()=>{})}catch{}}function Ya(o=kt,e=typeof location<"u"?location.hostname:""){return St(e)?Promise.resolve(!0):Ci(o??kt,e).then(t=>t==="ok"||t==="unsupported")}function Ci(o,e){let t=`${o??""}@${e}`,n=fi.get(t);return n||(o?n=xi(o,e).then(r=>{if(gi({version:nt,licensed:r.ok,company:r.ok?r.info.company:void 0},e),r.ok)return"ok";if(r.reason==="unsupported")return"unsupported";let i=r.info?` (${r.info.domains.join(", ")}, ${r.info.major?`${r.info.major}.x`:r.info.expires})`:"";return console.warn(`${kn[r.reason]}${i}
51
+ ${We}`),"bad"},()=>"bad"):(console.info(kn.missing),gi({version:nt,licensed:!1},e),n=Promise.resolve("none")),fi.set(t,n),n)}var Za;var Mt=()=>Za??(typeof location<"u"?location.hostname:""),mi=o=>{if(!o||typeof o!="object")return null;let{badge:e,trial:t}=o,n=!!t&&typeof t=="object"&&So(t.started)&&So(t.ends)&&typeof t.active=="boolean";return{badge:e===!0,trial:n?{started:t.started,ends:t.ends,active:t.active}:null}};function Ri(o=Mt()){if(St(o)||typeof fetch!="function")return Promise.resolve(null);let e=ko.get(o);if(e)return e;let t=new Date().toISOString().slice(0,10),n=null;try{n=typeof localStorage<"u"?localStorage:null;let i=JSON.parse(n?.getItem("freegrid:status")??"null"),s=i&&i.host===o&&i.day===t?mi(i.status):null;if(s){let a=Promise.resolve(s);return ko.set(o,a),a}}catch{}let r=fetch(Ua,{mode:"cors",credentials:"omit"}).then(i=>i.ok?i.json():null).then(i=>{let s=mi(i);if(s)try{n?.setItem("freegrid:status",JSON.stringify({host:o,day:t,status:s}))}catch{}return s}).catch(()=>null);return ko.set(o,r),r}function Qa(o=Mt()){return Ri(o).then(e=>e?.badge===!0)}async function ki(o,e=Mt()){return await Promise.resolve(),await Ya(o,e)?!1:Qa(e)}var Si="freegrid:gate",el=5,Mi=o=>{if(!o)return"";let e=o.trim().split(".");return e[e.length-1].slice(-16)},Ei=o=>{let e=JSON.parse(localStorage.getItem(Si)??"null");return!e||typeof e!="object"||e.host!==o||typeof e.trialEnded!="boolean"||!Array.isArray(e.verifiedKeys)||!e.verifiedKeys.every(t=>typeof t=="string")?null:{host:o,trialEnded:e.trialEnded,...typeof e.trialEnds=="string"?{trialEnds:e.trialEnds}:{},verifiedKeys:e.verifiedKeys}};function Ai(o,e=Mt()){if(St(e))return!0;let t=o??kt;if(t&&!vi()){let n=bi(t,e);if("info"in n&&!n.fail)return!0}try{let n=Ei(e);if(!n)return!0;let r=Mi(t);return r&&n.verifiedKeys.includes(r)?!0:!n.trialEnded}catch{return!0}}var wi=(o,e)=>{try{let t=null;try{t=Ei(o)}catch{}localStorage.setItem(Si,JSON.stringify(e(t??{host:o,trialEnded:!1,verifiedKeys:[]})))}catch{}};async function Ti(o,e=Mt()){if(St(e))return!0;await Promise.resolve();let t=o??kt,n=await Ci(t,e);if(n==="ok"){let s=Mi(t);return wi(e,a=>({...a,verifiedKeys:[s,...a.verifiedKeys.filter(l=>l!==s)].slice(0,el)})),!0}if(n==="unsupported")return!0;let r=(await Ri(e))?.trial;if(!r)return!0;wi(e,s=>({...s,trialEnded:!r.active,trialEnds:r.ends}));let i=`${r.active?"trial":"ended"}@${e}`;return hi.has(i)||(hi.add(i),r.active?console.info(kn.trial(r.ends)):console.warn(kn.ended)),r.active}function Pi(o){if(pi.has(o))return;pi.add(o);let e=ci[o]??{en:o,ko:o};console.warn(`FreeGrid: ${e.en} is a paid feature and is off on this domain. Get a free personal key (${ot}) or a company key: ${We}
52
+ FreeGrid: ${e.ko}\uC740(\uB294) \uC720\uB8CC \uAE30\uB2A5\uC774\uB77C \uC774 \uB3C4\uBA54\uC778\uC5D0\uC11C \uAEBC\uC838 \uC788\uC2B5\uB2C8\uB2E4. \uBB34\uB8CC \uAC1C\uC778 \uD0A4(${ot}) \uB610\uB294 \uD68C\uC0AC \uD0A4\uB97C \uBC1B\uC73C\uC138\uC694: ${We}`)}var Et={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"]},Li=["blank","notBlank"],Mo=500,Sn=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||N(e))return;let r=this.grid.store.state.locale,i=n.def,s=x("div",`fg-menu fg-theme-${this.grid.store.state.theme}`,{role:"dialog","aria-label":r.columnMenu});this.grid.applyFontTo(s),De(i)&&s.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(f=>f.colId!==e))]])),s.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.paid&&(this.grid.options.groupPanel||a.length)){let f=a.includes(e)?[[r.ungroup,()=>this.grid.setGroupBy(a.filter(h=>h!==e))]]:[[r.groupByThis,()=>this.grid.setGroupBy([...a,e])]];a.length&&f.push([r.expandAll,()=>this.grid.expandAll(!0)],[r.collapseAll,()=>this.grid.expandAll(!1)]),s.append(this.section(f))}if(this.grid.getRollup()&&!this.grid.isRollupKey(e)){let f=i.aggFunc??null,h=(C,M)=>`${C?"\u2713 ":""}${M}`,b=["sum","avg","min","max","count"].map(C=>[h(f===C,r[C]),()=>this.grid.setColumnAggFunc(e,C)]);s.append(this.section([[h(!f,r.noAggregate),()=>this.grid.setColumnAggFunc(e,null)],...b]))}let l=[[r.autosizeThis,()=>this.grid.autoSize([e])],[r.autosizeAll,()=>this.grid.autoSize()]];i.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&&this.grid.paid&&l.push([`${r.cf.title}\u2026`,()=>this.grid.formatDialog.open(e)]),s.append(this.section(l));let d=this.filterSection(e,()=>this.close());d&&s.append(d),ie(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 p=Math.max(4,Math.min(c.bottom+4,window.innerHeight-240));s.style.top=`${p}px`,s.style.maxHeight=`${Math.max(160,window.innerHeight-p-8)}px`,this.popup=s,this.colId=e;let m=f=>{me(f,s,t)||this.close()},g=f=>{f.key==="Escape"&&(this.close(),this.grid.renderer.gridEl.focus())},y=()=>this.close(),w=this.grid.renderer.scroller;document.addEventListener("pointerdown",m,!0),document.addEventListener("keydown",g,!0),w.addEventListener("scroll",y,{passive:!0}),this.off.push(()=>document.removeEventListener("pointerdown",m,!0),()=>document.removeEventListener("keydown",g,!0),()=>w.removeEventListener("scroll",y)),s.querySelector(".fg-filter-value:not([hidden]), .fg-set-search, .fg-menu-item")?.focus()}openAtFocus(){let{grid:e}=this,t=e.store.state.focus,n=t&&!N(t.colId)?t.colId:e.columns.displayed().find(a=>!N(a.id))?.id;if(!n)return!1;let r=e.renderer.root,i=CSS.escape(n),s=r.querySelector(`.fg-header-cell:not(.fg-header-group)[data-col="${i}"]`)??(t?r.querySelector(`.fg-row[data-row="${t.rowIndex}"] .fg-cell[data-col="${i}"]`):null)??e.renderer.gridEl;return this.open(n,s),!0}filterSection(e,t){let n=this.grid.columns.getNode(e);if(!n||n.children)return null;let r=this.grid.store.state.locale,i=de(n.def);return i==="set"?this.setFilter(e,r,t):i?this.conditionFilter(e,i,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 i=x("button","fg-menu-item",{type:"button"});i.textContent=n,i.addEventListener("click",()=>{r(),this.close();let s=jt(this.grid.renderer.root);(!s||s===document.body||!s.isConnected)&&this.grid.renderer.gridEl.focus({preventScroll:!0})}),t.append(i)}return t}actions(e,t,n,r){let i=x("div","fg-menu-actions"),s=x("button","fg-btn",{type:"button"});s.textContent=t.reset,s.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),i.append(s,a),i}title(e){let t=x("div","fg-menu-title");return t.textContent=e.filter,t}conditionRow(e,t,n,r,i){let s=x("div","fg-filter-cond"),a=x("select","fg-filter-op",{"aria-label":t.filter});if(r){let m=x("option");m.value="",m.textContent="\u2014",a.append(m)}for(let m of Et[e]){let g=x("option");g.value=m,g.textContent=t.ops[m],a.append(g)}a.value=n?.op??(r?"":Et[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||Li.includes(a.value),c.hidden=a.value!=="between"};a.addEventListener("change",u),u();for(let m of[d,c])m.addEventListener("keydown",g=>g.key==="Enter"&&!ce(g)&&i());return s.append(a,d,c),{row:s,read:()=>{let m=a.value;if(!m)return null;let g=!Li.includes(m);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:m,value:y,valueTo:w}:null}return e==="date"?!g||d.value?{type:e,op:m,value:d.value||void 0,valueTo:c.value||void 0}:null:!g||d.value?{type:e,op:m,value:d.value}:null}}}conditionFilter(e,t,n,r){let i=this.grid.store.state.filters[e],s=i?.type==="combined"?i.conditions:i?[i]:[],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 y=u.read(),w=p.read(),f=m.querySelector("input:checked")?.value==="or"?"or":"and",h=y&&w?{type:"combined",operator:f,conditions:[y,w]}:y??w;this.grid.setFilter(e,h),r()},u=this.conditionRow(t,n,a,!1,c),p=this.conditionRow(t,n,l,!0,c),m=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"),f=x("input","",{type:"radio",name:g,value:y});f.checked=(i?.type==="combined"?i.operator:"and")===y,w.append(f,` ${n[y]}`),m.append(w)}return d.append(this.title(n),u.row,m,p.row,this.actions(e,n,c,r)),d}setFilter(e,t,n){let{grid:r}=this,i=r.columns.getNode(e).def,s=Z(i,t.code),a=r.collator(),l=new Map;for(let v of r.rowModel.allNodes()){let S=G(i,v.data),A=te(S);l.has(A)||l.set(A,S)}let d=[...l.entries()].sort((v,S)=>vt(v[1],S[1],a)),c=r.store.state.filters[e],u=new Set(c?.type==="set"?c.values.map(te).filter(v=>l.has(v)):l.keys()),p=(v,S)=>v===""?t.blanks:s(S),m=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 f=x("div","fg-set-list"),h=()=>{let v=g.value.trim().toLowerCase();return v?d.filter(([S,A])=>p(S,A).toLowerCase().includes(v)):d},b=()=>{let v=h(),S=v.filter(([A])=>u.has(A)).length;w.checked=S>0&&S===v.length,w.indeterminate=S>0&&S<v.length},C=()=>{let v=h();if(f.replaceChildren(...v.slice(0,Mo).map(([S,A])=>{let D=x("label","fg-set-item"),k=x("input","fg-checkbox",{type:"checkbox"});return k.checked=u.has(S),k.addEventListener("change",()=>{k.checked?u.add(S):u.delete(S),b()}),D.append(k,document.createTextNode(p(S,A))),D})),v.length>Mo){let S=x("div","fg-set-more");S.textContent=`\u2026 +${v.length-Mo}`,f.append(S)}b()};w.addEventListener("change",()=>{for(let[v]of h())w.checked?u.add(v):u.delete(v);C()}),g.addEventListener("input",C);let M=()=>{r.setFilter(e,u.size===l.size?null:{type:"set",values:d.filter(([v])=>u.has(v)).map(([,v])=>v)}),n()};return g.addEventListener("keydown",v=>v.key==="Enter"&&!ce(v)&&M()),C(),m.append(this.title(t),g,y,f,this.actions(e,t,M,n)),m}};var Fi=new WeakMap,tl=0;function je(o){let e=Fi.get(o);return e||Fi.set(o,e=`r${++tl}`),e}var Mn=class{constructor(e){this.deps=e;this.stats={filterRuns:0,sortRuns:0};this.server=!1;this.full=[];this.last={};this.nodes=[];this.assignedIds=new WeakMap;this.filtered=[];this.sorted=[];this.display=[];this.indexById=null;this.orderedCache=null;this.layoutCache=null;this.quickCache=null}update(e){let t=this.deps.collator(),n=e.display,r=!!n?.getParentId!=!!this.last.display?.getParentId,i=e.data!==this.last.data,s=i||r||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(i){let u=this.deps.getRowId;if(u){let p=new Set,m=null;this.assignedIds=new WeakMap,this.nodes=e.data.map((g,y)=>{let w=String(u(g)),f=w;if(p.has(f)){m??(m=w);for(let h=2;p.has(f);h++)f=`${w}#${h}`}return p.add(f),this.assignedIds.set(g,f),{id:f,data:g,sourceIndex:y}}),m!==null&&O(`getRowId returned "${m}" for more than one row; inside the grid the repeats are told apart as "${m}#2" and so on, and updates by id reach the first of them. Return a unique id per row.`)}else this.nodes=e.data.map((p,m)=>({id:je(p),data:p,sourceIndex:m}))}if(s&&(this.filtered=this.filter(e),this.stats.filterRuns++),a){let u=e.sort.length?this.deps.sortBlocks?.(e.sort):null,p=u?.length?Mr(this.filtered.map(m=>m.data),u):void 0;this.sorted=jr(this.filtered,e.sort,m=>this.deps.columnDef(m),t,p),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}dataRowsBefore(e){let t=Math.min(e,this.full.length);if(this.full===this.sorted)return t;let n=0;for(let r=0;r<t;r++)this.full[r].kind||n++;return n}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}orderedDataRows(){let e=this.orderedCache;if(e&&e.full===this.full)return e.rows;let t=this.last.display,n=this.sorted;if(t&&(t.getParentId||t.groupBy.length)){let r={...t,expanded:new Map,defaultExpanded:-1,detailOpen:new Set,lazyChildren:void 0};n=this.buildDisplay(r,this.last.sort??[],this.last.collator??this.deps.collator()).filter(i=>!i.kind)}return this.orderedCache={full:this.full,rows:n},n}allNodes(){return this.nodes}idOf(e){return this.deps.getRowId?this.assignedIds.get(e)??String(this.deps.getRowId(e)):je(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,i){let s=this.layoutCache;if(s&&s.rows===this.display&&s.rh===e&&s.dh===t&&s.hv===r)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 p=this.display[u],m=e;if(p.kind==="detail")m=t;else if(!p.kind){c&&(m=c.get(p.id)??e);let g=i?.(p.data);typeof g=="number"&&g>0&&(m=c?Math.max(m,g):g)}m!==e&&(d=!1),l[u+1]=l[u]+m}return this.layoutCache={rows:this.display,rh:e,dh:t,hv:r,offsets:l,uniform:d},this.layoutCache}quickTexts(e){let t=[this.nodes,this.deps.textVersion?.()??"",...e],n=this.quickCache;return n&&n.key.length===t.length&&n.key.every((r,i)=>r===t[i])?n.texts:(this.quickCache={key:t,texts:new WeakMap},this.quickCache.texts)}filter(e){let t=Object.entries(e.filters).map(([u,p])=>({def:this.deps.columnDef(u),pred:Tt(p)})).filter(u=>!!u.def),n=er(e.quickFilter),r=n.length?this.deps.quickColumns():[],i=e.advancedFilter?Dn(e.advancedFilter,u=>this.deps.columnDef(u),G):null;if(!t.length&&!n.length&&!i)return this.nodes;let s=n.length?this.quickTexts(r):null,a=this.nodes.filter(u=>{for(let p of t)if(!p.pred(G(p.def,u.data)))return!1;if(i&&!i(u.data))return!1;if(s){let p=s.get(u.data);if(p===void 0&&(p=r.map(m=>this.deps.format(m,G(m,u.data))).join("").toLowerCase(),s.set(u.data,p)),!tr(n,p))return!1}return!0}),l=e.display?.getParentId;if(!l)return a;let d=new Map(this.nodes.map(u=>[u.id,u])),c=new Set(a);for(let u of a){let p=l(u.data),m=new Set;for(;p!=null&&!m.has(p);){m.add(p);let g=d.get(String(p));if(!g)break;c.add(g),p=l(g.data)}}return this.nodes.filter(u=>c.has(u))}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 i=e.groupBy.filter(a=>this.deps.columnDef(a));if(!i.length)return e.detailOpen.size?(this.withDetails(e,this.sorted,r),r):this.sorted;let s=(a,l,d)=>{let c=i[l],u=this.deps.columnDef(c),p=new Map;for(let y of a){let w=G(u,y.data),f=q(w)?"":te(w),h=p.get(f);h||p.set(f,h={value:w,nodes:[]}),h.nodes.push(y)}let m=t.find(y=>y.colId===c)?.dir==="desc"?-1:1,g=[...p.entries()].sort((y,w)=>pn(y[1].value,w[1].value,n,m));for(let[y,w]of g){let f=`${d}${c}:${y}`,h=this.isOpen(e,f,l);r.push({id:`group:${f}`,data:{},sourceIndex:-1,kind:"group",level:l,group:{key:f,colId:c,value:w.value,rows:w.nodes.map(b=>b.data),expanded:h}}),h&&(l+1<i.length?s(w.nodes,l+1,`${f}|`):this.withDetails(e,w.nodes.map(b=>({...b,level:l+1})),r))}};return s(this.sorted,0,""),r}buildTree(e,t){let n=new Set(this.sorted.map(d=>d.id)),r=new Map,i=[];for(let d of this.sorted){let c=e.getParentId(d.data),u=c==null?null:String(c);if(u!==null&&n.has(u)&&u!==d.id){let p=r.get(u);p||r.set(u,p=[]),p.push(d)}else i.push(d)}let s=new Set,a=d=>{let c=[d];for(;c.length;){let u=c.pop();if(!s.has(u.id)){s.add(u.id);for(let p of r.get(u.id)??[])c.push(p)}}};for(let d of i)a(d);for(let d of this.sorted){if(s.has(d.id))continue;let c=r.get(String(e.getParentId(d.data))),u=c?c.indexOf(d):-1;u>=0&&c.splice(u,1),i.push(d),a(d)}let l=(d,c,u)=>{for(let p of d){if(u.has(p.id))continue;let m=r.get(p.id)??[],g=!m.length&&!!e.lazyChildren?.(p.id,p.data),y=m.length>0&&this.isOpen(e,p.id,c),w={...p,level:c,hasChildren:m.length>0||g,expanded:y};g&&e.loading?.has(p.id)&&(w.loading=!0),this.withDetails(e,[w],t),y&&l(m,c+1,new Set([...u,p.id]))}};l(i,0,new Set)}};var nl=1e4,Eo=1e5,ol=4,Ao=3e3,En=class{constructor(e,t,n,r,i,s){this.datasource=e;this.getRowId=t;this.groupBy=n;this.query=r;this.onChange=i;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<ol&&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:i}){let s=n>=this.groupBy.length,a=this.query,l=r+nl,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(i!==this.gen)return;let u=Array.isArray(c?.rows)?c.rows.filter(w=>w!==null&&typeof w=="object"):[];Array.isArray(c?.rows)||O("datasource.getRows must resolve to { rows: Row[] }");let p=s?u.map((w,f)=>({id:this.getRowId?String(this.getRowId(w)):je(w),data:w,sourceIndex:r+f,level:n})):u.map(w=>{let f=this.groupBy[n],h=w[f],b=`${e?`${e}|`:""}${f}:${te(h)}`,C=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:f,value:h,rows:[],expanded:!1,count:C,aggregates:w,keys:[...t,h]}}}),m=r?[...this.levels.get(e)?.nodes??[],...p]:p,g=typeof c?.total=="number"&&c.total>=0?c.total:null,y=u.length>0&&(g!==null?m.length<g:u.length>=l-r);y&&m.length<Eo?(this.levels.set(e,{state:"loading",nodes:m}),this.fetch({path:e,keys:t,level:n,start:m.length,gen:i})):(y&&O(`a server group level has more than ${Eo} rows; only the first ${Eo} are shown`),this.levels.set(e,{state:"loaded",nodes:m})),this.touch(),this.onChange()},c=>{i===this.gen&&(this.levels.set(e,{state:"failed",nodes:[],retryAt:Date.now()+Ao}),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=[],i=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),r.push({id:`loading:${a}`,data:{},sourceIndex:-1,kind:"loading",level:d});return}if(c.state==="failed"){let u=c.retryAt??0;i=i?Math.min(i,u):u;return}for(let u of c.nodes){if(u.kind!=="group"){r.push(u);continue}let p=u.group,m=this.isOpen(e,p.key,d),g={...u,group:{...p,expanded:m}};r.push(g),m&&s(p.key,p.keys??[],d+1)}c.state==="loading"&&r.push({id:`loading:${a}`,data:{},sourceIndex:-1,kind:"loading",level:d})};return s("",[],0),this.retryAt=i,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 rl=new Float64Array(0),rt=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;this.quiet=!1}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 En(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),i=e.page??null,s=(i?.size??0)!==(this.page?.size??0);this.query={sort:e.sort,filters:e.filters,quickFilter:e.quickFilter,advancedFilter:e.advancedFilter??null},this.page=i?{...i}:null,(r||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||(!this.quiet&&e>=0&&e<this.getRowCount()&&this.ensure(Math.floor(t/this.bs)),this.placeholder(t))}withoutLoading(e){let t=this.quiet;this.quiet=!0;try{return e()}finally{this.quiet=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,i=this.gen;this.lastBlock=e,this.blocks.set(e,{state:"loading",nodes:[]});let s=this.query,a=d=>{i===this.gen&&(this.blocks.set(e,{state:"failed",nodes:[],retryAt:Date.now()+Ao}),this.deps.onFailed(n,r,d))},l;try{l=Promise.resolve(this.deps.datasource.getRows({start:n,end:r,sort:[...s.sort],filters:{...s.filters},quickFilter:s.quickFilter,advancedFilter:s.advancedFilter}))}catch(d){l=Promise.reject(d)}l.then(d=>{if(i!==this.gen)return;let c=Array.isArray(d?.rows)?d.rows.filter(m=>m!==null&&typeof m=="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,p=c.slice(0,this.bs).map((m,g)=>({id:u?String(u(m)):je(m),data:m,sourceIndex:n+g}));this.blocks.set(e,{state:"loaded",nodes:p}),typeof d.total=="number"&&d.total>=0?this.total=d.total:p.length<this.bs&&(this.total=n+p.length),this.loadedEnd=Math.max(this.loadedEnd,n+p.length),this.evict(),this.touch(),this.deps.onLoaded(n,n+p.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,i)=>r-i)){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)):je(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:rl,uniform:!0}}};function Ii(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 i=n;i<=r;i++)t.add(o.idAt(i));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 An=class{constructor(e){this.bus=new Je;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 To=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&Object.getPrototypeOf(o)===Object.prototype;function xe(o,e=0,t=new Map){if(e>8||!(Array.isArray(o)||To(o)))return o;let n=t.get(o);if(n)return n;if(Array.isArray(o)){let i=[];t.set(o,i);for(let s of o)i.push(xe(s,e+1,t));return i}let r={};t.set(o,r);for(let[i,s]of Object.entries(o))r[i]=xe(s,e+1,t);return r}function it(o,e,t=0,n=new Map){if(o===e)return!0;if(t>8||!o||!e||typeof o!="object"||typeof e!="object")return!1;let r=n.get(o);if(r?.has(e))return!0;if(r?r.add(e):n.set(o,new Set([e])),Array.isArray(o)||Array.isArray(e))return Array.isArray(o)&&Array.isArray(e)&&o.length===e.length&&o.every((s,a)=>it(s,e[a],t+1,n));if(!To(o)||!To(e))return!1;let i=Object.keys(o);return i.length===Object.keys(e).length&&i.every(s=>s in e&&it(o[s],e[s],t+1,n))}function il(o){let e=xe(o);return t=>it(t,e)?!1:(e=xe(t),!0)}var sl=500;function Di(o){let e=o.renderer.root,t=0,n=null,r=null,i=()=>{clearTimeout(t),n?.remove(),n=null,r=null},s=c=>{let u=c.dataset.col;if(!u||N(u))return null;let p=o.columns.getNode(u);if(!p)return null;if(c.classList.contains("fg-header-cell"))return p.def.headerTooltip??null;let m=c.closest(".fg-row[data-row]");if(!m||!c.closest(".fg-body"))return null;let g=Number(m.dataset.row),y=o.rowModel.getRow(g);if(!y||y.kind)return null;let w=p.def,f=G(w,y.data),h=Z(w,o.store.state.locale.code)(f);if(typeof w.tooltip=="function")try{let b=w.tooltip({value:f,formatted:h,row:y.data,rowIndex:g,column:w});return b?String(b):null}catch{return O(`tooltip of column "${u}" threw`),null}return w.tooltip===!0?h||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),ie(e).append(n);let p=c.getBoundingClientRect(),m=n.offsetWidth,g=n.offsetHeight,y=window.innerWidth||1024,w=window.innerHeight||768,f=p.bottom+6+g>w?p.top-g-6:p.bottom+6;n.style.left=`${Math.max(4,Math.min(y-m-4,p.left))}px`,n.style.top=`${Math.max(4,f)}px`},l=c=>{let u=c.target.closest?.(".fg-cell, .fg-header-cell");!u||u===r||!e.contains(u)||(i(),r=u,t=window.setTimeout(()=>{if(r!==u||!u.isConnected)return;let p=s(u);p&&a(u,p)},sl))},d=c=>{let u=c.relatedTarget;r&&u&&r.contains(u)||i()};return e.addEventListener("pointerover",l),e.addEventListener("pointerout",d),e.addEventListener("pointerdown",i),e.addEventListener("keydown",i),e.addEventListener("wheel",i,{passive:!0}),()=>{i(),e.removeEventListener("pointerover",l),e.removeEventListener("pointerout",d),e.removeEventListener("pointerdown",i),e.removeEventListener("keydown",i),e.removeEventListener("wheel",i)}}var $i=["blank","notBlank"],Tn=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&&!N(e.id)&&de(e.def)).map(e=>{let t=de(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 i=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()),i.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 R of["and","or"]){let F=x("label"),P=x("input","",{type:"radio",name:c,value:R});P.checked=(l?.operator??"and")===R,F.append(P,` ${t[R]}`),d.append(F)}let u=x("div","fg-fb-list"),p=[],m=R=>{p.splice(p.indexOf(R),1),R.el.remove()},g=R=>{let F=x("div","fg-fb-row"),P=x("select","fg-filter-op fg-fb-col",{"aria-label":t.columns});for(let ee of n){let $=x("option");$.value=ee.id,$.textContent=ee.label,P.append($)}let T=x("select","fg-filter-op fg-fb-op",{"aria-label":t.filter}),L=x("input","fg-input fg-fb-value",{type:"text",placeholder:t.value,"aria-label":t.value}),B=x("input","fg-input fg-fb-value-to",{type:"text",placeholder:t.valueTo,"aria-label":t.valueTo}),j=x("button","fg-chooser-close fg-fb-remove",{type:"button","aria-label":t.close});j.textContent="\xD7";let z=()=>n.find(ee=>ee.id===P.value)?.kind??"text",_=ee=>{let $=z();T.replaceChildren(...Et[$].map(U=>{let K=x("option");return K.value=U,K.textContent=t.ops[U],K})),ee&&Et[$].includes(ee)&&(T.value=ee);let V=$==="text"?"text":$;L.type=B.type=V,X()},X=()=>{L.hidden=$i.includes(T.value),B.hidden=T.value!=="between"};P.addEventListener("change",()=>_(T.value)),T.addEventListener("change",X),R&&n.some(ee=>ee.id===R.colId)&&(P.value=R.colId);let J=R?.model;_(J?.op),J?.value!=null&&(L.value=String(J.value)),J?.valueTo!=null&&(B.value=String(J.valueTo)),F.append(P,T,L,B,j);let ne={el:F,read:()=>{let ee=z(),$=T.value,V=!$i.includes($),U=null;if(ee==="number"){let K=L.value===""?void 0:Number(L.value),fe=B.value===""?void 0:Number(B.value);(!V||K!==void 0&&!Number.isNaN(K))&&(U=$==="between"?{type:"number",op:$,value:K,valueTo:fe}:{type:"number",op:$,value:K})}else ee==="date"?(!V||L.value)&&(U=$==="between"?{type:"date",op:$,value:L.value,valueTo:B.value}:{type:"date",op:$,value:L.value||void 0}):(!V||L.value)&&(U={type:"text",op:$,value:L.value});return U?{colId:P.value,model:U}:null}};return j.addEventListener("click",()=>m(ne)),ne},y=(R,F)=>{let P=x("div","fg-fb-row fg-fb-group"),T=x("span","fg-fb-group-label");T.textContent=F;let L=x("button","fg-chooser-close fg-fb-remove",{type:"button","aria-label":t.close});L.textContent="\xD7",P.append(T,L);let B={el:P,read:()=>R};return L.addEventListener("click",()=>m(B)),B},w=R=>{if("conditions"in R)return y(R,`( ${R.conditions.length} \xD7 ${t[R.operator]} )`);let F=n.find(L=>L.id===R.colId),P=R.model;if(F&&P&&(P.type==="text"||P.type==="number"||P.type==="date"))return g(R);let T=P?.type==="set"?P.values.map(String).join(", "):P?.type==="combined"?`( ${P.conditions.length} \xD7 ${t[P.operator]} )`:"";return y(R,`${F?.label??R.colId}: ${T}`)},f=R=>{p.push(R),u.append(R.el)};for(let R of l?.conditions??[])f(w(R));let h=x("button","fg-btn fg-fb-add",{type:"button"});h.textContent=`+ ${t.addCondition}`,h.addEventListener("click",()=>{let R=g();f(R),R.el.querySelector(".fg-fb-value").focus()});let b=x("div","fg-menu-actions"),C=x("button","fg-btn",{type:"button"});C.textContent=t.reset,C.addEventListener("click",()=>{e.setAdvancedFilter(null),this.close()});let M=x("button","fg-btn fg-btn-primary",{type:"button"});M.textContent=t.apply,M.addEventListener("click",()=>{let R=p.map(P=>P.read()).filter(P=>!!P),F=d.querySelector("input:checked")?.value==="or"?"or":"and";e.setAdvancedFilter(R.length?{operator:F,conditions:R}:null),this.close()}),b.append(C,M),r.append(i,d,u,h,b),ie(e.renderer.root).append(r),p.length||h.click();let v=e.renderer.root.getBoundingClientRect(),S=r.offsetWidth||460;r.style.left=`${Math.max(4,Math.min(v.left+24,(window.innerWidth||1024)-S-4))}px`;let A=e.renderer.headerEl.getBoundingClientRect(),D=window.innerHeight||768,k=Math.max(4,Math.min((A.height?A.bottom:v.top)+8,D-(r.offsetHeight||0)-4));r.style.top=`${k}px`,r.style.maxHeight=`${Math.max(160,D-k-8)}px`,this.popup=r;let E=R=>{me(R,r)||this.close()},I=R=>{R.key==="Escape"&&(this.close(),e.renderer.gridEl.focus())};document.addEventListener("pointerdown",E,!0),document.addEventListener("keydown",I,!0),this.off.push(()=>document.removeEventListener("pointerdown",E,!0),()=>document.removeEventListener("keydown",I,!0))}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var Ni=[{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}}],al=["value","formula","top","bottom","aboveAverage","belowAverage","duplicate","unique","dataBar","colorScale","iconSet"],ll=["gt","gte","lt","lte","eq","ne","between","notBetween","contains","notContains","startsWith","endsWith","blank","notBlank"],Po=["blank","notBlank"],Oi=["dataBar","colorScale","iconSet"],Pn=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||N(e))return;let r=t.store.state.locale,i={...ae.cf,...r.cf,aligns:{...ae.cf.aligns,...r.cf?.aligns}},s=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":`${i.title}: ${s}`});t.applyFontTo(a);let l=x("div","fg-chooser-head"),d=x("span","fg-menu-title");d.textContent=`${i.title} \xB7 ${s}`;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"),p=$=>i.ops[$]??r.ops[$]??$,m=$=>{let V=$.type??"value",U=i.types[V];if(V==="value"){let K=$.op??"eq";return Po.includes(K)?p(K):`${p(K)} ${String($.value??"")}${K==="between"||K==="notBetween"?` \u2013 ${String($.valueTo??"")}`:""}`}return V==="formula"?`${U}: ${$.formula??""}`:V==="top"||V==="bottom"?`${U} ${$.rank??10}${$.percent?"%":""}`:U},g=()=>{u.replaceChildren();let V=t.getConditionalFormats().map((U,K)=>({r:U,i:K})).filter(({r:U})=>U.columns.includes(e));if(!V.length){let U=x("div","fg-cf-empty");U.textContent=i.none,u.append(U);return}for(let{r:U,i:K}of V){let fe=x("div","fg-cf-rule"),Re=x("span","fg-cf-sample",{"aria-hidden":"true"});Re.textContent=U.type==="iconSet"?"\u25B2":U.type==="dataBar"?"\u25AC":"Aa",U.style?.background&&(Re.style.background=U.style.background),U.style?.color&&(Re.style.color=U.style.color),U.style?.bold&&(Re.style.fontWeight="700");let st=ge(U.style);st&&st!=="center"&&(Re.style.justifyItems=st==="left"?"start":"end",Re.style.padding="0 3px"),U.type==="colorScale"&&(Re.style.background=`linear-gradient(to right, ${(U.colors??["#f8696b","#ffeb84","#63be7b"]).join(",")})`);let at=x("span","fg-cf-rule-text");at.textContent=`${m(U)}${U.row?` \xB7 ${i.wholeRow}`:""}${st?` \xB7 ${i.align}: ${i.aligns[st]}`:""}`,at.title=at.textContent;let Ln=x("button","fg-chooser-close",{type:"button","aria-label":`${r.close}: ${at.textContent}`});Ln.textContent="\xD7",Ln.addEventListener("click",()=>{let No=t.getConditionalFormats(),Oo=No[K];Oo.columns=Oo.columns.filter(Fn=>Fn!==e),t.setConditionalFormats(No.filter(Fn=>Fn.columns.length)),g()}),fe.append(Re,at,Ln),u.append(fe)}};g();let y=x("div","fg-cf-form"),w=x("select","fg-filter-op fg-cf-wide fg-cf-type",{"aria-label":i.type});for(let $ of al){let V=x("option");V.value=$,V.textContent=i.types[$],w.append(V)}let f=x("select","fg-filter-op fg-cf-wide fg-cf-op",{"aria-label":r.filter});for(let $ of ll){let V=x("option");V.value=$,V.textContent=p($),f.append(V)}let h=n.def.type==="number",b=x("input","fg-input fg-cf-value",{type:h?"number":"text",placeholder:r.value,"aria-label":r.value}),C=x("input","fg-input fg-cf-value-to",{type:h?"number":"text",placeholder:r.valueTo,"aria-label":r.valueTo}),M=x("input","fg-input fg-cf-wide fg-cf-formula",{type:"text",placeholder:`=${n.def.field??e} > 100`,"aria-label":i.types.formula,spellcheck:"false"}),v=x("input","fg-input fg-cf-rank",{type:"number",min:"1",value:"10","aria-label":i.count}),S=x("label","fg-cf-pct"),A=x("input","",{type:"checkbox"});S.append(A," %");let D=x("div","fg-cf-swatches fg-cf-wide",{role:"group","aria-label":i.style}),k=0;Ni.forEach(($,V)=>{let U=x("button","fg-cf-swatch",{type:"button","aria-label":i.styles[$.key],title:i.styles[$.key],"aria-pressed":String(V===k)});U.textContent=$.key==="bold"?"B":"Aa",U.style.background=$.style.background??"#ffffff",U.style.color=$.style.color??"#1f2430",U.addEventListener("click",()=>{k=V;for(let K of D.children)K.setAttribute("aria-pressed",String(K===U))}),D.append(U)});let E=x("select","fg-filter-op fg-cf-wide fg-cf-align",{"aria-label":i.align,title:i.align});for(let $ of["","left","center","right"]){let V=x("option");V.value=$,V.textContent=$?`${i.align}: ${i.aligns[$]}`:`${i.align}: ${i.aligns.none}`,E.append(V)}let I=x("label","fg-cf-wide fg-cf-row"),R=x("input","",{type:"checkbox"});I.append(R,` ${i.wholeRow}`),y.append(w,f,b,C,M,v,S,D,E,I);let F=()=>{let $=w.value,V=f.value;f.hidden=$!=="value",b.hidden=$!=="value"||Po.includes(V),C.hidden=$!=="value"||V!=="between"&&V!=="notBetween",M.hidden=$!=="formula",v.hidden=S.hidden=$!=="top"&&$!=="bottom",D.hidden=E.hidden=Oi.includes($),I.hidden=$!=="value"&&$!=="formula"};w.addEventListener("change",F),f.addEventListener("change",F),F();let P=()=>{let $=w.value,V={columns:[e],type:$},U=K=>h&&K.value!==""?Number(K.value):K.value;if($==="value"){if(V.op=f.value,!Po.includes(V.op)){if(b.value==="")return null;if(V.value=U(b),V.op==="between"||V.op==="notBetween"){if(C.value==="")return null;V.valueTo=U(C)}}}else if($==="formula"){let K=M.value.trim();if(!K)return null;V.formula=K.startsWith("=")?K:`=${K}`}else($==="top"||$==="bottom")&&(V.rank=Math.max(1,Math.floor(Number(v.value)||10)),A.checked&&(V.percent=!0));if(!Oi.includes($)){V.style={...Ni[k].style};let K=ge({align:E.value});K&&(V.style.align=K)}return R.checked&&($==="value"||$==="formula")&&(V.row=!0),V},T=x("div","fg-menu-actions"),L=x("button","fg-btn",{type:"button"});L.textContent=i.clear,L.addEventListener("click",()=>{t.setConditionalFormats(t.getConditionalFormats().map($=>({...$,columns:$.columns.filter(V=>V!==e)})).filter($=>$.columns.length)),g()});let B=x("button","fg-btn fg-btn-primary",{type:"button"});B.textContent=i.add,B.addEventListener("click",()=>{let $=P();if(!$){(w.value==="formula"?M:b).focus();return}t.setConditionalFormats([...t.getConditionalFormats(),$]),b.value=C.value=M.value="",g()}),T.append(L,B),a.append(l,u,y,T),ie(t.renderer.root).append(a);let j=t.renderer.root.getBoundingClientRect(),z=a.offsetWidth||340;a.style.left=`${Math.max(4,Math.min(j.left+24,(window.innerWidth||1024)-z-4))}px`;let _=window.innerHeight||768,X=a.offsetHeight||0,J=Math.max(4,Math.min(j.top+24,_-X-4));a.style.top=`${J}px`,a.style.maxHeight=`${Math.max(160,_-J-8)}px`,a.style.overflowY="auto",this.popup=a,w.focus();let ne=$=>{me($,a)||this.close()},ee=$=>{$.key==="Escape"&&(this.close(),t.renderer.gridEl.focus())};document.addEventListener("pointerdown",ne,!0),document.addEventListener("keydown",ee,!0),this.off.push(()=>document.removeEventListener("pointerdown",ne,!0),()=>document.removeEventListener("keydown",ee,!0))}close(){for(let e of this.off)e();this.off=[],this.popup?.remove(),this.popup=null}};var Bi=o=>Math.round(o*2.75),Hi=o=>Math.round(o*3.1),Lo=13,Fo={compact:[.8,.85],normal:[1,1],comfortable:[1.25,1.15]},dl=[],cl=100,Gi=new Map;function Ce(o){return o.every(e=>e!==null&&typeof e=="object")?o:(O("data contains entries that are not objects; they were skipped"),o.filter(e=>e!==null&&typeof e=="object"))}var Io=class{constructor(e,t){this.options=t;this.events=new Je;this.pinnedRows={top:[],bottom:[]};this.spanCache=null;this.editVersion=0;this.tracker=new ln;this.history=new an;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 Rn(this);this.sourceDefs=[];this.pivotCfg=null;this.pivotData=null;this.rollupOn=!1;this.rollupBy=null;this.rollupData=null;this.savedGroup=null;this.page=0;this.pageSize=cl;this.formulaScope={off:()=>!this.allow("formulas"),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.cfRowsSrc=null;this.sourceSnapshot=void 0;this.summarySnapshot=null;this.cfRows=[];this.formats=new zt({rules:()=>this.cfRules,rows:()=>{let e=this.rowModel.dataRows();return this.cfRowsSrc!==e&&(this.cfRowsSrc=e,this.cfRows=e.map(t=>t.data)),this.cfRows},value:(e,t)=>{let n=this.columns.getNode(e)?.def;return n?G(n,t):void 0},version:()=>this.editVersion,formula:(e,t)=>Vn(e,t,new Set,0,new Map,this.formulaScope)});this.formatDialog=new Pn(this);this.rollupSelection=null;this.forcedOverlay=null;this.filterBuilder=new Tn(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.cellPadding=null;this.sortWithin=!1;this.mergeSel="rows";this.selBlockCache=null;this.blockStateCache=null;this.aggMemo=null;this.selectionVersion=0;this.selectableCache=null;this.paid=Ai(t.licenseKey),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 An({data:Array.isArray(t.data)?Ce(t.data):[],sort:[],filters:{},quickFilter:"",selected:new Set,anchorId:null,focus:null,range:null,extraRanges:[],advancedFilter:null,locale:At(t.locale),theme:t.theme??"light"}),this.sourceDefs=Array.isArray(t.columns)?t.columns:[],this.sourceSnapshot=xe(this.sourceDefs),this.columns=new Lt(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: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 rt({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 Mn({getRowId:t.getRowId,columnDef:s=>this.columns.getNode(s)?.def,quickColumns:()=>this.columns.displayed().filter(s=>!N(s.id)).map(s=>s.def),format:(s,a)=>Z(s,this.store.state.locale.code)(a),collator:()=>this.collator(),textVersion:()=>`${this.store.state.locale.code}|${this.editVersion}`,sortBlocks:s=>this.sortBlocks(s)}),this.sortWithin=!!t.sortWithinMerges,this.mergeSel=this.validMergeSelection(t.mergeSelection),this.sortWithin&&this.rowModel.server&&O("sortWithinMerges is ignored with a datasource: the server sorts the rows"),t.groupBy?.length&&this.allow(this.rowModel.server?"serverGroups":"grouping")&&(this.groupBy=this.validGroupBy(t.groupBy)),Array.isArray(t.conditionalFormats)&&t.conditionalFormats.length&&this.allow("conditional")&&(this.cfRules=t.conditionalFormats.filter(s=>s&&typeof s=="object"&&Array.isArray(s.columns)).map(s=>({...s,columns:[...s.columns]}))),this.defaultExpanded=t.treeData||this.paid?t.groupDefaultExpanded??0:0,t.treeData&&!t.getRowId&&O("treeData needs getRowId so parent ids can be matched"),this.updateRows(),this.summaryOpts=t.summary&&this.allow("summary")?t.summary:null,this.summarySnapshot=xe(this.summaryOpts),this.refreshSummary();let r=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:r,family:t.fontFamily??null};let i=r??Lo;if(this.renderer=new qt(e,this,{rowHeight:t.rowHeight??Math.round(Bi(i)*Fo[this.densityOf(t.density)][0]),headerHeight:t.headerHeight??Math.round(Hi(i)*Fo[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),t.cellPadding!=null&&this.applyCellPadding(t.cellPadding),this.menu=new Sn(this),this.chooser=new Yt(this),this.contextMenu=new Qt(this),this.editor=new sn(this),this.finder=new nn(this),this.fillHandle=new en(this),this.groupPanel=t.groupPanel&&this.allow("grouping")?new Wt(this):null,this.pinnedRows={top:Ce(t.pinnedTopRows??[]),bottom:Ce(t.pinnedBottomRows??[])},this.sideBar=t.sideBar&&this.allow("sideBar")?new Zt(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)),Gr(this),Dr(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(),Di(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),t.rollup&&this.setRollup(t.rollup),ki(t.licenseKey).then(s=>{s&&!this.destroyed&&this.renderer.showFreeBadge()}),this.renderer.render(),this.api=this.createApi(),Ut.set(this.renderer.root,this),to.set(this.api,this),Ti(t.licenseKey)}get valuesVersion(){return this.editVersion}rangesOn(){return this.options.rangeSelection!==!1&&this.paid}allow(e){return this.paid?!0:(Pi(e),!1)}columnDefs(){return[...this.sourceDefs]}summaryOptions(){return this.summaryOpts?JSON.parse(JSON.stringify(this.summaryOpts)):null}setConditionalFormats(e){if(!Array.isArray(e)){O("setConditionalFormats: formats must be an array");return}e.length&&!this.allow("conditional")||(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)}yr(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.rebuildRollup(),this.rowModel.invalidate(),this.updateRows(),this.refreshSummary(),this.renderer.invalidate({header:!0,rows:!0}),this.refreshChoosers()}display(){return{groupBy:this.options.treeData?dl: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.viewRows();this.rowModel.update({...this.store.state,data:t,display:this.display(),page:e?{index:this.page,size:this.pageSize}:null});let n=this.rollupSelection;n&&(this.rollupSelection=null,this.setSelected(n)),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.rollupData??this.store.state.data}getRollup(){return this.rollupBy?{by:[...this.rollupBy]}:this.rollupOn}setRollup(e){let t=e&&typeof e=="object"&&Array.isArray(e.by)?e.by.filter(r=>typeof r=="string"):null;if(e&&typeof e=="object"&&!t){O("setRollup: expected true, false or { by: string[] }");return}let n=!!e;if(!(n&&!this.allow("pivot"))&&!(n&&this.clientOnly("rollup"))){if(n&&this.options.treeData){O("rollup is not available with treeData");return}n===this.rollupOn&&(t??[]).join("")===(this.rollupBy??[]).join("")&&!t==!this.rollupBy||(this.editor.cancel(),this.rollupOn=n,this.rollupBy=n?t:null,this.store.set({range:null,focus:null}),this.columnsChanged())}}rebuildRollup(){let e=this.rollupData;this.rollupData=this.rollupOn&&!this.pivotCfg?di(this.store.state.data,this.dataColumns().map(t=>({id:t.id,def:t.def})),this.rollupBy):null,(e||this.rollupData)&&this.remapRollupSelection(e)}remapRollupSelection(e){let t=this.store.state.selected;if(!t.size)return;let n=a=>this.rowModel.idOf(a),r=e?new Set(e.filter(a=>t.has(n(a))).flatMap(a=>Rt(a)??[a]).map(n)):t,i=this.rollupData,s=i?i.filter(a=>(Rt(a)??[a]).every(l=>r.has(n(l)))).map(n):this.store.state.data.map(n).filter(a=>r.has(a));(s.length!==t.size||s.some(a=>!t.has(a)))&&(this.rollupSelection=new Set(s))}isRollupKey(e){return!!this.rollupBy?.includes(e)}sourceRowsOf(e){return this.rollupData?e.flatMap(t=>Rt(t)??[t]):e}cellEditable(e,t,n){return!this.rollupData&&Ft(e,t,n)}setColumnAggFunc(e,t){if(t!==null&&typeof t!="function"&&!["sum","avg","min","max","count"].includes(t)){O(`setColumnAggFunc: unknown aggFunc "${String(t)}"`);return}let n=!1,r=s=>s.map(a=>{if(!a||typeof a!="object")return a;if(Array.isArray(a.children))return{...a,children:r(a.children)};if((a.id??a.field)!==e)return a;n=!0;let l={...a};return t?l.aggFunc=t:delete l.aggFunc,l}),i=r(this.sourceDefs);if(!n){O(`setColumnAggFunc: no column "${e}"`);return}this.setColumns(i)}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.allow("pivot")||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(r=>r.id));this.pivotCfg||(this.savedGroup={groupBy:this.groupBy,expanded:this.expanded,defaultExpanded:this.defaultExpanded});let n=Ro(e,r=>t.has(r));this.pivotCfg&&si(n,this.pivotCfg)||(this.pivotCfg=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.rebuildRollup(),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])),i={sum:n.sum,avg:n.avg,min:n.min,max:n.max,count:n.count},s=ai(this.store.state.data,t,d=>r.get(d),{total:n.total,blank:n.blanks,agg:d=>i[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}`)}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[i,s]of e)this.flashing.set(i,{until:n,dir:s});if(this.flashTimer)return;let r=()=>{let i=Date.now(),s=new Set,a=1/0;for(let[l,d]of this.flashing)d.until<=i?(this.flashing.delete(l),s.add(l.slice(0,l.indexOf("\0")))):a=Math.min(a,d.until);s.size&&this.renderer.invalidateRowIds(s),this.flashTimer=this.flashing.size&&!this.destroyed?window.setTimeout(r,Math.max(16,a-i)):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,i={fields:new Set,ids:new Set},s=this.store.state.data,a=new Set(s),l=new Map(s.map(d=>[this.rowModel.idOf(d),d]));for(let d of e)d&&typeof d=="object"&&(s=this.txStep(d,s,{present:a,byId:l},t,r,n,i));if(!t.added.length&&!t.updated.length&&!t.removed.length)return t.notFound.length&&this.events.emit("transactionApplied",t),t;if(this.editVersion++,s===this.store.state.data&&!this.viewReads(i.fields)){(this.options.autoRowHeight||this.options.getRowHeight)&&this.renderer.invalidateHeights(),this.refreshSummary();let d=this.columns.displayed().some(c=>c.def.formula||c.def.formulas);d?this.finder.refresh():this.finder.refreshRows(i.ids),this.options.getRowHeight||d||this.columns.displayed().some(c=>c.def.merge||c.def.rowSpan)||this.formats.dependsOnOtherRows()?this.renderer.invalidate({rows:!0}):this.renderer.invalidateRowIds(i.ids)}else{this.renderer.invalidateHeights(),this.keepRange=!0;try{this.replaceData(s===this.store.state.data?[...s]:s)}finally{this.keepRange=!1}this.clampRanges()}return this.editor.sync(),r.size&&this.options.flashCells!==!1&&this.flash(r),this.events.emit("transactionApplied",t),t}clampRanges(){let e=this.rowModel.getRowCount(),{range:t,extraRanges:n,focus:r}=this.store.state,i=l=>!l||l.start.rowIndex<e&&l.end.rowIndex<e?l:Math.min(l.start.rowIndex,l.end.rowIndex)>=e?null:{start:{...l.start,rowIndex:Math.min(l.start.rowIndex,e-1)},end:{...l.end,rowIndex:Math.min(l.end.rowIndex,e-1)}},s=n.map(i).filter(l=>!!l);(s.length!==n.length||s.some((l,d)=>l!==n[d]))&&this.store.set({extraRanges:s}),r&&r.rowIndex>=e&&this.store.set({focus:e?{...r,rowIndex:e-1}:null});let a=i(t);a!==t&&(this.store.set({range:a}),this.events.emit("rangeChange",{range:a&&{start:{...a.start},end:{...a.end}}}))}viewReads(e){if(!e.size)return!1;let t=this.store.state;if(this.pivotCfg||this.options.treeData||t.quickFilter||t.advancedFilter||this.groupBy.length)return!0;let r=[...t.sort.map(i=>i.colId),...Object.keys(t.filters)].map(i=>this.columns.getNode(i)?.def);return t.sort.length&&r.push(...this.sortBlocks(t.sort)??[]),r.some(i=>i?i.valueGetter||i.formulas||i.formula?!0:i.field!=null&&e.has(i.field):!1)}txStep(e,t,n,r,i,s,a){let l=this.options.getRowId,{present:d,byId:c}=n,u=h=>{if(!h||typeof h!="object")return null;if(d.has(h))return this.rowModel.idOf(h);try{return l?String(l(h)):null}catch{return null}},p=new Set;for(let h of e.remove??[]){let b=u(h),C=b===null?void 0:c.get(b);C&&!p.has(C)?(p.add(C),d.delete(C),c.delete(b),r.removed.push(C),this.tracker.created.delete(C),this.tracker.originals.delete(C)):C||r.notFound.push(h)}let m=(h,b,C)=>{let M=this.tracker.originals.get(C);if(h===C){for(let v of Object.keys(h))M&&(M[v]=h[v]),a.fields.add(v);a.ids.add(b),r.updated.push(C);return}for(let[v,S]of Object.entries(h)){M&&(M[v]=S);let A=C[v];if(Object.is(A,S))continue;C[v]=S,a.fields.add(v),a.ids.add(b);let D=typeof A=="number"&&typeof S=="number"?S>A?"up":"down":"";for(let k of s.get(v)??[])i.set(`${b}\0${k}`,D)}r.updated.push(C)};for(let h of e.update??[]){let b=u(h),C=b===null?void 0:c.get(b);if(!C||p.has(C)){r.notFound.push(h);continue}m(h,b,C)}let g=Array.isArray(e.add)?[...e.add]:[];for(let h of Array.isArray(e.upsert)?e.upsert:[]){let b=u(h),C=b===null?void 0:c.get(b);C&&!p.has(C)?m(h,b,C):h&&typeof h=="object"&&g.push(h)}let y=Ce(g);r.added.push(...y);for(let h of y)d.add(h),c.set(this.rowModel.idOf(h),h);if(!p.size&&!y.length)return t;let w=p.size?t.filter(h=>!p.has(h)):[...t],f=typeof e.addIndex=="number"?Math.max(0,Math.min(w.length,Math.floor(e.addIndex))):w.length;return w.splice(f,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.allow("advancedFilter")||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(i=>({...i})),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,a]of Object.entries(e.columnGroups))typeof a=="boolean"&&this.setColumnGroupOpened(s,a);n("groupBy")&&Array.isArray(e.groupBy)&&this.setGroupBy(e.groupBy.filter(r)),n("pivot")&&this.setPivot(e.pivot??null);let i={};if(n("sort")&&Array.isArray(e.sort)){let s=this.checkSort(e.sort.filter(a=>a&&r(a.colId)));s&&(i.sort=s)}if(n("filters")&&e.filters&&typeof e.filters=="object"&&(i.filters=Object.fromEntries(Object.entries(e.filters).filter(([s])=>r(s)))),n("advancedFilter")){let s=e.advancedFilter,a=s&&typeof s=="object"&&Array.isArray(s.conditions)&&s.conditions.length?s:null;a!==this.store.state.advancedFilter&&(!a||this.allow("advancedFilter"))&&(i.advancedFilter=a)}if(n("quickFilter")&&typeof e.quickFilter=="string"&&(i.quickFilter=e.quickFilter),this.store.set(i),i.sort&&this.events.emit("sortChange",{sort:[...i.sort]}),i.filters&&this.events.emit("filterChange",{filters:{...i.filters}}),"advancedFilter"in i&&this.events.emit("advancedFilterChange",{advancedFilter:i.advancedFilter??null}),n("expanded")&&e.expanded&&typeof e.expanded=="object"){let s=new Map(Object.entries(e.expanded).filter(([,a])=>typeof a=="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(a=>a.id));this.setSelected(new Set(e.selected.map(String).filter(a=>s.has(a))))}}rowNumber(e){let t=this.rowModel.rows();if(this.rowNumberCache?.rows!==t){let r=new Int32Array(t.length),i=0;t.forEach((l,d)=>{r[d]=l.kind?0:++i});let s=this.page*this.pageSize,a=this.options.pagination&&!this.rowModel.server?this.rowModel.dataRowsBefore?.(s)??s:0;this.rowNumberCache={rows:t,nums:r,offset:a}}let n=this.rowNumberCache.nums[e];return n?n+this.rowNumberCache.offset: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 rt&&(this.saveEditBeforeReload(),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}))}saveEditBeforeReload(){this.rowModel.server&&(this.editor.endRow(!0),this.editor.active&&!this.editor.commit(null)&&this.editor.cancel())}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,r=a=>`${a.top},${a.left}`,i=(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()))}),s=[i(this.api,e),i(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||N(t)?(O(`groupBy: unknown column "${t}"`),!1):!0}):[]}getGroupBy(){return[...this.groupBy]}setGroupBy(e){if(Array.isArray(e)&&e.length&&!this.allow(this.rowModel.server?"serverGroups":"grouping"))return;let t=this.validGroupBy(e);t.join("")!==this.groupBy.join("")&&(this.groupBy=t,this.page=0,this.groupPanel?.refresh(),this.sortWithin&&this.rowModel.invalidate(),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 r=()=>(this.treeLoading.delete(n),!this.destroyed&&this.store.state.data.includes(e.data));Promise.resolve().then(()=>t.loadChildren(e.data)).then(i=>{if(!r())return;let s=Ce(Array.isArray(i)?i:[]);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})},i=>{r()&&(O(`treeData.loadChildren failed for row "${n}"`),this.displayChanged(),this.events.emit("childrenLoadFailed",{row:e.data,error:i}))})}setGroupExpanded(e,t){let n=this.rowModel.rows().find(i=>this.isExpandable(i)&&this.expandKey(i)===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 i=this.sourceRowsOf(e.group.rows);try{r.set(t,ye(n.aggFunc,i.map(s=>G(n,s)),i))}catch{O(`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 i=this.rawParent(r);if(i!==null&&String(i)===t)return i}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 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 i=this.dragOptions.canDrop;if(!i)return!0;try{return i({row:e,target:t,position:n,fromOtherGrid:r!==this})!==!1}catch{return O("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 i=this.options.treeData;!i&&n==="inside"&&(n="after");let s=this.store.state.data,a=r!==this,l=a?-1:s.indexOf(e);if(!a&&l<0||t&&!s.includes(t)||a&&(!r.canMoveRows()||s.includes(e))||!this.canDropRow(e,t,n,r))return!1;let d=i?this.rawParent(e):null,c=!i||!t?null:n==="inside"?t:this.store.state.data.find(f=>this.rowModel.idOf(f)===this.parentOf(t))??null,u=c?this.idValue(c):null,p=s.filter(f=>f!==e),m=!t||n==="inside"?p.length:p.indexOf(t)+(n==="after"?1:0);p.splice(m,0,e);let g=p.some((f,h)=>f!==s[h]);if(!a&&!g&&String(d??"")===String(u??""))return!1;let y=(f,h)=>{try{i.setParentId(e,f,h)}catch{O("treeData.setParentId threw")}},w=i?this.store.state.data.find(f=>this.rowModel.idOf(f)===this.parentOf(e))??null:null;return a?(r.removeRows([e]),i&&y(u,c),this.addRows([e],m)):(i&&y(u,c),this.replaceData(p),this.history.push({undo:()=>{i&&y(d,w),this.replaceData(s)},redo:()=>{i&&y(u,c),this.replaceData(p)}}),this.events.emit("rowDragEnd",{row:e,fromIndex:l,toIndex:m})),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,i=r.indexOf(e);if(i<0||!Number.isFinite(t))return!1;let s=Math.max(0,Math.min(r.length-1,Math.floor(t)));if(s===i)return!1;let a=[...r];return a.splice(i,1),a.splice(s,0,e),this.replaceData(a),n&&this.history.push({undo:()=>this.moveRow(e,i,!1),redo:()=>this.moveRow(e,s,!1)}),this.events.emit("rowDragEnd",{row:e,fromIndex:i,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 r=t??Lo;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]=Fo[this.density];this.options.rowHeight==null&&(this.renderer.opts.rowHeight=Math.round(Bi(e)*t)),this.options.headerHeight==null&&(this.renderer.opts.headerHeight=Math.round(Hi(e)*n))}setDensity(e){let t=this.densityOf(e);t!==this.density&&(this.density=t,this.renderer.applyTheme(),this.applyAutoHeights(this.font.size??Lo),this.renderer.invalidateHeights(),this.layoutChanged())}applyCellPadding(e){return e!=null&&!(typeof e=="number"&&Number.isFinite(e)&&e>=0)?(O("cellPadding must be a number of px, 0 or more"),!1):(this.cellPadding=e,e==null?this.renderer.root.style.removeProperty("--fg-cell-px"):this.renderer.root.style.setProperty("--fg-cell-px",`${e}px`),!0)}setCellPadding(e){e===this.cellPadding||!this.applyCellPadding(e)||(this.menu.close(),this.layoutChanged())}getCellPadding(){if(this.cellPadding!=null)return this.cellPadding;let e=parseFloat(getComputedStyle(this.renderer.root).getPropertyValue("--fg-cell-px"));return Number.isFinite(e)?e:12}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),this.cellPadding!=null&&e.style.setProperty("--fg-cell-px",`${this.cellPadding}px`)}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}if(!(e&&!this.allow("summary"))){if(it(e,this.summarySnapshot)){this.summaryOpts=e;return}this.summarySnapshot=xe(e),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=Sr(e.rows,this.sourceRowsOf(n),r=>this.columns.getNode(r)?.def)}dataColumns(){return this.columns.displayed().filter(e=>!N(e.id))}validRange(e){if(!e||!this.rangesOn())return null;let t=this.rowModel.getRowCount(),n=r=>!!r&&!N(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){if(e&&(e.start?.rowIndex!==e.end?.rowIndex||e.start?.colId!==e.end?.colId)&&!this.allow("range"))return;let n=this.validRange(e),r=t||!this.store.state.extraRanges.length?this.store.state.extraRanges:[],i=this.store.state.range;JSON.stringify(i)===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){if(!this.allow("range"))return;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){if(Array.isArray(e)&&e.length&&!this.allow("range"))return;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:yt({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=>Br(r,e,n.index))}selectAllCells(){if(!this.allow("range"))return;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){if(!t&&this.multiCell()&&!this.allow("clipboard"))return"";let n=this.store.state.locale.code,r=this.columns.displayed(),i=t?null:this.rangeBounds(),s=t,a,l,d=t?[]:this.allRangeBounds();if(d.length>1){let u=d.every(m=>m.c1===d[0].c1&&m.c2===d[0].c2),p=d.every(m=>m.r1===d[0].r1&&m.r2===d[0].r2);if(this.rangesStack(d)){let m=[...d].sort((w,f)=>u?w.r1-f.r1:w.c1-f.c1),g=m.map(w=>this.rangeMatrix(w)),y=u?g.flat():g[0].map((w,f)=>g.flatMap(h=>h[f]??[]));return e&&y.unshift((u?m.slice(0,1):m).flatMap(w=>this.rangeHeaders(w))),oo(y)}}if(i){a=[];for(let u=i.r1;u<=i.r2;u++){let p=this.rowModel.getRow(u);p&&!p.kind&&a.push(p.data)}l=r.slice(i.c1,i.c2+1).filter(u=>!N(u.id))}else if(s)a=this.shownSelectedRows(),l=this.dataColumns();else{let u=this.store.state.focus,p=u&&this.columns.getColumn(u.colId),m=u&&this.rowModel.getRow(u.rowIndex);if(!p||!m||m.kind||N(p.id))return"";a=[m.data],l=[p]}let c=a.map(u=>l.map(p=>this.copyCell(p.def,u,n)));return e&&c.unshift(l.map(u=>u.def.header??u.def.field??u.id)),oo(c)}multiCell(){let e=this.allRangeBounds();return e.length>1||e.some(t=>t.r1!==t.r2||t.c1!==t.c2)}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=>!N(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(i=>!N(i.id)),n=this.store.state.locale.code,r=[];for(let i=e.r1;i<=e.r2;i++){let s=this.rowModel.getRow(i);s&&!s.kind&&r.push(t.map(a=>this.copyCell(a.def,s.data,n)))}return r}copyCell(e,t,n){return this.copyAllowed(e,t)?on(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}copyText(e,t=!1){let n=this.rowModel;if(!(n instanceof rt))return this.selectionTSV(e,t);let r=n.withoutLoading(()=>this.selectionTSV(e,t)),i=t?0:n.withoutLoading(()=>this.unloadedInRanges());return i&&O(`copy: ${i} row${i>1?"s":""} of the range ${i>1?"are":"is"} not loaded and ${i>1?"were":"was"} not copied`),r}copyToClipboard(e,t=!1){let n=this.copyText(e,t);if(n&&typeof navigator<"u"&&navigator.clipboard?.writeText)try{navigator.clipboard.writeText(n)?.catch?.(()=>{})}catch{}return n}unloadedInRanges(){let e=new Set;for(let t of this.allRangeBounds())for(let n=t.r1;n<=t.r2;n++)this.rowModel.getRow(n)?.kind==="loading"&&e.add(n);return e.size}pasteText(e){let t=Nr(e),n={changed:0,skipped:0};if(!t.length||(t.length>1||t[0].length>1)&&!this.allow("clipboard"))return n;let r=this.columns.displayed(),i=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&&!N(l.id))d=a.rowIndex,c=l.index;else return n;let u=[],p=t.length===1&&t[0].length===1,m=p&&s?s.r2-s.r1+1:t.length,g=p&&s?s.c2-s.c1+1:Math.max(...t.map(y=>y.length));for(let y=d,w=0;y<i&&w<m;y++){let f=this.rowModel.getRow(y);if(f.kind){p&&s&&w++;continue}let h=w++;for(let b=0;b<g;b++){let C=r[c+b];if(!C)break;if(N(C.id))continue;let M=p&&s?t[0][0]:t[h]?.[b];if(M===void 0)continue;let v=C.def;if(!v.field||!this.cellEditable(v,f.data,y)){n.skipped++;continue}let S=f.data[v.field],A=this.acceptText(v,f.data,M,S);if(!A.ok){n.skipped++;continue}this.writeCell(u,f.data,v.field,C.id,y,A.value)&&n.changed++}}return this.endCellTx(u),this.events.emit("paste",{...n}),n}acceptText(e,t,n,r){let i,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};i=d.value}else if(e.formulas&&Ne(n.trim()))i=n.trim();else{let a=rn(e,n,r);if(!a.ok)return a;i=a.value}return this.cellError(e,t,i)!==null?{ok:!1}:{ok:!0,value:i}}cellError(e,t,n){let r=this.store.state.locale;if(e.required&&q(n))return r.required;if(e.unique&&e.field&&!q(n)){let i=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))===i}))return r.duplicate}if(e.validate){let i;try{i=e.validate(n,t)}catch{i=r.invalidValue}if(i!==!0)return typeof i=="string"&&i?i: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 i=this.rowModel.idOf(n),s=this.rowModel.indexOfId(i);for(let a of t){if(!this.cellEditable(a.def,n,s<0?r: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}sortBlocks(e){if(!this.sortWithin||!this.paid)return null;if(this.pivotCfg||this.options.treeData||this.groupBy.length)return O("sortWithinMerges is ignored while rows are grouped, pivoted or shown as a tree"),null;let t=new Set(e.map(n=>n.colId));return this.columns.displayed().filter(n=>n.def.merge&&!n.def.rowSpan&&!N(n.id)&&!t.has(n.id)).map(n=>n.def)}setSortWithinMerges(e){let t=!!e;if(t!==this.sortWithin){if(this.sortWithin=t,this.rowModel.server){t&&O("sortWithinMerges is ignored with a datasource: the server sorts the rows");return}this.rowModel.invalidate(),this.updateRows(),this.renderer.invalidate({rows:!0})}}mergeSpans(){if(this.rowModel.server||!this.columns.displayed().some(s=>s.def.merge||s.def.rowSpan)||!this.allow("merge"))return Gi;let e=this.rowModel.rows(),t=this.editVersion*1e6+this.columns.displayed().length,n=this.columns.getColumn(oe)?this.selectionBlocks():null;if(this.spanCache&&this.spanCache.rows===e&&this.spanCache.ver===t&&this.spanCache.sel===n)return this.spanCache.spans;let r=new Map,i=this.columns.displayed().filter(s=>s.def.merge||s.def.rowSpan);if(i.length&&!e.some(s=>s.kind)){let s=e.map(a=>a.data);for(let a of i)r.set(a.id,Xe(s,a.def));if(n){let a=e.length,l=new Int32Array(a),d=new Int32Array(a);for(let c=0;c<a;c++){let u=n.index.get(e[c].id)??-1;l[c]=u<0?c:Math.max(0,c-(u-n.spans.start[u])),d[c]=u<0?c:Math.min(a-1,c+(n.spans.end[u]-u))}r.set(oe,{start:l,end:d})}}return this.spanCache={rows:e,ver:t,sel:n,spans:r},r}validMergeSelection(e){return e==null||e==="rows"?"rows":typeof e=="number"&&Number.isInteger(e)&&e>=1?e:(O("mergeSelection must be 'rows' or a whole number from 1; one checkbox per row is used"),"rows")}setMergeSelection(e){let t=this.validMergeSelection(e);t!==this.mergeSel&&(this.mergeSel=t,this.renderer.invalidate({rows:!0}))}getMergeSelection(){return this.mergeSel}mergeLevelColumns(){return this.columns.displayed().filter(e=>e.def.merge&&!e.def.rowSpan&&!N(e.id))}mergeSelectionLevel(){if(this.mergeSel==="rows")return 0;if(!this.options.rowSelection)return O("mergeSelection needs rowSelection 'multiple' or 'single'"),0;if(!this.paid)return 0;if(this.rowModel.server||this.pivotCfg||this.options.treeData||this.groupBy.length)return O("mergeSelection is ignored while rows are grouped, pivoted, shown as a tree or loaded from a datasource: one checkbox per row"),0;let e=this.mergeLevelColumns().length;return e?this.mergeSel>e?(O(`mergeSelection: level ${this.mergeSel} asked for, but only ${e} merge column${e>1?"s are":" is"} shown; level ${e} is used`),e):this.mergeSel:0}selectionBlocks(){let e=this.mergeSelectionLevel();if(!e)return null;let t=this.rowModel.dataRows(),n=this.rowModel.rows(),r=this.mergeLevelColumns().slice(0,e),i=`${e}|${this.editVersion}|${r.map(l=>l.id).join("")}`,s=this.selBlockCache;if(s&&s.rows===t&&s.disp===n&&s.key===i)return s.blocks;let a=null;if(!n.some(l=>l.kind)){let l=t.map(d=>d.data);a={level:e,cols:r,spans:Yn(r.map(d=>Xe(l,d.def)),t.length),index:new Map(t.map((d,c)=>[d.id,c]))}}return this.selBlockCache={rows:t,disp:n,key:i,blocks:a},a}blockSelection(e){let t=this.selectionBlocks(),n=t&&this.rowModel.getRow(e),r=n?t.index.get(n.id):void 0;if(!t||r===void 0)return null;let i=this.store.state.selected,s=this.blockStateCache;(!s||s.sel!==i||s.blocks!==t||s.ver!==this.editVersion)&&(s=this.blockStateCache={sel:i,blocks:t,ver:this.editVersion,map:new Map});let a=t.spans.start[r],l=s.map.get(a);if(l===void 0){let d=this.rowModel.dataRows(),c=0,u=0;for(let p=a;p<=t.spans.end[a];p++)this.rowSelectable(d[p].data)&&(c++,i.has(d[p].id)&&u++);l=c?u===0?"none":u===c?"all":"some":"off",s.map.set(a,l)}return l}blockIds(e,t){let n=this.rowModel.dataRows(),r=[];for(let i=e;i<=t;i++)this.rowSelectable(n[i].data)&&r.push(n[i].id);return r}selectBlockFromClick(e,t,n,r){let i=this.options.rowSelection,s=e.index.get(this.rowModel.getRow(t).id);if(s===void 0)return;let{start:a,end:l}=e.spans,d=a[s],c=l[s],u=this.blockIds(d,c);if(!u.length)return;let p=this.store.state.selected,m=this.rowModel.dataRows()[d].id;if(i==="single"){let y=u.every(w=>p.has(w));this.setSelected(n&&y?new Set:new Set(u),m);return}let g=this.store.state.anchorId==null?void 0:e.index.get(this.store.state.anchorId);if(r&&g!==void 0){let y=n?new Set(p):new Set;for(let w of this.blockIds(Math.min(a[g],d),Math.max(l[g],c)))y.add(w);this.setSelected(y);return}if(n){let y=new Set(p),w=u.every(f=>y.has(f));for(let f of u)w?y.delete(f):y.add(f);this.setSelected(y,m);return}this.setSelected(new Set(u),m)}selectedGroups(e=!1){let t=this.selectionBlocks(),n=this.store.state.selected;if(!t||!n.size)return[];let r=this.rowModel.dataRows(),i=[];for(let s=0;s<r.length;s=t.spans.end[s]+1){let a=[],l=!1;for(let c=s;c<=t.spans.end[s];c++){let u=n.has(r[c].id);l||(l=u),(u||e)&&a.push(r[c].data)}if(!l)continue;let d={};for(let c of t.cols)d[c.def.field??c.id]=G(c.def,r[s].data);i.push({level:t.level,values:d,rows:a})}return i}rangeAggregates(){let e=this.allRangeBounds();if(!e.length||!this.paid)return null;let t=this.columns.displayed(),n=[JSON.stringify(e),this.rowModel.rows(),this.editVersion,...t.map(l=>l.def)],r=this.aggMemo;if(r&&r.key.length===n.length&&r.key.every((l,d)=>l===n[d]))return r.value&&{...r.value};let i={cells:0,count:0,numbers:0,sum:0,min:1/0,max:-1/0},s=e.length>1?new Set:null,a=t.length;for(let l of e){let d=t.slice(l.c1,l.c2+1).filter(c=>!N(c.id));for(let c=l.r1;c<=l.r2;c++){let u=this.rowModel.getRow(c);if(!u||u.kind)continue;let p=u.data;for(let m of d){if(s){let y=c*a+m.index;if(s.has(y))continue;s.add(y)}i.cells++;let g=G(m.def,p);if(!q(g)&&(i.count++,typeof g=="number"||m.def.type==="number"&&!Number.isNaN(Number(g)))){let y=Number(g);i.numbers++,i.sum+=y,y<i.min&&(i.min=y),y>i.max&&(i.max=y)}}}}return this.aggMemo={key:n,value:i},{...i}}fillRange(e){if(!this.allow("fill"))return;let t=this.rangeBounds()??(()=>{let g=this.store.state.focus,y=g&&this.columns.getColumn(g.colId);return g&&y&&!N(y.id)?{r1:g.rowIndex,r2:g.rowIndex,c1:y.index,c2:y.index}:null})(),n=this.columns.getColumn(e.start.colId),r=this.columns.getColumn(e.end.colId);if(!t||!n||!r)return;let i=yt({start:{rowIndex:e.start.rowIndex,colIndex:n.index},end:{rowIndex:e.end.rowIndex,colIndex:r.index}}),s=this.rowModel.getRowCount();i.r1=Math.max(0,i.r1),i.r2=Math.min(s-1,i.r2);let a=this.columns.displayed(),l=[],d=(g,y,w)=>{let f=a[y],h=this.rowModel.getRow(g),b=f?.def;!h||h.kind||!b?.field||N(f.id)||!this.cellEditable(b,h.data,g)||this.cellError(b,h.data,w)===null&&this.writeCell(l,h.data,b.field,f.id,g,w)},c=(g,y)=>G(a[y].def,this.rowModel.getRow(g).data),u=g=>{let y=this.rowModel.getRow(g);return!!y&&!y.kind},p=(g,y,w)=>{let f=[];for(let h=g;h<=y;h++)w(h)&&f.push(h);return f},m=g=>!!a[g]&&!N(a[g].id);if(i.r1<t.r1||i.r2>t.r2){let g=p(t.r2+1,i.r2,u),y=p(i.r1,t.r1-1,u).reverse(),w=p(t.r1,t.r2,u);for(let f=t.c1;f<=t.c2;f++){let h=w.map(b=>c(b,f));wt(h,g.length).forEach((b,C)=>d(g[C],f,b)),wt([...h].reverse(),y.length).forEach((b,C)=>d(y[C],f,b))}}else if(i.c1<t.c1||i.c2>t.c2){let g=p(t.c2+1,i.c2,m),y=p(i.c1,t.c1-1,m).reverse(),w=p(t.c1,t.c2,m);for(let f of p(t.r1,t.r2,u)){let h=w.map(b=>c(f,b));wt(h,g.length).forEach((b,C)=>d(f,g[C],b)),wt([...h].reverse(),y.length).forEach((b,C)=>d(f,y[C],b))}}else return;this.endCellTx(l),this.setRange({start:{rowIndex:i.r1,colId:a[i.c1].id},end:{rowIndex:i.r2,colId:a[i.c2].id}})}setPinnedRows(e){e.top&&(this.pinnedRows.top=Ce(e.top)),e.bottom&&(this.pinnedRows.bottom=Ce(e.bottom)),this.renderer.invalidate({rows:!0})}writeCell(e,t,n,r,i,s){let a=t[n];return Object.is(a,s)||this.veto("beforeCellChange",{row:t,rowIndex:i,colId:r,oldValue:a,newValue:s})?!1:(this.tracker.beforeChange(t),t[n]=s,e.push({row:t,field:n,colId:r,rowIndex:i,oldValue:a,newValue:s}),!0)}endCellTx(e){if(!e.length)return;let t=(n,r)=>{let i=n.map(s=>{let a=s.row[s.field];return s.row[s.field]=s[r],{row:s.row,rowIndex:this.rowModel.indexOfId(this.rowModel.idOf(s.row)),colId:s.colId,oldValue:a,newValue:s[r]}});this.afterDataEdit();for(let s of i)this.events.emit("cellValueChanged",s)};this.history.push({undo:()=>t([...e].reverse(),"oldValue"),redo:()=>t(e,"newValue")}),this.afterDataEdit();for(let n of e)this.events.emit("cellValueChanged",{row:n.row,rowIndex:n.rowIndex,colId:n.colId,oldValue:n.oldValue,newValue:n.newValue})}afterDataEdit(){this.renderer.invalidateHeights(),this.editVersion++,this.refreshSummary(),this.renderer.invalidate({rows:!0})}applyEdit(e,t,n){let r=this.rowModel.getRow(e),i=this.columns.getColumn(t)?.def;if(!r||!i?.field)return;let s=[];this.writeCell(s,r.data,i.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 r=this.store.state.focus,i=r?this.columns.getColumn(r.colId)?.index:void 0,s=n.length?n:r&&i!==void 0?[{r1:r.rowIndex,r2:r.rowIndex,c1:i,c2:i}]:[];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 p=t[u]?.def;c&&!c.kind&&p?.field&&this.cellEditable(p,c.data,d)&&(!e||this.copyAllowed(p,c.data))&&this.writeCell(a,c.data,p.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 r=this.rowModel.getRowCount(),i=this.store.state.focus;i&&i.rowIndex>=r&&this.store.set({focus:r?{...i,rowIndex:r-1}:null})}addRows(e,t,n=!0){if(this.clientOnly("addRows"))return[];let r=Ce(Array.isArray(e)?e:[]);if(!r.length)return[];let i=[...this.store.state.data],s=t===void 0?i.length:Math.max(0,Math.min(i.length,t));i.splice(s,0,...r);for(let a of r)this.tracker.created.add(a);return this.replaceData(i),n&&this.history.push({undo:()=>this.removeRows(r,!1),redo:()=>this.addRows(r,s,!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(Array.isArray(e)?e.flatMap(l=>Rt(l)??[l]):[])),i=[];if(n.forEach((l,d)=>{let c=!1;try{c=!!r(l)}catch{c=!1}c&&i.push({row:l,index:d})}),!i.length)return[];let s=new Set(i.map(l=>l.row)),a=new Set(i.filter(l=>this.tracker.created.has(l.row)).map(l=>l.row));for(let{row:l,index:d}of i)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 i)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:i.map(l=>l.row)}),i.map(l=>l.row)}trackedFields(){let e=[],t=n=>{for(let r of n)r.children?t(r.children):r.def.field&&!N(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 i of this.tracker.diff(n,e.map(s=>s.field)))t.push({row:n,colId:e.find(s=>s.field===i).colId,oldValue:r[i],newValue:n[i]});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 i=this.columns.getNode(r);!i||i.children||i.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(u=>this.columns.getColumn(u)):this.columns.displayed()).filter(u=>!!u&&It(u.def)),{first:n,last:r}=this.renderer.renderedRange(),i=this.store.state.locale.code,s=this.getCellPadding()*2,a=s+6+14,l=28,d=this.store.state.filters,c=s;for(let u of t){let p=this.renderer.measureText(u.def.header??u.def.field??"",!0)+a+(d[u.id]?l:0),m=Z(u.def,i);for(let y=n;y<=r;y++){let w=this.rowModel.getRow(y);w&&(p=Math.max(p,this.renderer.measureText(m(G(u.def,w.data)),!1)+c))}let g=this.columns.setWidth(u.id,Math.ceil(p));this.events.emit("columnResize",{colId:u.id,width:g})}this.layoutChanged()}resetColumns(){this.columns.reset(),this.columnsChanged()}setSort(e){let t=this.checkSort(e);t&&(this.store.set({sort:t}),this.events.emit("sortChange",{sort:[...t]}))}checkSort(e){let t=e.filter(n=>{let r=this.columns.getNode(n.colId);return!r||r.children?(O(`setSort: unknown column "${n.colId}"`),!1):n.dir==="asc"||n.dir==="desc"});return this.veto("beforeSort",{sort:t.map(n=>({...n}))})?null:t}toggleSort(e,t){let n=this.store.state.sort,r=n.find(a=>a.colId===e),i=r?r.dir==="asc"?"desc":null:"asc",s;t?i?r?s=n.map(a=>a.colId===e?{colId:e,dir:i}:a):s=[...n,{colId:e,dir:i}]:s=n.filter(a=>a.colId!==e):s=i?[{colId:e,dir:i}]:[],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 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=[],i=new Set([e.id]),s=[e.id];for(;s.length;)for(let a of n.get(s.shift())??[]){let l=this.rowModel.idOf(a);i.has(l)||(i.add(l),s.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(i=>n.has(i)).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(i=>n.has(i));for(let i of t)r?n.delete(i):n.add(i);this.setSelected(n)}selectFromClick(e,t,n){let r=this.options.rowSelection;if(!r||e<0||e>=this.rowModel.getRowCount())return;let i=this.rowModel.getRow(e);if(i.kind)return;let s=this.selectionBlocks();if(s){this.selectBlockFromClick(s,e,t,n);return}if(!this.rowSelectable(i.data))return;let a=Ii({selected:this.store.state.selected,anchorIndex:this.anchorIndex(),mode:r,index:e,idAt:l=>this.rowModel.getRow(l).id,toggle:t,range:n});if(this.rowModel.rows()!==this.rowModel.dataRows()||this.options.isRowSelectable)for(let l of a.selected){if(this.store.state.selected.has(l))continue;let d=this.rowModel.indexOfId(l),c=d>=0?this.rowModel.getRow(d):null;c&&(c.kind||!this.rowSelectable(c.data))&&a.selected.delete(l)}if(r==="multiple"&&this.options.groupSelectsChildren&&this.options.treeData&&i.hasChildren){let l=a.selected.has(i.id);for(let d of this.groupMemberIds(i))l?a.selected.add(d):a.selected.delete(d)}this.setSelected(a.selected,this.rowModel.getRow(a.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}selectableIds(){let e=this.rowModel.dataRows(),t=this.options.isRowSelectable,n=this.selectableCache;if(n&&n.rows===e&&n.fn===t&&n.ver===this.editVersion)return n.ids;let r=new Set(this.selectableRows().map(i=>i.id));return this.selectableCache={rows:e,fn:t,ver:this.editVersion,ids:r},r}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(i=>t.has(i.id)),r=new Set(t);for(let i of e)n?r.delete(i.id):r.add(i.id);this.setSelected(r)}selectedRows(){let e=this.store.state.selected;return e.size?this.sourceRowsOf(this.rowModel.allNodes().filter(t=>e.has(t.id)).map(t=>t.data)):[]}orderedDataRows(){return this.rowModel.orderedDataRows?.()??this.rowModel.dataRows()}shownSelectedRows(){let e=this.store.state.selected;return e.size?this.orderedDataRows().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(ar(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(sr),this.options.rowSelection&&t.push(ir),[...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();let n=Ce(e);this.store.set({data:n===this.store.state.data?[...n]:n}),t?.scrollToTop&&this.renderer.setScroll({top:0,left:0});let r=this.store.state.selected;if(r.size)if(this.options.getRowId){let a=new Set(this.rowModel.allNodes().map(d=>d.id)),l=new Set([...r].filter(d=>a.has(d)));l.size!==r.size&&this.setSelected(l)}else this.setSelected(new Set,null);let i=this.rowModel.getRowCount(),s=this.store.state.focus;s&&s.rowIndex>=i&&this.store.set({focus:i?{...s,rowIndex:i-1}:null})}setColumns(e){if(!Array.isArray(e)){O("setColumns: columns must be an array");return}if(it(e,this.sourceSnapshot)){this.sourceDefs=e;return}if(this.menu.close(),this.sourceDefs=e,this.sourceSnapshot=xe(e),this.pivotCfg){this.rebuildPivot();return}this.columns.updateDefs(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:this.store.state.focus&&t(this.store.state.focus.colId)?this.store.state.focus:null}),this.columnsChanged()}closePopups(){let t=!!(this.renderer.root.getRootNode().activeElement??document.activeElement)?.closest(".fg-menu");this.menu.close(),this.chooser.close(),this.contextMenu.close(),this.filterBuilder.close(),this.formatDialog.close(),t&&this.renderer.gridEl.focus({preventScroll:!0})}onChange(e){let t=(...i)=>i.some(s=>e.includes(s));t("sort","filters","quickFilter","advancedFilter")&&this.saveEditBeforeReload(),this.pivotCfg&&t("data","locale")&&this.rebuildPivot(!1),this.rollupOn&&t("data")&&this.rebuildRollup(),t("locale","theme")&&this.closePopups(),t("locale")&&(this.finder.relabel(),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();let r=t("sort","filters","quickFilter","advancedFilter","locale","data");!r&&t("selected")&&this.renderer.selectionChanged(),this.renderer.invalidate({header:r,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),setSortWithinMerges:e(t=>this.setSortWithinMerges(t)),getSortWithinMerges:e(()=>this.sortWithin),setMergeSelection:e(t=>this.setMergeSelection(t)),getMergeSelection:e(()=>this.getMergeSelection()),getSelectedGroups:e(()=>this.selectedGroups()),getSelectedGroupsAllRows:e(()=>this.selectedGroups(!0)),showOverlay:e(t=>{this.forcedOverlay=t==="loading"||t==="noRows"?t:null,this.renderer.invalidate()}),getXlsxSheet:e(t=>this.allow("excel")?yo(this,t):{name:t?.sheetName??"Sheet1",rows:[]}),print:e(t=>ti(po(this,t))),getPrintHtml:e(t=>po(this,t)),getPdf:e(t=>this.allow("pdf")?io(Cn(this,t),fn,{scale:t?.resolution,quality:t?.quality}):null),exportPdf:e((t="export.pdf",n)=>{if(!this.allow("pdf"))return;let r=io(Cn(this,n),fn,{scale:n?.resolution,quality:n?.quality});r?qe(t,[r],"application/pdf"):O("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.allow("advancedFilter")&&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.allow("conditional")&&this.formatDialog.open(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:At(t)})),setFont:e(t=>this.setFont(t)),setCellPadding:e(t=>this.setCellPadding(t)),getCellPadding:e(()=>this.getCellPadding()),setRollup:e(t=>this.setRollup(t)),getRollup:e(()=>this.getRollup()),setColumnAggFunc:e((t,n)=>this.setColumnAggFunc(t,n)),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.allow("sideBar")&&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.allow("find")?this.finder.find(t):0),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.allow("charts")?this.charts.create(t):{el:x("div","fg-chart-body"),setType:()=>{},update:()=>{},destroy:()=>{}}),getCsv:e(t=>go(this,t)),getJson:e(t=>mo(this,t)),exportJson:e((t="export.json",n)=>qe(t,[mo(this,n)],"application/json;charset=utf-8")),exportCsv:e((t="export.csv",n)=>qe(t,["\uFEFF",go(this,n)],"text/csv;charset=utf-8")),getXlsx:e(t=>this.allow("excel")?wo(this,t):new Uint8Array(0)),exportXlsx:e((t="export.xlsx",n)=>{this.allow("excel")&&qe(t,[wo(this,n)],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")}),importFile:e((t,n)=>oi(this,t,n)),on:e((t,n)=>this.events.on(t,n)),destroy:()=>this.destroy()}}destroy(){if(!this.destroyed){this.destroyed=!0,Ut.delete(this.renderer.root),clearTimeout(this.flashTimer),clearTimeout(this.txTimer);for(let e of this.disposers)e();this.renderer.destroy(),this.events.clear()}}};function ul(o,e){return new Io(o,e).api}function zi(o){let e=(Array.isArray(o)?o:[]).filter(t=>t&&t.grid&&typeof t.grid.getXlsxSheet=="function");return e.length?e.some(t=>Fr(t.grid)?.allow("workbook")===!1)?new Uint8Array(0):tt(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"),tt([{name:"Sheet1",rows:[]}]))}function fl(o,e){let t=zi(e);t.length&&qe(o||"export.xlsx",[t],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")}var hl=o=>typeof o=="function"?o():o??{};async function Vi(o,e,t,n){let r=o,i=o.split(/[?#]/)[0],s={method:e,credentials:n.credentials??"same-origin",headers:{Accept:"application/json",...hl(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 s.headers["Content-Type"]="application/json",s.body=JSON.stringify(t);let a=await fetch(r,s);if(!a.ok)throw new Error(`HTTP ${a.status} from ${i}`);let l=await a.text();if(!l)return null;try{return JSON.parse(l)}catch{throw new Error(`HTTP ${a.status} from ${i}: the response is not JSON`)}}function pl(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 qi(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?.()??{}},i=await Vi(o,e.method??"POST",r,e);return(e.transform??pl)(i)}}}var Do=new WeakMap;function gl(o,e,t={}){let n=Do.get(o);if(n)return n;if(!o.hasChanges())return Promise.resolve(null);let{created:r,updated:i,deleted:s}=o.getModifiedRows(),a=new Map([...r,...i].map(d=>[d,{...d}])),l=(async()=>{let d=await Vi(e,"POST",{created:r,updated:i,deleted:s,...t.params?.()??{}},t);return o.commitChanges({rows:a,deleted:s}),d})().finally(()=>Do.delete(o));return Do.set(o,l),l}var $o=new WeakMap;async function ml(o,e,t={}){let n=($o.get(o)??0)+1;$o.set(o,n);let{rows:r}=await qi(e,t).getRows({start:0,end:t.maxRows??1e4,sort:[],filters:{},quickFilter:""});return $o.get(o)===n&&o.setData(r),r}function wl(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 Wi=["add","update","remove","upsert"];function ji(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 Wi.some(n=>Array.isArray(t[n]))?t:Array.isArray(t.rows)?{rows:t.rows}:null}function yl(o,e){let t=e??{},n="connecting",r=!1,i=!1,s=[],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)&&!Wi.some(f=>f in w)?(o.flushAsyncTransactions(),o.setData(w.rows)):t.immediate?o.applyTransaction(w):o.applyTransactionAsync(w)},p=w=>{if(r)return;let f;try{f=t.parse?t.parse(w):ji(w),Array.isArray(f)&&(f={upsert:f})}catch(h){t.onError?t.onError(h):O("connectLive: a message could not be read");return}!f||typeof f!="object"||(i?s.push(f):u(f))},m=()=>{if(r||t.reconnect===!1){c("closed");return}let w=typeof t.maxDelay=="number"&&t.maxDelay>0?t.maxDelay:3e4,f=Math.min(w,500*2**Math.min(d++,10))*(.8+Math.random()*.4);c("connecting"),l=window.setTimeout(g,f)},g=()=>{if(r)return;if(l=0,t.poll){y();return}let w=t.url;if(!w){O("connectLive: give a url or a poll function"),c("error");return}c(i?"paused":"connecting");try{if(/^wss?:/i.test(w)){if(typeof WebSocket>"u")throw new Error("no WebSocket");let f=new WebSocket(w,t.protocols);a=f,f.onopen=()=>{d=0,c(i?"paused":"open")},f.onmessage=h=>p(h.data),f.onerror=()=>c("error"),f.onclose=()=>{a===f&&(a=null),r||m()}}else{if(typeof EventSource>"u")throw new Error("no EventSource");let f=new EventSource(w,{withCredentials:!!t.withCredentials});a=f,f.onopen=()=>{d=0,c(i?"paused":"open")},f.addEventListener(t.event||"message",h=>p(h.data)),f.onerror=()=>{f.readyState===2?(a===f&&(a=null),r||m()):c("connecting")}}}catch{c("error"),m()}},y=async()=>{if(!r)try{let w=await t.poll();if(r)return;d=0,c(i?"paused":"open"),p(w);let f=typeof t.interval=="number"&&t.interval>0?t.interval:2e3;l=window.setTimeout(y,f)}catch{if(r)return;c("error"),m()}};return g(),{get status(){return n},pause(){r||i||(i=!0,c("paused"))},resume(){if(r||!i)return;i=!1;let w=s;s=[];for(let f of w)u(f);c(a||t.poll?"open":"connecting")},close(){r||(r=!0,clearTimeout(l),a?.close(),a=null,s=[],c("closed"))},send(w){let f=a;return!f||typeof f.send!="function"||f.readyState!==1?!1:(f.send(w),!0)}}}var bl={en:ae,ko:Wo,"zh-CN":jo,"zh-TW":Uo,ja:qo,es:zo,fr:Vo,de:Go,vi:Ko,th:_o,id:Xo,ru:Jo,"pt-BR":Yo,it:Zo};for(let o of Object.values(bl))In(o);export{zi as buildWorkbook,il as changeTracker,yl as connectLive,ul as createGrid,wl as csrfHeaders,ae as en,Vn as evaluateFormula,fl as exportWorkbook,ys as formulaFunctions,ml as loadData,bl as locales,ji as messageToTransaction,lo as parseCsv,fo as readXlsx,ws as registerFormulaFunction,In as registerLocale,xo as renderChart,At as resolveLocale,qi as restDatasource,gl as saveChanges,Ja as setLicenseKey,xi as verifyLicense,nt as version,tt as writeXlsx};