@clypra-studio/engine 1.9.0 → 1.10.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.
package/dist/index.d.cts CHANGED
@@ -7169,6 +7169,68 @@ declare function renderEvaluatedSceneToCanvas(scene: EvaluatedScene, ctx: SceneC
7169
7169
  background?: boolean;
7170
7170
  }): void;
7171
7171
 
7172
+ /**
7173
+ * Shared Sticker Scanner and Validator Module
7174
+ *
7175
+ * Single canonical implementation shared across:
7176
+ * - clypra-packages (@clypra-studio/engine)
7177
+ * - clypra-studio (Client-side Sticker Builder)
7178
+ * - clypra-api (Server-side validation & staging)
7179
+ * - clypra-api (CI validator script)
7180
+ */
7181
+ declare const MAX_LOTTIE_BYTES: number;
7182
+ declare const MAX_ASSET_BYTES: number;
7183
+ interface LottieScanResult {
7184
+ valid: boolean;
7185
+ errors: string[];
7186
+ dimensions?: {
7187
+ width: number;
7188
+ height: number;
7189
+ };
7190
+ animation?: {
7191
+ durationMs: number;
7192
+ fps: number;
7193
+ loop: boolean;
7194
+ lottie: {
7195
+ layerCount: number;
7196
+ hasExpressions: boolean;
7197
+ };
7198
+ };
7199
+ }
7200
+ interface AssetScanResult {
7201
+ valid: boolean;
7202
+ errors: string[];
7203
+ bytes: number;
7204
+ mime: "application/json" | "image/webp" | "image/png" | "image/svg+xml" | "application/octet-stream";
7205
+ dimensions?: {
7206
+ width: number;
7207
+ height: number;
7208
+ };
7209
+ animation?: LottieScanResult["animation"];
7210
+ }
7211
+ /**
7212
+ * Recursively scans Lottie node tree for expressions and external URLs.
7213
+ */
7214
+ declare function scanLottieNodes(node: any, found?: {
7215
+ expressions: number;
7216
+ remoteUrls: number;
7217
+ }): {
7218
+ expressions: number;
7219
+ remoteUrls: number;
7220
+ };
7221
+ /**
7222
+ * Inspects parsed or stringified Lottie JSON data.
7223
+ */
7224
+ declare function inspectLottieJson(jsonOrString: string | Record<string, any>): LottieScanResult;
7225
+ /**
7226
+ * Sniffs an asset buffer or string to detect MIME type, dimensions, and Lottie validity.
7227
+ */
7228
+ declare function inspectStickerAsset(data: Uint8Array | ArrayBuffer | string, filenameHint?: string): AssetScanResult;
7229
+ /**
7230
+ * Universal SHA-256 hash helper supporting both Web Crypto API (browser) and Node.js.
7231
+ */
7232
+ declare function calculateSha256(data: Uint8Array | ArrayBuffer | string): Promise<string>;
7233
+
7172
7234
  /**
7173
7235
  * @clypra-studio/engine — Canvas 2D text effects, Lottie tooling, and animation engine.
7174
7236
  * @version 0.1.0
@@ -7177,4 +7239,4 @@ declare function renderEvaluatedSceneToCanvas(scene: EvaluatedScene, ctx: SceneC
7177
7239
  /** Package version */
7178
7240
  declare const VERSION = "1.4.0";
7179
7241
 
