@aceshooting/lyra-ui 30.8.0 → 30.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/components/charts/chart/box-plot-loader.js +1 -1
  3. package/dist/components/charts/chart/chart-core-loader.js +1 -1
  4. package/dist/components/charts/chart/chart-feature-loader.js +1 -1
  5. package/dist/components/charts/chart-3d/chart-3d-engine.js +1 -1
  6. package/dist/components/conversation/code-block/code-loader.js +1 -1
  7. package/dist/components/conversation/code-block/shiki-oniguruma.js +1 -1
  8. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  9. package/dist/components/conversation/markdown/katex-loader.js +1 -1
  10. package/dist/components/conversation/markdown/markdown-loader.js +1 -1
  11. package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
  12. package/dist/components/media/flag/flag-peer-bulk-standard.js +1 -1
  13. package/dist/components/media/flag/flag-peer-bulk.js +1 -1
  14. package/dist/components/media/flag/flag-peer.js +1 -1
  15. package/dist/components/media/map/map-feature-loader.js +1 -1
  16. package/dist/components/media/map/map-loader.js +1 -1
  17. package/dist/components/media/qr-code/qr-code-loader.js +1 -1
  18. package/dist/components/retrieval/embedding-explorer/embedding-explorer-engine.js +1 -1
  19. package/dist/components/retrieval/graph/graph-engine-adapter.js +1 -1
  20. package/dist/components/retrieval/graph/graph-loader.js +1 -1
  21. package/dist/components/utility/icon/dompurify-loader.js +1 -1
  22. package/dist/components/viewers/calendar-viewer/calendar-loader.js +1 -1
  23. package/dist/components/viewers/docx-viewer/docx-loader.js +1 -1
  24. package/dist/components/viewers/ebook-viewer/ebook-loader.js +1 -1
  25. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
  26. package/dist/components/viewers/ebook-viewer/epub-unload-guard.js +1 -0
  27. package/dist/components/viewers/email-viewer/email-loader.js +1 -1
  28. package/dist/components/viewers/html-viewer/dompurify-loader.js +1 -1
  29. package/dist/components/viewers/model-viewer/model-viewer-loader.js +1 -1
  30. package/dist/components/viewers/notebook-viewer/dompurify-loader.js +1 -1
  31. package/dist/components/viewers/pdf-viewer/pdf-loader.js +1 -1
  32. package/dist/components/viewers/pptx-viewer/pptx-loader.js +1 -1
  33. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-loader.js +1 -1
  34. package/dist/components/viewers/svg-viewer/dompurify-loader.js +1 -1
  35. package/dist/internal/dompurify-loader.js +1 -1
  36. package/dist/internal/locale-loaders.generated.js +1 -1
  37. package/dist/internal/map-scene-layer-runtime.js +1 -1
  38. package/dist/internal/media-panorama.js +1 -1
  39. package/dist/internal/package-metadata.js +1 -1
  40. package/dist/internal/papaparse-loader.js +1 -1
  41. package/dist/theme/theme.js +1 -1
  42. package/dist/theme-core.css +1 -0
  43. package/dist/utilities/scoped-registry.js +1 -1
  44. package/llms/peers.md +1 -1
  45. package/llms/shared/ai-and-peers.md +34 -0
  46. package/llms/shared/imports-and-registration.md +2 -0
  47. package/llms/shared/styles-and-tokens.md +47 -1
  48. package/llms/shared.md +83 -1
  49. package/package.json +10 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 30.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b96b689: Optional peers no longer have to be installed for an application to bundle. Published peer imports now sit in a `try` block, which esbuild, the Angular `application` builder, Next.js, webpack and Rspack treat as non-fatal when the peer is absent; before this, they failed with "Could not resolve" or "Module not found" for peers the application never uses, including every `@aceshooting/lyra-translations` locale catalog. A missing peer still reaches the same loader at run time, so components keep failing closed with their documented state. Parcel still needs an `alias` entry; see "Bundling without an optional peer" in the AI types and optional peers guide.
8
+ - b96b689: New `@aceshooting/lyra-ui/theme-core.css` lean theme entry for single-look applications: `theme.css` without the built-in Shadcn, Glass and Emerald profile, resolving to the Lyra look, Solid surface and no accent (about 83 KB against 104 KB raw). `looks/*.css`, `surfaces/glass.css`, `accents.css` and `density.css` add the choices an application selects, and the composition resolves identically to `theme.css`. Development builds now also warn when a selected default-profile look, surface or accent has no stylesheet under `theme-core.css`.
9
+
10
+ ### Patch Changes
11
+
12
+ - 8e590fc: `<lr-ebook-viewer>` no longer lets epub.js register a window `unload` listener. epub.js adds one for every rendition and never removes it, so each closed book stayed reachable from the window, and browsers that disallow `unload` by default (Chromium 158 and later) logged a permissions-policy violation on every render. The viewer already releases its rendition and book when it disconnects; scroll, resize and page snapping are unchanged.
13
+ - d90f34a: `createScopedRegistry(definitions, { document })` now constructs its elements in Firefox when `document` is an iframe or detached document. Firefox, which now ships native scoped custom element registries, left such elements unconstructed and logged a `NotSupportedError`; the registry now upgrades each element after adopting it into the owner document, and throws if a definition still fails to construct instead of returning an inert element.
14
+ - @aceshooting/lyra-translations@30.9.0
15
+
3
16
  ## 30.8.0
4
17
 
5
18
  ### Minor Changes
