index.min.js.map 13 KB
{"version":3,"file":"index.min.js","sources":["../../unitless/src/index.js","../src/index.js","../../memoize/src/index.js","../../hash/src/index.js"],"sourcesContent":["// @flow\nlet unitlessKeys: { [key: string]: 1 } = {\n  animationIterationCount: 1,\n  borderImageOutset: 1,\n  borderImageSlice: 1,\n  borderImageWidth: 1,\n  boxFlex: 1,\n  boxFlexGroup: 1,\n  boxOrdinalGroup: 1,\n  columnCount: 1,\n  columns: 1,\n  flex: 1,\n  flexGrow: 1,\n  flexPositive: 1,\n  flexShrink: 1,\n  flexNegative: 1,\n  flexOrder: 1,\n  gridRow: 1,\n  gridRowEnd: 1,\n  gridRowSpan: 1,\n  gridRowStart: 1,\n  gridColumn: 1,\n  gridColumnEnd: 1,\n  gridColumnSpan: 1,\n  gridColumnStart: 1,\n  fontWeight: 1,\n  lineHeight: 1,\n  opacity: 1,\n  order: 1,\n  orphans: 1,\n  tabSize: 1,\n  widows: 1,\n  zIndex: 1,\n  zoom: 1,\n  WebkitLineClamp: 1,\n\n  // SVG-related properties\n  fillOpacity: 1,\n  floodOpacity: 1,\n  stopOpacity: 1,\n  strokeDasharray: 1,\n  strokeDashoffset: 1,\n  strokeMiterlimit: 1,\n  strokeOpacity: 1,\n  strokeWidth: 1\n}\n\nexport default unitlessKeys\n","// @flow\nimport type {\n  Interpolation,\n  ScopedInsertableStyles,\n  RegisteredCache\n} from '@emotion/utils'\nimport hashString from '@emotion/hash'\nimport unitless from '@emotion/unitless'\nimport memoize from '@emotion/memoize'\n\nlet hyphenateRegex = /[A-Z]|^ms/g\n\nlet animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g\n\nconst processStyleName = memoize((styleName: string) =>\n  styleName.replace(hyphenateRegex, '-$&').toLowerCase()\n)\n\nlet processStyleValue = (key: string, value: string): string => {\n  if (value == null || typeof value === 'boolean') {\n    return ''\n  }\n\n  switch (key) {\n    case 'animation':\n    case 'animationName': {\n      value = value.replace(animationRegex, (match, p1, p2) => {\n        styles = p2 + styles\n        return p1\n      })\n    }\n  }\n\n  if (\n    unitless[key] !== 1 &&\n    key.charCodeAt(1) !== 45 && // custom properties\n    !isNaN(value) &&\n    value !== 0\n  ) {\n    return value + 'px'\n  }\n  return value\n}\n\nif (process.env.NODE_ENV !== 'production') {\n  let contentValuePattern = /(attr|calc|counters?|url)\\(/\n  let contentValues = [\n    'normal',\n    'none',\n    'counter',\n    'open-quote',\n    'close-quote',\n    'no-open-quote',\n    'no-close-quote',\n    'initial',\n    'inherit',\n    'unset'\n  ]\n  let oldProcessStyleValue = processStyleValue\n  processStyleValue = (key: string, value: string) => {\n    if (key === 'content') {\n      if (\n        typeof value !== 'string' ||\n        (contentValues.indexOf(value) === -1 &&\n          !contentValuePattern.test(value) &&\n          (value.charAt(0) !== value.charAt(value.length - 1) ||\n            (value.charAt(0) !== '\"' && value.charAt(0) !== \"'\")))\n      ) {\n        console.error(\n          `You seem to be using a value for 'content' without quotes, try replacing it with \\`content: '\"${value}\"'\\``\n        )\n      }\n    }\n    return oldProcessStyleValue(key, value)\n  }\n}\n\nfunction handleInterpolation(\n  mergedProps: void | Object,\n  registered: RegisteredCache,\n  interpolation: Interpolation\n): string | number {\n  if (interpolation == null) {\n    return ''\n  }\n  if (interpolation.__emotion_styles !== undefined) {\n    if (\n      process.env.NODE_ENV !== 'production' &&\n      interpolation.toString() === 'NO_COMPONENT_SELECTOR'\n    ) {\n      throw new Error(\n        'Component selectors can only be used in conjunction with babel-plugin-emotion.'\n      )\n    }\n    return interpolation\n  }\n\n  switch (typeof interpolation) {\n    case 'boolean': {\n      return ''\n    }\n    case 'object': {\n      if (interpolation.anim === 1) {\n        styles = interpolation.styles + styles\n        return interpolation.name\n      }\n      if (interpolation.styles !== undefined) {\n        return interpolation.styles\n      }\n\n      return createStringFromObject(mergedProps, registered, interpolation)\n    }\n    case 'function': {\n      if (mergedProps !== undefined) {\n        return handleInterpolation(\n          mergedProps,\n          registered,\n          // $FlowFixMe\n          interpolation(mergedProps)\n        )\n      }\n    }\n    // eslint-disable-next-line no-fallthrough\n    default: {\n      const cached = registered[interpolation]\n      return cached !== undefined ? cached : interpolation\n    }\n  }\n}\n\nfunction createStringFromObject(\n  mergedProps: void | Object,\n  registered: RegisteredCache,\n  obj: { [key: string]: Interpolation }\n): string {\n  let string = ''\n\n  if (Array.isArray(obj)) {\n    for (let i = 0; i < obj.length; i++) {\n      string += handleInterpolation(mergedProps, registered, obj[i])\n    }\n  } else {\n    for (let key in obj) {\n      if (typeof obj[key] !== 'object') {\n        string += `${processStyleName(key)}:${processStyleValue(\n          key,\n          obj[key]\n        )};`\n      } else {\n        if (\n          key === 'NO_COMPONENT_SELECTOR' &&\n          process.env.NODE_ENV !== 'production'\n        ) {\n          throw new Error(\n            'Component selectors can only be used in conjunction with @emotion/babel-plugin-core.'\n          )\n        }\n        if (\n          Array.isArray(obj[key]) &&\n          (typeof obj[key][0] === 'string' &&\n            registered[obj[key][0]] === undefined)\n        ) {\n          obj[key].forEach(value => {\n            string += `${processStyleName(key)}:${processStyleValue(\n              key,\n              value\n            )};`\n          })\n        } else {\n          string += `${key}{${handleInterpolation(\n            mergedProps,\n            registered,\n            obj[key]\n          )}}`\n        }\n      }\n    }\n  }\n\n  return string\n}\n\nlet labelPattern = /label:\\s*([^\\s;\\n{]+)\\s*;/g\n\n// this is set to an empty string on each serializeStyles call\n// it's declared in the module scope since we need to add to\n// it in the middle of serialization to add styles from keyframes\nlet styles = ''\n\nexport const serializeStyles = function(\n  registered: RegisteredCache,\n  args: Array<Interpolation>,\n  mergedProps: void | Object\n): ScopedInsertableStyles {\n  if (\n    args.length === 1 &&\n    typeof args[0] === 'object' &&\n    args[0] !== null &&\n    args[0].styles !== undefined\n  ) {\n    return args[0]\n  }\n  let stringMode = true\n  styles = ''\n  let identifierName = ''\n  let strings = args[0]\n  if (strings == null || strings.raw === undefined) {\n    stringMode = false\n    // we have to store this in a variable and then append it to styles since\n    // styles could be modified in handleInterpolation and using += would mean\n    // it would append the return value of handleInterpolation to the value before handleInterpolation is called\n    let stringifiedInterpolation = handleInterpolation(\n      mergedProps,\n      registered,\n      strings\n    )\n    styles += stringifiedInterpolation\n  } else {\n    styles += strings[0]\n  }\n  // we start at 1 since we've already handled the first arg\n  for (let i = 1; i < args.length; i++) {\n    // we have to store this in a variable and then append it to styles since\n    // styles could be modified in handleInterpolation and using += would mean\n    // it would append the return value of handleInterpolation to the value before handleInterpolation is called\n    let stringifiedInterpolation = handleInterpolation(\n      mergedProps,\n      registered,\n      args[i]\n    )\n    styles += stringifiedInterpolation\n    if (stringMode) {\n      styles += strings[i]\n    }\n  }\n\n  styles = styles.replace(labelPattern, (match, p1: string) => {\n    identifierName += `-${p1}`\n    return ''\n  })\n\n  let name = hashString(styles) + identifierName\n\n  return {\n    name,\n    styles\n  }\n}\n","// @flow\n\nexport default function memoize<V>(fn: string => V): string => V {\n  const cache = {}\n\n  return (arg: string) => {\n    if (cache[arg] === undefined) cache[arg] = fn(arg)\n    return cache[arg]\n  }\n}\n","// @flow\n/* eslint-disable */\n// murmurhash2 via https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js\n\nexport default function murmurhash2_32_gc(str: string) {\n  var l = str.length,\n    h = l ^ l,\n    i = 0,\n    k\n\n  while (l >= 4) {\n    k =\n      (str.charCodeAt(i) & 0xff) |\n      ((str.charCodeAt(++i) & 0xff) << 8) |\n      ((str.charCodeAt(++i) & 0xff) << 16) |\n      ((str.charCodeAt(++i) & 0xff) << 24)\n\n    k = (k & 0xffff) * 0x5bd1e995 + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16)\n    k ^= k >>> 24\n    k = (k & 0xffff) * 0x5bd1e995 + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16)\n\n    h =\n      ((h & 0xffff) * 0x5bd1e995 +\n        ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^\n      k\n\n    l -= 4\n    ++i\n  }\n\n  switch (l) {\n    case 3:\n      h ^= (str.charCodeAt(i + 2) & 0xff) << 16\n    case 2:\n      h ^= (str.charCodeAt(i + 1) & 0xff) << 8\n    case 1:\n      h ^= str.charCodeAt(i) & 0xff\n      h =\n        (h & 0xffff) * 0x5bd1e995 + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)\n  }\n\n  h ^= h >>> 13\n  h = (h & 0xffff) * 0x5bd1e995 + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)\n  h ^= h >>> 15\n\n  return (h >>> 0).toString(36)\n}\n"],"names":["unitlessKeys","animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","WebkitLineClamp","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","fn","cache","hyphenateRegex","animationRegex","processStyleName","styleName","replace","toLowerCase","arg","undefined","processStyleValue","key","value","match","p1","p2","styles","unitless","charCodeAt","isNaN","handleInterpolation","mergedProps","registered","interpolation","__emotion_styles","anim","name","obj","string","Array","isArray","i","length","forEach","createStringFromObject","cached","labelPattern","args","stringMode","identifierName","strings","raw","stringifiedInterpolation","str","k","l","h","toString","hashString"],"mappings":"mMACA,IAAIA,EAAqC,CACvCC,wBAAyB,EACzBC,kBAAmB,EACnBC,iBAAkB,EAClBC,iBAAkB,EAClBC,QAAS,EACTC,aAAc,EACdC,gBAAiB,EACjBC,YAAa,EACbC,QAAS,EACTC,KAAM,EACNC,SAAU,EACVC,aAAc,EACdC,WAAY,EACZC,aAAc,EACdC,UAAW,EACXC,QAAS,EACTC,WAAY,EACZC,YAAa,EACbC,aAAc,EACdC,WAAY,EACZC,cAAe,EACfC,eAAgB,EAChBC,gBAAiB,EACjBC,WAAY,EACZC,WAA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