7180
- export { ASPECT_RATIO_PRESETS, type AddBreakpointCommand, type AddDataPreviewSetCommand, type AddNodeCommand, type AddTimelineMarkerCommand, type AddVariableCommand, type AlignmentGuide, type AlignmentMode, type AnchorSide, type AnchorXMode, type AnchorYMode, type AnimBuildOpts, type AnimKeyframe, AnimTrack, type AnimTrackDef, type AnimatableParamDef, AnimatableValue, type AnimationCategory, type AnimationDiagnostic, type AnimationDiagnosticSeverity, type AnimationEvaluationOptions, AnimationPresetSchema, AnimationRuntime, AnimationSchema, type AnimationStartSpec, type AnimationState, AnimationValidator, type AnnotationNode, type ArcGeometryOutput, type AssetHandle, type AssetKind, type AssetManifest, type AssetRef, AssetRegistry$1 as AssetRegistry, type AssetSource, type AudioNode, type AudioPlaybackConfig, type AvatarNode, type AvoidRegionKind, type AxisConfig, BUILTIN_CANVAS_TEMPLATES, type BarGeometryItem, type BaseCommand, type BaseEditorCommand, type BatchCommand, type BatchCommandsCommand, type BatchInjection, type BehaviorKind, type BehaviorSpec, BezierControlPoints, type BindingDefinition, type BodySegmentationOptions, type BodySegmentationRequest, type BodySegmentationResponse, type BodySegmentationRuntime, type BodySegmentationRuntimeConfig, type BoundingBox, BoundingBoxSchema, type BoundingRegion, type BreadcrumbItem, type Breakpoint, type BreakpointSet, COMPOSITION_PRESETS, type CalloutNode, CanvasDevice, type CanvasSnapResult, type ChartAnimationConfig, type ChartBarStyle, type ChartNode, type ChartScale, type ChartSeries, type ChartType, type ClipConform, type ClipSegment, type CodeOverlayContent, type CodeSmartOverlayContent, type ColumnDefinition, type Command, type CommandBuffer, CommandBufferBuilder, type CommandExecutionResult, CommandExecutor, CommandHistory, type CommandHistoryOptions, type CommandType, type ComparisonItem, type ComparisonOverlayContent, type ComparisonSmartOverlayContent, CompiledTextTemplate, type ComponentCategory, type ComponentDefinition, type ComponentNode, type CompositionPreset, type ComputedCell, type ComputedColumn, type ComputedNodeBounds, type ComputedRow, type ComputedSplitUnitTransform, type ConformMode, type ConnectorNode, type ContainerNode, type CountUpEasing, DEFAULT_TEXT_STYLE, DataBindingAuthoringEngine, DataBindingEngine, type DataBindingRule, type DataPreviewSet, type DeleteNodeCommand, type DeleteNodesCommand, type DependencyGraph, type DetachComponentCommand, type DimensionMode, type DividerNode, type DocumentCommand, DocumentMigrator, type DocumentPoint, DocumentValidator, type DocumentVariable, type DotLottieManifest, type DrawPerCharTextOptions, type DuplicateNodesCommand, EMPHASIS_PRESETS, ENTRANCE_PRESETS, EXIT_PRESETS, EXPORT_PROFILE_PRESETS, type EasingControlPoint, type EditorAddNodeCommand, type EditorCommand, EditorCommandSystem, type EditorCommandType, type EditorExecutionResult, EffectBevelSchema, EffectFillSchema, EffectFullDefinitionSchema, EffectGlowSchema, EffectIndexItemSchema, type EffectInstance, EffectLayer, EffectPanelSchema, EffectShadowSchema, EffectStackSchema, EffectStrokeSchema, type EncodedFileEntry, type EncodedOutput, type EvaluatedBroadcastFrame, type EvaluatedContent, type EvaluatedExportFrame, type EvaluatedMilestone, type EvaluatedNode, type EvaluatedNodeState, type EvaluatedScene, type EvaluatedSceneState, type EvaluatedStyle, type EvaluatedThreshold, type EvaluatedTransform, type EvaluatedVideoStateAtTime, type EvaluationDiagnostic, type ExecutionPlanner, type ExecutionPolicy, type ExecutionQuality, ExportAbortError, type ExportConfig, type ExportDiagnosticCode, type ExportDiagnosticSeverity, type ExportFormat, type ExportFrameDescriptor, ExportJob, type ExportJobRecord, type ExportProfile, type ExportProgress, type ExportValidationDiagnostic, ExportValidator, FONT_WEIGHT_OPTIONS, type FillType, type FocalPoint$1 as FocalPoint, type FontRef, FontRegistry, FontSchema, type FontSpec, type FrameGraph, FrameGraphBuilder, type FrameNode, type GaugeNode, type GaugeThreshold, GifEncoder, type GifExportOptions, type GifFrame, GlowLayer, type GradientDir, type GradientNode, GradientStop, GradientStopSchema, GraphValidator, GridEngine, type GroupNodesCommand, type HandleType, type IconNode, type ImageFitMode, type ImageFittingInput, type ImageFittingResult, ImageLayerSchema, type JobChangeListener, type JobStatus, Keyframe, type KeyframeTrack, LOOP_PRESETS, LOTTIE_ANIM_PRESETS, LOTTIE_TEMPLATE_PRESETS, LayerAnimationSchema, type LayoutComputedState, LayoutEngine, type LayoutMode, type LineNode, type ListOverlayContent, type ListOverlayItem, type ListSmartOverlayContent, LiveBroadcastBridge, type LiveBroadcastOptions, type LottieAnimPreset, type LottieFileInfo, type LottieFontEntry, type LottieFontUsage, type LottieGradientStop, type LottieKeyframe, type LottieNode, type LottiePropertyPath, type LottieTemplatePreset, type LowerThirdOverlayContent, type LowerThirdSmartOverlayContent, type MediaEncoder, MediaEncoderRegistry, type MediaFitMode, MediaImageEngine, type MediaLayout, type MetricDelta, MetricEngine, type MetricEvaluationResult, type MetricFormatOptions, type MetricNode, type MilestoneItem, type MotionPreset, type MotionPresetDefinition, type MotionPresetParameter, MotionPresetRegistry, type MoveNodesCommand, type Mp4ExportOptions, Mp4VideoEncoder, type NodeAnimationRules, type NodeConstraints, type NodeDefinition, type NodeLayoutRules, NodeRegistry, type NodeSizingPolicy, type NodeStartTransform, type NodeStyleRules, type NormalizedCrop, NullBackend, type OverlayDocument, type ParsedTextLayer, type PlaybackDirection, type PlaybackMode, PngSequenceEncoder, type PngSequenceFrame, type PngSequenceOptions, Preset, type PrimitiveDefinition, type PrimitiveMediaNode, PrimitiveRegistry, type PrimitiveShapeNode, type PrimitiveTextNode, ProResVideoEncoder, type ProfileCanvasDimensions, type ProgressNode, ProjectCompiler, ProjectHelper, type ProjectManifestV2, type PropertyAnimationDefinition, PropertyAnimationRegistry, type PropertyDefinition, PropertyInspectorEngine, PropertyInterpolator, type PropertySchemaField, type PropertyValueType, type PublishedOverlayArtifact, type QuoteOverlayContent, type QuoteSmartOverlayContent, RawFramesEncoder, type RecordedExecution, type RegisterAssetCommand, type RegisteredAsset, type RegisteredFont, type RemoveAssetCommand, type RemoveBreakpointCommand, type RemoveDataPreviewSetCommand, type RemoveTimelineMarkerCommand, type RemoveVariableCommand, type RenderBackend, type RenderPass, RenderPlan, type RendererCapabilities, type ReorderNodesCommand, type ReparentNodeCommand, type RepeaterNode, type ResizeHandle, type ResizeNodeCommand, type ResizeOptions, ResolveTemplateControlValuesOptions, type ResolvedAsset, type ResolvedFit, type ResolvedFont, type ResolvedImageDimensions, type ResolvedLayoutBounds, type ResolvedMediaLayout, type ResourceAllocation, type ResourceRequest, type ResourceState$1 as ResourceState, ResponsiveAnchorConfig, type ResponsiveNodeOverride, type RichTextNode, type RichTextSpan, RuntimeAssetResolver, type RuntimeContext, SMART_OVERLAY_PRESETS, SUPPORTED_FONT_FAMILIES, type SceneCanvasContext, SceneDocument, type SceneNode, type SceneNodeBase, type SceneNodeType, type ScratchElementBlock, type ScratchOverlayTemplate, type ScreenPoint, SelectionEngine, type SemanticAnimationConfig, type SemanticBehaviorConfig, type SemanticContent, type SemanticIntent, type SemanticOverlayDefinition, type SemanticSlotDefinition, type SemanticSpatialConstraints, SeriesEngine, type SeriesPoint, type SetActiveBreakpointCommand, type SetAssetRefCommand, type SetBindingCommand, type SetDocumentCommand, type SetFontRefCommand, type SetResponsiveOverrideCommand, type ShaderCompilation, type ShapeKind, ShapeLayerSchema, type ShotBoundary, type Size, type SizingDimensionInput, type SmartAlignmentGuide, SmartGuideEngine, type SmartOverlayAnimation, type SmartOverlayClip, type SmartOverlayContentUnion, type SmartOverlayLayout, type SmartOverlayPreset, type SmartOverlayRegistryItem, SmartOverlayRegistryService, SmartOverlayRenderer, type SmartOverlayStyle, type SmartOverlayType, type SmartSnapResult, SnapEngine, type SnapResult, type SocialOverlayContent, type SocialSmartOverlayContent, type SpatialAnchorConfig, type SpatialConstraintSpec, SplitMode, type SplitUnit, SpringParams, type StatOverlayContent, type StatSmartOverlayContent, StyleRecipe, type SubtitleRegion, TEMPLATE_CATEGORIES, type TableColumn, type TableLayoutResult, type TableNode, TemplateCategory, TemplateCategorySchema, TemplateCustomization, TemplateEasingFunction, TemplateKeyframe, TemplateLayer, TemplateLayerSchema, type TemplateManifest, type TemplatePresetCategory, TemplateRenderContext, TemplateRenderer, type TemporalKeyframedRegion, type TextAlign, type TextCustomization, TextEffectBuilder, TextEffectConfig, TextEffectDefinition, TextEffectDefinitionSchema, type TextLayerConfig, TextLayerSchema, type TextLayerStyle, type TextLayoutBounds, type TextLayoutResult, TextSplitAnimator, type TextStyleOverride, TextStyleSpan, TextTemplate, TextTemplateArtifact, type TextTemplateDiagnostic, TextTemplateSchema, type ThresholdBand, type TimelineEvent, type TimelineMarker, type TimelineNode, type TimelineOverlayContent, type TimelineOverlayNode, type TimelineSmartOverlayContent, type TrackDefinition, type TrackedSubject, type TranscriptSegment, TransformEngine, type UngroupNodesCommand, type UpdateAnimationCommand, type UpdateCanvasSizeCommand, type UpdateDataPreviewSetCommand, type UpdateDocumentMetaCommand, type UpdateKeyframeTracksCommand, type UpdateNodePropertyCommand, type UpdateNodeStyleCommand, type UpdatePropCommand, type UpdateStyleCommand, type UpdateTimelineMarkerCommand, type UpdateVariableCommand, type Command$1 as V2Command, VERSION, type ValidatedEffectDefinition, type ValidatedTextEffectDefinition, type ValidatedTextTemplate, type ValidationDiagnostic, type ValidationError, type ValidationResult, type VideoCodecProfile, type VideoContext, type VideoNode, type VideoPlaybackConfig, type ViewportState, ViewportTransform, type VirtualWindow, WEBM_EXPORT_MAX_FRAMES, WebMEncoder, type WebMExportOptions, _resetPlatformCache, addImageLayer, addKeyframe, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, alignToLottieJ, animationRuntime, animationValidator, applyEasing, applyFillColorToAll, applyLetterSpacing, applyMaskReveal, applyRecipeToScene, applyStyleToLottie, applyStyleToLottieLayer, applyTimelineAtTime, assertValidTextTemplateArtifact, assetRegistry, bakeAnimationIntoLayer, blendConfigs, blendScenes, buildDotLottie, buildFontEntries, buildLottieFontName, buildPngSequenceZip, builtInRecipes, calculateCropFromFocalPoint, calculateDefaultCoverCrop, calculateMediaFit, calculateResizeBounds, calculateRotationAngle, canonicalTemplateHash, captureImageSourceDimensions, captureLottieFrames, captureVideoSourceDimensions, clearAnimationFromLayer, clearFontCache, clearRecipeCache, cloneSceneWithNewIds, commandExecutor, compileSemanticOverlay, compileTextTemplate, componentRegistry, computeAutoFitFontSize, computeFitZoom, computeTextLayout, convertScratchTemplateToClip, countTextGlyphs, createBlankLottie, createBlankScratchTemplate, createCanvas, createDefaultRevealTrack, createDefaultScratchBlock, createKeyframed, createPulseOpacityTrack, cubicBezier, dataBindingAuthoringEngine, dataBindingEngine, deleteKeyframe, deserializeTemplate, documentMigrator, documentValidator, downloadDotLottie, downloadLottieJson, downloadLottieMp4, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, drawRoundedRect, duplicateTrackAtPlayhead, ease, editorCommandSystem, enableKeyframing, encodeGif, ensureDefaultTimeline, ensureFontInLottie, evaluateAnimatable, evaluateExportFrame, evaluateOverlayDocument, evaluateSplitTextTransforms, exportLottieToMp4, exportValidator, findTrackIndex, fontRegistry, formatValidationErrors, getAnimPreset, getAnimatableParamDef, getAnimatableParamsForLayer, getCanvasTemplatePreset, getCanvasTemplatesByCategory, getClipLayout, getDefaultText, getLayerById, getPresetScene, getSourceCropRect, getSpanForCharIndex, getSupportedWebMMimeType, getTemplatePreset, getTemplatesByCategory, getWebMFrameCount, hexToLottieColor, hexToLottieRgb, hitTestTransformHandles, injectBatch, injectColor, injectGlobalTextStyle, injectSolidColor, injectText, injectTextStyle, interpolateColorString, interpolateValue, isKeyframed, isMp4ExportSupported, isWebMExportSupported, layoutEngine, liveBroadcastBridge, loadLottieFonts, lottieColorToHex, lottieJToAlign, measureTextFits, measureTextWidth, mediaEncoderRegistry, motionPresetRegistry, moveKeyframe, normalizeTextTemplateArtifact, parseHistorySnapshot, parseLottieJson, preloadGoogleFont, presetToRecipe, primitiveRegistry, propertyAnimationRegistry, propertyInspectorEngine, propertyInterpolator, pruneTracksForLayer, rainbowCharFillColors, readLayerScalar, readStyleFromLottieLayer, reindexLayers, releaseCanvas, removeKeyframe, removeTemplateKeyframe, removeTrack, renderEvaluatedSceneToCanvas, renderPngSequence, renderSceneWebM, resizeCharFillColors, resolveAnchorPosition, resolveAnimatedScalar, resolveBehaviorToAnimationSpec, resolveConform, resolveDocumentForBreakpoint, resolveExportCanvasDimensions, resolveMediaLayout, resolveNodeForBreakpoint, resolveSpatialConstraints, resolveTemplateControlValues, restoreLetterSpacing, rotateCrop, runtimeAssetResolver, sampleVideoContextAtTime, scanLottieFonts, scanTextLayers, selectionEngine, serializeTemplate, setCharFillColor, setTracks, shouldUsePerCharFill, smartOverlayRegistry, snapEngine, snapshotScene, solveSpring, sortKeyframes, splitTextContent, streamExportFrames, supportsCtxFilter, supportsLetterSpacing, supportsOffscreenCanvas, supportsRoundRect, trackId, updateKeyframe, updateSceneBevel, updateSceneCanvas, updateSceneFill, updateSceneGlow, updateScenePanel, updateSceneShadow, updateSceneStack, updateSceneStroke, updateSceneText, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, validateEffectDefinition, validateEffectDefinitionStrict, validateTextEffectDefinition, validateTextEffectDefinitionStrict, validateTextTemplate, validateTextTemplateArtifact, validateTextTemplateStrict, viewportTransform, waitForFontsReady, wrapTextToWidth };
7242
+ export { ASPECT_RATIO_PRESETS, type AddBreakpointCommand, type AddDataPreviewSetCommand, type AddNodeCommand, type AddTimelineMarkerCommand, type AddVariableCommand, type AlignmentGuide, type AlignmentMode, type AnchorSide, type AnchorXMode, type AnchorYMode, type AnimBuildOpts, type AnimKeyframe, AnimTrack, type AnimTrackDef, type AnimatableParamDef, AnimatableValue, type AnimationCategory, type AnimationDiagnostic, type AnimationDiagnosticSeverity, type AnimationEvaluationOptions, AnimationPresetSchema, AnimationRuntime, AnimationSchema, type AnimationStartSpec, type AnimationState, AnimationValidator, type AnnotationNode, type ArcGeometryOutput, type AssetHandle, type AssetKind, type AssetManifest, type AssetRef, AssetRegistry$1 as AssetRegistry, type AssetScanResult, type AssetSource, type AudioNode, type AudioPlaybackConfig, type AvatarNode, type AvoidRegionKind, type AxisConfig, BUILTIN_CANVAS_TEMPLATES, type BarGeometryItem, type BaseCommand, type BaseEditorCommand, type BatchCommand, type BatchCommandsCommand, type BatchInjection, type BehaviorKind, type BehaviorSpec, BezierControlPoints, type BindingDefinition, type BodySegmentationOptions, type BodySegmentationRequest, type BodySegmentationResponse, type BodySegmentationRuntime, type BodySegmentationRuntimeConfig, type BoundingBox, BoundingBoxSchema, type BoundingRegion, type BreadcrumbItem, type Breakpoint, type BreakpointSet, COMPOSITION_PRESETS, type CalloutNode, CanvasDevice, type CanvasSnapResult, type ChartAnimationConfig, type ChartBarStyle, type ChartNode, type ChartScale, type ChartSeries, type ChartType, type ClipConform, type ClipSegment, type CodeOverlayContent, type CodeSmartOverlayContent, type ColumnDefinition, type Command, type CommandBuffer, CommandBufferBuilder, type CommandExecutionResult, CommandExecutor, CommandHistory, type CommandHistoryOptions, type CommandType, type ComparisonItem, type ComparisonOverlayContent, type ComparisonSmartOverlayContent, CompiledTextTemplate, type ComponentCategory, type ComponentDefinition, type ComponentNode, type CompositionPreset, type ComputedCell, type ComputedColumn, type ComputedNodeBounds, type ComputedRow, type ComputedSplitUnitTransform, type ConformMode, type ConnectorNode, type ContainerNode, type CountUpEasing, DEFAULT_TEXT_STYLE, DataBindingAuthoringEngine, DataBindingEngine, type DataBindingRule, type DataPreviewSet, type DeleteNodeCommand, type DeleteNodesCommand, type DependencyGraph, type DetachComponentCommand, type DimensionMode, type DividerNode, type DocumentCommand, DocumentMigrator, type DocumentPoint, DocumentValidator, type DocumentVariable, type DotLottieManifest, type DrawPerCharTextOptions, type DuplicateNodesCommand, EMPHASIS_PRESETS, ENTRANCE_PRESETS, EXIT_PRESETS, EXPORT_PROFILE_PRESETS, type EasingControlPoint, type EditorAddNodeCommand, type EditorCommand, EditorCommandSystem, type EditorCommandType, type EditorExecutionResult, EffectBevelSchema, EffectFillSchema, EffectFullDefinitionSchema, EffectGlowSchema, EffectIndexItemSchema, type EffectInstance, EffectLayer, EffectPanelSchema, EffectShadowSchema, EffectStackSchema, EffectStrokeSchema, type EncodedFileEntry, type EncodedOutput, type EvaluatedBroadcastFrame, type EvaluatedContent, type EvaluatedExportFrame, type EvaluatedMilestone, type EvaluatedNode, type EvaluatedNodeState, type EvaluatedScene, type EvaluatedSceneState, type EvaluatedStyle, type EvaluatedThreshold, type EvaluatedTransform, type EvaluatedVideoStateAtTime, type EvaluationDiagnostic, type ExecutionPlanner, type ExecutionPolicy, type ExecutionQuality, ExportAbortError, type ExportConfig, type ExportDiagnosticCode, type ExportDiagnosticSeverity, type ExportFormat, type ExportFrameDescriptor, ExportJob, type ExportJobRecord, type ExportProfile, type ExportProgress, type ExportValidationDiagnostic, ExportValidator, FONT_WEIGHT_OPTIONS, type FillType, type FocalPoint$1 as FocalPoint, type FontRef, FontRegistry, FontSchema, type FontSpec, type FrameGraph, FrameGraphBuilder, type FrameNode, type GaugeNode, type GaugeThreshold, GifEncoder, type GifExportOptions, type GifFrame, GlowLayer, type GradientDir, type GradientNode, GradientStop, GradientStopSchema, GraphValidator, GridEngine, type GroupNodesCommand, type HandleType, type IconNode, type ImageFitMode, type ImageFittingInput, type ImageFittingResult, ImageLayerSchema, type JobChangeListener, type JobStatus, Keyframe, type KeyframeTrack, LOOP_PRESETS, LOTTIE_ANIM_PRESETS, LOTTIE_TEMPLATE_PRESETS, LayerAnimationSchema, type LayoutComputedState, LayoutEngine, type LayoutMode, type LineNode, type ListOverlayContent, type ListOverlayItem, type ListSmartOverlayContent, LiveBroadcastBridge, type LiveBroadcastOptions, type LottieAnimPreset, type LottieFileInfo, type LottieFontEntry, type LottieFontUsage, type LottieGradientStop, type LottieKeyframe, type LottieNode, type LottiePropertyPath, type LottieScanResult, type LottieTemplatePreset, type LowerThirdOverlayContent, type LowerThirdSmartOverlayContent, MAX_ASSET_BYTES, MAX_LOTTIE_BYTES, type MediaEncoder, MediaEncoderRegistry, type MediaFitMode, MediaImageEngine, type MediaLayout, type MetricDelta, MetricEngine, type MetricEvaluationResult, type MetricFormatOptions, type MetricNode, type MilestoneItem, type MotionPreset, type MotionPresetDefinition, type MotionPresetParameter, MotionPresetRegistry, type MoveNodesCommand, type Mp4ExportOptions, Mp4VideoEncoder, type NodeAnimationRules, type NodeConstraints, type NodeDefinition, type NodeLayoutRules, NodeRegistry, type NodeSizingPolicy, type NodeStartTransform, type NodeStyleRules, type NormalizedCrop, NullBackend, type OverlayDocument, type ParsedTextLayer, type PlaybackDirection, type PlaybackMode, PngSequenceEncoder, type PngSequenceFrame, type PngSequenceOptions, Preset, type PrimitiveDefinition, type PrimitiveMediaNode, PrimitiveRegistry, type PrimitiveShapeNode, type PrimitiveTextNode, ProResVideoEncoder, type ProfileCanvasDimensions, type ProgressNode, ProjectCompiler, ProjectHelper, type ProjectManifestV2, type PropertyAnimationDefinition, PropertyAnimationRegistry, type PropertyDefinition, PropertyInspectorEngine, PropertyInterpolator, type PropertySchemaField, type PropertyValueType, type PublishedOverlayArtifact, type QuoteOverlayContent, type QuoteSmartOverlayContent, RawFramesEncoder, type RecordedExecution, type RegisterAssetCommand, type RegisteredAsset, type RegisteredFont, type RemoveAssetCommand, type RemoveBreakpointCommand, type RemoveDataPreviewSetCommand, type RemoveTimelineMarkerCommand, type RemoveVariableCommand, type RenderBackend, type RenderPass, RenderPlan, type RendererCapabilities, type ReorderNodesCommand, type ReparentNodeCommand, type RepeaterNode, type ResizeHandle, type ResizeNodeCommand, type ResizeOptions, ResolveTemplateControlValuesOptions, type ResolvedAsset, type ResolvedFit, type ResolvedFont, type ResolvedImageDimensions, type ResolvedLayoutBounds, type ResolvedMediaLayout, type ResourceAllocation, type ResourceRequest, type ResourceState$1 as ResourceState, ResponsiveAnchorConfig, type ResponsiveNodeOverride, type RichTextNode, type RichTextSpan, RuntimeAssetResolver, type RuntimeContext, SMART_OVERLAY_PRESETS, SUPPORTED_FONT_FAMILIES, type SceneCanvasContext, SceneDocument, type SceneNode, type SceneNodeBase, type SceneNodeType, type ScratchElementBlock, type ScratchOverlayTemplate, type ScreenPoint, SelectionEngine, type SemanticAnimationConfig, type SemanticBehaviorConfig, type SemanticContent, type SemanticIntent, type SemanticOverlayDefinition, type SemanticSlotDefinition, type SemanticSpatialConstraints, SeriesEngine, type SeriesPoint, type SetActiveBreakpointCommand, type SetAssetRefCommand, type SetBindingCommand, type SetDocumentCommand, type SetFontRefCommand, type SetResponsiveOverrideCommand, type ShaderCompilation, type ShapeKind, ShapeLayerSchema, type ShotBoundary, type Size, type SizingDimensionInput, type SmartAlignmentGuide, SmartGuideEngine, type SmartOverlayAnimation, type SmartOverlayClip, type SmartOverlayContentUnion, type SmartOverlayLayout, type SmartOverlayPreset, type SmartOverlayRegistryItem, SmartOverlayRegistryService, SmartOverlayRenderer, type SmartOverlayStyle, type SmartOverlayType, type SmartSnapResult, SnapEngine, type SnapResult, type SocialOverlayContent, type SocialSmartOverlayContent, type SpatialAnchorConfig, type SpatialConstraintSpec, SplitMode, type SplitUnit, SpringParams, type StatOverlayContent, type StatSmartOverlayContent, StyleRecipe, type SubtitleRegion, TEMPLATE_CATEGORIES, type TableColumn, type TableLayoutResult, type TableNode, TemplateCategory, TemplateCategorySchema, TemplateCustomization, TemplateEasingFunction, TemplateKeyframe, TemplateLayer, TemplateLayerSchema, type TemplateManifest, type TemplatePresetCategory, TemplateRenderContext, TemplateRenderer, type TemporalKeyframedRegion, type TextAlign, type TextCustomization, TextEffectBuilder, TextEffectConfig, TextEffectDefinition, TextEffectDefinitionSchema, type TextLayerConfig, TextLayerSchema, type TextLayerStyle, type TextLayoutBounds, type TextLayoutResult, TextSplitAnimator, type TextStyleOverride, TextStyleSpan, TextTemplate, TextTemplateArtifact, type TextTemplateDiagnostic, TextTemplateSchema, type ThresholdBand, type TimelineEvent, type TimelineMarker, type TimelineNode, type TimelineOverlayContent, type TimelineOverlayNode, type TimelineSmartOverlayContent, type TrackDefinition, type TrackedSubject, type TranscriptSegment, TransformEngine, type UngroupNodesCommand, type UpdateAnimationCommand, type UpdateCanvasSizeCommand, type UpdateDataPreviewSetCommand, type UpdateDocumentMetaCommand, type UpdateKeyframeTracksCommand, type UpdateNodePropertyCommand, type UpdateNodeStyleCommand, type UpdatePropCommand, type UpdateStyleCommand, type UpdateTimelineMarkerCommand, type UpdateVariableCommand, type Command$1 as V2Command, VERSION, type ValidatedEffectDefinition, type ValidatedTextEffectDefinition, type ValidatedTextTemplate, type ValidationDiagnostic, type ValidationError, type ValidationResult, type VideoCodecProfile, type VideoContext, type VideoNode, type VideoPlaybackConfig, type ViewportState, ViewportTransform, type VirtualWindow, WEBM_EXPORT_MAX_FRAMES, WebMEncoder, type WebMExportOptions, _resetPlatformCache, addImageLayer, addKeyframe, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, alignToLottieJ, animationRuntime, animationValidator, applyEasing, applyFillColorToAll, applyLetterSpacing, applyMaskReveal, applyRecipeToScene, applyStyleToLottie, applyStyleToLottieLayer, applyTimelineAtTime, assertValidTextTemplateArtifact, assetRegistry, bakeAnimationIntoLayer, blendConfigs, blendScenes, buildDotLottie, buildFontEntries, buildLottieFontName, buildPngSequenceZip, builtInRecipes, calculateCropFromFocalPoint, calculateDefaultCoverCrop, calculateMediaFit, calculateResizeBounds, calculateRotationAngle, calculateSha256, canonicalTemplateHash, captureImageSourceDimensions, captureLottieFrames, captureVideoSourceDimensions, clearAnimationFromLayer, clearFontCache, clearRecipeCache, cloneSceneWithNewIds, commandExecutor, compileSemanticOverlay, compileTextTemplate, componentRegistry, computeAutoFitFontSize, computeFitZoom, computeTextLayout, convertScratchTemplateToClip, countTextGlyphs, createBlankLottie, createBlankScratchTemplate, createCanvas, createDefaultRevealTrack, createDefaultScratchBlock, createKeyframed, createPulseOpacityTrack, cubicBezier, dataBindingAuthoringEngine, dataBindingEngine, deleteKeyframe, deserializeTemplate, documentMigrator, documentValidator, downloadDotLottie, downloadLottieJson, downloadLottieMp4, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, drawRoundedRect, duplicateTrackAtPlayhead, ease, editorCommandSystem, enableKeyframing, encodeGif, ensureDefaultTimeline, ensureFontInLottie, evaluateAnimatable, evaluateExportFrame, evaluateOverlayDocument, evaluateSplitTextTransforms, exportLottieToMp4, exportValidator, findTrackIndex, fontRegistry, formatValidationErrors, getAnimPreset, getAnimatableParamDef, getAnimatableParamsForLayer, getCanvasTemplatePreset, getCanvasTemplatesByCategory, getClipLayout, getDefaultText, getLayerById, getPresetScene, getSourceCropRect, getSpanForCharIndex, getSupportedWebMMimeType, getTemplatePreset, getTemplatesByCategory, getWebMFrameCount, hexToLottieColor, hexToLottieRgb, hitTestTransformHandles, injectBatch, injectColor, injectGlobalTextStyle, injectSolidColor, injectText, injectTextStyle, inspectLottieJson, inspectStickerAsset, interpolateColorString, interpolateValue, isKeyframed, isMp4ExportSupported, isWebMExportSupported, layoutEngine, liveBroadcastBridge, loadLottieFonts, lottieColorToHex, lottieJToAlign, measureTextFits, measureTextWidth, mediaEncoderRegistry, motionPresetRegistry, moveKeyframe, normalizeTextTemplateArtifact, parseHistorySnapshot, parseLottieJson, preloadGoogleFont, presetToRecipe, primitiveRegistry, propertyAnimationRegistry, propertyInspectorEngine, propertyInterpolator, pruneTracksForLayer, rainbowCharFillColors, readLayerScalar, readStyleFromLottieLayer, reindexLayers, releaseCanvas, removeKeyframe, removeTemplateKeyframe, removeTrack, renderEvaluatedSceneToCanvas, renderPngSequence, renderSceneWebM, resizeCharFillColors, resolveAnchorPosition, resolveAnimatedScalar, resolveBehaviorToAnimationSpec, resolveConform, resolveDocumentForBreakpoint, resolveExportCanvasDimensions, resolveMediaLayout, resolveNodeForBreakpoint, resolveSpatialConstraints, resolveTemplateControlValues, restoreLetterSpacing, rotateCrop, runtimeAssetResolver, sampleVideoContextAtTime, scanLottieFonts, scanLottieNodes, scanTextLayers, selectionEngine, serializeTemplate, setCharFillColor, setTracks, shouldUsePerCharFill, smartOverlayRegistry, snapEngine, snapshotScene, solveSpring, sortKeyframes, splitTextContent, streamExportFrames, supportsCtxFilter, supportsLetterSpacing, supportsOffscreenCanvas, supportsRoundRect, trackId, updateKeyframe, updateSceneBevel, updateSceneCanvas, updateSceneFill, updateSceneGlow, updateScenePanel, updateSceneShadow, updateSceneStack, updateSceneStroke, updateSceneText, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, validateEffectDefinition, validateEffectDefinitionStrict, validateTextEffectDefinition, validateTextEffectDefinitionStrict, validateTextTemplate, validateTextTemplateArtifact, validateTextTemplateStrict, viewportTransform, waitForFontsReady, wrapTextToWidth };
package/dist/index.d.ts CHANGED
@@ -7169,6 +7169,68 @@ declare function renderEvaluatedSceneToCanvas(scene: EvaluatedScene, ctx: SceneC
7169
7169
  background?: boolean;
7170
7170
  }): void;
