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80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========

PlaceObj('XTemplate', {
	group = "ModManager",
	id = "ModManagerModDetails",
	save_in = "Common",
	PlaceObj('XTemplateWindow', {
		'Id', "idContentWrapper",
	}, {
		PlaceObj('XTemplateFunc', {
			'name', "Open",
			'func', function (self, ...)
				if GetUIStyleGamepad() then
					self:SetMinHeight(868)
					self:SetMaxHeight(868)
					self:ResolveId("idScrollAreaWrapper"):SetMaxHeight(755)
				end
				XWindow.Open(self, ...)
			end,
		}),
		PlaceObj('XTemplateWindow', {
			'comment', "content",
			'__context', function (parent, context) return GetDialogModeParam(parent) end,
			'__class', "XContextWindow",
			'Id', "idContent",
			'LayoutMethod', "VList",
			'ContextUpdateOnOpen', true,
			'OnContextUpdate', function (self, context, ...)
				XContextWindow.OnContextUpdate(self, context, ...)
				local spinner = self:ResolveId("idSpinner")
				spinner:SetVisible(not context.details_retrieved)
				if not context.details_retrieved then
					ModsUIRetrieveModDetails(context)
				end
				local obj = GetDialog(self).context
				self:ResolveId("idTitle"):SetText(context.DisplayName or "")
				local current_rating_win = self:ResolveId("idCurrentRating")
				if context.Rating and current_rating_win then
					for i = 1, context.Rating do
						current_rating_win[i]:SetImage("UI/Mods/rate-orange.tga")
					end
					current_rating_win:SetVisible(true)
					local ratings_total = self:ResolveId("idRatingsTotal")
					ratings_total:SetText("(" .. context.RatingsCount .. ")")
					ratings_total:SetVisible(true)
				end
				local mod_id = context.ModID
				if obj.installed_retrieved then
					local uninstalling = g_UninstallingMods[mod_id]
					local installed = obj.installed[mod_id] and not g_DownloadingMods[mod_id]
					if installed then
						local corrupted, warning, warning_id = context.Corrupted, context.Warning, context.Warning_id
						if corrupted == nil then
							local mod_def = obj.mod_defs[mod_id]
							if mod_def then
								corrupted, warning, warning_id = ModsUIGetModCorruptedStatus(mod_def)
								context.Corrupted, context.Warning, context.Warning_id = corrupted, warning, warning_id
							end
						end
						local warning_label = self:ResolveId("idWarning")
						warning_label:SetText(warning or "")
						warning_label:SetVisible((warning or "") ~= "")
						if not corrupted then
							local enabled = obj.enabled[mod_id]
							local status = self:ResolveId("idStatus")
							if status then				
								if status then status:SetVisible(installed) end
								status.idTick:SetVisible(enabled)
								status.idEnabled:SetVisible(enabled)
								status.idDisabled:SetVisible(not enabled)
							end
						end
					end
					local install_button = self:ResolveId("idInstall")
					if install_button then
						install_button:SetVisible(not installed)
						install_button:SetEnabled(not g_DownloadingMods[mod_id])
						self:ResolveId("idRemove"):SetVisible(installed and not uninstalling)
					end
					local spinner = self:ResolveId("idInstallSpinner")
					if spinner then
						spinner:SetVisible(g_DownloadingMods[mod_id] or uninstalling)
					end
				end
			end,
		}, {
			PlaceObj('XTemplateWindow', {
				'comment', "title",
				'__class', "XContextWindow",
				'Dock', "top",
				'LayoutMethod', "HList",
				'LayoutHSpacing', 10,
				'ContextUpdateOnOpen', true,
				'OnContextUpdate', function (self, context, ...)
					local mod_version = context.ModVersion or ""
					if mod_version ~= "" then
						self:ResolveId("idVersionWindow"):SetVisible(true)
						self:ResolveId("idVersion"):SetText("V. " .. mod_version)
					else
						self:ResolveId("idVersionWindow"):SetVisible(false)
					end
					local required_version = context.RequiredVersion
					self:ResolveId("idSuggestedVersionWindow"):SetVisible(required_version and required_version ~= "")
					self:ResolveId("idSuggestedVersion"):SetText(required_version or "")
					local line = self:ResolveId("idGameVersionLine")
					if line then
						line:SetVisible(required_version and required_version ~= "")
					end
				end,
			}, {
				PlaceObj('XTemplateWindow', {
					'__class', "XLabel",
					'Id', "idTitle",
					'VAlign', "center",
					'TextStyle', "GedTitle",
				}),
				PlaceObj('XTemplateWindow', {
					'Id', "idSuggestedVersionWindow",
					'Dock', "right",
					'VAlign', "bottom",
					'LayoutMethod', "VList",
					'Visible', false,
					'FoldWhenHidden', true,
				}, {
					PlaceObj('XTemplateWindow', {
						'__class', "XText",
						'Id', "idSuggestedVersion",
						'VAlign', "center",
						'HandleMouse', false,
						'TextHAlign', "right",
						'TextVAlign', "center",
					}),
					}),
				PlaceObj('XTemplateWindow', {
					'Id', "idVersionWindow",
					'Dock', "right",
					'VAlign', "bottom",
					'LayoutMethod', "VList",
				}, {
					PlaceObj('XTemplateWindow', {
						'__class', "XText",
						'Id', "idVersion",
						'VAlign', "center",
						'HandleMouse', false,
						'TextHAlign', "right",
						'TextVAlign', "center",
					}),
					}),
				}),
			PlaceObj('XTemplateWindow', {
				'comment', "buttons and rating",
				'__class', "XContextWindow",
				'Dock', "top",
				'MinHeight', 50,
				'MaxHeight', 50,
				'LayoutMethod', "HList",
				'LayoutHSpacing', 20,
				'OnContextUpdate', function (self, context, ...)
					self:ResolveId("idFileSizeWindow"):SetVisible(context.FileSize)
					if context.FileSize then
						self:ResolveId("idSize"):SetText(T(10487, "<FormatSize(FileSize, 2)>"))
					end
				end,
			}, {
				PlaceObj('XTemplateWindow', {
					'__class', "XLabel",
					'Id', "idWarning",
					'Padding', box(0, 0, 0, 0),
					'VAlign', "center",
					'Visible', false,
					'FoldWhenHidden', true,
					'Translate', true,
				}),
				PlaceObj('XTemplateTemplate', {
					'__template', "ModManagerLoadingAnim",
					'Id', "idInstallSpinner",
					'Dock', "box",
					'HAlign', "left",
					'VAlign', "center",
					'Visible', false,
					'FoldWhenHidden', true,
				}),
				PlaceObj('XTemplateGroup', {
					'__condition', function (parent, context) return not context.Local end,
				}, {
					PlaceObj('XTemplateWindow', {
						'__class', "XTextButton",
						'Id', "idInstall",
						'LayoutHSpacing', 6,
						'Visible', false,
						'FoldWhenHidden', true,
						'OnPress', function (self, gamepad)
							if not g_ModsBackendObj:IsLoggedIn() then
								local host = GetDialog(self)
								ModsUIOpenLoginPopup(host.idContentWrapper)
							else
								ModsUIInstallMod(self.context)
								self:SetEnabled(false)
							end
						end,
						'Translate', true,
						'Text', T(485037384930, --[[XTemplate ModManagerModDetails Text]] "INSTALL"),
					}, {
						PlaceObj('XTemplateFunc', {
							'name', "SetEnabled(self, enabled)",
							'func', function (self, enabled)
								XTextButton.SetEnabled(self, enabled)
								self:SetDesaturation(enabled and 0 or 255)
							end,
						}),
						}),
					PlaceObj('XTemplateWindow', {
						'__class', "XTextButton",
						'Id', "idRemove",
						'HAlign', "center",
						'VAlign', "center",
						'Visible', false,
						'FoldWhenHidden', true,
						'Background', RGBA(0, 0, 0, 0),
						'FocusedBackground', RGBA(0, 0, 0, 0),
						'OnPress', function (self, gamepad)
							ModsUIUninstallMod(self.context)
						end,
						'RolloverBackground', RGBA(0, 0, 0, 0),
						'PressedBackground', RGBA(0, 0, 0, 0),
						'IconColor', RGBA(125, 125, 125, 255),
					}),
					PlaceObj('XTemplateWindow', {
						'MinWidth', 1,
						'MaxWidth', 1,
						'Visible', false,
						'Background', RGBA(224, 224, 244, 255),
					}),
					}),
				PlaceObj('XTemplateWindow', {
					'Id', "idFileSizeWindow",
					'LayoutMethod', "HList",
					'LayoutHSpacing', 10,
					'Visible', false,
				}, {
					PlaceObj('XTemplateWindow', {
						'__class', "XLabel",
						'Padding', box(0, 0, 0, 0),
						'VAlign', "center",
						'Translate', true,
						'Text', T(721998459687, --[[XTemplate ModManagerModDetails Text]] "SIZE"),
					}),
					PlaceObj('XTemplateWindow', {
						'comment', "file size",
						'__class', "XLabel",
						'Id', "idSize",
						'Padding', box(0, 0, 0, 0),
						'VAlign', "center",
						'Translate', true,
					}),
					}),
				PlaceObj('XTemplateWindow', {
					'Dock', "right",
					'LayoutMethod', "HList",
					'LayoutHSpacing', 20,
					'Visible', false,
				}, {
					PlaceObj('XTemplateWindow', {
						'comment', "current rating",
						'LayoutMethod', "HList",
						'LayoutHSpacing', 10,
					}, {
						PlaceObj('XTemplateWindow', {
							'Id', "idCurrentRating",
							'VAlign', "center",
							'LayoutMethod', "HList",
							'LayoutHSpacing', 4,
							'Visible', false,
							'FoldWhenHidden', true,
						}, {
							PlaceObj('XTemplateForEach', {
								'array', function (parent, context) return nil, 1, 5 end,
							}, {
								PlaceObj('XTemplateWindow', {
									'__class', "XImage",
									'Image', "CommonAssets/UI/Icons/outline star",
									'ImageScale', point(230, 230),
								}),
								}),
							}),
						PlaceObj('XTemplateWindow', {
							'__class', "XLabel",
							'Id', "idRatingsTotal",
							'VAlign', "center",
							'Visible', false,
							'FoldWhenHidden', true,
						}),
						}),
					PlaceObj('XTemplateGroup', {
						'__condition', function (parent, context) return not context.Local end,
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XTextButton",
							'Id', "idRate",
							'HAlign', "center",
							'VAlign', "center",
							'RolloverOnFocus', false,
							'RelativeFocusOrder', "new-line",
							'OnPress', function (self, gamepad)
								local dlg = GetDialog(self)
								if not g_ModsBackendObj:IsLoggedIn() then
									ModsUIOpenLoginPopup(dlg.idContentWrapper)
								else
									ModsUIChooseModRating(dlg.idContentWrapper)
								end
							end,
							'Translate', true,
							'Text', T(449539499567, --[[XTemplate ModManagerModDetails Text]] "RATE"),
						}),
						PlaceObj('XTemplateWindow', {
							'__class', "XTextButton",
							'Id', "idFlag",
							'HAlign', "center",
							'VAlign', "center",
							'RolloverOnFocus', false,
							'RelativeFocusOrder', "new-line",
							'OnPress', function (self, gamepad)
								local dlg = GetDialog(self)
								ModsUIChooseFlagReason(dlg.idContentWrapper)
								dlg:UpdateActionViews(dlg)
							end,
							'Translate', true,
							'Text', T(593867358064, --[[XTemplate ModManagerModDetails Text]] "REPORT"),
						}),
						}),
					}),
				}),
			PlaceObj('XTemplateWindow', {
				'Id', "idScrollAreaWrapper",
			}, {
				PlaceObj('XTemplateWindow', nil, {
					PlaceObj('XTemplateWindow', {
						'__class', "XScrollArea",
						'Id', "idScrollAreaLeft",
						'IdNode', false,
						'MinWidth', 974,
						'MaxWidth', 974,
						'VScroll', "idScrollLeft",
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XContentTemplate",
							'IdNode', false,
							'LayoutMethod', "VList",
							'LayoutVSpacing', 20,
							'OnContextUpdate', function (self, context, ...)
								XContentTemplate.OnContextUpdate(self, context, ...)
								self:SetContentTexts()
							end,
							'RespawnOnDialogMode', false,
						}, {
							PlaceObj('XTemplateFunc', {
								'name', "Open",
								'func', function (self, ...)
									XContentTemplate.Open(self, ...)
									self:SetContentTexts()
								end,
							}),
							PlaceObj('XTemplateFunc', {
								'name', "SetContentTexts",
								'func', function (self, ...)
									local context = self.context
									local description = self:ResolveId("idDescription")
									description:SetText(context.LongDescription or "")
									description:SetVisible(context.LongDescription)
									
									if context.Thumbnail then
										self:ResolveId("idThumbnail"):SetImage(context.Thumbnail)
										local thumb_small = self:ResolveId("idThumbSmall")
										if thumb_small then
											thumb_small:SetImage(context.Thumbnail)
										end
									end
									
									local obj = GetDialog(self).context
									local mod_id = context.ModID
									if obj.installed_retrieved then
										local uninstalling = g_UninstallingMods[mod_id]
										local installed = obj.installed[mod_id] and not g_DownloadingMods[mod_id]
										if installed then
											local corrupted, warning, warning_id = context.Corrupted, context.Warning, context.Warning_id
											if not corrupted then
												local check_button = self:ResolveId("idEnabled")
												if check_button then
													local enabled = obj.enabled[mod_id]
													check_button:SetCheck(enabled)
													check_button:SetVisible(not uninstalling)
													check_button.idEnabled:SetVisible(enabled)
													check_button.idDisabled:SetVisible(not enabled)
												end
											end
										end
									end
								end,
							}),
							PlaceObj('XTemplateWindow', {
								'comment', "enable button & preview",
							}, {
								PlaceObj('XTemplateWindow', {
									'Dock', "left",
									'HAlign', "left",
									'VAlign', "top",
								}, {
									PlaceObj('XTemplateWindow', {
										'__class', "XCheckButton",
										'Id', "idEnabled",
										'HAlign', "center",
										'VAlign', "center",
										'Visible', false,
										'FoldWhenHidden', true,
										'OnPress', function (self, gamepad)
											ModsUIToggleEnabled(self.context, self)
										end,
									}, {
										PlaceObj('XTemplateFunc', {
											'name', "OnChange(self, check)",
											'func', function (self, check)
												self.idEnabled:SetVisible(check)
												self.idDisabled:SetVisible(not check)
											end,
										}),
										PlaceObj('XTemplateWindow', {
											'__class', "XLabel",
											'Id', "idEnabled",
											'Margins', box(20, 0, 0, 0),
											'Padding', box(0, 0, 0, 0),
											'Dock', "right",
											'VAlign', "center",
											'Visible', false,
											'FoldWhenHidden', true,
											'Translate', true,
											'Text', T(142384930906, --[[XTemplate ModManagerModDetails Text]] "Enabled"),
										}),
										PlaceObj('XTemplateWindow', {
											'__class', "XLabel",
											'Id', "idDisabled",
											'Margins', box(20, 0, 0, 0),
											'Padding', box(0, 0, 0, 0),
											'Dock', "right",
											'VAlign', "center",
											'Visible', false,
											'FoldWhenHidden', true,
											'Translate', true,
											'Text', T(513411835000, --[[XTemplate ModManagerModDetails Text]] "Disabled"),
										}),
										}),
									}),
								PlaceObj('XTemplateWindow', {
									'__condition', function (parent, context) return context.Thumbnail or next(context.ScreenshotPaths) end,
									'__class', "XImage",
									'Id', "idThumbnail",
									'HAlign', "center",
									'MinWidth', 885,
									'MinHeight', 440,
									'MaxWidth', 885,
									'MaxHeight', 440,
									'ImageFit', "smallest",
								}, {
									PlaceObj('XTemplateWindow', {
										'comment', "screenshots",
										'__condition', function (parent, context) return #(context.ScreenshotPaths or "") > 0 end,
										'__class', "XList",
										'IdNode', false,
										'Margins', box(0, 0, 0, 20),
										'BorderWidth', 0,
										'Padding', box(0, 0, 0, 0),
										'HAlign', "center",
										'VAlign', "bottom",
										'LayoutMethod', "HList",
										'LayoutHSpacing', 15,
										'Background', RGBA(255, 255, 255, 0),
										'FocusedBackground', RGBA(235, 235, 235, 0),
										'ForceInitialSelection', true,
									}, {
										PlaceObj('XTemplateForEach', {
											'array', function (parent, context) local t = table.icopy(context.ScreenshotPaths); table.insert(t, 1, context.Thumbnail); return t end,
											'run_after', function (child, context, item, i, n, last)
												rawset(child, "image_path", item)
												child:ResolveId("idLabel"):SetText(tostring(i))
											end,
										}, {
											PlaceObj('XTemplateWindow', {
												'__class', "XListItem",
												'BorderColor', RGBA(0, 0, 0, 255),
												'Background', RGBA(255, 255, 255, 255),
												'HandleMouse', true,
											}, {
												PlaceObj('XTemplateFunc', {
													'name', "OnMouseButtonDown(self, pos, button)",
													'func', function (self, pos, button)
														if button == "L" then
															local self_idx = table.find(self.parent, self)
															self.parent:SetSelection(self_idx)
															return "break"
														end
														return XImage.OnMouseButtonDown(self, pos, button)
													end,
												}),
												PlaceObj('XTemplateFunc', {
													'name', "SetSelected(self, selected)",
													'func', function (self, selected)
														if selected then
															local preview = GetParentOfKind(self, "XImage")
															preview:SetImage(self.image_path)
														end
													end,
												}),
												PlaceObj('XTemplateWindow', {
													'__class', "XLabel",
													'Id', "idLabel",
												}),
												}),
											}),
										}),
									}),
								}),
							PlaceObj('XTemplateWindow', {
								'__class', "XText",
								'Id', "idDescription",
							}, {
								PlaceObj('XTemplateFunc', {
									'name', "OnHyperLink(self, hyperlink, argument, hyperlink_box, pos, button)",
									'func', function (self, hyperlink, argument, hyperlink_box, pos, button)
										OpenUrl(argument)
									end,
								}),
								}),
							}),
						}),
					PlaceObj('XTemplateWindow', {
						'__class', "XSleekScroll",
						'Id', "idScrollLeft",
						'Dock', "right",
						'Target', "idScrollAreaLeft",
						'AutoHide', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "idScrollDown",
						'ActionGamepad', "RightThumbDown",
						'OnAction', function (self, host, source, ...)
							local scroll_area = host:ResolveId("idScrollAreaLeft")
							if scroll_area:GetVisible() then
								return scroll_area:OnMouseWheelBack()
							end
						end,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "idScrollUp",
						'ActionGamepad', "RightThumbUp",
						'OnAction', function (self, host, source, ...)
							local scroll_area = host:ResolveId("idScrollAreaLeft")
							if scroll_area:GetVisible() then
								return scroll_area:OnMouseWheelForward()
							end
						end,
					}),
					}),
				PlaceObj('XTemplateWindow', {
					'Margins', box(10, 0, 0, 0),
					'Dock', "right",
					'MinWidth', 350,
					'MaxWidth', 350,
				}, {
					PlaceObj('XTemplateWindow', {
						'__class', "XScrollArea",
						'Id', "idScrollAreaRight",
						'IdNode', false,
						'VScroll', "idScrollRight",
					}, {
						PlaceObj('XTemplateWindow', {
							'__class', "XContentTemplate",
							'IdNode', false,
							'Margins', box(15, 0, 0, 0),
							'LayoutMethod', "VList",
							'LayoutVSpacing', 10,
							'OnContextUpdate', function (self, context, ...)
								XContentTemplate.OnContextUpdate(self, context, ...)
								self:SetContentTexts()
							end,
							'RespawnOnDialogMode', false,
						}, {
							PlaceObj('XTemplateFunc', {
								'name', "Open",
								'func', function (self, ...)
									XContentTemplate.Open(self, ...)
									self:SetContentTexts()
								end,
							}),
							PlaceObj('XTemplateFunc', {
								'name', "SetContentTexts",
								'func', function (self, ...)
									local context = self.context
									
									local author = context.Author or ""
									if author ~= "" then
										self:ResolveId("idAuthor"):SetVisible(true)
										self:ResolveId("idAuthorName"):SetText(context.Author)
									else
										self:ResolveId("idAuthor"):SetVisible(false)
									end
									
									local dependencies = ModsUIGetDependenciesMods(context, "required")
									self:ResolveId("idRequirements"):SetVisible(next(dependencies) or context.RequiredDlcs)
									self:ResolveId("idDlcs"):SetVisible(context.RequiredDlcs)
									self:ResolveId("idMods"):SetVisible(next(dependencies))
									self:ResolveId("idTags"):SetVisible(#(context.Tags or "") > 0)
									
									self:ResolveId("idChangelog"):SetVisible(context.ChangeLog and #context.ChangeLog > 0)
									
									self:ResolveId("idFileSizeWindow"):SetVisible(context.FileSize)
									if context.FileSize then
										self:ResolveId("idSize"):SetText(T(10487, "<FormatSize(FileSize, 2)>"))
									end
								end,
							}),
							PlaceObj('XTemplateWindow', {
								'Id', "idAuthor",
								'LayoutMethod', "VList",
								'LayoutVSpacing', 5,
								'Visible', false,
								'FoldWhenHidden', true,
							}, {
								PlaceObj('XTemplateWindow', {
									'__class', "XLabel",
									'Padding', box(0, 0, 0, 0),
									'VAlign', "center",
									'Translate', true,
									'Text', T(884358339220, --[[XTemplate ModManagerModDetails Text]] "AUTHOR"),
								}),
								PlaceObj('XTemplateWindow', {
									'__class', "XLabel",
									'Id', "idAuthorName",
									'Padding', box(0, 0, 0, 0),
									'VAlign', "center",
								}),
								}),
							PlaceObj('XTemplateWindow', {
								'Id', "idRequirements",
								'LayoutMethod', "VList",
								'FoldWhenHidden', true,
							}, {
								PlaceObj('XTemplateWindow', {
									'comment', "dlcs",
									'Id', "idDlcs",
									'LayoutMethod', "VList",
									'LayoutHSpacing', 5,
									'FoldWhenHidden', true,
								}, {
									PlaceObj('XTemplateWindow', {
										'__class', "XLabel",
										'Translate', true,
										'Text', T(107096151285, --[[XTemplate ModManagerModDetails Text]] "Required DLC"),
									}),
									PlaceObj('XTemplateForEach', {
										'array', function (parent, context) return context.RequiredDlcs end,
										'run_after', function (child, context, item, i, n, last)
											child:SetText(item)
										end,
									}, {
										PlaceObj('XTemplateWindow', {
											'__class', "XText",
											'HandleMouse', false,
										}),
										}),
									}),
								PlaceObj('XTemplateWindow', {
									'comment', "mods",
									'Id', "idMods",
									'LayoutMethod', "VList",
									'LayoutVSpacing', 5,
									'FoldWhenHidden', true,
								}, {
									PlaceObj('XTemplateWindow', {
										'__class', "XLabel",
										'Translate', true,
										'Text', T(417466742687, --[[XTemplate ModManagerModDetails Text]] "Required Mods"),
									}),
									PlaceObj('XTemplateForEach', {
										'array', function (parent, context) return ModsUIGetDependenciesMods(context, "required") end,
										'run_after', function (child, context, item, i, n, last)
											child:SetText(item.title)
											local isLoaded = not item.id or table.find(AccountStorage.LoadMods, item.id) -- no id means not downloaded
											if item.state == "hard" and not isLoaded then
												child:SetTextStyle("ModsUIDetailsColumnItemsRed")
											elseif item.state == "soft" then
												child:SetTextStyle("ModsUIDetailsColumnItemsYellow")
											end
										end,
									}, {
										PlaceObj('XTemplateWindow', {
											'__class', "XText",
											'HandleMouse', false,
										}),
										}),
									}),
								}),
							PlaceObj('XTemplateWindow', {
								'comment', "tags",
								'Id', "idTags",
								'LayoutMethod', "VList",
								'FoldWhenHidden', true,
							}, {
								PlaceObj('XTemplateWindow', {
									'__class', "XLabel",
									'Translate', true,
									'Text', T(939919076028, --[[XTemplate ModManagerModDetails Text]] "TAGS"),
								}),
								PlaceObj('XTemplateForEach', {
									'array', function (parent, context) return context.Tags end,
									'run_after', function (child, context, item, i, n, last)
										child:SetText(item)
									end,
								}, {
									PlaceObj('XTemplateWindow', {
										'__class', "XText",
										'HandleMouse', false,
									}),
									}),
								}),
							PlaceObj('XTemplateWindow', {
								'comment', "changelog",
								'Id', "idChangelog",
								'LayoutMethod', "VList",
							}, {
								PlaceObj('XTemplateWindow', {
									'__class', "XLabel",
									'Translate', true,
									'Text', T(508028372782, --[[XTemplate ModManagerModDetails Text]] "CHANGELOG"),
								}),
								PlaceObj('XTemplateForEach', {
									'array', function (parent, context) return context.ChangeLog end,
									'__context', function (parent, context, item, i, n) return item end,
									'run_after', function (child, context, item, i, n, last)
										child.idReleasedVersion:SetText(T{10488, "v<ModVersion> - Released <Released>", ModVersion = Untranslated(item.ModVersion), Released = Untranslated(item.Released)})
										child.idDetails:SetText(item.Details)
									end,
								}, {
									PlaceObj('XTemplateWindow', {
										'IdNode', true,
										'LayoutMethod', "VList",
									}, {
										PlaceObj('XTemplateWindow', {
											'__class', "XText",
											'Id', "idReleasedVersion",
											'HandleMouse', false,
											'Translate', true,
										}),
										PlaceObj('XTemplateWindow', {
											'__class', "XText",
											'Id', "idDetails",
											'HandleMouse', false,
											'HideOnEmpty', true,
										}),
										}),
									}),
								}),
							}),
						}),
					PlaceObj('XTemplateWindow', {
						'__class', "XSleekScroll",
						'Id', "idScrollRight",
						'Dock', "right",
						'Target', "idScrollAreaRight",
						'AutoHide', true,
					}),
					}),
				}),
			}),
		PlaceObj('XTemplateTemplate', {
			'__template', "ModManagerLoadingAnim",
			'Id', "idSpinner",
			'FoldWhenHidden', true,
		}),
		}),
	PlaceObj('XTemplateAction', {
		'ActionId', "back",
		'ActionName', T(389206740263, --[[XTemplate ModManagerModDetails ActionName]] "BACK"),
		'ActionToolbar', "bottommenu",
		'ActionShortcut', "Escape",
		'ActionState', function (self, host)
			return ModsUIIsPopupShown(host) and "hidden"
		end,
		'OnActionEffect', "back",
		'OnAction', function (self, host, source, ...)
			if ModsUIIsPopupShown(host) then
				ModsUIClosePopup(host)
				return
			end
			XAction.OnAction(self, host, source)
		end,
	}),
	PlaceObj('XTemplateGroup', {
		'__condition', function (parent, context) return GetUIStyleGamepad() end,
	}, {
		PlaceObj('XTemplateAction', {
			'ActionId', "enable",
			'ActionName', T(751047175428, --[[XTemplate ModManagerModDetails ActionName]] "Enable"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "ButtonY",
			'ActionState', function (self, host)
				return ModsUIShowItemAction(host, "enabled", false, host.idContent.context.ModID) or "hidden"
			end,
			'OnAction', function (self, host, source, ...)
				ModsUIToggleEnabled(GetDialogModeParam(host), host)
			end,
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "disable",
			'ActionName', T(121157779258, --[[XTemplate ModManagerModDetails ActionName]] "Disable"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "ButtonY",
			'ActionState', function (self, host)
				return ModsUIShowItemAction(host, "enabled", true, host.idContent.context.ModID) or "hidden"
			end,
			'OnAction', function (self, host, source, ...)
				ModsUIToggleEnabled(GetDialogModeParam(host), host)
			end,
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "install",
			'ActionName', T(643623067322, --[[XTemplate ModManagerModDetails ActionName]] "Install"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "ButtonX",
			'ActionState', function (self, host)
				local mod_id = host.idContent.context.ModID
				if g_DownloadingMods[mod_id] then
					return "disabled"
				end
				return ModsUIShowItemAction(host, "installed", false, mod_id) or "hidden"
			end,
			'OnAction', function (self, host, source, ...)
				if not g_ModsBackendObj:IsLoggedIn() then
					ModsUIOpenLoginPopup(host.idContentWrapper)
				else
					ModsUIInstallMod(GetDialogModeParam(host))
				end
				host:UpdateActionViews(host)
			end,
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "uninstall",
			'ActionName', T(221390800637, --[[XTemplate ModManagerModDetails ActionName]] "Uninstall"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "ButtonX",
			'ActionState', function (self, host)
				return ModsUIShowItemAction(host, "installed", true, host.idContent.context.ModID) or "hidden"
			end,
			'OnAction', function (self, host, source, ...)
				ModsUIUninstallMod(GetDialogModeParam(host))
			end,
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "rate",
			'ActionName', T(157897998461, --[[XTemplate ModManagerModDetails ActionName]] "Rate Mod"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "LeftThumbClick",
			'ActionState', function (self, host)
				local context = GetDialogModeParam(host)
				return (context.Local or ModsUIIsPopupShown(host)) and "hidden"
			end,
			'OnAction', function (self, host, source, ...)
				if not g_ModsBackendObj:IsLoggedIn() then
					ModsUIOpenLoginPopup(host.idContentWrapper)
				else
					ModsUIChooseModRating(host.idContentWrapper)
				end
				host:UpdateActionViews(host)
			end,
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "flag",
			'ActionName', T(644441012576, --[[XTemplate ModManagerModDetails ActionName]] "Report"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "RightThumbClick",
			'ActionState', function (self, host)
				local context = GetDialogModeParam(host)
				return (context.Local or ModsUIIsPopupShown(host)) and "hidden"
			end,
			'OnAction', function (self, host, source, ...)
				ModsUIChooseFlagReason(host.idContentWrapper)
				host:UpdateActionViews(host)
			end,
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "back",
			'ActionName', T(574567507933, --[[XTemplate ModManagerModDetails ActionName]] "Back"),
			'ActionToolbar', "ActionBarRight",
			'ActionShortcut', "Escape",
			'ActionGamepad', "ButtonB",
			'ActionState', function (self, host)
				return not ModsUIIsPopupShown(host) or "hidden"
			end,
			'OnActionEffect', "back",
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "popupflagselect",
			'ActionName', T(958743969041, --[[XTemplate ModManagerModDetails ActionName]] "Select"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "ButtonA",
			'ActionState', function (self, host)
				local popup = ModsUIIsPopupShown(host)
				return popup ~= "flag" and "hidden"
			end,
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "popupflagsubmit",
			'ActionName', T(640607102205, --[[XTemplate ModManagerModDetails ActionName]] "Submit"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "Start",
			'ActionState', function (self, host)
				local popup = ModsUIIsPopupShown(host)
				if popup ~= "flag" then return "hidden" end
				return not host.mode_param.flag_reason and "disabled"
			end,
			'OnAction', function (self, host, source, ...)
				ModsUIFlagMod(host)
				host:UpdateActionViews(host)
			end,
		}),
		PlaceObj('XTemplateAction', {
			'ActionId', "popuprateselect",
			'ActionName', T(958743969041, --[[XTemplate ModManagerModDetails ActionName]] "Select"),
			'ActionToolbar', "ActionBarLeft",
			'ActionGamepad', "ButtonA",
			'ActionState', function (self, host)
				local popup = ModsUIIsPopupShown(host)
				return popup ~= "rate" and "hidden"
			end,
		}),
		}),
})