mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-20 16:58:01 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c52812c09 | ||
|
|
be27fd84b8 | ||
|
|
61ffddf1ec | ||
|
|
6d1ecb7678 | ||
|
|
68f5bb1512 | ||
|
|
aaedf667fe | ||
|
|
7df0b3e6e0 | ||
|
|
1b8ed286e7 | ||
|
|
87bb04e3c0 | ||
|
|
181ba07d2d | ||
|
|
3587f547b5 | ||
|
|
cf17c643a0 | ||
|
|
7843426057 | ||
|
|
4db31fd9cf | ||
|
|
18b2e22725 | ||
|
|
b6169e5bfb |
No files matched your search
@@ -20,6 +20,7 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
var rid = Environment.GetCurrentRid();
|
var rid = Environment.GetCurrentRid();
|
||||||
var cwd = Environment.GetAIStudioDirectory();
|
var cwd = Environment.GetAIStudioDirectory();
|
||||||
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", "wwwroot", "_content");
|
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", "wwwroot", "_content");
|
||||||
|
|
||||||
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
||||||
if (!isMudBlazorDirectoryPresent)
|
if (!isMudBlazorDirectoryPresent)
|
||||||
{
|
{
|
||||||
@@ -28,14 +29,21 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.Join(cwd, "wwwroot", "system"));
|
var destinationPath = Path.Join(cwd, "wwwroot", "system");
|
||||||
|
if(Directory.Exists(destinationPath))
|
||||||
|
Directory.Delete(destinationPath, true);
|
||||||
|
|
||||||
|
Directory.CreateDirectory(destinationPath);
|
||||||
|
|
||||||
var sourcePaths = Directory.EnumerateFiles(contentPath, "*", SearchOption.AllDirectories);
|
var sourcePaths = Directory.EnumerateFiles(contentPath, "*", SearchOption.AllDirectories);
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
foreach(var sourcePath in sourcePaths)
|
foreach(var sourcePath in sourcePaths)
|
||||||
{
|
{
|
||||||
counter++;
|
counter++;
|
||||||
var relativePath = Path.GetRelativePath(cwd, sourcePath);
|
var relativePath = sourcePath
|
||||||
var targetPath = Path.Join(cwd, "wwwroot", relativePath);
|
.Replace(contentPath, "")
|
||||||
|
.TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||||
|
var targetPath = Path.Join(cwd, "wwwroot", "system", relativePath);
|
||||||
var targetDirectory = Path.GetDirectoryName(targetPath);
|
var targetDirectory = Path.GetDirectoryName(targetPath);
|
||||||
if (targetDirectory != null)
|
if (targetDirectory != null)
|
||||||
Directory.CreateDirectory(targetDirectory);
|
Directory.CreateDirectory(targetDirectory);
|
||||||
|
|||||||
@@ -1648,11 +1648,17 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROFILESELECTION::T918741365"] = "You can
|
|||||||
-- Provider
|
-- Provider
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROVIDERSELECTION::T900237532"] = "Provider"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROVIDERSELECTION::T900237532"] = "Provider"
|
||||||
|
|
||||||
-- Use PDF content as input
|
-- Images are not supported yet
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READPDFCONTENT::T2849276709"] = "Use PDF content as input"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T298062956"] = "Images are not supported yet"
|
||||||
|
|
||||||
-- Select PDF file
|
-- Use file content as input
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READPDFCONTENT::T63272795"] = "Select PDF file"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T3499386973"] = "Use file content as input"
|
||||||
|
|
||||||
|
-- Select file to read its content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T354817589"] = "Select file to read its content"
|
||||||
|
|
||||||
|
-- Executables are not allowed
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T4167762413"] = "Executables are not allowed"
|
||||||
|
|
||||||
-- The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.
|
-- The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T1164201762"] = "The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T1164201762"] = "The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used."
|
||||||
@@ -1711,6 +1717,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANE
|
|||||||
-- Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.
|
-- Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T1299550589"] = "Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T1299550589"] = "Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used."
|
||||||
|
|
||||||
|
-- Agent: Text Content Cleaner Options
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T3517268866"] = "Agent: Text Content Cleaner Options"
|
||||||
|
|
||||||
-- No options are preselected
|
-- No options are preselected
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T354528094"] = "No options are preselected"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T354528094"] = "No options are preselected"
|
||||||
|
|
||||||
@@ -4348,6 +4357,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T64689067"] = "This Rust library is use
|
|||||||
-- installed by AI Studio
|
-- installed by AI Studio
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T833849470"] = "installed by AI Studio"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T833849470"] = "installed by AI Studio"
|
||||||
|
|
||||||
|
-- We use this library to be able to read PowerPoint files. This allows us to insert content from slides into prompts and take PowerPoint files into account in RAG processes. We thank Nils Kruthoff for his work on this Rust crate.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T855925638"] = "We use this library to be able to read PowerPoint files. This allows us to insert content from slides into prompts and take PowerPoint files into account in RAG processes. We thank Nils Kruthoff for his work on this Rust crate."
|
||||||
|
|
||||||
-- For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose.
|
-- For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T870640199"] = "For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T870640199"] = "For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose."
|
||||||
|
|
||||||
@@ -5476,6 +5488,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T304
|
|||||||
-- AI source selection with AI retrieval context validation
|
-- AI source selection with AI retrieval context validation
|
||||||
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T3775725978"] = "AI source selection with AI retrieval context validation"
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T3775725978"] = "AI source selection with AI retrieval context validation"
|
||||||
|
|
||||||
|
-- Executable Files
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T2217313358"] = "Executable Files"
|
||||||
|
|
||||||
-- PDF Files
|
-- PDF Files
|
||||||
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T3108466742"] = "PDF Files"
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T3108466742"] = "PDF Files"
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<ReadWebContent @bind-Content="@this.inputLegalDocument" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions && this.SettingsManager.ConfigurationData.LegalCheck.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions && this.SettingsManager.ConfigurationData.LegalCheck.PreselectContentCleanerAgent)"/>
|
<ReadWebContent @bind-Content="@this.inputLegalDocument" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions && this.SettingsManager.ConfigurationData.LegalCheck.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions && this.SettingsManager.ConfigurationData.LegalCheck.PreselectContentCleanerAgent)"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ReadPDFContent @bind-PDFContent="@this.inputLegalDocument"/>
|
<ReadFileContent @bind-FileContent="@this.inputLegalDocument"/>
|
||||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputLegalDocument" Validation="@this.ValidatingLegalDocument" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Legal document")" Variant="Variant.Outlined" Lines="12" AutoGrow="@true" MaxLines="24" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputLegalDocument" Validation="@this.ValidatingLegalDocument" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Legal document")" Variant="Variant.Outlined" Lines="12" AutoGrow="@true" MaxLines="24" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputQuestions" Validation="@this.ValidatingQuestions" AdornmentIcon="@Icons.Material.Filled.QuestionAnswer" Adornment="Adornment.Start" Label="@T("Your questions")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputQuestions" Validation="@this.ValidatingQuestions" AdornmentIcon="@Icons.Material.Filled.QuestionAnswer" Adornment="Adornment.Start" Label="@T("Your questions")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions && this.SettingsManager.ConfigurationData.TextSummarizer.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions && this.SettingsManager.ConfigurationData.TextSummarizer.PreselectContentCleanerAgent)"/>
|
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions && this.SettingsManager.ConfigurationData.TextSummarizer.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions && this.SettingsManager.ConfigurationData.TextSummarizer.PreselectContentCleanerAgent)"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ReadPDFContent @bind-PDFContent="@this.inputText"/>
|
<ReadFileContent @bind-FileContent="@this.inputText"/>
|
||||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
|
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
|
||||||
<EnumSelection T="Complexity" NameFunc="@(complexity => complexity.Name())" @bind-Value="@this.selectedComplexity" Icon="@Icons.Material.Filled.Layers" Label="@T("Target complexity")" AllowOther="@true" @bind-OtherInput="@this.expertInField" OtherValue="Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS" LabelOther="@T("Your expertise")" ValidateOther="@this.ValidateExpertInField" />
|
<EnumSelection T="Complexity" NameFunc="@(complexity => complexity.Name())" @bind-Value="@this.selectedComplexity" Icon="@Icons.Material.Filled.Layers" Label="@T("Target complexity")" AllowOther="@true" @bind-OtherInput="@this.expertInField" OtherValue="Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS" LabelOther="@T("Your expertise")" ValidateOther="@this.ValidateExpertInField" />
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.Translation.PreselectOptions && this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.Translation.PreselectOptions && this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent)"/>
|
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.Translation.PreselectOptions && this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.Translation.PreselectOptions && this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent)"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ReadPDFContent @bind-PDFContent="@this.inputText"/>
|
<ReadFileContent @bind-FileContent="@this.inputText"/>
|
||||||
|
|
||||||
<MudTextSwitch Label="@T("Live translation")" @bind-Value="@this.liveTranslation" LabelOn="@T("Live translation")" LabelOff="@T("No live translation")"/>
|
<MudTextSwitch Label="@T("Live translation")" @bind-Value="@this.liveTranslation" LabelOn="@T("Live translation")" LabelOff="@T("No live translation")"/>
|
||||||
@if (this.liveTranslation)
|
@if (this.liveTranslation)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</CardHeaderAvatar>
|
</CardHeaderAvatar>
|
||||||
<CardHeaderContent>
|
<CardHeaderContent>
|
||||||
<MudText Typo="Typo.body1">
|
<MudText Typo="Typo.body1">
|
||||||
@this.Role.ToName() (@this.Time)
|
@this.Role.ToName() (@this.Time.LocalDateTime)
|
||||||
</MudText>
|
</MudText>
|
||||||
</CardHeaderContent>
|
</CardHeaderContent>
|
||||||
<CardHeaderActions>
|
<CardHeaderActions>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudMarkdown Value="@textContent.Text.RemoveThinkTags().Trim()" OverrideHeaderTypo="@Markdown.OverrideHeaderTypo" CodeBlockTheme="@this.CodeColorPalette"/>
|
<MudMarkdown Value="@textContent.Text.RemoveThinkTags().Trim()" OverrideHeaderTypo="@Markdown.OverrideHeaderTypo" Styling="@this.MarkdownStyling" />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,6 +143,11 @@ public partial class ContentBlockComponent : MSGComponentBase
|
|||||||
|
|
||||||
private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default;
|
private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default;
|
||||||
|
|
||||||
|
private MudMarkdownStyling MarkdownStyling => new()
|
||||||
|
{
|
||||||
|
CodeBlock = { Theme = this.CodeColorPalette },
|
||||||
|
};
|
||||||
|
|
||||||
private async Task RemoveBlock()
|
private async Task RemoveBlock()
|
||||||
{
|
{
|
||||||
if (this.RemoveBlockFunc is null)
|
if (this.RemoveBlockFunc is null)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public partial class Changelog
|
|||||||
|
|
||||||
public static readonly Log[] LOGS =
|
public static readonly Log[] LOGS =
|
||||||
[
|
[
|
||||||
|
new (224, "v0.9.49, build 224 (2025-07-02 12:12 UTC)", "v0.9.49.md"),
|
||||||
new (223, "v0.9.48, build 223 (2025-06-10 13:15 UTC)", "v0.9.48.md"),
|
new (223, "v0.9.48, build 223 (2025-06-10 13:15 UTC)", "v0.9.48.md"),
|
||||||
new (222, "v0.9.47, build 222 (2025-06-02 18:25 UTC)", "v0.9.47.md"),
|
new (222, "v0.9.47, build 222 (2025-06-02 18:25 UTC)", "v0.9.47.md"),
|
||||||
new (221, "v0.9.46, build 221 (2025-06-01 19:19 UTC)", "v0.9.46.md"),
|
new (221, "v0.9.46, build 221 (2025-06-01 19:19 UTC)", "v0.9.46.md"),
|
||||||
|
|||||||
@@ -505,7 +505,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Clear the input field:
|
// Clear the input field:
|
||||||
|
await this.inputField.FocusAsync();
|
||||||
this.userInput = string.Empty;
|
this.userInput = string.Empty;
|
||||||
|
await this.inputField.BlurAsync();
|
||||||
|
|
||||||
// Enable the stream state for the chat component:
|
// Enable the stream state for the chat component:
|
||||||
this.isStreaming = true;
|
this.isStreaming = true;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
@inherits MSGComponentBase
|
@inherits MSGComponentBase
|
||||||
<MudButton StartIcon="@Icons.Material.Filled.Description" OnClick="async () => await this.SelectFile()" Variant="Variant.Filled" Class="mb-3">
|
<MudButton StartIcon="@Icons.Material.Filled.Description" OnClick="async () => await this.SelectFile()" Variant="Variant.Filled" Class="mb-3">
|
||||||
@T("Use PDF content as input")
|
@T("Use file content as input")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using AIStudio.Tools.Rust;
|
||||||
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public partial class ReadFileContent : MSGComponentBase
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public string FileContent { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<string> FileContentChanged { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
|
private async Task SelectFile()
|
||||||
|
{
|
||||||
|
var selectedFile = await this.RustService.SelectFile(T("Select file to read its content"));
|
||||||
|
if (selectedFile.UserCancelled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!File.Exists(selectedFile.SelectedFilePath))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var ext = Path.GetExtension(selectedFile.SelectedFilePath).TrimStart('.');
|
||||||
|
if (Array.Exists(FileTypeFilter.Executables.FilterExtensions, x => x.Equals(ext, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.AppBlocking, T("Executables are not allowed")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.Exists(FileTypeFilter.AllImages.FilterExtensions, x => x.Equals(ext, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
await MessageBus.INSTANCE.SendWarning(new(Icons.Material.Filled.ImageNotSupported, T("Images are not supported yet")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileContent = await this.RustService.ReadArbitraryFileData(selectedFile.SelectedFilePath, int.MaxValue);
|
||||||
|
await this.FileContentChanged.InvokeAsync(fileContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
using AIStudio.Tools.Rust;
|
|
||||||
using AIStudio.Tools.Services;
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
|
|
||||||
namespace AIStudio.Components;
|
|
||||||
|
|
||||||
public partial class ReadPDFContent : MSGComponentBase
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public string PDFContent { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public EventCallback<string> PDFContentChanged { get; set; }
|
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private RustService RustService { get; init; } = null!;
|
|
||||||
|
|
||||||
private async Task SelectFile()
|
|
||||||
{
|
|
||||||
var pdfFile = await this.RustService.SelectFile(T("Select PDF file"), FileTypeFilter.PDF);
|
|
||||||
if (pdfFile.UserCancelled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!File.Exists(pdfFile.SelectedFilePath))
|
|
||||||
return;
|
|
||||||
|
|
||||||
var pdfText = await this.RustService.GetPDFText(pdfFile.SelectedFilePath);
|
|
||||||
await this.PDFContentChanged.InvokeAsync(pdfText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
@inherits SettingsPanelBase
|
@inherits SettingsPanelBase
|
||||||
|
|
||||||
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.TextFields" HeaderText="Agent: Text Content Cleaner Options">
|
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.TextFields" HeaderText="@T("Agent: Text Content Cleaner Options")">
|
||||||
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
<MudText Typo="Typo.body1" Class="mb-3">
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
@T("Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.")
|
@T("Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.")
|
||||||
|
|||||||
@@ -47,14 +47,17 @@ public partial class Workspaces : MSGComponentBase
|
|||||||
// - Those initial tree items cannot have children
|
// - Those initial tree items cannot have children
|
||||||
// - When assigning the tree items to the MudTreeViewItem component, we must set the Value property to the value of the item
|
// - When assigning the tree items to the MudTreeViewItem component, we must set the Value property to the value of the item
|
||||||
//
|
//
|
||||||
await this.LoadTreeItems();
|
// We won't await the loading of the tree items here,
|
||||||
|
// to avoid blocking the UI thread:
|
||||||
|
_ = this.LoadTreeItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private async Task LoadTreeItems()
|
private async Task LoadTreeItems()
|
||||||
{
|
{
|
||||||
var workspacesNode = new TreeItemData<ITreeItem>
|
this.treeItems.Clear();
|
||||||
|
this.treeItems.Add(new TreeItemData<ITreeItem>
|
||||||
{
|
{
|
||||||
Expanded = this.ExpandRootNodes,
|
Expanded = this.ExpandRootNodes,
|
||||||
Expandable = true,
|
Expandable = true,
|
||||||
@@ -68,9 +71,16 @@ public partial class Workspaces : MSGComponentBase
|
|||||||
Path = "root",
|
Path = "root",
|
||||||
Children = await this.LoadWorkspaces(),
|
Children = await this.LoadWorkspaces(),
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
var tempChatNode = new TreeItemData<ITreeItem>
|
this.treeItems.Add(new TreeItemData<ITreeItem>
|
||||||
|
{
|
||||||
|
Expandable = false,
|
||||||
|
Value = new TreeDivider(),
|
||||||
|
});
|
||||||
|
|
||||||
|
await this.InvokeAsync(this.StateHasChanged);
|
||||||
|
this.treeItems.Add(new TreeItemData<ITreeItem>
|
||||||
{
|
{
|
||||||
Expanded = this.ExpandRootNodes,
|
Expanded = this.ExpandRootNodes,
|
||||||
Expandable = true,
|
Expandable = true,
|
||||||
@@ -84,16 +94,9 @@ public partial class Workspaces : MSGComponentBase
|
|||||||
Path = "temp",
|
Path = "temp",
|
||||||
Children = await this.LoadTemporaryChats(),
|
Children = await this.LoadTemporaryChats(),
|
||||||
},
|
},
|
||||||
};
|
|
||||||
|
|
||||||
this.treeItems.Clear();
|
|
||||||
this.treeItems.Add(workspacesNode);
|
|
||||||
this.treeItems.Add(new TreeItemData<ITreeItem>
|
|
||||||
{
|
|
||||||
Expandable = false,
|
|
||||||
Value = new TreeDivider(),
|
|
||||||
});
|
});
|
||||||
this.treeItems.Add(tempChatNode);
|
|
||||||
|
await this.InvokeAsync(this.StateHasChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadTemporaryChats()
|
private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadTemporaryChats()
|
||||||
|
|||||||
@@ -107,6 +107,12 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
|
|||||||
this.dataSecurityPolicy = this.DataSource.SecurityPolicy;
|
this.dataSecurityPolicy = this.DataSource.SecurityPolicy;
|
||||||
this.dataMaxMatches = this.DataSource.MaxMatches;
|
this.dataMaxMatches = this.DataSource.MaxMatches;
|
||||||
|
|
||||||
|
// We cannot load the retrieval processes now, since we have
|
||||||
|
// to load the data first. But while doing so, we can need to
|
||||||
|
// restore the selected retrieval process id. That's why we
|
||||||
|
// assign the selected retrieval id to the default retrieval process:
|
||||||
|
this.dataSelectedRetrievalProcess = this.dataSelectedRetrievalProcess with { Id = this.DataSource.SelectedRetrievalId };
|
||||||
|
|
||||||
if (this.dataAuthMethod is AuthMethod.TOKEN or AuthMethod.USERNAME_PASSWORD)
|
if (this.dataAuthMethod is AuthMethod.TOKEN or AuthMethod.USERNAME_PASSWORD)
|
||||||
{
|
{
|
||||||
// Load the secret:
|
// Load the secret:
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
|
|||||||
// Send a message to start the plugin system:
|
// Send a message to start the plugin system:
|
||||||
await this.MessageBus.SendMessage<bool>(this, Event.STARTUP_PLUGIN_SYSTEM);
|
await this.MessageBus.SendMessage<bool>(this, Event.STARTUP_PLUGIN_SYSTEM);
|
||||||
|
|
||||||
await this.themeProvider.WatchSystemPreference(this.SystemeThemeChanged);
|
await this.themeProvider.WatchSystemDarkModeAsync(this.SystemeThemeChanged);
|
||||||
await this.UpdateThemeConfiguration();
|
await this.UpdateThemeConfiguration();
|
||||||
this.LoadNavItems();
|
this.LoadNavItems();
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
|
|||||||
private async Task UpdateThemeConfiguration()
|
private async Task UpdateThemeConfiguration()
|
||||||
{
|
{
|
||||||
if (this.SettingsManager.ConfigurationData.App.PreferredTheme is Themes.SYSTEM)
|
if (this.SettingsManager.ConfigurationData.App.PreferredTheme is Themes.SYSTEM)
|
||||||
this.useDarkMode = await this.themeProvider.GetSystemPreference();
|
this.useDarkMode = await this.themeProvider.GetSystemDarkModeAsync();
|
||||||
else
|
else
|
||||||
this.useDarkMode = this.SettingsManager.ConfigurationData.App.PreferredTheme == Themes.DARK;
|
this.useDarkMode = this.SettingsManager.ConfigurationData.App.PreferredTheme == Themes.DARK;
|
||||||
|
|
||||||
|
|||||||
@@ -47,12 +47,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.1" />
|
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.3" />
|
||||||
<PackageReference Include="HtmlAgilityPack" Version="1.12.1" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.12.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.6" />
|
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.6" />
|
||||||
<PackageReference Include="MudBlazor" Version="8.6.0" />
|
<PackageReference Include="MudBlazor" Version="8.9.0" />
|
||||||
<PackageReference Include="MudBlazor.Markdown" Version="8.6.0" />
|
<PackageReference Include="MudBlazor.Markdown" Version="8.7.0" />
|
||||||
<PackageReference Include="ReverseMarkdown" Version="4.6.0" />
|
<PackageReference Include="ReverseMarkdown" Version="4.7.0" />
|
||||||
<PackageReference Include="LuaCSharp" Version="0.4.2" />
|
<PackageReference Include="LuaCSharp" Version="0.4.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,7 @@
|
|||||||
<ThirdPartyComponent Name="async-stream" Developer="Carl Lerche, Taiki Endo & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/tokio-rs/async-stream/blob/master/LICENSE" RepositoryUrl="https://github.com/tokio-rs/async-stream" UseCase="@T("This library is used to create asynchronous streams in Rust. It allows us to work with streams of data that can be produced asynchronously, making it easier to handle events or data that arrive over time. We use this, e.g., to stream arbitrary data from the file system to the embedding system.")"/>
|
<ThirdPartyComponent Name="async-stream" Developer="Carl Lerche, Taiki Endo & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/tokio-rs/async-stream/blob/master/LICENSE" RepositoryUrl="https://github.com/tokio-rs/async-stream" UseCase="@T("This library is used to create asynchronous streams in Rust. It allows us to work with streams of data that can be produced asynchronously, making it easier to handle events or data that arrive over time. We use this, e.g., to stream arbitrary data from the file system to the embedding system.")"/>
|
||||||
<ThirdPartyComponent Name="flexi_logger" Developer="emabee & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/emabee/flexi_logger/blob/master/LICENSE-MIT" RepositoryUrl="https://github.com/emabee/flexi_logger" UseCase="@T("This Rust library is used to output the app's messages to the terminal. This is helpful during development and troubleshooting. This feature is initially invisible; when the app is started via the terminal, the messages become visible.")"/>
|
<ThirdPartyComponent Name="flexi_logger" Developer="emabee & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/emabee/flexi_logger/blob/master/LICENSE-MIT" RepositoryUrl="https://github.com/emabee/flexi_logger" UseCase="@T("This Rust library is used to output the app's messages to the terminal. This is helpful during development and troubleshooting. This feature is initially invisible; when the app is started via the terminal, the messages become visible.")"/>
|
||||||
<ThirdPartyComponent Name="rand" Developer="Rust developers & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/rust-random/rand/blob/master/LICENSE-MIT" RepositoryUrl="https://github.com/rust-random/rand" UseCase="@T("We must generate random numbers, e.g., for securing the interprocess communication between the user interface and the runtime. The rand library is great for this purpose.")"/>
|
<ThirdPartyComponent Name="rand" Developer="Rust developers & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/rust-random/rand/blob/master/LICENSE-MIT" RepositoryUrl="https://github.com/rust-random/rand" UseCase="@T("We must generate random numbers, e.g., for securing the interprocess communication between the user interface and the runtime. The rand library is great for this purpose.")"/>
|
||||||
|
<ThirdPartyComponent Name="pptx-to-md" Developer="Nils Kruthoff & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/nilskruthoff/pptx-parser/blob/master/LICENCE-MIT" RepositoryUrl="https://github.com/nilskruthoff/pptx-parser" UseCase="@T("We use this library to be able to read PowerPoint files. This allows us to insert content from slides into prompts and take PowerPoint files into account in RAG processes. We thank Nils Kruthoff for his work on this Rust crate.")"/>
|
||||||
<ThirdPartyComponent Name="base64" Developer="Marshall Pierce, Alice Maz & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/marshallpierce/rust-base64/blob/master/LICENSE-MIT" RepositoryUrl="https://github.com/marshallpierce/rust-base64" UseCase="@T("For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose.")"/>
|
<ThirdPartyComponent Name="base64" Developer="Marshall Pierce, Alice Maz & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/marshallpierce/rust-base64/blob/master/LICENSE-MIT" RepositoryUrl="https://github.com/marshallpierce/rust-base64" UseCase="@T("For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose.")"/>
|
||||||
<ThirdPartyComponent Name="Rust Crypto" Developer="Artyom Pavlov, Tony Arcieri, Brian Warner, Arthur Gautier, Vlad Filippov, Friedel Ziegelmayer, Nicolas Stalder & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/RustCrypto/traits/blob/master/cipher/LICENSE-MIT" RepositoryUrl="https://github.com/RustCrypto" UseCase="@T("When transferring sensitive data between Rust runtime and .NET app, we encrypt the data. We use some libraries from the Rust Crypto project for this purpose: cipher, aes, cbc, pbkdf2, hmac, and sha2. We are thankful for the great work of the Rust Crypto project.")"/>
|
<ThirdPartyComponent Name="Rust Crypto" Developer="Artyom Pavlov, Tony Arcieri, Brian Warner, Arthur Gautier, Vlad Filippov, Friedel Ziegelmayer, Nicolas Stalder & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/RustCrypto/traits/blob/master/cipher/LICENSE-MIT" RepositoryUrl="https://github.com/RustCrypto" UseCase="@T("When transferring sensitive data between Rust runtime and .NET app, we encrypt the data. We use some libraries from the Rust Crypto project for this purpose: cipher, aes, cbc, pbkdf2, hmac, and sha2. We are thankful for the great work of the Rust Crypto project.")"/>
|
||||||
<ThirdPartyComponent Name="rcgen" Developer="RustTLS developers, est31 & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/rustls/rcgen/blob/main/LICENSE" RepositoryUrl="https://github.com/rustls/rcgen" UseCase="@T("For the secure communication between the user interface and the runtime, we need to create certificates. This Rust library is great for this purpose.")"/>
|
<ThirdPartyComponent Name="rcgen" Developer="RustTLS developers, est31 & Open Source Community" LicenseName="MIT" LicenseUrl="https://github.com/rustls/rcgen/blob/main/LICENSE" RepositoryUrl="https://github.com/rustls/rcgen" UseCase="@T("For the secure communication between the user interface and the runtime, we need to create certificates. This Rust library is great for this purpose.")"/>
|
||||||
|
|||||||
@@ -62,11 +62,14 @@ public partial class About : MSGComponentBase
|
|||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
|
||||||
this.osLanguage = await this.RustService.ReadUserLanguage();
|
this.osLanguage = await this.RustService.ReadUserLanguage();
|
||||||
this.logPaths = await this.RustService.GetLogPaths();
|
this.logPaths = await this.RustService.GetLogPaths();
|
||||||
|
|
||||||
await base.OnInitializedAsync();
|
// Determine the Pandoc version may take some time, so we start it here
|
||||||
await this.DeterminePandocVersion();
|
// without waiting for the result:
|
||||||
|
_ = this.DeterminePandocVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -19,10 +19,12 @@ public partial class Home : MSGComponentBase
|
|||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
await this.ReadLastChangeAsync();
|
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
|
|
||||||
this.InitializeAdvantagesItems();
|
this.InitializeAdvantagesItems();
|
||||||
|
|
||||||
|
// Read the last change content asynchronously
|
||||||
|
// without blocking the UI thread:
|
||||||
|
_ = this.ReadLastChangeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeAdvantagesItems()
|
private void InitializeAdvantagesItems()
|
||||||
@@ -61,6 +63,8 @@ public partial class Home : MSGComponentBase
|
|||||||
var latest = Changelog.LOGS.MaxBy(n => n.Build);
|
var latest = Changelog.LOGS.MaxBy(n => n.Build);
|
||||||
using var response = await this.HttpClient.GetAsync($"changelog/{latest.Filename}");
|
using var response = await this.HttpClient.GetAsync($"changelog/{latest.Filename}");
|
||||||
this.LastChangeContent = await response.Content.ReadAsStringAsync();
|
this.LastChangeContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
await this.InvokeAsync(this.StateHasChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string QUICK_START_GUIDE =
|
private const string QUICK_START_GUIDE =
|
||||||
|
|||||||
+26
-11
@@ -1474,7 +1474,7 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONPROVIDERSELECTION::T20906218
|
|||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONPROVIDERSELECTION::T3672477670"] = "App-Standard verwenden"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONPROVIDERSELECTION::T3672477670"] = "App-Standard verwenden"
|
||||||
|
|
||||||
-- Yes, let the AI decide which data sources are needed.
|
-- Yes, let the AI decide which data sources are needed.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::DATASOURCESELECTION::T1031370894"] = "Ja, lassen Sie die KI entscheiden, welche Datenquellen benötigt werden."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::DATASOURCESELECTION::T1031370894"] = "Ja, die KI soll entscheiden, welche Datenquellen benötigt werden."
|
||||||
|
|
||||||
-- Yes, let the AI validate & filter the retrieved data.
|
-- Yes, let the AI validate & filter the retrieved data.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::DATASOURCESELECTION::T1309929755"] = "Ja, die KI soll die abgerufenen Daten überprüfen und filtern."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::DATASOURCESELECTION::T1309929755"] = "Ja, die KI soll die abgerufenen Daten überprüfen und filtern."
|
||||||
@@ -1650,11 +1650,17 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROFILESELECTION::T918741365"] = "Hier k
|
|||||||
-- Provider
|
-- Provider
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROVIDERSELECTION::T900237532"] = "Anbieter"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROVIDERSELECTION::T900237532"] = "Anbieter"
|
||||||
|
|
||||||
-- Use PDF content as input
|
-- Images are not supported yet
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READPDFCONTENT::T2849276709"] = "PDF-Inhalt als Eingabe verwenden"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T298062956"] = "Bilder werden derzeit nicht unterstützt"
|
||||||
|
|
||||||
-- Select PDF file
|
-- Use file content as input
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READPDFCONTENT::T63272795"] = "PDF-Datei auswählen"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T3499386973"] = "Dokumenteninhalt als Eingabe verwenden"
|
||||||
|
|
||||||
|
-- Select file to read its content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T354817589"] = "Datei auswählen, um den Inhalt zu lesen"
|
||||||
|
|
||||||
|
-- Executables are not allowed
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T4167762413"] = "Ausführbare Dateien sind nicht erlaubt"
|
||||||
|
|
||||||
-- The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.
|
-- The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T1164201762"] = "Der Inhalt wird mithilfe eines LLM-Agents bereinigt: Der Hauptinhalt wird extrahiert, Werbung und andere irrelevante Elemente werden nach Möglichkeit entfernt. Relative Links werden nach Möglichkeit in absolute Links umgewandelt, damit sie verwendet werden können."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T1164201762"] = "Der Inhalt wird mithilfe eines LLM-Agents bereinigt: Der Hauptinhalt wird extrahiert, Werbung und andere irrelevante Elemente werden nach Möglichkeit entfernt. Relative Links werden nach Möglichkeit in absolute Links umgewandelt, damit sie verwendet werden können."
|
||||||
@@ -1713,6 +1719,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANE
|
|||||||
-- Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.
|
-- Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T1299550589"] = "Anwendungsfall: Dieser Agent wird verwendet, um Textinhalte zu bereinigen. Er extrahiert den Hauptinhalt, entfernt Werbung und andere irrelevante Elemente und versucht, relative Links in absolute Links umzuwandeln, damit diese verwendet werden können."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T1299550589"] = "Anwendungsfall: Dieser Agent wird verwendet, um Textinhalte zu bereinigen. Er extrahiert den Hauptinhalt, entfernt Werbung und andere irrelevante Elemente und versucht, relative Links in absolute Links umzuwandeln, damit diese verwendet werden können."
|
||||||
|
|
||||||
|
-- Agent: Text Content Cleaner Options
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T3517268866"] = "Agent: Inhaltsbereinigung"
|
||||||
|
|
||||||
-- No options are preselected
|
-- No options are preselected
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T354528094"] = "Keine Optionen sind vorausgewählt"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T354528094"] = "Keine Optionen sind vorausgewählt"
|
||||||
|
|
||||||
@@ -1728,8 +1737,8 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESEL
|
|||||||
-- Use Case: this agent is used to select the appropriate data sources for the current prompt.
|
-- Use Case: this agent is used to select the appropriate data sources for the current prompt.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T2208143316"] = "Anwendungsfall: Dieser Assistent wird verwendet, um die passenden Datenquellen für die aktuelle Eingabe auszuwählen."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T2208143316"] = "Anwendungsfall: Dieser Assistent wird verwendet, um die passenden Datenquellen für die aktuelle Eingabe auszuwählen."
|
||||||
|
|
||||||
-- Agent: Data Source Selection Options
|
-- Agent: Data Source Selection
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T2258031949"] = "Agent: Auswahlmöglichkeiten für Datenquellen"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T2258031949"] = "Agent: Wahl der Datenquellen"
|
||||||
|
|
||||||
-- No options are preselected
|
-- No options are preselected
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T354528094"] = "Keine Optionen sind vorausgewählt"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T354528094"] = "Keine Optionen sind vorausgewählt"
|
||||||
@@ -1773,11 +1782,11 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONT
|
|||||||
-- Options are preselected
|
-- Options are preselected
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T3875604319"] = "Optionen sind vorausgewählt"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T3875604319"] = "Optionen sind vorausgewählt"
|
||||||
|
|
||||||
-- Agent: Retrieval Context Validation Options
|
-- Agent: Retrieval Context Validation
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T928989804"] = "Agent: Optionen zur Überprüfung des Abruf-Kontexts"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T928989804"] = "Agent: Validierung der Abruf-Kontexte"
|
||||||
|
|
||||||
-- No validation is performed
|
-- No validation is performed
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T95175095"] = "Es findet keine Überprüfung statt"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T95175095"] = "Es findet keine Validierung statt"
|
||||||
|
|
||||||
-- Spellchecking is disabled
|
-- Spellchecking is disabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T1059411425"] = "Rechtschreibprüfung ist deaktiviert"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T1059411425"] = "Rechtschreibprüfung ist deaktiviert"
|
||||||
@@ -4212,7 +4221,7 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2173617769"] = "Diese Bibliothek wird
|
|||||||
-- For the secure communication between the user interface and the runtime, we need to create certificates. This Rust library is great for this purpose.
|
-- For the secure communication between the user interface and the runtime, we need to create certificates. This Rust library is great for this purpose.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2174764529"] = "Für die sichere Kommunikation zwischen der Benutzeroberfläche und der Laufzeit müssen wir Zertifikate erstellen. Diese Rust-Bibliothek eignet sich hervorragend dafür."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2174764529"] = "Für die sichere Kommunikation zwischen der Benutzeroberfläche und der Laufzeit müssen wir Zertifikate erstellen. Diese Rust-Bibliothek eignet sich hervorragend dafür."
|
||||||
|
|
||||||
-- AI Studio runs without an enterprise configuration.
|
-- This is a private AI Studio installation. It runs without an enterprise configuration.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2244723851"] = "Dies ist eine private AI Studio-Installation. Es wird keine Konfiguration einer Organisation verwendet."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2244723851"] = "Dies ist eine private AI Studio-Installation. Es wird keine Konfiguration einer Organisation verwendet."
|
||||||
|
|
||||||
-- OK
|
-- OK
|
||||||
@@ -4350,6 +4359,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T64689067"] = "Diese Rust-Bibliothek wi
|
|||||||
-- installed by AI Studio
|
-- installed by AI Studio
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T833849470"] = "installiert von AI Studio"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T833849470"] = "installiert von AI Studio"
|
||||||
|
|
||||||
|
-- We use this library to be able to read PowerPoint files. This allows us to insert content from slides into prompts and take PowerPoint files into account in RAG processes. We thank Nils Kruthoff for his work on this Rust crate.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T855925638"] = "Wir verwenden diese Bibliothek, um PowerPoint-Dateien lesen zu können. So ist es möglich, Inhalte aus Folien in Prompts einzufügen und PowerPoint-Dateien in RAG-Prozessen zu berücksichtigen. Wir danken Nils Kruthoff für seine Arbeit an diesem Rust-Crate."
|
||||||
|
|
||||||
-- For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose.
|
-- For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T870640199"] = "Für einige Datenübertragungen müssen wir die Daten in Base64 kodieren. Diese Rust-Bibliothek eignet sich dafür hervorragend."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T870640199"] = "Für einige Datenübertragungen müssen wir die Daten in Base64 kodieren. Diese Rust-Bibliothek eignet sich dafür hervorragend."
|
||||||
|
|
||||||
@@ -5478,6 +5490,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T304
|
|||||||
-- AI-based data source selection with AI retrieval context validation
|
-- AI-based data source selection with AI retrieval context validation
|
||||||
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T3775725978"] = "KI-basierte Datenquellen-Auswahl mit Validierung des Abrufkontexts"
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T3775725978"] = "KI-basierte Datenquellen-Auswahl mit Validierung des Abrufkontexts"
|
||||||
|
|
||||||
|
-- Executable Files
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T2217313358"] = "Ausführbare Dateien"
|
||||||
|
|
||||||
-- PDF Files
|
-- PDF Files
|
||||||
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T3108466742"] = "PDF-Dateien"
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T3108466742"] = "PDF-Dateien"
|
||||||
|
|
||||||
|
|||||||
+24
-9
@@ -1650,11 +1650,17 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROFILESELECTION::T918741365"] = "You can
|
|||||||
-- Provider
|
-- Provider
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROVIDERSELECTION::T900237532"] = "Provider"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::PROVIDERSELECTION::T900237532"] = "Provider"
|
||||||
|
|
||||||
-- Use PDF content as input
|
-- Images are not supported yet
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READPDFCONTENT::T2849276709"] = "Use PDF content as input"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T298062956"] = "Images are not supported yet"
|
||||||
|
|
||||||
-- Select PDF file
|
-- Use file content as input
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READPDFCONTENT::T63272795"] = "Select PDF file"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T3499386973"] = "Use file content as input"
|
||||||
|
|
||||||
|
-- Select file to read its content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T354817589"] = "Select file to read its content"
|
||||||
|
|
||||||
|
-- Executables are not allowed
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READFILECONTENT::T4167762413"] = "Executables are not allowed"
|
||||||
|
|
||||||
-- The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.
|
-- The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T1164201762"] = "The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T1164201762"] = "The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used."
|
||||||
@@ -1713,6 +1719,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANE
|
|||||||
-- Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.
|
-- Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T1299550589"] = "Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T1299550589"] = "Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used."
|
||||||
|
|
||||||
|
-- Agent: Text Content Cleaner Options
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T3517268866"] = "Agent: Text Content Cleaner"
|
||||||
|
|
||||||
-- No options are preselected
|
-- No options are preselected
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T354528094"] = "No options are preselected"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T354528094"] = "No options are preselected"
|
||||||
|
|
||||||
@@ -1728,8 +1737,8 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESEL
|
|||||||
-- Use Case: this agent is used to select the appropriate data sources for the current prompt.
|
-- Use Case: this agent is used to select the appropriate data sources for the current prompt.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T2208143316"] = "Use Case: this agent is used to select the appropriate data sources for the current prompt."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T2208143316"] = "Use Case: this agent is used to select the appropriate data sources for the current prompt."
|
||||||
|
|
||||||
-- Agent: Data Source Selection Options
|
-- Agent: Data Source Selection
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T2258031949"] = "Agent: Data Source Selection Options"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T2258031949"] = "Agent: Data Source Selection"
|
||||||
|
|
||||||
-- No options are preselected
|
-- No options are preselected
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T354528094"] = "No options are preselected"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTDATASOURCESELECTION::T354528094"] = "No options are preselected"
|
||||||
@@ -1773,8 +1782,8 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONT
|
|||||||
-- Options are preselected
|
-- Options are preselected
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T3875604319"] = "Options are preselected"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T3875604319"] = "Options are preselected"
|
||||||
|
|
||||||
-- Agent: Retrieval Context Validation Options
|
-- Agent: Retrieval Context Validation
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T928989804"] = "Agent: Retrieval Context Validation Options"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T928989804"] = "Agent: Retrieval Context Validation"
|
||||||
|
|
||||||
-- No validation is performed
|
-- No validation is performed
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T95175095"] = "No validation is performed"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTRETRIEVALCONTEXTVALIDATION::T95175095"] = "No validation is performed"
|
||||||
@@ -4212,7 +4221,7 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2173617769"] = "This library is used t
|
|||||||
-- For the secure communication between the user interface and the runtime, we need to create certificates. This Rust library is great for this purpose.
|
-- For the secure communication between the user interface and the runtime, we need to create certificates. This Rust library is great for this purpose.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2174764529"] = "For the secure communication between the user interface and the runtime, we need to create certificates. This Rust library is great for this purpose."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2174764529"] = "For the secure communication between the user interface and the runtime, we need to create certificates. This Rust library is great for this purpose."
|
||||||
|
|
||||||
-- AI Studio runs without an enterprise configuration.
|
-- This is a private AI Studio installation. It runs without an enterprise configuration.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2244723851"] = "This is a private AI Studio installation. It runs without an enterprise configuration."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T2244723851"] = "This is a private AI Studio installation. It runs without an enterprise configuration."
|
||||||
|
|
||||||
-- OK
|
-- OK
|
||||||
@@ -4350,6 +4359,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T64689067"] = "This Rust library is use
|
|||||||
-- installed by AI Studio
|
-- installed by AI Studio
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T833849470"] = "installed by AI Studio"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T833849470"] = "installed by AI Studio"
|
||||||
|
|
||||||
|
-- We use this library to be able to read PowerPoint files. This allows us to insert content from slides into prompts and take PowerPoint files into account in RAG processes. We thank Nils Kruthoff for his work on this Rust crate.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T855925638"] = "We use this library to be able to read PowerPoint files. This allows us to insert content from slides into prompts and take PowerPoint files into account in RAG processes. We thank Nils Kruthoff for his work on this Rust crate."
|
||||||
|
|
||||||
-- For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose.
|
-- For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T870640199"] = "For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::ABOUT::T870640199"] = "For some data transfers, we need to encode the data in base64. This Rust library is great for this purpose."
|
||||||
|
|
||||||
@@ -5478,6 +5490,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T304
|
|||||||
-- AI-based data source selection with AI retrieval context validation
|
-- AI-based data source selection with AI retrieval context validation
|
||||||
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T3775725978"] = "AI-based data source selection with AI retrieval context validation"
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RAG::RAGPROCESSES::AISRCSELWITHRETCTXVAL::T3775725978"] = "AI-based data source selection with AI retrieval context validation"
|
||||||
|
|
||||||
|
-- Executable Files
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T2217313358"] = "Executable Files"
|
||||||
|
|
||||||
-- PDF Files
|
-- PDF Files
|
||||||
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T3108466742"] = "PDF Files"
|
UI_TEXT_CONTENT["AISTUDIO::TOOLS::RUST::FILETYPEFILTER::T3108466742"] = "PDF Files"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
using AIStudio.Provider;
|
using AIStudio.Provider;
|
||||||
@@ -347,4 +348,21 @@ public sealed class SettingsManager
|
|||||||
return ConfidenceLevel.UNKNOWN;
|
return ConfidenceLevel.UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ToSettingName<T>(Expression<Func<T, object>> propertyExpression)
|
||||||
|
{
|
||||||
|
MemberExpression? memberExpr;
|
||||||
|
|
||||||
|
// Handle the case where the expression is a unary expression (e.g., when using Convert):
|
||||||
|
if (propertyExpression.Body is UnaryExpression { NodeType: ExpressionType.Convert } unaryExpr)
|
||||||
|
memberExpr = unaryExpr.Operand as MemberExpression;
|
||||||
|
else
|
||||||
|
memberExpr = propertyExpression.Body as MemberExpression;
|
||||||
|
|
||||||
|
if (memberExpr is null)
|
||||||
|
throw new ArgumentException("Expression must be a property access", nameof(propertyExpression));
|
||||||
|
|
||||||
|
// Return the full name of the property, including the class name:
|
||||||
|
return $"{typeof(T).Name}.{memberExpr.Member.Name}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamDocumentMetadata : ContentStreamSseMetadata;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamImageMetadata: ContentStreamSseMetadata;
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public sealed class ContentStreamMetadataJsonConverter : JsonConverter<ContentStreamSseMetadata>
|
||||||
|
{
|
||||||
|
public override ContentStreamSseMetadata? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
using var jsonDoc = JsonDocument.ParseValue(ref reader);
|
||||||
|
var root = jsonDoc.RootElement;
|
||||||
|
var rawText = root.GetRawText();
|
||||||
|
|
||||||
|
var propertyName = root.EnumerateObject()
|
||||||
|
.Select(p => p.Name)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
return propertyName switch
|
||||||
|
{
|
||||||
|
"Text" => JsonSerializer.Deserialize<ContentStreamTextMetadata?>(rawText, options),
|
||||||
|
"Pdf" => JsonSerializer.Deserialize<ContentStreamPdfMetadata?>(rawText, options),
|
||||||
|
"Spreadsheet" => JsonSerializer.Deserialize<ContentStreamSpreadsheetMetadata?>(rawText, options),
|
||||||
|
"Presentation" => JsonSerializer.Deserialize<ContentStreamPresentationMetadata?>(rawText, options),
|
||||||
|
"Image" => JsonSerializer.Deserialize<ContentStreamImageMetadata?>(rawText, options),
|
||||||
|
"Document" => JsonSerializer.Deserialize<ContentStreamDocumentMetadata?>(rawText, options),
|
||||||
|
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write(Utf8JsonWriter writer, ContentStreamSseMetadata value, JsonSerializerOptions options) => JsonSerializer.Serialize(writer, value, value.GetType(), options);
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamPdfDetails
|
||||||
|
{
|
||||||
|
[JsonPropertyName("page_number")]
|
||||||
|
public int? PageNumber { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamPdfMetadata : ContentStreamSseMetadata
|
||||||
|
{
|
||||||
|
[JsonPropertyName("Pdf")]
|
||||||
|
public ContentStreamPdfDetails? Pdf { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public sealed class ContentStreamPptxImageData
|
||||||
|
{
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public string? Id { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("content")]
|
||||||
|
public string? Content { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("segment")]
|
||||||
|
public int? Segment { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("is_end")]
|
||||||
|
public bool IsEnd { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamPresentationDetails
|
||||||
|
{
|
||||||
|
[JsonPropertyName("slide_number")]
|
||||||
|
public int? SlideNumber { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("image")]
|
||||||
|
public ContentStreamPptxImageData? Image { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamPresentationMetadata : ContentStreamSseMetadata
|
||||||
|
{
|
||||||
|
[JsonPropertyName("Presentation")]
|
||||||
|
public ContentStreamPresentationDetails? Presentation { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamSpreadsheetDetails
|
||||||
|
{
|
||||||
|
[JsonPropertyName("sheet_name")]
|
||||||
|
public string? SheetName { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("row_number")]
|
||||||
|
public int? RowNumber { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamSpreadsheetMetadata : ContentStreamSseMetadata
|
||||||
|
{
|
||||||
|
[JsonPropertyName("Spreadsheet")]
|
||||||
|
public ContentStreamSpreadsheetDetails? Spreadsheet { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public sealed class ContentStreamSseEvent
|
||||||
|
{
|
||||||
|
[JsonPropertyName("content")]
|
||||||
|
public string? Content { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("stream_id")]
|
||||||
|
public string? StreamId { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("metadata")]
|
||||||
|
public ContentStreamSseMetadata? Metadata { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public static class ContentStreamSseHandler
|
||||||
|
{
|
||||||
|
private static readonly ConcurrentDictionary<string, List<ContentStreamPptxImageData>> CHUNKED_IMAGES = new();
|
||||||
|
private static readonly ConcurrentDictionary<string, SlideManager> SLIDE_MANAGERS = new();
|
||||||
|
|
||||||
|
public static string? ProcessEvent(ContentStreamSseEvent? sseEvent, bool extractImages = true)
|
||||||
|
{
|
||||||
|
switch (sseEvent)
|
||||||
|
{
|
||||||
|
case { Content: not null, Metadata: not null }:
|
||||||
|
switch (sseEvent.Metadata)
|
||||||
|
{
|
||||||
|
case ContentStreamTextMetadata:
|
||||||
|
return sseEvent.Content;
|
||||||
|
|
||||||
|
case ContentStreamPdfMetadata pdfMetadata:
|
||||||
|
var pageNumber = pdfMetadata.Pdf?.PageNumber ?? 0;
|
||||||
|
return $"""
|
||||||
|
# Page {pageNumber}
|
||||||
|
{sseEvent.Content}
|
||||||
|
|
||||||
|
""";
|
||||||
|
|
||||||
|
case ContentStreamSpreadsheetMetadata spreadsheetMetadata:
|
||||||
|
var sheetName = spreadsheetMetadata.Spreadsheet?.SheetName;
|
||||||
|
var rowNumber = spreadsheetMetadata.Spreadsheet?.RowNumber;
|
||||||
|
var spreadSheetResult = new StringBuilder();
|
||||||
|
if (rowNumber == 0)
|
||||||
|
{
|
||||||
|
spreadSheetResult.AppendLine();
|
||||||
|
spreadSheetResult.AppendLine($"# {sheetName}");
|
||||||
|
}
|
||||||
|
|
||||||
|
spreadSheetResult.Append(sseEvent.Content);
|
||||||
|
return spreadSheetResult.ToString();
|
||||||
|
|
||||||
|
case ContentStreamDocumentMetadata:
|
||||||
|
case ContentStreamImageMetadata:
|
||||||
|
return sseEvent.Content;
|
||||||
|
|
||||||
|
case ContentStreamPresentationMetadata presentationMetadata:
|
||||||
|
var slideManager = SLIDE_MANAGERS.GetOrAdd(
|
||||||
|
sseEvent.StreamId!,
|
||||||
|
_ => new()
|
||||||
|
);
|
||||||
|
|
||||||
|
slideManager.AddSlide(presentationMetadata, sseEvent.Content, extractImages);
|
||||||
|
return null;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return sseEvent.Content;
|
||||||
|
}
|
||||||
|
|
||||||
|
case { Content: not null, Metadata: null }:
|
||||||
|
return sseEvent.Content;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool ProcessImageSegment(string imageId, ContentStreamPptxImageData contentStreamPptxImageData)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(contentStreamPptxImageData.Id) || string.IsNullOrWhiteSpace(imageId))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var segment = contentStreamPptxImageData.Segment ?? 0;
|
||||||
|
var content = contentStreamPptxImageData.Content ?? string.Empty;
|
||||||
|
var isEnd = contentStreamPptxImageData.IsEnd;
|
||||||
|
|
||||||
|
var imageSegment = new ContentStreamPptxImageData
|
||||||
|
{
|
||||||
|
Id = imageId,
|
||||||
|
Content = content,
|
||||||
|
Segment = segment,
|
||||||
|
IsEnd = isEnd,
|
||||||
|
};
|
||||||
|
|
||||||
|
CHUNKED_IMAGES.AddOrUpdate(
|
||||||
|
imageId,
|
||||||
|
_ => [imageSegment],
|
||||||
|
(_, existingList) =>
|
||||||
|
{
|
||||||
|
existingList.Add(imageSegment);
|
||||||
|
return existingList;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return isEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string BuildImage(string id)
|
||||||
|
{
|
||||||
|
if (!CHUNKED_IMAGES.TryGetValue(id, out var imageSegments))
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
var sortedSegments = imageSegments
|
||||||
|
.OrderBy(item => item.Segment)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var base64Image = string.Join(string.Empty, sortedSegments
|
||||||
|
.Where(item => item.Content != null)
|
||||||
|
.Select(item => item.Content));
|
||||||
|
|
||||||
|
CHUNKED_IMAGES.Remove(id, out _);
|
||||||
|
return base64Image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string? Clear(string streamId)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(streamId))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var finalContentChunk = new StringBuilder();
|
||||||
|
if(SLIDE_MANAGERS.TryGetValue(streamId, out var slideManager))
|
||||||
|
{
|
||||||
|
var result = slideManager.GetAllSlidesInOrder();
|
||||||
|
if (!string.IsNullOrWhiteSpace(result))
|
||||||
|
finalContentChunk.Append(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
SLIDE_MANAGERS.TryRemove(streamId, out _);
|
||||||
|
var imageIdPrefix = $"{streamId}-";
|
||||||
|
foreach (var key in CHUNKED_IMAGES.Keys.Where(k => k.StartsWith(imageIdPrefix, StringComparison.InvariantCultureIgnoreCase)))
|
||||||
|
CHUNKED_IMAGES.TryRemove(key, out _);
|
||||||
|
|
||||||
|
return finalContentChunk.Length > 0 ? finalContentChunk.ToString() : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
[JsonConverter(typeof(ContentStreamMetadataJsonConverter))]
|
||||||
|
public abstract class ContentStreamSseMetadata;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamTextDetails
|
||||||
|
{
|
||||||
|
[JsonPropertyName("line_number")]
|
||||||
|
public int? LineNumber { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
public sealed class ContentStreamTextMetadata : ContentStreamSseMetadata
|
||||||
|
{
|
||||||
|
[JsonPropertyName("Text")]
|
||||||
|
public ContentStreamTextDetails? Text { get; init; }
|
||||||
|
}
|
||||||
@@ -4,5 +4,5 @@ namespace AIStudio.Tools;
|
|||||||
|
|
||||||
public readonly record struct EnterpriseEnvironment(string ConfigurationServerUrl, Guid ConfigurationId, EntityTagHeaderValue? ETag)
|
public readonly record struct EnterpriseEnvironment(string ConfigurationServerUrl, Guid ConfigurationId, EntityTagHeaderValue? ETag)
|
||||||
{
|
{
|
||||||
public bool IsActive => !string.IsNullOrEmpty(this.ConfigurationServerUrl) && this.ConfigurationId != Guid.Empty;
|
public bool IsActive => !string.IsNullOrWhiteSpace(this.ConfigurationServerUrl) && this.ConfigurationId != Guid.Empty;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public interface ISlideContent;
|
||||||
@@ -48,7 +48,7 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsTable.TryGetValue("DataApp.UpdateBehavior", out var updateBehaviorValue) && updateBehaviorValue.TryRead<string>(out var updateBehaviorText) && Enum.TryParse<UpdateBehavior>(updateBehaviorText, true, out var updateBehavior))
|
if (settingsTable.TryGetValue(SettingsManager.ToSettingName<DataApp>(x => x.UpdateBehavior), out var updateBehaviorValue) && updateBehaviorValue.TryRead<string>(out var updateBehaviorText) && Enum.TryParse<UpdateBehavior>(updateBehaviorText, true, out var updateBehavior))
|
||||||
{
|
{
|
||||||
SETTINGS_LOCKER.Register<DataApp>(x => x.UpdateBehavior, this.Id);
|
SETTINGS_LOCKER.Register<DataApp>(x => x.UpdateBehavior, this.Id);
|
||||||
SETTINGS_MANAGER.ConfigurationData.App.UpdateBehavior = updateBehavior;
|
SETTINGS_MANAGER.ConfigurationData.App.UpdateBehavior = updateBehavior;
|
||||||
|
|||||||
@@ -20,4 +20,6 @@ public readonly record struct FileTypeFilter(string FilterName, string[] FilterE
|
|||||||
public static FileTypeFilter AllOffice => new(TB("All Office Files"), ["docx", "xlsx", "pptx", "doc", "xls", "ppt", "pdf"]);
|
public static FileTypeFilter AllOffice => new(TB("All Office Files"), ["docx", "xlsx", "pptx", "doc", "xls", "ppt", "pdf"]);
|
||||||
|
|
||||||
public static FileTypeFilter AllImages => new(TB("All Image Files"), ["jpg", "jpeg", "png", "gif", "bmp", "tiff"]);
|
public static FileTypeFilter AllImages => new(TB("All Image Files"), ["jpg", "jpeg", "png", "gif", "bmp", "tiff"]);
|
||||||
|
|
||||||
|
public static FileTypeFilter Executables => new(TB("Executable Files"), ["exe", "app", "bin", "appimage"]);
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ public sealed class EnterpriseEnvironmentService(ILogger<EnterpriseEnvironmentSe
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.LogInformation("Starting update of the enterprise environment.");
|
logger.LogInformation("Start updating of the enterprise environment.");
|
||||||
|
|
||||||
var enterpriseRemoveConfigId = await rustService.EnterpriseEnvRemoveConfigId();
|
var enterpriseRemoveConfigId = await rustService.EnterpriseEnvRemoveConfigId();
|
||||||
var isPlugin2RemoveInUse = PluginFactory.AvailablePlugins.Any(plugin => plugin.Id == enterpriseRemoveConfigId);
|
var isPlugin2RemoveInUse = PluginFactory.AvailablePlugins.Any(plugin => plugin.Id == enterpriseRemoveConfigId);
|
||||||
|
|||||||
@@ -1,16 +1,68 @@
|
|||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace AIStudio.Tools.Services;
|
namespace AIStudio.Tools.Services;
|
||||||
|
|
||||||
public sealed partial class RustService
|
public sealed partial class RustService
|
||||||
{
|
{
|
||||||
public async Task<string> GetPDFText(string filePath)
|
public async Task<string> ReadArbitraryFileData(string path, int maxChunks, bool extractImages = false)
|
||||||
{
|
{
|
||||||
var response = await this.http.GetAsync($"/retrieval/fs/read/pdf?file_path={filePath}");
|
var streamId = Guid.NewGuid().ToString();
|
||||||
|
var requestUri = $"/retrieval/fs/extract?path={Uri.EscapeDataString(path)}&stream_id={streamId}&extract_images={extractImages}";
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
|
||||||
|
var response = await this.http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
|
||||||
this.logger!.LogError($"Failed to read the PDF file due to an network error: '{response.StatusCode}'");
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
||||||
|
var resultBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await using var stream = await response.Content.ReadAsStreamAsync();
|
||||||
|
using var reader = new StreamReader(stream);
|
||||||
|
var chunkCount = 0;
|
||||||
|
|
||||||
|
while (!reader.EndOfStream && chunkCount < maxChunks)
|
||||||
|
{
|
||||||
|
var line = await reader.ReadLineAsync();
|
||||||
|
if (string.IsNullOrWhiteSpace(line))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!line.StartsWith("data:", StringComparison.InvariantCulture))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var jsonContent = line[5..];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sseEvent = JsonSerializer.Deserialize<ContentStreamSseEvent>(jsonContent);
|
||||||
|
if (sseEvent is not null)
|
||||||
|
{
|
||||||
|
var content = ContentStreamSseHandler.ProcessEvent(sseEvent, extractImages);
|
||||||
|
if (content is not null)
|
||||||
|
resultBuilder.AppendLine(content);
|
||||||
|
|
||||||
|
chunkCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
this.logger?.LogError("Failed to deserialize SSE event: {JsonContent}", jsonContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
this.logger?.LogError(e, "Error reading file data from stream: {Path}", path);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
var finalContentChunk = ContentStreamSseHandler.Clear(streamId);
|
||||||
|
if (!string.IsNullOrWhiteSpace(finalContentChunk))
|
||||||
|
resultBuilder.AppendLine(finalContentChunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await response.Content.ReadAsStringAsync();
|
return resultBuilder.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public sealed class Slide
|
||||||
|
{
|
||||||
|
public bool Delivered { get; set; }
|
||||||
|
|
||||||
|
public int Position { get; init; }
|
||||||
|
|
||||||
|
public List<ISlideContent> Content { get; } = new();
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public sealed class SlideImageContent(string base64Image) : ISlideContent
|
||||||
|
{
|
||||||
|
public StringBuilder Base64Image => new(base64Image);
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public sealed class SlideManager
|
||||||
|
{
|
||||||
|
private readonly Dictionary<int, Slide> slides = new();
|
||||||
|
|
||||||
|
public void AddSlide(ContentStreamPresentationMetadata metadata, string? content, bool extractImages = false)
|
||||||
|
{
|
||||||
|
var slideNumber = metadata.Presentation?.SlideNumber ?? 0;
|
||||||
|
if(slideNumber is 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var image = metadata.Presentation?.Image ?? null;
|
||||||
|
var addImage = false;
|
||||||
|
if (extractImages && image is not null)
|
||||||
|
{
|
||||||
|
var isEnd = ContentStreamSseHandler.ProcessImageSegment(image.Id!, image);
|
||||||
|
if (isEnd)
|
||||||
|
addImage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.slides.TryGetValue(slideNumber, out var slide))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Case: No existing slide content for this slide number.
|
||||||
|
//
|
||||||
|
|
||||||
|
var contentBuilder = new StringBuilder();
|
||||||
|
contentBuilder.AppendLine();
|
||||||
|
contentBuilder.AppendLine($"# Slide {slideNumber}");
|
||||||
|
|
||||||
|
// Add any text content to the slide?
|
||||||
|
if(!string.IsNullOrWhiteSpace(content))
|
||||||
|
contentBuilder.AppendLine(content);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add the text content to the slide:
|
||||||
|
//
|
||||||
|
var slideText = new SlideTextContent(contentBuilder.ToString());
|
||||||
|
var createdSlide = new Slide
|
||||||
|
{
|
||||||
|
Delivered = false,
|
||||||
|
Position = slideNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
createdSlide.Content.Add(slideText);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add image content to the slide?
|
||||||
|
//
|
||||||
|
if (addImage)
|
||||||
|
{
|
||||||
|
var img = ContentStreamSseHandler.BuildImage(image!.Id!);
|
||||||
|
var slideImage = new SlideImageContent(img);
|
||||||
|
createdSlide.Content.Add(slideImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.slides[slideNumber] = createdSlide;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Case: Existing slide content for this slide number.
|
||||||
|
//
|
||||||
|
|
||||||
|
// Add any text content?
|
||||||
|
if (!string.IsNullOrWhiteSpace(content))
|
||||||
|
{
|
||||||
|
var textContent = slide.Content.OfType<SlideTextContent>().First();
|
||||||
|
textContent.Text.AppendLine(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add any image content?
|
||||||
|
if (addImage)
|
||||||
|
{
|
||||||
|
var img = ContentStreamSseHandler.BuildImage(image!.Id!);
|
||||||
|
var slideImage = new SlideImageContent(img);
|
||||||
|
slide.Content.Add(slideImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string? GetAllSlidesInOrder()
|
||||||
|
{
|
||||||
|
var content = new StringBuilder();
|
||||||
|
foreach (var slide in this.slides.Values.Where(s => !s.Delivered).OrderBy(s => s.Position))
|
||||||
|
{
|
||||||
|
slide.Delivered = true;
|
||||||
|
foreach (var text in slide.Content.OfType<SlideTextContent>())
|
||||||
|
{
|
||||||
|
content.AppendLine(text.Text.ToString());
|
||||||
|
content.AppendLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var image in slide.Content.OfType<SlideImageContent>())
|
||||||
|
{
|
||||||
|
content.AppendLine(image.Base64Image.ToString());
|
||||||
|
content.AppendLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return content.Length > 0 ? content.ToString() : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public sealed class SlideTextContent(string textContent) : ISlideContent
|
||||||
|
{
|
||||||
|
public StringBuilder Text => new(textContent);
|
||||||
|
}
|
||||||
@@ -4,14 +4,14 @@
|
|||||||
"net9.0": {
|
"net9.0": {
|
||||||
"CodeBeam.MudBlazor.Extensions": {
|
"CodeBeam.MudBlazor.Extensions": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[8.2.1, )",
|
"requested": "[8.2.3, )",
|
||||||
"resolved": "8.2.1",
|
"resolved": "8.2.3",
|
||||||
"contentHash": "qPCjpk6vSsjJUt3Kc0J0RLC3aZDYgaE+wDEfvDdWQHh4CtatWF8wr/jfG6q3EwP0V91nr03cW+KCCKZ5JMEnTg==",
|
"contentHash": "mwZSZY8kHL7SqNOZEfXcTAQso2UFTVt7ZQPMXPFNf07vhliunu3U8n+Mp60NQ7lPurdNuTAsfXmj1FXBoxzpPg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"BuildBundlerMinifier": "3.2.449",
|
"BuildBundlerMinifier": "3.2.449",
|
||||||
"CsvHelper": "33.0.1",
|
"CsvHelper": "33.0.1",
|
||||||
"Microsoft.AspNetCore.Components": "9.0.5",
|
"Microsoft.AspNetCore.Components": "9.0.6",
|
||||||
"Microsoft.AspNetCore.Components.Web": "9.0.5",
|
"Microsoft.AspNetCore.Components.Web": "9.0.6",
|
||||||
"MudBlazor": "8.0.0",
|
"MudBlazor": "8.0.0",
|
||||||
"ZXing.Net": "0.16.9"
|
"ZXing.Net": "0.16.9"
|
||||||
}
|
}
|
||||||
@@ -45,9 +45,9 @@
|
|||||||
},
|
},
|
||||||
"MudBlazor": {
|
"MudBlazor": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[8.6.0, )",
|
"requested": "[8.9.0, )",
|
||||||
"resolved": "8.6.0",
|
"resolved": "8.9.0",
|
||||||
"contentHash": "vJROmWdTjiBmyiZBSbD8RcYVFfLbNMEQpKoCOMfY2628KbOLGVcnH1RBziHGyJH9pqc99UoCQS81XLm8X+49ug==",
|
"contentHash": "KdjXMXiSvl6uNr+S2YDhGI1aX/TULMQejQSniMlp6QTss35NKFrJyrMAmN082HNvOObuKdnTtLpntJ7rM5Op/A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNetCore.Components": "9.0.1",
|
"Microsoft.AspNetCore.Components": "9.0.1",
|
||||||
"Microsoft.AspNetCore.Components.Web": "9.0.1",
|
"Microsoft.AspNetCore.Components.Web": "9.0.1",
|
||||||
@@ -56,22 +56,21 @@
|
|||||||
},
|
},
|
||||||
"MudBlazor.Markdown": {
|
"MudBlazor.Markdown": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[8.6.0, )",
|
"requested": "[8.7.0, )",
|
||||||
"resolved": "8.6.0",
|
"resolved": "8.7.0",
|
||||||
"contentHash": "TIrR6QqXXBmHRx/L66Jxl9UlVtom8jK46iVpPkTi8C7TjsUUylI5zBzmKPiVYp8bKDhgLzOcQH0o01xuHlKJEw==",
|
"contentHash": "sPzha7UGVcguFR0wxDfMZ5ImqL5prxNnD4rxB25UHK1zxdeQKhwsA5XG6nFPrh8qHArT9IXMGe4sOogQnXfWGA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Markdig": "0.41.1",
|
"Markdig": "0.41.2",
|
||||||
"Microsoft.Extensions.Caching.Memory": "9.0.4",
|
"MudBlazor": "8.7.0"
|
||||||
"MudBlazor": "8.6.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ReverseMarkdown": {
|
"ReverseMarkdown": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[4.6.0, )",
|
"requested": "[4.7.0, )",
|
||||||
"resolved": "4.6.0",
|
"resolved": "4.7.0",
|
||||||
"contentHash": "ehNpMz3yQwd7P/vHpwi4KyDlT8UtVmtiL+NTb6mFEPzbLqJXbRIGF4OxEA5tuBA5Cfwhzf537TX1UIB6dUpo7A==",
|
"contentHash": "RM5i+RoCG+9Vc897SyjGe2qQ6FRYitU+JFjc4ZAQWQCN/8R1uOSO4B8DdAtBEtRhJcZfIEIqshe2MoLDChyExw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"HtmlAgilityPack": "1.11.61"
|
"HtmlAgilityPack": "1.12.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"BuildBundlerMinifier": {
|
"BuildBundlerMinifier": {
|
||||||
@@ -86,90 +85,70 @@
|
|||||||
},
|
},
|
||||||
"Markdig": {
|
"Markdig": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "0.41.1",
|
"resolved": "0.41.2",
|
||||||
"contentHash": "e9QXUg2agxd9iWV3hO5fA4Qp2avMuXFiElatzD8hp69yIEgESrdhKvDFf9y9NOlPe9jO7AA6W1JAnntLmqwRwA=="
|
"contentHash": "Fp6YZqOVs60rgDGAUm81K/HYt4yVgpmMpGc7PcLV9nnpbkZLSxsU8/cnpR8U0XM6BOcDiVYLg3HkAanUVR0Erw=="
|
||||||
},
|
},
|
||||||
"Microsoft.AspNetCore.Authorization": {
|
"Microsoft.AspNetCore.Authorization": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "HPd+7PG+nMZSP13bTJuM5+q0vdzoBtjoBUMP9iuUGwG/kFHkeBOZ9QrZuSHHGmz/IgYdLbqbdJGEykSI5biIPw==",
|
"contentHash": "FG/fHZAg2J9NKt+y2BH+fMjc+TqA7wlri/3PNtoSgvclMlr5iPshDLXHQgvS9l7IUzzfkqQ3/DWPYuA4OJu75A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNetCore.Metadata": "9.0.5",
|
"Microsoft.AspNetCore.Metadata": "9.0.6",
|
||||||
"Microsoft.Extensions.Logging.Abstractions": "9.0.5",
|
"Microsoft.Extensions.Logging.Abstractions": "9.0.6",
|
||||||
"Microsoft.Extensions.Options": "9.0.5"
|
"Microsoft.Extensions.Options": "9.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Microsoft.AspNetCore.Components": {
|
"Microsoft.AspNetCore.Components": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "qwA9bx7nWayh1ogWe1H13vyGL64pNjHrukHmnZ9WZbQPtHeY9QTuXkvF/Uue0tzGbxChBf9v2LH5+KeVaRJIqw==",
|
"contentHash": "4WzUBnpxqm0Gvv3XX47h5g09LN4dtQpJjYW2LAfoaVeho5TLM00uDj2YHzjxQwcRTdrG7tZDCyf4V4wwRpjGcA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNetCore.Authorization": "9.0.5",
|
"Microsoft.AspNetCore.Authorization": "9.0.6",
|
||||||
"Microsoft.AspNetCore.Components.Analyzers": "9.0.5"
|
"Microsoft.AspNetCore.Components.Analyzers": "9.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Microsoft.AspNetCore.Components.Analyzers": {
|
"Microsoft.AspNetCore.Components.Analyzers": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "u9dQP0/bjkTVHFHVBV+8TYpBVerjbFfvD3nwwOfaoJ8VmyCHoBFbD8m4nxV+rfu+jVLe2FQF4skjHZLIjjFbyQ=="
|
"contentHash": "UXMjbezwMMoL21L20OB1BLGF9M1BFPzdWiezaiZSBG55z36BEXvs8hetKw7PiuytOdUqWFI1wkPd3MD9jpeKAw=="
|
||||||
},
|
},
|
||||||
"Microsoft.AspNetCore.Components.Forms": {
|
"Microsoft.AspNetCore.Components.Forms": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "KsAPGDQIa3SpP9yaIDrlETHpqprtmbbotdbGfGJ9aVvn/vi72cCTUVzpWOXIXgstVCb0ZQ940o/wfHKxBZEQMg==",
|
"contentHash": "GHdFdrU+9ePkuE7S2g7iu+Lg8FPBY9qGaK+FPSBHNx8ulEdrOHJhufb1FZH/m++NoJgcikOzJ14+eL96HfBr8g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNetCore.Components": "9.0.5"
|
"Microsoft.AspNetCore.Components": "9.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Microsoft.AspNetCore.Components.Web": {
|
"Microsoft.AspNetCore.Components.Web": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "llh2dh9rR9JcnAMqvbijc9BzEnVhloQwKF8Kvfw73N2tJMnUJoxF3C9Ln1sao+nkZo3IpUuUu3k2czLOpS3NRQ==",
|
"contentHash": "c+2B1DdgAOKXt+mMcZgeQPbdoW0Ro+783m+yPK/QQHhjV8cbkPBWXg6OMJC2Vzum5tfAC3coNhlmcLUUBwc3ZQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNetCore.Components": "9.0.5",
|
"Microsoft.AspNetCore.Components": "9.0.6",
|
||||||
"Microsoft.AspNetCore.Components.Forms": "9.0.5",
|
"Microsoft.AspNetCore.Components.Forms": "9.0.6",
|
||||||
"Microsoft.Extensions.DependencyInjection": "9.0.5",
|
"Microsoft.Extensions.DependencyInjection": "9.0.6",
|
||||||
"Microsoft.Extensions.Primitives": "9.0.5",
|
"Microsoft.Extensions.Primitives": "9.0.6",
|
||||||
"Microsoft.JSInterop": "9.0.5"
|
"Microsoft.JSInterop": "9.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Microsoft.AspNetCore.Metadata": {
|
"Microsoft.AspNetCore.Metadata": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "E4lbYlraZfZLvWgliUEtrqKt42++Yh9mpGKLyGHPGo1FpbZrXF/x+fOg5dbe22bnuosgWn3cj30566XKdwiodw=="
|
"contentHash": "SZAmFKGsQPP/xyDir96J5UNTAdCsfeCpPwFO9EewIcgQ8gUr3KHmn4CTC2HmHIDdiTujGC2T3VBcSxmrY+3n/g=="
|
||||||
},
|
|
||||||
"Microsoft.Extensions.Caching.Abstractions": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "9.0.4",
|
|
||||||
"contentHash": "imcZ5BGhBw5mNsWLepBbqqumWaFe0GtvyCvne2/2wsDIBRa2+Lhx4cU/pKt/4BwOizzUEOls2k1eOJQXHGMalg==",
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.Extensions.Primitives": "9.0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Microsoft.Extensions.Caching.Memory": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "9.0.4",
|
|
||||||
"contentHash": "G5rEq1Qez5VJDTEyRsRUnewAspKjaY57VGsdZ8g8Ja6sXXzoiI3PpTd1t43HjHqNWD5A06MQveb2lscn+2CU+w==",
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.Extensions.Caching.Abstractions": "9.0.4",
|
|
||||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.4",
|
|
||||||
"Microsoft.Extensions.Logging.Abstractions": "9.0.4",
|
|
||||||
"Microsoft.Extensions.Options": "9.0.4",
|
|
||||||
"Microsoft.Extensions.Primitives": "9.0.4"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Microsoft.Extensions.DependencyInjection": {
|
"Microsoft.Extensions.DependencyInjection": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "N1Mn0T/tUBPoLL+Fzsp+VCEtneUhhxc1//Dx3BeuQ8AX+XrMlYCfnp2zgpEXnTCB7053CLdiqVWPZ7mEX6MPjg==",
|
"contentHash": "vS65HMo5RS10DD543fknsyVDxihMcVxVn3/hNaILgBxWYnOLxWIeCIO9X0QFuCvPRNjClvXe9Aj8KaQNx7vFkQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.5"
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Microsoft.Extensions.DependencyInjection.Abstractions": {
|
"Microsoft.Extensions.DependencyInjection.Abstractions": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "cjnRtsEAzU73aN6W7vkWy8Phj5t3Xm78HSqgrbh/O4Q9SK/yN73wZVa21QQY6amSLQRQ/M8N+koGnY6PuvKQsw=="
|
"contentHash": "0Zn6nR/6g+90MxskZyOOMPQvnPnrrGu6bytPwkV+azDcTtCSuQ1+GJUrg8Klmnrjk1i6zMpw2lXijl+tw7Q3kA=="
|
||||||
},
|
},
|
||||||
"Microsoft.Extensions.FileProviders.Abstractions": {
|
"Microsoft.Extensions.FileProviders.Abstractions": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
@@ -197,19 +176,19 @@
|
|||||||
},
|
},
|
||||||
"Microsoft.Extensions.Logging.Abstractions": {
|
"Microsoft.Extensions.Logging.Abstractions": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "pP1PADCrIxMYJXxFmTVbAgEU7GVpjK5i0/tyfU9DiE0oXQy3JWQaOVgCkrCiePLgS8b5sghM3Fau3EeHiVWbCg==",
|
"contentHash": "LFnyBNK7WtFmKdnHu3v0HOYQ8BcjYuy0jdC9pgCJ/rbLKoJEG9/dBzSKMEeeWDbDeoWS0TIxOC8a9CM5ufca3A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.5"
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Microsoft.Extensions.Options": {
|
"Microsoft.Extensions.Options": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "vPdJQU8YLOUSSK8NL0RmwcXJr2E0w8xH559PGQl4JYsglgilZr9LZnqV2zdgk+XR05+kuvhBEZKoDVd46o7NqA==",
|
"contentHash": "wUPhNM1zsI58Dy10xRdF2+pnsisiUuETg5ZBncyAEEUm/CQ9Q1vmivyUWH8RDbAlqyixf2dJNQ2XZb7HsKUEQw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.5",
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.6",
|
||||||
"Microsoft.Extensions.Primitives": "9.0.5"
|
"Microsoft.Extensions.Primitives": "9.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Microsoft.Extensions.Primitives": {
|
"Microsoft.Extensions.Primitives": {
|
||||||
@@ -219,8 +198,8 @@
|
|||||||
},
|
},
|
||||||
"Microsoft.JSInterop": {
|
"Microsoft.JSInterop": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "9.0.5",
|
"resolved": "9.0.6",
|
||||||
"contentHash": "ji4fQKbUUZiq3lmzVBMvp15VgBtEyfR51NrmEjo6qnD97Jf1R6C6QkSMjwUO8bw5NZIDRtmPCYurypB3W5AMEg=="
|
"contentHash": "IS9tI2pnpeoX+d4CO4FuTsm+6uymanPGSpBhHefTfMNIwBUvwLIcXch4su0QEW4MSslYdDJ9yzz2+OuIUuI5lw=="
|
||||||
},
|
},
|
||||||
"ZXing.Net": {
|
"ZXing.Net": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
|
|||||||
@@ -1 +1,13 @@
|
|||||||
# v0.9.49, build 224 (2025-06-xx xx:xx UTC)
|
# v0.9.49, build 224 (2025-07-02 12:12 UTC)
|
||||||
|
- Added a library by Nils Kruthoff (`nilskruthoff`) that allows AI Studio to read PowerPoint files. Thanks, Nils, for that great contribution.
|
||||||
|
- Added support for loading arbitrary document data into some assistants. This functionality replaces the previous PDF reading function and was contributed by Nils as well.
|
||||||
|
- Improved the loading of some components that require data fetching, resulting in a more responsive UI.
|
||||||
|
- Improved some awkward phrasings in English and German.
|
||||||
|
- Improved the implementation of configuration plugins to enhance long-term maintainability.
|
||||||
|
- Changed the timestamp display to use the local datetime format for the chats and assistants.
|
||||||
|
- Fixed a bug when editing data sources that caused the selected retrieval process of an ERI data source to not load correctly.
|
||||||
|
- Fixed a bug in the chat that caused the multi-line text input box to occupy too much space even after submitting a prompt.
|
||||||
|
- Upgraded to Rust 1.88.0.
|
||||||
|
- Upgraded MudBlazor to version 8.9.0.
|
||||||
|
- Upgraded Pdfium to version 137.0.7215.0.
|
||||||
|
- Upgraded other dependencies to the latest versions.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# v0.9.50, build 225 (2025-07-xx xx:xx UTC)
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
.mud-combobox{margin:0;padding:0;position:relative;list-style:none;}.mud-combobox.mud-combobox-padding{padding-top:8px;padding-bottom:8px;}.mud-combobox-item{width:100%;display:flex;position:relative;box-sizing:border-box;text-align:start;align-items:center;padding-top:8px;padding-bottom:8px;justify-content:flex-start;text-decoration:none;outline:none;min-height:48px;}.mud-combobox-item.mud-combobox-item-comfort{padding-top:4px;padding-bottom:4px;min-height:40px;}.mud-combobox-item.mud-combobox-item-slim{padding-top:2px;padding-bottom:2px;min-height:32px;}.mud-combobox-item.mud-combobox-item-superslim{padding-top:0;padding-bottom:0;min-height:24px;}.mud-combobox-item.mud-combobox-item-disabled{color:var(--mud-palette-action-disabled) !important;cursor:default !important;pointer-events:none !important;}.mud-combobox-item.mud-combobox-item-disabled .mud-combobox-item-icon{color:var(--mud-palette-action-disabled) !important;}.mud-combobox-item-clickable{color:inherit;border:0;cursor:pointer;margin:0;outline:0;user-select:none;border-radius:0;vertical-align:middle;background-color:transparent;-webkit-appearance:none;-webkit-tap-highlight-color:transparent;transition:background-color 150ms cubic-bezier(.4,0,.2,1) 0ms;}.mud-combobox-item-clickable:hover{background-color:var(--mud-palette-action-default-hover);}.mud-combobox-item-gutters{padding-left:16px;padding-right:16px;}.mud-combobox-item-text{flex:1 1 auto;min-width:0;margin-top:4px;margin-bottom:4px;padding-inline-start:8px;padding-inline-end:8px;}.mud-combobox-item-text-inset{padding-left:56px;padding-inline-start:56px;padding-inline-end:unset;}.mud-combobox-item-icon{color:var(--mud-palette-action-default);display:inline-flex;flex-shrink:0;padding-inline-start:8px;padding-inline-end:8px;margin-inline-start:-4px;margin-inline-end:4px;}.mud-combobox-item-multiselect{max-height:32px;}.mud-combobox-item-multiselect.mud-combobox-item-multiselect-checkbox{padding-inline-end:16px;}.mud-combobox-subheader{color:var(--mud-palette-action-default);background-color:var(--mud-palette-background);font-size:.875rem;box-sizing:border-box;list-style:none;font-weight:500;padding-top:16px;padding-bottom:16px;}.mud-combobox-subheader-secondary-background{background-color:var(--mud-palette-background-gray);}.mud-combobox-subheader-gutters{padding-left:16px;padding-right:16px;}.mud-combobox-subheader-inset{padding-left:72px;padding-inline-start:72px;padding-inline-end:unset;}.mud-combobox-subheader-sticky{top:-8px;z-index:1;position:sticky;}.mud-combobox-subheader-sticky.mud-combobox-subheader-sticky-dense{top:0;}.mud-combobox-item-hilight{background-color:var(--mud-palette-background-gray);}.mud-combobox-item-hilight{background-color:var(--mud-palette-lines-default) !important;}.mud-combobox-item-bordered{border-left:4px solid var(--mud-palette-lines-default);padding-inline-start:12px;}.mud-combobox-item-bordered-primary{border-left:4px solid var(--mud-palette-primary);padding-inline-start:12px;}.mud-combobox-item-bordered-secondary{border-left:4px solid var(--mud-palette-secondary);padding-inline-start:12px;}.mud-combobox-item-bordered-tertiary{border-left:4px solid var(--mud-palette-tertiary);padding-inline-start:12px;}.mud-combobox-item-bordered-info{border-left:4px solid var(--mud-palette-info);padding-inline-start:12px;}.mud-combobox-item-bordered-success{border-left:4px solid var(--mud-palette-success);padding-inline-start:12px;}.mud-combobox-item-bordered-warning{border-left:4px solid var(--mud-palette-warning);padding-inline-start:12px;}.mud-combobox-item-bordered-error{border-left:4px solid var(--mud-palette-error);padding-inline-start:12px;}.mud-combobox-item-bordered-dark{border-left:4px solid var(--mud-palette-dark);padding-inline-start:12px;}.mud-combobox-item-nested-background{background-color:var(--mud-palette-background-gray);}.mud-combobox-item-avatar{min-width:56px;flex-shrink:0;}.mud-combobox-highlighter{background-color:transparent;font-weight:bold;text-decoration:underline;}.mud-gallery-selected-toolbox{left:0;right:0;height:56px;width:100%;background-color:rgba(0,0,0,.6);}.mud-gallery-selected-toolbox.gallery-toolbox-top{top:0;}.mud-gallery-selected-toolbox.gallery-toolbox-bottom{bottom:0;}.mud-page{display:grid;box-sizing:border-box;width:100%;}.mud-page.mud-page-height-full{min-height:100vh;}.mud-page.mud-page-height-full-without-appbar{min-height:calc(100vh - var(--mud-appbar-height));}.mud-page.mud-page-column-2{grid-template-columns:repeat(2,50%);}.mud-page.mud-page-column-3{grid-template-columns:repeat(3,33.33333%);}.mud-page.mud-page-column-4{grid-template-columns:repeat(4,25%);}.mud-page.mud-page-column-5{grid-template-columns:repeat(5,20%);}.mud-page.mud-page-column-6{grid-template-columns:repeat(6,16.66667%);}.mud-page.mud-page-column-7{grid-template-columns:repeat(7,14.28571%);}.mud-page.mud-page-column-8{grid-template-columns:repeat(8,12.5%);}.mud-page.mud-page-column-9{grid-template-columns:repeat(9,11.11111%);}.mud-page.mud-page-column-Line truncated
|
.mud-combobox{margin:0;padding:0;position:relative;list-style:none;}.mud-combobox.mud-combobox-padding{padding-top:8px;padding-bottom:8px;}.mud-combobox-item{width:100%;display:flex;position:relative;box-sizing:border-box;text-align:start;align-items:center;padding-top:8px;padding-bottom:8px;justify-content:flex-start;text-decoration:none;outline:none;min-height:48px;}.mud-combobox-item.mud-combobox-item-comfort{padding-top:4px;padding-bottom:4px;min-height:40px;}.mud-combobox-item.mud-combobox-item-slim{padding-top:2px;padding-bottom:2px;min-height:32px;}.mud-combobox-item.mud-combobox-item-superslim{padding-top:0;padding-bottom:0;min-height:24px;}.mud-combobox-item.mud-combobox-item-disabled{color:var(--mud-palette-action-disabled) !important;cursor:default !important;pointer-events:none !important;}.mud-combobox-item.mud-combobox-item-disabled .mud-combobox-item-icon{color:var(--mud-palette-action-disabled) !important;}.mud-combobox-item-clickable{color:inherit;border:0;cursor:pointer;margin:0;outline:0;user-select:none;border-radius:0;vertical-align:middle;background-color:transparent;-webkit-appearance:none;-webkit-tap-highlight-color:transparent;transition:background-color 150ms cubic-bezier(.4,0,.2,1) 0ms;}.mud-combobox-item-clickable:hover{background-color:var(--mud-palette-action-default-hover);}.mud-combobox-item-gutters{padding-left:16px;padding-right:16px;}.mud-combobox-item-text{flex:1 1 auto;min-width:0;margin-top:4px;margin-bottom:4px;padding-inline-start:8px;padding-inline-end:8px;}.mud-combobox-item-text-inset{padding-left:56px;padding-inline-start:56px;padding-inline-end:unset;}.mud-combobox-item-icon{color:var(--mud-palette-action-default);display:inline-flex;flex-shrink:0;padding-inline-start:8px;padding-inline-end:8px;margin-inline-start:-4px;margin-inline-end:4px;}.mud-combobox-item-multiselect{max-height:32px;}.mud-combobox-item-multiselect.mud-combobox-item-multiselect-checkbox{padding-inline-end:16px;}.mud-combobox-subheader{color:var(--mud-palette-action-default);background-color:var(--mud-palette-background);font-size:.875rem;box-sizing:border-box;list-style:none;font-weight:500;padding-top:16px;padding-bottom:16px;}.mud-combobox-subheader-secondary-background{background-color:var(--mud-palette-background-gray);}.mud-combobox-subheader-gutters{padding-left:16px;padding-right:16px;}.mud-combobox-subheader-inset{padding-left:72px;padding-inline-start:72px;padding-inline-end:unset;}.mud-combobox-subheader-sticky{top:-8px;z-index:1;position:sticky;}.mud-combobox-subheader-sticky.mud-combobox-subheader-sticky-dense{top:0;}.mud-combobox-item-hilight{background-color:var(--mud-palette-background-gray);}.mud-combobox-item-hilight{background-color:var(--mud-palette-lines-default) !important;}.mud-combobox-item-bordered{border-left:4px solid var(--mud-palette-lines-default);padding-inline-start:12px;}.mud-combobox-item-bordered-primary{border-left:4px solid var(--mud-palette-primary);padding-inline-start:12px;}.mud-combobox-item-bordered-secondary{border-left:4px solid var(--mud-palette-secondary);padding-inline-start:12px;}.mud-combobox-item-bordered-tertiary{border-left:4px solid var(--mud-palette-tertiary);padding-inline-start:12px;}.mud-combobox-item-bordered-info{border-left:4px solid var(--mud-palette-info);padding-inline-start:12px;}.mud-combobox-item-bordered-success{border-left:4px solid var(--mud-palette-success);padding-inline-start:12px;}.mud-combobox-item-bordered-warning{border-left:4px solid var(--mud-palette-warning);padding-inline-start:12px;}.mud-combobox-item-bordered-error{border-left:4px solid var(--mud-palette-error);padding-inline-start:12px;}.mud-combobox-item-bordered-dark{border-left:4px solid var(--mud-palette-dark);padding-inline-start:12px;}.mud-combobox-item-nested-background{background-color:var(--mud-palette-background-gray);}.mud-combobox-item-avatar{min-width:56px;flex-shrink:0;}.mud-combobox-highlighter{background-color:transparent;font-weight:bold;text-decoration:underline;}.mud-gallery-selected-toolbox{left:0;right:0;height:56px;width:100%;background-color:rgba(0,0,0,.6);}.mud-gallery-selected-toolbox.gallery-toolbox-top{top:0;}.mud-gallery-selected-toolbox.gallery-toolbox-bottom{bottom:0;}.mud-page{display:grid;box-sizing:border-box;width:100%;}.mud-page.mud-page-height-full{min-height:100vh;}.mud-page.mud-page-height-full-without-appbar{min-height:calc(100vh - var(--mud-appbar-height));}.mud-page.mud-page-column-2{grid-template-columns:repeat(2,50%);}.mud-page.mud-page-column-3{grid-template-columns:repeat(3,33.33333%);}.mud-page.mud-page-column-4{grid-template-columns:repeat(4,25%);}.mud-page.mud-page-column-5{grid-template-columns:repeat(5,20%);}.mud-page.mud-page-column-6{grid-template-columns:repeat(6,16.66667%);}.mud-page.mud-page-column-7{grid-template-columns:repeat(7,14.28571%);}.mud-page.mud-page-column-8{grid-template-columns:repeat(8,12.5%);}.mud-page.mud-page-column-9{grid-template-columns:repeat(9,11.11111%);}.mud-page.mud-page-column-Line truncated
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
|||||||
function auto_size(n){n.style.height="5px";n.style.height=n.scrollHeight+4+"px"}function getcss(n,t){const i=document.querySelector(n);return i.style.getPropertyValue(t)}function setcss(n,t,i){const r=document.querySelectorAll(n);for(let n=0;n<r.length;n++)r[n].style.setProperty(t,i)}class MudScrollManagerExtended{scrollToMiddle(n,t){let i=document.getElementById(n),r=document.getElementById(t);i.scrollTop=r.offsetTop-i.offsetHeight+i.offsetHeight/2+r.offsetHeight/2}}window.mudScrollManagerExtended=new MudScrollManagerExtended;window.mudTeleport={teleport:(n,t)=>{const i=document.querySelector(t);return i?(i.appendChild(n),"ok"):"not found"},removeFromDOM:n=>{n&&n.__internalId!==null&&n.remove()}};class MudSignaturePadManager{constructor(){this.pads=[]}addPad(n,t,i){const r=new MudSignaturePad(n,t,i);r.init();this.pads.push(r)}togglePadEraser(n){const t=this.getPad(n);t&&t.toggleEraser()}disposePad(n){const t=this.getPad(n);t&&t.dispose()}clearPad(n){const t=this.getPad(n);t&&t.clear(!0)}downloadPadImage(n){const t=this.getPad(n);t&&t.download()}getBase64(n){const t=this.getPad(n);if(t)return t.getBase64()}updatePadOptions(n,t){const i=this.getPad(n);i&&i.setOptions(t)}updatePadImage(n,t){const i=this.getPad(n);if(i){if(t.startsWith("data:image/png;base64,")){i.updateImage(t);return}i.updateImage(`data:image/png;base64,${t}`)}}getPad(n){const t=this.pads.findIndex(t=>t.canvas.id===n.id);return t>=0?this.pads[t]:null}}class MudSignaturePad{constructor(n,t,i){this.canvas=t;this.options=i;this.isMouseDown=!1;this.isErasing=!1;this.memCanvas=document.createElement("canvas");this.points=[];this.dotnetRef=n}get ctx(){return this.canvas.getContext("2d")}get memCtx(){return this.memCanvas.getContext("2d")}getBase64(){return this.canvas.toDataURL()}init(){this.setCanvasSize();this.setOptions(this.options);this.canvas.addEventListener("mousedown",n=>this.startDrawing(n));this.canvas.addEventListener("mousemove",n=>this.drawLine(n));this.canvas.addEventListener("mouseup",()=>this.stopDrawing());this.canvas.addEventListener("mouseout",()=>this.stopDrawing());this.canvas.addEventListener("touchstart",n=>this.startDrawing(n));this.canvas.addEventListener("touchend",()=>this.stopDrawing());this.canvas.addEventListener("touchmove",n=>this.drawLine(n));this.setPencilCursor()}download(){const n=document.createElement("a");n.download="signature.png";n.href=this.canvas.toDataURL();n.click();n.remove()}updateImage(n){this.clear(!0);const t=new Image,i=this.ctx,r=this.memCtx;t.onload=function(){i.drawImage(t,0,0);r.drawImage(t,0,0);t.remove()};t.src=n}setCanvasSize(){const t=this.canvas.parentElement,n=t.getBoundingClientRect();this.canvas.width=n.width;this.canvas.height=n.height;this.memCanvas.height=n.height;this.memCanvas.width=n.width}dispose(){this.canvas.removeEventListener("mousedown");this.canvas.removeEventListener("mousemove");this.canvas.removeEventListener("mouseup");this.canvas.removeEventListener("mouseout");this.canvas.removeEventListener("touchstart");this.canvas.removeEventListener("touchend");this.canvas.removeEventListener("touchmove")}clear(n){n===!0&&this.memCtx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}stopDrawing(){this.isMouseDown=!1;this.memCtx.clearRect(0,0,this.memCanvas.width,this.memCanvas.height);this.memCtx.drawImage(this.canvas,0,0);this.points=[]}startDrawing(n){this.isMouseDown=!0;this.points.push({x:n.offsetX,y:n.offsetY})}setOptions(n){this.ctx.lineWidth=n.lineWidth;this.ctx.lineJoin=n.lineJoin;this.ctx.lineCap=n.lineCap;this.ctx.strokeStyle=n.strokeStyle;this.options=n}toggleEraser(){if(this.isErasing=!this.isErasing,this.isErasing){this.setEraserCursor();return}this.setPencilCursor()}setPencilCursor(){this.canvas.setAttribute("style","cursor:url('_content/CodeBeam.MudBlazor.Extensions/pencil.cur'), auto;")}setEraserCursor(){this.canvas.setAttribute("style","cursor:url('_content/CodeBeam.MudBlazor.Extensions/eraser.cur'), auto;")}drawLine(n){this.isMouseDown&&(this.isErasing===!1?(this.clear(),this.ctx.drawImage(this.memCanvas,0,0),this.points.push({x:n.offsetX,y:n.offsetY}),this.drawPoints(this.ctx,this.points)):this.ctx.clearRect(n.offsetX,n.offsetY,23,23))}drawPoints(n,t){if(!(t.length<6)){if(t.length<6){const i=t[0];n.beginPath();n.arc(i.x,i.y,n.lineWidth/2,0,Math.PI*2,!0);n.closePath();n.fill();this.pushUpdateToBlazorComponent();return}n.beginPath();n.moveTo(t[0].x,t[0].y);let i;for(let r=1;r<t.length-2;r++){const u=(t[r].x+t[r+1].x)/2,f=(t[r].y+t[r+1].y)/2;n.quadraticCurveTo(t[r].x,t[r].y,u,f);i=r}n.quadraticCurveTo(t[i].x,t[i].y,t[i+1].x,t[i+1].y);n.stroke();this.pushUpdateToBlazorComponent()}}pushUpdateToBlazorComponent(){this.dotnetRef.invokeMethodAsync("SignatureDataChangedAsync")}}window.mudSignaturePad=new MudSignaturePadManager;
|
function auto_size(n){n.style.height="5px";n.style.height=n.scrollHeight+4+"px"}function getcss(n,t){const i=document.querySelector(n);return i.style.getPropertyValue(t)}function setcss(n,t,i){const r=document.querySelectorAll(n);for(let n=0;n<r.length;n++)r[n].style.setProperty(t,i)}class MudScrollManagerExtended{scrollToMiddle(n,t){let i=document.getElementById(n),r=document.getElementById(t);i.scrollTop=r.offsetTop-i.offsetHeight+i.offsetHeight/2+r.offsetHeight/2}}window.mudScrollManagerExtended=new MudScrollManagerExtended;window.mudTeleport={teleport:(n,t)=>{const i=document.querySelector(t);return i?(i.appendChild(n),"ok"):"not found"},removeFromDOM:n=>{n&&n.__internalId!==null&&n.remove()}};class MudSignaturePadManager{constructor(){this.pads=[]}addPad(n,t,i){const r=new MudSignaturePad(n,t,i);r.init();this.pads.push(r)}togglePadEraser(n){const t=this.getPad(n);t&&t.toggleEraser()}disposePad(n){const t=this.getPad(n);t&&t.dispose()}clearPad(n){const t=this.getPad(n);t&&t.clear(!0)}downloadPadImage(n){const t=this.getPad(n);t&&t.download()}getBase64(n){const t=this.getPad(n);if(t)return t.getBase64()}updatePadOptions(n,t){const i=this.getPad(n);i&&i.setOptions(t)}updatePadImage(n,t){const i=this.getPad(n);i&&(t.startsWith("data:image/png;base64,")||(t=`data:image/png;base64,${t}`),i.updateImage(t))}setCanvasSize(n){const t=this.getPad(n);t&&t.updateCanvasSize()}getPad(n){return this.pads.find(t=>t.canvas.id===n.id)||null}}class MudSignaturePad{constructor(n,t,i){this.canvas=t;this.options=i;this.isMouseDown=!1;this.isErasing=!1;this.memCanvas=document.createElement("canvas");this.points=[];this.dotnetRef=n;this.onPointerDown=this.handlePointerDown.bind(this);this.onPointerMove=this.handlePointerMove.bind(this);this.onPointerUp=this.handlePointerUp.bind(this);this.onPointerLeave=this.stopDrawing.bind(this)}get ctx(){return this.canvas.getContext("2d")}get memCtx(){return this.memCanvas.getContext("2d")}init(){this.setCanvasSize();this.setOptions(this.options);this.canvas.addEventListener("pointerdown",this.onPointerDown,{passive:!1});this.canvas.addEventListener("pointermove",this.onPointerMove,{passive:!1});this.canvas.addEventListener("pointerup",this.onPointerUp,{passive:!1});this.canvas.addEventListener("pointerleave",this.onPointerLeave);this.canvas.style.touchAction="none";this.setPencilCursor()}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown);this.canvas.removeEventListener("pointermove",this.onPointerMove);this.canvas.removeEventListener("pointerup",this.onPointerUp);this.canvas.removeEventListener("pointerleave",this.onPointerLeave)}setCanvasSize(){const t=this.canvas.parentElement;if(t){const n=t.getBoundingClientRect();this.canvas.width=n.width;this.canvas.height=n.height;this.memCanvas.width=n.width;this.memCanvas.height=n.height}}updateCanvasSize(){const t=this.canvas.parentElement;if(t){const i=t.getBoundingClientRect(),r=i.width,u=i.height,n=document.createElement("canvas");n.width=this.canvas.width;n.height=this.canvas.height;const f=n.getContext("2d");f.drawImage(this.canvas,0,0);this.canvas.width=r;this.canvas.height=u;this.memCanvas.width=r;this.memCanvas.height=u;this.ctx.drawImage(n,0,0);this.memCtx.drawImage(n,0,0)}}getBase64(){return this.canvas.toDataURL()}updateImage(n){this.clear(!0);const t=new Image;t.onload=()=>{this.ctx.drawImage(t,0,0),this.memCtx.drawImage(t,0,0)};t.src=n}download(){const n=document.createElement("a");n.download="signature.png";n.href=this.getBase64();n.click();n.remove()}clear(n){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);n&&this.memCtx.clearRect(0,0,this.canvas.width,this.canvas.height)}setOptions(n){this.options=n;const t=t=>{t.lineWidth=n.lineWidth,t.lineJoin=n.lineJoin,t.lineCap=n.lineCap,t.strokeStyle=n.strokeStyle};t(this.ctx);t(this.memCtx)}toggleEraser(){this.isErasing=!this.isErasing;this.isErasing?this.setEraserCursor():this.setPencilCursor()}setPencilCursor(){this.canvas.style.cursor="url('_content/CodeBeam.MudBlazor.Extensions/pencil.cur'), auto"}setEraserCursor(){this.canvas.style.cursor="url('_content/CodeBeam.MudBlazor.Extensions/eraser.cur'), auto"}handlePointerDown(n){n.preventDefault();this.isMouseDown=!0;const{offsetX:t,offsetY:i}=n;this.points=[{x:t,y:i}]}handlePointerMove(n){if(this.isMouseDown){n.preventDefault();const{offsetX:t,offsetY:i}=n;this.isErasing?this.ctx.clearRect(t-10,i-10,23,23):(this.clear(),this.ctx.drawImage(this.memCanvas,0,0),this.points.push({x:t,y:i}),this.drawPoints(this.ctx,this.points))}}handlePointerUp(n){n.preventDefault();this.stopDrawing()}stopDrawing(){this.isMouseDown&&(this.isMouseDown=!1,this.memCtx.clearRect(0,0,this.memCanvas.width,this.memCanvas.height),this.memCtx.drawImage(this.canvas,0,0),this.points=[])}drawPoints(n,t){if(!(t.length<2)){if(t.length<6){const i=t[0];n.beginPath();n.lineWidth=this.options.lineWidth;n.strokeStyle=this.options.strokeStyle;n.arc(i.x,i.y,n.lineWidth/2,0,Math.PI*2,!0);n.fill();n.closePath();this.pushUpdateToBlazorComponent(Line truncated
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
|||||||
.mud-markdown-body code:not(.hljs){background:var(--mud-palette-action-disabled-background);color:var(--mud-palette-text-primary)!important;padding:2.5px 7.5px;border-radius:5px}pre code.hljs{display:block!important;overflow-x:auto;padding:1em}.mud-markdown-body .snippet-clipboard-content{position:relative!important}.mud-markdown-body .snippet-clipboard-content:hover>.snippet-clipboard-copy-icon{display:block!important}.mud-markdown-body .snippet-clipboard-content .snippet-clipboard-copy-icon{position:absolute;display:none;top:0;right:0}.mud-markdown-body blockquote{border-left:.25em solid var(--mud-palette-text-disabled);color:var(--mud-palette-text-secondary);background-color:var(--mud-palette-table-hover);padding:.25em 1em;margin:.5em 0 1.25em}.mud-markdown-body blockquote p{margin-bottom:0!important}.mud-markdown-body table{margin:1.25em 0}.mud-markdown-body .mud-link:hover{cursor:pointer!important}.mud-markdown-body ul{list-style-type:disc}.mud-markdown-body ol,.mud-markdown-body ul{padding-left:2em;margin-bottom:1.25em!important}.mud-markdown-body ul ul{list-style-type:circle;margin-bottom:0!important}.mud-markdown-body ul ul ul{list-style-type:square;margin-bottom:0!important}.mud-markdown-body li{display:list-item!important;text-align:-webkit-match-parent}.mud-markdown-body h1,.mud-markdown-body h2{border-bottom:1px solid var(--mud-palette-text-disabled);padding-bottom:.125em;margin-bottom:.4em}.mud-markdown-body h1,.mud-markdown-body h2,.mud-markdown-body h3,.mud-markdown-body h4,.mud-markdown-body h5,.mud-markdown-body h6{scroll-margin-top:5rem;margin-top:.25em;word-wrap:break-word;margin-bottom:.3em!important}.mud-markdown-body .mud-divider{margin:.5em 0;height:.25em}.mud-markdown-body p{margin-bottom:1.25em!important}.mud-markdown-body .mud-expand-panel p,.mud-markdown-body li p{margin-bottom:0!important}.mud-markdown-body p .mud-markdown-error{white-space:pre}.mud-markdown-body img{max-width:100%}
|
.mud-markdown-body code:not(.hljs){background:var(--mud-palette-action-disabled-background);color:var(--mud-palette-text-primary)!important;padding:2.5px 7.5px;border-radius:5px}pre code.hljs{display:block!important;overflow-x:auto;padding:1em}.mud-markdown-body .snippet-clipboard-content{position:relative!important}.mud-markdown-body .snippet-clipboard-content:hover>.snippet-clipboard-copy-icon{display:block!important}.mud-markdown-body .snippet-clipboard-content .snippet-clipboard-copy-icon{position:absolute;display:none;top:0;right:0}.mud-markdown-body blockquote{border-left:.25em solid var(--mud-palette-text-disabled);color:var(--mud-palette-text-secondary);background-color:var(--mud-palette-table-hover);padding:.25em 1em;margin:.5em 0 1.25em}.mud-markdown-body blockquote p{margin-bottom:0!important}.mud-markdown-body table{margin:1.25em 0}.mud-markdown-body .mud-link:hover{cursor:pointer!important}.mud-markdown-body ul{list-style-type:disc}.mud-markdown-body ol,.mud-markdown-body ul{padding-left:2em;margin-bottom:1.25em!important}.mud-markdown-body ul ul{list-style-type:circle;margin-bottom:0!important}.mud-markdown-body ul ul ul{list-style-type:square;margin-bottom:0!important}.mud-markdown-body li{display:list-item!important;text-align:-webkit-match-parent}.mud-markdown-body h1,.mud-markdown-body h2{border-bottom:1px solid var(--mud-palette-text-disabled);padding-bottom:.125em;margin-bottom:.4em}.mud-markdown-body h1,.mud-markdown-body h2,.mud-markdown-body h3,.mud-markdown-body h4,.mud-markdown-body h5,.mud-markdown-body h6{scroll-margin-top:5rem;margin-top:.25em;word-wrap:break-word;margin-bottom:.3em!important}.mud-markdown-body .mud-divider{margin:.5em 0;height:.25em}.mud-markdown-body p{margin-bottom:1.25em!important}.mud-markdown-body .mud-expand-panel p,.mud-markdown-body li p{margin-bottom:0!important}.mud-markdown-body p .mud-markdown-error{white-space:pre}.mud-markdown-body img{max-width:100%}.mud-markdown-toc{position:relative}.mud-markdown-toc-drawer{position:sticky;overflow:hidden;z-index:calc(var(--mud-zindex-appbar) - 2);top:calc(var(--mud-appbar-height) + 16px);float:right}.mud-markdown-toc-drawer-content{width:var(--mud-drawer-width-right);opacity:0;visibility:collapse;transition:opacity .3s ease,visibility .3s ease}.mud-markdown-toc-drawer-content.open{opacity:1;visibility:visible}.mud-markdown-toc-content{margin-right:0;transition:margin-left .3s ease}.mud-markdown-toc-content.open{margin-right:calc(var(--mud-drawer-width-right) + 16px)}.mud-markdown-toc-btn-toggle{position:absolute;right:0;z-index:calc(var(--mud-zindex-appbar) - 1)}.mud-markdown-toc-nav-menu .mud-nav-link{padding:4px 16px!important}.mud-markdown-toc-nav-menu .mud-nav-link-h2 .mud-nav-link-text{margin-left:20px!important}.mud-markdown-toc-nav-menu .mud-nav-link-h3 .mud-nav-link-text{margin-left:28px!important}.mud-markdown-toc-nav-menu .mud-nav-item{border-left:4px solid var(--mud-palette-text-disabled)}.mud-markdown-toc-nav-menu .mud-nav-item.active{border-left-color:var(--mud-palette-primary)!important;color:var(--mud-palette-primary)!important}
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
|||||||
(()=>{var e={2224:e=>{e.exports=function(e){var t="built_in",a={},n={begin:"}",className:t,endsParent:!0},r={begin:"{",end:"}",contains:[e.QUOTE_STRING_MODE,"self"]},i=e.COMMENT("@\\*","\\*@",{relevance:10}),o={begin:"@[A-Za-z0-9\\._:-]+",returnBegin:!0,end:"(\\r|\\n|<|\\s|\"|')",subLanguage:"csharp",contains:[{begin:"@",className:t},{begin:"\\[",end:"\\]",skip:!0},{begin:"\\(",end:"\\)",skip:!0}],returnEnd:!0},s={begin:"[@]{0,1}<text>",returnBegin:!0,end:"</text>",returnEnd:!0,subLanguage:"cshtml-razor",contains:[{begin:"[@]{0,1}<text>",className:t},{begin:"</text>",className:t,endsParent:!0}]},l={begin:"@\\(",end:"\\)",returnBegin:!0,returnEnd:!0,subLanguage:"csharp",contains:[{begin:"@\\(",className:t},{begin:"\\(",end:"\\)",subLanguage:"csharp",contains:[e.QUOTE_STRING_MODE,"self",s]},s,{begin:"\\)",className:t,endsParent:!0}]},c=function(e,t){var a={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:"[A-Za-z0-9\\._:-]+",relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",variants:[{begin:/"/,end:/"/,contains:t},{begin:/'/,end:/'/,contains:t},{begin:/[^\s"'=<>`]+/}]}]}]};return[{className:"meta",begin:"<!DOCTYPE",end:">",relevance:10,contains:[{begin:"\\[",end:"\\]"}]},e.COMMENT("\x3c!--","--\x3e",{relevance:10}),{begin:"<\\!\\[CDATA\\[",end:"\\]\\]>",relevance:10},{className:"meta",begin:/<\?xml/,end:/\?>/,relevance:10},{className:"tag",begin:"<style(?=\\s|>|$)",end:">",keywords:{name:"style"},contains:[a],starts:{end:"</style>",returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:"<script(?=\\s|>|$)",end:">",keywords:{name:"script"},contains:[a],starts:{end:"<\/script>",returnEnd:!0,subLanguage:["actionscript","javascript","handlebars","xml"]}},{className:"tag",begin:"</?",end:"/?>",contains:[{className:"name",begin:/[^\/><\s]+/,relevance:0},a]}].concat(t)}(e,[o,l]),_="^\\s*@(page|model|using|inherits|inject|layout)",d={begin:_+"[^\\r\\n{\\(]*$",end:"$",returnBegin:!0,returnEnd:!0,contains:[{begin:_,className:t},{variants:[{begin:"\\r|\\n",endsParent:!0},{begin:"\\s[^\\r\\n]+",end:"$"},{begin:"$"}],className:"type",endsParent:!0}]},m={variants:[{begin:"@\\{",end:"}"},{begin:"@code\\s*\\{",end:"}"}],returnBegin:!0,returnEnd:!0,subLanguage:"csharp",contains:[{begin:"@(code\\s*)?\\{",className:t},a,{begin:"{",end:"}",contains:["self"],skip:!0},n]},p={begin:"^\\s*@helper[\\s]*[^{]+[\\s]*{",returnBegin:!0,returnEnd:!0,end:"}",subLanguage:"cshtml-razor",contains:[{begin:"@helper",className:t},{begin:"{",className:t},n]},u=[{begin:"@for[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@if[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@switch[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@while[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@using[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@lock[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@foreach[\\s]*\\([^{]+[\\s]*{",end:"}"}],g={variants:u,returnBegin:!0,returnEnd:!0,subLanguage:"csharp",contains:[{variants:u.map((function(e){return{begin:e.begin}})),returnBegin:!0,contains:[{begin:"@",className:t},{variants:u.map((function(e){return{begin:e.begin.substr(1,e.begin.length-2)}})),subLanguage:"csharp"},{begin:"{",className:t}]},a,{variants:[{begin:"}[\\s]*else\\sif[\\s]*\\([^{]+[\\s]*{"},{begin:"}[\\s]*else[\\s]*{"}],returnBegin:!0,contains:[{begin:"}",className:t},{variants:[{begin:"[\\s]*else\\sif[\\s]*\\([^{]+[\\s]*{"},{begin:"[\\s]*else[\\s]*"}],subLanguage:"csharp"},{begin:"{",className:t}]},r,n]},E={begin:"@try[\\s]*{",end:"}",returnBegin:!0,returnEnd:!0,subLanguage:"csharp",contains:[{begin:"@",className:t},{begin:"try[\\s]*{",subLanguage:"csharp"},{variants:[{begin:"}[\\s]*catch[\\s]*\\([^\\)]+\\)[\\s]*{"},{begin:"}[\\s]*finally[\\s]*{"}],returnBegin:!0,contains:[{begin:"}",className:t},{variants:[{begin:"[\\s]*catch[\\s]*\\([^\\)]+\\)[\\s]*"},{begin:"[\\s]*finally[\\s]*"}],subLanguage:"csharp"},{begin:"{",className:t}]},a,r,n]},S="@section[\\s]+[a-zA-Z0-9]+[\\s]*{",b=[d,p,m,g,{begin:S,returnBegin:!0,returnEnd:!0,end:"}",subLanguage:"cshtml-razor",contains:[{begin:S,className:t},r,n]},{begin:"@await ",returnBegin:!0,subLanguage:"csharp",end:"(\\r|\\n|<|\\s)",contains:[{begin:"@await ",className:t},{begin:"[<\\r\\n]",endsParent:!0}]},E,{variants:[{begin:"@@"},{begin:"[a-zA-Z]+@"}],skip:!0},s,i,l,{className:"meta",begin:"<!DOCTYPE",end:">",relevance:10,contains:[{begin:"\\[",end:"\\]"}]},{begin:"<\\!\\[CDATA\\[",end:"\\]\\]>",relevance:10}].concat(c);return[m,g,E].forEach((function(e){var t=b.filter((function(t){return t!==e})),n=e.contains.indexOf(a);e.contains.splice.apply(e.contains,[n,1].concat(t))})),{aliases:["cshtml","razor","razor-cshtml","cshtml-razor"],contains:b}}},8416:e=>{function t(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((a=>{const n=e[a],r=typeof n;"object"!==r&&"function"!==r||Object.isFrozen(n)||t(n)})),e}class a{constructoLine truncated
|
(()=>{var e={2224:e=>{e.exports=function(e){var t="built_in",a={},n={begin:"}",className:t,endsParent:!0},r={begin:"{",end:"}",contains:[e.QUOTE_STRING_MODE,"self"]},i=e.COMMENT("@\\*","\\*@",{relevance:10}),o={begin:"@[A-Za-z0-9\\._:-]+",returnBegin:!0,end:"(\\r|\\n|<|\\s|\"|')",subLanguage:"csharp",contains:[{begin:"@",className:t},{begin:"\\[",end:"\\]",skip:!0},{begin:"\\(",end:"\\)",skip:!0}],returnEnd:!0},s={begin:"[@]{0,1}<text>",returnBegin:!0,end:"</text>",returnEnd:!0,subLanguage:"cshtml-razor",contains:[{begin:"[@]{0,1}<text>",className:t},{begin:"</text>",className:t,endsParent:!0}]},l={begin:"@\\(",end:"\\)",returnBegin:!0,returnEnd:!0,subLanguage:"csharp",contains:[{begin:"@\\(",className:t},{begin:"\\(",end:"\\)",subLanguage:"csharp",contains:[e.QUOTE_STRING_MODE,"self",s]},s,{begin:"\\)",className:t,endsParent:!0}]},c=function(e,t){var a={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:"[A-Za-z0-9\\._:-]+",relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",variants:[{begin:/"/,end:/"/,contains:t},{begin:/'/,end:/'/,contains:t},{begin:/[^\s"'=<>`]+/}]}]}]};return[{className:"meta",begin:"<!DOCTYPE",end:">",relevance:10,contains:[{begin:"\\[",end:"\\]"}]},e.COMMENT("\x3c!--","--\x3e",{relevance:10}),{begin:"<\\!\\[CDATA\\[",end:"\\]\\]>",relevance:10},{className:"meta",begin:/<\?xml/,end:/\?>/,relevance:10},{className:"tag",begin:"<style(?=\\s|>|$)",end:">",keywords:{name:"style"},contains:[a],starts:{end:"</style>",returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:"<script(?=\\s|>|$)",end:">",keywords:{name:"script"},contains:[a],starts:{end:"<\/script>",returnEnd:!0,subLanguage:["actionscript","javascript","handlebars","xml"]}},{className:"tag",begin:"</?",end:"/?>",contains:[{className:"name",begin:/[^\/><\s]+/,relevance:0},a]}].concat(t)}(e,[o,l]),_="^\\s*@(page|model|using|inherits|inject|layout)",d={begin:_+"[^\\r\\n{\\(]*$",end:"$",returnBegin:!0,returnEnd:!0,contains:[{begin:_,className:t},{variants:[{begin:"\\r|\\n",endsParent:!0},{begin:"\\s[^\\r\\n]+",end:"$"},{begin:"$"}],className:"type",endsParent:!0}]},m={variants:[{begin:"@\\{",end:"}"},{begin:"@code\\s*\\{",end:"}"}],returnBegin:!0,returnEnd:!0,subLanguage:"csharp",contains:[{begin:"@(code\\s*)?\\{",className:t},a,{begin:"{",end:"}",contains:["self"],skip:!0},n]},p={begin:"^\\s*@helper[\\s]*[^{]+[\\s]*{",returnBegin:!0,returnEnd:!0,end:"}",subLanguage:"cshtml-razor",contains:[{begin:"@helper",className:t},{begin:"{",className:t},n]},u=[{begin:"@for[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@if[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@switch[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@while[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@using[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@lock[\\s]*\\([^{]+[\\s]*{",end:"}"},{begin:"@foreach[\\s]*\\([^{]+[\\s]*{",end:"}"}],g={variants:u,returnBegin:!0,returnEnd:!0,subLanguage:"csharp",contains:[{variants:u.map((function(e){return{begin:e.begin}})),returnBegin:!0,contains:[{begin:"@",className:t},{variants:u.map((function(e){return{begin:e.begin.substr(1,e.begin.length-2)}})),subLanguage:"csharp"},{begin:"{",className:t}]},a,{variants:[{begin:"}[\\s]*else\\sif[\\s]*\\([^{]+[\\s]*{"},{begin:"}[\\s]*else[\\s]*{"}],returnBegin:!0,contains:[{begin:"}",className:t},{variants:[{begin:"[\\s]*else\\sif[\\s]*\\([^{]+[\\s]*{"},{begin:"[\\s]*else[\\s]*"}],subLanguage:"csharp"},{begin:"{",className:t}]},r,n]},E={begin:"@try[\\s]*{",end:"}",returnBegin:!0,returnEnd:!0,subLanguage:"csharp",contains:[{begin:"@",className:t},{begin:"try[\\s]*{",subLanguage:"csharp"},{variants:[{begin:"}[\\s]*catch[\\s]*\\([^\\)]+\\)[\\s]*{"},{begin:"}[\\s]*finally[\\s]*{"}],returnBegin:!0,contains:[{begin:"}",className:t},{variants:[{begin:"[\\s]*catch[\\s]*\\([^\\)]+\\)[\\s]*"},{begin:"[\\s]*finally[\\s]*"}],subLanguage:"csharp"},{begin:"{",className:t}]},a,r,n]},S="@section[\\s]+[a-zA-Z0-9]+[\\s]*{",b=[d,p,m,g,{begin:S,returnBegin:!0,returnEnd:!0,end:"}",subLanguage:"cshtml-razor",contains:[{begin:S,className:t},r,n]},{begin:"@await ",returnBegin:!0,subLanguage:"csharp",end:"(\\r|\\n|<|\\s)",contains:[{begin:"@await ",className:t},{begin:"[<\\r\\n]",endsParent:!0}]},E,{variants:[{begin:"@@"},{begin:"[a-zA-Z]+@"}],skip:!0},s,i,l,{className:"meta",begin:"<!DOCTYPE",end:">",relevance:10,contains:[{begin:"\\[",end:"\\]"}]},{begin:"<\\!\\[CDATA\\[",end:"\\]\\]>",relevance:10}].concat(c);return[m,g,E].forEach((function(e){var t=b.filter((function(t){return t!==e})),n=e.contains.indexOf(a);e.contains.splice.apply(e.contains,[n,1].concat(t))})),{aliases:["cshtml","razor","razor-cshtml","cshtml-razor"],contains:b}}},8416:e=>{function t(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((a=>{const n=e[a],r=typeof n;"object"!==r&&"function"!==r||Object.isFrozen(n)||t(n)})),e}class a{constructoLine truncated
|
||||||
Binary file not shown.
Binary file not shown.
@@ -2,4 +2,4 @@
|
|||||||
* MudBlazor (https://mudblazor.com/)
|
* MudBlazor (https://mudblazor.com/)
|
||||||
* Copyright (c) 2021 MudBlazor
|
* Copyright (c) 2021 MudBlazor
|
||||||
* Licensed under MIT (https://github.com/MudBlazor/MudBlazor/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/MudBlazor/MudBlazor/blob/master/LICENSE)
|
||||||
*/.mud-primary{background-color:var(--mud-palette-primary) !important}.mud-primary-text{color:var(--mud-palette-primary) !important;--mud-ripple-color: var(--mud-palette-primary) !important}.mud-primary-hover{background-color:var(--mud-palette-primary-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-primary-hover:hover{background-color:var(--mud-palette-primary-hover) !important}}.hover\:mud-primary-hover:focus-visible,.hover\:mud-primary-hover:active{background-color:var(--mud-palette-primary-hover) !important}.mud-border-primary{border-color:var(--mud-palette-primary) !important}.mud-theme-primary{color:var(--mud-palette-primary-text) !important;background-color:var(--mud-palette-primary) !important}.mud-secondary{background-color:var(--mud-palette-secondary) !important}.mud-secondary-text{color:var(--mud-palette-secondary) !important;--mud-ripple-color: var(--mud-palette-secondary) !important}.mud-secondary-hover{background-color:var(--mud-palette-secondary-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-secondary-hover:hover{background-color:var(--mud-palette-secondary-hover) !important}}.hover\:mud-secondary-hover:focus-visible,.hover\:mud-secondary-hover:active{background-color:var(--mud-palette-secondary-hover) !important}.mud-border-secondary{border-color:var(--mud-palette-secondary) !important}.mud-theme-secondary{color:var(--mud-palette-secondary-text) !important;background-color:var(--mud-palette-secondary) !important}.mud-tertiary{background-color:var(--mud-palette-tertiary) !important}.mud-tertiary-text{color:var(--mud-palette-tertiary) !important;--mud-ripple-color: var(--mud-palette-tertiary) !important}.mud-tertiary-hover{background-color:var(--mud-palette-tertiary-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-tertiary-hover:hover{background-color:var(--mud-palette-tertiary-hover) !important}}.hover\:mud-tertiary-hover:focus-visible,.hover\:mud-tertiary-hover:active{background-color:var(--mud-palette-tertiary-hover) !important}.mud-border-tertiary{border-color:var(--mud-palette-tertiary) !important}.mud-theme-tertiary{color:var(--mud-palette-tertiary-text) !important;background-color:var(--mud-palette-tertiary) !important}.mud-info{background-color:var(--mud-palette-info) !important}.mud-info-text{color:var(--mud-palette-info) !important;--mud-ripple-color: var(--mud-palette-info) !important}.mud-info-hover{background-color:var(--mud-palette-info-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-info-hover:hover{background-color:var(--mud-palette-info-hover) !important}}.hover\:mud-info-hover:focus-visible,.hover\:mud-info-hover:active{background-color:var(--mud-palette-info-hover) !important}.mud-border-info{border-color:var(--mud-palette-info) !important}.mud-theme-info{color:var(--mud-palette-info-text) !important;background-color:var(--mud-palette-info) !important}.mud-success{background-color:var(--mud-palette-success) !important}.mud-success-text{color:var(--mud-palette-success) !important;--mud-ripple-color: var(--mud-palette-success) !important}.mud-success-hover{background-color:var(--mud-palette-success-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-success-hover:hover{background-color:var(--mud-palette-success-hover) !important}}.hover\:mud-success-hover:focus-visible,.hover\:mud-success-hover:active{background-color:var(--mud-palette-success-hover) !important}.mud-border-success{border-color:var(--mud-palette-success) !important}.mud-theme-success{color:var(--mud-palette-success-text) !important;background-color:var(--mud-palette-success) !important}.mud-warning{background-color:var(--mud-palette-warning) !important}.mud-warning-text{color:var(--mud-palette-warning) !important;--mud-ripple-color: var(--mud-palette-warning) !important}.mud-warning-hover{background-color:var(--mud-palette-warning-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-warning-hover:hover{background-color:var(--mud-palette-warning-hover) !important}}.hover\:mud-warning-hover:focus-visible,.hover\:mud-warning-hover:active{background-color:var(--mud-palette-warning-hover) !important}.mud-border-warning{border-color:var(--mud-palette-warning) !important}.mud-theme-warning{color:var(--mud-palette-warning-text) !important;background-color:var(--mud-palette-warning) !important}.mud-error{background-color:var(--mud-palette-error) !important}.mud-error-text{color:var(--mud-palette-error) !important;--mud-ripple-color: var(--mud-palette-error) !important}.mud-error-hover{background-color:var(--mud-palette-error-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-error-hover:hover{background-color:var(--mud-palette-error-hover) !important}}.hover\:mud-error-hover:focus-visible,.hover\:mud-error-hover:active{background-color:var(--mud-palette-error-hover) !important}.mud-border-error{border-color:var(--mud-palette-error) !important}.mud-theme-error{color:var(--mud-paleLine truncated
|
*/.mud-primary{background-color:var(--mud-palette-primary) !important}.mud-primary-text{color:var(--mud-palette-primary) !important;--mud-ripple-color: var(--mud-palette-primary) !important}.mud-primary-hover{background-color:var(--mud-palette-primary-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-primary-hover:hover{background-color:var(--mud-palette-primary-hover) !important}}.hover\:mud-primary-hover:focus-visible,.hover\:mud-primary-hover:active{background-color:var(--mud-palette-primary-hover) !important}.mud-border-primary{border-color:var(--mud-palette-primary) !important}.mud-theme-primary{color:var(--mud-palette-primary-text) !important;background-color:var(--mud-palette-primary) !important}.mud-secondary{background-color:var(--mud-palette-secondary) !important}.mud-secondary-text{color:var(--mud-palette-secondary) !important;--mud-ripple-color: var(--mud-palette-secondary) !important}.mud-secondary-hover{background-color:var(--mud-palette-secondary-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-secondary-hover:hover{background-color:var(--mud-palette-secondary-hover) !important}}.hover\:mud-secondary-hover:focus-visible,.hover\:mud-secondary-hover:active{background-color:var(--mud-palette-secondary-hover) !important}.mud-border-secondary{border-color:var(--mud-palette-secondary) !important}.mud-theme-secondary{color:var(--mud-palette-secondary-text) !important;background-color:var(--mud-palette-secondary) !important}.mud-tertiary{background-color:var(--mud-palette-tertiary) !important}.mud-tertiary-text{color:var(--mud-palette-tertiary) !important;--mud-ripple-color: var(--mud-palette-tertiary) !important}.mud-tertiary-hover{background-color:var(--mud-palette-tertiary-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-tertiary-hover:hover{background-color:var(--mud-palette-tertiary-hover) !important}}.hover\:mud-tertiary-hover:focus-visible,.hover\:mud-tertiary-hover:active{background-color:var(--mud-palette-tertiary-hover) !important}.mud-border-tertiary{border-color:var(--mud-palette-tertiary) !important}.mud-theme-tertiary{color:var(--mud-palette-tertiary-text) !important;background-color:var(--mud-palette-tertiary) !important}.mud-info{background-color:var(--mud-palette-info) !important}.mud-info-text{color:var(--mud-palette-info) !important;--mud-ripple-color: var(--mud-palette-info) !important}.mud-info-hover{background-color:var(--mud-palette-info-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-info-hover:hover{background-color:var(--mud-palette-info-hover) !important}}.hover\:mud-info-hover:focus-visible,.hover\:mud-info-hover:active{background-color:var(--mud-palette-info-hover) !important}.mud-border-info{border-color:var(--mud-palette-info) !important}.mud-theme-info{color:var(--mud-palette-info-text) !important;background-color:var(--mud-palette-info) !important}.mud-success{background-color:var(--mud-palette-success) !important}.mud-success-text{color:var(--mud-palette-success) !important;--mud-ripple-color: var(--mud-palette-success) !important}.mud-success-hover{background-color:var(--mud-palette-success-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-success-hover:hover{background-color:var(--mud-palette-success-hover) !important}}.hover\:mud-success-hover:focus-visible,.hover\:mud-success-hover:active{background-color:var(--mud-palette-success-hover) !important}.mud-border-success{border-color:var(--mud-palette-success) !important}.mud-theme-success{color:var(--mud-palette-success-text) !important;background-color:var(--mud-palette-success) !important}.mud-warning{background-color:var(--mud-palette-warning) !important}.mud-warning-text{color:var(--mud-palette-warning) !important;--mud-ripple-color: var(--mud-palette-warning) !important}.mud-warning-hover{background-color:var(--mud-palette-warning-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-warning-hover:hover{background-color:var(--mud-palette-warning-hover) !important}}.hover\:mud-warning-hover:focus-visible,.hover\:mud-warning-hover:active{background-color:var(--mud-palette-warning-hover) !important}.mud-border-warning{border-color:var(--mud-palette-warning) !important}.mud-theme-warning{color:var(--mud-palette-warning-text) !important;background-color:var(--mud-palette-warning) !important}.mud-error{background-color:var(--mud-palette-error) !important}.mud-error-text{color:var(--mud-palette-error) !important;--mud-ripple-color: var(--mud-palette-error) !important}.mud-error-hover{background-color:var(--mud-palette-error-hover) !important}@media(hover: hover)and (pointer: fine){.hover\:mud-error-hover:hover{background-color:var(--mud-palette-error-hover) !important}}.hover\:mud-error-hover:focus-visible,.hover\:mud-error-hover:active{background-color:var(--mud-palette-error-hover) !important}.mud-border-error{border-color:var(--mud-palette-error) !important}.mud-theme-error{color:var(--mud-paleLine truncated
|
||||||
Binary file not shown.
Binary file not shown.
+234
-166
@@ -1,5 +1,27 @@
|
|||||||
|
|
||||||
class MudThrottledEventManager{constructor(){this.mapper={};}
|
class MudInput{resetValue(id){const input=document.getElementById(id);if(input){input.value='';}}
|
||||||
|
focusInput(elementId){const input=document.getElementById(elementId);if(input&&document.activeElement!==input){input.focus();input.click();}}}
|
||||||
|
window.mudInput=new MudInput();class MudScrollSpy{constructor(){this.lastKnowElement=null;this.handlerRef=null;}
|
||||||
|
spying(dotnetReference,containerSelector,sectionClassSelector){this.lastKnowElement=null;this.handlerRef=this.handleScroll.bind(this,dotnetReference,containerSelector,sectionClassSelector);document.addEventListener('scroll',this.handlerRef,true);window.addEventListener('resize',this.handlerRef,true);}
|
||||||
|
handleScroll(dotnetReference,containerSelector,sectionClassSelector,event){const container=document.querySelector(containerSelector);if(container===null){return;}
|
||||||
|
const elements=document.getElementsByClassName(sectionClassSelector);if(elements.length===0){return;}
|
||||||
|
const containerTop=container.tagName==='HTML'?0:container.getBoundingClientRect().top;const containerHeight=container.clientHeight;const center=containerTop+containerHeight/2.0;let minDifference=Number.MAX_SAFE_INTEGER;let foundAbove=false;let elementId='';for(let i=0;i<elements.length;i++){const element=elements[i];const rect=element.getBoundingClientRect();const diff=Math.abs(rect.top-center);if(!foundAbove&&rect.top<center){foundAbove=true;minDifference=diff;elementId=element.id;continue;}
|
||||||
|
if(foundAbove&&rect.top>=center){continue;}
|
||||||
|
if(diff<minDifference){minDifference=diff;elementId=element.id;}}
|
||||||
|
if(elementId!==this.lastKnowElement){this.lastKnowElement=elementId;history.replaceState(null,'',window.location.pathname+"#"+elementId);dotnetReference.invokeMethodAsync('SectionChangeOccured',elementId);}}
|
||||||
|
activateSection(sectionId){const element=document.getElementById(sectionId);if(element){this.lastKnowElement=sectionId;history.replaceState(null,'',window.location.pathname+"#"+sectionId);}}
|
||||||
|
scrollToSection(sectionId){if(sectionId){let element=document.getElementById(sectionId);if(element){element.scrollIntoView({behavior:'smooth',block:'center',inline:'start'});}}
|
||||||
|
else{window.scrollTo({top:0,behavior:'smooth'});}}
|
||||||
|
unspy(){document.removeEventListener('scroll',this.handlerRef,true);window.removeEventListener('resize',this.handlerRef,true);}};window.mudScrollSpy=new MudScrollSpy();class MudScrollManager{constructor(){this._lockCount=0;}
|
||||||
|
scrollToYear(elementId,offset){let element=document.getElementById(elementId);if(element){element.parentNode.scrollTop=element.offsetTop-element.parentNode.offsetTop-element.scrollHeight*3;}}
|
||||||
|
scrollToListItem(elementId){let element=document.getElementById(elementId);if(element){let parent=element.parentElement;if(parent){parent.scrollTop=element.offsetTop;}}}
|
||||||
|
scrollTo(selector,left,top,behavior){let element=document.querySelector(selector)||document.documentElement;element.scrollTo({left,top,behavior});}
|
||||||
|
scrollIntoView(selector,behavior){let element=document.querySelector(selector)||document.documentElement;if(element)
|
||||||
|
element.scrollIntoView({behavior,block:'center',inline:'start'});}
|
||||||
|
scrollToBottom(selector,behavior){let element=document.querySelector(selector);if(element){element.scrollTo({top:element.scrollHeight,behavior:behavior});}else{window.scrollTo({top:document.body.scrollHeight,behavior:behavior});}}
|
||||||
|
lockScroll(selector,lockclass){if(this._lockCount===0){const element=document.querySelector(selector)||document.body;const hasScrollBar=window.innerWidth>document.body.clientWidth;const classToAdd=hasScrollBar?lockclass:lockclass+"-no-padding";element.classList.add(classToAdd);}
|
||||||
|
this._lockCount++;}
|
||||||
|
unlockScroll(selector,lockclass){this._lockCount=Math.max(0,this._lockCount-1);if(this._lockCount===0){const element=document.querySelector(selector)||document.body;element.classList.remove(lockclass);element.classList.remove(lockclass+"-no-padding");}}};window.mudScrollManager=new MudScrollManager();class MudThrottledEventManager{constructor(){this.mapper={};}
|
||||||
subscribe(eventName,elementId,projection,throotleInterval,key,properties,dotnetReference){const handlerRef=this.throttleEventHandler.bind(this,key);let elem=document.getElementById(elementId);if(elem){elem.addEventListener(eventName,handlerRef,false);let projector=null;if(projection){const parts=projection.split('.');let functionPointer=window;let functionReferenceFound=true;if(parts.length==0||parts.length==1){functionPointer=functionPointer[projection];}
|
subscribe(eventName,elementId,projection,throotleInterval,key,properties,dotnetReference){const handlerRef=this.throttleEventHandler.bind(this,key);let elem=document.getElementById(elementId);if(elem){elem.addEventListener(eventName,handlerRef,false);let projector=null;if(projection){const parts=projection.split('.');let functionPointer=window;let functionReferenceFound=true;if(parts.length==0||parts.length==1){functionPointer=functionPointer[projection];}
|
||||||
else{for(let i=0;i<parts.length;i++){functionPointer=functionPointer[parts[i]];if(!functionPointer){functionReferenceFound=false;break;}}}
|
else{for(let i=0;i<parts.length;i++){functionPointer=functionPointer[parts[i]];if(!functionPointer){functionReferenceFound=false;break;}}}
|
||||||
if(functionReferenceFound===true){projector=functionPointer;}}
|
if(functionReferenceFound===true){projector=functionPointer;}}
|
||||||
@@ -16,7 +38,64 @@ if(entry.projection){if(typeof entry.projection==="function"){entry.projection.a
|
|||||||
entry.reference.invokeMethodAsync('OnEventOccur',key,JSON.stringify(eventEntry));}
|
entry.reference.invokeMethodAsync('OnEventOccur',key,JSON.stringify(eventEntry));}
|
||||||
unsubscribe(key){const entry=this.mapper[key];if(!entry){return;}
|
unsubscribe(key){const entry=this.mapper[key];if(!entry){return;}
|
||||||
entry.reference=null;if(document==entry.elementId){document.removeEventListener(entry.eventName,entry.handler,false);}else{const elem=document.getElementById(entry.elementId);if(elem){elem.removeEventListener(entry.eventName,entry.handler,false);}}
|
entry.reference=null;if(document==entry.elementId){document.removeEventListener(entry.eventName,entry.handler,false);}else{const elem=document.getElementById(entry.elementId);if(elem){elem.removeEventListener(entry.eventName,entry.handler,false);}}
|
||||||
delete this.mapper[key];}};window.mudThrottledEventManager=new MudThrottledEventManager();window.mudEventProjections={correctOffset:function(eventEntry,event){var target=event.target.getBoundingClientRect();eventEntry.offsetX=event.clientX-target.x;eventEntry.offsetY=event.clientY-target.y;}};class MudElementReference{constructor(){this.listenerId=0;this.eventListeners={};}
|
delete this.mapper[key];}};window.mudThrottledEventManager=new MudThrottledEventManager();window.mudEventProjections={correctOffset:function(eventEntry,event){var target=event.target.getBoundingClientRect();eventEntry.offsetX=event.clientX-target.x;eventEntry.offsetY=event.clientY-target.y;}};class MudPointerEventsNone{constructor(){this.dotnet=null;this.logger=(msg,...args)=>{};this.pointerDownHandlerRef=null;this.pointerUpHandlerRef=null;this.pointerDownMap=new Map();this.pointerUpMap=new Map();}
|
||||||
|
listenForPointerEvents(dotNetReference,elementId,options){if(!options){this.logger("options object is required but was not provided");return;}
|
||||||
|
if(options.enableLogging){this.logger=(msg,...args)=>console.log("[MudBlazor | PointerEventsNone]",msg,...args);}else{this.logger=(msg,...args)=>{};}
|
||||||
|
this.logger("Called listenForPointerEvents",{dotNetReference,elementId,options});if(!dotNetReference){this.logger("dotNetReference is required but was not provided");return;}
|
||||||
|
if(!elementId){this.logger("elementId is required but was not provided");return;}
|
||||||
|
if(!options.subscribeDown&&!options.subscribeUp){this.logger("No subscriptions added: both subscribeDown and subscribeUp are false");return;}
|
||||||
|
if(!this.dotnet){this.dotnet=dotNetReference;}
|
||||||
|
if(options.subscribeDown){this.logger("Subscribing to 'pointerdown' for element:",elementId);this.pointerDownMap.set(elementId,options);if(!this.pointerDownHandlerRef){this.logger("Registering global 'pointerdown' event listener");this.pointerDownHandlerRef=this.pointerDownHandler.bind(this);document.addEventListener("pointerdown",this.pointerDownHandlerRef,false);}}
|
||||||
|
if(options.subscribeUp){this.logger("Subscribing to 'pointerup' events for element:",elementId);this.pointerUpMap.set(elementId,options);if(!this.pointerUpHandlerRef){this.logger("Registering global 'pointerup' event listener");this.pointerUpHandlerRef=this.pointerUpHandler.bind(this);document.addEventListener("pointerup",this.pointerUpHandlerRef,false);}}}
|
||||||
|
pointerDownHandler(event){this._handlePointerEvent(event,this.pointerDownMap,"RaiseOnPointerDown");}
|
||||||
|
pointerUpHandler(event){this._handlePointerEvent(event,this.pointerUpMap,"RaiseOnPointerUp");}
|
||||||
|
_handlePointerEvent(event,map,raiseMethod){if(map.size===0){this.logger("No elements registered for",raiseMethod);return;}
|
||||||
|
const elements=[];for(const id of map.keys()){const element=document.getElementById(id);if(element){elements.push(element);}else{this.logger("Element",id,"not found in DOM");}}
|
||||||
|
if(elements.length===0){this.logger("None of the registered elements were found in the DOM for",raiseMethod);return;}
|
||||||
|
elements.forEach(x=>x.style.pointerEvents="auto");const elementsFromPoint=document.elementsFromPoint(event.clientX,event.clientY);elements.forEach(x=>x.style.pointerEvents="none");const matchingIds=[];for(const element of elementsFromPoint){if(!element.id||!map.has(element.id)){break;}
|
||||||
|
matchingIds.push(element.id);}
|
||||||
|
if(matchingIds.length===0){this.logger("No matching registered elements found under pointer for",raiseMethod);return;}
|
||||||
|
this.logger("Raising",raiseMethod,"for matching element(s):",matchingIds);this.dotnet.invokeMethodAsync(raiseMethod,matchingIds);}
|
||||||
|
cancelListener(elementId){if(!elementId){this.logger("cancelListener called with invalid elementId");return;}
|
||||||
|
const hadDown=this.pointerDownMap.delete(elementId);const hadUp=this.pointerUpMap.delete(elementId);if(hadDown||hadUp){this.logger("Cancelled listener for element",elementId);}else{this.logger("No active listener found for element",elementId);}
|
||||||
|
if(this.pointerDownMap.size===0&&this.pointerDownHandlerRef){this.logger("No more elements listening for 'pointerdown' — removing global event listener");document.removeEventListener("pointerdown",this.pointerDownHandlerRef);this.pointerDownHandlerRef=null;}
|
||||||
|
if(this.pointerUpMap.size===0&&this.pointerUpHandlerRef){this.logger("No more elements listening for 'pointerup' — removing global event listener");document.removeEventListener("pointerup",this.pointerUpHandlerRef);this.pointerUpHandlerRef=null;}}
|
||||||
|
dispose(){if(!this.dotnet&&!this.pointerDownHandlerRef&&!this.pointerUpHandlerRef){this.logger("dispose() called but instance was already cleaned up");return;}
|
||||||
|
this.logger("Disposing");if(this.pointerDownHandlerRef){this.logger("Removing global 'pointerdown' event listener");document.removeEventListener("pointerdown",this.pointerDownHandlerRef);this.pointerDownHandlerRef=null;}
|
||||||
|
if(this.pointerUpHandlerRef){this.logger("Removing global 'pointerup' event listener");document.removeEventListener("pointerup",this.pointerUpHandlerRef);this.pointerUpHandlerRef=null;}
|
||||||
|
const downCount=this.pointerDownMap.size;const upCount=this.pointerUpMap.size;if(downCount>0){this.logger("Clearing",downCount,"element(s) from pointerDownMap");}
|
||||||
|
if(upCount>0){this.logger("Clearing",upCount,"element(s) from pointerUpMap");}
|
||||||
|
this.pointerDownMap.clear();this.pointerUpMap.clear();this.dotnet=null;}}
|
||||||
|
window.mudPointerEventsNone=new MudPointerEventsNone();window.mudDragAndDrop={initDropZone:(id)=>{const elem=document.getElementById(id);elem.addEventListener('dragover',()=>event.preventDefault());elem.addEventListener('dragstart',()=>event.dataTransfer.setData('',event.target.id));},makeDropZonesNotRelative:()=>{var firstDropItems=Array.from(document.getElementsByClassName('mud-drop-item')).filter(x=>x.getAttribute('index')=="-1");for(let dropItem of firstDropItems){dropItem.style.position='static';}
|
||||||
|
const dropZones=document.getElementsByClassName('mud-drop-zone');for(let dropZone of dropZones){dropZone.style.position='unset';}},getDropZoneIdentifierOnPosition:(x,y)=>{const elems=document.elementsFromPoint(x,y);const dropZones=elems.filter(e=>e.classList.contains('mud-drop-zone'))
|
||||||
|
const dropZone=dropZones[0];if(dropZone){return dropZone.getAttribute('identifier')||"";}
|
||||||
|
return"";},getDropIndexOnPosition:(x,y,id)=>{const elems=document.elementsFromPoint(x,y);const dropItems=elems.filter(e=>e.classList.contains('mud-drop-item')&&e.id!=id)
|
||||||
|
const dropItem=dropItems[0];if(dropItem){return dropItem.getAttribute('index')||"";}
|
||||||
|
return"";},makeDropZonesRelative:()=>{const dropZones=document.getElementsByClassName('mud-drop-zone');for(let dropZone of dropZones){dropZone.style.position='relative';}
|
||||||
|
var firstDropItems=Array.from(document.getElementsByClassName('mud-drop-item')).filter(x=>x.getAttribute('index')=="-1");for(let dropItem of firstDropItems){dropItem.style.position='relative';}},moveItemByDifference:(id,dx,dy)=>{const elem=document.getElementById(id);var tx=(parseFloat(elem.getAttribute('data-x'))||0)+dx;var ty=(parseFloat(elem.getAttribute('data-y'))||0)+dy;elem.style.webkitTransform=elem.style.transform='translate3d('+tx+'px, '+ty+'px, 10px)';elem.setAttribute('data-x',tx);elem.setAttribute('data-y',ty);},resetItem:(id)=>{const elem=document.getElementById(id);if(elem){elem.style.webkitTransform=elem.style.transform='';elem.setAttribute('data-x',0);elem.setAttribute('data-y',0);}}};class MudFileUpload{openFilePicker(id){const element=document.getElementById(id);if(!element){return;}
|
||||||
|
try{element.showPicker();}catch(error){element.click();}}}
|
||||||
|
window.mudFileUpload=new MudFileUpload();class MudResizeListener{constructor(id){this.logger=function(message){};this.options={};this.throttleResizeHandlerId=-1;this.dotnet=undefined;this.breakpoint=-1;this.id=id;this.handleResize=this.throttleResizeHandler.bind(this);}
|
||||||
|
listenForResize(dotnetRef,options){if(this.dotnet){this.options=options;return;}
|
||||||
|
this.options=options;this.dotnet=dotnetRef;this.logger=options.enableLogging?console.log:(message)=>{};this.logger(`[MudBlazor]Reporting resize events at rate of:${this.options.reportRate}ms`);window.addEventListener("resize",this.handleResize,false);if(!this.options.suppressInitEvent){this.resizeHandler();}
|
||||||
|
this.breakpoint=this.getBreakpoint(window.innerWidth);}
|
||||||
|
throttleResizeHandler(){clearTimeout(this.throttleResizeHandlerId);this.throttleResizeHandlerId=window.setTimeout(this.resizeHandler.bind(this),this.options.reportRate);}
|
||||||
|
resizeHandler(){if(this.options.notifyOnBreakpointOnly){let bp=this.getBreakpoint(window.innerWidth);if(bp==this.breakpoint){return;}
|
||||||
|
this.breakpoint=bp;}
|
||||||
|
try{if(this.id){this.dotnet.invokeMethodAsync('RaiseOnResized',{height:window.innerHeight,width:window.innerWidth},this.getBreakpoint(window.innerWidth),this.id);}
|
||||||
|
else{this.dotnet.invokeMethodAsync('RaiseOnResized',{height:window.innerHeight,width:window.innerWidth},this.getBreakpoint(window.innerWidth));}}catch(error){this.logger("[MudBlazor] Error in resizeHandler:",{error});}}
|
||||||
|
cancelListener(){this.dotnet=undefined;window.removeEventListener("resize",this.handleResize);}
|
||||||
|
matchMedia(query){let m=window.matchMedia(query).matches;return m;}
|
||||||
|
getBrowserWindowSize(){return{height:window.innerHeight,width:window.innerWidth};}
|
||||||
|
getBreakpoint(width){if(width>=this.options.breakpointDefinitions["Xxl"])
|
||||||
|
return 5;else if(width>=this.options.breakpointDefinitions["Xl"])
|
||||||
|
return 4;else if(width>=this.options.breakpointDefinitions["Lg"])
|
||||||
|
return 3;else if(width>=this.options.breakpointDefinitions["Md"])
|
||||||
|
return 2;else if(width>=this.options.breakpointDefinitions["Sm"])
|
||||||
|
return 1;else
|
||||||
|
return 0;}};window.mudResizeListener=new MudResizeListener();window.mudResizeListenerFactory={mapping:{},listenForResize:(dotnetRef,options,id)=>{var map=window.mudResizeListenerFactory.mapping;if(map[id]){return;}
|
||||||
|
var listener=new MudResizeListener(id);listener.listenForResize(dotnetRef,options);map[id]=listener;},cancelListener:(id)=>{var map=window.mudResizeListenerFactory.mapping;if(!map[id]){return;}
|
||||||
|
var listener=map[id];listener.cancelListener();delete map[id];},cancelListeners:(ids)=>{for(let i=0;i<ids.length;i++){window.mudResizeListenerFactory.cancelListener(ids[i]);}},dispose(){var map=window.mudResizeListenerFactory.mapping;for(var id in map){window.mudResizeListenerFactory.cancelListener(id);}}}
|
||||||
|
class MudElementReference{constructor(){this.listenerId=0;this.eventListeners={};}
|
||||||
focus(element){if(element)
|
focus(element){if(element)
|
||||||
{element.focus();}}
|
{element.focus();}}
|
||||||
blur(element){if(element){element.blur();}}
|
blur(element){if(element){element.blur();}}
|
||||||
@@ -48,46 +127,145 @@ removeDefaultPreventingHandler(element,eventName,listenerId){this.removeEventLis
|
|||||||
addDefaultPreventingHandlers(element,eventNames){let listeners=[];for(const eventName of eventNames){let listenerId=this.addDefaultPreventingHandler(element,eventName);listeners.push(listenerId);}
|
addDefaultPreventingHandlers(element,eventNames){let listeners=[];for(const eventName of eventNames){let listenerId=this.addDefaultPreventingHandler(element,eventName);listeners.push(listenerId);}
|
||||||
return listeners;}
|
return listeners;}
|
||||||
removeDefaultPreventingHandlers(element,eventNames,listenerIds){for(let index=0;index<eventNames.length;++index){const eventName=eventNames[index];const listenerId=listenerIds[index];this.removeDefaultPreventingHandler(element,eventName,listenerId);}}
|
removeDefaultPreventingHandlers(element,eventNames,listenerIds){for(let index=0;index<eventNames.length;++index){const eventName=eventNames[index];const listenerId=listenerIds[index];this.removeDefaultPreventingHandler(element,eventName,listenerId);}}
|
||||||
addOnBlurEvent(element,dotNetReference){element._mudBlurHandler=function(e){if(!element)return;e.preventDefault();element.blur();if(dotNetReference){dotNetReference.invokeMethodAsync('CallOnBlurredAsync');}
|
addOnBlurEvent(element,dotNetReference){if(!element)return;element._mudBlurHandler=function(e){if(!element||!document.contains(element)){window.mudElementRef.removeOnBlurEvent(element);return;}
|
||||||
else{console.error("No dotNetReference found for iosKeyboardFocus");}}
|
e.preventDefault();if(dotNetReference){dotNetReference.invokeMethodAsync('CallOnBlurredAsync').catch(err=>{console.warn("Error invoking CallOnBlurredAsync, possibly disposed:",err);window.mudElementRef.removeOnBlurEvent(element);});}else{console.error("No dotNetReference found for iosKeyboardFocus");}};element.addEventListener('blur',element._mudBlurHandler);}
|
||||||
element.addEventListener('blur',element._mudBlurHandler);}
|
removeOnBlurEvent(element){if(!element)return;if(element._mudBlurHandler){element.removeEventListener('blur',element._mudBlurHandler);delete element._mudBlurHandler;}}};window.mudElementRef=new MudElementReference();function setRippleOffset(event,target){const rect=target.getBoundingClientRect();const x=event.clientX-rect.left-rect.width/2;const y=event.clientY-rect.top-rect.height/2;target.style.setProperty("--mud-ripple-offset-x",`${x}px`);target.style.setProperty("--mud-ripple-offset-y",`${y}px`);}
|
||||||
removeOnBlurEvent(element,dotnetRef){if(!element||!element._mudBlurHandler)return;element.removeEventListener('blur',element._mudBlurHandler);delete element._mudBlurHandler;}};window.mudElementRef=new MudElementReference();const darkThemeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)");window.darkModeChange=()=>{return darkThemeMediaQuery.matches;};function darkModeChangeListener(e){dotNetHelperTheme.invokeMethodAsync('SystemPreferenceChanged',e.matches);}
|
document.addEventListener("click",function(event){const target=event.target.closest(".mud-ripple");if(target){setRippleOffset(event,target);}});window.mudTimePicker={initPointerEvents:(clock,dotNetHelper)=>{let isPointerDown=false;const startHandler=(event)=>{if(event.button!==0){return;}
|
||||||
function watchDarkThemeMedia(dotNetHelper){dotNetHelperTheme=dotNetHelper;darkThemeMediaQuery.addEventListener('change',darkModeChangeListener);}
|
isPointerDown=true;event.target.releasePointerCapture(event.pointerId);if(event.target.classList.contains('mud-hour')||event.target.classList.contains('mud-minute')){let attributeValue=event.target.getAttribute('data-stick-value');let stickValue=attributeValue?parseInt(attributeValue):-1;dotNetHelper.invokeMethodAsync('SelectTimeFromStick',stickValue,false);}
|
||||||
function stopWatchingDarkThemeMedia(){darkThemeMediaQuery.removeEventListener('change',darkModeChangeListener);}
|
event.preventDefault();};const endHandler=(event)=>{if(event.button!==0){return;}
|
||||||
class MudScrollManager{scrollToYear(elementId,offset){let element=document.getElementById(elementId);if(element){element.parentNode.scrollTop=element.offsetTop-element.parentNode.offsetTop-element.scrollHeight*3;}}
|
isPointerDown=false;if(event.target.classList.contains('mud-hour')||event.target.classList.contains('mud-minute')){let attributeValue=event.target.getAttribute('data-stick-value');let stickValue=attributeValue?parseInt(attributeValue):-1;dotNetHelper.invokeMethodAsync('OnStickClick',stickValue);}
|
||||||
scrollToListItem(elementId){let element=document.getElementById(elementId);if(element){let parent=element.parentElement;if(parent){parent.scrollTop=element.offsetTop;}}}
|
event.preventDefault();};const moveHandler=(event)=>{if(!isPointerDown||(!event.target.classList.contains('mud-hour')&&!event.target.classList.contains('mud-minute'))){return;}
|
||||||
scrollTo(selector,left,top,behavior){let element=document.querySelector(selector)||document.documentElement;element.scrollTo({left,top,behavior});}
|
let attributeValue=event.target.getAttribute('data-stick-value');let stickValue=attributeValue?parseInt(attributeValue):-1;dotNetHelper.invokeMethodAsync('SelectTimeFromStick',stickValue,true);event.preventDefault();};clock.addEventListener('pointerdown',startHandler);clock.addEventListener('pointerup',endHandler);clock.addEventListener('pointercancel',endHandler);clock.addEventListener('pointerover',moveHandler);clock.destroy=()=>{clock.removeEventListener('pointerdown',startHandler);clock.removeEventListener('pointerup',endHandler);clock.removeEventListener('pointercancel',endHandler);clock.removeEventListener('pointerover',moveHandler);};},destroyPointerEvents:(container)=>{if(container==null){return;}
|
||||||
scrollIntoView(selector,behavior){let element=document.querySelector(selector)||document.documentElement;if(element)
|
if(typeof container.destroy==='function'){container.destroy();}}};class MudWindow{copyToClipboard(text){navigator.clipboard.writeText(text);}
|
||||||
element.scrollIntoView({behavior,block:'center',inline:'start'});}
|
|
||||||
scrollToBottom(selector,behavior){let element=document.querySelector(selector);if(element){element.scrollTo({top:element.scrollHeight,behavior:behavior});}else{window.scrollTo({top:document.body.scrollHeight,behavior:behavior});}}
|
|
||||||
lockScroll(selector,lockclass){let element=document.querySelector(selector)||document.body;let hasScrollBar=window.innerWidth>document.body.clientWidth;if(hasScrollBar){element.classList.add(lockclass);}else{let lockClassNoPadding=lockclass+"-no-padding";element.classList.add(lockClassNoPadding);}}
|
|
||||||
unlockScroll(selector,lockclass){let element=document.querySelector(selector)||document.body;element.classList.remove(lockclass);element.classList.remove(lockclass+"-no-padding");}};window.mudScrollManager=new MudScrollManager();window.getTabbableElements=(element)=>{return element.querySelectorAll("a[href]:not([tabindex='-1']),"+"area[href]:not([tabindex='-1']),"+"button:not([disabled]):not([tabindex='-1']),"+"input:not([disabled]):not([tabindex='-1']):not([type='hidden']),"+"select:not([disabled]):not([tabindex='-1']),"+"textarea:not([disabled]):not([tabindex='-1']),"+"iframe:not([tabindex='-1']),"+"details:not([tabindex='-1']),"+"[tabindex]:not([tabindex='-1']),"+"[contentEditable=true]:not([tabindex='-1'])");};window.serializeParameter=(data,spec)=>{if(typeof data=="undefined"||data===null){return null;}
|
|
||||||
if(typeof data==="number"||typeof data==="string"||typeof data=="boolean"){return data;}
|
|
||||||
let res=(Array.isArray(data))?[]:{};if(!spec){spec="*";}
|
|
||||||
for(let i in data){let currentMember=data[i];if(typeof currentMember==='function'||currentMember===null){continue;}
|
|
||||||
let currentMemberSpec;if(spec!="*"){currentMemberSpec=Array.isArray(data)?spec:spec[i];if(!currentMemberSpec){continue;}}else{currentMemberSpec="*"}
|
|
||||||
if(typeof currentMember==='object'){if(Array.isArray(currentMember)||currentMember.length){res[i]=[];for(let j=0;j<currentMember.length;j++){const arrayItem=currentMember[j];if(typeof arrayItem==='object'){res[i].push(this.serializeParameter(arrayItem,currentMemberSpec));}else{res[i].push(arrayItem);}}}else{if(currentMember.length===0){res[i]=[];}else{res[i]=this.serializeParameter(currentMember,currentMemberSpec);}}}else{if(currentMember===Infinity){currentMember="Infinity";}
|
|
||||||
if(currentMember!==null){res[i]=currentMember;}}}
|
|
||||||
return res;};window.mudGetSvgBBox=(svgElement)=>{if(svgElement==null)return null;const bbox=svgElement.getBBox();return{x:bbox.x,y:bbox.y,width:bbox.width,height:bbox.height};};window.mudObserveElementSize=(dotNetReference,element,functionName='OnElementSizeChanged',debounceMillis=200)=>{if(!element)return;let lastNotifiedTime=0;let scheduledCall=null;const throttledNotify=(width,height)=>{const timestamp=Date.now();const timeSinceLast=timestamp-lastNotifiedTime;if(timeSinceLast>=debounceMillis){lastNotifiedTime=timestamp;try{dotNetReference.invokeMethodAsync(functionName,{width,height,timestamp});}
|
|
||||||
catch(error){this.logger("[MudBlazor] Error in mudObserveElementSize:",{error});}}else{if(scheduledCall!==null){clearTimeout(scheduledCall);}
|
|
||||||
scheduledCall=setTimeout(()=>{lastNotifiedTime=Date.now();scheduledCall=null;try{dotNetReference.invokeMethodAsync(functionName,{width,height,timestamp});}
|
|
||||||
catch(error){this.logger("[MudBlazor] Error in mudObserveElementSize:",{error});}},debounceMillis-timeSinceLast);}};const resizeObserver=new ResizeObserver(entries=>{if(element.isConnected===false){return;}
|
|
||||||
let width=element.clientWidth;let height=element.clientHeight;for(const entry of entries){width=entry.contentRect.width;height=entry.contentRect.height;}
|
|
||||||
width=Math.floor(width);height=Math.floor(height);throttledNotify(width,height);});resizeObserver.observe(element);let mutationObserver=null;const parent=element.parentNode;if(parent){mutationObserver=new MutationObserver(mutations=>{for(const mutation of mutations){for(const removedNode of mutation.removedNodes){if(removedNode===element){cleanup();}}}});mutationObserver.observe(parent,{childList:true});}
|
|
||||||
function cleanup(){resizeObserver.disconnect();if(mutationObserver){mutationObserver.disconnect();}
|
|
||||||
if(scheduledCall!==null){clearTimeout(scheduledCall);}}
|
|
||||||
return{width:element.clientWidth,height:element.clientHeight};};window.mudDragAndDrop={initDropZone:(id)=>{const elem=document.getElementById(id);elem.addEventListener('dragover',()=>event.preventDefault());elem.addEventListener('dragstart',()=>event.dataTransfer.setData('',event.target.id));},makeDropZonesNotRelative:()=>{var firstDropItems=Array.from(document.getElementsByClassName('mud-drop-item')).filter(x=>x.getAttribute('index')=="-1");for(let dropItem of firstDropItems){dropItem.style.position='static';}
|
|
||||||
const dropZones=document.getElementsByClassName('mud-drop-zone');for(let dropZone of dropZones){dropZone.style.position='unset';}},getDropZoneIdentifierOnPosition:(x,y)=>{const elems=document.elementsFromPoint(x,y);const dropZones=elems.filter(e=>e.classList.contains('mud-drop-zone'))
|
|
||||||
const dropZone=dropZones[0];if(dropZone){return dropZone.getAttribute('identifier')||"";}
|
|
||||||
return"";},getDropIndexOnPosition:(x,y,id)=>{const elems=document.elementsFromPoint(x,y);const dropItems=elems.filter(e=>e.classList.contains('mud-drop-item')&&e.id!=id)
|
|
||||||
const dropItem=dropItems[0];if(dropItem){return dropItem.getAttribute('index')||"";}
|
|
||||||
return"";},makeDropZonesRelative:()=>{const dropZones=document.getElementsByClassName('mud-drop-zone');for(let dropZone of dropZones){dropZone.style.position='relative';}
|
|
||||||
var firstDropItems=Array.from(document.getElementsByClassName('mud-drop-item')).filter(x=>x.getAttribute('index')=="-1");for(let dropItem of firstDropItems){dropItem.style.position='relative';}},moveItemByDifference:(id,dx,dy)=>{const elem=document.getElementById(id);var tx=(parseFloat(elem.getAttribute('data-x'))||0)+dx;var ty=(parseFloat(elem.getAttribute('data-y'))||0)+dy;elem.style.webkitTransform=elem.style.transform='translate3d('+tx+'px, '+ty+'px, 10px)';elem.setAttribute('data-x',tx);elem.setAttribute('data-y',ty);},resetItem:(id)=>{const elem=document.getElementById(id);if(elem){elem.style.webkitTransform=elem.style.transform='';elem.setAttribute('data-x',0);elem.setAttribute('data-y',0);}}};class MudWindow{copyToClipboard(text){navigator.clipboard.writeText(text);}
|
|
||||||
changeCssById(id,css){var element=document.getElementById(id);if(element){element.className=css;}}
|
changeCssById(id,css){var element=document.getElementById(id);if(element){element.className=css;}}
|
||||||
updateStyleProperty(elementId,propertyName,value){const element=document.getElementById(elementId);if(element){element.style.setProperty(propertyName,value);}}
|
updateStyleProperty(elementId,propertyName,value){const element=document.getElementById(elementId);if(element){element.style.setProperty(propertyName,value);}}
|
||||||
changeGlobalCssVariable(name,newValue){document.documentElement.style.setProperty(name,newValue);}
|
changeGlobalCssVariable(name,newValue){document.documentElement.style.setProperty(name,newValue);}
|
||||||
open(args){window.open(args);}}
|
open(args){window.open(args);}}
|
||||||
window.mudWindow=new MudWindow();class MudJsEventFactory{connect(dotNetRef,elementId,options){if(!elementId)
|
window.mudWindow=new MudWindow();window.mudpopoverHelper={mainContainerClass:null,overflowPadding:24,flipMargin:0,debounce:function(func,wait){let timeout;return function executedFunction(...args){const later=()=>{clearTimeout(timeout);func(...args);};clearTimeout(timeout);timeout=setTimeout(later,wait);};},basePopoverZIndex:parseInt(getComputedStyle(document.documentElement).getPropertyValue('--mud-zindex-popover'))||1200,baseTooltipZIndex:parseInt(getComputedStyle(document.documentElement).getPropertyValue('--mud-zindex-tooltip'))||1600,flipClassReplacements:{'top':{'mud-popover-top-left':'mud-popover-bottom-left','mud-popover-top-center':'mud-popover-bottom-center','mud-popover-top-right':'mud-popover-bottom-right','mud-popover-anchor-bottom-center':'mud-popover-anchor-top-center','mud-popover-anchor-bottom-left':'mud-popover-anchor-top-left','mud-popover-anchor-bottom-right':'mud-popover-anchor-top-right',},'left':{'mud-popover-top-left':'mud-popover-top-right','mud-popover-center-left':'mud-popover-center-right','mud-popover-bottom-left':'mud-popover-bottom-right','mud-popover-anchor-center-right':'mud-popover-anchor-center-left','mud-popover-anchor-bottom-right':'mud-popover-anchor-bottom-left','mud-popover-anchor-top-right':'mud-popover-anchor-top-left',},'right':{'mud-popover-top-right':'mud-popover-top-left','mud-popover-center-right':'mud-popover-center-left','mud-popover-bottom-right':'mud-popover-bottom-left','mud-popover-anchor-center-left':'mud-popover-anchor-center-right','mud-popover-anchor-bottom-left':'mud-popover-anchor-bottom-right','mud-popover-anchor-top-left':'mud-popover-anchor-top-right',},'bottom':{'mud-popover-bottom-left':'mud-popover-top-left','mud-popover-bottom-center':'mud-popover-top-center','mud-popover-bottom-right':'mud-popover-top-right','mud-popover-anchor-top-center':'mud-popover-anchor-bottom-center','mud-popover-anchor-top-left':'mud-popover-anchor-bottom-left','mud-popover-anchor-top-right':'mud-popover-anchor-bottom-right',},'top-and-left':{'mud-popover-top-left':'mud-popover-bottom-right','mud-popover-anchor-bottom-right':'mud-popover-anchor-top-left','mud-popover-anchor-bottom-center':'mud-popover-anchor-top-center','mud-popover-anchor-bottom-left':'mud-popover-anchor-top-right','mud-popover-anchor-top-right':'mud-popover-anchor-bottom-left','mud-popover-anchor-top-center':'mud-popover-anchor-bottom-center','mud-popover-anchor-top-left':'mud-popover-anchor-bottom-right',},'top-and-right':{'mud-popover-top-right':'mud-popover-bottom-left','mud-popover-anchor-bottom-left':'mud-popover-anchor-top-right','mud-popover-anchor-bottom-center':'mud-popover-anchor-top-center','mud-popover-anchor-bottom-right':'mud-popover-anchor-top-left','mud-popover-anchor-top-left':'mud-popover-anchor-bottom-right','mud-popover-anchor-top-center':'mud-popover-anchor-bottom-center','mud-popover-anchor-top-right':'mud-popover-anchor-bottom-left',},'bottom-and-left':{'mud-popover-bottom-left':'mud-popover-top-right','mud-popover-anchor-top-right':'mud-popover-anchor-bottom-left','mud-popover-anchor-top-center':'mud-popover-anchor-bottom-center','mud-popover-anchor-top-left':'mud-popover-anchor-bottom-right','mud-popover-anchor-bottom-right':'mud-popover-anchor-top-left','mud-popover-anchor-bottom-center':'mud-popover-anchor-top-center','mud-popover-anchor-bottom-left':'mud-popover-anchor-top-right',},'bottom-and-right':{'mud-popover-bottom-right':'mud-popover-top-left','mud-popover-anchor-top-left':'mud-popover-anchor-bottom-right','mud-popover-anchor-top-center':'mud-popover-anchor-bottom-center','mud-popover-anchor-top-right':'mud-popover-anchor-bottom-left','mud-popover-anchor-bottom-left':'mud-popover-anchor-top-right','mud-popover-anchor-bottom-center':'mud-popover-anchor-top-center','mud-popover-anchor-bottom-right':'mud-popover-anchor-top-left',},},calculatePopoverPosition:function(list,boundingRect,selfRect){let top=boundingRect.top;let left=boundingRect.left;const isPositionOverride=list.indexOf('mud-popover-position-override')>=0;let offsetX=0;let offsetY=0;if(list.indexOf('mud-popover-top-left')>=0){offsetX=0;offsetY=0;}else if(list.indexOf('mud-popover-top-center')>=0){offsetX=-selfRect.width/2;offsetY=0;}else if(list.indexOf('mud-popover-top-right')>=0){offsetX=-selfRect.width;offsetY=0;}
|
||||||
|
else if(list.indexOf('mud-popover-center-left')>=0){offsetX=0;offsetY=-selfRect.height/2;}else if(list.indexOf('mud-popover-center-center')>=0){offsetX=-selfRect.width/2;offsetY=-selfRect.height/2;}else if(list.indexOf('mud-popover-center-right')>=0){offsetX=-selfRect.width;offsetY=-selfRect.height/2;}
|
||||||
|
else if(list.indexOf('mud-popover-bottom-left')>=0){offsetX=0;offsetY=-selfRect.height;}else if(list.indexOf('mud-popover-bottom-center')>=0){offsetX=-selfRect.width/2;offsetY=-selfRect.height;}else if(list.indexOf('mud-popover-bottom-right')>=0){offsetX=-selfRect.width;offsetY=-selfRect.height;}
|
||||||
|
if(!isPositionOverride){if(list.indexOf('mud-popover-anchor-top-left')>=0){left=boundingRect.left;top=boundingRect.top;}else if(list.indexOf('mud-popover-anchor-top-center')>=0){left=boundingRect.left+boundingRect.width/2;top=boundingRect.top;}else if(list.indexOf('mud-popover-anchor-top-right')>=0){left=boundingRect.left+boundingRect.width;top=boundingRect.top;}else if(list.indexOf('mud-popover-anchor-center-left')>=0){left=boundingRect.left;top=boundingRect.top+boundingRect.height/2;}else if(list.indexOf('mud-popover-anchor-center-center')>=0){left=boundingRect.left+boundingRect.width/2;top=boundingRect.top+boundingRect.height/2;}else if(list.indexOf('mud-popover-anchor-center-right')>=0){left=boundingRect.left+boundingRect.width;top=boundingRect.top+boundingRect.height/2;}else if(list.indexOf('mud-popover-anchor-bottom-left')>=0){left=boundingRect.left;top=boundingRect.top+boundingRect.height;}else if(list.indexOf('mud-popover-anchor-bottom-center')>=0){left=boundingRect.left+boundingRect.width/2;top=boundingRect.top+boundingRect.height;}else if(list.indexOf('mud-popover-anchor-bottom-right')>=0){left=boundingRect.left+boundingRect.width;top=boundingRect.top+boundingRect.height;}}
|
||||||
|
return{top:top,left:left,offsetX:offsetX,offsetY:offsetY,anchorY:top,anchorX:left};},getPositionForFlippedPopver:function(inputArray,selector,boundingRect,selfRect){const classList=[];const replacementsList={};for(var i=0;i<inputArray.length;i++){const item=inputArray[i];const replacements=window.mudpopoverHelper.flipClassReplacements[selector][item];if(replacements){replacementsList[item]=replacements;classList.push(replacements);}
|
||||||
|
else{classList.push(item);}}
|
||||||
|
return window.mudpopoverHelper.calculatePopoverPosition(classList,boundingRect,selfRect);},isInViewport:function(node,rect){const windowHeight=(window.innerHeight||document.documentElement.clientHeight);const windowWidth=(window.innerWidth||document.documentElement.clientWidth);const isInVisibleViewport=rect.top<windowHeight&&rect.bottom>0&&rect.left<windowWidth&&rect.right>0;if(isInVisibleViewport){return true;}
|
||||||
|
let current=node.parentNode;while(current&¤t!==document.body){const style=window.getComputedStyle(current);const overflowY=style.overflowY;const overflowX=style.overflowX;const isScrollableY=(overflowY==='auto'||overflowY==='scroll')&¤t.scrollHeight>current.clientHeight;const isScrollableX=(overflowX==='auto'||overflowX==='scroll')&¤t.scrollWidth>current.clientWidth;if(isScrollableY||isScrollableX){return false;}
|
||||||
|
current=current.parentNode;}
|
||||||
|
return true;},placePopover:function(popoverNode,classSelector){if(popoverNode&&popoverNode.parentNode){const id=popoverNode.id.substr(8);const popoverContentNode=document.getElementById('popovercontent-'+id);if(!popoverContentNode)return;const classList=popoverContentNode.classList;if(!classList.contains('mud-popover-open'))return;if(classSelector&&!classList.contains(classSelector))return;let boundingRect=popoverNode.parentNode.getBoundingClientRect();if(!window.mudpopoverHelper.isInViewport(popoverNode,boundingRect)){return;}
|
||||||
|
const selfRect=popoverContentNode.getBoundingClientRect();const popoverNodeStyle=window.getComputedStyle(popoverNode);const isPositionFixed=popoverNodeStyle.position==='fixed';const isPositionOverride=classList.contains('mud-popover-position-override');const isRelativeWidth=classList.contains('mud-popover-relative-width');const isAdaptiveWidth=classList.contains('mud-popover-adaptive-width');const isFlipOnOpen=classList.contains('mud-popover-overflow-flip-onopen');const isFlipAlways=classList.contains('mud-popover-overflow-flip-always');const zIndexAuto=popoverNodeStyle.getPropertyValue('z-index')==='auto';const classListArray=Array.from(classList);if(isPositionOverride){const positiontop=parseInt(popoverContentNode.getAttribute('data-pc-y'))||boundingRect.top;const positionleft=parseInt(popoverContentNode.getAttribute('data-pc-x'))||boundingRect.left;const scrollLeft=window.scrollX;const scrollTop=window.scrollY;boundingRect={left:positionleft-scrollLeft,top:positiontop-scrollTop,right:positionleft+1,bottom:positiontop+1,width:1,height:1};}
|
||||||
|
const position=window.mudpopoverHelper.calculatePopoverPosition(classListArray,boundingRect,selfRect);let left=position.left;let top=position.top;let offsetX=position.offsetX;let offsetY=position.offsetY;let anchorY=position.anchorY;let anchorX=position.anchorX;popoverContentNode.style['max-width']='none';popoverContentNode.style['min-width']='none';if(isRelativeWidth){popoverContentNode.style['max-width']=(boundingRect.width)+'px';}
|
||||||
|
else if(isAdaptiveWidth){popoverContentNode.style['min-width']=(boundingRect.width)+'px';}
|
||||||
|
if(popoverContentNode.mudHeight&&anchorY>0&&anchorY<window.innerHeight){popoverContentNode.style.maxHeight=null;popoverContentNode.mudHeight=null;}
|
||||||
|
if(isFlipOnOpen||isFlipAlways){const appBarElements=document.getElementsByClassName("mud-appbar mud-appbar-fixed-top");let appBarOffset=0;if(appBarElements.length>0){appBarOffset=appBarElements[0].getBoundingClientRect().height;}
|
||||||
|
let selector=popoverContentNode.mudPopoverFliped;if(!selector){const popoverHeight=popoverContentNode.offsetHeight;const popoverWidth=popoverContentNode.offsetWidth;if(classList.contains('mud-popover-top-left')){const spaceBelow=window.innerHeight-anchorY-window.mudpopoverHelper.flipMargin;const spaceRight=window.innerWidth-anchorX-window.mudpopoverHelper.flipMargin;const spaceAbove=anchorY-window.mudpopoverHelper.flipMargin;const spaceLeft=anchorX-window.mudpopoverHelper.flipMargin;const shouldFlipVertical=popoverHeight>spaceBelow&&spaceAbove>spaceBelow;const shouldFlipHorizontal=popoverWidth>spaceRight&&spaceLeft>spaceRight;if(shouldFlipVertical&&shouldFlipHorizontal){selector='top-and-left';}
|
||||||
|
else if(shouldFlipVertical){selector='top';}
|
||||||
|
else if(shouldFlipHorizontal){selector='left';}}
|
||||||
|
else if(classList.contains('mud-popover-top-center')){const spaceBelow=window.innerHeight-anchorY-window.mudpopoverHelper.flipMargin;const spaceAbove=anchorY-window.mudpopoverHelper.flipMargin;if(popoverHeight>spaceBelow&&spaceAbove>spaceBelow){selector='top';}}
|
||||||
|
else if(classList.contains('mud-popover-top-right')){const spaceBelow=window.innerHeight-anchorY-window.mudpopoverHelper.flipMargin;const spaceLeft=anchorX-window.mudpopoverHelper.flipMargin;const spaceAbove=anchorY-window.mudpopoverHelper.flipMargin;const spaceRight=window.innerWidth-anchorX-window.mudpopoverHelper.flipMargin;const shouldFlipVertical=popoverHeight>spaceBelow&&spaceAbove>spaceBelow;const shouldFlipHorizontal=popoverWidth>spaceLeft&&spaceRight>spaceLeft;if(shouldFlipVertical&&shouldFlipHorizontal){selector='top-and-right';}
|
||||||
|
else if(shouldFlipVertical){selector='top';}
|
||||||
|
else if(shouldFlipHorizontal){selector='right';}}
|
||||||
|
else if(classList.contains('mud-popover-center-left')){const spaceRight=window.innerWidth-anchorX-window.mudpopoverHelper.flipMargin;const spaceLeft=anchorX-window.mudpopoverHelper.flipMargin;if(popoverWidth>spaceRight&&spaceLeft>spaceRight){selector='left';}}
|
||||||
|
else if(classList.contains('mud-popover-center-right')){const spaceLeft=anchorX-window.mudpopoverHelper.flipMargin;const spaceRight=window.innerWidth-anchorX-window.mudpopoverHelper.flipMargin;if(popoverWidth>spaceLeft&&spaceRight>spaceLeft){selector='right';}}
|
||||||
|
else if(classList.contains('mud-popover-bottom-left')){const spaceAbove=anchorY-window.mudpopoverHelper.flipMargin;const spaceRight=window.innerWidth-anchorX-window.mudpopoverHelper.flipMargin;const spaceBelow=window.innerHeight-anchorY-window.mudpopoverHelper.flipMargin;const spaceLeft=anchorX-window.mudpopoverHelper.flipMargin;const shouldFlipVertical=popoverHeight>spaceAbove&&spaceBelow>spaceAbove;const shouldFlipHorizontal=popoverWidth>spaceRight&&spaceLeft>spaceRight;if(shouldFlipVertical&&shouldFlipHorizontal){selector='bottom-and-left';}
|
||||||
|
else if(shouldFlipVertical){selector='bottom';}
|
||||||
|
else if(shouldFlipHorizontal){selector='left';}}
|
||||||
|
else if(classList.contains('mud-popover-bottom-center')){const spaceAbove=anchorY-window.mudpopoverHelper.flipMargin;const spaceBelow=window.innerHeight-anchorY-window.mudpopoverHelper.flipMargin;if(popoverHeight>spaceAbove&&spaceBelow>spaceAbove){selector='bottom';}}
|
||||||
|
else if(classList.contains('mud-popover-bottom-right')){const spaceAbove=anchorY-window.mudpopoverHelper.flipMargin;const spaceLeft=anchorX-window.mudpopoverHelper.flipMargin;const spaceBelow=window.innerHeight-anchorY-window.mudpopoverHelper.flipMargin;const spaceRight=window.innerWidth-anchorX-window.mudpopoverHelper.flipMargin;const shouldFlipVertical=popoverHeight>spaceAbove&&spaceBelow>spaceAbove;const shouldFlipHorizontal=popoverWidth>spaceLeft&&spaceRight>spaceLeft;if(shouldFlipVertical&&shouldFlipHorizontal){selector='bottom-and-right';}
|
||||||
|
else if(shouldFlipVertical){selector='bottom';}
|
||||||
|
else if(shouldFlipHorizontal){selector='right';}}}
|
||||||
|
if(selector&&selector!='none'){const newPosition=window.mudpopoverHelper.getPositionForFlippedPopver(classListArray,selector,boundingRect,selfRect);left=newPosition.left;top=newPosition.top;offsetX=newPosition.offsetX;offsetY=newPosition.offsetY;popoverContentNode.setAttribute('data-mudpopover-flip',selector);}
|
||||||
|
else{popoverContentNode.removeAttribute('data-mudpopover-flip');}
|
||||||
|
if(isFlipOnOpen){if(!popoverContentNode.mudPopoverFliped){popoverContentNode.mudPopoverFliped=selector||'none';}}
|
||||||
|
if(left+offsetX<window.mudpopoverHelper.overflowPadding&&Math.abs(left+offsetX)<selfRect.width){left=window.mudpopoverHelper.overflowPadding;offsetX=0;}
|
||||||
|
if(top+offsetY<window.mudpopoverHelper.overflowPadding&&boundingRect.top>=0&&Math.abs(top+offsetY)<selfRect.height){top=window.mudpopoverHelper.overflowPadding;offsetY=0;}
|
||||||
|
if(top+offsetY<appBarOffset&&appBarElements.length>0){this.updatePopoverZIndex(popoverContentNode,appBarElements[0]);}
|
||||||
|
const firstChild=popoverContentNode.firstElementChild;const hasMaxHeight=popoverContentNode.style.maxHeight!=''||(firstChild&&firstChild.style.maxHeight!='');if(!hasMaxHeight){let shouldShowFromTop=false;let newMaxHeight=window.innerHeight-top-offsetY-window.mudpopoverHelper.overflowPadding;const isCentered=Array.from(classList).some(className=>className.includes('mud-popover-anchor-center'));const isFlippedUpward=!isCentered&&(popoverContentNode.getAttribute('data-mudpopover-flip')==='top'||popoverContentNode.getAttribute('data-mudpopover-flip')==='top-and-left'||popoverContentNode.getAttribute('data-mudpopover-flip')==='top-and-right');if(top+offsetY<anchorY||top+offsetY==window.mudpopoverHelper.overflowPadding){shouldShowFromTop=true;if(isFlippedUpward){newMaxHeight=anchorY-window.mudpopoverHelper.overflowPadding-popoverNode.offsetHeight;}
|
||||||
|
else{newMaxHeight=anchorY-window.mudpopoverHelper.overflowPadding;}}
|
||||||
|
if(popoverContentNode.offsetHeight>newMaxHeight){if(shouldShowFromTop){top=window.mudpopoverHelper.overflowPadding;offsetY=0;}
|
||||||
|
popoverContentNode.style.maxHeight=(newMaxHeight)+'px';popoverContentNode.mudHeight="setmaxheight";}}}
|
||||||
|
if(isPositionFixed){popoverContentNode.style['position']='fixed';}
|
||||||
|
else if(!classList.contains('mud-popover-fixed')){offsetX+=window.scrollX;offsetY+=window.scrollY}
|
||||||
|
popoverContentNode.style['left']=(left+offsetX)+'px';popoverContentNode.style['top']=(top+offsetY)+'px';this.updatePopoverZIndex(popoverContentNode,popoverNode.parentNode);if(!zIndexAuto){popoverContentNode.style['z-index']=Math.max(popoverNodeStyle.getPropertyValue('z-index'),popoverContentNode.style['z-index']);popoverContentNode.skipZIndex=true;}
|
||||||
|
window.mudpopoverHelper.popoverOverlayUpdates();}
|
||||||
|
else{}},placePopoverByClassSelector:function(classSelector=null){var items=window.mudPopover.getAllObservedContainers();for(let i=0;i<items.length;i++){const popoverNode=document.getElementById('popover-'+items[i]);window.mudpopoverHelper.placePopover(popoverNode,classSelector);}},placePopoverByNode:function(target){const id=target.id.substr(15);const popoverNode=document.getElementById('popover-'+id);window.mudpopoverHelper.placePopover(popoverNode);},countProviders:function(){return document.querySelectorAll(`.${window.mudpopoverHelper.mainContainerClass}`).length;},updatePopoverOverlay:function(popoverContentNode){if(!popoverContentNode||popoverContentNode.classList.contains("mud-tooltip")){return;}
|
||||||
|
const provider=popoverContentNode.closest(`.${window.mudpopoverHelper.mainContainerClass}`);if(provider&&popoverContentNode.classList.contains("mud-popover")){const overlay=provider.querySelector('.mud-overlay');if(overlay&&!overlay.classList.contains('mud-skip-overlay-positioning')){const popoverContentNodeZindex=Number(popoverContentNode.style['z-index']||0);const overlayZindex=Number(overlay.style['z-index']||0);if(popoverContentNodeZindex>overlayZindex){overlay.style['z-index']=popoverContentNodeZindex;}}}},updatePopoverZIndex:function(popoverContentNode,parentNode){const parentPopover=parentNode.closest('.mud-popover');const popoverNode=document.getElementById('popover-'+popoverContentNode.id.substr(15));let newZIndex=window.mudpopoverHelper.basePopoverZIndex+1;const origZIndex=parseInt(popoverContentNode.style['z-index'])||1;const contentZIndex=popoverContentNode.style['z-index'];if(parentPopover){const computedStyle=window.getComputedStyle(parentPopover);const parentZIndexValue=computedStyle.getPropertyValue('z-index');if(parentZIndexValue!=='auto'){newZIndex=parseInt(parentZIndexValue)+1;}
|
||||||
|
popoverContentNode.style['z-index']=newZIndex;}
|
||||||
|
else if(parentNode&&parentNode.classList.contains("mud-tooltip-root")){const computedStyle=window.getComputedStyle(parentNode);const tooltipZIndexValue=computedStyle.getPropertyValue('z-index');if(tooltipZIndexValue!=='auto'){newZIndex=parseInt(tooltipZIndexValue)+1;}
|
||||||
|
popoverContentNode.style['z-index']=Math.max(newZIndex,window.mudpopoverHelper.baseTooltipZIndex+1);}
|
||||||
|
else if(parentNode&&parentNode.classList.contains("mud-appbar")){const computedStyle=window.getComputedStyle(parentNode);const appBarZIndexValue=computedStyle.getPropertyValue('z-index');if(appBarZIndexValue!=='auto'){newZIndex=parseInt(appBarZIndexValue)+1;}
|
||||||
|
popoverContentNode.style['z-index']=newZIndex;}
|
||||||
|
else if(popoverNode.parentNode){const baseZIndexValue=window.mudpopoverHelper.getEffectiveZIndex(popoverNode.parentNode);newZIndex=baseZIndexValue+1;popoverContentNode.style['z-index']=Math.max(newZIndex,window.mudpopoverHelper.basePopoverZIndex+1,origZIndex);}
|
||||||
|
else if(!contentZIndex||parseInt(contentZIndex)<1){popoverContentNode.style['z-index']=newZIndex;}},getEffectiveZIndex:function(element){let currentElement=element;let maxZIndex=0;while(currentElement&¤tElement!==document.body){if(currentElement.nodeType!==1){currentElement=currentElement.parentElement;continue;}
|
||||||
|
const style=window.getComputedStyle(currentElement);const position=style.getPropertyValue('position');if(position==='static'){currentElement=currentElement.parentElement;continue;}
|
||||||
|
const zIndex=style.getPropertyValue('z-index');const zIndexValue=parseInt(zIndex,10);if(!isNaN(zIndexValue)&&zIndexValue>maxZIndex){maxZIndex=zIndexValue;}
|
||||||
|
currentElement=currentElement.parentElement;}
|
||||||
|
return maxZIndex;},popoverOverlayUpdates:function(){let highestTickItem=null;let highestTickValue=-1;const parentNode=document.querySelector(`.${window.mudpopoverHelper.mainContainerClass}`);if(!parentNode||!parentNode.children){return;}
|
||||||
|
for(const child of parentNode.children){if(child&&child.classList&&child.classList.contains("mud-popover-open")){const tickValue=Number(child.getAttribute("data-ticks"))||0;if(tickValue>highestTickValue){highestTickValue=tickValue;highestTickItem=child;}}}
|
||||||
|
if(highestTickItem){const isNested=highestTickItem.classList.contains('mud-popover-nested');if(!isNested){window.mudpopoverHelper.updatePopoverOverlay(highestTickItem);}}}}
|
||||||
|
class MudPopover{constructor(){this.map={};this.contentObserver=null;this.onResize=()=>window.mudpopoverHelper.debouncedResize();this.onScroll=()=>window.mudpopoverHelper.handleScroll(null);this.onScrollableNodes=(node)=>window.mudpopoverHelper.handleScroll(node);}
|
||||||
|
popoverScrollListener(node){let currentNode=node.parentNode;const scrollableElements=[];while(currentNode){const isScrollable=(currentNode.scrollHeight>currentNode.clientHeight)||(currentNode.scrollWidth>currentNode.clientWidth);if(isScrollable){const handler=()=>this.onScrollableNodes(node);currentNode.addEventListener('scroll',handler,{passive:true});scrollableElements.push({element:currentNode,handler});}
|
||||||
|
if(currentNode.tagName==="BODY"){break;}
|
||||||
|
currentNode=currentNode.parentNode;}
|
||||||
|
return scrollableElements;}
|
||||||
|
createObservers(id){this.disposeObservers(id);const popoverNode=document.getElementById('popover-'+id);const popoverContentNode=document.getElementById('popovercontent-'+id);if(popoverNode&&popoverNode.parentNode&&popoverContentNode){const resizeObserver=new ResizeObserver(entries=>{for(let entry of entries){const target=entry.target;for(const childNode of target.childNodes){if(childNode.id&&childNode.id.startsWith('popover-')){this.onResize();}}}});resizeObserver.observe(popoverNode.parentNode);const scrollableElements=this.popoverScrollListener(popoverNode);this.map[id].scrollableElements=scrollableElements;this.map[id].parentResizeObserver=resizeObserver;}else{console.warn(`Could not connect observers to popover with ID ${id}:One or more required elements not found`);}}
|
||||||
|
disposeObservers(id){const{scrollableElements,parentResizeObserver}=this.map[id];if(scrollableElements&&Array.isArray(scrollableElements)){scrollableElements.forEach(({element,handler})=>{if(element&&typeof element.removeEventListener==='function'){element.removeEventListener('scroll',handler);}});}
|
||||||
|
if(parentResizeObserver&&typeof parentResizeObserver.disconnect==='function'){parentResizeObserver.disconnect();}
|
||||||
|
this.map[id].scrollableElements=null;this.map[id].parentResizeObserver=null;}
|
||||||
|
openPopover(target,id){this.createObservers(id);const total=this.getTransitionTimes(id);const interval=Math.ceil(total/12);const start=performance.now();window.mudpopoverHelper.placePopoverByNode(target);const intervalId=setInterval(()=>{window.mudpopoverHelper.placePopoverByNode(target);if(performance.now()-start>total){clearInterval(intervalId);}},interval);}
|
||||||
|
callbackPopover(mutation){const target=mutation.target;if(!target)return;const id=target.id.substr(15);if(mutation.type=='attributes'&&mutation.attributeName=='class'){if(target.classList.contains('mud-popover-open')){if(this.map[id]&&!this.map[id].isOpened){this.map[id].isOpened=true;}
|
||||||
|
this.openPopover(target,id);}
|
||||||
|
else{if(this.map[id]&&this.map[id].isOpened){this.map[id].isOpened=false;}
|
||||||
|
const delay=parseFloat(target.style['transition-duration'])||0;if(delay==0){target.style.removeProperty('left');target.style.removeProperty('top');}
|
||||||
|
else{setTimeout(()=>{if(this.map[id]&&this.map[id].isOpened)return;if(target&&!target.classList.contains('mud-popover-open')){target.style.removeProperty('left');target.style.removeProperty('top');}},delay);}
|
||||||
|
target.mudPopoverFliped=null;target.removeAttribute('data-mudpopover-flip');this.disposeObservers(id);window.mudpopoverHelper.popoverOverlayUpdates();}}
|
||||||
|
else if(mutation.type=='attributes'&&mutation.attributeName=='data-ticks'){const tickAttribute=target.getAttribute('data-ticks');if(tickAttribute>0&&target.parentNode&&this.map[id]&&this.map[id].isOpened){window.mudpopoverHelper.placePopoverByNode(target);}}}
|
||||||
|
initialize(containerClass,flipMargin,overflowPadding){if(this.map.length>0){console.error('Popover Service already initialized, disposing to reinitialize.');this.dispose();}
|
||||||
|
window.mudpopoverHelper.mainContainerClass=containerClass;window.mudpopoverHelper.overflowPadding=overflowPadding;if(flipMargin){window.mudpopoverHelper.flipMargin=flipMargin;}
|
||||||
|
this.observeMainContainer();window.addEventListener('resize',this.onResize,{passive:true});window.addEventListener('scroll',this.onScroll,{passive:true});}
|
||||||
|
observeMainContainer(){const mainContent=document.body.getElementsByClassName(window.mudpopoverHelper.mainContainerClass);const provider=mainContent[0];if(!provider){console.error(`No Popover Container found with class ${containerClass}`);return;}
|
||||||
|
if(this.currentMainProvider===provider){return;}
|
||||||
|
this.currentMainProvider=provider;if(this.contentObserver){this.contentObserver.disconnect();this.contentObserver=null;}
|
||||||
|
const config={attributes:true,subtree:true,attributeFilter:['data-ticks','class']};const observer=new MutationObserver((mutations)=>{for(const mutation of mutations){if(mutation.target.parentNode===this.currentMainProvider&&mutation.target.classList.contains('mud-popover')){this.callbackPopover(mutation);}}});observer.observe(this.currentMainProvider,config);this.contentObserver=observer;}
|
||||||
|
getTransitionTimes(id){let node=document.getElementById(`popover-${id}`);if(!node){return 0;}
|
||||||
|
let maxTime=0;while(node&&node.tagName!=='BODY'){const computedStyle=window.getComputedStyle(node);const delays=(computedStyle.transitionDelay+','+computedStyle.animationDelay).split(',');const durations=(computedStyle.transitionDuration+','+computedStyle.animationDuration).split(',');for(let i=0;i<Math.max(delays.length,durations.length);i++){const delay=this.parseTime(delays[i%delays.length]);const duration=this.parseTime(durations[i%durations.length]);const total=delay+duration;if(total>maxTime){maxTime=total;}}
|
||||||
|
node=node.parentElement;}
|
||||||
|
return maxTime;}
|
||||||
|
parseTime(timeStr){if(!timeStr)return 0;timeStr=timeStr.trim();if(timeStr.endsWith('ms')){return parseFloat(timeStr);}else if(timeStr.endsWith('s')){return parseFloat(timeStr)*1000;}
|
||||||
|
return 0;}
|
||||||
|
connect(id){if(this.map[id]){this.disconnect(id);}
|
||||||
|
this.observeMainContainer()
|
||||||
|
const popoverNode=document.getElementById('popover-'+id);const popoverContentNode=document.getElementById('popovercontent-'+id);const startOpened=popoverContentNode.classList.contains('mud-popover-open');this.map[id]={popoverContentNode:popoverContentNode,scrollableElements:null,parentResizeObserver:null,isOpened:startOpened};if(startOpened){this.openPopover(popoverContentNode,id);}
|
||||||
|
window.mudpopoverHelper.debouncedResize();}
|
||||||
|
disconnect(id){if(!this.map[id]){return;}
|
||||||
|
try{this.disposeObservers(id);this.map[id].popoverContentNode=null;delete this.map[id];}catch(error){console.error(`Error disconnecting popover with ID ${id}:`,error);}}
|
||||||
|
dispose(){try{const ids=Object.keys(this.map);for(const id of ids){this.disconnect(id);}
|
||||||
|
this.map={};if(this.contentObserver){this.contentObserver.disconnect();this.contentObserver=null;}
|
||||||
|
window.removeEventListener('resize',this.onResize);window.removeEventListener('scroll',this.onScroll);}catch(error){console.error("Error disposing MudPopover:",error);}}
|
||||||
|
getAllObservedContainers(){return Object.keys(this.map);}}
|
||||||
|
window.mudpopoverHelper.debouncedResize=window.mudpopoverHelper.debounce(()=>{window.mudpopoverHelper.placePopoverByClassSelector();},25);window.mudpopoverHelper.handleScroll=function(node=null){if(node){window.mudpopoverHelper.placePopover(node);}
|
||||||
|
else{window.mudpopoverHelper.placePopoverByClassSelector('mud-popover-fixed');window.mudpopoverHelper.placePopoverByClassSelector('mud-popover-overflow-flip-always');}
|
||||||
|
window.mudpopoverHelper.debouncedResize();};window.mudPopover=new MudPopover();const darkThemeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)");window.darkModeChange=()=>{return darkThemeMediaQuery.matches;};function darkModeChangeListener(e){dotNetHelperTheme.invokeMethodAsync('SystemDarkModeChangedAsync',e.matches);}
|
||||||
|
function watchDarkThemeMedia(dotNetHelper){dotNetHelperTheme=dotNetHelper;darkThemeMediaQuery.addEventListener('change',darkModeChangeListener);}
|
||||||
|
function stopWatchingDarkThemeMedia(){darkThemeMediaQuery.removeEventListener('change',darkModeChangeListener);}
|
||||||
|
class MudScrollListener{constructor(){this.throttleScrollHandlerId=-1;this.handlerRef=null;}
|
||||||
|
listenForScroll(dotnetReference,selector){let element=selector?document.querySelector(selector):document;this.handlerRef=this.throttleScrollHandler.bind(this,dotnetReference);element.addEventListener('scroll',this.handlerRef,false);}
|
||||||
|
throttleScrollHandler(dotnetReference,event){clearTimeout(this.throttleScrollHandlerId);this.throttleScrollHandlerId=window.setTimeout(this.scrollHandler.bind(this,dotnetReference,event),100);}
|
||||||
|
scrollHandler(dotnetReference,event){try{let element=event.target;let scrollTop=element.scrollTop;let scrollHeight=element.scrollHeight;let scrollWidth=element.scrollWidth;let scrollLeft=element.scrollLeft;let nodeName=element.nodeName;let firstChild=element.firstElementChild;let firstChildBoundingClientRect=firstChild.getBoundingClientRect();dotnetReference.invokeMethodAsync('RaiseOnScroll',{firstChildBoundingClientRect,scrollLeft,scrollTop,scrollHeight,scrollWidth,nodeName,});}catch(error){console.log('[MudBlazor] Error in scrollHandler:',{error});}}
|
||||||
|
cancelListener(selector){let element=selector?document.querySelector(selector):document;element.removeEventListener('scroll',this.handlerRef);}};window.mudScrollListener=new MudScrollListener();class MudResizeObserverFactory{constructor(){this._maps={};}
|
||||||
|
connect(id,dotNetRef,elements,elementIds,options){var existingEntry=this._maps[id];if(!existingEntry){var observer=new MudResizeObserver(dotNetRef,options);this._maps[id]=observer;}
|
||||||
|
var result=this._maps[id].connect(elements,elementIds);return result;}
|
||||||
|
disconnect(id,element){var existingEntry=this._maps[id];if(existingEntry){existingEntry.disconnect(element);}}
|
||||||
|
cancelListener(id){var existingEntry=this._maps[id];if(existingEntry){existingEntry.cancelListener();delete this._maps[id];}}}
|
||||||
|
class MudResizeObserver{constructor(dotNetRef,options){this.logger=options.enableLogging?console.log:(message)=>{};this.options=options;this._dotNetRef=dotNetRef
|
||||||
|
var delay=(this.options||{}).reportRate||200;this.throttleResizeHandlerId=-1;var observervedElements=[];this._observervedElements=observervedElements;this.logger('[MudBlazor | ResizeObserver] Observer initialized');this._resizeObserver=new ResizeObserver(entries=>{var changes=[];this.logger('[MudBlazor | ResizeObserver] changes detected');for(let entry of entries){var target=entry.target;var affectedObservedElement=observervedElements.find((x)=>x.element==target);if(affectedObservedElement){var size=entry.target.getBoundingClientRect();if(affectedObservedElement.isInitialized==true){changes.push({id:affectedObservedElement.id,size:size});}
|
||||||
|
else{affectedObservedElement.isInitialized=true;}}}
|
||||||
|
if(changes.length>0){if(this.throttleResizeHandlerId>=0){clearTimeout(this.throttleResizeHandlerId);}
|
||||||
|
this.throttleResizeHandlerId=window.setTimeout(this.resizeHandler.bind(this,changes),delay);}});}
|
||||||
|
resizeHandler(changes){try{this.logger("[MudBlazor | ResizeObserver] OnSizeChanged handler invoked");this._dotNetRef.invokeMethodAsync("OnSizeChanged",changes);}catch(error){this.logger("[MudBlazor | ResizeObserver] Error in OnSizeChanged handler:",{error});}}
|
||||||
|
connect(elements,ids){var result=[];this.logger('[MudBlazor | ResizeObserver] Start observing elements...');for(var i=0;i<elements.length;i++){var newEntry={element:elements[i],id:ids[i],isInitialized:false,};this.logger("[MudBlazor | ResizeObserver] Start observing element:",{newEntry});result.push(elements[i].getBoundingClientRect());this._observervedElements.push(newEntry);this._resizeObserver.observe(elements[i]);}
|
||||||
|
return result;}
|
||||||
|
disconnect(elementId){this.logger('[MudBlazor | ResizeObserver] Try to unobserve element with id',{elementId});var affectedObservedElement=this._observervedElements.find((x)=>x.id==elementId);if(affectedObservedElement){var element=affectedObservedElement.element;this._resizeObserver.unobserve(element);this.logger('[MudBlazor | ResizeObserver] Element found. Ubobserving size changes of element',{element});var index=this._observervedElements.indexOf(affectedObservedElement);this._observervedElements.splice(index,1);}}
|
||||||
|
cancelListener(){this.logger('[MudBlazor | ResizeObserver] Closing ResizeObserver. Detaching all observed elements');this._resizeObserver.disconnect();this._dotNetRef=undefined;}}
|
||||||
|
window.mudResizeObserver=new MudResizeObserverFactory();class MudJsEventFactory{connect(dotNetRef,elementId,options){if(!elementId)
|
||||||
throw"[MudBlazor | JsEvent] elementId: expected element id!";var element=document.getElementById(elementId);if(!element)
|
throw"[MudBlazor | JsEvent] elementId: expected element id!";var element=document.getElementById(elementId);if(!element)
|
||||||
throw"[MudBlazor | JsEvent] no element found for id: "+elementId;if(!element.mudJsEvent)
|
throw"[MudBlazor | JsEvent] no element found for id: "+elementId;if(!element.mudJsEvent)
|
||||||
element.mudJsEvent=new MudJsEvent(dotNetRef,options);element.mudJsEvent.connect(element);}
|
element.mudJsEvent=new MudJsEvent(dotNetRef,options);element.mudJsEvent.connect(element);}
|
||||||
@@ -131,97 +309,7 @@ onpaste(self,e){const invoke=self._subscribedEvents["paste"];if(invoke){e.preven
|
|||||||
const text=clipboardData.getData('text/plain');self._dotNetRef.invokeMethodAsync('OnPaste',text);}}
|
const text=clipboardData.getData('text/plain');self._dotNetRef.invokeMethodAsync('OnPaste',text);}}
|
||||||
onselect(self,e){const invoke=self._subscribedEvents["select"];if(invoke){const start=e.target.selectionStart;const end=e.target.selectionEnd;if(start===end)
|
onselect(self,e){const invoke=self._subscribedEvents["select"];if(invoke){const start=e.target.selectionStart;const end=e.target.selectionEnd;if(start===end)
|
||||||
return;self._dotNetRef.invokeMethodAsync('OnSelect',start,end);}}}
|
return;self._dotNetRef.invokeMethodAsync('OnSelect',start,end);}}}
|
||||||
window.mudTimePicker={initPointerEvents:(clock,dotNetHelper)=>{let isPointerDown=false;const startHandler=(event)=>{if(event.button!==0){return;}
|
window.mudInputAutoGrow={initAutoGrow:(elem,maxLines)=>{const compStyle=getComputedStyle(elem);const lineHeight=parseFloat(compStyle.getPropertyValue('line-height'));const paddingTop=parseFloat(compStyle.getPropertyValue('padding-top'));let maxHeight=0;elem.updateParameters=function(newMaxLines){if(newMaxLines>0){maxHeight=lineHeight*newMaxLines+paddingTop;}else{maxHeight=0;}}
|
||||||
isPointerDown=true;event.target.releasePointerCapture(event.pointerId);if(event.target.classList.contains('mud-hour')||event.target.classList.contains('mud-minute')){let attributeValue=event.target.getAttribute('data-stick-value');let stickValue=attributeValue?parseInt(attributeValue):-1;dotNetHelper.invokeMethodAsync('SelectTimeFromStick',stickValue,false);}
|
|
||||||
event.preventDefault();};const endHandler=(event)=>{if(event.button!==0){return;}
|
|
||||||
isPointerDown=false;if(event.target.classList.contains('mud-hour')||event.target.classList.contains('mud-minute')){let attributeValue=event.target.getAttribute('data-stick-value');let stickValue=attributeValue?parseInt(attributeValue):-1;dotNetHelper.invokeMethodAsync('OnStickClick',stickValue);}
|
|
||||||
event.preventDefault();};const moveHandler=(event)=>{if(!isPointerDown||(!event.target.classList.contains('mud-hour')&&!event.target.classList.contains('mud-minute'))){return;}
|
|
||||||
let attributeValue=event.target.getAttribute('data-stick-value');let stickValue=attributeValue?parseInt(attributeValue):-1;dotNetHelper.invokeMethodAsync('SelectTimeFromStick',stickValue,true);event.preventDefault();};clock.addEventListener('pointerdown',startHandler);clock.addEventListener('pointerup',endHandler);clock.addEventListener('pointercancel',endHandler);clock.addEventListener('pointerover',moveHandler);clock.destroy=()=>{clock.removeEventListener('pointerdown',startHandler);clock.removeEventListener('pointerup',endHandler);clock.removeEventListener('pointercancel',endHandler);clock.removeEventListener('pointerover',moveHandler);};},destroyPointerEvents:(container)=>{if(container==null){return;}
|
|
||||||
if(typeof container.destroy==='function'){container.destroy();}}};class MudResizeObserverFactory{constructor(){this._maps={};}
|
|
||||||
connect(id,dotNetRef,elements,elementIds,options){var existingEntry=this._maps[id];if(!existingEntry){var observer=new MudResizeObserver(dotNetRef,options);this._maps[id]=observer;}
|
|
||||||
var result=this._maps[id].connect(elements,elementIds);return result;}
|
|
||||||
disconnect(id,element){var existingEntry=this._maps[id];if(existingEntry){existingEntry.disconnect(element);}}
|
|
||||||
cancelListener(id){var existingEntry=this._maps[id];if(existingEntry){existingEntry.cancelListener();delete this._maps[id];}}}
|
|
||||||
class MudResizeObserver{constructor(dotNetRef,options){this.logger=options.enableLogging?console.log:(message)=>{};this.options=options;this._dotNetRef=dotNetRef
|
|
||||||
var delay=(this.options||{}).reportRate||200;this.throttleResizeHandlerId=-1;var observervedElements=[];this._observervedElements=observervedElements;this.logger('[MudBlazor | ResizeObserver] Observer initialized');this._resizeObserver=new ResizeObserver(entries=>{var changes=[];this.logger('[MudBlazor | ResizeObserver] changes detected');for(let entry of entries){var target=entry.target;var affectedObservedElement=observervedElements.find((x)=>x.element==target);if(affectedObservedElement){var size=entry.target.getBoundingClientRect();if(affectedObservedElement.isInitialized==true){changes.push({id:affectedObservedElement.id,size:size});}
|
|
||||||
else{affectedObservedElement.isInitialized=true;}}}
|
|
||||||
if(changes.length>0){if(this.throttleResizeHandlerId>=0){clearTimeout(this.throttleResizeHandlerId);}
|
|
||||||
this.throttleResizeHandlerId=window.setTimeout(this.resizeHandler.bind(this,changes),delay);}});}
|
|
||||||
resizeHandler(changes){try{this.logger("[MudBlazor | ResizeObserver] OnSizeChanged handler invoked");this._dotNetRef.invokeMethodAsync("OnSizeChanged",changes);}catch(error){this.logger("[MudBlazor | ResizeObserver] Error in OnSizeChanged handler:",{error});}}
|
|
||||||
connect(elements,ids){var result=[];this.logger('[MudBlazor | ResizeObserver] Start observing elements...');for(var i=0;i<elements.length;i++){var newEntry={element:elements[i],id:ids[i],isInitialized:false,};this.logger("[MudBlazor | ResizeObserver] Start observing element:",{newEntry});result.push(elements[i].getBoundingClientRect());this._observervedElements.push(newEntry);this._resizeObserver.observe(elements[i]);}
|
|
||||||
return result;}
|
|
||||||
disconnect(elementId){this.logger('[MudBlazor | ResizeObserver] Try to unobserve element with id',{elementId});var affectedObservedElement=this._observervedElements.find((x)=>x.id==elementId);if(affectedObservedElement){var element=affectedObservedElement.element;this._resizeObserver.unobserve(element);this.logger('[MudBlazor | ResizeObserver] Element found. Ubobserving size changes of element',{element});var index=this._observervedElements.indexOf(affectedObservedElement);this._observervedElements.splice(index,1);}}
|
|
||||||
cancelListener(){this.logger('[MudBlazor | ResizeObserver] Closing ResizeObserver. Detaching all observed elements');this._resizeObserver.disconnect();this._dotNetRef=undefined;}}
|
|
||||||
window.mudResizeObserver=new MudResizeObserverFactory();window.mudpopoverHelper={debounce:function(func,wait){let timeout;return function executedFunction(...args){const later=()=>{clearTimeout(timeout);func(...args);};clearTimeout(timeout);timeout=setTimeout(later,wait);};},rafThrottle:function(func){let ticking=false;return function(...args){if(!ticking){window.requestAnimationFrame(()=>{func.apply(this,args);ticking=false;});ticking=true;}};},calculatePopoverPosition:function(list,boundingRect,selfRect){let top=0;let left=0;if(list.indexOf('mud-popover-anchor-top-left')>=0){left=boundingRect.left;top=boundingRect.top;}else if(list.indexOf('mud-popover-anchor-top-center')>=0){left=boundingRect.left+boundingRect.width/2;top=boundingRect.top;}else if(list.indexOf('mud-popover-anchor-top-right')>=0){left=boundingRect.left+boundingRect.width;top=boundingRect.top;}else if(list.indexOf('mud-popover-anchor-center-left')>=0){left=boundingRect.left;top=boundingRect.top+boundingRect.height/2;}else if(list.indexOf('mud-popover-anchor-center-center')>=0){left=boundingRect.left+boundingRect.width/2;top=boundingRect.top+boundingRect.height/2;}else if(list.indexOf('mud-popover-anchor-center-right')>=0){left=boundingRect.left+boundingRect.width;top=boundingRect.top+boundingRect.height/2;}else if(list.indexOf('mud-popover-anchor-bottom-left')>=0){left=boundingRect.left;top=boundingRect.top+boundingRect.height;}else if(list.indexOf('mud-popover-anchor-bottom-center')>=0){left=boundingRect.left+boundingRect.width/2;top=boundingRect.top+boundingRect.height;}else if(list.indexOf('mud-popover-anchor-bottom-right')>=0){left=boundingRect.left+boundingRect.width;top=boundingRect.top+boundingRect.height;}
|
|
||||||
let offsetX=0;let offsetY=0;if(list.indexOf('mud-popover-top-left')>=0){offsetX=0;offsetY=0;}else if(list.indexOf('mud-popover-top-center')>=0){offsetX=-selfRect.width/2;offsetY=0;}else if(list.indexOf('mud-popover-top-right')>=0){offsetX=-selfRect.width;offsetY=0;}
|
|
||||||
else if(list.indexOf('mud-popover-center-left')>=0){offsetX=0;offsetY=-selfRect.height/2;}else if(list.indexOf('mud-popover-center-center')>=0){offsetX=-selfRect.width/2;offsetY=-selfRect.height/2;}else if(list.indexOf('mud-popover-center-right')>=0){offsetX=-selfRect.width;offsetY=-selfRect.height/2;}
|
|
||||||
else if(list.indexOf('mud-popover-bottom-left')>=0){offsetX=0;offsetY=-selfRect.height;}else if(list.indexOf('mud-popover-bottom-center')>=0){offsetX=-selfRect.width/2;offsetY=-selfRect.height;}else if(list.indexOf('mud-popover-bottom-right')>=0){offsetX=-selfRect.width;offsetY=-selfRect.height;}
|
|
||||||
return{top:top,left:left,offsetX:offsetX,offsetY:offsetY};},flipClassReplacements:{'top':{'mud-popover-top-left':'mud-popover-bottom-left','mud-popover-top-center':'mud-popover-bottom-center','mud-popover-anchor-bottom-center':'mud-popover-anchor-top-center','mud-popover-top-right':'mud-popover-bottom-right',},'left':{'mud-popover-top-left':'mud-popover-top-right','mud-popover-center-left':'mud-popover-center-right','mud-popover-anchor-center-right':'mud-popover-anchor-center-left','mud-popover-bottom-left':'mud-popover-bottom-right',},'right':{'mud-popover-top-right':'mud-popover-top-left','mud-popover-center-right':'mud-popover-center-left','mud-popover-anchor-center-left':'mud-popover-anchor-center-right','mud-popover-bottom-right':'mud-popover-bottom-left',},'bottom':{'mud-popover-bottom-left':'mud-popover-top-left','mud-popover-bottom-center':'mud-popover-top-center','mud-popover-anchor-top-center':'mud-popover-anchor-bottom-center','mud-popover-bottom-right':'mud-popover-top-right',},'top-and-left':{'mud-popover-top-left':'mud-popover-bottom-right',},'top-and-right':{'mud-popover-top-right':'mud-popover-bottom-left',},'bottom-and-left':{'mud-popover-bottom-left':'mud-popover-top-right',},'bottom-and-right':{'mud-popover-bottom-right':'mud-popover-top-left',},},flipMargin:0,basePopoverZIndex:parseInt(getComputedStyle(document.documentElement).getPropertyValue('--mud-zindex-popover'))||1200,baseTooltipZIndex:parseInt(getComputedStyle(document.documentElement).getPropertyValue('--mud-zindex-tooltip'))||1600,getPositionForFlippedPopver:function(inputArray,selector,boundingRect,selfRect){const classList=[];for(var i=0;i<inputArray.length;i++){const item=inputArray[i];const replacments=window.mudpopoverHelper.flipClassReplacements[selector][item];if(replacments){classList.push(replacments);}
|
|
||||||
else{classList.push(item);}}
|
|
||||||
return window.mudpopoverHelper.calculatePopoverPosition(classList,boundingRect,selfRect);},placePopover:function(popoverNode,classSelector){if(popoverNode&&popoverNode.parentNode){const id=popoverNode.id.substr(8);const popoverContentNode=document.getElementById('popovercontent-'+id);if(!popoverContentNode){return;}
|
|
||||||
const classList=popoverContentNode.classList;if(classList.contains('mud-popover-open')==false){return;}
|
|
||||||
if(classSelector){if(classList.contains(classSelector)==false){return;}}
|
|
||||||
let boundingRect=popoverNode.parentNode.getBoundingClientRect();popoverContentNode.style['max-width']='none';popoverContentNode.style['min-width']='none';if(classList.contains('mud-popover-relative-width')){popoverContentNode.style['max-width']=(boundingRect.width)+'px';}
|
|
||||||
else if(classList.contains('mud-popover-adaptive-width')){popoverContentNode.style['min-width']=(boundingRect.width)+'px';}
|
|
||||||
const selfRect=popoverContentNode.getBoundingClientRect();const classListArray=Array.from(classList);const postion=window.mudpopoverHelper.calculatePopoverPosition(classListArray,boundingRect,selfRect);let left=postion.left;let top=postion.top;let offsetX=postion.offsetX;let offsetY=postion.offsetY;if(classList.contains('mud-popover-position-override')){left=parseInt(popoverContentNode.style['left'])||left;top=parseInt(popoverContentNode.style['top'])||top;offsetX=0;offsetY=0;boundingRect={left:left,top:top,right:left+selfRect.width,bottom:top+selfRect.height,width:selfRect.width,height:selfRect.height};}
|
|
||||||
if(classList.contains('mud-popover-overflow-flip-onopen')||classList.contains('mud-popover-overflow-flip-always')){const appBarElements=document.getElementsByClassName("mud-appbar mud-appbar-fixed-top");let appBarOffset=0;if(appBarElements.length>0){appBarOffset=appBarElements[0].getBoundingClientRect().height;}
|
|
||||||
const graceMargin=window.mudpopoverHelper.flipMargin;const deltaToLeft=left+offsetX;const deltaToRight=window.innerWidth-left-selfRect.width;const deltaTop=top-selfRect.height-appBarOffset;const spaceToTop=top-appBarOffset;const deltaBottom=window.innerHeight-top-selfRect.height;let selector=popoverContentNode.mudPopoverFliped;if(!selector){if(classList.contains('mud-popover-top-left')){if(deltaBottom<graceMargin&&deltaToRight<graceMargin&&spaceToTop>=selfRect.height&&deltaToLeft>=selfRect.width){selector='top-and-left';}else if(deltaBottom<graceMargin&&spaceToTop>=selfRect.height){selector='top';}else if(deltaToRight<graceMargin&&deltaToLeft>=selfRect.width){selector='left';}}else if(classList.contains('mud-popover-top-center')){if(deltaBottom<graceMargin&&spaceToTop>=selfRect.height){selector='top';}}else if(classList.contains('mud-popover-top-right')){if(deltaBottom<graceMargin&&deltaToLeft<graceMargin&&spaceToTop>=selfRect.height&&deltaToRight>=selfRect.width){selector='top-and-right';}else if(deltaBottom<graceMargin&&spaceToTop>=selfRect.height){selector='top';}else if(deltaToLeft<graceMargin&&deltaToRight>=selfRect.width){selector='right';}}
|
|
||||||
else if(classList.contains('mud-popover-center-left')){if(deltaToRight<graceMargin&&deltaToLeft>=selfRect.width){selector='left';}}
|
|
||||||
else if(classList.contains('mud-popover-center-right')){if(deltaToLeft<graceMargin&&deltaToRight>=selfRect.width){selector='right';}}
|
|
||||||
else if(classList.contains('mud-popover-bottom-left')){if(deltaTop<graceMargin&&deltaToRight<graceMargin&&deltaBottom>=0&&deltaToLeft>=selfRect.width){selector='bottom-and-left';}else if(deltaTop<graceMargin&&deltaBottom>=0){selector='bottom';}else if(deltaToRight<graceMargin&&deltaToLeft>=selfRect.width){selector='left';}}else if(classList.contains('mud-popover-bottom-center')){if(deltaTop<graceMargin&&deltaBottom>=0){selector='bottom';}}else if(classList.contains('mud-popover-bottom-right')){if(deltaTop<graceMargin&&deltaToLeft<graceMargin&&deltaBottom>=0&&deltaToRight>=selfRect.width){selector='bottom-and-right';}else if(deltaTop<graceMargin&&deltaBottom>=0){selector='bottom';}else if(deltaToLeft<graceMargin&&deltaToRight>=selfRect.width){selector='right';}}}
|
|
||||||
if(selector&&selector!='none'){const newPosition=window.mudpopoverHelper.getPositionForFlippedPopver(classListArray,selector,boundingRect,selfRect);left=newPosition.left;top=newPosition.top;offsetX=newPosition.offsetX;offsetY=newPosition.offsetY;popoverContentNode.setAttribute('data-mudpopover-flip','flipped');}
|
|
||||||
else{if(left+offsetX<0&&Math.abs(left+offsetX)<selfRect.width){left=Math.max(0,left+offsetX);offsetX=0;}
|
|
||||||
if(top+offsetY<appBarOffset&&appBarElements.length>0){this.updatePopoverZIndex(popoverContentNode,appBarElements[0]);}
|
|
||||||
if(top+offsetY<0&&Math.abs(top+offsetY)<selfRect.height){top=Math.max(0,top+offsetY);offsetY=0;}
|
|
||||||
const list=popoverContentNode.querySelector('.mud-list');const listPadding=24;const listMaxHeight=(window.innerHeight-top-offsetY);if(list&&list.offsetHeight>listMaxHeight){list.style.maxHeight=(listMaxHeight-listPadding)+'px';}
|
|
||||||
popoverContentNode.removeAttribute('data-mudpopover-flip');}
|
|
||||||
if(classList.contains('mud-popover-overflow-flip-onopen')){if(!popoverContentNode.mudPopoverFliped){popoverContentNode.mudPopoverFliped=selector||'none';}}}
|
|
||||||
if(window.getComputedStyle(popoverNode).position=='fixed'){popoverContentNode.style['position']='fixed';}
|
|
||||||
else if(!classList.contains('mud-popover-fixed')){offsetX+=window.scrollX;offsetY+=window.scrollY}
|
|
||||||
if(classList.contains('mud-popover-position-override')){offsetX=0;offsetY=0;}
|
|
||||||
popoverContentNode.style['left']=(left+offsetX)+'px';popoverContentNode.style['top']=(top+offsetY)+'px';this.updatePopoverZIndex(popoverContentNode,popoverNode.parentNode);if(window.getComputedStyle(popoverNode).getPropertyValue('z-index')!='auto'){popoverContentNode.style['z-index']=Math.max(window.getComputedStyle(popoverNode).getPropertyValue('z-index'),popoverContentNode.style['z-index']);popoverContentNode.skipZIndex=true;}}
|
|
||||||
else{}},popoverScrollListener:function(node){let currentNode=node.parentNode;while(currentNode){const isScrollable=(currentNode.scrollHeight>currentNode.clientHeight)||(currentNode.scrollWidth>currentNode.clientWidth);if(isScrollable){currentNode.addEventListener('scroll',()=>{window.mudpopoverHelper.placePopoverByClassSelector('mud-popover-fixed');window.mudpopoverHelper.placePopoverByClassSelector('mud-popover-overflow-flip-always');});}
|
|
||||||
if(currentNode.tagName==="BODY"){break;}
|
|
||||||
currentNode=currentNode.parentNode;}},placePopoverByClassSelector:function(classSelector=null){var items=window.mudPopover.getAllObservedContainers();for(let i=0;i<items.length;i++){const popoverNode=document.getElementById('popover-'+items[i]);window.mudpopoverHelper.placePopover(popoverNode,classSelector);}},placePopoverByNode:function(target){const id=target.id.substr(15);const popoverNode=document.getElementById('popover-'+id);window.mudpopoverHelper.placePopover(popoverNode);},countProviders:function(){return document.querySelectorAll(".mud-popover-provider").length;},updatePopoverOverlay:function(popoverContentNode){if(popoverContentNode.classList.contains("mud-tooltip")){return;}
|
|
||||||
const provider=popoverContentNode.closest('.mud-popover-provider');if(provider&&popoverContentNode.classList.contains("mud-popover")){const overlay=provider.querySelector('.mud-overlay');if(overlay&&!overlay.classList.contains('mud-skip-overlay-positioning')){if(popoverContentNode&&overlay.style['z-index']!==popoverContentNode.style['z-index']){overlay.style['z-index']=popoverContentNode.style['z-index'];}}}},updatePopoverZIndex:function(popoverContentNode,parentNode){const parentPopover=parentNode.closest('.mud-popover');const parentOfPopover=popoverContentNode.parentNode;let newZIndex=window.mudpopoverHelper.basePopoverZIndex+1;const origZIndex=parseInt(popoverContentNode.style['z-index'])||1;const contentZIndex=popoverContentNode.style['z-index'];if(parentPopover){const computedStyle=window.getComputedStyle(parentPopover);const parentZIndexValue=computedStyle.getPropertyValue('z-index');if(parentZIndexValue!=='auto'){newZIndex=parseInt(parentZIndexValue)+1;}
|
|
||||||
popoverContentNode.style['z-index']=newZIndex;}
|
|
||||||
else if(parentOfPopover){const computedStyle=window.getComputedStyle(parentOfPopover);const tooltipZIndexValue=computedStyle.getPropertyValue('z-index');if(tooltipZIndexValue!=='auto'){newZIndex=parseInt(tooltipZIndexValue)+1;}
|
|
||||||
popoverContentNode.style['z-index']=Math.max(newZIndex,window.mudpopoverHelper.baseTooltipZIndex+1,origZIndex);}
|
|
||||||
else if(parentNode&&parentNode.classList.contains("mud-tooltip-root")){const computedStyle=window.getComputedStyle(parentNode);const tooltipZIndexValue=computedStyle.getPropertyValue('z-index');if(tooltipZIndexValue!=='auto'){newZIndex=parseInt(tooltipZIndexValue)+1;}
|
|
||||||
popoverContentNode.style['z-index']=Math.max(newZIndex,window.mudpopoverHelper.baseTooltipZIndex+1);}
|
|
||||||
else if(parentNode&&parentNode.classList.contains("mud-appbar")){const computedStyle=window.getComputedStyle(parentNode);const appBarZIndexValue=computedStyle.getPropertyValue('z-index');if(appBarZIndexValue!=='auto'){newZIndex=parseInt(appBarZIndexValue)+1;}
|
|
||||||
popoverContentNode.style['z-index']=newZIndex;}
|
|
||||||
else if(!contentZIndex||parseInt(contentZIndex)<1){popoverContentNode.style['z-index']=newZIndex;}},}
|
|
||||||
class MudPopover{constructor(){this.map={};this.contentObserver=null;this.mainContainerClass=null;}
|
|
||||||
callback(id,mutationsList,observer){for(const mutation of mutationsList){if(mutation.type==='attributes'){const target=mutation.target
|
|
||||||
if(mutation.attributeName=='class'){if(target.classList.contains('mud-popover-overflow-flip-onopen')&&target.classList.contains('mud-popover-open')==false){target.mudPopoverFliped=null;target.removeAttribute('data-mudpopover-flip');}
|
|
||||||
window.mudpopoverHelper.placePopoverByNode(target);}
|
|
||||||
else if(mutation.attributeName=='data-ticks'){const tickAttribute=target.getAttribute('data-ticks');const tickValues=[];let max=-1;if(parent&&parent.children){for(let i=0;i<parent.children.length;i++){const childNode=parent.children[i];const tickValue=parseInt(childNode.getAttribute('data-ticks'));if(tickValue==0){continue;}
|
|
||||||
if(tickValues.indexOf(tickValue)>=0){continue;}
|
|
||||||
tickValues.push(tickValue);if(tickValue>max){max=tickValue;}}}
|
|
||||||
let highestTickItem=null;let highestTickValue=-1;for(const mapItem of Object.values(this.map)){const popoverContentNode=mapItem.popoverContentNode;if(popoverContentNode){const tickValue=Number(popoverContentNode.getAttribute('data-ticks'));if(tickValue>highestTickValue){highestTickValue=tickValue;highestTickItem=popoverContentNode;}}}
|
|
||||||
if(highestTickItem){window.mudpopoverHelper.updatePopoverOverlay(highestTickItem);}
|
|
||||||
if(tickValues.length==0){continue;}
|
|
||||||
const sortedTickValues=tickValues.sort((x,y)=>x-y);continue;for(let i=0;i<parent.children.length;i++){const childNode=parent.children[i];const tickValue=parseInt(childNode.getAttribute('data-ticks'));if(tickValue==0){continue;}
|
|
||||||
if(childNode.skipZIndex==true){continue;}
|
|
||||||
const newIndex=window.mudpopoverHelper.basePopoverZIndex+sortedTickValues.indexOf(tickValue)+3;childNode.style['z-index']=newIndex;}}}}}
|
|
||||||
initialize(containerClass,flipMargin){const mainContent=document.getElementsByClassName(containerClass);if(mainContent.length==0){return;}
|
|
||||||
if(flipMargin){window.mudpopoverHelper.flipMargin=flipMargin;}
|
|
||||||
this.mainContainerClass=containerClass;if(!mainContent[0].mudPopoverMark){mainContent[0].mudPopoverMark="mudded";if(this.contentObserver!=null){this.contentObserver.disconnect();this.contentObserver=null;}
|
|
||||||
this.contentObserver=new ResizeObserver(entries=>{window.mudpopoverHelper.placePopoverByClassSelector();});this.contentObserver.observe(mainContent[0]);}}
|
|
||||||
connect(id){this.initialize(this.mainContainerClass);const popoverNode=document.getElementById('popover-'+id);mudpopoverHelper.popoverScrollListener(popoverNode);const popoverContentNode=document.getElementById('popovercontent-'+id);if(popoverNode&&popoverNode.parentNode&&popoverContentNode){window.mudpopoverHelper.placePopover(popoverNode);const config={attributeFilter:['class','data-ticks']};const observer=new MutationObserver(this.callback.bind(this,id));observer.observe(popoverContentNode,config);const resizeObserver=new ResizeObserver(entries=>{for(let entry of entries){const target=entry.target;for(const childNode of target.childNodes){if(childNode.id&&childNode.id.startsWith('popover-')){window.mudpopoverHelper.placePopover(childNode);}}}});resizeObserver.observe(popoverNode.parentNode);const contentNodeObserver=new ResizeObserver(entries=>{for(let entry of entries){const target=entry.target;if(target)
|
|
||||||
window.mudpopoverHelper.placePopoverByNode(target);}});contentNodeObserver.observe(popoverContentNode);this.map[id]={popoverContentNode:popoverContentNode,mutationObserver:observer,resizeObserver:resizeObserver,contentNodeObserver:contentNodeObserver};}}
|
|
||||||
disconnect(id){if(this.map[id]){const item=this.map[id]
|
|
||||||
item.mutationObserver.disconnect();item.resizeObserver.disconnect();item.contentNodeObserver.disconnect();delete this.map[id];}}
|
|
||||||
dispose(){for(var i in this.map){disconnect(i);}
|
|
||||||
this.contentObserver.disconnect();this.contentObserver=null;}
|
|
||||||
getAllObservedContainers(){const result=[];for(var i in this.map){result.push(i);}
|
|
||||||
return result;}}
|
|
||||||
window.mudPopover=new MudPopover();const debouncedResize=window.mudpopoverHelper.debounce(()=>{window.mudpopoverHelper.placePopoverByClassSelector();},100);const throttledScroll=window.mudpopoverHelper.rafThrottle(()=>{window.mudpopoverHelper.placePopoverByClassSelector('mud-popover-fixed');window.mudpopoverHelper.placePopoverByClassSelector('mud-popover-overflow-flip-always');});window.addEventListener('resize',debouncedResize,{passive:true});window.addEventListener('scroll',throttledScroll,{passive:true});class MudScrollListener{constructor(){this.throttleScrollHandlerId=-1;this.handlerRef=null;}
|
|
||||||
listenForScroll(dotnetReference,selector){let element=selector?document.querySelector(selector):document;this.handlerRef=this.throttleScrollHandler.bind(this,dotnetReference);element.addEventListener('scroll',this.handlerRef,false);}
|
|
||||||
throttleScrollHandler(dotnetReference,event){clearTimeout(this.throttleScrollHandlerId);this.throttleScrollHandlerId=window.setTimeout(this.scrollHandler.bind(this,dotnetReference,event),100);}
|
|
||||||
scrollHandler(dotnetReference,event){try{let element=event.target;let scrollTop=element.scrollTop;let scrollHeight=element.scrollHeight;let scrollWidth=element.scrollWidth;let scrollLeft=element.scrollLeft;let nodeName=element.nodeName;let firstChild=element.firstElementChild;let firstChildBoundingClientRect=firstChild.getBoundingClientRect();dotnetReference.invokeMethodAsync('RaiseOnScroll',{firstChildBoundingClientRect,scrollLeft,scrollTop,scrollHeight,scrollWidth,nodeName,});}catch(error){console.log('[MudBlazor] Error in scrollHandler:',{error});}}
|
|
||||||
cancelListener(selector){let element=selector?document.querySelector(selector):document;element.removeEventListener('scroll',this.handlerRef);}};window.mudScrollListener=new MudScrollListener();window.mudInputAutoGrow={initAutoGrow:(elem,maxLines)=>{const compStyle=getComputedStyle(elem);const lineHeight=parseFloat(compStyle.getPropertyValue('line-height'));const paddingTop=parseFloat(compStyle.getPropertyValue('padding-top'));let maxHeight=0;elem.updateParameters=function(newMaxLines){if(newMaxLines>0){maxHeight=lineHeight*newMaxLines+paddingTop;}else{maxHeight=0;}}
|
|
||||||
elem.adjustAutoGrowHeight=function(didReflow=false){const scrollTops=[];let curElem=elem;while(curElem&&curElem.parentNode&&curElem.parentNode instanceof Element){if(curElem.parentNode.scrollTop){scrollTops.push([curElem.parentNode,curElem.parentNode.scrollTop]);}
|
elem.adjustAutoGrowHeight=function(didReflow=false){const scrollTops=[];let curElem=elem;while(curElem&&curElem.parentNode&&curElem.parentNode instanceof Element){if(curElem.parentNode.scrollTop){scrollTops.push([curElem.parentNode,curElem.parentNode.scrollTop]);}
|
||||||
curElem=curElem.parentNode;}
|
curElem=curElem.parentNode;}
|
||||||
elem.style.height=0;if(didReflow){elem.style.textAlign=null;}
|
elem.style.height=0;if(didReflow){elem.style.textAlign=null;}
|
||||||
@@ -230,43 +318,7 @@ elem.style.height=newHeight+"px";scrollTops.forEach(([node,scrollTop])=>{node.st
|
|||||||
elem.restoreToInitialState=function(){elem.removeEventListener('input',elem.adjustAutoGrowHeight);elem.style.overflowY=null;elem.style.height=null;}
|
elem.restoreToInitialState=function(){elem.removeEventListener('input',elem.adjustAutoGrowHeight);elem.style.overflowY=null;elem.style.height=null;}
|
||||||
elem.addEventListener('input',elem.adjustAutoGrowHeight);window.addEventListener('resize',elem.adjustAutoGrowHeight);elem.updateParameters(maxLines);elem.adjustAutoGrowHeight();},adjustHeight:(elem)=>{if(typeof elem.adjustAutoGrowHeight==='function'){elem.adjustAutoGrowHeight();}},updateParams:(elem,maxLines)=>{if(typeof elem.updateParameters==='function'){elem.updateParameters(maxLines);}
|
elem.addEventListener('input',elem.adjustAutoGrowHeight);window.addEventListener('resize',elem.adjustAutoGrowHeight);elem.updateParameters(maxLines);elem.adjustAutoGrowHeight();},adjustHeight:(elem)=>{if(typeof elem.adjustAutoGrowHeight==='function'){elem.adjustAutoGrowHeight();}},updateParams:(elem,maxLines)=>{if(typeof elem.updateParameters==='function'){elem.updateParameters(maxLines);}
|
||||||
if(typeof elem.adjustAutoGrowHeight==='function'){elem.adjustAutoGrowHeight();}},destroy:(elem)=>{if(elem==null){return;}
|
if(typeof elem.adjustAutoGrowHeight==='function'){elem.adjustAutoGrowHeight();}},destroy:(elem)=>{if(elem==null){return;}
|
||||||
window.removeEventListener('resize',elem.adjustAutoGrowHeight);if(typeof elem.restoreToInitialState==='function'){elem.restoreToInitialState();}}};class MudInput{resetValue(id){const input=document.getElementById(id);if(input){input.value='';}}}
|
window.removeEventListener('resize',elem.adjustAutoGrowHeight);if(typeof elem.restoreToInitialState==='function'){elem.restoreToInitialState();}}};class MudKeyInterceptorFactory{connect(dotNetRef,elementId,options){if(!elementId)
|
||||||
window.mudInput=new MudInput();class MudFileUpload{openFilePicker(id){const element=document.getElementById(id);if(!element){return;}
|
|
||||||
try{element.showPicker();}catch(error){element.click();}}}
|
|
||||||
window.mudFileUpload=new MudFileUpload();class MudScrollSpy{constructor(){this.lastKnowElement=null;this.handlerRef=null;}
|
|
||||||
spying(dotnetReference,containerSelector,sectionClassSelector){this.lastKnowElement=null;this.handlerRef=this.handleScroll.bind(this,dotnetReference,containerSelector,sectionClassSelector);document.addEventListener('scroll',this.handlerRef,true);window.addEventListener('resize',this.handlerRef,true);}
|
|
||||||
handleScroll(dotnetReference,containerSelector,sectionClassSelector,event){const container=document.querySelector(containerSelector);if(container===null){return;}
|
|
||||||
const elements=document.getElementsByClassName(sectionClassSelector);if(elements.length===0){return;}
|
|
||||||
const containerTop=container.tagName==='HTML'?0:container.getBoundingClientRect().top;const containerHeight=container.clientHeight;const center=containerTop+containerHeight/2.0;let minDifference=Number.MAX_SAFE_INTEGER;let foundAbove=false;let elementId='';for(let i=0;i<elements.length;i++){const element=elements[i];const rect=element.getBoundingClientRect();const diff=Math.abs(rect.top-center);if(!foundAbove&&rect.top<center){foundAbove=true;minDifference=diff;elementId=element.id;continue;}
|
|
||||||
if(foundAbove&&rect.top>=center){continue;}
|
|
||||||
if(diff<minDifference){minDifference=diff;elementId=element.id;}}
|
|
||||||
if(elementId!==this.lastKnowElement){this.lastKnowElement=elementId;history.replaceState(null,'',window.location.pathname+"#"+elementId);dotnetReference.invokeMethodAsync('SectionChangeOccured',elementId);}}
|
|
||||||
activateSection(sectionId){const element=document.getElementById(sectionId);if(element){this.lastKnowElement=sectionId;history.replaceState(null,'',window.location.pathname+"#"+sectionId);}}
|
|
||||||
scrollToSection(sectionId){if(sectionId){let element=document.getElementById(sectionId);if(element){element.scrollIntoView({behavior:'smooth',block:'center',inline:'start'});}}
|
|
||||||
else{window.scrollTo({top:0,behavior:'smooth'});}}
|
|
||||||
unspy(){document.removeEventListener('scroll',this.handlerRef,true);window.removeEventListener('resize',this.handlerRef,true);}};window.mudScrollSpy=new MudScrollSpy();class MudResizeListener{constructor(id){this.logger=function(message){};this.options={};this.throttleResizeHandlerId=-1;this.dotnet=undefined;this.breakpoint=-1;this.id=id;this.handleResize=this.throttleResizeHandler.bind(this);}
|
|
||||||
listenForResize(dotnetRef,options){if(this.dotnet){this.options=options;return;}
|
|
||||||
this.options=options;this.dotnet=dotnetRef;this.logger=options.enableLogging?console.log:(message)=>{};this.logger(`[MudBlazor]Reporting resize events at rate of:${this.options.reportRate}ms`);window.addEventListener("resize",this.handleResize,false);if(!this.options.suppressInitEvent){this.resizeHandler();}
|
|
||||||
this.breakpoint=this.getBreakpoint(window.innerWidth);}
|
|
||||||
throttleResizeHandler(){clearTimeout(this.throttleResizeHandlerId);this.throttleResizeHandlerId=window.setTimeout(this.resizeHandler.bind(this),this.options.reportRate);}
|
|
||||||
resizeHandler(){if(this.options.notifyOnBreakpointOnly){let bp=this.getBreakpoint(window.innerWidth);if(bp==this.breakpoint){return;}
|
|
||||||
this.breakpoint=bp;}
|
|
||||||
try{if(this.id){this.dotnet.invokeMethodAsync('RaiseOnResized',{height:window.innerHeight,width:window.innerWidth},this.getBreakpoint(window.innerWidth),this.id);}
|
|
||||||
else{this.dotnet.invokeMethodAsync('RaiseOnResized',{height:window.innerHeight,width:window.innerWidth},this.getBreakpoint(window.innerWidth));}}catch(error){this.logger("[MudBlazor] Error in resizeHandler:",{error});}}
|
|
||||||
cancelListener(){this.dotnet=undefined;window.removeEventListener("resize",this.handleResize);}
|
|
||||||
matchMedia(query){let m=window.matchMedia(query).matches;return m;}
|
|
||||||
getBrowserWindowSize(){return{height:window.innerHeight,width:window.innerWidth};}
|
|
||||||
getBreakpoint(width){if(width>=this.options.breakpointDefinitions["Xxl"])
|
|
||||||
return 5;else if(width>=this.options.breakpointDefinitions["Xl"])
|
|
||||||
return 4;else if(width>=this.options.breakpointDefinitions["Lg"])
|
|
||||||
return 3;else if(width>=this.options.breakpointDefinitions["Md"])
|
|
||||||
return 2;else if(width>=this.options.breakpointDefinitions["Sm"])
|
|
||||||
return 1;else
|
|
||||||
return 0;}};window.mudResizeListener=new MudResizeListener();window.mudResizeListenerFactory={mapping:{},listenForResize:(dotnetRef,options,id)=>{var map=window.mudResizeListenerFactory.mapping;if(map[id]){return;}
|
|
||||||
var listener=new MudResizeListener(id);listener.listenForResize(dotnetRef,options);map[id]=listener;},cancelListener:(id)=>{var map=window.mudResizeListenerFactory.mapping;if(!map[id]){return;}
|
|
||||||
var listener=map[id];listener.cancelListener();delete map[id];},cancelListeners:(ids)=>{for(let i=0;i<ids.length;i++){window.mudResizeListenerFactory.cancelListener(ids[i]);}},dispose(){var map=window.mudResizeListenerFactory.mapping;for(var id in map){window.mudResizeListenerFactory.cancelListener(id);}}}
|
|
||||||
function setRippleOffset(event,target){const rect=target.getBoundingClientRect();const x=event.clientX-rect.left-rect.width/2;const y=event.clientY-rect.top-rect.height/2;target.style.setProperty("--mud-ripple-offset-x",`${x}px`);target.style.setProperty("--mud-ripple-offset-y",`${y}px`);}
|
|
||||||
document.addEventListener("click",function(event){const target=event.target.closest(".mud-ripple");if(target){setRippleOffset(event,target);}});class MudKeyInterceptorFactory{connect(dotNetRef,elementId,options){if(!elementId)
|
|
||||||
throw"elementId: expected element id!";var element=document.getElementById(elementId);if(!element)
|
throw"elementId: expected element id!";var element=document.getElementById(elementId);if(!element)
|
||||||
throw"no element found for id: "+elementId;if(!element.mudKeyInterceptor)
|
throw"no element found for id: "+elementId;if(!element.mudKeyInterceptor)
|
||||||
element.mudKeyInterceptor=new MudKeyInterceptor(dotNetRef,options);element.mudKeyInterceptor.connect(element);}
|
element.mudKeyInterceptor=new MudKeyInterceptor(dotNetRef,options);element.mudKeyInterceptor.connect(element);}
|
||||||
@@ -322,3 +374,19 @@ processKeyUp(args,keyOptions){if(this.matchesKeyCombination(keyOptions.preventUp
|
|||||||
args.preventDefault();if(this.matchesKeyCombination(keyOptions.stopUp,args))
|
args.preventDefault();if(this.matchesKeyCombination(keyOptions.stopUp,args))
|
||||||
args.stopPropagation();}
|
args.stopPropagation();}
|
||||||
toKeyboardEventArgs(args){return{Key:args.key,Code:args.code,Location:args.location,Repeat:args.repeat,CtrlKey:args.ctrlKey,ShiftKey:args.shiftKey,AltKey:args.altKey,MetaKey:args.metaKey};}}
|
toKeyboardEventArgs(args){return{Key:args.key,Code:args.code,Location:args.location,Repeat:args.repeat,CtrlKey:args.ctrlKey,ShiftKey:args.shiftKey,AltKey:args.altKey,MetaKey:args.metaKey};}}
|
||||||
|
window.getTabbableElements=(element)=>{return element.querySelectorAll("a[href]:not([tabindex='-1']),"+"area[href]:not([tabindex='-1']),"+"button:not([disabled]):not([tabindex='-1']),"+"input:not([disabled]):not([tabindex='-1']):not([type='hidden']),"+"select:not([disabled]):not([tabindex='-1']),"+"textarea:not([disabled]):not([tabindex='-1']),"+"iframe:not([tabindex='-1']),"+"details:not([tabindex='-1']),"+"[tabindex]:not([tabindex='-1']),"+"[contentEditable=true]:not([tabindex='-1'])");};window.serializeParameter=(data,spec)=>{if(typeof data=="undefined"||data===null){return null;}
|
||||||
|
if(typeof data==="number"||typeof data==="string"||typeof data=="boolean"){return data;}
|
||||||
|
let res=(Array.isArray(data))?[]:{};if(!spec){spec="*";}
|
||||||
|
for(let i in data){let currentMember=data[i];if(typeof currentMember==='function'||currentMember===null){continue;}
|
||||||
|
let currentMemberSpec;if(spec!="*"){currentMemberSpec=Array.isArray(data)?spec:spec[i];if(!currentMemberSpec){continue;}}else{currentMemberSpec="*"}
|
||||||
|
if(typeof currentMember==='object'){if(Array.isArray(currentMember)||currentMember.length){res[i]=[];for(let j=0;j<currentMember.length;j++){const arrayItem=currentMember[j];if(typeof arrayItem==='object'){res[i].push(this.serializeParameter(arrayItem,currentMemberSpec));}else{res[i].push(arrayItem);}}}else{if(currentMember.length===0){res[i]=[];}else{res[i]=this.serializeParameter(currentMember,currentMemberSpec);}}}else{if(currentMember===Infinity){currentMember="Infinity";}
|
||||||
|
if(currentMember!==null){res[i]=currentMember;}}}
|
||||||
|
return res;};window.mudGetSvgBBox=(svgElement)=>{if(svgElement==null)return null;const bbox=svgElement.getBBox();return{x:bbox.x,y:bbox.y,width:bbox.width,height:bbox.height};};window.mudObserveElementSize=(dotNetReference,element,functionName='OnElementSizeChanged',debounceMillis=200)=>{if(!element)return;let lastNotifiedTime=0;let scheduledCall=null;const throttledNotify=(width,height)=>{const timestamp=Date.now();const timeSinceLast=timestamp-lastNotifiedTime;if(timeSinceLast>=debounceMillis){lastNotifiedTime=timestamp;try{dotNetReference.invokeMethodAsync(functionName,{width,height,timestamp});}
|
||||||
|
catch(error){this.logger("[MudBlazor] Error in mudObserveElementSize:",{error});}}else{if(scheduledCall!==null){clearTimeout(scheduledCall);}
|
||||||
|
scheduledCall=setTimeout(()=>{lastNotifiedTime=Date.now();scheduledCall=null;try{dotNetReference.invokeMethodAsync(functionName,{width,height,timestamp});}
|
||||||
|
catch(error){this.logger("[MudBlazor] Error in mudObserveElementSize:",{error});}},debounceMillis-timeSinceLast);}};const resizeObserver=new ResizeObserver(entries=>{if(element.isConnected===false){return;}
|
||||||
|
let width=element.clientWidth;let height=element.clientHeight;for(const entry of entries){width=entry.contentRect.width;height=entry.contentRect.height;}
|
||||||
|
width=Math.floor(width);height=Math.floor(height);throttledNotify(width,height);});resizeObserver.observe(element);let mutationObserver=null;const parent=element.parentNode;if(parent){mutationObserver=new MutationObserver(mutations=>{for(const mutation of mutations){for(const removedNode of mutation.removedNodes){if(removedNode===element){cleanup();}}}});mutationObserver.observe(parent,{childList:true});}
|
||||||
|
function cleanup(){resizeObserver.disconnect();if(mutationObserver){mutationObserver.disconnect();}
|
||||||
|
if(scheduledCall!==null){clearTimeout(scheduledCall);}}
|
||||||
|
return{width:element.clientWidth,height:element.clientHeight};};
|
||||||
Binary file not shown.
Binary file not shown.
+7
-7
@@ -1,11 +1,11 @@
|
|||||||
0.9.48
|
0.9.49
|
||||||
2025-06-11 08:14:42 UTC
|
2025-07-02 12:12:12 UTC
|
||||||
223
|
224
|
||||||
9.0.107 (commit ef50dc9d27)
|
9.0.107 (commit ef50dc9d27)
|
||||||
9.0.6 (commit 3875b54e7b)
|
9.0.6 (commit 3875b54e7b)
|
||||||
1.87.0 (commit 17067e9ac)
|
1.88.0 (commit 6b00bc388)
|
||||||
8.6.0
|
8.9.0
|
||||||
1.8.1
|
1.8.1
|
||||||
2616101607a, release
|
be27fd84b82, release
|
||||||
osx-arm64
|
osx-arm64
|
||||||
137.0.7123.0
|
137.0.7215.0
|
||||||
Generated
+291
-422
File diff suppressed because it is too large.
Load diff
+9
-8
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mindwork-ai-studio"
|
name = "mindwork-ai-studio"
|
||||||
version = "0.9.48"
|
version = "0.9.49"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "MindWork AI Studio"
|
description = "MindWork AI Studio"
|
||||||
authors = ["Thorsten Sommer"]
|
authors = ["Thorsten Sommer"]
|
||||||
@@ -15,11 +15,11 @@ serde = { version = "1.0.219", features = ["derive"] }
|
|||||||
serde_json = "1.0.140"
|
serde_json = "1.0.140"
|
||||||
keyring = { version = "3.6.2", features = ["apple-native", "windows-native", "sync-secret-service"] }
|
keyring = { version = "3.6.2", features = ["apple-native", "windows-native", "sync-secret-service"] }
|
||||||
arboard = "3.5.0"
|
arboard = "3.5.0"
|
||||||
tokio = { version = "1.44.2", features = ["rt", "rt-multi-thread", "macros", "process"] }
|
tokio = { version = "1.45.1", features = ["rt", "rt-multi-thread", "macros", "process"] }
|
||||||
tokio-stream = "0.1.17"
|
tokio-stream = "0.1.17"
|
||||||
futures = "0.3.31"
|
futures = "0.3.31"
|
||||||
async-stream = "0.3.6"
|
async-stream = "0.3.6"
|
||||||
flexi_logger = "0.30.1"
|
flexi_logger = "0.31.1"
|
||||||
log = { version = "0.4.27", features = ["kv"] }
|
log = { version = "0.4.27", features = ["kv"] }
|
||||||
once_cell = "1.21.3"
|
once_cell = "1.21.3"
|
||||||
rocket = { version = "0.5.1", features = ["json", "tls"] }
|
rocket = { version = "0.5.1", features = ["json", "tls"] }
|
||||||
@@ -34,10 +34,11 @@ hmac = "0.12.1"
|
|||||||
sha2 = "0.10.8"
|
sha2 = "0.10.8"
|
||||||
rcgen = { version = "0.13.2", features = ["pem"] }
|
rcgen = { version = "0.13.2", features = ["pem"] }
|
||||||
file-format = "0.27.0"
|
file-format = "0.27.0"
|
||||||
calamine = "0.27.0"
|
calamine = "0.28.0"
|
||||||
pdfium-render = "0.8.31"
|
pdfium-render = "0.8.33"
|
||||||
sys-locale = "0.3.2"
|
sys-locale = "0.3.2"
|
||||||
cfg-if = "1.0.0"
|
cfg-if = "1.0.1"
|
||||||
|
pptx-to-md = "0.4.0"
|
||||||
|
|
||||||
# Fixes security vulnerability downstream, where the upstream is not fixed yet:
|
# Fixes security vulnerability downstream, where the upstream is not fixed yet:
|
||||||
url = "2.5"
|
url = "2.5"
|
||||||
@@ -46,13 +47,13 @@ crossbeam-channel = "0.5.15"
|
|||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
# See issue https://github.com/tauri-apps/tauri/issues/4470
|
# See issue https://github.com/tauri-apps/tauri/issues/4470
|
||||||
reqwest = { version = "0.12.15", features = ["native-tls-vendored"] }
|
reqwest = { version = "0.12.20", features = ["native-tls-vendored"] }
|
||||||
|
|
||||||
# Fixes security vulnerability downstream, where the upstream is not fixed yet:
|
# Fixes security vulnerability downstream, where the upstream is not fixed yet:
|
||||||
openssl = "0.10.72"
|
openssl = "0.10.72"
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
windows-registry = "0.5.2"
|
windows-registry = "0.5.3"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
custom-protocol = ["tauri/custom-protocol"]
|
custom-protocol = ["tauri/custom-protocol"]
|
||||||
+249
-80
@@ -1,57 +1,103 @@
|
|||||||
use std::path::Path;
|
use std::cmp::min;
|
||||||
use std::pin::Pin;
|
use crate::api_token::APIToken;
|
||||||
|
use crate::pandoc::PandocProcessBuilder;
|
||||||
|
use crate::pdfium::PdfiumInit;
|
||||||
use async_stream::stream;
|
use async_stream::stream;
|
||||||
use base64::{engine::general_purpose, Engine as _};
|
use base64::{engine::general_purpose, Engine as _};
|
||||||
use calamine::{open_workbook_auto, Reader};
|
use calamine::{open_workbook_auto, Reader};
|
||||||
use file_format::{FileFormat, Kind};
|
use file_format::{FileFormat, Kind};
|
||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
use pdfium_render::prelude::Pdfium;
|
use pdfium_render::prelude::Pdfium;
|
||||||
|
use pptx_to_md::{ImageHandlingMode, ParserConfig, PptxContainer};
|
||||||
|
use rocket::get;
|
||||||
|
use rocket::response::stream::{Event, EventStream};
|
||||||
|
use rocket::serde::Serialize;
|
||||||
|
use rocket::tokio::select;
|
||||||
|
use rocket::Shutdown;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::pin::Pin;
|
||||||
|
use log::{debug, error};
|
||||||
use tokio::io::AsyncBufReadExt;
|
use tokio::io::AsyncBufReadExt;
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use tokio_stream::wrappers::ReceiverStream;
|
use tokio_stream::wrappers::ReceiverStream;
|
||||||
use rocket::Shutdown;
|
|
||||||
use rocket::response::stream::{EventStream, Event};
|
|
||||||
use rocket::tokio::select;
|
|
||||||
use rocket::serde::Serialize;
|
|
||||||
use rocket::get;
|
|
||||||
use crate::api_token::APIToken;
|
|
||||||
use crate::pandoc::PandocProcessBuilder;
|
|
||||||
use crate::pdfium::PdfiumInit;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct Chunk {
|
pub struct Chunk {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
|
pub stream_id: String,
|
||||||
pub metadata: Metadata,
|
pub metadata: Metadata,
|
||||||
}
|
}
|
||||||
|
impl Chunk {
|
||||||
|
pub fn new(content: String, metadata: Metadata) -> Self {
|
||||||
|
Chunk { content, stream_id: String::new(), metadata }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_stream_id(&mut self, stream_id: &str) { self.stream_id = stream_id.to_string(); }
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub enum Metadata {
|
pub enum Metadata {
|
||||||
Text { line_number: usize },
|
Text {
|
||||||
Pdf { page_number: usize },
|
line_number: usize
|
||||||
Spreadsheet { sheet_name: String, row_number: usize },
|
},
|
||||||
Document,
|
|
||||||
Image,
|
Pdf {
|
||||||
|
page_number: usize
|
||||||
|
},
|
||||||
|
|
||||||
|
Spreadsheet {
|
||||||
|
sheet_name: String,
|
||||||
|
row_number: usize,
|
||||||
|
},
|
||||||
|
|
||||||
|
Document {},
|
||||||
|
Image {},
|
||||||
|
|
||||||
|
Presentation {
|
||||||
|
slide_number: u32,
|
||||||
|
image: Option<Base64Image>,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct Base64Image {
|
||||||
|
pub id: String,
|
||||||
|
pub content: String,
|
||||||
|
pub segment: usize,
|
||||||
|
pub is_end: bool
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Base64Image {
|
||||||
|
fn new(id: String, content: String, segment: usize, is_end: bool) -> Self {
|
||||||
|
Self { id, content, segment, is_end }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TO_MARKDOWN: &str = "markdown";
|
const TO_MARKDOWN: &str = "markdown";
|
||||||
const DOCX: &str = "docx";
|
const DOCX: &str = "docx";
|
||||||
const ODT: &str = "odt";
|
const ODT: &str = "odt";
|
||||||
|
const IMAGE_SEGMENT_SIZE_IN_CHARS: usize = 8_192; // equivalent to ~ 5500 token
|
||||||
|
|
||||||
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
|
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
|
||||||
type ChunkStream = Pin<Box<dyn Stream<Item = Result<Chunk>> + Send>>;
|
type ChunkStream = Pin<Box<dyn Stream<Item = Result<Chunk>> + Send>>;
|
||||||
|
|
||||||
#[get("/retrieval/fs/extract?<path>")]
|
#[get("/retrieval/fs/extract?<path>&<stream_id>&<extract_images>")]
|
||||||
pub async fn extract_data(_token: APIToken, path: String, mut end: Shutdown) -> EventStream![] {
|
pub async fn extract_data(_token: APIToken, path: String, stream_id: String, extract_images: bool, mut end: Shutdown) -> EventStream![] {
|
||||||
EventStream! {
|
EventStream! {
|
||||||
let stream_result = stream_data(&path).await;
|
let stream_result = stream_data(&path, extract_images).await;
|
||||||
|
let id_ref = &stream_id;
|
||||||
|
|
||||||
match stream_result {
|
match stream_result {
|
||||||
Ok(mut stream) => {
|
Ok(mut stream) => {
|
||||||
loop {
|
loop {
|
||||||
let chunk = select! {
|
let chunk = select! {
|
||||||
chunk = stream.next() => match chunk {
|
chunk = stream.next() => match chunk {
|
||||||
Some(Ok(chunk)) => chunk,
|
Some(Ok(mut chunk)) => {
|
||||||
|
chunk.set_stream_id(id_ref);
|
||||||
|
chunk
|
||||||
|
},
|
||||||
Some(Err(e)) => {
|
Some(Err(e)) => {
|
||||||
yield Event::json(&format!("Error: {}", e));
|
yield Event::json(&format!("Error: {e}"));
|
||||||
break;
|
break;
|
||||||
},
|
},
|
||||||
None => break,
|
None => break,
|
||||||
@@ -64,29 +110,42 @@ pub async fn extract_data(_token: APIToken, path: String, mut end: Shutdown) ->
|
|||||||
},
|
},
|
||||||
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
yield Event::json(&format!("Error starting stream: {}", e));
|
yield Event::json(&format!("Error starting stream: {e}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn stream_data(file_path: &str) -> Result<ChunkStream> {
|
async fn stream_data(file_path: &str, extract_images: bool) -> Result<ChunkStream> {
|
||||||
if !Path::new(file_path).exists() {
|
if !Path::new(file_path).exists() {
|
||||||
|
error!("File does not exist: '{file_path}'");
|
||||||
return Err("File does not exist.".into());
|
return Err("File does not exist.".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let file_path_clone = file_path.to_owned();
|
let file_path_clone = file_path.to_owned();
|
||||||
let fmt = tokio::task::spawn_blocking(move || {
|
let fmt = match FileFormat::from_file(&file_path_clone) {
|
||||||
FileFormat::from_file(&file_path_clone)
|
Ok(format) => format,
|
||||||
}).await??;
|
Err(error) => {
|
||||||
|
error!("Failed to determine file format for '{file_path}': {error}");
|
||||||
|
return Err(format!("Failed to determine file format for '{file_path}': {error}").into());
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
let ext = file_path.split('.').next_back().unwrap_or("");
|
let ext = file_path.split('.').next_back().unwrap_or("");
|
||||||
|
debug!("Extracting data from file: '{file_path}', format: '{fmt:?}', extension: '{ext}'");
|
||||||
|
|
||||||
let stream = match ext {
|
let stream = match ext {
|
||||||
DOCX | ODT => {
|
DOCX | ODT => {
|
||||||
let from = if ext == DOCX { "docx" } else { "odt" };
|
let from = if ext == DOCX { "docx" } else { "odt" };
|
||||||
convert_with_pandoc(file_path, from, TO_MARKDOWN).await?
|
convert_with_pandoc(file_path, from, TO_MARKDOWN).await?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"csv" | "tsv" => {
|
||||||
|
stream_text_file(file_path, true, Some("csv".to_string())).await?
|
||||||
|
},
|
||||||
|
|
||||||
|
"pptx" => stream_pptx(file_path, extract_images).await?,
|
||||||
|
|
||||||
"xlsx" | "ods" | "xls" | "xlsm" | "xlsb" | "xla" | "xlam" => {
|
"xlsx" | "ods" | "xls" | "xlsm" | "xlsb" | "xla" | "xlam" => {
|
||||||
stream_spreadsheet_as_csv(file_path).await?
|
stream_spreadsheet_as_csv(file_path).await?
|
||||||
}
|
}
|
||||||
@@ -94,83 +153,93 @@ async fn stream_data(file_path: &str) -> Result<ChunkStream> {
|
|||||||
_ => match fmt.kind() {
|
_ => match fmt.kind() {
|
||||||
Kind::Document => match fmt {
|
Kind::Document => match fmt {
|
||||||
FileFormat::PortableDocumentFormat => stream_pdf(file_path).await?,
|
FileFormat::PortableDocumentFormat => stream_pdf(file_path).await?,
|
||||||
|
|
||||||
FileFormat::MicrosoftWordDocument => {
|
FileFormat::MicrosoftWordDocument => {
|
||||||
convert_with_pandoc(file_path, "docx", TO_MARKDOWN).await?
|
convert_with_pandoc(file_path, "docx", TO_MARKDOWN).await?
|
||||||
}
|
},
|
||||||
|
|
||||||
FileFormat::OfficeOpenXmlDocument => {
|
FileFormat::OfficeOpenXmlDocument => {
|
||||||
convert_with_pandoc(file_path, fmt.extension(), TO_MARKDOWN).await?
|
convert_with_pandoc(file_path, fmt.extension(), TO_MARKDOWN).await?
|
||||||
}
|
},
|
||||||
_ => stream_text_file(file_path).await?,
|
|
||||||
|
_ => stream_text_file(file_path, false, None).await?,
|
||||||
},
|
},
|
||||||
|
|
||||||
Kind::Ebook => return Err("Ebooks not yet supported".into()),
|
Kind::Ebook => return Err("Ebooks not yet supported".into()),
|
||||||
Kind::Image => chunk_image(file_path).await?,
|
|
||||||
|
Kind::Image => {
|
||||||
|
if !extract_images {
|
||||||
|
return Err("Image extraction is disabled.".into());
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk_image(file_path).await?
|
||||||
|
},
|
||||||
|
|
||||||
Kind::Other => match fmt {
|
Kind::Other => match fmt {
|
||||||
FileFormat::HypertextMarkupLanguage => {
|
FileFormat::HypertextMarkupLanguage => {
|
||||||
convert_with_pandoc(file_path, fmt.extension(), TO_MARKDOWN).await?
|
convert_with_pandoc(file_path, fmt.extension(), TO_MARKDOWN).await?
|
||||||
}
|
},
|
||||||
_ => stream_text_file(file_path).await?,
|
|
||||||
|
_ => stream_text_file(file_path, false, None).await?,
|
||||||
},
|
},
|
||||||
|
|
||||||
Kind::Presentation => match fmt {
|
Kind::Presentation => match fmt {
|
||||||
FileFormat::OfficeOpenXmlPresentation => {
|
FileFormat::OfficeOpenXmlPresentation => {
|
||||||
convert_with_pandoc(file_path, fmt.extension(), TO_MARKDOWN).await?
|
stream_pptx(file_path, extract_images).await?
|
||||||
}
|
},
|
||||||
_ => stream_text_file(file_path).await?,
|
|
||||||
|
_ => stream_text_file(file_path, false, None).await?,
|
||||||
},
|
},
|
||||||
|
|
||||||
Kind::Spreadsheet => stream_spreadsheet_as_csv(file_path).await?,
|
Kind::Spreadsheet => stream_spreadsheet_as_csv(file_path).await?,
|
||||||
_ => stream_text_file(file_path).await?,
|
|
||||||
|
_ => stream_text_file(file_path, false, None).await?,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Box::pin(stream))
|
Ok(Box::pin(stream))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn stream_text_file(file_path: &str) -> Result<ChunkStream> {
|
async fn stream_text_file(file_path: &str, use_md_fences: bool, fence_language: Option<String>) -> Result<ChunkStream> {
|
||||||
let file = tokio::fs::File::open(file_path).await?;
|
let file = tokio::fs::File::open(file_path).await?;
|
||||||
let reader = tokio::io::BufReader::new(file);
|
let reader = tokio::io::BufReader::new(file);
|
||||||
let mut lines = reader.lines();
|
let mut lines = reader.lines();
|
||||||
let mut line_number = 0;
|
let mut line_number = 0;
|
||||||
|
|
||||||
let stream = stream! {
|
let stream = stream! {
|
||||||
|
|
||||||
|
if use_md_fences {
|
||||||
|
match fence_language {
|
||||||
|
Some(lang) if lang.trim().is_empty() => {
|
||||||
|
yield Ok(Chunk::new("```".to_string(), Metadata::Text { line_number }));
|
||||||
|
},
|
||||||
|
|
||||||
|
Some(lang) => {
|
||||||
|
yield Ok(Chunk::new(format!("```{}", lang.trim()), Metadata::Text { line_number }));
|
||||||
|
},
|
||||||
|
|
||||||
|
None => {
|
||||||
|
yield Ok(Chunk::new("```".to_string(), Metadata::Text { line_number }));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
while let Ok(Some(line)) = lines.next_line().await {
|
while let Ok(Some(line)) = lines.next_line().await {
|
||||||
line_number += 1;
|
line_number += 1;
|
||||||
yield Ok(Chunk {
|
yield Ok(Chunk::new(
|
||||||
content: line,
|
line,
|
||||||
metadata: Metadata::Text { line_number },
|
Metadata::Text { line_number }
|
||||||
});
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if use_md_fences {
|
||||||
|
yield Ok(Chunk::new("```\n".to_string(), Metadata::Text { line_number }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Box::pin(stream))
|
Ok(Box::pin(stream))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/retrieval/fs/read/pdf?<file_path>")]
|
|
||||||
pub fn read_pdf(_token: APIToken, file_path: String) -> String {
|
|
||||||
let pdfium = Pdfium::ai_studio_init();
|
|
||||||
let doc = match pdfium.load_pdf_from_file(&file_path, None) {
|
|
||||||
Ok(document) => document,
|
|
||||||
Err(e) => return e.to_string(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut pdf_content = String::new();
|
|
||||||
for page in doc.pages().iter() {
|
|
||||||
let content = match page.text().map(|text_content| text_content.all()) {
|
|
||||||
Ok(content) => content,
|
|
||||||
Err(_) => {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
pdf_content.push_str(&content);
|
|
||||||
pdf_content.push_str("\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
pdf_content
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn stream_pdf(file_path: &str) -> Result<ChunkStream> {
|
async fn stream_pdf(file_path: &str) -> Result<ChunkStream> {
|
||||||
let path = file_path.to_owned();
|
let path = file_path.to_owned();
|
||||||
let (tx, rx) = mpsc::channel(10);
|
let (tx, rx) = mpsc::channel(10);
|
||||||
@@ -194,10 +263,10 @@ async fn stream_pdf(file_path: &str) -> Result<ChunkStream> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if tx.blocking_send(Ok(Chunk {
|
if tx.blocking_send(Ok(Chunk::new(
|
||||||
content,
|
content,
|
||||||
metadata: Metadata::Pdf { page_number: num_page + 1 },
|
Metadata::Pdf { page_number: num_page + 1 }
|
||||||
})).is_err() {
|
))).is_err() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,22 +297,40 @@ async fn stream_spreadsheet_as_csv(file_path: &str) -> Result<ChunkStream> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (row_idx, row) in range.rows().enumerate() {
|
let mut row_idx = 0;
|
||||||
|
tx.blocking_send(Ok(Chunk::new(
|
||||||
|
"```csv".to_string(),
|
||||||
|
Metadata::Spreadsheet {
|
||||||
|
sheet_name: sheet_name.clone(),
|
||||||
|
row_number: row_idx,
|
||||||
|
}
|
||||||
|
))).ok();
|
||||||
|
|
||||||
|
for row in range.rows() {
|
||||||
|
row_idx += 1;
|
||||||
let content = row.iter()
|
let content = row.iter()
|
||||||
.map(|cell| cell.to_string())
|
.map(|cell| cell.to_string())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(",");
|
.join(",");
|
||||||
|
|
||||||
if tx.blocking_send(Ok(Chunk {
|
if tx.blocking_send(Ok(Chunk::new(
|
||||||
content,
|
content,
|
||||||
metadata: Metadata::Spreadsheet {
|
Metadata::Spreadsheet {
|
||||||
sheet_name: sheet_name.clone(),
|
sheet_name: sheet_name.clone(),
|
||||||
row_number: row_idx + 1,
|
row_number: row_idx,
|
||||||
},
|
}
|
||||||
})).is_err() {
|
))).is_err() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tx.blocking_send(Ok(Chunk::new(
|
||||||
|
"```".to_string(),
|
||||||
|
Metadata::Spreadsheet {
|
||||||
|
sheet_name: sheet_name.clone(),
|
||||||
|
row_number: row_idx,
|
||||||
|
}
|
||||||
|
))).ok();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -265,10 +352,10 @@ async fn convert_with_pandoc(
|
|||||||
let stream = stream! {
|
let stream = stream! {
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
match String::from_utf8(output.stdout.clone()) {
|
match String::from_utf8(output.stdout.clone()) {
|
||||||
Ok(content) => yield Ok(Chunk {
|
Ok(content) => yield Ok(Chunk::new(
|
||||||
content,
|
content,
|
||||||
metadata: Metadata::Document,
|
Metadata::Document {}
|
||||||
}),
|
)),
|
||||||
Err(e) => yield Err(e.into()),
|
Err(e) => yield Err(e.into()),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -287,11 +374,93 @@ async fn chunk_image(file_path: &str) -> Result<ChunkStream> {
|
|||||||
let base64 = general_purpose::STANDARD.encode(&data);
|
let base64 = general_purpose::STANDARD.encode(&data);
|
||||||
|
|
||||||
let stream = stream! {
|
let stream = stream! {
|
||||||
yield Ok(Chunk {
|
yield Ok(Chunk::new(
|
||||||
content: base64,
|
base64,
|
||||||
metadata: Metadata::Image,
|
Metadata::Image {},
|
||||||
});
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Box::pin(stream))
|
Ok(Box::pin(stream))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn stream_pptx(file_path: &str, extract_images: bool) -> Result<ChunkStream> {
|
||||||
|
let path = Path::new(file_path).to_owned();
|
||||||
|
|
||||||
|
let parser_config = ParserConfig::builder()
|
||||||
|
.extract_images(extract_images)
|
||||||
|
.compress_images(true)
|
||||||
|
.quality(75)
|
||||||
|
.image_handling_mode(ImageHandlingMode::Manually)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let mut streamer = tokio::task::spawn_blocking(move || {
|
||||||
|
PptxContainer::open(&path, parser_config).map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync>)
|
||||||
|
}).await??;
|
||||||
|
|
||||||
|
let (tx, rx) = mpsc::channel(32);
|
||||||
|
|
||||||
|
tokio::spawn(async move {
|
||||||
|
for slide_result in streamer.iter_slides() {
|
||||||
|
match slide_result {
|
||||||
|
Ok(slide) => {
|
||||||
|
if let Some(md_content) = slide.convert_to_md() {
|
||||||
|
let chunk = Chunk::new(
|
||||||
|
md_content,
|
||||||
|
Metadata::Presentation {
|
||||||
|
slide_number: slide.slide_number,
|
||||||
|
image: None,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if tx.send(Ok(chunk)).await.is_err() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(images) = slide.load_images_manually() {
|
||||||
|
for image in images.iter() {
|
||||||
|
let base64_data = &image.base64_content;
|
||||||
|
let total_length = base64_data.len();
|
||||||
|
let mut offset = 0;
|
||||||
|
let mut segment_index = 0;
|
||||||
|
|
||||||
|
while offset < total_length {
|
||||||
|
let end = min(offset + IMAGE_SEGMENT_SIZE_IN_CHARS, total_length);
|
||||||
|
let segment_content = &base64_data[offset..end];
|
||||||
|
let is_end = end == total_length;
|
||||||
|
|
||||||
|
let base64_image = Base64Image::new(
|
||||||
|
image.img_ref.id.clone(),
|
||||||
|
segment_content.to_string(),
|
||||||
|
segment_index,
|
||||||
|
is_end
|
||||||
|
);
|
||||||
|
|
||||||
|
let chunk = Chunk::new(
|
||||||
|
String::new(),
|
||||||
|
Metadata::Presentation {
|
||||||
|
slide_number: slide.slide_number,
|
||||||
|
image: Some(base64_image),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if tx.send(Ok(chunk)).await.is_err() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = end;
|
||||||
|
segment_index += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
let _ = tx.send(Err(Box::new(e) as Box<dyn std::error::Error + Send + Sync>)).await;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Ok(Box::pin(ReceiverStream::new(rx)))
|
||||||
|
}
|
||||||
@@ -82,7 +82,6 @@ pub fn start_runtime_api() {
|
|||||||
crate::environment::delete_enterprise_env_config_id,
|
crate::environment::delete_enterprise_env_config_id,
|
||||||
crate::environment::read_enterprise_env_config_server_url,
|
crate::environment::read_enterprise_env_config_server_url,
|
||||||
crate::file_data::extract_data,
|
crate::file_data::extract_data,
|
||||||
crate::file_data::read_pdf,
|
|
||||||
crate::log::get_log_paths,
|
crate::log::get_log_paths,
|
||||||
])
|
])
|
||||||
.ignite().await.unwrap()
|
.ignite().await.unwrap()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "MindWork AI Studio",
|
"productName": "MindWork AI Studio",
|
||||||
"version": "0.9.48"
|
"version": "0.9.49"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
|||||||
Reference in new issue
Block a user