7171
7171
 
7172
+ /**
7173
+ * Shared Sticker Scanner and Validator Module
7174
+ *
7175
+ * Single canonical implementation shared across:
7176
+ * - clypra-packages (@clypra-studio/engine)
7177
+ * - clypra-studio (Client-side Sticker Builder)
7178
+ * - clypra-api (Server-side validation & staging)
7179
+ * - clypra-api (CI validator script)
7180
+ */
7181
+ declare const MAX_LOTTIE_BYTES: number;
7182
+ declare const MAX_ASSET_BYTES: number;
7183
+ interface LottieScanResult {
7184
+ valid: boolean;
7185
+ errors: string[];
7186
+ dimensions?: {
7187
+ width: number;
7188
+ height: number;
7189
+ };
7190
+ animation?: {
7191
+ durationMs: number;
7192
+ fps: number;
7193
+ loop: boolean;
7194
+ lottie: {
7195
+ layerCount: number;
7196
+ hasExpressions: boolean;
7197
+ };
7198
+ };
7199
+ }
7200
+ interface AssetScanResult {
7201
+ valid: boolean;
7202
+ errors: string[];
7203
+ bytes: number;
7204
+ mime: "application/json" | "image/webp" | "image/png" | "image/svg+xml" | "application/octet-stream";
7205
+ dimensions?: {
7206
+ width: number;
7207
+ height: number;
7208
+ };
7209
+ animation?: LottieScanResult["animation"];
7210
+ }
7211
+ /**
7212
+ * Recursively scans Lottie node tree for expressions and external URLs.
7213
+ */
7214
+ declare function scanLottieNodes(node: any, found?: {
7215
+ expressions: number;
7216
+ remoteUrls: number;
7217
+ }): {
7218
+ expressions: number;
7219
+ remoteUrls: number;
7220
+ };
7221
+ /**
7222
+ * Inspects parsed or stringified Lottie JSON data.
7223
+ */
7224
+ declare function inspectLottieJson(jsonOrString: string | Record<string, any>): LottieScanResult;
7225
+ /**
7226
+ * Sniffs an asset buffer or string to detect MIME type, dimensions, and Lottie validity.
7227
+ */
7228
+ declare function inspectStickerAsset(data: Uint8Array | ArrayBuffer | string, filenameHint?: string): AssetScanResult;
7229
+ /**
7230
+ * Universal SHA-256 hash helper supporting both Web Crypto API (browser) and Node.js.
7231
+ */
7232
+ declare function calculateSha256(data: Uint8Array | ArrayBuffer | string): Promise<string>;
7233
+
7172
7234
  /**
7173
7235
  * @clypra-studio/engine — Canvas 2D text effects, Lottie tooling, and animation engine.
7174
7236
  * @version 0.1.0
@@ -7177,4 +7239,4 @@ declare function renderEvaluatedSceneToCanvas(scene: EvaluatedScene, ctx: SceneC
7177
7239
  /** Package version */
