DigitalFormUtils.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6. using System.Windows.Forms;
  7. using FastReport;
  8. using FastReport.Table;
  9. using FastReport.Utils;
  10. using InABox.Core;
  11. using InABox.Scripting;
  12. using InABox.Wpf.Reports;
  13. using InABox.Wpf.Reports.CustomObjects;
  14. using UnderlineType = InABox.Core.UnderlineType;
  15. namespace InABox.DynamicGrid
  16. {
  17. public static class DigitalFormUtils
  18. {
  19. #region Layout Importer
  20. private class Cell
  21. {
  22. public string Content { get; set; }
  23. public int Row { get; set; }
  24. public int Column { get; set; }
  25. public int RowSpan { get; set; } = 1;
  26. public int ColumnSpan { get; set; } = 1;
  27. public ICell InnerCell { get; set; }
  28. public Cell(int row, int column, string content, ICell cell)
  29. {
  30. Row = row;
  31. Column = column;
  32. Content = content;
  33. InnerCell = cell;
  34. }
  35. }
  36. private static void DeleteColumn(List<Cell> cells, int column)
  37. {
  38. foreach(var cell in cells)
  39. {
  40. if(cell.Column <= column && cell.Column + cell.ColumnSpan - 1 >= column)
  41. {
  42. --cell.ColumnSpan;
  43. }
  44. else if(cell.Column > column)
  45. {
  46. --cell.Column;
  47. }
  48. }
  49. cells.RemoveAll(x => x.ColumnSpan < 0);
  50. }
  51. private static List<Cell> GetCells(ISheet sheet)
  52. {
  53. var grid = new Dictionary<int, Dictionary<int, Cell>>();
  54. for (int rowIdx = sheet.FirstRow; rowIdx <= sheet.LastRow; ++rowIdx)
  55. {
  56. var row = sheet.GetRow(rowIdx);
  57. if (row is not null && row.FirstColumn >= 0)
  58. {
  59. var rowCells = new Dictionary<int, Cell>();
  60. for (int colIdx = row.FirstColumn; colIdx <= row.LastColumn; ++colIdx)
  61. {
  62. var cell = row.GetCell(colIdx);
  63. if (cell is not null)
  64. {
  65. rowCells.Add(colIdx, new Cell(rowIdx, colIdx, cell.GetValue(), cell));
  66. }
  67. }
  68. grid.Add(rowIdx, rowCells);
  69. }
  70. }
  71. foreach (var region in sheet.GetMergedCells())
  72. {
  73. for (int r = region.FirstRow; r <= region.LastRow; ++r)
  74. {
  75. if (!grid.TryGetValue(r, out var row)) continue;
  76. for (int c = region.FirstColumn; c <= region.LastColumn; ++c)
  77. {
  78. if ((r - region.FirstRow) + (c - region.FirstColumn) != 0)
  79. {
  80. row.Remove(c);
  81. }
  82. }
  83. if (row.Count == 0)
  84. {
  85. grid.Remove(r);
  86. }
  87. }
  88. if (grid.TryGetValue(region.FirstRow, out var cRow) && cRow.TryGetValue(region.FirstColumn, out var cCell))
  89. {
  90. cCell.RowSpan = region.LastRow - region.FirstRow + 1;
  91. cCell.ColumnSpan = region.LastColumn - region.FirstColumn + 1;
  92. }
  93. }
  94. var cells = new List<Cell>();
  95. foreach (var row in grid.Values)
  96. {
  97. foreach (var cell in row.Values)
  98. {
  99. cells.Add(cell);
  100. }
  101. }
  102. return cells;
  103. }
  104. private static Regex VariableRegex = new(@"^\[(?<VAR>[^:\]]+)(?::(?<TYPE>[^:\]]*))?(?::(?<PROPERTIES>[^\]]*))?\]$");
  105. private static Regex HeaderRegex = new(@"^{(?<HEADER>[^:}]+)(?::(?<COLLAPSED>[^}]*))?}$");
  106. public static DFLayout LoadLayout(ISpreadsheet spreadsheet)
  107. {
  108. var sheet = spreadsheet.GetSheet(0);
  109. var cells = GetCells(sheet);
  110. int firstRow = int.MaxValue;
  111. int lastRow = 0;
  112. int firstCol = int.MaxValue;
  113. int lastCol = 0;
  114. foreach (var cell in cells)
  115. {
  116. firstCol = Math.Min(cell.Column, firstCol);
  117. lastCol = Math.Max(cell.Column + cell.ColumnSpan - 1, lastCol);
  118. firstRow = Math.Min(cell.Row, firstRow);
  119. lastRow = Math.Max(cell.Row + cell.RowSpan - 1, lastRow);
  120. }
  121. var layout = new DFLayout();
  122. var columnWidths = new Dictionary<int, float>();
  123. var colOffset = 0;
  124. for (int col = firstCol; col <= lastCol; ++col)
  125. {
  126. var width = sheet.GetColumnWidth(col);
  127. if(width == float.MinValue)
  128. {
  129. layout.ColumnWidths.Add("10*");
  130. }
  131. else if(width <= 0f)
  132. {
  133. DeleteColumn(cells, col);
  134. }
  135. else
  136. {
  137. layout.ColumnWidths.Add($"{width}*");
  138. }
  139. }
  140. for (int row = firstRow; row <= lastRow; ++row)
  141. layout.RowHeights.Add("Auto");
  142. foreach(var cell in cells)
  143. {
  144. var style = cell.InnerCell.GetStyle();
  145. if (string.IsNullOrWhiteSpace(cell.Content) && style.Foreground == Color.Empty) continue;
  146. DFLayoutControl? control;
  147. var content = cell.Content?.Trim() ?? "";
  148. var headermatch = HeaderRegex.Match(content);
  149. var variablematch = VariableRegex.Match(content);
  150. if (headermatch.Success)
  151. {
  152. var text = headermatch.Groups["HEADER"];
  153. var collapsed = headermatch.Groups["COLLAPSED"];
  154. var header = new DFLayoutHeader()
  155. {
  156. Header = text.Value,
  157. Collapsed = collapsed.Success && String.Equals(collapsed.Value.ToUpper(),"COLLAPSED"),
  158. };
  159. header.Style.Synchronise(CreateStyle(style));
  160. control = header;
  161. }
  162. else if (variablematch.Success)
  163. {
  164. var variableName = variablematch.Groups["VAR"];
  165. var variableType = variablematch.Groups["TYPE"];
  166. var variableProps = variablematch.Groups["PROPERTIES"];
  167. Type? fieldType = null;
  168. if (variableType.Success)
  169. fieldType = DFUtils.GetFieldType(variableType.Value);
  170. fieldType ??= typeof(DFLayoutStringField);
  171. var field = (Activator.CreateInstance(fieldType) as DFLayoutField)!;
  172. field.Name = variableName.Value;
  173. if (variableProps.Success)
  174. {
  175. if (field is DFLayoutOptionField option)
  176. option.Properties.Options = variableProps.Value;
  177. if (field is DFLayoutStringField text)
  178. text.Properties.TextWrapping = style.WrapText;
  179. // need to populate other variable types here
  180. }
  181. control = field;
  182. }
  183. else
  184. {
  185. var label = new DFLayoutLabel
  186. {
  187. Caption = content
  188. };
  189. label.Style.Synchronise(CreateStyle(style));
  190. control = label;
  191. }
  192. if(control is not null)
  193. {
  194. control.Row = cell.Row - firstRow + 1;
  195. control.Column = cell.Column - firstCol + 1 - colOffset;
  196. control.RowSpan = cell.RowSpan;
  197. control.ColumnSpan = cell.ColumnSpan;
  198. layout.Elements.Add(control);
  199. }
  200. }
  201. return layout;
  202. }
  203. private static DFLayoutTextStyle CreateStyle(ICellStyle style)
  204. {
  205. if (style == null)
  206. return new DFLayoutTextStyle();
  207. var result = new DFLayoutTextStyle
  208. {
  209. FontSize = style.Font.FontSize,
  210. IsItalic = style.Font.Italic,
  211. IsBold = style.Font.Bold,
  212. Underline = style.Font.Underline switch
  213. {
  214. Scripting.UnderlineType.None => UnderlineType.None,
  215. Scripting.UnderlineType.Single or Scripting.UnderlineType.SingleAccounting => UnderlineType.Single,
  216. Scripting.UnderlineType.Double or Scripting.UnderlineType.DoubleAccounting => UnderlineType.Double,
  217. _ => UnderlineType.None
  218. },
  219. BackgroundColour = style.Background,
  220. ForegroundColour = style.Font.Colour,
  221. HorizontalTextAlignment = style.HorizontalAlignment switch
  222. {
  223. CellAlignment.Middle => DFLayoutAlignment.Middle,
  224. CellAlignment.End => DFLayoutAlignment.End,
  225. CellAlignment.Justify => DFLayoutAlignment.Stretch,
  226. _ => DFLayoutAlignment.Start
  227. },
  228. VerticalTextAlignment = style.VerticalAlignment switch
  229. {
  230. CellAlignment.Start => DFLayoutAlignment.Start,
  231. CellAlignment.End => DFLayoutAlignment.End,
  232. CellAlignment.Justify => DFLayoutAlignment.Stretch,
  233. _ => DFLayoutAlignment.Middle
  234. },
  235. TextWrapping = style.WrapText
  236. };
  237. return result;
  238. }
  239. #endregion
  240. #region Report Generator
  241. private static string ElementName(HashSet<string> names, string name)
  242. {
  243. int i = 0;
  244. if(names.Contains(name))
  245. {
  246. string newName;
  247. do
  248. {
  249. newName = $"{name}{i}";
  250. ++i;
  251. } while (names.Contains(newName));
  252. name = newName;
  253. }
  254. return name;
  255. }
  256. public static Report? GenerateReport(DigitalFormLayout layout, DataModel model)
  257. {
  258. bool IsValidChar(char c) => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789".Contains(c);
  259. var report = ReportUtils.SetupReport(null, model, true);
  260. var dfLayout = new DFLayout();
  261. dfLayout.LoadLayout(layout.Layout);
  262. var page = new ReportPage();
  263. page.Name = "Page1";
  264. page.PaperWidth = 210;
  265. page.PaperHeight = 297;
  266. page.Landscape = false;
  267. page.LeftMargin = 10;
  268. page.TopMargin = 10;
  269. page.RightMargin = 10;
  270. page.BottomMargin = 10;
  271. report.Pages.Add(page);
  272. var formData = report.GetDataSource("Form_Data");
  273. var band = new DataBand
  274. {
  275. Name = "Data1",
  276. Height = Units.Millimeters * (page.PaperHeight - (page.TopMargin + page.BottomMargin)),
  277. Width = Units.Millimeters * (page.PaperWidth - (page.LeftMargin + page.RightMargin)),
  278. PrintIfDatasourceEmpty = true,
  279. DataSource = formData,
  280. StartNewPage = true
  281. };
  282. page.AddChild(band);
  283. var logo = new PictureObject()
  284. {
  285. Height = 20F * Units.Millimeters,
  286. Width = 30F * Units.Millimeters,
  287. DataColumn = "CompanyLogo.Data"
  288. };
  289. band.AddChild(logo);
  290. var company = new TextObject()
  291. {
  292. Left = band.Width - (90F * Units.Millimeters),
  293. Width = 90F * Units.Millimeters,
  294. Height = 5F * Units.Millimeters,
  295. Text = "[CompanyInformation.CompanyName]",
  296. HorzAlign = HorzAlign.Right,
  297. VertAlign = VertAlign.Center,
  298. Font = new System.Drawing.Font("Arial", 12F, FontStyle.Bold)
  299. };
  300. band.AddChild(company);
  301. var address = new TextObject()
  302. {
  303. Left = band.Width - (90F * Units.Millimeters),
  304. Width = 90F * Units.Millimeters,
  305. Height = 15F * Units.Millimeters,
  306. Top = 5F * Units.Millimeters,
  307. Text = "[CompanyInformation.PostalAddress_Street]\n[CompanyInformation.PostalAddress_City] [CompanyInformation.PostalAddress_PostCode]",
  308. HorzAlign = HorzAlign.Right,
  309. VertAlign = VertAlign.Top,
  310. Font = new System.Drawing.Font("Arial", 12F)
  311. };
  312. band.AddChild(address);
  313. var instancetable = model
  314. .GetType()
  315. .GetInterfaces()
  316. .FirstOrDefault(x => x.IsConstructedGenericType && x.GetGenericTypeDefinition() == typeof(IDataModel<>))?
  317. .GetGenericArguments()
  318. .FirstOrDefault()?
  319. .EntityName()
  320. .Split('.')
  321. .Last();
  322. var title = new TextObject()
  323. {
  324. Top = 23F * Units.Millimeters,
  325. Width = band.Width,
  326. Height = 6F * Units.Millimeters,
  327. Text = $"[Form_Data.{instancetable}.Number] - {layout.Form.Description}",
  328. HorzAlign = HorzAlign.Center,
  329. VertAlign = VertAlign.Center,
  330. Font = new System.Drawing.Font("Arial", 14F, FontStyle.Bold)
  331. };
  332. band.AddChild(title);
  333. /*
  334. <TextObject Name="Text2" Left="500.85" Top="28.35" Width="207.9" Height="56.7" Text="16 Madrid Place&#13;&#10;Maddington WA 6109&#13;&#10;Phone: (08) 9492 1200&#13;&#10;Email: admin@com-al.com.au" HorzAlign="Right" Font="Arial, 9pt"/>
  335. <PictureObject Name="Picture1" Left="9.45" Top="9.45" Width="113.4" Height="75.6" DataColumn="CompanyLogo.Data"/>
  336. <TextObject Name="Text1" Left="444.15" Top="9.45" Width="264.6" Height="18.9" Text="Com-Al Windows Pty Ltd" HorzAlign="Right" Font="Arial, 10pt, style=Bold" TextFill.Color="RoyalBlue"/>
  337. <TextObject Name="Text3" Left="9.45" Top="103.95" Width="699.3" Height="28.35" Text="TEST &amp; TAG REPORT: [KanbanForm.Number]" HorzAlign="Center" VertAlign="Center" Font="Arial, 14pt, style=Bold"/>
  338. */
  339. var elementNames = new HashSet<string>();
  340. var table = new TableObject()
  341. {
  342. Name = "FormTable",
  343. ColumnCount = dfLayout.ColumnWidths.Count,
  344. RowCount = dfLayout.RowHeights.Count,
  345. Top = 32F * Units.Millimeters
  346. };
  347. band.AddChild(table);
  348. foreach(var element in dfLayout.Elements)
  349. {
  350. if (element.Row < 1 || element.Row + element.RowSpan - 1 > table.RowCount
  351. || element.Column < 1 || element.Column + element.ColumnSpan - 1 > table.ColumnCount) continue;
  352. var row = table.Rows[element.Row - 1];
  353. if(row.ChildObjects[element.Column - 1] is TableCell cell)
  354. {
  355. cell.Border.Lines = BorderLines.All;
  356. cell.ColSpan = element.ColumnSpan;
  357. cell.RowSpan = element.RowSpan;
  358. if (element is DFLayoutField field)
  359. {
  360. var manualHeight = 0.0f;
  361. cell.Name = ElementName(elementNames, $"Cell_{new string(field.Name.Where(c => IsValidChar(c)).ToArray())}");
  362. var dataColumn = $"Form_Data.{field.Name}";
  363. if(field is DFLayoutEmbeddedImage || field is DFLayoutSignaturePad)
  364. {
  365. var picture = new PictureObject
  366. {
  367. DataColumn = dataColumn,
  368. //Dock = DockStyle.Fill,
  369. //Padding = new Padding(5,5,5,5)
  370. };
  371. //cell.Padding = new Padding(5);
  372. cell.AddChild(picture);
  373. manualHeight = 40;
  374. }
  375. else if(field is DFLayoutMultiImage)
  376. {
  377. var image = new MultiImageObject
  378. {
  379. DataColumn = dataColumn,
  380. //Dock = DockStyle.Fill,
  381. //Padding = new Padding(5,5,5,5)
  382. };
  383. cell.AddChild(image);
  384. manualHeight = 40;
  385. }
  386. else if(field is DFLayoutMultiSignaturePad)
  387. {
  388. var image = new MultiSignatureObject
  389. {
  390. DataColumn = dataColumn,
  391. //Dock = DockStyle.Fill,
  392. //Padding = new Padding(5,5,5,5)
  393. };
  394. cell.AddChild(image);
  395. manualHeight = 40;
  396. }
  397. else
  398. {
  399. cell.Text = $"[{dataColumn}]";
  400. cell.Font = new System.Drawing.Font(cell.Font.FontFamily, 10F, FontStyle.Italic);
  401. cell.TextColor = Color.Navy;
  402. cell.HorzAlign = HorzAlign.Left;
  403. cell.VertAlign = VertAlign.Center;
  404. if (field is DFLayoutStringField lsf)
  405. cell.WordWrap = lsf.Properties.TextWrapping;
  406. }
  407. if(manualHeight > 0 && dfLayout.RowHeights[element.Row - 1] == "Auto")
  408. {
  409. dfLayout.RowHeights[element.Row - 1] = manualHeight.ToString();
  410. }
  411. }
  412. else if (element is DFLayoutLabel label)
  413. {
  414. var background = label.Style.BackgroundColour;
  415. if (background == Color.Empty)
  416. {
  417. label.Style.BackgroundColour = Color.WhiteSmoke;
  418. }
  419. cell.Text = label.Description;
  420. cell.Name = ElementName(elementNames, "Label_" + element.Row + "_" + element.Column);
  421. ApplyStyle(cell, label.Style);
  422. }
  423. else if (element is DFLayoutHeader header)
  424. {
  425. cell.Name = ElementName(elementNames, "Header_" + element.Row + "_" + element.Column);
  426. cell.Text = header.Header;
  427. ApplyStyle(cell, header.Style);
  428. }
  429. }
  430. }
  431. ProcessColumnWidths(band.Width, dfLayout.ColumnWidths, table.Columns);
  432. ProcessRowHeights(band.Height, dfLayout.RowHeights, table.Rows);
  433. return report;
  434. }
  435. private static void ApplyStyle(TableCell cell, DFLayoutTextStyle style)
  436. {
  437. var background = style.BackgroundColour;
  438. if(background != Color.Empty) cell.FillColor = background;
  439. var foreground = style.ForegroundColour;
  440. if (foreground != Color.Empty) cell.TextColor = foreground;
  441. FontStyle fontstyle = System.Drawing.FontStyle.Regular;
  442. if (style.IsBold)
  443. fontstyle |= System.Drawing.FontStyle.Bold;
  444. if (style.IsItalic)
  445. fontstyle |= System.Drawing.FontStyle.Italic;
  446. if (style.Underline != UnderlineType.None)
  447. fontstyle |= FontStyle.Underline;
  448. float fontsize = (float)style.FontSize;
  449. fontsize = fontsize == 0F ? 10F : fontsize;
  450. cell.Font = new System.Drawing.Font(cell.Font.FontFamily, fontsize, fontstyle);
  451. cell.HorzAlign = style.HorizontalTextAlignment switch
  452. {
  453. DFLayoutAlignment.Start => HorzAlign.Left,
  454. DFLayoutAlignment.Middle => HorzAlign.Center,
  455. DFLayoutAlignment.End => HorzAlign.Right,
  456. DFLayoutAlignment.Stretch => HorzAlign.Justify,
  457. _ => HorzAlign.Left
  458. };
  459. cell.VertAlign = style.VerticalTextAlignment switch
  460. {
  461. DFLayoutAlignment.Start => VertAlign.Top,
  462. DFLayoutAlignment.Middle => VertAlign.Center,
  463. DFLayoutAlignment.End => VertAlign.Bottom,
  464. DFLayoutAlignment.Stretch => VertAlign.Center,
  465. _ => VertAlign.Center
  466. };
  467. cell.WordWrap = style.TextWrapping;
  468. }
  469. private static void ProcessRowHeights(float bandheight, List<string> values, TableRowCollection rows)
  470. {
  471. float fixedtotal = 0F;
  472. for (int iFixed = 0; iFixed < values.Count; iFixed++)
  473. {
  474. if (!values[iFixed].Contains("*"))
  475. {
  476. if (!float.TryParse(values[iFixed], out float value))
  477. value = 25F / Units.Millimeters;
  478. else
  479. value = value / (1.5f * Units.Millimeters);
  480. rows[iFixed].Height = Units.Millimeters * value;
  481. fixedtotal += Units.Millimeters * value;
  482. }
  483. }
  484. Dictionary<int, float> starvalues = new Dictionary<int, float>();
  485. float startotal = 0F;
  486. for (int iStar = 0; iStar < values.Count; iStar++)
  487. {
  488. if (values[iStar].Contains('*'))
  489. {
  490. if (!float.TryParse(values[iStar].Replace("*", ""), out float value))
  491. value += 1;
  492. starvalues[iStar] = value;
  493. startotal += value;
  494. }
  495. }
  496. foreach (var key in starvalues.Keys)
  497. rows[key].Height = (starvalues[key] / startotal) * (bandheight - fixedtotal);
  498. }
  499. private static void ProcessColumnWidths(float bandwidth, List<string> values, TableColumnCollection columns)
  500. {
  501. float fixedtotal = 0F;
  502. for (int iFixed = 0; iFixed < values.Count; iFixed++)
  503. {
  504. if (!values[iFixed].Contains("*"))
  505. {
  506. if (!float.TryParse(values[iFixed], out float value))
  507. value = 40F;
  508. columns[iFixed].Width = Units.Millimeters * value;
  509. fixedtotal += Units.Millimeters * value;
  510. }
  511. }
  512. Dictionary<int, float> starvalues = new Dictionary<int, float>();
  513. float startotal = 0F;
  514. for (int iStar = 0; iStar < values.Count; iStar++)
  515. {
  516. if (values[iStar].Contains('*'))
  517. {
  518. if (!float.TryParse(values[iStar].Replace("*", ""), out float value))
  519. value += 1;
  520. starvalues[iStar] = value;
  521. startotal += value;
  522. }
  523. }
  524. foreach (var key in starvalues.Keys)
  525. columns[key].Width = (starvalues[key] / startotal) * (bandwidth - fixedtotal);
  526. }
  527. #endregion
  528. #region Data Model
  529. private static List<Type>? _entityForms;
  530. public static DataModel? GetDataModel(String appliesto, IEnumerable<DigitalFormVariable> variables)
  531. {
  532. _entityForms ??= CoreUtils.Entities
  533. .Where(x => x.IsSubclassOfRawGeneric(typeof(EntityForm<,,>)))
  534. .ToList();
  535. var entityForm = _entityForms
  536. .FirstOrDefault(x => x.GetSuperclassDefinition(typeof(EntityForm<,,>))
  537. ?.GenericTypeArguments[0].Name == appliesto);
  538. if(entityForm is not null)
  539. {
  540. var model = (Activator.CreateInstance(typeof(DigitalFormReportDataModel<>).MakeGenericType(entityForm), Filter.Create(entityForm).None(), null) as DataModel)!;
  541. (model as IDigitalFormReportDataModel)!.Variables = variables.ToArray();
  542. return model;
  543. }
  544. return null;
  545. }
  546. #endregion
  547. }
  548. }