{"version":3,"sources":["../src/chakra-provider.tsx"],"sourcesContent":["import { CSSReset, CSSPolyfill } from \"@chakra-ui/css-reset\"\nimport { PortalManager } from \"@chakra-ui/portal\"\nimport {\n  ColorModeProvider,\n  ColorModeProviderProps,\n  GlobalStyle,\n  ThemeProvider,\n  ThemeProviderProps,\n} from \"@chakra-ui/system\"\nimport { Dict } from \"@chakra-ui/utils\"\nimport {\n  EnvironmentProvider,\n  EnvironmentProviderProps,\n} from \"@chakra-ui/react-env\"\n\nexport interface ChakraProviderProps\n  extends Pick<ThemeProviderProps, \"cssVarsRoot\"> {\n  /**\n   * a theme. if omitted, uses the default theme provided by chakra\n   */\n  theme?: Dict\n  /**\n   * Common z-index to use for `Portal`\n   *\n   * @default undefined\n   */\n  portalZIndex?: number\n  /**\n   * If `true`, `CSSReset` component will be mounted to help\n   * you reset browser styles\n   *\n   * @default true\n   */\n  resetCSS?: boolean\n  /**\n   * The selector to scope the css reset styles to.\n   */\n  resetScope?: string\n  /**\n   * manager to persist a users color mode preference in\n   *\n   * omit if you don't render server-side\n   * for SSR: choose `cookieStorageManager`\n   *\n   * @default localStorageManager\n   */\n  colorModeManager?: ColorModeProviderProps[\"colorModeManager\"]\n  /**\n   * Your application content\n   */\n  children?: React.ReactNode\n  /**\n   * The environment (`window` and `document`) to be used by\n   * all components and hooks.\n   *\n   * By default, we smartly determine the ownerDocument and defaultView\n   * based on where `ChakraProvider` is rendered.\n   */\n  environment?: EnvironmentProviderProps[\"environment\"]\n  /**\n   * Disabled the use of automatic window and document detection.\n   * This removed the injected `<span/>` element\n   */\n  disableEnvironment?: boolean\n  /**\n   * If `true`, Chakra will not mount the global styles defined in the theme.\n   */\n  disableGlobalStyle?: boolean\n}\n\n/**\n * The global provider that must be added to make all Chakra components\n * work correctly\n */\nexport const ChakraProvider: React.FC<ChakraProviderProps> = (props) => {\n  const {\n    children,\n    colorModeManager,\n    portalZIndex,\n    resetScope,\n    resetCSS = true,\n    theme = {},\n    environment,\n    cssVarsRoot,\n    disableEnvironment,\n    disableGlobalStyle,\n  } = props\n\n  const _children = (\n    <EnvironmentProvider\n      environment={environment}\n      disabled={disableEnvironment}\n    >\n      {children}\n    </EnvironmentProvider>\n  )\n\n  return (\n    <ThemeProvider theme={theme as Dict} cssVarsRoot={cssVarsRoot}>\n      <ColorModeProvider\n        colorModeManager={colorModeManager}\n        options={theme.config}\n      >\n        {resetCSS ? <CSSReset scope={resetScope} /> : <CSSPolyfill />}\n        {!disableGlobalStyle && <GlobalStyle />}\n        {portalZIndex ? (\n          <PortalManager zIndex={portalZIndex}>{_children}</PortalManager>\n        ) : (\n          _children\n        )}\n      </ColorModeProvider>\n    </ThemeProvider>\n  )\n}\n"],"mappings":";;;AAAA,SAAS,UAAU,mBAAmB;AACtC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,OAEK;AA4EH,cAUE,YAVF;AAfG,IAAM,iBAAgD,CAAC,UAAU;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,QAAQ,CAAC;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,YACJ;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,UAAU;AAAA,MAET;AAAA;AAAA,EACH;AAGF,SACE,oBAAC,iBAAc,OAAsB,aACnC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,SAAS,MAAM;AAAA,MAEd;AAAA,mBAAW,oBAAC,YAAS,OAAO,YAAY,IAAK,oBAAC,eAAY;AAAA,QAC1D,CAAC,sBAAsB,oBAAC,eAAY;AAAA,QACpC,eACC,oBAAC,iBAAc,QAAQ,cAAe,qBAAU,IAEhD;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}