{"version":3,"sources":["../src/index.ts","../src/primitives.ts","../src/AnimatedStyle.ts","../src/AnimatedTransform.ts"],"sourcesContent":["import { StyleSheet } from 'react-native'\nimport { createHost, AnimatedObject } from '@react-spring/animated'\nimport {\n  is,\n  Globals,\n  createStringInterpolator,\n  colors,\n} from '@react-spring/shared'\nimport { primitives } from './primitives'\nimport { WithAnimated } from './animated'\nimport { AnimatedStyle } from './AnimatedStyle'\n\nGlobals.assign({\n  batchedUpdates: require('react-native').unstable_batchedUpdates,\n  createStringInterpolator,\n  colors,\n})\n\nconst host = createHost(primitives, {\n  applyAnimatedValues(instance, props) {\n    if (is.und(props.children) && instance.setNativeProps) {\n      instance.setNativeProps(props)\n      return true\n    }\n    return false\n  },\n  createAnimatedStyle(styles) {\n    styles = StyleSheet.flatten(styles)\n    if (is.obj(styles.shadowOffset)) {\n      styles.shadowOffset = new AnimatedObject(styles.shadowOffset)\n    }\n    return new AnimatedStyle(styles)\n  },\n})\n\nexport const animated = host.animated as WithAnimated\nexport { animated as a }\n\nexport * from './animated'\nexport * from '@react-spring/core'\n","import {\n  Text,\n  View,\n  Image,\n  ImageProps,\n  ViewProps,\n  TextProps,\n} from 'react-native'\nimport { ComponentClass, ReactNode } from 'react'\n\nexport const primitives = {\n  View: View as ComponentClass<ViewProps & { children?: ReactNode }>,\n  Text: Text as ComponentClass<TextProps & { children?: ReactNode }>,\n  Image: Image as ComponentClass<ImageProps>,\n}\n","import { AnimatedObject } from '@react-spring/animated'\nimport { AnimatedTransform } from './AnimatedTransform'\n\ntype Style = object & { transform?: any }\n\nexport class AnimatedStyle extends AnimatedObject {\n  constructor(style: Style) {\n    super(style)\n  }\n\n  setValue(style: Style) {\n    super.setValue(\n      style && style.transform\n        ? { ...style, transform: new AnimatedTransform(style.transform) }\n        : style\n    )\n  }\n}\n","import { each, eachProp, getFluidValue } from '@react-spring/shared'\nimport { Animated, AnimatedValue, AnimatedObject } from '@react-spring/animated'\n\ntype Transform = { [key: string]: string | number | Animated }\n\ntype Source = Transform[]\n\nexport class AnimatedTransform extends AnimatedObject {\n  protected declare source: Source\n  constructor(source: Source) {\n    super(source)\n  }\n\n  getValue() {\n    return this.source\n      ? this.source.map(source => {\n          const transform: any = {}\n          eachProp(source, (source, key) => {\n            transform[key] = getFluidValue(source)\n          })\n          return transform\n        })\n      : []\n  }\n\n  setValue(source: Source) {\n    this.source = source\n    this.payload = this._makePayload(source)\n  }\n\n  protected _makePayload(source: Source) {\n    if (!source) return []\n    const payload = new Set<AnimatedValue>()\n    each(source, transform => eachProp(transform, this._addToPayload, payload))\n    return Array.from(payload)\n  }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,YAAY,kBAAAA,uBAAsB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACPP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAGA,IAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AACF;;;ACdA,SAAS,kBAAAC,uBAAsB;;;ACA/B,SAAS,MAAM,UAAU,qBAAqB;AAC9C,SAAkC,sBAAsB;AAMjD,IAAM,oBAAN,cAAgC,eAAe;AAAA,EAEpD,YAAY,QAAgB;AAC1B,UAAM,MAAM;AAAA,EACd;AAAA,EAEA,WAAW;AACT,WAAO,KAAK,SACR,KAAK,OAAO,IAAI,YAAU;AACxB,YAAM,YAAiB,CAAC;AACxB,eAAS,QAAQ,CAACC,SAAQ,QAAQ;AAChC,kBAAU,GAAG,IAAI,cAAcA,OAAM;AAAA,MACvC,CAAC;AACD,aAAO;AAAA,IACT,CAAC,IACD,CAAC;AAAA,EACP;AAAA,EAEA,SAAS,QAAgB;AACvB,SAAK,SAAS;AACd,SAAK,UAAU,KAAK,aAAa,MAAM;AAAA,EACzC;AAAA,EAEU,aAAa,QAAgB;AACrC,QAAI,CAAC;AAAQ,aAAO,CAAC;AACrB,UAAM,UAAU,oBAAI,IAAmB;AACvC,S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