@octane-xplat/lottie 0.9.0 → 0.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/README.md +36 -16
- package/dist/native/index.js +10 -9
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/index.js +39 -25
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +25 -3
- package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
- package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
- package/platforms/macos/UPSTREAM.md +13 -0
- package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
- package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
- package/src/Lottie.macos.tsrx +129 -0
- package/src/Lottie.tsrx +3 -2
- package/src/Lottie.web.tsrx +28 -11
- package/src/index.macos.ts +2 -0
- package/src/props.ts +6 -1
- package/types/generated/props.d.ts +5 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Data+Serialization.swift
|
|
3
|
+
// ZIPFoundation
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2017-2025 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors.
|
|
6
|
+
// Released under the MIT License.
|
|
7
|
+
//
|
|
8
|
+
// See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information.
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import Foundation
|
|
12
|
+
|
|
13
|
+
#if os(Android)
|
|
14
|
+
typealias FILEPointer = OpaquePointer
|
|
15
|
+
#else
|
|
16
|
+
typealias FILEPointer = UnsafeMutablePointer<FILE>
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
// MARK: - DataSerializable
|
|
20
|
+
|
|
21
|
+
protocol DataSerializable {
|
|
22
|
+
init?(data: Data, additionalDataProvider: (Int) throws -> Data)
|
|
23
|
+
|
|
24
|
+
static var size: Int { get }
|
|
25
|
+
|
|
26
|
+
var data: Data { get }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
extension Data {
|
|
30
|
+
enum DataError: Error {
|
|
31
|
+
case unreadableFile
|
|
32
|
+
case unwritableFile
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static func readStruct<T: DataSerializable>(from file: FILEPointer, at offset: UInt64)
|
|
36
|
+
-> T?
|
|
37
|
+
{
|
|
38
|
+
guard offset <= .max else { return nil }
|
|
39
|
+
fseeko(file, off_t(offset), SEEK_SET)
|
|
40
|
+
guard let data = try? readChunk(of: T.size, from: file) else {
|
|
41
|
+
return nil
|
|
42
|
+
}
|
|
43
|
+
return T(data: data, additionalDataProvider: { additionalDataSize -> Data in
|
|
44
|
+
return try self.readChunk(of: additionalDataSize, from: file)
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static func consumePart(
|
|
49
|
+
of size: Int64,
|
|
50
|
+
chunkSize: Int,
|
|
51
|
+
skipCRC32: Bool = false,
|
|
52
|
+
provider: Provider,
|
|
53
|
+
consumer: Consumer
|
|
54
|
+
) throws -> CRC32 {
|
|
55
|
+
var checksum = CRC32(0)
|
|
56
|
+
guard size > 0 else {
|
|
57
|
+
try consumer(Data())
|
|
58
|
+
return checksum
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let readInOneChunk = (size < chunkSize)
|
|
62
|
+
var chunkSize = readInOneChunk ? Int(size) : chunkSize
|
|
63
|
+
var bytesRead: Int64 = 0
|
|
64
|
+
while bytesRead < size {
|
|
65
|
+
let remainingSize = size - bytesRead
|
|
66
|
+
chunkSize = remainingSize < chunkSize ? Int(remainingSize) : chunkSize
|
|
67
|
+
let data = try provider(bytesRead, chunkSize)
|
|
68
|
+
try consumer(data)
|
|
69
|
+
if !skipCRC32 {
|
|
70
|
+
checksum = data.crc32(checksum: checksum)
|
|
71
|
+
}
|
|
72
|
+
bytesRead += Int64(chunkSize)
|
|
73
|
+
}
|
|
74
|
+
return checksum
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static func readChunk(of size: Int, from file: FILEPointer) throws -> Data {
|
|
78
|
+
let alignment = MemoryLayout<UInt>.alignment
|
|
79
|
+
#if swift(>=4.1)
|
|
80
|
+
let bytes = UnsafeMutableRawPointer.allocate(byteCount: size, alignment: alignment)
|
|
81
|
+
#else
|
|
82
|
+
let bytes = UnsafeMutableRawPointer.allocate(bytes: size, alignedTo: alignment)
|
|
83
|
+
#endif
|
|
84
|
+
let bytesRead = fread(bytes, 1, size, file)
|
|
85
|
+
let error = ferror(file)
|
|
86
|
+
if error > 0 {
|
|
87
|
+
bytes.deallocate()
|
|
88
|
+
throw DataError.unreadableFile
|
|
89
|
+
}
|
|
90
|
+
#if swift(>=4.1)
|
|
91
|
+
return Data(bytesNoCopy: bytes, count: bytesRead, deallocator: .custom { buf, _ in buf.deallocate() })
|
|
92
|
+
#else
|
|
93
|
+
let deallocator = Deallocator.custom { buf, _ in buf.deallocate(bytes: size, alignedTo: 1) }
|
|
94
|
+
return Data(bytesNoCopy: bytes, count: bytesRead, deallocator: deallocator)
|
|
95
|
+
#endif
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static func write(chunk: Data, to file: FILEPointer) throws -> Int {
|
|
99
|
+
var sizeWritten = 0
|
|
100
|
+
chunk.withUnsafeBytes { rawBufferPointer in
|
|
101
|
+
if let baseAddress = rawBufferPointer.baseAddress, rawBufferPointer.count > 0 {
|
|
102
|
+
let pointer = baseAddress.assumingMemoryBound(to: UInt8.self)
|
|
103
|
+
sizeWritten = fwrite(pointer, 1, chunk.count, file)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
let error = ferror(file)
|
|
107
|
+
if error > 0 {
|
|
108
|
+
throw DataError.unwritableFile
|
|
109
|
+
}
|
|
110
|
+
return sizeWritten
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static func writeLargeChunk(
|
|
114
|
+
_ chunk: Data,
|
|
115
|
+
size: UInt64,
|
|
116
|
+
bufferSize: Int,
|
|
117
|
+
to file: FILEPointer
|
|
118
|
+
) throws -> UInt64 {
|
|
119
|
+
var sizeWritten: UInt64 = 0
|
|
120
|
+
chunk.withUnsafeBytes { rawBufferPointer in
|
|
121
|
+
if let baseAddress = rawBufferPointer.baseAddress, rawBufferPointer.count > 0 {
|
|
122
|
+
let pointer = baseAddress.assumingMemoryBound(to: UInt8.self)
|
|
123
|
+
|
|
124
|
+
while sizeWritten < size {
|
|
125
|
+
let remainingSize = size - sizeWritten
|
|
126
|
+
let chunkSize = Swift.min(Int(remainingSize), bufferSize)
|
|
127
|
+
let curPointer = pointer.advanced(by: Int(sizeWritten))
|
|
128
|
+
fwrite(curPointer, 1, chunkSize, file)
|
|
129
|
+
sizeWritten += UInt64(chunkSize)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
let error = ferror(file)
|
|
134
|
+
if error > 0 {
|
|
135
|
+
throw DataError.unwritableFile
|
|
136
|
+
}
|
|
137
|
+
return sizeWritten
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
func scanValue<T>(start: Int) -> T {
|
|
141
|
+
withUnsafeBytes {
|
|
142
|
+
$0.loadUnaligned(fromByteOffset: start, as: T.self)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Date+ZIP.swift
|
|
3
|
+
// ZIPFoundation
|
|
4
|
+
//
|
|
5
|
+
// Created by Thomas Zoechling on 20.12.22.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
extension Date {
|
|
11
|
+
|
|
12
|
+
// MARK: Lifecycle
|
|
13
|
+
|
|
14
|
+
init(dateTime: (UInt16, UInt16)) {
|
|
15
|
+
var msdosDateTime = Int(dateTime.0)
|
|
16
|
+
msdosDateTime <<= 16
|
|
17
|
+
msdosDateTime |= Int(dateTime.1)
|
|
18
|
+
var unixTime = tm()
|
|
19
|
+
unixTime.tm_sec = Int32((msdosDateTime & 31) * 2)
|
|
20
|
+
unixTime.tm_min = Int32((msdosDateTime >> 5) & 63)
|
|
21
|
+
unixTime.tm_hour = Int32((Int(dateTime.1) >> 11) & 31)
|
|
22
|
+
unixTime.tm_mday = Int32((msdosDateTime >> 16) & 31)
|
|
23
|
+
unixTime.tm_mon = Int32((msdosDateTime >> 21) & 15)
|
|
24
|
+
unixTime.tm_mon -= 1 // UNIX time struct month entries are zero based.
|
|
25
|
+
unixTime.tm_year = Int32(1980 + (msdosDateTime >> 25))
|
|
26
|
+
unixTime.tm_year -= 1900 // UNIX time structs count in "years since 1900".
|
|
27
|
+
let time = timegm(&unixTime)
|
|
28
|
+
self = Date(timeIntervalSince1970: TimeInterval(time))
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
init(timespec: timespec) {
|
|
32
|
+
let seconds = 1.0e-9 * Double(timespec.tv_nsec)
|
|
33
|
+
let timeIntervalSince1970 = TimeInterval(timespec.tv_sec)
|
|
34
|
+
let absoluteTimeIntervalSince1970 = Constants.absoluteTimeIntervalSince1970
|
|
35
|
+
self.init(timeIntervalSinceReferenceDate: (timeIntervalSince1970 - absoluteTimeIntervalSince1970) + seconds)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// MARK: Internal
|
|
39
|
+
|
|
40
|
+
var fileModificationDateTime: (UInt16, UInt16) {
|
|
41
|
+
(fileModificationDate, fileModificationTime)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var fileModificationDate: UInt16 {
|
|
45
|
+
var time = time_t(timeIntervalSince1970)
|
|
46
|
+
guard let unixTime = gmtime(&time) else {
|
|
47
|
+
return 0
|
|
48
|
+
}
|
|
49
|
+
var year = unixTime.pointee.tm_year + 1900 // UNIX time structs count in "years since 1900".
|
|
50
|
+
// ZIP uses the MSDOS date format which has a valid range of 1980 - 2099.
|
|
51
|
+
year = year >= 1980 ? year : 1980
|
|
52
|
+
year = year <= 2099 ? year : 2099
|
|
53
|
+
let month = unixTime.pointee.tm_mon + 1 // UNIX time struct month entries are zero based.
|
|
54
|
+
let day = unixTime.pointee.tm_mday
|
|
55
|
+
return UInt16(day + (month * 32) + ((year - 1980) * 512))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var fileModificationTime: UInt16 {
|
|
59
|
+
var time = time_t(timeIntervalSince1970)
|
|
60
|
+
guard let unixTime = gmtime(&time) else {
|
|
61
|
+
return 0
|
|
62
|
+
}
|
|
63
|
+
let hour = unixTime.pointee.tm_hour
|
|
64
|
+
let minute = unixTime.pointee.tm_min
|
|
65
|
+
let second = unixTime.pointee.tm_sec
|
|
66
|
+
return UInt16((second / 2) + (minute * 32) + (hour * 2048))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// MARK: - Date.Constants
|
|
72
|
+
|
|
73
|
+
extension Date {
|
|
74
|
+
|
|
75
|
+
fileprivate enum Constants {
|
|
76
|
+
#if os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS)
|
|
77
|
+
static let absoluteTimeIntervalSince1970 = kCFAbsoluteTimeIntervalSince1970
|
|
78
|
+
#else
|
|
79
|
+
static let absoluteTimeIntervalSince1970 = 978307200.0
|
|
80
|
+
#endif
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
extension stat {
|
|
85
|
+
|
|
86
|
+
var lastAccessDate: Date {
|
|
87
|
+
#if os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS)
|
|
88
|
+
return Date(timespec: st_atimespec)
|
|
89
|
+
#else
|
|
90
|
+
return Date(timespec: st_atim)
|
|
91
|
+
#endif
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
extension timeval {
|
|
96
|
+
|
|
97
|
+
init(timeIntervalSince1970: TimeInterval) {
|
|
98
|
+
let (integral, fractional) = modf(timeIntervalSince1970)
|
|
99
|
+
self.init(tv_sec: time_t(integral), tv_usec: suseconds_t(1.0e6 * fractional))
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Entry+Serialization.swift
|
|
3
|
+
// ZIPFoundation
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2017-2025 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors.
|
|
6
|
+
// Released under the MIT License.
|
|
7
|
+
//
|
|
8
|
+
// See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information.
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import Foundation
|
|
12
|
+
|
|
13
|
+
extension Entry.LocalFileHeader {
|
|
14
|
+
|
|
15
|
+
// MARK: Lifecycle
|
|
16
|
+
|
|
17
|
+
init?(data: Data, additionalDataProvider provider: (Int) throws -> Data) {
|
|
18
|
+
guard data.count == Entry.LocalFileHeader.size else { return nil }
|
|
19
|
+
guard data.scanValue(start: 0) == localFileHeaderSignature else { return nil }
|
|
20
|
+
versionNeededToExtract = data.scanValue(start: 4)
|
|
21
|
+
generalPurposeBitFlag = data.scanValue(start: 6)
|
|
22
|
+
compressionMethod = data.scanValue(start: 8)
|
|
23
|
+
lastModFileTime = data.scanValue(start: 10)
|
|
24
|
+
lastModFileDate = data.scanValue(start: 12)
|
|
25
|
+
crc32 = data.scanValue(start: 14)
|
|
26
|
+
compressedSize = data.scanValue(start: 18)
|
|
27
|
+
uncompressedSize = data.scanValue(start: 22)
|
|
28
|
+
fileNameLength = data.scanValue(start: 26)
|
|
29
|
+
extraFieldLength = data.scanValue(start: 28)
|
|
30
|
+
let additionalDataLength = Int(fileNameLength) + Int(extraFieldLength)
|
|
31
|
+
guard let additionalData = try? provider(additionalDataLength) else { return nil }
|
|
32
|
+
guard additionalData.count == additionalDataLength else { return nil }
|
|
33
|
+
var subRangeStart = 0
|
|
34
|
+
var subRangeEnd = Int(fileNameLength)
|
|
35
|
+
fileNameData = additionalData.subdata(in: subRangeStart..<subRangeEnd)
|
|
36
|
+
subRangeStart += Int(fileNameLength)
|
|
37
|
+
subRangeEnd = subRangeStart + Int(extraFieldLength)
|
|
38
|
+
extraFieldData = additionalData.subdata(in: subRangeStart..<subRangeEnd)
|
|
39
|
+
if
|
|
40
|
+
let zip64ExtendedInformation = Entry.ZIP64ExtendedInformation.scanForZIP64Field(
|
|
41
|
+
in: extraFieldData,
|
|
42
|
+
fields: validFields
|
|
43
|
+
)
|
|
44
|
+
{
|
|
45
|
+
extraFields = [zip64ExtendedInformation]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// MARK: Internal
|
|
50
|
+
|
|
51
|
+
var data: Data {
|
|
52
|
+
var localFileHeaderSignature = localFileHeaderSignature
|
|
53
|
+
var versionNeededToExtract = versionNeededToExtract
|
|
54
|
+
var generalPurposeBitFlag = generalPurposeBitFlag
|
|
55
|
+
var compressionMethod = compressionMethod
|
|
56
|
+
var lastModFileTime = lastModFileTime
|
|
57
|
+
var lastModFileDate = lastModFileDate
|
|
58
|
+
var crc32 = crc32
|
|
59
|
+
var compressedSize = compressedSize
|
|
60
|
+
var uncompressedSize = uncompressedSize
|
|
61
|
+
var fileNameLength = fileNameLength
|
|
62
|
+
var extraFieldLength = extraFieldLength
|
|
63
|
+
var data = Data()
|
|
64
|
+
withUnsafePointer(to: &localFileHeaderSignature) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
65
|
+
withUnsafePointer(to: &versionNeededToExtract) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
66
|
+
withUnsafePointer(to: &generalPurposeBitFlag) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
67
|
+
withUnsafePointer(to: &compressionMethod) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
68
|
+
withUnsafePointer(to: &lastModFileTime) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
69
|
+
withUnsafePointer(to: &lastModFileDate) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
70
|
+
withUnsafePointer(to: &crc32) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
71
|
+
withUnsafePointer(to: &compressedSize) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
72
|
+
withUnsafePointer(to: &uncompressedSize) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
73
|
+
withUnsafePointer(to: &fileNameLength) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
74
|
+
withUnsafePointer(to: &extraFieldLength) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
75
|
+
data.append(fileNameData)
|
|
76
|
+
data.append(extraFieldData)
|
|
77
|
+
return data
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
extension Entry.CentralDirectoryStructure {
|
|
83
|
+
|
|
84
|
+
// MARK: Lifecycle
|
|
85
|
+
|
|
86
|
+
init?(data: Data, additionalDataProvider provider: (Int) throws -> Data) {
|
|
87
|
+
guard data.count == Entry.CentralDirectoryStructure.size else { return nil }
|
|
88
|
+
guard data.scanValue(start: 0) == centralDirectorySignature else { return nil }
|
|
89
|
+
versionMadeBy = data.scanValue(start: 4)
|
|
90
|
+
versionNeededToExtract = data.scanValue(start: 6)
|
|
91
|
+
generalPurposeBitFlag = data.scanValue(start: 8)
|
|
92
|
+
compressionMethod = data.scanValue(start: 10)
|
|
93
|
+
lastModFileTime = data.scanValue(start: 12)
|
|
94
|
+
lastModFileDate = data.scanValue(start: 14)
|
|
95
|
+
crc32 = data.scanValue(start: 16)
|
|
96
|
+
compressedSize = data.scanValue(start: 20)
|
|
97
|
+
uncompressedSize = data.scanValue(start: 24)
|
|
98
|
+
fileNameLength = data.scanValue(start: 28)
|
|
99
|
+
extraFieldLength = data.scanValue(start: 30)
|
|
100
|
+
fileCommentLength = data.scanValue(start: 32)
|
|
101
|
+
diskNumberStart = data.scanValue(start: 34)
|
|
102
|
+
internalFileAttributes = data.scanValue(start: 36)
|
|
103
|
+
externalFileAttributes = data.scanValue(start: 38)
|
|
104
|
+
relativeOffsetOfLocalHeader = data.scanValue(start: 42)
|
|
105
|
+
let additionalDataLength = Int(fileNameLength) + Int(extraFieldLength) + Int(fileCommentLength)
|
|
106
|
+
guard let additionalData = try? provider(additionalDataLength) else { return nil }
|
|
107
|
+
guard additionalData.count == additionalDataLength else { return nil }
|
|
108
|
+
var subRangeStart = 0
|
|
109
|
+
var subRangeEnd = Int(fileNameLength)
|
|
110
|
+
fileNameData = additionalData.subdata(in: subRangeStart..<subRangeEnd)
|
|
111
|
+
subRangeStart += Int(fileNameLength)
|
|
112
|
+
subRangeEnd = subRangeStart + Int(extraFieldLength)
|
|
113
|
+
extraFieldData = additionalData.subdata(in: subRangeStart..<subRangeEnd)
|
|
114
|
+
subRangeStart += Int(extraFieldLength)
|
|
115
|
+
subRangeEnd = subRangeStart + Int(fileCommentLength)
|
|
116
|
+
fileCommentData = additionalData.subdata(in: subRangeStart..<subRangeEnd)
|
|
117
|
+
if
|
|
118
|
+
let zip64ExtendedInformation = Entry.ZIP64ExtendedInformation.scanForZIP64Field(
|
|
119
|
+
in: extraFieldData,
|
|
120
|
+
fields: validFields
|
|
121
|
+
)
|
|
122
|
+
{
|
|
123
|
+
extraFields = [zip64ExtendedInformation]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// MARK: Internal
|
|
128
|
+
|
|
129
|
+
var data: Data {
|
|
130
|
+
var centralDirectorySignature = centralDirectorySignature
|
|
131
|
+
var versionMadeBy = versionMadeBy
|
|
132
|
+
var versionNeededToExtract = versionNeededToExtract
|
|
133
|
+
var generalPurposeBitFlag = generalPurposeBitFlag
|
|
134
|
+
var compressionMethod = compressionMethod
|
|
135
|
+
var lastModFileTime = lastModFileTime
|
|
136
|
+
var lastModFileDate = lastModFileDate
|
|
137
|
+
var crc32 = crc32
|
|
138
|
+
var compressedSize = compressedSize
|
|
139
|
+
var uncompressedSize = uncompressedSize
|
|
140
|
+
var fileNameLength = fileNameLength
|
|
141
|
+
var extraFieldLength = extraFieldLength
|
|
142
|
+
var fileCommentLength = fileCommentLength
|
|
143
|
+
var diskNumberStart = diskNumberStart
|
|
144
|
+
var internalFileAttributes = internalFileAttributes
|
|
145
|
+
var externalFileAttributes = externalFileAttributes
|
|
146
|
+
var relativeOffsetOfLocalHeader = relativeOffsetOfLocalHeader
|
|
147
|
+
var data = Data()
|
|
148
|
+
withUnsafePointer(to: ¢ralDirectorySignature) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
149
|
+
withUnsafePointer(to: &versionMadeBy) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
150
|
+
withUnsafePointer(to: &versionNeededToExtract) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
151
|
+
withUnsafePointer(to: &generalPurposeBitFlag) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
152
|
+
withUnsafePointer(to: &compressionMethod) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
153
|
+
withUnsafePointer(to: &lastModFileTime) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
154
|
+
withUnsafePointer(to: &lastModFileDate) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
155
|
+
withUnsafePointer(to: &crc32) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
156
|
+
withUnsafePointer(to: &compressedSize) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
157
|
+
withUnsafePointer(to: &uncompressedSize) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
158
|
+
withUnsafePointer(to: &fileNameLength) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
159
|
+
withUnsafePointer(to: &extraFieldLength) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
160
|
+
withUnsafePointer(to: &fileCommentLength) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
161
|
+
withUnsafePointer(to: &diskNumberStart) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
162
|
+
withUnsafePointer(to: &internalFileAttributes) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
163
|
+
withUnsafePointer(to: &externalFileAttributes) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
164
|
+
withUnsafePointer(to: &relativeOffsetOfLocalHeader) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
165
|
+
data.append(fileNameData)
|
|
166
|
+
data.append(extraFieldData)
|
|
167
|
+
data.append(fileCommentData)
|
|
168
|
+
return data
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
extension Entry.DataDescriptor {
|
|
174
|
+
init?(data: Data, additionalDataProvider _: (Int) throws -> Data) {
|
|
175
|
+
guard data.count == Self.size else { return nil }
|
|
176
|
+
let signature: UInt32 = data.scanValue(start: 0)
|
|
177
|
+
// The DataDescriptor signature is not mandatory so we have to re-arrange the input data if it is missing.
|
|
178
|
+
var readOffset = 0
|
|
179
|
+
if signature == dataDescriptorSignature { readOffset = 4 }
|
|
180
|
+
crc32 = data.scanValue(start: readOffset)
|
|
181
|
+
readOffset += MemoryLayout<UInt32>.size
|
|
182
|
+
compressedSize = data.scanValue(start: readOffset)
|
|
183
|
+
readOffset += Self.memoryLengthOfSize
|
|
184
|
+
uncompressedSize = data.scanValue(start: readOffset)
|
|
185
|
+
// Our add(_ entry:) methods always maintain compressed & uncompressed
|
|
186
|
+
// sizes and so we don't need a data descriptor for newly added entries.
|
|
187
|
+
// Data descriptors of already existing entries are manually preserved
|
|
188
|
+
// when copying those entries to the tempArchive during remove(_ entry:).
|
|
189
|
+
self.data = Data()
|
|
190
|
+
}
|
|
191
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Entry+ZIP64.swift
|
|
3
|
+
// ZIPFoundation
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2017-2025 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors.
|
|
6
|
+
// Released under the MIT License.
|
|
7
|
+
//
|
|
8
|
+
// See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information.
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import Foundation
|
|
12
|
+
|
|
13
|
+
// MARK: - ExtensibleDataField
|
|
14
|
+
|
|
15
|
+
protocol ExtensibleDataField {
|
|
16
|
+
var headerID: UInt16 { get }
|
|
17
|
+
var dataSize: UInt16 { get }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
extension Entry {
|
|
21
|
+
|
|
22
|
+
enum EntryError: Error {
|
|
23
|
+
case missingPermissionsAttributeError
|
|
24
|
+
case missingModificationDateAttributeError
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
struct ZIP64ExtendedInformation: ExtensibleDataField {
|
|
28
|
+
static let headerSize: UInt16 = 4
|
|
29
|
+
|
|
30
|
+
let headerID: UInt16 = ExtraFieldHeaderID.zip64ExtendedInformation.rawValue
|
|
31
|
+
let dataSize: UInt16
|
|
32
|
+
let uncompressedSize: UInt64
|
|
33
|
+
let compressedSize: UInt64
|
|
34
|
+
let relativeOffsetOfLocalHeader: UInt64
|
|
35
|
+
let diskNumberStart: UInt32
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var zip64ExtendedInformation: ZIP64ExtendedInformation? {
|
|
39
|
+
centralDirectoryStructure.zip64ExtendedInformation
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
typealias Field = Entry.ZIP64ExtendedInformation.Field
|
|
44
|
+
|
|
45
|
+
extension Entry.LocalFileHeader {
|
|
46
|
+
var validFields: [Field] {
|
|
47
|
+
var fields = [Field]()
|
|
48
|
+
if uncompressedSize == .max { fields.append(.uncompressedSize) }
|
|
49
|
+
if compressedSize == .max { fields.append(.compressedSize) }
|
|
50
|
+
return fields
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
extension Entry.CentralDirectoryStructure {
|
|
55
|
+
var validFields: [Field] {
|
|
56
|
+
var fields = [Field]()
|
|
57
|
+
if uncompressedSize == .max { fields.append(.uncompressedSize) }
|
|
58
|
+
if compressedSize == .max { fields.append(.compressedSize) }
|
|
59
|
+
if relativeOffsetOfLocalHeader == .max { fields.append(.relativeOffsetOfLocalHeader) }
|
|
60
|
+
if diskNumberStart == .max { fields.append(.diskNumberStart) }
|
|
61
|
+
return fields
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var zip64ExtendedInformation: Entry.ZIP64ExtendedInformation? {
|
|
65
|
+
extraFields?.compactMap { $0 as? Entry.ZIP64ExtendedInformation }.first
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
extension Entry.ZIP64ExtendedInformation {
|
|
70
|
+
|
|
71
|
+
// MARK: Lifecycle
|
|
72
|
+
|
|
73
|
+
init?(data: Data, fields: [Field]) {
|
|
74
|
+
let headerLength = 4
|
|
75
|
+
guard fields.reduce(0, { $0 + $1.size }) + headerLength == data.count else { return nil }
|
|
76
|
+
|
|
77
|
+
var readOffset = headerLength
|
|
78
|
+
func value<T: BinaryInteger>(of field: Field) -> T {
|
|
79
|
+
if fields.contains(field), readOffset + field.size <= data.count {
|
|
80
|
+
defer { readOffset += MemoryLayout<T>.size }
|
|
81
|
+
|
|
82
|
+
return data.scanValue(start: readOffset)
|
|
83
|
+
} else {
|
|
84
|
+
return 0
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
dataSize = data.scanValue(start: 2)
|
|
89
|
+
uncompressedSize = value(of: .uncompressedSize)
|
|
90
|
+
compressedSize = value(of: .compressedSize)
|
|
91
|
+
relativeOffsetOfLocalHeader = value(of: .relativeOffsetOfLocalHeader)
|
|
92
|
+
diskNumberStart = value(of: .diskNumberStart)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
init?(zip64ExtendedInformation: Entry.ZIP64ExtendedInformation?, offset: UInt64) {
|
|
96
|
+
// Only used when removing entry, if no ZIP64 extended information exists,
|
|
97
|
+
// then this information will not be newly added either
|
|
98
|
+
guard let existingInfo = zip64ExtendedInformation else { return nil }
|
|
99
|
+
relativeOffsetOfLocalHeader = offset >= maxOffsetOfLocalFileHeader ? offset : 0
|
|
100
|
+
uncompressedSize = existingInfo.uncompressedSize
|
|
101
|
+
compressedSize = existingInfo.compressedSize
|
|
102
|
+
diskNumberStart = existingInfo.diskNumberStart
|
|
103
|
+
let tempDataSize = [relativeOffsetOfLocalHeader, uncompressedSize, compressedSize]
|
|
104
|
+
.filter { $0 != 0 }
|
|
105
|
+
.reduce(UInt16(0)) { $0 + UInt16(MemoryLayout.size(ofValue: $1)) }
|
|
106
|
+
dataSize = tempDataSize + (diskNumberStart > 0 ? UInt16(MemoryLayout.size(ofValue: diskNumberStart)) : 0)
|
|
107
|
+
if dataSize == 0 { return nil }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// MARK: Internal
|
|
111
|
+
|
|
112
|
+
enum Field {
|
|
113
|
+
case uncompressedSize
|
|
114
|
+
case compressedSize
|
|
115
|
+
case relativeOffsetOfLocalHeader
|
|
116
|
+
case diskNumberStart
|
|
117
|
+
|
|
118
|
+
var size: Int {
|
|
119
|
+
switch self {
|
|
120
|
+
case .uncompressedSize, .compressedSize, .relativeOffsetOfLocalHeader:
|
|
121
|
+
8
|
|
122
|
+
case .diskNumberStart:
|
|
123
|
+
4
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
var data: Data {
|
|
129
|
+
var headerID = headerID
|
|
130
|
+
var dataSize = dataSize
|
|
131
|
+
var uncompressedSize = uncompressedSize
|
|
132
|
+
var compressedSize = compressedSize
|
|
133
|
+
var relativeOffsetOfLFH = relativeOffsetOfLocalHeader
|
|
134
|
+
var diskNumberStart = diskNumberStart
|
|
135
|
+
var data = Data()
|
|
136
|
+
withUnsafePointer(to: &headerID) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
137
|
+
withUnsafePointer(to: &dataSize) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
138
|
+
if uncompressedSize != 0 || compressedSize != 0 {
|
|
139
|
+
withUnsafePointer(to: &uncompressedSize) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
140
|
+
withUnsafePointer(to: &compressedSize) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
141
|
+
}
|
|
142
|
+
if relativeOffsetOfLocalHeader != 0 {
|
|
143
|
+
withUnsafePointer(to: &relativeOffsetOfLFH) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
144
|
+
}
|
|
145
|
+
if diskNumberStart != 0 {
|
|
146
|
+
withUnsafePointer(to: &diskNumberStart) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
|
|
147
|
+
}
|
|
148
|
+
return data
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static func scanForZIP64Field(in data: Data, fields: [Field]) -> Entry.ZIP64ExtendedInformation? {
|
|
152
|
+
guard data.isEmpty == false else { return nil }
|
|
153
|
+
var offset = 0
|
|
154
|
+
var headerID: UInt16
|
|
155
|
+
var dataSize: UInt16
|
|
156
|
+
let extraFieldLength = data.count
|
|
157
|
+
let headerSize = Int(Entry.ZIP64ExtendedInformation.headerSize)
|
|
158
|
+
while offset < extraFieldLength - headerSize {
|
|
159
|
+
headerID = data.scanValue(start: offset)
|
|
160
|
+
dataSize = data.scanValue(start: offset + 2)
|
|
161
|
+
let nextOffset = offset + headerSize + Int(dataSize)
|
|
162
|
+
guard nextOffset <= extraFieldLength else { return nil }
|
|
163
|
+
if headerID == ExtraFieldHeaderID.zip64ExtendedInformation.rawValue {
|
|
164
|
+
return Entry.ZIP64ExtendedInformation(data: data.subdata(in: offset..<nextOffset), fields: fields)
|
|
165
|
+
}
|
|
166
|
+
offset = nextOffset
|
|
167
|
+
}
|
|
168
|
+
return nil
|
|
169
|
+
}
|
|
170
|
+
}
|