7178
7240
  declare const VERSION = "1.4.0";
7179
7241
 
7180
- export { ASPECT_RATIO_PRESETS, type AddBreakpointCommand, type AddDataPreviewSetCommand, type AddNodeCommand, type AddTimelineMarkerCommand, type AddVariableCommand, type AlignmentGuide, type AlignmentMode, type AnchorSide, type AnchorXMode, type AnchorYMode, type AnimBuildOpts, type AnimKeyframe, AnimTrack, type AnimTrackDef, type AnimatableParamDef, AnimatableValue, type AnimationCategory, type AnimationDiagnostic, type AnimationDiagnosticSeverity, type AnimationEvaluationOptions, AnimationPresetSchema, AnimationRuntime, AnimationSchema, type AnimationStartSpec, type AnimationState, AnimationValidator, type AnnotationNode, type ArcGeometryOutput, type AssetHandle, type AssetKind, type AssetManifest, type AssetRef, AssetRegistry$1 as AssetRegistry, type AssetSource, type AudioNode, type AudioPlaybackConfig, type AvatarNode, type AvoidRegionKind, type AxisConfig, BUILTIN_CANVAS_TEMPLATES, type BarGeometryItem, type BaseCommand, type BaseEditorCommand, type BatchCommand, type BatchCommandsCommand, type BatchInjection, type BehaviorKind, type BehaviorSpec, BezierControlPoints, type BindingDefinition, type BodySegmentationOptions, type BodySegmentationRequest, type BodySegmentationResponse, type BodySegmentationRuntime, type BodySegmentationRuntimeConfig, type BoundingBox, BoundingBoxSchema, type BoundingRegion, type BreadcrumbItem, type Breakpoint, type BreakpointSet, COMPOSITION_PRESETS, type CalloutNode, CanvasDevice, type CanvasSnapResult, type ChartAnimationConfig, type ChartBarStyle, type ChartNode, type ChartScale, type ChartSeries, type ChartType, type ClipConform, type ClipSegment, type CodeOverlayContent, type CodeSmartOverlayContent, type ColumnDefinition, type Command, type CommandBuffer, CommandBufferBuilder, type CommandExecutionResult, CommandExecutor, CommandHistory, type CommandHistoryOptions, type CommandType, type ComparisonItem, type ComparisonOverlayContent, type ComparisonSmartOverlayContent, CompiledTextTemplate, type ComponentCategory, type ComponentDefinition, type ComponentNode, type CompositionPreset, type ComputedCell, type ComputedColumn, type ComputedNodeBounds, type ComputedRow, type ComputedSplitUnitTransform, type ConformMode, type ConnectorNode, type ContainerNode, type CountUpEasing, DEFAULT_TEXT_STYLE, DataBindingAuthoringEngine, DataBindingEngine, type DataBindingRule, type DataPreviewSet, type DeleteNodeCommand, type DeleteNodesCommand, type DependencyGraph, type DetachComponentCommand, type DimensionMode, type DividerNode, type DocumentCommand, DocumentMigrator, type DocumentPoint, DocumentValidator, type DocumentVariable, type DotLottieManifest, type DrawPerCharTextOptions, type DuplicateNodesCommand, EMPHASIS_PRESETS, ENTRANCE_PRESETS, EXIT_PRESETS, EXPORT_PROFILE_PRESETS, type EasingControlPoint, type EditorAddNodeCommand, type EditorCommand, EditorCommandSystem, type EditorCommandType, type EditorExecutionResult, EffectBevelSchema, EffectFillSchema, EffectFullDefinitionSchema, EffectGlowSchema, EffectIndexItemSchema, type EffectInstance, EffectLayer, EffectPanelSchema, EffectShadowSchema, EffectStackSchema, EffectStrokeSchema, type EncodedFileEntry, type EncodedOutput, type EvaluatedBroadcastFrame, type EvaluatedContent, type EvaluatedExportFrame, type EvaluatedMilestone, type EvaluatedNode, type EvaluatedNodeState, type EvaluatedScene, type EvaluatedSceneState, type EvaluatedStyle, type EvaluatedThreshold, type EvaluatedTransform, type EvaluatedVideoStateAtTime, type EvaluationDiagnostic, type ExecutionPlanner, type ExecutionPolicy, type ExecutionQuality, ExportAbortError, type ExportConfig, type ExportDiagnosticCode, type ExportDiagnosticSeverity, type ExportFormat, type ExportFrameDescriptor, ExportJob, type ExportJobRecord, type ExportProfile, type ExportProgress, type ExportValidationDiagnostic, ExportValidator, FONT_WEIGHT_OPTIONS, type FillType, type FocalPoint$1 as FocalPoint, type FontRef, FontRegistry, FontSchema, type FontSpec, type FrameGraph, FrameGraphBuilder, type FrameNode, type GaugeNode, type GaugeThreshold, GifEncoder, type GifExportOptions, type GifFrame, GlowLayer, type GradientDir, type GradientNode, GradientStop, GradientStopSchema, GraphValidator, GridEngine, type GroupNodesCommand, type HandleType, type IconNode, type ImageFitMode, type ImageFittingInput, type ImageFittingResult, ImageLayerSchema, type JobChangeListener, type JobStatus, Keyframe, type KeyframeTrack, LOOP_PRESETS, LOTTIE_ANIM_PRESETS, LOTTIE_TEMPLATE_PRESETS, LayerAnimationSchema, type LayoutComputedState, LayoutEngine, type LayoutMode, type LineNode, type ListOverlayContent, type ListOverlayItem, type ListSmartOverlayContent, LiveBroadcastBridge, type LiveBroadcastOptions, type LottieAnimPreset, type LottieFileInfo, type LottieFontEntry, type LottieFontUsage, type LottieGradientStop, type LottieKeyframe, type LottieNode, type LottiePropertyPath, type LottieTemplatePreset, type LowerThirdOverlayContent, type LowerThirdSmartOverlayContent, type MediaEncoder, MediaEncoderRegistry, type MediaFitMode, MediaImageEngine, type MediaLayout, type MetricDelta, MetricEngine, type MetricEvaluationResult, type MetricFormatOptions, type MetricNode, type MilestoneItem, type MotionPreset, type MotionPresetDefinition, type MotionPresetParameter, MotionPresetRegistry, type MoveNodesCommand, type Mp4ExportOptions, Mp4VideoEncoder, type NodeAnimationRules, type NodeConstraints, type NodeDefinition, type NodeLayoutRules, NodeRegistry, type NodeSizingPolicy, type NodeStartTransform, type NodeStyleRules, type NormalizedCrop, NullBackend, type OverlayDocument, type ParsedTextLayer, type PlaybackDirection, type PlaybackMode, PngSequenceEncoder, type PngSequenceFrame, type PngSequenceOptions, Preset, type PrimitiveDefinition, type PrimitiveMediaNode, PrimitiveRegistry, type PrimitiveShapeNode, type PrimitiveTextNode, ProResVideoEncoder, type ProfileCanvasDimensions, type ProgressNode, ProjectCompiler, ProjectHelper, type ProjectManifestV2, type PropertyAnimationDefinition, PropertyAnimationRegistry, type PropertyDefinition, PropertyInspectorEngine, PropertyInterpolator, type PropertySchemaField, type PropertyValueType, type PublishedOverlayArtifact, type QuoteOverlayContent, type QuoteSmartOverlayContent, RawFramesEncoder, type RecordedExecution, type RegisterAssetCommand, type RegisteredAsset, type RegisteredFont, type RemoveAssetCommand, type RemoveBreakpointCommand, type RemoveDataPreviewSetCommand, type RemoveTimelineMarkerCommand, type RemoveVariableCommand, type RenderBackend, type RenderPass, RenderPlan, type RendererCapabilities, type ReorderNodesCommand, type ReparentNodeCommand, type RepeaterNode, type ResizeHandle, type ResizeNodeCommand, type ResizeOptions, ResolveTemplateControlValuesOptions, type ResolvedAsset, type ResolvedFit, type ResolvedFont, type ResolvedImageDimensions, type ResolvedLayoutBounds, type ResolvedMediaLayout, type ResourceAllocation, type ResourceRequest, type ResourceState$1 as ResourceState, ResponsiveAnchorConfig, type ResponsiveNodeOverride, type RichTextNode, type RichTextSpan, RuntimeAssetResolver, type RuntimeContext, SMART_OVERLAY_PRESETS, SUPPORTED_FONT_FAMILIES, type SceneCanvasContext, SceneDocument, type SceneNode, type SceneNodeBase, type SceneNodeType, type ScratchElementBlock, type ScratchOverlayTemplate, type ScreenPoint, SelectionEngine, type SemanticAnimationConfig, type SemanticBehaviorConfig, type SemanticContent, type SemanticIntent, type SemanticOverlayDefinition, type SemanticSlotDefinition, type SemanticSpatialConstraints, SeriesEngine, type SeriesPoint, type SetActiveBreakpointCommand, type SetAssetRefCommand, type SetBindingCommand, type SetDocumentCommand, type SetFontRefCommand, type SetResponsiveOverrideCommand, type ShaderCompilation, type ShapeKind, ShapeLayerSchema, type ShotBoundary, type Size, type SizingDimensionInput, type SmartAlignmentGuide, SmartGuideEngine, type SmartOverlayAnimation, type SmartOverlayClip, type SmartOverlayContentUnion, type SmartOverlayLayout, type SmartOverlayPreset, type SmartOverlayRegistryItem, SmartOverlayRegistryService, SmartOverlayRenderer, type SmartOverlayStyle, type SmartOverlayType, type SmartSnapResult, SnapEngine, type SnapResult, type SocialOverlayContent, type SocialSmartOverlayContent, type SpatialAnchorConfig, type SpatialConstraintSpec, SplitMode, type SplitUnit, SpringParams, type StatOverlayContent, type StatSmartOverlayContent, StyleRecipe, type SubtitleRegion, TEMPLATE_CATEGORIES, type TableColumn, type TableLayoutResult, type TableNode, TemplateCategory, TemplateCategorySchema, TemplateCustomization, TemplateEasingFunction, TemplateKeyframe, TemplateLayer, TemplateLayerSchema, type TemplateManifest, type TemplatePresetCategory, TemplateRenderContext, TemplateRenderer, type TemporalKeyframedRegion, type TextAlign, type TextCustomization, TextEffectBuilder, TextEffectConfig, TextEffectDefinition, TextEffectDefinitionSchema, type TextLayerConfig, TextLayerSchema, type TextLayerStyle, type TextLayoutBounds, type TextLayoutResult, TextSplitAnimator, type TextStyleOverride, TextStyleSpan, TextTemplate, TextTemplateArtifact, type TextTemplateDiagnostic, TextTemplateSchema, type ThresholdBand, type TimelineEvent, type TimelineMarker, type TimelineNode, type TimelineOverlayContent, type TimelineOverlayNode, type TimelineSmartOverlayContent, type TrackDefinition, type TrackedSubject, type TranscriptSegment, TransformEngine, type UngroupNodesCommand, type UpdateAnimationCommand, type UpdateCanvasSizeCommand, type UpdateDataPreviewSetCommand, type UpdateDocumentMetaCommand, type UpdateKeyframeTracksCommand, type UpdateNodePropertyCommand, type UpdateNodeStyleCommand, type UpdatePropCommand, type UpdateStyleCommand, type UpdateTimelineMarkerCommand, type UpdateVariableCommand, type Command$1 as V2Command, VERSION, type ValidatedEffectDefinition, type ValidatedTextEffectDefinition, type ValidatedTextTemplate, type ValidationDiagnostic, type ValidationError, type ValidationResult, type VideoCodecProfile, type VideoContext, type VideoNode, type VideoPlaybackConfig, type ViewportState, ViewportTransform, type VirtualWindow, WEBM_EXPORT_MAX_FRAMES, WebMEncoder, type WebMExportOptions, _resetPlatformCache, addImageLayer, addKeyframe, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, alignToLottieJ, animationRuntime, animationValidator, applyEasing, applyFillColorToAll, applyLetterSpacing, applyMaskReveal, applyRecipeToScene, applyStyleToLottie, applyStyleToLottieLayer, applyTimelineAtTime, assertValidTextTemplateArtifact, assetRegistry, bakeAnimationIntoLayer, blendConfigs, blendScenes, buildDotLottie, buildFontEntries, buildLottieFontName, buildPngSequenceZip, builtInRecipes, calculateCropFromFocalPoint, calculateDefaultCoverCrop, calculateMediaFit, calculateResizeBounds, calculateRotationAngle, canonicalTemplateHash, captureImageSourceDimensions, captureLottieFrames, captureVideoSourceDimensions, clearAnimationFromLayer, clearFontCache, clearRecipeCache, cloneSceneWithNewIds, commandExecutor, compileSemanticOverlay, compileTextTemplate, componentRegistry, computeAutoFitFontSize, computeFitZoom, computeTextLayout, convertScratchTemplateToClip, countTextGlyphs, createBlankLottie, createBlankScratchTemplate, createCanvas, createDefaultRevealTrack, createDefaultScratchBlock, createKeyframed, createPulseOpacityTrack, cubicBezier, dataBindingAuthoringEngine, dataBindingEngine, deleteKeyframe, deserializeTemplate, documentMigrator, documentValidator, downloadDotLottie, downloadLottieJson, downloadLottieMp4, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, drawRoundedRect, duplicateTrackAtPlayhead, ease, editorCommandSystem, enableKeyframing, encodeGif, ensureDefaultTimeline, ensureFontInLottie, evaluateAnimatable, evaluateExportFrame, evaluateOverlayDocument, evaluateSplitTextTransforms, exportLottieToMp4, exportValidator, findTrackIndex, fontRegistry, formatValidationErrors, getAnimPreset, getAnimatableParamDef, getAnimatableParamsForLayer, getCanvasTemplatePreset, getCanvasTemplatesByCategory, getClipLayout, getDefaultText, getLayerById, getPresetScene, getSourceCropRect, getSpanForCharIndex, getSupportedWebMMimeType, getTemplatePreset, getTemplatesByCategory, getWebMFrameCount, hexToLottieColor, hexToLottieRgb, hitTestTransformHandles, injectBatch, injectColor, injectGlobalTextStyle, injectSolidColor, injectText, injectTextStyle, interpolateColorString, interpolateValue, isKeyframed, isMp4ExportSupported, isWebMExportSupported, layoutEngine, liveBroadcastBridge, loadLottieFonts, lottieColorToHex, lottieJToAlign, measureTextFits, measureTextWidth, mediaEncoderRegistry, motionPresetRegistry, moveKeyframe, normalizeTextTemplateArtifact, parseHistorySnapshot, parseLottieJson, preloadGoogleFont, presetToRecipe, primitiveRegistry, propertyAnimationRegistry, propertyInspectorEngine, propertyInterpolator, pruneTracksForLayer, rainbowCharFillColors, readLayerScalar, readStyleFromLottieLayer, reindexLayers, releaseCanvas, removeKeyframe, removeTemplateKeyframe, removeTrack, renderEvaluatedSceneToCanvas, renderPngSequence, renderSceneWebM, resizeCharFillColors, resolveAnchorPosition, resolveAnimatedScalar, resolveBehaviorToAnimationSpec, resolveConform, resolveDocumentForBreakpoint, resolveExportCanvasDimensions, resolveMediaLayout, resolveNodeForBreakpoint, resolveSpatialConstraints, resolveTemplateControlValues, restoreLetterSpacing, rotateCrop, runtimeAssetResolver, sampleVideoContextAtTime, scanLottieFonts, scanTextLayers, selectionEngine, serializeTemplate, setCharFillColor, setTracks, shouldUsePerCharFill, smartOverlayRegistry, snapEngine, snapshotScene, solveSpring, sortKeyframes, splitTextContent, streamExportFrames, supportsCtxFilter, supportsLetterSpacing, supportsOffscreenCanvas, supportsRoundRect, trackId, updateKeyframe, updateSceneBevel, updateSceneCanvas, updateSceneFill, updateSceneGlow, updateScenePanel, updateSceneShadow, updateSceneStack, updateSceneStroke, updateSceneText, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, validateEffectDefinition, validateEffectDefinitionStrict, validateTextEffectDefinition, validateTextEffectDefinitionStrict, validateTextTemplate, validateTextTemplateArtifact, validateTextTemplateStrict, viewportTransform, waitForFontsReady, wrapTextToWidth };
7242
+ export { ASPECT_RATIO_PRESETS, type AddBreakpointCommand, type AddDataPreviewSetCommand, type AddNodeCommand, type AddTimelineMarkerCommand, type AddVariableCommand, type AlignmentGuide, type AlignmentMode, type AnchorSide, type AnchorXMode, type AnchorYMode, type AnimBuildOpts, type AnimKeyframe, AnimTrack, type AnimTrackDef, type AnimatableParamDef, AnimatableValue, type AnimationCategory, type AnimationDiagnostic, type AnimationDiagnosticSeverity, type AnimationEvaluationOptions, AnimationPresetSchema, AnimationRuntime, AnimationSchema, type AnimationStartSpec, type AnimationState, AnimationValidator, type AnnotationNode, type ArcGeometryOutput, type AssetHandle, type AssetKind, type AssetManifest, type AssetRef, AssetRegistry$1 as AssetRegistry, type AssetScanResult, type AssetSource, type AudioNode, type AudioPlaybackConfig, type AvatarNode, type AvoidRegionKind, type AxisConfig, BUILTIN_CANVAS_TEMPLATES, type BarGeometryItem, type BaseCommand, type BaseEditorCommand, type BatchCommand, type BatchCommandsCommand, type BatchInjection, type BehaviorKind, type BehaviorSpec, BezierControlPoints, type BindingDefinition, type BodySegmentationOptions, type BodySegmentationRequest, type BodySegmentationResponse, type BodySegmentationRuntime, type BodySegmentationRuntimeConfig, type BoundingBox, BoundingBoxSchema, type BoundingRegion, type BreadcrumbItem, type Breakpoint, type BreakpointSet, COMPOSITION_PRESETS, type CalloutNode, CanvasDevice, type CanvasSnapResult, type ChartAnimationConfig, type ChartBarStyle, type ChartNode, type ChartScale, type ChartSeries, type ChartType, type ClipConform, type ClipSegment, type CodeOverlayContent, type CodeSmartOverlayContent, type ColumnDefinition, type Command, type CommandBuffer, CommandBufferBuilder, type CommandExecutionResult, CommandExecutor, CommandHistory, type CommandHistoryOptions, type CommandType, type ComparisonItem, type ComparisonOverlayContent, type ComparisonSmartOverlayContent, CompiledTextTemplate, type ComponentCategory, type ComponentDefinition, type ComponentNode, type CompositionPreset, type ComputedCell, type ComputedColumn, type ComputedNodeBounds, type ComputedRow, type ComputedSplitUnitTransform, type ConformMode, type ConnectorNode, type ContainerNode, type CountUpEasing, DEFAULT_TEXT_STYLE, DataBindingAuthoringEngine, DataBindingEngine, type DataBindingRule, type DataPreviewSet, type DeleteNodeCommand, type DeleteNodesCommand, type DependencyGraph, type DetachComponentCommand, type DimensionMode, type DividerNode, type DocumentCommand, DocumentMigrator, type DocumentPoint, DocumentValidator, type DocumentVariable, type DotLottieManifest, type DrawPerCharTextOptions, type DuplicateNodesCommand, EMPHASIS_PRESETS, ENTRANCE_PRESETS, EXIT_PRESETS, EXPORT_PROFILE_PRESETS, type EasingControlPoint, type EditorAddNodeCommand, type EditorCommand, EditorCommandSystem, type EditorCommandType, type EditorExecutionResult, EffectBevelSchema, EffectFillSchema, EffectFullDefinitionSchema, EffectGlowSchema, EffectIndexItemSchema, type EffectInstance, EffectLayer, EffectPanelSchema, EffectShadowSchema, EffectStackSchema, EffectStrokeSchema, type EncodedFileEntry, type EncodedOutput, type EvaluatedBroadcastFrame, type EvaluatedContent, type EvaluatedExportFrame, type EvaluatedMilestone, type EvaluatedNode, type EvaluatedNodeState, type EvaluatedScene, type EvaluatedSceneState, type EvaluatedStyle, type EvaluatedThreshold, type EvaluatedTransform, type EvaluatedVideoStateAtTime, type EvaluationDiagnostic, type ExecutionPlanner, type ExecutionPolicy, type ExecutionQuality, ExportAbortError, type ExportConfig, type ExportDiagnosticCode, type ExportDiagnosticSeverity, type ExportFormat, type ExportFrameDescriptor, ExportJob, type ExportJobRecord, type ExportProfile, type ExportProgress, type ExportValidationDiagnostic, ExportValidator, FONT_WEIGHT_OPTIONS, type FillType, type FocalPoint$1 as FocalPoint, type FontRef, FontRegistry, FontSchema, type FontSpec, type FrameGraph, FrameGraphBuilder, type FrameNode, type GaugeNode, type GaugeThreshold, GifEncoder, type GifExportOptions, type GifFrame, GlowLayer, type GradientDir, type GradientNode, GradientStop, GradientStopSchema, GraphValidator, GridEngine, type GroupNodesCommand, type HandleType, type IconNode, type ImageFitMode, type ImageFittingInput, type ImageFittingResult, ImageLayerSchema, type JobChangeListener, type JobStatus, Keyframe, type KeyframeTrack, LOOP_PRESETS, LOTTIE_ANIM_PRESETS, LOTTIE_TEMPLATE_PRESETS, LayerAnimationSchema, type LayoutComputedState, LayoutEngine, type LayoutMode, type LineNode, type ListOverlayContent, type ListOverlayItem, type ListSmartOverlayContent, LiveBroadcastBridge, type LiveBroadcastOptions, type LottieAnimPreset, type LottieFileInfo, type LottieFontEntry, type LottieFontUsage, type LottieGradientStop, type LottieKeyframe, type LottieNode, type LottiePropertyPath, type LottieScanResult, type LottieTemplatePreset, type LowerThirdOverlayContent, type LowerThirdSmartOverlayContent, MAX_ASSET_BYTES, MAX_LOTTIE_BYTES, type MediaEncoder, MediaEncoderRegistry, type MediaFitMode, MediaImageEngine, type MediaLayout, type MetricDelta, MetricEngine, type MetricEvaluationResult, type MetricFormatOptions, type MetricNode, type MilestoneItem, type MotionPreset, type MotionPresetDefinition, type MotionPresetParameter, MotionPresetRegistry, type MoveNodesCommand, type Mp4ExportOptions, Mp4VideoEncoder, type NodeAnimationRules, type NodeConstraints, type NodeDefinition, type NodeLayoutRules, NodeRegistry, type NodeSizingPolicy, type NodeStartTransform, type NodeStyleRules, type NormalizedCrop, NullBackend, type OverlayDocument, type ParsedTextLayer, type PlaybackDirection, type PlaybackMode, PngSequenceEncoder, type PngSequenceFrame, type PngSequenceOptions, Preset, type PrimitiveDefinition, type PrimitiveMediaNode, PrimitiveRegistry, type PrimitiveShapeNode, type PrimitiveTextNode, ProResVideoEncoder, type ProfileCanvasDimensions, type ProgressNode, ProjectCompiler, ProjectHelper, type ProjectManifestV2, type PropertyAnimationDefinition, PropertyAnimationRegistry, type PropertyDefinition, PropertyInspectorEngine, PropertyInterpolator, type PropertySchemaField, type PropertyValueType, type PublishedOverlayArtifact, type QuoteOverlayContent, type QuoteSmartOverlayContent, RawFramesEncoder, type RecordedExecution, type RegisterAssetCommand, type RegisteredAsset, type RegisteredFont, type RemoveAssetCommand, type RemoveBreakpointCommand, type RemoveDataPreviewSetCommand, type RemoveTimelineMarkerCommand, type RemoveVariableCommand, type RenderBackend, type RenderPass, RenderPlan, type RendererCapabilities, type ReorderNodesCommand, type ReparentNodeCommand, type RepeaterNode, type ResizeHandle, type ResizeNodeCommand, type ResizeOptions, ResolveTemplateControlValuesOptions, type ResolvedAsset, type ResolvedFit, type ResolvedFont, type ResolvedImageDimensions, type ResolvedLayoutBounds, type ResolvedMediaLayout, type ResourceAllocation, type ResourceRequest, type ResourceState$1 as ResourceState, ResponsiveAnchorConfig, type ResponsiveNodeOverride, type RichTextNode, type RichTextSpan, RuntimeAssetResolver, type RuntimeContext, SMART_OVERLAY_PRESETS, SUPPORTED_FONT_FAMILIES, type SceneCanvasContext, SceneDocument, type SceneNode, type SceneNodeBase, type SceneNodeType, type ScratchElementBlock, type ScratchOverlayTemplate, type ScreenPoint, SelectionEngine, type SemanticAnimationConfig, type SemanticBehaviorConfig, type SemanticContent, type SemanticIntent, type SemanticOverlayDefinition, type SemanticSlotDefinition, type SemanticSpatialConstraints, SeriesEngine, type SeriesPoint, type SetActiveBreakpointCommand, type SetAssetRefCommand, type SetBindingCommand, type SetDocumentCommand, type SetFontRefCommand, type SetResponsiveOverrideCommand, type ShaderCompilation, type ShapeKind, ShapeLayerSchema, type ShotBoundary, type Size, type SizingDimensionInput, type SmartAlignmentGuide, SmartGuideEngine, type SmartOverlayAnimation, type SmartOverlayClip, type SmartOverlayContentUnion, type SmartOverlayLayout, type SmartOverlayPreset, type SmartOverlayRegistryItem, SmartOverlayRegistryService, SmartOverlayRenderer, type SmartOverlayStyle, type SmartOverlayType, type SmartSnapResult, SnapEngine, type SnapResult, type SocialOverlayContent, type SocialSmartOverlayContent, type SpatialAnchorConfig, type SpatialConstraintSpec, SplitMode, type SplitUnit, SpringParams, type StatOverlayContent, type StatSmartOverlayContent, StyleRecipe, type SubtitleRegion, TEMPLATE_CATEGORIES, type TableColumn, type TableLayoutResult, type TableNode, TemplateCategory, TemplateCategorySchema, TemplateCustomization, TemplateEasingFunction, TemplateKeyframe, TemplateLayer, TemplateLayerSchema, type TemplateManifest, type TemplatePresetCategory, TemplateRenderContext, TemplateRenderer, type TemporalKeyframedRegion, type TextAlign, type TextCustomization, TextEffectBuilder, TextEffectConfig, TextEffectDefinition, TextEffectDefinitionSchema, type TextLayerConfig, TextLayerSchema, type TextLayerStyle, type TextLayoutBounds, type TextLayoutResult, TextSplitAnimator, type TextStyleOverride, TextStyleSpan, TextTemplate, TextTemplateArtifact, type TextTemplateDiagnostic, TextTemplateSchema, type ThresholdBand, type TimelineEvent, type TimelineMarker, type TimelineNode, type TimelineOverlayContent, type TimelineOverlayNode, type TimelineSmartOverlayContent, type TrackDefinition, type TrackedSubject, type TranscriptSegment, TransformEngine, type UngroupNodesCommand, type UpdateAnimationCommand, type UpdateCanvasSizeCommand, type UpdateDataPreviewSetCommand, type UpdateDocumentMetaCommand, type UpdateKeyframeTracksCommand, type UpdateNodePropertyCommand, type UpdateNodeStyleCommand, type UpdatePropCommand, type UpdateStyleCommand, type UpdateTimelineMarkerCommand, type UpdateVariableCommand, type Command$1 as V2Command, VERSION, type ValidatedEffectDefinition, type ValidatedTextEffectDefinition, type ValidatedTextTemplate, type ValidationDiagnostic, type ValidationError, type ValidationResult, type VideoCodecProfile, type VideoContext, type VideoNode, type VideoPlaybackConfig, type ViewportState, ViewportTransform, type VirtualWindow, WEBM_EXPORT_MAX_FRAMES, WebMEncoder, type WebMExportOptions, _resetPlatformCache, addImageLayer, addKeyframe, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, alignToLottieJ, animationRuntime, animationValidator, applyEasing, applyFillColorToAll, applyLetterSpacing, applyMaskReveal, applyRecipeToScene, applyStyleToLottie, applyStyleToLottieLayer, applyTimelineAtTime, assertValidTextTemplateArtifact, assetRegistry, bakeAnimationIntoLayer, blendConfigs, blendScenes, buildDotLottie, buildFontEntries, buildLottieFontName, buildPngSequenceZip, builtInRecipes, calculateCropFromFocalPoint, calculateDefaultCoverCrop, calculateMediaFit, calculateResizeBounds, calculateRotationAngle, calculateSha256, canonicalTemplateHash, captureImageSourceDimensions, captureLottieFrames, captureVideoSourceDimensions, clearAnimationFromLayer, clearFontCache, clearRecipeCache, cloneSceneWithNewIds, commandExecutor, compileSemanticOverlay, compileTextTemplate, componentRegistry, computeAutoFitFontSize, computeFitZoom, computeTextLayout, convertScratchTemplateToClip, countTextGlyphs, createBlankLottie, createBlankScratchTemplate, createCanvas, createDefaultRevealTrack, createDefaultScratchBlock, createKeyframed, createPulseOpacityTrack, cubicBezier, dataBindingAuthoringEngine, dataBindingEngine, deleteKeyframe, deserializeTemplate, documentMigrator, documentValidator, downloadDotLottie, downloadLottieJson, downloadLottieMp4, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, drawRoundedRect, duplicateTrackAtPlayhead, ease, editorCommandSystem, enableKeyframing, encodeGif, ensureDefaultTimeline, ensureFontInLottie, evaluateAnimatable, evaluateExportFrame, evaluateOverlayDocument, evaluateSplitTextTransforms, exportLottieToMp4, exportValidator, findTrackIndex, fontRegistry, formatValidationErrors, getAnimPreset, getAnimatableParamDef, getAnimatableParamsForLayer, getCanvasTemplatePreset, getCanvasTemplatesByCategory, getClipLayout, getDefaultText, getLayerById, getPresetScene, getSourceCropRect, getSpanForCharIndex, getSupportedWebMMimeType, getTemplatePreset, getTemplatesByCategory, getWebMFrameCount, hexToLottieColor, hexToLottieRgb, hitTestTransformHandles, injectBatch, injectColor, injectGlobalTextStyle, injectSolidColor, injectText, injectTextStyle, inspectLottieJson, inspectStickerAsset, interpolateColorString, interpolateValue, isKeyframed, isMp4ExportSupported, isWebMExportSupported, layoutEngine, liveBroadcastBridge, loadLottieFonts, lottieColorToHex, lottieJToAlign, measureTextFits, measureTextWidth, mediaEncoderRegistry, motionPresetRegistry, moveKeyframe, normalizeTextTemplateArtifact, parseHistorySnapshot, parseLottieJson, preloadGoogleFont, presetToRecipe, primitiveRegistry, propertyAnimationRegistry, propertyInspectorEngine, propertyInterpolator, pruneTracksForLayer, rainbowCharFillColors, readLayerScalar, readStyleFromLottieLayer, reindexLayers, releaseCanvas, removeKeyframe, removeTemplateKeyframe, removeTrack, renderEvaluatedSceneToCanvas, renderPngSequence, renderSceneWebM, resizeCharFillColors, resolveAnchorPosition, resolveAnimatedScalar, resolveBehaviorToAnimationSpec, resolveConform, resolveDocumentForBreakpoint, resolveExportCanvasDimensions, resolveMediaLayout, resolveNodeForBreakpoint, resolveSpatialConstraints, resolveTemplateControlValues, restoreLetterSpacing, rotateCrop, runtimeAssetResolver, sampleVideoContextAtTime, scanLottieFonts, scanLottieNodes, scanTextLayers, selectionEngine, serializeTemplate, setCharFillColor, setTracks, shouldUsePerCharFill, smartOverlayRegistry, snapEngine, snapshotScene, solveSpring, sortKeyframes, splitTextContent, streamExportFrames, supportsCtxFilter, supportsLetterSpacing, supportsOffscreenCanvas, supportsRoundRect, trackId, updateKeyframe, updateSceneBevel, updateSceneCanvas, updateSceneFill, updateSceneGlow, updateScenePanel, updateSceneShadow, updateSceneStack, updateSceneStroke, updateSceneText, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, validateEffectDefinition, validateEffectDefinitionStrict, validateTextEffectDefinition, validateTextEffectDefinitionStrict, validateTextTemplate, validateTextTemplateArtifact, validateTextTemplateStrict, viewportTransform, waitForFontsReady, wrapTextToWidth };
package/dist/index.js CHANGED
@@ -17635,6 +17635,170 @@ function renderEvaluatedSceneToCanvas(scene, ctx, options = {}) {
17635
17635
  scene.nodes.forEach((node) => drawNode(ctx, node, scene.time));
17636
17636
  }
