dfg_3dviewer_js_library/dist/library/dfg_3dviewer.min.js
2026-06-25 09:19:26 +02:00

10 lines
421 KiB
JavaScript

import{T as e,e as t,V as n,M as i,Q as o,E as r,a,O as s,b as l,F as c,c as d}from"./assets/three.js";window.THREE=e;const u={clippingPlanes:null,materialsFolder:null,materialsPropertiesText:null,camera:null,colors:{},intensity:{},ambientLight:null,cameraLight:null,mainCanvas:null,noticeContainer:null,statusNotice:null,gridSize:null,dirLightTarget:null,lightHelper:null,scene:new e.Scene,basicGrid:new e.Group,axesHelper:new e.AxesHelper,cameraCoords:null,tween:new t.Tween,controls:null,transformControlClippingPlaneY:null,transformControlClippingPlaneX:null,transformControlClippingPlaneZ:null,planeHelpers:null,outlineClipping:null,sceneBackgroundColor:null,distanceGeometry:null,planeParams:null,clippingFolder:null,helperObjects:[]},p=(e,t)=>{u[e]=t};function h(e,t,n,i){return{x:e.x+i/Math.abs(n)*t.x,y:e.y+i/Math.abs(n)*t.y,z:e.z+i/Math.abs(n)*t.z}}function g(e,t){return 0===e.length?e:e.length>t?e.substring(0,t)+"...":e}function m(e){if(null==e)return null;if(Array.isArray(e)&&Array.isArray(e[0])&&(e=e[0]),"object"==typeof e&&null!==e&&"number"==typeof e.r&&"number"==typeof e.g&&"number"==typeof e.b)return{r:e.r,g:e.g,b:e.b,a:e.a??1};if(Array.isArray(e)){const[t,n,i,o=1]=e;return"number"==typeof t&&"number"==typeof n&&"number"==typeof i?{r:t,g:n,b:i,a:o}:null}return"number"==typeof e?{r:e>>16&255,g:e>>8&255,b:255&e,a:1}:"string"==typeof e?f(e):null}function f(e){if("string"!=typeof e)return null;if((e=e.trim()).startsWith("0x")){const t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t,a:1}}if(e.startsWith("#")){let t=e.slice(1);return 3===t.length&&(t=t.split("").map(e=>e+e).join("")),6!==t.length?null:{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:1}}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/i);if(t){const[,e,n,i,o]=t;return{r:+e,g:+n,b:+i,a:void 0!==o?+o:1}}return null}p("getProxyPath",function(e,t){return decodeURIComponent(t.mainUrl).replace(u.fileObject.originalPath,encodeURIComponent(e))});const b={en:{menu:{actions:"Viewer actions",openActions:"Open viewer actions",embed:"Embed",exitEmbed:"Exit embed",openEmbedOptions:"Open embed options",exitEmbedMode:"Exit embed mode",download:"Download"},theme:{lightMode:"Light mode",darkMode:"Dark mode",switchToLightMode:"Switch to light mode",switchToDarkMode:"Switch to dark mode"},fullscreen:{mode:"Fullscreen mode",enter:"Fullscreen",exit:"Exit fullscreen",exitMode:"Exit fullscreen mode"},language:{label:"Language: English",switchToPolish:"Switch to Polish",switchToEnglish:"Switch to English",switchToGerman:"Switch to German"},hints:{pickingSelect:"Select at least one face to add annotation.",picking:"Shift + click to select multiple faces",clipping:"Drag active clipping plane helper to adjust cut"},controls:{enablePickingMode:"Enable picking mode",disablePickingMode:"Disable picking mode",enableDistanceMeasurement:"Enable distance measurement",disableDistanceMeasurement:"Disable distance measurement",selectedFaces:"Selected faces"},gui:{moveToolbar:"Move toolbar",orbit:"Navigation mode",controls:"Controls",editor:"Editor",transform3dObject:"Transform 3D Object",transformLight:"Transform Light",transformMode:"Transform Mode",directionalLight:"Directional Light",ambientLight:"Ambient Light",ambient:"Ambient",lights:"Lights",cameraLight:"Camera Light",backgroundColor:"Background Color",BackgroundColorOuter:"Background Color Outer",backgroundType:"Background Type",clippingPlanes:"Clipping Planes",clippingFolder:"Clipping Planes",displayHelperX:"Show X helper",displayHelperY:"Show Y helper",displayHelperZ:"Show Z helper",constantX:"Constant X",constantY:"Constant Y",constantZ:"Constant Z",visible:"Visible cutting",materials:"Materials",metadata:"Annotations",saveProperties:"Save properties",hierarchy:"Hierarchy",statistics:"Statistics",clearSelectedFaces:"Clear selected faces",clearSelectedHierarchy:"Clear selected objects",addAnnotations:"Add annotations",exportAnnotationsXml:"Export annotations XML",importAnnotationsXml:"Import annotations XML",IIIFexport:"Export IIIF",resetCameraPosition:"Reset camera position",saveSettings:"Save settings",renderPreview:"Render preview",color:"Color",intensity:"Intensity",metalness:"Metalness",emissive:"Emissive",position:"Position",rotation:"Rotation",camera:"Camera",performance:"Performance",highPerformance:"High-performance",lowPower:"Low-power",default:"Default",none:"None",move:"Move",rotate:"Rotate",scale:"Scale",target:"Target",local:"Local",global:"Global",linear:"Linear",gradient:"Gradient",editMaterial:"Edit material",selectByMaterial:"select by material",hideAdvancedEditor:"Hide advanced editor",showAdvancedEditor:"Show advanced editor",showLoadingLogs:"Show loading logs",hideLoadingLogs:"Hide loading logs",hierarchy:"Hierarchy",expand:"Expand toolbar",collapse:"Collapse toolbar",orthographicProjection:"Switch to orthographic projection",perspectiveProjection:"Switch to perspective projection",environmentMap:"Environment map",environmentMapToggle:"Toggle environment map",environmentMapIntensity:"Environment map intensity",environmentMapStyleNeutral:"Neutral",environmentMapStyleSunny:"Sunny",environmentMapStyleStudio:"Studio",environmentMapStyleGoldenHour:"Golden Hour",enableWireframeMode:"Enable wireframe mode",disableWireframeMode:"Disable wireframe mode",download:"Download model"},metadata:{modelDetails:"Model details",metadata:"Metadata",visualizedFile:"Visualized file",vertices:"Vertices",faces:"Faces",title:"Title",author:"Author",authorAffiliation:"Author affiliation",license:"License",description:"Description",objectType:"Object type",reconstructionAuthors:"Reconstruction authors",reconstructionPeriod:"Reconstruction period"},manifesto:{invalidUrl:"Please enter a valid manifesto URL.",invalidJson:"Please enter a valid manifesto JSON text."},iiif:{loader:"IIIF Loader",collapse:"Collapse",expand:"Expand",manifest:"IIIF manifest",loadFromUrl:"Load from URL",loadFromText:"Load from Text",manifestUrlPlaceholder:"https://example.org/iiif/manifest.json",manifestTextPlaceholder:"Paste IIIF manifest JSON here...",invalidUrl:"Please enter a valid IIIF manifest URL.",invalidJson:"Please enter a valid IIIF JSON text.",optionModelPositionScale:"Model Position and Scale",optionModelOrigin:"Model Origin",optionModelOriginBg:"Model Origin with background color",optionModelPosition:"Model Position"},localPreview:{loadExampleModel:"Load example model"},embedPanel:{title:"Embed options",closeAria:"Close embed options",modelUrl:"Model URL",modelUrlPlaceholder:"/examples/box.glb",entityId:"Entity ID",theme:"Theme",themeDark:"Dark",themeLight:"Light",autoRotateSpeed:"Auto-rotate speed",cameraPosition:"Camera position",cameraTarget:"Camera target",cameraVectorPlaceholder:"x,y,z",fov:"FOV",autoRotate:"Auto-rotate",disableInteraction:"Disable interaction",hideActionMenu:"Hide action menu",hideMetadata:"Hide metadata",presentationMode:"Presentation mode",useCurrentCamera:"Use Current Camera",resetFromViewer:"Reset From Viewer",copyUrl:"Copy URL",copyIframe:"Copy Iframe",embedUrl:"Embed URL",iframeCode:"Iframe code",preview:"Preview",previewTitle:"Embed preview"},loadingLog:{title:"Loading process log",loadingModel:"Loading 3D model...",modelLoaded:"Model has been loaded.",loadingAssets:"Loading assets...",parsingScene:"Parsing scene...",loadingTextures:"Loading textures...",preparingGeometry:"Preparing geometry...",settingUpLighting:"Setting up lighting...",settingUpMaterials:"Setting up materials...",buildingBvh:"Building BVH...",compilingShaders:"Compiling shaders...",initializingRenderer:"Initializing renderer...",uploadingBuffers:"Uploading buffers...",fetchingMetadata:"Fetching metadata..."},processingHeader:"Processing progress",processingSteps:{preparingModel:"Preparing model",convertingToTransmissionFormat:"Converting to transmission format",renderingThumbnails:"Rendering thumbnails",savingEntity:"Saving entity",finalizing3dModel:"Finalizing 3D model",initializingViewer:"Initializing viewer"},state:{enabled:"enabled",disabled:"disabled"},toasts:{transformMove:"Move: drag axis arrows to reposition the object.",transformRotate:"Rotate: drag rotation rings to rotate the object.",transformScale:"Scale: drag axis handles to resize the object.",transformLightMove:"Transform Light - Move: drag axis arrows to move the directional light.",transformLightTarget:"Transform Light - Target: drag axis arrows to reposition the light target.",distanceEnabled:"Distance measurement is enabled.",distanceHint:"Select a start point and an end point to measure distance.",noIiiifModelFallback:"No 3D model found in IIIF manifest, loading example model.",facePickingEnabled:"Face picking is enabled",facePickingDisabled:"Face picking is disabled",distanceModeEnabled:"Distance measurement mode is enabled",distanceModeDisabled:"Distance measurement mode is disabled",settingsFound:"Settings {filename}_viewer.json found",settingsNotFound:"No settings {filename}_viewer.json found",metadataFetchError:"Error fetching metadata: {error}",presentationModeError:"An error occurred during presentation mode setup.",objLoaded:"OBJ model has been loaded.",mtlLoadError:"Error occurred while loading attached MTL file.",glbLoadError:"Error occurred while loading attached GLB file.",unsupportedExtension:"File extension is not supported yet.",modelLoaded:"Model {filename} has been loaded.",modelLoadedSimple:"Model loaded successfully.",unsupportedFormat:"Unsupported file format.",presentationModeReady:"Presentation mode is ready.",presentationModeError:"An error occurred during presentation mode setup.",sandboxDropModel:"Drag and drop a 3D model into the viewer.",supportedFormats:"<strong>Supported formats</strong>:\n{formats}\nand <strong>archive formats</strong>: {archives}.",embedSourceMissing:"Set Model URL or Entity ID for embed.",embedUrlCopied:"Embed URL copied.",embedUrlCopyError:"Could not copy embed URL.",embedIframeCopied:"Embed iframe copied.",embedIframeCopyError:"Could not copy embed iframe.",embedCodeCopied:"Embed code copied to clipboard.",embedCodeCopyError:"Could not copy embed code.",annotationDataMissing:"Annotation data not found for this POI.",selectFaceRequired:"Select at least one face to add annotation.",selectFaceRequiredAgain:"Select at least one face, then run Add annotations again.",noFacesSelected:"No faces selected for annotation.",titleRequired:"Title is required.",facesInactive:"Selected faces are no longer active.",annotationsSaved:"Annotations saved for {count} face{plural}.",annotationsImported:"Imported {count} annotation{plural}.",annotationsExported:"Annotations XML exported.",noAnnotationsToExport:"No annotations to export.",noValidAnnotations:"No valid annotations found in XML.",annotationsImportError:"Failed to import annotations XML.",settingsSaved:"Settings have been saved.",settingsSaveError:"Error saving settings.",featureToggle:"{feature} is {state}.",clippingHelperToggle:"Clipping plane {axis} helper {state}.",clippingPlanes:"Drag active clipping plane helper to adjust cut",downloadSuccess:"Model downloaded successfully.",downloadError:"Failed to download model.",iiifManifestGenerated:"IIIF manifest has been generated.",iiifManifestGenerationError:"Error generating IIIF manifest.",containerNotFound:"Container element not found. Please check the Viewer configuration.",missingFiles:"Missing required files for the Viewer. Please check the Viewer configuration.",unsupportedFileFormat:"Unsupported file format."},shortcuts:{mouse:"Mouse: drag orbit, wheel zoom, right-drag pan",keyboard:"Keyboard: Arrows orbit, Shift+Arrows faster, Ctrl/Cmd+Arrows pan, +/- zoom, Space toggle auto-rotate",touch:"Touch: pinch-to-zoom, drag to orbit, double-tap-and-hold pan",dragAndDrop:"Or drag and drop a 3D model into the viewer"}},pl:{menu:{actions:"Akcje podglądu",openActions:"Otworz akcje podglądu",embed:"Osadź",exitEmbed:"Wyjdź z osadzania",openEmbedOptions:"Otwórz opcje osadzania",exitEmbedMode:"Wyjdź z trybu osadzania",download:"Pobierz"},theme:{lightMode:"Tryb jasny",darkMode:"Tryb ciemny",switchToLightMode:"Przelącz na tryb jasny",switchToDarkMode:"Przelącz na tryb ciemny"},fullscreen:{mode:"Tryb pełnoekranowy",enter:"Pełny ekran",exit:"Wyjdź z pełnego ekranu",exitMode:"Wyjdź z trybu pełnoekranowego"},language:{label:"Language: Polski",switchToPolish:"Przelącz na język polski",switchToEnglish:"Przelącz na język angielski",switchToGerman:"Przelącz na język niemiecki"},hints:{picking:"Shift + klik, aby wybrać wiele scian",pickingSelect:"Wybierz co najmniej jedną ścianę, aby dodać adnotację.",clipping:"Przeciągnij aktywną plaszczyznę przycinania, aby dostosować cięcie"},controls:{enablePickingMode:"Włącz tryb wyboru",disablePickingMode:"Wyłącz tryb wyboru",enableDistanceMeasurement:"Włącz pomiar odległości",disableDistanceMeasurement:"Wyłącz pomiar odległości",selectedFaces:"Wybrane sciany"},gui:{moveToolbar:"Przesuń pasek narzędzi",orbit:"Tryb nawigacji",controls:"Sterowanie",editor:"Edytor",transform3dObject:"Transformacja obiektu 3D",transformLight:"Transformacja światła",transformMode:"Tryb transformacji",directionalLight:"Światło kierunkowe",ambientLight:"Światło otaczające",ambient:"Ambient",lights:"Światła",cameraLight:"Światło kamery",backgroundColor:"Kolor tła",backgroundColorOuter:"Kolor tła zewnętrznego",backgroundType:"Typ tła",clippingPlanes:"Płaszczyzny przycinania",clippingFolder:"Płaszczyzny przycinania",displayHelperX:"Pokaż oś X",displayHelperY:"Pokaż oś Y",displayHelperZ:"Pokaż oś Z",constantX:"Stała X",constantY:"Stała Y",constantZ:"Stała Z",visible:"Widoczne cięcie",materials:"Materiały",metadata:"Annotacje",saveProperties:"Zapisz właściwości",hierarchy:"Hierarchia",statistics:"Statystyki",clearSelectedFaces:"Wyczyść wybrane ściany",clearSelectedHierarchy:"Odznacz wybrane obiekty",addAnnotations:"Dodaj annotacje",exportAnnotationsXml:"Eksportuj annotacje XML",importAnnotationsXml:"Importuj annotacje XML",IIIFexport:"Eksportuj do IIIF",resetCameraPosition:"Resetuj pozycję kamery",saveSettings:"Zapisz ustawienia",renderPreview:"Renderuj podgląd",color:"Kolor",intensity:"Intensywność",metalness:"Metaliczność",emissive:"Emisja",position:"Pozycja",rotation:"Rotacja",camera:"Kamera",performance:"Wydajność",highPerformance:"Wysoka wydajność",lowPower:"Niski pobór mocy",default:"Domyślny",none:"Brak",move:"Przesuń",rotate:"Obróć",scale:"Skaluj",target:"Cel",local:"Lokalny",global:"Globalny",linear:"Liniowe",gradient:"Gradient",editMaterial:"Edytuj materiał",selectByMaterial:"wybierz według materiału",hideAdvancedEditor:"Ukryj tryb zaawansowany",showAdvancedEditor:"Pokaż tryb zaawansowany",showLoadingLogs:"Pokaż logi ładowania",hideLoadingLogs:"Ukryj logi ładowania",hierarchy:"Hierarchia",collapse:"Zwiń pasek narzędzi",expand:"Rozwiń pasek narzędzi",orthographicProjection:"Przełącz na projekcję ortograficzną",perspectiveProjection:"Przełącz na projekcję perspektywiczną",environmentMap:"Mapa otoczenia",environmentMapToggle:"Przełącz mapę otoczenia",environmentMapIntensity:"Intensywność mapy otoczenia",environmentMapStyleNeutral:"Neutralny",environmentMapStyleSunny:"Słoneczny",environmentMapStyleStudio:"Studio",environmentMapStyleGoldenHour:"Złota godzina",enableWireframeMode:"Włącz tryb siatki",disableWireframeMode:"Wyłącz tryb siatki",download:"Pobierz model"},metadata:{modelDetails:"Szczegóły modelu",metadata:"Metadane",visualizedFile:"Wizualizowany plik",vertices:"Wierzchołki",faces:"Ściany",title:"Tytuł",author:"Autor",authorAffiliation:"Afiliacja autora",license:"Licencja",description:"Opis",objectType:"Typ obiektu",reconstructionAuthors:"Autorzy rekonstrukcji",reconstructionPeriod:"Okres rekonstrukcji"},manifesto:{invalidUrl:"Podaj poprawny URL manifestu.",invalidJson:"Podaj poprawny tekst JSON."},iiif:{loader:"Ładowanie IIIF",collapse:"Zwiń",expand:"Rozwiń",manifest:"Manifest IIIF",loadFromUrl:"Wczytaj z URL",loadFromText:"Wczytaj z tekstu",manifestUrlPlaceholder:"https://example.org/iiif/manifest.json",manifestTextPlaceholder:"Wklej tutaj JSON manifestu IIIF...",invalidUrl:"Podaj poprawny URL manifestu IIIF.",invalidJson:"Podaj poprawny tekst JSON IIIF.",optionModelPositionScale:"Pozycja i skala modelu",optionModelOrigin:"Punkt początkowy modelu",optionModelOriginBg:"Punkt początkowy modelu z kolorem tła",optionModelPosition:"Pozycja modelu"},localPreview:{loadExampleModel:"Wczytaj model przykładowy"},embedPanel:{title:"Opcje osadzania",closeAria:"Zamknij opcje osadzania",modelUrl:"URL modelu",modelUrlPlaceholder:"/examples/box.glb",entityId:"ID encji",theme:"Motyw",themeDark:"Ciemny",themeLight:"Jasny",autoRotateSpeed:"Prędkość auto-obrotu",cameraPosition:"Pozycja kamery",cameraTarget:"Cel kamery",cameraVectorPlaceholder:"x,y,z",fov:"FOV",autoRotate:"Auto-obrót",disableInteraction:"Wyłącz interakcję",hideActionMenu:"Ukryj menu akcji",hideMetadata:"Ukryj metadane",presentationMode:"Tryb prezentacji",useCurrentCamera:"Użyj bieżącej kamery",resetFromViewer:"Przywróć z viewera",copyUrl:"Kopiuj URL",copyIframe:"Kopiuj iframe",embedUrl:"URL osadzenia",iframeCode:"Kod iframe",preview:"Podgląd",previewTitle:"Podgląd osadzenia"},loadingLog:{title:"Log procesu ładowania",loadingModel:"Ładowanie modelu 3D...",modelLoaded:"Model został załadowany.",loadingAssets:"Ładowanie zasobów...",parsingScene:"Analizowanie sceny...",loadingTextures:"Ładowanie tekstur...",preparingGeometry:"Przygotowywanie geometrii...",settingUpLighting:"Konfigurowanie oświetlenia...",settingUpMaterials:"Konfigurowanie materiałów...",buildingBvh:"Budowanie BVH...",compilingShaders:"Kompilowanie shaderów...",initializingRenderer:"Inicjalizowanie renderera...",uploadingBuffers:"Przesyłanie buforów...",fetchingMetadata:"Pobieranie metadanych..."},processingHeader:"Postęp przetwarzania",processingSteps:{preparingModel:"Przygotowywanie modelu",convertingToTransmissionFormat:"Konwersja do formatu docelowego",renderingThumbnails:"Renderowanie miniaturek",savingEntity:"Zapisywanie encji",finalizing3dModel:"Finalizowanie modelu 3D",initializingViewer:"Inicjalizowanie viewera"},state:{enabled:"włączony",disabled:"wyłączony"},toasts:{transformMove:"Przesuwanie: przeciągnij strzalki osi, aby przesunąć obiekt.",transformRotate:"Obracanie: przeciągnij pierscienie obrotu, aby obrócić obiekt.",transformScale:"Skalowanie: przeciągnij uchwyty osi, aby zmienić rozmiar obiektu.",transformLightMove:"Transformacja światła - Przesunięcie: przeciągnij strzalki osi, aby przesunąć światło kierunkowe.",transformLightTarget:"Transformacja światła - Cel: przeciągnij strzałki osi, aby przesunąć punkt celu światła.",distanceEnabled:"Pomiar odległości jest włączony.",distanceHint:"Wybierz punkt początkowy i końcowy, aby zmierzyć odległość.",noIiiifModelFallback:"Nie znaleziono modelu 3D w manifescie IIIF, ładuję model przykładowy.",facePickingEnabled:"Tryb wyboru ścian jest włączony",facePickingDisabled:"Tryb wyboru ścian jest wyłączony",distanceModeEnabled:"Tryb pomiaru odległości jest włączony",distanceModeDisabled:"Tryb pomiaru odległości jest wyłączony",settingsFound:"Znaleziono ustawienia {filename}_viewer.json",settingsNotFound:"Nie znaleziono ustawień {filename}_viewer.json",metadataFetchError:"Błąd pobierania metadanych: {error}",presentationModeError:"Wystąpił błąd podczas konfiguracji trybu prezentacji.",objLoaded:"Model OBJ został załadowany.",mtlLoadError:"Wystąpił błąd podczas ładowania pliku MTL.",glbLoadError:"Wystąpił błąd podczas ładowania pliku GLB.",unsupportedExtension:"Rozszerzenie pliku nie jest jeszcze obsługiwane.",modelLoaded:"Model {filename} został załadowany.",modelLoadedSimple:"Model został pomyślnie załadowany.",unsupportedFormat:"Nieobsługiwany format pliku.",presentationModeReady:"Tryb prezentacji jest gotowy.",presentationModeError:"Wystąpił błąd podczas konfiguracji trybu prezentacji.",sandboxDropModel:"Przeciągnij i upuść model 3D w oknie viewer'a.",supportedFormats:"<strong>Obłsugiwane formaty</strong>:\n{formats}\ni <strong>archiwa</strong>: {archives}.",embedSourceMissing:"Ustaw URL modelu lub ID encji do osadzenia.",embedUrlCopied:"Skopiowano URL osadzenia.",embedUrlCopyError:"Nie udało się skopiować URL osadzenia.",embedIframeCopied:"Skopiowano iframe osadzenia.",embedIframeCopyError:"Nie udało się skopiować iframe.",embedCodeCopied:"Kod osadzenia został skopiowany do schowka.",embedCodeCopyError:"Nie udało się skopiować kodu osadzenia.",annotationDataMissing:"Nie znaleziono danych adnotacji dla tego punktu.",selectFaceRequired:"Wybierz co najmniej jedną ścianę, aby dodać adnotację.",selectFaceRequiredAgain:"Wybierz co najmniej jedną ścianę, a następnie ponownie dodaj adnotacje.",noFacesSelected:"Nie wybrano ścian do adnotacji.",titleRequired:"Tytuł jest wymagany.",facesInactive:"Wybrane ściany nie są już aktywne.",annotationsSaved:"Zapisano adnotacje dla {count} ścian{plural}.",annotationsImported:"Zaimportowano {count} adnotacj{plural}.",annotationsExported:"Wyeksportowano XML adnotacji.",noAnnotationsToExport:"Brak adnotacji do eksportu.",noValidAnnotations:"Nie znaleziono poprawnych adnotacji w XML.",annotationsImportError:"Nie udało się zaimportować XML adnotacji.",settingsSaved:"Ustawienia zostały zapisane.",settingsSaveError:"Błąd zapisywania ustawień.",featureToggle:"{feature} jest {state}.",clippingHelperToggle:"Pomocnik płaszczyzny przycinania {axis} jest {state}.",clippingPlanes:"Przeciągnij aktywną płaszczyznę przycinania, aby dostosować cięcie",downloadSuccess:"Model został pomyślnie pobrany.",downloadError:"Nie udało się pobrać modelu.",iiifManifestGenerated:"Manifest IIIF został wygenerowany.",iiifManifestGenerationError:"Błąd podczas generowania manifestu IIIF.",containerNotFound:"Element kontenera nie został znaleziony. Proszę sprawdzić konfigurację Viewera.",missingFiles:"Brak wymaganych plików dla Viewera. Proszę sprawdzić konfigurację Viewera.",unsupportedFileFormat:"Nieobsługiwany format pliku."},shortcuts:{mouse:"Mysz: przeciągnij, aby obracać, rolka - zoom, prawy przycisk - przesuwanie",keyboard:"Klawiatura: strzałki - obrót, Shift+strzałki - szybciej, Ctrl/Cmd+strzałki - przesuwanie, +/- — zoom, Spacja - auto-obrót",touch:"Dotyk: szczypanie, aby przybliżyć, przeciągnij, aby obracać, dotknij i przytrzymaj, aby przesunąć",dragAndDrop:"Lub przeciągnij i upuść model 3D w oknie viewer'a"}},de:{menu:{actions:"Viewer-Aktionen",openActions:"Viewer-Aktionen öffnen",embed:"Einbetten",exitEmbed:"Einbettung beenden",openEmbedOptions:"Einbettungsoptionen öffnen",exitEmbedMode:"Einbettungsmodus beenden",download:"Herunterladen"},theme:{lightMode:"Hellmodus",darkMode:"Dunkelmodus",switchToLightMode:"Zu Hellmodus wechseln",switchToDarkMode:"Zu Dunkelmodus wechseln"},fullscreen:{mode:"Vollbildmodus",enter:"Vollbild",exit:"Vollbild beenden",exitMode:"Vollbildmodus beenden"},language:{label:"Sprache: Deutsch",switchToPolish:"Zu Polnisch wechseln",switchToEnglish:"Zu Englisch wechseln"},hints:{picking:"Umschalt + Klick, um mehrere Flächen auszuwählen",pickingSelect:"Wählen Sie mindestens eine Fläche aus, um eine Anmerkung hinzuzufügen.",clipping:"Ziehen Sie die aktive Schnittebene-Hilfe, um den Schnitt anzupassen"},controls:{enablePickingMode:"Auswahlmodus aktivieren",disablePickingMode:"Auswahlmodus deaktivieren",enableDistanceMeasurement:"Entfernungsmessung aktivieren",disableDistanceMeasurement:"Entfernungsmessung deaktivieren",selectedFaces:"Ausgewählte Flächen"},gui:{moveToolbar:"Werkzeugleiste verschieben",orbit:"Navigationsmodus",controls:"Steuerung",editor:"Editor",transform3dObject:"3D-Objekt transformieren",transformLight:"Licht transformieren",transformMode:"Transformationsmodus",directionalLight:"Gerichtetes Licht",ambientLight:"Umgebungslicht",ambient:"Ambient",lights:"Beleuchtung",cameraLight:"Kamera-Licht",backgroundColor:"Hintergrundfarbe",backgroundColorOuter:"Äußere Hintergrundfarbe",backgroundType:"Hintergrundtyp",clippingPlanes:"Schnittebenen",clippingFolder:"Schnittebenen",displayHelperX:"X-Hilfe anzeigen",displayHelperY:"Y-Hilfe anzeigen",displayHelperZ:"Z-Hilfe anzeigen",constantX:"Konstante X",constantY:"Konstante Y",constantZ:"Konstante Z",visible:"Sichtbarer Schnitt",materials:"Materialien",metadata:"Anmerkungen",saveProperties:"Eigenschaften speichern",hierarchy:"Hierarchie",statistics:"Statistiken",clearSelectedFaces:"Ausgewählte Flächen löschen",clearSelectedHierarchy:"Ausgewählte Objekte abwählen",addAnnotations:"Anmerkungen hinzufügen",exportAnnotationsXml:"Anmerkungen XML exportieren",importAnnotationsXml:"Anmerkungen XML importieren",IIIFexport:"IIIF exportieren",resetCameraPosition:"Kameraposition zurücksetzen",saveSettings:"Einstellungen speichern",renderPreview:"Vorschau rendern",color:"Farbe",intensity:"Intensität",metalness:"Metallizität",emissive:"Emissiv",position:"Position",rotation:"Rotation",camera:"Kamera",performance:"Leistung",highPerformance:"Hohe Leistung",lowPower:"Niedriger Stromverbrauch",default:"Standard",none:"Keine",move:"Bewegen",rotate:"Drehen",scale:"Skalieren",target:"Ziel",local:"Lokal",global:"Global",linear:"Linear",gradient:"Farbverlauf",editMaterial:"Material bearbeiten",selectByMaterial:"nach Material auswählen",hideAdvancedEditor:"Erweiterten Editor ausblenden",showAdvancedEditor:"Erweiterten Editor anzeigen",showLoadingLogs:"Ladeprotokolle anzeigen",hideLoadingLogs:"Ladeprotokolle ausblenden",hierarchy:"Hierarchie",expand:"Werkzeugleiste erweitern",collapse:"Werkzeugleiste zusammenklappen",orthographicProjection:"Zur orthografischen Projektion wechseln",perspectiveProjection:"Zur perspektivischen Projektion wechseln",environmentMap:"Umgebungsmap",environmentMapToggle:"Umgebungsmap wechseln",environmentMapIntensity:"Intensität der Umgebungsmap",environmentMapStyleNeutral:"Neutral",environmentMapStyleSunny:"Sonnig",environmentMapStyleStudio:"Studio",environmentMapStyleGoldenHour:"Goldene Stunde",enableWireframeMode:"Drahtgittermodus aktivieren",disableWireframeMode:"Drahtgittermodus deaktivieren",download:"Modell herunterladen"},metadata:{modelDetails:"Modelldetails",metadata:"Metadaten",visualizedFile:"Visualisierte Datei",vertices:"Vertices",faces:"Flächen",title:"Titel",author:"Autor",authorAffiliation:"Autoren-Zugehörigkeit",license:"Lizenz",description:"Beschreibung",objectType:"Objekttyp",reconstructionAuthors:"Rekonstruktionsautoren",reconstructionPeriod:"Rekonstruktionsperiode"},manifesto:{invalidUrl:"Bitte geben Sie eine gültige Manifest-URL ein.",invalidJson:"Bitte geben Sie einen gültigen Manifest-JSON-Text ein."},iiif:{loader:"IIIF-Loader",collapse:"Zusammenklappen",expand:"Erweitern",manifest:"IIIF-Manifest",loadFromUrl:"Von URL laden",loadFromText:"Von Text laden",manifestUrlPlaceholder:"https://example.org/iiif/manifest.json",manifestTextPlaceholder:"IIIF-Manifest-JSON hier einfügen...",invalidUrl:"Bitte geben Sie eine gültige IIIF-Manifest-URL ein.",invalidJson:"Bitte geben Sie einen gültigen IIIF-JSON-Text ein.",optionModelPositionScale:"Modellposition und -skalierung",optionModelOrigin:"Modellursprung",optionModelOriginBg:"Modellursprung mit Hintergrundfarbe",optionModelPosition:"Modellposition"},localPreview:{loadExampleModel:"Beispielmodell laden"},embedPanel:{title:"Einbettungsoptionen",closeAria:"Einbettungsoptionen schließen",modelUrl:"Modell-URL",modelUrlPlaceholder:"/examples/box.glb",entityId:"Entitäts-ID",theme:"Thema",themeDark:"Dunkel",themeLight:"Hell",autoRotateSpeed:"Geschwindigkeit der Auto-Rotation",cameraPosition:"Kameraposition",cameraTarget:"Kameraziel",cameraVectorPlaceholder:"x,y,z",fov:"FOV",autoRotate:"Auto-Rotation",disableInteraction:"Interaktion deaktivieren",hideActionMenu:"Aktionsmenü ausblenden",hideMetadata:"Metadaten ausblenden",presentationMode:"Präsentationsmodus",useCurrentCamera:"Aktuelle Kamera verwenden",resetFromViewer:"Aus Viewer zurücksetzen",copyUrl:"URL kopieren",copyIframe:"Iframe kopieren",embedUrl:"Einbettungs-URL",iframeCode:"Iframe-Code",preview:"Vorschau",previewTitle:"Einbettungsvorschau"},loadingLog:{title:"Protokoll des Ladeprozesses",loadingModel:"3D-Modell wird geladen...",modelLoaded:"Modell wurde geladen.",loadingAssets:"Assets werden geladen...",parsingScene:"Szene wird analysiert...",loadingTextures:"Texturen werden geladen...",preparingGeometry:"Geometrie wird vorbereitet...",settingUpLighting:"Beleuchtung wird eingerichtet...",settingUpMaterials:"Materialien werden eingerichtet...",buildingBvh:"BVH wird erstellt...",compilingShaders:"Shader werden kompiliert...",initializingRenderer:"Renderer wird initialisiert...",uploadingBuffers:"Buffer werden hochgeladen...",fetchingMetadata:"Metadaten werden abgerufen..."},processingHeader:"Verarbeitungsschritte",processingSteps:{preparingModel:"Modell wird vorbereitet",convertingToTransmissionFormat:"Konvertierung in das Übertragungsformat",renderingThumbnails:"Vorschaubilder werden gerendert",savingEntity:"Entität wird gespeichert",finalizing3dModel:"3D-Modell wird finalisiert",initializingViewer:"Viewer wird initialisiert"},state:{enabled:"aktiviert",disabled:"deaktiviert"},toasts:{transformMove:"Bewegen: Ziehen Sie die Achsenpfeile, um das Objekt zu repositionieren.",transformRotate:"Drehen: Ziehen Sie die Rotationsringe, um das Objekt zu drehen.",transformScale:"Skalieren: Ziehen Sie die Achsengriffe, um die Größe des Objekts zu ändern.",transformLightMove:"Licht transformieren - Bewegen: Ziehen Sie die Achsenpfeile, um das gerichtete Licht zu bewegen.",transformLightTarget:"Licht transformieren - Ziel: Ziehen Sie die Achsenpfeile, um das Lichtziel zu repositionieren.",distanceEnabled:"Entfernungsmessung ist aktiviert.",distanceHint:"Wählen Sie einen Startpunkt und einen Endpunkt, um die Entfernung zu messen.",noIiiifModelFallback:"Kein 3D-Modell im IIIF-Manifest gefunden, Beispielmodell wird geladen.",facePickingEnabled:"Flächenauswahl ist aktiviert",facePickingDisabled:"Flächenauswahl ist deaktiviert",distanceModeEnabled:"Entfernungsmessungsmodus ist aktiviert",distanceModeDisabled:"Entfernungsmessungsmodus ist deaktiviert",settingsFound:"Einstellungen {filename}_viewer.json gefunden",settingsNotFound:"Keine Einstellungen {filename}_viewer.json gefunden",metadataFetchError:"Fehler beim Abrufen der Metadaten: {error}",presentationModeError:"Beim Einrichten des Präsentationsmodus ist ein Fehler aufgetreten.",objLoaded:"OBJ-Modell wurde geladen.",mtlLoadError:"Fehler beim Laden der zugehörigen MTL-Datei.",glbLoadError:"Fehler beim Laden der GLB-Datei.",unsupportedExtension:"Dateierweiterung wird noch nicht unterstützt.",modelLoaded:"Modell {filename} wurde geladen.",modelLoadedSimple:"Modell wurde erfolgreich geladen.",unsupportedFormat:"Nicht unterstütztes Dateiformat.",presentationModeReady:"Präsentationsmodus ist bereit.",presentationModeError:"Beim Einrichten des Präsentationsmodus ist ein Fehler aufgetreten.",sandboxDropModel:"Ziehen Sie ein 3D-Modell per Drag-and-drop in den Viewer.",supportedFormats:"<strong>Unterstützte Formate:</strong> {formats} \n und <strong>Unterstützte Archive:</strong> {archives}.",embedSourceMissing:"Model-URL oder Entitäts-ID für die Einbettung festlegen.",embedUrlCopied:"Einbettungs-URL kopiert.",embedUrlCopyError:"Einbettungs-URL konnte nicht kopiert werden.",embedIframeCopied:"Einbettungs-iframe kopiert.",embedIframeCopyError:"Einbettungs-iframe konnte nicht kopiert werden.",embedCodeCopied:"Einbettungscode in die Zwischenablage kopiert.",embedCodeCopyError:"Einbettungscode konnte nicht kopiert werden.",annotationDataMissing:"Keine Annotationsdaten für diesen Punkt gefunden.",selectFaceRequired:"Wählen Sie mindestens eine Fläche aus, um eine Annotation hinzuzufügen.",selectFaceRequiredAgain:"Wählen Sie mindestens eine Fläche und führen Sie dann „Annotationen hinzufügen“ erneut aus.",noFacesSelected:"Keine Flächen für Annotation ausgewählt.",titleRequired:"Titel ist erforderlich.",facesInactive:"Ausgewählte Flächen sind nicht mehr aktiv.",annotationsSaved:"Annotationen für {count} Fläche{plural} gespeichert.",annotationsImported:"{count} Annotation{plural} importiert.",annotationsExported:"Annotations-XML exportiert.",noAnnotationsToExport:"Keine Annotationen zum Exportieren.",noValidAnnotations:"Keine gültigen Annotationen im XML gefunden.",annotationsImportError:"Import der Annotations-XML fehlgeschlagen.",settingsSaved:"Einstellungen wurden gespeichert.",settingsSaveError:"Fehler beim Speichern der Einstellungen.",featureToggle:"{feature} ist {state}.",clippingHelperToggle:"Clipping-Ebenen-Helfer {axis} ist {state}.",clippingPlanes:"Ziehen Sie die aktive Schnittebene-Hilfe, um den Schnitt anzupassen",downloadSuccess:"Modell erfolgreich heruntergeladen.",downloadError:"Fehler beim Herunterladen des Modells.",iiifManifestGenerated:"IIIF-Manifest wurde generiert.",iiifManifestGenerationError:"Fehler beim Generieren des IIIF-Manifests.",containerNotFound:"Container-Element nicht gefunden. Bitte überprüfen Sie die Viewer-Konfiguration.",missingFiles:"Fehlende erforderliche Dateien für den Viewer. Bitte überprüfen Sie die Viewer-Konfiguration.",unsupportedFileFormat:"Nicht unterstütztes Dateiformat."},shortcuts:{mouse:"Maus: ziehen zum Drehen, Mausrad - Zoom, Rechtsklick - Verschieben",keyboard:"Tastatur: Pfeile - Drehen, Shift+Pfeile - schneller, Ctrl/Cmd+Pfeile - Verschieben, +/- - Zoom, Leertaste - Auto-Rotation",touch:"Touch: Pinch-to-Zoom, ziehen zum Drehen, Doppeltippen und halten zum Verschieben",dragAndDrop:"Oder ziehen Sie ein 3D-Modell per Drag-and-drop in den Viewer"}}},y=function(e,t={},n=""){const i=["pl","de"].includes(u.currentLanguage)?u.currentLanguage:"en",o=b[i]||b.en,r=String(e||"").split(".").reduce((e,t)=>e&&"object"==typeof e?e[t]:void 0,o);let a={},s="";"string"==typeof t?s=t:(a=t||{},s=n);return("string"==typeof r?r:s||e).replace(/\{(\w+)\}/g,(e,t)=>{let n=a[t];return"boolean"==typeof n?n=y("state."+(n?"enabled":"disabled")):"string"==typeof n&&("enabled"===n||"disabled"===n?n=y(`state.${n}`):n.startsWith("state.")&&(n=y(n))),n??`{${t}}`})};const v=(e,t,n)=>w(`toasts.${e}`,t,n),w=(e,t,n)=>{if(!u.showNotifications)return;const{tone:i,options:o}=function(e,t){let n="info",i={};return"string"==typeof e?(n=e,i=t??{}):e&&"object"==typeof e&&(i=e,n=e.tone??"info"),{tone:n,options:i}}(t,n),r=Number.isFinite(o.duration)?o.duration:4200,a=String(o.key??""),s=!0===o.replace,l=!0===o.persistent,c=String(o.variant??"");let d="",p={};const h=String(o.detailI18nKey??""),g=o.detailVars&&"object"==typeof o.detailVars?o.detailVars:o;let m,f="";"string"==typeof e&&e.includes(".")?(d=e,p=o,m=y(e,o)):m=String(e),h?f=y(h,g):null!=o.detail&&(f=String(o.detail)),window.__E2E__&&window.viewer&&(window.viewer.toasts??=[],window.viewer.toasts.push([m,f].filter(Boolean).join(" ")));const b=u.statusNotice,v=u.enqueueStatusNotice;"function"!=typeof v?b?(b.hidden=!1,b.textContent=[m,f].filter(Boolean).join(" "),b.dataset.tone=i,b.classList.remove("is-visible","is-hiding"),b.classList.add("is-visible"),u.statusNoticeTimer&&window.clearTimeout(u.statusNoticeTimer),u.statusNoticeTimer=window.setTimeout(()=>{b.classList.remove("is-visible"),b.classList.add("is-hiding"),window.setTimeout(()=>{b.classList.contains("is-visible")||(b.hidden=!0,b.classList.remove("is-hiding"))},220)},r)):console.info(`[viewer:${i}] ${m}`):v({message:m,detail:f,tone:i,duration:r,key:a,replace:s,persistent:l,variant:c,i18nKey:d,i18nVars:p,detailI18nKey:h,detailI18nVars:g})};function E(e,t={}){const{context:n="",consoleLabel:i="Viewer error",toast:o=!0,e2e:r=!0}=t,a=function(e){return e instanceof Error&&e.message?e.message:"string"==typeof e?e:String(e)}(e),s=n?`${n}: ${a}`:a;return console.error(i,e),r&&window.__E2E__&&window.viewer&&(window.viewer.errors??=[],window.viewer.errors.push(s)),o&&w(s),s}function C(e){return u.objectsConfig?.models?.find(t=>t.name===e)}function M(e){return e?Array.isArray(e)&&3===e.length?{x:e[0],y:e[1],z:e[2]}:"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z?e:null:null}function S(e){return{type:e.type,shapeOrDirection:e.shapeOrDirection,colors:e.colors.map(m).filter(Boolean)}}function I(t,n){if(!n)return;const i=M(n.position??n.objPosition);i&&t.position.set(i.x,i.y,i.z);const o=M(n.scale??n.objScale);o&&t.scale.set(o.x,o.y,o.z);const r=M(n.rotation??n.objRotation);r&&t.rotation.set(e.MathUtils.degToRad(r.x),e.MathUtils.degToRad(r.y),e.MathUtils.degToRad(r.z))}function A(e){e.needsUpdate=!0,void 0!==e.geometry&&(e.geometry.computeBoundingBox(),e.geometry.computeBoundingSphere()),e.updateMatrix(),e.updateMatrixWorld(!0)}function L(t){const n=new e.Box3;if(n.setFromObject(t,!0),n.isEmpty())return;const i=new e.Vector3;n.getCenter(i),t.position.sub(i),t.updateMatrixWorld(!0)}const O=(t,n)=>{let i;if(void 0===t.children||0==t.children.length?i=C(t.name):t.children.length>0&&(i=C(t.children[0].name)),null!=n)I(t,n),A(t),function(e,t){if(!t)return;const n=M(t.controlsTarget),i=M(t.cameraPosition);if(!n&&!i)return;const o=u.controls.enableDamping;u.controls.enableDamping=!1,n&&u.controls.target?.set(n.x,n.y,n.z),i&&u.camera.position?.set(i.x,i.y,i.z),u.camera.updateProjectionMatrix(),u.controls.update(),u.controls.saveState(),u.controls.enableDamping=o}(0,n);else if(void 0!==u.objectsConfig&&i){if(Array.isArray(u.objectsConfig.models)&&0!==u.objectsConfig.models.length||null!=n){let e=u.objectsConfig.models[u.objectsConfig.setupIndex];null!=e&&null==n?I(t,e):null!=n&&I(t,n)}else null!=i.position&&t.position.set(i.position.x,i.position.y,i.position.z),null!=i.scale&&t.scale.set(i.scale.x,i.scale.y,i.scale.z),null!=i.rotation&&t.rotation.set(e.MathUtils.degToRad(i.rotation.x),e.MathUtils.degToRad(i.rotation.y),e.MathUtils.degToRad(i.rotation.z));A(t)}else{var o=new e.Box3;if(Array.isArray(t))for(let e=0;e<t.length;e++)o.setFromObject(t[e]),t[e].position.set(-(o.min.x+o.max.x)/2,-o.min.y,-(o.min.z+o.max.z)/2),t[e].needsUpdate=!0,void 0!==t[e].geometry&&(t[e].geometry.computeBoundingBox(),t[e].geometry.computeBoundingSphere()),t[e].updateMatrixWorld();else t.isGroup?u.PRESENTATION_MODE?L(t):(o.setFromObject(t),t.position.set(-(o.min.x+o.max.x)/2,-o.min.y,-(o.min.z+o.max.z)/2),t.updateMatrixWorld()):u.PRESENTATION_MODE?(L(t),A(t)):(o.setFromObject(t),t.position.set((o.max.x-o.min.x)/2,(o.max.y-o.min.y)/2,(o.max.z-o.min.z)/2),A(t))}u.cameraLight.position.set(u.camera.position.x,u.camera.position.y,u.camera.position.z),Array.isArray(t)?u.cameraLightTarget.position.set(t[0].position.x,t[0].position.y,t[0].position.z):u.cameraLightTarget.position.set(t.position.x,t.position.y,t.position.z),u.cameraLight.target.updateMatrixWorld(),u.objectsConfig.setupIndex++};function _(e){if(Array.isArray(e)){const[t,n,i,o=1]=e;return{r:t,g:n,b:i,a:o}}return"string"==typeof e?f(e):null}function P(e,t){const n=e.scenes?.[t]?.background??e.scene?.background??e.globals?.background??null;if(!n)return{kind:"default"};if("object"==typeof n&&Array.isArray(n.value)){const e=function(e){if(!Array.isArray(e)||0===e.length)return null;if(3===e.length&&e.every(e=>"number"==typeof e))return{type:"linear",colors:[{r:e[0],g:e[1],b:e[2],a:1}]};const t=e.map(_).filter(Boolean);return t.length<2?null:{type:"linear",colors:t}}(n.value);if(e){return{kind:"gradient",normalizedGradient:S(e)}}}if("string"==typeof n){const e=function(e){if(!e||"string"!=typeof e)return null;const t=e.match(/(radial|linear)-gradient\s*\(([^,]+)/i),n=t?t[1].toLowerCase():null,i=t?t[2].trim():null,o=[],r=e.matchAll(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/gi);for(const[,e,t,n,i]of r)o.push({r:+e,g:+t,b:+n,a:void 0!==i?+i:1});const a=e.matchAll(/#([0-9a-f]{3}|[0-9a-f]{6})/gi);for(const[,e]of a){const t=3===e.length?e.split("").map(e=>e+e).join(""):e;o.push({r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:1})}return{type:n,shapeOrDirection:i,colors:o}}(n);if(e){return{kind:"gradient",normalizedGradient:S(e)}}return{kind:"color",color:n}}return{kind:"default"}}async function x(t,n){const i=u.lightObjects[0],o=n??u.CONFIG??null,r=n??u.objectsConfig??null,a=o?.cameraPosition??r?.camera?.position;Array.isArray(a)?u.camera.position.set(a[0],a[1],a[2]):a&&"object"==typeof a?u.camera.position.set(a.x,a.y,a.z):await async function(t){console.log("Setting up empty camera");var n=new e.Box3;if(Array.isArray(t))for(let i=0;i<t.length;i++){const o=(new e.Box3).setFromObject(t[i],!0);n.union(o)}else n.setFromObject(t,!0);var i=new e.Vector3;n.getSize(i);var o=new e.Vector3;n.getCenter(o);const r=i.length();u.camera.position.set(o.x,o.y,o.z+r),await k(t,!0)}(t);const s=o?.controlsTarget??r?.camera?.target;Array.isArray(s)?u.controls.target.set(s[0],s[1],s[2]):s&&u.controls?.target.set(s.x,s.y,s.z);const l=o?.controlsZoom?.[0];if("number"==typeof l&&0!==l){const t=(new e.Vector3).subVectors(u.camera.position,u.controls?.target||new e.Vector3).normalize();u.camera.position.copy(u.controls?.target||new e.Vector3).add(t.multiplyScalar(l))}if(!o&&r?.scene?.lights?r.scene.lights.forEach(t=>{switch(t.type){case"directional":i.position.set(t.position.x,t.position.y,t.position.z),i.color=new e.Color(m(t.color)),i.intensity=t.intensity;break;case"ambient":u.ambientLight.color=new e.Color(m(t.color)),u.ambientLight.intensity=t.intensity;break;case"point":u.cameraLight.color=new e.Color(m(t.color)),u.cameraLight.intensity=t.intensity}}):o&&(o.lightAmbientColor&&(u.ambientLight.color=new e.Color(m(o.lightAmbientColor[0])),u.ambientLight.intensity=o.lightAmbientIntensity?.[0]??u.ambientLight.intensity),o.lightColor&&(i.color=new e.Color(m(o.lightColor[0])),i.intensity=o.lightIntensity?.[0]??i.intensity),o.lightCameraColor&&(u.cameraLight.color=new e.Color(m(o.lightCameraColor[0])),u.cameraLight.intensity=o.lightCameraIntensity?.[0]??u.cameraLight.intensity)),u.PRESENTATION_MODE){N({type:"radial",colors:[{r:255,g:255,b:255,a:0},{r:255,g:255,b:255,a:0}]})}else{const e=P(r,u.activeScene);switch(e.kind){case"gradient":case"radial":N(e.normalizedGradient);break;case"color":case"linear":D("linear",e.color);break;case"default":case"unknown":D("radial",u.colors.BackgroundColor,u.colors.BackgroundColorOuter)}}u.camera.updateProjectionMatrix(),u.controls?.update(),await k(t,!1,o)}function T({finalCameraPos:n,finalTarget:i,boundingBox:o,duration:r=3500,easing:a=t.Easing.Cubic.Out,startOffsetFactor:s=.5,animate:l=!0,distanceOffsetFactor:c=0,distanceOffsetUnits:d=0}){const p=n.clone(),h=i.clone(),g=p.clone().sub(h).normalize(),m=p.distanceTo(h),f=m*c+d,b=p.clone().add(g.multiplyScalar(m*s+f)),y=h.clone();if(!l)return u.camera.position.copy(p),u.controls?.target.copy(h),void u.controls?.update();u.camera.position.copy(b),u.controls?.target.copy(y),u.controls?.update();const v=b.clone(),w=y.clone();u.cameraTween=new t.Tween(v).to(p,r).easing(a).onUpdate(()=>{u.camera.position.copy(v)}),u.targetTween=new t.Tween(w).to(h,r).easing(a).onUpdate(()=>{u.controls?.target.copy(w),u.controls?.update()}),u.cameraTween.start(),u.targetTween.start(),u.cameraTween.onComplete(()=>{u.camera.position.copy(p),u.controls?.target.copy(h),u.controls?.update();const t=o?o.getCenter(new e.Vector3):new e.Vector3;if(o){const n=o.getSize(new e.Vector3).length(),i=p.distanceTo(t)+n;u.camera.near=Math.max(i/1e3,.001),u.camera.far=10*i,u.camera.updateProjectionMatrix(),u.controls&&(u.controls.maxDistance=2*i)}!function(e){window.__E2E__||null!=u.GESTURE&&(u.GESTURE.rotate=!0,u.GESTURE.target=e.clone(),u.controls.target.copy(u.GESTURE.target),null!=u.handHint&&(u.handHint.hidden=!1,u.handHint.classList.add("hand-drag-animate")))}(t)})}async function k(t,n,i){const o=new e.Box3;if(Array.isArray(t))for(let n=0;n<t.length;n++){const i=(new e.Box3).setFromObject(t[n],!0);o.union(i)}else o.setFromObject(t,!0);var r=new e.Vector3,a=new e.Vector3;o.getSize(r),o.getCenter(a);var s=new e.Vector3(Math.abs(o.max.x-o.min.x),Math.abs(o.max.y-o.min.y),Math.abs(o.max.z-o.min.z));u.gridSize=Math.max(s.x,s.y,s.z),u.dirLightTarget=new e.Object3D,u.dirLightTarget.position.set(0,0,0),u.lightHelper=new e.DirectionalLightHelper(u.dirLight,u.gridSize),u.scene.add(u.lightHelper),u.lightHelper.visible=!1,u.scene.add(u.dirLightTarget),u.dirLight.target=u.dirLightTarget,u.dirLight.target.updateMatrixWorld();var l=2.5*u.gridSize;void 0!==u.basicGrid&&u.scene.remove(u.basicGrid),u.basicGrid=new e.Group;var c=new e.ShadowMaterial({opacity:.35}),d=new e.Mesh(new e.PlaneGeometry(l,l),c);d.rotation.x=-Math.PI/2,d.position.set(0,0,0),d.receiveShadow=!0,u.basicGrid.add(d),u.axesHelper=new e.AxesHelper(u.gridSize),u.axesHelper.position.set(0,0,0),u.axesHelper.visible=!1,u.basicGrid.add(u.axesHelper);const p=new e.GridHelper(l,25,11447982,0);p.material.opacity=.05,p.material.transparent=!0,p.position.set(0,0,0),u.basicGrid.add(p),u.scene.add(u.basicGrid);const h=r.y/2,g=r.x/2,m=h/Math.tan(e.MathUtils.degToRad(u.camera.fov/2)),f=g/Math.tan(e.MathUtils.degToRad(u.camera.fov/2))/u.camera.aspect,b=1.95*Math.max(m,f),y=new e.Vector3(.5,-.25,-1).normalize();y.multiplyScalar(-b);const w=a.clone().add(y),E=a.clone();if(3===i?.cameraPosition?.length&&w.set(i.cameraPosition[0],i.cameraPosition[1],i.cameraPosition[2]),3===i?.controlsTarget?.length&&E.set(i.controlsTarget[0],i.controlsTarget[1],i.controlsTarget[2]),u.cameraCoords=w.clone(),u.controlsTarget=E.clone(),T({finalCameraPos:w,finalTarget:E,boundingBox:o,duration:3500,startOffsetFactor:.15,distanceOffsetFactor:-.5,distanceOffsetUnits:0}),n){var C=new e.Vector3;C=new e.Vector3(e.MathUtils.radToDeg(u.helperObjects[0]?.rotation.x||1),e.MathUtils.radToDeg(u.helperObjects[0]?.rotation.y||5),e.MathUtils.radToDeg(u.helperObjects[0]?.rotation.z||1));const n=Array.isArray(t)?t[0]:t;u.objectsConfig.originalMetadata={objPosition:[n?.position?.x||0,n?.position?.y||0,n?.position?.z||0],objRotation:[C.x,C.y,C.z],objScale:[u.helperObjects[0]?.scale.x||1,u.helperObjects[0]?.scale.y||5,u.helperObjects[0]?.scale.z||1],cameraPosition:[u.camera.position.x,u.camera.position.y,u.camera.position.z],controlsTarget:[u.controls.target.x,u.controls.target.y,u.controls.target.z]}}u.PRESENTATION_MODE||function(t,n){u.clippingPlanes[0].constant=n.x,u.clippingPlanes[1].constant=n.y,u.clippingPlanes[2].constant=n.z;let i=0;if(t){const n=new e.Box3;if(Array.isArray(t))for(let i=0;i<t.length;i++)n.union((new e.Box3).setFromObject(t[i],!0));else n.setFromObject(t,!0);n.isEmpty()||(i=n.getCenter(new e.Vector3).y)}const o=(e,t)=>{const n=u.planeHelpers?.[e],i=u.clippingPlanes?.[e];n&&i&&n.position.copy(i.normal).multiplyScalar(-t)};if(u.EDITOR){u.transformControlClippingPlaneX&&u.transformControlClippingPlaneY&&u.transformControlClippingPlaneZ&&(u.scene.add(u.transformControlClippingPlaneX?.getHelper()),u.scene.add(u.transformControlClippingPlaneY?.getHelper()),u.scene.add(u.transformControlClippingPlaneZ?.getHelper()));let t=new e.Color(16777215).getHexString();null!=u.scene.background&&(t=u.scene.background.getHexString()),u.planeHelpers=u.clippingPlanes.map(n=>new e.PlaneHelper(n,2*u.gridSize,function(e){let t=e.substring(1);return t=parseInt(t,16),t^=16777215,t=t.toString(16),t=("000000"+t).slice(-6),"#"+t}(t))),u.planeHelpers.forEach((e,t)=>{if(e.visible=!1,e.name="PlaneHelper",o(t,u.clippingPlanes[t].constant),0===t||2===t){e.userData.clippingCenterY=i;const t=e.updateMatrixWorld.bind(e);e.updateMatrixWorld=function(e){t(e),this.position.y=this.userData.clippingCenterY||0,this.updateMatrix(),this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix);for(let e=0;e<this.children.length;e++)this.children[e].updateMatrixWorld(!0)},u.scene.add(e)}else u.scene.add(e)}),u.distanceGeometry=n,((e,t)=>{["x","y","z"].forEach(n=>e[n]*=t)})(u.distanceGeometry,2);const r=(e,t)=>{v("clippingHelperToggle","info",{axis:e,state:t})},a=()=>{const e=u.updateClippingHintVisibility;if("function"==typeof e)return void e();if(!u.clippingHint||!u.planeParams?.clippingMode)return;const t=u.planeParams.clippingMode;u.clippingHint.hidden=!(t.x||t.y||t.z)},s=(e,t)=>window?.Viewer?.t?.(e,t)??t;let l={x:R(u.planeParams.planeX,"displayHelperX"),constantX:R(u.planeParams.planeX,"constantX"),y:R(u.planeParams.planeY,"displayHelperY"),constantY:R(u.planeParams.planeY,"constantY"),z:R(u.planeParams.planeZ,"displayHelperZ"),constantZ:R(u.planeParams.planeZ,"constantZ"),outline:R(u.planeParams.outline,"visible")};l.x?.name?.(s("gui.displayHelperX","Show X helper")),l.constantX?.name?.(s("gui.constantX","Constant X")),l.y?.name?.(s("gui.displayHelperY","Show Y helper")),l.constantY?.name?.(s("gui.constantY","Constant Y")),l.z?.name?.(s("gui.displayHelperZ","Show Z helper")),l.constantZ?.name?.(s("gui.constantZ","Constant Z")),l.outline?.name?.(s("gui.visible","Visible")),l.x?.onChange(e=>{u.planeParams.clippingMode.x=u.planeHelpers[0].visible=e,e?(u.transformControlClippingPlaneX.attach(u.planeHelpers[0]),u.planeParams.outline.visible&&(u.outlineClipping.visible=!0)):(u.transformControlClippingPlaneX.detach(),u.planeParams.clippingMode.y||u.planeParams.clippingMode.z||u.planeParams.outline.visible||(u.outlineClipping.visible=!1)),r("X",e),a()}),l?.constantX.min(-u.distanceGeometry.x).max(u.distanceGeometry.x).setValue(u.distanceGeometry.x).step(u.gridSize/100).listen().onChange(e=>{u.clippingPlanes[0].constant=e,o(0,e)}),l.y?.onChange(e=>{u.planeParams.clippingMode.y=u.planeHelpers[1].visible=e,e?(u.transformControlClippingPlaneY.attach(u.planeHelpers[1]),u.planeParams.outline.visible&&(u.outlineClipping.visible=!0)):(u.transformControlClippingPlaneY.detach(),u.planeParams.clippingMode.x||u.planeParams.clippingMode.z||u.planeParams.outline.visible||(u.outlineClipping.visible=!1)),r("Y",e),a()}),l?.constantY.min(-u.distanceGeometry.y).max(u.distanceGeometry.y).setValue(u.distanceGeometry.y).step(u.gridSize/100).listen().onChange(e=>{u.clippingPlanes[1].constant=e,o(1,e)}),l.z?.onChange(e=>{u.planeParams.clippingMode.z=u.planeHelpers[2].visible=e,e?(u.transformControlClippingPlaneZ.attach(u.planeHelpers[2]),u.planeParams.outline.visible&&(u.outlineClipping.visible=!0)):(u.transformControlClippingPlaneZ.detach(),u.planeParams.clippingMode.x||u.planeParams.clippingMode.y||u.planeParams.outline.visible||(u.outlineClipping.visible=!1)),r("Z",e),a()}),l?.constantZ.min(-u.distanceGeometry.z).max(u.distanceGeometry.z).setValue(u.distanceGeometry.z).step(u.gridSize/100).listen().onChange(e=>{u.clippingPlanes[2].constant=e,o(2,e)}),l.outline.onChange(e=>{u.outlineClipping.visible=e}),a()}}(t,{x:1.1*o.max.x,y:1.1*o.max.y,z:1.1*o.max.z})}function F(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function j(e,t,n=100){u.mainCanvas.style.setProperty("background",`radial-gradient(circle, ${e} 0%, ${t} ${n}%)`)}function N(e){if(!e||!Array.isArray(e.colors)||0===e.colors.length)return;const t=e.colors;if(1===t.length){return void D("linear",F(t[0]))}if(2===t.length){const n=F(t[0]),i=F(t[1]);return void D(e.type,n,i)}const n=t.map((e,n)=>{const i=Math.round(n/(t.length-1)*100);return`${F(e)} ${i}%`}),i="radial"===e.type?`radial-gradient(circle, ${n.join(", ")})`:`linear-gradient(to bottom, ${n.join(", ")})`;u.mainCanvas.style.setProperty("background",i)}function D(e,t,n=t,i=100){switch(e){case"linear":j(t,t,i);break;case"gradient":case"radial":j(t,n,i)}}function R(e,t){const n=e=>{if(!e)return null;const i=e.controllers?.find(e=>e._name===t||e.property===t);if(i)return i;for(const t of e.folders||[]){const e=n(t);if(e)return e}return null};let i=n(u.clippingFolder);return i||u.clippingFolder?.add(e,t)}function z(){return u.CONFIG?.viewer?.gallery||{}}function B(e,t){return e.fileElement?.[0]||t||e.container||u.container||null}function U(e,t=""){const n=[["#1f3c88","#6da3ff"],["#0f766e","#6ee7b7"],["#9a3412","#fdba74"],["#5b21b6","#c4b5fd"]],[i,o]=n[e%n.length],r=`\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 320">\n <defs>\n <linearGradient id="g" x1="0" y1="0" x2="1" y2="1">\n <stop offset="0%" stop-color="${i}"/>\n <stop offset="100%" stop-color="${o}"/>\n </linearGradient>\n </defs>\n <rect width="480" height="320" fill="url(#g)"/>\n <circle cx="92" cy="86" r="34" fill="rgba(255,255,255,0.25)"/>\n <path d="M48 248l94-98 72 66 66-86 152 118H48z" fill="rgba(255,255,255,0.22)"/>\n <text x="240" y="164" text-anchor="middle" font-family="Arial, sans-serif" font-size="28" fill="#ffffff">${t||`Preview ${e+1}`}</text>\n </svg>\n `.trim();return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(r)}`}function G(e,t){return(t=t.filter(function(e){if(!(e instanceof Element))return!1;let t="";const n=e.querySelector("img"),i=e.querySelector("a");t=n&&n.getAttribute("src")?n.getAttribute("src"):i&&i.getAttribute("href")?i.getAttribute("href"):(e.textContent||e.innerHTML||"").trim();const o=H(t);return r=o,!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(r)&&(e.innerHTML=o,!!n);var r})).forEach(function(e){e.innerHTML='<img loading="lazy" src="'+e.innerHTML+'" width="200px" height="200px" alt="" class="img-fluid image-style-wisski-preview">'}),t}function H(e){if(!e||"string"!=typeof e)return"";let t=e.trim();if(""===t)return"";t.startsWith("public://")?t="/sites/default/files/"+t.substring(9):t.startsWith("sites/default/files/")&&(t="/"+t);const n=(u.CONFIG?.mainUrl||window.location.origin||"").replace(/\/+$/,"");try{const e=new URL(t,window.location.origin),i=e.host||"",o=e.pathname||"",r=i.toLowerCase(),a=i.includes("_")||"default"===r||"dfg_3dviewer"===r;return o.startsWith("/sites/default/files/")?a?`${n}${o}`:"http:"===e.protocol||"https:"===e.protocol?e.href:`${n}${o}`:e.href}catch(e){return t.startsWith("/sites/default/files/")?`${n}${t}`:t}}function V(e,t,n,i){void 0===i&&(i=n),document.getElementById("image-list")?.remove(),document.getElementById("modalGallery")?.remove();var o=document.createElement("div");o.setAttribute("id","image-list"),o.style.display="flex",o.style.flexWrap="wrap",o.style.gap="16px",o.style.alignItems="center";var r=document.createElement("div"),a=document.createElement("img");a.setAttribute("class","modalImage"),a.style.transform="scale(0.95)",e.bindEventListener(r,"wheel",function(t){return t.preventDefault(),t.stopPropagation(),t.deltaY>0&&e.zoomImage>.15?a.style.transform=`scale(${e.zoomImage-=e.ZOOM_SPEED_IMAGE})`:t.deltaY<0&&e.zoomImage<5&&(a.style.transform=`scale(${e.zoomImage+=e.ZOOM_SPEED_IMAGE})`),!1});var s=document.createElement("span");r.setAttribute("id","modalGallery"),r.setAttribute("class","modalGallery"),s.setAttribute("class","closeGallery"),s.setAttribute("title","Close"),s.innerHTML="&times",s.onclick=function(){r.classList.remove("is-open")},e.bindEventListener(document,"click",function(t){r.contains(t.target)||o.contains(t.target)||(r.classList.remove("is-open"),e.zoomImage=1.5,a.style.transform="scale(1.5)")}),r.appendChild(a),r.appendChild(s);for(let e=0;i.length-e>=0;e++)if(void 0!==i[e]&&void 0!==i[e].innerHTML){var l=i[e].getElementsByTagName("a");for(let e=0;e<l.length;e++)l[e].setAttribute("href","#"),l[e].setAttribute("src",l[e].firstChild.src),l[e].setAttribute("class","image-list-item");1==(l=i[e].getElementsByTagName("img")).length&&(l[0].style.maxWidth="fit-content",l[0].style.maxHeight="180px");for(let e=0;e<l.length;e++)l[e].onclick=function(){r.classList.add("is-open"),o.style.zIndex=0,o.style.display="hidden",a.src=this.src};i[e]instanceof HTMLElement&&(i[e].style.display="block"),o.appendChild(i[e])}if(o&&o.childNodes.length>0&&B(e,t)){const n=B(e,t);n.insertAdjacentElement("beforebegin",r),n.insertAdjacentElement("beforebegin",o)}}function $(e){const t=z();var n,i=t.container?document.getElementById(t.container):null;if(""!==t.imageClass){if(0===(n=document.getElementsByClassName(t.imageClass)).length){const e=document.querySelectorAll(".field--type-image");e.length>0&&(n=e,console.warn("Gallery imageClass not found, falling back to .field--type-image."))}if(n.length>0){var o=document.getElementsByClassName("field__label");void 0!==o&&o.length>0&&(o[0].innerText="")}}else""!==t.imageId&&(n=document.getElementById(t.imageId));if(null!=n)if(n.length>0)if(void 0!==n[0].innerHTML){let t=Array.from(n[0].getElementsByClassName("field__items")[0].childNodes);t=G(0,t),n[0].classList.add("field--label-hidden"),V(e,i,t,t)}else V(e,i,n);else if(void 0!==n.childNodes&&n.childNodes.length>0)if("string"==typeof n.childNodes[0].innerHTML||"string"==typeof n.childNodes[1].innerHTML){let t=Array.from(n.childNodes);t=G(0,t),n.classList.add("field--type-image"),n.classList.add("field--label-hidden"),V(e,i,t,n)}else V(e,i,n);if(!0===u.CONFIG?.viewer?.gallery?.buildFake){const n=function(){const e=z(),t=(Array.isArray(e.testImages)?e.testImages:[]).map((e,t)=>{if("string"==typeof e){const n=H(e);return n?{src:n,alt:`Preview ${t+1}`}:null}if(e&&"object"==typeof e){const n=H(e.src||e.url||"");return n?{src:n,alt:String(e.alt||e.label||`Preview ${t+1}`)}:null}return null}).filter(Boolean);return t.length>0?t:[]}(),o=n.length>0?n:Array.from({length:9},(e,t)=>({src:U(t,`Preview ${t+1}`),alt:`Preview ${t+1}`}));if(!0===t.build){const t=function(e){return e.map(e=>{const t=document.createElement("div");return t.className="field__item",t.innerHTML=`<img loading="lazy" src="${e.src}" width="200px" height="200px" alt="${e.alt}" class="img-fluid image-style-wisski-preview">`,t})}(o);return V(e,i,t,t),void console.log("Built fallback thumbnail gallery for local testing")}}console.log("No gallery source found")}const W={progress:0,bar:null,panel:null,header:null,stepsContainer:null,steps:[],isFinished:!1,hideTimer:null,resetTimer:null,init(){if(this.bar)return;const e=document.createElement("div");e.id="ultra-loader",e.innerHTML='<div id="ultra-loader-bar"></div>';const t=document.createElement("div");t.id="ultra-loader-panel";const n=document.createElement("div");n.id="ultra-loader-header",n.textContent=y("processingHeader"),t.appendChild(n);const i=document.createElement("div");i.id="ultra-loader-steps",t.appendChild(i),document.body.appendChild(e),document.body.appendChild(t),this.bar=document.getElementById("ultra-loader-bar"),this.panel=t,this.header=n,this.stepsContainer=i},start(e){this.init(),this.hideTimer&&(window.clearTimeout(this.hideTimer),this.hideTimer=null),this.resetTimer&&(window.clearTimeout(this.resetTimer),this.resetTimer=null),this.steps=e,this.updateHeader(),this.progress=5,this.isFinished=!1,this.bar.style.width="5%",this.bar.style.background="",this.renderSteps(0),this.panel.classList.add("show"),this.render()},set(e,t){this.progress=Math.max(this.progress,e),this.render()},step(e){this.renderSteps(e)},finish(){this.progress=100,this.isFinished=!0,this.render(),this.renderSteps(this.steps.length),this.hideTimer=window.setTimeout(()=>{this.isFinished&&(this.panel.classList.remove("show"),this.hideTimer=null,this.resetTimer=window.setTimeout(()=>{this.bar.style.width="0%",this.progress=0,this.resetTimer=null},1500))},2500)},render(){this.bar.style.width=this.progress+"%"},updateHeader(){this.header&&(this.header.textContent=y("processingHeader"))},renderSteps(e){this.updateHeader(),this.stepsContainer&&(this.stepsContainer.replaceChildren(),this.steps.forEach((t,n)=>{const i=document.createElement("div");i.className="ultra-step",n<e?(i.classList.add("done"),i.textContent="✓ "+t):n===e?(i.classList.add("active"),i.textContent="⏳ "+t):(i.classList.add("pending"),i.textContent="□ "+t),this.stepsContainer.appendChild(i)}))},error(e="Processing error"){this.isFinished=!0,this.renderErrorSteps();const t=document.createElement("div");t.id="ultra-loader-error",t.textContent=`ERROR: ${e}`,this.panel.appendChild(t),this.bar.style.background="#d93025"},renderErrorSteps(){this.updateHeader(),this.stepsContainer&&(this.stepsContainer.replaceChildren(),this.steps.forEach(e=>{const t=document.createElement("div");t.className="ultra-step error",t.textContent="✖ "+e,this.stepsContainer.appendChild(t)}))}};function X(e,t,n){return e?t:n}function K(e,t){const n=e.originalMetadata,i=e.saveProperties,o={};return o.objPosition=X(i.Position,[u.helperObjects[0].position.x,u.helperObjects[0].position.y,u.helperObjects[0].position.z],n.objPosition),o.objRotation=X(i.Rotation,[t.x,t.y,t.z],n.objRotation),o.objScale=X(i.Scale,[u.helperObjects[0].scale.x,u.helperObjects[0].scale.y,u.helperObjects[0].scale.z],n.objScale),o.cameraPosition=X(i.Camera,[u.camera.position.x,u.camera.position.y,u.camera.position.z],n.cameraPosition),o.controlsTarget=X(i.Camera,[u.controls.target.x,u.controls.target.y,u.controls.target.z],n.controlsTarget),o.controlsZoom=X(i.Camera,[u.camera.position.distanceTo(u.controls.target)],n.controlsZoom),o.lightPosition=X(i.DirectionalLight,[u.dirLight.position.x,u.dirLight.position.y,u.dirLight.position.z],n.lightPosition),o.lightTarget=X(i.DirectionalLight,[u.dirLight.rotation._x,u.dirLight.rotation._y,u.dirLight.rotation._z],n.lightTarget),o.lightColor=X(i.DirectionalLight,["#"+u.dirLight.color.getHexString().toUpperCase()],n.lightColor),o.lightIntensity=X(i.DirectionalLight,[u.dirLight.intensity],n.lightIntensity),o.lightAmbientColor=X(i.AmbientLight,["#"+u.ambientLight.color.getHexString().toUpperCase()],n.lightAmbientColor),o.lightAmbientIntensity=X(i.AmbientLight,[u.ambientLight.intensity],n.lightAmbientIntensity),o.lightCameraColor=X(i.CameraLight,["#"+u.cameraLight.color.getHexString().toUpperCase()],n.lightCameraColor),o.lightCameraIntensity=X(i.CameraLight,[u.cameraLight.intensity],n.lightCameraIntensity),o.background=i.BackgroundColor?[window.getComputedStyle(e.mainCanvas).background]:n.background,o.annotationEntries=e.getAnnotationEntriesForPersistence(),o.iiifAnnotationsXml=e.exportAnnotationsToIIIFXml(),o}function Y(e,t,n,i){i.x=(t-e.mainCanvas.getBoundingClientRect().left)/u.renderer.domElement.clientWidth*2-1,i.y=-(n-e.mainCanvas.getBoundingClientRect().top)/u.renderer.domElement.clientHeight*2+1}function Z(e,t){e.raycaster.setFromCamera(t,u.camera);let n=[];if(u.mainObject.length>1){for(let t=0;t<u.mainObject.length;t++)n.push(...e.raycaster.intersectObjects(u.mainObject[t].children,!0));n.length<=0&&(n=e.raycaster.intersectObjects(u.mainObject,!0))}else u.mainObject[0]&&(n=e.raycaster.intersectObject(u.mainObject[0],!0));return e.getPrimaryIntersection(n)}function q(e,t){e.raycaster.setFromCamera(t,u.camera);return e.raycaster.intersectObjects(e.annotationPOIMarkers||[],!0).find(e=>!0===e?.object?.userData?.isAnnotationPOI)||null}function J(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Q(){const e=document.getElementById("metadata-content"),t=document.getElementById("metadata-card");if(!e||!t||!e.classList.contains("expanded"))return;const n=e.scrollHeight-e.clientHeight>8;t.classList.toggle("metadata-card-overflowing",n),e.querySelectorAll(".metadata-row").forEach(e=>{const t=e.querySelector(".metadata-value");if(!t)return;const n=e.classList.contains("metadata-row-pinned");e.classList.remove("metadata-row-pinned","metadata-row-expandable");const i=t.scrollHeight-t.clientHeight>4;e.classList.toggle("metadata-row-expandable",i),n&&i&&e.classList.add("metadata-row-pinned")})}function ee(){"true"!==u.metadataContainer.dataset.boundCollapse&&(u.metadataContainer.addEventListener("click",e=>{if(e.target.closest("#metadata-collapse"))return void function(){const e=document.getElementById("metadata-content"),t=document.getElementById("metadata-collapse"),n=document.getElementById("metadata-card");if(!e||!t)return;const i=e.classList.toggle("expanded");if(t.classList.toggle("metadata-collapsed",!i),n?.classList.toggle("metadata-open",i),t.setAttribute("aria-expanded",i),!i)return n?.classList.remove("metadata-card-overflowing"),void e.querySelectorAll(".metadata-row-pinned").forEach(e=>{e.classList.remove("metadata-row-pinned")});Q()}();const t=document.getElementById("metadata-card"),n=document.getElementById("metadata-content");if(!t||!n||!n.classList.contains("expanded"))return;const i=e.target.closest(".metadata-row");if(!i)return;const o=!i.classList.contains("metadata-row-pinned");n.querySelectorAll(".metadata-row-pinned").forEach(e=>{e.classList.remove("metadata-row-pinned")}),o&&i.classList.add("metadata-row-pinned")}),window.addEventListener("resize",Q),u.metadataContainer.dataset.boundCollapse="true")}function te(e,t){if(!e?.geometry)return 0;const n=e.geometry.index?.count,i=e.geometry.attributes?.position?.count??0;switch(t){case"vertices":return i;case"faces":return(n??i)/3;default:return 0}}async function ne(e,t,n){Viewer.clearHierarchySubmenu(),Array.isArray(n)?(O(n[0],e),await x(n[0],e)):"Scene"===n.name||n.children.length>0||"Mesh"==n.type?(O(n,e),n.traverse(function(e){if(e.isMesh){t.vertices+=te(e,"vertices"),t.faces+=te(e,"faces"),""===e.name&&(e.name="Mesh");var n=g(e.name,35);Viewer.addHierarchySubmenuItem(n,e.id),e.traverse(function(t){if(t.isMesh&&t.name!==e.name){""===t.name&&(t.name="ChildrenMesh");var n=g(t.name,35);Viewer.addHierarchySubmenuItem(n,t.id)}})}}),await x(n,e)):(O(n,e),await x(n,e),t.vertices+=te(n,"vertices"),t.faces+=te(n,"faces"),""===n.name?(Viewer.addHierarchySubmenuItem("Mesh",n.id),n.name=n.id):Viewer.addHierarchySubmenuItem(n.name,n.id)),u.metadataContainer||(u.metadataContainer=document.createElement("div"),u.metadataContainer.id="metadata-container"),u.metadataContainer.setAttribute("data-viewer-theme",u.container?.closest(".viewer-wrapper")?.getAttribute("data-viewer-theme")||"dark");var i='<div id="metadata-card"><button id="metadata-collapse" class="metadata-collapse metadata-collapsed" type="button" aria-expanded="false" aria-controls="metadata-content"><span class="metadata-toggle-icon" aria-hidden="true"></span><span class="metadata-toggle-copy"><span class="metadata-toggle-eyebrow" data-i18n-key="metadata.modelDetails">'+J(y("metadata.modelDetails","Model details"))+'</span><span class="metadata-toggle-title" data-i18n-key="metadata.metadata">'+J(y("metadata.metadata","Metadata"))+'</span></span><span class="metadata-toggle-chevron" aria-hidden="true"></span></button><div id="metadata-content" class="metadata-content">';if(i+='<div class="metadata-row"><span class="metadata-label" data-i18n-key="metadata.visualizedFile">'+J(y("metadata.visualizedFile","Visualized file"))+':</span><span class="metadata-value">'+J(u.fileObject.basename)+"."+J(u.fileObject.extension)+"</span></div>",i+='<div class="metadataSeparator"></div>',i+='<div class="metadata-row"><span class="metadata-label" data-i18n-key="metadata.vertices">'+J(y("metadata.vertices","Vertices"))+':</span><span class="metadata-value">'+t.vertices+"</span></div>",i+='<div class="metadata-row"><span class="metadata-label" data-i18n-key="metadata.faces">'+J(y("metadata.faces","Faces"))+':</span><span class="metadata-value">'+t.faces+"</span></div>",i+=await async function(){return u.CONFIG.entity.metadata.sourceType&&""!==u.CONFIG.entity.metadata.url?(console.warn("Entity ID is missing or invalid. Skipping metadata fetch."),""):""}(),u.downloadModel||(u.downloadModel.hidden=!0,u.downloadModel.removeAttribute("href")),u.viewEntity&&(u.viewEntity.hidden=!0,u.viewEntity.removeAttribute("data-embed-url")),!u.isLightweight&&u.downloadModel){const e=u.fileObject.path;""!==u.loadedFile&&(u.fileObject.filename=u.fileObject.filename.replace(u.fileObject.orgExtension,u.fileObject.extension)),u.downloadModel.href=`blob:${encodeURI(e+u.fileObject.filename)}`,u.downloadModel.setAttribute("download",u.fileObject.filename),u.downloadModel.hidden=!1,window.Viewer?.updateDownloadMenuEntryLabel?.()}if(u.viewEntity&&(u.CONFIG?.entity?.id||u.fileObject?.originalPath)){const e=window.Viewer?.getSharePayload?.();e?.url&&u.viewEntity.setAttribute("data-embed-url",e.url),window.Viewer?.updateEmbedMenuEntryState?.(),u.viewEntity.hidden=!1}(function(e){u.metadataContainer.innerHTML=e,u.container.contains(u.metadataContainer)||u.container.appendChild(u.metadataContainer)})(i+="</div></div>"),ee(),requestAnimationFrame(Q)}async function ie(e,t,n){Array.isArray(e)?(O(e[0],n),await x(e[0],n)):("Scene"===e.name||e.children.length,O(e,n),await x(e,n))}async function oe(e){if(null===e||""===e)return console.log("No metadata found due to null or empty metadata URL",e),null;try{if(u.isLocalPreview)return null;const t=await fetch(e,{cache:"no-cache"});return 404===t.status?(v("settingsNotFound","info",{filename:u.fileObject.filename}),null):(v("settingsFound","success",{filename:u.fileObject.filename}),t.json())}catch(e){return v("metadataFetchError","error",{error:e.message}),null}}async function re(e){u.PRESENTATION_MODE&&async function(e){Array.isArray(e)?(e.forEach(e=>{e.updateMatrixWorld(!0)}),await x(e,null)):("Scene"===e.name||e.children.length>0||e.type,O(e,null),await x(e,null))}(e)}function ae(e="iiif"){const t=document.createElement("div"),n="iiif"===e?"IIIF":"AIM3IF",i="iiif"===e?"iiif":"aim3if";t.id="form-manifesto";const o=document.createElement("div");o.className="form-manifesto-header",o.innerHTML=`\n <span class="title">${J(y(`${i}.loader`,`${n} Loader`))}</span>\n <div class="tools">\n <button type="button" id="manifesto-toggle-collapse" title="${J(y(`${i}.collapse`,"Collapse"))}">▾</button>\n </div>\n `,t.appendChild(o);const r=document.createElement("div");r.className="form-manifesto-content",r.id="form-manifesto-content",r.innerHTML=`\n <div class="form-manifesto-group">\n <input type="text" id="manifesto-manifest-url" placeholder="${J(y(`${i}.manifestUrlPlaceholder`,"https://example.org/manifesto/manifest.json"))}">\n <button class="primary" id="load-manifesto-from-url">${J(y(`${i}.loadFromUrl`,"Load from URL"))}</button>\n </div>\n\n <div class="form-manifesto-group column">\n <textarea id="manifesto-manifest-text" rows="8" placeholder="${J(y(`${i}.manifestTextPlaceholder`,`Paste ${n} manifest JSON here...`))}"></textarea>\n <div class="actions">\n <button class="secondary" id="load-manifesto-from-text">${J(y(`${i}.loadFromText`,"Load from Text"))}</button>\n </div>\n </div>\n `,t.appendChild(r),document.body.appendChild(t)}window.UltraLoader=W;const se=async()=>(await import("./assets/three.js").then(function(e){return e.l})).OBJLoader,le=async()=>(await import("./assets/three.js").then(function(e){return e.G})).GLTFLoader;let ce={};const de={gltf:le,glb:le,obj:se,fbx:async()=>(await import("./assets/three.js").then(function(e){return e.n})).FBXLoader,ply:async()=>(await import("./assets/three.js").then(function(e){return e.P})).PLYLoader,stl:async()=>(await import("./assets/three.js").then(function(e){return e.S})).STLLoader,dae:async()=>(await import("./assets/three.js").then(function(e){return e.o})).ColladaLoader,xyz:async()=>(await import("./assets/three.js").then(function(e){return e.X})).XYZLoader,"3ds":async()=>(await import("./assets/three.js").then(function(e){return e.p})).TDSLoader,pcd:async()=>(await import("./assets/three.js").then(function(e){return e.q})).PCDLoader,ifc:async()=>(await import("./assets/IFCLoader.js")).IFCLoader};async function ue(e){const t=de[e];if(!t)throw new Error(`Unsupported format: ${e}`);return new(await t())}function pe(e){if("undefined"==typeof window||!e)return e;let t=e.trim();t.startsWith("http://")?t="https://"+t.slice(7):t.startsWith("//")?t=`${window.location.protocol}${t}`:t.startsWith("/")?t=`${window.location.protocol}//${window.location.host}${t}`:/^[a-zA-Z][\w+-.]*:/.test(t)||(t=new URL(t,window.location.href).href);try{const e=new URL(t);e.pathname=e.pathname.replace(/\/\/{2,}/g,"/"),t=e.href}catch(e){t=t.replace(/\/\/{2,}/g,"/")}return t}function he(e){if(!e||"string"!=typeof e)return"";let t=e.trim().replace(/\/$/,"");if(!t)return"";if(/^[a-zA-Z][\w+-.]*:\/\//.test(t))try{const e=new URL(t),n=`/${e.host}`;return e.pathname.startsWith(n)&&(e.pathname=e.pathname.slice(n.length)||"/"),e.pathname=e.pathname.replace(/\/\/{2,}/g,"/"),e.href.replace(/\/$/,"")}catch(e){return t}if(/^[^\/]+\.[^\/]+\/.+/.test(t)){const e=t.split("/"),n=e.shift(),i=`/${e.join("/")}`.replace(/\/\/{2,}/g,"/");if(n&&"undefined"!=typeof window&&(n===window.location.host||/^\w[\w.-]*\.[a-z]{2,}$/i.test(n)))return i.replace(/\/$/,"")}if(/^\/[^\/]+\.[^\/]+\/.+/.test(t)){const e=t.split("/").filter(Boolean),n=e.shift(),i=`/${e.join("/")}`.replace(/\/\/{2,}/g,"/");if(n&&"undefined"!=typeof window&&(n===window.location.host||/^\w[\w.-]*\.[a-z]{2,}$/i.test(n)))return i.replace(/\/$/,"")}return t.replace(/\/\/{2,}/g,"/")}function ge(t,n){n.map&&(n.map.anisotropy=16,n.map.colorSpace=e.SRGBColorSpace),n.envMapIntensity=.76,n.roughness=Math.min(1.35*n.roughness,1),n.clipShadows=!0,n.side=u.PRESENTATION_MODE?e.DoubleSide:e.FrontSide,n.clippingPlanes=u.PRESENTATION_MODE?[]:u.clippingPlanes,n.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace("reflectedLight.directSpecular += directSpecular;","\n reflectedLight.directSpecular += directSpecular * 0.15;\n ")},n.needsUpdate=!0,""===n.name&&(n.name=n.uuid);var i={name:n.name,uuid:n.uuid};t.some(e=>e.uuid===i.uuid)||t.push(i)}function me(e){var t=[];return e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,e.geometry&&"function"==typeof e.geometry.computeVertexNormals&&!e.geometry.getAttribute?.("normal")&&e.geometry.computeVertexNormals(),e.material.isMaterial?ge(t,e.material):Array.isArray(e.material)&&e.material.forEach(e=>ge(t,e))),t}function fe(t,n="neutral"){return t?(u.scene.environmentIntensity=u.environmentMapIntensity||.5,ce[n]||(ce[n]=(async()=>{const i=new e.PMREMGenerator(t);try{if("studio"===n){const e=await(async()=>(await import("./assets/three.js").then(function(e){return e.R})).RoomEnvironment)();return i.fromScene(new e).texture}if("neutral"===n||"sunny"===n||"goldenHour"===n){const t=await(async()=>(await import("./assets/three.js").then(function(e){return e.H})).HDRLoader)(),o=new t,r=u.DFG_ASSETS||u.CONFIG?.baseModulePath||"/assets",a="goldenHour"===n?"golden_hour.hdr":`${n}.hdr`,s=`${r.replace(/\/$/,"")}/maps/${a}`,l=await new Promise((e,t)=>{o.load(s,e,void 0,t)});return l.mapping=e.EquirectangularReflectionMapping,i.fromEquirectangular(l).texture}return null}finally{i.dispose()}})()),ce[n]):Promise.resolve(null)}async function be(e=!0,t=null){if(!u.scene)return;const n=t||window.viewer?.environmentMapPreset||"neutral";var i;e?(u.scene.environment=await fe(u.renderer,n),0===u.scene.environmentIntensity&&(u.scene.environmentIntensity=.5)):(u.scene.environment=null,u.scene.environmentIntensity=0),i=u.scene,i?.traverse?.(e=>{(e?.material?Array.isArray(e.material)?e.material:[e.material]:[]).forEach(e=>{(e?.isMeshStandardMaterial||e?.isMeshPhysicalMaterial)&&(e.needsUpdate=!0)})})}function ye(e,t=""){const n=E(e,{context:t,consoleLabel:"Viewer load error:"});return u.circle?.complete?.(1200),void 0!==u.EXIT_CODE&&(u.EXIT_CODE=1),n}async function ve(){u.loadingLog?.start?.();let t=u.fileObject.filename.startsWith("blob:")?u.fileObject.filename:u.fileObject.path+u.fileObject.filename;function n(e,t,n=Ee){return new Promise((i,o)=>{e.load(t,i,n,o)})}function i(e,t=null){u.circle?.setStage?.(e,t),u.loadingLog?.setStage?.(e,t)}async function o({object:t}){if(null==t)throw new Error("Loaded object is null or undefined.");if(i("loadingLog.loadingTextures",99),u.PRESENTATION_MODE||(Array.isArray(t)?t.forEach(e=>{e.position.set(0,0,0),e.rotation.set(0,0,0),e.scale.set(1,1,1),e.updateMatrixWorld(!0)}):(t.position.set(0,0,0),t.rotation.set(0,0,0),t.scale.set(1,1,1),t.updateMatrixWorld(!0)),u.handHint.hidden=!0),window.viewer.modelLoaded=!0,i("loadingLog.preparingGeometry",99),function(e){me(e),e.traverse(function(e){me(e)}),window.Viewer?.initializeMaterialsEditor&&!0!==u.PRESENTATION_MODE&&window.Viewer.initializeMaterialsEditor(e)}(t),u.PRESENTATION_MODE)i("loadingLog.settingUpMaterials",99),re(t).catch(e=>{ye(e,"Presentation mode setup failed"),w("toasts.presentationModeError","error")});else{/\/[^/]+_(ZIP|RAR|TAR|XZ|GZ)\/gltf\/$/i.test(u.fileObject.path)||("gltf"===u.fileObject.extension.toLowerCase()||"glb"===u.fileObject.extension.toLowerCase()?u.fileObject.path=u.fileObject.path.replace("/gltf/","/"):u.fileObject.path=u.fileObject.path.replace("gltf/","")),i("loadingLog.fetchingMetadata",99),await async function(e){var t={vertices:0,faces:0};let n="";if(u.fileObject.filename.startsWith("blob:"))console.log("Skipping metadata fetch for local file");else if(u.CONFIG.metadataUrl&&u.fileObject.uri&&u.fileObject.filename){const e=new URL(u.CONFIG.metadataUrl).href.replace(/\/+$/,"");let t=new URL(u.fileObject.uri).href.replace(/\/+$/,"");t.startsWith(e)&&(t=t.slice(e.length)),t=t.replace(/^\/+/,""),n=new URL(`${e}/${t}/metadata/${u.fileObject.filename}_viewer.json`).href,console.log("Fetched metadata from:",n)}else console.warn("Metadata URL or file information is missing. Skipping metadata fetch.");if("IIIF"===u.CONFIG.entity.metadata.sourceType)console.log("Fetching IIIF metadata from ",u.objectsConfig),await ne(u.CONFIG.model,t,e);else if(n)if(console.log("Loading metadata from URL:",n),void 0!==u.CONFIG.entity.proxyPath||u.isLightweight){n=u.getProxyPath(n,u.CONFIG);const i=await oe(n);window.Viewer?.hydrateAnnotationsFromMetadataPayload?.(i),await ne(i,t,e),ie(e,0,i)}else{const i=await oe(n);window.Viewer?.hydrateAnnotationsFromMetadataPayload?.(i),await ne(i,t,e),ie(e,0,i)}else window.Viewer?.hydrateAnnotationsFromMetadataPayload?.(null),await ne("",t,e)}(t),i("loadingLog.settingUpMaterials",99),u.outlineClipping=function(t){u.outlineClipping=t.clone(!0);var n=new e.MeshBasicMaterial({color:"crimson",side:e.BackSide,clippingPlanes:u.clippingPlanes,clipShadows:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});return u.outlineClipping.traverse(function(e){"Mesh"!=e.type&&"Object3D"!=e.type||(e.material=n)}),u.outlineClipping.visible=!1,u.outlineClipping}(t),Array.isArray(t)?u.helperObjects.push(t[0]):u.helperObjects.push(t),u.scene.add(u.outlineClipping)}i("loadingLog.settingUpLighting",99),Array.isArray(t)?t.forEach(e=>u.scene.add(e)):u.scene.add(t),u.mainObject.push(t),i("loadingLog.compilingShaders",99),await be(!1!==u.environmentMapEnabled)}function r(e){if(!e||"string"!=typeof e)return e;if(/^[a-zA-Z][\w+-.]*:\/\//.test(e))try{const t=new URL(e);return t.pathname=t.pathname.replace(/\/{2,}/g,"/"),t.href}catch(t){return e}return e.replace(/\/{2,}/g,"/")}void 0===u.CONFIG.entity.proxyPath||u.fileObject.filename.startsWith("blob:")||(t=u.getProxyPath(t,u.CONFIG,u.fileObject));try{switch(u.fileObject.extension.toLowerCase()){case"obj":{const t=await async function(){const t=await(async()=>(await import("./assets/three.js").then(function(e){return e.j})).DDSLoader)(),n=await(async()=>(await import("./assets/three.js").then(function(e){return e.k})).MTLLoader)(),i=await se(),o=new e.LoadingManager;o.onLoad=()=>v("objLoaded","success"),o.addHandler(/\.dds$/i,new t);const r=u.fileObject.filename.replace(/\.[^/.]+$/,""),a=u.fileObject.filename;if(!u.CONFIG.noMTL)try{const e=await new Promise((e,t)=>{new n(o).setPath(u.fileObject.path).load(r+".mtl",e,void 0,t)});e.preload();const t=await new Promise((t,n)=>{new i(o).setMaterials(e).setPath(u.fileObject.path).load(a,t,Ee,n)});return t.position.set(0,0,0),t}catch(e){u.CONFIG.noMTL=!0,v("mtlLoadError","error"),console.warn("MTL load failed, falling back to OBJ-only load.",e)}const s=await new Promise((e,t)=>{(new i).setPath(u.fileObject.path).load(a,e,Ee,t)});return s.position.set(0,0,0),s}();await o({object:t});break}case"fbx":{const e=await ue(u.fileObject.extension.toLowerCase()),i=await n(e,t,Ee);i.position.set(0,0,0),await o({object:i});break}case"ply":{const i=await ue(u.fileObject.extension.toLowerCase()),r=await n(i,t,Ee);r.getAttribute?.("normal")||r.computeVertexNormals();const a=new e.MeshStandardMaterial({color:22015,flatShading:!0}),s=new e.Mesh(r,a);s.position.set(0,0,0),s.castShadow=!0,s.receiveShadow=!0,await o({object:s});break}case"dae":{const e=await ue(u.fileObject.extension.toLowerCase()),i=(await n(e,t,Ee)).scene;i.position.set(0,0,0),await o({object:i});break}case"ifc":{const e=await ue(u.fileObject.extension.toLowerCase()),i=we();let a=await async function(e){const t=[r(e.replace(/\/$/,"")+"/ifc/"),r(e.replace(/\/$/,"")+"/ifc")];for(const e of t){const t=e.replace(/\/$/,"")+"/web-ifc.wasm";try{if((await fetch(t,{method:"HEAD",cache:"no-store"})).ok)return e}catch(e){}}return null}(i);if(!a){const e=`[loadModel] IFC WASM not found in ${i}/ifc; please verify path and permissions`;throw console.error(e),new Error(e)}const s=pe(a);console.log("[loadModel] IFC WASM path:",s),e.ifcManager.setWasmPath(s,!0);const l=await n(e,t,Ee);await o({object:l});break}case"stl":{const i=await ue(u.fileObject.extension.toLowerCase()),r=await n(i,t,Ee);let a=new e.MeshPhongMaterial({color:16733491,specular:1118481,shininess:200});r.hasColors&&(a=new e.MeshPhongMaterial({opacity:r.alpha,vertexColors:!0}));const s=new e.Mesh(r,a);s.position.set(0,0,0),s.castShadow=!0,s.receiveShadow=!0,await o({object:s});break}case"xyz":{const i=await ue(u.fileObject.extension.toLowerCase()),r=await n(i,t,Ee);r.center();const a=new e.PointsMaterial({size:.1,vertexColors:!0===r.hasAttribute("color")}),s=new e.Points(r,a);s.position.set(0,0,0),await o({object:s});break}case"pcd":{const e=await ue(u.fileObject.extension.toLowerCase()),i=await n(e,t,Ee);i.geometry?.center?.(),i.material&&(i.material.size=Math.max(i.material.size??0,.1)),await o({object:i});break}case"json":{const i=new e.ObjectLoader,r=await n(i,t,Ee);r.position.set(0,0,0),await o({object:r});break}case"3ds":{const e=await ue(u.fileObject.extension.toLowerCase());e.setResourcePath(u.fileObject.path);let t=u.fileObject.path;void 0!==u.CONFIG.entity.proxyPath&&(t=u.getProxyPath(t));const i=await n(e,t+u.fileObject.basename+"."+u.fileObject.extension,Ee);await o({object:i});break}case"glb":case"gltf":{const e=await async function(){let e=u.fileObject.filename.startsWith("blob:")?u.fileObject.filename:u.fileObject.path+u.fileObject.basename+"."+u.fileObject.extension;void 0===u.CONFIG.entity.proxyPath||u.fileObject.filename.startsWith("blob:")||(e=u.getProxyPath(e));const t=r(pe(`${we()}/draco/gltf/`)),n=await ue(u.fileObject.extension.toLowerCase()),i=await(async()=>(await import("./assets/three.js").then(function(e){return e.r})).DRACOLoader)(),o=new i;o.setDecoderConfig({type:"js"}),o.setDecoderPath(t),n.setDRACOLoader(o);try{return(await new Promise((t,i)=>{n.load(e,t,e=>{Ce(e)},i)})).scene}finally{o.dispose()}}();await o({object:e});break}default:return v("unsupportedExtension","warning"),void u.loadingLog?.fail?.()}i("loadingLog.modelLoaded",100),u.circle?.complete?.(2600),u.editorToolbar?.classList.remove("editorToolbar-hidden"),u.editorToolbar?.classList.add("editorToolbar-visible"),u.loadingLog?.finish?.(),u.PRESENTATION_MODE?v("presentationModeReady","success"):v("modelLoaded","success",{filename:u.fileObject.filename}),void 0!==u.EXIT_CODE&&(u.EXIT_CODE=0),u.UltraLoader?.finish(),u.poller?.updateSteps(2)}catch(e){throw u.loadingLog?.fail?.(),ye(e,`Failed to load ${u.fileObject.filename}`),e}}console.log("[loaders] ENV_BUILD:","library"),console.log("[loaders] MODULES_PATH:",""),console.log("[loaders] ENV_SUBDIR:","");const we=function(){let e=he(u.DFG_ASSETS||u.CONFIG?.baseModulePath);if(!e&&void 0!==import.meta&&import.meta.url){const t=new URL(import.meta.url);e=t.pathname.includes("/assets/")?new URL("../assets/",t).pathname.replace(/\/$/,""):new URL("./assets/",t).pathname.replace(/\/$/,"")}return e||(e="/assets"),u.isLocalPreview&&(e="/assets"),e=he(e),console.log("[loaders] resolved ModuleAssetBasePath:",e),u.CONFIG.baseModulePath=e,u.DFG_ASSETS=e,e},Ee=function(e){Ce(e)},Ce=function(e){if(!u.circle)return;const t=e.total||e.loaded||1,n=Math.min(e.loaded/t*100,99);Number.isFinite(n)&&(u.circle.show(),u.circle.set(n,100),u.editorToolbar?.classList.remove("editorToolbar-hidden"),u.editorToolbar?.classList.add("editorToolbar-visible"),u.loadingLog?.update?.(n),u.UltraLoader?.set(n))};class Me{constructor(e){this.id=e,this.interval=2e3,this.timer=null,this.running=!1}async start(){this.running||(this.running=!0,u.isLocalPreview?this.map=u.isLocalPreview?Object.fromEntries(Object.entries(this.fullMap).slice(-3).map(([e],t)=>[e,t])):this.fullMap:await this.tick())}stop(){this.running=!1,this.timer&&clearTimeout(this.timer)}fullMap={init:0,preparing:1,processing:2,converted:3,updating:4,rendering:4,model_ready:5,viewer_ready:6,ready:6,failed:7,error:7};terminalStatuses=new Set(["ready","viewer_ready","failed","error"]);map=this.fullMap;updateSteps(e){void 0!==this.map[e]&&UltraLoader.step(this.map[e])}async tick(){if(this.running&&!u.isLocalPreview){try{const e=await fetch(`/api/model/status/${this.id}`,{cache:"no-store"});if(!e.ok)throw new Error("API error");const t=await e.json();if("error"===t.status)return UltraLoader.error(t.message||"Processing failed"),this.stop(),void localStorage.removeItem("processing_model_id");if(UltraLoader.set(t.progress),this.updateSteps(t.status),this.terminalStatuses.has(t.status))return"ready"===t.status||"viewer_ready"===t.status?UltraLoader.finish("3D Viewer is ready"):UltraLoader.finish("Failed processing the model"),this.stop(),void localStorage.removeItem("processing_model_id")}catch(e){u.isLocalPreview||(UltraLoader.error("Connection error"),this.stop())}this.timer=setTimeout(()=>this.tick(),this.interval)}}}var Se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ie(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ae,Le={exports:{}};function Oe(){return Ae||(Ae=1,Le.exports=(e=function(){function t(e){return o.appendChild(e.dom),e}function n(e){for(var t=0;t<o.children.length;t++)o.children[t].style.display=t===e?"block":"none";i=e}var i=0,o=document.createElement("div");o.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",o.addEventListener("click",function(e){e.preventDefault(),n(++i%o.children.length)},!1);var r=(performance||Date).now(),a=r,s=0,l=t(new e.Panel("FPS","#0ff","#002")),c=t(new e.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new e.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:o,addPanel:t,showPanel:n,begin:function(){r=(performance||Date).now()},end:function(){s++;var e=(performance||Date).now();if(c.update(e-r,200),e>a+1e3&&(l.update(1e3*s/(e-a),100),a=e,s=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){r=this.end()},domElement:o,setMode:n}},e.Panel=function(e,t,n){var i=1/0,o=0,r=Math.round,a=r(window.devicePixelRatio||1),s=80*a,l=48*a,c=3*a,d=2*a,u=3*a,p=15*a,h=74*a,g=30*a,m=document.createElement("canvas");m.width=s,m.height=l,m.style.cssText="width:80px;height:48px";var f=m.getContext("2d");return f.font="bold "+9*a+"px Helvetica,Arial,sans-serif",f.textBaseline="top",f.fillStyle=n,f.fillRect(0,0,s,l),f.fillStyle=t,f.fillText(e,c,d),f.fillRect(u,p,h,g),f.fillStyle=n,f.globalAlpha=.9,f.fillRect(u,p,h,g),{dom:m,update:function(l,b){i=Math.min(i,l),o=Math.max(o,l),f.fillStyle=n,f.globalAlpha=1,f.fillRect(0,0,s,p),f.fillStyle=t,f.fillText(r(l)+" "+e+" ("+r(i)+"-"+r(o)+")",c,d),f.drawImage(m,u+a,p,h-a,g,u,p,h-a,g),f.fillRect(u+h-a,p,a,g),f.fillStyle=n,f.globalAlpha=.9,f.fillRect(u+h-a,p,a,r((1-l/b)*g))}}},e)),Le.exports;var e}var _e=Ie(Oe());
/**
* lil-gui
* https://lil-gui.georgealways.com
* @version 0.19.2
* @author George Michael Brower
* @license MIT
*/
class Pe{constructor(e,t,n,i,o="div"){this.parent=e,this.object=t,this.property=n,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(o),this.domElement.classList.add("controller"),this.domElement.classList.add(i),this.$name=document.createElement("div"),this.$name.classList.add("name"),Pe.nextNameID=Pe.nextNameID||0,this.$name.id="lil-gui-name-"+ ++Pe.nextNameID,this.$widget=document.createElement("div"),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.domElement.addEventListener("keydown",e=>e.stopPropagation()),this.domElement.addEventListener("keyup",e=>e.stopPropagation()),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(n)}name(e){return this._name=e,this.$name.textContent=e,this}onChange(e){return this._onChange=e,this}_callOnChange(){this.parent._callOnChange(this),void 0!==this._onChange&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),void 0!==this._onFinishChange&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(e=!0){return this.disable(!e)}disable(e=!0){return e===this._disabled||(this._disabled=e,this.domElement.classList.toggle("disabled",e),this.$disable.toggleAttribute("disabled",e)),this}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(e){const t=this.parent.add(this.object,this.property,e);return t.name(this._name),this.destroy(),t}min(e){return this}max(e){return this}step(e){return this}decimals(e){return this}listen(e=!0){return this._listening=e,void 0!==this._listenCallbackID&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const e=this.save();e!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=e}getValue(){return this.object[this.property]}setValue(e){return this.getValue()!==e&&(this.object[this.property]=e,this._callOnChange(),this.updateDisplay()),this}updateDisplay(){return this}load(e){return this.setValue(e),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}let xe=class extends Pe{constructor(e,t,n){super(e,t,n,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}};function Te(e){let t,n;return(t=e.match(/(#|0x)?([a-f0-9]{6})/i))?n=t[2]:(t=e.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?n=parseInt(t[1]).toString(16).padStart(2,0)+parseInt(t[2]).toString(16).padStart(2,0)+parseInt(t[3]).toString(16).padStart(2,0):(t=e.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(n=t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),!!n&&"#"+n}const ke={isPrimitive:!0,match:e=>"number"==typeof e,fromHexString:e=>parseInt(e.substring(1),16),toHexString:e=>"#"+e.toString(16).padStart(6,0)},Fe={isPrimitive:!1,match:e=>Array.isArray(e),fromHexString(e,t,n=1){const i=ke.fromHexString(e);t[0]=(i>>16&255)/255*n,t[1]=(i>>8&255)/255*n,t[2]=(255&i)/255*n},toHexString:([e,t,n],i=1)=>ke.toHexString(e*(i=255/i)<<16^t*i<<8^n*i)},je={isPrimitive:!1,match:e=>Object(e)===e,fromHexString(e,t,n=1){const i=ke.fromHexString(e);t.r=(i>>16&255)/255*n,t.g=(i>>8&255)/255*n,t.b=(255&i)/255*n},toHexString:({r:e,g:t,b:n},i=1)=>ke.toHexString(e*(i=255/i)<<16^t*i<<8^n*i)},Ne=[{isPrimitive:!0,match:e=>"string"==typeof e,fromHexString:Te,toHexString:Te},ke,Fe,je];class De extends Pe{constructor(e,t,n,i){var o;super(e,t,n,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(o=this.initialValue,Ne.find(e=>e.match(o))),this._rgbScale=i,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const e=Te(this.$text.value);e&&this._setValueFromHexString(e)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(e){if(this._format.isPrimitive){const t=this._format.fromHexString(e);this.setValue(t)}else this._format.fromHexString(e,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(e){return this._setValueFromHexString(e),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class Re extends Pe{constructor(e,t,n){super(e,t,n,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",e=>{e.preventDefault(),this.getValue().call(this.object),this._callOnChange()}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class ze extends Pe{constructor(e,t,n,i,o,r){super(e,t,n,"number"),this._initInput(),this.min(i),this.max(o);const a=void 0!==r;this.step(a?r:this._getImplicitStep(),a),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,t=!0){return this._step=e,this._stepExplicit=t,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let t=(e-this._min)/(this._max-this._min);t=Math.max(0,Math.min(t,1)),this.$fill.style.width=100*t+"%"}return this._inputFocused||(this.$input.value=void 0===this._decimals?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),window.matchMedia("(pointer: coarse)").matches&&(this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any")),this.$widget.appendChild(this.$input),this.$disable=this.$input;const e=e=>{const t=parseFloat(this.$input.value);isNaN(t)||(this._snapClampSetValue(t+e),this.$input.value=this.getValue())};let t,n,i,o,r,a=!1;const s=e=>{if(a){const i=e.clientX-t,o=e.clientY-n;Math.abs(o)>5?(e.preventDefault(),this.$input.blur(),a=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(i)>5&&l()}if(!a){const t=e.clientY-i;r-=t*this._step*this._arrowKeyMultiplier(e),o+r>this._max?r=this._max-o:o+r<this._min&&(r=this._min-o),this._snapClampSetValue(o+r)}i=e.clientY},l=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",l)};this.$input.addEventListener("input",()=>{let e=parseFloat(this.$input.value);isNaN(e)||(this._stepExplicit&&(e=this._snap(e)),this.setValue(this._clamp(e)))}),this.$input.addEventListener("keydown",t=>{"Enter"===t.key&&this.$input.blur(),"ArrowUp"===t.code&&(t.preventDefault(),e(this._step*this._arrowKeyMultiplier(t))),"ArrowDown"===t.code&&(t.preventDefault(),e(this._step*this._arrowKeyMultiplier(t)*-1))}),this.$input.addEventListener("wheel",t=>{this._inputFocused&&(t.preventDefault(),e(this._step*this._normalizeMouseWheel(t)))},{passive:!1}),this.$input.addEventListener("mousedown",e=>{t=e.clientX,n=i=e.clientY,a=!0,o=this.getValue(),r=0,window.addEventListener("mousemove",s),window.addEventListener("mouseup",l)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=e=>{const t=this.$slider.getBoundingClientRect();let n=(i=e,o=t.left,r=t.right,a=this._min,(i-o)/(r-o)*(this._max-a)+a);var i,o,r,a;this._snapClampSetValue(n)},t=t=>{e(t.clientX)},n=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)};let i,o,r=!1;const a=t=>{t.preventDefault(),this._setDraggingStyle(!0),e(t.touches[0].clientX),r=!1},s=t=>{if(r){const e=t.touches[0].clientX-i,n=t.touches[0].clientY-o;Math.abs(e)>Math.abs(n)?a(t):(window.removeEventListener("touchmove",s),window.removeEventListener("touchend",l))}else t.preventDefault(),e(t.touches[0].clientX)},l=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",s),window.removeEventListener("touchend",l)},c=this._callOnFinishChange.bind(this);let d;this.$slider.addEventListener("mousedown",i=>{this._setDraggingStyle(!0),e(i.clientX),window.addEventListener("mousemove",t),window.addEventListener("mouseup",n)}),this.$slider.addEventListener("touchstart",e=>{e.touches.length>1||(this._hasScrollBar?(i=e.touches[0].clientX,o=e.touches[0].clientY,r=!0):a(e),window.addEventListener("touchmove",s,{passive:!1}),window.addEventListener("touchend",l))},{passive:!1}),this.$slider.addEventListener("wheel",e=>{if(Math.abs(e.deltaX)<Math.abs(e.deltaY)&&this._hasScrollBar)return;e.preventDefault();const t=this._normalizeMouseWheel(e)*this._step;this._snapClampSetValue(this.getValue()+t),this.$input.value=this.getValue(),clearTimeout(d),d=setTimeout(c,400)},{passive:!1})}_setDraggingStyle(e,t="horizontal"){this.$slider&&this.$slider.classList.toggle("active",e),document.body.classList.toggle("lil-gui-dragging",e),document.body.classList.toggle("lil-gui-"+t,e)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(e){let{deltaX:t,deltaY:n}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(t=0,n=-e.wheelDelta/120,n*=this._stepExplicit?1:10),t+-n}_arrowKeyMultiplier(e){let t=this._stepExplicit?1:10;return e.shiftKey?t*=10:e.altKey&&(t/=10),t}_snap(e){const t=Math.round(e/this._step)*this._step;return parseFloat(t.toPrecision(15))}_clamp(e){return e<this._min&&(e=this._min),e>this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return void 0!==this._min}get _hasMax(){return void 0!==this._max}}class Be extends Pe{constructor(e,t,n,i){super(e,t,n,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.options(i)}options(e){return this._values=Array.isArray(e)?e:Object.values(e),this._names=Array.isArray(e)?e:Object.keys(e),this.$select.replaceChildren(),this._names.forEach(e=>{const t=document.createElement("option");t.textContent=e,this.$select.appendChild(t)}),this.updateDisplay(),this}updateDisplay(){const e=this.getValue(),t=this._values.indexOf(e);return this.$select.selectedIndex=t,this.$display.textContent=-1===t?e:this._names[t],this}}class Ue extends Pe{constructor(e,t,n){super(e,t,n,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("spellcheck","false"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",e=>{"Enter"===e.code&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let Ge=!1;class He{constructor({parent:e,autoPlace:t=void 0===e,container:n,width:i,title:o="Controls",closeFolders:r=!1,injectStyles:a=!0,touchStyles:s=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",e=>{"Enter"!==e.code&&"Space"!==e.code||(e.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(o),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),s&&this.domElement.classList.add("allow-touch-styles"),!Ge&&a&&(function(){const e=document.createElement("style");e.innerHTML='.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--title-height:calc(var(--widget-height) + var(--spacing)*1.25);--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{background:var(--background-color);display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles,.lil-gui.force-touch-styles .lil-gui{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui button,.lil-gui input,.lil-gui label{-webkit-tap-highlight-color:transparent}.lil-gui input{background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{-moz-appearance:textfield;padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input[type=checkbox]{appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{background:var(--widget-color);border:none;border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);outline:none;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles,.lil-gui.allow-touch-styles .lil-gui{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.number .slider:hover,.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color)}.lil-gui button:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}}';const t=document.querySelector("head link[rel=stylesheet], head style");t?document.head.insertBefore(e,t):document.head.appendChild(e)}(),Ge=!0),n?n.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),i&&this.domElement.style.setProperty("--width",i+"px"),this._closeFolders=r}add(e,t,n,i,o){if(Object(n)===n)return new Be(this,e,t,n);const r=e[t];switch(typeof r){case"number":return new ze(this,e,t,n,i,o);case"boolean":return new xe(this,e,t);case"string":return new Ue(this,e,t);case"function":return new Re(this,e,t)}console.error("gui.add failed\n\tproperty:",t,"\n\tobject:",e,"\n\tvalue:",r)}addColor(e,t,n=1){return new De(this,e,t,n)}addFolder(e){const t=new He({parent:this,title:e});return this.root._closeFolders&&t.close(),t}load(e,t=!0){return e.controllers&&this.controllers.forEach(t=>{t instanceof Re||t._name in e.controllers&&t.load(e.controllers[t._name])}),t&&e.folders&&this.folders.forEach(t=>{t._title in e.folders&&t.load(e.folders[t._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(e=>{if(!(e instanceof Re)){if(e._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${e._name}"`);t.controllers[e._name]=e.save()}}),e&&this.folders.forEach(e=>{if(e._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${e._title}"`);t.folders[e._title]=e.save()}),t}open(e=!0){return this._setClosed(!e),this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}_setClosed(e){this._closed!==e&&(this._closed=e,this._callOnOpenClose(this))}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._setClosed(!e),this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const n=e=>{e.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",n))};this.$children.addEventListener("transitionend",n);const i=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=i+"px"})}),this}title(e){return this._title=e,this.$title.textContent=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(e=>e.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),void 0!==this._onChange&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),void 0!==this._onFinishChange&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onOpenClose(e){return this._onOpenClose=e,this}_callOnOpenClose(e){this.parent&&this.parent._callOnOpenClose(e),void 0!==this._onOpenClose&&this._onOpenClose.call(this,e)}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}let Ve={models:[{name:"Astronaut_mesh",url:"https://raw.githubusercontent.com/IIIF/3d/main/assets/astronaut/astronaut.glb",position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1}}],camera:{position:{x:0,y:5,z:10},target:{x:0,y:0,z:0}},scene:{background:"radial-gradient(circle, #ffffff 0%, #999999 100%)",lights:[{type:"directional",color:"0xffffff",intensity:1,position:{x:0,y:100,z:100},target:{x:0,y:0,z:0}},{type:"ambient",color:"0x404040",intensity:1},{type:"point",color:"0xffffff",intensity:1,position:{x:2,y:3,z:4}}]}};var $e,We,Xe=function(){function e(e){this.__jsonld=e,this.context=this.getProperty("context"),this.id=this.getProperty("id")}return e.prototype.getProperty=function(e){var t=null;return this.__jsonld&&((t=this.__jsonld[e])||(t=this.__jsonld["@"+e])),t},e.prototype.getPropertyAsObject=function(e){var t=this.getProperty(e);return"string"==typeof t?{id:t,isIRI:!0}:t===Object(t)?t:null},e}(),Ke=($e=function(e,t){return $e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},$e(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}$e(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Ye=function(e){function t(t){var n=e.call(this,t)||this;return n.isTransform=!0,n.isTransform=!0,n}return Ke(t,e),t}(Xe),Ze={};function qe(){return We||(We=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.ViewingHint=Ze.ViewingDirection=Ze.ServiceType=Ze.ServiceProfile=Ze.RenderingFormat=Ze.MediaType=Ze.IIIFResourceType=Ze.ExternalResourceType=Ze.Behavior=Ze.AnnotationMotivation=void 0,function(e){e.BOOKMARKING="oa:bookmarking",e.CLASSIFYING="oa:classifying",e.COMMENTING="oa:commenting",e.DESCRIBING="oa:describing",e.EDITING="oa:editing",e.HIGHLIGHTING="oa:highlighting",e.IDENTIFYING="oa:identifying",e.LINKING="oa:linking",e.MODERATING="oa:moderating",e.PAINTING="sc:painting",e.QUESTIONING="oa:questioning",e.REPLYING="oa:replying",e.TAGGING="oa:tagging",e.TRANSCRIBING="oad:transcribing"}(e||(Ze.AnnotationMotivation=e={})),function(e){e.AUTO_ADVANCE="auto-advance",e.CONTINUOUS="continuous",e.FACING_PAGES="facing-pages",e.HIDDEN="hidden",e.INDIVIDUALS="individuals",e.MULTI_PART="multi-part",e.NO_NAV="no-nav",e.NON_PAGED="non-paged",e.PAGED="paged",e.REPEAT="repeat",e.SEQUENCE="sequence",e.THUMBNAIL_NAV="thumbnail-nav",e.TOGETHER="together",e.UNORDERED="unordered"}(t||(Ze.Behavior=t={})),function(e){e.CANVAS="canvas",e.CHOICE="choice",e.OA_CHOICE="oa:choice",e.CONTENT_AS_TEXT="contentastext",e.DATASET="dataset",e.DOCUMENT="document",e.IMAGE="image",e.MODEL="model",e.MOVING_IMAGE="movingimage",e.PDF="pdf",e.PHYSICAL_OBJECT="physicalobject",e.SOUND="sound",e.TEXT="text",e.TEXTUALBODY="textualbody",e.VIDEO="video"}(n||(Ze.ExternalResourceType=n={})),function(e){e.ANNOTATION="annotation",e.ANNOTATION_COLLECTION="annotationcollection",e.ANNOTATION_PAGE="annotationpage",e.CANVAS="canvas",e.COLLECTION="collection",e.MANIFEST="manifest",e.RANGE="range",e.SEQUENCE="sequence"}(i||(Ze.IIIFResourceType=i={})),function(e){e.APNG="image/apng",e.AUDIO_MP4="audio/mp4",e.AUDIO_OGG="audio/ogg",e.AVIF="audio/avif",e.CORTO="application/corto",e.DICOM="application/dicom",e.DRACO="application/draco",e.EPUB="application/epub+zip",e.GIF="image/gif",e.GIRDER="image/vnd.kitware.girder",e.GLB="model/gltf-binary",e.GLTF="model/gltf+json",e.IIIF_PRESENTATION_2='application/ld+json;profile="http://iiif.io/api/presentation/2/context.json"',e.IIIF_PRESENTATION_3='application/ld+json;profile="http://iiif.io/api/presentation/3/context.json"',e.JPG="image/jpeg",e.M3U8="application/vnd.apple.mpegurl",e.MP3="audio/mp3",e.MPEG="audio/mpeg",e.MPEG_DASH="application/dash+xml",e.OBJ="model/obj",e.OPF="application/oebps-package+xml",e.PDF="application/pdf",e.PLY="application/ply",e.PNG="image/png",e.SVG="image/svg+xml",e.THREEJS="application/vnd.threejs+json",e.USDZ="model/vnd.usd+zip",e.VIDEO_MP4="video/mp4",e.VIDEO_OGG="video/ogg",e.WAV="audio/wav",e.WEBM="video/webm",e.WEBP="image/webp"}(o||(Ze.MediaType=o={})),function(e){e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.ODT="application/vnd.oasis.opendocument.text",e.PDF="application/pdf"}(r||(Ze.RenderingFormat=r={})),function(e){e.IMAGE_0_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/compliance.html#level0",e.IMAGE_0_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/compliance.html#level1",e.IMAGE_0_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/compliance.html#level2",e.IMAGE_0_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/conformance.html#level0",e.IMAGE_0_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/conformance.html#level1",e.IMAGE_0_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/conformance.html#level2",e.IMAGE_1_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",e.IMAGE_1_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",e.IMAGE_1_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",e.IMAGE_1_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",e.IMAGE_1_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",e.IMAGE_1_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",e.IMAGE_1_LEVEL_0="http://iiif.io/api/image/1/level0.json",e.IMAGE_1_PROFILE_LEVEL_0="http://iiif.io/api/image/1/profiles/level0.json",e.IMAGE_1_LEVEL_1="http://iiif.io/api/image/1/level1.json",e.IMAGE_1_PROFILE_LEVEL_1="http://iiif.io/api/image/1/profiles/level1.json",e.IMAGE_1_LEVEL_2="http://iiif.io/api/image/1/level2.json",e.IMAGE_1_PROFILE_LEVEL_2="http://iiif.io/api/image/1/profiles/level2.json",e.IMAGE_2_LEVEL_0="http://iiif.io/api/image/2/level0.json",e.IMAGE_2_PROFILE_LEVEL_0="http://iiif.io/api/image/2/profiles/level0.json",e.IMAGE_2_LEVEL_1="http://iiif.io/api/image/2/level1.json",e.IMAGE_2_PROFILE_LEVEL_1="http://iiif.io/api/image/2/profiles/level1.json",e.IMAGE_2_LEVEL_2="http://iiif.io/api/image/2/level2.json",e.IMAGE_2_PROFILE_LEVEL_2="http://iiif.io/api/image/2/profiles/level2.json",e.AUTH_0_CLICK_THROUGH="http://iiif.io/api/auth/0/login/clickthrough",e.AUTH_0_LOGIN="http://iiif.io/api/auth/0/login",e.AUTH_0_LOGOUT="http://iiif.io/api/auth/0/logout",e.AUTH_0_RESTRICTED="http://iiif.io/api/auth/0/login/restricted",e.AUTH_0_TOKEN="http://iiif.io/api/auth/0/token",e.AUTH_1_CLICK_THROUGH="http://iiif.io/api/auth/1/clickthrough",e.AUTH_1_EXTERNAL="http://iiif.io/api/auth/1/external",e.AUTH_1_KIOSK="http://iiif.io/api/auth/1/kiosk",e.AUTH_1_LOGIN="http://iiif.io/api/auth/1/login",e.AUTH_1_LOGOUT="http://iiif.io/api/auth/1/logout",e.AUTH_1_PROBE="http://iiif.io/api/auth/1/probe",e.AUTH_1_TOKEN="http://iiif.io/api/auth/1/token",e.SEARCH_0="http://iiif.io/api/search/0/search",e.SEARCH_0_AUTO_COMPLETE="http://iiif.io/api/search/0/autocomplete",e.SEARCH_1="http://iiif.io/api/search/1/search",e.SEARCH_1_AUTO_COMPLETE="http://iiif.io/api/search/1/autocomplete",e.SEARCH_2="http://iiif.io/api/search/2/search",e.SEARCH_2_AUTO_COMPLETE="http://iiif.io/api/search/2/autocomplete",e.TRACKING_EXTENSIONS="http://universalviewer.io/tracking-extensions-profile",e.UI_EXTENSIONS="http://universalviewer.io/ui-extensions-profile",e.PRINT_EXTENSIONS="http://universalviewer.io/print-extensions-profile",e.SHARE_EXTENSIONS="http://universalviewer.io/share-extensions-profile",e.DOWNLOAD_EXTENSIONS="http://universalviewer.io/download-extensions-profile",e.OTHER_MANIFESTATIONS="http://iiif.io/api/otherManifestations.json",e.IXIF="http://wellcomelibrary.org/ld/ixif/0/alpha.json"}(a||(Ze.ServiceProfile=a={})),function(e){e.IMAGE_SERVICE_2="ImageService2",e.IMAGE_SERVICE_3="ImageService3",e.SEARCH_SERVICE_2="SearchService2",e.AUTO_COMPLETE_SERVICE_2="AutoCompleteService2"}(s||(Ze.ServiceType=s={})),function(e){e.BOTTOM_TO_TOP="bottom-to-top",e.LEFT_TO_RIGHT="left-to-right",e.RIGHT_TO_LEFT="right-to-left",e.TOP_TO_BOTTOM="top-to-bottom"}(l||(Ze.ViewingDirection=l={})),function(e){e.CONTINUOUS="continuous",e.INDIVIDUALS="individuals",e.NON_PAGED="non-paged",e.PAGED="paged",e.TOP="top"}(c||(Ze.ViewingHint=c={}))),Ze;var e,t,n,i,o,r,a,s,l,c}var Je,Qe,et,tt,nt,it,ot,rt,at,st,lt,ct,dt,ut,pt,ht,gt,mt,ft,bt,yt,vt,wt,Et,Ct,Mt,St,It,At=qe(),Lt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ot=function(e){function t(t,n){var i=e.call(this,t)||this;return i.options=n,i}return Lt(t,e),t.prototype.getIIIFResourceType=function(){return Tn.normaliseType(this.getProperty("type"))},t.prototype.getLabel=function(){var e=this.getProperty("label");return e?jn.parse(e,this.options.locale):new jn([],this.options.locale)},t.prototype.getSummary=function(){var e=this.getProperty("summary");return e?jn.parse(e,this.options.locale):new jn([],this.options.locale)},t.prototype.getDefaultLabel=function(){return this.getLabel().getValue(this.options.locale)},t.prototype.getMetadata=function(){var e=this.getProperty("metadata"),t=[];if(!e)return t;for(var n=0;n<e.length;n++){var i=e[n],o=new In(this.options.locale);o.parse(i),t.push(o)}return t},t.prototype.getRendering=function(e){for(var t=this.getRenderings(),n=0;n<t.length;n++){var i=t[n];if(i.getFormat()===e)return i}return null},t.prototype.getRenderings=function(){var e,t=[];if(!(e=this.__jsonld?this.__jsonld.rendering:this.rendering))return t;Array.isArray(e)||(e=[e]);for(var n=0;n<e.length;n++){var i=e[n];t.push(new Vn(i,this.options))}return t},t.prototype.getRequiredStatement=function(){var e=null,t=this.getProperty("requiredStatement");return t&&(e=new In(this.options.locale)).parse(t),e},t.prototype.getService=function(e){return Tn.getService(this,e)},t.prototype.getServices=function(){return Tn.getServices(this)},t.prototype.getThumbnail=function(){var e=this.getProperty("thumbnail");return Array.isArray(e)&&(e=e[0]),e?new ni(e,this.options):null},t.prototype.isAnnotation=function(){return this.getIIIFResourceType()===At.IIIFResourceType.ANNOTATION},t.prototype.isCanvas=function(){return this.getIIIFResourceType()===At.IIIFResourceType.CANVAS},t.prototype.isCollection=function(){return this.getIIIFResourceType()===At.IIIFResourceType.COLLECTION},t.prototype.isManifest=function(){return this.getIIIFResourceType()===At.IIIFResourceType.MANIFEST},t.prototype.isRange=function(){return this.getIIIFResourceType()===At.IIIFResourceType.RANGE},t.prototype.isScene=function(){return this.getIIIFResourceType()===Tn.normaliseType("Scene")},t.prototype.isSequence=function(){return this.getIIIFResourceType()===At.IIIFResourceType.SEQUENCE},t}(Xe),_t=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Pt=function(e){function t(t,n){return e.call(this,t,n)||this}return _t(t,e),t.prototype.getFormat=function(){var e=this.getProperty("format");return e?e.toLowerCase():null},t.prototype.getResources=function(){var e=[];if(!this.__jsonld.resources)return e;for(var t=0;t<this.__jsonld.resources.length;t++){var n=this.__jsonld.resources[t],i=new Kt(n,this.options);e.push(i)}return e},t.prototype.getType=function(){var e=this.getProperty("type");return e?Tn.normaliseType(e):null},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t.prototype.getMaxWidth=function(){return this.getProperty("maxWidth")},t.prototype.getMaxHeight=function(){return this.getProperty("maxHeight")?null:this.getMaxWidth()},t}(Ot),xt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Tt=function(e){function t(t,n){var i=e.call(this,t,n)||this;i.index=-1,i.isLoaded=!1;var o={defaultLabel:"-",locale:"en-GB",resource:i,pessimisticAccessControl:!1};return i.options=Object.assign(o,n),i}return xt(t,e),t.prototype.getAttribution=function(){var e=this.getProperty("attribution");return e?jn.parse(e,this.options.locale):new jn([],this.options.locale)},t.prototype.getDescription=function(){var e=this.getProperty("description");return e?jn.parse(e,this.options.locale):new jn([],this.options.locale)},t.prototype.getHomepage=function(){var e=this.getProperty("homepage");return e?"string"==typeof e?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||e.id):null},t.prototype.getIIIFResourceType=function(){return Tn.normaliseType(this.getProperty("type"))},t.prototype.getLogo=function(){var e=this.getProperty("logo");if(!e){var t=this.getProperty("provider");if(!t)return null;var n=t.find(function(e){return void 0!==e.logo});e=n&&void 0!==n.logo?n.logo:null}return e?"string"==typeof e?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||(null==e?void 0:e.id)):null},t.prototype.getLicense=function(){return Tn.getLocalisedValue(this.getProperty("license"),this.options.locale)},t.prototype.getRights=function(){var e=this.getProperty("rights");return e?"string"==typeof e?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||e.id):null},t.prototype.getNavDate=function(){return new Date(this.getProperty("navDate"))},t.prototype.getRelated=function(){return this.getProperty("related")},t.prototype.getSeeAlso=function(){return this.getProperty("seeAlso")},t.prototype.getTrackingLabel=function(){var e=this.getService(At.ServiceProfile.TRACKING_EXTENSIONS);return e?e.getProperty("trackingLabel"):""},t.prototype.getDefaultTree=function(){return this.defaultTree=new ai("root"),this.defaultTree.data=this,this.defaultTree},t.prototype.getRequiredStatement=function(){var e=null,t=this.getProperty("requiredStatement");if(t)(e=new In(this.options.locale)).parse(t);else{var n=this.getAttribution();n&&n.length&&((e=new In(this.options.locale)).value=n)}return e},t.prototype.isCollection=function(){return this.getIIIFResourceType()===At.IIIFResourceType.COLLECTION},t.prototype.isManifest=function(){return this.getIIIFResourceType()===At.IIIFResourceType.MANIFEST},t.prototype.load=function(){var e=this;return new Promise(function(t){if(e.isLoaded)t(e);else{var n=e.options;n.navDate=e.getNavDate();var i=e.__jsonld.id;i||(i=e.__jsonld["@id"]),Tn.loadManifest(i).then(function(i){e.parentLabel=e.getLabel().getValue(n.locale);var o=Yn.parse(i,n);(e=Object.assign(e,o)).index=n.index,t(e)})}})},t}(Ot),kt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ft=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.isAnnotationBody=!1,i.isSpecificResource=!0,i.isSpecificResource=!0,i}return kt(t,e),t.prototype.getScope=function(){var e=this.getPropertyAsObject("scope");if(null==e?void 0:e.isIRI)return e;if(e){var t=[].concat(e)[0];if(t&&"Annotation"===t.type)return new Kt(t,this.options)}return null},t.prototype.getSource=function(){var e=this.getPropertyAsObject("source");if(e.isIRI)return e;if(e){var t=[].concat(e)[0];if(["Scene","Canvas"].includes(t.type))return t}if(e){var n=[].concat(e)[0];if(n)return Wt.BuildFromJson(n,this.options)}throw new Error("cannot resolve Source "+JSON.stringify(e))},Object.defineProperty(t.prototype,"Source",{get:function(){return this.getSource()},enumerable:!1,configurable:!0}),t.prototype.getSelector=function(){var e=this.getProperty("selector");if(e){var t=[].concat(e)[0];if(t&&"PointSelector"===t.type)return new Bn(t);throw new Error("unable to resolve SpecificResource selector "+JSON.stringify(this.__jsonld))}return null},Object.defineProperty(t.prototype,"Selector",{get:function(){return this.getSelector()},enumerable:!1,configurable:!0}),t.prototype.getTransform=function(){for(var e=[],t=this.getProperty("transform"),n=0;n<t.length;++n){var i=t[n];e.push(ri.BuildFromJson(i))}return e},Object.defineProperty(t.prototype,"Transform",{get:function(){return this.getTransform()},enumerable:!1,configurable:!0}),t}(Ot),jt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Nt=function(e){function t(t,n){return e.call(this,t,n)||this}return jt(t,e),t.prototype.getResourceID=function(){if(this.isSpecificResource()){var e=this.getSource();return e instanceof t?e.id:e||this.id}return this.id},t.prototype.getFormat=function(){var e=this.getPropertyFromSelfOrSource("format");return e?Tn.getMediaType(e):null},t.prototype.getType=function(){var e=this.getPropertyFromSelfOrSource("type");return e?Tn.normaliseType(e):null},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t.prototype.getTransform=function(){return this.getProperty("transform")?this.getProperty("transform").map(function(e){return ri.BuildFromJson(e)}):null},t.prototype.getTransformMatrix=function(){var e=this.getTransform();return e&&e.length?function(e){for(var t=new i,n=0,o=e;n<o.length;n++){var r=o[n],a=new i;if(r.isTranslateTransform){var s=r.getTranslation();a.makeTranslation(s.x,s.y,s.z)}else if(r.isRotateTransform){var l=Ii(r);a.makeRotationFromEuler(l)}else if(r.isScaleTransform){var c=r.getScale();a.makeScale(c.x,c.y,c.z)}t.premultiply(a)}return t}(e):null},t.prototype.getTransformSet=function(){var e=this.getTransform();return e&&e.length?function(e){for(var t=new n,i=new r,a=new n(1,1,1),s=0,l=e;s<l.length;s++){var c=l[s];if(c.isTranslateTransform){var d=c.getTranslation();t.add(new n(d.x,d.y,d.z))}else if(c.isRotateTransform){var u=Ii(c),p=(new o).setFromEuler(i),h=(new o).setFromEuler(u);p.premultiply(h),i.setFromQuaternion(p,"XYZ"),t.applyEuler(u)}else if(c.isScaleTransform){var g=c.getScale(),m=new n(g.x,g.y,g.z);a.multiply(m),t.multiply(m)}}return{translation:t,rotation:i,scale:a}}(e):null},t.prototype.getPropertyFromSelfOrSource=function(e){return this.isSpecificResource()&&this.getSource()instanceof t?this.getSource().getProperty(e):this.getProperty(e)},t.prototype.getLabelFromSelfOrSource=function(){return this.isSpecificResource()&&this.getSource()instanceof t?this.getSource().getLabel():this.getLabel()},t.prototype.getSource=function(){var e=[].concat(this.getPropertyAsObject("source"))[0];return e?!0===e.isIRI?e.id:Wt.BuildFromJson(e,this.options):null},t.prototype.isModel=function(){return this.getType()===At.ExternalResourceType.MODEL},t.prototype.isSound=function(){return this.getType()===At.ExternalResourceType.SOUND},t.prototype.isSoundCaption=function(){return this.getType()===At.ExternalResourceType.TEXT&&"text/vtt"===this.getProperty("format").toLowerCase()},t.prototype.isSpecificResource=function(){return"SpecificResource"===this.getProperty("type")},t}(Ot),Dt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Rt=function(e){function t(t,n){return e.call(this,t,n)||this}return Dt(t,e),t.prototype.getColor=function(){var e=this.getPropertyFromSelfOrSource("color");return e?Si.fromCSS(e):new Si([255,255,255])},Object.defineProperty(t.prototype,"Color",{get:function(){return this.getColor()},enumerable:!1,configurable:!0}),t.prototype.getIntensity=function(){var e=this.getPropertyFromSelfOrSource("intensity");if(!e)return 1;try{if("Value"!==e.type||"relative"!==e.unit)throw new Error;return e.value}catch(t){throw new Error("unable to interpret raw intensity object "+JSON.stringify(e))}},Object.defineProperty(t.prototype,"Intensity",{get:function(){return this.getIntensity()},enumerable:!1,configurable:!0}),t.prototype.getAngle=function(){return this.isSpotLight()?Number(this.getPropertyFromSelfOrSource("angle")):void 0},Object.defineProperty(t.prototype,"Angle",{get:function(){return this.getAngle()},enumerable:!1,configurable:!0}),t.prototype.getLookAt=function(){var e,t,n=null!==(e=this.getPropertyAsObject("lookAt"))&&void 0!==e?e:null;if(null==n)return null;var i=null!==(t=n.type||n["@type"])&&void 0!==t?t:null;if(null==i)return null;if("Annotation"==i)return n;if("PointSelector"==i)return new Bn(n);throw new Error("unidentified value of lookAt ".concat(i))},Object.defineProperty(t.prototype,"LookAt",{get:function(){return this.getLookAt()},enumerable:!1,configurable:!0}),t.prototype.isAmbientLight=function(){return"ambientlight"===Tn.normaliseType(this.getType()||"")},t.prototype.isDirectionalLight=function(){return"directionallight"===Tn.normaliseType(this.getType()||"")},t.prototype.isPointLight=function(){return"pointlight"===Tn.normaliseType(this.getType()||"")},t.prototype.isSpotLight=function(){return"spotlight"===Tn.normaliseType(this.getType()||"")},t}(Nt),zt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Bt=function(e){function t(t,n){return e.call(this,t,n)||this}return zt(t,e),t.prototype.getFieldOfView=function(){if(this.isPerspectiveCamera()){var e=this.getPropertyFromSelfOrSource("fieldOfView");return e?e>0&&e<180?e:void console.warn("Camera fieldOfView out of range and will be considered undefined."):void 0}},Object.defineProperty(t.prototype,"FieldOfView",{get:function(){return this.getFieldOfView()},enumerable:!1,configurable:!0}),t.prototype.getViewHeight=function(){if(this.isOrthographicCamera()){var e=this.getProperty("viewHeight");return e||void 0}},Object.defineProperty(t.prototype,"ViewHeight",{get:function(){return this.getViewHeight()},enumerable:!1,configurable:!0}),t.prototype.getLookAt=function(){var e,t,n=null!==(e=this.getPropertyAsObject("lookAt"))&&void 0!==e?e:null;if(null==n)return null;var i=null!==(t=n.type||n["@type"])&&void 0!==t?t:null;return null==i?null:"Annotation"==i?n:"PointSelector"==i?new Bn(n):"SpecificResource"==i?new Ft(n,this.options):(console.error("unidentified value of lookAt ".concat(i)),null)},Object.defineProperty(t.prototype,"LookAt",{get:function(){return this.getLookAt()},enumerable:!1,configurable:!0}),t.prototype.getNear=function(){var e=this.getPropertyFromSelfOrSource("near");return e||void 0},Object.defineProperty(t.prototype,"Near",{get:function(){return this.getNear()},enumerable:!1,configurable:!0}),t.prototype.getFar=function(){var e=this.getPropertyFromSelfOrSource("far");return e||void 0},Object.defineProperty(t.prototype,"Far",{get:function(){return this.getFar()},enumerable:!1,configurable:!0}),t.prototype.isPerspectiveCamera=function(){return"perspectivecamera"===Tn.normaliseType(this.getType()||"")},t.prototype.isOrthographicCamera=function(){return"orthographiccamera"===Tn.normaliseType(this.getType()||"")},t}(Nt),Ut=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Gt=function(e){function t(t,n){return e.call(this,t,n)||this}return Ut(t,e),Object.defineProperty(t.prototype,"Value",{get:function(){return this.getProperty("value")||""},enumerable:!1,configurable:!0}),t.prototype.getPosition=function(){var e,t=null!==(e=this.getPropertyAsObject("position"))&&void 0!==e?e:null;if(null==t)return null;if(t.type&&"SpecificResource"==t.type)return new Ft(t,this.options);throw new Error("unknown position type specified")},Object.defineProperty(t.prototype,"Position",{get:function(){return this.getPosition()},enumerable:!1,configurable:!0}),t}(Nt),Ht=["AmbientLight","DirectionalLight","PointLight","SpotLight"],Vt=["PerspectiveCamera","OrthographicCamera"],$t=["Image","Document","Audio","Model","Video","Canvas","Sound","Text"],Wt=function(){function e(){}return e.BuildFromJson=function(e,t){var n="SpecificResource"===e.type&&e.source?[].concat(e.source)[0].type:e.type;if($t.includes(n))return new Nt(e,t);if(Ht.includes(n))return new Rt(e,t);if(Vt.includes(n))return new Bt(e,t);if("TextualBody"===n)return new Gt(e,t);throw new Error("unimplemented type for AnnotationBody: "+n)},e}(),Xt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Kt=function(e){function t(t,n){return e.call(this,t,n)||this}return Xt(t,e),t.prototype.getBody=function(){var e=[],t=this.getProperty("bodyValue");if(t)return[new Gt({id:"https://example.com/TextualBody/1",value:t,type:"TextualBody"},this.options)];var n=this.getProperty("body");if(n)for(var i=0,o=[].concat(n);i<o.length;i++){var r=o[i],a=r.items;a?e=e.concat(this.parseBodiesFromItemsList(a)):e.push(this.parseSingletonBody(r))}return e},Object.defineProperty(t.prototype,"Body",{get:function(){return this.getBody()},enumerable:!1,configurable:!0}),t.prototype.parseBodiesFromItemsList=function(e){for(var t=[],n=0,i=[].concat(e);n<i.length;n++){var o=i[n];t.push(this.parseSingletonBody(o))}return t},t.prototype.parseSingletonBody=function(e){return Wt.BuildFromJson(e,this.options)},t.prototype.getBody3D=function(){return console.warn("Annotation.getBody3D is deprecated: replace with getBody3D() with getBody()[0]"),this.getBody()[0]},t.prototype.getMotivation=function(){var e=this.getProperty("motivation");return e||null},t.prototype.getOn=function(){return this.getProperty("on")},t.prototype.getTarget=function(){var e=this.getPropertyAsObject("target");if(e.isIRI)return e;if(e.type&&"SpecificResource"==e.type)return new Ft(e,this.options);if(["Scene","Canvas"].includes(e.type))return e;throw new Error("unknown target specified")},Object.defineProperty(t.prototype,"Target",{get:function(){return this.getTarget()},enumerable:!1,configurable:!0}),t.prototype.getScopeContent=function(){var e,n,i,o=this,r=null===(i=null===(n=null===(e=this.getTarget())||void 0===e?void 0:e.getScope())||void 0===n?void 0:n.getTarget())||void 0===i?void 0:i.items;return r?r.filter(function(e){return e&&"AnnotationPage"===e.type}).map(function(e){return new Jt(e,o.options).getItems()}).flat().filter(function(e){return e&&"Annotation"===e.type}).map(function(e){return new t(e,o.options)}):[]},Object.defineProperty(t.prototype,"ScopeContent",{get:function(){return this.getScopeContent()},enumerable:!1,configurable:!0}),t.prototype.getResource=function(){return new Pt(this.getProperty("resource"),this.options)},Object.defineProperty(t.prototype,"LookAtLocation",{get:function(){var e,t=this.getTarget();return t.isSpecificResource&&(null===(e=t.getSelector())||void 0===e?void 0:e.isPointSelector)?t.getSelector().getLocation():new n(0,0,0)},enumerable:!1,configurable:!0}),t}(Ot),Yt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Zt=function(e){function t(t,n,i){var o=e.call(this,n)||this;return o.label=t,o.options=i,o}return Yt(t,e),t.prototype.getIIIFResourceType=function(){return Tn.normaliseType(this.getProperty("type"))},t.prototype.getLabel=function(){return this.label},t.prototype.getResources=function(){var e=this;return this.getProperty("resources").map(function(t){return new Kt(t,e.options)})},t.prototype.load=function(){var e=this;return new Promise(function(t,n){if(e.isLoaded)t(e);else{var i=e.__jsonld.id;i||(i=e.__jsonld["@id"]),Tn.loadManifest(i).then(function(n){e.__jsonld=n,e.context=e.getProperty("context"),e.id=e.getProperty("id"),e.isLoaded=!0,t(e)}).catch(n)}})},t}(Xe),qt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Jt=function(e){function t(t,n){return e.call(this,t,n)||this}return qt(t,e),t.prototype.getItems=function(){return this.getProperty("items")},t}(Ot);function Qt(){if(Qe)return Je;return Qe=1,Je=function(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}}function en(){if(tt)return et;tt=1;var e="object"==typeof Se&&Se&&Se.Object===Object&&Se;return et=e}function tn(){if(it)return nt;it=1;var e=en(),t="object"==typeof self&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return nt=n}function nn(){if(rt)return ot;rt=1;var e=tn().Symbol;return ot=e}function on(){if(st)return at;st=1;var e=nn(),t=Object.prototype,n=t.hasOwnProperty,i=t.toString,o=e?e.toStringTag:void 0;return at=function(e){var t=n.call(e,o),r=e[o];try{e[o]=void 0;var a=!0}catch(e){}var s=i.call(e);return a&&(t?e[o]=r:delete e[o]),s}}function rn(){if(ct)return lt;ct=1;var e=Object.prototype.toString;return lt=function(t){return e.call(t)}}function an(){if(ut)return dt;ut=1;var e=nn(),t=on(),n=rn(),i=e?e.toStringTag:void 0;return dt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?t(e):n(e)}}function sn(){if(ht)return pt;return ht=1,pt=function(e){return null!=e&&"object"==typeof e}}function ln(){if(mt)return gt;mt=1;var e=an(),t=sn();return gt=function(n){return t(n)&&"[object Arguments]"==e(n)}}function cn(){if(bt)return ft;bt=1;var e=ln(),t=sn(),n=Object.prototype,i=n.hasOwnProperty,o=n.propertyIsEnumerable,r=e(function(){return arguments}())?e:function(e){return t(e)&&i.call(e,"callee")&&!o.call(e,"callee")};return ft=r}function dn(){if(vt)return yt;vt=1;var e=Array.isArray;return yt=e}function un(){if(Et)return wt;Et=1;var e=nn(),t=cn(),n=dn(),i=e?e.isConcatSpreadable:void 0;return wt=function(e){return n(e)||t(e)||!!(i&&e&&e[i])}}function pn(){if(Mt)return Ct;Mt=1;var e=Qt(),t=un();return Ct=function n(i,o,r,a,s){var l=-1,c=i.length;for(r||(r=t),s||(s=[]);++l<c;){var d=i[l];o>0&&r(d)?o>1?n(d,o-1,r,a,s):e(s,d):a||(s[s.length]=d)}return s},Ct}function hn(){if(It)return St;It=1;var e=pn();return St=function(t){return(null==t?0:t.length)?e(t,1):[]}}var gn,mn,fn=Ie(hn());function bn(){if(mn)return gn;mn=1;var e=pn(),t=1/0;return gn=function(n){return(null==n?0:n.length)?e(n,t):[]}}var yn,vn=Ie(bn()),wn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),En=function(e){function t(t,n){return e.call(this,t,n)||this}return wn(t,e),t.prototype.getCanonicalImageUri=function(e){var t,n=null,i="default",o=e;if(this.externalResource&&this.externalResource.data&&this.externalResource.data["@id"])n=this.externalResource.data["@id"],o||(o=this.externalResource.data.width),this.externalResource.data["@context"]&&(this.externalResource.data["@context"].indexOf("/1.0/context.json")>-1||this.externalResource.data["@context"].indexOf("/1.1/context.json")>-1||this.externalResource.data["@context"].indexOf("/1/context.json")>-1)&&(i="native");else{var r=void 0;if((r=this.getImages())&&r.length){var a=r[0].getResource(),s=a.getServices();if(o||(o=a.getWidth()),l=s?s.find(function(e){return Tn.isImageProfile(e.getProfile())||Tn.isImageServiceType(e.getIIIFResourceType())}):null)n=l.id,i=Tn.getImageQuality(l.getProfile());else if(o===a.getWidth())return a.id}if((r=this.getContent())&&r.length){var l,c=r[0].getBody()[0];s=c.getServices();if(o||(o=c.getWidth()),l=s?s.find(function(e){return Tn.isImageServiceType(e.getIIIFResourceType())}):null)n=l.id,i=Tn.getImageQuality(l.getProfile());else if(o===c.getWidth())return c.id}if(!n){var d=this.getProperty("thumbnail");if(d){if("string"==typeof d)return d;if(d["@id"])return d["@id"];if(d.length)return d[0].id}}}return t=o+",",n&&n.endsWith("/")&&(n=n.substr(0,n.length-1)),[n,"full",t,0,i+".jpg"].join("/")},t.prototype.getMaxDimensions=function(){var e,t=null;return this.externalResource&&this.externalResource.data&&this.externalResource.data.profile&&(e=this.externalResource.data.profile,Array.isArray(e)&&(e=e.filter(function(e){var t;return null!==(t=e.maxWidth)&&void 0!==t?t:e.maxwidth})[0],e&&(t=new Jn(e.maxWidth,e.maxHeight?e.maxHeight:e.maxWidth)))),t},t.prototype.getContent=function(){var e=[],t=this.__jsonld.items||this.__jsonld.content;if(!t)return e;var n=null;if(t.length&&(n=new Jt(t[0],this.options)),!n)return e;for(var i=n.getItems(),o=0;o<i.length;o++){var r=i[o],a=new Kt(r,this.options);e.push(a)}return e},t.prototype.getDuration=function(){return this.getProperty("duration")},t.prototype.getImages=function(){var e=[];if(!this.__jsonld.images)return e;for(var t=0;t<this.__jsonld.images.length;t++){var n=this.__jsonld.images[t],i=new Kt(n,this.options);e.push(i)}return e},t.prototype.getIndex=function(){return this.getProperty("index")},t.prototype.getNonContentAnnotations=function(){var e=this,t=(this.__jsonld.annotations||[]).filter(function(e){return e&&"AnnotationPage"===e.type}).map(function(t){return new Jt(t,e.options)});if(!t.length)return[];var n=t.map(function(e){return e.getItems()});return vn(n).map(function(t){return new Kt(t,e.options)})},t.prototype.getOtherContent=function(){var e=this,t=Array.isArray(this.getProperty("otherContent"))?this.getProperty("otherContent"):[this.getProperty("otherContent")],n=t.filter(function(e){return e&&("string"==typeof(t=e["@type"])&&t.toLowerCase()==t.toLowerCase());var t}).map(function(t,n){return new Zt(t.label||"Annotation list ".concat(n),t,e.options)}).map(function(e){return e.load()});return Promise.all(n)},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},Object.defineProperty(t.prototype,"imageResources",{get:function(){var e=this,n=vn([this.getImages().map(function(e){return e.getResource()}),this.getContent().map(function(e){return e.getBody()})]);return fn(n.map(function(n){switch(n.getProperty("type").toLowerCase()){case At.ExternalResourceType.CHOICE:case At.ExternalResourceType.OA_CHOICE:return new t({images:fn([n.getProperty("default"),n.getProperty("item")]).map(function(e){return{resource:e}})},e.options).getImages().map(function(e){return e.getResource()});default:return n}}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resourceAnnotations",{get:function(){return vn([this.getImages(),this.getContent()])},enumerable:!1,configurable:!0}),t.prototype.resourceAnnotation=function(e){return this.resourceAnnotations.find(function(t){return t.getResource().id===e||fn(new Array(t.getBody())).some(function(t){return t.id===e})})},t.prototype.onFragment=function(e){var t=this.resourceAnnotation(e);if(t){var n=t.getProperty("on"),i=t.getProperty("target");if(n&&i){var o=(n||i).match(/xywh=(.*)$/);if(o)return o[1].split(",").map(function(e){return parseInt(e,10)})}}},Object.defineProperty(t.prototype,"iiifImageResources",{get:function(){return this.imageResources.filter(function(e){return e&&e.getServices()[0]&&e.getServices()[0].id})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"imageServiceIds",{get:function(){return this.iiifImageResources.map(function(e){return e.getServices()[0].id})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspectRatio",{get:function(){return this.getWidth()/this.getHeight()},enumerable:!1,configurable:!0}),t}(Pt),Cn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Mn=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.items=[],i._collections=null,i._manifests=null,t.__collection=i,i}return Cn(t,e),t.prototype.getCollections=function(){return this._collections?this._collections:this._collections=this.items.filter(function(e){return e.isCollection()})},t.prototype.getManifests=function(){return this._manifests?this._manifests:this._manifests=this.items.filter(function(e){return e.isManifest()})},t.prototype.getCollectionByIndex=function(e){for(var t,n=this.getCollections(),i=0;i<n.length;i++){var o=n[i];o.index===e&&(t=o)}if(t)return t.options.index=e,t.load();throw new Error("Collection index not found")},t.prototype.getManifestByIndex=function(e){for(var t,n=this.getManifests(),i=0;i<n.length;i++){var o=n[i];o.index===e&&(t=o)}if(t)return t.options.index=e,t.load();throw new Error("Manifest index not found")},t.prototype.getTotalCollections=function(){return this.getCollections().length},t.prototype.getTotalManifests=function(){return this.getManifests().length},t.prototype.getTotalItems=function(){return this.items.length},t.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?this.getProperty("viewingDirection"):At.ViewingDirection.LEFT_TO_RIGHT},t.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},t.prototype.getDefaultTree=function(){return e.prototype.getDefaultTree.call(this),this.defaultTree.data.type=Tn.normaliseType(Qn.COLLECTION),this._parseManifests(this),this._parseCollections(this),Tn.generateTreeNodeIds(this.defaultTree),this.defaultTree},t.prototype._parseManifests=function(e){if(e.getManifests()&&e.getManifests().length)for(var t=0;t<e.getManifests().length;t++){var n=e.getManifests()[t],i=n.getDefaultTree();i.label=n.parentLabel||n.getLabel().getValue(this.options.locale)||"manifest "+(t+1),i.navDate=n.getNavDate(),i.data.id=n.id,i.data.type=Tn.normaliseType(Qn.MANIFEST),e.defaultTree.addNode(i)}},t.prototype._parseCollections=function(e){if(e.getCollections()&&e.getCollections().length)for(var t=0;t<e.getCollections().length;t++){var n=e.getCollections()[t],i=n.getDefaultTree();i.label=n.parentLabel||n.getLabel().getValue(this.options.locale)||"collection "+(t+1),i.navDate=n.getNavDate(),i.data.id=n.id,i.data.type=Tn.normaliseType(Qn.COLLECTION),e.defaultTree.addNode(i)}},t}(Tt),Sn=function(){function e(e,t){this.start=e,this.end=t}return e.prototype.getLength=function(){return this.end-this.start},e}(),In=function(){function e(e){this.defaultLocale=e}return e.prototype.parse=function(e){this.resource=e,this.label=jn.parse(this.resource.label,this.defaultLocale),this.value=jn.parse(this.resource.value,this.defaultLocale)},e.prototype.getLabel=function(e){return null===this.label?null:(Array.isArray(e)&&!e.length&&(e=void 0),this.label.getValue(e||this.defaultLocale))},e.prototype.setLabel=function(e){null===this.label&&(this.label=new jn([])),this.label.setValue(e,this.defaultLocale)},e.prototype.getValue=function(e,t){return void 0===t&&(t="<br/>"),null===this.value?null:(Array.isArray(e)&&!e.length&&(e=void 0),this.value.getValue(e||this.defaultLocale,t))},e.prototype.getValues=function(e){return null===this.value?[]:(Array.isArray(e)&&!e.length&&(e=void 0),this.value.getValues(e||this.defaultLocale))},e.prototype.setValue=function(e){null===this.value&&(this.value=new jn([])),this.value.setValue(e,this.defaultLocale)},e}(),An={};function Ln(){return yn||(yn=1,Object.defineProperty(An,"__esModule",{value:!0}),An.CONTINUE=100,An.SWITCHING_PROTOCOLS=101,An.PROCESSING=102,An.OK=200,An.CREATED=201,An.ACCEPTED=202,An.NON_AUTHORITATIVE_INFORMATION=203,An.NO_CONTENT=204,An.RESET_CONTENT=205,An.PARTIAL_CONTENT=206,An.MULTI_STATUS=207,An.MULTIPLE_CHOICES=300,An.MOVED_PERMANENTLY=301,An.MOVED_TEMPORARILY=302,An.SEE_OTHER=303,An.NOT_MODIFIED=304,An.USE_PROXY=305,An.TEMPORARY_REDIRECT=307,An.BAD_REQUEST=400,An.UNAUTHORIZED=401,An.PAYMENT_REQUIRED=402,An.FORBIDDEN=403,An.NOT_FOUND=404,An.METHOD_NOT_ALLOWED=405,An.NOT_ACCEPTABLE=406,An.PROXY_AUTHENTICATION_REQUIRED=407,An.REQUEST_TIME_OUT=408,An.CONFLICT=409,An.GONE=410,An.LENGTH_REQUIRED=411,An.PRECONDITION_FAILED=412,An.REQUEST_ENTITY_TOO_LARGE=413,An.REQUEST_URI_TOO_LARGE=414,An.UNSUPPORTED_MEDIA_TYPE=415,An.REQUESTED_RANGE_NOT_SATISFIABLE=416,An.EXPECTATION_FAILED=417,An.IM_A_TEAPOT=418,An.UNPROCESSABLE_ENTITY=422,An.LOCKED=423,An.FAILED_DEPENDENCY=424,An.UNORDERED_COLLECTION=425,An.UPGRADE_REQUIRED=426,An.PRECONDITION_REQUIRED=428,An.TOO_MANY_REQUESTS=429,An.REQUEST_HEADER_FIELDS_TOO_LARGE=431,An.INTERNAL_SERVER_ERROR=500,An.NOT_IMPLEMENTED=501,An.BAD_GATEWAY=502,An.SERVICE_UNAVAILABLE=503,An.GATEWAY_TIME_OUT=504,An.HTTP_VERSION_NOT_SUPPORTED=505,An.VARIANT_ALSO_NEGOTIATES=506,An.INSUFFICIENT_STORAGE=507,An.BANDWIDTH_LIMIT_EXCEEDED=509,An.NOT_EXTENDED=510,An.NETWORK_AUTHENTICATION_REQUIRED=511),An}var On,_n=Ln(),Pn=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})},xn=function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&s[0]?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],i=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},Tn=function(){function e(){}return e.getMediaType=function(e){return(e=(e=e.toLowerCase()).split(";")[0]).trim()},e.getImageQuality=function(e){return e===At.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1||e===At.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2||e===At.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1||e===At.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2||e===At.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1||e===At.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2||e===At.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1||e===At.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2||e===At.ServiceProfile.IMAGE_1_LEVEL_1||e===At.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1||e===At.ServiceProfile.IMAGE_1_LEVEL_2||e===At.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2?"native":"default"},e.getInexactLocale=function(e){return-1!==e.indexOf("-")?e.substr(0,e.indexOf("-")):e},e.getLocalisedValue=function(e,t){if(!Array.isArray(e))return e;for(var n=0;n<e.length;n++){var i=e[n];if(t===i["@language"])return i["@value"]}var o=t.substr(0,t.indexOf("-"));for(n=0;n<e.length;n++){var r=e[n];if(r["@language"]===o)return r["@value"]}return null},e.generateTreeNodeIds=function(t,n){var i;void 0===n&&(n=0),i=t.parentNode?t.parentNode.id+"-"+n:"0",t.id=i;for(var o=0;o<t.nodes.length;o++){var r=t.nodes[o];e.generateTreeNodeIds(r,o)}},e.normaliseType=function(e){return-1!==(e=(e||"").toLowerCase()).indexOf(":")?e.split(":")[1]:e},e.normaliseUrl=function(e){return-1!==(e=e.substr(e.indexOf("://"))).indexOf("#")&&(e=e.split("#")[0]),e},e.normalisedUrlsMatch=function(t,n){return e.normaliseUrl(t)===e.normaliseUrl(n)},e.isImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2))},e.isImageServiceType=function(e){return null!==e&&e.toLowerCase()===At.ServiceType.IMAGE_SERVICE_2.toLowerCase()||e===At.ServiceType.IMAGE_SERVICE_3.toLowerCase()},e.isLevel0ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_LEVEL_0)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0))},e.isLevel1ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_LEVEL_1)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1))},e.isLevel2ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_LEVEL_2)||e.normalisedUrlsMatch(t,At.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2))},e.parseManifest=function(e,t){return Yn.parse(e,t)},e.checkStatus=function(e){if(e.ok)return e;var t=new Error(e.statusText);return t.response=e,Promise.reject(t)},e.loadManifest=function(t){return new Promise(function(n,i){fetch(t).then(e.checkStatus).then(function(e){return e.json()}).then(function(e){n(e)}).catch(function(e){i()})})},e.loadExternalResourcesAuth1=function(t,n,i,o,r,a,s,l){return new Promise(function(c,d){var u=t.map(function(t){return e.loadExternalResourceAuth1(t,n,i,o,r,a,s,l)});Promise.all(u).then(function(){c(t)}).catch(function(e){d(e)})})},e.loadExternalResourceAuth1=function(t,n,i,o,r,a,s,l){return Pn(this,void 0,void 0,function(){var c;return xn(this,function(d){switch(d.label){case 0:return[4,o(t)];case 1:return(c=d.sent())?[4,t.getData(c)]:[3,6];case 2:return d.sent(),t.status!==_n.OK?[3,3]:[2,t];case 3:return[4,e.doAuthChain(t,n,i,r,a,s,l)];case 4:d.sent(),d.label=5;case 5:if(t.status===_n.OK||t.status===_n.MOVED_TEMPORARILY)return[2,t];throw e.createAuthorizationFailedError();case 6:return[4,t.getData()];case 7:return d.sent(),t.status!==_n.MOVED_TEMPORARILY&&t.status!==_n.UNAUTHORIZED?[3,9]:[4,e.doAuthChain(t,n,i,r,a,s,l)];case 8:d.sent(),d.label=9;case 9:if(t.status===_n.OK||t.status===_n.MOVED_TEMPORARILY)return[2,t];throw e.createAuthorizationFailedError()}})})},e.doAuthChain=function(t,n,i,o,r,a,s){return Pn(this,void 0,void 0,function(){var l,c,d,u,p,h,g,m;return xn(this,function(f){switch(f.label){case 0:return t.isAccessControlled()?((l=t.externalService)&&(l.options=t.options),(c=t.kioskService)&&(c.options=t.options),(d=t.clickThroughService)&&(d.options=t.options),(u=t.loginService)&&(u.options=t.options),t.isResponseHandled||t.status!==_n.MOVED_TEMPORARILY?[3,2]:[4,a(t)]):[2,t];case 1:case 3:case 6:case 10:case 14:return f.sent(),[2,t];case 2:return p=null,h=null,(p=l)?(h=p,[4,e.attemptResourceWithToken(t,i,p)]):[3,4];case 4:return(p=c)?(h=p,(g=n(p))?[4,o(g)]:[3,7]):[3,7];case 5:case 9:case 13:return f.sent(),[4,e.attemptResourceWithToken(t,i,p)];case 7:return(p=d)?(h=p,[4,r(t,p)]):[3,11];case 8:return(m=f.sent())?[4,o(m)]:[3,11];case 11:return(p=u)?(h=p,[4,r(t,p)]):[3,15];case 12:return(m=f.sent())?[4,o(m)]:[3,15];case 15:return h&&s(t,h),[2]}})})},e.attemptResourceWithToken=function(e,t,n){return Pn(this,void 0,void 0,function(){var i,o;return xn(this,function(r){switch(r.label){case 0:return(i=n.getService(At.ServiceProfile.AUTH_1_TOKEN))?[4,t(e,i)]:[3,3];case 1:return(o=r.sent())&&o.accessToken?[4,e.getData(o)]:[3,3];case 2:return r.sent(),[2,e];case 3:return[2]}})})},e.loadExternalResourcesAuth09=function(t,n,i,o,r,a,s,l,c,d){return new Promise(function(u,p){var h=t.map(function(t){return e.loadExternalResourceAuth09(t,n,i,o,r,a,s,l,c,d)});Promise.all(h).then(function(){u(t)}).catch(function(e){p(e)})})},e.loadExternalResourceAuth09=function(t,n,i,o,r,a,s,l,c,d){return new Promise(function(u,p){d&&d.pessimisticAccessControl?t.getData().then(function(){t.isAccessControlled()?t.clickThroughService?(u(i(t)),u(o(t))):r(t).then(function(){a(t,!0).then(function(n){t.getData(n).then(function(){u(c(t))}).catch(function(t){p(e.createInternalServerError(t))})}).catch(function(t){p(e.createInternalServerError(t))})}).catch(function(t){p(e.createInternalServerError(t))}):u(t)}).catch(function(t){p(e.createInternalServerError(t))}):l(t,n).then(function(d){d?t.getData(d).then(function(){t.status===_n.OK?u(c(t)):e.authorize(t,n,i,o,r,a,s,l).then(function(){u(c(t))}).catch(function(t){p(e.createAuthorizationFailedError())})}).catch(function(t){p(e.createAuthorizationFailedError())}):e.authorize(t,n,i,o,r,a,s,l).then(function(){u(c(t))}).catch(function(t){p(e.createAuthorizationFailedError())})}).catch(function(t){p(e.createAuthorizationFailedError())})})},e.createError=function(e,t){var n=new Error;return n.message=t,n.name=String(e),n},e.createAuthorizationFailedError=function(){return e.createError(Rn.AUTHORIZATION_FAILED,"Authorization failed")},e.createRestrictedError=function(){return e.createError(Rn.RESTRICTED,"Restricted")},e.createInternalServerError=function(t){return e.createError(Rn.INTERNAL_SERVER_ERROR,t)},e.authorize=function(t,n,i,o,r,a,s,l){return new Promise(function(c,d){t.getData().then(function(){t.isAccessControlled()?l(t,n).then(function(l){l?t.getData(l).then(function(){t.status===_n.OK?c(t):e.showAuthInteraction(t,n,i,o,r,a,s,c,d)}).catch(function(t){d(e.createInternalServerError(t))}):a(t,!1).then(function(l){l?s(t,l,n).then(function(){t.getData(l).then(function(){t.status===_n.OK?c(t):e.showAuthInteraction(t,n,i,o,r,a,s,c,d)}).catch(function(t){d(e.createInternalServerError(t))})}).catch(function(t){d(e.createInternalServerError(t))}):e.showAuthInteraction(t,n,i,o,r,a,s,c,d)})}).catch(function(t){d(e.createInternalServerError(t))}):c(t)})})},e.showAuthInteraction=function(t,n,i,o,r,a,s,l,c){t.status!==_n.MOVED_TEMPORARILY||t.isResponseHandled?t.clickThroughService&&!t.isResponseHandled?i(t).then(function(){a(t,!0).then(function(i){s(t,i,n).then(function(){t.getData(i).then(function(){l(t)}).catch(function(t){c(e.createInternalServerError(t))})}).catch(function(t){c(e.createInternalServerError(t))})}).catch(function(t){c(e.createInternalServerError(t))})}):r(t).then(function(){a(t,!0).then(function(i){s(t,i,n).then(function(){t.getData(i).then(function(){l(t)}).catch(function(t){c(e.createInternalServerError(t))})}).catch(function(t){c(e.createInternalServerError(t))})}).catch(function(t){c(e.createInternalServerError(t))})}):l(t)},e.getService=function(e,t){for(var n=this.getServices(e),i=0;i<n.length;i++){var o=n[i];if(o.getProfile()===t)return o}return null},e.getResourceById=function(t,n){return e.traverseAndFind(t.__jsonld,"@id",n)},e.traverseAndFind=function(t,n,i){if(t.hasOwnProperty(n)&&t[n]===i)return t;for(var o=0;o<Object.keys(t).length;o++)if("object"==typeof t[Object.keys(t)[o]]){var r=e.traverseAndFind(t[Object.keys(t)[o]],n,i);if(null!=r)return r}},e.getServices=function(t,n){var i=void 0===n?{}:n,o=i.onlyService,r=void 0!==o&&o,a=i.onlyServices,s=void 0!==a&&a,l=i.skipParentResources,c=[];!(void 0!==l&&l)&&t&&t.options&&t.options.resource&&t.options.resource!==t&&c.push.apply(c,e.getServices(t.options.resource,{onlyServices:!0}));var d=s?[]:(t.__jsonld||t).service||[];if(Array.isArray(d)||(d=[d]),r||d.push.apply(d,(t.__jsonld||t).services||[]),0===d.length)return c;for(var u=0;u<d.length;u++){var p=d[u];if("string"==typeof p){var h=this.getResourceById(t.options.resource,p);h&&c.push(new qn(h.__jsonld||h,t.options))}else c.push(new qn(p,t.options))}return c},e.getTemporalComponent=function(e){var t=/t=([^&]+)/g.exec(e),n=null;return t&&t[1]&&(n=t[1].split(",")),n},e}(),kn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Fn=function(){function e(e,t,n){void 0===n&&(n="none"),Array.isArray(e)&&1===e.length?this._value=e[0]:this._value=e,"none"!==t&&"@none"!==t||(t=void 0),this._locale=t,this._defaultLocale=n}return e.parseV2Value=function(t,n){return"string"==typeof t?new e(t,void 0,n):t["@value"]?new e(t["@value"],t["@language"],n):null},Object.defineProperty(e.prototype,"value",{get:function(){return Array.isArray(this._value)?this._value.join("<br/>"):this._value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"locale",{get:function(){return void 0===this._locale?this._defaultLocale:this._locale},enumerable:!1,configurable:!0}),e.prototype.addValue=function(e){Array.isArray(this._value)||(this._value=[this._value]),Array.isArray(e)?this._value=this._value.concat(e):this._value.push(e)},e}(),jn=function(e){function t(n,i){void 0===n&&(n=[]);var o=e.apply(this,n)||this;return o.__proto__=t.prototype,o._defaultLocale=i,o}return kn(t,e),t.parse=function(e,n){if(!e)return new t([],n);if(Array.isArray(e)){var i=(o=e.map(function(e){return Fn.parseV2Value(e,n)}).filter(function(e){return null!==e})).reduce(function(e,t){var n=t._locale;return n||(n="none"),e[n]?e[n].addValue(t._value):e[n]=t,e},{});return new t(Object.values(i),n)}return"string"==typeof e?new t([new Fn(e,void 0,n)],n):e["@language"]||e["@value"]?new t(null!==(o=Fn.parseV2Value(e))?[o]:[],n):new t(Object.keys(e).map(function(t){var i=e[t];if(!Array.isArray(i))throw new Error("A IIIF v3 localized property value must have an array as the value for a given language.");return new Fn(i,t,n)}),n);var o},t.prototype.getSuitableLocale=function(e){0==e.length&&this._defaultLocale&&e.push(this._defaultLocale);for(var t=Array.from(this.values()).map(function(e){return e._locale}).filter(function(e){return void 0!==e}),n=function(e){var n=t.find(function(t){return t===e});if(n)return{value:n}},i=0,o=e;i<o.length;i++){var r=n(o[i]);if("object"==typeof r)return r.value}for(var a=function(e){var n=t.find(function(t){return Tn.getInexactLocale(t)===Tn.getInexactLocale(e)});if(n)return{value:n}},s=0,l=e;s<l.length;s++){var c=a(l[s]);if("object"==typeof c)return c.value}},t.prototype.setValue=function(e,t){var n=void 0;if(t){var i=this.getSuitableLocale([t]);i&&(n=this.find(function(e){return e._locale===i}))}else n=this.find(function(e){return void 0===e._locale});n?n._value=e:this.push(new Fn(e,t,this._defaultLocale))},t.prototype.getValue=function(e,t){var n=this.getValues(e);return 0===n.length?null:t?n.join(t):n[0]},t.prototype.getValues=function(e){if(!this.length)return[];var t;if(t=e?Array.isArray(e)?e:[e]:[],1===this.length&&void 0===this[0]._locale){var n=this[0]._value;return Array.isArray(n)?n:[n]}var i=this.getSuitableLocale(t);if(i){n=this.find(function(e){return e._locale===i})._value;return Array.isArray(n)?n:[n]}var o=!this.find(function(e){return void 0===e._locale});if(o){n=this[0]._value;return Array.isArray(n)?n:[n]}var r=this.find(function(e){return void 0===e._locale});return r?Array.isArray(r._value)?r._value:[r._value]:[]},t}(Array),Nn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Dn=function(e){function t(t,n){var i=e.call(this,t,n)||this;if(i.index=0,i._allRanges=null,i.items=[],i._topRanges=[],i.__jsonld.structures&&i.__jsonld.structures.length)for(var o=i._getTopRanges(),r=0;r<o.length;r++){var a=o[r];i._parseRanges(a,String(r))}return i._annotationIdMap=null,i}return Nn(t,e),t.prototype.getPosterCanvas=function(){var e=this.getProperty("posterCanvas");return e&&(e=new En(e,this.options)),e},t.prototype.getAccompanyingCanvas=function(){var e=this.getProperty("accompanyingCanvas");return e&&(e=new En(e,this.options)),e},t.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.getDefaultTree=function(){if(e.prototype.getDefaultTree.call(this),this.defaultTree.data.type=Tn.normaliseType(Qn.MANIFEST),!this.isLoaded)return this.defaultTree;var t=this.getTopRanges();return t.length&&t[0].getTree(this.defaultTree),Tn.generateTreeNodeIds(this.defaultTree),this.defaultTree},t.prototype._getTopRanges=function(){var e=[];if(this.__jsonld.structures&&this.__jsonld.structures.length){for(var t=0;t<this.__jsonld.structures.length;t++){var n=this.__jsonld.structures[t];n.viewingHint===At.ViewingHint.TOP&&e.push(n)}if(!e.length){var i={};i.ranges=this.__jsonld.structures,e.push(i)}}return e},t.prototype.getTopRanges=function(){return this._topRanges},t.prototype._getRangeById=function(e){if(this.__jsonld.structures&&this.__jsonld.structures.length)for(var t=0;t<this.__jsonld.structures.length;t++){var n=this.__jsonld.structures[t];if(n["@id"]===e||n.id===e)return n}return null},t.prototype._parseRanges=function(e,t,n){var i=null;if("string"==typeof e&&(i=e,e=this._getRangeById(i)),e){var o=new Gn(e,this.options);o.parentRange=n,o.path=t,n?n.items.push(o):this._topRanges.push(o);var r=e.items||e.members;if(r)for(var a=0;a<r.length;a++){var s=r[a];if(s["@type"]&&"sc:range"===s["@type"].toLowerCase()||s.type&&"range"===s.type.toLowerCase())this._parseRanges(s,t+"/"+a,o);else if(s["@type"]&&"sc:canvas"===s["@type"].toLowerCase()||s.type&&"canvas"===s.type.toLowerCase()){o.canvases||(o.canvases=[]);var l=s.id||s["@id"];o.canvases.push(l)}}else if(e.ranges)for(a=0;a<e.ranges.length;a++)this._parseRanges(e.ranges[a],t+"/"+a,o)}else console.warn("Range:",i,"does not exist")},t.prototype.getAllRanges=function(){if(null!=this._allRanges)return this._allRanges;this._allRanges=[];for(var e=this.getTopRanges(),t=function(t){var i=e[t];i.id&&n._allRanges.push(i);var o=function(e,t){e.add(t);var n=t.getRanges();return n.length?n.reduce(o,e):e},r=Array.from(i.getRanges().reduce(o,new Set));n._allRanges=n._allRanges.concat(r)},n=this,i=0;i<e.length;i++)t(i);return this._allRanges},t.prototype.getRangeById=function(e){for(var t=this.getAllRanges(),n=0;n<t.length;n++){var i=t[n];if(i.id===e)return i}return null},t.prototype.getRangeByPath=function(e){for(var t=this.getAllRanges(),n=0;n<t.length;n++){var i=t[n];if(i.path===e)return i}return null},t.prototype.getSequences=function(){if(this.items.length)return this.items;var e=this.__jsonld.mediaSequences||this.__jsonld.sequences;if(e)for(var t=0;t<e.length;t++){var n=e[t],i=new Kn(n,this.options);this.items.push(i)}else if(this.__jsonld.items){i=new Kn(this.__jsonld.items,this.options);this.items.push(i)}return this.items},t.prototype.getSequenceByIndex=function(e){return this.getSequences()[e]},t.prototype.getTotalSequences=function(){return this.getSequences().length},t.prototype.getManifestType=function(){var e=this.getService(At.ServiceProfile.UI_EXTENSIONS);return e?e.getProperty("manifestType"):On.EMPTY},t.prototype.isMultiSequence=function(){return this.getTotalSequences()>1},t.prototype.isPagingEnabled=function(){var e=this.getViewingHint();if(e)return e===At.ViewingHint.PAGED;var t=this.getBehavior();return!!t&&t===At.Behavior.PAGED},t.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")},t.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},Object.defineProperty(t.prototype,"annotationIdMap",{get:function(){if(null==this._annotationIdMap){this._annotationIdMap={};for(var e=0,t=this.getSequences();e<t.length;e++)for(var n=0,i=t[e].getScenes();n<i.length;n++)for(var o=0,r=i[n].getContent();o<r.length;o++){var a=r[o];this._annotationIdMap[a.id]=a}}return this._annotationIdMap},enumerable:!1,configurable:!0}),t}(Tt);!function(e){e.EMPTY="",e.MANUSCRIPT="manuscript",e.MONOGRAPH="monograph"}(On||(On={}));var Rn,zn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Bn=function(e){function t(t){var n=e.call(this,t)||this;return n.isPointSelector=!0,n}return zn(t,e),t.prototype.getLocation=function(){return new n(this.__jsonld.x,this.__jsonld.y,this.__jsonld.z)},Object.defineProperty(t.prototype,"Location",{get:function(){return this.getLocation()},enumerable:!1,configurable:!0}),t}(Xe),Un=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Gn=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i._ranges=null,i.canvases=null,i.items=[],i}return Un(t,e),t.prototype.getCanvasIds=function(){return this.__jsonld.canvases?this.__jsonld.canvases:this.canvases?this.canvases:[]},t.prototype.getDuration=function(){if(this.canvases&&this.canvases.length){for(var e=[],t=[],n=0,i=this.canvases;n<i.length;n++){if(h=i[n]){var o=h.match(/(.*)#t=([0-9.]+),?([0-9.]+)?/)||[void 0,h],r=o[1],a=o[2],s=o[3];r&&(e.push(parseFloat(a)),t.push(parseFloat(s)))}}if(e.length&&t.length)return new Sn(Math.min.apply(Math,e),Math.max.apply(Math,t))}else{e=[],t=[];for(var l=0,c=m=this.getRanges();l<c.length;l++){(f=c[l].getDuration())&&(e.push(f.start),t.push(f.end))}if(e.length&&t.length)return new Sn(Math.min.apply(Math,e),Math.max.apply(Math,t))}var d,u;if(this.canvases&&this.canvases.length)for(var p=0;p<this.canvases.length;p++){var h=this.canvases[p],g=Tn.getTemporalComponent(h);g&&g.length>1&&(0===p&&(d=Number(g[0])),p===this.canvases.length-1&&(u=Number(g[1])))}else{var m=this.getRanges();for(p=0;p<m.length;p++){var f;(f=m[p].getDuration())&&(0===p&&(d=f.start),p===m.length-1&&(u=f.end))}}if(void 0!==d&&void 0!==u)return new Sn(d,u)},t.prototype.getRanges=function(){return this._ranges?this._ranges:this._ranges=this.items.filter(function(e){return e.isRange()})},t.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")},t.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},t.prototype.getTree=function(e){e.data=this,this.treeNode=e;var t=this.getRanges();if(t&&t.length)for(var n=0;n<t.length;n++){var i=t[n],o=new ai;e.addNode(o),this._parseTreeNode(o,i)}return Tn.generateTreeNodeIds(e),e},t.prototype.spansTime=function(e){var t=this.getDuration();return!!(t&&e>=t.start&&e<=t.end)},t.prototype._parseTreeNode=function(e,t){e.label=t.getLabel().getValue(this.options.locale),e.data=t,e.data.type=Tn.normaliseType(Qn.RANGE),t.treeNode=e;var n=t.getRanges();if(n&&n.length)for(var i=0;i<n.length;i++){var o=n[i];if(o.getBehavior()!==At.Behavior.NO_NAV){var r=new ai;e.addNode(r),this._parseTreeNode(r,o)}}},t}(Ot),Hn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Vn=function(e){function t(t,n){return e.call(this,t,n)||this}return Hn(t,e),t.prototype.getFormat=function(){return this.getProperty("format")},t}(Ot),$n=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Wn=function(e){function t(t,n){return e.call(this,t,n)||this}return $n(t,e),t.prototype.getContent=function(){var e=[],t=this.__jsonld.items||this.__jsonld.content;if(!t)return e;var n=null;if(t.length&&(n=new Jt(t[0],this.options)),!n)return e;for(var i=n.getItems(),o=0;o<i.length;o++){var r=i[o],a=new Kt(r,this.options);e.push(a)}return e},Object.defineProperty(t.prototype,"Content",{get:function(){return this.getContent()},enumerable:!1,configurable:!0}),t.prototype.getAnnotationById=function(e){for(var t=0,n=this.Content;t<n.length;t++){var i=n[t];if(i.id===e)return i}return null},t.prototype.getBackgroundColor=function(){var e=this.getProperty("backgroundColor");return e?Si.fromCSS(e):null},t.prototype.getNonContentAnnotations=function(){var e=this,t=(this.__jsonld.annotations||[]).filter(function(e){return e&&"AnnotationPage"===e.type}).map(function(t){return new Jt(t,e.options)});if(!t.length)return[];var n=t.map(function(e){return e.getItems()});return vn(n).map(function(t){return new Kt(t,e.options)})},t}(Ot),Xn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Kn=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.items=[],i._thumbnails=null,i}return Xn(t,e),t.prototype.getCanvases=function(){if(this.items.length)return this.items;var e=this.__jsonld.canvases||this.__jsonld.elements;if(e)for(var t=0;t<e.length;t++){var n=e[t];(i=new En(n,this.options)).index=t,this.items.push(i)}else if(this.__jsonld)for(t=0;t<this.__jsonld.length;t++){var i;n=this.__jsonld[t];(i=new En(n,this.options)).index=t,this.items.push(i)}return this.items},t.prototype.getCanvasById=function(e){for(var t=0;t<this.getTotalCanvases();t++){var n=this.getCanvasByIndex(t),i=Tn.normaliseUrl(n.id);if(Tn.normaliseUrl(e)===i)return n}return null},t.prototype.getCanvasByIndex=function(e){return this.getCanvases()[e]},t.prototype.getCanvasIndexById=function(e){for(var t=0;t<this.getTotalCanvases();t++){if(this.getCanvasByIndex(t).id===e)return t}return null},t.prototype.getCanvasIndexByLabel=function(e,t){e=e.trim(),isNaN(e)||(e=parseInt(e,10).toString(),t&&(e+="r"));for(var n,i,o,r=/(\d*)\D+(\d*)/,a=0;a<this.getTotalCanvases();a++){var s=this.getCanvasByIndex(a);if(s.getLabel().getValue(this.options.locale)===e)return a;if((n=r.exec(e))&&(i=n[1],(o=n[2])&&new RegExp("^"+i+"\\D+"+o+"$").test(s.getLabel().toString())))return a}return-1},t.prototype.getLastCanvasLabel=function(e){for(var t=this.getTotalCanvases()-1;t>=0;t--){var n=this.getCanvasByIndex(t).getLabel().getValue(this.options.locale);if(e){if(/^[a-zA-Z0-9]*$/.test(n))return n}else if(n)return n}return this.options.defaultLabel},t.prototype.getLastPageIndex=function(){return this.getTotalCanvases()-1},t.prototype.getNextPageIndex=function(e,t){var n;if(t){var i=this.getPagedIndices(e),o=this.getViewingDirection();n=o&&o===At.ViewingDirection.RIGHT_TO_LEFT?i[0]+1:i[i.length-1]+1}else n=e+1;return n>this.getLastPageIndex()?-1:n},t.prototype.getPagedIndices=function(e,t){var n=[];if(t){n=this.isFirstCanvas(e)||this.isLastCanvas(e)?[e]:e%2?[e,e+1]:[e-1,e];var i=this.getViewingDirection();i&&i===At.ViewingDirection.RIGHT_TO_LEFT&&(n=n.reverse())}else n.push(e);return n},t.prototype.getPrevPageIndex=function(e,t){var n;if(t){var i=this.getPagedIndices(e),o=this.getViewingDirection();n=o&&o===At.ViewingDirection.RIGHT_TO_LEFT?i[i.length-1]-1:i[0]-1}else n=e-1;return n},t.prototype.getScenes=function(){var e=[],t=this.__jsonld.elements||this.__jsonld;if(t)for(var n=0;n<t.length;++n){var i=t[n];if("Scene"===i.type){var o=new Wn(i,this.options);e.push(o)}}return e},t.prototype.getStartCanvasIndex=function(){var e=this.getStartCanvas();if(e)for(var t=0;t<this.getTotalCanvases();t++){if(this.getCanvasByIndex(t).id===e)return t}return 0},t.prototype.getThumbs=function(e,t){for(var n=[],i=this.getTotalCanvases(),o=0;o<i;o++){var r=this.getCanvasByIndex(o),a=new ei(e,r);n.push(a)}return n},t.prototype.getThumbnails=function(){if(null!=this._thumbnails)return this._thumbnails;this._thumbnails=[];for(var e=this.getCanvases(),t=0;t<e.length;t++){var n=e[t].getThumbnail();n&&this._thumbnails.push(n)}return this._thumbnails},t.prototype.getStartCanvas=function(){return this.getProperty("startCanvas")},t.prototype.getTotalCanvases=function(){return this.getCanvases().length},t.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?this.getProperty("viewingDirection"):this.options.resource.getViewingDirection?this.options.resource.getViewingDirection():null},t.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},t.prototype.isCanvasIndexOutOfRange=function(e){return e>this.getTotalCanvases()-1},t.prototype.isFirstCanvas=function(e){return 0===e},t.prototype.isLastCanvas=function(e){return e===this.getTotalCanvases()-1},t.prototype.isMultiCanvas=function(){return this.getTotalCanvases()>1},t.prototype.isPagingEnabled=function(){var e=this.getViewingHint();return!!e&&e===At.ViewingHint.PAGED},t.prototype.isTotalCanvasesEven=function(){return this.getTotalCanvases()%2==0},t}(Ot),Yn=function(){function e(){}return e.parse=function(e,t){return"string"==typeof e&&(e=JSON.parse(e)),this.parseJson(e,t)},e.parseJson=function(e,t){var n;if(t&&t.navDate&&!isNaN(t.navDate.getTime())&&(e.navDate=t.navDate.toString()),e["@type"])switch(e["@type"]){case"sc:Collection":n=this.parseCollection(e,t);break;case"sc:Manifest":n=this.parseManifest(e,t);break;default:return null}else switch(e.type){case"Collection":n=this.parseCollection(e,t);break;case"Manifest":n=this.parseManifest(e,t);break;default:return null}return n.isLoaded=!0,n},e.parseCollection=function(e,t){var n=new Mn(e,t);return t?(n.index=t.index||0,t.resource&&(n.parentCollection=t.resource.parentCollection)):n.index=0,this.parseCollections(n,t),this.parseManifests(n,t),this.parseItems(n,t),n},e.parseCollections=function(e,t){var n;if(e.__jsonld.collections?n=e.__jsonld.collections:e.__jsonld.items&&(n=e.__jsonld.items.filter(function(e){return"collection"===e.type.toLowerCase()})),n)for(var i=0;i<n.length;i++){t&&(t.index=i);var o=this.parseCollection(n[i],t);o.index=i,o.parentCollection=e,e.items.push(o)}},e.parseManifest=function(e,t){return new Dn(e,t)},e.parseManifests=function(e,t){var n;if(e.__jsonld.manifests?n=e.__jsonld.manifests:e.__jsonld.items&&(n=e.__jsonld.items.filter(function(e){return"manifest"===e.type.toLowerCase()})),n)for(var i=0;i<n.length;i++){var o=this.parseManifest(n[i],t);o.index=i,o.parentCollection=e,e.items.push(o)}},e.parseItem=function(e,t){if(e["@type"]){if("sc:manifest"===e["@type"].toLowerCase())return this.parseManifest(e,t);if("sc:collection"===e["@type"].toLowerCase())return this.parseCollection(e,t)}else if(e.type){if("manifest"===e.type.toLowerCase())return this.parseManifest(e,t);if("collection"===e.type.toLowerCase())return this.parseCollection(e,t)}return null},e.parseItems=function(e,t){var n=e.__jsonld.members||e.__jsonld.items;if(n)for(var i=function(i){t&&(t.index=i);var r=o.parseItem(n[i],t);return r?e.items.filter(function(e){return e.id===r.id})[0]?"continue":(r.index=i,r.parentCollection=e,void e.items.push(r)):{value:void 0}},o=this,r=0;r<n.length;r++){var a=i(r);if("object"==typeof a)return a.value}},e}(),Zn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),qn=function(e){function t(t,n){return e.call(this,t,n)||this}return Zn(t,e),t.prototype.getProfile=function(){var e=this.getProperty("profile");return e||(e=this.getProperty("dcterms:conformsTo")),Array.isArray(e)?e[0]:e},t.prototype.getConfirmLabel=function(){return Tn.getLocalisedValue(this.getProperty("confirmLabel"),this.options.locale)},t.prototype.getDescription=function(){return Tn.getLocalisedValue(this.getProperty("description"),this.options.locale)},t.prototype.getFailureDescription=function(){return Tn.getLocalisedValue(this.getProperty("failureDescription"),this.options.locale)},t.prototype.getFailureHeader=function(){return Tn.getLocalisedValue(this.getProperty("failureHeader"),this.options.locale)},t.prototype.getHeader=function(){return Tn.getLocalisedValue(this.getProperty("header"),this.options.locale)},t.prototype.getServiceLabel=function(){return Tn.getLocalisedValue(this.getProperty("label"),this.options.locale)},t.prototype.getInfoUri=function(){var e=this.id;return e.endsWith("/")||(e+="/"),e+="info.json"},t}(Ot),Jn=function(e,t){this.width=e,this.height=t};!function(e){e[e.AUTHORIZATION_FAILED=1]="AUTHORIZATION_FAILED",e[e.FORBIDDEN=2]="FORBIDDEN",e[e.INTERNAL_SERVER_ERROR=3]="INTERNAL_SERVER_ERROR",e[e.RESTRICTED=4]="RESTRICTED"}(Rn||(Rn={}));var Qn,ei=function(e,t){this.data=t,this.index=t.index,this.width=e;var n=t.getHeight()/t.getWidth();this.height=n?Math.floor(this.width*n):e,this.uri=t.getCanonicalImageUri(e),this.label=t.getLabel().getValue(),this.viewingHint=t.getViewingHint()},ti=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ni=function(e){function t(t,n){return e.call(this,t,n)||this}return ti(t,e),t}(Pt),ii=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),oi=function(e){function t(t){var n=e.call(this,t)||this;return n.isTranslateTransform=!0,n}return ii(t,e),t.prototype.getTranslation=function(){for(var e={},t=0,n=["x","y","z"];t<n.length;t++){var i=n[t],o=this.__jsonld[i];e[i]=void 0!==o?Number(o):0}return e},t}(Ye),ri=function(){function e(){}return e.BuildFromJson=function(e){if("TranslateTransform"===e.type)return new oi(e);if("RotateTransform"===e.type)return new di(e);if("ScaleTransform"===e.type)return new pi(e);throw new Error("Unknown transform type "+e.type)},e}(),ai=function(){function e(e,t){this.label=e,this.data=t||{},this.nodes=[]}return e.prototype.addNode=function(e){this.nodes.push(e),e.parentNode=this},e.prototype.isCollection=function(){return this.data.type===Tn.normaliseType(Qn.COLLECTION)},e.prototype.isManifest=function(){return this.data.type===Tn.normaliseType(Qn.MANIFEST)},e.prototype.isRange=function(){return this.data.type===Tn.normaliseType(Qn.RANGE)},e}();!function(e){e.COLLECTION="collection",e.MANIFEST="manifest",e.RANGE="range"}(Qn||(Qn={}));var si,li,ci=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),di=function(e){function t(t){var n=e.call(this,t)||this;return n.isRotateTransform=!0,n}return ci(t,e),t.prototype.getRotation=function(){for(var e={},t=0,n=["x","y","z"];t<n.length;t++){var i=n[t],o=this.__jsonld[i];e[i]=void 0!==o?Number(o):0}return e},Object.defineProperty(t.prototype,"Rotation",{get:function(){return this.getRotation()},enumerable:!1,configurable:!0}),t}(Ye),ui=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),pi=function(e){function t(t){var n=e.call(this,t)||this;return n.isScaleTransform=!0,n}return ui(t,e),t.prototype.getScale=function(){for(var e={},t=0,n=["x","y","z"];t<n.length;t++){var i=n[t],o=this.__jsonld[i];e[i]=void 0!==o?Number(o):1}return e},t}(Ye),hi={exports:{}};function gi(){return li?si:(li=1,si={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]})}var mi,fi,bi,yi,vi={exports:{}};function wi(){return fi?mi:(fi=1,mi=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))})}function Ei(){if(bi)return vi.exports;bi=1;var e=wi(),t=Array.prototype.concat,n=Array.prototype.slice,i=vi.exports=function(i){for(var o=[],r=0,a=i.length;r<a;r++){var s=i[r];e(s)?o=t.call(o,n.call(s)):o.push(s)}return o};return i.wrap=function(e){return function(){return e(i(arguments))}},vi.exports}function Ci(){if(yi)return hi.exports;yi=1;var e=gi(),t=Ei(),n=Object.hasOwnProperty,i=Object.create(null);for(var o in e)n.call(e,o)&&(i[e[o]]=o);var r=hi.exports={to:{},get:{}};function a(e,t,n){return Math.min(Math.max(t,e),n)}function s(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}return r.get=function(e){var t,n;switch(e.substring(0,3).toLowerCase()){case"hsl":t=r.get.hsl(e),n="hsl";break;case"hwb":t=r.get.hwb(e),n="hwb";break;default:t=r.get.rgb(e),n="rgb"}return t?{model:n,value:t}:null},r.get.rgb=function(t){if(!t)return null;var i,o,r,s=[0,0,0,1];if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=i[2],i=i[1],o=0;o<3;o++){var l=2*o;s[o]=parseInt(i.slice(l,l+2),16)}r&&(s[3]=parseInt(r,16)/255)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(i=i[1])[3],o=0;o<3;o++)s[o]=parseInt(i[o]+i[o],16);r&&(s[3]=parseInt(r+r,16)/255)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(o=0;o<3;o++)s[o]=parseInt(i[o+1],0);i[4]&&(i[5]?s[3]=.01*parseFloat(i[4]):s[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(i=t.match(/^(\w+)$/))?"transparent"===i[1]?[0,0,0,0]:n.call(e,i[1])?((s=e[i[1]])[3]=1,s):null:null;for(o=0;o<3;o++)s[o]=Math.round(2.55*parseFloat(i[o+1]));i[4]&&(i[5]?s[3]=.01*parseFloat(i[4]):s[3]=parseFloat(i[4]))}for(o=0;o<3;o++)s[o]=a(s[o],0,255);return s[3]=a(s[3],0,1),s},r.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,a(parseFloat(t[2]),0,100),a(parseFloat(t[3]),0,100),a(isNaN(n)?1:n,0,1)]}return null},r.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,a(parseFloat(t[2]),0,100),a(parseFloat(t[3]),0,100),a(isNaN(n)?1:n,0,1)]}return null},r.to.hex=function(){var e=t(arguments);return"#"+s(e[0])+s(e[1])+s(e[2])+(e[3]<1?s(Math.round(255*e[3])):"")},r.to.rgb=function(){var e=t(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},r.to.rgb.percent=function(){var e=t(arguments),n=Math.round(e[0]/255*100),i=Math.round(e[1]/255*100),o=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+n+"%, "+i+"%, "+o+"%)":"rgba("+n+"%, "+i+"%, "+o+"%, "+e[3]+")"},r.to.hsl=function(){var e=t(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},r.to.hwb=function(){var e=t(arguments),n="";return e.length>=4&&1!==e[3]&&(n=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+n+")"},r.to.keyword=function(e){return i[e.slice(0,3)]},hi.exports}var Mi=Ci(),Si=function(){function e(e){this.value=e}return e.fromCSS=function(t){var n=Mi.get(t);if("rgb"!==n.model)throw new Error("unsupported color string: "+t);return new e([n.value[0],n.value[1],n.value[2]])},Object.defineProperty(e.prototype,"red",{get:function(){return this.value[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"green",{get:function(){return this.value[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blue",{get:function(){return this.value[2]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CSS",{get:function(){return Mi.to.hex(this.value)},enumerable:!1,configurable:!0}),e}();function Ii(e){var t=e.Rotation;return new r(a.degToRad(t.x),a.degToRad(t.y),a.degToRad(t.z),"XYZ")}var Ai=function(e,t){return Tn.parseManifest(e,t)};class Li{constructor(e){!function(e){try{JSON.parse(e)}catch(e){return!1}return!0}(e)?(this.manifestJson=null,this.manifestUrl=e):(this.manifestJson=e,this.manifestUrl=null,this.manifest=Ai(e))}async loadManifest(){var e;this.manifestUrl&&(this.manifestJson=await(e=this.manifestUrl,Tn.loadManifest(e))),this.manifestJson&&(this.manifest=await Ai(this.manifestJson)),this.manifest&&(this.scenes=this.manifest?.getSequences()[0]?.getScenes()||[])}annotationsFromScene(e){return e?.getContent()||[]}}async function Oi(e,t){let n=t.index||0;if(!e.annotations[n])return;const i=e.annotations?.[n];if(null==i)throw new Error(`No annotation at index ${n}`);const o=Array.isArray(i)?i:[i];return await Promise.all(o.map(async i=>{if(i.getBody()[0].isSpecificResource){let e=new Array;try{const t=i.getBody?.(),n=Array.isArray(t)?t[0]:null;e=n?.getTransform?.()||[]}catch(e){}for(const i of e){if(!i.isTransform)continue;const e=[{key:"isScaleTransform",action:()=>{const e=i.getScale();e?t.models[n].scale=e:(t.models[n].scale={x:1,y:1,z:1},console.log("No scale defined in scale transform"))}},{key:"isRotateTransform",action:()=>{const e=i.getRotation();e?t.models[n].rotation=e:(t.models[n].rotation={x:0,y:0,z:0},console.log("No rotation defined in rotate transform"))}},{key:"isTranslateTransform",action:()=>{const e=i.getTranslation();t.models[n].position=e||{x:0,y:0,z:0}}}];for(const{key:t,action:n}of e)i[t]&&n()}}if(1==e.modelTarget.isSpecificResource){const i=e.modelTarget.getSelector();if(i&&i.isPointSelector){const e=i.getLocation();e&&(t.models[n].position.x+=e.x,t.models[n].position.y+=e.y,t.models[n].position.z+=e.z)}}})),e.annotations}class _i{constructor(e){"string"==typeof e&&e.trim().startsWith("{")?(this.manifestJson=JSON.parse(e),this.manifestUrl=null):"object"==typeof e?(this.manifestJson=e,this.manifestUrl=null):(this.manifestUrl=e,this.manifestJson=null)}async loadManifest(){if(this.manifestUrl){const e=await fetch(this.manifestUrl);this.manifestJson=await e.json()}this.manifest=this.manifestJson,this.scenes=this.manifest?.items?.filter(e=>"Scene"===e.type)||[]}annotationsFromScene(e){const t=[];for(const n of e?.items||[])if("AnnotationPage"===n.type)for(const e of n.items||[])t.push(e);return t}}function Pi(e,t){const n=e.AIM3DViewer?.modelTransform;if(!n)return;const i=t.models[0];i.position={x:n.position?.[0]??0,y:n.position?.[1]??0,z:n.position?.[2]??0},i.rotation={x:n.rotation?.x??0,y:n.rotation?.y??0,z:n.rotation?.z??0},i.scale={x:n.scale?.[0]??1,y:n.scale?.[1]??1,z:n.scale?.[2]??1},i.wireframe=n.wireframe??!1}function xi(e){const t={moveToolbar:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v18M3 12h18M12 3l-2.5 2.5M12 3l2.5 2.5M12 21l-2.5-2.5M12 21l2.5-2.5M3 12l2.5-2.5M3 12l2.5 2.5M21 12l-2.5-2.5M21 12l-2.5 2.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',orbit:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a9 9 0 1 0 9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M16.5 2.75 21 3.5l-.75 4.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><circle cx="12" cy="12" r="2.25" fill="currentColor"/></svg>',move:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v18M3 12h18M12 3l-2.5 2.5M12 3l2.5 2.5M12 21l-2.5-2.5M12 21l2.5-2.5M3 12l2.5-2.5M3 12l2.5 2.5M21 12l-2.5-2.5M21 12l-2.5 2.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',rotate:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 6.5A7.5 7.5 0 1 1 5 12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M8 3.5v3H5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',scale:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 8h8v8H8zM5 5h4M5 5v4M19 19h-4M19 19v-4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',lightMove:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3 5 13h5l-1 8 7-10h-5z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/></svg>',lightTarget:'<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="7" fill="none" stroke="currentColor" stroke-width="1.8"/><circle cx="12" cy="12" r="2.5" fill="currentColor"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',lights:'<svg viewBox="0 0 24 24" aria-hidden="true"> <circle cx="12" cy="12" r="3" fill="none" stroke="currentColor" stroke-width="1.8"/> <path d="M12 4V7M12 17v3M4 12h3M17 12h3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/> <path d="M6.5 6.5l2 2M15.5 15.5l2 2M17.5 6.5l-2 2M8.5 15.5l-2 2" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/> </svg>',materials:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2l8 4v8l-8 4-8-4V6l8-4z" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M12 6l8 4M12 6v8M12 14l-8-4" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>',ambientLight:'<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="6" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',cameraLight:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 7h3l2-2h4l2 2h3v10H5z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><circle cx="12" cy="13" r="2.5" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>',environmentMap:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3 19 7v10l-7 4-7-4V7z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M12 3v18M5 7l7 4 7-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><circle cx="18.25" cy="5.75" r="1.25" fill="currentColor"/></svg>',color:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a5 5 0 0 0-5 5c0 2.8 5 9 5 9s5-6.2 5-9a5 5 0 0 0-5-5Z" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M12 14.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Z" fill="currentColor"/></svg>',intensity:'<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',picking:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 3 8 8-4 1 2 5-2.5 1-2-5-3 3Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/></svg>',resetCamera:'<svg viewBox="0 0 24 24" aria-hidden="true"> <path d="M9 4H4v5M15 4h5v5M20 15v5h-5M4 15v5h5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/> <circle cx="12" cy="12" r="3" fill="none" stroke="currentColor" stroke-width="1.8"/> </svg>',preview:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 6h16v12H4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="m8 14 2.5-3 2.5 2 2-3 3 4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',save:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 4h11l3 3v13H5z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M8 4v5h8M9 18h6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',mainMenu:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m12 3 2 2.2 3-.2.8 2.9 2.6 1.4-1 2.8 1 2.8-2.6 1.4-.8 2.9-3-.2L12 21l-2-2.2-3 .2-.8-2.9-2.6-1.4 1-2.8-1-2.8 2.6-1.4.8-2.9 3 .2Z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><circle cx="12" cy="12" r="2.5" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>',advancedEditor:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h10M4 17h16M14 7h6M4 12h6M12 12h8M8 5v4M16 10v4M10 15v4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',fullScreen:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h5M4 4v5M20 4h-5M20 4v5M4 20h5M4 20v-5M20 20h-5M20 20v-5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',displayHelperX:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 8l8 8M16 8 8 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',displayHelperY:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 7 12 13 17 7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 13v4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',displayHelperZ:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 7h10M7 17h10M17 7 7 17" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',visible:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8S1 12 1 12Z" fill="none" stroke="currentColor" stroke-width="1.8"/><circle cx="12" cy="12" r="3" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>',clippingPlanes:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 6h10v12H7z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M12 5v14" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/><path d="M7 6h5v12H7z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-dasharray="2.5 2.5" stroke-linejoin="round"/></svg>',ruler:'<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="4" y="9" width="16" height="6" rx="1.8" fill="none" stroke="currentColor" stroke-width="1.8"/> <path d="M7 9v2.5 M9.5 9v1.6 M12 9v2.5 M14.5 9v1.6 M17 9v2.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',annotate:'<svg viewBox="0 0 24 24" aria-hidden="true"> <path d="M5 5h14v10H9l-4 4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/> <path d="M9 9h6M9 12h4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/> </svg>',annotateAdd:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 4h14v11H9l-4 4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M12 8v5M9.5 10.5h5" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/></svg>',annotateImport:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 4h14v11H9l-4 4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M12 6.8v7" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/><path d="M8.8 10.8 12 14l3.2-3.2" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>',annotateExport:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 4h14v11H9l-4 4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M12 14.2V7.2" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/><path d="M8.8 10.2 12 7l3.2 3.2" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>',IIIFexport:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h9l3 3v12H6z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M15 3v3h3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M12 18V9" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/><path d="M8.8 12.2L12 9l3.2 3.2" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/><path d="M5 21h14" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/></svg>',hierarchy:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h5v5H4zM15 4h5v5h-5zM4 15h5v5H4zM15 15h5v5h-5zM9 6h6M9 17h6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',loadingLogs:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12h18M3 6h12M3 18h12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',performance:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a9 9 0 1 1-9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 3a9 9 0 0 1 9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 12 15 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/></svg>',statistics:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 18h16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M7 14v4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 10v8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M17 6v12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',performanceDefault:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a9 9 0 1 1-9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 3a9 9 0 0 1 9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 12 15 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/></svg>',performanceHigh:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a9 9 0 1 1-9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 3a9 9 0 0 1 9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 12 15 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="12" r="1.5" fill="#FF4136"/></svg>',performanceLow:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a9 9 0 1 1-9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 3a9 9 0 0 1 9 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 12 15 9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="12" r="1.5" fill="#2ECC40"/></svg>',expand:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 5l7 7-7 7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',collapse:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 9l5 5 5-5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',projection:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 8l5-3h7v14h-7l-5-3z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M11 5v14" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M6 8v8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>',wireframe:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3 19 7v10l-7 4-7-4V7z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M12 3v18M5 7l7 4 7-4M5 17l7-4 7 4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>',screenshot:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 5H5a2 2 0 0 0-2 2v2M17 5h2a2 2 0 0 1 2 2v2M17 19h2a2 2 0 0 0 2-2v-2M7 19H5a2 2 0 0 1-2-2v-2" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="12" r="3.2" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>',download:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v12M5 12l7 7 7-7M4 19h16a1 1 0 0 1 1 1v2H3v-2a1 1 0 0 1 1-1z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>'};return t[e]||t.advancedEditor}function Ti(e){if(!e.editorToolbarSecondaryTray)return;const t=Array.from(e.editorToolbarSecondaryTray.children).reduce((e,t)=>e+t.getBoundingClientRect().width+10,0);e.editorToolbarSecondaryTray.style.setProperty("--viewer-toolbar-secondary-width",`${Math.ceil(t)}px`)}function ki(e){return u.container||e.viewerWrapper||null}function Fi(e,t,n,i){let o=null,r=0,a=0;const s=(e,t)=>{const n=i.getBoundingClientRect();return{x:Math.min(Math.max(e,-n.width),n.width),y:Math.min(Math.max(t,-n.height),n.height)}},l=()=>{n.style.setProperty("--drag-x",`${r}px`),n.style.setProperty("--drag-y",`${a}px`)},c=e=>{if(!o)return;const t=(()=>{const e=getComputedStyle(n),t=parseFloat(e.getPropertyValue("--viewer-toolbar-scale"));return Number.isFinite(t)?t:1})(),i=(e.clientX-o.startX)/t,c=(e.clientY-o.startY)/t,d=s(o.originX+i,o.originY+c);r=d.x,a=d.y,l()},d=()=>{o&&(o=null,n.classList.remove("viewer-editor-toolbar_dragging"),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",d),document.removeEventListener("pointercancel",d),requestAnimationFrame(()=>{n.style.removeProperty("transition")}))};t.bindEventListener(e,"pointerdown",e=>{0===e.button&&(e.preventDefault(),e.stopPropagation(),o={startX:e.clientX,startY:e.clientY,originX:r,originY:a},n.classList.add("viewer-editor-toolbar_dragging"),n.style.transition="none",document.addEventListener("pointermove",c,{passive:!0}),document.addEventListener("pointerup",d),document.addEventListener("pointercancel",d))}),t.bindEventListener(e,"click",e=>{e.stopPropagation()});new ResizeObserver(()=>{const e=s(r,a);r=e.x,a=e.y,l()}).observe(i),l()}function ji(e){if(!u.editorToolbar)return;Ti(e),e.isToolbarExpanded=!e.isToolbarExpanded,u.editorToolbar.classList.toggle("expanded",e.isToolbarExpanded),e.editorToolbarButtons.expand.classList.toggle("expanded-icon",e.isToolbarExpanded),e.editorToolbarButtons.expand.setAttribute("aria-expanded",e.isToolbarExpanded?"true":"false");const t=e.editorToolbarButtons.expand.querySelector(".viewer-editor-tool_icon");t&&(t.innerHTML=xi(e.isToolbarExpanded?"collapse":"expand")),e.updateEditorToolbarLabels()}function Ni(t){if(!u.EDITOR||t.urlOptions.hideUi||u.editorToolbar||!u.container)return;const n=document.createElement("div");n.id="viewerEditorToolbar",n.setAttribute("role","toolbar"),n.setAttribute("aria-label",y("toolbar.editor","Editor tools"));const i=[{key:"moveToolbar",icon:"moveToolbar",onClick:()=>{},pressed:!0,primary:!0},{key:"orbit",icon:"orbit",onClick:()=>t.setObjectTransformMode(""),primary:!0},{key:"move",icon:"move",onClick:()=>t.toggleObjectTransformMode("translate"),pressed:!0,primary:!0},{key:"rotate",icon:"rotate",onClick:()=>t.toggleObjectTransformMode("rotate"),pressed:!0,primary:!0},{key:"scale",icon:"scale",onClick:()=>t.toggleObjectTransformMode("scale"),pressed:!0,primary:!0},{key:"lights",icon:"lights",onClick:()=>{},pressed:!1,primary:!1},{key:"materials",icon:"materials",onClick:()=>t.openMaterialsFolder(),pressed:!1,primary:!1},{key:"picking",icon:"picking",onClick:()=>t.togglePickingMode(),pressed:!0,primary:!1},{key:"annotate",icon:"annotate",onClick:()=>t.openAnnotationDialogWithAutoPicking(),primary:!1},{key:"ruler",icon:"ruler",onClick:()=>t.toggleDistanceMeasurement(),pressed:!0,primary:!1},{key:"fullScreen",icon:"fullScreen",onClick:()=>t.toggleFullscreen(),pressed:!0,primary:!0},{key:"clippingPlanes",icon:"clippingPlanes",onClick:()=>t.toggleClippingPlanesPanel(),pressed:!0,primary:!1},{key:"resetCamera",icon:"resetCamera",onClick:()=>t.resetCamera(),primary:!1},{key:"hierarchy",icon:"hierarchy",onClick:()=>{},pressed:!0,primary:!1},{key:"projection",icon:"projection",onClick:()=>t.toggleCameraProjection(),pressed:!0,primary:!1},{key:"wireframe",icon:"wireframe",onClick:()=>t.toggleWireframeMode(),pressed:!0,primary:!1},{key:"statistics",icon:"statistics",onClick:()=>{},pressed:!1,primary:!1}];u.isLightweight&&!u.isLocalPreview||i.splice(i.length-1,0,{key:"loadingLogs",icon:"loadingLogs",onClick:()=>t.toggleLoadingLogs(),pressed:!0,primary:!1},{key:"download",icon:"download",onClick:()=>async function(e="model.glb"){if(!u.downloadModel)return;const t=await window.showSaveFilePicker({suggestedName:e}),n=await t.createWritable();await n.write(u.downloadModel),await n.close(),v("download","success")}(u.fileObject.filename),pressed:!0,primary:!1},{key:"preview",icon:"preview",onClick:()=>t.takeScreenshot(),primary:!1},{key:"save",icon:"save",onClick:()=>{},primary:!1}),t.editorToolbarButtons={},t.environmentMapPreset=t.environmentMapPreset||"neutral";const o=document.createElement("div");o.className="viewer-editor-toolbar_secondary-tray",t.editorToolbarSecondaryTray=o,i.forEach(i=>{const r=document.createElement("button");if(r.type="button",r.className="viewer-editor-tool",i.primary||r.classList.add("viewer-editor-tool-not-primary"),r.dataset.tool=i.key,r.dataset.pressed=i.pressed?"true":"false",r.dataset.primary=i.primary?"true":"false","materials"===i.key){const e=y("gui.materials","Materials");r.setAttribute("title",e),r.setAttribute("aria-label",e)}if(r.innerHTML=`\n <span class="viewer-editor-tool_icon" aria-hidden="true">${xi(i.icon)}</span>\n <span class="viewer-editor-tool_sr"></span>\n `,"moveToolbar"===i.key)Fi(r,t,n,ki(t));else if("clippingPlanes"===i.key){r.classList.add("has-submenu");const e=document.createElement("div");e.className="viewer-editor-tool_submenu";const n=[{key:"displayHelperX",icon:"displayHelperX",label:y("gui.displayHelperX","Show X helper"),onClick:()=>t.toggleClippingPlaneHelper("x")},{key:"displayHelperY",icon:"displayHelperY",label:y("gui.displayHelperY","Show Y helper"),onClick:()=>t.toggleClippingPlaneHelper("y")},{key:"displayHelperZ",icon:"displayHelperZ",label:y("gui.displayHelperZ","Show Z helper"),onClick:()=>t.toggleClippingPlaneHelper("z")},{key:"visible",icon:"visible",label:y("gui.visible","Visible"),onClick:()=>t.toggleClippingPlaneVisible()}];t.clippingPlaneSubmenuButtons={},n.forEach(n=>{const i=document.createElement("button");i.type="button",i.className="viewer-editor-tool viewer-editor-tool_submenu-button",i.dataset.tool=n.key,i.innerHTML=`\n <span class="viewer-editor-tool_icon" aria-hidden="true">${xi(n.icon)}</span>\n `,i.setAttribute("title",n.label),i.setAttribute("aria-label",n.label),t.bindEventListener(i,"click",e=>{e.stopPropagation(),n.onClick()}),e.appendChild(i),t.clippingPlaneSubmenuButtons[n.key]=i}),r.appendChild(e)}else if("annotate"===i.key){r.classList.add("has-submenu");const e=document.createElement("div");e.className="viewer-editor-tool_submenu";const n=[{key:"annotateAdd",icon:"annotateAdd",label:y("gui.annotateAdd","Add Annotation"),onClick:()=>t.openAnnotationDialogWithAutoPicking()},{key:"annotateImport",icon:"annotateImport",label:y("gui.annotateImport","Import Annotations"),onClick:()=>t.triggerAnnotationsXmlImport()},{key:"annotateExport",icon:"annotateExport",label:y("gui.annotateExport","Export Annotations"),onClick:()=>t.downloadAnnotationsXmlFile()},{key:"IIIFexport",icon:"IIIFexport",label:y("gui.IIIFexport","Export to IIIF"),onClick:()=>t.exportIIIFManifest()}];t.annotateSubmenuButtons={},n.forEach(n=>{const i=document.createElement("button");i.type="button",i.className="viewer-editor-tool viewer-editor-tool_submenu-button",i.dataset.tool=n.key,i.innerHTML=`\n <span class="viewer-editor-tool_icon" aria-hidden="true">${xi(n.icon)}</span>\n `,i.setAttribute("title",n.label),i.setAttribute("aria-label",n.label),t.bindEventListener(i,"click",e=>{e.stopPropagation(),n.onClick()}),e.appendChild(i),t.annotateSubmenuButtons[n.key]=i}),r.appendChild(e)}else if("materials"===i.key){r.classList.add("has-submenu");const e=document.createElement("div");e.className="viewer-editor-tool_submenu viewer-editor-tool_submenu-materials",t.materialsSubmenu=e,t.refreshMaterialsToolbarMenu(),r.appendChild(e)}else if("hierarchy"===i.key){r.classList.add("has-submenu");const e=document.createElement("div");e.className="viewer-editor-tool_submenu viewer-editor-hierarchy-submenu",t.hierarchySubmenu=e;const n=document.createElement("div");n.className="viewer-editor-hierarchy-submenu-list",t.hierarchySubmenuList=n;const i=document.createElement("button");i.type="button",i.className="viewer-editor-tool viewer-editor-tool_submenu-button viewer-editor-hierarchy-clear",t.bindEventListener(i,"click",e=>{e.stopPropagation(),t.clearHierarchySelection()}),t.hierarchyClearButton=i,t.hierarchySubmenuButtons={},e.appendChild(n),e.appendChild(i),r.appendChild(e)}else if("save"===i.key){r.classList.add("has-submenu");const e=document.createElement("div");e.className="viewer-editor-tool_submenu viewer-editor-save-submenu",t.bindEventListener(e,"click",e=>{e.stopPropagation()});const n=[{key:"Position",label:y("gui.position","Position")},{key:"Rotation",label:y("gui.rotation","Rotation")},{key:"Scale",label:y("gui.scale","Scale")},{key:"Camera",label:y("gui.camera","Camera")},{key:"DirectionalLight",label:y("gui.directionalLight","Directional Light")},{key:"AmbientLight",label:y("gui.ambientLight","Ambient Light")},{key:"CameraLight",label:y("gui.cameraLight","Camera Light")},{key:"BackgroundColor",label:y("gui.backgroundColor","Background Color")}];t.saveSubmenuCheckboxes={},n.forEach(n=>{const i=document.createElement("label");i.className="viewer-editor-save-option",i.setAttribute("title",n.label),i.setAttribute("aria-label",n.label);const o=document.createElement("input");o.type="checkbox",o.checked=Boolean(t.saveProperties[n.key]),o.dataset.property=n.key,t.bindEventListener(o,"click",e=>{e.stopPropagation()}),t.bindEventListener(o,"change",e=>{e.stopPropagation(),t.saveProperties[n.key]=e.target.checked});const r=document.createElement("span");r.className="viewer-editor-save-option_label",r.textContent=n.label,i.appendChild(o),i.appendChild(r),e.appendChild(i),t.saveSubmenuCheckboxes[n.key]={row:i,checkbox:o,text:r}});const i=document.createElement("div");i.className="viewer-editor-save-actions";const o=document.createElement("button");o.type="button",o.className="viewer-editor-save-apply",o.textContent=y("gui.saveSettings","Save settings"),t.bindEventListener(o,"click",e=>{e.stopPropagation(),t.saveEditorMetadata()}),t.saveSubmenuActionButton=o,i.appendChild(o),e.appendChild(i),r.appendChild(e)}else if("statistics"===i.key){r.classList.add("has-submenu");const e=document.createElement("div");e.className="viewer-editor-tool_submenu",t.statisticsSubmenuButtons={};const n=(e,i)=>{e.forEach(e=>{const o=document.createElement("button");o.type="button",o.className="viewer-editor-tool viewer-editor-tool_submenu-button",o.dataset.tool=e.key,o.setAttribute("title",e.label),o.setAttribute("aria-label",e.label),o.setAttribute("aria-pressed",e.pressed);const r=document.createElement("span");r.className="viewer-editor-tool_icon",r.setAttribute("aria-hidden","true"),r.innerHTML=xi(e.icon),o.appendChild(r);const a=document.createElement("span");if(a.className="viewer-editor-tool_sr",a.textContent=e.label,o.appendChild(a),e.onClick&&t.bindEventListener(o,"click",t=>{t.stopPropagation(),e.onClick()}),e.children){o.classList.add("has-submenu");const t=document.createElement("div");t.className="viewer-editor-tool_submenu",n(e.children,t),o.appendChild(t)}t.statisticsSubmenuButtons[e.key]=o,i.appendChild(o)})};n([{key:"toggleStats",icon:"statistics",label:y("gui.statistics","Statistics"),pressed:!1,onClick:()=>t.toggleStatsVisibility()},{key:"performance",icon:"performance",label:y("gui.performance","Performance"),children:[{key:"performanceDefault",icon:"statistics",label:y("gui.default","Default"),onClick:()=>t.setPerformanceMode("default"),pressed:!0},{key:"performanceHigh",icon:"performanceHigh",label:y("gui.highPerformance","High-performance"),onClick:()=>t.setPerformanceMode("high-performance"),pressed:!0},{key:"performanceLow",icon:"performanceLow",label:y("gui.lowPower","Low-power"),onClick:()=>t.setPerformanceMode("low-power"),pressed:!0}]}],e),r.appendChild(e)}else if("lights"===i.key){r.classList.add("has-submenu");const n=document.createElement("div");n.className="viewer-editor-tool_submenu",t.lightsSubmenuButtons={};const i=e=>"string"!=typeof e?"#ffffff":e.startsWith("0x")?`#${e.slice(2).padStart(6,"0")}`:e.startsWith("#")?e:`#${e}`,o=(e,n)=>{e.forEach(e=>{const r=document.createElement("button");r.type="button",r.className="viewer-editor-tool viewer-editor-tool_submenu-button ",r.dataset.tool=e.key,r.setAttribute("title",e.label),r.setAttribute("aria-label",e.label);const a=document.createElement("span");if(a.className="viewer-editor-tool_icon",a.setAttribute("aria-hidden","true"),a.innerHTML=e.iconHtml||xi(e.icon),r.appendChild(a),"color"===e.type){r.classList.add("viewer-editor-tool_submenu-control");const t=document.createElement("input");t.type="color",t.value=i(e.value()),t.className="viewer-editor-tool_submenu-input",t.addEventListener("click",e=>e.stopPropagation()),t.addEventListener("input",n=>{const o=n.target.value;e.onChange(o),t.value=i(o)}),r.appendChild(t)}else if("slider"===e.type){r.classList.add("viewer-editor-tool_submenu-control");const t=document.createElement("input");t.type="range",t.min=e.min??0,t.max=e.max??10,t.step=e.step??.01,t.value=String(e.value()),t.className="viewer-editor-tool_submenu-input",t.addEventListener("click",e=>e.stopPropagation()),t.addEventListener("input",t=>{const i=parseFloat(t.target.value);e.onChange(i),n.textContent=i.toFixed(2)});const n=document.createElement("span");n.className="viewer-editor-tool_submenu-value",n.textContent=Number(e.value()).toFixed(2),n.setAttribute("aria-hidden","true"),r.appendChild(t),r.appendChild(n)}else if("toggle"===e.type){r.classList.add("viewer-editor-tool_submenu-control","viewer-editor-tool_submenu-toggle"),r.setAttribute("type","button");const n=document.createElement("span");n.className="viewer-editor-tool_submenu-toggle-state";const i=()=>{const t=Boolean(e.value());n.textContent=t?y("gui.on","ON"):y("gui.off","OFF"),r.setAttribute("aria-pressed",t?"true":"false"),r.classList.toggle("is-active",t)};i(),t.bindEventListener(r,"click",async t=>{t.stopPropagation();const n=!Boolean(e.value());e.onChange&&await e.onChange(n),i()}),r.appendChild(n)}else e.onClick&&t.bindEventListener(r,"click",t=>{t.stopPropagation(),e.onClick()});if(e.children){r.classList.add("has-submenu");const t=document.createElement("div");t.className="viewer-editor-tool_submenu",o(e.children,t),r.appendChild(t)}("lightTargetTransformMove"===e.key||"lightTargetTransformTarget"===e.key||e.key.startsWith("environmentMap"))&&(t.lightsSubmenuButtons[e.key]=r),n.appendChild(r)})};o([{key:"environmentMap",icon:"environmentMap",label:y("gui.environmentMap","Environment map"),children:[{key:"environmentMapToggle",icon:"environmentMap",label:y("gui.environmentMapToggle","Environment map"),type:"toggle",value:()=>(u.scene?.environmentIntensity??0)>0,onChange:async e=>{u.scene&&(u.scene.traverse(e=>{(e?.material?Array.isArray(e.material)?e.material:[e.material]:[]).forEach(e=>{(e?.isMeshStandardMaterial||e?.isMeshPhysicalMaterial)&&(e.needsUpdate=!0)})}),t.updateEditorToolbarState())}},{key:"environmentMapIntensity",icon:"intensity",label:y("gui.intensity","Intensity"),type:"slider",min:0,max:1,step:.01,value:()=>u.environmentMapIntensity??.5,onChange:e=>{u.scene&&(u.scene.environmentIntensity=e,u.scene.traverse(e=>{(e?.material?Array.isArray(e.material)?e.material:[e.material]:[]).forEach(e=>{(e?.isMeshStandardMaterial||e?.isMeshPhysicalMaterial)&&(e.needsUpdate=!0)})}))}},{key:"environmentMapStyleNeutral",iconHtml:"🌥",label:y("gui.environmentMapNeutral","Neutral"),onClick:async()=>{await t.setEnvironmentMapPreset("neutral"),t.updateLightsSubmenuState()}},{key:"environmentMapStyleSunny",iconHtml:"☀️",label:y("gui.environmentMapSunny","Sunny"),onClick:async()=>{await t.setEnvironmentMapPreset("sunny"),t.updateLightsSubmenuState()}},{key:"environmentMapStyleStudio",iconHtml:"📸",label:y("gui.environmentMapStudio","Studio"),onClick:async()=>{await t.setEnvironmentMapPreset("studio"),t.updateLightsSubmenuState()}},{key:"environmentMapStyleGoldenHour",iconHtml:"🌅",label:y("gui.environmentMapGoldenHour","Golden Hour"),onClick:async()=>{await t.setEnvironmentMapPreset("goldenHour"),t.updateLightsSubmenuState()}}]},{key:"lightTarget",icon:"lightTarget",label:y("gui.target","Target"),children:[{key:"lightTargetColor",icon:"color",label:y("gui.color","Color"),type:"color",value:()=>t.colors.DirectionalLight,onChange:n=>{t.colors.DirectionalLight=n,u.lightObjects[0].color=new e.Color(n)}},{key:"lightTargetIntensity",icon:"intensity",label:y("gui.intensity","Intensity"),type:"slider",min:0,max:10,step:.01,value:()=>t.intensity.startIntensityDir,onChange:e=>{t.intensity.startIntensityDir=e,u.lightObjects[0].intensity=e}},{key:"lightTargetTransform",icon:"move",label:y("gui.transform","Transform"),children:[{key:"lightTargetTransformMove",icon:"move",label:y("gui.move","Move"),onClick:()=>t.toggleLightTransformMode("translate")},{key:"lightTargetTransformTarget",icon:"lightTarget",label:y("gui.target","Target"),onClick:()=>t.toggleLightTransformMode("rotate")}]}]},{key:"lightAmbient",icon:"ambientLight",label:y("gui.ambient","Ambient"),children:[{key:"lightAmbientColor",icon:"color",label:y("gui.color","Color"),type:"color",value:()=>t.colors.AmbientLight,onChange:n=>{t.colors.AmbientLight=n,t.ambientLight.color=new e.Color(n)}},{key:"lightAmbientIntensity",icon:"intensity",label:y("gui.intensity","Intensity"),type:"slider",min:0,max:10,step:.01,value:()=>t.intensity.startIntensityAmbient,onChange:e=>{t.intensity.startIntensityAmbient=e,t.ambientLight.intensity=e}}]},{key:"lightCamera",icon:"cameraLight",label:y("gui.camera","Camera"),children:[{key:"lightCameraColor",icon:"color",label:y("gui.color","Color"),type:"color",value:()=>t.colors.CameraLight,onChange:n=>{t.colors.CameraLight=n,t.cameraLight.color=new e.Color(n)}},{key:"lightCameraIntensity",icon:"intensity",label:y("gui.intensity","Intensity"),type:"slider",min:0,max:10,step:.01,value:()=>t.intensity.startIntensityCamera,onChange:e=>{t.intensity.startIntensityCamera=e,t.cameraLight.intensity=e}}]}],n),r.appendChild(n)}else if("materials"===i.key){r.classList.add("has-submenu");const e=document.createElement("div");e.className="viewer-editor-tool_submenu viewer-editor-tool_submenu-materials";[{key:"materialColor",icon:"color",label:y("gui.color","Color"),onClick:()=>t.openMaterialsFolder()},{key:"materialIntensity",icon:"intensity",label:y("gui.intensity","Intensity"),onClick:()=>t.openMaterialsFolder()}].forEach(n=>{const i=document.createElement("button");i.type="button",i.className="viewer-editor-tool viewer-editor-tool_submenu-button",i.dataset.tool=n.key,i.innerHTML=`\n <span class="viewer-editor-tool_icon" aria-hidden="true">${xi(n.icon)}</span>\n `,i.setAttribute("title",n.label),i.setAttribute("aria-label",n.label),t.bindEventListener(i,"click",e=>{e.stopPropagation(),n.onClick()}),e.appendChild(i)}),r.appendChild(e)}else"download"===i.key&&(u.isLightweight&&!u.isLocalPreview||(r.href=u.downloadModel,r.target="_blank",r.rel="noopener noreferrer",r.download=u.fileObject.filename));t.bindEventListener(r,"click",()=>{t.stopHandMode(),i.onClick&&i.onClick()}),i.primary?n.appendChild(r):o.appendChild(r),t.editorToolbarButtons[i.key]=r,i.primary||t.editorSecondaryKeys.push(r)}),n.appendChild(o);const r=document.createElement("button");r.type="button",r.className="viewer-editor-tool viewer-editor-expand",r.innerHTML=`<span class="viewer-editor-tool_icon" aria-hidden="true">${xi("expand")}</span>`,r.dataset.primary="true",r.setAttribute("aria-expanded","false"),r.setAttribute("title",y("gui.expand","Expand toolbar")),r.setAttribute("aria-label",y("gui.expand","Expand toolbar")),t.bindEventListener(r,"click",()=>ji(t)),n.appendChild(r),t.editorToolbarButtons.expand=r,t.actionMenu&&(t.actionMenu.classList.add("viewer-action-menu_in-toolbar"),n.appendChild(t.actionMenu)),ki(t)?.appendChild(n),u.editorToolbar=n,u.editorToolbar.classList.add("editorToolbar-hidden"),u.editorToolbar.classList.add("collapsed"),t.updateFullscreenButtonIcon(),t.updateEditorToolbarLabels(),t.updateEditorToolbarState(),Ti(t),t.bindEventListener(window,"resize",()=>Ti(t))}function Di(e){if(!e.hierarchySubmenuButtons)return;const t=new Set((u.selectedObjects||[]).filter(e=>!0===e?.selected).map(e=>String(e.id)));Object.entries(e.hierarchySubmenuButtons).forEach(([e,n])=>{const i=t.has(String(e));n.classList.toggle("is-active",i),n.setAttribute("aria-pressed",i?"true":"false")}),e.hierarchyClearButton?.toggleAttribute("disabled",0===t.size)}function Ri(e){if(!e.statisticsSubmenuButtons)return;const t=void 0!==u.stats&&"hidden"!==u.stats?.dom?.style?.visibility;e.statisticsSubmenuButtons.toggleStats?.classList.toggle("is-active",t),e.statisticsSubmenuButtons.toggleStats?.setAttribute("aria-pressed",t?"true":"false");const n=u.renderer?.powerPreference||u.CONFIG.viewer?.performanceMode||"default";Object.entries({performanceHigh:"high-performance",performanceLow:"low-power",performanceDefault:"default"}).forEach(([t,i])=>{const o=n===i;e.statisticsSubmenuButtons[t]?.classList.toggle("is-active",o),e.statisticsSubmenuButtons[t]?.setAttribute("aria-pressed",o?"true":"false")})}function zi(e){if(!e.clippingPlaneSubmenuButtons)return;const t=u.planeParams?.clippingMode||{};e.clippingPlaneSubmenuButtons.displayHelperX?.classList.toggle("is-active",Boolean(t.x)),e.clippingPlaneSubmenuButtons.displayHelperY?.classList.toggle("is-active",Boolean(t.y)),e.clippingPlaneSubmenuButtons.displayHelperZ?.classList.toggle("is-active",Boolean(t.z)),e.clippingPlaneSubmenuButtons.visible?.classList.toggle("is-active",Boolean(u.planeParams?.outline?.visible))}function Bi(e){if(!e.lightsSubmenuButtons)return;const t=e.transformText["Transform Light"];e.lightsSubmenuButtons.environmentMap?.classList.toggle("is-active",!1!==e.environmentMapEnabled),e.lightsSubmenuButtons.environmentMap?.setAttribute("aria-pressed",!1!==e.environmentMapEnabled?"true":"false");const n=e.lightsSubmenuButtons.environmentMapToggle;if(n){const e=n.querySelector(".viewer-editor-tool_submenu-toggle-state"),t=(u.scene?.environmentIntensity??0)>0;e&&(e.textContent=t?y("gui.on","ON"):y("gui.off","OFF")),n.setAttribute("aria-pressed",t?"true":"false"),n.classList.toggle("is-active",t)}e.lightsSubmenuButtons.lightTargetTransformMove?.classList.toggle("is-active","translate"===t),e.lightsSubmenuButtons.lightTargetTransformTarget?.classList.toggle("is-active","rotate"===t);const i=e.environmentMapPreset||"neutral";Object.entries({environmentMapStyleNeutral:"neutral",environmentMapStyleSunny:"sunny",environmentMapStyleStudio:"studio",environmentMapStyleGoldenHour:"goldenHour"}).forEach(([t,n])=>{const o=i===n;e.lightsSubmenuButtons[t]?.classList.toggle("is-active",o),e.lightsSubmenuButtons[t]?.setAttribute("aria-pressed",o?"true":"false")})}var Ui=Uint8Array,Gi=Uint16Array,Hi=Int32Array,Vi=new Ui([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$i=new Ui([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Wi=new Ui([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xi=function(e,t){for(var n=new Gi(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var o=new Hi(n[30]);for(i=1;i<30;++i)for(var r=n[i];r<n[i+1];++r)o[r]=r-n[i]<<5|i;return{b:n,r:o}},Ki=Xi(Vi,2),Yi=Ki.b,Zi=Ki.r;Yi[28]=258,Zi[258]=28;for(var qi=Xi($i,0).b,Ji=new Gi(32768),Qi=0;Qi<32768;++Qi){var eo=(43690&Qi)>>1|(21845&Qi)<<1;eo=(61680&(eo=(52428&eo)>>2|(13107&eo)<<2))>>4|(3855&eo)<<4,Ji[Qi]=((65280&eo)>>8|(255&eo)<<8)>>1}var to=function(e,t,n){for(var i=e.length,o=0,r=new Gi(t);o<i;++o)e[o]&&++r[e[o]-1];var a,s=new Gi(t);for(o=1;o<t;++o)s[o]=s[o-1]+r[o-1]<<1;if(n){a=new Gi(1<<t);var l=15-t;for(o=0;o<i;++o)if(e[o])for(var c=o<<4|e[o],d=t-e[o],u=s[e[o]-1]++<<d,p=u|(1<<d)-1;u<=p;++u)a[Ji[u]>>l]=c}else for(a=new Gi(i),o=0;o<i;++o)e[o]&&(a[o]=Ji[s[e[o]-1]++]>>15-e[o]);return a},no=new Ui(288);for(Qi=0;Qi<144;++Qi)no[Qi]=8;for(Qi=144;Qi<256;++Qi)no[Qi]=9;for(Qi=256;Qi<280;++Qi)no[Qi]=7;for(Qi=280;Qi<288;++Qi)no[Qi]=8;var io=new Ui(32);for(Qi=0;Qi<32;++Qi)io[Qi]=5;var oo=to(no,9,1),ro=to(io,5,1),ao=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},so=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},lo=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},co=function(e){return(e+7)/8|0},uo=function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new Ui(e.subarray(t,n))},po=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ho=function(e,t,n){var i=new Error(t||po[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,ho),!n)throw i;return i},go=new Ui(0),mo=function(e,t){return e[t]|e[t+1]<<8},fo=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},bo=function(e,t){return fo(e,t)+4294967296*fo(e,t+4)};function yo(e,t){return function(e,t,n,i){var o=e.length,r=i?i.length:0;if(!o||t.f&&!t.l)return n||new Ui(0);var a=!n,s=a||2!=t.i;a&&(n=new Ui(3*o));var l=function(e){var t=n.length;if(e>t){var i=new Ui(Math.max(2*t,e));i.set(n),n=i}},c=t.f||0,d=t.p||0,u=t.b||0,p=t.l,h=t.d,g=t.m,m=t.n,f=8*o;do{if(!p){c=so(e,d,1);var b=so(e,d+1,3);if(d+=3,!b){var y=e[(_=co(d)+4)-4]|e[_-3]<<8,v=_+y;if(v>o){ho(0);break}s&&l(u+y),n.set(e.subarray(_,v),u),t.b=u+=y,t.p=d=8*v,t.f=c;continue}if(1==b)p=oo,h=ro,g=9,m=5;else if(2==b){var w=so(e,d,31)+257,E=so(e,d+10,15)+4,C=w+so(e,d+5,31)+1;d+=14;for(var M=new Ui(C),S=new Ui(19),I=0;I<E;++I)S[Wi[I]]=so(e,d+3*I,7);d+=3*E;var A=ao(S),L=(1<<A)-1,O=to(S,A,1);for(I=0;I<C;){var _,P=O[so(e,d,L)];if(d+=15&P,(_=P>>4)<16)M[I++]=_;else{var x=0,T=0;for(16==_?(T=3+so(e,d,3),d+=2,x=M[I-1]):17==_?(T=3+so(e,d,7),d+=3):18==_&&(T=11+so(e,d,127),d+=7);T--;)M[I++]=x}}var k=M.subarray(0,w),F=M.subarray(w);g=ao(k),m=ao(F),p=to(k,g,1),h=to(F,m,1)}else ho(1);if(d>f){ho(0);break}}s&&l(u+131072);for(var j=(1<<g)-1,N=(1<<m)-1,D=d;;D=d){var R=(x=p[lo(e,d)&j])>>4;if((d+=15&x)>f){ho(0);break}if(x||ho(2),R<256)n[u++]=R;else{if(256==R){D=d,p=null;break}var z=R-254;if(R>264){var B=Vi[I=R-257];z=so(e,d,(1<<B)-1)+Yi[I],d+=B}var U=h[lo(e,d)&N],G=U>>4;if(U||ho(3),d+=15&U,F=qi[G],G>3&&(B=$i[G],F+=lo(e,d)&(1<<B)-1,d+=B),d>f){ho(0);break}s&&l(u+131072);var H=u+z;if(u<F){var V=r-F,$=Math.min(F,H);for(V+u<0&&ho(3);u<$;++u)n[u]=i[V+u]}for(;u<H;++u)n[u]=n[u-F]}}t.l=p,t.p=D,t.b=u,t.f=c,p&&(c=1,t.m=g,t.d=h,t.n=m)}while(!c);return u!=n.length&&a?uo(n,0,u):n.subarray(0,u)}(e,{i:2},t&&t.out,t&&t.dictionary)}var vo="undefined"!=typeof TextDecoder&&new TextDecoder;try{vo.decode(go,{stream:!0})}catch(Te){}function wo(e,t){if(t){for(var n="",i=0;i<e.length;i+=16384)n+=String.fromCharCode.apply(null,e.subarray(i,i+16384));return n}if(vo)return vo.decode(e);var o=function(e){for(var t="",n=0;;){var i=e[n++],o=(i>127)+(i>223)+(i>239);if(n+o>e.length)return{s:t,r:uo(e,n-1)};o?3==o?(i=((15&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|i>>10,56320|1023&i)):t+=1&o?String.fromCharCode((31&i)<<6|63&e[n++]):String.fromCharCode((15&i)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(i)}}(e),r=o.s;return(n=o.r).length&&ho(8),r}var Eo=function(e,t){return t+30+mo(e,t+26)+mo(e,t+28)},Co=function(e,t,n){var i=mo(e,t+28),o=mo(e,t+30),r=wo(e.subarray(t+46,t+46+i),!(2048&mo(e,t+8))),a=t+46+i,s=Mo(e,a,o,n,fo(e,t+20),fo(e,t+24),fo(e,t+42)),l=s[0],c=s[1],d=s[2];return[mo(e,t+10),l,c,r,a+o+mo(e,t+32),d]},Mo=function(e,t,n,i,o,r,a){var s=4294967295==o,l=4294967295==r,c=4294967295==a,d=t+n;if(i&&s+l+c){for(;t+4<d;t+=4+mo(e,t+2))if(1==mo(e,t))return[s?bo(e,t+4+8*l):o,l?bo(e,t+4):r,c?bo(e,t+4+8*(l+s)):a,1];i<2&&ho(13)}return[o,r,a,0]};async function So(e){const t=e.name.split(".").pop().toLowerCase();!function(){if(!u.mainObject||0===u.mainObject.length)return;u.mainObject.forEach(e=>{u.scene.remove(e)}),u.mainObject=[]}();const n=URL.createObjectURL(e);u.fileObject.originalPath=n,u.fileObject.filename=n,u.fileObject.basename=e.name.substring(0,e.name.lastIndexOf(".")),u.fileObject.extension=t,u.fileObject.path="",u.fileObject.uri=n,u.fileObject.relativePath=n,Viewer._ext=t,p("fileObject",u.fileObject),u.autoPath="",await Viewer.mainLoadModel(),u.SANDBOX_MODE&&(Viewer.showSandboxGuiAfterModelLoad(),Viewer.dismissStatusNotice("sandbox-drop-model")),v("modelLoadedSimple","success")}let Io={};async function Ao(e){const t=await e.arrayBuffer(),n=function(e){for(var t={},n=e.length-22;101010256!=fo(e,n);--n)(!n||e.length-n>65558)&&ho(13);var i=mo(e,n+8);if(!i)return{};var o=fo(e,n+16),r=117853008==fo(e,n-20);if(r){var a=fo(e,n-12);(r=101075792==fo(e,a))&&(i=fo(e,a+32),o=fo(e,a+48))}for(var s=0;s<i;++s){var l=Co(e,o,r),c=l[0],d=l[1],u=l[2],p=l[3],h=l[4],g=l[5],m=Eo(e,g);o=h,c?8==c?t[p]=yo(e.subarray(m,m+d),{out:new Ui(u)}):ho(14,"unknown compression type "+c):t[p]=uo(e,m,m+d)}return t}(new Uint8Array(t)),i=[];return Object.entries(n).forEach(([e,t])=>{e.endsWith("/")||i.push(new File([t],e,{type:"application/octet-stream"}))}),i}function Lo(e){Object.values(Io).forEach(e=>{try{URL.revokeObjectURL(e)}catch(e){}}),Io={},e.forEach(e=>{const t=e.name.replace(/^\/+/,"");Io[t]=URL.createObjectURL(e)})}async function Oo(e){try{const t=e.name.split(".").pop().toLowerCase();let n=[];if("zip"!==t)throw new Error(`Unsupported archive type: ${t}`);if(n=await Ao(e),!n.length)throw new Error("Archive is empty");const i=function(e){const t=u.SUPPORTED_EXTENSIONS;for(const n of t){const t=e.find(e=>e.name.split(".").pop().toLowerCase()===n);if(t)return t}return null}(n);if(!i)throw new Error("No supported model file found in archive");Lo(n),await So(i)}catch(e){console.error(e),v("unsupportedFormat","error")}}const _o=!0===window.__E2E__;window.viewer={ready:!1,modelLoaded:!1,webglReady:!1,camera:null,scene:null,renderer:null,controls:null};const Po={CONFIG:null,PRESENTATION_MODE:!1,SANDBOX_MODE:!1,SUPPORTED_EXTENSIONS:["glb","gltf","obj","dae","fbx","ply","ifc","stl","xyz","json","3ds","pcd"],SUPPORTED_ARCHIVES:["zip","rar","tar","xz","gz"],camera:null,scene:null,activeScene:0,renderer:null,stats:null,controls:null,loader:null,ambientLight:null,dirLight:null,dirLightTarget:null,cameraLight:null,cameraLightTarget:null,dirLights:[],imported:null,mainObject:[],metadataContentTech:null,mainCanvas:null,distanceGeometry:new e.Vector3,metadataUrl:null,iiifConfigURL:{url:"https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_transform_scale_position.json",name:"Inbuilt"},testModelURL:"https://raw.githubusercontent.com/IIIF/3d/main/assets/astronaut/astronaut.glb",clock:null,FULLSCREEN:!1,mixer:null,cameraTween:null,targetTween:null,container:null,viewerWrapper:null,scrollTop:null,rect:null,fileObject:{originalPath:"",filename:"",basename:"",extension:"",path:"",uri:"",newExtension:"",relativePath:"",autopath:""},bottomLineGUI:null,loadedFile:null,fileElement:null,COPYRIGHTS:!1,EXIT_CODE:1,gridSize:null,noMTL:!1,canvasText:null,viewEntity:null,actionMenu:null,actionMenuToggle:null,actionMenuPanel:null,mainMenuButton:null,fullscreenMode:null,themeMode:null,languageMode:null,editorToolbar:null,editorToolbarButtons:{},isToolbarExpanded:!1,editorSecondaryKeys:[],downloadModel:null,embedConfiguratorPanel:null,embedConfigInputs:null,embedConfigPreviewFrame:null,embedMissingSourceNotified:!1,wireframeMode:!1,environmentMapEnabled:!0,environmentMapPreset:"neutral",environmentMapIntensity:.5,currentTheme:"dark",currentLanguage:"en",loadingLog:null,loadingLogMessageKeys:["loadingLog.loadingAssets","loadingLog.loadingModel","loadingLog.loadingTextures","loadingLog.preparingGeometry","loadingLog.settingUpLighting","loadingLog.settingUpMaterials","loadingLog.compilingShaders","loadingLog.fetchingMetadata","loadingLog.modelLoaded"],processingLoadingStepKeys:["processingSteps.preparingModel","processingSteps.convertingToTransmissionFormat","processingSteps.renderingThumbnails","processingSteps.savingEntity","processingSteps.finalizing3dModel","processingSteps.initializingViewer"],THEME_STORAGE_KEY:"manifesto-dark-mode",LANGUAGE_STORAGE_KEY:"viewer-language",I18N:b,GESTURE:{handPx:55,period:5.5,rotate:!1,active:!1,target:new e.Vector3,startTime:0,baseAngle:0,orbitAngle:e.MathUtils.degToRad(15),easeInTime:2.25},lastTime:null,originalMetadata:[],spinnerContainer:null,spinnerElement:null,loadingLog:null,guiContainer:null,noticeContainer:null,statusNotice:null,statusNoticeTimer:null,statusNoticeHideTimer:null,statusNoticeQueue:[],statusNoticeActive:!1,statusNoticeCurrent:null,pickingHint:null,clippingHint:null,metadataContainer:null,spinner:null,circle:null,lilGui:null,raycaster:new e.Raycaster,pointer:new e.Vector2,onUpPosition:new e.Vector2,onDownPosition:new e.Vector2,bottomOffsetFullscreen:0,geometry:new e.BoxGeometry(20,20,20),transformControl:null,transformControlLight:null,transformControlLightTarget:null,transformControlClippingPlaneX:null,transformControlClippingPlaneY:null,transformControlClippingPlaneZ:null,cameraCoords:null,helperObjects:[],lightObjects:[],lightHelper:null,lightHelperTarget:null,selectedObject:!1,selectedObjects:[],selectedFaces:[],annotationEntries:[],annotationDialog:null,annotationDialogHost:null,annotationDialogTitleInput:null,annotationDialogDescriptionInput:null,materialsDialog:null,materialsDialogSelect:null,materialsDialogInputs:null,materialsDialogPosition:null,materialsDialogDragging:!1,annotationTargetFaceKeys:[],annotationBatchGroupId:"",annotationPOIGroup:null,annotationPOIMarkers:[],annotationPOITooltip:null,annotationPOITooltipTitle:null,annotationPOITooltipTarget:null,annotationImportInput:null,pendingAnnotationsXml:"",pickingTexture:null,windowHalfX:null,windowHalfY:null,transformType:"",transformText:{"Transform 3D Object":"","Transform Light":"","Transform Mode":"local"},materialsPropertiesText:{"Edit material":""},materialsEditorObject:null,materialsList:[],selectedMaterialUuid:null,materialSelectionController:null,materialGuiControls:null,pickingStats:{"Selected faces":0},colors:{DirectionalLight:"0xFFFFFF",AmbientLight:"0x404040",CameraLight:"0xFFFFFF",BackgroundColor:"#FFFFFF",BackgroundColorOuter:"#999999"},materialProperties:{color:"0xFFFFFF",emissiveColor:"0x404040",emissive:1,metalness:0},intensity:{startIntensityDir:1,startIntensityAmbient:1,startIntensityCamera:1},saveProperties:{Position:!0,Rotation:!0,Scale:!0,Camera:!0,DirectionalLight:!0,AmbientLight:!0,CameraLight:!0,BackgroundColor:!0,BackgroundColorOuter:!0},backgroundType:{"Background Type":"gradient"},backgroundOuterFolder:null,pickingMode:!1,EDITOR:!1,RULER_MODE:!1,linePoints:[],gui:null,hierarchyFolder:null,GUILength:35,zoomImage:1,ZOOM_SPEED_IMAGE:.1,loadedFile:"",archiveType:"",planeParams:{planeX:{constantX:0,negated:!1,displayHelperX:!1},planeY:{constantY:0,negated:!1,displayHelperY:!1},planeZ:{constantZ:0,negated:!1,displayHelperZ:!1},outline:{visible:!1},clippingMode:{x:!1,y:!1,z:!1}},clippingPlanes:null,planeHelpers:[],clippingFolder:null,propertiesFolder:null,planeObjects:[],editorFolder:null,metadataFolder:null,materialsFolder:null,pickingModeController:null,distanceMeasurementController:null,clearSelectedFacesController:null,selectedFacesCountController:null,addAnnotationController:null,textMesh:null,textMeshDistance:null,ruler:[],rulerObject:null,lastPickedFace:{id:"",object:"",faceIndex:null,overlay:null},loadedTimes:0,_ext:"",DFG_ASSETS:"",isLightweight:!1,urlOptions:{model:null,id:null,theme:null,language:null,autoRotate:null,autoRotateSpeed:null,disableInteraction:!1,hideUi:!1,hideMetadata:!1,cameraPosition:null,cameraTarget:null,cameraFov:null,presentationMode:!1,sandboxMode:!1},keyboardStep:{rotate:e.MathUtils.degToRad(2.25),rotateFast:e.MathUtils.degToRad(6),panFactor:.04,zoomFactor:1.08},keyboardTweenDurationMs:150,lastKeyboardHintAt:0,keyboardHintCooldownMs:45e3,keyboardHintAfterFocusDelayMs:1800,lastWindowFocusAt:0,cleanupCallbacks:[],resizeObserver:null,i18nGui:{},showNotifications:!0,getE2EModelOverride(){if(!window.__E2E__)return null;return new URLSearchParams(window.location.search).get("e2eModel")||null},ensureE2EState:()=>window.__E2E__?(window.viewer&&!0===window.viewer.e2eMode?(window.viewer.errors??=[],window.viewer.toasts??=[]):window.viewer={e2eMode:!0,modelLoaded:!1,errors:[],toasts:[],get camera(){return u.camera},get scene(){return u.scene}},window.viewer):null,recordE2EError(e){if(!window.__E2E__)return;const t=this.ensureE2EState(),n=e instanceof Error?e.message:String(e);t.errors.push(n)},addCleanup(e){"function"==typeof e&&this.cleanupCallbacks.push(e)},bindEventListener(e,t,n,i){e&&"function"==typeof e.addEventListener&&(e.addEventListener(t,n,i),this.addCleanup(()=>e.removeEventListener(t,n,i)))},closeActionMenu(){this.actionMenuToggle&&(this.actionMenuToggle.checked=!1),this.languageModeDropdown&&(this.languageModeDropdown.hidden=!0),this.updateEditorToolbarState()},stopHandMode(){const e=u.GESTURE;e&&(e.rotate=!1,e.active=!1,e.baseAngle=null,e.target=null),u.handHint&&(u.handHint.hidden=!0,u.handHint.classList.remove("hand-drag-animate")),u.controls&&(u.controls.enabled=!0,u.controls.update?.())},getEditorToolbarIcon:e=>xi(e),toggleToolbarExpanded(){return ji(this)},syncEditorToolbarSecondaryTrayWidth(){return Ti(this)},getEditorToolbarHost(){return ki(this)},attachEditorToolbar(){return function(e){if(!u.editorToolbar||!u.container)return;"static"===getComputedStyle(u.container).position&&(u.container.style.position="relative");const t=ki(e);t&&u.editorToolbar.parentElement!==t&&t.appendChild(u.editorToolbar)}(this)},createEditorToolbar(){return Ni(this)},updateEditorToolbarLabels(){return function(e){if(!e.editorToolbarButtons)return;const t={moveToolbar:y("gui.moveToolbar","Move toolbar"),orbit:y("gui.orbit","Navigation mode"),move:y("gui.move","Move"),rotate:y("gui.rotate","Rotate"),scale:y("gui.scale","Scale"),lights:y("gui.lights","Lights"),picking:e.pickingMode?y("controls.disablePickingMode","Disable picking mode"):y("controls.enablePickingMode","Enable picking mode"),annotate:y("gui.addAnnotations","Add annotations"),ruler:e.RULER_MODE?y("controls.disableDistanceMeasurement","Disable distance measurement"):y("controls.enableDistanceMeasurement","Enable distance measurement"),resetCamera:y("gui.resetCameraPosition","Reset camera position"),preview:y("gui.renderPreview","Render preview"),save:y("gui.saveSettings","Save settings"),advancedEditor:e.isEditorAdvancedPanelVisible()?y("gui.hideAdvancedEditor","Hide advanced editor"):y("gui.showAdvancedEditor","Show advanced editor"),fullScreen:e.FULLSCREEN?y("fullscreen.exit","Exit fullscreen"):y("fullscreen.enter","Enter fullscreen"),clippingPlanes:e.clippingMode?y("gui.disableClippingPlanesMode","Disable clipping planes mode"):y("gui.enableClippingPlanesMode","Enable clipping planes mode"),projection:u.camera&&u.camera.isPerspectiveCamera?y("gui.orthographicProjection","Switch to orthographic projection"):y("gui.perspectiveProjection","Switch to perspective projection"),wireframe:e.wireframeMode?y("gui.disableWireframeMode","Disable wireframe mode"):y("gui.enableWireframeMode","Enable wireframe mode"),loadingLogs:e.showLoadingLogs?y("gui.hideLoadingLogs","Hide loading logs"):y("gui.showLoadingLogs","Show loading logs"),hierarchy:y("gui.hierarchy","Hierarchy"),materials:y("gui.materials","Materials"),statistics:y("gui.statistics","Statistics"),expand:e.isToolbarExpanded?y("gui.collapse","Collapse toolbar"):y("gui.expand","Expand toolbar"),download:y("gui.download","Download model")};if(Object.entries(e.editorToolbarButtons).forEach(([e,n])=>{const i=t[e]||e;n.setAttribute("title",i),n.setAttribute("aria-label",i);const o=n.querySelector(".viewer-editor-tool_sr");o&&(o.textContent=i)}),e.clippingPlaneSubmenuButtons){const t={displayHelperX:y("gui.displayHelperX","Show X helper"),displayHelperY:y("gui.displayHelperY","Show Y helper"),displayHelperZ:y("gui.displayHelperZ","Show Z helper"),visible:y("gui.visible","Visible")};Object.entries(e.clippingPlaneSubmenuButtons).forEach(([e,n])=>{const i=t[e]||e;n.setAttribute("title",i),n.setAttribute("aria-label",i)})}if(e.annotateSubmenuButtons){const t={annotateAdd:y("gui.addAnnotations","Add Annotation"),annotateImport:y("gui.importAnnotationsXml","Import Annotations"),annotateExport:y("gui.exportAnnotationsXml","Export Annotations"),IIIFexport:y("gui.IIIFexport","Export to IIIF")};Object.entries(e.annotateSubmenuButtons).forEach(([e,n])=>{const i=t[e]||e;n.setAttribute("title",i),n.setAttribute("aria-label",i)})}if(e.statisticsSubmenuButtons){const t={toggleStats:y("gui.statistics","Statistics"),performance:y("gui.performance","Performance"),performanceDefault:y("gui.default","Default"),performanceHigh:y("gui.highPerformance","High-performance"),performanceLow:y("gui.lowPower","Low-power")};Object.entries(e.statisticsSubmenuButtons).forEach(([e,n])=>{const i=t[e]||e;n.setAttribute("title",i),n.setAttribute("aria-label",i)})}if(e.lightsSubmenuButtons){const t={environmentMap:y("gui.environmentMap","Environment map"),lightTargetTransformMove:y("gui.move","Move"),lightTargetTransformTarget:y("gui.target","Target"),environmentMapToggle:y("gui.environmentMapToggle","Environment map"),environmentMapIntensity:y("gui.intensity","Intensity"),environmentMapStyleNeutral:y("gui.environmentMapNeutral","Neutral"),environmentMapStyleSunny:y("gui.environmentMapSunny","Sunny"),environmentMapStyleStudio:y("gui.environmentMapStudio","Studio"),environmentMapStyleGoldenHour:y("gui.environmentMapGoldenHour","Golden Hour")};Object.entries(e.lightsSubmenuButtons).forEach(([e,n])=>{const i=t[e]||e;n.setAttribute("title",i),n.setAttribute("aria-label",i)})}if(e.hierarchyClearButton){const t=y("gui.clearSelectedHierarchy","Clear selected objects");e.hierarchyClearButton.setAttribute("title",t),e.hierarchyClearButton.setAttribute("aria-label",t),e.hierarchyClearButton.textContent=t}if(e.saveSubmenuCheckboxes){const t={Position:y("gui.position","Position"),Rotation:y("gui.rotation","Rotation"),Scale:y("gui.scale","Scale"),Camera:y("gui.camera","Camera"),DirectionalLight:y("gui.directionalLight","Directional Light"),AmbientLight:y("gui.ambientLight","Ambient Light"),CameraLight:y("gui.cameraLight","Camera Light"),BackgroundColor:y("gui.backgroundColor","Background Color")};Object.entries(e.saveSubmenuCheckboxes).forEach(([n,i])=>{const o=t[n]||n;i.row.setAttribute("title",o),i.row.setAttribute("aria-label",o),i.text.textContent=o,i.checkbox.checked=Boolean(e.saveProperties[n])})}e.saveSubmenuActionButton&&(e.saveSubmenuActionButton.textContent=y("gui.saveSettings","Save settings")),u.editorToolbar?.setAttribute("aria-label",y("toolbar.editor","Editor tools")),e.editorToolbarButtons.expand?.setAttribute("aria-expanded",e.isToolbarExpanded?"true":"false")}(this)},isEditorAdvancedPanelVisible(){return!!this.editorFolder?.domElement&&"none"!==this.editorFolder.domElement.style.display},setEditorAdvancedPanelVisible(e){this.editorFolder&&(e?(u.guiContainer&&(u.guiContainer.hidden=!1),u.gui?.domElement?.style&&(u.gui.domElement.style.visibility="visible"),this.editorFolder.show?.()):this.editorFolder.hide?.(),this.updateEditorToolbarLabels(),this.updateEditorToolbarState())},toggleEditorAdvancedPanel(){this.setEditorAdvancedPanelVisible(!this.isEditorAdvancedPanelVisible())},toggleCameraProjection(){if(!u.camera)return;const e=!0===u.camera.isPerspectiveCamera;Po.setCameraProjection(e?"orthographic":"perspective")},updateOrthoFrustum(t,n,i){const o=u.controls?.target||new e.Vector3(0,0,0),r=u.camera.position.distanceTo(o),a=r*(n/i);t.left=-a/2,t.right=a/2,t.top=r/2,t.bottom=-r/2,t.updateProjectionMatrix()},setCameraProjection(t){if(!u.camera)return;if(t===(u.camera.isPerspectiveCamera?"perspective":"orthographic"))return;const n=u.CONFIG.viewer.canvasDimensions.x/u.CONFIG.viewer.canvasDimensions.y,i=u.controls?.target||new e.Vector3(0,0,0),o=u.camera.position.distanceTo(i);let r;if("orthographic"===t){const t=e.MathUtils.degToRad(u.camera.fov),i=2*o*Math.tan(t/2),a=i*n;r=new e.OrthographicCamera(-a/2,a/2,i/2,-i/2,.1,2e3),r.zoom=1}else r=new e.PerspectiveCamera(50,n,.1,2e3);r.position.copy(u.camera.position),r.quaternion.copy(u.camera.quaternion),r.up.copy(u.camera.up),r.updateProjectionMatrix(),u.camera=r,u.controls&&(u.controls.object=u.camera,u.controls.update()),this.updateCamera(),this.updateFullscreenButtonIcon(),this.updateEditorToolbarLabels(),this.updateEditorToolbarState()},updateCamera(){u.camera&&u.controls&&(u.controls.object=u.camera,u.controls.update())},toggleWireframeMode(){void 0!==u.scene&&(u.wireframeMode=!u.wireframeMode,u.scene.traverse(e=>{e.material&&(e.material.wireframe=u.wireframeMode,e.material.needsUpdate=!0,e.material.wireframeLinewidth=1)}),this.updateEditorToolbarLabels(),this.updateEditorToolbarState())},async setEnvironmentMapEnabled(e){this.environmentMapEnabled=!1!==e,p("environmentMapEnabled",this.environmentMapEnabled),await be(this.environmentMapEnabled),this.updateEditorToolbarState()},async setEnvironmentMapPreset(e){this.environmentMapPreset=e||"studio",p("environmentMapPreset",this.environmentMapPreset);(u.scene?.environmentIntensity??0)>0&&await be(!0,this.environmentMapPreset),this.updateEditorToolbarState()},async toggleEnvironmentMap(){await this.setEnvironmentMapEnabled(!this.environmentMapEnabled)},addHierarchySubmenuItem(e,t){if(!this.hierarchySubmenu)return;const n=document.createElement("button");n.type="button",n.className="viewer-editor-tool viewer-editor-tool_submenu-button viewer-editor-hierarchy-item",n.dataset.tool=`hierarchy-item-${t}`,n.innerHTML=`<span class="viewer-editor-tool_sr">${e}</span>`,n.setAttribute("title",e),n.setAttribute("aria-label",e);const i=document.createElement("span");i.className="viewer-editor-hierarchy-submenu-label",i.style.marginLeft="8px",i.style.marginRight="8px",i.textContent=e,i.style.maxWidth="120px",i.style.overflow="hidden",i.style.textOverflow="ellipsis",i.style.whiteSpace="nowrap",i.style.display="inline-block",n.appendChild(i),this.bindEventListener(n,"click",e=>{e.stopPropagation(),Po.selectObjectHierarchy(t,u.container)}),this.hierarchySubmenuList.appendChild(n),this.hierarchySubmenuButtons[t]=n,this.updateHierarchySubmenuState()},clearHierarchySubmenu(){this.hierarchySubmenuList&&(this.hierarchySubmenuList.innerHTML="",this.hierarchySubmenuButtons={},this.updateHierarchySubmenuState())},updateHierarchySubmenuState(){return Di(this)},clearHierarchySelection(){Array.isArray(u.selectedObjects)&&0!==u.selectedObjects.length?(u.selectedObjects.forEach(e=>{const t=u.scene?.getObjectById?.(e.id);t&&e?.originalMaterial&&(t.material=e.originalMaterial,t.material.needsUpdate=!0)}),u.selectedObjects.length=0,Po.updateHierarchySubmenuState()):Po.updateHierarchySubmenuState()},toggleStatsVisibility(){if(void 0===u.stats||!u.stats?.dom)return;const e="visible"!==u.stats.dom.style.visibility;u.stats.dom.style.visibility=e?"visible":"hidden",this.updateEditorToolbarState()},setPerformanceMode(e){void 0!==u.renderer&&(u.renderer.powerPreference=e),u.CONFIG.viewer||(u.CONFIG.viewer={}),u.CONFIG.viewer.performanceMode=e,this.updateEditorToolbarState()},updateStatisticsSubmenuState(){return Ri(this)},toggleMainMenu(){this.actionMenuToggle&&(this.actionMenuToggle.checked=!this.actionMenuToggle.checked,!this.actionMenuToggle.checked&&this.languageModeDropdown&&(this.languageModeDropdown.hidden=!0),this.updateEditorToolbarLabels(),this.updateEditorToolbarState())},setObjectTransformMode(e=""){const t=["translate","rotate","scale"].includes(e)?e:"";t&&!u.helperObjects?.[0]||(u.i18nGui.transformObjectController?.setValue?u.i18nGui.transformObjectController.setValue(t):this.transformText["Transform 3D Object"]=t,this.updateEditorToolbarState())},toggleObjectTransformMode(e=""){const t=this.transformText["Transform 3D Object"]===e?"":e;this.setObjectTransformMode(t)},setLightTransformMode(e=""){const t=["translate","rotate"].includes(e)?e:"";u.i18nGui.transformLightController?.setValue?u.i18nGui.transformLightController.setValue(t):this.transformText["Transform Light"]=t,this.updateEditorToolbarState()},toggleLightTransformMode(e=""){const t=this.transformText["Transform Light"]===e?"":e;this.setLightTransformMode(t)},openLightFolder(e){this.setEditorAdvancedPanelVisible(!0);const t=u.i18nGui?.[e];t?.open&&t.open()},togglePickingMode(){this.pickingMode=!this.pickingMode,v(this.pickingMode?"facePickingEnabled":"facePickingDisabled",{duration:1400}),this.pickingMode?(this.RULER_MODE=!1,this.updateDistanceMeasurementControllerLabel()):(this.restoreLastPickedFace(),this.clearSelectedFaces()),this.updatePickingModeControllerLabel(),this.updatePickingControlsVisibility(),this.updateEditorToolbarLabels(),this.updateEditorToolbarState()},toggleDistanceMeasurement(){this.RULER_MODE=!this.RULER_MODE,this.RULER_MODE?(v("distanceEnabled",{duration:2600}),v("distanceHint",{duration:5200})):v(this.RULER_MODE?"distanceModeEnabled":"distanceModeDisabled"),this.RULER_MODE?(this.pickingMode=!1,this.restoreLastPickedFace(),this.clearSelectedFaces(),this.updatePickingModeControllerLabel(),this.updatePickingControlsVisibility()):(this.ruler.forEach(e=>{u.scene.remove(e)}),this.rulerObject=new e.Object3D,this.ruler=[],this.linePoints=[]),this.updateDistanceMeasurementControllerLabel(),this.updateEditorToolbarLabels(),this.updateEditorToolbarState()},toggleClippingPlanesPanel(){this.clippingMode=!this.clippingMode,this.clippingMode?(v("facePickingEnabled",{duration:2600}),v("clippingPlanes",{duration:5200})):(v("facePickingDisabled"),u.planeHelpers?.length>=3&&u.planeHelpers.forEach(e=>{e&&(e.visible=!1)}),u.planeParams.clippingMode.x=!1,u.planeParams.clippingMode.y=!1,u.planeParams.clippingMode.z=!1,u.outlineClipping&&(u.outlineClipping.visible=!1),this.transformControlClippingPlaneX&&this.transformControlClippingPlaneX.detach(),this.transformControlClippingPlaneY&&this.transformControlClippingPlaneY.detach(),this.transformControlClippingPlaneZ&&this.transformControlClippingPlaneZ.detach()),this.updateClippingPlanesControllerLabel(),this.updateClippingPlanesControlsVisibility(),this.updateEditorToolbarLabels(),this.updateEditorToolbarState()},updateClippingPlanesControllerLabel(){u.i18nGui.clippingPlanesController?.name&&u.i18nGui.clippingPlanesController.name(this.clippingMode?y("controls.disableClippingPlanesMode","Disable clipping planes mode"):y("controls.enableClippingPlanesMode","Enable clipping planes mode"))},updateClippingPlanesControlsVisibility(){this.transformControlClippingPlaneX&&(this.transformControlClippingPlaneX.visible=this.clippingMode),this.transformControlClippingPlaneY&&(this.transformControlClippingPlaneY.visible=this.clippingMode),this.transformControlClippingPlaneZ&&(this.transformControlClippingPlaneZ.visible=this.clippingMode)},toggleClippingPlaneHelper(e){const t={x:0,y:1,z:2}[e],n=u.planeHelpers?.[t],i=this[`transformControlClippingPlane${e.toUpperCase()}`];if(!n)return;const o=!Boolean(u.planeParams.clippingMode?.[e]);u.planeParams.clippingMode[e]=n.visible=o,o?(i?.attach?.(n),u.planeParams.outline.visible&&(u.outlineClipping.visible=!0)):(i?.detach?.(),u.planeParams.clippingMode.x||u.planeParams.clippingMode.y||u.planeParams.clippingMode.z||u.planeParams.outline.visible||(u.outlineClipping.visible=!1)),v("clippingHelperToggle","info",{axis:e.toUpperCase(),state:o}),this.refreshClippingHintVisibility(),this.updateClippingPlanesSubmenuState()},toggleClippingPlaneVisible(){const e=!Boolean(u.planeParams.outline.visible);u.planeParams.outline.visible=e,u.outlineClipping&&(u.outlineClipping.visible=e),this.updateClippingPlanesSubmenuState()},refreshClippingHintVisibility(){const e=u.planeParams?.clippingMode||{};this.clippingHint&&(this.clippingHint.hidden=!(e.x||e.y||e.z))},updateClippingPlanesSubmenuState(){return zi(this)},updateAnnotateSubmenuState(){this.annotateSubmenuButtons},updateLightsSubmenuState(){return Bi(this)},async saveEditorMetadata(){return async function(t){if(!u.EDITOR||u.isLightweight||!u.helperObjects?.[0])return;const n=new e.Vector3(e.MathUtils.radToDeg(u.helperObjects[0].rotation.x),e.MathUtils.radToDeg(u.helperObjects[0].rotation.y),e.MathUtils.radToDeg(u.helperObjects[0].rotation.z));void 0!==u.CONFIG.entity.proxyPath&&(u.CONFIG.metadataUrl=u.getProxyPath(u.CONFIG.metadataUrl));let i={};try{if(u.CONFIG?.metadataUrl){const e=await fetch(u.CONFIG.metadataUrl,{cache:"no-cache"});e.ok&&(i=await e.json())}}catch(e){console.warn("Metadata fetch failed, continuing with save",e)}t.originalMetadata={...t.originalMetadata,...i};const o=K(t,n);try{const e=await fetch("/session/token").then(e=>e.text());await fetch(u.CONFIG.mainUrl+"/api/editor/save-metadata",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-CSRF-Token":e},body:JSON.stringify({filename:u.fileObject.filename,path:""!==t.archiveType?u.fileObject.relativePath+u.fileObject.basename+u.loadedFile:u.fileObject.relativePath,content:JSON.stringify(o,null,"\t")})}),v("settingsSaved","success")}catch(e){console.error(e),v("settingsSaveError","error")}}(this)},updateEditorToolbarState(){return function(e){if(!e.editorToolbarButtons)return;const t={moveToolbar:"translate"===e.transformText["Transform 3D Object"]||"rotate"===e.transformText["Transform 3D Object"]||"scale"===e.transformText["Transform 3D Object"],orbit:""===e.transformText["Transform 3D Object"],move:"translate"===e.transformText["Transform 3D Object"],rotate:"rotate"===e.transformText["Transform 3D Object"],scale:"scale"===e.transformText["Transform 3D Object"],picking:!0===e.pickingMode,ruler:!0===e.RULER_MODE,clippingPlanes:!0===e.clippingMode,advancedEditor:e.isEditorAdvancedPanelVisible(),fullScreen:!0===e.FULLSCREEN,loadingLogs:!0===e.showLoadingLogs,wireframe:!0===e.wireframeMode,download:!1};Object.entries(e.editorToolbarButtons).forEach(([e,n])=>{const i=!0===t[e];n.classList.toggle("is-active",i),"true"===n.dataset.pressed?n.setAttribute("aria-pressed",i?"true":"false"):n.removeAttribute("aria-pressed")}),Di(e),zi(e),Bi(e),Ri(e)}(this)},tFormat(e,t={},n=""){const i=y(e,n);return String(i).replace(/\{(\w+)\}/g,(e,n)=>{const i=t?.[n];return null==i?"":String(i)})},parseBooleanParam(e){if(null==e)return null;const t=String(e).trim().toLowerCase();return!!["1","true","yes","on"].includes(t)||!["0","false","no","off"].includes(t)&&null},parseFloatParam(e){if(null==e||""===e)return null;const t=Number.parseFloat(String(e));return Number.isFinite(t)?t:null},parseVector2Param(t){if(null==t||""===t)return null;const n=String(t).replace(/[\[\]()]/g," ").trim().split(/[\s,;|]+/).filter(Boolean);if(2!==n.length)return null;const i=Number.parseFloat(n[0]),o=Number.parseFloat(n[1]);return Number.isFinite(i)&&Number.isFinite(o)?new e.Vector2(i,o):null},parseVector3Param(t){if(null==t||""===t)return null;const n=String(t).replace(/[\[\]()]/g," ").trim().split(/[\s,;|]+/).filter(Boolean);if(3!==n.length)return null;const i=Number.parseFloat(n[0]),o=Number.parseFloat(n[1]),r=Number.parseFloat(n[2]);return Number.isFinite(i)&&Number.isFinite(o)&&Number.isFinite(r)?new e.Vector3(i,o,r):null},formatVector3Param(e){if(!e||"object"!=typeof e)return null;const t=Number(e.x),n=Number(e.y),i=Number(e.z);return Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(i)?`${t.toFixed(4)},${n.toFixed(4)},${i.toFixed(4)}`:null},parseUrlOptions(){const e=new URLSearchParams(window.location.search),t=e.get("model")||e.get("src"),n=(e.get("theme")||"").trim().toLowerCase(),i=this.normalizeLanguage(e.get("lang")||e.get("language")),o=this.parseBooleanParam(e.get("autorotate")),r=this.parseBooleanParam(e.get("disableInteraction")),a=this.parseBooleanParam(e.get("hideUi")),s=this.parseBooleanParam(e.get("hideMetadata")),l=this.parseBooleanParam(e.get("presentationMode")),c=this.parseBooleanParam(e.get("sandbox"));null!==l&&(u.PRESENTATION_MODE=l),null!==c&&(u.SANDBOX_MODE=c),this.urlOptions={model:t||null,id:e.get("id")||null,theme:"light"===n||"dark"===n?n:null,language:i,autoRotate:o,autoRotateSpeed:this.parseFloatParam(e.get("autorotateSpeed")),disableInteraction:!0===r,hideUi:!0===a,hideMetadata:!0===s,cameraPosition:this.parseVector3Param(e.get("camPos")||e.get("cameraPos")),cameraTarget:this.parseVector3Param(e.get("camTarget")||e.get("cameraTarget")),cameraFov:this.parseFloatParam(e.get("fov")),presentationMode:!0===u.PRESENTATION_MODE,sandboxMode:!0===u.SANDBOX_MODE,scale:this.parseVector2Param(e.get("scale"))??null,showNotifications:this.parseBooleanParam(e.get("showNotifications"))}},setGuiFolderTitle(e,t){e&&t&&("function"!=typeof e.title?(e.$title&&(e.$title.textContent=t),e._title=t):e.title(t))},refreshOptionController(e,t){if(!e||"function"!=typeof e.options)return;const n="function"==typeof e.getValue?e.getValue():void 0;e.options(t),void 0!==n&&"function"==typeof e.setValue&&e.setValue(n),"function"==typeof e.updateDisplay&&e.updateDisplay()},updatePickingModeControllerLabel(){this.pickingModeController?.name&&this.pickingModeController.name(this.pickingMode?y("controls.disablePickingMode","Disable picking mode"):y("controls.enablePickingMode","Enable picking mode"))},updateMaterialControllerLabel(){this.materialController?.name&&this.materialController.name(this.materialMode?y("controls.disableMaterialMode","Disable material mode"):y("controls.enableMaterialMode","Enable material mode"))},updateDistanceMeasurementControllerLabel(){this.distanceMeasurementController?.name&&this.distanceMeasurementController.name(this.RULER_MODE?y("controls.disableDistanceMeasurement","Disable distance measurement"):y("controls.enableDistanceMeasurement","Enable distance measurement"))},getDistanceMeasurementScaleMeters(){const e=Number(u.CONFIG?.viewer?.measurement?.modelUnitInMeters);return Number.isFinite(e)&&e>0?e:1},formatMeasuredDistance(e){const t=this.getDistanceMeasurementScaleMeters(),n=e*t;return Number.isFinite(n)?n>=1?{text:`${n.toFixed(2)} m`,meters:n,scaleMeters:t}:n>=.01?{text:`${(100*n).toFixed(1)} cm`,meters:n,scaleMeters:t}:{text:`${(1e3*n).toFixed(0)} mm`,meters:n,scaleMeters:t}:{text:"0 mm",meters:0,scaleMeters:t}},updateSelectedFacesControllerLabel(){this.selectedFacesCountController?.name&&this.selectedFacesCountController.name(y("controls.selectedFaces","Selected faces"))},updatePickingHintVisibility(){if(!this.pickingHint)return;const e=Array.isArray(this.selectedFaces)&&this.selectedFaces.length>0;this.pickingHint.hidden=!this.pickingMode||e,this.updateClippingHintVisibility()},updateClippingHintVisibility(){if(!this.clippingHint)return;const e=this.planeParams?.clippingMode||{},t=Boolean(e.x||e.y||e.z),n=Boolean(this.pickingHint&&!1===this.pickingHint.hidden);this.clippingHint.hidden=!t||n},updatePickingControlsVisibility(){const e=this.pickingMode?"show":"hide";this.clearSelectedFacesController?.[e]?.(),this.selectedFacesCountController?.[e]?.(),this.updateAddAnnotationControllerState(),this.updatePickingHintVisibility(),this.updateEditorToolbarLabels(),this.updateEditorToolbarState()},updateAddAnnotationControllerState(){this.addAnnotationController&&this.addAnnotationController.enable?.()},getKeyboardShortcutsText:()=>[y("shortcuts.mouse"),y("shortcuts.keyboard"),y("shortcuts.touch"),!0===u.CONFIG?.viewer?.enableDragAndDrop?y("shortcuts.dragAndDrop"):null].join("\n"),getSupportedFormatsText:()=>u.SUPPORTED_EXTENSIONS.map(e=>e.toUpperCase()).join(", "),getSupportedArchiveFormatsText:()=>u.SUPPORTED_ARCHIVES.map(e=>e.toUpperCase()).join(", "),updateDragAndDropHint(){this.dragAndDropHint&&(!0===u.CONFIG?.viewer?.enableDragAndDrop?(this.dragAndDropHint.textContent=y("shortcuts.dragAndDrop","You can also drag and drop a model file here to load it"),this.dragAndDropHint.hidden=!1):this.dragAndDropHint.hidden=!0)},maybeShowKeyboardHint(){try{if("1"!==window.localStorage.getItem("viewerHintSeen"))return}catch(e){}if("visible"!==document.visibilityState||!document.hasFocus())return;const e=Date.now();if(e-this.lastWindowFocusAt<this.keyboardHintAfterFocusDelayMs)return;if(this.pickingMode)return;const t=this.planeParams?.clippingMode||{};t.x||t.y||t.z||u.handHint?.hidden&&!u.GESTURE?.active&&(e-this.lastKeyboardHintAt<this.keyboardHintCooldownMs||(this.lastKeyboardHintAt=e,this.showStatusNotice(this.getKeyboardShortcutsText(),7400)))},isInteractiveTextInput:e=>!(!e||"function"!=typeof e.closest)&&Boolean(e.closest("input, textarea, select, [contenteditable='true'], [contenteditable='']")),isViewerKeyboardActive(e){if(this.isInteractiveTextInput(e?.target))return!1;if(!u.renderer?.domElement)return!1;const t=document.activeElement;return t===u.renderer.domElement||u.renderer.domElement.contains(t)},isPointerDirectlyOverCanvas(e){if(!u.renderer?.domElement||!e)return!1;const t=Number(e.clientX),n=Number(e.clientY);if(!Number.isFinite(t)||!Number.isFinite(n))return!1;const i=document.elementFromPoint(t,n);return!!i&&i===u.renderer.domElement},animateKeyboardCameraTo(e,n){if(!(u.camera&&u.controls&&e&&n))return;const i=u.camera.position.clone(),o=u.controls.target.clone(),r=e.clone(),a=n.clone(),s=this.keyboardTweenDurationMs;u.cameraTween?.stop?.(),u.targetTween?.stop?.(),u.cameraTween=new t.Tween(i).to(r,s).easing(t.Easing.Quadratic.Out).onUpdate(()=>{u.camera.position.copy(i),u.cameraLight?.position.copy(i),u.camera.updateProjectionMatrix()}).onComplete(()=>{u.camera.position.copy(r),u.cameraLight?.position.copy(r),u.camera.updateProjectionMatrix()}),u.targetTween=new t.Tween(o).to(a,s).easing(t.Easing.Quadratic.Out).onUpdate(()=>{u.controls.target.copy(o),u.controls.update()}).onComplete(()=>{u.controls.target.copy(a),u.controls.update()}),u.cameraTween.start(),u.targetTween.start()},rotateCameraByKeyboard(t=0,n=0){if(!u.camera||!u.controls)return;const i=u.controls.target.clone(),o=u.camera.position.clone().sub(i);if(0===o.lengthSq())return;const r=(new e.Spherical).setFromVector3(o),a=Math.PI-.05;r.theta+=t,r.phi=e.MathUtils.clamp(r.phi+n,.05,a),o.setFromSpherical(r);const s=i.clone().add(o);this.animateKeyboardCameraTo(s,i)},panCameraByKeyboard(t=0,n=0){if(!u.camera||!u.controls)return;const i=(u.camera.position.distanceTo(u.controls.target)||1)*this.keyboardStep.panFactor,o=u.controls.target.clone().sub(u.camera.position).normalize(),r=(new e.Vector3).crossVectors(o,u.camera.up).normalize(),a=u.camera.up.clone().normalize(),s=r.multiplyScalar(t*i).add(a.multiplyScalar(n*i)),l=u.camera.position.clone().add(s),c=u.controls.target.clone().add(s);this.animateKeyboardCameraTo(l,c)},zoomCameraByKeyboard(e=!0){if(!u.camera||!u.controls)return;const t=e?1/this.keyboardStep.zoomFactor:this.keyboardStep.zoomFactor,n=u.camera.position.clone().sub(u.controls.target);let i=n.length()*t;if(Number.isFinite(u.controls.minDistance)&&(i=Math.max(u.controls.minDistance,i)),Number.isFinite(u.controls.maxDistance)&&u.controls.maxDistance>0&&(i=Math.min(u.controls.maxDistance,i)),i<=0)return;n.setLength(i);const o=u.controls.target.clone(),r=o.clone().add(n);this.animateKeyboardCameraTo(r,o)},toggleAutoRotateByKeyboard(){u.controls&&(u.controls.autoRotate=!u.controls.autoRotate,this.showStatusNotice(u.controls.autoRotate?"Auto-rotate enabled":"Auto-rotate disabled",1400),this.updateEmbedConfiguratorPreview())},onViewerKeyDown(e){if(!Po.isViewerKeyboardActive(e))return;const t=e.shiftKey?Po.keyboardStep.rotateFast:Po.keyboardStep.rotate,n=e.ctrlKey||e.metaKey;let i=!1;switch(e.key){case"ArrowLeft":n?Po.panCameraByKeyboard(-1,0):Po.rotateCameraByKeyboard(-t,0),i=!0;break;case"ArrowRight":n?Po.panCameraByKeyboard(1,0):Po.rotateCameraByKeyboard(t,0),i=!0;break;case"ArrowUp":n?Po.panCameraByKeyboard(0,1):Po.rotateCameraByKeyboard(0,-t),i=!0;break;case"ArrowDown":n?Po.panCameraByKeyboard(0,-1):Po.rotateCameraByKeyboard(0,t),i=!0;break;case"+":case"=":Po.zoomCameraByKeyboard(!0),i=!0;break;case"-":case"_":Po.zoomCameraByKeyboard(!1),i=!0;break;case" ":case"Spacebar":Po.toggleAutoRotateByKeyboard(),i=!0}i&&(Po.maybeShowKeyboardHint(),e.preventDefault(),e.stopPropagation())},updateFullscreenButtonIcon(){u.editorToolbar&&(Po.FULLSCREEN?u.editorToolbar.classList.add("with-fullscreen"):u.editorToolbar.classList.remove("with-fullscreen"))},cleanupRuntimeBindings(){for(;this.cleanupCallbacks.length>0;){const e=this.cleanupCallbacks.pop();try{e()}catch(e){console.warn("Viewer cleanup callback failed:",e)}}this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},cleanupTransientUI(){const e=document.getElementById("form-manifesto");e&&e.remove()},reportError:(e,t={})=>E(e,{consoleLabel:"Viewer error:",...t}),disposeMaterial(e){if(!e)return;(Array.isArray(e)?e:[e]).forEach(e=>{e&&"object"==typeof e&&(Object.values(e).forEach(e=>{e&&"object"==typeof e&&!0===e.isTexture&&e.dispose()}),e.dispose?.())})},disposeObjectResources(e){if(!e)return;Array.isArray(e)?e.forEach(e=>Po.disposeObjectResources(e)):e.traverse?.(e=>{var t;(t=e)&&"object"==typeof t&&(t.geometry?.dispose?.(),Po.disposeMaterial(t.material))})},removeAndDisposeFromScene(e){e&&(Array.isArray(e)?e.forEach(e=>Po.removeAndDisposeFromScene(e)):(e.parent?e.parent.remove(e):u.scene?.remove?.(e),Po.disposeObjectResources(e)))},disposeFaceOverlay(e){e?.overlay&&(e.overlay.removeFromParent(),Po.disposeObjectResources(e.overlay))},resetLoadedModelState(){Po.restoreLastPickedFace(),Po.clearSelectedFaces(),Po.closeAnnotationDialog(),Po.annotationEntries.length=0,Po.pendingAnnotationsXml="",Po.clearAnnotationPOIs(),u.transformControl?.detach?.(),u.transformControlLight?.detach?.(),u.transformControlLightTarget?.detach?.(),Po.transformText["Transform 3D Object"]="",Po.transformText["Transform Light"]="",Po.pickingMode=!1,Po.RULER_MODE=!1,Po.updateEditorToolbarLabels(),Po.updateEditorToolbarState(),u.outlineClipping&&(Po.removeAndDisposeFromScene(u.outlineClipping),u.outlineClipping=null,p("outlineClipping",null)),Po.textMesh&&(Po.removeAndDisposeFromScene(Po.textMesh),Po.textMesh=null),Po.ruler?.length&&Po.ruler.forEach(e=>Po.removeAndDisposeFromScene(e)),Po.ruler=[],Po.rulerObject=null,Po.textMeshDistance=null,u.mainObject?.length&&(u.mainObject.forEach(e=>Po.removeAndDisposeFromScene(e)),u.mainObject.length=0),Array.isArray(u.helperObjects)&&(u.helperObjects.length=0),Array.isArray(u.selectedObjects)&&(u.selectedObjects.length=0),Array.isArray(Po.helperObjects)&&(Po.helperObjects.length=0),Array.isArray(Po.selectedObjects)&&(Po.selectedObjects.length=0),Array.isArray(Po.selectedFaces)&&(Po.selectedFaces.length=0),Po.updateSelectedFacesCount(),Po.lastPickedFace={id:"",object:"",faceIndex:null,overlay:null}},renderFatalError(e){this.reportError(e,{context:"Viewer initialization failed",toast:!1,consoleLabel:"Viewer initialization error:"});const t=this.container||document.getElementById(u.CONFIG?.viewer?.container||"DFG_3DViewer")||document.body;this.noticeContainer.style.bottom="50%",w(t?"toasts.missingFiles":"toasts.containerNotFound","error",{duration:5e3})},getDefaultConfig:()=>({mainUrl:"https://dfg-repository.wisski.cloud",baseNamespace:"https://dfg-repository.wisski.cloud",metadataUrl:"https://dfg-repository.wisski.cloud",baseModulePath:"/libraries/dfg-3dviewer/assets",entity:{bundle:"bd3d7baa74856d141bcff7b4193fa128",fieldDf:"field_df",exportViewer:"field_df",idUri:"/wisski/navigate/(.*)/view",viewEntityPath:"/wisski/navigate/",attributeId:"wisski_id",metadata:{source:"IIIF"}},viewer:{container:"DFG_3DViewer",fileUpload:"fbf95bddee5160d515b982b3fd2e05f7",fileName:"faa602a0be629324806aef22892cdbe5",imageGeneration:"f605dc6b727a1099b9e52b3ccbdf5673",presentationMode:"false",sandboxMode:"false",lightweight:0,scaleContainer:{x:.85,y:1.4},editor:!0,gallery:{build:!0,container:"block-bootstrap5-content",imageClass:"field--name-fd6a974b7120d422c7b21b5f1f2315d9",imageId:"",buildFake:!1,testImages:[]},background:"radial-gradient(circle, #ffffff 0%, #999999 100%)",performanceMode:{Performance:"high-performance"},measurement:{modelUnitInMeters:1}}}),resolveBundleAssetBasePath:e=>e.pathname.includes("/assets/")?new URL("../assets/",e).pathname.replace(/\/$/,""):new URL("./assets/",e).pathname.replace(/\/$/,""),async loadViewerConfig(e,t=null){if(t&&Object.keys(t).length>0)return t;const n="undefined"!=typeof window?window.drupalSettings?.dfg_3dviewer:null;if(n&&"object"==typeof n&&Object.keys(n).length>0){const{csrfToken:e,...t}=n;return e&&"undefined"!=typeof window&&(window.CSRF_TOKEN=e),console.log("Loaded viewer settings from drupalSettings",t.viewer),"undefined"!=typeof window&&window.__E2E__&&(window.viewer=window.viewer||{},window.viewer.configFromDrupal=!0,window.viewer.configBundle=t.entity?.bundle),t}const i=e.pathname.includes("/assets/")?"../viewer-settings.json":"./viewer-settings.json",o=new URL(i,e),r=await fetch(o,{cache:"no-store"});if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();return console.log("Loaded viewer-settings.json",a.viewer),a},async MainInit(n=null){window.__E2E__&&this.ensureE2EState(),this.cleanupRuntimeBindings(),this.cleanupTransientUI(),this.resetLoadedModelState(),await new Promise(e=>{"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)});const i=new URL(import.meta.url),o=this.resolveBundleAssetBasePath(i);p("viewEntity",this.viewEntity),p("CONFIG",this.CONFIG),p("loadedFile",this.loadedFile),p("stats",this.stats),p("guiContainer",this.guiContainer),p("lilGui",this.lilGui),p("gui",this.gui),p("i18nGui",this.i18nGui),p("SUPPORTED_EXTENSIONS",this.SUPPORTED_EXTENSIONS),p("SUPPORTED_ARCHIVES",this.SUPPORTED_ARCHIVES),p("enqueueStatusNotice",this.enqueueStatusNotice.bind(this)),p("dismissStatusNotice",this.dismissStatusNotice.bind(this)),p("updateClippingHintVisibility",this.updateClippingHintVisibility.bind(this)),p("editorToolbar",this.editorToolbar),p("wireframeMode",this.wireframeMode),p("DFG_ASSETS",o),u.CONFIG=await this.loadViewerConfig(i,n),0===Object.keys(u.CONFIG).length&&(u.CONFIG=this.getDefaultConfig()),u.CONFIG.entity??={},u.CONFIG.entity.metadata??={},u.CONFIG.viewer??={},u.CONFIG.viewer.gallery??={},u.CONFIG.viewer.scaleContainer??={x:1,y:1},this.isLightweight=Boolean(u.CONFIG.viewer.lightweight),p("isLightweight",this.isLightweight),this.EDITOR=Boolean(u.CONFIG.viewer.editor),p("EDITOR",this.EDITOR);const r=this.parseBooleanParam(u.CONFIG.viewer.presentationMode);this.PRESENTATION_MODE=r??Boolean(u.CONFIG.viewer.presentationMode),p("PRESENTATION_MODE",this.PRESENTATION_MODE);const a=this.parseBooleanParam(u.CONFIG.viewer.sandboxMode);if(this.SANDBOX_MODE=a??Boolean(u.CONFIG.viewer.sandboxMode),p("SANDBOX_MODE",this.SANDBOX_MODE),console.log("Presentation mode: "+(this.PRESENTATION_MODE?"ON":"OFF")),console.log("Sandbox mode: "+(this.SANDBOX_MODE?"ON":"OFF")),console.log(`AIM 3D-Viewer ${this.isLightweight?"🪶 LIGHTWEIGHT":"💪 FULL"} mode`),console.log(`Powered by Three.js (v${e.REVISION})`),u.CONFIG.entity.metadata.sourceType||(u.CONFIG.entity.metadata.sourceType="",console.log(`Metadata source: ${u.CONFIG.entity.metadata.sourceType}`)),this.container=document.getElementById(u.CONFIG.viewer.container),this.noticeContainer=document.createElement("div"),this.noticeContainer.id="viewerNoticeContainer",this.statusNotice=document.createElement("div"),this.statusNotice.id="viewerStatusNotice",this.statusNotice.className="viewer-notice viewer-notice-status",this.statusNotice.hidden=!0,this.statusNotice.setAttribute("role","status"),this.statusNotice.setAttribute("aria-live","polite"),this.noticeContainer.appendChild(this.statusNotice),p("statusNotice",this.statusNotice),this.statusNoticeQueue=[],this.statusNoticeActive=!1,this.statusNoticeTimer&&(clearTimeout(this.statusNoticeTimer),this.statusNoticeTimer=null),this.parseUrlOptions(),p("showNotifications",this.showNotifications),void 0!==this.urlOptions.showNotifications&&null!==this.urlOptions.showNotifications&&(u.showNotifications=this.urlOptions.showNotifications),!this.container)return document.body.appendChild(this.noticeContainer),this.noticeContainer.style.bottom="50%",void w("toasts.containerNotFound","error",{duration:5e3});p("container",this.container),document.body.classList.toggle("viewer-embed-page",this.isEmbedMode()),u.container?.appendChild(this.noticeContainer),p("noticeContainer",this.noticeContainer),console.log("Presentation mode: "+(u.PRESENTATION_MODE?"ON":"OFF")),console.log("Sandbox mode: "+(u.SANDBOX_MODE?"ON":"OFF")),this.currentLanguage=this.getStoredLanguage(),p("currentLanguage",this.currentLanguage),this.urlOptions.model&&this.container.setAttribute("3d",this.urlOptions.model),this.shouldIgnoreLegacyEmbedDefaultModel()&&this.container.removeAttribute("3d"),this.scrollTop=window.scrollY||document.documentElement.scrollTop,this.rect=u.container.getBoundingClientRect(),this.baseContainerRect={width:this.rect.width,height:this.rect.height};const s=this.getE2EModelOverride();s&&u.container.setAttribute("3d",s),this.fileObject.originalPath=this.normalizeFileUrl(u.container.getAttribute("3d")),p("fileObject",this.fileObject),void 0!==this.urlOptions.scale&&null!==this.urlOptions.scale&&(u.CONFIG.viewer.scaleContainer.x=this.urlOptions.scale.x,u.CONFIG.viewer.scaleContainer.y=this.urlOptions.scale.y),u.CONFIG.viewer.canvasDimensions={x:this.rect.width*Number(u.CONFIG.viewer.scaleContainer.x),y:this.rect.height*Number(u.CONFIG.viewer.scaleContainer.y)},this.bottomLineGUI=u.CONFIG.viewer.canvasDimensions.y-85,p("bottomLineGUI",this.bottomLineGUI),u.isLightweight&&(u.CONFIG.viewer.lightweight=u.container.getAttribute("proxy"));var l=window.location.pathname;null!==(l=l.match(u.CONFIG.entity.idUri))?u.CONFIG.entity.id=l[1]:this.urlOptions.id&&(u.CONFIG.entity.id=this.urlOptions.id),u.CONFIG.entity.id&&(u.container.setAttribute(u.CONFIG.entity.attributeId,u.CONFIG.entity.id),console.log("Entity ID:",u.CONFIG.entity.id)),this.core=(()=>{const t=[new e.Plane(new e.Vector3(-1,0,0),0),new e.Plane(new e.Vector3(0,-1,0),0),new e.Plane(new e.Vector3(0,0,-1),0)];return p("clippingPlanes",t),t})(),p("EXIT_CODE",this.EXIT_CODE),p("objectsConfig",Ve),p("outlineClipping",void 0),u.objectsConfig.setupIndex=u.objectsConfig.index=0,this.cameraTween=new t.Tween,p("cameraTween",this.cameraTween),this.targetTween=new t.Tween,p("targetTween",this.targetTween),u.container.classList.add("mainContainer"),u.container.hasAttribute("basePath")&&(u.CONFIG.baseModulePath=u.container.getAttribute("basePath")),this.setModelPaths(),u.CONFIG.viewer.exportPath="/api/editor/xml-export/",this.loadedFile=`${u.fileObject.basename}.${u.fileObject.extension}`,u.PRESENTATION_MODE||(this.handHint=document.createElement("div"),this.handHint.id="handHint",this.handHint.hidden=!0,u.container.appendChild(this.handHint),p("handHint",this.handHint),this.pickingHint=document.createElement("div"),this.pickingHint.id="pickingHint",this.pickingHint.className="viewer-notice viewer-notice-hint",this.pickingHint.textContent="Shift + click to select multiple faces",this.pickingHint.hidden=!0,this.noticeContainer.appendChild(this.pickingHint),p("pickingHint",this.pickingHint),this.clippingHint=document.createElement("div"),this.clippingHint.id="clippingHint",this.clippingHint.className="viewer-notice viewer-notice-hint",this.clippingHint.textContent="Drag active clipping plane helper to adjust cut",this.clippingHint.hidden=!0,this.noticeContainer.appendChild(this.clippingHint),p("clippingHint",this.clippingHint),u.guiContainer=document.createElement("div"),u.guiContainer.id="guiContainer",u.guiContainer.className="guiContainer",u.guiContainer.hidden=!0===u.SANDBOX_MODE,u.container.appendChild(u.guiContainer),u.gui=new He({container:u.guiContainer}),u.gui.domElement.style.visibility="hidden",this.metadataContainer=document.createElement("div"),this.metadataContainer.setAttribute("id","metadata-container"),this.metadataContainer.style.top=-this.metadataContainer.getBoundingClientRect().top+"px",this.urlOptions.hideMetadata&&(this.metadataContainer.style.display="none"),p("metadataContainer",this.metadataContainer),p("colors",this.colors),p("planeHelpers",this.planeHelpers),p("planeParams",this.planeParams),p("materialProperties",this.materialProperties),p("materialsPropertiesText",this.materialsPropertiesText),p("intensity",this.intensity),p("environmentMapEnabled",this.environmentMapEnabled),p("environmentMapIntensity",this.environmentMapIntensity),p("environmentMapPreset",this.environmentMapPreset),this.clippingPlanes=this.core,p("clippingPlanes",this.clippingPlanes),p("helperObjects",this.helperObjects),p("lightHelper",this.lightHelper),p("selectedObjects",this.selectedObjects),u.showNotifications=!0),this.spinnerContainer=document.createElement("div"),this.spinnerContainer.id="spinnerContainer",this.spinnerElement=document.createElement("div"),this.spinnerElement.id="spinner",this.spinnerContainer.appendChild(this.spinnerElement),u.container.appendChild(this.spinnerContainer),this.circle=this.createModelLoadingProgress(this.spinnerElement),p("circle",this.circle),u.PRESENTATION_MODE||(this.loadingLog=this.createLoadingLog(),p("loadingLog",this.loadingLog)),this.rect=u.container.getBoundingClientRect(),this.clock=new e.Timer,Po.init(),u.PRESENTATION_MODE||Po.prepareStats(),localStorage.setItem("viewerHintSeen","0"),this.updateSize(),Po.animate()},normalizeDrupalFilesPath:e=>e&&"string"==typeof e?e.replace(/^https?:\/{1,2}[^/]+\/?/,"").replace(/^public:\/\//,"").replace(/^\/?sites\/default\/files\/?/,"").replace(/\/+/g,"/").replace(/\/$/,""):"",normalizeArchiveModelPath(e){if(!e||"string"!=typeof e)return"";const t=e=>!/\/[^/]+_(ZIP|RAR|TAR|XZ|GZ)\//i.test(e)||/\/gltf\//i.test(e)?e:e.replace(/^(.*\/[^/]+_(ZIP|RAR|TAR|XZ|GZ))(\/?)(.*)$/i,"$1/gltf/$4");if(/^[a-zA-Z][\w+-.]*:\/\//.test(e))try{const n=new URL(e);return n.pathname=t(n.pathname),n.href}catch(n){return t(e)}return t(e)},setModelPaths(){if(!u.fileObject.originalPath)return u.fileObject.filename="",u.fileObject.basename="",u.fileObject.extension="",u.fileObject.path="",u.fileObject.uri="",void(u.fileObject.relativePath="");u.fileObject.filename=u.fileObject.originalPath.split("/").pop(),u.fileObject.basename=u.fileObject.filename.substring(0,u.fileObject.filename.lastIndexOf(".")),u.fileObject.extension=u.fileObject.filename.substring(u.fileObject.filename.lastIndexOf(".")+1),u.fileObject.path=u.fileObject.originalPath.substring(0,u.fileObject.originalPath.lastIndexOf(u.fileObject.filename))||"/",u.fileObject.uri=u.fileObject.path.replace(u.CONFIG.mainUrl+"/",""),u.fileObject.relativePath=Po.normalizeDrupalFilesPath(u.fileObject.uri)},disableInteractionHint(){u.PRESENTATION_MODE||(u.handHint.hidden=!0,Po.stopGesture(),u.cameraTween&&"function"==typeof u.cameraTween.stop&&(u.cameraTween.stop(),u.cameraTween=null),u.targetTween&&"function"==typeof u.targetTween.stop&&(u.targetTween.stop(),u.targetTween=null),localStorage.setItem("viewerHintSeen","1"))},addTextWatermark(t,n){var i=[new e.MeshStandardMaterial({color:16777215,flatShading:!0,side:e.DoubleSide,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.4}),new e.MeshStandardMaterial({color:16777215,flatShading:!0,side:e.DoubleSide,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.4})];(new c).load(`${u.DFG_ASSETS}/fonts/helvetiker_regular.typeface.json`,function(o){const r=new d(t,{font:o,size:3*n,height:n/10,curveSegments:5,bevelEnabled:!0,bevelThickness:n/8,bevelSize:n/10,bevelOffset:0,bevelSegments:1});r.computeBoundingBox(),Po.textMesh=new e.Mesh(r,i),Po.textMesh.rotation.z=Math.PI,Po.textMesh.rotation.y=Math.PI,Po.textMesh.position.x=0,Po.textMesh.position.y=0,Po.textMesh.position.z=0,Po.textMesh.renderOrder=1,u.scene.add(Po.textMesh)})},addTextPoint(t,n,i){const o=new c,r=n/10;o.load(`${u.DFG_ASSETS}/fonts/helvetiker_regular.typeface.json`,o=>{const a=new d(t,{font:o,size:3*n,height:n,curveSegments:4,bevelEnabled:!0,bevelThickness:r,bevelSize:r/10,bevelOffset:0,bevelSegments:1,depth:n/10});a.computeBoundingBox();const s=new e.Vector3;a.boundingBox.getCenter(s).negate(),a.translate(s.x,s.y,s.z);const l=a.clone();l.scale(1.05,1.08,1.05);const c=new e.MeshBasicMaterial({color:0,transparent:!0,opacity:.9,depthTest:!1,depthWrite:!1}),u=new e.MeshBasicMaterial({color:16777215,transparent:!0,opacity:1,depthTest:!1,depthWrite:!1}),p=new e.Mesh(l,c);p.position.z=.02*-n;const h=new e.Mesh(a,u),g=new e.Group;g.add(p),g.add(h),g.position.set(i.x,i.y,i.z),g.renderOrder=999,g.userData.isDistanceLabel=!0,Po.rulerObject.add(g)})},selectObjectHierarchy(e){let t=!0;for(let n=0;n<u.selectedObjects.length&&!0===t;n++)u.selectedObjects[n].id===e&&(t=!1,!0===u.selectedObjects[n].selected&&(u.scene.getObjectById(e).material=u.selectedObjects[n].originalMaterial,u.scene.getObjectById(e).material.needsUpdate=!0,u.selectedObjects[n].selected=!1,u.selectedObjects.splice(u.selectedObjects.indexOf(u.selectedObjects[n]),1)));if(t){u.selectedObjects.push({id:e,selected:!0,originalMaterial:u.scene.getObjectById(e).material.clone()});const t=u.scene.getObjectById(e).material.clone(),n=Po.toThreeColor("0x00FF00");n&&(t.color=n),u.scene.getObjectById(e).material=t,u.scene.getObjectById(e).material.needsUpdate=!0}Po.updateHierarchySubmenuState()},recreateBoundingBox(t){var n=new e.Vector3,i=new e.Vector3;if(t instanceof e.Object3D){t.traverse(function(t){if(t instanceof e.Mesh){t.geometry.computeBoundingBox();var o=t.geometry.boundingBox;n.x=Math.min(n.x,o.min.x+t.position.x),n.y=Math.min(n.y,o.min.y+t.position.y),n.z=Math.min(n.z,o.min.z+t.position.z),i.x=Math.max(i.x,o.max.x+t.position.x),i.y=Math.max(i.y,o.max.y+t.position.y),i.z=Math.max(i.z,o.max.z+t.position.z)}});var o=new e.Vector3(n.x,n.y,n.z),r=new e.Vector3(i.x,i.y,i.z),a=new e.Box3(o,r);t.position.set((a.min.x+a.max.x)/2,a.min.y,(a.min.z+a.max.z)/2)}return t},normalizeFileUrl(e){if(!e||"string"!=typeof e)return"";let t=e.trim();if(""===t)return"";/^\/[a-z][\w+.-]*:\/\//i.test(t)&&(t=t.replace(/^\/+/,"")),t.startsWith("public://")?t="/sites/default/files/"+t.substring(9):t.startsWith("sites/default/files/")&&(t="/"+t);const n=(u.CONFIG?.mainUrl||window.location.origin||"").replace(/\/+$/,"");try{const e=new URL(t,window.location.origin),i=(e.host||"").toLowerCase(),o=e.pathname||"",r="default"===i||"dfg_3dviewer"===i||i.includes("_");return o.startsWith("/sites/default/files/")?r?`${n}${o}`:"http:"===e.protocol||"https:"===e.protocol?e.href:`${n}${o}`:e.href}catch(e){return t.startsWith("/sites/default/files/")?`${n}${t}`:t}},shouldIgnoreLegacyEmbedDefaultModel(){if(!this.isEmbedMode())return!1;if(this.urlOptions?.model||this.urlOptions?.id)return!1;if(!String(u.CONFIG?.entity?.metadata?.sourceType||"").toLowerCase().startsWith("drupal"))return!1;const e=String(this.container?.getAttribute("3d")||"").trim();return!!e&&/^(?:\.{1,2}\/)?examples\/box\.stl(?:\?.*)?$/i.test(e)},buildGallery(){return $(this)},toHexColor(e){if(!e)return null;if("function"==typeof e.getHex)return e.getHex();if("number"==typeof e)return e>>>0;if("string"==typeof e){const t=e.replace("#","");return/^[0-9a-fA-F]{6}$/.test(t)?parseInt(t,16):null}if(Array.isArray(e)){const[t,n,i]=e;if([t,n,i].every(e=>"number"==typeof e)){return(255&(t<=1?Math.round(255*t):t))<<16|(255&(n<=1?Math.round(255*n):n))<<8|255&(i<=1?Math.round(255*i):i)}return null}if("object"==typeof e&&"r"in e&&"g"in e&&"b"in e){return(255&(e.r<=1?Math.round(255*e.r):e.r))<<16|(255&(e.g<=1?Math.round(255*e.g):e.g))<<8|255&(e.b<=1?Math.round(255*e.b):e.b)}return null},toThreeColor(t){const n=m(t);return n?new e.Color(n.r/255,n.g/255,n.b/255):null},updateSize(){const e=!!document.fullscreenElement;if(Po.FULLSCREEN=e,!Po.mainCanvas||!Po.fullscreenMode||!u.guiContainer)return;let t,n,i={x:1,y:1};const o=Po.viewerWrapper||u.container;if(!o)return;if(e)t=window.innerWidth,n=window.innerHeight;else{i={x:Number(u.CONFIG.viewer.scaleContainer?.x||1),y:Number(u.CONFIG.viewer.scaleContainer?.y||1)};const e=o.getBoundingClientRect();t=e.width||800,n=e.height||600}const r=t*i.x,a=n*i.y;Po.mainCanvas.style.width=`${r}px`,Po.mainCanvas.style.height=`${a}px`;const s=Po.mainCanvas.getBoundingClientRect(),l=u.container.getBoundingClientRect().bottom-s.bottom+12||24;if(e?(Po.mainCanvas.style.width="100vw",Po.mainCanvas.style.height="100vh",u.editorToolbar.style.bottom=`${l}px`):u.editorToolbar&&(u.editorToolbar.style.bottom=`${l}px`),u.metadataContainer&&(u.metadataContainer.style.width="100%",u.metadataContainer.style.height="100%"),Po.fileElement&&Po.fileElement.length>0&&(Po.fileElement[0].style.height=1.1*a+"px"),!u.guiContainer.hidden){const e=u.lilGui?.[0]?.getBoundingClientRect().width||u.guiContainer.getBoundingClientRect().width;e>0&&(u.guiContainer.style.left=r-e+"px")}if(u.camera.isOrthographicCamera?this.updateOrthoFrustum(u.camera,r,a):(u.camera.aspect=r/a,u.camera.updateProjectionMatrix()),u.renderer.setPixelRatio(window.devicePixelRatio||1),u.renderer.setSize(r,a,!1),Po.actionMenu)if(Po.actionMenu.classList.contains("viewer-action-menu_in-toolbar"))Po.actionMenu.style.top="",Po.actionMenu.style.right="",Po.actionMenu.style.bottom="";else{const e=16,t=Po.actionMenu.querySelector(".viewer-action-menu_toggle")?.getBoundingClientRect().height||45;Po.actionMenu.style.top=a-t-e+"px",Po.actionMenu.style.right=`${e}px`,Po.actionMenu.style.bottom="auto"}u.handHint&&(u.handHint.style.top=a-150+"px"),u.controls?.update(),u.CONFIG.viewer.canvasDimensions={x:r,y:a}},async toggleFullscreen(){Po.closeActionMenu();try{document.fullscreenElement?await document.exitFullscreen():await u.container.requestFullscreen(),Po.updateSize(),Po.updateFullscreenButtonIcon(),Po.updateEditorToolbarLabels(),Po.updateEditorToolbarState()}catch(e){Po.reportError(e,{context:"Fullscreen error",toast:!1,e2e:!1})}},onFullscreenChange(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{Po.updateSize(),Po.updateEditorToolbarLabels(),Po.updateEditorToolbarState()})}),Po.updateFullscreenButtonIcon(),Po.closeActionMenu()},exitFullscreenHandler(){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement;document.webkitIsFullScreen&&document.mozFullScreen&&document.msFullscreenElement;!e&&Po.FULLSCREEN&&fullscreen()},updateHandAnimation:e=>{const t=u.GESTURE;if(!t)return;if(!t.active||!t.baseAngle||!t.target)return;const n=(e-t.startTime)/1e3,i=Math.sin(n/u.GESTURE.period*Math.PI*2),o=Math.min(n/t.easeInTime,1),r=o*o*(3-2*o);u.handHint?.style.setProperty("--hand-x",i*u.GESTURE.handPx+"px");const a=t.baseAngle.clone();a.theta=t.baseAngle.theta+i*u.GESTURE.orbitAngle*r,u.camera.position.setFromSpherical(a).add(t.target),u.camera.lookAt(t.target)},startGesture:t=>{const n=u.GESTURE;n&&(n.active||(n.rotate=!0,n.startTime=t,n.active=!0,n.target=u.controls.target.clone(),n.baseAngle=(new e.Spherical).setFromVector3(u.camera.position.clone().sub(n.target)),u.controls.enabled=!1))},stopGesture:()=>{if(!u.handHint)return;const e=u.GESTURE;e&&e.active&&(e.rotate=!1,e.active=!1,u.controls.target.copy(e.target),u.controls.object.position.copy(u.camera.position),u.controls.update(),u.controls.enabled=!0,e.baseAngle=null,e.target=null,u.handHint.hidden=!0,u.GESTURE.active=!1)},animate:e=>{requestAnimationFrame(Po.animate);const t=Po.clock.getDelta();if(!u.PRESENTATION_MODE){const t=!window.__E2E__&&!u.handHint?.hidden;t&&u.GESTURE?.rotate&&!u.GESTURE?.active&&Po.startGesture(e),!u.GESTURE?.active||u.GESTURE?.rotate&&t||Po.stopGesture(),Po.updateHandAnimation(e),u.controls?.update(),null!==Po.textMesh&&Po.textMesh.lookAt(u.camera.position),Po.ruler?.length&&Po.ruler.forEach(e=>{e?.traverse?.(e=>{!0===e?.userData?.isDistanceLabel&&e.lookAt(u.camera.position)})}),Po.updateAnnotationPOITooltipPosition()}u.GESTURE?.active&&!u.PRESENTATION_MODE||u.controls?.update(),!u.PRESENTATION_MODE&&!u.handHint?.hidden||u.GESTURE?.active||(u.cameraTween?.update(e),u.targetTween?.update(e)),Po.mixer&&Po.mixer.update(t),u.renderer?.clear(),u.renderer?.render(u.scene,u.camera),u.stats?.update()},onDragOver(e){e.preventDefault(),e.dataTransfer.dropEffect="copy"},showSandboxGuiAfterModelLoad(){if(!u.guiContainer)return;u.guiContainer.hidden=!1,u.lilGui=document.getElementsByClassName("lil-gui root");requestAnimationFrame(()=>{Po.updateSize(),requestAnimationFrame(()=>Po.updateSize())})},async onDrop(e){e.preventDefault();const t=e.dataTransfer.files;if(!t||0===t.length)return;const n=t[0],i=n.name.split(".").pop().toLowerCase();u.SUPPORTED_EXTENSIONS.includes(i)?await So(n):Po.SUPPORTED_ARCHIVES.includes(i)?await Oo(n):v("unsupportedFormat","error")},async changeScale(){if("scale"===u.transformControl.getMode())switch(u.transformControl.axis){case"X":case"XY":case"Z":case"XZ":u.helperObjects[0].scale.set(u.helperObjects[0].scale.x,u.helperObjects[0].scale.x,u.helperObjects[0].scale.x);break;case"Y":case"YZ":u.helperObjects[0].scale.set(u.helperObjects[0].scale.y,u.helperObjects[0].scale.y,u.helperObjects[0].scale.y)}},syncOutlineClippingTransform(){const e=u.outlineClipping,t=u.helperObjects?.[0];e&&t&&(e.position.copy(t.position),e.quaternion.copy(t.quaternion),e.scale.copy(t.scale),e.updateMatrixWorld(!0))},async calculateObjectScale(){u.renderer&&(u.renderer.localClippingEnabled=!0),Po.syncOutlineClippingTransform();const t=new e.Box3;if(Array.isArray(u.helperObjects[0]))for(let n=0;n<u.helperObjects[0].length;n++){const i=(new e.Box3).setFromObject(u.helperObjects[0][n],!0);t.union(i)}else t.setFromObject(u.helperObjects[0],!0);if(t.isEmpty())return;const n=new e.Vector3;t.getCenter(n);const i=new e.Vector3(Math.max(Math.abs(t.max.x),Math.abs(t.min.x)),Math.max(Math.abs(t.max.y),Math.abs(t.min.y)),Math.max(Math.abs(t.max.z),Math.abs(t.min.z)));if(Po.distanceGeometry=i,p("distanceGeometry",Po.distanceGeometry),u.clippingPlanes?.length>=3&&(u.clippingPlanes[0].constant=i.x,u.clippingPlanes[1].constant=i.y,u.clippingPlanes[2].constant=i.z),Po.planeParams.planeX.constantX=i.x,Po.planeParams.planeY.constantY=i.y,Po.planeParams.planeZ.constantZ=i.z,u.clippingFolder?.controllers?.[1]&&(u.clippingFolder.controllers[1]._max=i.x,u.clippingFolder.controllers[1]._min=-i.x,u.clippingFolder.controllers[1].setValue(i.x),u.clippingFolder.controllers[1].updateDisplay()),u.clippingFolder?.controllers?.[3]&&(u.clippingFolder.controllers[3]._max=i.y,u.clippingFolder.controllers[3]._min=-i.y,u.clippingFolder.controllers[3].setValue(i.y),u.clippingFolder.controllers[3].updateDisplay()),u.clippingFolder?.controllers?.[5]&&(u.clippingFolder.controllers[5]._max=i.z,u.clippingFolder.controllers[5]._min=-i.z,u.clippingFolder.controllers[5].setValue(i.z),u.clippingFolder.controllers[5].updateDisplay()),Po.planeHelpers?.length>=3&&u.clippingPlanes?.length>=3)for(let e=0;e<3;e++){const t=Po.planeHelpers[e],i=u.clippingPlanes[e];t&&i&&(t.position.copy(i.normal).multiplyScalar(-i.constant),0!==e&&2!==e||(t.userData.clippingCenterY=n.y,t.updateMatrixWorld(!0)))}var o=Math.max(i.x,i.y,i.z);Po.planeHelpers?.forEach(e=>e&&(e.size=o))},changeLightRotation(){u.lightHelper.update()},takeScreenshot(){return e=this,u.camera.aspect=1,u.camera.updateProjectionMatrix(),u.renderer.setSize(256,256),u.renderer.render(u.scene,u.camera),e.mainCanvas.toBlob(e=>{if(!e)return void console.error("Failed to capture screenshot");if(!(e instanceof Blob)||0===e.size)return void console.error("Invalid blob data");if(!["image/png","image/jpeg"].includes(e.type))return void console.error("Invalid blob type:",e.type);const t=new FormData;t.append("path",u.fileObject.path),t.append("filename",u.fileObject.basename),t.append("data",e,"thumbnail.png"),console.log("Uploading thumbnail for entity ID:",u.CONFIG.entity.id),t.append("wisski_individual",u.CONFIG.entity.id),fetch(u.CONFIG.mainUrl+"/api/editor/upload-thumbnail",{method:"POST",credentials:"same-origin",headers:{"X-CSRF-Token":window.CSRF_TOKEN||window.drupalSettings?.dfg_3dviewer?.csrfToken},body:t}).then(async e=>{const t=await e.text(),n=t?JSON.parse(t):{};if(!e.ok)throw new Error(n.error||"Upload failed");return n})},"image/png"),u.renderer.setPixelRatio(devicePixelRatio),u.camera.aspect=u.CONFIG.viewer.canvasDimensions.x/u.CONFIG.viewer.canvasDimensions.y,u.camera.updateProjectionMatrix(),void u.renderer.setSize(u.CONFIG.viewer.canvasDimensions.x,u.CONFIG.viewer.canvasDimensions.y);var e},async mainLoadModelWrapper(){""!==u.autoPath&&(u.autoPath=Po.normalizeFileUrl(u.autoPath),u.autoPath=Po.normalizeArchiveModelPath(u.autoPath),u.fileObject.filename=u.autoPath.split("/").pop(),u.fileObject.basename=u.fileObject.filename.substring(0,u.fileObject.filename.lastIndexOf(".")),u.fileObject.extension=u.fileObject.filename.substring(u.fileObject.filename.lastIndexOf(".")+1),Po._ext=u.fileObject.extension.toLowerCase(),u.fileObject.path=u.autoPath.substring(0,u.autoPath.lastIndexOf(u.fileObject.filename))),await Po.mainLoadModel(),Po.applyPendingAnnotationsIfAny()},async mainLoadModel(){console.log("Loading model:",u.fileObject.basename,", with extension:",u.fileObject.extension),"glb"===Po._ext||"gltf"===Po._ext?await ve():Po.SUPPORTED_ARCHIVES.includes(Po._ext)?(u.loadedFile="_"+Po._ext.toUpperCase()+"/",u.fileObject.path=u.fileObject.path+u.fileObject.basename+u.loadedFile,u.fileObject.extension="glb",u.fileObject.newExtension=Po._ext,await ve()):(Po._ext,await ve()),this.applyCameraOverridesFromUrl()},prepareSandboxScene(){u.mainObject?.length&&(u.mainObject.forEach(e=>Po.removeAndDisposeFromScene(e)),u.mainObject.length=0),u.loadingLog&&u.loadingLog.finish?.(),u.circle&&(u.circle.set?.(0,100),u.circle.complete()),u.mainCanvas&&u.CONFIG?.viewer?.background&&u.mainCanvas.style.setProperty("background",u.CONFIG.viewer.background),u.camera?.position.set(0,60,180),u.controls?.target.set(0,0,0),u.controls?.update(),this.applyCameraOverridesFromUrl(),window.viewer&&(window.viewer.modelLoaded=!1),v("sandboxDropModel","info",{formats:this.getSupportedFormatsText(),archives:this.getSupportedArchiveFormatsText(),detailI18nKey:"toasts.supportedFormats",key:"sandbox-drop-model",replace:!0,persistent:!0,variant:"sandbox"})},applyCameraOverridesFromUrl(){if(!u.camera)return;const e=this.urlOptions?.cameraPosition,t=this.urlOptions?.cameraTarget,n=this.urlOptions?.cameraFov,i=e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z),o=t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.z),r=Number.isFinite(n);if(i||o||r){if(i&&(u.camera.position.copy(e),u.cameraLight?.position.copy(e)),o&&(u.controls?.target.copy(t),u.camera.lookAt(t)),r){const e=Math.min(179,Math.max(1,Number(n)));u.camera.fov=e,this.embedConfigInputs?.fov&&""===this.embedConfigInputs.fov.value&&(this.embedConfigInputs.fov.value=String(e))}u.camera.updateProjectionMatrix(),u.controls?.update()}},createClippingPlaneAxis(e,t="z"){var n=new l(u.camera,u.renderer.domElement);return n.space="world",n.setMode("translate"),n.showX="x"===t,n.showY="y"===t,n.showZ="z"===t,n.addEventListener("change",Po.render),n.addEventListener("objectChange",function(t){if(void 0===t.target||void 0===t.target.object)return;let n;switch(e){case 0:n=t.target.worldPositionStart.x+t.target.pointEnd.x,u.clippingPlanes[e].constant=n,u.planeParams.planeX.constantX=n,u.clippingFolder.controllers[1]&&u.clippingFolder.controllers[1].setValue(n),u.planeHelpers[0].position.copy(u.clippingPlanes[0].normal).multiplyScalar(-n);break;case 1:n=t.target.worldPositionStart.y+t.target.pointEnd.y,u.clippingPlanes[e].constant=n,u.planeParams.planeY.constantY=n,u.clippingFolder.controllers[3]&&u.clippingFolder.controllers[3].setValue(n),u.planeHelpers[1].position.copy(u.clippingPlanes[1].normal).multiplyScalar(-n);break;case 2:n=t.target.worldPositionStart.z+t.target.pointEnd.z,u.clippingPlanes[e].constant=n,u.planeParams.planeZ.constantZ=n,u.clippingFolder.controllers[5]&&u.clippingFolder.controllers[5].setValue(n),u.planeHelpers[2].position.copy(u.clippingPlanes[2].normal).multiplyScalar(-n)}}),n.addEventListener("dragging-changed",function(e){u.controls.enabled=!e.value}),n},resetCamera(){const n=u.cameraCoords||u.camera.position.clone(),i=u.controlsTarget||u.controls?.target?.clone()||new e.Vector3;if(!n||"number"!=typeof n.x)return;const o=u.camera.position.clone(),r=u.controls?.target?.clone()||new e.Vector3,a=r.clone().sub(o).normalize(),s=i.clone().sub(n).normalize(),l=2*a.angleTo(s),c=Math.max(o.distanceTo(n),r.distanceTo(i)),d=Math.max(c,l),p=e.MathUtils.clamp(d/1.25*1e3,300,3e3);u.cameraTween=new t.Tween(o).to(n,p).easing(t.Easing.Cubic.Out).onUpdate(()=>{u.camera.position.copy(o),u.cameraLight.position.copy(o),u.camera.updateProjectionMatrix()}),u.targetTween=new t.Tween(r).to(i,p).easing(t.Easing.Cubic.Out).onUpdate(()=>{u.controls?.target.copy(r),u.controls?.update()}),u.cameraTween.onComplete(()=>{u.camera.position.copy(n),u.cameraLight.position.copy(n),u.controls?.target.copy(i),u.controls?.update(),u.camera.updateProjectionMatrix()}),u.cameraTween.start(),u.targetTween.start()},buildMetadata(e){return K(this,e)},prepareStats(){u.stats=new _e,u.stats.domElement.classList.add("viewer-stats"),void 0!==u.guiContainer&&u.stats?.dom&&(u.guiContainer.appendChild(u.stats.dom),u.stats.dom.style.left=u.guiContainer.getBoundingClientRect().width-u.stats.domElement.getBoundingClientRect().width+10+"px",u.stats.dom.style.visibility="hidden"),Po.windowHalfX=u.CONFIG.viewer.canvasDimensions.x/2,Po.windowHalfY=u.CONFIG.viewer.canvasDimensions.y/2,Po.editorFolder=u.gui.addFolder(y("gui.editor","Editor")).close(),Po.editorFolder.domElement?.classList.add("viewer-gui-main-folder"),Po.editorFolder.domElement?.setAttribute("data-gui-main-folder","editor"),u.i18nGui.editorFolder=Po.editorFolder;const t=e=>{const t={translate:y("toasts.transformLightMove","Transform Light - Move: drag axis arrows to move the directional light."),rotate:y("toasts.transformLightTarget","Transform Light - Target: drag axis arrows to reposition the light target.")}[e];t&&w(t,{duration:5200})};u.i18nGui.transformObjectController=Po.editorFolder.add(Po.transformText,"Transform 3D Object",{[y("gui.none","None")]:"",[y("gui.move","Move")]:"translate",[y("gui.rotate","Rotate")]:"rotate",[y("gui.scale","Scale")]:"scale"}).name(y("gui.transform3dObject","Transform 3D Object")).onChange(function(e){if(""===e)u.transformControl.detach(),u.axesHelper.visible=!1,u.renderer.localClippingEnabled=!0;else{const t=u.helperObjects?.[0];if(!t)return;u.axesHelper.visible=!0,u.renderer.localClippingEnabled=!0,u.transformControl.setMode(e),u.transformControl.attach(t),(e=>{const t={translate:y("toasts.transformMove","Move: drag axis arrows to reposition the object."),rotate:y("toasts.transformRotate","Rotate: drag rotation rings to rotate the object."),scale:y("toasts.transformScale","Scale: drag axis handles to resize the object.")}[e];t&&w(t,{duration:5200})})(e)}Po.updateEditorToolbarState()}),u.i18nGui.transformModeController=Po.editorFolder.add(Po.transformText,"Transform Mode",{[y("gui.local","Local")]:"local",[y("gui.global","Global")]:"global"}).name(y("gui.transformMode","Transform Mode")).onChange(function(e){u.transformControl.space=e,Po.updateEditorToolbarState()});const n=Po.editorFolder.addFolder(y("gui.directionalLight","Directional Light")).close();u.i18nGui.lightFolder=n,u.i18nGui.transformLightController=n.add(Po.transformText,"Transform Light",{[y("gui.none","None")]:"",[y("gui.move","Move")]:"translate",[y("gui.target","Target")]:"rotate"}).name(y("gui.transformLight","Transform Light")).onChange(function(e){""===e?(u.transformControlLight.detach(),u.transformControlLightTarget.detach(),u.lightHelper.visible=!1):(u.lightHelper.visible=!0,"translate"===e?(u.transformControlLight.setMode("translate"),u.transformControlLight.attach(u.dirLight),u.transformControlLightTarget.detach(),t("translate")):(u.transformControlLightTarget.setMode("translate"),u.transformControlLightTarget.attach(u.dirLightTarget),u.transformControlLight.detach(),t("rotate"))),Po.updateEditorToolbarState()}),u.i18nGui.directionalLightColorController=n.addColor(Po.colors,"DirectionalLight").name(y("gui.color","Color")).onChange(function(t){u.lightObjects[0].color=new e.Color(t)}).listen(),u.i18nGui.directionalLightIntensityController=n.add(Po.intensity,"startIntensityDir",0,10).name(y("gui.intensity","Intensity")).onChange(function(e){u.lightObjects[0].intensity=e}).listen();const i=Po.editorFolder.addFolder(y("gui.ambientLight","Ambient Light")).close();u.i18nGui.lightFolderAmbient=i,u.i18nGui.ambientLightColorController=i.addColor(Po.colors,"AmbientLight").name(y("gui.color","Color")).onChange(function(t){Po.ambientLight.color=new e.Color(t)}).listen(),u.i18nGui.ambientLightIntensityController=i.add(Po.intensity,"startIntensityAmbient",0,10).name(y("gui.intensity","Intensity")).onChange(function(e){Po.ambientLight.intensity=e}).listen();const o=Po.editorFolder.addFolder(y("gui.cameraLight","Camera Light")).close();u.i18nGui.lightFolderCamera=o,u.i18nGui.cameraLightColorController=o.addColor(Po.colors,"CameraLight").name(y("gui.color","Color")).onChange(function(t){Po.cameraLight.color=new e.Color(t)}).listen(),u.i18nGui.cameraLightIntensityController=o.add(Po.intensity,"startIntensityCamera",0,10).name(y("gui.intensity","Intensity")).onChange(function(e){Po.cameraLight.intensity=e}).listen();const r=Po.editorFolder.addFolder(y("gui.backgroundColor","Background Color")).close();u.i18nGui.backgroundFolder=r,u.i18nGui.backgroundColorController=r.addColor(Po.colors,"BackgroundColor").name(y("gui.backgroundColor","Background Color")).onChange(function(e){D(Po.backgroundType["Background Type"],e,Po.colors.BackgroundColorOuter)}).listen(),u.i18nGui.backgroundColorOuterController=r.addColor(Po.colors,"BackgroundColorOuter").name(y("gui.backgroundColorOuter","Background Color Outer")).onChange(function(e){D(Po.backgroundType["Background Type"],Po.colors.BackgroundColor,e)}).listen(),u.i18nGui.backgroundTypeController=r.add(Po.backgroundType,"Background Type",{[y("gui.linear","Linear")]:"linear",[y("gui.gradient","Gradient")]:"gradient"}).name(y("gui.backgroundType","Background Type")).onChange(function(e){"linear"==e?Po.backgroundOuterFolder.hide():Po.backgroundOuterFolder.show(),D(e,Po.colors.BackgroundColor,Po.colors.BackgroundColorOuter)}),p("clippingFolder",Po.clippingFolder),u.EDITOR&&(u.clippingFolder=Po.editorFolder.addFolder(y("gui.clippingFolder","Clipping Planes")).close(),u.i18nGui.clippingFolder=u.clippingFolder,u.materialsFolder=Po.editorFolder.addFolder(y("gui.materials","Materials")).close(),u.i18nGui.materialsFolder=u.materialsFolder,p("materialsFolder",u.materialsFolder),Po.pickingModeController=Po.editorFolder.add({togglePickingMode(){Po.togglePickingMode()}},"togglePickingMode"),Po.updatePickingModeControllerLabel(),Po.clearSelectedFacesController=Po.editorFolder.add({[y("gui.clearSelectedFaces","Clear selected faces")](){Po.clearSelectedFaces(),Po.restoreLastPickedFace()}},y("gui.clearSelectedFaces","Clear selected faces")),u.i18nGui.clearSelectedFacesController=Po.clearSelectedFacesController,Po.selectedFacesCountController=Po.editorFolder.add(Po.pickingStats,"Selected faces").listen(),Po.updateSelectedFacesControllerLabel(),Po.selectedFacesCountController.disable(),Po.updatePickingControlsVisibility(),Po.distanceMeasurementController=Po.editorFolder.add({toggleDistanceMeasurement(){Po.toggleDistanceMeasurement()}},"toggleDistanceMeasurement"),Po.updateDistanceMeasurementControllerLabel(),u.i18nGui.resetCameraController=Po.editorFolder.add({[y("gui.resetCameraPosition","Reset camera position")](){Po.resetCamera()}},y("gui.resetCameraPosition","Reset camera position"))),u.isLightweight||(Po.propertiesFolder=Po.editorFolder.addFolder(y("gui.saveProperties","Save properties")).close(),u.i18nGui.propertiesFolder=Po.propertiesFolder,u.i18nGui.savePropPositionController=Po.propertiesFolder.add(Po.saveProperties,"Position").name(y("gui.position","Position")),u.i18nGui.savePropRotationController=Po.propertiesFolder.add(Po.saveProperties,"Rotation").name(y("gui.rotation","Rotation")),u.i18nGui.savePropScaleController=Po.propertiesFolder.add(Po.saveProperties,"Scale").name(y("gui.scale","Scale")),u.i18nGui.savePropCameraController=Po.propertiesFolder.add(Po.saveProperties,"Camera").name(y("gui.camera","Camera")),u.i18nGui.savePropDirectionalController=Po.propertiesFolder.add(Po.saveProperties,"DirectionalLight").name(y("gui.directionalLight","Directional Light")),u.i18nGui.savePropAmbientController=Po.propertiesFolder.add(Po.saveProperties,"AmbientLight").name(y("gui.ambientLight","Ambient Light")),u.i18nGui.savePropCameraLightController=Po.propertiesFolder.add(Po.saveProperties,"CameraLight").name(y("gui.cameraLight","Camera Light")),u.i18nGui.savePropBackgroundController=Po.propertiesFolder.add(Po.saveProperties,"BackgroundColor").name(y("gui.backgroundColor","Background Color"))),u.EDITOR&&!u.isLightweight&&(u.i18nGui.saveController=Po.editorFolder.add({[y("gui.save","Save")](){Po.saveEditorMetadata()}},y("gui.save","Save")),u.i18nGui.renderPreviewController=Po.editorFolder.add({[y("gui.renderPreview","Render preview")](){Po.takeScreenshot()}},y("gui.renderPreview","Render preview"))),u.EDITOR&&(Po.createEditorToolbar(),Po.setEditorAdvancedPanelVisible(!1)),Po.updateLocalizedUI()},async startModelProcessing(){const e=u.CONFIG.entity.id;localStorage.setItem("processing_model_id",e);let t=this.getProcessingLoadingSteps();t=u.isLocalPreview?t.slice(-2):t,W.start(t),p("UltraLoader",W);const n=new Me(e);p("poller",n),n.start()},async setupManifesto(e,t="url",n="iiif"){Po.iiifConfigURL.url="text"===t?"":e;const i="iiif"===n?await async function(e){let t,n,i=new Li(e);if(await i.loadManifest(),i.modelUrls=new Array,i.scenes.length>0)for(const[e,o]of i.scenes.entries()){const o=i.scenes[e];i.scenes[e].background=await o.getBackgroundColor(),n=i.annotationsFromScene(o).filter(e=>{const t=e.getBody()[0];return"painting"===e.getMotivation()?.[0]&&(t.isSpecificResource||"model"===t?.getType())}),n.forEach(e=>{let n;n=e.getBody()[0].isSpecificResource?e.getBody()[0].getSource()?.id:e.getBody()[0].id,t=e.getTarget(),n&&t&&i.modelUrls.push(n)})}return{manifest:i.manifest,scenes:i.scenes,annotations:n,modelUrls:i.modelUrls,modelTarget:t}}(e):await async function(e){const t=new _i(e);await t.loadManifest();const n=[];let i=null,o=[];for(const e of t.scenes){e.background=e.backgroundColor||"#000000",o=t.annotationsFromScene(e).filter(e=>e.motivation?.includes("painting")&&"Model"===e.body?.type);for(const e of o){const t=e.body?.id;t&&n.push(t),i=e.target}}return t.modelUrls=n,t.modelTarget=i,{manifest:t.manifest,scenes:t.scenes,annotations:o,modelUrls:n,modelTarget:i}}(e);if(0===i.modelUrls.length&&(i.modelUrls.push("https://raw.githubusercontent.com/IIIF/3d/main/assets/astronaut/astronaut.glb"),w(y("toasts.noIiiifModelFallback","No 3D model found in IIIF manifest, loading example model."))),Po.resetLoadedModelState(),u.axesHelper.visible=!1,console.log("TOTAL Annotations: "+i.annotations.length),i.annotations.length!==i.modelUrls.length){const e=i.annotations.length-i.modelUrls.length;if(e>0)for(let t=0;t<e;t++)i.modelUrls.push(Po.testModelURL),u.objectsConfig.models.push({name:"Test Model",url:Po.testModelURL})}for(const[e,t]of i.modelUrls?.entries())u.objectsConfig.index=e,u.fileObject.originalPath=i.modelUrl=t,Po.setModelPaths(),"iiif"===n?await Oi(i,u.objectsConfig):await Pi(i,u.objectsConfig),i.scenes&&i.scenes.length>0&&(u.objectsConfig.scenes=i.scenes),Po._ext=u.fileObject.extension.toLowerCase(),await Po.mainLoadModel()},async loadManifestoURL(e="iiif"){const t=document.getElementById("form-manifesto"),n=document.getElementById("manifesto-toggle-collapse");t?.setAttribute("data-viewer-theme",Po.currentTheme),Po.updateIIIFFormLabels(),Po.bindEventListener(n,"click",()=>{t.classList.toggle("collapsed"),n.textContent=t.classList.contains("collapsed")?"▸":"▾",n.title=t.classList.contains("collapsed")?y("${titleKey}.expand","Expand"):y("${titleKey}.collapse","Collapse")}),Po.bindEventListener(document.getElementById("manifesto-manifest-select"),"change",async t=>{try{t.target.value!==Po.iiifConfigURL.url&&(u.objectsConfig.setupIndex=0,await Po.setupManifesto(t.target.value,"url",e))}catch(e){Po.reportError(e,{context:"Error loading ${className} manifest"})}}),Po.bindEventListener(document.getElementById("load-manifesto-from-url"),"click",async t=>{try{const t=document.getElementById("manifesto-manifest-url");if(""===t.value||!Po.isUrlFlexible(t.value))return t.style.border="2px solid red",void w("manifesto.invalidUrl","warning");t.style.border="2px solid green",u.objectsConfig.setupIndex=0,console.log("Loading ${className} manifest from URL: "+t.value),await Po.setupManifesto(t.value,"url",e)}catch(e){Po.reportError(e,{context:"Error loading ${className} manifest"})}}),Po.bindEventListener(document.getElementById("load-manifesto-from-text"),"click",async t=>{try{const t=document.getElementById("manifesto-manifest-text");if(""===t.value||!Po.isValidJsonObject(t.value))return t.style.border="2px solid red",void w("manifesto.invalidJson","warning");t.style.border="2px solid green",u.objectsConfig.setupIndex=0,console.log("Loading ${className} manifest from privided text"),await Po.setupManifesto(t.value,"text",e)}catch(e){Po.reportError(e,{context:"Error loading ${className} manifest"})}})},isUrlFlexible(e){try{return new URL(e),!0}catch{return/^(https?:\/\/)?([\w-]+\.)+[\w-]{2,}(\/\S*)?$/i.test(e)}},isValidJsonObject(e){try{const t=JSON.parse(e);return"object"==typeof t&&null!==t}catch{return!1}},async init(){if(!Po.renderer){Po.camera=new e.PerspectiveCamera(45,u.CONFIG.viewer.canvasDimensions.x/u.CONFIG.viewer.canvasDimensions.y,.001,999e6),Po.camera.position.set(0,0,0),p("renderer",Po.renderer),p("camera",Po.camera),p("mainObject",Po.mainObject),Po.scene=new e.Scene,p("scene",Po.scene),p("activeScene",Po.activeScene);const t=window.location.hostname,n=["localhost","127.0.0.1","::1"].includes(window.location.hostname),i=t.startsWith("192.168.")||t.startsWith("10.")||t.endsWith(".local"),o=t.includes("codesandbox.io")||t.includes("csb.app");this.isLocalPreview=n||i||o,p("isLocalPreview",this.isLocalPreview),console.info("Running on",window.location.hostname,"- Local preview mode:",u.isLocalPreview),u.PRESENTATION_MODE||u.SANDBOX_MODE||Po.startModelProcessing();const r=new e.HemisphereLight(16777215,4473924);r.position.set(0,200,0),u.scene.add(r),Po.ambientLight=new e.AmbientLight(4210752),u.scene.add(Po.ambientLight),p("ambientLight",Po.ambientLight),Po.dirLight=new e.DirectionalLight(16777215),Po.dirLight.position.set(0,100,50),Po.dirLight.castShadow=!0,Po.dirLight.shadow.camera.top=180,Po.dirLight.shadow.camera.bottom=-100,Po.dirLight.shadow.camera.left=-120,Po.dirLight.shadow.camera.right=120,Po.dirLight.shadow.bias=-1e-4,Po.dirLight.shadow.mapSize.width=4096,Po.dirLight.shadow.mapSize.height=4096,u.scene.add(Po.dirLight),Po.lightObjects.push(Po.dirLight),p("dirLight",Po.dirLight),p("lightObjects",Po.lightObjects),Po.cameraLightTarget=new e.Object3D,Po.cameraLightTarget.position.set(Po.camera.position.x,Po.camera.position.y,Po.camera.position.z),u.scene.add(Po.cameraLightTarget),p("cameraLightTarget",Po.cameraLightTarget),Po.cameraLight=new e.DirectionalLight(16777215),Po.cameraLight.position.set(u.camera.position),Po.cameraLight.castShadow=!1,Po.cameraLight.intensity=.3,u.scene.add(Po.cameraLight),Po.cameraLight.target=Po.cameraLightTarget,Po.cameraLight.target.updateMatrixWorld(),p("cameraLight",Po.cameraLight),u.renderer=new e.WebGLRenderer({antialias:!0,logarithmicDepthBuffer:!0,colorManagement:!0,sortObjects:!0,preserveDrawingBuffer:!0,powerPreference:"high-performance",alpha:!0,shadowMap:{enabled:!0,type:e.PCFSoftShadowMap},localClippingEnabled:!0,physicallyCorrectLights:!0,autoClear:!1,setClearColor:0,outputColorSpace:e.SRGBColorSpace,toneMapping:e.ACESFilmicToneMapping,toneMappingExposure:.65}),u.renderer.localClippingEnabled=!0,p("renderer",u.renderer),u.renderer.domElement.id="MainCanvas",Po.mainCanvas=document.getElementById("MainCanvas")||u.renderer.domElement,window.__E2E__&&document.body.appendChild(u.renderer.domElement),u.renderer.domElement.tabIndex=0,u.renderer.domElement.setAttribute("aria-label","3D viewer canvas"),u.PRESENTATION_MODE||(Po.bindEventListener(u.renderer.domElement,"pointerdown",Po.onPointerDown),Po.bindEventListener(u.renderer.domElement,"pointerup",Po.onPointerUp),Po.bindEventListener(u.renderer.domElement,"pointermove",Po.onPointerMove),Po.bindEventListener(u.renderer.domElement,"mouseenter",e=>{Po.isPointerDirectlyOverCanvas(e)&&Po.maybeShowKeyboardHint()}),Po.lastWindowFocusAt=Date.now(),Po.bindEventListener(window,"focus",()=>{Po.lastWindowFocusAt=Date.now()}),Po.bindEventListener(document,"visibilitychange",()=>{"visible"===document.visibilityState&&(Po.lastWindowFocusAt=Date.now())}),Po.bindEventListener(u.renderer.domElement,"pointerdown",()=>{u.renderer.domElement.focus()}),Po.bindEventListener(u.renderer.domElement,"keydown",Po.onViewerKeyDown),(u.isLocalPreview||u.SANDBOX_MODE)&&(Po.bindEventListener(u.renderer.domElement,"dragover",Po.onDragOver),Po.bindEventListener(u.renderer.domElement,"drop",Po.onDrop)));const a=window.devicePixelRatio||1;if(u.renderer.setSize(u.CONFIG.viewer.canvasDimensions.x,u.CONFIG.viewer.canvasDimensions.y),_o?(console.info("E2E MODE ENABLED"),u.renderer.setPixelRatio(1),u.renderer.toneMappingExposure=1,"function"==typeof disablePostProcessing&&disablePostProcessing(),this.ensureE2EState()):u.renderer.setPixelRatio(a),u.renderer.domElement.style.width=u.CONFIG.viewer.canvasDimensions.x+"px",u.renderer.domElement.style.height=u.CONFIG.viewer.canvasDimensions.y+"px",u.renderer.domElement.style.display="block",u.container.appendChild(u.renderer.domElement),Po.mainCanvas.classList.add("mainCanvas"),Po.viewerWrapper=u.container.closest(".viewer-wrapper"),Po.viewerWrapper||(Po.viewerWrapper=u.container.parentElement,Po.viewerWrapper.classList.add("viewer-wrapper")),Po.attachEditorToolbar(),u.camera.aspect=u.CONFIG.viewer.canvasDimensions.x/u.CONFIG.viewer.canvasDimensions.y,u.camera.updateProjectionMatrix(),p("mainCanvas",Po.mainCanvas),!u.PRESENTATION_MODE){const e=document.currentScript?.src||import.meta.url;Po.DFG_ASSETS=e.replace(/\/[^\/]*$/,""),p("DFG_ASSETS",Po.DFG_ASSETS),we(),Po.actionMenu=document.createElement("div"),Po.actionMenu.setAttribute("id","viewerActionMenu"),Po.actionMenu.innerHTML='\n <input\n id="viewerActionMenuToggle"\n class="viewer-action-menu_checkbox"\n type="checkbox"\n aria-label="Open main menu"\n />\n <label\n for="viewerActionMenuToggle"\n class="viewer-action-menu_toggle"\n aria-label="Open main menu"\n title="Main menu"\n >\n <span class="viewer-action-menu_settings-icon" aria-hidden="true">\n <svg viewBox="0 0 24 24" aria-hidden="true"><path d="m12 3 2 2.2 3-.2.8 2.9 2.6 1.4-1 2.8 1 2.8-2.6 1.4-.8 2.9-3-.2L12 21l-2-2.2-3 .2-.8-2.9-2.6-1.4 1-2.8-1-2.8 2.6-1.4.8-2.9 3 .2Z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><circle cx="12" cy="12" r="2.5" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>\n </span>\n <b class="viewer-editor-tool_sr">Main menu</b>\n </label>\n <div class="viewer-action-menu_panel" aria-label="Main menu"></div>\n ',u.container.appendChild(Po.actionMenu),Po.actionMenuToggle=Po.actionMenu.querySelector("#viewerActionMenuToggle"),Po.actionMenuPanel=Po.actionMenu.querySelector(".viewer-action-menu_panel"),Po.applyTheme(Po.getStoredTheme(),{persist:!1}),Po.viewEntity=document.createElement("button"),Po.viewEntity.setAttribute("id","viewEntity"),Po.viewEntity.setAttribute("type","button"),Po.viewEntity.hidden=!0,Po.downloadModel=document.createElement("a"),p("downloadModel",Po.downloadModel),u.downloadModel.setAttribute("id","downloadModel"),u.downloadModel.hidden=!0,Po.fullscreenMode=document.createElement("button"),Po.updateFullscreenButtonIcon(),Po.themeMode=document.createElement("button"),Po.themeMode.setAttribute("id","viewerThemeMode"),Po.themeMode.setAttribute("type","button"),Po.languageModeContainer=document.createElement("div"),Po.languageModeContainer.setAttribute("id","viewerLanguageModeContainer"),Po.languageModeContainer.className="language-mode-container",Po.languageMode=document.createElement("button"),Po.languageMode.setAttribute("id","viewerLanguageMode"),Po.languageMode.setAttribute("type","button"),Po.languageModeDropdown=document.createElement("div"),Po.languageModeDropdown.setAttribute("id","viewerLanguageModeDropdown"),Po.languageModeDropdown.className="language-mode-dropdown",Po.languageModeDropdown.hidden=!0;if([{code:"en",label:"EN",class:"language-dropdown-item-english"},{code:"pl",label:"PL",class:"language-dropdown-item-polish"},{code:"de",label:"DE",class:"language-dropdown-item-german"}].forEach(e=>{const t=document.createElement("div");t.className=`language-dropdown-item ${e.class}`,t.dataset.lang=e.code,t.textContent=e.label,t.setAttribute("role","option"),t.setAttribute("aria-selected",u.currentLanguage===e.code?"true":"false"),Po.bindEventListener(t,"click",()=>Po.selectLanguage(e.code)),Po.languageModeDropdown.appendChild(t)}),Po.languageModeContainer.appendChild(Po.languageMode),Po.languageModeContainer.appendChild(Po.languageModeDropdown),Po.updateThemeControlLabels(),Po.updateLanguageControlLabels(),Po.actionMenuPanel.appendChild(Po.languageModeContainer),Po.actionMenuPanel.appendChild(Po.themeMode),Po.actionMenuPanel.appendChild(Po.viewEntity),Po.actionMenuPanel.appendChild(Po.downloadModel),Po.urlOptions.hideUi&&(Po.actionMenu.hidden=!0),this.createEmbedConfiguratorPanel(),p("viewEntity",Po.viewEntity),Po.bindEventListener(Po.languageMode,"click",Po.toggleLanguage.bind(Po)),Po.bindEventListener(Po.themeMode,"click",Po.toggleTheme.bind(Po)),Po.bindEventListener(Po.viewEntity,"click",Po.openEmbedConfiguratorFromMenu.bind(Po)),Po.updateEmbedMenuEntryState(),Po.applyLanguage({persist:!1}),Po.bindEventListener(Po.downloadModel,"click",()=>Po.closeActionMenu()),Po.bindEventListener(document,"click",e=>{Po.actionMenu?.contains(e.target)||Po.embedConfiguratorPanel?.contains(e.target)||Po.closeActionMenu()}),Po.handHint.innerHTML=`<img src="${u.DFG_ASSETS}/img/hand-hint.png" alt="Hand hint" width=48 height=48 title="Hand hint animation"/>`,Po.rect=u.container.getBoundingClientRect(),Po.viewerWrapper===u.container&&u.CONFIG.viewer?.scaleContainer){const e={x:Number(u.CONFIG.viewer.scaleContainer.x||1),y:Number(u.CONFIG.viewer.scaleContainer.y||1)};Po.baseContainerRect={width:Po.rect.width/e.x,height:Po.rect.height/e.y}}u.guiContainer.style.maxHeight=Po.rect.height-20+"px",Po.fileElement=document.getElementsByClassName("field--type-file"),Po.fileElement.length>0&&(Po.fileElement[0].style.height=1.1*u.CONFIG.viewer.canvasDimensions.y+"px"),!0!==u.CONFIG.viewer.gallery?.build||u.SANDBOX_MODE||Po.buildGallery()}if(Po.controls=new s(u.camera,u.renderer.domElement),Po.controls.target.set(0,100,0),Po.controls.enableDamping=!0,Po.controls.dampingFactor=.05,Po.controls.enableRotate=!0,u.PRESENTATION_MODE&&(Po.controls.autoRotate=!0,Po.controls.autoRotateSpeed=1.5,document.body.classList.add("presentation-mode"),document.documentElement.classList.add("presentation-mode"),u.renderer.setClearColor(0,0)),"boolean"==typeof Po.urlOptions.autoRotate&&(Po.controls.autoRotate=Po.urlOptions.autoRotate),Number.isFinite(Po.urlOptions.autoRotateSpeed)&&(Po.controls.autoRotateSpeed=Po.urlOptions.autoRotateSpeed),(Po.urlOptions.disableInteraction||u.PRESENTATION_MODE)&&(Po.controls.enabled=!1,Po.controls.enableRotate=!1,Po.controls.enablePan=!1,Po.controls.enableZoom=!1),Po.controls.update(),p("controls",Po.controls),p("GESTURE",Po.GESTURE),p("lastTime",Po.lastTime),p("helperObjects",Po.helperObjects),u.PRESENTATION_MODE||(Po.transformControl=new l(u.camera,u.renderer.domElement),Po.transformControl.rotationSnap=e.MathUtils.degToRad(5),Po.transformControl.space="local",Po.transformControl.addEventListener("change",Po.render),Po.transformControl.addEventListener("objectChange",()=>{Po.changeScale(),Po.syncOutlineClippingTransform()}),Po.transformControl.addEventListener("mouseUp",()=>{Po.syncOutlineClippingTransform(),Po.calculateObjectScale()}),Po.transformControl.addEventListener("dragging-changed",function(e){u.controls.enabled=!e.value}),u.scene.add(Po.transformControl.getHelper()),p("transformControl",Po.transformControl),Po.transformControlLight=new l(u.camera,u.renderer.domElement),Po.transformControlLight.space="local",Po.transformControlLight.addEventListener("change",Po.render),Po.transformControlLight.addEventListener("dragging-changed",function(e){u.controls.enabled=!e.value}),u.scene.add(Po.transformControlLight.getHelper()),p("transformControlLight",Po.transformControlLight),Po.transformControlLightTarget=new l(u.camera,u.renderer.domElement),Po.transformControlLightTarget.space="global",Po.transformControlLightTarget.addEventListener("change",Po.render),Po.transformControlLightTarget.addEventListener("objectChange",Po.changeLightRotation),Po.transformControlLightTarget.addEventListener("dragging-changed",function(e){u.controls.enabled=!e.value}),u.scene.add(Po.transformControlLightTarget.getHelper()),p("transformControlLightTarget",Po.transformControlLightTarget),Po.transformControlClippingPlaneX=Po.createClippingPlaneAxis(0,"x"),Po.transformControlClippingPlaneY=Po.createClippingPlaneAxis(1,"y"),Po.transformControlClippingPlaneZ=Po.createClippingPlaneAxis(2,"z"),p("transformControlClippingPlaneX",Po.transformControlClippingPlaneX),p("transformControlClippingPlaneY",Po.transformControlClippingPlaneY),p("transformControlClippingPlaneZ",Po.transformControlClippingPlaneZ),p("clippingPlanes",Po.clippingPlanes),p("selectObjectHierarchy",Po.selectObjectHierarchy)),Po.GESTURE.handPx*=Math.min(window.innerWidth/1200,1),Po._ext=u.fileObject.extension.toLowerCase(),Po.SUPPORTED_ARCHIVES.includes(Po._ext)&&(Po.archiveType=Po._ext),u.autoPath="",u.isLocalPreview&&!u.PRESENTATION_MODE&&!u.SANDBOX_MODE){const e=document.getElementById("example-model-picker"),t=document.getElementById("example-model-select"),n=document.getElementById("example-theme-toggle"),i=document.getElementById("DFG_3DViewer");if(e&&t&&i){Po.updateLocalPreviewLabels();let o=new URL(window.location.href).searchParams.get("model");o||(o=localStorage.getItem("dfg3dviewer-example-model")),o||(o=i.getAttribute("3d")),o||(o="./examples/box.stl"),u.autoPath=o,e.style.display="inline-flex",t.value=o,i.setAttribute("3d",o),n&&(n.hidden=!0),t.addEventListener("change",()=>{u.autoPath=t.value,window.localStorage.setItem("dfg3dviewer-example-model",t.value),this.resetLoadedModelState(),this.mainLoadModelWrapper()})}}if(u.SANDBOX_MODE)Po.prepareSandboxScene();else if(u.PRESENTATION_MODE)await Po.mainLoadModelWrapper();else{const e=u.CONFIG.entity.metadata.sourceType.toLowerCase();if(console.log("Loading from source: "+e),window.__E2E__)try{await Po.mainLoadModelWrapper()}catch(e){Po.reportError(e,{context:"E2E model load error"})}else if("drupal"===e)try{if(u.CONFIG.entity.metadata.exportUrl&&""!==u.CONFIG.entity.metadata.exportUrl){const e=await fetch(u.CONFIG.viewer.exportPath+u.CONFIG.entity.id,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/xml"},body:JSON.stringify({id:u.CONFIG.entity.id,domain:u.CONFIG.metadataUrl})});if(!e.ok)throw new Error(`XML export failed: ${e.status}`);const t=await e.text(),n=(new DOMParser).parseFromString(t,"application/xml");Po.pendingAnnotationsXml=Po.extractAnnotationsXmlFromExportDocument(n),u.autoPath="";const i=n.getElementsByTagName("*");for(let e=0;e<i.length;e++){const t=i[e];if(t.tagName?.includes("converted_file")&&t.textContent){u.autoPath=t.textContent;break}}}await Po.mainLoadModelWrapper()}catch(e){Po.reportError(e,{context:u.isLightweight?"Lightweight model load error":"Metadata load error"})}else if("iiif"===e)Po.cleanupTransientUI(),ae("iiif"),console.log("Loading from source: "+u.CONFIG.entity.metadata.sourceType),""!==Po.iiifConfigURL.url&&(!function(e){const t=[{url:e.url,name:e.name},{url:"https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_transform_scale_position.json",name:y("iiif.optionModelPositionScale","Model Position and Scale")},{url:"https://raw.githubusercontent.com/IIIF/3d/main/manifests/1_basic_model_in_scene/model_origin.json",name:y("iiif.optionModelOrigin","Model Origin")},{url:"https://raw.githubusercontent.com/IIIF/3d/main/manifests/1_basic_model_in_scene/model_origin_bgcolor.json",name:y("iiif.optionModelOriginBg","Model Origin with background color")},{url:"https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_position.json",name:y("iiif.optionModelPosition","Model Position")}].filter(Boolean),n=document.createElement("div");n.className="form-manifesto-group";const i=document.createElement("label");i.textContent=y("iiif.manifest","IIIF manifest"),i.className="form-manifesto-label";const o=document.createElement("select");o.id="manifesto-manifest-select",o.name="manifesto-manifest-select",t.forEach(e=>{const t=document.createElement("option");t.value=e.url,t.textContent=e.name,o.appendChild(t)}),n.appendChild(i),n.appendChild(o),document.querySelector("#form-manifesto-content").prepend(n)}(Po.iiifConfigURL),await Po.loadManifestoURL(),u.CONFIG.entity.metadata.sourceType="IIIF",await Po.setupManifesto(Po.iiifConfigURL.url));else if("aim3if"===e)Po.cleanupTransientUI(),ae("aim3if"),console.log("Loading from source: "+u.CONFIG.entity.metadata.sourceType),u.CONFIG.entity.metadata.url&&(!function(e){const t=document.createElement("div");t.className="form-manifesto-group";const n=[{url:e,name:y("aim3if.optionDefault","Default configuration")},{url:"https://viewer.thedworak.com/manifests/box.json",name:y("aim3if.optionBox","Box configuration")}].filter(Boolean),i=document.createElement("label");i.textContent=y("aim3if.modelConfig","Model configuration"),i.className="form-manifesto-label";const o=document.createElement("select");o.id="manifesto-config-select",o.name="manifesto-config-select",n.forEach(e=>{const t=document.createElement("option");t.value=e.url,t.textContent=e.name,o.appendChild(t)}),t.appendChild(i);const r=document.createElement("option");r.value=e,r.textContent=y("aim3if.optionDefault","Default configuration"),o.appendChild(r),t.appendChild(i),t.appendChild(o),document.querySelector("#form-manifesto-content").prepend(t)}(u.CONFIG.entity.metadata.url),await Po.loadManifestoURL("aim3if"),u.CONFIG.entity.metadata.sourceType="AIM3IF",await Po.setupManifesto(u.CONFIG.entity.metadata.url,"url","aim3if"));else{console.log("Custom metadata source:"+u.CONFIG.entity.metadata.sourceType);try{if("drupal"===u.CONFIG.entity.metadata.sourceType.substring(0,6).toLowerCase())console.log("Loading from URL: "+u.CONFIG.entity.metadata.url);await Po.mainLoadModelWrapper()}catch(e){Po.reportError(e,{context:u.isLightweight?"Lightweight model load error":"Custom metadata load error"})}}}u.renderer.setPixelRatio(a);const c=()=>Po.updateSize();Po.bindEventListener(window,"resize",c),Po.resizeObserver=new ResizeObserver(c),Po.resizeObserver.observe(Po.viewerWrapper),Po.bindEventListener(document,"fullscreenchange",Po.onFullscreenChange);const d=()=>setTimeout(c,100);Po.bindEventListener(window,"orientationchange",d)}},render(){u.controls?.update(),u.renderer?.render(u.scene,u.camera)}};var xo;async function To(e,t){await expect.poll(async()=>e.evaluate(()=>{const e=document.querySelector("canvas");return!!e&&!(!e.getContext("webgl2")&&!e.getContext("webgl"))}),{timeout:5e3,message:"WebGL context not available"}).toBeTruthy()}xo=Po,Object.assign(xo,{getStoredTheme(){return"light"===this.urlOptions?.theme||"dark"===this.urlOptions?.theme?this.urlOptions.theme:"0"===window.localStorage.getItem(this.THEME_STORAGE_KEY)?"light":"dark"},normalizeLanguage(e){if(null==e)return null;const t=String(e).trim().toLowerCase();return t.startsWith("pl")?"pl":t.startsWith("de")?"de":t.startsWith("en")?"en":null},getStoredLanguage(){const e=this.normalizeLanguage(this.urlOptions?.language);if(e)return e;const t=this.normalizeLanguage(window.localStorage.getItem(this.LANGUAGE_STORAGE_KEY));return t||(this.normalizeLanguage(navigator?.language||"en")||"en")},updateThemeControlLabels(){const e="dark"===this.currentTheme;if(this.themeMode){this.themeMode.innerHTML=`\n <span class="viewer-theme-icon" aria-hidden="true">${e?"☀️":"🌙"}</span>\n <span>${e?y("theme.lightMode","Light mode"):y("theme.darkMode","Dark mode")}</span>\n `;const t=e?y("theme.switchToLightMode","Switch to light mode"):y("theme.switchToDarkMode","Switch to dark mode");this.themeMode.setAttribute("aria-label",t),this.themeMode.setAttribute("title",t)}const t=document.getElementById("example-theme-toggle");t&&(t.textContent=e?"☀️":"🌙",t.setAttribute("aria-pressed",e?"true":"false"),t.hidden=!0)},applyTheme(e,{persist:t=!0}={}){const n="light"===e?"light":"dark",i="dark"===n;this.currentTheme=n,document.documentElement.setAttribute("data-viewer-theme",n),document.body.setAttribute("data-viewer-theme",n),document.body.classList.toggle("iiif-dark",i),this.viewerWrapper?.setAttribute("data-viewer-theme",n),this.actionMenu?.setAttribute("data-viewer-theme",n),this.metadataContainer?.setAttribute("data-viewer-theme",n),u.guiContainer?.setAttribute("data-viewer-theme",n),document.getElementById("form-IIIF")?.setAttribute("data-viewer-theme",n),W.panel?.setAttribute("data-viewer-theme",n),t&&window.localStorage.setItem(this.THEME_STORAGE_KEY,i?"1":"0"),this.updateThemeControlLabels()},toggleTheme(){this.closeActionMenu(),this.applyTheme("dark"===this.currentTheme?"light":"dark")},updateLanguageControlLabels(){if(!this.languageMode)return;const e=[{code:"en",label:"Language: EN"},{code:"pl",label:"Język: PL"},{code:"de",label:"Sprache: DE"}].find(e=>e.code===u.currentLanguage)?.label||"EN";this.languageMode.innerHTML=`\n <span class="viewer-action-icon language-icon" aria-hidden="true"></span>\n <span>${e}</span>\n `,this.languageMode.setAttribute("aria-label",y("language.label","Language: EN")),this.languageMode.setAttribute("title",y("language.label","Language: EN")),this.languageModeDropdown&&this.languageModeDropdown.querySelectorAll(".language-dropdown-item").forEach(e=>{e.classList.toggle("active",e.dataset.lang===u.currentLanguage)})},updateActionMenuLabels(){if(!this.actionMenu)return;const e=y("menu.mainMenu","Main menu"),t=this.actionMenu.querySelector(".viewer-action-menu_toggle");t?.setAttribute("title",e);const n=t?.querySelector(".viewer-editor-tool_sr");n&&(n.textContent=e),this.actionMenu.querySelector(".viewer-action-menu_panel")?.setAttribute("aria-label",e)},updateDownloadMenuEntryLabel(){this.downloadModel&&!this.downloadModel.hidden&&(this.downloadModel.innerHTML=`\n <span class="viewer-action-icon download-icon" aria-hidden="true"></span>\n <span>${y("menu.download","Download")}</span>\n `)},updateLocalizedUI(){const e=["pl","de"].includes(u.currentLanguage)?u.currentLanguage:"en";document.documentElement.setAttribute("lang",e),this.updateActionMenuLabels(),this.updateLanguageControlLabels(),this.updateThemeControlLabels(),this.updateEmbedMenuEntryState(),this.updateFullscreenButtonIcon(),this.updateDownloadMenuEntryLabel(),this.updateEditorToolbarLabels(),this.updateEditorToolbarState(),this.updatePickingModeControllerLabel(),this.updateDistanceMeasurementControllerLabel(),this.updateSelectedFacesControllerLabel(),this.updateLocalPreviewLabels(),this.updateIIIFFormLabels(),this.updateMetadataPanelLabels(),this.updateMaterialsDialogLabels(),this.refreshStatusNoticeLanguage(),W.updateHeader?.(),this.pickingHint&&(this.pickingHint.textContent=y("hints.picking","Shift + click to select multiple faces")),this.clippingHint&&(this.clippingHint.textContent=y("hints.clipping","Drag active clipping plane helper to adjust cut"))},updateLocalPreviewLabels(){const e=document.querySelector("#example-model-picker label[for='example-model-select']");e&&(e.textContent=y("localPreview.loadExampleModel","Load example model"))},updateIIIFFormLabels(){const e=document.getElementById("form-IIIF");if(!e)return;const t=e.querySelector(".form-IIIF-header .title");t&&(t.textContent=y("iiif.loader","IIIF Loader"));const n=document.getElementById("iiif-toggle-collapse");if(n){const t=e.classList.contains("collapsed");n.title=t?y("iiif.expand","Expand"):y("iiif.collapse","Collapse")}const i=e.querySelector(".form-IIIF-label");i&&(i.textContent=y("iiif.manifest","IIIF manifest"));const o=document.getElementById("iiif-manifest-select");if(o){const e={"https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_transform_scale_position.json":y("iiif.optionModelPositionScale","Model Position and Scale"),"https://raw.githubusercontent.com/IIIF/3d/main/manifests/1_basic_model_in_scene/model_origin.json":y("iiif.optionModelOrigin","Model Origin"),"https://raw.githubusercontent.com/IIIF/3d/main/manifests/1_basic_model_in_scene/model_origin_bgcolor.json":y("iiif.optionModelOriginBg","Model Origin with background color"),"https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_position.json":y("iiif.optionModelPosition","Model Position")};Array.from(o.options).forEach(t=>{const n=e[t.value];n&&(t.textContent=n)})}const r=document.getElementById("manifest-url");r&&(r.placeholder=y("iiif.manifestUrlPlaceholder","https://example.org/iiif/manifest.json"));const a=document.getElementById("manifest-text");a&&(a.placeholder=y("iiif.manifestTextPlaceholder","Paste IIIF manifest JSON here..."));const s=document.getElementById("load-manifest-from-url");s&&(s.textContent=y("iiif.loadFromUrl","Load from URL"));const l=document.getElementById("load-manifest-from-text");l&&(l.textContent=y("iiif.loadFromText","Load from Text"))},updateMetadataPanelLabels(){const e=document.getElementById("metadata-container");e&&e.querySelectorAll("[data-i18n-key]").forEach(e=>{const t=e.getAttribute("data-i18n-key");if(!t)return;const n=e.classList.contains("metadata-label"),i=y(t,e.textContent?.replace(/:\s*$/,"")||"");e.textContent=n?`${i}:`:i})},applyLanguage({persist:e=!0}={}){e&&window.localStorage.setItem(this.LANGUAGE_STORAGE_KEY,u.currentLanguage),this.updateLocalizedUI()},toggleLanguage(){if(!this.languageModeDropdown)return;const e=!this.languageModeDropdown.hidden;this.languageModeDropdown.hidden=e},selectLanguage(e){u.currentLanguage=e,this.languageModeDropdown.hidden=!0,this.closeActionMenu(),this.applyLanguage()}}),function(e){Object.assign(e,{toggleLoadingLogs(){this.showLoadingLogs=!this.showLoadingLogs,u.loadingLog.get()&&u.loadingLog.get().classList.toggle("editorToolbar-visible",this.showLoadingLogs),this.updateEditorToolbarLabels(),this.updateEditorToolbarState()},getLoadingLogMessages(){return this.loadingLogMessageKeys.map(e=>y(e))},getProcessingLoadingSteps(){return this.processingLoadingStepKeys.map(e=>y(e))},createModelLoadingProgress(e){e.className="model-loader",e.hidden=!0,e.setAttribute("role","status"),e.setAttribute("aria-live","polite");const t=document.createElement("div");t.className="model-loader__ring",t.setAttribute("aria-hidden","true");const n=document.createElement("div");n.className="model-loader__percent",n.textContent="0%",t.appendChild(n);const i=document.createElement("div");i.className="model-loader__content";const o=document.createElement("div");o.className="model-loader__phase",o.textContent=this.getLoadingLogMessages()[0]??y("loadingLog.loadingAssets","Loading assets");const r=document.createElement("div");r.className="model-loader__phase-viewport";const a=document.createElement("div");a.className="model-loader__phase-list",r.appendChild(a);const s=this.getLoadingLogMessages(),l=new Map(this.loadingLogMessageKeys.map((e,t)=>[e,t])),c=Math.max(0,l.get("loadingLog.loadingModel")??0);let d=null;s.forEach(e=>{const t=document.createElement("div");t.className="model-loader__phase-item",t.textContent=e,a.appendChild(t)});const u=()=>{d&&(window.clearTimeout(d),d=null)},p=e=>{const t=a.firstElementChild?.offsetHeight||24;a.style.transform=`translateY(-${e*t}px)`,o.textContent=s[e]||s[c]||o.textContent,Array.from(a.children).forEach((t,n)=>{t.toggleAttribute("data-active",n===e),t.toggleAttribute("data-near",n===e-1||n===e+1)})},h=document.createElement("div");h.className="model-loader__track",h.setAttribute("role","progressbar"),h.setAttribute("aria-valuemin","0"),h.setAttribute("aria-valuemax","100"),h.setAttribute("aria-valuenow","0"),i.append(r,h);const g=document.createElement("div");g.className="model-loader__bar",h.appendChild(g),e.replaceChildren(t,i);const m=(t=0,i=100)=>{const o=Number.isFinite(i)&&i>0?i:100,r=Number.isFinite(t)?Math.min(Math.max(t/o,0),1):0,a=Math.round(100*r);e.style.setProperty("--model-loader-progress",String(a)),n.textContent=`${a}%`,g.style.width=`${a}%`,h.setAttribute("aria-valuenow",String(a)),p(c)};return m(0,100),{getElement:()=>e,show:()=>{u(),e.hidden=!1,delete e.dataset.complete,p(c)},hide:()=>{u(),e.hidden=!0,delete e.dataset.complete},setStage:(t,i=null)=>{const o=l.get(t);if("number"==typeof o&&p(o),Number.isFinite(i)){const t=Math.max(0,Math.min(Math.round(i),100));e.style.setProperty("--model-loader-progress",String(t)),n.textContent=`${t}%`,g.style.width=`${t}%`,h.setAttribute("aria-valuenow",String(t))}},complete:(t=2400)=>{u(),p(l.get("loadingLog.modelLoaded")??s.length-1),e.style.setProperty("--model-loader-progress","100"),n.textContent="100%",g.style.width="100%",h.setAttribute("aria-valuenow","100"),e.dataset.complete="true",d=window.setTimeout(()=>{d=null,delete e.dataset.complete,e.hidden=!0},t)},set:m,reset:(t=100)=>{u(),delete e.dataset.complete,m(0,t)}}},createLoadingLog(){const e=document.createElement("div");e.id="loading-log",e.setAttribute("aria-live","polite"),e.hidden=!0;const t=document.createElement("button");t.type="button",t.className="loading-log__collapsed-toggle",t.setAttribute("aria-label",y("loadingLog.title","Loading process log")),t.setAttribute("aria-expanded","false"),e.appendChild(t);const n=document.createElement("button");n.type="button",n.className="loading-log__header",n.setAttribute("aria-expanded","false");const i=document.createElement("span");i.className="loading-log__title",i.textContent=y("loadingLog.title","Loading process log");const o=document.createElement("span");o.className="loading-log__summary",n.append(i,o),e.appendChild(n);const r=document.createElement("div");r.className="loading-log__body";const a=document.createElement("div");a.className="loading-log__messages";const s=document.createElement("div");s.className="loading-log__progress",s.setAttribute("role","progressbar"),s.setAttribute("aria-valuemin","0"),s.setAttribute("aria-valuemax","100"),s.setAttribute("aria-valuenow","0");const l=document.createElement("div");l.className="loading-log__progress-bar",s.appendChild(l),r.append(a,s),e.appendChild(r),u.container.appendChild(e),e.classList.add("editorToolbar-hidden");let c=null,d=0,p=0,h=0,g=0,m=null,f=!1;const b=this.getLoadingLogMessages(),v=new Map(this.loadingLogMessageKeys.map((e,t)=>[e,t])),w=Math.max(0,v.get("loadingLog.loadingModel")??0);let E=!1;const C=i=>{E=i,e.dataset.expanded=i?"true":"false",n.setAttribute("aria-expanded",i?"true":"false"),t.setAttribute("aria-expanded",i?"true":"false")},M=()=>{const e=b[d]||b[w]||"";o.textContent=`${h}% • ${e}`};n.addEventListener("click",()=>{e.hidden||C(!E)}),t.addEventListener("click",()=>{e.hidden||C(!E)});const S=(e=!1)=>{const t=b.slice(Math.max(0,d-p+1),d+1);a.replaceChildren(...t.map((n,i)=>{const o=document.createElement("div");return o.className="loading-log__message",e?o.classList.add("loading-log__message--done"):i===t.length-1&&o.classList.add("loading-log__message--active"),o.textContent=n,o}))},I=e=>{const t=Number.isFinite(e)?Math.min(Math.max(e,0),100):0;h=Math.max(h,Math.round(t)),l.style.width=`${h}%`,s.setAttribute("aria-valuenow",String(h)),M()},A=()=>{p=Math.min(4,p+1),f||(d=w,I(Math.min(h+8,12))),S()},L=()=>{c&&(window.clearInterval(c),c=null)},O=()=>{m&&(window.clearTimeout(m),m=null)};return{start:()=>{L(),O(),f=!1,g=performance.now(),e.hidden=!1,C(!1),e.classList.remove("loading-log--done","loading-log--error"),d=w,p=1,h=0,S(),I(6),c=window.setInterval(A,520)},update:t=>{if(e.hidden)return;f=!0;const n=Number.isFinite(t)?t:0;d=w,p=Math.min(4,Math.max(p,2)),S(),I(Math.min(n,99))},setStage:(t,n=null)=>{if(e.hidden)return;const i=v.get(t);"number"==typeof i&&(d=i,p=Math.min(4,Math.max(p,2)),S(),M()),Number.isFinite(n)&&I(n)},finish:()=>{if(e.hidden)return;L();const t=b.length;d=t-1,p=t,S(!0),I(100),M(),e.classList.add("loading-log--done");const n=performance.now()-g,i=Math.max(1200,900-n+800);O(),m=window.setTimeout(()=>{e.classList.remove("loading-log--done"),e.classList.remove("loading-log--error"),C(!1),m=null},i)},fail:()=>{e.hidden||(L(),O(),C(!0),e.classList.add("loading-log--error"),m=window.setTimeout(()=>{e.classList.remove("loading-log--error"),C(!1),m=null},2e3))},get:()=>e}},showStatusNotice(e,t=2600,n={}){this.enqueueStatusNotice({message:e,duration:t,tone:"info",...n})},localizeStatusNotice(e){if(!e)return e;const t=String(e.i18nKey||""),n=String(e.detailI18nKey||"");return{...e,message:t?y(t,e.i18nVars||{},e.message):e.message,detail:n?y(n,e.detailI18nVars||{},e.detail):e.detail}},renderStatusNoticeContent(e){if(!this.statusNotice||!e)return;const t=String(e.message??""),n=String(e.detail??"");this.statusNotice.textContent="";const i=document.createElement("span");if(i.className="viewer-notice-message",i.textContent=t,this.statusNotice.appendChild(i),n){const e=n.split(/\r?\n/);for(const t of e){const e=document.createElement("span");e.className="viewer-notice-detail",e.innerHTML=t,this.statusNotice.appendChild(e)}}},getStatusNoticeText:e=>[e?.message,e?.detail].filter(Boolean).join(" "),refreshStatusNoticeLanguage(){Array.isArray(this.statusNoticeQueue)&&(this.statusNoticeQueue=this.statusNoticeQueue.map(e=>this.localizeStatusNotice(e))),this.statusNoticeCurrent&&(this.statusNoticeCurrent=this.localizeStatusNotice(this.statusNoticeCurrent),this.renderStatusNoticeContent(this.statusNoticeCurrent))},showStatusNoticeNow(e){this.statusNotice&&e&&(e=this.localizeStatusNotice(e),this.statusNoticeHideTimer&&(clearTimeout(this.statusNoticeHideTimer),this.statusNoticeHideTimer=null),this.statusNoticeActive=!0,this.statusNoticeCurrent=e,this.statusNotice.hidden=!1,this.renderStatusNoticeContent(e),this.statusNotice.dataset.tone=e.tone||"info",e.variant?this.statusNotice.dataset.variant=e.variant:delete this.statusNotice.dataset.variant,this.noticeContainer?.classList.toggle("viewer-notice-container--sandbox","sandbox"===e.variant),this.statusNotice.classList.remove("is-hiding"),this.statusNotice.classList.add("is-visible"),this.statusNoticeTimer&&(clearTimeout(this.statusNoticeTimer),this.statusNoticeTimer=null),e.persistent||(this.statusNoticeTimer=setTimeout(()=>{this.statusNotice&&(this.statusNotice.classList.remove("is-visible"),this.statusNotice.classList.add("is-hiding")),this.statusNoticeHideTimer=setTimeout(()=>{this.statusNotice&&(this.statusNotice.hidden=!0,this.statusNotice.classList.remove("is-hiding"),delete this.statusNotice.dataset.variant),this.noticeContainer?.classList.remove("viewer-notice-container--sandbox"),this.statusNoticeActive=!1,this.statusNoticeCurrent=null,this.statusNoticeTimer=null,this.statusNoticeHideTimer=null,this.processStatusNoticeQueue()},220)},e.duration)))},dismissStatusNotice(e=""){const t=String(e||"");this.statusNoticeQueue=this.statusNoticeQueue.filter(e=>t&&(e?.key||"")!==t),(!t||this.statusNoticeCurrent&&(this.statusNoticeCurrent.key||"")===t)&&(this.statusNoticeTimer&&(clearTimeout(this.statusNoticeTimer),this.statusNoticeTimer=null),this.statusNoticeHideTimer&&(clearTimeout(this.statusNoticeHideTimer),this.statusNoticeHideTimer=null),this.statusNotice&&(this.statusNotice.hidden=!0,this.statusNotice.classList.remove("is-visible","is-hiding"),delete this.statusNotice.dataset.variant),this.noticeContainer?.classList.remove("viewer-notice-container--sandbox"),this.statusNoticeActive=!1,this.statusNoticeCurrent=null,this.processStatusNoticeQueue())},enqueueStatusNotice({message:e,duration:t=2600,tone:n="info",key:i="",replace:o=!1,persistent:r=!1,variant:a="",i18nKey:s="",i18nVars:l={},detail:c="",detailI18nKey:d="",detailI18nVars:u={}}={}){const p=String(e??"");if(!p)return;const h={message:p,tone:n,duration:Number.isFinite(t)?t:2600,key:String(i||""),persistent:r,variant:String(a||""),i18nKey:String(s||""),i18nVars:l&&"object"==typeof l?{...l}:{},detail:String(c||""),detailI18nKey:String(d||""),detailI18nVars:u&&"object"==typeof u?{...u}:{}};if(this.statusNoticeActive&&this.getStatusNoticeText(this.statusNoticeCurrent)===this.getStatusNoticeText(h)&&(this.statusNoticeCurrent?.tone||"info")===h.tone&&(this.statusNoticeCurrent?.key||"")===h.key)return;if(h.key&&(this.statusNoticeQueue=this.statusNoticeQueue.filter(e=>(e?.key||"")!==h.key)),o&&this.statusNoticeActive&&(!h.key||(this.statusNoticeCurrent?.key||"")===h.key))return void this.showStatusNoticeNow(h);if(this.statusNoticeQueue.some(e=>this.getStatusNoticeText(e)===this.getStatusNoticeText(h)&&e?.tone===h.tone&&(e?.key||"")===h.key))return;const g={error:0,warning:1,info:2,success:3},m=g[h.tone]??2,f=this.statusNoticeQueue.findIndex(e=>m<(g[e?.tone]??2));-1===f?this.statusNoticeQueue.push(h):this.statusNoticeQueue.splice(f,0,h),this.processStatusNoticeQueue()},processStatusNoticeQueue(){if(this.statusNoticeActive)return;if(!this.statusNotice)return;if(!Array.isArray(this.statusNoticeQueue)||0===this.statusNoticeQueue.length)return;const e=this.statusNoticeQueue.shift();e&&this.showStatusNoticeNow(e)}})}(Po),function(t){Object.assign(t,{openMaterialsFolder(e=null){if(this.buildMaterialsDialog(),!this.materialsDialog)return;if(!this.materialsEditorObject||!this.materialsList?.length)return void w(y("gui.selectByMaterial","select by material"),"warning");this.syncMaterialsDialogSelectionOptions();const t=e&&""!==e?e:this.selectedMaterialUuid||this.materialsList[0]?.uuid||"";t&&this.selectMaterialInEditor(this.materialsEditorObject,t),this.updateMaterialsDialogBounds(),this.materialsDialog.hidden=!1,this.syncMaterialsDialogFields(),this.closeActionMenu(),this.materialsDialogSelect?.focus()},destroyMaterialGuiControls(){this.materialGuiControls&&(Object.values(this.materialGuiControls).forEach(e=>{e?.destroy&&e.destroy()}),this.materialGuiControls=null)},destroyMaterialSelectionController(){this.materialsEditorObject=null,this.selectedMaterialUuid=null,this.materialsList=[],this.materialsDialogSelect&&(this.materialsDialogSelect.innerHTML=""),this.syncMaterialsDialogFields()},getMaterialByUuid(e,t){if(!e||!t)return null;let n=null;return e.traverse(e=>{if(e.isMesh&&e.material){(Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{e?.isMaterial&&e.uuid===t&&(n=e)})}}),n},normalizeMaterialColorValue:(e,t="#ffffff")=>e?"string"==typeof e?e.startsWith("0x")?`#${e.slice(2).padStart(6,"0")}`:e.startsWith("#")?e:`#${e}`:"function"==typeof e.getHexString?`#${e.getHexString()}`:t:t,syncMaterialsDialogSelectionOptions(){if(!this.materialsDialogSelect)return;const e=this.selectedMaterialUuid||"";this.materialsDialogSelect.innerHTML="";const t=document.createElement("option");t.value="",t.textContent=y("gui.selectByMaterial","select by material"),this.materialsDialogSelect.appendChild(t),this.materialsList.forEach(e=>{const t=document.createElement("option");t.value=e.uuid,t.textContent=e.label,this.materialsDialogSelect.appendChild(t)}),this.materialsDialogSelect.value=e},updateMaterialsDialogLabels(){if(!this.materialsDialog)return;const e=this.materialsDialog.querySelector("#materialsDialogTitle"),t=this.materialsDialog.querySelector(".materials-dialog__close"),n=Array.from(this.materialsDialog.querySelectorAll(".materials-dialog__field > span")),i=this.materialsDialogInputs?.hint,o=this.materialsDialogInputs?.emptyState;if(e&&(e.textContent=y("gui.materials","Materials")),t&&t.setAttribute("aria-label",y("gui.materials","Materials")),n.length>0&&(n[0].textContent=y("gui.editMaterial","Edit material")),n.length>1&&(n[1].textContent=y("gui.color","Color")),n.length>2&&(n[2].textContent=y("gui.emissive","Emissive")),n.length>3&&(n[3].textContent=y("gui.intensity","Intensity")),n.length>4&&(n[4].textContent=y("gui.metalness","Metalness")),this.materialsDialogSelect){const e=this.materialsDialogSelect.querySelector('option[value=""]');e&&(e.textContent=y("gui.selectByMaterial","select by material"))}i&&(i.textContent=y("gui.selectByMaterial","select by material")),o&&(o.textContent=y("gui.selectByMaterial","select by material"))},syncMaterialsDialogFields(){if(!this.materialsDialogInputs)return;const e=this.materialsEditorObject&&this.selectedMaterialUuid?this.getMaterialByUuid(this.materialsEditorObject,this.selectedMaterialUuid):null,t=Boolean(e),{color:n,emissiveColor:i,emissive:o,metalness:r,emptyState:a,hint:s}=this.materialsDialogInputs;if(this.materialsDialogSelect&&(this.materialsDialogSelect.disabled=0===this.materialsList.length,this.materialsDialogSelect.value=this.selectedMaterialUuid||""),[n,i,o,r].forEach(e=>{e&&(e.disabled=!t)}),!t)return n&&(n.value="#ffffff"),i&&(i.value="#000000"),o&&(o.value="0"),r&&(r.value="0"),a&&(a.hidden=this.materialsList.length>0),void(s&&(s.textContent=y("gui.selectByMaterial","select by material")));n&&(n.value=this.normalizeMaterialColorValue(e.color,"#ffffff")),i&&(i.value=this.normalizeMaterialColorValue(e.emissive,"#000000")),o&&(o.value=String(e.emissiveIntensity??0)),r&&(r.value=String(e.metalness??0)),a&&(a.hidden=!0),s&&(s.textContent=this.materialsList.find(t=>t.uuid===e.uuid)?.label||e.uuid)},selectMaterialInEditor(e,t){if(!e)return;if(!t)return this.destroyMaterialGuiControls(),this.selectedMaterialUuid=null,this.refreshMaterialsToolbarMenu(),void this.syncMaterialsDialogFields();this.destroyMaterialGuiControls();const n=this.getMaterialByUuid(e,t);if(!n)return this.selectedMaterialUuid=null,this.refreshMaterialsToolbarMenu(),void this.syncMaterialsDialogFields();u.materialProperties.color=this.normalizeMaterialColorValue(n.color,"#ffffff"),u.materialProperties.emissiveColor=this.normalizeMaterialColorValue(n.emissive,"#000000"),u.materialProperties.emissive=n.emissiveIntensity??0,u.materialProperties.metalness=n.metalness??0,this.selectedMaterialUuid=t,this.syncMaterialsDialogSelectionOptions(),this.refreshMaterialsToolbarMenu(),this.syncMaterialsDialogFields()},initializeMaterialsEditor(e){if(!e)return;this.destroyMaterialGuiControls(),this.destroyMaterialSelectionController();const t=new Map,n=e=>{e&&e.isMaterial&&e.uuid&&(t.has(e.uuid)||t.set(e.uuid,e))},i=e=>{e.material&&(Array.isArray(e.material)?e.material.forEach(n):n(e.material))};e.isMesh&&i(e),e.traverse(e=>{e.isMesh&&i(e)});const o={[y("gui.selectByMaterial","select by material")]:""};this.materialsList=[],t.forEach((e,t)=>{const n=e.name?.trim()?e.name:t;o[n]=t,this.materialsList.push({uuid:t,label:n})}),u.materialsPropertiesText["Edit material"]="",this.materialsEditorObject=e,this.refreshMaterialsToolbarMenu(),this.syncMaterialsDialogSelectionOptions(),this.syncMaterialsDialogFields()},refreshMaterialsToolbarMenu(){if(!this.materialsSubmenu)return;this.materialsSubmenu.innerHTML="";const e=this.materialsList?.length?this.materialsList:[];if(!e.length){const e=document.createElement("button");e.type="button",e.className="viewer-editor-tool viewer-editor-tool_submenu-button viewer-editor-tool_submenu-control viewer-editor-tool_submenu-materials",e.disabled=!0;const t=y("gui.selectByMaterial","Select by material"),n=document.createElement("span");return n.textContent=t,e.appendChild(n),void this.materialsSubmenu.appendChild(e)}e.forEach(e=>{const t=document.createElement("button");t.type="button",t.className="viewer-editor-tool viewer-editor-tool_submenu-button viewer-editor-tool_submenu-control viewer-editor-tool_submenu-materials",e.uuid===this.selectedMaterialUuid&&t.classList.add("is-active"),t.dataset.materialUuid=e.uuid,t.setAttribute("title",e.label),t.setAttribute("aria-label",e.label);const n=document.createElement("span");n.className="viewer-editor-tool_icon",n.setAttribute("aria-hidden","true"),n.innerHTML=this.getEditorToolbarIcon("color"),t.appendChild(n);const i=document.createElement("span");i.className="viewer-editor-tool_label",i.textContent=e.label,t.appendChild(i),this.bindEventListener(t,"click",t=>{t.stopPropagation(),this.openMaterialsFolder(e.uuid)}),this.materialsSubmenu.appendChild(t)})},buildMaterialsDialog(){if(!u.container||this.materialsDialog)return;const n=document.createElement("div");n.id="materialsDialog",n.className="materials-dialog",n.hidden=!0,n.innerHTML=`\n <div class="materials-dialog__backdrop" data-materials-dismiss="true"></div>\n <div class="materials-dialog__panel" role="dialog" aria-modal="true" aria-labelledby="materialsDialogTitle">\n <div class="materials-dialog__header">\n <h3 id="materialsDialogTitle">${y("gui.materials","Materials")}</h3>\n <button type="button" class="materials-dialog__close" data-materials-dismiss="true" aria-label="${y("gui.materials","Materials")}">&times;</button>\n </div>\n <div class="materials-dialog__body">\n <label class="materials-dialog__field">\n <span>${y("gui.editMaterial","Edit material")}</span>\n <select id="materialsDialogSelect"></select>\n </label>\n <p id="materialsDialogHint" class="materials-dialog__hint">${y("gui.selectByMaterial","select by material")}</p>\n <p id="materialsDialogEmpty" class="materials-dialog__empty">${y("gui.selectByMaterial","select by material")}</p>\n <div class="materials-dialog__grid">\n <label class="materials-dialog__field">\n <span>${y("gui.color","Color")}</span>\n <input id="materialsDialogColor" type="color" />\n </label>\n <label class="materials-dialog__field">\n <span>${y("gui.emissive","Emissive")}</span>\n <input id="materialsDialogEmissiveColor" type="color" />\n </label>\n <label class="materials-dialog__field">\n <span>${y("gui.intensity","Intensity")}</span>\n <input id="materialsDialogEmissive" type="range" min="0" max="1" step="0.01" />\n </label>\n <label class="materials-dialog__field">\n <span>${y("gui.metalness","Metalness")}</span>\n <input id="materialsDialogMetalness" type="range" min="0" max="1" step="0.01" />\n </label>\n </div>\n </div>\n </div>\n `,document.body.appendChild(n),this.materialsDialog=n,this.materialsDialogPosition=null,this.materialsDialogSelect=n.querySelector("#materialsDialogSelect");const i=n.querySelector(".materials-dialog__panel"),o=n.querySelector(".materials-dialog__header");this.materialsDialogInputs={color:n.querySelector("#materialsDialogColor"),emissiveColor:n.querySelector("#materialsDialogEmissiveColor"),emissive:n.querySelector("#materialsDialogEmissive"),metalness:n.querySelector("#materialsDialogMetalness"),emptyState:n.querySelector("#materialsDialogEmpty"),hint:n.querySelector("#materialsDialogHint")},this.bindEventListener(n,"click",e=>{const t=e.target?.closest?.("[data-materials-dismiss='true']");t&&this.closeMaterialsDialog()}),this.bindEventListener(document,"keydown",e=>{"Escape"===e.key&&this.materialsDialog&&!this.materialsDialog.hidden&&(e.preventDefault(),this.closeMaterialsDialog())});const r=e=>{this.selectMaterialInEditor(this.materialsEditorObject,e.target.value)};this.bindEventListener(this.materialsDialogSelect,"change",r),this.bindEventListener(this.materialsDialogSelect,"input",r),this.bindEventListener(this.materialsDialogInputs.color,"input",t=>{const n=this.getMaterialByUuid(this.materialsEditorObject,this.selectedMaterialUuid);if(!n?.color)return;const i=t.target.value;u.materialProperties.color=i,n.color=new e.Color(i)}),this.bindEventListener(this.materialsDialogInputs.emissiveColor,"input",t=>{const n=this.getMaterialByUuid(this.materialsEditorObject,this.selectedMaterialUuid);if(!n||void 0===n.emissive)return;const i=t.target.value;u.materialProperties.emissiveColor=i,n.emissive=new e.Color(i)}),this.bindEventListener(this.materialsDialogInputs.emissive,"input",e=>{const t=this.getMaterialByUuid(this.materialsEditorObject,this.selectedMaterialUuid);if(!t)return;const n=parseFloat(e.target.value);u.materialProperties.emissive=n,t.emissiveIntensity=n}),this.bindEventListener(this.materialsDialogInputs.metalness,"input",e=>{const t=this.getMaterialByUuid(this.materialsEditorObject,this.selectedMaterialUuid);if(!t)return;const n=parseFloat(e.target.value);u.materialProperties.metalness=n,t.metalness=n}),this.bindEventListener(o,"pointerdown",e=>{if(0!==e.button)return;if(e.target?.closest?.(".materials-dialog__close"))return;const n=t.mainCanvas?.getBoundingClientRect?.()||u.container?.getBoundingClientRect?.(),o=i?.getBoundingClientRect?.();n&&o&&(this.materialsDialogDragging={offsetX:e.clientX-o.left,offsetY:e.clientY-o.top},i.setPointerCapture?.(e.pointerId),i.classList.add("is-dragging"),e.preventDefault())}),this.bindEventListener(document,"pointermove",e=>{if(!this.materialsDialogDragging||!this.materialsDialog||this.materialsDialog.hidden)return;const n=t.mainCanvas?.getBoundingClientRect?.()||u.container?.getBoundingClientRect?.(),o=i?.getBoundingClientRect?.();if(!n||!o)return;const r=e.clientX-this.materialsDialogDragging.offsetX,a=e.clientY-this.materialsDialogDragging.offsetY,s=n.left+12,l=n.right-o.width-12,c=n.top+12,d=n.bottom-o.height-12;this.materialsDialogPosition={left:Math.min(Math.max(r,s),Math.max(s,l)),top:Math.min(Math.max(a,c),Math.max(c,d))},this.updateMaterialsDialogBounds()});const a=()=>{this.materialsDialogDragging=!1,i?.classList.remove("is-dragging")};this.bindEventListener(document,"pointerup",a),this.bindEventListener(document,"pointercancel",a),this.bindEventListener(window,"resize",()=>this.updateMaterialsDialogBounds()),this.bindEventListener(window,"scroll",()=>this.updateMaterialsDialogBounds(),!0),this.bindEventListener(document,"fullscreenchange",()=>this.updateMaterialsDialogBounds()),this.syncMaterialsDialogSelectionOptions(),this.syncMaterialsDialogFields()},updateMaterialsDialogBounds(){if(!this.materialsDialog)return;const e=t.mainCanvas?.getBoundingClientRect?.()||u.container?.getBoundingClientRect?.();if(!e)return;const n=Math.max(0,Math.round(e.left)),i=Math.max(0,Math.round(e.top)),o=Math.max(0,Math.round(e.width)),r=Math.max(0,Math.round(e.height)),a=this.materialsDialog.querySelector(".materials-dialog__panel"),s=a?.offsetWidth||Math.min(360,o-24),l=a?.offsetHeight||Math.min(520,r-24);if(this.materialsDialogPosition){const e=n+12,t=n+o-s-12,a=i+12,c=i+r-l-12;this.materialsDialogPosition={left:Math.min(Math.max(this.materialsDialogPosition.left,e),Math.max(e,t)),top:Math.min(Math.max(this.materialsDialogPosition.top,a),Math.max(a,c))}}else this.materialsDialogPosition={left:Math.max(n+12,n+o-s-16),top:Math.max(i+16,i+Math.min(40,Math.max(16,.08*r)))};this.materialsDialog.style.left=`${n}px`,this.materialsDialog.style.top=`${i}px`,this.materialsDialog.style.width=`${o}px`,this.materialsDialog.style.height=`${r}px`,a&&(a.style.left=this.materialsDialogPosition.left-n+"px",a.style.top=this.materialsDialogPosition.top-i+"px",a.style.right="auto",a.style.transform="none")},closeMaterialsDialog(){this.materialsDialog&&(this.materialsDialog.hidden=!0)}})}(Po),function(t){Object.assign(t,{clearAnnotationPOIs(){this.closeAnnotationPOITooltip(),this.annotationPOIGroup?(this.annotationPOIGroup.children.slice().forEach(e=>{this.removeAndDisposeFromScene(e)}),this.annotationPOIGroup.clear(),this.annotationPOIMarkers=[],this.annotationPOIGroup.visible=!1):this.annotationPOIMarkers=[]},ensureAnnotationPOIGroup(){if(this.annotationPOIGroup)return this.annotationPOIGroup;const t=new e.Group;return t.name="annotation-poi-group",t.visible=!1,u.scene?.add?.(t),this.annotationPOIGroup=t,t},createNumberTexture(t){const n=128,i=document.createElement("canvas");i.width=n,i.height=n;const o=i.getContext("2d");o.fillStyle="rgba(0,0,0,0.6)",o.beginPath(),o.arc(64,64,64,0,2*Math.PI),o.fill(),o.fillStyle="#fff",o.font="bold 64px Arial",o.textAlign="center",o.textBaseline="middle",o.fillText(t,64,64);const r=new e.CanvasTexture(i);return r.needsUpdate=!0,r},createAnnotationPOIMarker(n,i,o=1){const r=Math.max((this.gridSize||u.gridSize||1)/15,.005),a=t.createNumberTexture(o.toString()),s=new e.SpriteMaterial({map:a,transparent:!0,depthTest:!1}),l=new e.Sprite(s);return l.scale.set(r,r,1),l.position.copy(i),l.userData.isAnnotationPOI=!0,l.userData.annotationId=n.id,l.userData.groupId=n.groupId||"",l.userData.key=n.key||"",l.userData.targetId=n.targetId,l.userData.faceIndex=n.faceIndex,l.userData.title=n.title||"",l},ensureAnnotationPOITooltip(){if(this.annotationPOITooltip)return this.annotationPOITooltip;const e=document.createElement("div");return e.id="annotationPOITooltip",e.className="annotation-poi-tooltip",e.hidden=!0,e.innerHTML='\n <div class="annotation-poi-tooltip__panel" role="status" aria-live="polite" aria-atomic="true">\n <div class="annotation-poi-tooltip__title" id="annotationPOITooltipTitle"></div>\n </div>\n ',document.body.appendChild(e),this.annotationPOITooltip=e,this.annotationPOITooltipTitle=e.querySelector("#annotationPOITooltipTitle"),e},openAnnotationPOITooltip(e){if(!e?.userData?.isAnnotationPOI)return this.closeAnnotationPOITooltip(),!1;const t=this.ensureAnnotationPOITooltip();if(!t)return!1;this.annotationPOITooltipTarget=e;const n=String(e.userData?.title||"").trim();return this.annotationPOITooltipTitle&&(this.annotationPOITooltipTitle.textContent=n||"Annotation"),t.hidden=!1,t.style.visibility="visible",this.updateAnnotationPOITooltipPosition(),!0},getAnnotationEntriesForPOIMarker(e){if(!e?.userData?.isAnnotationPOI)return[];const t=String(e.userData?.annotationId||"").trim(),n=String(e.userData?.groupId||"").trim(),i=String(e.userData?.key||"").trim();let o=null;t&&(o=this.annotationEntries.find(e=>String(e?.id||"")===t)||null),!o&&i&&(o=this.annotationEntries.find(e=>String(e?.key||"")===i)||null);const r=String(o?.groupId||n||"").trim();if(r){const e=this.annotationEntries.filter(e=>String(e?.groupId||"").trim()===r);if(e.length>0)return e}if(o)return[o];const a=String(e.userData?.targetId||"").trim(),s=Number(e.userData?.faceIndex);return!a||!Number.isInteger(s)||s<0?[]:[{id:t||"",key:this.getFaceSelectionKey(a,s),targetId:a,object:a,faceIndex:s,title:String(e.userData?.title||"").trim(),description:"",groupId:r}]},selectAnnotationEntriesFaces(e){Array.isArray(e)&&0!==e.length&&(this.clearSelectedFaces(),e.forEach(e=>{const t=this.resolveObjectByTargetId(e.targetId);if(!t)return;(Array.isArray(e.faceNumbers)?e.faceNumbers:[e.faceIndex]).forEach(e=>{this.toggleSelectedFace({object:t,faceIndex:e},{multiSelect:!0})})}),this.updateSelectedFacesCount())},openAnnotationDialogFromPOIMarker(e){const t=this.getAnnotationEntriesForPOIMarker(e);if(!t.length)return v("annotationDataMissing","warning"),!1;if(this.selectAnnotationEntriesFaces(t),this.buildAnnotationDialog(),!this.annotationDialog)return!1;const n=t.map(e=>String(e?.key||"").trim()).filter(Boolean);this.annotationTargetFaceKeys=Array.from(new Set(n));const i=Array.from(new Set(t.map(e=>String(e?.groupId||"").trim()).filter(Boolean)));this.annotationBatchGroupId=1===i.length?i[0]:`anno-group-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;const o=Array.from(new Set(t.map(e=>String(e?.title||"").trim()))),r=Array.from(new Set(t.map(e=>String(e?.description||"").trim())));return this.annotationDialogTitleInput.value=1===o.length?o[0]:"",this.annotationDialogDescriptionInput.value=1===r.length?r[0]:"",this.updateAnnotationDialogBounds(),this.annotationDialog.hidden=!1,this.closeAnnotationPOITooltip(),this.closeActionMenu(),this.annotationDialogTitleInput?.focus(),this.annotationDialogTitleInput?.select(),!0},closeAnnotationPOITooltip(){this.annotationPOITooltipTarget=null,this.annotationPOITooltip&&(this.annotationPOITooltip.hidden=!0,this.annotationPOITooltip.style.visibility="hidden")},updateAnnotationPOITooltipPosition(){const n=this.annotationPOITooltip,i=this.annotationPOITooltipTarget;if(!n||n.hidden||!i||!u.camera)return;const o=t.mainCanvas?.getBoundingClientRect?.()||u.container?.getBoundingClientRect?.();if(!o||o.width<=0||o.height<=0)return;const r=new e.Vector3;i.getWorldPosition(r);const a=r.clone().project(u.camera),s=a.z>=-1&&a.z<=1,l=o.left+(a.x+1)/2*o.width,c=o.top+(1-a.y)/2*o.height,d=l>=o.left&&l<=o.right,p=c>=o.top&&c<=o.bottom;s&&d&&p?(n.style.left=`${Math.round(l)}px`,n.style.top=`${Math.round(c)}px`,n.style.visibility="visible"):n.style.visibility="hidden"},refreshAnnotationPOIs(){this.clearAnnotationPOIs();const t=this.getAnnotationEntriesForPersistence();if(!t.length)return 0;const n=this.ensureAnnotationPOIGroup();let i=0;return t.forEach(o=>{const r=this.resolveObjectByTargetId(o.targetId);if(!r)return;const a=new e.Vector3;o.faceNumbers.forEach(e=>{const t=this.getFaceCentroidWorld(r,e);t&&a.add(t)}),a.divideScalar(o.faceNumbers.length);const s=this.createAnnotationPOIMarker(o,a,t.indexOf(o)+1);n.add(s),this.annotationPOIMarkers.push(s),i+=1}),n.visible=i>0,i},findAnnotationByFaceKey(e){return e&&this.annotationEntries.find(t=>{const n=String(t.targetId||t.object||t.target?.id||"").trim();if(!n)return!1;return(Array.isArray(t.faceNumbers)?t.faceNumbers:[t.faceIndex]).some(t=>this.getFaceSelectionKey(n,Number(t))===e)})||null},buildAnnotationDialog(){if(!u.container||this.annotationDialog)return;const e=document.createElement("div");e.id="annotationDialog",e.className="annotation-dialog",e.hidden=!0,e.innerHTML='\n <div class="annotation-dialog__backdrop" data-annotation-dismiss="true"></div>\n <div class="annotation-dialog__panel" role="dialog" aria-modal="true" aria-labelledby="annotationDialogTitle">\n <div class="annotation-dialog__header">\n <h3 id="annotationDialogTitle">Add annotation</h3>\n <button type="button" class="annotation-dialog__close" data-annotation-dismiss="true" aria-label="Close annotation dialog">&times;</button>\n </div>\n <form id="annotationDialogForm" class="annotation-dialog__form">\n <label>\n <span>Title</span>\n <input id="annotationTitleInput" name="title" type="text" maxlength="120" required />\n </label>\n <label>\n <span>Description</span>\n <textarea id="annotationDescriptionInput" name="description" rows="5" maxlength="4000"></textarea>\n </label>\n <div class="annotation-dialog__actions">\n <button type="submit">Save annotation</button>\n <button type="button" data-annotation-dismiss="true">Cancel</button>\n </div>\n </form>\n </div>\n ',document.body.appendChild(e),this.annotationDialog=e,this.annotationDialogHost=document.body,this.annotationDialogTitleInput=e.querySelector("#annotationTitleInput"),this.annotationDialogDescriptionInput=e.querySelector("#annotationDescriptionInput");const t=e.querySelector("#annotationDialogForm");this.bindEventListener(e,"click",e=>{const t=e.target?.closest?.("[data-annotation-dismiss='true']");t&&this.closeAnnotationDialog()}),this.bindEventListener(document,"keydown",e=>{"Escape"===e.key&&this.annotationDialog&&!this.annotationDialog.hidden&&(e.preventDefault(),this.closeAnnotationDialog())}),this.bindEventListener(t,"submit",e=>{e.preventDefault(),this.saveAnnotationFromDialog()}),this.bindEventListener(window,"resize",()=>this.updateAnnotationDialogBounds()),this.bindEventListener(window,"scroll",()=>this.updateAnnotationDialogBounds(),!0),this.bindEventListener(document,"fullscreenchange",()=>this.updateAnnotationDialogBounds())},updateAnnotationDialogBounds(){if(!this.annotationDialog)return;const e=t.mainCanvas?.getBoundingClientRect?.()||u.container?.getBoundingClientRect?.();if(!e)return;const n=Math.max(0,Math.round(e.left)),i=Math.max(0,Math.round(e.top)),o=Math.max(0,Math.round(e.width)),r=Math.max(0,Math.round(e.height));this.annotationDialog.style.left=`${n}px`,this.annotationDialog.style.top=`${i}px`,this.annotationDialog.style.width=`${o}px`,this.annotationDialog.style.height=`${r}px`},openAnnotationDialog(){if(!Array.isArray(this.selectedFaces)||0===this.selectedFaces.length)return void v("selectFaceRequired","warning");if(this.buildAnnotationDialog(),!this.annotationDialog)return;const e=this.selectedFaces.map(e=>String(e?.key||"").trim()).filter(Boolean);this.annotationTargetFaceKeys=e;const t=Array.from(new Set(e.map(e=>this.annotationEntries.find(t=>t.key===e)?.groupId||"").map(e=>String(e).trim()).filter(Boolean)));this.annotationBatchGroupId=1===t.length?t[0]:`anno-group-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;const n=e.map(e=>this.annotationEntries.find(t=>t.key===e)).filter(Boolean),i=Array.from(new Set(n.map(e=>String(e.title||"").trim()))),o=Array.from(new Set(n.map(e=>String(e.description||"").trim())));this.annotationDialogTitleInput.value=1===i.length?i[0]:"",this.annotationDialogDescriptionInput.value=1===o.length?o[0]:"",this.updateAnnotationDialogBounds(),this.annotationDialog.hidden=!1,this.closeAnnotationPOITooltip(),this.closeActionMenu(),this.annotationDialogTitleInput?.focus(),this.annotationDialogTitleInput?.select()},openAnnotationDialogWithAutoPicking(){this.pickingMode||(this.pickingMode=!0,this.RULER_MODE=!1,this.updateDistanceMeasurementControllerLabel(),this.updatePickingModeControllerLabel(),this.updatePickingControlsVisibility(),v("featureToggle","info",{feature:"Face picking",state:"enabled"})),Array.isArray(this.selectedFaces)&&0!==this.selectedFaces.length?this.openAnnotationDialog():v("selectFaceRequiredAgain","warning")},closeAnnotationDialog(){this.annotationDialog&&(this.annotationDialog.hidden=!0,this.annotationTargetFaceKeys=[],this.annotationBatchGroupId="")},saveAnnotationFromDialog(){if(!Array.isArray(this.annotationTargetFaceKeys)||0===this.annotationTargetFaceKeys.length)return v("noFacesSelected","warning"),void this.closeAnnotationDialog();const e=String(this.annotationDialogTitleInput?.value||"").trim(),t=String(this.annotationDialogDescriptionInput?.value||"").trim();if(!e)return v("titleRequired","warning"),void this.annotationDialogTitleInput?.focus();const n=this.annotationTargetFaceKeys.map(e=>{const t=this.selectedFaces.find(t=>t.key===e);if(t)return t;const n=this.findAnnotationByFaceKey(e);return n?{key:n.key,targetId:n.targetId||n.object||"",object:n.object||n.targetId||"",faceIndex:n.faceIndex}:null}).filter(Boolean);if(0===n.length)return v("facesInactive","warning"),void this.closeAnnotationDialog();const i=(new Date).toISOString();let o=0,r=0;const a=n[0].targetId,s=n.map(e=>Number(e.faceIndex)).filter(Number.isInteger),l={id:this.annotationBatchGroupId||`anno-${Date.now()}`,targetId:a,object:a,faceNumbers:s,faceIndex:s[0],target:{id:a,faces:s},title:e,description:t,updatedAt:i,createdAt:i},c=this.annotationEntries.findIndex(e=>e.id===l.id);c>=0?(this.annotationEntries.splice(c,1,l),o++):(this.annotationEntries.push(l),r++);const d=o+r;d>0&&v("annotationsSaved","success",{count:d,plural:1===d?"":"s"}),this.refreshAnnotationPOIs(),this.closeAnnotationDialog()},getAnnotationEntriesForPersistence(){return Array.isArray(this.annotationEntries)?this.annotationEntries.map((e,t)=>{if(!e||"object"!=typeof e)return null;const n=String(e.targetId||e.object||"").trim(),i=(Array.isArray(e.faceNumbers)?e.faceNumbers:[e.faceIndex]).map(e=>Number(e)).filter(e=>Number.isInteger(e)&&e>=0),o=i[0]??Number(e.faceIndex),r=Number.isInteger(o)&&o>=0?o:-1;if(!n||r<0)return null;const a=this.getFaceSelectionKey(n,r),s=`anno-${this.toStableIdToken(n)}-f${r}`;return{id:String(e.id||s),groupId:e.groupId?String(e.groupId):"",key:a,object:n,targetId:n,faceIndex:r,faceNumbers:i.length>0?i:[r],target:{id:n,faces:i.length>0?i:[r]},title:String(e.title||"").trim(),description:String(e.description||"").trim(),createdAt:e.createdAt?String(e.createdAt):"",updatedAt:e.updatedAt?String(e.updatedAt):""}}).filter(Boolean):[]},exportAnnotationsToIIIFXml(){const e=this.getAnnotationEntriesForPersistence(),t=new Map;e.forEach(e=>{const n=e.groupId||e.id;t.has(n)||t.set(n,{...e,faceNumbers:[]}),t.get(n).faceNumbers.push(...e.faceNumbers)});const n=document.implementation.createDocument("","",null),i=n.createElement("iiif:annotations");return i.setAttribute("xmlns:iiif","http://iiif.io/api/presentation/3#"),i.setAttribute("version","3.0"),i.setAttribute("generatedAt",(new Date).toISOString()),n.appendChild(i),t.forEach(e=>{const t=n.createElement("iiif:annotation");t.setAttribute("id",e.id),t.setAttribute("type","Annotation"),t.setAttribute("motivation","commenting"),e.groupId&&t.setAttribute("groupId",String(e.groupId));const o=n.createElement("iiif:body");o.setAttribute("type","TextualBody"),o.setAttribute("format","text/plain");const r=n.createElement("iiif:title");r.textContent=e.title||"",o.appendChild(r);const a=n.createElement("iiif:description");a.textContent=e.description||"",o.appendChild(a),t.appendChild(o);const s=n.createElement("iiif:target");s.setAttribute("id",e.targetId),s.setAttribute("faces",e.faceNumbers.join(",")),t.appendChild(s),i.appendChild(t)}),(new XMLSerializer).serializeToString(n)},downloadAnnotationsXmlFile(){const e=this.exportAnnotationsToIIIFXml();if(!e)return v("noAnnotationsToExport","warning"),!1;const t=u.fileObject?.basename||"annotations",n=`${String(t).replace(/[^a-zA-Z0-9._-]+/g,"_")||"annotations"}-iiif-annotations.xml`,i=new Blob([e],{type:"application/xml;charset=utf-8"}),o=URL.createObjectURL(i),r=document.createElement("a");return r.href=o,r.download=n,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>URL.revokeObjectURL(o),0),v("annotationsExported","success"),!0},exportIIIFManifest(){const e=u.fileObject?.originalPath||"";if(!e)return v("iiifUrlMissing","warning"),!1;const t=`${e}/scene`,n={"@context":"http://iiif.io/api/presentation/4/context.json",id:`${e}/manifest.json`,type:"Manifest",label:{en:[u.fileObject?.basename||"Model"]},items:[{id:t,type:"Scene",label:{en:[u.fileObject?.basename||"Model"]},backgroundColor:u.scene?.background?`#${u.scene.background.getHexString()}`:"#000000",items:[{id:`${t}/page/model`,type:"AnnotationPage",items:[{id:`${t}/annotation/model`,type:"Annotation",motivation:["painting"],body:{id:u.fileObject.originalPath,type:"Model",format:u.fileObject.mimeType||void 0},target:{id:t,type:"Scene"}}]}],annotations:[{id:`${t}/page/annotations`,type:"AnnotationPage",items:this.getAnnotationEntriesForPersistence().map(e=>({id:String(e.id),type:"Annotation",motivation:["commenting"],label:{en:[String(e.title||"").trim()]},created:e.createdAt||void 0,modified:e.updatedAt||void 0,target:{source:u.fileObject.originalPath,selector:{type:"JsonSelector",value:{targetId:e.targetId,faceIndex:e.faceIndex,faceNumbers:e.faceNumbers||[],selectorId:e.selectorId}}},body:{type:"TextualBody",value:String(e.description||"").trim()},AIM3DViewer:{groupId:e.groupId||"",key:e.key||"",object:e.object||""}}))}]}],AIM3DViewer:{version:"1.0",generatedAt:(new Date).toISOString(),camera:{position:u.camera.position.toArray(),target:u.controls?.target?u.controls.target.toArray():[0,0,0],up:u.camera.up.toArray(),fov:u.camera.fov,zoom:"number"==typeof u.controls?.zoom?u.controls.zoom:void 0,distance:u.camera.position.distanceTo(u.controls.target),perspectiveMode:u.camera.isPerspectiveCamera?"orthographic":"perspective"},viewer:{container:u.CONFIG?.viewer?.container||"DFG_3DViewer",mailUrl:u.CONFIG.mainUrl||"https://localhost",baseNamespace:"https://localhost",metadataUrl:"https://localhost",backgroundColor:u.scene?.background?.isColor?`#${u.scene.background.getHexString()}`:void 0,environmentMap:{intensity:u.environmentMapIntensity||.5,preset:u.environmentMapPreset||"neutral",enabled:u.environmentMapEnabled||!0},presentationMode:u.PRESENTATION_MODE||!1,sandbox:u.SANDBOX_MODE||!1,scale:u.CONFIG.viewer.scaleContainer||new Vector2(1,1),performance:u.CONFIG.viewer.performanceMode||"high-performance",units:u.CONFIG?.viewer?.measurement?.modelUnitInMeters,gallery:{build:u.CONFIG.viewer.gallery?.build||!1,container:u.CONFIG.viewer.gallery?.container||"AIM3DViewerContainer",imageClass:u.CONFIG.viewer.gallery?.imageClass||"AIM3DViewerGalleryImage",imageId:u.CONFIG.viewer.gallery?.imageId||"AIM3DViewerGalleryImage",buildFake:!0,testImages:[void 0]}},integration:{type:u.CONFIG.entity?"drupal":"none",bundle:u.CONFIG.entity?.bundle||"bd3d7baa74856d141bcff7b4193fa128",fieldDf:u.CONFIG.entity?.fieldDf||"field_df",exportViewer:u.CONFIG.entity?.exportViewer||"field_df",idUri:u.CONFIG.entity?.idUri||"/wisski/navigate/(.*)/view",viewEntityPath:u.CONFIG.entity?.viewEntityPath||"/wisski/navigate/",attributeId:u.CONFIG.entity?.attributeId||"wisski_id",metadata:{source:u.CONFIG.entity?.metadata?.source||""},fileUpload:u.CONFIG.viewer.fileUpload||"fbf95bddee5160d515b982b3fd2e05f7",fileName:u.CONFIG.viewer.fileName||"faa602a0be629324806aef22892cdbe5",imageGeneration:u.CONFIG.viewer.imageGeneration||"f605dc6b727a1099b9e52b3ccbdf5673"},lights:(u.scene?.children||[]).filter(e=>["DirectionalLight","SpotLight","PointLight","AmbientLight"].includes(e.type)).map(e=>({type:e.type,position:e.position?.toArray?.()||[0,0,0],target:e.target?.position?.toArray?.()||void 0,color:`#${e.color.getHexString()}`,intensity:e.intensity})),modelTransform:{position:u.mainObject?.position?.toArray?.()||[0,0,0],rotation:u.mainObject?.rotation?{x:u.mainObject.rotation.x,y:u.mainObject.rotation.y,z:u.mainObject.rotation.z,order:u.mainObject.rotation.order}:{x:0,y:0,z:0,order:"XYZ"},scale:u.mainObject?.scale?.toArray?.()||[1,1,1],wireframe:u.wireframeMode||!1}},modified:(new Date).toISOString()};n.AIM3DViewer.generatedAt=(new Date).toISOString(),u.fileObject?.iiifUrl&&(n.id=`${u.fileObject?.basename}_manifest.json`);const i=u.fileObject?.basename||"manifest",o=`${String(i).replace(/[^a-zA-Z0-9._-]+/g,"_")||"manifest"}-iiif-manifest.json`,r=new Blob([JSON.stringify(n,null,2)],{type:"application/json;charset=utf-8"}),a=URL.createObjectURL(r),s=document.createElement("a");return s.href=a,s.download=o,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(a),0),v("iiifManifestGenerated","success"),!0},ensureAnnotationImportInput(){if(this.annotationImportInput)return this.annotationImportInput;const e=document.createElement("input");return e.type="file",e.accept=".xml,text/xml,application/xml",e.hidden=!0,this.bindEventListener(e,"change",async e=>{const t=e?.target,n=t?.files?.[0];if(n)try{const e=await n.text(),t=this.importAnnotationsFromIIIFXml(e);t>0?v("annotationsImported","success",{count:t,plural:1===t?"":"s"}):v("noValidAnnotations","warning")}catch(e){console.error(e),v("annotationsImportError","error")}finally{t.value=""}}),document.body.appendChild(e),this.annotationImportInput=e,e},triggerAnnotationsXmlImport(){const e=this.ensureAnnotationImportInput();return!!e&&(e.click(),!0)},importAnnotationsFromIIIFXml(e){const t=String(e||"").trim();if(!t)return this.annotationEntries=[],0;let n;try{n=(new DOMParser).parseFromString(t,"application/xml")}catch(e){return 0}if(!n||n.querySelector("parsererror"))return 0;const i=Array.from(n.querySelectorAll("annotation, iiif\\:annotation")),o=[];return i.forEach((e,t)=>{const n=e.getAttribute("id")||"",i=e.getAttribute("groupId")||"",r=e.querySelector("target, iiif\\:target")||e.getElementsByTagName("target")[0]||e.getElementsByTagName("iiif:target")[0],a=String(r?.getAttribute?.("id")||"").trim(),s=String(r?.getAttribute?.("faces")||"").trim().split(/[,\s;|]+/).filter(Boolean).map(e=>Number(e)).filter(e=>Number.isInteger(e)&&e>=0),l=s[0];if(!a||!Number.isInteger(l))return;const c=e.querySelector("title, iiif\\:title, label, iiif\\:label")||e.getElementsByTagName("title")[0]||e.getElementsByTagName("iiif:title")[0],d=e.querySelector("description, iiif\\:description, value, iiif\\:value")||e.getElementsByTagName("description")[0]||e.getElementsByTagName("iiif:description")[0],u=this.getFaceSelectionKey(a,l);o.push({id:n||`anno-${this.toStableIdToken(a)}-f${l}-${t}`,groupId:i?String(i):"",key:u,object:a,targetId:a,faceIndex:l,faceNumbers:s.length>0?s:[l],target:{id:a,faces:s.length>0?s:[l]},title:String(c?.textContent||"").trim(),description:String(d?.textContent||"").trim()})}),this.annotationEntries=o,this.refreshAnnotationPOIs(),o.length},hydrateAnnotationsFromMetadataPayload(e){if(!e||"object"!=typeof e)return this.annotationEntries=[],this.refreshAnnotationPOIs(),0;const t=e.iiifAnnotationsXml||e.iiif_annotations_xml||e.annotationsXml||e.annotations_xml||"";return"string"==typeof t&&""!==t.trim()?this.importAnnotationsFromIIIFXml(t):Array.isArray(e.annotationEntries)?(this.annotationEntries=e.annotationEntries.map((e,t)=>{const n=String(e?.targetId||e?.object||e?.target?.id||"").trim(),i=(Array.isArray(e?.faceNumbers)?e.faceNumbers:Array.isArray(e?.target?.faces)?e.target.faces:[e?.faceIndex]).map(e=>Number(e)).filter(e=>Number.isInteger(e)&&e>=0),o=i[0];return n&&Number.isInteger(o)?{id:String(e?.id||`anno-${this.toStableIdToken(n)}-f${o}-${t}`),groupId:e?.groupId?String(e.groupId):"",key:this.getFaceSelectionKey(n,o),object:n,targetId:n,faceIndex:o,faceNumbers:i.length>0?i:[o],target:{id:n,faces:i.length>0?i:[o]},title:String(e?.title||"").trim(),description:String(e?.description||"").trim(),createdAt:e?.createdAt?String(e.createdAt):"",updatedAt:e?.updatedAt?String(e.updatedAt):""}:null}).filter(Boolean),this.refreshAnnotationPOIs(),this.annotationEntries.length):(this.annotationEntries=[],this.refreshAnnotationPOIs(),0)},extractAnnotationsXmlFromExportDocument(e){if(!e)return"";const t=e.querySelector("iiif\\:annotations, annotations, iiif_annotations, iiif_annotations_xml")||e.getElementsByTagName("iiif:annotations")[0]||e.getElementsByTagName("annotations")[0]||e.getElementsByTagName("iiif_annotations")[0]||e.getElementsByTagName("iiif_annotations_xml")[0];if(!t)return"";if("iiif_annotations_xml"===t.tagName)return String(t.textContent||"").trim();try{return(new XMLSerializer).serializeToString(t)}catch(e){return""}},applyPendingAnnotationsIfAny(){const e=String(this.pendingAnnotationsXml||"").trim();if(!e)return 0;const t=this.importAnnotationsFromIIIFXml(e);return this.pendingAnnotationsXml="",t}})}(Po),function(t){Object.assign(t,{createTriangleGeometry(t){const n=t?.object?.geometry?.attributes?.position,i=t?.face;if(!n||!i)return null;const o=new Float32Array([n.getX(i.a),n.getY(i.a),n.getZ(i.a),n.getX(i.b),n.getY(i.b),n.getZ(i.b),n.getX(i.c),n.getY(i.c),n.getZ(i.c)]),r=new e.BufferGeometry;return r.setAttribute("position",new e.BufferAttribute(o,3)),r.computeVertexNormals(),r},createPickingFaceOverlay(n,i={}){const o=t.createTriangleGeometry(n);if(!o)return null;const r=i.fillColor??16711680,a=i.lineColor??16777215,s=i.opacity??.65,l=new e.MeshBasicMaterial({color:r,side:e.DoubleSide,transparent:!0,opacity:s,depthTest:!0,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-2,toneMapped:!1}),c=new e.Mesh(o,l);c.renderOrder=999;const d=new e.EdgesGeometry(o),u=new e.LineBasicMaterial({color:a,transparent:!0,opacity:Math.min(s+.2,1),depthTest:!1,depthWrite:!1,toneMapped:!1}),p=new e.LineSegments(d,u);p.renderOrder=1e3;const h=new e.Group;return h.name="picking-face-overlay",h.userData.isPickingOverlay=!0,c.userData.isPickingOverlay=!0,p.userData.isPickingOverlay=!0,h.add(c),h.add(p),h},isPickingOverlayObject(e){let t=e;for(;t;){if(!0===t.userData?.isPickingOverlay||"picking-face-overlay"===t.name)return!0;t=t.parent}return!1},getPrimaryIntersection:e=>Array.isArray(e)&&0!==e.length?e.find(e=>!t.isPickingOverlayObject(e?.object))??null:null,getFaceSelectionKey:(e,t)=>e&&null!=t?`${e}:${t}`:"",findSelectedFaceIndex(e,n){const i=t.getFaceSelectionKey(e,n);return t.selectedFaces.findIndex(e=>e.key===i)},updateSelectedFacesCount(){t.pickingStats["Selected faces"]=Array.isArray(t.selectedFaces)?t.selectedFaces.length:0;(Array.isArray(t.selectedFaces)?t.selectedFaces.length:0)<1&&t.annotationDialog&&!1===t.annotationDialog.hidden&&t.closeAnnotationDialog(),t.updateAddAnnotationControllerState(),t.updatePickingHintVisibility()},toStableIdToken:e=>String(e||"").trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"target",getSelectionRootObject(e){let t=e;for(;t?.parent&&t.parent!==u.scene;)t=t.parent;return t||e},getSelectionRootSlot:e=>e&&Array.isArray(u.mainObject)?u.mainObject.findIndex(t=>t===e||Array.isArray(t)&&t.includes(e)):-1,getObjectHierarchyPath(e,t){if(!e||!t)return"";const n=[];let i=e;for(;i&&i!==t;){const e=i.parent;if(!e)break;const t=e.children.indexOf(i);n.push(t>=0?String(t):"x"),i=e}return n.reverse().join(".")||"root"},resolveFaceTargetId(e){if(!e)return"";const n=e.userData?.annotationTargetId||e.userData?.id;if(n)return String(n);const i=t.getSelectionRootObject(e),o=t.getSelectionRootSlot(i),r=t.getObjectHierarchyPath(e,i);let a=o>=0?`m${o}`:"m0";if(o>=0&&Array.isArray(u.mainObject?.[o])){const e=u.mainObject[o].indexOf(i);e>=0&&(a=`${a}.${e}`)}const s=`${a}:${r}`;return e.userData??={},e.userData.annotationTargetId=s,s},resolveObjectByTargetId(e){const t=String(e||"").trim().match(/^m(\d+)(?:\.(\d+))?:(.+)$/);if(!t)return null;const n=Number.parseInt(t[1],10),i=Number.parseInt(t[2]||"0",10),o=t[3]||"root";if(!Number.isInteger(n)||n<0)return null;const r=u.mainObject?.[n];if(!r)return null;let a=Array.isArray(r)?r[i]:r;if(!a)return null;if("root"===o)return a;const s=o.split(".").filter(Boolean);for(const e of s){const t=Number.parseInt(e,10);if(!Number.isInteger(t)||t<0)return null;if(a=a.children?.[t],!a)return null}return a},getFaceCentroidWorld(t,n){const i=t?.geometry;if(!i||!i.getAttribute)return null;const o=i.getAttribute("position");if(!o)return null;const r=Number(n);if(!Number.isInteger(r)||r<0)return null;let a=3*r,s=a+1,l=a+2;const c=i.getIndex?.()||i.index||null;if(c?.array){const e=c.array;if(l>=e.length)return null;a=e[a],s=e[s],l=e[l]}else if(l>=o.count)return null;const d=(new e.Vector3).fromBufferAttribute(o,a),u=(new e.Vector3).fromBufferAttribute(o,s),p=(new e.Vector3).fromBufferAttribute(o,l),h=d.add(u).add(p).multiplyScalar(1/3);return t.updateMatrixWorld?.(!0),h.applyMatrix4(t.matrixWorld),h},clearSelectedFaces(){Array.isArray(t.selectedFaces)&&0!==t.selectedFaces.length?(t.selectedFaces.forEach(e=>{t.disposeFaceOverlay(e)}),t.selectedFaces.length=0,t.updateSelectedFacesCount()):t.updateSelectedFacesCount()},restoreLastPickedFace(){t.lastPickedFace.overlay?(t.disposeFaceOverlay(t.lastPickedFace),t.lastPickedFace={id:"",object:"",faceIndex:null,overlay:null}):t.lastPickedFace={id:"",object:"",faceIndex:null,overlay:null}},pickFaces(e){const n=e?.object?.id??"",i=e?.faceIndex??null;if(!n)return void t.restoreLastPickedFace();if(t.lastPickedFace.object===n&&t.lastPickedFace.faceIndex===i)return;t.restoreLastPickedFace();const o=t.createPickingFaceOverlay(e,{fillColor:16726832,lineColor:16777215,opacity:.4});o&&(t.lastPickedFace={id:n,object:n,faceIndex:i,overlay:o},e.object.add(o))},toggleSelectedFace(e,n={}){const i=t.resolveFaceTargetId(e?.object),o=e?.object?.id??"",r=e?.faceIndex??null;if(!i||null===r)return;const a=!0===n.multiSelect,s=t.findSelectedFaceIndex(i,r);if(!a){const e=t.getFaceSelectionKey(i,r),n=s>=0&&1===t.selectedFaces.length&&t.selectedFaces[0]?.key===e;if(t.clearSelectedFaces(),n)return}if(s>=0){const[e]=t.selectedFaces.splice(s,1);return t.disposeFaceOverlay(e),void t.updateSelectedFacesCount()}const l=t.createPickingFaceOverlay(e,{fillColor:51283,lineColor:15269864,opacity:.5});l&&(e.object.add(l),t.selectedFaces.push({key:t.getFaceSelectionKey(i,r),targetId:i,object:i,runtimeObjectId:o,faceIndex:r,overlay:l}),t.updateSelectedFacesCount())},onPointerDown(e){t.disableInteractionHint(),e.stopPropagation(),0===e.button&&Y(t,e.clientX,e.clientY,t.onDownPosition)},onPointerUp(e){if(0===e.button&&(Y(t,e.clientX,e.clientY,t.onUpPosition),t.onUpPosition.x===t.onDownPosition.x&&t.onUpPosition.y===t.onDownPosition.y)){if(!t.pickingMode&&!t.RULER_MODE){const e=q(t,t.onUpPosition);if(e?.object)return void t.openAnnotationDialogFromPOIMarker(e.object);t.closeAnnotationPOITooltip()}if(t.pickingMode||t.RULER_MODE){const n=Z(t,t.onUpPosition);if(!n)return;t.RULER_MODE?t.buildRuler(n):t.pickingMode&&t.toggleSelectedFace(n,{multiSelect:e.shiftKey})}}},onPointerMove(e){if(Y(t,e.clientX,e.clientY,t.pointer),0!==e.buttons&&(t.disableInteractionHint(),t.closeAnnotationPOITooltip()),1!=e.buttons){if(!t.pickingMode&&!t.RULER_MODE)if(t.annotationDialog&&!1===t.annotationDialog.hidden)t.closeAnnotationPOITooltip();else{const e=q(t,t.pointer);e?.object?t.openAnnotationPOITooltip(e.object):t.closeAnnotationPOITooltip()}if(t.pickingMode){const e=Z(t,t.pointer);e?t.pickFaces(e):t.pickFaces("")}}else t.pointer.x!==t.onDownPosition.x&&t.pointer.y!==t.onDownPosition.y&&t.cameraLight.position.set(u.camera.position.x,u.camera.position.y,u.camera.position.z)}})}(Po),function(t){Object.assign(t,{buildRuler(n){t.rulerObject=new e.Object3D;const i=t.gridSize||u.gridSize||1,o=Math.max(i/150,.001),r=Math.max(i/100,.01),a=Math.max(i/200,.01);var s=new e.Mesh(new e.SphereGeometry(o,7,7),new e.MeshStandardMaterial({color:16711680,transparent:!0,opacity:.85,side:e.DoubleSide,depthTest:!1,depthWrite:!1})),l=new e.Vector3(n.point.x,n.point.y,n.point.z);s.position.set(l.x,l.y,l.z),t.rulerObject.add(s),t.linePoints.push(l);const c=(new e.BufferGeometry).setFromPoints(t.linePoints),d=new e.LineBasicMaterial({color:255}),p=new e.Line(c,d);t.rulerObject.add(p);var g,m,f,b=new e.LineBasicMaterial({color:255,linewidth:1,opacity:1,side:e.DoubleSide,depthTest:!1,depthWrite:!1});if(t.linePoints.length>1){var y=(m=t.linePoints[t.linePoints.length-2],{x:(f=l).x-m.x,y:f.y-m.y,z:f.z-m.z}),v=(g=y,Math.sqrt(Math.pow(g.x,2)+Math.pow(g.y,2)+Math.pow(g.z,2)));const n=t.formatMeasuredDistance(v);var w=function(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2,z:(t.z+e.z)/2}}(t.linePoints[t.linePoints.length-2],l);t.addTextPoint(n.text,r,w);for(var E=0;E<=100*v;){const n=[];var C=h(t.linePoints[t.linePoints.length-2],y,v,E/100);n.push(new e.Vector3(C.x,C.y,C.z)),n.push(new e.Vector3(C.x+a,C.y+a,C.z+a));const i=(new e.BufferGeometry).setFromPoints(n);var M=new e.Line(i,b);t.rulerObject.add(M),E+=10}}t.rulerObject.renderOrder=10,u.scene.add(t.rulerObject),t.ruler.push(t.rulerObject)}})}(Po),function(e){Object.assign(e,{isEmbedModeActive(){return!1===this.embedConfiguratorPanel?.hidden},isEmbedMode(){const e=new URLSearchParams(window.location.search).get("embed");return window.location.pathname.endsWith("/embed.html")||"1"===e||"true"===e},getEmbedPageUrl(){const e=new URL("embed.html",import.meta.url);return e.search="",e.hash="",e},async copyTextToClipboard(e){if(navigator.clipboard?.writeText)return void await navigator.clipboard.writeText(e);const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),t.remove()},getCurrentEmbedOptions({includeCamera:e=!1}={}){const t=u.CONFIG?.entity?.id,n={model:u.fileObject?.originalPath||u.container?.getAttribute("3d")||""||null,id:t||null,theme:"light"===this.currentTheme?"light":null,autorotate:!0===u.controls?.autoRotate,autorotateSpeed:Number.isFinite(u.controls?.autoRotateSpeed)?u.controls.autoRotateSpeed:null,disableInteraction:!0===this.urlOptions?.disableInteraction,hideUi:!0===this.urlOptions?.hideUi,hideMetadata:!0===this.urlOptions?.hideMetadata,presentationMode:!0===u.PRESENTATION_MODE,sandboxMode:!0===u.SANDBOX_MODE,cameraPosition:null,cameraTarget:null,fov:null};return e&&(n.cameraPosition=this.formatVector3Param(u.camera?.position),n.cameraTarget=this.formatVector3Param(u.controls?.target),n.fov=Number.isFinite(u.camera?.fov)?u.camera.fov:null),n},applyEmbedOptionsToInputs(e={}){console.log(this.embedConfigInputs),this.embedConfigInputs&&(this.embedConfigInputs.model.value=e.model??"",this.embedConfigInputs.id.value=e.id??"",this.embedConfigInputs.theme.value="light"===e.theme?"light":"dark",this.embedConfigInputs.autorotate.checked=!0===e.autorotate,this.embedConfigInputs.autorotateSpeed.value=Number.isFinite(e.autorotateSpeed)?String(e.autorotateSpeed):"",this.embedConfigInputs.disableInteraction.checked=!0===e.disableInteraction,this.embedConfigInputs.hideUi.checked=!0===e.hideUi,this.embedConfigInputs.hideMetadata.checked=!0===e.hideMetadata,this.embedConfigInputs.presentationMode.checked=!0===e.presentationMode,this.embedConfigInputs.camPos.value=e.cameraPosition??"",this.embedConfigInputs.camTarget.value=e.cameraTarget??"",this.embedConfigInputs.fov.value=Number.isFinite(e.fov)?String(e.fov):"",console.log("fillConfiguratorWithCurrentCamera",this.embedConfigInputs.camPos.value))},setEmbedInputError(e,t,n=""){e&&(e.classList.toggle("embed-input-invalid",t),t&&n?(e.setAttribute("title",n),e.setAttribute("aria-invalid","true")):(e.removeAttribute("title"),e.removeAttribute("aria-invalid")))},validateEmbedInputFields(){if(!this.embedConfigInputs)return!0;const{camPos:e,camTarget:t,fov:n}=this.embedConfigInputs,i=e.value.trim(),o=t.value.trim(),r=n.value.trim(),a=""===i||null!==this.parseVector3Param(i),s=""===o||null!==this.parseVector3Param(o),l=this.parseFloatParam(r),c=""===r||Number.isFinite(l)&&l>=1&&l<=179;return this.setEmbedInputError(e,!a,"Use format: x,y,z (for example 1.2,0.8,2.5)"),this.setEmbedInputError(t,!s,"Use format: x,y,z (for example 0,0,0)"),this.setEmbedInputError(n,!c,"FOV must be a number from 1 to 179"),a&&s&&c},buildEmbedPayload(e={}){const t=this.getEmbedPageUrl(),n=new URLSearchParams;return e.model?n.set("model",e.model):e.id&&n.set("id",e.id),"light"===e.theme&&n.set("theme",e.theme),!0===e.autorotate&&(n.set("autorotate","1"),Number.isFinite(e.autorotateSpeed)&&n.set("autorotateSpeed",String(e.autorotateSpeed))),e.disableInteraction&&n.set("disableInteraction","1"),e.hideUi&&n.set("hideUi","1"),e.hideMetadata&&n.set("hideMetadata","1"),e.presentationMode&&n.set("presentationMode","1"),e.sandboxMode&&n.set("sandbox","1"),e.cameraPosition&&n.set("camPos",e.cameraPosition),e.cameraTarget&&n.set("camTarget",e.cameraTarget),Number.isFinite(e.fov)&&n.set("fov",String(e.fov)),t.search=n.toString(),{url:t.toString(),code:`<iframe src="${t.toString()}" title="DFG 3D Viewer" loading="lazy" allow="fullscreen; xr-spatial-tracking" referrerpolicy="strict-origin-when-cross-origin" style="width:100%; aspect-ratio: 16 / 9; border: 0;"></iframe>`}},getSharePayload(){return this.buildEmbedPayload(this.getCurrentEmbedOptions({includeCamera:!0}))},collectEmbedConfiguratorOptions(){console.trace("collectEmbedConfiguratorOptions");const e=this.embedConfigInputs;if(!e)return this.getCurrentEmbedOptions({includeCamera:!0});const t=this.parseVector3Param(e.camPos.value),n=this.parseVector3Param(e.camTarget.value),i=this.parseFloatParam(e.fov.value),o=Number.isFinite(i)?Math.min(179,Math.max(1,i)):null;return{model:e.model.value.trim()||null,id:e.id.value.trim()||null,theme:"light"===e.theme.value?"light":null,autorotate:e.autorotate.checked,autorotateSpeed:this.parseFloatParam(e.autorotateSpeed.value),disableInteraction:e.disableInteraction.checked,hideUi:e.hideUi.checked,hideMetadata:e.hideMetadata.checked,presentationMode:e.presentationMode.checked,cameraPosition:this.formatVector3Param(t),cameraTarget:this.formatVector3Param(n),fov:o}},hasEmbedSourceSelection:(e={})=>Boolean(e.model||e.id),notifyMissingEmbedSource({force:e=!1}={}){!e&&this.embedMissingSourceNotified||(v("embedSourceMissing","warning"),this.embedMissingSourceNotified=!0)},updateEmbedConfiguratorPreview(){if(!this.embedConfigInputs)return;if(this.updatingEmbedFields)return;this.validateEmbedInputFields();const e=this.collectEmbedConfiguratorOptions();this.hasEmbedSourceSelection(e)?this.embedMissingSourceNotified=!1:this.notifyMissingEmbedSource();const t=this.buildEmbedPayload(e);this.embedConfigInputs.url.value=t.url,this.embedConfigInputs.iframe.value=t.code,this.embedConfigPreviewFrame&&(this.embedConfigPreviewFrame.src=t.url)},fillConfiguratorWithCurrentCamera(){this.embedConfigInputs&&(this.updatingEmbedFields=!0,this.embedConfigInputs.camPos.value=this.formatVector3Param(u.camera?.position)||"",this.embedConfigInputs.camTarget.value=this.formatVector3Param(u.controls?.target)||"",this.embedConfigInputs.fov.value=Number.isFinite(u.camera?.fov)?String(u.camera.fov):"",this.updatingEmbedFields=!1,this.updateEmbedConfiguratorPreview())},resetEmbedConfiguratorFromViewerState(){this.embedConfigInputs&&(this.applyEmbedOptionsToInputs(this.getCurrentEmbedOptions({includeCamera:!0})),this.updateEmbedConfiguratorPreview())},toggleEmbedConfigurator(e){if(e?.preventDefault?.(),this.closeActionMenu(),!this.embedConfiguratorPanel)return;const t=!0===this.embedConfiguratorPanel.hidden;this.embedConfiguratorPanel.hidden=!t,t&&this.updateEmbedConfiguratorPreview(),this.updateEmbedMenuEntryState()},openEmbedConfiguratorFromMenu(e){this.toggleEmbedConfigurator(e)},createEmbedConfiguratorPanel(){if(!u.container||this.embedConfiguratorPanel)return;const e=this.getCurrentEmbedOptions({includeCamera:!0}),t=y("embedPanel.title","Embed options"),n=y("embedPanel.closeAria","Close embed options"),i=y("embedPanel.modelUrl","Model URL"),o=y("embedPanel.modelUrlPlaceholder","/examples/box.glb"),r=y("embedPanel.entityId","Entity ID"),a=y("embedPanel.theme","Theme"),s=y("embedPanel.themeDark","Dark"),l=y("embedPanel.themeLight","Light"),c=y("embedPanel.autoRotateSpeed","Auto-rotate speed"),d=y("embedPanel.cameraPosition","Camera position"),p=y("embedPanel.cameraTarget","Camera target"),h=y("embedPanel.cameraVectorPlaceholder","x,y,z"),g=y("embedPanel.fov","FOV"),m=y("embedPanel.autoRotate","Auto-rotate"),f=y("embedPanel.disableInteraction","Disable interaction"),b=y("embedPanel.hideActionMenu","Hide action menu"),w=y("embedPanel.hideMetadata","Hide metadata"),E=y("embedPanel.presentationMode","Presentation mode"),C=y("embedPanel.useCurrentCamera","Use Current Camera"),M=y("embedPanel.resetFromViewer","Reset From Viewer"),S=y("embedPanel.copyUrl","Copy URL"),I=y("embedPanel.copyIframe","Copy Iframe"),A=y("embedPanel.embedUrl","Embed URL"),L=y("embedPanel.iframeCode","Iframe code"),O=y("embedPanel.preview","Preview"),_=y("embedPanel.previewTitle","Embed preview"),P=document.createElement("div");P.id="embedConfiguratorPanel",P.hidden=!0,P.innerHTML=`\n <div class="embed-config-header">\n <span>${t}</span>\n <button id="embedClosePanel" type="button" aria-label="${n}">X</button>\n </div>\n <div class="embed-config-layout">\n <div class="embed-config-main">\n <div class="embed-config-grid">\n <label>${i}<input id="embedModelInput" type="text" placeholder="${o}" value="${e.model??""}" /></label>\n <label>${r}<input id="embedIdInput" type="text" value="${e.id??""}" /></label>\n <label>${a}\n <select id="embedThemeInput">\n <option value="dark">${s}</option>\n <option value="light"${"light"===e.theme?" selected":""}>${l}</option>\n </select>\n </label>\n <label>${c}<input id="embedAutorotateSpeedInput" type="number" step="0.1" value="${Number.isFinite(e.autorotateSpeed)?e.autorotateSpeed:""}" /></label>\n <label>${d}<input id="embedCamPosInput" type="text" placeholder="${h}" value="${e.cameraPosition??""}" /></label>\n <label>${p}<input id="embedCamTargetInput" type="text" placeholder="${h}" value="${e.cameraTarget??""}" /></label>\n <label>${g}<input id="embedFovInput" type="number" step="1" min="1" max="179" value="${Number.isFinite(e.fov)?e.fov:""}" /></label>\n </div>\n <div class="embed-config-checks">\n <label><input id="embedAutorotateInput" type="checkbox"${e.autorotate?" checked":""} /> ${m}</label>\n <label><input id="embedDisableInteractionInput" type="checkbox"${e.disableInteraction?" checked":""} /> ${f}</label>\n <label><input id="embedHideUiInput" type="checkbox"${e.hideUi?" checked":""} /> ${b}</label>\n <label><input id="embedHideMetadataInput" type="checkbox"${e.hideMetadata?" checked":""} /> ${w}</label>\n <label><input id="embedPresentationModeInput" type="checkbox"${e.presentationMode?" checked":""} /> ${E}</label>\n </div>\n <div class="embed-config-actions">\n <button id="embedUseCurrentCamera" type="button">${C}</button>\n <button id="embedResetFromViewer" type="button">${M}</button>\n <button id="embedCopyUrl" type="button">${S}</button>\n <button id="embedCopyIframe" type="button">${I}</button>\n </div>\n <label class="embed-config-field">${A}<textarea id="embedUrlOutput" readonly></textarea></label>\n <label class="embed-config-field">${L}<textarea id="embedIframeOutput" readonly></textarea></label>\n </div>\n <div class="embed-config-preview-side">\n <span>${O}</span>\n <iframe id="embedPreviewFrame" title="${_}" loading="lazy"></iframe>\n </div>\n </div>\n `,u.container.appendChild(P),this.embedConfiguratorPanel=P,this.embedConfigInputs={model:P.querySelector("#embedModelInput"),id:P.querySelector("#embedIdInput"),theme:P.querySelector("#embedThemeInput"),autorotate:P.querySelector("#embedAutorotateInput"),autorotateSpeed:P.querySelector("#embedAutorotateSpeedInput"),disableInteraction:P.querySelector("#embedDisableInteractionInput"),hideUi:P.querySelector("#embedHideUiInput"),hideMetadata:P.querySelector("#embedHideMetadataInput"),presentationMode:P.querySelector("#embedPresentationModeInput"),camPos:P.querySelector("#embedCamPosInput"),camTarget:P.querySelector("#embedCamTargetInput"),fov:P.querySelector("#embedFovInput"),url:P.querySelector("#embedUrlOutput"),iframe:P.querySelector("#embedIframeOutput")},this.embedConfigPreviewFrame=P.querySelector("#embedPreviewFrame");[this.embedConfigInputs.model,this.embedConfigInputs.id,this.embedConfigInputs.theme,this.embedConfigInputs.autorotate,this.embedConfigInputs.autorotateSpeed,this.embedConfigInputs.disableInteraction,this.embedConfigInputs.hideUi,this.embedConfigInputs.hideMetadata,this.embedConfigInputs.presentationMode,this.embedConfigInputs.camPos,this.embedConfigInputs.camTarget,this.embedConfigInputs.fov].forEach(e=>{if(!e)return;const t="checkbox"===e.type||"SELECT"===e.tagName?"change":"input";this.bindEventListener(e,t,()=>this.updateEmbedConfiguratorPreview())});const x=P.querySelector("#embedUseCurrentCamera"),T=P.querySelector("#embedResetFromViewer"),k=P.querySelector("#embedCopyUrl"),F=P.querySelector("#embedCopyIframe"),j=P.querySelector("#embedClosePanel");this.bindEventListener(x,"click",()=>this.fillConfiguratorWithCurrentCamera()),this.bindEventListener(T,"click",()=>this.resetEmbedConfiguratorFromViewerState()),this.bindEventListener(j,"click",()=>{this.closeEmbedConfigurator()}),this.bindEventListener(k,"click",async()=>{try{const e=this.collectEmbedConfiguratorOptions();if(!this.hasEmbedSourceSelection(e))return void this.notifyMissingEmbedSource({force:!0});const t=this.buildEmbedPayload(e);await this.copyTextToClipboard(t.url),v("embedUrlCopied","success")}catch(e){this.reportError(e,{context:"Copy embed URL failed"}),v("embedUrlCopyError","error")}}),this.bindEventListener(F,"click",async()=>{try{const e=this.collectEmbedConfiguratorOptions();if(!this.hasEmbedSourceSelection(e))return void this.notifyMissingEmbedSource({force:!0});const t=this.buildEmbedPayload(e);await this.copyTextToClipboard(t.code),v("embedIframeCopied","success")}catch(e){this.reportError(e,{context:"Copy embed iframe failed"}),v("embedIframeCopyError","error")}}),this.updateEmbedConfiguratorPreview()},async copyEmbedCode(e){e?.preventDefault?.(),this.closeActionMenu();try{const{code:e}=this.getSharePayload();await this.copyTextToClipboard(e),v("embedCodeCopied","success")}catch(e){this.reportError(e,{context:"Copy embed code failed"}),v("embedCodeCopyError","error")}},updateEmbedMenuEntryState(){if(!this.viewEntity)return;const e=this.isEmbedModeActive(),t=e?y("menu.exitEmbed","Exit embed"):y("menu.embed","Embed"),n=e?"embed-exit-icon":"embed-icon";this.viewEntity.innerHTML=`<span class="${n}"></span><span>${t}</span>`;const i=e?y("menu.exitEmbedMode","Exit embed mode"):y("menu.openEmbedOptions","Open embed options");this.viewEntity.setAttribute("aria-label",i),this.viewEntity.setAttribute("title",i)},closeEmbedConfigurator(){this.embedConfiguratorPanel&&(this.embedConfiguratorPanel.hidden=!0),this.updateEmbedMenuEntryState()},closeEmbedMode(){this.closeEmbedConfigurator()}})}(Po),window.Viewer=Po,(async()=>{try{await Po.MainInit()}catch(e){Po.renderFatalError(e)}})();export{Po as Viewer,To as expectWebGL};
//# sourceMappingURL=main.js.map