@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.
Files changed (313) hide show
  1. package/README.md +36 -16
  2. package/dist/native/index.js +10 -9
  3. package/dist/native/octane-client-build.json +1 -1
  4. package/dist/web/index.js +39 -25
  5. package/dist/web/octane-client-build.json +1 -1
  6. package/package.json +25 -3
  7. package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
  8. package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
  9. package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
  10. package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
  11. package/platforms/macos/UPSTREAM.md +13 -0
  12. package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
  13. package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
  14. package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
  15. package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
  16. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
  17. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
  18. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
  19. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
  20. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
  21. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
  22. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
  23. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
  24. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
  25. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
  26. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
  27. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
  28. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
  29. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
  30. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
  31. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
  32. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
  33. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
  34. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
  35. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
  36. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
  37. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
  38. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
  39. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
  40. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
  41. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
  42. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
  43. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
  44. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
  45. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
  46. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
  47. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
  48. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
  49. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
  50. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
  51. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
  52. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
  53. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
  54. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
  55. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
  56. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
  57. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
  58. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
  59. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
  60. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
  61. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
  62. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
  63. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
  64. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
  65. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
  66. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
  67. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
  68. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
  69. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
  70. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
  71. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
  72. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
  73. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
  74. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
  75. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
  76. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
  77. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
  78. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
  79. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
  80. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
  81. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
  82. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
  83. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
  84. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
  85. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
  86. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
  87. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
  88. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
  89. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
  90. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
  91. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
  92. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
  93. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
  94. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
  95. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
  96. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
  97. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
  98. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
  99. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
  100. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
  101. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
  102. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
  103. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
  104. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
  105. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
  106. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
  107. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
  108. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
  109. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
  110. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
  111. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
  112. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
  113. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
  114. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
  115. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
  116. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
  117. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
  118. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
  119. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
  120. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
  121. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
  122. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
  123. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
  124. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
  125. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
  126. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
  127. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
  128. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
  129. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
  130. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
  131. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
  132. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
  133. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
  134. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
  135. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
  136. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
  137. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
  138. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
  139. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
  140. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
  141. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
  142. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
  143. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
  144. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
  145. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
  146. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
  147. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
  148. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
  149. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
  150. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
  151. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
  152. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
  153. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
  154. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
  155. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
  156. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
  157. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
  158. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
  159. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
  160. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
  161. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
  162. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
  163. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
  164. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
  165. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
  166. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
  167. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
  168. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
  169. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
  170. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
  171. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
  172. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
  173. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
  174. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
  175. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
  176. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
  177. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
  178. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
  179. package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
  180. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
  181. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
  182. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
  183. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
  184. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
  185. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
  186. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
  187. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
  188. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
  189. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
  190. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
  191. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
  192. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
  193. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
  194. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
  195. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
  196. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
  197. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
  198. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
  199. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
  200. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
  201. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
  202. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
  203. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
  204. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
  205. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
  206. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
  207. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
  208. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
  209. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
  210. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
  211. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
  212. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
  213. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
  214. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
  215. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
  216. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
  217. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
  218. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
  219. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
  220. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
  221. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
  222. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
  223. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
  224. package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
  225. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
  226. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
  227. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
  228. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
  229. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
  230. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
  231. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
  232. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
  233. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
  234. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
  235. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
  236. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
  237. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
  238. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
  239. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
  240. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
  241. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
  242. package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
  243. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
  244. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
  245. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
  246. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
  247. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
  248. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
  249. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
  250. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
  251. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
  252. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
  253. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
  254. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
  255. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
  256. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
  257. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
  258. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
  259. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
  260. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
  261. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
  262. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
  263. package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
  264. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
  265. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
  266. package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
  267. package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
  268. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
  269. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
  270. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
  271. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
  272. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
  273. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
  274. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
  275. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
  276. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
  277. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
  278. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
  279. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
  280. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
  281. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
  282. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
  283. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
  284. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
  285. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
  286. package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
  287. package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
  288. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
  289. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
  290. package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
  291. package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
  292. package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
  293. package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
  294. package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
  295. package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
  296. package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
  297. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
  298. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
  299. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
  300. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
  301. package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
  302. package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
  303. package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
  304. package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
  305. package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
  306. package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
  307. package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
  308. package/src/Lottie.macos.tsrx +129 -0
  309. package/src/Lottie.tsrx +3 -2
  310. package/src/Lottie.web.tsrx +28 -11
  311. package/src/index.macos.ts +2 -0
  312. package/src/props.ts +6 -1
  313. package/types/generated/props.d.ts +5 -1