17637
17637
 
17638
+ // src/stickers/stickerScanner.ts
17639
+ var MAX_LOTTIE_BYTES = 300 * 1024;
17640
+ var MAX_ASSET_BYTES = 2 * 1024 * 1024;
17641
+ function scanLottieNodes(node, found = { expressions: 0, remoteUrls: 0 }) {
17642
+ if (Array.isArray(node)) {
17643
+ for (const item of node) {
17644
+ scanLottieNodes(item, found);
17645
+ }
17646
+ } else if (node && typeof node === "object") {
17647
+ if (typeof node.x === "string" && node.x.trim() !== "" && "k" in node) {
17648
+ found.expressions++;
17649
+ }
17650
+ for (const value of Object.values(node)) {
17651
+ scanLottieNodes(value, found);
17652
+ }
17653
+ } else if (typeof node === "string" && /^https?:\/\//i.test(node)) {
17654
+ found.remoteUrls++;
17655
+ }
17656
+ return found;
17657
+ }
17658
+ function inspectLottieJson(jsonOrString) {
17659
+ const errors = [];
17660
+ let json;
17661
+ if (typeof jsonOrString === "string") {
17662
+ try {
17663
+ json = JSON.parse(jsonOrString);
17664
+ } catch (err) {
17665
+ return { valid: false, errors: [`Lottie file is not valid JSON: ${err.message}`] };
17666
+ }
17667
+ } else {
17668
+ json = jsonOrString;
17669
+ }
17670
+ if (!json || typeof json !== "object") {
17671
+ return { valid: false, errors: ["Lottie data must be a JSON object"] };
17672
+ }
17673
+ for (const field of ["v", "fr", "ip", "op", "w", "h", "layers"]) {
17674
+ if (!(field in json)) {
17675
+ errors.push(`Lottie header missing required field "${field}"`);
17676
+ }
17677
+ }
17678
+ const found = scanLottieNodes(json);
17679
+ if (found.expressions > 0) {
17680
+ errors.push(`Lottie contains ${found.expressions} expression(s); expressions are strictly forbidden`);
17681
+ }
17682
+ if (found.remoteUrls > 0) {
17683
+ errors.push(`Lottie references ${found.remoteUrls} remote URL(s); all assets must be embedded`);
17684
+ }
17685
+ const fps = typeof json.fr === "number" && json.fr > 0 ? json.fr : 30;
17686
+ const ip = typeof json.ip === "number" ? json.ip : 0;
17687
+ const op = typeof json.op === "number" ? json.op : ip;
17688
+ const durationMs = Math.round((op - ip) / fps * 1e3);
17689
+ const layerCount = Array.isArray(json.layers) ? json.layers.length : 0;
17690
+ const width = Math.round(Number(json.w || 0));
17691
+ const height = Math.round(Number(json.h || 0));
17692
+ if (width < 16 || width > 2048) {
17693
+ errors.push(`Lottie width ${width} is outside permitted range [16, 2048]`);
17694
+ }
17695
+ if (height < 16 || height > 2048) {
17696
+ errors.push(`Lottie height ${height} is outside permitted range [16, 2048]`);
17697
+ }
17698
+ return {
17699
+ valid: errors.length === 0,
17700
+ errors,
17701
+ dimensions: { width, height },
17702
+ animation: {
17703
+ durationMs: Math.max(1, durationMs),
17704
+ fps,
17705
+ loop: true,
17706
+ lottie: {
17707
+ layerCount,
17708
+ hasExpressions: false
17709
+ }
17710
+ }
17711
+ };
17712
+ }
17713
+ function inspectStickerAsset(data, filenameHint = "") {
17714
+ const errors = [];
17715
+ let u8;
17716
+ if (typeof data === "string") {
17717
+ u8 = new TextEncoder().encode(data);
17718
+ } else if (data instanceof Uint8Array) {
17719
+ u8 = data;
17720
+ } else {
17721
+ u8 = new Uint8Array(data);
17722
+ }
17723
+ const bytes = u8.length;
17724
+ const isPng = u8.length >= 8 && u8[0] === 137 && u8[1] === 80 && u8[2] === 78 && u8[3] === 71 && u8[4] === 13 && u8[5] === 10 && u8[6] === 26 && u8[7] === 10;
17725
+ const isWebp = u8.length >= 12 && u8[0] === 82 && u8[1] === 73 && u8[2] === 70 && u8[3] === 70 && u8[8] === 87 && u8[9] === 69 && u8[10] === 66 && u8[11] === 80;
17726
+ const isJson = !isPng && !isWebp && (filenameHint.toLowerCase().endsWith(".json") || u8[0] === 123);
17727
+ const isSvg = !isPng && !isWebp && !isJson && (filenameHint.toLowerCase().endsWith(".svg") || u8[0] === 60);
17728
+ if (isJson) {
17729
+ if (bytes > MAX_LOTTIE_BYTES) {
17730
+ errors.push(`Lottie file size (${bytes} bytes) exceeds maximum limit of ${MAX_LOTTIE_BYTES} bytes (300 KB)`);
17731
+ }
17732
+ const text = new TextDecoder("utf8").decode(u8);
17733
+ const lottieScan = inspectLottieJson(text);
17734
+ if (!lottieScan.valid) {
17735
+ errors.push(...lottieScan.errors);
17736
+ }
17737
+ return {
17738
+ valid: errors.length === 0,
17739
+ errors,
17740
+ bytes,
17741
+ mime: "application/json",
17742
+ dimensions: lottieScan.dimensions,
17743
+ animation: lottieScan.animation
17744
+ };
17745
+ }
17746
+ if (bytes > MAX_ASSET_BYTES) {
17747
+ errors.push(`Asset file size (${bytes} bytes) exceeds maximum limit of ${MAX_ASSET_BYTES} bytes (2 MB)`);
17748
+ }
17749
+ if (isPng) {
17750
+ let width = 0;
17751
+ let height = 0;
17752
+ if (u8.length >= 24) {
17753
+ const view = new DataView(u8.buffer, u8.byteOffset, u8.byteLength);
17754
+ width = view.getUint32(16);
17755
+ height = view.getUint32(20);
17756
+ }
17757
+ return {
17758
+ valid: errors.length === 0,
17759
+ errors,
17760
+ bytes,
17761
+ mime: "image/png",
17762
+ dimensions: width > 0 && height > 0 ? { width, height } : void 0
17763
+ };
17764
+ }
17765
+ if (isWebp) {
17766
+ return {
17767
+ valid: errors.length === 0,
17768
+ errors,
17769
+ bytes,
17770
+ mime: "image/webp"
17771
+ };
17772
+ }
17773
+ if (isSvg) {
17774
+ return {
17775
+ valid: errors.length === 0,
17776
+ errors,
17777
+ bytes,
17778
+ mime: "image/svg+xml"
17779
+ };
17780
+ }
17781
+ return {
17782
+ valid: false,
17783
+ errors: ["Unsupported file format; allowed formats are Lottie JSON, WebP, PNG, and SVG"],
17784
+ bytes,
17785
+ mime: "application/octet-stream"
17786
+ };
17787
+ }
17788
+ async function calculateSha256(data) {
17789
+ const u8 = typeof data === "string" ? new TextEncoder().encode(data) : data instanceof Uint8Array ? data : new Uint8Array(data);
17790
+ if (typeof crypto !== "undefined" && crypto.subtle) {
17791
+ const hashBuf = await crypto.subtle.digest("SHA-256", u8);
17792
+ return Array.from(new Uint8Array(hashBuf)).map((b) => b.toString(16).padStart(2, "0")).join("");
17793
+ }
17794
+ try {
17795
+ const nodeCrypto = await import("crypto");
17796
+ return nodeCrypto.createHash("sha256").update(u8).digest("hex");
17797
+ } catch {
17798
+ throw new Error("No cryptographic hash implementation available");
17799
+ }
17800
+ }
17801
+
17638
17802
  // src/index.ts
