namespace ZB.MOM.WW.OtOpcUa.AdminUI.ScriptAnalysis;
/// Size limits for moving Monaco editor text across the Blazor Server circuit.
///
/// The editor text crosses JS → .NET only on demand (at blur and when a page saves), never per keystroke. Each
/// crossing is ONE SignalR message, bounded by the Blazor hub's MaximumReceiveMessageSize. The framework
/// default is 32 KB, which silently lost any larger script (the oversize invoke failed and Save persisted the
/// stale source), so AddAdminUI raises it to . The editor JS
/// refuses to send a value whose serialized form exceeds — an oversize frame
/// would tear the circuit down — and the save surfaces that refusal to the author instead.
///
public static class ScriptEditorLimits
{
/// The Blazor hub's receive limit, in bytes (1 MB).
public const long HubMaximumReceiveMessageSize = 1024 * 1024;
/// The largest serialized editor value the JS will send, leaving 64 KB of frame headroom.
public const int MaxEditorSyncBytes = (int)HubMaximumReceiveMessageSize - 64 * 1024;
///
/// The most diagnostic markers the editor reports to .NET (for the Problems list) in one circuit message.
/// A non-C# paste produces several Roslyn errors per line; uncapped, a few thousand markers exceed the hub
/// limit and tear the circuit down. The JS sends the first N in display order (errors first) plus the total.
/// Monaco's own in-editor squiggles are local and stay uncapped (up to ).
///
public const int MaxReportedMarkers = 200;
/// Each reported marker's message is truncated to this many characters before it crosses the circuit.
public const int MaxReportedMessageChars = 300;
///
/// The most markers the diagnostics endpoint returns (errors first). Bounds the analysis response and the
/// marker set Monaco renders for pathological input; an error is always kept when one exists, so the
/// editor still rejects exactly what publish rejects.
///
public const int MaxDiagnosticMarkers = 1000;
/// Each diagnostics-endpoint marker message is truncated to this many characters (a Roslyn message
/// can quote an arbitrarily long pasted token).
public const int MaxDiagnosticMessageChars = 1000;
}