@@ -1 +1 @@
1
- import{loadChartJs}from"./chart-core-loader.js";import{resolveOptionalPeerCapability,unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";function isConstructor(value){if(typeof value!="function")return!1;try{return Reflect.construct(Object,[],value),!0}catch{return!1}}function missingBoxPlotCapability(candidate){if(typeof candidate!="object"&&typeof candidate!="function"||candidate===null)return"module namespace";const module=candidate;if(!isConstructor(module.BoxPlotController))return"BoxPlotController";if(!isConstructor(module.BoxAndWiskers))return"BoxAndWiskers"}function isBoxPlotModule(candidate){return missingBoxPlotCapability(candidate)===void 0}function resolveBoxPlotModule(value){const module=resolveOptionalPeerCapability(value,isBoxPlotModule);if(module)return module;const candidate=unwrapOptionalPeerDefault(value),missing=missingBoxPlotCapability(candidate)??"module namespace";throw new Error(`Invalid optional peer \`@sgratzl/chartjs-chart-boxplot\`: missing or invalid \`${missing}\` constructor.`)}async function loadBoxPlotAndRegister(loadChart=loadChartJs,importBoxPlot=()=>import("@sgratzl/chartjs-chart-boxplot")){try{const[chartMod,imported]=await Promise.all([loadChart(),importBoxPlot()]);if(!chartMod)return null;const boxMod=resolveBoxPlotModule(imported);return chartMod.Chart.register(boxMod.BoxPlotController,boxMod.BoxAndWiskers),boxMod}catch(error){return console.warn("<lr-box-plot> needs the optional peer dependency `@sgratzl/chartjs-chart-boxplot` — install it with `pnpm add @sgratzl/chartjs-chart-boxplot`.",error),null}}export{loadBoxPlotAndRegister};
1
+ import{loadChartJs}from"./chart-core-loader.js";import{resolveOptionalPeerCapability,unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";function isConstructor(value){if(typeof value!="function")return!1;try{return Reflect.construct(Object,[],value),!0}catch{return!1}}function missingBoxPlotCapability(candidate){if(typeof candidate!="object"&&typeof candidate!="function"||candidate===null)return"module namespace";const module=candidate;if(!isConstructor(module.BoxPlotController))return"BoxPlotController";if(!isConstructor(module.BoxAndWiskers))return"BoxAndWiskers"}function isBoxPlotModule(candidate){return missingBoxPlotCapability(candidate)===void 0}function resolveBoxPlotModule(value){const module=resolveOptionalPeerCapability(value,isBoxPlotModule);if(module)return module;const candidate=unwrapOptionalPeerDefault(value),missing=missingBoxPlotCapability(candidate)??"module namespace";throw new Error(`Invalid optional peer \`@sgratzl/chartjs-chart-boxplot\`: missing or invalid \`${missing}\` constructor.`)}async function loadBoxPlotAndRegister(loadChart=loadChartJs,importBoxPlot=()=>(async()=>{try{return await import("@sgratzl/chartjs-chart-boxplot")}catch(e){throw e}})()){try{const[chartMod,imported]=await Promise.all([loadChart(),importBoxPlot()]);if(!chartMod)return null;const boxMod=resolveBoxPlotModule(imported);return chartMod.Chart.register(boxMod.BoxPlotController,boxMod.BoxAndWiskers),boxMod}catch(error){return console.warn("<lr-box-plot> needs the optional peer dependency `@sgratzl/chartjs-chart-boxplot` — install it with `pnpm add @sgratzl/chartjs-chart-boxplot`.",error),null}}export{loadBoxPlotAndRegister};
@@ -1 +1 @@
1
- import{resolveOptionalPeerCapability,unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";const CHART_REGISTERABLE_KEYS=["LineController","BarController","ScatterController","DoughnutController","PieController","RadarController","PolarAreaController","BubbleController","LineElement","PointElement","BarElement","ArcElement","LinearScale","CategoryScale","RadialLinearScale","LogarithmicScale","Filler","Tooltip","Legend"];function isObjectLike(value){return(typeof value=="object"||typeof value=="function")&&value!==null}function isConstructor(value){if(typeof value!="function")return!1;try{return Reflect.construct(Object,[],value),!0}catch{return!1}}function missingChartCapability(candidate){if(!isObjectLike(candidate))return"module namespace";if(!isConstructor(candidate.Chart))return"Chart";if(typeof candidate.Chart.register!="function")return"Chart.register";if(!isObjectLike(candidate.defaults))return"defaults";for(const key of CHART_REGISTERABLE_KEYS)if(!isObjectLike(candidate[key]))return key}function isChartJsModule(candidate){return missingChartCapability(candidate)===void 0}function resolveChartJsModule(value){const module=resolveOptionalPeerCapability(value,isChartJsModule);if(module)return module;const candidate=unwrapOptionalPeerDefault(value),missing=missingChartCapability(candidate)??"module namespace";throw new Error(`Invalid optional peer \`chart.js\`: missing or invalid \`${missing}\` capability.`)}let chartJs,registered=!1;async function loadChartModule(importChart=()=>import("chart.js")){try{return resolveChartJsModule(await importChart())}catch(err){return console.warn("<lr-chart> needs the optional peer dependency `chart.js` — install it with `pnpm add chart.js`:",err),null}}function registerCore(mod){registered||(mod.Chart.register(mod.LineController,mod.BarController,mod.ScatterController,mod.DoughnutController,mod.PieController,mod.RadarController,mod.PolarAreaController,mod.BubbleController,mod.LineElement,mod.PointElement,mod.BarElement,mod.ArcElement,mod.LinearScale,mod.CategoryScale,mod.RadialLinearScale,mod.LogarithmicScale,mod.Filler,mod.Tooltip,mod.Legend),registered=!0)}async function loadAndRegisterChartModule(importChart=()=>import("chart.js"),register=registerCore){const mod=await loadChartModule(importChart);if(!mod)return null;try{return register(mod),mod}catch(error){return console.warn("<lr-chart> could not register the optional `chart.js` peer:",error),null}}function loadChartJs(){return chartJs||(chartJs=loadAndRegisterChartModule()),chartJs}export{loadAndRegisterChartModule,loadChartJs,loadChartModule};
1
+ import{resolveOptionalPeerCapability,unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";const CHART_REGISTERABLE_KEYS=["LineController","BarController","ScatterController","DoughnutController","PieController","RadarController","PolarAreaController","BubbleController","LineElement","PointElement","BarElement","ArcElement","LinearScale","CategoryScale","RadialLinearScale","LogarithmicScale","Filler","Tooltip","Legend"];function isObjectLike(value){return(typeof value=="object"||typeof value=="function")&&value!==null}function isConstructor(value){if(typeof value!="function")return!1;try{return Reflect.construct(Object,[],value),!0}catch{return!1}}function missingChartCapability(candidate){if(!isObjectLike(candidate))return"module namespace";if(!isConstructor(candidate.Chart))return"Chart";if(typeof candidate.Chart.register!="function")return"Chart.register";if(!isObjectLike(candidate.defaults))return"defaults";for(const key of CHART_REGISTERABLE_KEYS)if(!isObjectLike(candidate[key]))return key}function isChartJsModule(candidate){return missingChartCapability(candidate)===void 0}function resolveChartJsModule(value){const module=resolveOptionalPeerCapability(value,isChartJsModule);if(module)return module;const candidate=unwrapOptionalPeerDefault(value),missing=missingChartCapability(candidate)??"module namespace";throw new Error(`Invalid optional peer \`chart.js\`: missing or invalid \`${missing}\` capability.`)}let chartJs,registered=!1;async function loadChartModule(importChart=()=>(async()=>{try{return await import("chart.js")}catch(e){throw e}})()){try{return resolveChartJsModule(await importChart())}catch(err){return console.warn("<lr-chart> needs the optional peer dependency `chart.js` — install it with `pnpm add chart.js`:",err),null}}function registerCore(mod){registered||(mod.Chart.register(mod.LineController,mod.BarController,mod.ScatterController,mod.DoughnutController,mod.PieController,mod.RadarController,mod.PolarAreaController,mod.BubbleController,mod.LineElement,mod.PointElement,mod.BarElement,mod.ArcElement,mod.LinearScale,mod.CategoryScale,mod.RadialLinearScale,mod.LogarithmicScale,mod.Filler,mod.Tooltip,mod.Legend),registered=!0)}async function loadAndRegisterChartModule(importChart=()=>(async()=>{try{return await import("chart.js")}catch(e){throw e}})(),register=registerCore){const mod=await loadChartModule(importChart);if(!mod)return null;try{return register(mod),mod}catch(error){return console.warn("<lr-chart> could not register the optional `chart.js` peer:",error),null}}function loadChartJs(){return chartJs||(chartJs=loadAndRegisterChartModule()),chartJs}export{loadAndRegisterChartModule,loadChartJs,loadChartModule};
@@ -1 +1 @@
1
- import{resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";import{loadChartJs,loadChartModule}from"./chart-core-loader.js";import{notifyAnnotationPluginRegistered}from"../../../internal/chart-annotation-registration.js";function isObjectLike(value){return(typeof value=="object"||typeof value=="function")&&value!==null}function isChartPlugin(candidate){return isObjectLike(candidate)&&typeof candidate.id=="string"&&candidate.id.trim().length>0}function resolveChartPlugin(value,packageName){const plugin=resolveOptionalPeerCapability(value,isChartPlugin);if(plugin)return plugin;throw new Error(`Invalid optional peer \`${packageName}\`: expected a plugin with a non-empty string \`id\`.`)}let zoomResultLoad,dataLabelsResultLoad,annotationResultLoad,zoomLoad,dataLabelsLoad;async function loadChartAndZoom(importChart=()=>import("chart.js"),importZoom=()=>import("chartjs-plugin-zoom"),needsZoom=!1){const mod=await loadChartModule(importChart);if(!mod)return null;if(!needsZoom)return{mod,zoomPlugin:void 0};let zoomPlugin;try{zoomPlugin=resolveChartPlugin(await importZoom(),"chartjs-plugin-zoom")}catch(err){console.warn("<lr-chart> zoom support needs the optional peer dependency `chartjs-plugin-zoom` — charts still render without it, but the `zoomable` attribute has no effect until it is installed with `pnpm add chartjs-plugin-zoom`:",err)}return{mod,zoomPlugin}}async function loadChartAndRegisterZoom(loadChart,importZoom=()=>import("chartjs-plugin-zoom")){const mod=await loadChart();if(!mod)return{kind:"core-unavailable"};const zoomPlugin=(await loadChartAndZoom(()=>Promise.resolve(mod),importZoom,!0))?.zoomPlugin;if(!zoomPlugin)return{kind:"feature-unavailable",mod};try{mod.Chart.register(zoomPlugin)}catch(err){return console.warn("<lr-chart> zoom support could not be enabled — charts still render without it, but the `zoomable` attribute has no effect:",err),{kind:"feature-unavailable",mod}}return{kind:"available",mod,plugin:zoomPlugin}}function loadChartJsWithZoomResult(importZoom=()=>import("chartjs-plugin-zoom")){return zoomResultLoad??=loadChartAndRegisterZoom(loadChartJs,importZoom)}function loadChartJsWithZoom(importZoom=()=>import("chartjs-plugin-zoom")){return zoomLoad??=loadChartJsWithZoomResult(importZoom).then(result=>result.kind==="core-unavailable"?null:result.mod)}async function loadDataLabelsPlugin(importDataLabels=()=>import("chartjs-plugin-datalabels")){try{return resolveChartPlugin(await importDataLabels(),"chartjs-plugin-datalabels")}catch(err){console.warn("<lr-chart> data labels need the optional peer dependency `chartjs-plugin-datalabels` — charts still render without it, but the `data-labels`/`stack-totals` attributes have no effect until it is installed with `pnpm add chartjs-plugin-datalabels`:",err);return}}async function loadChartAndDataLabels(loadChart,importDataLabels=()=>import("chartjs-plugin-datalabels")){const mod=await loadChart();if(!mod)return{kind:"core-unavailable"};const plugin=await loadDataLabelsPlugin(importDataLabels);return plugin?{kind:"available",mod,plugin}:{kind:"feature-unavailable",mod}}function loadChartJsWithDataLabelsResult(importDataLabels=()=>import("chartjs-plugin-datalabels")){return dataLabelsResultLoad??=loadChartAndDataLabels(loadChartJs,importDataLabels)}function loadChartJsWithDataLabels(importDataLabels=()=>import("chartjs-plugin-datalabels")){return dataLabelsLoad??=loadChartJsWithDataLabelsResult(importDataLabels).then(result=>result.kind==="core-unavailable"?null:{mod:result.mod,plugin:result.kind==="available"?result.plugin:void 0})}async function loadAnnotationPlugin(importAnnotation=()=>import("chartjs-plugin-annotation")){try{return resolveChartPlugin(await importAnnotation(),"chartjs-plugin-annotation")}catch(err){console.warn("<lr-chart> annotations need the optional peer dependency `chartjs-plugin-annotation` — charts still render without it, but the `annotations` property has no effect until it is installed with `pnpm add chartjs-plugin-annotation`:",err);return}}async function loadChartAndAnnotation(loadChart,importAnnotation=()=>import("chartjs-plugin-annotation")){const mod=await loadChart();if(!mod)return{kind:"core-unavailable"};const plugin=await loadAnnotationPlugin(importAnnotation);if(!plugin)return{kind:"feature-unavailable",mod};try{mod.Chart.register(plugin)}catch(err){return console.warn("<lr-chart> annotations could not be enabled — charts still render without them, but the `annotations` property has no effect:",err),{kind:"feature-unavailable",mod}}return notifyAnnotationPluginRegistered(),{kind:"available",mod,plugin}}function loadChartJsWithAnnotationResult(importAnnotation=()=>import("chartjs-plugin-annotation")){return annotationResultLoad??=loadChartAndAnnotation(loadChartJs,importAnnotation)}export{loadAnnotationPlugin,loadChartAndAnnotation,loadChartAndDataLabels,loadChartAndRegisterZoom,loadChartAndZoom,loadChartJsWithAnnotationResult,loadChartJsWithDataLabels,loadChartJsWithDataLabelsResult,loadChartJsWithZoom,loadChartJsWithZoomResult,loadDataLabelsPlugin};
1
+ import{resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";import{loadChartJs,loadChartModule}from"./chart-core-loader.js";import{notifyAnnotationPluginRegistered}from"../../../internal/chart-annotation-registration.js";function isObjectLike(value){return(typeof value=="object"||typeof value=="function")&&value!==null}function isChartPlugin(candidate){return isObjectLike(candidate)&&typeof candidate.id=="string"&&candidate.id.trim().length>0}function resolveChartPlugin(value,packageName){const plugin=resolveOptionalPeerCapability(value,isChartPlugin);if(plugin)return plugin;throw new Error(`Invalid optional peer \`${packageName}\`: expected a plugin with a non-empty string \`id\`.`)}let zoomResultLoad,dataLabelsResultLoad,annotationResultLoad,zoomLoad,dataLabelsLoad;async function loadChartAndZoom(importChart=()=>(async()=>{try{return await import("chart.js")}catch(e){throw e}})(),importZoom=()=>(async()=>{try{return await import("chartjs-plugin-zoom")}catch(e){throw e}})(),needsZoom=!1){const mod=await loadChartModule(importChart);if(!mod)return null;if(!needsZoom)return{mod,zoomPlugin:void 0};let zoomPlugin;try{zoomPlugin=resolveChartPlugin(await importZoom(),"chartjs-plugin-zoom")}catch(err){console.warn("<lr-chart> zoom support needs the optional peer dependency `chartjs-plugin-zoom` — charts still render without it, but the `zoomable` attribute has no effect until it is installed with `pnpm add chartjs-plugin-zoom`:",err)}return{mod,zoomPlugin}}async function loadChartAndRegisterZoom(loadChart,importZoom=()=>(async()=>{try{return await import("chartjs-plugin-zoom")}catch(e){throw e}})()){const mod=await loadChart();if(!mod)return{kind:"core-unavailable"};const zoomPlugin=(await loadChartAndZoom(()=>Promise.resolve(mod),importZoom,!0))?.zoomPlugin;if(!zoomPlugin)return{kind:"feature-unavailable",mod};try{mod.Chart.register(zoomPlugin)}catch(err){return console.warn("<lr-chart> zoom support could not be enabled — charts still render without it, but the `zoomable` attribute has no effect:",err),{kind:"feature-unavailable",mod}}return{kind:"available",mod,plugin:zoomPlugin}}function loadChartJsWithZoomResult(importZoom=()=>(async()=>{try{return await import("chartjs-plugin-zoom")}catch(e){throw e}})()){return zoomResultLoad??=loadChartAndRegisterZoom(loadChartJs,importZoom)}function loadChartJsWithZoom(importZoom=()=>(async()=>{try{return await import("chartjs-plugin-zoom")}catch(e){throw e}})()){return zoomLoad??=loadChartJsWithZoomResult(importZoom).then(result=>result.kind==="core-unavailable"?null:result.mod)}async function loadDataLabelsPlugin(importDataLabels=()=>(async()=>{try{return await import("chartjs-plugin-datalabels")}catch(e){throw e}})()){try{return resolveChartPlugin(await importDataLabels(),"chartjs-plugin-datalabels")}catch(err){console.warn("<lr-chart> data labels need the optional peer dependency `chartjs-plugin-datalabels` — charts still render without it, but the `data-labels`/`stack-totals` attributes have no effect until it is installed with `pnpm add chartjs-plugin-datalabels`:",err);return}}async function loadChartAndDataLabels(loadChart,importDataLabels=()=>(async()=>{try{return await import("chartjs-plugin-datalabels")}catch(e){throw e}})()){const mod=await loadChart();if(!mod)return{kind:"core-unavailable"};const plugin=await loadDataLabelsPlugin(importDataLabels);return plugin?{kind:"available",mod,plugin}:{kind:"feature-unavailable",mod}}function loadChartJsWithDataLabelsResult(importDataLabels=()=>(async()=>{try{return await import("chartjs-plugin-datalabels")}catch(e){throw e}})()){return dataLabelsResultLoad??=loadChartAndDataLabels(loadChartJs,importDataLabels)}function loadChartJsWithDataLabels(importDataLabels=()=>(async()=>{try{return await import("chartjs-plugin-datalabels")}catch(e){throw e}})()){return dataLabelsLoad??=loadChartJsWithDataLabelsResult(importDataLabels).then(result=>result.kind==="core-unavailable"?null:{mod:result.mod,plugin:result.kind==="available"?result.plugin:void 0})}async function loadAnnotationPlugin(importAnnotation=()=>(async()=>{try{return await import("chartjs-plugin-annotation")}catch(e){throw e}})()){try{return resolveChartPlugin(await importAnnotation(),"chartjs-plugin-annotation")}catch(err){console.warn("<lr-chart> annotations need the optional peer dependency `chartjs-plugin-annotation` — charts still render without it, but the `annotations` property has no effect until it is installed with `pnpm add chartjs-plugin-annotation`:",err);return}}async function loadChartAndAnnotation(loadChart,importAnnotation=()=>(async()=>{try{return await import("chartjs-plugin-annotation")}catch(e){throw e}})()){const mod=await loadChart();if(!mod)return{kind:"core-unavailable"};const plugin=await loadAnnotationPlugin(importAnnotation);if(!plugin)return{kind:"feature-unavailable",mod};try{mod.Chart.register(plugin)}catch(err){return console.warn("<lr-chart> annotations could not be enabled — charts still render without them, but the `annotations` property has no effect:",err),{kind:"feature-unavailable",mod}}return notifyAnnotationPluginRegistered(),{kind:"available",mod,plugin}}function loadChartJsWithAnnotationResult(importAnnotation=()=>(async()=>{try{return await import("chartjs-plugin-annotation")}catch(e){throw e}})()){return annotationResultLoad??=loadChartAndAnnotation(loadChartJs,importAnnotation)}export{loadAnnotationPlugin,loadChartAndAnnotation,loadChartAndDataLabels,loadChartAndRegisterZoom,loadChartAndZoom,loadChartJsWithAnnotationResult,loadChartJsWithDataLabels,loadChartJsWithDataLabelsResult,loadChartJsWithZoom,loadChartJsWithZoomResult,loadDataLabelsPlugin};
@@ -1 +1 @@
1
- import{isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";import{resolveCanvasColor}from"../../../internal/canvas-color.js";import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{Engine3dSelection,engine3dFailureReason,webgl2Available}from"../../../internal/engine-3d.js";import{finiteRange}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{normalizeChart3dCamera}from"./chart-3d-data.js";const chart3dPointsLoader=createEngine3dLoader({entry:"points",tag:tag("chart-3d"),load:()=>import("@aceshooting/lyra-3d/points")}),chart3dEngineEnvironment={available:document=>webgl2Available(()=>document.createElement("canvas")),visible:host=>isAccessibilityVisible(host)};class Chart3dEngineController{constructor(host,callbacks){this.host=host,this.callbacks=callbacks,this.selection=new Engine3dSelection(!1),this.notice=null,this.loading=!1,this.ready=!1,this.software=!1,this.generation=0,this.revision=0,this.disposed=new WeakSet,this.preference="builtin",this.selected=-1,this.cursor=-1,this.hover=-1,this.attempted=!1,this.configured=!1,this.contextLost=!1,this.intersecting=!1,this.cleanup=[]}dispose(engine){if(!(!engine||this.disposed.has(engine))){this.disposed.add(engine);try{engine.dispose()}catch{}}}invalidate(){const generation=++this.generation;this.observer?.disconnect(),this.observer=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.intersecting=!1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.styleObserver?.disconnect(),this.styleObserver=void 0;for(const cleanup of this.cleanup)cleanup();this.cleanup=[];const engine=this.engine;return this.engine=void 0,this.colorContext=void 0,this.loading=this.ready=this.configured=this.attempted=this.contextLost=this.software=!1,this.hover=-1,this.notice=null,this.selection.prefer(this.preference),this.dispose(engine),generation}disconnect(){this.invalidate()===this.generation&&(this.container=void 0,this.data=void 0)}update(data,container,preference,selected,cursor,camera){if(this.data!==data||this.container!==container||this.preference!==preference){if(this.invalidate()!==this.generation)return;this.data=data,this.container=container,this.preference=preference,this.selection.prefer(preference)}const cameraChanged=camera!==this.camera;if(this.camera=camera,this.selected=selected,this.cursor=cursor,this.engine&&this.configured&&!this.contextLost){const engine=this.engine,generation=this.generation,current=()=>generation===this.generation&&this.engine===engine;try{cameraChanged&&camera&&engine.setCamera(camera),current()&&this.syncState()}catch{current()&&this.fail("error")}if(!current())return}preference!=="webgl"||!data?.positions.length||!container||!this.host.isConnected||this.attempted||this.observer||this.eligibility||this.awaitAdmission(container)}awaitAdmission(container){const view=this.host.ownerDocument.defaultView,generation=this.generation;this.intersecting=view?.IntersectionObserver===void 0;const admit=()=>{generation!==this.generation||this.attempted||!this.intersecting||chart3dEngineEnvironment.visible(this.host)&&(this.observer?.disconnect(),this.observer=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.start())};if(view?.IntersectionObserver&&(this.observer=new view.IntersectionObserver(entries=>{if(generation===this.generation){for(const entry of entries)entry.target===container&&(this.intersecting=entry.isIntersecting);admit()}}),this.observer.observe(container)),view?.MutationObserver){this.eligibility=new view.MutationObserver(admit);let ancestor=this.host;for(let depth=0;ancestor&&depth<=256;depth++){this.eligibility.observe(ancestor,{attributes:!0,attributeFilter:["aria-hidden","inert","hidden","style","class","open"]});const root=ancestor.getRootNode();ancestor=ancestor.assignedSlot??ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}admit()}fail(reason){const previous=this.notice,detail=this.selection.renderer==="webgl"?this.selection.fail(reason):null;if(reason==="context-lost")this.contextLost=!0,this.ready=this.loading=!1;else{if(this.invalidate()!==this.generation)return;this.selection.prefer("webgl"),this.selection.fail(reason),this.attempted=!0}if(this.notice=detail??previous,!detail){previous&&reason!=="context-lost"&&this.callbacks.changed();return}this.callbacks.changed(),this.callbacks.fallback(detail)}syncState(){this.engine?.setState?.({selected:new Set(this.selected<0?[]:[this.selected]),dimmed:new Set,hover:this.hover,focus:this.cursor})}async start(){const container=this.container,data=this.data,owner=this.host.ownerDocument;if(!container||!data||!this.host.isConnected||this.preference!=="webgl"||this.attempted)return;const generation=this.generation,current=()=>generation===this.generation&&this.host.isConnected&&this.host.ownerDocument===owner&&this.container===container;if(this.attempted=!0,!chart3dEngineEnvironment.available(owner)){this.fail("unsupported");return}this.loading=!0,this.callbacks.changed();let engine=null;try{if(engine=await chart3dPointsLoader.create(),!current()){this.dispose(engine??void 0);return}if(!engine){this.fail("unavailable");return}this.engine=engine;const mounted=engine,rowCount=data.positions.length/3,valid=index=>index!==null&&Number.isSafeInteger(index)&&index>=0&&index<rowCount;if(await engine.mount(container,{hover:index=>{if(!(!current()||!this.ready)){this.hover=valid(index)?index:-1;try{this.syncState()}catch{current()&&this.fail("error")}}},pick:index=>{current()&&this.ready&&valid(index)&&this.callbacks.pick(index)},camera:value=>{!current()||!this.ready||(this.camera=normalizeChart3dCamera(value),this.callbacks.camera(this.camera))},lost:reason=>{current()&&this.fail(reason)},rendering:info=>{current()&&(this.software=info.software,this.callbacks.changed())},restored:()=>{if(current()&&(this.contextLost=!1,!(!this.configured||!this.selection.restore())))try{if(mounted.setStyle(this.style()),!current()||(this.camera&&mounted.setCamera(this.camera),!current()||this.contextLost))return;this.ready=!0,this.notice=null,this.syncState(),current()&&this.callbacks.changed()}catch{current()&&this.fail("error")}}}),!current()){this.dispose(engine);return}if(engine.setStyle(this.style()),!current()||(engine.setData(data,++this.revision),!current())||(this.camera?engine.setCamera(this.camera):engine.fit?.(),!current()))return;const resize=()=>{if(!current())return;const rect=container.getBoundingClientRect();mounted.resize(Math.max(1,rect.width),Math.max(1,rect.height))};if(resize(),!current())return;this.observe(container,resize,current),this.configured=!0,this.loading=!1,this.ready=!this.contextLost,this.ready&&(this.selection.restore(),this.notice=null),this.syncState(),current()&&this.callbacks.changed()}catch(error){current()?this.fail(engine3dFailureReason(error)):this.dispose(engine??void 0)}}observe(container,resize,current){const view=this.host.ownerDocument.defaultView,engine=this.engine,refresh=()=>{if(!(!current()||!this.ready||!engine))try{engine.setStyle(this.style()),current()&&resize()}catch{current()&&this.fail("error")}};if(view?.ResizeObserver&&(this.resizeObserver=new view.ResizeObserver(refresh),this.resizeObserver.observe(container)),view?.MutationObserver){this.styleObserver=new view.MutationObserver(refresh);let ancestor=this.host;for(;ancestor;){this.styleObserver.observe(ancestor,{attributes:!0});const root=ancestor.getRootNode();ancestor=ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}for(const query of["(prefers-reduced-motion: reduce)","(forced-colors: active)","(prefers-color-scheme: dark)"]){const media=view?.matchMedia(query);media?.addEventListener("change",refresh),media&&this.cleanup.push(()=>media.removeEventListener("change",refresh))}}style(){const view=this.host.ownerDocument.defaultView,computed=view.getComputedStyle(this.host),probe=this.host.shadowRoot?.querySelector("[data-style-probe]"),measured=probe?view.getComputedStyle(probe):computed;if(this.colorContext===void 0){const canvas=this.host.ownerDocument.createElement("canvas");canvas.width=canvas.height=1,this.colorContext=canvas.getContext("2d",{willReadFrequently:!0})}const context=this.colorContext,color=name=>{const resolved=resolveCanvasColor(this.host,`var(${name})`,computed.color);if(!context)return resolved;context.clearRect(0,0,1,1),context.fillStyle=resolved,context.fillRect(0,0,1,1);const rgba=context.getImageData(0,0,1,1).data;return`rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3]/255})`};return{background:color("--lr-color-surface"),foreground:color("--lr-color-text"),muted:color("--lr-color-text-quiet"),accent:color("--lr-color-brand"),focus:color("--lr-focus-ring-color"),palette:Array.from({length:8},(_,index)=>color(`--lr-color-chart-${index+1}`)),fontFamily:computed.fontFamily,fontSize:finiteRange(Number.parseFloat(computed.fontSize),14,1,128),pointSize:finiteRange(Number.parseFloat(measured.inlineSize),8,1,1024),lineWidth:finiteRange(Number.parseFloat(measured.borderBlockStartWidth),1,0,64),devicePixelRatio:finiteRange(view.devicePixelRatio,1,.25,4),reducedMotion:view.matchMedia("(prefers-reduced-motion: reduce)").matches,forcedColors:view.matchMedia("(forced-colors: active)").matches}}}export{Chart3dEngineController,chart3dEngineEnvironment,chart3dPointsLoader};
1
+ import{isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";import{resolveCanvasColor}from"../../../internal/canvas-color.js";import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{Engine3dSelection,engine3dFailureReason,webgl2Available}from"../../../internal/engine-3d.js";import{finiteRange}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{normalizeChart3dCamera}from"./chart-3d-data.js";const chart3dPointsLoader=createEngine3dLoader({entry:"points",tag:tag("chart-3d"),load:()=>(async()=>{try{return await import("@aceshooting/lyra-3d/points")}catch(e){throw e}})()}),chart3dEngineEnvironment={available:document=>webgl2Available(()=>document.createElement("canvas")),visible:host=>isAccessibilityVisible(host)};class Chart3dEngineController{constructor(host,callbacks){this.host=host,this.callbacks=callbacks,this.selection=new Engine3dSelection(!1),this.notice=null,this.loading=!1,this.ready=!1,this.software=!1,this.generation=0,this.revision=0,this.disposed=new WeakSet,this.preference="builtin",this.selected=-1,this.cursor=-1,this.hover=-1,this.attempted=!1,this.configured=!1,this.contextLost=!1,this.intersecting=!1,this.cleanup=[]}dispose(engine){if(!(!engine||this.disposed.has(engine))){this.disposed.add(engine);try{engine.dispose()}catch{}}}invalidate(){const generation=++this.generation;this.observer?.disconnect(),this.observer=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.intersecting=!1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.styleObserver?.disconnect(),this.styleObserver=void 0;for(const cleanup of this.cleanup)cleanup();this.cleanup=[];const engine=this.engine;return this.engine=void 0,this.colorContext=void 0,this.loading=this.ready=this.configured=this.attempted=this.contextLost=this.software=!1,this.hover=-1,this.notice=null,this.selection.prefer(this.preference),this.dispose(engine),generation}disconnect(){this.invalidate()===this.generation&&(this.container=void 0,this.data=void 0)}update(data,container,preference,selected,cursor,camera){if(this.data!==data||this.container!==container||this.preference!==preference){if(this.invalidate()!==this.generation)return;this.data=data,this.container=container,this.preference=preference,this.selection.prefer(preference)}const cameraChanged=camera!==this.camera;if(this.camera=camera,this.selected=selected,this.cursor=cursor,this.engine&&this.configured&&!this.contextLost){const engine=this.engine,generation=this.generation,current=()=>generation===this.generation&&this.engine===engine;try{cameraChanged&&camera&&engine.setCamera(camera),current()&&this.syncState()}catch{current()&&this.fail("error")}if(!current())return}preference!=="webgl"||!data?.positions.length||!container||!this.host.isConnected||this.attempted||this.observer||this.eligibility||this.awaitAdmission(container)}awaitAdmission(container){const view=this.host.ownerDocument.defaultView,generation=this.generation;this.intersecting=view?.IntersectionObserver===void 0;const admit=()=>{generation!==this.generation||this.attempted||!this.intersecting||chart3dEngineEnvironment.visible(this.host)&&(this.observer?.disconnect(),this.observer=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.start())};if(view?.IntersectionObserver&&(this.observer=new view.IntersectionObserver(entries=>{if(generation===this.generation){for(const entry of entries)entry.target===container&&(this.intersecting=entry.isIntersecting);admit()}}),this.observer.observe(container)),view?.MutationObserver){this.eligibility=new view.MutationObserver(admit);let ancestor=this.host;for(let depth=0;ancestor&&depth<=256;depth++){this.eligibility.observe(ancestor,{attributes:!0,attributeFilter:["aria-hidden","inert","hidden","style","class","open"]});const root=ancestor.getRootNode();ancestor=ancestor.assignedSlot??ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}admit()}fail(reason){const previous=this.notice,detail=this.selection.renderer==="webgl"?this.selection.fail(reason):null;if(reason==="context-lost")this.contextLost=!0,this.ready=this.loading=!1;else{if(this.invalidate()!==this.generation)return;this.selection.prefer("webgl"),this.selection.fail(reason),this.attempted=!0}if(this.notice=detail??previous,!detail){previous&&reason!=="context-lost"&&this.callbacks.changed();return}this.callbacks.changed(),this.callbacks.fallback(detail)}syncState(){this.engine?.setState?.({selected:new Set(this.selected<0?[]:[this.selected]),dimmed:new Set,hover:this.hover,focus:this.cursor})}async start(){const container=this.container,data=this.data,owner=this.host.ownerDocument;if(!container||!data||!this.host.isConnected||this.preference!=="webgl"||this.attempted)return;const generation=this.generation,current=()=>generation===this.generation&&this.host.isConnected&&this.host.ownerDocument===owner&&this.container===container;if(this.attempted=!0,!chart3dEngineEnvironment.available(owner)){this.fail("unsupported");return}this.loading=!0,this.callbacks.changed();let engine=null;try{if(engine=await chart3dPointsLoader.create(),!current()){this.dispose(engine??void 0);return}if(!engine){this.fail("unavailable");return}this.engine=engine;const mounted=engine,rowCount=data.positions.length/3,valid=index=>index!==null&&Number.isSafeInteger(index)&&index>=0&&index<rowCount;if(await engine.mount(container,{hover:index=>{if(!(!current()||!this.ready)){this.hover=valid(index)?index:-1;try{this.syncState()}catch{current()&&this.fail("error")}}},pick:index=>{current()&&this.ready&&valid(index)&&this.callbacks.pick(index)},camera:value=>{!current()||!this.ready||(this.camera=normalizeChart3dCamera(value),this.callbacks.camera(this.camera))},lost:reason=>{current()&&this.fail(reason)},rendering:info=>{current()&&(this.software=info.software,this.callbacks.changed())},restored:()=>{if(current()&&(this.contextLost=!1,!(!this.configured||!this.selection.restore())))try{if(mounted.setStyle(this.style()),!current()||(this.camera&&mounted.setCamera(this.camera),!current()||this.contextLost))return;this.ready=!0,this.notice=null,this.syncState(),current()&&this.callbacks.changed()}catch{current()&&this.fail("error")}}}),!current()){this.dispose(engine);return}if(engine.setStyle(this.style()),!current()||(engine.setData(data,++this.revision),!current())||(this.camera?engine.setCamera(this.camera):engine.fit?.(),!current()))return;const resize=()=>{if(!current())return;const rect=container.getBoundingClientRect();mounted.resize(Math.max(1,rect.width),Math.max(1,rect.height))};if(resize(),!current())return;this.observe(container,resize,current),this.configured=!0,this.loading=!1,this.ready=!this.contextLost,this.ready&&(this.selection.restore(),this.notice=null),this.syncState(),current()&&this.callbacks.changed()}catch(error){current()?this.fail(engine3dFailureReason(error)):this.dispose(engine??void 0)}}observe(container,resize,current){const view=this.host.ownerDocument.defaultView,engine=this.engine,refresh=()=>{if(!(!current()||!this.ready||!engine))try{engine.setStyle(this.style()),current()&&resize()}catch{current()&&this.fail("error")}};if(view?.ResizeObserver&&(this.resizeObserver=new view.ResizeObserver(refresh),this.resizeObserver.observe(container)),view?.MutationObserver){this.styleObserver=new view.MutationObserver(refresh);let ancestor=this.host;for(;ancestor;){this.styleObserver.observe(ancestor,{attributes:!0});const root=ancestor.getRootNode();ancestor=ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}for(const query of["(prefers-reduced-motion: reduce)","(forced-colors: active)","(prefers-color-scheme: dark)"]){const media=view?.matchMedia(query);media?.addEventListener("change",refresh),media&&this.cleanup.push(()=>media.removeEventListener("change",refresh))}}style(){const view=this.host.ownerDocument.defaultView,computed=view.getComputedStyle(this.host),probe=this.host.shadowRoot?.querySelector("[data-style-probe]"),measured=probe?view.getComputedStyle(probe):computed;if(this.colorContext===void 0){const canvas=this.host.ownerDocument.createElement("canvas");canvas.width=canvas.height=1,this.colorContext=canvas.getContext("2d",{willReadFrequently:!0})}const context=this.colorContext,color=name=>{const resolved=resolveCanvasColor(this.host,`var(${name})`,computed.color);if(!context)return resolved;context.clearRect(0,0,1,1),context.fillStyle=resolved,context.fillRect(0,0,1,1);const rgba=context.getImageData(0,0,1,1).data;return`rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3]/255})`};return{background:color("--lr-color-surface"),foreground:color("--lr-color-text"),muted:color("--lr-color-text-quiet"),accent:color("--lr-color-brand"),focus:color("--lr-focus-ring-color"),palette:Array.from({length:8},(_,index)=>color(`--lr-color-chart-${index+1}`)),fontFamily:computed.fontFamily,fontSize:finiteRange(Number.parseFloat(computed.fontSize),14,1,128),pointSize:finiteRange(Number.parseFloat(measured.inlineSize),8,1,1024),lineWidth:finiteRange(Number.parseFloat(measured.borderBlockStartWidth),1,0,64),devicePixelRatio:finiteRange(view.devicePixelRatio,1,.25,4),reducedMotion:view.matchMedia("(prefers-reduced-motion: reduce)").matches,forcedColors:view.matchMedia("(forced-colors: active)").matches}}}export{Chart3dEngineController,chart3dEngineEnvironment,chart3dPointsLoader};
@@ -1 +1 @@
1
- import{GREYCAT_LANGUAGE}from"./greycat-language.js";import{SHIKI_DARK_THEME,SHIKI_LIGHT_THEME,isShikiHighlighter,normalizeShikiLanguage}from"./shiki-types.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";import{SHIKI_DARK_THEME as SHIKI_DARK_THEME2,SHIKI_LIGHT_THEME as SHIKI_LIGHT_THEME2,SHIKI_THEMES,normalizeShikiLanguage as normalizeShikiLanguage2}from"./shiki-types.js";import{loadShikiHighlighterCore}from"./shiki-types.js";let highlighter,shikiModuleLoaderForTesting;const unsupportedLanguages=new Set,FULL_HIGHLIGHTER_WARNING_KEY="lyra-code-block-shiki-unavailable",FULL_HIGHLIGHTER_WARNING="<lr-code-block>: syntax highlighting is unavailable because the optional Shiki peer could not load. Code is rendered as plain text.";function __setShikiModuleLoaderForTesting(loader){shikiModuleLoaderForTesting=loader,highlighter=void 0}const CUSTOM_LANGUAGES={gcl:GREYCAT_LANGUAGE,greycat:GREYCAT_LANGUAGE};function isShikiModule(candidate){return(typeof candidate=="object"||typeof candidate=="function")&&candidate!==null&&typeof candidate.createHighlighter=="function"}function loadShikiHighlighter(){return highlighter||(highlighter=(shikiModuleLoaderForTesting??(()=>import("shiki")))().then(async mod=>{const shikiModule=resolveOptionalPeerCapability(mod,isShikiModule);if(!shikiModule)throw new Error("Invalid optional peer `shiki`: missing `createHighlighter` capability.");const instance=await shikiModule.createHighlighter({themes:[SHIKI_LIGHT_THEME,SHIKI_DARK_THEME],langs:[]});if(!isShikiHighlighter(instance))throw new Error("Invalid optional peer `shiki`: `createHighlighter()` did not produce a usable highlighter capability.");return instance}).catch(()=>(devWarnOnce(FULL_HIGHLIGHTER_WARNING_KEY,FULL_HIGHLIGHTER_WARNING),null))),highlighter}function shikiHasLoadedLanguage(hl,lang){try{return hl.getLoadedLanguages().includes(lang)}catch{return!1}}async function loadShikiLanguage(hl,lang){const normalizedLanguage=normalizeShikiLanguage(lang);if(shikiHasLoadedLanguage(hl,normalizedLanguage))return!0;if(unsupportedLanguages.has(normalizedLanguage))return!1;try{return await hl.loadLanguage(CUSTOM_LANGUAGES[normalizedLanguage]??normalizedLanguage),!0}catch{return unsupportedLanguages.add(normalizedLanguage),!1}}export{SHIKI_DARK_THEME2 as SHIKI_DARK_THEME,SHIKI_LIGHT_THEME2 as SHIKI_LIGHT_THEME,SHIKI_THEMES,__setShikiModuleLoaderForTesting,loadShikiHighlighter,loadShikiHighlighterCore,loadShikiLanguage,normalizeShikiLanguage2 as normalizeShikiLanguage,shikiHasLoadedLanguage};
1
+ import{GREYCAT_LANGUAGE}from"./greycat-language.js";import{SHIKI_DARK_THEME,SHIKI_LIGHT_THEME,isShikiHighlighter,normalizeShikiLanguage}from"./shiki-types.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";import{SHIKI_DARK_THEME as SHIKI_DARK_THEME2,SHIKI_LIGHT_THEME as SHIKI_LIGHT_THEME2,SHIKI_THEMES,normalizeShikiLanguage as normalizeShikiLanguage2}from"./shiki-types.js";import{loadShikiHighlighterCore}from"./shiki-types.js";let highlighter,shikiModuleLoaderForTesting;const unsupportedLanguages=new Set,FULL_HIGHLIGHTER_WARNING_KEY="lyra-code-block-shiki-unavailable",FULL_HIGHLIGHTER_WARNING="<lr-code-block>: syntax highlighting is unavailable because the optional Shiki peer could not load. Code is rendered as plain text.";function __setShikiModuleLoaderForTesting(loader){shikiModuleLoaderForTesting=loader,highlighter=void 0}const CUSTOM_LANGUAGES={gcl:GREYCAT_LANGUAGE,greycat:GREYCAT_LANGUAGE};function isShikiModule(candidate){return(typeof candidate=="object"||typeof candidate=="function")&&candidate!==null&&typeof candidate.createHighlighter=="function"}function loadShikiHighlighter(){return highlighter||(highlighter=(shikiModuleLoaderForTesting??(()=>(async()=>{try{return await import("shiki")}catch(e){throw e}})()))().then(async mod=>{const shikiModule=resolveOptionalPeerCapability(mod,isShikiModule);if(!shikiModule)throw new Error("Invalid optional peer `shiki`: missing `createHighlighter` capability.");const instance=await shikiModule.createHighlighter({themes:[SHIKI_LIGHT_THEME,SHIKI_DARK_THEME],langs:[]});if(!isShikiHighlighter(instance))throw new Error("Invalid optional peer `shiki`: `createHighlighter()` did not produce a usable highlighter capability.");return instance}).catch(()=>(devWarnOnce(FULL_HIGHLIGHTER_WARNING_KEY,FULL_HIGHLIGHTER_WARNING),null))),highlighter}function shikiHasLoadedLanguage(hl,lang){try{return hl.getLoadedLanguages().includes(lang)}catch{return!1}}async function loadShikiLanguage(hl,lang){const normalizedLanguage=normalizeShikiLanguage(lang);if(shikiHasLoadedLanguage(hl,normalizedLanguage))return!0;if(unsupportedLanguages.has(normalizedLanguage))return!1;try{return await hl.loadLanguage(CUSTOM_LANGUAGES[normalizedLanguage]??normalizedLanguage),!0}catch{return unsupportedLanguages.add(normalizedLanguage),!1}}export{SHIKI_DARK_THEME2 as SHIKI_DARK_THEME,SHIKI_LIGHT_THEME2 as SHIKI_LIGHT_THEME,SHIKI_THEMES,__setShikiModuleLoaderForTesting,loadShikiHighlighter,loadShikiHighlighterCore,loadShikiLanguage,normalizeShikiLanguage2 as normalizeShikiLanguage,shikiHasLoadedLanguage};
@@ -1 +1 @@
1
- import{unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";function createShikiOnigurumaEngine(){return import("shiki/engine/oniguruma").then(module=>{const createEngine=(typeof module.createOnigurumaEngine=="function"?module:unwrapOptionalPeerDefault(module))?.createOnigurumaEngine;if(typeof createEngine!="function")throw new Error("Invalid optional peer shiki: an Oniguruma engine factory is required.");return createEngine(fetch(new URL("./onig.wasm",import.meta.url)))})}export{createShikiOnigurumaEngine};
1
+ import{unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";function createShikiOnigurumaEngine(){return (async()=>{try{return await import("shiki/engine/oniguruma")}catch(e){throw e}})().then(module=>{const createEngine=(typeof module.createOnigurumaEngine=="function"?module:unwrapOptionalPeerDefault(module))?.createOnigurumaEngine;if(typeof createEngine!="function")throw new Error("Invalid optional peer shiki: an Oniguruma engine factory is required.");return createEngine(fetch(new URL("./onig.wasm",import.meta.url)))})}export{createShikiOnigurumaEngine};
@@ -1 +1 @@
1
- const SHIKI_SOURCE_MAX_CODE_UNITS=8192;import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";function isShikiHighlighter(candidate){return(typeof candidate=="object"||typeof candidate=="function")&&candidate!==null&&typeof candidate.getLoadedLanguages=="function"&&typeof candidate.loadLanguage=="function"&&typeof candidate.codeToHtml=="function"}const SHIKI_LIGHT_THEME="github-light",SHIKI_DARK_THEME="github-dark",SHIKI_THEMES={light:SHIKI_LIGHT_THEME,dark:SHIKI_DARK_THEME};function normalizeShikiLanguage(lang){return lang.trim().toLowerCase().replace(/^\./,"")}function javascriptEngineFactory(){return import("shiki/engine/javascript").then(({createJavaScriptRegexEngine})=>createJavaScriptRegexEngine())}let engineFactory=javascriptEngineFactory;function setShikiCoreEngine(engine){if(engine!=="javascript"&&typeof engine!="function")throw new TypeError("Expected the javascript preset or a regex engine factory.");engineFactory=engine==="javascript"?javascriptEngineFactory:engine}function __resetShikiCoreEngineForTesting(){engineFactory=javascriptEngineFactory}const highlighterCores=new WeakMap,recentHighlighterCores=[];function equalFrozenGrammars(left,right){let remaining=2e4;const leftSeen=new WeakSet,rightSeen=new WeakSet,equal=(a,b,depth)=>{if(--remaining<0||depth>32||typeof a!=typeof b||typeof a=="function"||typeof a=="symbol"||typeof a=="number"&&(!Number.isFinite(a)||!Number.isFinite(b)))return!1;if(a===null||b===null||typeof a!="object"||typeof b!="object")return Object.is(a,b);if(!Object.isFrozen(a)||!Object.isFrozen(b)||leftSeen.has(a)||rightSeen.has(b))return!1;const prototype=Object.getPrototypeOf(a);if(prototype!==Object.getPrototypeOf(b)||prototype!==Object.prototype&&prototype!==Array.prototype&&prototype!==null||Array.isArray(a)!==Array.isArray(b))return!1;leftSeen.add(a),rightSeen.add(b);const leftKeys=Reflect.ownKeys(a),rightKeys=Reflect.ownKeys(b);if(leftKeys.length!==rightKeys.length||leftKeys.length>remaining)return!1;for(let i=0;i<leftKeys.length;i+=1){const key=leftKeys[i];if(typeof key!="string"||key!==rightKeys[i])return!1;const first=Object.getOwnPropertyDescriptor(a,key),second=Object.getOwnPropertyDescriptor(b,key);if(!("value"in first)||!("value"in second)||first.enumerable!==second.enumerable||!equal(first.value,second.value,depth+1))return!1}return!0};try{return equal(left,right,0)}catch{return!1}}function shikiGrammarOwnNames(input){const known=new Set;let primaryName;const registrations=Array.isArray(input)?input:[input];for(const registration of registrations){if(!registration||typeof registration!="object")continue;const name=registration.name;typeof name=="string"&&name!==""&&(known.add(name),primaryName??=name);const aliases=registration.aliases;if(Array.isArray(aliases))for(const alias of aliases)typeof alias=="string"&&known.add(alias)}return{primaryName,known}}function buildShikiLangAlias(languages){let aliases;try{for(const key of Object.keys(languages)){const grammar=languages[key];if(grammar===void 0)continue;const{primaryName,known}=shikiGrammarOwnNames(grammar);!primaryName||known.has(key)||(aliases??={},aliases[key]=primaryName)}}catch{return aliases}return aliases}const coreLangAliases=new WeakMap;let highlighterCoreLoaderForTesting;const FINE_GRAINED_SHIKI_WARNING_KEY="lyra-fine-grained-shiki-highlighter-unavailable",FINE_GRAINED_SHIKI_WARNING="Lyra syntax highlighting failed to build a fine-grained shiki highlighter from the supplied grammars. Code is rendered as plain text.";function __setShikiHighlighterCoreLoaderForTesting(loader){highlighterCoreLoaderForTesting=loader}function loadShikiHighlighterCore(languages){if(highlighterCoreLoaderForTesting)return highlighterCoreLoaderForTesting(languages);const engine=engineFactory;let perEngine=highlighterCores.get(languages),cached=perEngine?.get(engine),frozen=!1;if(!cached)try{frozen=Object.isFrozen(languages)}catch{}if(frozen)for(let i=recentHighlighterCores.length-1;i>=0;i-=1){const entry=recentHighlighterCores[i],previous=entry.languages.deref(),promise=entry.promise.deref();if(!previous||!promise)recentHighlighterCores.splice(i,1);else if(entry.engine===engine&&equalFrozenGrammars(languages,previous)){cached=promise,recentHighlighterCores.splice(i,1),recentHighlighterCores.push({languages:new WeakRef(languages),engine,promise:entry.promise}),perEngine??=new Map,perEngine.set(engine,cached),highlighterCores.set(languages,perEngine);break}}if(!cached&&(cached=Promise.all([import("shiki/core"),Promise.resolve(engine()),import("shiki/themes/github-light.mjs"),import("shiki/themes/github-dark.mjs")]).then(async([{createHighlighterCore},resolvedEngine,light,dark])=>{const langAlias=buildShikiLangAlias(languages)??{},core=await createHighlighterCore({themes:[light.default,dark.default],langs:Object.values(languages),langAlias,engine:resolvedEngine});if(!isShikiHighlighter(core))throw new Error("Invalid optional peer `shiki`: `createHighlighterCore()` did not produce a usable highlighter capability.");return coreLangAliases.set(core,langAlias),core}).catch(()=>(devWarnOnce(FINE_GRAINED_SHIKI_WARNING_KEY,FINE_GRAINED_SHIKI_WARNING),null)),perEngine??=new Map,perEngine.set(engine,cached),highlighterCores.set(languages,perEngine),frozen)){recentHighlighterCores.push({languages:new WeakRef(languages),engine,promise:new WeakRef(cached)}),recentHighlighterCores.length>8&&recentHighlighterCores.shift();const pending=cached;pending.then(core=>{if(!core)for(let i=recentHighlighterCores.length-1;i>=0;i-=1)recentHighlighterCores[i].promise.deref()===pending&&recentHighlighterCores.splice(i,1)})}return cached}const resolvedLanguagesCache=new WeakMap;function resolvedShikiLanguages(languages){let hasLoader=!1;for(const key of Object.keys(languages))if(typeof languages[key]=="function"){hasLoader=!0;break}if(!hasLoader)return languages;let cached=resolvedLanguagesCache.get(languages);if(!cached){cached={};for(const key of Object.keys(languages)){const value=languages[key];value!==void 0&&typeof value!="function"&&(cached[key]=value)}resolvedLanguagesCache.set(languages,cached)}return cached}const loadedLanguageSources=new WeakMap,LAZY_LANGUAGE_SOURCE_WARNING_KEY="lyra-shiki-lazy-language-source-failed",LAZY_LANGUAGE_SOURCE_WARNING="Lyra syntax highlighting could not load a lazy `languages` grammar loader. That language renders as plain text.";function ensureShikiLanguageLoaded(core,key,source){if(typeof source!="function")return Promise.resolve(!0);let perCore=loadedLanguageSources.get(core);perCore||(perCore=new Map,loadedLanguageSources.set(core,perCore));let pending=perCore.get(key);return pending||(pending=Promise.resolve().then(source).then(async resolved=>{const grammar=unwrapOptionalPeerDefault(resolved);await core.loadLanguage(grammar);const{primaryName,known}=shikiGrammarOwnNames(grammar),aliases=coreLangAliases.get(core);aliases&&primaryName&&!known.has(key)&&(aliases[key]=primaryName)}).then(()=>!0).catch(()=>(devWarnOnce(LAZY_LANGUAGE_SOURCE_WARNING_KEY,LAZY_LANGUAGE_SOURCE_WARNING),!1)),perCore.set(key,pending)),pending}export{SHIKI_DARK_THEME,SHIKI_LIGHT_THEME,SHIKI_SOURCE_MAX_CODE_UNITS,SHIKI_THEMES,__resetShikiCoreEngineForTesting,__setShikiHighlighterCoreLoaderForTesting,ensureShikiLanguageLoaded,isShikiHighlighter,loadShikiHighlighterCore,normalizeShikiLanguage,resolvedShikiLanguages,setShikiCoreEngine};
1
+ const SHIKI_SOURCE_MAX_CODE_UNITS=8192;import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";function isShikiHighlighter(candidate){return(typeof candidate=="object"||typeof candidate=="function")&&candidate!==null&&typeof candidate.getLoadedLanguages=="function"&&typeof candidate.loadLanguage=="function"&&typeof candidate.codeToHtml=="function"}const SHIKI_LIGHT_THEME="github-light",SHIKI_DARK_THEME="github-dark",SHIKI_THEMES={light:SHIKI_LIGHT_THEME,dark:SHIKI_DARK_THEME};function normalizeShikiLanguage(lang){return lang.trim().toLowerCase().replace(/^\./,"")}function javascriptEngineFactory(){return (async()=>{try{return await import("shiki/engine/javascript")}catch(e){throw e}})().then(({createJavaScriptRegexEngine})=>createJavaScriptRegexEngine())}let engineFactory=javascriptEngineFactory;function setShikiCoreEngine(engine){if(engine!=="javascript"&&typeof engine!="function")throw new TypeError("Expected the javascript preset or a regex engine factory.");engineFactory=engine==="javascript"?javascriptEngineFactory:engine}function __resetShikiCoreEngineForTesting(){engineFactory=javascriptEngineFactory}const highlighterCores=new WeakMap,recentHighlighterCores=[];function equalFrozenGrammars(left,right){let remaining=2e4;const leftSeen=new WeakSet,rightSeen=new WeakSet,equal=(a,b,depth)=>{if(--remaining<0||depth>32||typeof a!=typeof b||typeof a=="function"||typeof a=="symbol"||typeof a=="number"&&(!Number.isFinite(a)||!Number.isFinite(b)))return!1;if(a===null||b===null||typeof a!="object"||typeof b!="object")return Object.is(a,b);if(!Object.isFrozen(a)||!Object.isFrozen(b)||leftSeen.has(a)||rightSeen.has(b))return!1;const prototype=Object.getPrototypeOf(a);if(prototype!==Object.getPrototypeOf(b)||prototype!==Object.prototype&&prototype!==Array.prototype&&prototype!==null||Array.isArray(a)!==Array.isArray(b))return!1;leftSeen.add(a),rightSeen.add(b);const leftKeys=Reflect.ownKeys(a),rightKeys=Reflect.ownKeys(b);if(leftKeys.length!==rightKeys.length||leftKeys.length>remaining)return!1;for(let i=0;i<leftKeys.length;i+=1){const key=leftKeys[i];if(typeof key!="string"||key!==rightKeys[i])return!1;const first=Object.getOwnPropertyDescriptor(a,key),second=Object.getOwnPropertyDescriptor(b,key);if(!("value"in first)||!("value"in second)||first.enumerable!==second.enumerable||!equal(first.value,second.value,depth+1))return!1}return!0};try{return equal(left,right,0)}catch{return!1}}function shikiGrammarOwnNames(input){const known=new Set;let primaryName;const registrations=Array.isArray(input)?input:[input];for(const registration of registrations){if(!registration||typeof registration!="object")continue;const name=registration.name;typeof name=="string"&&name!==""&&(known.add(name),primaryName??=name);const aliases=registration.aliases;if(Array.isArray(aliases))for(const alias of aliases)typeof alias=="string"&&known.add(alias)}return{primaryName,known}}function buildShikiLangAlias(languages){let aliases;try{for(const key of Object.keys(languages)){const grammar=languages[key];if(grammar===void 0)continue;const{primaryName,known}=shikiGrammarOwnNames(grammar);!primaryName||known.has(key)||(aliases??={},aliases[key]=primaryName)}}catch{return aliases}return aliases}const coreLangAliases=new WeakMap;let highlighterCoreLoaderForTesting;const FINE_GRAINED_SHIKI_WARNING_KEY="lyra-fine-grained-shiki-highlighter-unavailable",FINE_GRAINED_SHIKI_WARNING="Lyra syntax highlighting failed to build a fine-grained shiki highlighter from the supplied grammars. Code is rendered as plain text.";function __setShikiHighlighterCoreLoaderForTesting(loader){highlighterCoreLoaderForTesting=loader}function loadShikiHighlighterCore(languages){if(highlighterCoreLoaderForTesting)return highlighterCoreLoaderForTesting(languages);const engine=engineFactory;let perEngine=highlighterCores.get(languages),cached=perEngine?.get(engine),frozen=!1;if(!cached)try{frozen=Object.isFrozen(languages)}catch{}if(frozen)for(let i=recentHighlighterCores.length-1;i>=0;i-=1){const entry=recentHighlighterCores[i],previous=entry.languages.deref(),promise=entry.promise.deref();if(!previous||!promise)recentHighlighterCores.splice(i,1);else if(entry.engine===engine&&equalFrozenGrammars(languages,previous)){cached=promise,recentHighlighterCores.splice(i,1),recentHighlighterCores.push({languages:new WeakRef(languages),engine,promise:entry.promise}),perEngine??=new Map,perEngine.set(engine,cached),highlighterCores.set(languages,perEngine);break}}if(!cached&&(cached=Promise.all([(async()=>{try{return await import("shiki/core")}catch(e){throw e}})(),Promise.resolve(engine()),(async()=>{try{return await import("shiki/themes/github-light.mjs")}catch(e){throw e}})(),(async()=>{try{return await import("shiki/themes/github-dark.mjs")}catch(e){throw e}})()]).then(async([{createHighlighterCore},resolvedEngine,light,dark])=>{const langAlias=buildShikiLangAlias(languages)??{},core=await createHighlighterCore({themes:[light.default,dark.default],langs:Object.values(languages),langAlias,engine:resolvedEngine});if(!isShikiHighlighter(core))throw new Error("Invalid optional peer `shiki`: `createHighlighterCore()` did not produce a usable highlighter capability.");return coreLangAliases.set(core,langAlias),core}).catch(()=>(devWarnOnce(FINE_GRAINED_SHIKI_WARNING_KEY,FINE_GRAINED_SHIKI_WARNING),null)),perEngine??=new Map,perEngine.set(engine,cached),highlighterCores.set(languages,perEngine),frozen)){recentHighlighterCores.push({languages:new WeakRef(languages),engine,promise:new WeakRef(cached)}),recentHighlighterCores.length>8&&recentHighlighterCores.shift();const pending=cached;pending.then(core=>{if(!core)for(let i=recentHighlighterCores.length-1;i>=0;i-=1)recentHighlighterCores[i].promise.deref()===pending&&recentHighlighterCores.splice(i,1)})}return cached}const resolvedLanguagesCache=new WeakMap;function resolvedShikiLanguages(languages){let hasLoader=!1;for(const key of Object.keys(languages))if(typeof languages[key]=="function"){hasLoader=!0;break}if(!hasLoader)return languages;let cached=resolvedLanguagesCache.get(languages);if(!cached){cached={};for(const key of Object.keys(languages)){const value=languages[key];value!==void 0&&typeof value!="function"&&(cached[key]=value)}resolvedLanguagesCache.set(languages,cached)}return cached}const loadedLanguageSources=new WeakMap,LAZY_LANGUAGE_SOURCE_WARNING_KEY="lyra-shiki-lazy-language-source-failed",LAZY_LANGUAGE_SOURCE_WARNING="Lyra syntax highlighting could not load a lazy `languages` grammar loader. That language renders as plain text.";function ensureShikiLanguageLoaded(core,key,source){if(typeof source!="function")return Promise.resolve(!0);let perCore=loadedLanguageSources.get(core);perCore||(perCore=new Map,loadedLanguageSources.set(core,perCore));let pending=perCore.get(key);return pending||(pending=Promise.resolve().then(source).then(async resolved=>{const grammar=unwrapOptionalPeerDefault(resolved);await core.loadLanguage(grammar);const{primaryName,known}=shikiGrammarOwnNames(grammar),aliases=coreLangAliases.get(core);aliases&&primaryName&&!known.has(key)&&(aliases[key]=primaryName)}).then(()=>!0).catch(()=>(devWarnOnce(LAZY_LANGUAGE_SOURCE_WARNING_KEY,LAZY_LANGUAGE_SOURCE_WARNING),!1)),perCore.set(key,pending)),pending}export{SHIKI_DARK_THEME,SHIKI_LIGHT_THEME,SHIKI_SOURCE_MAX_CODE_UNITS,SHIKI_THEMES,__resetShikiCoreEngineForTesting,__setShikiHighlighterCoreLoaderForTesting,ensureShikiLanguageLoaded,isShikiHighlighter,loadShikiHighlighterCore,normalizeShikiLanguage,resolvedShikiLanguages,setShikiCoreEngine};
@@ -1 +1 @@
1
- import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";function isKatexApi(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&"renderToString"in value&&typeof value.renderToString=="function"}const katex=createOptionalPeerLoader({load:()=>import("katex"),isCapability:isKatexApi,warningKey:"lyra-markdown-katex-unavailable",warning:"<lr-markdown>/<lr-markdown-core>: Math rendering is unavailable because the optional KaTeX peer could not load. TeX is rendered as literal text."});let cached,cacheGeneration;const KATEX_CACHE_GENERATION=Symbol.for("@aceshooting/lyra-ui/markdown-katex-cache-generation");function loadKatex(importKatex){return katex.loadWith(importKatex)}function getKatex(importKatex){const generation=Reflect.get(globalThis,KATEX_CACHE_GENERATION);return generation!==cacheGeneration&&(cached=void 0,cacheGeneration=generation),cached||(cached=loadKatex(importKatex)),cached}export{getKatex,loadKatex};
1
+ import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";function isKatexApi(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&"renderToString"in value&&typeof value.renderToString=="function"}const katex=createOptionalPeerLoader({load:()=>(async()=>{try{return await import("katex")}catch(e){throw e}})(),isCapability:isKatexApi,warningKey:"lyra-markdown-katex-unavailable",warning:"<lr-markdown>/<lr-markdown-core>: Math rendering is unavailable because the optional KaTeX peer could not load. TeX is rendered as literal text."});let cached,cacheGeneration;const KATEX_CACHE_GENERATION=Symbol.for("@aceshooting/lyra-ui/markdown-katex-cache-generation");function loadKatex(importKatex){return katex.loadWith(importKatex)}function getKatex(importKatex){const generation=Reflect.get(globalThis,KATEX_CACHE_GENERATION);return generation!==cacheGeneration&&(cached=void 0,cacheGeneration=generation),cached||(cached=loadKatex(importKatex)),cached}export{getKatex,loadKatex};
@@ -1 +1 @@
1
- import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";import{loadDompurify}from"../../../internal/dompurify-loader.js";function isLyraMarkedParser(value){return typeof value=="object"&&value!==null&&"defaults"in value&&typeof value.defaults=="object"&&value.defaults!==null&&"use"in value&&typeof value.use=="function"&&"parse"in value&&typeof value.parse=="function"}function isMarkedModule(value){if(typeof value!="object"&&typeof value!="function"||value===null||!("Marked"in value))return!1;try{const Marked=value.Marked;return typeof Marked!="function"?!1:isLyraMarkedParser(new Marked)}catch{return!1}}const markedLoader=createOptionalPeerLoader({load:()=>import("marked"),isCapability:isMarkedModule,warningKey:"lyra-markdown-marked-unavailable",warning:"<lr-markdown>/<lr-markdown-core>: Markdown parsing is unavailable because the optional marked peer could not load. Content is rendered as plain text."});let deps,resolvedDeps;async function loadMarkdownAndSanitizer(importMarked,importDompurify){const[marked,DOMPurify]=await Promise.all([markedLoader.loadWith(importMarked),loadDompurify(importDompurify)]);return{marked:marked??void 0,DOMPurify:DOMPurify??void 0}}function loadMarkdownDeps(){return deps||(deps=loadMarkdownAndSanitizer().then(resolved=>(resolvedDeps=resolved,resolved))),deps}function getMarkdownDepsIfLoaded(){return resolvedDeps}export{getMarkdownDepsIfLoaded,loadMarkdownAndSanitizer,loadMarkdownDeps};
1
+ import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";import{loadDompurify}from"../../../internal/dompurify-loader.js";function isLyraMarkedParser(value){return typeof value=="object"&&value!==null&&"defaults"in value&&typeof value.defaults=="object"&&value.defaults!==null&&"use"in value&&typeof value.use=="function"&&"parse"in value&&typeof value.parse=="function"}function isMarkedModule(value){if(typeof value!="object"&&typeof value!="function"||value===null||!("Marked"in value))return!1;try{const Marked=value.Marked;return typeof Marked!="function"?!1:isLyraMarkedParser(new Marked)}catch{return!1}}const markedLoader=createOptionalPeerLoader({load:()=>(async()=>{try{return await import("marked")}catch(e){throw e}})(),isCapability:isMarkedModule,warningKey:"lyra-markdown-marked-unavailable",warning:"<lr-markdown>/<lr-markdown-core>: Markdown parsing is unavailable because the optional marked peer could not load. Content is rendered as plain text."});let deps,resolvedDeps;async function loadMarkdownAndSanitizer(importMarked,importDompurify){const[marked,DOMPurify]=await Promise.all([markedLoader.loadWith(importMarked),loadDompurify(importDompurify)]);return{marked:marked??void 0,DOMPurify:DOMPurify??void 0}}function loadMarkdownDeps(){return deps||(deps=loadMarkdownAndSanitizer().then(resolved=>(resolvedDeps=resolved,resolved))),deps}function getMarkdownDepsIfLoaded(){return resolvedDeps}export{getMarkdownDepsIfLoaded,loadMarkdownAndSanitizer,loadMarkdownDeps};
@@ -1 +1 @@
1
- import{classifyOptionalPeerImportError}from"../../../internal/optional-peer-failure.js";const LOCALE_DATA_IMPORTERS=Object.freeze({en:()=>import("emoji-picker-element-data/en/emojibase/data.json",{with:{type:"json"}}),"en-gb":()=>import("emoji-picker-element-data/en-gb/emojibase/data.json",{with:{type:"json"}}),fr:()=>import("emoji-picker-element-data/fr/emojibase/data.json",{with:{type:"json"}}),ja:()=>import("emoji-picker-element-data/ja/emojibase/data.json",{with:{type:"json"}}),ru:()=>import("emoji-picker-element-data/ru/emojibase/data.json",{with:{type:"json"}}),sv:()=>import("emoji-picker-element-data/sv/emojibase/data.json",{with:{type:"json"}}),zh:()=>import("emoji-picker-element-data/zh/emojibase/data.json",{with:{type:"json"}})}),importEnglishData=()=>import("emoji-picker-element-data/en/emojibase/data.json",{with:{type:"json"}}),SUPPORTED_LOCALE_DIRECTORIES=new Set(Object.keys(LOCALE_DATA_IMPORTERS));function resolveEmojiDataLocale(locale){const lower=locale.toLowerCase();if(SUPPORTED_LOCALE_DIRECTORIES.has(lower))return lower;const base=lower.split("-")[0];return base&&SUPPORTED_LOCALE_DIRECTORIES.has(base)?base:"en"}const cached=new Map;let missingPeer;const MISSING_WARNING="<lr-emoji-picker>: the optional peer dependency `emoji-picker-element-data` is not installed, so there is no default emoji set. Install it with `pnpm add emoji-picker-element-data`, or supply `groups` directly.",FAILED_WARNING="<lr-emoji-picker>: the optional peer dependency `emoji-picker-element-data` was found but its emoji data could not be loaded or validated. Check the installed version and that your bundler supports JSON import attributes, or supply `groups` directly:";async function loadEmojiDataOutcome(locale="en",importData=resolvedLocale=>(LOCALE_DATA_IMPORTERS[resolvedLocale]??importEnglishData)()){let raw;try{raw=await importData(resolveEmojiDataLocale(locale))}catch(error){const reason=classifyOptionalPeerImportError(error);return reason==="missing"?console.warn(MISSING_WARNING):console.warn(FAILED_WARNING,error),{reason}}const adapted=adaptEmojiPickerElementData(raw);return adapted===null?(console.warn(FAILED_WARNING,new TypeError("The emoji-picker-element-data peer does not expose the expected array (or { default: array }) shape.")),{reason:"failed"}):adapted}async function loadEmojiData(locale="en",importData){const outcome=await loadEmojiDataOutcome(locale,importData);return Array.isArray(outcome)?outcome:null}function loadEmojiDataOutcomeCached(locale="en",importData){return cachedLoad(locale,importData).outcome}function loadEmojiDataCached(locale="en",importData){return cachedLoad(locale,importData).groups}function cachedLoad(locale,importData){if(missingPeer)return missingPeer;const key=resolveEmojiDataLocale(locale);let entry=cached.get(key);if(!entry){const outcome=loadEmojiDataOutcome(key,importData),load={outcome,groups:outcome.then(value=>Array.isArray(value)?value:null)};entry=load,cached.set(key,load),outcome.then(value=>{Array.isArray(value)||(cached.get(key)===load&&cached.delete(key),value.reason==="missing"&&(missingPeer??=load))})}return entry}function clearEmojiDataCache(){cached.clear(),missingPeer=void 0}const GROUP_LABELS={0:"Smileys & Emotion",1:"People & Body",2:"Component",3:"Animals & Nature",4:"Food & Drink",5:"Travel & Places",6:"Activities",7:"Objects",8:"Symbols",9:"Flags"};function adaptEmojiPickerElementData(raw){const candidate=raw?.default,entries=Array.isArray(raw)?raw:Array.isArray(candidate)?candidate:null;if(entries===null)return null;const byGroup=new Map;for(const entry of entries){if(!entry.emoji||!entry.annotation||entry.group===void 0)continue;let bucket=byGroup.get(entry.group);bucket||(bucket={key:String(entry.group),label:GROUP_LABELS[entry.group]??String(entry.group),emojis:[]},byGroup.set(entry.group,bucket)),bucket.emojis.push({emoji:entry.emoji,name:entry.annotation,shortcodes:entry.shortcodes})}return[...byGroup.entries()].sort(([a],[b])=>a-b).map(([,group])=>group)}export{clearEmojiDataCache,loadEmojiData,loadEmojiDataCached,loadEmojiDataOutcome,loadEmojiDataOutcomeCached,resolveEmojiDataLocale};
1
+ import{classifyOptionalPeerImportError}from"../../../internal/optional-peer-failure.js";const LOCALE_DATA_IMPORTERS=Object.freeze({en:()=>(async()=>{try{return await import("emoji-picker-element-data/en/emojibase/data.json",{with:{type:"json"}})}catch(e){throw e}})(),"en-gb":()=>(async()=>{try{return await import("emoji-picker-element-data/en-gb/emojibase/data.json",{with:{type:"json"}})}catch(e){throw e}})(),fr:()=>(async()=>{try{return await import("emoji-picker-element-data/fr/emojibase/data.json",{with:{type:"json"}})}catch(e){throw e}})(),ja:()=>(async()=>{try{return await import("emoji-picker-element-data/ja/emojibase/data.json",{with:{type:"json"}})}catch(e){throw e}})(),ru:()=>(async()=>{try{return await import("emoji-picker-element-data/ru/emojibase/data.json",{with:{type:"json"}})}catch(e){throw e}})(),sv:()=>(async()=>{try{return await import("emoji-picker-element-data/sv/emojibase/data.json",{with:{type:"json"}})}catch(e){throw e}})(),zh:()=>(async()=>{try{return await import("emoji-picker-element-data/zh/emojibase/data.json",{with:{type:"json"}})}catch(e){throw e}})()}),importEnglishData=()=>(async()=>{try{return await import("emoji-picker-element-data/en/emojibase/data.json",{with:{type:"json"}})}catch(e){throw e}})(),SUPPORTED_LOCALE_DIRECTORIES=new Set(Object.keys(LOCALE_DATA_IMPORTERS));function resolveEmojiDataLocale(locale){const lower=locale.toLowerCase();if(SUPPORTED_LOCALE_DIRECTORIES.has(lower))return lower;const base=lower.split("-")[0];return base&&SUPPORTED_LOCALE_DIRECTORIES.has(base)?base:"en"}const cached=new Map;let missingPeer;const MISSING_WARNING="<lr-emoji-picker>: the optional peer dependency `emoji-picker-element-data` is not installed, so there is no default emoji set. Install it with `pnpm add emoji-picker-element-data`, or supply `groups` directly.",FAILED_WARNING="<lr-emoji-picker>: the optional peer dependency `emoji-picker-element-data` was found but its emoji data could not be loaded or validated. Check the installed version and that your bundler supports JSON import attributes, or supply `groups` directly:";async function loadEmojiDataOutcome(locale="en",importData=resolvedLocale=>(LOCALE_DATA_IMPORTERS[resolvedLocale]??importEnglishData)()){let raw;try{raw=await importData(resolveEmojiDataLocale(locale))}catch(error){const reason=classifyOptionalPeerImportError(error);return reason==="missing"?console.warn(MISSING_WARNING):console.warn(FAILED_WARNING,error),{reason}}const adapted=adaptEmojiPickerElementData(raw);return adapted===null?(console.warn(FAILED_WARNING,new TypeError("The emoji-picker-element-data peer does not expose the expected array (or { default: array }) shape.")),{reason:"failed"}):adapted}async function loadEmojiData(locale="en",importData){const outcome=await loadEmojiDataOutcome(locale,importData);return Array.isArray(outcome)?outcome:null}function loadEmojiDataOutcomeCached(locale="en",importData){return cachedLoad(locale,importData).outcome}function loadEmojiDataCached(locale="en",importData){return cachedLoad(locale,importData).groups}function cachedLoad(locale,importData){if(missingPeer)return missingPeer;const key=resolveEmojiDataLocale(locale);let entry=cached.get(key);if(!entry){const outcome=loadEmojiDataOutcome(key,importData),load={outcome,groups:outcome.then(value=>Array.isArray(value)?value:null)};entry=load,cached.set(key,load),outcome.then(value=>{Array.isArray(value)||(cached.get(key)===load&&cached.delete(key),value.reason==="missing"&&(missingPeer??=load))})}return entry}function clearEmojiDataCache(){cached.clear(),missingPeer=void 0}const GROUP_LABELS={0:"Smileys & Emotion",1:"People & Body",2:"Component",3:"Animals & Nature",4:"Food & Drink",5:"Travel & Places",6:"Activities",7:"Objects",8:"Symbols",9:"Flags"};function adaptEmojiPickerElementData(raw){const candidate=raw?.default,entries=Array.isArray(raw)?raw:Array.isArray(candidate)?candidate:null;if(entries===null)return null;const byGroup=new Map;for(const entry of entries){if(!entry.emoji||!entry.annotation||entry.group===void 0)continue;let bucket=byGroup.get(entry.group);bucket||(bucket={key:String(entry.group),label:GROUP_LABELS[entry.group]??String(entry.group),emojis:[]},byGroup.set(entry.group,bucket)),bucket.emojis.push({emoji:entry.emoji,name:entry.annotation,shortcodes:entry.shortcodes})}return[...byGroup.entries()].sort(([a],[b])=>a-b).map(([,group])=>group)}export{clearEmojiDataCache,loadEmojiData,loadEmojiDataCached,loadEmojiDataOutcome,loadEmojiDataOutcomeCached,resolveEmojiDataLocale};
@@ -1 +1 @@
1
- import{loadBulkFlagUrl,setFlagUrlResolver}from"./flag.js";const peerResolver=loadBulkFlagUrl(()=>import("@aceshooting/lyra-flags/standard"));setFlagUrlResolver(peerResolver);async function registerLyraFlagStandardBulkPeer(){return peerResolver}registerLyraFlagStandardBulkPeer();export{registerLyraFlagStandardBulkPeer};
1
+ import{loadBulkFlagUrl,setFlagUrlResolver}from"./flag.js";const peerResolver=loadBulkFlagUrl(()=>(async()=>{try{return await import("@aceshooting/lyra-flags/standard")}catch(e){throw e}})());setFlagUrlResolver(peerResolver);async function registerLyraFlagStandardBulkPeer(){return peerResolver}registerLyraFlagStandardBulkPeer();export{registerLyraFlagStandardBulkPeer};
@@ -1 +1 @@
1
- import{loadBulkFlagUrl,setFlagUrlResolver}from"./flag.js";const peerResolver=loadBulkFlagUrl(()=>import("@aceshooting/lyra-flags"));setFlagUrlResolver(peerResolver);async function registerLyraFlagBulkPeer(){return peerResolver}registerLyraFlagBulkPeer();export{registerLyraFlagBulkPeer};
1
+ import{loadBulkFlagUrl,setFlagUrlResolver}from"./flag.js";const peerResolver=loadBulkFlagUrl(()=>(async()=>{try{return await import("@aceshooting/lyra-flags")}catch(e){throw e}})());setFlagUrlResolver(peerResolver);async function registerLyraFlagBulkPeer(){return peerResolver}registerLyraFlagBulkPeer();export{registerLyraFlagBulkPeer};
@@ -1 +1 @@
1
- import{loadFlagUrl,setFlagUrlResolver}from"./flag.js";const peerResolver=loadFlagUrl(()=>import("@aceshooting/lyra-flags"));setFlagUrlResolver(peerResolver);async function registerLyraFlagPeer(){return peerResolver}registerLyraFlagPeer();export{registerLyraFlagPeer};
1
+ import{loadFlagUrl,setFlagUrlResolver}from"./flag.js";const peerResolver=loadFlagUrl(()=>(async()=>{try{return await import("@aceshooting/lyra-flags")}catch(e){throw e}})());setFlagUrlResolver(peerResolver);async function registerLyraFlagPeer(){return peerResolver}registerLyraFlagPeer();export{registerLyraFlagPeer};
@@ -1 +1 @@
1
- import{resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";import{mapFeatureLoader,__setMapFeatureImporterForTesting as setImporter}from"./map-feature-loader-core.js";import{loadMapImageRuntime,loadMapStyleOverrideRuntime}from"./map-resource-feature-loaders.js";const loadMapAnchorRuntime=mapFeatureLoader(()=>import("./map-anchor-controller.js")),loadMapControlRuntime=mapFeatureLoader(()=>import("./map-controls-lifecycle.js")),loadMapDrawingRuntime=mapFeatureLoader(()=>import("./map-drawing-controller.js")),loadMapImageExportRuntime=mapFeatureLoader(()=>import("./map-image-export-controller.js")),loadMapHashRuntime=mapFeatureLoader(()=>import("./map-hash-owner.js")),loadMapFeatureStateRuntime=mapFeatureLoader(()=>import("./map-feature-state-routes.js")),loadMapOwnedFeatureRuntime=mapFeatureLoader(()=>import("./map-owned-features.js"));function __setMapFeatureImporterForTesting(loader,importer){setImporter(loader,importer)}const loadMapSceneRenderRuntime=mapFeatureLoader(()=>import("./map-scene-render-controller.js")),sceneBridgeImporter=()=>import("@aceshooting/lyra-map/scene");let importSceneBridge=sceneBridgeImporter;async function importSceneBridgeRuntime(){const runtime=resolveOptionalPeerCapability(await importSceneBridge(),value=>typeof value=="object"&&value!==null&&"createSceneBridge"in value&&typeof value.createSceneBridge=="function");if(!runtime)throw new TypeError("Map scene renderer unavailable");return runtime}const loadMapSceneBridge=mapFeatureLoader(importSceneBridgeRuntime);function __setMapSceneBridgeImporterForTesting(importer){importSceneBridge=importer??sceneBridgeImporter,setImporter(loadMapSceneBridge)}export{__setMapFeatureImporterForTesting,__setMapSceneBridgeImporterForTesting,loadMapAnchorRuntime,loadMapControlRuntime,loadMapDrawingRuntime,loadMapFeatureStateRuntime,loadMapHashRuntime,loadMapImageExportRuntime,loadMapImageRuntime,loadMapOwnedFeatureRuntime,loadMapSceneBridge,loadMapSceneRenderRuntime,loadMapStyleOverrideRuntime};
1
+ import{resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";import{mapFeatureLoader,__setMapFeatureImporterForTesting as setImporter}from"./map-feature-loader-core.js";import{loadMapImageRuntime,loadMapStyleOverrideRuntime}from"./map-resource-feature-loaders.js";const loadMapAnchorRuntime=mapFeatureLoader(()=>import("./map-anchor-controller.js")),loadMapControlRuntime=mapFeatureLoader(()=>import("./map-controls-lifecycle.js")),loadMapDrawingRuntime=mapFeatureLoader(()=>import("./map-drawing-controller.js")),loadMapImageExportRuntime=mapFeatureLoader(()=>import("./map-image-export-controller.js")),loadMapHashRuntime=mapFeatureLoader(()=>import("./map-hash-owner.js")),loadMapFeatureStateRuntime=mapFeatureLoader(()=>import("./map-feature-state-routes.js")),loadMapOwnedFeatureRuntime=mapFeatureLoader(()=>import("./map-owned-features.js"));function __setMapFeatureImporterForTesting(loader,importer){setImporter(loader,importer)}const loadMapSceneRenderRuntime=mapFeatureLoader(()=>import("./map-scene-render-controller.js")),sceneBridgeImporter=()=>(async()=>{try{return await import("@aceshooting/lyra-map/scene")}catch(e){throw e}})();let importSceneBridge=sceneBridgeImporter;async function importSceneBridgeRuntime(){const runtime=resolveOptionalPeerCapability(await importSceneBridge(),value=>typeof value=="object"&&value!==null&&"createSceneBridge"in value&&typeof value.createSceneBridge=="function");if(!runtime)throw new TypeError("Map scene renderer unavailable");return runtime}const loadMapSceneBridge=mapFeatureLoader(importSceneBridgeRuntime);function __setMapSceneBridgeImporterForTesting(importer){importSceneBridge=importer??sceneBridgeImporter,setImporter(loadMapSceneBridge)}export{__setMapFeatureImporterForTesting,__setMapSceneBridgeImporterForTesting,loadMapAnchorRuntime,loadMapControlRuntime,loadMapDrawingRuntime,loadMapFeatureStateRuntime,loadMapHashRuntime,loadMapImageExportRuntime,loadMapImageRuntime,loadMapOwnedFeatureRuntime,loadMapSceneBridge,loadMapSceneRenderRuntime,loadMapStyleOverrideRuntime};
@@ -1 +1 @@
1
- import{resolveOptionalPeerCapability,unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";const MAP_METHODS=["getCanvas","getCenter","getZoom","setCenter","setZoom","resize","remove","on","once","setStyle","getSource","addSource","removeSource","getLayer","addLayer","removeLayer","setPaintProperty","queryRenderedFeatures"],MARKER_METHODS=["setLngLat","setPopup","getPopup","addTo","remove"],POPUP_METHODS=["setHTML","setText"];function isObjectLike(value){return(typeof value=="object"||typeof value=="function")&&value!==null}function isConstructor(value){if(typeof value!="function")return!1;try{return Reflect.construct(Object,[],value),!0}catch{return!1}}function missingConstructorCapability(module,name,methods){const Constructor=module[name];if(!isConstructor(Constructor))return name;const prototype=Constructor.prototype;if(!isObjectLike(prototype))return`${name}.prototype`;for(const method of methods)if(typeof prototype[method]!="function")return`${name}.prototype.${method}`}function missingMaplibreCapability(candidate){return isObjectLike(candidate)?missingConstructorCapability(candidate,"Map",MAP_METHODS)??missingConstructorCapability(candidate,"Marker",MARKER_METHODS)??missingConstructorCapability(candidate,"Popup",POPUP_METHODS):"module namespace"}function isMaplibreModule(candidate){return missingMaplibreCapability(candidate)===void 0}function resolveMaplibreModule(value){const module=resolveOptionalPeerCapability(value,isMaplibreModule);if(module)return module;const candidate=unwrapOptionalPeerDefault(value),missing=missingMaplibreCapability(candidate)??"module namespace";throw new Error(`Invalid optional peer \`maplibre-gl\`: missing or invalid \`${missing}\` capability.`)}let maplibre,maplibreCapabilities;async function loadMaplibreModule(importer=()=>import("maplibre-gl").then(source=>maplibreCapabilities??=Object.freeze({get Map(){return source.Map},get Marker(){return source.Marker},get Popup(){return source.Popup},get NavigationControl(){return source.NavigationControl},get ScaleControl(){return source.ScaleControl},get GeolocateControl(){return source.GeolocateControl},get AttributionControl(){return source.AttributionControl},get setWorkerUrl(){return source.setWorkerUrl},get getVersion(){return source.getVersion},get default(){return source.default}}))){try{return resolveMaplibreModule(await importer())}catch(error){return console.warn("<lr-map> needs the optional peer dependency `maplibre-gl` — install it with `pnpm add maplibre-gl`.",error),null}}function loadMaplibre(){return maplibre||(maplibre=loadMaplibreModule()),maplibre}function isModularMapModule(candidate){return isMaplibreModule(candidate)&&typeof candidate.Map.prototype.prepareFeatures=="function"}let modularMapCapabilities;async function loadModularMapModule(importer=()=>import("@aceshooting/lyra-map").then(source=>modularMapCapabilities??=Object.freeze({get Map(){return source.Map},get Marker(){return source.Marker},get Popup(){return source.Popup}}))){try{const value=await importer(),module=resolveOptionalPeerCapability(value,isModularMapModule);if(module)return module;const candidate=unwrapOptionalPeerDefault(value),missing=missingMaplibreCapability(candidate)??"Map.prototype.prepareFeatures";throw new Error(`Invalid optional peer \`@aceshooting/lyra-map\`: missing or invalid \`${missing}\` capability.`)}catch(error){return console.warn("<lr-map> needs the optional peer dependency `@aceshooting/lyra-map` — install it with `pnpm add @aceshooting/lyra-map`.",error),null}}let modularMap;function loadModularMap(){return modularMap??=loadModularMapModule()}async function loadMapControl(kind,engine,module){if(kind==="globe"||kind==="terrain"){const runtime=await import("./map-scene-controls.js");return kind==="globe"?runtime.MapGlobeControl:runtime.MapTerrainControl}const name={navigation:"NavigationControl",scale:"ScaleControl",geolocate:"GeolocateControl",attribution:"AttributionControl"}[kind],provided=module?.[name];if(isConstructor(provided))return provided;if(engine!=="modular")return null;try{const source=kind==="navigation"?await import("@aceshooting/lyra-map/controls/navigation"):kind==="scale"?await import("@aceshooting/lyra-map/controls/scale"):kind==="geolocate"?await import("@aceshooting/lyra-map/controls/geolocate"):await import("@aceshooting/lyra-map/controls/attribution"),candidate=unwrapOptionalPeerDefault(source),control=isObjectLike(candidate)?candidate[name]:void 0;return isConstructor(control)?control:null}catch(error){return console.warn(`<lr-map> could not load the ${kind} control from \`@aceshooting/lyra-map\`.`,error),null}}export{loadMapControl,loadMaplibre,loadMaplibreModule,loadModularMap,loadModularMapModule};
1
+ import{resolveOptionalPeerCapability,unwrapOptionalPeerDefault}from"../../../internal/optional-peer-capabilities.js";const MAP_METHODS=["getCanvas","getCenter","getZoom","setCenter","setZoom","resize","remove","on","once","setStyle","getSource","addSource","removeSource","getLayer","addLayer","removeLayer","setPaintProperty","queryRenderedFeatures"],MARKER_METHODS=["setLngLat","setPopup","getPopup","addTo","remove"],POPUP_METHODS=["setHTML","setText"];function isObjectLike(value){return(typeof value=="object"||typeof value=="function")&&value!==null}function isConstructor(value){if(typeof value!="function")return!1;try{return Reflect.construct(Object,[],value),!0}catch{return!1}}function missingConstructorCapability(module,name,methods){const Constructor=module[name];if(!isConstructor(Constructor))return name;const prototype=Constructor.prototype;if(!isObjectLike(prototype))return`${name}.prototype`;for(const method of methods)if(typeof prototype[method]!="function")return`${name}.prototype.${method}`}function missingMaplibreCapability(candidate){return isObjectLike(candidate)?missingConstructorCapability(candidate,"Map",MAP_METHODS)??missingConstructorCapability(candidate,"Marker",MARKER_METHODS)??missingConstructorCapability(candidate,"Popup",POPUP_METHODS):"module namespace"}function isMaplibreModule(candidate){return missingMaplibreCapability(candidate)===void 0}function resolveMaplibreModule(value){const module=resolveOptionalPeerCapability(value,isMaplibreModule);if(module)return module;const candidate=unwrapOptionalPeerDefault(value),missing=missingMaplibreCapability(candidate)??"module namespace";throw new Error(`Invalid optional peer \`maplibre-gl\`: missing or invalid \`${missing}\` capability.`)}let maplibre,maplibreCapabilities;async function loadMaplibreModule(importer=()=>(async()=>{try{return await import("maplibre-gl")}catch(e){throw e}})().then(source=>maplibreCapabilities??=Object.freeze({get Map(){return source.Map},get Marker(){return source.Marker},get Popup(){return source.Popup},get NavigationControl(){return source.NavigationControl},get ScaleControl(){return source.ScaleControl},get GeolocateControl(){return source.GeolocateControl},get AttributionControl(){return source.AttributionControl},get setWorkerUrl(){return source.setWorkerUrl},get getVersion(){return source.getVersion},get default(){return source.default}}))){try{return resolveMaplibreModule(await importer())}catch(error){return console.warn("<lr-map> needs the optional peer dependency `maplibre-gl` — install it with `pnpm add maplibre-gl`.",error),null}}function loadMaplibre(){return maplibre||(maplibre=loadMaplibreModule()),maplibre}function isModularMapModule(candidate){return isMaplibreModule(candidate)&&typeof candidate.Map.prototype.prepareFeatures=="function"}let modularMapCapabilities;async function loadModularMapModule(importer=()=>(async()=>{try{return await import("@aceshooting/lyra-map")}catch(e){throw e}})().then(source=>modularMapCapabilities??=Object.freeze({get Map(){return source.Map},get Marker(){return source.Marker},get Popup(){return source.Popup}}))){try{const value=await importer(),module=resolveOptionalPeerCapability(value,isModularMapModule);if(module)return module;const candidate=unwrapOptionalPeerDefault(value),missing=missingMaplibreCapability(candidate)??"Map.prototype.prepareFeatures";throw new Error(`Invalid optional peer \`@aceshooting/lyra-map\`: missing or invalid \`${missing}\` capability.`)}catch(error){return console.warn("<lr-map> needs the optional peer dependency `@aceshooting/lyra-map` — install it with `pnpm add @aceshooting/lyra-map`.",error),null}}let modularMap;function loadModularMap(){return modularMap??=loadModularMapModule()}async function loadMapControl(kind,engine,module){if(kind==="globe"||kind==="terrain"){const runtime=await import("./map-scene-controls.js");return kind==="globe"?runtime.MapGlobeControl:runtime.MapTerrainControl}const name={navigation:"NavigationControl",scale:"ScaleControl",geolocate:"GeolocateControl",attribution:"AttributionControl"}[kind],provided=module?.[name];if(isConstructor(provided))return provided;if(engine!=="modular")return null;try{const source=kind==="navigation"?await import("@aceshooting/lyra-map/controls/navigation"):kind==="scale"?await import("@aceshooting/lyra-map/controls/scale"):kind==="geolocate"?await import("@aceshooting/lyra-map/controls/geolocate"):await import("@aceshooting/lyra-map/controls/attribution"),candidate=unwrapOptionalPeerDefault(source),control=isObjectLike(candidate)?candidate[name]:void 0;return isConstructor(control)?control:null}catch(error){return console.warn(`<lr-map> could not load the ${kind} control from \`@aceshooting/lyra-map\`.`,error),null}}export{loadMapControl,loadMaplibre,loadMaplibreModule,loadModularMap,loadModularMapModule};
@@ -1 +1 @@
1
- import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";const QR_CODE_PEER_WARNING_KEY="lyra-qr-code-peer-unavailable",QR_CODE_PEER_WARNING="<lr-qr-code> could not load its optional qrcode peer.";function isQrCodeApi(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&"create"in value&&typeof value.create=="function"}const qrCode=createOptionalPeerLoader({load:()=>import("qrcode"),isCapability:candidate=>{try{return isQrCodeApi(candidate)}catch{return!1}},warningKey:QR_CODE_PEER_WARNING_KEY,warning:QR_CODE_PEER_WARNING});function loadQrCode(importQrCode){return qrCode.loadWith(importQrCode)}function loadQrCodeCached(){return qrCode.get()}function clearQrCodeCache(){qrCode.clear()}export{clearQrCodeCache,loadQrCode,loadQrCodeCached};
1
+ import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";const QR_CODE_PEER_WARNING_KEY="lyra-qr-code-peer-unavailable",QR_CODE_PEER_WARNING="<lr-qr-code> could not load its optional qrcode peer.";function isQrCodeApi(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&"create"in value&&typeof value.create=="function"}const qrCode=createOptionalPeerLoader({load:()=>(async()=>{try{return await import("qrcode")}catch(e){throw e}})(),isCapability:candidate=>{try{return isQrCodeApi(candidate)}catch{return!1}},warningKey:QR_CODE_PEER_WARNING_KEY,warning:QR_CODE_PEER_WARNING});function loadQrCode(importQrCode){return qrCode.loadWith(importQrCode)}function loadQrCodeCached(){return qrCode.get()}function clearQrCodeCache(){qrCode.clear()}export{clearQrCodeCache,loadQrCode,loadQrCodeCached};
@@ -1 +1 @@
1
- import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{Engine3dSelection,engine3dFailureReason,webgl2Available}from"../../../internal/engine-3d.js";import{resolveCanvasColor}from"../../../internal/canvas-color.js";import{finiteRange}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";const embeddingPointsLoader=createEngine3dLoader({entry:"points",tag:tag("embedding-explorer"),load:()=>import("@aceshooting/lyra-3d/points")}),embeddingEngineEnvironment={available:document=>webgl2Available(()=>document.createElement("canvas"))};class EmbeddingEngineController{constructor(host,changed,fallback,pick){this.host=host,this.changed=changed,this.fallback=fallback,this.pick=pick,this.selection=new Engine3dSelection(!0),this.notice=null,this.loading=!1,this.ready=!1,this.software=!1,this.generation=0,this.revision=0,this.rows=null,this.container=null,this.intersecting=!1,this.pending=!1,this.attempted=!1,this.preference="builtin",this.sourceMode=!1,this.mediaCleanup=[],this.hover=-1,this.selected=-1,this.focus=-1}releaseEngine(){this.generation++,this.observer?.disconnect(),this.observer=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.intersecting=!1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.styleObserver?.disconnect(),this.styleObserver=void 0;for(const cleanup of this.mediaCleanup)cleanup();this.mediaCleanup=[];const engine=this.engine;this.engine=void 0,this.ready=this.loading=this.pending=!1,this.software=!1,this.hover=-1,engine?.dispose()}invalidate(){this.releaseEngine(),this.attempted=!1,this.selection.prefer(this.preference),this.notice=null}disconnect(){this.invalidate(),this.container=null,this.rows=null}update(preference,rows,sourceMode,container,selected,focus){if((preference!==this.preference||rows!==this.rows||sourceMode!==this.sourceMode||container!==this.container)&&(this.invalidate(),this.preference=preference,this.rows=rows,this.sourceMode=sourceMode,this.container=container,this.selection.prefer(preference),this.notice=null),this.selected=selected,this.focus=focus,preference!=="webgl"||!this.host.isConnected)return;if(sourceMode){this.attempted||(this.attempted=!0,this.fail("unsupported"));return}if(!rows?.count||!container)return;if(this.engine&&this.ready){try{this.engine.setStyle(this.style()),this.syncState()}catch{this.fail("error")}return}if(this.pending||this.attempted||this.selection.renderer!=="webgl"||this.observer||this.eligibility)return;const view=this.host.ownerDocument.defaultView,generation=this.generation;this.intersecting=view?.IntersectionObserver===void 0;const admit=()=>{generation!==this.generation||this.pending||this.attempted||!this.intersecting||!isAccessibilityVisible(this.host)||(this.observer?.disconnect(),this.observer=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.start())};if(view?.IntersectionObserver&&(this.observer=new view.IntersectionObserver(entries=>{if(generation===this.generation){for(const entry of entries)entry.target===container&&(this.intersecting=entry.isIntersecting);admit()}}),this.observer.observe(container)),view?.MutationObserver){this.eligibility=new view.MutationObserver(admit);let ancestor=this.host,depth=0;for(;ancestor&&depth++<=256;){this.eligibility.observe(ancestor,{attributes:!0,attributeFilter:["aria-hidden","inert","hidden","style","class","open"]});const root=ancestor.getRootNode();ancestor=ancestor.assignedSlot??ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}admit()}fail(reason){const detail=this.selection.renderer==="webgl"?this.selection.fail(reason):null;this.loading=this.ready=!1,reason!=="context-lost"&&(this.releaseEngine(),this.attempted=!0),detail&&(this.notice=detail,this.changed(),this.fallback(detail))}syncState(){this.engine?.setState?.({selected:new Set(this.selected<0?[]:[this.selected]),dimmed:new Set,hover:this.hover,focus:this.focus})}async start(){const container=this.container,rows=this.rows,owner=this.host.ownerDocument;if(!container||!rows||!this.host.isConnected||this.preference!=="webgl")return;const generation=this.generation,current=()=>generation===this.generation&&this.host.isConnected&&this.host.ownerDocument===owner&&this.container===container;if(this.attempted=this.pending=!0,!embeddingEngineEnvironment.available(owner)){this.pending=!1,this.fail("unsupported");return}this.loading=!0,this.changed();let engine=null;try{if(engine=await embeddingPointsLoader.create(),!current()){engine?.dispose();return}if(!engine){this.pending=!1,this.fail("unavailable");return}if(this.engine=engine,await engine.mount(container,{hover:index=>{if(!(!current()||!this.ready)){this.hover=index!==null&&rows.point(index)?index:-1;try{this.syncState()}catch{this.fail("error")}}},pick:index=>{current()&&this.ready&&index!==null&&rows.point(index)&&this.pick(index)},camera:()=>{},lost:reason=>{current()&&this.fail(reason)},rendering:info=>{current()&&(this.software=info.software,this.changed())},restored:()=>{if(!(!current()||!this.engine||!this.selection.restore()))try{this.ready=!0,this.notice=null,this.syncState(),this.changed()}catch{this.fail("error")}}}),!current()){engine.dispose();return}engine.setStyle(this.style()),engine.setData(rows.data(),++this.revision);const resize=()=>{if(!current())return;const box=container.getBoundingClientRect();engine.resize(Math.max(1,box.width),Math.max(1,box.height))};resize(),engine.fit?.();const view=owner.defaultView;view?.ResizeObserver&&(this.resizeObserver=new view.ResizeObserver(()=>{if(!(!current()||!this.ready))try{engine.setStyle(this.style()),resize()}catch{this.fail("error")}}),this.resizeObserver.observe(container));const refreshStyle=()=>{if(!(!current()||!this.ready))try{engine.setStyle(this.style())}catch{this.fail("error")}};if(view?.MutationObserver){this.styleObserver=new view.MutationObserver(refreshStyle);let ancestor=this.host;for(;ancestor;){this.styleObserver.observe(ancestor,{attributes:!0});const root=ancestor.getRootNode();ancestor=ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}for(const query of["(prefers-reduced-motion: reduce)","(forced-colors: active)","(prefers-color-scheme: dark)"]){const media=view?.matchMedia(query);media?.addEventListener("change",refreshStyle),media&&this.mediaCleanup.push(()=>media.removeEventListener("change",refreshStyle))}this.pending=this.loading=!1,this.ready=this.selection.renderer==="webgl",this.syncState(),this.changed()}catch(error){if(!current()){engine?.dispose();return}this.fail(engine3dFailureReason(error))}}style(){const view=this.host.ownerDocument.defaultView,computed=view.getComputedStyle(this.host),canvas=this.host.ownerDocument.createElement("canvas");canvas.width=canvas.height=1;const context=canvas.getContext("2d",{willReadFrequently:!0}),color=name=>{const resolved=resolveCanvasColor(this.host,`var(${name})`,computed.color);if(!context)return resolved;context.clearRect(0,0,1,1),context.fillStyle=resolved,context.fillRect(0,0,1,1);const rgba=context.getImageData(0,0,1,1).data;return`rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3]/255})`};return{background:color("--lr-color-surface"),foreground:color("--lr-color-text"),muted:color("--lr-color-text-quiet"),accent:color("--lr-color-brand"),focus:color("--lr-focus-ring-color"),palette:Array.from({length:8},(_,index)=>color(`--lr-color-chart-${index+1}`)),fontFamily:computed.fontFamily,fontSize:finiteRange(Number.parseFloat(computed.fontSize),14,1,128),pointSize:12,lineWidth:1,devicePixelRatio:finiteRange(view.devicePixelRatio,1,.25,4),reducedMotion:view.matchMedia("(prefers-reduced-motion: reduce)").matches,forcedColors:view.matchMedia("(forced-colors: active)").matches}}}export{EmbeddingEngineController,embeddingEngineEnvironment,embeddingPointsLoader};
1
+ import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{Engine3dSelection,engine3dFailureReason,webgl2Available}from"../../../internal/engine-3d.js";import{resolveCanvasColor}from"../../../internal/canvas-color.js";import{finiteRange}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";const embeddingPointsLoader=createEngine3dLoader({entry:"points",tag:tag("embedding-explorer"),load:()=>(async()=>{try{return await import("@aceshooting/lyra-3d/points")}catch(e){throw e}})()}),embeddingEngineEnvironment={available:document=>webgl2Available(()=>document.createElement("canvas"))};class EmbeddingEngineController{constructor(host,changed,fallback,pick){this.host=host,this.changed=changed,this.fallback=fallback,this.pick=pick,this.selection=new Engine3dSelection(!0),this.notice=null,this.loading=!1,this.ready=!1,this.software=!1,this.generation=0,this.revision=0,this.rows=null,this.container=null,this.intersecting=!1,this.pending=!1,this.attempted=!1,this.preference="builtin",this.sourceMode=!1,this.mediaCleanup=[],this.hover=-1,this.selected=-1,this.focus=-1}releaseEngine(){this.generation++,this.observer?.disconnect(),this.observer=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.intersecting=!1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.styleObserver?.disconnect(),this.styleObserver=void 0;for(const cleanup of this.mediaCleanup)cleanup();this.mediaCleanup=[];const engine=this.engine;this.engine=void 0,this.ready=this.loading=this.pending=!1,this.software=!1,this.hover=-1,engine?.dispose()}invalidate(){this.releaseEngine(),this.attempted=!1,this.selection.prefer(this.preference),this.notice=null}disconnect(){this.invalidate(),this.container=null,this.rows=null}update(preference,rows,sourceMode,container,selected,focus){if((preference!==this.preference||rows!==this.rows||sourceMode!==this.sourceMode||container!==this.container)&&(this.invalidate(),this.preference=preference,this.rows=rows,this.sourceMode=sourceMode,this.container=container,this.selection.prefer(preference),this.notice=null),this.selected=selected,this.focus=focus,preference!=="webgl"||!this.host.isConnected)return;if(sourceMode){this.attempted||(this.attempted=!0,this.fail("unsupported"));return}if(!rows?.count||!container)return;if(this.engine&&this.ready){try{this.engine.setStyle(this.style()),this.syncState()}catch{this.fail("error")}return}if(this.pending||this.attempted||this.selection.renderer!=="webgl"||this.observer||this.eligibility)return;const view=this.host.ownerDocument.defaultView,generation=this.generation;this.intersecting=view?.IntersectionObserver===void 0;const admit=()=>{generation!==this.generation||this.pending||this.attempted||!this.intersecting||!isAccessibilityVisible(this.host)||(this.observer?.disconnect(),this.observer=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.start())};if(view?.IntersectionObserver&&(this.observer=new view.IntersectionObserver(entries=>{if(generation===this.generation){for(const entry of entries)entry.target===container&&(this.intersecting=entry.isIntersecting);admit()}}),this.observer.observe(container)),view?.MutationObserver){this.eligibility=new view.MutationObserver(admit);let ancestor=this.host,depth=0;for(;ancestor&&depth++<=256;){this.eligibility.observe(ancestor,{attributes:!0,attributeFilter:["aria-hidden","inert","hidden","style","class","open"]});const root=ancestor.getRootNode();ancestor=ancestor.assignedSlot??ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}admit()}fail(reason){const detail=this.selection.renderer==="webgl"?this.selection.fail(reason):null;this.loading=this.ready=!1,reason!=="context-lost"&&(this.releaseEngine(),this.attempted=!0),detail&&(this.notice=detail,this.changed(),this.fallback(detail))}syncState(){this.engine?.setState?.({selected:new Set(this.selected<0?[]:[this.selected]),dimmed:new Set,hover:this.hover,focus:this.focus})}async start(){const container=this.container,rows=this.rows,owner=this.host.ownerDocument;if(!container||!rows||!this.host.isConnected||this.preference!=="webgl")return;const generation=this.generation,current=()=>generation===this.generation&&this.host.isConnected&&this.host.ownerDocument===owner&&this.container===container;if(this.attempted=this.pending=!0,!embeddingEngineEnvironment.available(owner)){this.pending=!1,this.fail("unsupported");return}this.loading=!0,this.changed();let engine=null;try{if(engine=await embeddingPointsLoader.create(),!current()){engine?.dispose();return}if(!engine){this.pending=!1,this.fail("unavailable");return}if(this.engine=engine,await engine.mount(container,{hover:index=>{if(!(!current()||!this.ready)){this.hover=index!==null&&rows.point(index)?index:-1;try{this.syncState()}catch{this.fail("error")}}},pick:index=>{current()&&this.ready&&index!==null&&rows.point(index)&&this.pick(index)},camera:()=>{},lost:reason=>{current()&&this.fail(reason)},rendering:info=>{current()&&(this.software=info.software,this.changed())},restored:()=>{if(!(!current()||!this.engine||!this.selection.restore()))try{this.ready=!0,this.notice=null,this.syncState(),this.changed()}catch{this.fail("error")}}}),!current()){engine.dispose();return}engine.setStyle(this.style()),engine.setData(rows.data(),++this.revision);const resize=()=>{if(!current())return;const box=container.getBoundingClientRect();engine.resize(Math.max(1,box.width),Math.max(1,box.height))};resize(),engine.fit?.();const view=owner.defaultView;view?.ResizeObserver&&(this.resizeObserver=new view.ResizeObserver(()=>{if(!(!current()||!this.ready))try{engine.setStyle(this.style()),resize()}catch{this.fail("error")}}),this.resizeObserver.observe(container));const refreshStyle=()=>{if(!(!current()||!this.ready))try{engine.setStyle(this.style())}catch{this.fail("error")}};if(view?.MutationObserver){this.styleObserver=new view.MutationObserver(refreshStyle);let ancestor=this.host;for(;ancestor;){this.styleObserver.observe(ancestor,{attributes:!0});const root=ancestor.getRootNode();ancestor=ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}for(const query of["(prefers-reduced-motion: reduce)","(forced-colors: active)","(prefers-color-scheme: dark)"]){const media=view?.matchMedia(query);media?.addEventListener("change",refreshStyle),media&&this.mediaCleanup.push(()=>media.removeEventListener("change",refreshStyle))}this.pending=this.loading=!1,this.ready=this.selection.renderer==="webgl",this.syncState(),this.changed()}catch(error){if(!current()){engine?.dispose();return}this.fail(engine3dFailureReason(error))}}style(){const view=this.host.ownerDocument.defaultView,computed=view.getComputedStyle(this.host),canvas=this.host.ownerDocument.createElement("canvas");canvas.width=canvas.height=1;const context=canvas.getContext("2d",{willReadFrequently:!0}),color=name=>{const resolved=resolveCanvasColor(this.host,`var(${name})`,computed.color);if(!context)return resolved;context.clearRect(0,0,1,1),context.fillStyle=resolved,context.fillRect(0,0,1,1);const rgba=context.getImageData(0,0,1,1).data;return`rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3]/255})`};return{background:color("--lr-color-surface"),foreground:color("--lr-color-text"),muted:color("--lr-color-text-quiet"),accent:color("--lr-color-brand"),focus:color("--lr-focus-ring-color"),palette:Array.from({length:8},(_,index)=>color(`--lr-color-chart-${index+1}`)),fontFamily:computed.fontFamily,fontSize:finiteRange(Number.parseFloat(computed.fontSize),14,1,128),pointSize:12,lineWidth:1,devicePixelRatio:finiteRange(view.devicePixelRatio,1,.25,4),reducedMotion:view.matchMedia("(prefers-reduced-motion: reduce)").matches,forcedColors:view.matchMedia("(forced-colors: active)").matches}}}export{EmbeddingEngineController,embeddingEngineEnvironment,embeddingPointsLoader};
@@ -1 +1 @@
1
- import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{engine3dFailureReason,webgl2Available}from"../../../internal/engine-3d.js";import{tag}from"../../../internal/prefix.js";const loader=createEngine3dLoader({entry:"graph",tag:tag("graph"),load:()=>import("@aceshooting/lyra-3d/graph")});class GraphEngineAdapter{constructor(services={}){this.services=services,this.generation=0,this.disposed=new WeakSet}release(engine){this.disposed.has(engine)||(this.disposed.add(engine),engine.dispose())}close(){this.generation++;const previous=this.engine;this.engine=void 0,previous&&this.release(previous)}async open(request){this.close();const generation=this.generation;if(request.preference!=="webgl"||!request.eligible||!request.visible)return null;const available=(this.services.available??webgl2Available)();if(generation!==this.generation)return null;if(!available)return request.failure("unsupported"),null;let engine;try{engine=await(this.services.create??(()=>loader.create()))()}catch{return generation===this.generation&&request.failure("unavailable"),null}if(generation!==this.generation)return engine&&this.release(engine),null;if(!engine)return request.failure("unavailable"),null;let appearance=!1;try{appearance=typeof engine.setAppearance=="function"}catch{}if(generation!==this.generation)return this.release(engine),null;if(!appearance)return this.release(engine),request.failure("unavailable"),null;this.engine=engine;const current=()=>generation===this.generation&&this.engine===engine;let callbackThrew=!1,callbackError;const invoke=action=>{if(current())try{action()}catch(error){throw callbackThrew=!0,callbackError=error,error}},host={hover:item=>{invoke(()=>request.host.hover(item))},pick:(item,modifiers)=>{invoke(()=>request.host.pick(item,modifiers))},camera:camera=>{invoke(()=>request.host.camera(camera))},lost:(reason,detail)=>{invoke(()=>request.host.lost(reason,detail))},restored:()=>{invoke(()=>request.host.restored?.())},rendering:info=>{invoke(()=>request.host.rendering?.(info))},progress:(loaded,total)=>{invoke(()=>request.host.progress?.(loaded,total))}};try{await engine.mount(request.container,host)}catch(error){const active=current();if(active&&(this.engine=void 0,this.generation++),this.release(engine),callbackThrew&&Object.is(error,callbackError))throw error;return active&&request.failure(engine3dFailureReason(error)),null}return current()?engine:(this.release(engine),null)}}export{GraphEngineAdapter};
1
+ import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{engine3dFailureReason,webgl2Available}from"../../../internal/engine-3d.js";import{tag}from"../../../internal/prefix.js";const loader=createEngine3dLoader({entry:"graph",tag:tag("graph"),load:()=>(async()=>{try{return await import("@aceshooting/lyra-3d/graph")}catch(e){throw e}})()});class GraphEngineAdapter{constructor(services={}){this.services=services,this.generation=0,this.disposed=new WeakSet}release(engine){this.disposed.has(engine)||(this.disposed.add(engine),engine.dispose())}close(){this.generation++;const previous=this.engine;this.engine=void 0,previous&&this.release(previous)}async open(request){this.close();const generation=this.generation;if(request.preference!=="webgl"||!request.eligible||!request.visible)return null;const available=(this.services.available??webgl2Available)();if(generation!==this.generation)return null;if(!available)return request.failure("unsupported"),null;let engine;try{engine=await(this.services.create??(()=>loader.create()))()}catch{return generation===this.generation&&request.failure("unavailable"),null}if(generation!==this.generation)return engine&&this.release(engine),null;if(!engine)return request.failure("unavailable"),null;let appearance=!1;try{appearance=typeof engine.setAppearance=="function"}catch{}if(generation!==this.generation)return this.release(engine),null;if(!appearance)return this.release(engine),request.failure("unavailable"),null;this.engine=engine;const current=()=>generation===this.generation&&this.engine===engine;let callbackThrew=!1,callbackError;const invoke=action=>{if(current())try{action()}catch(error){throw callbackThrew=!0,callbackError=error,error}},host={hover:item=>{invoke(()=>request.host.hover(item))},pick:(item,modifiers)=>{invoke(()=>request.host.pick(item,modifiers))},camera:camera=>{invoke(()=>request.host.camera(camera))},lost:(reason,detail)=>{invoke(()=>request.host.lost(reason,detail))},restored:()=>{invoke(()=>request.host.restored?.())},rendering:info=>{invoke(()=>request.host.rendering?.(info))},progress:(loaded,total)=>{invoke(()=>request.host.progress?.(loaded,total))}};try{await engine.mount(request.container,host)}catch(error){const active=current();if(active&&(this.engine=void 0,this.generation++),this.release(engine),callbackThrew&&Object.is(error,callbackError))throw error;return active&&request.failure(engine3dFailureReason(error)),null}return current()?engine:(this.release(engine),null)}}export{GraphEngineAdapter};
@@ -1 +1 @@
1
- import{createOptionalPeerLoader,resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";function optionalPeerRecord(value){return(typeof value=="object"||typeof value=="function")&&value!==null?value:{}}const forceApiNames=["forceSimulation","forceLink","forceManyBody","forceCenter","forceCollide"];function hasRequiredCallables(value,names){const candidate=optionalPeerRecord(value);return names.every(name=>typeof candidate[name]=="function")}function isD3ForceApi(value){return hasRequiredCallables(value,forceApiNames)}function isD3DragApi(value){return hasRequiredCallables(value,["drag"])}function isD3ZoomApi(value){if(!hasRequiredCallables(value,["zoom","zoomTransform"]))return!1;const identity=optionalPeerRecord(optionalPeerRecord(value).zoomIdentity);return typeof identity.translate=="function"&&typeof identity.scale=="function"}function isD3SelectionApi(value){return hasRequiredCallables(value,["select"])}async function loadD3Modules(importForce=()=>import("d3-force"),importDrag=()=>import("d3-drag"),importZoom=()=>import("d3-zoom"),importSelection=()=>import("d3-selection")){try{const[force,dragMod,zoomMod,selectionMod]=await Promise.all([importForce(),importDrag(),importZoom(),importSelection()]),forceApi=optionalPeerRecord(resolveOptionalPeerCapability(force,isD3ForceApi)),dragApi=optionalPeerRecord(resolveOptionalPeerCapability(dragMod,isD3DragApi)),zoomApi=optionalPeerRecord(resolveOptionalPeerCapability(zoomMod,isD3ZoomApi)),selectionApi=optionalPeerRecord(resolveOptionalPeerCapability(selectionMod,isD3SelectionApi)),modules={forceSimulation:forceApi.forceSimulation,forceLink:forceApi.forceLink,forceManyBody:forceApi.forceManyBody,forceCenter:forceApi.forceCenter,forceCollide:forceApi.forceCollide,drag:dragApi.drag,zoom:zoomApi.zoom,zoomIdentity:zoomApi.zoomIdentity,zoomTransform:zoomApi.zoomTransform,select:selectionApi.select},missing=["forceSimulation","forceLink","forceManyBody","forceCenter","forceCollide","drag","zoom","zoomTransform","select"].some(name=>typeof modules[name]!="function"),identity=modules.zoomIdentity;return missing||typeof identity?.translate!="function"||typeof identity.scale!="function"?null:modules}catch{return null}}const d3=createOptionalPeerLoader({load:()=>loadD3Modules(),isCapability:candidate=>candidate!==null,warningKey:"lyra-graph-d3-unavailable",warning:"<lr-graph> needs the optional peers d3-force, d3-drag, d3-zoom and d3-selection (pnpm add d3-force d3-drag d3-zoom d3-selection)."});function loadD3(){return d3.get()}export{loadD3,loadD3Modules};
1
+ import{createOptionalPeerLoader,resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";function optionalPeerRecord(value){return(typeof value=="object"||typeof value=="function")&&value!==null?value:{}}const forceApiNames=["forceSimulation","forceLink","forceManyBody","forceCenter","forceCollide"];function hasRequiredCallables(value,names){const candidate=optionalPeerRecord(value);return names.every(name=>typeof candidate[name]=="function")}function isD3ForceApi(value){return hasRequiredCallables(value,forceApiNames)}function isD3DragApi(value){return hasRequiredCallables(value,["drag"])}function isD3ZoomApi(value){if(!hasRequiredCallables(value,["zoom","zoomTransform"]))return!1;const identity=optionalPeerRecord(optionalPeerRecord(value).zoomIdentity);return typeof identity.translate=="function"&&typeof identity.scale=="function"}function isD3SelectionApi(value){return hasRequiredCallables(value,["select"])}async function loadD3Modules(importForce=()=>(async()=>{try{return await import("d3-force")}catch(e){throw e}})(),importDrag=()=>(async()=>{try{return await import("d3-drag")}catch(e){throw e}})(),importZoom=()=>(async()=>{try{return await import("d3-zoom")}catch(e){throw e}})(),importSelection=()=>(async()=>{try{return await import("d3-selection")}catch(e){throw e}})()){try{const[force,dragMod,zoomMod,selectionMod]=await Promise.all([importForce(),importDrag(),importZoom(),importSelection()]),forceApi=optionalPeerRecord(resolveOptionalPeerCapability(force,isD3ForceApi)),dragApi=optionalPeerRecord(resolveOptionalPeerCapability(dragMod,isD3DragApi)),zoomApi=optionalPeerRecord(resolveOptionalPeerCapability(zoomMod,isD3ZoomApi)),selectionApi=optionalPeerRecord(resolveOptionalPeerCapability(selectionMod,isD3SelectionApi)),modules={forceSimulation:forceApi.forceSimulation,forceLink:forceApi.forceLink,forceManyBody:forceApi.forceManyBody,forceCenter:forceApi.forceCenter,forceCollide:forceApi.forceCollide,drag:dragApi.drag,zoom:zoomApi.zoom,zoomIdentity:zoomApi.zoomIdentity,zoomTransform:zoomApi.zoomTransform,select:selectionApi.select},missing=["forceSimulation","forceLink","forceManyBody","forceCenter","forceCollide","drag","zoom","zoomTransform","select"].some(name=>typeof modules[name]!="function"),identity=modules.zoomIdentity;return missing||typeof identity?.translate!="function"||typeof identity.scale!="function"?null:modules}catch{return null}}const d3=createOptionalPeerLoader({load:()=>loadD3Modules(),isCapability:candidate=>candidate!==null,warningKey:"lyra-graph-d3-unavailable",warning:"<lr-graph> needs the optional peers d3-force, d3-drag, d3-zoom and d3-selection (pnpm add d3-force d3-drag d3-zoom d3-selection)."});function loadD3(){return d3.get()}export{loadD3,loadD3Modules};
@@ -1 +1 @@
1
- import{clearDompurifyCache,loadDompurify}from"../../../internal/dompurify-loader.js";function loadIconSanitizerDeps(importDompurify=()=>import("dompurify")){return loadDompurify(importDompurify)}function loadIconSanitizer(importer){return loadDompurify(importer)}function clearIconSanitizerCache(){clearDompurifyCache()}export{clearIconSanitizerCache,loadIconSanitizer,loadIconSanitizerDeps};
1
+ import{clearDompurifyCache,loadDompurify}from"../../../internal/dompurify-loader.js";function loadIconSanitizerDeps(importDompurify=()=>(async()=>{try{return await import("dompurify")}catch(e){throw e}})()){return loadDompurify(importDompurify)}function loadIconSanitizer(importer){return loadDompurify(importer)}function clearIconSanitizerCache(){clearDompurifyCache()}export{clearIconSanitizerCache,loadIconSanitizer,loadIconSanitizerDeps};
@@ -1 +1 @@
1
- import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";const CALENDAR_ICAL_WARNING_KEY="lyra-calendar-viewer-ical-unavailable",CALENDAR_ICAL_WARNING="<lr-calendar-viewer> could not load its optional ical.js peer.";function isIcalApi(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&"parse"in value&&typeof value.parse=="function"&&"Component"in value&&typeof value.Component=="function"&&"Event"in value&&typeof value.Event=="function"}const ical=createOptionalPeerLoader({load:()=>import("ical.js"),isCapability:isIcalApi,warningKey:CALENDAR_ICAL_WARNING_KEY,warning:CALENDAR_ICAL_WARNING});function loadIcalDeps(importIcal){return ical.loadWith(importIcal)}function loadIcal(){return ical.get()}function clearIcalCache(){ical.clear()}export{clearIcalCache,loadIcal,loadIcalDeps};
1
+ import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";const CALENDAR_ICAL_WARNING_KEY="lyra-calendar-viewer-ical-unavailable",CALENDAR_ICAL_WARNING="<lr-calendar-viewer> could not load its optional ical.js peer.";function isIcalApi(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&"parse"in value&&typeof value.parse=="function"&&"Component"in value&&typeof value.Component=="function"&&"Event"in value&&typeof value.Event=="function"}const ical=createOptionalPeerLoader({load:()=>(async()=>{try{return await import("ical.js")}catch(e){throw e}})(),isCapability:isIcalApi,warningKey:CALENDAR_ICAL_WARNING_KEY,warning:CALENDAR_ICAL_WARNING});function loadIcalDeps(importIcal){return ical.loadWith(importIcal)}function loadIcal(){return ical.get()}function clearIcalCache(){ical.clear()}export{clearIcalCache,loadIcal,loadIcalDeps};
@@ -1 +1 @@
1
- import{loadDompurify}from"../../../internal/dompurify-loader.js";import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";let depsPromise,resolvedDeps;function isMammothApi(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&"convertToHtml"in value&&typeof value.convertToHtml=="function"}const mammothLoader=createOptionalPeerLoader({load:()=>import("mammoth/mammoth.browser.js"),isCapability:isMammothApi,warningKey:"lyra-docx-viewer-mammoth-unavailable",warning:"<lr-docx-viewer> could not load its optional mammoth peer."});async function loadMammothAndSanitizer(importMammoth,importDompurify){const[mammoth,DOMPurify]=await Promise.all([importMammoth?mammothLoader.loadWith(importMammoth):mammothLoader.get(),loadDompurify(importDompurify)]);return{mammoth:mammoth??void 0,DOMPurify:DOMPurify??void 0}}function loadDocxDeps(){return depsPromise||(depsPromise=loadMammothAndSanitizer().then(resolved=>(resolvedDeps=resolved,resolved))),depsPromise}function getDocxDepsIfLoaded(){return resolvedDeps}function clearDocxDepsCache(){depsPromise=void 0,resolvedDeps=void 0,mammothLoader.clear()}export{clearDocxDepsCache,getDocxDepsIfLoaded,loadDocxDeps,loadMammothAndSanitizer};
1
+ import{loadDompurify}from"../../../internal/dompurify-loader.js";import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";let depsPromise,resolvedDeps;function isMammothApi(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&"convertToHtml"in value&&typeof value.convertToHtml=="function"}const mammothLoader=createOptionalPeerLoader({load:()=>(async()=>{try{return await import("mammoth/mammoth.browser.js")}catch(e){throw e}})(),isCapability:isMammothApi,warningKey:"lyra-docx-viewer-mammoth-unavailable",warning:"<lr-docx-viewer> could not load its optional mammoth peer."});async function loadMammothAndSanitizer(importMammoth,importDompurify){const[mammoth,DOMPurify]=await Promise.all([importMammoth?mammothLoader.loadWith(importMammoth):mammothLoader.get(),loadDompurify(importDompurify)]);return{mammoth:mammoth??void 0,DOMPurify:DOMPurify??void 0}}function loadDocxDeps(){return depsPromise||(depsPromise=loadMammothAndSanitizer().then(resolved=>(resolvedDeps=resolved,resolved))),depsPromise}function getDocxDepsIfLoaded(){return resolvedDeps}function clearDocxDepsCache(){depsPromise=void 0,resolvedDeps=void 0,mammothLoader.clear()}export{clearDocxDepsCache,getDocxDepsIfLoaded,loadDocxDeps,loadMammothAndSanitizer};
@@ -1 +1 @@
1
- import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";function isEpubFactory(value){return typeof value=="function"}let override;const epub=createOptionalPeerLoader({load:()=>import("epubjs"),isCapability:isEpubFactory,warningKey:"lyra-ebook-viewer-epubjs-unavailable",warning:"<lr-ebook-viewer> could not load its optional epubjs peer."});function loadEpubJs(importEpub){return epub.loadWith(importEpub)}function getEpubJs(){return override??epub.get()}function __setEpubJsForTesting(factory){override=factory===void 0?void 0:Promise.resolve(factory),epub.clear()}export{__setEpubJsForTesting,getEpubJs,loadEpubJs};
1
+ import{createOptionalPeerLoader}from"../../../internal/optional-peer-capabilities.js";function isEpubFactory(value){return typeof value=="function"}let override;const epub=createOptionalPeerLoader({load:()=>(async()=>{try{return await import("epubjs")}catch(e){throw e}})(),isCapability:isEpubFactory,warningKey:"lyra-ebook-viewer-epubjs-unavailable",warning:"<lr-ebook-viewer> could not load its optional epubjs peer."});function loadEpubJs(importEpub){return epub.loadWith(importEpub)}function getEpubJs(){return override??epub.get()}function __setEpubJsForTesting(factory){override=factory===void 0?void 0:Promise.resolve(factory),epub.clear()}export{__setEpubJsForTesting,getEpubJs,loadEpubJs};