17639
17803
  var VERSION = "1.4.0";
17640
17804
  export {
@@ -17702,6 +17866,8 @@ export {
17702
17866
  LayerAnimationSchema,
17703
17867
  LayoutEngine,
17704
17868
  LiveBroadcastBridge,
17869
+ MAX_ASSET_BYTES,
17870
+ MAX_LOTTIE_BYTES,
17705
17871
  MediaEncoderRegistry,
17706
17872
  MediaImageEngine,
17707
17873
  MetricEngine,
@@ -17791,6 +17957,7 @@ export {
17791
17957
  calculateMediaFit,
17792
17958
  calculateResizeBounds,
17793
17959
  calculateRotationAngle,
17960
+ calculateSha256,
17794
17961
  canonicalContentHash,
17795
17962
  canonicalTemplateHash,
17796
17963
  canonicalizeSceneDocument,
@@ -17907,6 +18074,8 @@ export {
17907
18074
  injectSolidColor,
17908
18075
  injectText,
17909
18076
  injectTextStyle,
18077
+ inspectLottieJson,
18078
+ inspectStickerAsset,
17910
18079
  interpolateColorString,
17911
18080
  interpolateValue,
17912
18081
  isKeyframed,
@@ -17974,6 +18143,7 @@ export {
17974
18143
  runtimeAssetResolver,
17975
18144
  sampleVideoContextAtTime,
17976
18145
  scanLottieFonts,
18146
+ scanLottieNodes,
17977
18147
  scanTextLayers,
17978
18148
  sceneToConfig,
17979
18149
  searchEffects,