@knkcs/importhub-ui 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1066 @@
1
+ import { jsx as n, jsxs as g, Fragment as L } from "react/jsx-runtime";
2
+ import { Button as D, EmptyState as Se, StatusBadge as Y } from "@knkcs/anker/atoms";
3
+ import { Modal as oe, StatusBadgeCell as Pe, ContextRail as Z, Card as se, TruncatedTextCell as De, IdentityCell as Ae, DateCell as Ne, ActionCell as ze, DataTable as He } from "@knkcs/anker/components";
4
+ import { InputField as Q, BaseSelectField as Oe, TextareaField as _e } from "@knkcs/anker/forms";
5
+ import { useHostIdentity as H } from "@knkcs/anker/host";
6
+ import { Tabs as J, Stack as k, Text as I, Alert as C, List as A, Link as ue, HStack as j, Box as K, Center as Ke, Spinner as Be, Table as z, Code as ee } from "@knkcs/anker/primitives";
7
+ import { DetailPageTemplate as Re, usePageRail as Ve } from "@knkcs/anker/templates";
8
+ import { useMutation as X, useQueryClient as le, useQuery as B, useQueries as We, useInfiniteQuery as qe } from "@tanstack/react-query";
9
+ import { CircleAlert as Le, Tag as Xe, RotateCcw as $e, History as je, Trash2 as Ue, ArrowRightLeft as Ge } from "lucide-react";
10
+ import { createContext as Ie, useContext as Ee, useEffect as $, useState as W, useMemo as V, useCallback as Je } from "react";
11
+ import { useForm as we, useWatch as Ze, FormProvider as Ce } from "react-hook-form";
12
+ import { useTranslation as E } from "react-i18next";
13
+ import { useSearchParams as Qe, Link as me } from "react-router";
14
+ import { C as Ye, R as et } from "./importhub-client-CrS-3Zuu.js";
15
+ const tt = { imports: { title: "Importe", empty: "In diesem Workspace gibt es noch keine Importe." }, profiles: { title: "Importprofile", summary_zero: "In diesem Workspace gibt es noch keine Importprofile.", summary_one: "In diesem Workspace gibt es ein Importprofil.", summary_other: "In diesem Workspace gibt es {{count}} Importprofile." }, mappings: { title: "Mappings", empty: "In diesem Workspace gibt es noch keine Mappings." }, entitySets: { title: "Entity Sets", summary_zero: "In diesem Workspace gibt es noch keine Entity Sets.", summary_one: "In diesem Workspace gibt es ein Entity Set.", summary_other: "In diesem Workspace gibt es {{count}} Entity Sets." }, processors: { title: "Prozessoren", summary_zero: "importhub bietet keine Prozessoren an.", summary_one: "importhub bietet einen Prozessor an.", summary_other: "importhub bietet {{count}} Prozessoren an." } }, nt = { loading: "Wird geladen…", error: "Das konnte nicht geladen werden. Versuchen Sie es gleich noch einmal." }, it = { open: "Change Set in contenthub öffnen" }, rt = { cancel: "Abbrechen", delete: "Löschen", create: "Anlegen", save: "Speichern", apply: "Übernehmen", close: "Schließen" }, st = { name: "Name", description: "Beschreibung" }, ot = { column: "Gültigkeit", valid: "Gültig", invalid: "Ungültig", invalidTitle: "Diese Konfiguration ist ungültig und kann nicht freigegeben werden:" }, lt = { column: "Letztes Release", number: "Release {{number}}", none: "Noch kein Release", state: { none: "Noch nicht freigegeben", differs: "Entwurf weicht von Release {{number}} ab", current: "Release {{number}} ist aktuell" } }, at = { nameTaken: "Dieser Name ist schon vergeben.", nameRequired: "Ein Name ist erforderlich.", failed: "Es konnte nicht angelegt werden. Versuchen Sie es gleich noch einmal." }, ct = { failed: "Die Änderungen konnten nicht gespeichert werden." }, dt = { title: "Details", actions: "Aktionen" }, pt = { moveUp: "{{name}} nach oben", moveDown: "{{name}} nach unten", remove: "{{name}} entfernen" }, ut = { new: "Neues Importprofil", empty: "In diesem Workspace gibt es noch keine Importprofile.", general: "Allgemein", entitySet: "Entity Set", entitySetHelp: "Die externen Zeichen-Entities, mit denen die Quelldatei gelesen wird.", noEntitySet: "Keines", autoPublish: "Automatisch veröffentlichen", autoPublishHelp: "Das Change Set eines Imports ohne Item Problems veröffentlichen.", deleteOnSuccess: "Quelldatei nach Erfolg löschen", deleteOnSuccessHelp: "Die Quelldatei löschen, sobald ein Import ohne Item Problems erfolgreich ist, statt nach der Aufbewahrungsfrist.", preprocessors: "Präprozessoren", mappings: "Mappings", postProcessors: "Postprozessoren", noPreprocessors: "Keine Präprozessoren: Die Quelldatei wird gemappt, wie sie ist.", noPostProcessors: "Keine Postprozessoren.", noMappings: "Es enthält noch kein Mapping.", addPreprocessor: "Präprozessor hinzufügen", addPostProcessor: "Postprozessor hinzufügen", addMapping: "Mapping hinzufügen", missingMapping: "Ein Mapping, das es nicht mehr gibt", delete: "Importprofil löschen", deleteTitle: "{{name}} löschen?", deleteMessage: "Das Importprofil wird gelöscht, und kein Import kann es mehr ausführen. Importe, die es ausgeführt hat, bleiben erhalten." }, mt = { empty: "importhub bietet keine Prozessoren an.", kindColumn: "Art", targetColumn: "Konfiguriert in", settingsColumn: "Einstellungen", noSettings: "Keine Einstellungen", kind: { preprocessor: "Präprozessor", post_processor: "Postprozessor" }, target: { source_file: "Importprofil", rich_text_field: "Rich-Text-Feld eines Mappings" }, unknown: "Nicht im Katalog", settingsOf: "Einstellungen von {{name}}", configure: "{{name}} konfigurieren", viewSettings: "Einstellungen von {{name}}", settingsCount_zero: "Keine Einstellungen gesetzt", settingsCount_one: "Eine Einstellung", settingsCount_other: "{{count}} Einstellungen" }, ht = { new: "Neues Mapping", empty: "In diesem Workspace gibt es noch keine Mappings.", general: "Allgemein", blueprint: "Ziel-Blueprint", release: "Blueprint-Release", blueprintId: "Blueprint-ID", releaseId: "Blueprint-Release-ID", idsHelp: "Wie blueprinthub sie nennt.", newRelease: "Neues Blueprint-Release", newReleaseId: "Neue Blueprint-Release-ID", elementSelector: "Element-Selektor", elementSelectorHelp: "Der XPath, der die Elemente wählt, aus denen je ein Content wird.", sourceKeySelector: "Source-Key-Selektor", sourceKeyTemplate: "Source-Key-Vorlage", sourceKeyTemplateHelp: "XPath-Ausdrücke in geschweiften Klammern, etwa {ancestor::gesetz/@refid}-{@nr}; hat Vorrang vor dem Selektor.", fieldCount_zero: "Es mappt noch kein Feld. Feld-Mappings werden im Mapping-Editor bearbeitet.", fieldCount_one: "Es mappt ein Feld. Feld-Mappings werden im Mapping-Editor bearbeitet.", fieldCount_other: "Es mappt {{count}} Felder. Feld-Mappings werden im Mapping-Editor bearbeitet.", target: "Ziel", move: "Auf ein anderes Release umstellen", moveTitle: "Auf ein anderes Blueprint-Release umstellen", check: "Prüfen", checkFailed: "Das Release konnte nicht geprüft werden.", nothingLost: "Jeden gemappten Feldpfad gibt es auch in diesem Release.", lost_one: "Ein gemappter Pfad fehlt in diesem Release:", lost_other: "{{count}} gemappte Pfade fehlen in diesem Release:", lostFields: "Feldpfade", lostReleaseSpec: "Release-Spec-Felder", moveConfirm: "Umstellen", includedBy: "Importprofile, die es enthalten", noProfiles: "Kein Importprofil enthält es.", delete: "Mapping löschen", deleteTitle: "{{name}} löschen?", deleteMessage: "Das Mapping wird gelöscht. importhub lehnt das ab, solange ein Importprofil es enthält." }, gt = { new: "Neues Entity Set", empty: "In diesem Workspace gibt es noch keine Entity Sets.", general: "Allgemein", entities: "Entities", entity: "Entity", noEntities: "Es definiert noch keine Entity.", entityName: "Entity {{index}}", entityText: "Steht für (Entity {{index}})", addEntity: "Entity hinzufügen", removeEntity: "Entity {{index}} entfernen", delete: "Entity Set löschen", deleteTitle: "{{name}} löschen?", deleteMessage: "Das Entity Set wird gelöscht. importhub lehnt das ab, solange ein Importprofil es nennt." }, ft = { settings: "Einstellungen", history: "Verlauf" }, bt = { action: "Release erstellen", title: "Release erstellen", confirm: "Release erstellen", message: "Der gespeicherte Entwurf wird als Release {{number}} freigegeben. Echte Importe verwenden ihn ab ihrem nächsten Start.", unchanged: "Der Entwurf entspricht Release {{number}}: Es gibt nichts freizugeben.", unsaved: "Nicht gespeicherte Änderungen auf dieser Seite gehören nicht zum Release. Speichern Sie sie zuerst, um sie freizugeben.", profilesIntro: "Diese Importprofile enthalten das Mapping und übernehmen das Release bei ihrem nächsten Import:", profiles: "Importprofile, die dieses Release übernehmen", noProfiles: "Noch kein Importprofil enthält das Mapping.", refused: "importhub hat das Release nicht erstellt:", failed: "Das Release konnte nicht erstellt werden. Versuchen Sie es gleich noch einmal.", done: "Release {{number}} ist erstellt.", doneBody: "Echte Importe verwenden es ab ihrem nächsten Start." }, yt = { hint: "Jedes Speichern ist eine Revision. Wählen Sie zwei aus, um sie nebeneinander zu vergleichen.", none: "Noch keine Revisionen.", loadMore: "Ältere Revisionen laden", columns: { revision: "Revision", release: "Release", savedBy: "Gespeichert von", savedAt: "Gespeichert" }, draft: "Entwurf", revision: "Früherer Entwurf", revisionOf: "Revision vom {{time}}", restoredFrom: "Wiederhergestellt aus {{revision}}", cutBy: "Erstellt von {{name}}, {{time}}.", unknownPerson: "Jemand, der nicht mehr im Workspace ist", restore: "Als Entwurf wiederherstellen", restoreTitle: "{{revision}} wiederherstellen?", restoreConfirm: "Wiederherstellen", restoreMessage: "Ihr Inhalt wird als neuer Entwurf gespeichert. Echte Importe verwenden weiter das neueste Release, bis Sie ein neues erstellen.", restoreFailed: "Sie konnte nicht wiederhergestellt werden.", olderRelease: "{{release}} wurde von {{name}} am {{time}} aus einer älteren Revision erstellt: Laden Sie ältere Revisionen, um sie zu sehen.", earlierRevision: "Eine frühere Revision" }, vt = { title: "Vergleich", between: "{{from}} verglichen mit {{to}}", field: "Feld", same: "Die beiden Revisionen sind gleich.", differing_one: "Ein Feld unterscheidet sich.", differing_other: "{{count}} Felder unterscheiden sich.", status: { unchanged: "Unverändert", added: "Hinzugefügt", removed: "Entfernt", changed: "Geändert" }, absent: "Nicht gesetzt", missingEntitySet: "Ein Entity Set, das nicht mehr existiert", yes: "Ja", no: "Nein" }, St = { tabs: { fields: "Felder", versions: "Source Key & Source Versions", output: "Ausgabe" }, reasonsHere: "importhub hat hier einen Fehler gefunden:", tree: { label: "Felder des Blueprint-Release", mapped: "gemappt", unmapped: "nicht gemappt", invalid: "ungültig", toggle: "Felder von {{label}} ein- oder ausblenden", outside: "Gemappt, nicht in diesem Release", noLookup: "Dieser Host kann die Felder des Blueprint-Release nicht lesen, daher sind nur die Felder aufgeführt, die das Mapping mappt.", loadFailed: "Die Felder des Blueprint-Release konnten nicht gelesen werden.", selectField: "Wählen Sie ein Feld, um es zu mappen." }, field: { title: "Feld-Mapping", notMapped: "Das Mapping mappt dieses Feld nicht.", map: "Feld mappen", remove: "Mapping entfernen", selector: "XPath", selectorHelp: "Relativ zum Element; die Felder eines Fieldsets relativ zu dessen.", type: "Typ", optional: "Optional", optionalHelp: "Ein Element ohne diesen Wert ist kein Fehler.", dateFormat: "Datumsformat", dateFormatHelp: "Ein Go-Zeitlayout wie 02.01.2006; leer: ISO-Daten (2006-01-02).", dateFormats: "Weitere Datumsformate", dateFormatsHelp: "Ein Go-Zeitlayout pro Zeile, der Reihe nach nach dem Datumsformat versucht.", autoDetectDateFormat: "Gängige Datumsformate erkennen", numberLocale: "Zahlenformat", locale: { de: "Deutsch (1.234,56)", en: "Englisch (1,234.56)", ch: "Schweiz (1'234.56)" }, stripCurrency: "Währungszeichen entfernen", skipInvalid: "Ungültige Werte überspringen", skipInvalidHelp: "Ein nicht lesbarer Wert lässt das Feld leer, statt ein Problem zu melden.", selectOptions: "Auswahloptionen", selectOptionsHelp: "Eine pro Zeile: Schlüssel = Bezeichnung, etwa 0 = Gesetz.", textWrapperElement: "Text-Wrapper-Element", ignoreElements: "Ignorierte Elemente", passThroughElements: "Durchgereichte Elemente", elementsHelp: "Ein Elementname pro Zeile.", normalizeWhitespace: "Leerraum normalisieren", convertNewlinesToBreaks: "Zeilenumbrüche übernehmen", richTextMore: "Node- und Mark-Mappings und die übrigen Rich-Text-Einstellungen stehen unter Erweitert (JSON).", refBlueprintId: "ID des referenzierten Blueprints", refIdTemplate: "Vorlage der Referenz-ID", refIdTemplateHelp: "XPath-Ausdrücke in geschweiften Klammern; sie müssen den Source Key des Ziels bilden.", refIdExtractPattern: "Extraktionsmuster der Referenz-ID", refIdExtractSeparator: "Trennzeichen der Referenz-ID", refIdExtractSeparatorHelp: "Verbindet die Gruppen des Musters; ohne Angabe -.", concatSelectors: "Verkettete XPaths", concatSelectorsHelp: "Ein XPath pro Zeile, der Reihe nach verbunden.", normalizeUnicode: "Unicode normalisieren", childrenHelp: "Seine Felder werden einzeln gemappt: wählen Sie sie im Baum.", elementBlueprintMap: "Blueprint je Element", elementBlueprintMapHelp: "Eine pro Zeile: Elementname = ID des referenzierten Blueprints, für einen Selektor, der mehrere Elemente trifft.", elementRefIdTemplateMap: "Vorlage der Referenz-ID je Element", elementRefIdTemplateMapHelp: "Eine pro Zeile: Elementname = Vorlage der Referenz-ID." }, json: { title: "Erweitert (JSON)", help: "Alle xmlmapper-Einstellungen des Feld-Mappings. Schlüssel, für die das Formular oben kein Eingabefeld hat, bleiben beim Speichern erhalten.", label: "Feld-Mapping als JSON", apply: "JSON übernehmen", notJson: "Das ist kein gültiges JSON.", notObject: "Ein Feld-Mapping ist ein JSON-Objekt.", unapplied: "Noch nicht übernommen: JSON übernehmen setzt es ins Formular, Speichern speichert es." }, sourceKey: { title: "Extraktion des Source Key", help: "Selektor und Vorlage des Source Key stehen unter Einstellungen.", extractPattern: "Extraktionsmuster", extractPatternHelp: "Ein regulärer Ausdruck auf den Wert jedes Platzhalters; seine Gruppen ersetzen einen passenden Wert.", extractSeparator: "Trennzeichen", extractSeparatorHelp: "Verbindet die Gruppen; - solange nicht gesetzt. Einmal gesetzt und geleert, verbindet es sie ohne Zeichen.", normalize: "Allen Leerraum aus dem Source Key entfernen" }, versionMatch: { title: "Version Match", help: "Eine Source Version entspricht einem bestehenden Release, dessen Werte alle gleich sind. Ohne Angabe ist jedes Element eine einzige Source Version, verglichen mit dem Stand von Main.", validityPeriod: "Gültigkeitszeitraum vergleichen", releaseSpecFields: "Zu vergleichende Release-Spec-Felder", noReleaseSpecFields: "Das Release hat keine Release-Spec-Felder.", contentFields: "Zu vergleichende Inhaltsfelder", noContentFields: "Das Mapping mappt noch kein Feld." }, validityPeriod: { title: "Gültigkeitszeitraum", validFrom: "XPath für gültig ab", validTo: "XPath für gültig bis", validToHelp: "Leer für unbefristet.", dateFormats: "Datumsformate", dateFormatsHelp: "Ein Go-Zeitlayout pro Zeile, der Reihe nach versucht; leer: ISO-Daten." }, releaseSpec: { title: "Quellen der Release Spec", none: "Kein Release-Spec-Wert wird aus der Quelle gelesen.", field: "Release-Spec-Feld {{index}}", selector: "XPath {{index}}", remove: "Release-Spec-Quelle {{index}} entfernen", add: "Release-Spec-Quelle hinzufügen" }, changedVersion: { title: "Changed Version", label: "Wenn eine Source Version zu einem Release passt, ihre gemappten Daten aber abweichen", help: "Ohne Auswahl: Korrigieren.", correct: "Korrigieren: ein Planned Release, das das passende ersetzt", keep: "Bestehendes Release behalten", fail: "Import fehlschlagen lassen" }, stub: { title: "Stub Mapping", label: "Stub Mapping", help: "Legt für jeden Source Key, für den es noch keinen Inhalt gibt, einen Inhalt nur mit Content Key und den gemappten Feldern an und ändert nie bestehende Inhalte." }, naming: { title: "Name und Collections", displayNameTemplate: "Vorlage des Anzeigenamens", displayNameTemplateHelp: "Feldpfade in geschweiften Klammern, etwa {titelnum} — {titel}.", collections: "Ziel-Collections", collectionsHelp: "Ein Collection-Schlüssel pro Zeile; jeder Inhalt wird in jede abgelegt." }, routing: { title: "Collection-Routing", help: "Leitet eine Collection pro Inhalt ab: den Wert des Selektors, übersetzt; sonst den Treffer des ID-Musters in der Vorlage; sonst die Ersatz-Collection.", selector: "XPath", collectionMap: "Collection-Zuordnung", collectionMapHelp: "Eine pro Zeile: Wert = Collection-Schlüssel. Leer: der Wert ist der Schlüssel.", idPattern: "ID-Muster", collectionTemplate: "Collection-Vorlage", collectionTemplateHelp: "Mit {match} und {suffix}.", suffix: "Suffix", fallback: "Ersatz-Collection" }, titles: { title: "Title Contributions", help: "Schreibt Daten je Ausgabe auf den Title, dessen Content Key der Ausgabe-Code ist.", none: "Keine Title Contributions.", item: "Title Contribution {{index}}", remove: "Title Contribution {{index}} entfernen", add: "Title Contribution hinzufügen", selector: "XPath der Ausgabe-Elemente", selectorHelp: "Wählt die Elemente, die je die Daten einer Ausgabe tragen.", ausgabeCodeSelector: "XPath des Ausgabe-Codes", referenceSpecValues: "Reference-Spec-Werte", valueField: "Reference-Spec-Feld {{index}}", valueSelector: "XPath des Werts {{index}}", removeValue: "Reference-Spec-Wert {{index}} entfernen", addValue: "Reference-Spec-Wert hinzufügen", referenceFilterSelector: "XPath des Referenzfilters", intent: "Absicht", intents: { none: "Keine", exclude: "Ausschließen", replace: "Ersetzen", annotate: "Anmerken" }, intentTextSelector: "XPath des Absichtstexts", intentTextSelectorHelp: "Der Ersatz- oder Anmerkungstext." }, assets: { title: "Placeholder Assets", help: "Macht die Dateiverweise der Quelle zu mediahub-Assets ohne Datei.", none: "Keine Dateiverweise werden zu Placeholder Assets.", item: "Placeholder Assets {{index}}", remove: "Placeholder Assets {{index}} entfernen", add: "Placeholder Assets hinzufügen", selector: "XPath der Dateiverweise", selectorHelp: "Etwa .//grafik.", assetType: "Asset-Typ", keyParts: "Schlüsselteile", keyPartsHelp: "Ein XPath pro Zeile, relativ zum Verweis; ihre Werte, mit / verbunden, bilden den Schlüssel des Assets.", nameSelector: "XPath des Namens", descriptionSelector: "XPath der Beschreibung", metadata: "Metadaten", metadataHelp: "Eine pro Zeile: Metadatenfeld = XPath.", folderRoot: "Wurzelordner", folderPathSelector: "XPath des Ordnerpfads", folderPathSelectorHelp: "Der Pfad der Datei, als Ordner unter dem Wurzelordner gespiegelt." } }, Pt = {
16
+ section: tt,
17
+ startPage: nt,
18
+ changeSet: it,
19
+ common: rt,
20
+ fields: st,
21
+ validity: ot,
22
+ release: lt,
23
+ delete: { inUse: "Es kann nicht gelöscht werden, solange diese Importprofile es verwenden:", failed: "Es konnte nicht gelöscht werden. Versuchen Sie es gleich noch einmal." },
24
+ create: at,
25
+ save: ct,
26
+ rail: dt,
27
+ order: pt,
28
+ profiles: ut,
29
+ processors: mt,
30
+ mappings: ht,
31
+ entitySets: gt,
32
+ tabs: ft,
33
+ cut: bt,
34
+ history: yt,
35
+ compare: vt,
36
+ editor: St
37
+ }, Rt = { imports: { title: "Imports", empty: "No Imports in this workspace yet." }, profiles: { title: "Import Profiles", summary_zero: "No Import Profiles in this workspace yet.", summary_one: "This workspace has one Import Profile.", summary_other: "This workspace has {{count}} Import Profiles." }, mappings: { title: "Mappings", empty: "No Mappings in this workspace yet." }, entitySets: { title: "Entity Sets", summary_zero: "No Entity Sets in this workspace yet.", summary_one: "This workspace has one Entity Set.", summary_other: "This workspace has {{count}} Entity Sets." }, processors: { title: "Processors", summary_zero: "importhub offers no Processors.", summary_one: "importhub offers one Processor.", summary_other: "importhub offers {{count}} Processors." } }, It = { loading: "Loading…", error: "This could not be loaded. Try again in a moment." }, Et = { open: "Open the Change Set in contenthub" }, wt = { cancel: "Cancel", delete: "Delete", create: "Create", save: "Save", apply: "Apply", close: "Close" }, Ct = { name: "Name", description: "Description" }, kt = { column: "Validity", valid: "Valid", invalid: "Invalid", invalidTitle: "This configuration is invalid and cannot be released:" }, Tt = { column: "Latest Release", number: "Release {{number}}", none: "No Release yet", state: { none: "Not released yet", differs: "Draft differs from Release {{number}}", current: "Release {{number}} is current" } }, Mt = { nameTaken: "Another one already has this name.", nameRequired: "A name is required.", failed: "It could not be created. Try again in a moment." }, Ft = { failed: "The changes could not be saved." }, xt = { title: "Details", actions: "Actions" }, Dt = { moveUp: "Move {{name}} up", moveDown: "Move {{name}} down", remove: "Remove {{name}}" }, At = { new: "New Import Profile", empty: "No Import Profiles in this workspace yet.", general: "General", entitySet: "Entity Set", entitySetHelp: "The external character entities the Source File is read with.", noEntitySet: "None", autoPublish: "Auto-publish", autoPublishHelp: "Publish the Change Set of an Import that succeeds without Item Problems.", deleteOnSuccess: "Delete the Source File on success", deleteOnSuccessHelp: "Delete the Source File as soon as an Import succeeds without Item Problems, instead of after the retention period.", preprocessors: "Preprocessors", mappings: "Mappings", postProcessors: "Post-processors", noPreprocessors: "No Preprocessors: the Source File is mapped as it is.", noPostProcessors: "No Post-processors.", noMappings: "It includes no Mapping yet.", addPreprocessor: "Add Preprocessor", addPostProcessor: "Add Post-processor", addMapping: "Add Mapping", missingMapping: "A Mapping that no longer exists", delete: "Delete Import Profile", deleteTitle: "Delete {{name}}?", deleteMessage: "The Import Profile is deleted, and no Import can run it any more. Imports it ran keep their record." }, Nt = { empty: "importhub offers no Processors.", kindColumn: "Kind", targetColumn: "Configured on", settingsColumn: "Settings", noSettings: "No settings", kind: { preprocessor: "Preprocessor", post_processor: "Post-processor" }, target: { source_file: "Import Profile", rich_text_field: "Rich-text field of a Mapping" }, unknown: "Not in the catalogue", settingsOf: "Settings of {{name}}", configure: "Configure {{name}}", viewSettings: "Settings of {{name}}", settingsCount_zero: "No settings set", settingsCount_one: "One setting", settingsCount_other: "{{count}} settings" }, zt = { new: "New Mapping", empty: "No Mappings in this workspace yet.", general: "General", blueprint: "Target Blueprint", release: "Blueprint Release", blueprintId: "Blueprint ID", releaseId: "Blueprint Release ID", idsHelp: "As blueprinthub names them.", newRelease: "New Blueprint Release", newReleaseId: "New Blueprint Release ID", elementSelector: "Element selector", elementSelectorHelp: "The XPath selecting the elements that each become one Content.", sourceKeySelector: "Source Key selector", sourceKeyTemplate: "Source Key template", sourceKeyTemplateHelp: "XPath expressions in braces, such as {ancestor::gesetz/@refid}-{@nr}; wins over the selector.", fieldCount_zero: "It maps no field yet. Field mappings are edited in the Mapping editor.", fieldCount_one: "It maps one field. Field mappings are edited in the Mapping editor.", fieldCount_other: "It maps {{count}} fields. Field mappings are edited in the Mapping editor.", target: "Target", move: "Move to another Release", moveTitle: "Move to another Blueprint Release", check: "Check", checkFailed: "The Release could not be checked.", nothingLost: "Every mapped field path exists in this Release.", lost_one: "One mapped path does not exist in this Release:", lost_other: "{{count}} mapped paths do not exist in this Release:", lostFields: "Field paths", lostReleaseSpec: "Release Spec fields", moveConfirm: "Move", includedBy: "Import Profiles that include it", noProfiles: "No Import Profile includes it.", delete: "Delete Mapping", deleteTitle: "Delete {{name}}?", deleteMessage: "The Mapping is deleted. importhub refuses while an Import Profile includes it." }, Ht = { new: "New Entity Set", empty: "No Entity Sets in this workspace yet.", general: "General", entities: "Entities", entity: "Entity", noEntities: "It defines no entity yet.", entityName: "Entity {{index}}", entityText: "Stands for (entity {{index}})", addEntity: "Add entity", removeEntity: "Remove entity {{index}}", delete: "Delete Entity Set", deleteTitle: "Delete {{name}}?", deleteMessage: "The Entity Set is deleted. importhub refuses while an Import Profile names it." }, Ot = { settings: "Settings", history: "History" }, _t = { action: "Cut Release", title: "Cut a Release", confirm: "Cut Release", message: "The saved draft is released as Release {{number}}. Real Imports run it from their next Start.", unchanged: "The draft is the same as Release {{number}}: there is nothing to release.", unsaved: "Unsaved changes on this page are not part of the Release. Save them first to release them.", profilesIntro: "These Import Profiles include the Mapping and take the Release at their next Import:", profiles: "Import Profiles that take this Release", noProfiles: "No Import Profile includes the Mapping yet.", refused: "importhub did not cut the Release:", failed: "The Release could not be cut. Try again in a moment.", done: "Release {{number}} is cut.", doneBody: "Real Imports run it from their next Start." }, Kt = { hint: "Every save is a Revision. Choose two to compare them side by side.", none: "No Revisions yet.", loadMore: "Load older Revisions", columns: { revision: "Revision", release: "Release", savedBy: "Saved by", savedAt: "Saved" }, draft: "Draft", revision: "Earlier draft", revisionOf: "Revision of {{time}}", restoredFrom: "Restored from {{revision}}", cutBy: "Cut by {{name}}, {{time}}.", unknownPerson: "Someone no longer in the workspace", restore: "Restore as draft", restoreTitle: "Restore {{revision}}?", restoreConfirm: "Restore", restoreMessage: "Its content is saved as a new draft. Real Imports keep running the latest Release until you cut another.", restoreFailed: "It could not be restored.", olderRelease: "{{release}} was cut by {{name}}, {{time}}, from an older Revision: load older Revisions to see it.", earlierRevision: "An earlier Revision" }, Bt = { title: "Comparison", between: "{{from}} compared with {{to}}", field: "Field", same: "The two Revisions are the same.", differing_one: "One field differs.", differing_other: "{{count}} fields differ.", status: { unchanged: "Unchanged", added: "Added", removed: "Removed", changed: "Changed" }, absent: "Not set", missingEntitySet: "An Entity Set that no longer exists", yes: "Yes", no: "No" }, Vt = { tabs: { fields: "Fields", versions: "Source Key & Source Versions", output: "Output" }, reasonsHere: "importhub found this wrong here:", tree: { label: "Fields of the Blueprint Release", mapped: "mapped", unmapped: "not mapped", invalid: "invalid", toggle: "Show or hide the fields of {{label}}", outside: "Mapped, not in this Release", noLookup: "This host cannot read the Blueprint Release's fields, so only the fields the Mapping maps are listed.", loadFailed: "The Blueprint Release's fields could not be read.", selectField: "Select a field to map it." }, field: { title: "Field mapping", notMapped: "The Mapping does not map this field.", map: "Map this field", remove: "Remove mapping", selector: "XPath", selectorHelp: "Relative to the element; a fieldset's children relative to the fieldset's.", type: "Type", optional: "Optional", optionalHelp: "An element without it is not an error.", dateFormat: "Date format", dateFormatHelp: "A Go time layout, such as 02.01.2006; ISO dates (2006-01-02) when empty.", dateFormats: "Further date formats", dateFormatsHelp: "One Go time layout per line, tried in order after the date format.", autoDetectDateFormat: "Detect common date formats", numberLocale: "Number format", locale: { de: "German (1.234,56)", en: "English (1,234.56)", ch: "Swiss (1'234.56)" }, stripCurrency: "Strip currency symbols", skipInvalid: "Skip invalid values", skipInvalidHelp: "A value that cannot be read leaves the field empty instead of reporting a problem.", selectOptions: "Select options", selectOptionsHelp: "One per line: key = label, such as 0 = Gesetz.", textWrapperElement: "Text wrapper element", ignoreElements: "Ignored elements", passThroughElements: "Pass-through elements", elementsHelp: "One element name per line.", normalizeWhitespace: "Normalize whitespace", convertNewlinesToBreaks: "Turn newlines into line breaks", richTextMore: "Node and mark mappings and the other rich-text settings are in Advanced (JSON).", refBlueprintId: "Referenced Blueprint ID", refIdTemplate: "Reference ID template", refIdTemplateHelp: "XPath expressions in braces; it must build the target's Source Key.", refIdExtractPattern: "Reference ID extract pattern", refIdExtractSeparator: "Reference ID separator", refIdExtractSeparatorHelp: "Joins the pattern's groups; - when left out.", concatSelectors: "Concatenated XPaths", concatSelectorsHelp: "One XPath per line, joined in order.", normalizeUnicode: "Normalize Unicode", childrenHelp: "Its fields are mapped on their own: select them in the tree.", elementBlueprintMap: "Blueprint by element", elementBlueprintMapHelp: "One per line: element name = referenced Blueprint ID, for a selector matching several elements.", elementRefIdTemplateMap: "Reference ID template by element", elementRefIdTemplateMapHelp: "One per line: element name = reference ID template." }, json: { title: "Advanced (JSON)", help: "The field mapping's full xmlmapper settings. Keys the form above has no input for are kept when you save.", label: "Field mapping as JSON", apply: "Apply JSON", notJson: "This is not valid JSON.", notObject: "A field mapping is a JSON object.", unapplied: "Not applied yet: Apply JSON puts it into the form, and Save saves it." }, sourceKey: { title: "Source Key extraction", help: "The Source Key's selector and template are under Settings.", extractPattern: "Extract pattern", extractPatternHelp: "A regular expression applied to each placeholder's value; its groups replace a value it matches.", extractSeparator: "Extract separator", extractSeparatorHelp: "Joins the groups; - while left unset. Emptied once set, it joins them with nothing.", normalize: "Remove all whitespace from the Source Key" }, versionMatch: { title: "Version Match", help: "A Source Version matches an existing Release whose values are all equal. Unset, each element is a single Source Version, compared with Main's head.", validityPeriod: "Compare the Validity Period", releaseSpecFields: "Release Spec fields to compare", noReleaseSpecFields: "The Release has no Release Spec fields.", contentFields: "Content fields to compare", noContentFields: "The Mapping maps no field yet." }, validityPeriod: { title: "Validity Period", validFrom: "Valid from XPath", validTo: "Valid to XPath", validToHelp: "Empty for open-ended.", dateFormats: "Date formats", dateFormatsHelp: "One Go time layout per line, tried in order; ISO dates when empty." }, releaseSpec: { title: "Release Spec sources", none: "No Release Spec value is read from the source.", field: "Release Spec field {{index}}", selector: "XPath {{index}}", remove: "Remove Release Spec source {{index}}", add: "Add Release Spec source" }, changedVersion: { title: "Changed Version", label: "When a Source Version matches a Release but its mapped data differs", help: "Correct when nothing is chosen.", correct: "Correct: a Planned Release that Supersedes the matched one", keep: "Keep the existing Release", fail: "Fail the Import" }, stub: { title: "Stub Mapping", label: "Stub Mapping", help: "Creates Content holding only the Content Key and the fields it maps for each Source Key no Content has yet, and never changes existing Content." }, naming: { title: "Name and Collections", displayNameTemplate: "Display-name template", displayNameTemplateHelp: "Field paths in braces, such as {titelnum} — {titel}.", collections: "Target Collections", collectionsHelp: "One Collection key per line; every Content is filed into each." }, routing: { title: "Collection routing", help: "Derives one Collection per Content: the selector's value, mapped; else the ID pattern's match in the template; else the fallback.", selector: "XPath", collectionMap: "Collection map", collectionMapHelp: "One per line: value = Collection key. Empty: the value is the key.", idPattern: "ID pattern", collectionTemplate: "Collection template", collectionTemplateHelp: "With {match} and {suffix}.", suffix: "Suffix", fallback: "Fallback Collection" }, titles: { title: "Title Contributions", help: "Writes per-Ausgabe data onto the Title whose Content Key is the Ausgabe code.", none: "No Title Contributions.", item: "Title Contribution {{index}}", remove: "Remove Title Contribution {{index}}", add: "Add Title Contribution", selector: "Ausgabe elements XPath", selectorHelp: "Selects the elements that carry one Ausgabe's data each.", ausgabeCodeSelector: "Ausgabe code XPath", referenceSpecValues: "Reference Spec values", valueField: "Reference Spec field {{index}}", valueSelector: "Value XPath {{index}}", removeValue: "Remove Reference Spec value {{index}}", addValue: "Add Reference Spec value", referenceFilterSelector: "Reference filter XPath", intent: "Intent", intents: { none: "None", exclude: "Exclude", replace: "Replace", annotate: "Annotate" }, intentTextSelector: "Intent text XPath", intentTextSelectorHelp: "The replacement or annotation text." }, assets: { title: "Placeholder Assets", help: "Turns the file references the source names into mediahub assets without a file.", none: "No file references become Placeholder Assets.", item: "Placeholder Assets {{index}}", remove: "Remove Placeholder Assets {{index}}", add: "Add Placeholder Assets", selector: "File references XPath", selectorHelp: "Such as .//grafik.", assetType: "Asset type", keyParts: "Key parts", keyPartsHelp: "One XPath per line, relative to the reference; their values joined by / form the asset's key.", nameSelector: "Name XPath", descriptionSelector: "Description XPath", metadata: "Metadata", metadataHelp: "One per line: metadata field = XPath.", folderRoot: "Folder root", folderPathSelector: "Folder path XPath", folderPathSelectorHelp: "The file's path, mirrored as folders under the root." } }, Wt = {
38
+ section: Rt,
39
+ startPage: It,
40
+ changeSet: Et,
41
+ common: wt,
42
+ fields: Ct,
43
+ validity: kt,
44
+ release: Tt,
45
+ delete: { inUse: "It cannot be deleted while these Import Profiles use it:", failed: "It could not be deleted. Try again in a moment." },
46
+ create: Mt,
47
+ save: Ft,
48
+ rail: xt,
49
+ order: Dt,
50
+ profiles: At,
51
+ processors: Nt,
52
+ mappings: zt,
53
+ entitySets: Ht,
54
+ tabs: Ot,
55
+ cut: _t,
56
+ history: Kt,
57
+ compare: Bt,
58
+ editor: Vt
59
+ }, P = "importhub-ui", An = {
60
+ en: { [P]: Wt },
61
+ de: { [P]: Pt }
62
+ }, Nn = [
63
+ "imports",
64
+ "profiles",
65
+ "mappings",
66
+ "entitySets",
67
+ "processors"
68
+ ];
69
+ function he(e, t, i) {
70
+ return `${e[t].replace(/\/$/, "")}/${encodeURIComponent(i)}`;
71
+ }
72
+ const qt = {
73
+ imports: "/imports",
74
+ profiles: "/settings/import-profiles",
75
+ mappings: "/settings/mappings",
76
+ entitySets: "/settings/entity-sets",
77
+ processors: "/settings/processors"
78
+ }, Lt = {
79
+ paths: qt,
80
+ changeSetHref: () => null
81
+ }, ke = Ie(Lt);
82
+ function zn({ host: e, children: t }) {
83
+ return /* @__PURE__ */ n(ke.Provider, { value: e, children: t });
84
+ }
85
+ function U() {
86
+ return Ee(ke);
87
+ }
88
+ const u = {
89
+ all: (e) => ["importhub", e],
90
+ importProfiles: (e) => [...u.all(e), "importProfiles"],
91
+ importProfile: (e, t) => [...u.importProfiles(e), t],
92
+ processors: (e) => [...u.all(e), "processors"],
93
+ mappings: (e) => [...u.all(e), "mappings"],
94
+ mapping: (e, t) => [...u.mappings(e), t],
95
+ mappingImportProfiles: (e, t) => [...u.mapping(e, t), "importProfiles"],
96
+ entitySets: (e) => [...u.all(e), "entitySets"],
97
+ entitySet: (e, t) => [...u.entitySets(e), t],
98
+ blueprints: (e) => [...u.all(e), "blueprints"],
99
+ blueprintReleases: (e, t) => [...u.blueprints(e), t, "releases"],
100
+ /** A Blueprint Release with its field tree; a Release never changes once cut. */
101
+ blueprintRelease: (e, t) => [...u.blueprints(e), "release", t],
102
+ /** One configuration of a kind, as its page reads it. */
103
+ configuration: (e, t, i) => t === "importProfile" ? u.importProfile(e, i) : t === "mapping" ? u.mapping(e, i) : u.entitySet(e, i),
104
+ /** Every list of a kind, so one change refreshes them all. */
105
+ configurations: (e, t) => t === "importProfile" ? u.importProfiles(e) : t === "mapping" ? u.mappings(e) : u.entitySets(e),
106
+ history: (e, t, i) => [...u.configuration(e, t, i), "history"],
107
+ comparison: (e, t, i, l, s) => [
108
+ ...u.configuration(e, t, i),
109
+ "comparison",
110
+ l,
111
+ s
112
+ ]
113
+ };
114
+ function Xt(e = []) {
115
+ const { t } = E(P), [i, l] = Qe(), s = /* @__PURE__ */ new Set(["history", ...e.map((o) => o.value)]), r = i.get("tab") ?? "", a = s.has(r) ? r : "settings", c = (o) => {
116
+ const p = new URLSearchParams(i);
117
+ o !== "settings" ? p.set("tab", o) : p.delete("tab"), l(p, { replace: !0 });
118
+ }, d = /* @__PURE__ */ n(J.Root, { value: a, onValueChange: (o) => c(o.value), children: /* @__PURE__ */ g(J.List, { children: [
119
+ /* @__PURE__ */ n(J.Trigger, { value: "settings", children: t("tabs.settings") }),
120
+ e.map((o) => /* @__PURE__ */ n(J.Trigger, { value: o.value, children: o.label }, o.value)),
121
+ /* @__PURE__ */ n(J.Trigger, { value: "history", children: t("tabs.history") })
122
+ ] }) });
123
+ return [a, d];
124
+ }
125
+ function $t({
126
+ open: e,
127
+ onClose: t,
128
+ title: i,
129
+ message: l,
130
+ onDelete: s,
131
+ onDeleted: r
132
+ }) {
133
+ const { t: a } = E(P), { paths: c } = U(), d = X({ mutationFn: s, onSuccess: r }), { reset: o } = d;
134
+ $(() => {
135
+ e && o();
136
+ }, [e, o]);
137
+ const p = d.error instanceof Ye ? d.error : null;
138
+ return /* @__PURE__ */ n(
139
+ oe,
140
+ {
141
+ open: e,
142
+ onClose: t,
143
+ header: i,
144
+ lazyMount: !0,
145
+ unmountOnExit: !0,
146
+ footer: /* @__PURE__ */ g(j, { gap: "2", children: [
147
+ /* @__PURE__ */ n(D, { variant: "outline", onClick: t, children: a("common.cancel") }),
148
+ /* @__PURE__ */ n(
149
+ D,
150
+ {
151
+ variant: "solid",
152
+ colorPalette: "red",
153
+ loading: d.isPending,
154
+ disabled: p !== null,
155
+ onClick: () => d.mutate(),
156
+ children: a("common.delete")
157
+ }
158
+ )
159
+ ] }),
160
+ children: /* @__PURE__ */ g(k, { gap: "4", children: [
161
+ /* @__PURE__ */ n(I, { children: l }),
162
+ p ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: a("delete.inUse"), children: /* @__PURE__ */ n(A.Root, { ps: "4", children: p.importProfiles.map((y) => /* @__PURE__ */ n(A.Item, { children: /* @__PURE__ */ n(ue, { asChild: !0, children: /* @__PURE__ */ n(me, { to: he(c, "profiles", y.id), children: y.name }) }) }, y.id)) }) }) : d.isError ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: a("delete.failed") }) : null
163
+ ] })
164
+ }
165
+ );
166
+ }
167
+ function jt() {
168
+ const { t: e } = E(P);
169
+ return /* @__PURE__ */ n(Ke, { py: "12", children: /* @__PURE__ */ n(Be, { "aria-label": e("startPage.loading") }) });
170
+ }
171
+ function Ut() {
172
+ const { t: e } = E(P);
173
+ return /* @__PURE__ */ n(K, { px: "8", py: "6", children: /* @__PURE__ */ n(Se, { icon: /* @__PURE__ */ n(Le, { size: 32, "aria-hidden": !0 }), header: e("startPage.error") }) });
174
+ }
175
+ function Gt({ state: e }) {
176
+ const { t } = E(P);
177
+ if (!e.latestRelease)
178
+ return /* @__PURE__ */ n(Y, { tone: "warning", label: t("release.state.none") });
179
+ const i = e.latestRelease.number;
180
+ return e.draftDiffersFromRelease ? /* @__PURE__ */ n(Y, { tone: "warning", label: t("release.state.differs", { number: i }) }) : /* @__PURE__ */ n(Y, { tone: "success", label: t("release.state.current", { number: i }) });
181
+ }
182
+ function Te() {
183
+ return U().canConfigure ?? !1;
184
+ }
185
+ function Me({ validity: e }) {
186
+ const { t } = E(P);
187
+ return e.valid ? null : /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: t("validity.invalidTitle"), children: /* @__PURE__ */ n(A.Root, { ps: "4", children: e.reasons.map((i) => /* @__PURE__ */ n(A.Item, { children: i.message }, `${i.code}:${i.path}:${i.message}`)) }) });
188
+ }
189
+ const Jt = (e) => ({
190
+ [e("validity.valid")]: "success",
191
+ [e("validity.invalid")]: "danger"
192
+ });
193
+ function Zt({ validity: e }) {
194
+ const { t } = E(P);
195
+ return /* @__PURE__ */ n(
196
+ Pe,
197
+ {
198
+ value: e.valid ? t("validity.valid") : t("validity.invalid"),
199
+ toneMap: Jt(t),
200
+ detail: e.valid ? null : e.reasons.map((i) => i.message).join(" ")
201
+ }
202
+ );
203
+ }
204
+ function Hn(e, t) {
205
+ return e.latestRelease ? t("release.number", { number: e.latestRelease.number }) : t("release.none");
206
+ }
207
+ function Qt({
208
+ open: e,
209
+ onClose: t,
210
+ client: i,
211
+ kind: l,
212
+ id: s,
213
+ validity: r,
214
+ state: a,
215
+ unsaved: c,
216
+ onCut: d
217
+ }) {
218
+ const { t: o } = E(P), { workspaceId: p } = H(), y = le(), h = X({
219
+ mutationFn: () => i.cutRelease(l, s, a.draftRevisionId),
220
+ onSuccess: d,
221
+ // A refusal means the page's draft is not importhub's (somebody saved
222
+ // in between, or its validity changed): read it again, so the next
223
+ // opening shows where it stands and cuts the draft that is there.
224
+ onError: () => {
225
+ y.invalidateQueries({
226
+ queryKey: u.configuration(p, l, s)
227
+ });
228
+ }
229
+ }), { reset: v } = h;
230
+ $(() => {
231
+ e && v();
232
+ }, [e, v]);
233
+ const R = B({
234
+ queryKey: u.mappingImportProfiles(p, s),
235
+ queryFn: () => i.listMappingImportProfiles(s),
236
+ enabled: e && l === "mapping"
237
+ }), m = (a.latestRelease?.number ?? 0) + 1, f = a.latestRelease !== void 0 && !a.draftDiffersFromRelease, T = r.valid && !f, F = h.error instanceof et ? h.error : null;
238
+ return /* @__PURE__ */ n(
239
+ oe,
240
+ {
241
+ open: e,
242
+ onClose: t,
243
+ header: o("cut.title"),
244
+ lazyMount: !0,
245
+ unmountOnExit: !0,
246
+ footer: /* @__PURE__ */ g(j, { gap: "2", children: [
247
+ /* @__PURE__ */ n(D, { variant: "outline", onClick: t, children: o(T ? "common.cancel" : "common.close") }),
248
+ T ? /* @__PURE__ */ n(
249
+ D,
250
+ {
251
+ variant: "solid",
252
+ loading: h.isPending,
253
+ disabled: F !== null,
254
+ onClick: () => h.mutate(),
255
+ children: o("cut.confirm")
256
+ }
257
+ ) : null
258
+ ] }),
259
+ children: /* @__PURE__ */ g(k, { gap: "4", children: [
260
+ r.valid ? f ? /* @__PURE__ */ n(
261
+ C,
262
+ {
263
+ status: "info",
264
+ colorPalette: "info",
265
+ title: o("cut.unchanged", { number: a.latestRelease?.number })
266
+ }
267
+ ) : /* @__PURE__ */ g(L, { children: [
268
+ /* @__PURE__ */ n(I, { children: o("cut.message", { number: m }) }),
269
+ c ? /* @__PURE__ */ n(C, { status: "warning", colorPalette: "warning", title: o("cut.unsaved") }) : null,
270
+ l === "mapping" ? /* @__PURE__ */ n(Yt, { query: R }) : null
271
+ ] }) : /* @__PURE__ */ n(Me, { validity: r }),
272
+ F && r.valid ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: o("cut.refused"), children: F.validity && !F.validity.valid ? /* @__PURE__ */ n(A.Root, { ps: "4", children: F.validity.reasons.map((M) => /* @__PURE__ */ n(A.Item, { children: M.message }, `${M.code}:${M.path}:${M.message}`)) }) : F.message }) : h.isError && !F ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: o("cut.failed") }) : null
273
+ ] })
274
+ }
275
+ );
276
+ }
277
+ function Yt({
278
+ query: e
279
+ }) {
280
+ const { t } = E(P), { paths: i } = U();
281
+ return e.isError ? /* @__PURE__ */ n(I, { color: "fg.muted", children: t("startPage.error") }) : e.data ? e.data.length === 0 ? /* @__PURE__ */ n(I, { children: t("cut.noProfiles") }) : /* @__PURE__ */ g(k, { gap: "2", children: [
282
+ /* @__PURE__ */ n(I, { children: t("cut.profilesIntro") }),
283
+ /* @__PURE__ */ n(A.Root, { ps: "4", "aria-label": t("cut.profiles"), children: e.data.map((l) => /* @__PURE__ */ n(A.Item, { children: /* @__PURE__ */ n(ue, { asChild: !0, children: /* @__PURE__ */ n(me, { to: he(i, "profiles", l.id), children: l.name }) }) }, l.id)) })
284
+ ] }) : /* @__PURE__ */ n(I, { color: "fg.muted", children: t("startPage.loading") });
285
+ }
286
+ function en({
287
+ client: e,
288
+ kind: t,
289
+ id: i,
290
+ validity: l,
291
+ state: s,
292
+ unsaved: r
293
+ }) {
294
+ const { t: a } = E(P), { workspaceId: c } = H(), d = le(), [o, p] = W(!1), [y, h] = W(null);
295
+ return {
296
+ railAction: /* @__PURE__ */ n(
297
+ Z.IconButton,
298
+ {
299
+ label: a("cut.action"),
300
+ icon: /* @__PURE__ */ n(Xe, { size: 16 }),
301
+ onClick: () => {
302
+ h(null), p(!0);
303
+ }
304
+ }
305
+ ),
306
+ dialog: /* @__PURE__ */ n(
307
+ Qt,
308
+ {
309
+ open: o,
310
+ onClose: () => p(!1),
311
+ client: e,
312
+ kind: t,
313
+ id: i,
314
+ validity: l,
315
+ state: s,
316
+ unsaved: r,
317
+ onCut: (v) => {
318
+ p(!1), h(v.release.number), d.invalidateQueries({
319
+ queryKey: u.configuration(c, t, i)
320
+ }), d.invalidateQueries({
321
+ queryKey: u.configurations(c, t)
322
+ }), t === "mapping" && d.invalidateQueries({
323
+ queryKey: u.importProfiles(c)
324
+ });
325
+ }
326
+ }
327
+ ),
328
+ notice: y === null ? null : /* @__PURE__ */ n(C, { status: "success", colorPalette: "success", title: a("cut.done", { number: y }), children: a("cut.doneBody") })
329
+ };
330
+ }
331
+ function Fe(e) {
332
+ const { blueprints: t } = U(), { workspaceId: i } = H(), l = [...new Set(e.filter(Boolean))].sort(), s = B({
333
+ queryKey: u.blueprints(i),
334
+ queryFn: () => t?.listBlueprints() ?? Promise.resolve([]),
335
+ enabled: t !== void 0
336
+ }), r = We({
337
+ queries: l.map((o) => ({
338
+ queryKey: u.blueprintReleases(i, o),
339
+ queryFn: () => t?.listReleases(o) ?? Promise.resolve([]),
340
+ enabled: t !== void 0
341
+ }))
342
+ }), a = r.map((o) => o.data), c = r.map((o) => o.dataUpdatedAt).join(), d = l.join();
343
+ return V(
344
+ () => ({
345
+ available: t !== void 0,
346
+ blueprintName: (o) => s.data?.find((p) => p.id === o)?.name,
347
+ releaseLabel: (o, p) => a[l.indexOf(o)]?.find((y) => y.id === p)?.label
348
+ }),
349
+ [t, s.data, c, d]
350
+ );
351
+ }
352
+ const tn = {
353
+ unchanged: "neutral",
354
+ added: "success",
355
+ removed: "danger",
356
+ changed: "warning"
357
+ }, nn = {
358
+ name: "fields.name",
359
+ description: "fields.description",
360
+ entities: "entitySets.entities",
361
+ entity_set_id: "profiles.entitySet",
362
+ preprocessors: "profiles.preprocessors",
363
+ mapping_ids: "profiles.mappings",
364
+ post_processors: "profiles.postProcessors",
365
+ auto_publish: "profiles.autoPublish",
366
+ delete_source_file_on_success: "profiles.deleteOnSuccess",
367
+ blueprint_id: "mappings.blueprint",
368
+ blueprint_release_id: "mappings.release",
369
+ element_selector: "mappings.elementSelector"
370
+ }, pe = {
371
+ blueprint_id: "mappings.blueprintId",
372
+ blueprint_release_id: "mappings.releaseId"
373
+ };
374
+ function rn({
375
+ client: e,
376
+ kind: t,
377
+ id: i,
378
+ fromRevisionId: l,
379
+ toRevisionId: s,
380
+ labelOf: r
381
+ }) {
382
+ const { t: a } = E(P), { workspaceId: c } = H(), d = B({
383
+ queryKey: u.comparison(c, t, i, l, s),
384
+ queryFn: () => e.compareRevisions(t, i, l, s)
385
+ }), { format: o, blueprintIdsOnly: p } = sn(e, t, d.data), y = (f) => p && f in pe ? pe[f] : nn[f], h = [...d.data?.fields ?? []].sort(
386
+ (f, T) => +(f.status === "unchanged") - +(T.status === "unchanged")
387
+ ), v = h.filter((f) => f.status !== "unchanged").length, R = r(l), m = r(s);
388
+ return /* @__PURE__ */ n(K, { as: "section", "aria-label": a("compare.title"), children: /* @__PURE__ */ n(se, { title: a("compare.title"), children: /* @__PURE__ */ g(k, { gap: "3", children: [
389
+ /* @__PURE__ */ n(I, { children: a("compare.between", { from: R, to: m }) }),
390
+ d.isError ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: a("startPage.error") }) : null,
391
+ d.data ? /* @__PURE__ */ g(L, { children: [
392
+ /* @__PURE__ */ n(I, { color: "fg.muted", children: v === 0 ? a("compare.same") : a("compare.differing", { count: v }) }),
393
+ /* @__PURE__ */ g(z.Root, { size: "sm", children: [
394
+ /* @__PURE__ */ n(z.Header, { children: /* @__PURE__ */ g(z.Row, { children: [
395
+ /* @__PURE__ */ n(z.ColumnHeader, { children: a("compare.field") }),
396
+ /* @__PURE__ */ n(z.ColumnHeader, { children: R }),
397
+ /* @__PURE__ */ n(z.ColumnHeader, { children: m })
398
+ ] }) }),
399
+ /* @__PURE__ */ n(z.Body, { children: h.map((f) => /* @__PURE__ */ g(z.Row, { verticalAlign: "top", children: [
400
+ /* @__PURE__ */ n(z.Cell, { as: "th", scope: "row", fontWeight: "normal", children: /* @__PURE__ */ g(k, { gap: "1", align: "start", children: [
401
+ /* @__PURE__ */ n(I, { fontWeight: "medium", children: y(f.field) ? a(y(f.field)) : f.field }),
402
+ /* @__PURE__ */ n(
403
+ Y,
404
+ {
405
+ tone: tn[f.status],
406
+ label: a(`compare.status.${f.status}`)
407
+ }
408
+ )
409
+ ] }) }),
410
+ /* @__PURE__ */ n(z.Cell, { children: /* @__PURE__ */ n(fe, { text: o(f.field, "from") }) }),
411
+ /* @__PURE__ */ n(z.Cell, { children: /* @__PURE__ */ n(fe, { text: o(f.field, "to") }) })
412
+ ] }, f.field)) })
413
+ ] })
414
+ ] }) : d.isError ? null : /* @__PURE__ */ n(I, { color: "fg.muted", children: a("startPage.loading") })
415
+ ] }) }) });
416
+ }
417
+ function fe({ text: e }) {
418
+ const { t } = E(P);
419
+ return e === null ? /* @__PURE__ */ n(I, { color: "fg.muted", children: t("compare.absent") }) : "plain" in e ? /* @__PURE__ */ n(I, { whiteSpace: "pre-wrap", children: e.plain }) : "code" in e ? /* @__PURE__ */ n(ee, { children: e.code }) : /* @__PURE__ */ n(ee, { display: "block", whiteSpace: "pre-wrap", p: "2", children: e.json });
420
+ }
421
+ function sn(e, t, i) {
422
+ const { t: l } = E(P), { workspaceId: s } = H(), r = t === "importProfile", a = B({
423
+ queryKey: u.mappings(s),
424
+ queryFn: () => e.listMappings(),
425
+ enabled: r
426
+ }), c = B({
427
+ queryKey: u.entitySets(s),
428
+ queryFn: () => e.listEntitySets(),
429
+ enabled: r
430
+ }), d = t === "mapping" && i ? [i.from.content.blueprint_id, i.to.content.blueprint_id].map((h) => String(h ?? "")) : [], o = Fe(d), p = t === "mapping" && !o.available;
431
+ return { format: (h, v) => {
432
+ const R = i?.[v].content ?? {}, m = R[h];
433
+ if (m == null) return null;
434
+ if (r && h === "mapping_ids" && Array.isArray(m))
435
+ return m.length === 0 ? { plain: l("profiles.noMappings") } : {
436
+ plain: m.map(
437
+ (f) => a.data?.find((T) => T.id === f)?.content.name ?? l("profiles.missingMapping")
438
+ ).join(`
439
+ `)
440
+ };
441
+ if (r && h === "entity_set_id")
442
+ return m === "" ? { plain: l("profiles.noEntitySet") } : {
443
+ plain: c.data?.find((f) => f.id === m)?.content.name ?? l("compare.missingEntitySet")
444
+ };
445
+ if (p && h in pe)
446
+ return m === "" ? { plain: "—" } : { code: String(m) };
447
+ if (t === "mapping" && o.available && h === "blueprint_id")
448
+ return { plain: o.blueprintName(String(m)) ?? "…" };
449
+ if (t === "mapping" && o.available && h === "blueprint_release_id") {
450
+ const f = String(R.blueprint_id ?? "");
451
+ return { plain: o.releaseLabel(f, String(m)) ?? "…" };
452
+ }
453
+ return typeof m == "string" ? { plain: m === "" ? "—" : m } : typeof m == "boolean" ? { plain: l(m ? "compare.yes" : "compare.no") } : typeof m == "number" ? { plain: String(m) } : { json: JSON.stringify(m, null, 2) };
454
+ }, blueprintIdsOnly: p };
455
+ }
456
+ const on = "YYYY-MM-DD HH:mm", ie = (e) => String(e).padStart(2, "0");
457
+ function be(e) {
458
+ const t = new Date(e);
459
+ return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${ie(t.getMonth() + 1)}-${ie(t.getDate())} ${ie(t.getHours())}:${ie(t.getMinutes())}`;
460
+ }
461
+ function ln(e, t, i) {
462
+ const { t: l } = E(P);
463
+ return V(
464
+ () => ({
465
+ of: (s) => {
466
+ if (s === i) return l("history.draft");
467
+ const r = t.find((c) => c.revisionId === s);
468
+ if (r) return l("release.number", { number: r.number });
469
+ const a = e.find((c) => c.id === s);
470
+ return a ? l("history.revisionOf", { time: be(a.savedAt) }) : l("history.earlierRevision");
471
+ },
472
+ time: be
473
+ }),
474
+ [l, e, t, i]
475
+ );
476
+ }
477
+ function an({
478
+ client: e,
479
+ kind: t,
480
+ id: i,
481
+ draftRevisionId: l,
482
+ onRestored: s
483
+ }) {
484
+ const { t: r } = E(P), { workspaceId: a, members: c } = H(), d = Te(), o = qe({
485
+ queryKey: u.history(a, t, i),
486
+ queryFn: ({ pageParam: b }) => e.listHistory(t, i, b),
487
+ initialPageParam: "",
488
+ getNextPageParam: (b) => b.nextPageToken || void 0
489
+ }), p = V(
490
+ () => (o.data?.pages ?? []).flatMap((b) => b.revisions),
491
+ [o.data]
492
+ ), y = V(() => o.data?.pages[0]?.releases ?? [], [o.data]), h = ln(p, y, l), [v, R] = W(null), [m, f] = W([]), T = V(
493
+ () => Object.fromEntries(m.map((b) => [b, !0])),
494
+ [m]
495
+ ), F = (b) => f((x) => {
496
+ const S = Object.fromEntries(x.map((_) => [_, !0])), N = typeof b == "function" ? b(S) : b, O = Object.keys(N).filter((_) => N[_]), ae = x.filter((_) => O.includes(_)), ne = O.filter((_) => !x.includes(_));
497
+ return [...ae, ...ne].slice(-2);
498
+ }), M = m.length === 2 ? [...m].sort(
499
+ (b, x) => p.findIndex((S) => S.id === x) - p.findIndex((S) => S.id === b)
500
+ ) : null, G = V(() => {
501
+ const b = (S) => y.filter((N) => N.revisionId === S), x = (S) => c.byId(S)?.displayName ?? r("history.unknownPerson");
502
+ return [
503
+ {
504
+ id: "revision",
505
+ header: r("history.columns.revision"),
506
+ enableSorting: !1,
507
+ cell: ({ row: S }) => /* @__PURE__ */ n(
508
+ De,
509
+ {
510
+ value: S.original.id === l ? r("history.draft") : r("history.revision"),
511
+ subText: S.original.restoredFromRevisionId ? r("history.restoredFrom", {
512
+ revision: h.of(S.original.restoredFromRevisionId)
513
+ }) : void 0
514
+ }
515
+ )
516
+ },
517
+ {
518
+ id: "release",
519
+ header: r("history.columns.release"),
520
+ enableSorting: !1,
521
+ cell: ({ row: S }) => {
522
+ const N = b(S.original.id);
523
+ return /* @__PURE__ */ n(
524
+ Pe,
525
+ {
526
+ value: N.length > 0 ? N.map((O) => r("release.number", { number: O.number })).join(", ") : null,
527
+ fallbackTone: "success",
528
+ detailColor: "fg.muted",
529
+ detail: N.length > 0 ? N.map(
530
+ (O) => r("history.cutBy", {
531
+ name: x(O.releasedBy),
532
+ time: h.time(O.releasedAt)
533
+ })
534
+ ).join(" ") : null
535
+ }
536
+ );
537
+ }
538
+ },
539
+ {
540
+ id: "savedBy",
541
+ header: r("history.columns.savedBy"),
542
+ enableSorting: !1,
543
+ cell: ({ row: S }) => /* @__PURE__ */ n(Ae, { name: x(S.original.savedBy) })
544
+ },
545
+ {
546
+ id: "savedAt",
547
+ header: r("history.columns.savedAt"),
548
+ enableSorting: !1,
549
+ size: 140,
550
+ cell: ({ row: S }) => /* @__PURE__ */ n(Ne, { value: S.original.savedAt, format: on })
551
+ },
552
+ {
553
+ id: "validity",
554
+ header: r("validity.column"),
555
+ enableSorting: !1,
556
+ cell: ({ row: S }) => /* @__PURE__ */ n(Zt, { validity: S.original.validity })
557
+ },
558
+ {
559
+ id: "actions",
560
+ header: "",
561
+ enableSorting: !1,
562
+ minSize: 60,
563
+ cell: ({ row: S }) => d && S.original.id !== l ? /* @__PURE__ */ n(
564
+ ze,
565
+ {
566
+ actions: [
567
+ {
568
+ icon: $e,
569
+ label: r("history.restore"),
570
+ onClick: () => R(S.original)
571
+ }
572
+ ]
573
+ }
574
+ ) : null
575
+ }
576
+ ];
577
+ }, [r, c, y, h, l, d]), q = (b) => c.byId(b)?.displayName ?? r("history.unknownPerson"), te = y.filter((b) => !p.some((x) => x.id === b.revisionId));
578
+ return /* @__PURE__ */ g(L, { children: [
579
+ /* @__PURE__ */ n(K, { px: "8", py: "4", children: /* @__PURE__ */ g(k, { gap: "1", children: [
580
+ /* @__PURE__ */ n(I, { color: "fg.muted", children: r("history.hint") }),
581
+ o.hasNextPage ? te.map((b) => /* @__PURE__ */ n(I, { color: "fg.muted", children: r("history.olderRelease", {
582
+ release: r("release.number", { number: b.number }),
583
+ name: q(b.releasedBy),
584
+ time: h.time(b.releasedAt)
585
+ }) }, b.id)) : null
586
+ ] }) }),
587
+ o.isError ? /* @__PURE__ */ n(K, { px: "8", pb: "4", children: /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: r("startPage.error") }) }) : null,
588
+ /* @__PURE__ */ n(
589
+ He,
590
+ {
591
+ columns: G,
592
+ data: p,
593
+ loading: o.isLoading,
594
+ selectable: !0,
595
+ rowSelection: T,
596
+ onRowSelectionChange: F,
597
+ getRowId: (b) => b.id,
598
+ emptyState: /* @__PURE__ */ n(Se, { icon: /* @__PURE__ */ n(je, { size: 32 }), header: r("history.none") })
599
+ }
600
+ ),
601
+ o.hasNextPage || M ? /* @__PURE__ */ n(K, { px: "8", py: "6", children: /* @__PURE__ */ g(k, { gap: "4", children: [
602
+ o.hasNextPage ? /* @__PURE__ */ n(
603
+ D,
604
+ {
605
+ size: "sm",
606
+ variant: "outline",
607
+ alignSelf: "center",
608
+ loading: o.isFetchingNextPage,
609
+ onClick: () => {
610
+ o.fetchNextPage();
611
+ },
612
+ children: r("history.loadMore")
613
+ }
614
+ ) : null,
615
+ M ? /* @__PURE__ */ n(
616
+ rn,
617
+ {
618
+ client: e,
619
+ kind: t,
620
+ id: i,
621
+ fromRevisionId: M[0],
622
+ toRevisionId: M[1],
623
+ labelOf: h.of
624
+ }
625
+ ) : null
626
+ ] }) }) : null,
627
+ /* @__PURE__ */ n(
628
+ cn,
629
+ {
630
+ revision: v,
631
+ label: v ? h.of(v.id) : "",
632
+ onClose: () => R(null),
633
+ onRestore: (b) => e.restoreRevision(t, i, b.id, l),
634
+ onRestored: () => {
635
+ f([]), Promise.resolve(s?.()).catch(() => {
636
+ });
637
+ },
638
+ kind: t,
639
+ id: i
640
+ }
641
+ )
642
+ ] });
643
+ }
644
+ function cn({
645
+ revision: e,
646
+ label: t,
647
+ onClose: i,
648
+ onRestore: l,
649
+ onRestored: s,
650
+ kind: r,
651
+ id: a
652
+ }) {
653
+ const { t: c } = E(P), { workspaceId: d } = H(), o = le(), p = e !== null, [y, h] = W({ revision: e, label: t });
654
+ e && e !== y.revision && h({ revision: e, label: t });
655
+ const v = X({
656
+ mutationFn: l,
657
+ onSuccess: () => {
658
+ s(), o.invalidateQueries({
659
+ queryKey: u.configuration(d, r, a)
660
+ }), o.invalidateQueries({
661
+ queryKey: u.configurations(d, r)
662
+ }), i();
663
+ }
664
+ }), { reset: R } = v;
665
+ return $(() => {
666
+ p && R();
667
+ }, [p, R]), /* @__PURE__ */ n(
668
+ oe,
669
+ {
670
+ open: p,
671
+ onClose: i,
672
+ header: c("history.restoreTitle", { revision: y.label }),
673
+ lazyMount: !0,
674
+ unmountOnExit: !0,
675
+ footer: /* @__PURE__ */ g(j, { gap: "2", children: [
676
+ /* @__PURE__ */ n(D, { variant: "outline", onClick: i, children: c("common.cancel") }),
677
+ /* @__PURE__ */ n(
678
+ D,
679
+ {
680
+ variant: "solid",
681
+ loading: v.isPending,
682
+ onClick: () => y.revision && v.mutate(y.revision),
683
+ children: c("history.restoreConfirm")
684
+ }
685
+ )
686
+ ] }),
687
+ children: /* @__PURE__ */ g(k, { gap: "4", children: [
688
+ /* @__PURE__ */ n(I, { children: c("history.restoreMessage") }),
689
+ v.isError ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: c("history.restoreFailed"), children: v.error.message }) : null
690
+ ] })
691
+ }
692
+ );
693
+ }
694
+ const dn = (e) => e.replace(/_([a-z0-9])/g, (t, i) => i.toUpperCase());
695
+ function pn(e) {
696
+ return !e || e === "/" ? "" : e.replace(/^\//, "").split("/").map((t) => dn(t.replace(/~1/g, "/").replace(/~0/g, "~"))).join(".");
697
+ }
698
+ function un(e) {
699
+ const t = /* @__PURE__ */ new Map();
700
+ for (const i of e) {
701
+ const l = pn(i.path);
702
+ if (!l) continue;
703
+ const s = t.get(l);
704
+ t.set(l, s ? `${s} ${i.message}` : i.message);
705
+ }
706
+ return t;
707
+ }
708
+ function mn({
709
+ open: e,
710
+ onClose: t,
711
+ client: i,
712
+ mapping: l,
713
+ onMove: s
714
+ }) {
715
+ const { t: r } = E(P), a = we({ defaultValues: { blueprintReleaseId: null } }), c = Ze({ control: a.control, name: "blueprintReleaseId" }) ?? "", d = X({
716
+ mutationFn: (m) => i.checkMappingBlueprintRelease(l.id, m)
717
+ }), o = X({ mutationFn: s, onSuccess: t }), { reset: p } = a, { reset: y } = d, { reset: h } = o;
718
+ $(() => {
719
+ e && (p({ blueprintReleaseId: null }), y(), h());
720
+ }, [e, p, y, h]);
721
+ const v = d.variables, R = d.data && v === c ? d.data : null;
722
+ return $(() => {
723
+ v !== void 0 && v !== c && y();
724
+ }, [v, c, y]), /* @__PURE__ */ n(
725
+ oe,
726
+ {
727
+ open: e,
728
+ onClose: t,
729
+ header: r("mappings.moveTitle"),
730
+ lazyMount: !0,
731
+ unmountOnExit: !0,
732
+ footer: /* @__PURE__ */ g(j, { gap: "2", children: [
733
+ /* @__PURE__ */ n(D, { variant: "outline", onClick: t, children: r("common.cancel") }),
734
+ /* @__PURE__ */ n(
735
+ D,
736
+ {
737
+ variant: "outline",
738
+ disabled: !c || c === l.content.blueprintReleaseId,
739
+ loading: d.isPending,
740
+ onClick: () => d.mutate(c),
741
+ children: r("mappings.check")
742
+ }
743
+ ),
744
+ /* @__PURE__ */ n(
745
+ D,
746
+ {
747
+ variant: "solid",
748
+ disabled: !R,
749
+ loading: o.isPending,
750
+ onClick: () => o.mutate(c),
751
+ children: r("mappings.moveConfirm")
752
+ }
753
+ )
754
+ ] }),
755
+ children: /* @__PURE__ */ n(Ce, { ...a, children: /* @__PURE__ */ g(k, { gap: "4", children: [
756
+ /* @__PURE__ */ n(hn, { mapping: l }),
757
+ d.isError ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: r("mappings.checkFailed"), children: d.error.message }) : null,
758
+ R ? /* @__PURE__ */ n(gn, { report: R }) : null,
759
+ o.isError ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: r("save.failed"), children: o.error.message }) : null
760
+ ] }) })
761
+ }
762
+ );
763
+ }
764
+ function hn({ mapping: e }) {
765
+ const { t } = E(P), { blueprints: i } = U(), { workspaceId: l } = H(), s = B({
766
+ queryKey: u.blueprintReleases(l, e.content.blueprintId),
767
+ queryFn: () => i?.listReleases(e.content.blueprintId) ?? Promise.resolve([]),
768
+ enabled: i !== void 0
769
+ });
770
+ return i ? /* @__PURE__ */ n(
771
+ Oe,
772
+ {
773
+ name: "blueprintReleaseId",
774
+ label: t("mappings.newRelease"),
775
+ required: !0,
776
+ options: (s.data ?? []).filter((r) => r.id !== e.content.blueprintReleaseId).map((r) => ({ id: r.id, label: r.label }))
777
+ }
778
+ ) : /* @__PURE__ */ n(Q, { name: "blueprintReleaseId", label: t("mappings.newReleaseId"), required: !0 });
779
+ }
780
+ function gn({ report: e }) {
781
+ const { t } = E(P), i = e.missingFieldPaths.length + e.missingReleaseSpecFields.length;
782
+ return i === 0 ? /* @__PURE__ */ n(C, { status: "success", colorPalette: "success", title: t("mappings.nothingLost") }) : /* @__PURE__ */ n(C, { status: "warning", colorPalette: "warning", title: t("mappings.lost", { count: i }), children: /* @__PURE__ */ g(k, { gap: "2", children: [
783
+ e.missingFieldPaths.length > 0 ? /* @__PURE__ */ n(ye, { label: t("mappings.lostFields"), paths: e.missingFieldPaths }) : null,
784
+ e.missingReleaseSpecFields.length > 0 ? /* @__PURE__ */ n(ye, { label: t("mappings.lostReleaseSpec"), paths: e.missingReleaseSpecFields }) : null
785
+ ] }) });
786
+ }
787
+ function ye({ label: e, paths: t }) {
788
+ return /* @__PURE__ */ g(k, { gap: "1", children: [
789
+ /* @__PURE__ */ n(I, { fontWeight: "medium", children: e }),
790
+ /* @__PURE__ */ n(A.Root, { ps: "4", "aria-label": e, children: t.map((i) => /* @__PURE__ */ n(A.Item, { children: /* @__PURE__ */ n(ee, { children: i }) }, i)) })
791
+ ] });
792
+ }
793
+ const xe = Ie(null);
794
+ function On() {
795
+ const e = Ee(xe);
796
+ if (!e) throw new Error("useMappingPage outside a Mapping's page");
797
+ return e;
798
+ }
799
+ const de = (e) => structuredClone(e), fn = [
800
+ ["versionMatch"],
801
+ ["validityPeriod"],
802
+ ["collectionRouting"],
803
+ ["sourceKey", "extractSeparator"]
804
+ ], bn = (e) => e === "" || e !== null && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0;
805
+ function ve(e, t) {
806
+ const i = JSON.parse(JSON.stringify(e));
807
+ for (const l of fn) {
808
+ const s = l.slice(0, -1), r = l[l.length - 1], a = s.reduce(
809
+ (d, o) => d?.[o],
810
+ i
811
+ ), c = s.reduce(
812
+ (d, o) => d?.[o],
813
+ t
814
+ );
815
+ a && r in a && bn(a[r]) && !(c && r in c) && delete a[r];
816
+ }
817
+ return i;
818
+ }
819
+ function _n({
820
+ client: e,
821
+ id: t,
822
+ onDeleted: i,
823
+ editor: l
824
+ }) {
825
+ const { t: s } = E(P), { workspaceId: r } = H(), a = B({
826
+ queryKey: u.mapping(r, t),
827
+ queryFn: () => e.getMapping(t)
828
+ });
829
+ return a.isError || !a.data ? /* @__PURE__ */ n(Re, { title: s("section.mappings.title"), children: a.isError ? /* @__PURE__ */ n(Ut, {}) : /* @__PURE__ */ n(jt, {}) }) : /* @__PURE__ */ n(yn, { client: e, mapping: a.data, onDeleted: i, editor: l });
830
+ }
831
+ function yn({
832
+ client: e,
833
+ mapping: t,
834
+ onDeleted: i,
835
+ editor: l
836
+ }) {
837
+ const { t: s } = E(P), { workspaceId: r } = H(), { paths: a } = U(), c = Te(), d = le(), [o, p] = W(!1), [y, h] = W(!1), v = Fe([t.content.blueprintId]), R = B({
838
+ queryKey: u.mappingImportProfiles(r, t.id),
839
+ queryFn: () => e.listMappingImportProfiles(t.id)
840
+ }), m = we({ defaultValues: de(t.content) }), { reset: f, formState: T, setError: F } = m, M = Je(() => {
841
+ for (const [w, ce] of un(t.validity.reasons))
842
+ F(w, { type: "importhub", message: ce });
843
+ }, [t, F]);
844
+ $(() => {
845
+ T.isDirty || f(de(t.content)), M();
846
+ }, [t, f, T.isDirty, M]);
847
+ const G = (w) => {
848
+ d.setQueryData(u.mapping(r, w.id), w), f(de(w.content)), d.invalidateQueries({ queryKey: u.mappings(r) }), d.invalidateQueries({ queryKey: u.importProfiles(r) });
849
+ }, q = X({
850
+ mutationFn: (w) => e.updateMapping(t.id, w, t.state.draftRevisionId),
851
+ onSuccess: G,
852
+ // Nothing was saved: the draft's reasons still hold.
853
+ onError: M
854
+ }), te = () => {
855
+ m.clearErrors(), m.handleSubmit((w) => q.mutate(ve(w, t.content)))();
856
+ }, [b, x] = Xt(l?.tabs), S = en({
857
+ client: e,
858
+ kind: "mapping",
859
+ id: t.id,
860
+ validity: t.validity,
861
+ state: t.state,
862
+ unsaved: T.isDirty
863
+ });
864
+ Ve(
865
+ c ? /* @__PURE__ */ g(Z, { storageKey: "importhub.mapping.rail", children: [
866
+ /* @__PURE__ */ n(Z.Header, { title: s("rail.title") }),
867
+ /* @__PURE__ */ g(Z.Section, { id: "actions", label: s("rail.actions"), children: [
868
+ S.railAction,
869
+ /* @__PURE__ */ n(
870
+ Z.IconButton,
871
+ {
872
+ label: s("mappings.delete"),
873
+ icon: /* @__PURE__ */ n(Ue, { size: 16 }),
874
+ tone: "outline-red",
875
+ onClick: () => p(!0)
876
+ }
877
+ )
878
+ ] })
879
+ ] }) : null
880
+ );
881
+ const N = v.blueprintName(t.content.blueprintId), O = v.releaseLabel(
882
+ t.content.blueprintId,
883
+ t.content.blueprintReleaseId
884
+ ), ae = t.content.fields?.length ?? 0, ne = /* @__PURE__ */ g(L, { children: [
885
+ S.notice,
886
+ /* @__PURE__ */ n(Me, { validity: t.validity }),
887
+ q.isError ? /* @__PURE__ */ n(C, { status: "error", colorPalette: "danger", title: s("save.failed"), children: q.error.message }) : null
888
+ ] }), _ = V(
889
+ () => ({ mapping: t, canConfigure: c, reasons: t.validity.reasons }),
890
+ [t, c]
891
+ ), ge = l?.tabs.some((w) => w.value === b) ? b : null;
892
+ return /* @__PURE__ */ g(
893
+ Re,
894
+ {
895
+ title: t.content.name,
896
+ breadcrumbs: [{ label: s("section.mappings.title"), to: a.mappings }],
897
+ badges: /* @__PURE__ */ g(j, { gap: "2", children: [
898
+ /* @__PURE__ */ n(
899
+ Y,
900
+ {
901
+ tone: t.validity.valid ? "success" : "danger",
902
+ label: t.validity.valid ? s("validity.valid") : s("validity.invalid")
903
+ }
904
+ ),
905
+ /* @__PURE__ */ n(Gt, { state: t.state })
906
+ ] }),
907
+ tabs: x,
908
+ actions: c ? /* @__PURE__ */ n(
909
+ D,
910
+ {
911
+ variant: "solid",
912
+ disabled: !T.isDirty,
913
+ loading: q.isPending,
914
+ onClick: te,
915
+ children: s("common.save")
916
+ }
917
+ ) : void 0,
918
+ children: [
919
+ b === "history" ? /* @__PURE__ */ n(
920
+ an,
921
+ {
922
+ client: e,
923
+ kind: "mapping",
924
+ id: t.id,
925
+ draftRevisionId: t.state.draftRevisionId,
926
+ onRestored: async () => {
927
+ G(await e.getMapping(t.id));
928
+ }
929
+ }
930
+ ) : /* @__PURE__ */ n(xe.Provider, { value: _, children: /* @__PURE__ */ n(Ce, { ...m, children: /* @__PURE__ */ n(
931
+ "form",
932
+ {
933
+ onSubmit: (w) => {
934
+ w.preventDefault(), c && te();
935
+ },
936
+ children: l && ge ? l.render(ge, ne) : /* @__PURE__ */ n(K, { px: "8", py: "6", children: /* @__PURE__ */ g(k, { gap: "4", children: [
937
+ ne,
938
+ /* @__PURE__ */ n(se, { title: s("mappings.general"), children: /* @__PURE__ */ g(k, { gap: "4", children: [
939
+ /* @__PURE__ */ n(
940
+ Q,
941
+ {
942
+ name: "name",
943
+ label: s("fields.name"),
944
+ required: !0,
945
+ disabled: !c
946
+ }
947
+ ),
948
+ /* @__PURE__ */ n(
949
+ _e,
950
+ {
951
+ name: "description",
952
+ label: s("fields.description"),
953
+ disabled: !c
954
+ }
955
+ ),
956
+ /* @__PURE__ */ n(
957
+ Q,
958
+ {
959
+ name: "elementSelector",
960
+ label: s("mappings.elementSelector"),
961
+ helperText: s("mappings.elementSelectorHelp"),
962
+ disabled: !c
963
+ }
964
+ ),
965
+ /* @__PURE__ */ n(
966
+ Q,
967
+ {
968
+ name: "sourceKey.selector",
969
+ label: s("mappings.sourceKeySelector"),
970
+ disabled: !c
971
+ }
972
+ ),
973
+ /* @__PURE__ */ n(
974
+ Q,
975
+ {
976
+ name: "sourceKey.template",
977
+ label: s("mappings.sourceKeyTemplate"),
978
+ helperText: s("mappings.sourceKeyTemplateHelp"),
979
+ disabled: !c
980
+ }
981
+ ),
982
+ l ? null : /* @__PURE__ */ n(I, { color: "fg.muted", fontSize: "sm", children: s("mappings.fieldCount", { count: ae }) })
983
+ ] }) }),
984
+ /* @__PURE__ */ n(se, { title: s("mappings.target"), children: /* @__PURE__ */ g(k, { gap: "3", children: [
985
+ v.available ? /* @__PURE__ */ g(L, { children: [
986
+ /* @__PURE__ */ n(re, { label: s("mappings.blueprint"), children: N ?? "…" }),
987
+ /* @__PURE__ */ n(re, { label: s("mappings.release"), children: O ?? "…" })
988
+ ] }) : /* @__PURE__ */ g(L, { children: [
989
+ /* @__PURE__ */ n(re, { label: s("mappings.blueprintId"), children: /* @__PURE__ */ n(ee, { children: t.content.blueprintId }) }),
990
+ /* @__PURE__ */ n(re, { label: s("mappings.releaseId"), children: /* @__PURE__ */ n(ee, { children: t.content.blueprintReleaseId }) })
991
+ ] }),
992
+ c ? /* @__PURE__ */ n(K, { children: /* @__PURE__ */ g(D, { variant: "outline", size: "sm", onClick: () => h(!0), children: [
993
+ /* @__PURE__ */ n(Ge, { size: 14, "aria-hidden": !0 }),
994
+ s("mappings.move")
995
+ ] }) }) : null
996
+ ] }) }),
997
+ /* @__PURE__ */ n(se, { title: s("mappings.includedBy"), children: R.isError ? /* @__PURE__ */ n(I, { color: "fg.muted", children: s("startPage.error") }) : R.data ? R.data.length === 0 ? /* @__PURE__ */ n(I, { color: "fg.muted", children: s("mappings.noProfiles") }) : /* @__PURE__ */ n(A.Root, { ps: "4", "aria-label": s("mappings.includedBy"), children: R.data.map((w) => /* @__PURE__ */ n(A.Item, { children: /* @__PURE__ */ n(ue, { asChild: !0, children: /* @__PURE__ */ n(me, { to: he(a, "profiles", w.id), children: w.name }) }) }, w.id)) }) : /* @__PURE__ */ n(I, { color: "fg.muted", children: s("startPage.loading") }) })
998
+ ] }) })
999
+ }
1000
+ ) }) }),
1001
+ S.dialog,
1002
+ /* @__PURE__ */ n(
1003
+ mn,
1004
+ {
1005
+ open: y,
1006
+ onClose: () => h(!1),
1007
+ client: e,
1008
+ mapping: t,
1009
+ onMove: async (w) => {
1010
+ const ce = {
1011
+ ...ve(m.getValues(), t.content),
1012
+ blueprintReleaseId: w
1013
+ };
1014
+ G(await e.updateMapping(t.id, ce, t.state.draftRevisionId));
1015
+ }
1016
+ }
1017
+ ),
1018
+ /* @__PURE__ */ n(
1019
+ $t,
1020
+ {
1021
+ open: o,
1022
+ onClose: () => p(!1),
1023
+ title: s("mappings.deleteTitle", { name: t.content.name }),
1024
+ message: s("mappings.deleteMessage"),
1025
+ onDelete: () => e.deleteMapping(t.id),
1026
+ onDeleted: () => {
1027
+ p(!1), d.removeQueries({ queryKey: u.mapping(r, t.id) }), d.invalidateQueries({ queryKey: u.mappings(r) }), i();
1028
+ }
1029
+ }
1030
+ )
1031
+ ]
1032
+ }
1033
+ );
1034
+ }
1035
+ function re({ label: e, children: t }) {
1036
+ return /* @__PURE__ */ g(j, { gap: "4", align: "baseline", children: [
1037
+ /* @__PURE__ */ n(I, { color: "fg.muted", minW: "40", children: e }),
1038
+ /* @__PURE__ */ n(K, { children: t })
1039
+ ] });
1040
+ }
1041
+ export {
1042
+ an as C,
1043
+ $t as D,
1044
+ P as I,
1045
+ Ut as L,
1046
+ _n as M,
1047
+ Gt as R,
1048
+ qt as S,
1049
+ Me as V,
1050
+ jt as a,
1051
+ Te as b,
1052
+ Xt as c,
1053
+ en as d,
1054
+ he as e,
1055
+ Zt as f,
1056
+ Fe as g,
1057
+ Nn as h,
1058
+ u as i,
1059
+ zn as j,
1060
+ An as k,
1061
+ On as l,
1062
+ pn as m,
1063
+ Hn as r,
1064
+ U as u
1065
+ };
1066
+ //# sourceMappingURL=mapping-page-v0GJAPjW.js.map