ultra-text 1.0.0 → 1.0.2

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 (200) hide show
  1. package/README.md +267 -962
  2. package/THIRD_PARTY_NOTICES.md +3 -0
  3. package/dist/assets/{cpuSdf.worker-Du9o8q4p.js → cpuSdf.worker--X1Qpmdp.js} +148 -57
  4. package/dist/assets/cpuSdf.worker--X1Qpmdp.js.map +1 -0
  5. package/dist/atlas/appendAtlas.js +69 -26
  6. package/dist/atlas/appendAtlas.js.map +1 -1
  7. package/dist/atlas/buildAtlas.js +5 -15
  8. package/dist/atlas/buildAtlas.js.map +1 -1
  9. package/dist/atlas/cpuAtlas.d.ts +4 -1
  10. package/dist/atlas/cpuAtlas.js +8 -6
  11. package/dist/atlas/cpuAtlas.js.map +1 -1
  12. package/dist/atlas/cpuSdf.js +164 -50
  13. package/dist/atlas/cpuSdf.js.map +1 -1
  14. package/dist/atlas/cpuWorker.d.ts +5 -3
  15. package/dist/atlas/cpuWorker.js +119 -12
  16. package/dist/atlas/cpuWorker.js.map +1 -1
  17. package/dist/atlas/gpuAtlas.d.ts +7 -6
  18. package/dist/atlas/gpuAtlas.js +206 -247
  19. package/dist/atlas/gpuAtlas.js.map +1 -1
  20. package/dist/atlas/gpuCommon.d.ts +135 -0
  21. package/dist/atlas/gpuCommon.js +223 -0
  22. package/dist/atlas/gpuCommon.js.map +1 -0
  23. package/dist/atlas/jfaWgsl.js +59 -125
  24. package/dist/atlas/jfaWgsl.js.map +1 -1
  25. package/dist/atlas/rasterize.d.ts +2 -0
  26. package/dist/atlas/rasterize.js +104 -144
  27. package/dist/atlas/rasterize.js.map +1 -1
  28. package/dist/atlas/shapeRaster.js +2 -1
  29. package/dist/atlas/shapeRaster.js.map +1 -1
  30. package/dist/atlas/vanillaBounds.d.ts +64 -0
  31. package/dist/atlas/vanillaBounds.js +42 -0
  32. package/dist/atlas/vanillaBounds.js.map +1 -0
  33. package/dist/atlas/vanillaCore.d.ts +100 -0
  34. package/dist/atlas/vanillaCore.js +1012 -0
  35. package/dist/atlas/vanillaCore.js.map +1 -0
  36. package/dist/atlas/vanillaCpuAtlas.d.ts +9 -0
  37. package/dist/atlas/vanillaCpuAtlas.js +87 -0
  38. package/dist/atlas/vanillaCpuAtlas.js.map +1 -0
  39. package/dist/atlas/vanillaExtras.d.ts +8 -0
  40. package/dist/atlas/vanillaExtras.js +166 -0
  41. package/dist/atlas/vanillaExtras.js.map +1 -0
  42. package/dist/atlas/vanillaGpuHelpers.d.ts +232 -0
  43. package/dist/atlas/vanillaGpuHelpers.js +119 -0
  44. package/dist/atlas/vanillaGpuHelpers.js.map +1 -0
  45. package/dist/dom/DomSdf.js +263 -272
  46. package/dist/dom/DomSdf.js.map +1 -1
  47. package/dist/dom/DomSlug.d.ts +26 -0
  48. package/dist/dom/DomSlug.js +564 -0
  49. package/dist/dom/DomSlug.js.map +1 -0
  50. package/dist/dom/SlugText.d.ts +18 -0
  51. package/dist/dom/SlugText.js +94 -0
  52. package/dist/dom/SlugText.js.map +1 -0
  53. package/dist/dom/Text.js +4 -67
  54. package/dist/dom/Text.js.map +1 -1
  55. package/dist/dom/domAnalytic.d.ts +54 -0
  56. package/dist/dom/domAnalytic.js +282 -0
  57. package/dist/dom/domAnalytic.js.map +1 -0
  58. package/dist/dom/domExtras.d.ts +27 -0
  59. package/dist/dom/domExtras.js +137 -0
  60. package/dist/dom/domExtras.js.map +1 -0
  61. package/dist/dom/fontCanvas.d.ts +2 -0
  62. package/dist/dom/fontCanvas.js +119 -0
  63. package/dist/dom/fontCanvas.js.map +1 -0
  64. package/dist/dom/layoutSignature.js +156 -27
  65. package/dist/dom/layoutSignature.js.map +1 -1
  66. package/dist/dom/pretextLayout.js +55 -13
  67. package/dist/dom/pretextLayout.js.map +1 -1
  68. package/dist/dom/snapshot.js +563 -243
  69. package/dist/dom/snapshot.js.map +1 -1
  70. package/dist/dom/svgCapture.d.ts +8 -1
  71. package/dist/dom/svgCapture.js +75 -1
  72. package/dist/dom/svgCapture.js.map +1 -1
  73. package/dist/dom/textHost.d.ts +11 -0
  74. package/dist/dom/textHost.js +68 -0
  75. package/dist/dom/textHost.js.map +1 -0
  76. package/dist/dom/tone.js +76 -36
  77. package/dist/dom/tone.js.map +1 -1
  78. package/dist/index.js +4 -3
  79. package/dist/slug/SlugMaterial.d.ts +13 -4
  80. package/dist/slug/SlugMaterial.js +82 -12
  81. package/dist/slug/SlugMaterial.js.map +1 -1
  82. package/dist/slug/coverage.d.ts +17 -13
  83. package/dist/slug/coverage.js +195 -222
  84. package/dist/slug/coverage.js.map +1 -1
  85. package/dist/slug/preprocessCore.d.ts +6 -3
  86. package/dist/slug/preprocessCore.js +149 -95
  87. package/dist/slug/preprocessCore.js.map +1 -1
  88. package/dist/slug/runtime.d.ts +1 -0
  89. package/dist/slug/runtime.js +94 -46
  90. package/dist/slug/runtime.js.map +1 -1
  91. package/dist/slug/standaloneRuntime.d.ts +40 -0
  92. package/dist/slug/standaloneRuntime.js +175 -0
  93. package/dist/slug/standaloneRuntime.js.map +1 -0
  94. package/dist/slug/truetype.d.ts +22 -0
  95. package/dist/slug/truetype.js +467 -0
  96. package/dist/slug/truetype.js.map +1 -0
  97. package/dist/slug/vanillaCore.d.ts +340 -0
  98. package/dist/slug/vanillaCore.js +1621 -0
  99. package/dist/slug/vanillaCore.js.map +1 -0
  100. package/dist/slug-vanilla.d.ts +13 -0
  101. package/dist/slug-vanilla.js +13 -0
  102. package/dist/slug.d.ts +21 -0
  103. package/dist/slug.js +19 -0
  104. package/dist/text/GlyphTextMaterial.d.ts +11 -11
  105. package/dist/text/GlyphTextMaterial.js +102 -33
  106. package/dist/text/GlyphTextMaterial.js.map +1 -1
  107. package/dist/text/SdfTextMaterial.d.ts +5 -4
  108. package/dist/text/SdfTextMaterial.js +29 -9
  109. package/dist/text/SdfTextMaterial.js.map +1 -1
  110. package/dist/text/decorations.js +36 -19
  111. package/dist/text/decorations.js.map +1 -1
  112. package/dist/text/geometry.d.ts +3 -22
  113. package/dist/text/geometryUtils.d.ts +11 -1
  114. package/dist/text/geometryUtils.js +22 -1
  115. package/dist/text/geometryUtils.js.map +1 -1
  116. package/dist/text/glyphGeometry.d.ts +9 -0
  117. package/dist/text/glyphGeometry.js +353 -0
  118. package/dist/text/glyphGeometry.js.map +1 -0
  119. package/dist/text/index.d.ts +2 -1
  120. package/dist/text/rectGeometry.d.ts +13 -0
  121. package/dist/text/rectGeometry.js +97 -0
  122. package/dist/text/rectGeometry.js.map +1 -0
  123. package/dist/text/reflow.d.ts +18 -1
  124. package/dist/text/reflow.js +108 -38
  125. package/dist/text/reflow.js.map +1 -1
  126. package/dist/text/snap.d.ts +1 -0
  127. package/dist/text/snap.js +26 -0
  128. package/dist/text/snap.js.map +1 -0
  129. package/dist/types.d.ts +63 -14
  130. package/dist/vanilla.d.ts +13 -360
  131. package/dist/vanilla.js +8 -1402
  132. package/dist/windfoil/WindfoilMaterial.d.ts +2 -1
  133. package/dist/windfoil/WindfoilMaterial.js +8 -1
  134. package/dist/windfoil/WindfoilMaterial.js.map +1 -1
  135. package/dist/windfoil/abortable.d.ts +2 -0
  136. package/dist/windfoil/abortable.js +26 -0
  137. package/dist/windfoil/abortable.js.map +1 -0
  138. package/dist/windfoil/color.js +2 -1
  139. package/dist/windfoil/color.js.map +1 -1
  140. package/dist/windfoil/coverage.d.ts +3 -20
  141. package/dist/windfoil/coverage.js +7 -20
  142. package/dist/windfoil/coverage.js.map +1 -1
  143. package/dist/windfoil/emoji.js +1 -1
  144. package/dist/windfoil/emoji.js.map +1 -1
  145. package/dist/windfoil/emojiMetrics.js +1 -1
  146. package/dist/windfoil/emojiMetrics.js.map +1 -1
  147. package/dist/windfoil/geometry.d.ts +2 -2
  148. package/dist/windfoil/geometry.js +204 -64
  149. package/dist/windfoil/geometry.js.map +1 -1
  150. package/dist/windfoil/layerGrid.js +14 -10
  151. package/dist/windfoil/layerGrid.js.map +1 -1
  152. package/dist/windfoil/layerNormalization.d.ts +1 -1
  153. package/dist/windfoil/layerNormalization.js +1 -1
  154. package/dist/windfoil/layerNormalization.js.map +1 -1
  155. package/dist/windfoil/mixed.d.ts +1 -0
  156. package/dist/windfoil/mixed.js +44 -25
  157. package/dist/windfoil/mixed.js.map +1 -1
  158. package/dist/windfoil/outlineValidation.d.ts +86 -0
  159. package/dist/windfoil/outlineValidation.js +65 -0
  160. package/dist/windfoil/outlineValidation.js.map +1 -0
  161. package/dist/windfoil/preprocess.js +3 -2
  162. package/dist/windfoil/preprocess.js.map +1 -1
  163. package/dist/windfoil/preprocessCore.d.ts +5 -85
  164. package/dist/windfoil/preprocessCore.js +218 -209
  165. package/dist/windfoil/preprocessCore.js.map +1 -1
  166. package/dist/windfoil/requests.js +1 -1
  167. package/dist/windfoil/requests.js.map +1 -1
  168. package/dist/windfoil/runtime.d.ts +5 -2
  169. package/dist/windfoil/runtime.js +63 -40
  170. package/dist/windfoil/runtime.js.map +1 -1
  171. package/dist/windfoil/shapeResources.js +2 -1
  172. package/dist/windfoil/shapeResources.js.map +1 -1
  173. package/dist/windfoil/shapes.js +1 -1
  174. package/dist/windfoil/skirt.d.ts +22 -0
  175. package/dist/windfoil/skirt.js +20 -0
  176. package/dist/windfoil/skirt.js.map +1 -0
  177. package/dist/windfoil/storage.d.ts +62 -4
  178. package/dist/windfoil/storage.js +143 -28
  179. package/dist/windfoil/storage.js.map +1 -1
  180. package/dist/windfoil/trace/contours.d.ts +3 -3
  181. package/dist/windfoil/trace/contours.js +228 -137
  182. package/dist/windfoil/trace/contours.js.map +1 -1
  183. package/dist/windfoil/trace/fit.d.ts +3 -7
  184. package/dist/windfoil/trace/fit.js +668 -376
  185. package/dist/windfoil/trace/fit.js.map +1 -1
  186. package/dist/windfoil/trace/outline.js +60 -35
  187. package/dist/windfoil/trace/outline.js.map +1 -1
  188. package/dist/windfoil/trace/types.d.ts +15 -3
  189. package/dist/windfoil/tracedOutlines.d.ts +37 -1
  190. package/dist/windfoil/tracedOutlines.js +228 -64
  191. package/dist/windfoil/tracedOutlines.js.map +1 -1
  192. package/package.json +60 -11
  193. package/skills/ultra-text/SKILL.md +114 -0
  194. package/skills/ultra-text/references/frameworks.md +43 -0
  195. package/skills/ultra-text/references/three-tsl.md +78 -0
  196. package/skills/ultra-text/references/vanilla-webgpu.md +96 -0
  197. package/dist/assets/cpuSdf.worker-Du9o8q4p.js.map +0 -1
  198. package/dist/text/geometry.js +0 -348
  199. package/dist/text/geometry.js.map +0 -1
  200. package/dist/vanilla.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"vanilla.js","names":[],"sources":["../src/vanilla.ts"],"sourcesContent":["import { alphaOfRgba, encodeSdfFromAlpha } from './atlas/cpuSdf.js'\nimport { JFA_WGSL, MIP_WGSL } from './atlas/jfaWgsl.js'\nimport {\n isColorCandidate,\n rasterizeGlyphAtlas,\n type RasterizeOptions,\n type ShapeRows,\n} from './atlas/rasterize.js'\nimport { layoutSignatureOf } from './dom/layoutSignature.js'\nimport { collectDomSnapshot } from './dom/snapshot.js'\nimport {\n backdropCurve,\n resolveDomTextTone,\n resolveTextTone,\n srgbEncode,\n toneCoverage,\n toneLightness,\n type ResolvedTextTone,\n type TextToneCapture,\n type TextToneContext,\n} from './dom/tone.js'\nimport { reflowSnapshot, snapGlyph } from './text/reflow.js'\nimport type {\n BuildSdfAtlasOptions,\n ColorGlyphMode,\n DomLayoutSnapshot,\n DomSdfOptions,\n DomSdfStats,\n DomSvgOptions,\n DomTextBackend,\n DomTextLayoutEngine,\n DomTextStats,\n FontStyleSnapshot,\n GlyphBreak,\n GlyphLayout,\n GlyphRequest,\n GlyphShape,\n GlyphShapePath,\n GlyphShapeStroke,\n GlyphSlot,\n RasterAtlas,\n RasterColorBand,\n RectLayout,\n SdfAnimationMode,\n SdfAtlasMode,\n SdfDropShadowOptions,\n SdfMotionOptions,\n SdfOutlineOptions,\n SdfTextQuality,\n SvgEmojiOutlineProviderOptions,\n SvgToWindfoilOptions,\n TextBlockLayout,\n TextClass,\n TextCss,\n TextDecorationLayout,\n TextToneModel,\n TextToneOptions,\n WindfoilAffine,\n WindfoilBoundingBox,\n WindfoilColorStop,\n WindfoilEmBox,\n WindfoilExtendMode,\n WindfoilForegroundPaint,\n WindfoilGlyphOutline,\n WindfoilGradientBase,\n WindfoilGradientPaint,\n WindfoilLinearGradientPaint,\n WindfoilOptions,\n WindfoilOutlineLayer,\n WindfoilOutlineProvider,\n WindfoilPaint,\n WindfoilQuadratic,\n WindfoilRadialGradientPaint,\n WindfoilShapeInstance,\n WindfoilShapePathLike,\n WindfoilShapesStats,\n WindfoilSolidPaint,\n WindfoilSvgLayer,\n WindfoilSvgPaint,\n WindfoilSvgPath,\n WindfoilSvgResult,\n WindfoilSvgSource,\n WindfoilSvgWarning,\n WindfoilSvgWarningCode,\n WindfoilSweepGradientPaint,\n} from './types.js'\nimport { svgToWindfoilOutlines } from './windfoil/svg/convert.js'\nimport { windfoilOutlineFromSvgPaths } from './windfoil/svg/pathConverter.js'\n\nexport {\n alphaOfRgba,\n backdropCurve,\n collectDomSnapshot,\n encodeSdfFromAlpha,\n isColorCandidate,\n layoutSignatureOf,\n rasterizeGlyphAtlas,\n reflowSnapshot,\n resolveDomTextTone,\n resolveTextTone,\n snapGlyph,\n srgbEncode,\n svgToWindfoilOutlines,\n toneCoverage,\n toneLightness,\n windfoilOutlineFromSvgPaths,\n}\n\nexport type {\n BuildSdfAtlasOptions,\n ColorGlyphMode,\n DomLayoutSnapshot,\n DomSdfStats,\n DomSvgOptions,\n DomTextBackend,\n DomTextLayoutEngine,\n DomTextStats,\n FontStyleSnapshot,\n GlyphBreak,\n GlyphLayout,\n GlyphRequest,\n GlyphShape,\n GlyphShapePath,\n GlyphShapeStroke,\n GlyphSlot,\n RasterAtlas,\n RasterColorBand,\n RasterizeOptions,\n RectLayout,\n ResolvedTextTone,\n SdfAnimationMode,\n SdfAtlasMode,\n SdfDropShadowOptions,\n SdfMotionOptions,\n SdfOutlineOptions,\n SdfTextQuality,\n SvgEmojiOutlineProviderOptions,\n SvgToWindfoilOptions,\n TextBlockLayout,\n TextClass,\n TextCss,\n TextDecorationLayout,\n TextToneCapture,\n TextToneContext,\n TextToneModel,\n TextToneOptions,\n WindfoilAffine,\n WindfoilBoundingBox,\n WindfoilColorStop,\n WindfoilEmBox,\n WindfoilExtendMode,\n WindfoilForegroundPaint,\n WindfoilGlyphOutline,\n WindfoilGradientBase,\n WindfoilGradientPaint,\n WindfoilLinearGradientPaint,\n WindfoilOptions,\n WindfoilOutlineLayer,\n WindfoilOutlineProvider,\n WindfoilPaint,\n WindfoilQuadratic,\n WindfoilRadialGradientPaint,\n WindfoilShapeInstance,\n WindfoilShapePathLike,\n WindfoilShapesStats,\n WindfoilSolidPaint,\n WindfoilSvgLayer,\n WindfoilSvgPaint,\n WindfoilSvgPath,\n WindfoilSvgResult,\n WindfoilSvgSource,\n WindfoilSvgWarning,\n WindfoilSvgWarningCode,\n WindfoilSweepGradientPaint,\n}\n\n/** Structural WebGPU texture handle returned by GPU atlas builds. */\nexport interface VanillaGpuTexture {\n readonly label?: string\n readonly width?: number\n readonly height?: number\n readonly format?: string\n readonly mipLevelCount?: number\n createView(descriptor?: { baseMipLevel?: number; mipLevelCount?: number }): unknown\n destroy(): void\n}\n\n/** Structural WebGPU device interface so callers need neither Three.js nor `@webgpu/types`. */\nexport interface VanillaGpuDevice {\n readonly limits?: {\n readonly maxStorageBufferBindingSize: number\n readonly maxBufferSize: number\n readonly maxComputeInvocationsPerWorkgroup?: number\n readonly maxComputeWorkgroupSizeX?: number\n readonly maxComputeWorkgroupSizeY?: number\n readonly maxStorageBuffersPerShaderStage?: number\n readonly maxStorageBuffersInFragmentStage?: number\n readonly maxTextureDimension2D?: number\n }\n createTexture(descriptor: {\n label?: string\n size: readonly [number, number] | [number, number]\n mipLevelCount?: number\n format: string\n usage: number\n }): VanillaGpuTexture\n createBuffer(descriptor: {\n label?: string\n size: number\n usage: number\n mappedAtCreation?: boolean\n }): { destroy(): void }\n createSampler(descriptor?: {\n label?: string\n minFilter?: 'nearest' | 'linear'\n magFilter?: 'nearest' | 'linear'\n }): unknown\n createShaderModule(descriptor: { label?: string; code: string }): unknown\n createComputePipeline(descriptor: {\n label?: string\n layout: 'auto'\n compute: { module: unknown; entryPoint: string }\n }): { getBindGroupLayout(index: number): unknown }\n createRenderPipeline(descriptor: {\n label?: string\n layout: 'auto'\n vertex: { module: unknown; entryPoint: string }\n fragment: { module: unknown; entryPoint: string; targets: readonly { format: string }[] }\n primitive?: { topology?: string }\n }): { getBindGroupLayout(index: number): unknown }\n createBindGroup(descriptor: {\n layout: unknown\n entries: readonly { binding: number; resource: unknown }[]\n }): unknown\n createCommandEncoder(descriptor?: { label?: string }): {\n copyTextureToBuffer(\n source: { texture: VanillaGpuTexture },\n destination: { buffer: { destroy(): void }; bytesPerRow: number; rowsPerImage: number },\n size: readonly [number, number] | [number, number],\n ): void\n beginComputePass(descriptor?: { label?: string }): {\n setPipeline(pipeline: unknown): void\n setBindGroup(index: number, bindGroup: unknown): void\n dispatchWorkgroups(x: number, y?: number, z?: number): void\n end(): void\n }\n beginRenderPass(descriptor: {\n label?: string\n colorAttachments: readonly {\n view: unknown\n loadOp: 'clear' | 'load'\n storeOp: 'store' | 'discard'\n clearValue?: { r: number; g: number; b: number; a: number }\n }[]\n }): {\n setPipeline(pipeline: unknown): void\n setBindGroup(index: number, bindGroup: unknown): void\n draw(vertexCount: number): void\n end(): void\n }\n finish(): unknown\n }\n readonly queue: {\n copyExternalImageToTexture(\n source: { source: HTMLCanvasElement; flipY?: boolean },\n destination: { texture: VanillaGpuTexture; premultipliedAlpha?: boolean },\n size: readonly [number, number] | [number, number],\n ): void\n writeBuffer(\n buffer: { destroy(): void },\n bufferOffset: number,\n data: ArrayBufferView,\n dataOffset?: number,\n size?: number,\n ): void\n writeTexture(\n destination: { texture: VanillaGpuTexture; mipLevel?: number },\n data: ArrayBufferView,\n dataLayout: { offset?: number; bytesPerRow: number; rowsPerImage?: number },\n size: readonly [number, number] | [number, number],\n ): void\n submit(commandBuffers: readonly unknown[]): void\n }\n pushErrorScope?(filter: 'validation' | 'out-of-memory' | 'internal'): void\n popErrorScope?(): Promise<{ readonly message?: string } | null>\n}\n\n/** A WebGPU `GPUDevice`, an engine renderer holding `{ device }`, or `null`/`undefined` for CPU mode. */\nexport type VanillaGpuDeviceSource =\n VanillaGpuDevice | { readonly device?: VanillaGpuDevice | null | undefined } | null | undefined\n\n/** Companion colour layer owned and disposed by its `VanillaSdfAtlas`. */\nexport interface VanillaSdfColorLayer {\n readonly data: Uint8Array\n readonly gpuTexture?: VanillaGpuTexture | undefined\n readonly width: number\n readonly top: number\n readonly height: number\n}\n\n/** Engine-agnostic SDF atlas with CPU bytes and/or an adopted WebGPU `GPUTexture`. */\nexport interface VanillaSdfAtlas {\n /** Single-channel SDF bytes (`width * height`), present when built on CPU. */\n readonly data?: Uint8Array | undefined\n /** WebGPU `r8unorm` texture (`TEXTURE_BINDING | COPY_SRC`), present when built on GPU. */\n readonly gpuTexture?: VanillaGpuTexture | undefined\n readonly colorLayer?: VanillaSdfColorLayer | undefined\n readonly shapeTop?: number | undefined\n readonly width: number\n readonly height: number\n readonly pxRange: number\n readonly bakeSize: number\n readonly glyphs: ReadonlyMap<string, GlyphSlot>\n readonly mode: Exclude<SdfAtlasMode, 'auto'>\n /** Requested mipmap flag. */\n readonly mipmaps: boolean\n /** Requested anisotropy level. */\n readonly anisotropy: number\n dispose(): void\n}\n\nfunction resolveGpuDevice(source: VanillaGpuDeviceSource): VanillaGpuDevice | null {\n if (!source || typeof source !== 'object') return null\n if ('createTexture' in source && typeof source.createTexture === 'function') return source\n if ('device' in source && source.device && typeof source.device.createTexture === 'function') {\n return source.device\n }\n return null\n}\n\nfunction rasterRowBytes(width: number): number {\n return Math.ceil(width / 64) * 256\n}\n\nfunction jfaSteps(pxRange: number): number[] {\n const radius = Math.ceil(pxRange / 2) + 1\n let step = 1\n while (2 * step - 1 < radius) step *= 2\n const steps: number[] = []\n while (step >= 1) {\n steps.push(step)\n step = Math.floor(step / 2)\n }\n return steps\n}\n\nconst COMPUTE_WORKGROUP_DIMENSION = 8\nconst ERROR_FILTERS = ['validation', 'out-of-memory', 'internal'] as const\n\nfunction checkVanillaAtlasLimits(\n limits: NonNullable<VanillaGpuDevice['limits']>,\n width: number,\n height: number,\n): void {\n for (const [name, need] of [\n ['maxComputeInvocationsPerWorkgroup', COMPUTE_WORKGROUP_DIMENSION ** 2],\n ['maxComputeWorkgroupSizeX', COMPUTE_WORKGROUP_DIMENSION],\n ['maxComputeWorkgroupSizeY', COMPUTE_WORKGROUP_DIMENSION],\n ['maxStorageBuffersPerShaderStage', 2],\n ['maxStorageBuffersInFragmentStage', 1],\n ] as const) {\n const value = limits[name]\n if (typeof value === 'number' && value < need) {\n throw new RangeError(`buildVanillaGpuSdfAtlas: ${name}=${value}, needs ${need}`)\n }\n }\n const largest = limits.maxTextureDimension2D\n if (typeof largest === 'number' && Math.max(width, height) > largest) {\n throw new RangeError(\n `buildVanillaGpuSdfAtlas: ${width}×${height} exceeds maxTextureDimension2D=${largest}`,\n )\n }\n const bytes = Math.max(width * height * 8, rasterRowBytes(width) * height)\n if (bytes > limits.maxStorageBufferBindingSize || bytes > limits.maxBufferSize) {\n throw new RangeError(\n `buildVanillaGpuSdfAtlas: ${width}×${height} exceeds storage-buffer limits`,\n )\n }\n}\n\nfunction openVanillaErrorScopes(device: VanillaGpuDevice): { close(): Promise<string | null> } {\n if (typeof device.pushErrorScope !== 'function' || typeof device.popErrorScope !== 'function') {\n return { close: () => Promise.resolve(null) }\n }\n const scoped = device as Required<Pick<VanillaGpuDevice, 'pushErrorScope' | 'popErrorScope'>>\n for (const filter of ERROR_FILTERS) scoped.pushErrorScope(filter)\n return {\n close() {\n return Promise.all(ERROR_FILTERS.map(() => scoped.popErrorScope())).then(\n (errors) => {\n const error = errors.find(Boolean)\n return error ? (error.message ?? 'unknown GPU error') : null\n },\n (error: unknown) => String(error),\n )\n },\n }\n}\n\ntype CachedDevicePipelines = readonly [\n ReturnType<VanillaGpuDevice['createComputePipeline']>,\n ReturnType<VanillaGpuDevice['createComputePipeline']>,\n ReturnType<VanillaGpuDevice['createRenderPipeline']>,\n ReturnType<VanillaGpuDevice['createRenderPipeline']>,\n ReturnType<VanillaGpuDevice['createRenderPipeline']>,\n unknown,\n]\n\nconst devicePipelines = new WeakMap<VanillaGpuDevice, CachedDevicePipelines>()\n\nfunction getDevicePipelines(device: VanillaGpuDevice): CachedDevicePipelines {\n let cached = devicePipelines.get(device)\n if (cached) return cached\n const module = device.createShaderModule({ code: JFA_WGSL + MIP_WGSL })\n const compute = (entryPoint: string) =>\n device.createComputePipeline({ layout: 'auto', compute: { module, entryPoint } })\n const render = (vertex: string, fragment: string, format: string) =>\n device.createRenderPipeline({\n layout: 'auto',\n vertex: { module, entryPoint: vertex },\n fragment: { module, entryPoint: fragment, targets: [{ format }] },\n })\n cached = [\n compute('seedMain'),\n compute('jumpMain'),\n render('fullscreenVert', 'resolveFrag', 'r8unorm'),\n render('mipVert', 'mipFrag', 'r8unorm'),\n render('mipVert', 'mipFrag', 'rgba8unorm-srgb'),\n device.createSampler({ minFilter: 'linear', magFilter: 'linear' }),\n ]\n devicePipelines.set(device, cached)\n return cached\n}\n\nfunction encodeMipmapChain(\n device: VanillaGpuDevice,\n encoder: ReturnType<VanillaGpuDevice['createCommandEncoder']>,\n texture: VanillaGpuTexture,\n mipLevelCount: number,\n pipeline: ReturnType<VanillaGpuDevice['createRenderPipeline']>,\n sampler: unknown,\n): void {\n const view = (baseMipLevel: number) => texture.createView({ baseMipLevel, mipLevelCount: 1 })\n for (let level = 1; level < mipLevelCount; level++) {\n const pass = encoder.beginRenderPass({\n colorAttachments: [{ view: view(level), loadOp: 'clear', storeOp: 'store' }],\n })\n pass.setPipeline(pipeline)\n pass.setBindGroup(\n 0,\n device.createBindGroup({\n layout: pipeline.getBindGroupLayout(0),\n entries: [\n { binding: 0, resource: view(level - 1) },\n { binding: 1, resource: sampler },\n ],\n }),\n )\n pass.draw(3)\n pass.end()\n }\n}\n\nconst DEFAULT_BUF_USAGE = { COPY_SRC: 4, COPY_DST: 8, UNIFORM: 64, STORAGE: 128 }\nconst DEFAULT_TEX_USAGE = { COPY_SRC: 1, COPY_DST: 2, TEXTURE_BINDING: 4, RENDER_ATTACHMENT: 16 }\ninterface UsageGlobals {\n GPUBufferUsage?: typeof DEFAULT_BUF_USAGE\n GPUTextureUsage?: typeof DEFAULT_TEX_USAGE\n}\nconst texUsageOf = () => (globalThis as UsageGlobals).GPUTextureUsage ?? DEFAULT_TEX_USAGE\nconst bufUsageOf = () => (globalThis as UsageGlobals).GPUBufferUsage ?? DEFAULT_BUF_USAGE\nconst mipCount = (w: number, h: number, mipmaps: boolean): number =>\n mipmaps ? Math.floor(Math.log2(Math.max(w, h))) + 1 : 1\n\nfunction createGpuColorLayer(\n device: VanillaGpuDevice,\n width: number,\n band: RasterColorBand,\n mipmaps: boolean,\n): VanillaSdfColorLayer {\n const textures = texUsageOf()\n const mipLevelCount = mipCount(width, band.height, mipmaps)\n const gpuTexture = device.createTexture({\n size: [width, band.height],\n mipLevelCount,\n format: 'rgba8unorm-srgb',\n usage:\n textures.TEXTURE_BINDING |\n textures.COPY_DST |\n textures.COPY_SRC |\n (mipLevelCount > 1 ? textures.RENDER_ATTACHMENT : 0),\n })\n device.queue.writeTexture(\n { texture: gpuTexture, mipLevel: 0 },\n band.data,\n { offset: 0, bytesPerRow: width * 4, rowsPerImage: band.height },\n [width, band.height],\n )\n if (mipLevelCount > 1) {\n const pipelines = getDevicePipelines(device)\n const encoder = device.createCommandEncoder()\n encodeMipmapChain(device, encoder, gpuTexture, mipLevelCount, pipelines[4], pipelines[5])\n device.queue.submit([encoder.finish()])\n }\n return {\n data: band.data,\n gpuTexture,\n width,\n top: band.top,\n height: band.height,\n }\n}\n\nexport async function buildVanillaGpuSdfAtlas(\n device: VanillaGpuDevice,\n raster: RasterAtlas,\n options: Omit<BuildSdfAtlasOptions, 'mode'> = {},\n): Promise<VanillaSdfAtlas> {\n options.signal?.throwIfAborted()\n const { width, height } = raster\n if (device.limits) checkVanillaAtlasLimits(device.limits, width, height)\n\n const bufUsage = bufUsageOf()\n const texUsage = texUsageOf()\n const scopes = openVanillaErrorScopes(device)\n const bytesPerRow = rasterRowBytes(width)\n const steps = jfaSteps(raster.pxRange)\n const mipmaps = options.mipmaps === true\n const mipLevelCount = mipCount(width, height, mipmaps)\n\n let rasterTexture: VanillaGpuTexture | undefined\n let outputTexture: VanillaGpuTexture | undefined\n let retainOutput = false\n const transient: { destroy(): void }[] = []\n const makeBuf = (size: number, usage: number) => {\n const b = device.createBuffer({ size, usage })\n transient.push(b)\n return b\n }\n\n try {\n const pipelines = getDevicePipelines(device)\n rasterTexture = device.createTexture({\n size: [width, height],\n format: 'rgba8unorm',\n usage: texUsage.COPY_SRC | texUsage.COPY_DST | texUsage.RENDER_ATTACHMENT,\n })\n const rasterBuffer = makeBuf(bytesPerRow * height, bufUsage.STORAGE | bufUsage.COPY_DST)\n const seedBytes = width * height * 8\n const seedA = makeBuf(seedBytes, bufUsage.STORAGE)\n const seedB = makeBuf(seedBytes, bufUsage.STORAGE)\n const paramsByteLength = steps.length * 256 + 16\n const paramsBuffer = makeBuf(paramsByteLength, bufUsage.UNIFORM | bufUsage.COPY_DST)\n const paramsInts = new Int32Array(steps.length * 64 + 4)\n paramsInts.set([width, height, bytesPerRow / 4])\n new Float32Array(paramsInts.buffer, 12, 1)[0] = 1 / raster.pxRange\n steps.forEach((step, i) => paramsInts.set([width, height, step], (i + 1) * 64))\n device.queue.writeBuffer(paramsBuffer, 0, paramsInts)\n\n device.queue.copyExternalImageToTexture(\n { source: raster.canvas, flipY: false },\n { texture: rasterTexture, premultipliedAlpha: false },\n [width, height],\n )\n\n outputTexture = device.createTexture({\n size: [width, height],\n mipLevelCount,\n format: 'r8unorm',\n usage: texUsage.RENDER_ATTACHMENT | texUsage.TEXTURE_BINDING | texUsage.COPY_SRC,\n })\n\n const encoder = device.createCommandEncoder()\n encoder.copyTextureToBuffer(\n { texture: rasterTexture },\n { buffer: rasterBuffer, bytesPerRow, rowsPerImage: height },\n [width, height],\n )\n\n const groupsX = Math.ceil(width / COMPUTE_WORKGROUP_DIMENSION)\n const groupsY = Math.ceil(height / COMPUTE_WORKGROUP_DIMENSION)\n const bind = (\n pipeline: { getBindGroupLayout(index: number): unknown },\n offset: number,\n ...bufs: { destroy(): void }[]\n ) =>\n device.createBindGroup({\n layout: pipeline.getBindGroupLayout(0),\n entries: [\n { binding: 0, resource: { buffer: paramsBuffer, offset, size: 16 } },\n ...bufs.map((buffer, idx) => ({ binding: idx + 1, resource: { buffer } })),\n ],\n })\n\n const computePass = encoder.beginComputePass()\n computePass.setPipeline(pipelines[0])\n computePass.setBindGroup(0, bind(pipelines[0], 0, rasterBuffer, seedA))\n computePass.dispatchWorkgroups(groupsX, groupsY)\n\n let currentIn = seedA\n let currentOut = seedB\n computePass.setPipeline(pipelines[1])\n for (let i = 0; i < steps.length; i++) {\n computePass.setBindGroup(0, bind(pipelines[1], (i + 1) * 256, currentIn, currentOut))\n computePass.dispatchWorkgroups(groupsX, groupsY)\n const prev = currentIn\n currentIn = currentOut\n currentOut = prev\n }\n computePass.end()\n\n const resolvePass = encoder.beginRenderPass({\n colorAttachments: [\n {\n view: outputTexture.createView({ baseMipLevel: 0, mipLevelCount: 1 }),\n loadOp: 'clear',\n storeOp: 'store',\n },\n ],\n })\n resolvePass.setPipeline(pipelines[2])\n resolvePass.setBindGroup(0, bind(pipelines[2], 0, currentIn))\n resolvePass.draw(3)\n resolvePass.end()\n\n if (mipLevelCount > 1) {\n encodeMipmapChain(device, encoder, outputTexture, mipLevelCount, pipelines[3], pipelines[5])\n }\n\n device.queue.submit([encoder.finish()])\n } catch (error) {\n void scopes.close()\n for (const b of transient) b.destroy()\n outputTexture?.destroy()\n throw error\n } finally {\n rasterTexture?.destroy()\n }\n\n const rejection = await scopes.close()\n for (const b of transient) b.destroy()\n\n if (rejection !== null) {\n outputTexture.destroy()\n throw new Error(`buildVanillaGpuSdfAtlas: the device rejected the atlas passes: ${rejection}`)\n }\n\n try {\n options.signal?.throwIfAborted()\n const colorLayer = raster.colorBand\n ? createGpuColorLayer(device, width, raster.colorBand, mipmaps)\n : undefined\n retainOutput = true\n const retainedTexture = outputTexture\n let disposed = false\n const { shapeTop } = raster as RasterAtlas & ShapeRows\n return {\n ...(shapeTop === undefined ? {} : { shapeTop }),\n ...(colorLayer ? { colorLayer } : {}),\n gpuTexture: retainedTexture,\n width,\n height,\n pxRange: raster.pxRange,\n bakeSize: raster.bakeSize,\n glyphs: raster.glyphs,\n mode: 'gpu',\n mipmaps,\n anisotropy: mipmaps ? Math.max(1, options.anisotropy ?? 1) : 1,\n dispose(): void {\n if (disposed) return\n disposed = true\n colorLayer?.gpuTexture?.destroy()\n retainedTexture.destroy()\n },\n }\n } finally {\n if (!retainOutput) outputTexture.destroy()\n }\n}\n\nfunction readRasterPixels(raster: RasterAtlas): Uint8ClampedArray {\n const context = raster.canvas.getContext('2d', { willReadFrequently: true })\n if (!context) throw new Error('buildVanillaCpuSdfAtlas: Canvas 2D is unavailable')\n return context.getImageData(0, 0, raster.width, raster.height).data\n}\n\nexport async function buildVanillaCpuSdfAtlas(\n raster: RasterAtlas,\n options: Omit<BuildSdfAtlasOptions, 'mode'> & { device?: VanillaGpuDeviceSource } = {},\n): Promise<VanillaSdfAtlas> {\n options.signal?.throwIfAborted()\n let rgba = readRasterPixels(raster)\n let sdf: Uint8Array | undefined\n if (options.cpuWorker !== false && typeof Worker !== 'undefined') {\n try {\n const { encodeInWorker } = await import('./atlas/cpuWorker.js')\n sdf = await encodeInWorker(rgba, raster.width, raster.height, raster.pxRange, options.signal)\n } catch {\n options.signal?.throwIfAborted()\n if (rgba.byteLength === 0) rgba = readRasterPixels(raster)\n }\n }\n options.signal?.throwIfAborted()\n sdf ??= encodeSdfFromAlpha(\n alphaOfRgba(rgba, raster.width * raster.height),\n raster.width,\n raster.height,\n raster.pxRange,\n )\n\n const device = resolveGpuDevice(options.device)\n const mipmaps = options.mipmaps === true\n let gpuTexture: VanillaGpuTexture | undefined\n let colorLayer: VanillaSdfColorLayer | undefined\n\n if (device) {\n const texUsage = texUsageOf()\n const mipLevelCount = mipCount(raster.width, raster.height, mipmaps)\n gpuTexture = device.createTexture({\n size: [raster.width, raster.height],\n mipLevelCount,\n format: 'r8unorm',\n usage:\n texUsage.TEXTURE_BINDING |\n texUsage.COPY_DST |\n texUsage.COPY_SRC |\n (mipLevelCount > 1 ? texUsage.RENDER_ATTACHMENT : 0),\n })\n device.queue.writeTexture(\n { texture: gpuTexture, mipLevel: 0 },\n sdf,\n { offset: 0, bytesPerRow: raster.width, rowsPerImage: raster.height },\n [raster.width, raster.height],\n )\n if (mipLevelCount > 1) {\n const pipelines = getDevicePipelines(device)\n const encoder = device.createCommandEncoder()\n encodeMipmapChain(device, encoder, gpuTexture, mipLevelCount, pipelines[3], pipelines[5])\n device.queue.submit([encoder.finish()])\n }\n if (raster.colorBand) {\n colorLayer = createGpuColorLayer(device, raster.width, raster.colorBand, mipmaps)\n }\n } else if (raster.colorBand) {\n colorLayer = {\n data: raster.colorBand.data,\n width: raster.width,\n top: raster.colorBand.top,\n height: raster.colorBand.height,\n }\n }\n\n let disposed = false\n const { shapeTop } = raster as RasterAtlas & ShapeRows\n return {\n ...(shapeTop === undefined ? {} : { shapeTop }),\n ...(colorLayer ? { colorLayer } : {}),\n ...(gpuTexture ? { gpuTexture } : {}),\n data: sdf,\n width: raster.width,\n height: raster.height,\n pxRange: raster.pxRange,\n bakeSize: raster.bakeSize,\n glyphs: raster.glyphs,\n mode: 'cpu',\n mipmaps,\n anisotropy: mipmaps ? Math.max(1, options.anisotropy ?? 1) : 1,\n dispose(): void {\n if (disposed) return\n disposed = true\n colorLayer?.gpuTexture?.destroy()\n gpuTexture?.destroy()\n },\n }\n}\n\nlet warnedVanillaGpuFallback = false\n\n/**\n * Engine-agnostic SDF atlas builder. Accepts a `GPUDevice`, an object holding `{ device }`\n * (such as a Mini3 `Renderer`), or `null`/`undefined` for CPU generation.\n * In `'auto'` mode (default), tries the WebGPU JFA path when a device is provided and falls\n * back to the exact CPU EDT encoder if the device is absent or rejects the passes.\n */\nexport async function buildVanillaSdfAtlas(\n deviceOrRenderer: VanillaGpuDeviceSource,\n raster: RasterAtlas,\n options: BuildSdfAtlasOptions = {},\n): Promise<VanillaSdfAtlas> {\n options.signal?.throwIfAborted()\n const mode = options.mode ?? 'auto'\n const device = resolveGpuDevice(deviceOrRenderer)\n\n if (mode === 'cpu') {\n return buildVanillaCpuSdfAtlas(raster, { ...options, device })\n }\n if (!device) {\n if (mode === 'gpu') {\n throw new Error(\n 'buildVanillaSdfAtlas: mode \"gpu\" requires a WebGPU GPUDevice; use mode \"auto\" or \"cpu\" without a device',\n )\n }\n return buildVanillaCpuSdfAtlas(raster, options)\n }\n\n if (mode === 'gpu') {\n return buildVanillaGpuSdfAtlas(device, raster, options)\n }\n\n try {\n return await buildVanillaGpuSdfAtlas(device, raster, options)\n } catch (error) {\n options.signal?.throwIfAborted()\n if (!warnedVanillaGpuFallback) {\n warnedVanillaGpuFallback = true\n console.warn(\n '[ultra-text] WebGPU JFA atlas generation failed; falling back to the CPU EDT generator.',\n error,\n )\n }\n return buildVanillaCpuSdfAtlas(raster, { ...options, device })\n }\n}\n\nexport { buildVanillaSdfAtlas as buildSdfAtlas }\n\n// ============================================================================\n// Pure Typed-Array Instance Buffer Packers & In-Place Updaters\n// ============================================================================\n\n/** Unit quad vertex positions (`[0,0,0, 1,0,0, 1,1,0, 0,1,0]`, 4 vertices × 3 floats). */\nexport const UNIT_QUAD_POSITIONS = new Float32Array([0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0])\n\n/** Unit quad vertex normals (`[0,0,1, ...]`, 4 vertices × 3 floats). */\nexport const UNIT_QUAD_NORMALS = new Float32Array([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1])\n\n/** Unit quad triangle indices (`[0, 1, 2, 0, 2, 3]`, 6 uint16 indices). */\nexport const UNIT_QUAD_INDICES = new Uint16Array([0, 1, 2, 0, 2, 3])\n\n/** Engine-agnostic 3D axis-aligned bounding box and bounding sphere. */\nexport interface VanillaBounds {\n readonly min: readonly [x: number, y: number, z: number]\n readonly max: readonly [x: number, y: number, z: number]\n readonly center: readonly [x: number, y: number, z: number]\n readonly radius: number\n}\n\n/** Computes a bounding box and sphere in local capture coordinates. */\nexport function computeInstanceBounds(\n width: number,\n height: number,\n padding = 0,\n minZ = 0,\n maxZ = 0,\n): VanillaBounds {\n const minX = -padding\n const minY = -padding\n const minBoundZ = minZ - padding\n const maxX = width + padding\n const maxY = height + padding\n const maxBoundZ = maxZ + padding\n const cx = (minX + maxX) * 0.5\n const cy = (minY + maxY) * 0.5\n const cz = (minBoundZ + maxBoundZ) * 0.5\n const dx = maxX - cx\n const dy = maxY - cy\n const dz = maxBoundZ - cz\n return {\n min: [minX, minY, minBoundZ],\n max: [maxX, maxY, maxBoundZ],\n center: [cx, cy, cz],\n radius: Math.sqrt(dx * dx + dy * dy + dz * dz),\n }\n}\n\n/** Packed typed-array instance attributes for SDF glyphs. */\nexport interface VanillaGlyphInstances {\n count: number\n maxSequence: number\n /** `[x0, y0, x1, y1]` per glyph in local capture units (`count * 4`). */\n rects: Float32Array\n /** Normalized `unorm16` `[u0, v1, u1, v0]` per glyph (`count * 4`). */\n uvRects: Uint16Array\n /** Normalized `unorm16` support trim `[u0, v1, u1, v0]` per glyph (`count * 4`), or `null` with `runMotion`. */\n trims: Uint16Array | null\n /** `[x0, y0, x1, y1]` clip box per glyph (`count * 4`). */\n clips: Float32Array\n /** Normalized `unorm8` `[r, g, b, a]` per glyph (`count * 4`). */\n colors: Uint8Array\n /** `[sequence, z]` or `[sequence, z, switchEm]` per glyph (`count * metaItemSize`). */\n metadata: Float32Array\n metaItemSize: 2 | 3\n /** `[centerX, centerY, ordinal]` per glyph (`count * 3`) when shaped runs or SVG groups are present. */\n runMotion: Float32Array | null\n bounds: VanillaBounds\n}\n\n/** Packed typed-array instance attributes for DOM background rectangles. */\nexport interface VanillaRectInstances {\n count: number\n readonly receiveShadow: boolean\n /** `[x0, y0, x1, y1]` per rectangle (`count * 4`). */\n rects: Float32Array\n /** Normalized `unorm8` `[r, g, b, a]` per rectangle (`count * 4`). */\n colors: Uint8Array\n /** Corner radius per rectangle (`count`). */\n radii: Float32Array\n /** Z depth per rectangle (`count`). */\n depths: Float32Array\n bounds: VanillaBounds\n}\n\n/** Packed typed-array instance attributes for CSS text decorations. */\nexport interface VanillaDecorationInstances {\n count: number\n /** Source glyph `[x0, y0, x1, y1]` per decoration (`count * 4`). */\n rects: Float32Array\n /** Decoration stroke `[x0, y0, x1, y1]` per decoration (`count * 4`). */\n decorationRects: Float32Array\n /** Motion index per decoration (`count`). */\n decorationIndices: Float32Array\n /** Normalized `unorm8` `[r, g, b, a]` per decoration (`count * 4`). */\n colors: Uint8Array\n /** `[x0, y0, x1, y1]` clip box per decoration (`count * 4`). */\n clips: Float32Array\n /** `[sequence, z]` per decoration (`count * 2`). */\n metadata: Float32Array\n /** `[centerX, centerY, ordinal]` per decoration (`count * 3`) when shaped runs are present. */\n runMotion: Float32Array | null\n bounds: VanillaBounds\n}\n\nfunction byte(value: number): number {\n if (value <= 0) return 0\n if (value >= 1) return 255\n return (value * 255 + 0.5) | 0\n}\n\nfunction metaSize(snapshot: DomLayoutSnapshot): 2 | 3 {\n return snapshot.sizeSwitched || snapshot.glyphs.some((glyph) => glyph.switchEm !== undefined)\n ? 3\n : 2\n}\n\nfunction writeMeta(target: Float32Array, index: number, size: number, glyph: GlyphLayout): void {\n target[index * size] = glyph.sequence\n target[index * size + 1] = glyph.z\n if (size === 3) target[index * size + 2] = glyph.switchEm ?? 0\n}\n\nfunction needsRunMotion(snapshot: DomLayoutSnapshot): boolean {\n return (\n snapshot.textShaping === 'browser' ||\n snapshot.glyphs.some((glyph) => glyph.motionOrigin !== undefined)\n )\n}\n\nfunction shapeOrdinals(snapshot: DomLayoutSnapshot): Float32Array | undefined {\n const glyphs = snapshot.glyphs\n if (!glyphs.some((glyph) => glyph.shapeGroup !== undefined)) return undefined\n const out = new Float32Array(glyphs.length)\n let ordinal = -1\n let previous: number | undefined\n for (let index = 0; index < glyphs.length; index++) {\n const glyph = glyphs[index]!\n if (glyph.shapeGroup === undefined || glyph.shapeGroup !== previous) ordinal++\n previous = glyph.shapeGroup\n out[index] = glyph.motionOrigin?.[2] ?? ordinal\n }\n return out\n}\n\nfunction writeUvRect(target: Uint16Array, offset: number, slot: GlyphSlot): void {\n target[offset] = (slot.u0 * 65535 + 0.5) | 0\n target[offset + 1] = (slot.v1 * 65535 + 0.5) | 0\n target[offset + 2] = (slot.u1 * 65535 + 0.5) | 0\n target[offset + 3] = (slot.v0 * 65535 + 0.5) | 0\n}\n\nconst unorm16Floor = (value: number): number =>\n Math.min(65535, Math.max(0, Math.floor(value * 65535)))\n\nconst unorm16Ceil = (value: number): number =>\n Math.min(65535, Math.max(0, Math.ceil(value * 65535)))\n\nfunction writeTrim(target: Uint16Array, offset: number, slot: GlyphSlot, uvRects: Uint16Array) {\n const support = slot.support\n if (!support) {\n target[offset] = uvRects[offset]!\n target[offset + 1] = uvRects[offset + 1]!\n target[offset + 2] = uvRects[offset + 2]!\n target[offset + 3] = uvRects[offset + 3]!\n return\n }\n target[offset] = unorm16Floor(support.u0)\n target[offset + 1] = unorm16Ceil(support.v1)\n target[offset + 2] = unorm16Ceil(support.u1)\n target[offset + 3] = unorm16Floor(support.v0)\n}\n\nfunction writeGlyphRect(\n rects: Float32Array,\n offset: number,\n glyph: GlyphLayout,\n slot: GlyphSlot,\n bakeSize: number,\n shaped: boolean,\n): void {\n const scale = glyph.fontSize / bakeSize\n const scaleX = shaped && slot.advance > 0 ? glyph.advance / slot.advance : scale\n const baseline = glyph.lineBottom + (glyph.baselineOffset ?? slot.descent * scale)\n rects[offset] = glyph.originX + slot.planeX0 * scaleX\n rects[offset + 1] = baseline + slot.planeY0 * scale\n rects[offset + 2] = glyph.originX + slot.planeX1 * scaleX\n rects[offset + 3] = baseline + slot.planeY1 * scale\n}\n\nexport type GlyphAtlasLookup = Pick<VanillaSdfAtlas, 'bakeSize' | 'glyphs'>\n\nfunction writeVanillaRunMotion(\n runMotion: Float32Array | null,\n index: number,\n ordinal: number,\n glyph: GlyphLayout,\n rects: Float32Array,\n offset: number,\n motionOrdinals: Float32Array | undefined,\n): void {\n if (!runMotion) return\n const rOffset = index * 3\n const origin = glyph.motionOrigin\n runMotion[rOffset] = origin ? origin[0] : (rects[offset]! + rects[offset + 2]!) * 0.5\n runMotion[rOffset + 1] = origin ? origin[1] : (rects[offset + 1]! + rects[offset + 3]!) * 0.5\n runMotion[rOffset + 2] = origin ? origin[2] : (motionOrdinals?.[ordinal] ?? ordinal)\n}\n\nfunction writeVanillaGlyphBatch(\n snapshot: DomLayoutSnapshot,\n atlas: GlyphAtlasLookup,\n rects: Float32Array,\n uvRects: Uint16Array,\n trims: Uint16Array | null,\n clips: Float32Array,\n colors: Uint8Array,\n metadata: Float32Array,\n metaItemSize: number,\n runMotion: Float32Array | null,\n motionOrdinals: Float32Array | undefined,\n): [number, number, number, number] {\n const glyphs = snapshot.glyphs\n const total = glyphs.length\n const shaped = snapshot.textShaping === 'browser'\n const bakeSize = atlas.bakeSize\n const atlasGlyphs = atlas.glyphs\n let count = 0\n let maxSequence = 0\n let minZ = 0\n let maxZ = 0\n for (let ordinal = 0; ordinal < total; ordinal++) {\n const glyph = glyphs[ordinal]!\n const slot = atlasGlyphs.get(glyph.glyphKey)\n if (!slot) continue\n const index = count++\n const offset = index * 4\n writeGlyphRect(rects, offset, glyph, slot, bakeSize, shaped)\n writeUvRect(uvRects, offset, slot)\n if (trims) writeTrim(trims, offset, slot, uvRects)\n const clip = glyph.clip\n clips[offset] = clip[0]\n clips[offset + 1] = clip[1]\n clips[offset + 2] = clip[2]\n clips[offset + 3] = clip[3]\n const color = glyph.color\n colors[offset] = byte(color[0])\n colors[offset + 1] = byte(color[1])\n colors[offset + 2] = byte(color[2])\n colors[offset + 3] = byte(color[3])\n writeMeta(metadata, index, metaItemSize, glyph)\n writeVanillaRunMotion(runMotion, index, ordinal, glyph, rects, offset, motionOrdinals)\n if (glyph.sequence > maxSequence) maxSequence = glyph.sequence\n if (glyph.z < minZ) minZ = glyph.z\n if (glyph.z > maxZ) maxZ = glyph.z\n }\n return [count, maxSequence, minZ, maxZ]\n}\n\n/** Packs instanced glyph attribute arrays from a layout snapshot and SDF atlas. */\nexport function packGlyphInstances(\n snapshot: DomLayoutSnapshot,\n atlas: GlyphAtlasLookup,\n motionPadding = 0,\n motionOrdinals?: Float32Array,\n): VanillaGlyphInstances {\n const hasRunMotion = needsRunMotion(snapshot)\n motionOrdinals ??= hasRunMotion ? shapeOrdinals(snapshot) : undefined\n const total = snapshot.glyphs.length\n const rects = new Float32Array(total * 4)\n const uvRects = new Uint16Array(total * 4)\n const clips = new Float32Array(total * 4)\n const colors = new Uint8Array(total * 4)\n const metaItemSize = metaSize(snapshot)\n const metadata = new Float32Array(total * metaItemSize)\n const runMotion = hasRunMotion || motionOrdinals ? new Float32Array(total * 3) : null\n const trims = runMotion ? null : new Uint16Array(total * 4)\n const [count, maxSequence, minZ, maxZ] = writeVanillaGlyphBatch(\n snapshot,\n atlas,\n rects,\n uvRects,\n trims,\n clips,\n colors,\n metadata,\n metaItemSize,\n runMotion,\n motionOrdinals,\n )\n\n const full = count === total\n return {\n count,\n maxSequence,\n rects: full ? rects : rects.subarray(0, count * 4),\n uvRects: full ? uvRects : uvRects.subarray(0, count * 4),\n trims: trims ? (full ? trims : trims.subarray(0, count * 4)) : null,\n clips: full ? clips : clips.subarray(0, count * 4),\n colors: full ? colors : colors.subarray(0, count * 4),\n metadata: full ? metadata : metadata.subarray(0, count * metaItemSize),\n metaItemSize,\n runMotion: runMotion ? (full ? runMotion : runMotion.subarray(0, count * 3)) : null,\n bounds: computeInstanceBounds(snapshot.width, snapshot.height, motionPadding, minZ, maxZ),\n }\n}\n\n/**\n * Rewrites the glyph instance arrays that change on a reflow (`rects`, `clips`, `metadata`,\n * `runMotion`, `bounds`) in place without reallocating. Returns `maxSequence`, or `null` when\n * the glyph count no longer matches.\n */\nexport function updateGlyphInstances(\n instances: VanillaGlyphInstances,\n snapshot: DomLayoutSnapshot,\n atlas: GlyphAtlasLookup,\n motionPadding = 0,\n motionOrdinals?: Float32Array,\n): number | null {\n const { rects, clips, metadata, metaItemSize, runMotion, count: instanceCount } = instances\n const glyphs = snapshot.glyphs\n const total = glyphs.length\n if (total < instanceCount) return null\n motionOrdinals ??= needsRunMotion(snapshot) ? shapeOrdinals(snapshot) : undefined\n const shaped = snapshot.textShaping === 'browser'\n const bakeSize = atlas.bakeSize\n const atlasGlyphs = atlas.glyphs\n\n let count = 0\n let maxSequence = 0\n let minZ = 0\n let maxZ = 0\n for (let ordinal = 0; ordinal < total; ordinal++) {\n const glyph = glyphs[ordinal]!\n const slot = atlasGlyphs.get(glyph.glyphKey)\n if (!slot) continue\n if (count >= instanceCount) return null\n const index = count++\n const offset = index * 4\n writeGlyphRect(rects, offset, glyph, slot, bakeSize, shaped)\n const clip = glyph.clip\n clips[offset] = clip[0]\n clips[offset + 1] = clip[1]\n clips[offset + 2] = clip[2]\n clips[offset + 3] = clip[3]\n metadata[index * metaItemSize] = glyph.sequence\n writeVanillaRunMotion(runMotion, index, ordinal, glyph, rects, offset, motionOrdinals)\n if (glyph.sequence > maxSequence) maxSequence = glyph.sequence\n if (glyph.z < minZ) minZ = glyph.z\n if (glyph.z > maxZ) maxZ = glyph.z\n }\n if (count !== instanceCount) return null\n instances.maxSequence = maxSequence\n instances.bounds = computeInstanceBounds(\n snapshot.width,\n snapshot.height,\n motionPadding,\n minZ,\n maxZ,\n )\n return maxSequence\n}\n\n/**\n * Rewrites all glyph instance arrays in place when the drawable count and layout match.\n * Returns `maxSequence`, or `null` without mutating when the buffers do not fit.\n */\nexport function updateGlyphContentInstances(\n instances: VanillaGlyphInstances,\n snapshot: DomLayoutSnapshot,\n atlas: GlyphAtlasLookup,\n motionPadding = 0,\n motionOrdinals?: Float32Array,\n): number | null {\n const glyphs = snapshot.glyphs\n const total = glyphs.length\n const expectedCount = instances.count\n if (total < expectedCount || metaSize(snapshot) !== instances.metaItemSize) return null\n const hasRun = needsRunMotion(snapshot)\n motionOrdinals ??= hasRun ? shapeOrdinals(snapshot) : undefined\n const wantsRun = hasRun || !!motionOrdinals\n if (wantsRun !== (instances.runMotion !== null)) return null\n const atlasGlyphs = atlas.glyphs\n let drawable = 0\n for (let i = 0; i < total; i++) {\n if (atlasGlyphs.has(glyphs[i]!.glyphKey)) {\n drawable++\n if (drawable > expectedCount) return null\n } else if (drawable + (total - 1 - i) < expectedCount) {\n return null\n }\n }\n if (drawable !== expectedCount) return null\n\n const [, maxSequence, minZ, maxZ] = writeVanillaGlyphBatch(\n snapshot,\n atlas,\n instances.rects,\n instances.uvRects,\n instances.trims,\n instances.clips,\n instances.colors,\n instances.metadata,\n instances.metaItemSize,\n instances.runMotion,\n motionOrdinals,\n )\n instances.maxSequence = maxSequence\n instances.bounds = computeInstanceBounds(\n snapshot.width,\n snapshot.height,\n motionPadding,\n minZ,\n maxZ,\n )\n return maxSequence\n}\n\nfunction rectCountFor(snapshot: DomLayoutSnapshot, receiveShadow: boolean): number {\n let count = 0\n for (const rect of snapshot.rects) if (rect.receiveShadow === receiveShadow) count++\n return count\n}\n\nfunction writeRectBatch(\n snapshot: DomLayoutSnapshot,\n receiveShadow: boolean,\n rects: Float32Array,\n colors: Uint8Array,\n radii: Float32Array,\n depths: Float32Array,\n): [number, number] {\n let index = 0\n let minZ = 0\n let maxZ = 0\n for (const item of snapshot.rects) {\n if (item.receiveShadow !== receiveShadow) continue\n const offset = index * 4\n rects[offset] = item.rect[0]\n rects[offset + 1] = item.rect[1]\n rects[offset + 2] = item.rect[2]\n rects[offset + 3] = item.rect[3]\n colors[offset] = byte(item.color[0])\n colors[offset + 1] = byte(item.color[1])\n colors[offset + 2] = byte(item.color[2])\n colors[offset + 3] = byte(item.color[3])\n radii[index] = item.radius\n depths[index] = item.z\n if (item.z < minZ) minZ = item.z\n if (item.z > maxZ) maxZ = item.z\n index++\n }\n return [minZ, maxZ]\n}\n\n/** Packs instanced rectangle attribute arrays for `receiveShadow: false` or `true`. */\nexport function packRectInstances(\n snapshot: DomLayoutSnapshot,\n receiveShadow = false,\n): VanillaRectInstances | null {\n const count = rectCountFor(snapshot, receiveShadow)\n if (count === 0) return null\n const rects = new Float32Array(count * 4)\n const colors = new Uint8Array(count * 4)\n const radii = new Float32Array(count)\n const depths = new Float32Array(count)\n const [minZ, maxZ] = writeRectBatch(snapshot, receiveShadow, rects, colors, radii, depths)\n return {\n count,\n receiveShadow,\n rects,\n colors,\n radii,\n depths,\n bounds: computeInstanceBounds(snapshot.width, snapshot.height, 0, minZ, maxZ),\n }\n}\n\n/** Rewrites a same-count rectangle batch in place. Returns `false` when the count changed. */\nexport function updateRectInstances(\n instances: VanillaRectInstances,\n snapshot: DomLayoutSnapshot,\n receiveShadow = instances.receiveShadow,\n): boolean {\n if (rectCountFor(snapshot, receiveShadow) !== instances.count) return false\n const [minZ, maxZ] = writeRectBatch(\n snapshot,\n receiveShadow,\n instances.rects,\n instances.colors,\n instances.radii,\n instances.depths,\n )\n instances.bounds = computeInstanceBounds(snapshot.width, snapshot.height, 0, minZ, maxZ)\n return true\n}\n\ntype DecorationRecord = readonly [\n stroke: readonly [number, number, number, number],\n rectIndex: number,\n motionIndex: number,\n color: readonly [number, number, number, number],\n clip: readonly [number, number, number, number],\n sequence: number,\n z: number,\n motionOrigin: readonly [number, number, number] | null,\n]\n\nfunction sameDecoration(a: TextDecorationLayout, b: TextDecorationLayout): boolean {\n return (\n a.line === b.line &&\n a.offset === b.offset &&\n a.thickness === b.thickness &&\n a.color.every((v, i) => v === b.color[i])\n )\n}\n\nlet cachedVanillaRecordsSnapshot: DomLayoutSnapshot | null = null\nlet cachedVanillaRecordsDrawable: ((key: string) => boolean) | null = null\nlet cachedVanillaRecords: readonly DecorationRecord[] = []\n\nfunction decorationRecords(\n snapshot: DomLayoutSnapshot,\n drawable: (key: string) => boolean,\n): readonly DecorationRecord[] {\n if (snapshot === cachedVanillaRecordsSnapshot && drawable === cachedVanillaRecordsDrawable) {\n return cachedVanillaRecords\n }\n const glyphs = snapshot.glyphs\n const records: DecorationRecord[] = []\n if (glyphs.some((glyph) => glyph.decorations?.length)) {\n let glyphIndex = 0\n let motionIndex = -1\n let previousGroup: number | undefined\n for (let index = 0; index < glyphs.length; index++) {\n const glyph = glyphs[index]!\n if (!drawable(glyph.glyphKey)) continue\n if (glyph.shapeGroup === undefined || glyph.shapeGroup !== previousGroup) motionIndex++\n previousGroup = glyph.shapeGroup\n const decorations = glyph.decorations\n if (decorations) {\n for (const decoration of decorations) {\n if (decoration.thickness <= 0 || decoration.color[3] <= 0) continue\n const next = glyphs[index + 1]\n let right = glyph.originX + (glyph.decorationWidth ?? Math.abs(glyph.advance))\n if (\n next?.block === glyph.block &&\n next.lineBottom === glyph.lineBottom &&\n next.decorations?.some((candidate) => sameDecoration(decoration, candidate))\n ) {\n right = Math.max(right, next.originX)\n }\n const y = glyph.lineBottom + decoration.offset\n records.push([\n [glyph.originX, y - decoration.thickness / 2, right, y + decoration.thickness / 2],\n glyphIndex,\n glyph.motionOrigin?.[2] ?? motionIndex,\n decoration.color,\n glyph.clip,\n glyph.sequence,\n glyph.z,\n glyph.motionOrigin ?? null,\n ])\n }\n }\n glyphIndex++\n }\n }\n cachedVanillaRecordsSnapshot = snapshot\n cachedVanillaRecordsDrawable = drawable\n return (cachedVanillaRecords = records)\n}\n\nfunction writeDecorationBatch(\n records: readonly DecorationRecord[],\n sourceRects: ArrayLike<number>,\n rects: Float32Array,\n strokes: Float32Array,\n indices: Float32Array,\n colors: Uint8Array,\n clips: Float32Array,\n metadata: Float32Array,\n runMotion: Float32Array | null,\n): [number, number] {\n let minZ = 0\n let maxZ = 0\n for (let index = 0; index < records.length; index++) {\n const [stroke, rectIndex, motionIndex, color, clip, sequence, z, motionOrigin] = records[index]!\n const offset = index * 4\n const srcOffset = rectIndex * 4\n rects[offset] = sourceRects[srcOffset] ?? 0\n rects[offset + 1] = sourceRects[srcOffset + 1] ?? 0\n rects[offset + 2] = sourceRects[srcOffset + 2] ?? 0\n rects[offset + 3] = sourceRects[srcOffset + 3] ?? 0\n strokes.set(stroke, offset)\n clips.set(clip, offset)\n indices[index] = motionIndex\n colors[offset] = byte(color[0])\n colors[offset + 1] = byte(color[1])\n colors[offset + 2] = byte(color[2])\n colors[offset + 3] = byte(color[3])\n metadata[index * 2] = sequence\n metadata[index * 2 + 1] = z\n if (runMotion && motionOrigin) runMotion.set(motionOrigin, index * 3)\n if (z < minZ) minZ = z\n if (z > maxZ) maxZ = z\n }\n return [minZ, maxZ]\n}\n\nexport function packDecorationInstances(\n snapshot: DomLayoutSnapshot,\n sourceGlyphRects: ArrayLike<number>,\n drawable: (key: string) => boolean,\n motionPadding = 0,\n): VanillaDecorationInstances | null {\n const records = decorationRecords(snapshot, drawable)\n const count = records.length\n if (count === 0) return null\n const rects = new Float32Array(count * 4)\n const decorationRects = new Float32Array(count * 4)\n const decorationIndices = new Float32Array(count)\n const colors = new Uint8Array(count * 4)\n const clips = new Float32Array(count * 4)\n const metadata = new Float32Array(count * 2)\n const runMotion = records.some((record) => record[7] !== null)\n ? new Float32Array(count * 3)\n : null\n const [minZ, maxZ] = writeDecorationBatch(\n records,\n sourceGlyphRects,\n rects,\n decorationRects,\n decorationIndices,\n colors,\n clips,\n metadata,\n runMotion,\n )\n return {\n count,\n rects,\n decorationRects,\n decorationIndices,\n colors,\n clips,\n metadata,\n runMotion,\n bounds: computeInstanceBounds(snapshot.width, snapshot.height, motionPadding, minZ, maxZ),\n }\n}\n\nexport function updateDecorationInstances(\n instances: VanillaDecorationInstances,\n snapshot: DomLayoutSnapshot,\n sourceGlyphRects: ArrayLike<number>,\n drawable: (key: string) => boolean,\n motionPadding = 0,\n): boolean {\n const records = decorationRecords(snapshot, drawable)\n if (records.length === 0 || records.length !== instances.count) return false\n const wantsRun = records.some((record) => record[7] !== null)\n if (wantsRun !== (instances.runMotion !== null)) return false\n const [minZ, maxZ] = writeDecorationBatch(\n records,\n sourceGlyphRects,\n instances.rects,\n instances.decorationRects,\n instances.decorationIndices,\n instances.colors,\n instances.clips,\n instances.metadata,\n instances.runMotion,\n )\n instances.bounds = computeInstanceBounds(\n snapshot.width,\n snapshot.height,\n motionPadding,\n minZ,\n maxZ,\n )\n return true\n}\n\n// ============================================================================\n// Retained Engine-Agnostic Controllers: VanillaDomText & VanillaText\n// ============================================================================\n\nexport interface VanillaDomTextRebuildOptions {\n signal?: AbortSignal\n}\n\nexport type VanillaChangeReason = 'create' | 'rebuild' | 'reflow' | 'motion' | 'dispose'\n\n/** Options for `VanillaDomText` (`DomText` / `DomSdf` in `ultra-text/vanilla`). */\nexport interface VanillaDomTextOptions extends Omit<\n DomSdfOptions,\n 'fill' | 'vertex' | 'sharedAtlas' | 'side' | 'textBackend' | 'windfoil'\n> {\n /** Optional shared `VanillaSdfAtlas` across multiple `VanillaDomText` instances. */\n sharedAtlas?: VanillaSdfAtlas\n /** Called after initial creation, rebuild, reflow, motion update, or disposal. */\n onChange?: (instance: VanillaDomText, reason: VanillaChangeReason) => void\n}\n\nfunction nowMs(): number {\n return typeof performance !== 'undefined' ? performance.now() : Date.now()\n}\n\nfunction makeAbortError(): Error {\n if (typeof DOMException !== 'undefined') {\n return new DOMException('The operation was aborted', 'AbortError')\n }\n const error = new Error('The operation was aborted')\n error.name = 'AbortError'\n return error\n}\n\nfunction isAbortError(error: unknown): boolean {\n return error instanceof Error && error.name === 'AbortError'\n}\n\nfunction linkAbortSignals(...signals: (AbortSignal | undefined)[]): [AbortController, () => void] {\n const controller = new AbortController()\n const activeSignals = signals.filter((signal): signal is AbortSignal => signal !== undefined)\n for (const signal of activeSignals) {\n if (signal.aborted) {\n controller.abort(signal.reason ?? makeAbortError())\n return [controller, (): void => undefined]\n }\n }\n const listeners = activeSignals.map((signal) => {\n const onAbort = (): void => {\n controller.abort(signal.reason ?? makeAbortError())\n }\n signal.addEventListener('abort', onAbort, { once: true })\n return [signal, onAbort] as const\n })\n return [\n controller,\n (): void => {\n for (const [signal, onAbort] of listeners) {\n signal.removeEventListener('abort', onAbort)\n }\n },\n ]\n}\n\nasync function waitForDocumentFonts(document: Document, signal?: AbortSignal): Promise<void> {\n signal?.throwIfAborted()\n const fonts = document.fonts as FontFaceSet | undefined\n if (!fonts) return\n if (!signal) {\n await Promise.resolve(fonts.ready)\n return\n }\n await new Promise<void>((resolve, reject) => {\n const onAbort = (): void => {\n reject(\n signal.reason instanceof Error\n ? signal.reason\n : new DOMException(String(signal.reason ?? 'The operation was aborted'), 'AbortError'),\n )\n }\n signal.addEventListener('abort', onAbort, { once: true })\n void Promise.resolve(fonts.ready).then(\n () => {\n signal.removeEventListener('abort', onAbort)\n resolve()\n },\n (error: unknown) => {\n signal.removeEventListener('abort', onAbort)\n reject(error instanceof Error ? error : new Error(String(error)))\n },\n )\n })\n}\n\nfunction hasAllGlyphs(\n atlas: VanillaSdfAtlas,\n snapshot: DomLayoutSnapshot,\n colorGlyphsOption: ColorGlyphMode | undefined,\n): boolean {\n const bitmap =\n colorGlyphsOption === 'none' && snapshot.requests.some((request) => request.shape?.bitmap)\n return snapshot.requests.every((request) => {\n const slot = atlas.glyphs.get(request.key)\n return (\n slot !== undefined &&\n !(colorGlyphsOption === 'none' && bitmap && !request.shape && slot.color) &&\n (!isColorCandidate(request, colorGlyphsOption) || slot.color !== undefined)\n )\n })\n}\n\nexport class VanillaDomText {\n readonly element: HTMLElement\n readonly device: VanillaGpuDevice | null\n readonly options: Readonly<VanillaDomTextOptions>\n\n glyphs!: VanillaGlyphInstances\n plainRects: VanillaRectInstances | null = null\n litRects: VanillaRectInstances | null = null\n decorations: VanillaDecorationInstances | null = null\n tone: ResolvedTextTone | null = null\n motion: Required<SdfMotionOptions>\n\n #a!: VanillaSdfAtlas\n #s: DomLayoutSnapshot | null = null\n #as = ''\n #ls = ''\n #o = true\n #st!: DomSdfStats\n #ro: ResizeObserver | null = null\n #mo: MutationObserver | null = null\n #uf: (() => void) | null = null\n #f: number | null = null\n #ac: AbortController | null = null\n #rv = 0\n #av = 0\n #sel = false\n #d = false\n #cbs = new Set<(instance: VanillaDomText, reason: VanillaChangeReason) => void>()\n\n protected constructor(\n element: HTMLElement,\n deviceOrRenderer: VanillaGpuDeviceSource,\n options: VanillaDomTextOptions,\n ) {\n this.element = element\n this.device = resolveGpuDevice(deviceOrRenderer)\n this.options = Object.freeze({ ...options })\n this.motion = {\n enabled: options.motion?.enabled ?? true,\n mode: options.motion?.mode ?? 'slide-up',\n strength: Math.max(0, options.motion?.strength ?? 18),\n speed: Math.max(0, options.motion?.speed ?? 1.35),\n stagger: Math.max(0, options.motion?.stagger ?? 0.045),\n }\n if (options.onChange) this.#cbs.add(options.onChange)\n }\n\n static async create(\n element: HTMLElement,\n deviceOrRenderer?: VanillaGpuDeviceSource,\n options: VanillaDomTextOptions = {},\n ): Promise<VanillaDomText> {\n if (!element.isConnected) {\n throw new Error('VanillaDomText.create requires a connected HTMLElement')\n }\n options.signal?.throwIfAborted()\n if (\n options.sharedAtlas &&\n (options.sharedAtlas.mipmaps !== (options.quality === 'high') ||\n ((options.colorGlyphs ?? 'emoji') !== 'none') !== Boolean(options.sharedAtlas.colorLayer))\n ) {\n throw new Error('VanillaDomText: sharedAtlas must match quality and colorGlyphs options')\n }\n\n const instance = new VanillaDomText(element, deviceOrRenderer, options)\n try {\n instance.applySelectableAttribute()\n await instance.rebuild(options.signal ? { signal: options.signal } : {})\n instance.setupObservers()\n instance.notify('create')\n return instance\n } catch (error) {\n instance.dispose()\n throw error\n }\n }\n\n get atlas(): VanillaSdfAtlas {\n return this.#a\n }\n\n get stats(): Readonly<DomSdfStats> {\n return this.#st\n }\n\n get snapshot(): DomLayoutSnapshot | null {\n return this.#s\n }\n\n get width(): number {\n return this.#s?.width ?? 0\n }\n\n get height(): number {\n return this.#s?.height ?? 0\n }\n\n get isDisposed(): boolean {\n return this.#d\n }\n\n subscribe(listener: (instance: VanillaDomText, reason: VanillaChangeReason) => void): () => void {\n this.#cbs.add(listener)\n return (): void => {\n this.#cbs.delete(listener)\n }\n }\n\n reflow(width: number): this {\n if (this.#d) {\n throw new Error('Cannot reflow a disposed VanillaDomText instance')\n }\n if (this.options.reflowable !== true || !this.#s) {\n throw new Error('VanillaDomText.reflow requires { reflowable: true } at creation time')\n }\n if (this.#s.textShaping === 'browser') {\n throw new Error(\n 'VanillaDomText.reflow does not support textShaping: \"browser\"; call rebuild() after resizing',\n )\n }\n if (!Number.isFinite(width) || width <= 0) {\n throw new RangeError('VanillaDomText.reflow: width must be a positive finite number')\n }\n const geometryStart = nowMs()\n const nextSnapshot = reflowSnapshot(this.#s, width)\n const motionPadding = Math.max(0, this.motion.strength)\n const maxSequence = updateGlyphInstances(this.glyphs, nextSnapshot, this.#a, motionPadding)\n if (maxSequence === null) {\n this.glyphs = packGlyphInstances(nextSnapshot, this.#a, motionPadding)\n }\n if (this.decorations) {\n const drawable = (key: string): boolean => this.#a.glyphs.has(key)\n if (\n !updateDecorationInstances(\n this.decorations,\n nextSnapshot,\n this.glyphs.rects,\n drawable,\n motionPadding,\n )\n ) {\n this.decorations = packDecorationInstances(\n nextSnapshot,\n this.glyphs.rects,\n drawable,\n motionPadding,\n )\n }\n }\n const geometryBuildMs = nowMs() - geometryStart\n this.#s = nextSnapshot\n this.#ls = ''\n const draws =\n (this.plainRects ? 1 : 0) +\n (this.litRects ? 1 : 0) +\n (this.glyphs.count > 0 ? 1 : 0) +\n (this.decorations ? 1 : 0)\n this.#st = Object.freeze({\n ...this.#st,\n atlasBuildMs: 0,\n layoutReadMs: 0,\n geometryBuildMs,\n lines: nextSnapshot.lineCount,\n draws,\n })\n this.notify('reflow')\n return this\n }\n\n setMotion(motion: SdfMotionOptions): this {\n if (this.#d) return this\n const previousStrength = this.motion.strength\n this.motion = {\n enabled: motion.enabled ?? this.motion.enabled,\n mode: motion.mode ?? this.motion.mode,\n strength: Math.max(0, motion.strength ?? this.motion.strength),\n speed: Math.max(0, motion.speed ?? this.motion.speed),\n stagger: Math.max(0, motion.stagger ?? this.motion.stagger),\n }\n if (this.motion.strength !== previousStrength && this.#s) {\n const padding = this.motion.strength\n let minZ = 0\n let maxZ = 0\n for (const glyph of this.#s.glyphs) {\n if (glyph.z < minZ) minZ = glyph.z\n if (glyph.z > maxZ) maxZ = glyph.z\n }\n this.glyphs.bounds = computeInstanceBounds(this.#s.width, this.#s.height, padding, minZ, maxZ)\n }\n this.notify('motion')\n return this\n }\n\n async rebuild(rebuildOptions: VanillaDomTextRebuildOptions = {}): Promise<this> {\n if (this.#d) {\n throw new Error('Cannot rebuild a disposed VanillaDomText instance')\n }\n if (!this.element.isConnected) {\n throw new Error('Cannot rebuild VanillaDomText when the source element is disconnected')\n }\n\n const version = ++this.#rv\n this.#ac?.abort(makeAbortError())\n const [controller, unlinkSignals] = linkAbortSignals(this.options.signal, rebuildOptions.signal)\n this.#ac = controller\n const { signal } = controller\n\n let nextAtlas: VanillaSdfAtlas | undefined\n let nextOwnsAtlas = true\n\n try {\n await waitForDocumentFonts(this.element.ownerDocument, signal)\n signal.throwIfAborted()\n\n const { device } = this\n const opts = this.options\n const sharedAtlas = opts.sharedAtlas\n const currentAtlas = this.#a as VanillaSdfAtlas | undefined\n const gpuUpload = opts.atlasMode !== 'cpu' && typeof device?.createShaderModule === 'function'\n if (gpuUpload && !sharedAtlas && !currentAtlas && !devicePipelines.has(device)) {\n try {\n getDevicePipelines(device)\n device.queue.submit([])\n } catch {\n // Deferred to buildVanillaSdfAtlas error handling.\n }\n }\n\n const layoutStart = nowMs()\n const snapshotOptions: DomSdfOptions = {\n ...(opts as Omit<VanillaDomTextOptions, 'sharedAtlas' | 'onChange'>),\n signal,\n }\n const snapshot = await collectDomSnapshot(this.element, snapshotOptions)\n const layoutReadMs = nowMs() - layoutStart\n signal.throwIfAborted()\n const nextTone = this.resolveCaptureTone(snapshot)\n\n const canUseSharedAtlas = Boolean(\n sharedAtlas && hasAllGlyphs(sharedAtlas, snapshot, opts.colorGlyphs),\n )\n const canReusePrivateAtlas = Boolean(\n !canUseSharedAtlas &&\n currentAtlas &&\n this.#o &&\n (this.#as === snapshot.atlasSignature ||\n hasAllGlyphs(currentAtlas, snapshot, opts.colorGlyphs)),\n )\n\n const nextLayoutSignature = layoutSignatureOf(snapshot)\n if (this.#ls === '' && this.#s) {\n this.#ls = layoutSignatureOf(this.#s)\n }\n if (\n (canUseSharedAtlas || canReusePrivateAtlas) &&\n this.#ls !== '' &&\n nextLayoutSignature === this.#ls\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (version !== this.#rv || this.#d) {\n throw makeAbortError()\n }\n this.tone = nextTone\n this.#s = snapshot\n this.#st = Object.freeze({\n ...this.#st,\n atlasBuildMs: 0,\n layoutReadMs,\n geometryBuildMs: 0,\n })\n this.notify('rebuild')\n return this\n }\n\n const atlasStart = nowMs()\n const highQuality = opts.quality === 'high'\n if (canUseSharedAtlas && sharedAtlas) {\n nextAtlas = sharedAtlas\n nextOwnsAtlas = false\n } else if (canReusePrivateAtlas && currentAtlas) {\n nextAtlas = currentAtlas\n nextOwnsAtlas = true\n } else {\n const raster = await rasterizeGlyphAtlas(this.element.ownerDocument, snapshot.requests, {\n ...opts,\n previousAtlas: currentAtlas !== sharedAtlas ? currentAtlas : undefined,\n ...(gpuUpload ? { gpuUpload } : {}),\n signal,\n })\n signal.throwIfAborted()\n nextAtlas = await buildVanillaSdfAtlas(device, raster, {\n ...(opts.cpuWorker === undefined ? {} : { cpuWorker: opts.cpuWorker }),\n mode: opts.atlasMode ?? 'auto',\n mipmaps: highQuality,\n anisotropy: highQuality ? 4 : 1,\n signal,\n })\n ;(nextAtlas as VanillaSdfAtlas & { colorGlyphs?: ColorGlyphMode }).colorGlyphs =\n opts.colorGlyphs ?? 'emoji'\n nextOwnsAtlas = true\n }\n const atlasBuildMs = canUseSharedAtlas || canReusePrivateAtlas ? 0 : nowMs() - atlasStart\n signal.throwIfAborted()\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (version !== this.#rv || this.#d) {\n throw makeAbortError()\n }\n\n const resolvedAtlas = nextAtlas\n const geometryStart = nowMs()\n const motionPadding = Math.max(0, this.motion.strength)\n const drawable = (key: string): boolean => resolvedAtlas.glyphs.has(key)\n\n const currentGlyphs = this.glyphs as VanillaGlyphInstances | undefined\n if (\n !currentGlyphs ||\n updateGlyphContentInstances(currentGlyphs, snapshot, resolvedAtlas, motionPadding) === null\n ) {\n this.glyphs = packGlyphInstances(snapshot, resolvedAtlas, motionPadding)\n }\n\n if (!this.plainRects || !updateRectInstances(this.plainRects, snapshot, false)) {\n this.plainRects = packRectInstances(snapshot, false)\n }\n if (!this.litRects || !updateRectInstances(this.litRects, snapshot, true)) {\n this.litRects = packRectInstances(snapshot, true)\n }\n\n if (\n !this.decorations ||\n !updateDecorationInstances(\n this.decorations,\n snapshot,\n this.glyphs.rects,\n drawable,\n motionPadding,\n )\n ) {\n this.decorations = packDecorationInstances(\n snapshot,\n this.glyphs.rects,\n drawable,\n motionPadding,\n )\n }\n const geometryBuildMs = nowMs() - geometryStart\n\n const previousAtlas = this.#a as VanillaSdfAtlas | undefined\n const previousOwnsAtlas = this.#o\n this.#a = resolvedAtlas\n this.#o = nextOwnsAtlas\n this.tone = nextTone\n this.#s = snapshot\n if (!canUseSharedAtlas && !canReusePrivateAtlas) {\n this.#as = snapshot.atlasSignature\n }\n this.#ls = nextLayoutSignature\n this.#av = version\n\n let textGlyphs = 0\n let shapes = 0\n let colorGlyphCount = 0\n for (const glyph of snapshot.glyphs) {\n if (glyph.shapeGroup !== undefined) shapes++\n else {\n textGlyphs++\n if (resolvedAtlas.glyphs.get(glyph.glyphKey)?.color) colorGlyphCount++\n }\n }\n const mipFactor = highQuality ? 4 / 3 : 1\n const colorBytes = resolvedAtlas.colorLayer\n ? resolvedAtlas.width * resolvedAtlas.colorLayer.height * 4\n : 0\n const textStorageBytes = Math.round(\n (resolvedAtlas.width * resolvedAtlas.height + colorBytes) * mipFactor,\n )\n const draws =\n (this.plainRects ? 1 : 0) +\n (this.litRects ? 1 : 0) +\n (this.glyphs.count > 0 ? 1 : 0) +\n (this.decorations ? 1 : 0)\n\n this.#st = Object.freeze({\n colorGlyphs: colorGlyphCount,\n shapes,\n fallbackGlyphs: 0,\n switchableGlyphs: 0,\n atlasBuildMs,\n layoutReadMs,\n geometryBuildMs,\n glyphs: textGlyphs,\n rects: snapshot.rects.length,\n lines: snapshot.lineCount,\n draws,\n atlasWidth: resolvedAtlas.width,\n atlasHeight: resolvedAtlas.height,\n textBackend: 'sdf',\n atlasMode: resolvedAtlas.mode,\n textStorageBytes,\n })\n\n if (previousAtlas && previousOwnsAtlas && previousAtlas !== resolvedAtlas) {\n previousAtlas.dispose()\n }\n if (this.#av > 1) {\n this.notify('rebuild')\n }\n return this\n } catch (error) {\n if (nextAtlas && nextOwnsAtlas && nextAtlas !== (this.#a as VanillaSdfAtlas | undefined)) {\n nextAtlas.dispose()\n }\n throw error\n } finally {\n unlinkSignals()\n if (this.#ac === controller) {\n this.#ac = null\n }\n }\n }\n\n dispose(): void {\n if (this.#d) return\n this.#d = true\n this.#ac?.abort(makeAbortError())\n this.#ac = null\n if (this.#f !== null && typeof cancelAnimationFrame === 'function') {\n cancelAnimationFrame(this.#f)\n this.#f = null\n }\n this.#ro?.disconnect()\n this.#ro = null\n this.#mo?.disconnect()\n this.#mo = null\n this.#uf?.()\n this.#uf = null\n if (this.#sel) {\n this.element.classList.remove('sdf-selectable')\n this.#sel = false\n }\n const currentAtlas = this.#a as VanillaSdfAtlas | undefined\n if (currentAtlas && this.#o) {\n currentAtlas.dispose()\n }\n this.#s = null\n this.notify('dispose')\n this.#cbs.clear()\n }\n\n protected resolveCaptureTone(snapshot: DomLayoutSnapshot): ResolvedTextTone | null {\n return resolveDomTextTone(this.element, this.options.tone, {\n glyphs: snapshot.glyphs,\n rects: snapshot.rects,\n rootRect: this.options.includeRootBackground !== false,\n })\n }\n\n protected notify(reason: VanillaChangeReason): void {\n for (const listener of this.#cbs) {\n listener(this, reason)\n }\n }\n\n protected applySelectableAttribute(): void {\n if (this.options.selectable !== true) return\n if (!this.element.classList.contains('sdf-selectable')) {\n this.element.classList.add('sdf-selectable')\n this.#sel = true\n }\n }\n\n protected setupObservers(): void {\n if (this.options.observe === false || this.#d) return\n const schedule = (): void => {\n if (this.#d || this.#f !== null) return\n if (typeof requestAnimationFrame === 'function') {\n this.#f = requestAnimationFrame(() => {\n this.#f = null\n if (this.#d || !this.element.isConnected) return\n void this.rebuild().catch((error: unknown) => {\n if (!isAbortError(error)) {\n this.options.onError?.(error)\n }\n })\n })\n }\n }\n if (typeof ResizeObserver !== 'undefined') {\n this.#ro = new ResizeObserver(schedule)\n this.#ro.observe(this.element)\n }\n if (typeof MutationObserver !== 'undefined') {\n this.#mo = new MutationObserver(schedule)\n this.#mo.observe(this.element, {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['style', 'class', 'dir', 'lang', 'data-text-depth', 'data-sdf-depth'],\n })\n }\n const fonts = this.element.ownerDocument.fonts as FontFaceSet | undefined\n if (fonts && typeof fonts.addEventListener === 'function') {\n fonts.addEventListener('loadingdone', schedule)\n this.#uf = (): void => {\n fonts.removeEventListener('loadingdone', schedule)\n }\n }\n }\n}\n\nexport { VanillaDomText as DomSdf, VanillaDomText as DomText }\n\nexport interface VanillaTextOptions extends VanillaDomTextOptions {\n device?: VanillaGpuDeviceSource\n renderer?: VanillaGpuDeviceSource\n css?: TextCss\n cssClass?: TextClass\n parent?: HTMLElement\n}\n\nconst UNITLESS_CSS = new Set(\n 'aspect-ratio columns column-count fill-opacity flex flex-grow flex-shrink font-weight grid-column grid-row line-clamp line-height opacity order orphans scale stroke-opacity tab-size widows z-index zoom'.split(\n ' ',\n ),\n)\n\nconst BASE_TEXT_STYLE: Readonly<Record<string, string>> = {\n position: 'fixed',\n left: '0',\n top: '0',\n margin: '0',\n pointerEvents: 'none',\n userSelect: 'none',\n webkitUserSelect: 'none',\n visibility: 'hidden',\n zIndex: '-2147483648',\n}\n\nfunction kebabProperty(name: string): string {\n if (name.startsWith('--')) return name\n return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n}\n\nfunction applyBaseStyle(element: HTMLElement): void {\n for (const [property, value] of Object.entries(BASE_TEXT_STYLE)) {\n element.style.setProperty(kebabProperty(property), value)\n }\n}\n\nfunction applyTextCss(element: HTMLElement, css: TextCss | undefined): void {\n element.removeAttribute('style')\n if (typeof css === 'string') {\n element.style.cssText = css\n } else if (css) {\n for (const [rawName, rawValue] of Object.entries(css)) {\n if (rawValue === undefined || rawValue === null) continue\n const property = kebabProperty(rawName)\n const value =\n typeof rawValue === 'number' && !property.startsWith('--') && !UNITLESS_CSS.has(property)\n ? `${String(rawValue)}px`\n : String(rawValue)\n element.style.setProperty(property, value)\n }\n }\n applyBaseStyle(element)\n}\n\nfunction classTokens(cssClass: TextClass | undefined): string[] {\n if (!cssClass) return []\n const raw =\n typeof cssClass === 'string'\n ? [cssClass]\n : Array.isArray(cssClass)\n ? (cssClass as readonly string[])\n : Object.entries(cssClass)\n .filter(([, enabled]) => Boolean(enabled))\n .map(([name]) => name)\n return raw.flatMap((entry) => entry.split(/\\s+/)).filter(Boolean)\n}\n\nfunction createOwnedTextElement(text: string, options: VanillaTextOptions): HTMLElement {\n const parent = options.parent ?? (typeof document !== 'undefined' ? document.body : null)\n if (!parent?.isConnected) {\n throw new Error('VanillaText requires a connected parent element or document.body')\n }\n const element = parent.ownerDocument.createElement('div')\n element.setAttribute('data-sdf-block', '')\n element.setAttribute('aria-hidden', 'true')\n element.textContent = text\n applyTextCss(element, options.css)\n parent.appendChild(element)\n return element\n}\n\nfunction stripTextOnlyOptions(options: VanillaTextOptions): VanillaDomTextOptions {\n const domOptions: VanillaTextOptions = { ...options }\n delete domOptions.css\n delete domOptions.cssClass\n delete domOptions.parent\n delete domOptions.device\n delete domOptions.renderer\n return domOptions\n}\n\nexport class VanillaText extends VanillaDomText {\n readonly ready: Promise<this>\n #t: string\n #c: string[] = []\n\n constructor(text: string, options: VanillaTextOptions = {}) {\n options.signal?.throwIfAborted()\n const element = createOwnedTextElement(text, options)\n super(element, options.device ?? options.renderer, stripTextOnlyOptions(options))\n this.#t = text\n this.#acls(options.cssClass)\n this.ready = this.#p(options.signal)\n }\n\n async #p(signal?: AbortSignal): Promise<this> {\n try {\n await this.rebuild(signal ? { signal } : {})\n this.setupObservers()\n this.notify('create')\n return this\n } catch (error) {\n this.dispose()\n throw error\n }\n }\n\n static override create(text: string, options?: VanillaTextOptions): Promise<VanillaText>\n static override create(\n element: HTMLElement,\n deviceOrRenderer?: VanillaGpuDeviceSource,\n options?: VanillaDomTextOptions,\n ): Promise<VanillaDomText>\n static override async create(\n textOrElement: string | HTMLElement,\n optionsOrDevice?: VanillaTextOptions | VanillaGpuDeviceSource,\n maybeOptions?: VanillaDomTextOptions,\n ): Promise<VanillaDomText> {\n if (typeof textOrElement === 'string') {\n const instance = new VanillaText(\n textOrElement,\n (optionsOrDevice as VanillaTextOptions | undefined) ?? {},\n )\n return instance.ready\n }\n return super.create(textOrElement, optionsOrDevice as VanillaGpuDeviceSource, maybeOptions)\n }\n\n get text(): string {\n return this.#t\n }\n\n set text(value: string) {\n this.#t = value\n if (!this.isDisposed) {\n this.element.textContent = value\n }\n }\n\n async setText(value: string, options?: VanillaDomTextRebuildOptions): Promise<this> {\n this.text = value\n return this.rebuild(options)\n }\n\n async setCss(css: TextCss | undefined, options?: VanillaDomTextRebuildOptions): Promise<this> {\n if (!this.isDisposed) applyTextCss(this.element, css)\n return this.rebuild(options)\n }\n\n async setClass(\n cssClass: TextClass | undefined,\n options?: VanillaDomTextRebuildOptions,\n ): Promise<this> {\n if (!this.isDisposed) this.#acls(cssClass)\n return this.rebuild(options)\n }\n\n override dispose(): void {\n const wasDisposed = this.isDisposed\n super.dispose()\n if (!wasDisposed) {\n this.element.remove()\n }\n }\n\n protected override resolveCaptureTone(snapshot: DomLayoutSnapshot): ResolvedTextTone | null {\n return resolveDomTextTone(this.element, this.options.tone, {\n glyphs: snapshot.glyphs,\n rects: snapshot.rects,\n rootRect: this.options.includeRootBackground !== false,\n page: false,\n })\n }\n\n #acls(cssClass: TextClass | undefined): void {\n if (this.#c.length > 0) {\n this.element.classList.remove(...this.#c)\n }\n this.#c = classTokens(cssClass)\n if (this.#c.length > 0) {\n this.element.classList.add(...this.#c)\n }\n }\n}\n\nexport { VanillaText as Text }\n"],"mappings":";;;;;;;;;;AAiUA,SAAS,iBAAiB,QAAyD;CACjF,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO;CAClD,IAAI,mBAAmB,UAAU,OAAO,OAAO,kBAAkB,YAAY,OAAO;CACpF,IAAI,YAAY,UAAU,OAAO,UAAU,OAAO,OAAO,OAAO,kBAAkB,YAChF,OAAO,OAAO;CAEhB,OAAO;AACT;AAEA,SAAS,eAAe,OAAuB;CAC7C,OAAO,KAAK,KAAK,QAAQ,EAAE,IAAI;AACjC;AAEA,SAAS,SAAS,SAA2B;CAC3C,MAAM,SAAS,KAAK,KAAK,UAAU,CAAC,IAAI;CACxC,IAAI,OAAO;CACX,OAAO,IAAI,OAAO,IAAI,QAAQ,QAAQ;CACtC,MAAM,QAAkB,CAAC;CACzB,OAAO,QAAQ,GAAG;EAChB,MAAM,KAAK,IAAI;EACf,OAAO,KAAK,MAAM,OAAO,CAAC;CAC5B;CACA,OAAO;AACT;AAEA,IAAM,8BAA8B;AACpC,IAAM,gBAAgB;CAAC;CAAc;CAAiB;AAAU;AAEhE,SAAS,wBACP,QACA,OACA,QACM;CACN,KAAK,MAAM,CAAC,MAAM,SAAS;EACzB,CAAC,qCAAqC,+BAA+B,CAAC;EACtE,CAAC,4BAA4B,2BAA2B;EACxD,CAAC,4BAA4B,2BAA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