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ASvB,GACvC,MAAAc,GAAAA,EAAUd,EAAQ,EAGpB,OAAO,IAAA2C,cACL,gBAAC,KAAiB3B,IAAKwB,IAAkB,OAAkB,qBACxDD,EAAMK,KAAKC,GACV,gBAACjC,EAAS,KAACkC,IAAKD,EAAKhC,IAAQgC,GAA5B,CAAkC/B,QAAS4B,EAAa3B,eAG7DvF,SAASwH,KAEb,CAxCAV,EAAmC3I,UAAY,CAC7C4I,MAAO,YACL,UAAgB,CACd1B,GAAI,cAGRC,QAAS,SACTC,OAAQ,UAGVuB,EAAmC1I,aAAe,CAChD2I,MAAO,GACPzB,aAAS,EACTC,YAAQ,G,iSCrCV,SAASkC,EAAuBC,GAC9B,MAAM,IAAIC,MAAM,2BAClB,CAEO,MAAMC,GAAe,IAAAC,eAAc,CACxCC,QAASL,EACTM,QAASN,EACTxG,MAAOwG,IAGIO,EAAgB,EAAEnK,eAC7B,MAAOkJ,EAAOkB,IAAY,IAAArC,UAAS,IAE7BsC,GAAW,IAAAC,cAAY,CAAC5G,EAAMV,KAAYuH,KAC9C,MAAM/C,EAAK,SAAS,QACdgD,G,qHAAY,IAAID,G,MAAJ,CAAU7G,OAAMV,UAASwE,S,MAE3C4C,GAASK,GAAgB,CAACD,KAAcC,IAAc,GACrD,IAMGC,GAAU,IAAAhF,UAAQ,KAAM,CAC5BuE,QAAS,CAACjH,EAASuH,IAASF,EAAS,UAAWrH,EAASuH,GACzDL,QAAS,CAAClH,EAASuH,IAASF,EAAS,UAAWrH,EAASuH,GACzDnH,MAAO,CAACJ,EAASuH,IAASF,EAAS,QAASrH,EAASuH,MACnD,CAACF,IAEL,OACE,gBAACN,EAAaxD,SAAb,CAAsBC,MAAOkE,GAC3B1K,EACD,gBAACiJ,EAAkC,CAACC,QAAcxB,OAblCiD,IAClBP,GAASK,GAAgBA,EAAaG,QAAOpB,GAAQA,EAAKhC,KAAOmD,KAAS,IAa1E,C","sources":["webpack://nodalview/./app/javascript/src/global/test_helper.js","webpack://nodalview/./app/javascript/src/react/apollo/graphql_provider.jsx","webpack://nodalview/./app/javascript/src/react/apollo/private/cache/possible_types.js","webpack://nodalview/./app/javascript/src/react/apollo/private/cache/field_policies.js","webpack://nodalview/./app/javascript/src/react/apollo/private/cache/type_policies.js","webpack://nodalview/./app/javascript/src/react/apollo/private/apollo_client.js","webpack://nodalview/./app/javascript/src/react/apollo/public/apollo_client.js","webpack://nodalview/./app/javascript/src/react/apollo/public/cache/possible_types.js","webpack://nodalview/./app/javascript/src/react/apollo/public/cache/field_policies.js","webpack://nodalview/./app/javascript/src/react/apollo/public/cache/type_policies.js","webpack://nodalview/./app/javascript/src/react/providers/nodes_provider/nodes_provider.jsx","webpack://nodalview/./app/javascript/src/react/providers/toast_provider/helper.js","webpack://nodalview/./app/javascript/src/react/providers/toast_provider/components/toast_item.styled.jsx","webpack://nodalview/./app/javascript/src/react/providers/toast_provider/components/toast_item.jsx","webpack://nodalview/./app/javascript/src/react/providers/toast_provider/components/toasts_container.styled.jsx","webpack://nodalview/./app/javascript/src/react/providers/toast_provider/components/toasts_container.jsx","webpack://nodalview/./app/javascript/src/react/providers/toast_provider/toast_provider.jsx"],"sourcesContent":["// eslint-disable-next-line camelcase\nimport { enable_data_test_attributes } from 'NodalviewEnvironment';\n\nexport function purposeAttributes(purpose) {\n  if (enable_data_test_attributes) {\n    return { 'data-test-purpose': purpose };\n  } else {\n    return {};\n  }\n}\n","import { ApolloProvider } from '@apollo/client/react';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport { privateApolloClient } from './private/apollo_client';\nimport { publicApolloClient } from './public/apollo_client';\n\nexport const GraphQLProvider = ({ children, scope }) => {\n  const client = scope === 'public' ? publicApolloClient : privateApolloClient;\n\n  return <ApolloProvider client={client}>{children}</ApolloProvider>;\n};\n\nexport const WithGraphqlProvider = (Component, scope) => (props) => (\n  <GraphQLProvider scope={scope}>\n    <Component {...props} />\n  </GraphQLProvider>\n);\n\nGraphQLProvider.propTypes = {\n  scope: PropTypes.oneOf(['public', 'private']),\n};\n\nGraphQLProvider.defaultProps = {\n  scope: 'private',\n};\n","const possibleTypes = {\n\n}\n\nexport { possibleTypes };","const fieldPolicies = {\n  tours: {\n    keyArgs: [\"input\"],\n  },\n  socialMediaPostsIndex: {\n    keyArgs: [\"date\"],\n    merge(existing = [], incoming = []) {\n      return [...existing, ...incoming];\n    }\n  }\n}\n\nexport { fieldPolicies };","const typePolicies = {\n  UserResourceUsage: {\n    keyFields: [\"id\", \"resourceType\"],\n  },\n  UserInvitation: {\n    keyFields: ['uuid'],\n  },\n  VideoMakerSequence: {\n    keyFields: ['uuid'],\n  },\n  Layer: {\n    fields: {\n      operations: {\n        merge(existing, incoming) {\n          return incoming;\n        },\n      }\n    }\n  },\n  Document: {\n    keyFields: ['uuid'],\n  }\n}\n\nexport {typePolicies};","import { ApolloClient, ApolloLink, createHttpLink, InMemoryCache, split } from '@apollo/client';\nimport { BatchHttpLink } from '@apollo/client/link/batch-http';\nimport { setContext } from '@apollo/client/link/context';\nimport { onError } from '@apollo/client/link/error';\nimport { createConsumer } from '@rails/actioncable';\nimport ActionCableLink from 'graphql-ruby-client/subscriptions/ActionCableLink';\nimport { fieldPolicies, possibleTypes, typePolicies } from './cache';\n\nconst cable = createConsumer();\n\nconst batchLink = new BatchHttpLink({\n  batchMax: 5,\n  uri: '/api/web/private_graphql',\n  credentials: 'include',\n});\n\nconst httpLink = createHttpLink({\n  uri: '/api/web/private_graphql',\n  credentials: 'include',\n});\n\nconst skipBatchLink = ({ query: { definitions } }) => {\n  const hasMutation = definitions.some(\n    ({ kind, operation }) => kind === 'OperationDefinition' && operation === 'mutation',\n  );\n\n  return hasMutation || RAILS_ENV === 'test';\n};\n\nconst hasSubscriptionOperation = ({ query: { definitions } }) =>\n  definitions.some(\n    ({ kind, operation }) => kind === 'OperationDefinition' && operation === 'subscription',\n  );\n\nconst authLink = setContext((_, { headers }) => {\n  const csrfTokenElem = document.querySelector(\"meta[name='csrf-token']\");\n  const csrfToken = csrfTokenElem ? csrfTokenElem.getAttribute('content') : '';\n\n  const jwtElem = document.querySelector(\"meta[name='jwt']\");\n  const jwt = jwtElem ? `Bearer ${jwtElem.getAttribute('content')}` : '';\n\n  const nodalviewTransactionIdElem = document.querySelector(\n    \"meta[name='nodalview-transaction-id']\",\n  );\n  const nodalviewTransactionId = nodalviewTransactionIdElem\n    ? nodalviewTransactionIdElem.getAttribute('content')\n    : '';\n\n  return {\n    headers: {\n      ...headers,\n      authorization: jwt,\n      'X-CSRF-TOKEN': csrfToken,\n      'X-Nodalview-Transaction-Id': nodalviewTransactionId,\n    },\n  };\n});\n\nconst errorLink = onError(({ graphQLErrors, networkError }) => {\n  if (graphQLErrors) {\n    graphQLErrors.forEach(({ message, locations, path }) => {\n      console.error(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`);\n    });\n\n    const hasNoCustomErrorCode = graphQLErrors.every(\n      (gqlError) => !gqlError.extensions?.error_code,\n    );\n\n    if (hasNoCustomErrorCode) {\n      // eslint-disable-next-line no-undef\n      new Toast({\n        type: 'error',\n        message: I18n.t('react.errors.graphql.default_error_text'),\n      }).show();\n    }\n  }\n\n  if (networkError) console.error(`[Network error]: ${networkError}`);\n});\n\nconst webLink = ApolloLink.from([errorLink, authLink, split(skipBatchLink, httpLink, batchLink)]);\n\nconst cache = new InMemoryCache({\n  possibleTypes,\n  typePolicies: {\n    Query: {\n      fields: fieldPolicies,\n    },\n    ...typePolicies,\n  },\n});\n\nconst endLink = split(hasSubscriptionOperation, new ActionCableLink({ cable }), webLink);\n\nexport const privateApolloClient = new ApolloClient({\n  link: endLink,\n  cache,\n});\n\n","import { ApolloClient, ApolloLink, createHttpLink, InMemoryCache, split } from '@apollo/client';\nimport { onError } from '@apollo/client/link/error';\nimport { BatchHttpLink } from '@apollo/client/link/batch-http';\nimport ActionCableLink from 'graphql-ruby-client/subscriptions/ActionCableLink';\nimport { createConsumer } from '@rails/actioncable';\nimport { fieldPolicies, possibleTypes, typePolicies } from './cache';\n\nconst cable = createConsumer();\n\nconst hasMutationOperation = ({ query: { definitions } }) => {\n  const hasMutation = definitions.some(\n    ({ kind, operation }) => kind === 'OperationDefinition' && operation === 'mutation',\n  );\n\n  return hasMutation || RAILS_ENV === 'test';\n};\n\nconst hasSubscriptionOperation = ({ query: { definitions } }) =>\n  definitions.some(\n    ({ kind, operation }) => kind === 'OperationDefinition' && operation === 'subscription',\n  );\n\nconst batchLink = new BatchHttpLink({\n  batchMax: 5,\n  uri: '/api/web/public_graphql',\n});\n\nconst httpLink = createHttpLink({\n  uri: '/api/web/public_graphql',\n});\n\nconst errorLink = onError(({ graphQLErrors, networkError }) => {\n  if (graphQLErrors) {\n    graphQLErrors.forEach(({ message, locations, path }) => {\n      console.error(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`);\n    });\n  }\n\n  if (networkError) {\n    console.error(`[Network error]: ${networkError}`);\n  }\n});\n\nconst webLink = ApolloLink.from([errorLink, split(hasMutationOperation, httpLink, batchLink)]);\nconst endLink = split(hasSubscriptionOperation, new ActionCableLink({ cable }), webLink);\n\n\nconst cache = new InMemoryCache({\n  possibleTypes,\n  typePolicies: {\n    Query: {\n      fields: fieldPolicies,\n    },\n    ...typePolicies,\n  },\n});\n\nexport const publicApolloClient = new ApolloClient({\n  link: endLink,\n  cache,\n});\n","const possibleTypes = {\n\n}\n\nexport { possibleTypes };","const fieldPolicies = {\n}\n\nexport { fieldPolicies };","const typePolicies = {\n  \n}\n\nexport {typePolicies};","import { GlobalStyles, Theme, TranslationsContext } from '@nodalview/nodes-web';\nimport { get, has } from 'lodash';\nimport PropTypes from 'prop-types';\nimport { useEffect, useMemo } from 'react';\nimport { ThemeProvider } from 'styled-components';\nimport { Schema } from '@react/helpers';\nimport { ToastProvider } from '../toast_provider';\n\nexport const WithNodesProvider = (Component, options) => {\n  const HocComponent = (props) => (\n    <NodesProvider {...options}>\n      <Component {...props} />\n    </NodesProvider>\n  );\n  HocComponent.displayName = `WithNodesProvider(${Component.displayName ?? 'Component'})`;\n  return HocComponent;\n};\n\nexport const NodesProvider = ({ children, base, colors, fonts }) => {\n  const i18nContext = useMemo(\n    () => ({\n      t: (translationKey, variables) => window.I18n.t(`react.${translationKey}`, variables),\n      i18n: window.I18n,\n    }),\n    [],\n  );\n\n  const theme = new Theme({ base, colors, fonts });\n\n  useEffect(() => {\n    const { locale, translations } = window.I18n ?? {};\n\n    if (!translations) return;\n\n    if (has(translations, `${locale}.react.shared.yup_rules`)) {\n      const rules = get(translations, `${locale}.react.shared.yup_rules`);\n      Schema?.setLocale(rules);\n    } else {\n      const rules = get(translations, 'en.react.shared.yup_rules');\n      Schema?.setLocale(rules);\n    }\n  }, []);\n\n  return (\n    <ThemeProvider theme={theme}>\n      <GlobalStyles />\n      <TranslationsContext.Provider value={i18nContext}>\n        <ToastProvider>{children}</ToastProvider>\n      </TranslationsContext.Provider>\n    </ThemeProvider>\n  );\n};\n\nNodesProvider.propTypes = {\n  base: PropTypes.number,\n  colors: PropTypes.shape({}),\n  fonts: PropTypes.shape({}),\n};\n\nNodesProvider.defaultProps = {\n  base: 14,\n  colors: {},\n  fonts: {},\n};\n","export function animateContainer(container, element) {\n  const {height} = element.getBoundingClientRect();\n\n  container.animate(\n    [\n      {transform: `translateY(-${height}px)`},\n      {transform: 'translateY(0)'},\n    ], {\n      easing: 'ease-out',\n      duration: 300,\n    }\n  );\n}\n\nexport function setDimensions (element) {\n  const {height, width} = element.getBoundingClientRect();\n\n  element.style.setProperty('width', `${width}px`);\n  element.style.setProperty('height', `${height}px`);\n}","import styled, {css} from 'styled-components';\n\nexport const Item = styled.div(({theme: {utils}}) => css`\n  display: block;\n  margin-bottom: ${utils.rem(8)};\n  opacity: 0;\n  transition: ${utils.transition('opacity', 'transform')};\n  transform: translateX(50%);\n  \n  &:hover {\n    cursor: pointer;\n  }\n  \n  &.active {\n    opacity: 1;\n    transform: translateX(0);\n  }\n`)","import { purposeAttributes } from '@global';\nimport { Alert, Transition } from '@nodalview/nodes-web';\nimport PropTypes from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\nimport { setDimensions } from '../helper';\nimport * as Styled from './toast_item.styled';\n\nexport const ToastItem = ({ id, type, message, duration, onEnter, onExit }) => {\n  const ref = useRef(null);\n  const [visible, setVisible] = useState(true);\n  const [hover, setHover] = useState(false);\n\n  useEffect(() => {\n    if (ref.current) {\n      setDimensions(ref.current);\n      onEnter?.(ref.current);\n    }\n    /* eslint-disable-next-line react-hooks/exhaustive-deps */\n  }, [ref]);\n\n  useEffect(() => {\n    if (hover) return;\n\n    const timerId = setTimeout(() => setVisible(false), duration);\n    return () => clearTimeout(timerId);\n    /* eslint-disable-next-line react-hooks/exhaustive-deps */\n  }, [hover]);\n\n  return (\n    <Transition as={Styled.Item} visible={visible} onTransitionEnd={() => onExit(id)}>\n      <Alert\n        type={type}\n        ref={ref}\n        onClick={() => setVisible(false)}\n        onMouseEnter={() => setHover(true)}\n        onMouseLeave={() => setHover(false)}\n        {...purposeAttributes('toast')}\n      >\n        {message}\n      </Alert>\n    </Transition>\n  );\n};\n\nToastItem.propTypes = {\n  id: PropTypes.string.isRequired,\n  type: PropTypes.string,\n  message: PropTypes.string,\n  duration: PropTypes.number,\n  onEnter: PropTypes.func,\n  onExit: PropTypes.func,\n};\n\nToastItem.defaultProps = {\n  type: 'success',\n  message: '',\n  duration: 3500,\n  onEnter: undefined,\n  onExit: undefined,\n};\n","import styled, { css } from 'styled-components';\n\nexport const Container = styled.div(\n  ({ theme: { utils } }) => css`\n    max-height: 100vh;\n    padding: ${utils.rem(16)};\n    position: fixed;\n    right: 0;\n    top: 0;\n    z-index: 2147483647;\n\n    &:empty {\n      display: none;\n    }\n  `,\n);\n\nexport const Item = styled.div(\n  ({ theme: { utils } }) => css`\n    display: block;\n    margin-bottom: ${utils.rem(8)};\n    opacity: 0;\n    transition: ${utils.transition('opacity', 'transform')};\n    transform: translateX(50%);\n\n    &.active {\n      opacity: 1;\n      transform: translateX(0);\n    }\n  `,\n);\n","import { purposeAttributes } from '@global';\nimport PropTypes from 'prop-types';\nimport { useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport { animateContainer } from '@react/providers/toast_provider/helper';\nimport { ToastItem } from './toast_item';\nimport * as Styled from './toasts_container.styled';\n\nexport const BackwardsCompatibleToastsContainer = ({ stack, onEnter, onExit }) => {\n  const containerRef = useRef(document.getElementById('toasts-container'));\n\n  const handleEnter = (element) => {\n    animateContainer(containerRef.current, element);\n    onEnter?.(element);\n  };\n\n  if (!containerRef.current) {\n    return <NewToastsContainer stack={stack} onEnter={onEnter} onExit={onExit} />;\n  }\n\n  return createPortal(\n    stack.map((item) => (\n      <ToastItem key={item.id} {...item} onEnter={handleEnter} onExit={onExit} />\n    )),\n    containerRef.current,\n  );\n};\n\nBackwardsCompatibleToastsContainer.propTypes = {\n  stack: PropTypes.arrayOf(\n    PropTypes.shape({\n      id: PropTypes.string,\n    }),\n  ),\n  onEnter: PropTypes.func,\n  onExit: PropTypes.func,\n};\n\nBackwardsCompatibleToastsContainer.defaultProps = {\n  stack: [],\n  onEnter: undefined,\n  onExit: undefined,\n};\n\n/**\n * This component should be used instead of <BackwardsCompatibleToastsContainer /> when ToastCenter will be totally replaced.\n * @param stack: array\n * @param onEnter: function\n * @param onExit: function\n * @returns {React.ReactPortal}\n * @constructor\n */\nexport function NewToastsContainer({ stack, onEnter, onExit }) {\n  const containerRef = useRef(null);\n\n  const handleEnter = (element) => {\n    animateContainer(containerRef.current, element);\n    onEnter?.(element);\n  };\n\n  return createPortal(\n    <Styled.Container ref={containerRef} {...purposeAttributes('toasts_container')}>\n      {stack.map((item) => (\n        <ToastItem key={item.id} {...item} onEnter={handleEnter} onExit={onExit} />\n      ))}\n    </Styled.Container>,\n    document.body,\n  );\n}\n","import uniqueId from 'lodash/uniqueId'\nimport {createContext, useCallback, useMemo, useState} from \"react\";\nimport {BackwardsCompatibleToastsContainer} from \"./components\";\n\nfunction defaultContextCallback(_message) {\n  throw new Error('ToastProvider is missing')\n}\n\nexport const ToastContext = createContext({\n  success: defaultContextCallback,\n  warning: defaultContextCallback,\n  error: defaultContextCallback,\n})\n\nexport const ToastProvider = ({children}) => {\n  const [stack, setStack] = useState([]);\n\n  const addToast = useCallback((type, message, ...opts) => {\n    const id = `toast-${uniqueId()}`;\n    const toastItem = {...opts, type, message, id};\n\n    setStack(currentStack => [toastItem, ...currentStack]);\n  }, []);\n\n  const handleExit = (toastId) => {\n    setStack(currentStack => currentStack.filter(item => item.id !== toastId));\n  }\n\n  const context = useMemo(() => ({\n    success: (message, opts) => addToast('success', message, opts),\n    warning: (message, opts) => addToast('warning', message, opts),\n    error: (message, opts) => addToast('error', message, opts),\n  }), [addToast]);\n\n  return (\n    <ToastContext.Provider value={context}>\n      {children}\n      <BackwardsCompatibleToastsContainer stack={stack} onExit={handleExit}/>\n    </ToastContext.Provider>\n  )\n}"],"names":["purposeAttributes","purpose","enable_data_test_attributes","GraphQLProvider","children","scope","client","WithGraphqlProvider","Component","props","propTypes","defaultProps","fieldPolicies","tours","keyArgs","socialMediaPostsIndex","merge","existing","incoming","typePolicies","UserResourceUsage","keyFields","UserInvitation","VideoMakerSequence","Layer","fields","operations","Document","cable","batchLink","batchMax","uri","credentials","httpLink","createHttpLink","authLink","_","headers","csrfTokenElem","document","querySelector","csrfToken","getAttribute","jwtElem","jwt","nodalviewTransactionIdElem","nodalviewTransactionId","authorization","errorLink","graphQLErrors","networkError","forEach","message","locations","path","console","error","every","gqlError","extensions","error_code","Toast","type","I18n","t","show","webLink","ApolloLink","from","split","query","definitions","some","kind","operation","cache","possibleTypes","Query","endLink","ActionCableLink","A","privateApolloClient","ApolloClient","link","publicApolloClient","WithNodesProvider","options","HocComponent","NodesProvider","displayName","base","colors","fonts","i18nContext","useMemo","translationKey","variables","window","i18n","theme","useEffect","locale","translations","has","rules","get","setLocale","Provider","value","animateContainer","container","element","height","getBoundingClientRect","animate","transform","easing","duration","Item","div","utils","rem","transition","ToastItem","id","onEnter","onExit","ref","useRef","visible","setVisible","useState","hover","setHover","current","width","style","setProperty","setDimensions","timerId","setTimeout","clearTimeout","as","onTransitionEnd","onClick","onMouseEnter","onMouseLeave","isRequired","Container","BackwardsCompatibleToastsContainer","stack","containerRef","getElementById","handleEnter","createPortal","map","item","key","NewToastsContainer","body","defaultContextCallback","_message","Error","ToastContext","createContext","success","warning","ToastProvider","setStack","addToast","useCallback","opts","toastItem","currentStack","context","toastId","filter"],"sourceRoot":""}