@@ -0,0 +1,669 @@
1
+ //
2
+ // Entry.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 CoreFoundation
12
+ import Foundation
13
+
14
+ // MARK: - Entry
15
+
16
+ /// A value that represents a file, a directory or a symbolic link within a ZIP `Archive`.
17
+ ///
18
+ /// You can retrieve instances of `Entry` from an `Archive` via subscripting or iteration.
19
+ /// Entries are identified by their `path`.
20
+ struct Entry: Equatable {
21
+
22
+ // MARK: Lifecycle
23
+
24
+ init?(
25
+ centralDirectoryStructure: CentralDirectoryStructure,
26
+ localFileHeader: LocalFileHeader,
27
+ dataDescriptor: DefaultDataDescriptor? = nil,
28
+ zip64DataDescriptor: ZIP64DataDescriptor? = nil
29
+ ) {
30
+ // We currently don't support encrypted archives
31
+ guard !centralDirectoryStructure.isEncrypted else { return nil }
32
+ self.centralDirectoryStructure = centralDirectoryStructure
33
+ self.localFileHeader = localFileHeader
34
+ self.dataDescriptor = dataDescriptor
35
+ self.zip64DataDescriptor = zip64DataDescriptor
36
+ }
37
+
38
+ // MARK: Internal
39
+
40
+ /// The type of an `Entry` in a ZIP `Archive`.
41
+ enum EntryType: Int {
42
+ /// Indicates a regular file.
43
+ case file
44
+ /// Indicates a directory.
45
+ case directory
46
+ /// Indicates a symbolic link.
47
+ case symlink
48
+
49
+ init(mode: mode_t) {
50
+ switch mode & S_IFMT {
51
+ case S_IFDIR:
52
+ self = .directory
53
+ case S_IFLNK:
54
+ self = .symlink
55
+ default:
56
+ self = .file
57
+ }
58
+ }
59
+ }
60
+
61
+ enum OSType: UInt {
62
+ case msdos = 0
63
+ case unix = 3
64
+ case osx = 19
65
+ case unused = 20
66
+ }
67
+
68
+ struct LocalFileHeader: DataSerializable {
69
+ static let size = 30
70
+
71
+ let localFileHeaderSignature = UInt32(localFileHeaderStructSignature)
72
+ let versionNeededToExtract: UInt16
73
+ let generalPurposeBitFlag: UInt16
74
+ let compressionMethod: UInt16
75
+ let lastModFileTime: UInt16
76
+ let lastModFileDate: UInt16
77
+ let crc32: UInt32
78
+ let compressedSize: UInt32
79
+ let uncompressedSize: UInt32
80
+ let fileNameLength: UInt16
81
+ let extraFieldLength: UInt16
82
+ let fileNameData: Data
83
+ let extraFieldData: Data
84
+ var extraFields: [ExtensibleDataField]?
85
+ }
86
+
87
+ struct DataDescriptor<T: BinaryInteger>: DataSerializable {
88
+ static var memoryLengthOfSize: Int {
89
+ MemoryLayout<T>.size
90
+ }
91
+
92
+ static var size: Int {
93
+ memoryLengthOfSize * 2 + 8
94
+ }
95
+
96
+ let data: Data
97
+ let dataDescriptorSignature = UInt32(dataDescriptorStructSignature)
98
+ let crc32: UInt32
99
+ // For normal archives, the compressed and uncompressed sizes are 4 bytes each.
100
+ // For ZIP64 format archives, the compressed and uncompressed sizes are 8 bytes each.
101
+ let compressedSize: T
102
+ let uncompressedSize: T
103
+ }
104
+
105
+ typealias DefaultDataDescriptor = DataDescriptor<UInt32>
106
+ typealias ZIP64DataDescriptor = DataDescriptor<UInt64>
107
+
108
+ struct CentralDirectoryStructure: DataSerializable {
109
+ static let size = 46
110
+
111
+ let centralDirectorySignature = UInt32(centralDirectoryStructSignature)
112
+ let versionMadeBy: UInt16
113
+ let versionNeededToExtract: UInt16
114
+ let generalPurposeBitFlag: UInt16
115
+ let compressionMethod: UInt16
116
+ let lastModFileTime: UInt16
117
+ let lastModFileDate: UInt16
118
+ let crc32: UInt32
119
+ let compressedSize: UInt32
120
+ let uncompressedSize: UInt32
121
+ let fileNameLength: UInt16
122
+ let extraFieldLength: UInt16
123
+ let fileCommentLength: UInt16
124
+ let diskNumberStart: UInt16
125
+ let internalFileAttributes: UInt16
126
+ let externalFileAttributes: UInt32
127
+ let relativeOffsetOfLocalHeader: UInt32
128
+ let fileNameData: Data
129
+ let extraFieldData: Data
130
+ let fileCommentData: Data
131
+
132
+ var extraFields: [ExtensibleDataField]?
133
+
134
+ var usesDataDescriptor: Bool {
135
+ (generalPurposeBitFlag & (1 << 3)) != 0
136
+ }
137
+
138
+ var usesUTF8PathEncoding: Bool {
139
+ (generalPurposeBitFlag & (1 << 11)) != 0
140
+ }
141
+
142
+ var isEncrypted: Bool {
143
+ (generalPurposeBitFlag & (1 << 0)) != 0
144
+ }
145
+
146
+ var isZIP64: Bool {
147
+ // If ZIP64 extended information is existing, try to treat cd as ZIP64 format
148
+ // even if the version needed to extract is lower than 4.5
149
+ UInt8(truncatingIfNeeded: versionNeededToExtract) >= 45 || zip64ExtendedInformation != nil
150
+ }
151
+ }
152
+
153
+ let centralDirectoryStructure: CentralDirectoryStructure
154
+ let localFileHeader: LocalFileHeader
155
+ let dataDescriptor: DefaultDataDescriptor?
156
+ let zip64DataDescriptor: ZIP64DataDescriptor?
157
+
158
+ /// The `path` of the receiver within a ZIP `Archive`.
159
+ var path: String {
160
+ let encoding = centralDirectoryStructure.usesUTF8PathEncoding ? String.Encoding.utf8 : .codepage437
161
+ return self.path(using: encoding)
162
+ }
163
+
164
+ /// The file attributes of the receiver as key/value pairs.
165
+ ///
166
+ /// Contains the modification date and file permissions.
167
+ var fileAttributes: [FileAttributeKey: Any] {
168
+ FileManager.attributes(from: self)
169
+ }
170
+
171
+ /// The `CRC32` checksum of the receiver.
172
+ ///
173
+ /// - Note: Always returns `0` for entries of type `EntryType.directory`.
174
+ var checksum: CRC32 {
175
+ if centralDirectoryStructure.usesDataDescriptor {
176
+ return zip64DataDescriptor?.crc32 ?? dataDescriptor?.crc32 ?? 0
177
+ }
178
+ return centralDirectoryStructure.crc32
179
+ }
180
+
181
+ /// The `EntryType` of the receiver.
182
+ var type: EntryType {
183
+ // OS Type is stored in the upper byte of versionMadeBy
184
+ let osTypeRaw = centralDirectoryStructure.versionMadeBy >> 8
185
+ let osType = OSType(rawValue: UInt(osTypeRaw)) ?? .unused
186
+ var isDirectory = path.hasSuffix("/")
187
+ switch osType {
188
+ case .unix, .osx:
189
+ // Use truncatingIfNeeded for safer conversion across platforms
190
+ let modeValue = UInt16(truncatingIfNeeded: centralDirectoryStructure.externalFileAttributes >> 16)
191
+ let mode = mode_t(modeValue) & S_IFMT
192
+ switch mode {
193
+ case S_IFREG:
194
+ return .file
195
+ case S_IFDIR:
196
+ return .directory
197
+ case S_IFLNK:
198
+ return .symlink
199
+ default:
200
+ return isDirectory ? .directory : .file
201
+ }
202
+
203
+ case .msdos:
204
+ isDirectory = isDirectory || ((centralDirectoryStructure.externalFileAttributes >> 4) == 0x01)
205
+ fallthrough // For all other OSes we can only guess based on the directory suffix char
206
+ default: return isDirectory ? .directory : .file
207
+ }
208
+ }
209
+
210
+ /// Indicates whether or not the receiver is compressed.
211
+ var isCompressed: Bool {
212
+ localFileHeader.compressionMethod != CompressionMethod.none.rawValue
213
+ }
214
+
215
+ /// The size of the receiver's compressed data.
216
+ var compressedSize: UInt64 {
217
+ if centralDirectoryStructure.isZIP64 {
218
+ return zip64DataDescriptor?.compressedSize ?? centralDirectoryStructure.effectiveCompressedSize
219
+ }
220
+ return UInt64(dataDescriptor?.compressedSize ?? centralDirectoryStructure.compressedSize)
221
+ }
222
+
223
+ /// The size of the receiver's uncompressed data.
224
+ var uncompressedSize: UInt64 {
225
+ if centralDirectoryStructure.isZIP64 {
226
+ return zip64DataDescriptor?.uncompressedSize ?? centralDirectoryStructure.effectiveUncompressedSize
227
+ }
228
+ return UInt64(dataDescriptor?.uncompressedSize ?? centralDirectoryStructure.uncompressedSize)
229
+ }
230
+
231
+ /// The combined size of the local header, the data and the optional data descriptor.
232
+ var localSize: UInt64 {
233
+ let localFileHeader = localFileHeader
234
+ var extraDataLength = Int(localFileHeader.fileNameLength)
235
+ extraDataLength += Int(localFileHeader.extraFieldLength)
236
+ var size = UInt64(LocalFileHeader.size + extraDataLength)
237
+ size += isCompressed ? compressedSize : uncompressedSize
238
+ if centralDirectoryStructure.isZIP64 {
239
+ size += zip64DataDescriptor != nil ? UInt64(ZIP64DataDescriptor.size) : 0
240
+ } else {
241
+ size += dataDescriptor != nil ? UInt64(DefaultDataDescriptor.size) : 0
242
+ }
243
+ return size
244
+ }
245
+
246
+ var dataOffset: UInt64 {
247
+ var dataOffset = centralDirectoryStructure.effectiveRelativeOffsetOfLocalHeader
248
+ dataOffset += UInt64(LocalFileHeader.size)
249
+ dataOffset += UInt64(localFileHeader.fileNameLength)
250
+ dataOffset += UInt64(localFileHeader.extraFieldLength)
251
+ return dataOffset
252
+ }
253
+
254
+ static func ==(lhs: Entry, rhs: Entry) -> Bool {
255
+ lhs.path == rhs.path
256
+ && lhs.localFileHeader.crc32 == rhs.localFileHeader.crc32
257
+ && lhs.centralDirectoryStructure.effectiveRelativeOffsetOfLocalHeader
258
+ == rhs.centralDirectoryStructure.effectiveRelativeOffsetOfLocalHeader
259
+ }
260
+
261
+ /// Returns the `path` of the receiver within a ZIP `Archive` using a given encoding.
262
+ ///
263
+ /// - Parameters:
264
+ /// - encoding: `String.Encoding`
265
+ func path(using encoding: String.Encoding) -> String {
266
+ String(pathData: centralDirectoryStructure.fileNameData, encoding: encoding)
267
+ }
268
+
269
+ }
270
+
271
+ extension Entry.CentralDirectoryStructure {
272
+
273
+ init(
274
+ localFileHeader: Entry.LocalFileHeader,
275
+ fileAttributes: UInt32,
276
+ relativeOffset: UInt32,
277
+ extraField: (length: UInt16, data: Data)
278
+ ) {
279
+ versionMadeBy = UInt16(789)
280
+ versionNeededToExtract = localFileHeader.versionNeededToExtract
281
+ generalPurposeBitFlag = localFileHeader.generalPurposeBitFlag
282
+ compressionMethod = localFileHeader.compressionMethod
283
+ lastModFileTime = localFileHeader.lastModFileTime
284
+ lastModFileDate = localFileHeader.lastModFileDate
285
+ crc32 = localFileHeader.crc32
286
+ compressedSize = localFileHeader.compressedSize
287
+ uncompressedSize = localFileHeader.uncompressedSize
288
+ fileNameLength = localFileHeader.fileNameLength
289
+ extraFieldLength = extraField.length
290
+ fileCommentLength = UInt16(0)
291
+ diskNumberStart = UInt16(0)
292
+ internalFileAttributes = UInt16(0)
293
+ externalFileAttributes = fileAttributes
294
+ relativeOffsetOfLocalHeader = relativeOffset
295
+ fileNameData = localFileHeader.fileNameData
296
+ extraFieldData = extraField.data
297
+ fileCommentData = Data()
298
+ if
299
+ let zip64ExtendedInformation = Entry.ZIP64ExtendedInformation.scanForZIP64Field(
300
+ in: extraFieldData,
301
+ fields: validFields
302
+ )
303
+ {
304
+ extraFields = [zip64ExtendedInformation]
305
+ }
306
+ }
307
+
308
+ init(
309
+ centralDirectoryStructure: Entry.CentralDirectoryStructure,
310
+ zip64ExtendedInformation: Entry.ZIP64ExtendedInformation?,
311
+ relativeOffset: UInt32
312
+ ) {
313
+ if let existingInfo = zip64ExtendedInformation {
314
+ extraFieldData = existingInfo.data
315
+ versionNeededToExtract = max(
316
+ centralDirectoryStructure.versionNeededToExtract,
317
+ Archive.Version.v45.rawValue
318
+ )
319
+ } else {
320
+ extraFieldData = centralDirectoryStructure.extraFieldData
321
+ let existingVersion = centralDirectoryStructure.versionNeededToExtract
322
+ versionNeededToExtract = existingVersion < Archive.Version.v45.rawValue
323
+ ? centralDirectoryStructure.versionNeededToExtract
324
+ : Archive.Version.v20.rawValue
325
+ }
326
+ extraFieldLength = UInt16(extraFieldData.count)
327
+ relativeOffsetOfLocalHeader = relativeOffset
328
+ versionMadeBy = centralDirectoryStructure.versionMadeBy
329
+ generalPurposeBitFlag = centralDirectoryStructure.generalPurposeBitFlag
330
+ compressionMethod = centralDirectoryStructure.compressionMethod
331
+ lastModFileTime = centralDirectoryStructure.lastModFileTime
332
+ lastModFileDate = centralDirectoryStructure.lastModFileDate
333
+ crc32 = centralDirectoryStructure.crc32
334
+ compressedSize = centralDirectoryStructure.compressedSize
335
+ uncompressedSize = centralDirectoryStructure.uncompressedSize
336
+ fileNameLength = centralDirectoryStructure.fileNameLength
337
+ fileCommentLength = centralDirectoryStructure.fileCommentLength
338
+ diskNumberStart = centralDirectoryStructure.diskNumberStart
339
+ internalFileAttributes = centralDirectoryStructure.internalFileAttributes
340
+ externalFileAttributes = centralDirectoryStructure.externalFileAttributes
341
+ fileNameData = centralDirectoryStructure.fileNameData
342
+ fileCommentData = centralDirectoryStructure.fileCommentData
343
+ if
344
+ let zip64ExtendedInformation = Entry.ZIP64ExtendedInformation.scanForZIP64Field(
345
+ in: extraFieldData,
346
+ fields: validFields
347
+ )
348
+ {
349
+ extraFields = [zip64ExtendedInformation]
350
+ }
351
+ }
352
+ }
353
+
354
+ extension Entry.CentralDirectoryStructure {
355
+
356
+ var effectiveCompressedSize: UInt64 {
357
+ if isZIP64, let compressedSize = zip64ExtendedInformation?.compressedSize, compressedSize > 0 {
358
+ return compressedSize
359
+ }
360
+ return UInt64(compressedSize)
361
+ }
362
+
363
+ var effectiveUncompressedSize: UInt64 {
364
+ if isZIP64, let uncompressedSize = zip64ExtendedInformation?.uncompressedSize, uncompressedSize > 0 {
365
+ return uncompressedSize
366
+ }
367
+ return UInt64(uncompressedSize)
368
+ }
369
+
370
+ var effectiveRelativeOffsetOfLocalHeader: UInt64 {
371
+ if isZIP64, let offset = zip64ExtendedInformation?.relativeOffsetOfLocalHeader, offset > 0 {
372
+ return offset
373
+ }
374
+ return UInt64(relativeOffsetOfLocalHeader)
375
+ }
376
+ }
377
+
378
+ extension String.Encoding {
379
+
380
+ static let codepage437: Self = {
381
+ let dosLatinUS = 0x400
382
+ let dosLatinUSEncoding = CFStringEncoding(dosLatinUS)
383
+ let dosLatinUSStringEncoding = CFStringConvertEncodingToNSStringEncoding(dosLatinUSEncoding)
384
+ return String.Encoding(rawValue: dosLatinUSStringEncoding)
385
+ }()
386
+ }
387
+
388
+ extension String {
389
+
390
+ // MARK: Lifecycle
391
+
392
+ init(pathData: Data, encoding: String.Encoding) {
393
+ #if os(Linux)
394
+ if encoding == .codepage437 {
395
+ self.init()
396
+ for byte in pathData {
397
+ unicodeScalars.append(Self.cp437Lookup[Int(byte)])
398
+ }
399
+ return
400
+ }
401
+ #endif
402
+ self = String(data: pathData, encoding: encoding) ?? ""
403
+ }
404
+
405
+ // MARK: Private
406
+
407
+ #if os(Linux)
408
+ // Source: https://en.wikipedia.org/wiki/Code_page_437#Character_set
409
+ private static let cp437Lookup: [UnicodeScalar] = [
410
+ 0x0000,
411
+ 0x263A,
412
+ 0x263B,
413
+ 0x2665,
414
+ 0x2666,
415
+ 0x2663,
416
+ 0x2660,
417
+ 0x2022,
418
+ 0x25D8,
419
+ 0x25CB,
420
+ 0x25D9,
421
+ 0x2642,
422
+ 0x2640,
423
+ 0x266A,
424
+ 0x266B,
425
+ 0x263C,
426
+ 0x25BA,
427
+ 0x25C4,
428
+ 0x2195,
429
+ 0x203C,
430
+ 0x00B6,
431
+ 0x00A7,
432
+ 0x25AC,
433
+ 0x21A8,
434
+ 0x2191,
435
+ 0x2193,
436
+ 0x2192,
437
+ 0x2190,
438
+ 0x221F,
439
+ 0x2194,
440
+ 0x25B2,
441
+ 0x25BC,
442
+ 0x0020,
443
+ 0x0021,
444
+ 0x0022,
445
+ 0x0023,
446
+ 0x0024,
447
+ 0x0025,
448
+ 0x0026,
449
+ 0x0027,
450
+ 0x0028,
451
+ 0x0029,
452
+ 0x002A,
453
+ 0x002B,
454
+ 0x002C,
455
+ 0x002D,
456
+ 0x002E,
457
+ 0x002F,
458
+ 0x0030,
459
+ 0x0031,
460
+ 0x0032,
461
+ 0x0033,
462
+ 0x0034,
463
+ 0x0035,
464
+ 0x0036,
465
+ 0x0037,
466
+ 0x0038,
467
+ 0x0039,
468
+ 0x003A,
469
+ 0x003B,
470
+ 0x003C,
471
+ 0x003D,
472
+ 0x003E,
473
+ 0x003F,
474
+ 0x0040,
475
+ 0x0041,
476
+ 0x0042,
477
+ 0x0043,
478
+ 0x0044,
479
+ 0x0045,
480
+ 0x0046,
481
+ 0x0047,
482
+ 0x0048,
483
+ 0x0049,
484
+ 0x004A,
485
+ 0x004B,
486
+ 0x004C,
487
+ 0x004D,
488
+ 0x004E,
489
+ 0x004F,
490
+ 0x0050,
491
+ 0x0051,
492
+ 0x0052,
493
+ 0x0053,
494
+ 0x0054,
495
+ 0x0055,
496
+ 0x0056,
497
+ 0x0057,
498
+ 0x0058,
499
+ 0x0059,
500
+ 0x005A,
501
+ 0x005B,
502
+ 0x005C,
503
+ 0x005D,
504
+ 0x005E,
505
+ 0x005F,
506
+ 0x0060,
507
+ 0x0061,
508
+ 0x0062,
509
+ 0x0063,
510
+ 0x0064,
511
+ 0x0065,
512
+ 0x0066,
513
+ 0x0067,
514
+ 0x0068,
515
+ 0x0069,
516
+ 0x006A,
517
+ 0x006B,
518
+ 0x006C,
519
+ 0x006D,
520
+ 0x006E,
521
+ 0x006F,
522
+ 0x0070,
523
+ 0x0071,
524
+ 0x0072,
525
+ 0x0073,
526
+ 0x0074,
527
+ 0x0075,
528
+ 0x0076,
529
+ 0x0077,
530
+ 0x0078,
531
+ 0x0079,
532
+ 0x007A,
533
+ 0x007B,
534
+ 0x007C,
535
+ 0x007D,
536
+ 0x007E,
537
+ 0x2302,
538
+ 0x00C7,
539
+ 0x00FC,
540
+ 0x00E9,
541
+ 0x00E2,
542
+ 0x00E4,
543
+ 0x00E0,
544
+ 0x00E5,
545
+ 0x00E7,
546
+ 0x00EA,
547
+ 0x00EB,
548
+ 0x00E8,
549
+ 0x00EF,
550
+ 0x00EE,
551
+ 0x00EC,
552
+ 0x00C4,
553
+ 0x00C5,
554
+ 0x00C9,
555
+ 0x00E6,
556
+ 0x00C6,
557
+ 0x00F4,
558
+ 0x00F6,
559
+ 0x00F2,
560
+ 0x00FB,
561
+ 0x00F9,
562
+ 0x00FF,
563
+ 0x00D6,
564
+ 0x00DC,
565
+ 0x00A2,
566
+ 0x00A3,
567
+ 0x00A5,
568
+ 0x20A7,
569
+ 0x0192,
570
+ 0x00E1,
571
+ 0x00ED,
572
+ 0x00F3,
573
+ 0x00FA,
574
+ 0x00F1,
575
+ 0x00D1,
576
+ 0x00AA,
577
+ 0x00BA,
578
+ 0x00BF,
579
+ 0x2310,
580
+ 0x00AC,
581
+ 0x00BD,
582
+ 0x00BC,
583
+ 0x00A1,
584
+ 0x00AB,
585
+ 0x00BB,
586
+ 0x2591,
587
+ 0x2592,
588
+ 0x2593,
589
+ 0x2502,
590
+ 0x2524,
591
+ 0x2561,
592
+ 0x2562,
593
+ 0x2556,
594
+ 0x2555,
595
+ 0x2563,
596
+ 0x2551,
597
+ 0x2557,
598
+ 0x255D,
599
+ 0x255C,
600
+ 0x255B,
601
+ 0x2510,
602
+ 0x2514,
603
+ 0x2534,
604
+ 0x252C,
605
+ 0x251C,
606
+ 0x2500,
607
+ 0x253C,
608
+ 0x255E,
609
+ 0x255F,
610
+ 0x255A,
611
+ 0x2554,
612
+ 0x2569,
613
+ 0x2566,
614
+ 0x2560,
615
+ 0x2550,
616
+ 0x256C,
617
+ 0x2567,
618
+ 0x2568,
619
+ 0x2564,
620
+ 0x2565,
621
+ 0x2559,
622
+ 0x2558,
623
+ 0x2552,
624
+ 0x2553,
625
+ 0x256B,
626
+ 0x256A,
627
+ 0x2518,
628
+ 0x250C,
629
+ 0x2588,
630
+ 0x2584,
631
+ 0x258C,
632
+ 0x2590,
633
+ 0x2580,
634
+ 0x03B1,
635
+ 0x00DF,
636
+ 0x0393,
637
+ 0x03C0,
638
+ 0x03A3,
639
+ 0x03C3,
640
+ 0x00B5,
641
+ 0x03C4,
642
+ 0x03A6,
643
+ 0x0398,
644
+ 0x03A9,
645
+ 0x03B4,
646
+ 0x221E,
647
+ 0x03C6,
648
+ 0x03B5,
649
+ 0x2229,
650
+ 0x2261,
651
+ 0x00B1,
652
+ 0x2265,
653
+ 0x2264,
654
+ 0x2329,
655
+ 0x2321,
656
+ 0x00F7,
657
+ 0x2248,
658
+ 0x00B0,
659
+ 0x2219,
660
+ 0x00B7,
661
+ 0x221A,
662
+ 0x207F,
663
+ 0x00B2,
664
+ 0x25A0,
665
+ 0x00A0,
666
+ ].map { UnicodeScalar($0)! }
667
+ #endif
668
+
669
+ }