{"version":3,"sources":["webpack:///./src/js/modules/weatherWidget/components/Panel.js","webpack:///./src/js/modules/weatherWidget/index.js","webpack:///./node_modules/prop-types/index.js","webpack:///./node_modules/prop-types/factoryWithThrowingShims.js","webpack:///./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack:///./node_modules/classnames/index.js"],"names":["Panel","isOpen","report","unit","onUnitChange","onClose","forecastLabel","snowLabel","acreageLabel","snow24hrLabel","snow48hrLabel","snow7dayLabel","loaded","useRef","panelRef","panelBoxRef","ignoreUtilFocusChanges","lastFocus","navRef","navButtonsRefs","useState","selectedMountain","setSelectedMountain","mountains","weather","content","breakpoint","window","matchMedia","breakpoints","tabletLandscape","animatePanel","useCallback","direction","panel","current","panelBox","timeline","anime","easing","begin","style","visibility","complete","focusFirstDescendant","add","targets","opacity","duration","matches","translateX","animatedElement","querySelectorAll","closeButton","querySelector","delay","stagger","translateY","toggle","document","body","position","top","scrollY","scrollTo","parseInt","useEffect","handleFocus","e","contains","target","activeElement","focusLastDescendant","addEventListener","removeEventListener","listener","addListener","removeListener","element","i","childNodes","length","child","attemptFocus","isFocusable","focus","nf","Intl","NumberFormat","left","offsetLeft","behavior","className","ref","viewBox","xlinkHref","aria-label","onClick","data-animate","map","mountain","index","key","name","classNames","active","condition_title","temperature","toUpperCase","weatherIconMap","condition","high","low","snow","imperial","acres","format","open","total","button_links","link","url","href","link_text","text_links","propTypes","PropTypes","bool","isRequired","object","string","func","WeatherWidget","endpoint","props","setIsOpen","setReport","localStorage","getItem","selectedUnit","setSelectedUnit","Axios","method","data","fetchData","closeEvent","CustomEvent","customEvents","closeMobilePrimaryNavTrigger","dispatchEvent","handleEventClose","closeWeatherWidgetTrigger","setItem","module","exports","ReactPropTypesSecret","emptyFunction","emptyFunctionWithReset","resetWarningCache","shim","propName","componentName","location","propFullName","secret","err","Error","getShim","ReactPropTypes","array","number","symbol","any","arrayOf","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","hasOwn","hasOwnProperty","classes","arguments","arg","argType","push","Array","isArray","inner","apply","toString","Object","prototype","call","join","default"],"mappings":"kmDAQA,IAAMA,EAAQ,SAAC,GAYT,MAXJC,EAWI,EAXJA,OACAC,EAUI,EAVJA,OACAC,EASI,EATJA,KACAC,EAQI,EARJA,aACAC,EAOI,EAPJA,QACAC,EAMI,EANJA,cACAC,EAKI,EALJA,UACAC,EAII,EAJJA,aACAC,EAGI,EAHJA,cACAC,EAEI,EAFJA,cACAC,EACI,EADJA,cAEMC,EAASC,kBAAO,GAChBC,EAAWD,iBAAO,MAClBE,EAAcF,iBAAO,MAErBG,EAAyBH,iBAAO,MAChCI,EAAYJ,iBAAO,MACnBK,EAASL,iBAAO,MAChBM,EAAiBN,iBAAO,IAE9B,IAAgDO,mBAAS,GAAzD,GAAOC,EAAP,KAAyBC,EAAzB,KACA,EAA6BpB,EAAOqB,UAAUF,GAAtCG,EAAR,EAAQA,QAASC,EAAjB,EAAiBA,QAEXC,EAAaC,OAAOC,WAAP,sBACFC,IAAYC,gBADV,QAIbC,EAAeC,uBACnB,YAA8B,QAA3BC,iBAA2B,MAAf,SAAe,EACtBC,EAAQpB,EAASqB,QACjBC,EAAWrB,EAAYoB,QAEvBE,EAAWC,IAAMD,SAAS,CAC9BE,OAAQ,gBACRN,YACAO,MAAO,WACa,WAAdP,IACFC,EAAMO,MAAMC,WAAa,YAG7BC,SAAU,WACU,YAAdV,EACFC,EAAMO,MAAMC,WAAa,SAEzBE,EAAqBR,MAW3B,GANAC,EAASQ,IAAI,CACXC,QAASZ,EACTa,QAAS,CAAC,EAAG,GACbC,SAAUtB,EAAWuB,QAAU,IAAM,IAGnCvB,EAAWuB,QAAS,CACtBZ,EAASQ,IAAI,CACXC,QAASV,EACTc,WAAY,CAAC,OAAQ,MACrBF,SAAU,MAGZ,IAAMG,EAAkBf,EAASgB,iBAAiB,kBAC5CC,EAAcjB,EAASkB,cAC3B,gCAGFjB,EAASQ,IAAI,CACXC,QAAS,GAAF,SAAMK,G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AAKvF,QAIfmF,EAAQI,KAAKF,EAAIO,aAKpB,OAAOT,EAAQa,KAAK,KAGgB7C,EAAOC,SAC3ClD,EAAW+F,QAAU/F,EACrBiD,EAAOC,QAAUlD,QAKhB,KAFwB,EAAF,WACtB,OAAOA,GACP,QAFoB,OAEpB,aA9CH","file":"27.d52f61e7a82a58c7a65f.js","sourcesContent":["import React, { useState, useRef, useEffect, useCallback } from 'react';\nimport anime from 'animejs';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport { isFocusable } from '../../../helpers';\nimport { breakpoints, weatherIconMap } from '../../../helpers/constants';\n\nconst Panel = ({\n  isOpen,\n  report,\n  unit,\n  onUnitChange,\n  onClose,\n  forecastLabel,\n  snowLabel,\n  acreageLabel,\n  snow24hrLabel,\n  snow48hrLabel,\n  snow7dayLabel\n}) => {\n  const loaded = useRef(false);\n  const panelRef = useRef(null);\n  const panelBoxRef = useRef(null);\n\n  const ignoreUtilFocusChanges = useRef(null);\n  const lastFocus = useRef(null);\n  const navRef = useRef(null);\n  const navButtonsRefs = useRef([]);\n\n  const [selectedMountain, setSelectedMountain] = useState(0);\n  const { weather, content } = report.mountains[selectedMountain];\n\n  const breakpoint = window.matchMedia(\n    `(min-width: ${breakpoints.tabletLandscape}px)`\n  );\n\n  const animatePanel = useCallback(\n    ({ direction = 'normal' }) => {\n      const panel = panelRef.current;\n      const panelBox = panelBoxRef.current;\n\n      const timeline = anime.timeline({\n        easing: 'easeInOutQuad',\n        direction,\n        begin: () => {\n          if (direction === 'normal') {\n            panel.style.visibility = 'visible';\n          }\n        },\n        complete: () => {\n          if (direction === 'reverse') {\n            panel.style.visibility = 'hidden';\n          } else {\n            focusFirstDescendant(panelBox);\n          }\n        }\n      });\n\n      timeline.add({\n        targets: panel,\n        opacity: [0, 1],\n        duration: breakpoint.matches ? 150 : 0\n      });\n\n      if (breakpoint.matches) {\n        timeline.add({\n          targets: panelBox,\n          translateX: ['100%', '0%'],\n          duration: 400\n        });\n\n        const animatedElement = panelBox.querySelectorAll('[data-animate]');\n        const closeButton = panelBox.querySelector(\n          '.weather-widget__panel-close'\n        );\n\n        timeline.add({\n          targets: [...animatedElement, closeButton],\n          opacity: [0, 1],\n          translateX: ['10%', '0%'],\n          duration: 300,\n          delay: anime.stagger(100)\n        });\n      } else {\n        timeline.add({\n          targets: panelBox,\n          translateY: ['100%', '0%'],\n          duration: 400\n        });\n      }\n    },\n    [breakpoint.matches, focusFirstDescendant]\n  );\n\n  const toggle = useCallback(() => {\n    if (loaded.current) {\n      if (isOpen) {\n        document.body.style.position = 'fixed';\n        document.body.style.top = `-${window.scrollY}px`;\n        animatePanel({});\n      } else {\n        const scrollY = document.body.style.top;\n        document.body.style.position = null;\n        document.body.style.top = null;\n        window.scrollTo(0, parseInt(scrollY || '0') * -1);\n        animatePanel({ direction: 'reverse' });\n      }\n    } else {\n      loaded.current = true;\n    }\n  }, [animatePanel, isOpen]);\n\n  useEffect(() => {\n    toggle();\n  }, [toggle]);\n\n  useEffect(() => {\n    const handleFocus = e => {\n      if (ignoreUtilFocusChanges.current) return;\n\n      if (panelBoxRef.current.contains(e.target)) {\n        lastFocus.current = e.target;\n      } else {\n        focusFirstDescendant(panelBoxRef.current);\n\n        if (lastFocus.current === document.activeElement) {\n          focusLastDescendant(panelBoxRef.current);\n        }\n        lastFocus.current = document.activeElement;\n      }\n    };\n\n    document.addEventListener('focus', handleFocus, true);\n    return () => {\n      document.removeEventListener('focus', handleFocus, true);\n    };\n  }, [focusFirstDescendant, focusLastDescendant]);\n\n  useEffect(() => {\n    const listener = () => {\n      panelRef.current.style = null;\n      panelBoxRef.current.style = null;\n      toggle();\n    };\n\n    breakpoint.addListener(listener);\n    return () => breakpoint.removeListener(listener);\n  }, [breakpoint, toggle]);\n\n  const focusFirstDescendant = useCallback(\n    element => {\n      for (let i = 0; i < element.childNodes.length; i++) {\n        const child = element.childNodes[i];\n        if (attemptFocus(child) || focusFirstDescendant(child)) {\n          return true;\n        }\n      }\n      return false;\n    },\n    [attemptFocus]\n  );\n\n  const focusLastDescendant = useCallback(\n    element => {\n      for (let i = element.childNodes.length - 1; i >= 0; i--) {\n        const child = element.childNodes[i];\n        if (attemptFocus(child) || focusLastDescendant(child)) {\n          return true;\n        }\n      }\n      return false;\n    },\n    [attemptFocus]\n  );\n\n  const attemptFocus = useCallback(element => {\n    if (!isFocusable(element)) {\n      return false;\n    }\n\n    ignoreUtilFocusChanges.current = true;\n    try {\n      element.focus();\n    } catch (e) {\n      return;\n    }\n    ignoreUtilFocusChanges.current = false;\n    return document.activeElement === element;\n  }, []);\n\n  const nf = new Intl.NumberFormat();\n\n  useEffect(() => {\n    if (\n      navRef.current &&\n      navButtonsRefs.current &&\n      navButtonsRefs.current[selectedMountain]\n    ) {\n      const left = navButtonsRefs.current[selectedMountain].offsetLeft;\n      navRef.current.scrollTo({\n        top: 0,\n        left: left - 42,\n        behavior: 'smooth'\n      });\n    }\n  }, [selectedMountain]);\n\n  return (\n    <div className=\"weather-widget__panel\" ref={panelRef}>\n      <div className=\"weather-widget__panel-box\" ref={panelBoxRef}>\n        <svg viewBox=\"0 0 531 600\" className=\"weather-widget__panel-logo\">\n          <title>aspen logo</title>\n          <use xlinkHref=\"#aspen-leaf\" />\n        </svg>\n\n        <button\n          className=\"weather-widget__panel-close\"\n          aria-label=\"Close\"\n          onClick={onClose}\n        >\n          <svg viewBox=\"0 0 246 246\">\n            <title>panel close</title>\n            <use xlinkHref=\"#close\" />\n          </svg>\n        </button>\n        <ul className=\"weather-widget__navigation\" data-animate ref={navRef}>\n          {report.mountains?.map((mountain, index) => (\n            <li key={mountain.name}>\n              <button\n                ref={ref => (navButtonsRefs.current[index] = ref)}\n                className={classNames({\n                  active: selectedMountain === index\n                })}\n                onClick={() => setSelectedMountain(index)}\n              >\n                {mountain.name}\n              </button>\n            </li>\n          ))}\n        </ul>\n        <div className=\"weather-widget__panel-inner\">\n          {!!weather && (\n            <div>\n              <p className=\"weather-widget__panel-label\" data-animate>\n                {forecastLabel}: <strong>{weather.condition_title}</strong>\n              </p>\n              <div data-animate>\n                <div className=\"weather-widget__panel-unit-toggle\">\n                  <button\n                    className={classNames({ active: unit === 'f' })}\n                    onClick={() => onUnitChange('f')}\n                  >\n                    °F\n                  </button>\n                  <button\n                    className={classNames({ active: unit === 'c' })}\n                    onClick={() => onUnitChange('c')}\n                  >\n                    °C\n                  </button>\n                </div>\n                <div className=\"weather-widget__panel-today\">\n                  <p className=\"weather-widget__panel-value\">\n                    {weather.temperature.current[unit]}°{unit.toUpperCase()}\n                  </p>\n                  <svg className=\"weather-widget__panel-icon\">\n                    <title>weather</title>\n                    <use xlinkHref={`#${weatherIconMap[weather.condition]}`} />\n                  </svg>\n                  <div className=\"weather-widget__panel-max-min\">\n                    <p>\n                      <svg viewBox=\"0 0 11 16\">\n                        <title>highest</title>\n                        <use xlinkHref=\"#arrow-up\" />\n                      </svg>\n                      {weather.temperature.high[unit]}°{unit.toUpperCase()}\n                    </p>\n                    <p>\n                      <svg viewBox=\"0 0 11 15\">\n                        <title>lowest</title>\n                        <use xlinkHref=\"#arrow-down\" />\n                      </svg>\n                      {weather.temperature.low[unit]}°{unit.toUpperCase()}\n                    </p>\n                  </div>\n                </div>\n              </div>\n              {weather.snow && (\n                <>\n                  <p className=\"weather-widget__panel-label\" data-animate>\n                    {snowLabel}\n                  </p>\n                  <div className=\"weather-widget__panel-value-row\" data-animate>\n                    <p className=\"weather-widget__panel-value\">\n                      {weather.snow['_24_hour'].imperial}”\n                      <span>{snow24hrLabel}</span>\n                    </p>\n                    <p className=\"weather-widget__panel-value\">\n                      {weather.snow['_48_hour'].imperial}”\n                      <span>{snow48hrLabel}</span>\n                    </p>\n                    <p className=\"weather-widget__panel-value\">\n                      {weather.snow['_7_day'].imperial}”\n                      <span>{snow7dayLabel}</span>\n                    </p>\n                  </div>\n                </>\n              )}\n              {!!weather.acres && (\n                <div className=\"weather-widget__panel-value-row\">\n                  <p className=\"weather-widget__panel-label\" data-animate>\n                    {acreageLabel}\n                  </p>\n                  <p className=\"weather-widget__panel-value\" data-animate>\n                    {nf.format(weather.acres.open || 0)}{' '}\n                    <span className=\"weather-widget__panel-value\">\n                      of {nf.format(weather.acres.total || 0)}\n                    </span>\n                  </p>\n                </div>\n              )}\n            </div>\n          )}\n          <ul className=\"weather-widget__links\" data-animate>\n            {content?.button_links.map(link => (\n              <li key={link.url}>\n                <a href={link.url} target={link.target}>\n                  {link.link_text}\n                </a>\n              </li>\n            ))}\n            {content?.text_links.map(link => (\n              <li key={link.url}>\n                <a href={link.url} target={link.target}>\n                  {link.link_text}\n                </a>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </div>\n    </div>\n  );\n};\n\nPanel.propTypes = {\n  isOpen: PropTypes.bool.isRequired,\n  report: PropTypes.object.isRequired,\n  unit: PropTypes.string.isRequired,\n  onUnitChange: PropTypes.func.isRequired,\n  onClose: PropTypes.func.isRequired,\n  forecastLabel: PropTypes.string.isRequired,\n  snowLabel: PropTypes.string.isRequired,\n  acreageLabel: PropTypes.string.isRequired,\n  snow24hrLabel: PropTypes.string.isRequired,\n  snow48hrLabel: PropTypes.string.isRequired,\n  snow7dayLabel: PropTypes.string.isRequired\n};\n\nexport default Panel;\n","import React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport Axios from 'axios';\n\nimport Panel from './components/Panel';\nimport { breakpoints, customEvents, weatherIconMap } from '../../helpers/constants';\n\nconst WeatherWidget = ({ endpoint, ...props }) => {\n  const breakpoint = window.matchMedia(\n    `(min-width: ${breakpoints.tabletLandscape}px)`\n  );\n  const [isOpen, setIsOpen] = useState(false);\n  const [report, setReport] = useState({});\n  const [selectedUnit, setSelectedUnit] = useState(\n    window.localStorage.getItem('aspen_weather_unit') || 'f'\n  );\n\n  useEffect(() => {\n    const fetchData = async () => {\n      const { data } = await Axios({\n        method: 'GET',\n        url: endpoint\n      });\n\n      setReport(data);\n    };\n\n    fetchData();\n  }, [endpoint]);\n\n  useEffect(() => {\n    if (isOpen) {\n      const closeEvent = new CustomEvent(customEvents.closeMobilePrimaryNavTrigger);\n      window.dispatchEvent(closeEvent);\n    }\n  }, [isOpen])\n\n  const handleEventClose = () => (\n    setIsOpen(false)\n  )\n\n  useEffect(() => {\n    window.addEventListener(customEvents.closeWeatherWidgetTrigger, handleEventClose);\n    return () => window.removeEventListener(customEvents.closeWeatherWidgetTrigger, handleEventClose);\n  }, [])\n\n  const handleSelectUnit = unit => {\n    setSelectedUnit(unit);\n    window.localStorage.setItem('aspen_weather_unit', unit);\n  };\n\n  if (!report.mountains?.length) {\n    return null;\n  }\n\n  const {\n    weather: { condition, temperature }\n  } = report.mountains[0];\n\n  return (\n    <>\n      <button\n        className=\"weather-widget__trigger\"\n        onClick={() => setIsOpen(!isOpen)}\n      >\n        {isOpen && !breakpoint.matches ? (\n          <svg\n            viewBox=\"0 0 246 246\"\n            className=\"weather-widget__trigger-close-icon\"\n          >\n            <title>menu</title>\n            <use xlinkHref=\"#close\" />\n          </svg>\n        ) : (\n          <>\n            <span>\n              {temperature.current[selectedUnit]}°{selectedUnit.toUpperCase()}\n            </span>\n            <svg className=\"weather-widget__trigger-icon\">\n              <title>weather</title>\n              <use xlinkHref={`#${weatherIconMap[condition]}`} />\n            </svg>\n          </>\n        )}\n      </button>\n      <Panel\n        {...props}\n        isOpen={isOpen}\n        report={report}\n        unit={selectedUnit}\n        onUnitChange={handleSelectUnit}\n        onClose={() => setIsOpen(false)}\n      />\n    </>\n  );\n};\n\nWeatherWidget.propTypes = {\n  endpoint: PropTypes.string.isRequired\n};\n\nexport default WeatherWidget;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n  var ReactIs = require('react-is');\n\n  // By explicitly using `prop-types` you are opting into new development behavior.\n  // http://fb.me/prop-types-in-prod\n  var throwOnDirectAccess = true;\n  module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n  // By explicitly using `prop-types` you are opting into new production behavior.\n  // http://fb.me/prop-types-in-prod\n  module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n  function shim(props, propName, componentName, location, propFullName, secret) {\n    if (secret === ReactPropTypesSecret) {\n      // It is still safe when called from React.\n      return;\n    }\n    var err = new Error(\n      'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n      'Use PropTypes.checkPropTypes() to call them. ' +\n      'Read more at http://fb.me/use-check-prop-types'\n    );\n    err.name = 'Invariant Violation';\n    throw err;\n  };\n  shim.isRequired = shim;\n  function getShim() {\n    return shim;\n  };\n  // Important!\n  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n  var ReactPropTypes = {\n    array: shim,\n    bool: shim,\n    func: shim,\n    number: shim,\n    object: shim,\n    string: shim,\n    symbol: shim,\n\n    any: shim,\n    arrayOf: getShim,\n    element: shim,\n    elementType: shim,\n    instanceOf: getShim,\n    node: shim,\n    objectOf: getShim,\n    oneOf: getShim,\n    oneOfType: getShim,\n    shape: getShim,\n    exact: getShim,\n\n    checkPropTypes: emptyFunctionWithReset,\n    resetWarningCache: emptyFunction\n  };\n\n  ReactPropTypes.PropTypes = ReactPropTypes;\n\n  return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/*!\n  Copyright (c) 2018 Jed Watson.\n  Licensed under the MIT License (MIT), see\n  http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString === Object.prototype.toString) {\n\t\t\t\t\tfor (var key in arg) {\n\t\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n"],"sourceRoot":""}