{"version":3,"sources":["webpack:///./node_modules/cocoon-js-vanilla/index.js","webpack:///./app/javascript/packs/public.js","webpack:///./app/javascript/mastodon/load_keyboard_extensions.js"],"names":["document","addEventListener","cocoonElementCounter","createNewID","Date","getTime","newcontentBraced","id","newcontentUnderscored","cocoonAddFields","e","target","preventDefault","stopPropagation","thisNode","assoc","getAttribute","assocs","content","insertionMethod","insertionNode","insertionTraversal","count","parseInt","regexpBraced","RegExp","regexpUnderscored","newId","newContent","replace","newContents","originalEvent","isNaN","Math","max","push","insertionNodeElem","console","warn","querySelector","parentNode","getInsertionNodeElem","length","forEach","node","i","contentNode","beforeInsert","CustomEvent","bubbles","cancelable","detail","dispatchEvent","defaultPrevented","htmlMapping","before","prepend","append","after","htmlMethod","addedContent","insertAdjacentHTML","previousElementSibling","firstElementChild","lastElementChild","nextElementSibling","afterInsert","cocoonRemoveFields","wrapperClass","nodeToDelete","closest","triggerNode","beforeRemove","timeout","setTimeout","classList","contains","parentElement","removeChild","elem","selector","sibling","matches","cocoonGetPreviousSibling","value","style","display","afterRemove","this","start","window","data","parent","type","ready","postMessage","height","getElementsByTagName","scrollHeight","loadPolyfills","then","IntlMessageFormat","require","default","timeAgoString","delegate","emojify","getLocale","messages","ReactDOM","createBrowserHistory","scrollToDetailedStatus","history","detailedStatuses","querySelectorAll","location","state","scrolledToDetailedStatus","scrollIntoView","pathname","getEmojiAnimationHandler","swapTo","src","locale","documentElement","lang","dateTimeFormat","Intl","DateTimeFormat","year","month","day","hour","minute","dateFormat","timeFormat","timeStyle","hour12","call","innerHTML","datetime","formattedDate","format","title","textContent","todayFormat","formattedContent","date","today","getDate","getMonth","getFullYear","isToday","formattedTime","time","now","formatMessage","values","defaultMessage","formatDate","options","includes","reactComponents","MediaContainer","component","children","child","createElement","render","components","body","appendChild","catch","error","password","getElementById","confirmation","maxLength","setCustomValidity","statusEl","dataset","spoiler","spoilerLink","message","name","escapeTextContentForBrowser","avatar","file","files","url","URL","createObjectURL","originalSrc","getProfileAvatarAnimationHandler","swapSrc","header","lock","checked","hidden","focus","select","setSelectionRange","input","oldReadOnly","readonly","execCommand","blur","add","remove","err","toggleSidebar","sidebar","toggleButton","overflow","setAttribute","toggle","key","field","test","navigator","userAgent","arrowKeyNav","register","Promise","resolve"],"mappings":"6EAAAA,SAASC,iBAAiB,oBAAoB,WAC5C,IAAIC,EAAuB,EACvBC,EAAc,WAChB,OAAO,IAAIC,MAAOC,UAAYH,KAE5BI,EAAmB,SAAUC,GAC/B,MAAO,IAAMA,EAAK,OAEhBC,EAAwB,SAAUD,GACpC,MAAO,IAAMA,EAAK,OAgChBE,EAAkB,SAAUC,EAAGC,GACjCD,EAAEE,iBACFF,EAAEG,kBACF,IAAIC,EAAWH,EACXI,EAAQD,EAASE,aAAa,oBAC9BC,EAASH,EAASE,aAAa,qBAC/BE,EAAUJ,EAASE,aAAa,uCAChCG,EAAkBL,EAASE,aAAa,sCAAwCF,EAASE,aAAa,wCAA0C,SAChJI,EAAgBN,EAASE,aAAa,mCACtCK,EAAqBP,EAASE,aAAa,wCAC3CM,EAAQC,SAAST,EAASE,aAAa,cAAe,IACtDQ,EAAe,IAAIC,OAAO,UAAYV,EAAQ,cAAe,KAC7DW,EAAoB,IAAID,OAAO,QAAUV,EAAQ,UAAW,KAC5DY,EAAQxB,IACRyB,EAAaV,EAAQW,QAAQL,EAAclB,EAAiBqB,IAC5DG,EAAc,GACdC,EAAgBrB,EAUpB,IATIkB,IAAeV,IACjBM,EAAe,IAAIC,OAAO,UAAYR,EAAS,cAAe,KAC9DS,EAAoB,IAAID,OAAO,QAAUR,EAAS,UAAW,KAC7DW,EAAaV,EAAQW,QAAQL,EAAclB,EAAiBqB,KAG9DG,EAAc,CADdF,EAAaA,EAAWC,QAAQH,EAAmBlB,EAAsBmB,KAEzEL,EAAQU,MAAMV,GAAS,EAAIW,KAAKC,IAAIZ,EAAO,GAC3CA,GAAS,EACFA,GACLK,EAAQxB,IAERyB,GADAA,EAAaV,EAAQW,QAAQL,EAA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AASzG,SAAU,mCAAoC,UAAU,KAC/D,CAAC,eAAgB,wBAAyB,4BAA6B,sCAAsC2C,SAAQpC,IACnH,MAAMkN,EAAQzN,SAAS+K,eAAexK,GAClCkN,IACFA,EAAMrI,MAAQ,aAQnBgB,MChUY,WACb,MAAI,QAAQsH,KAAKC,UAAUC,WAJpB,+BAK6BxH,MAAKyH,IACrCA,EAAYC,cAGTC,QAAQC,aD2TdpD,OAAMC,IACLxI,QAAQwI,MAAMA,Q","file":"js/public-fa96c95539e8445f2256.chunk.js","sourcesContent":["document.addEventListener('DOMContentLoaded', function () {\n  var cocoonElementCounter = 0;\n  var createNewID = function () {\n    return new Date().getTime() + cocoonElementCounter++;\n  };\n  var newcontentBraced = function (id) {\n    return '[' + id + ']$1';\n  };\n  var newcontentUnderscored = function (id) {\n    return '_' + id + '_$1';\n  };\n  var getInsertionNodeElem = function (insertionNode, insertionTraversal, thisNode) {\n    if (!insertionNode) {\n      return thisNode.parentNode;\n    }\n    if (typeof insertionNode === 'function') {\n      if (insertionTraversal) {\n        console.warn('association-insertion-traversal is ignored, because association-insertion-node is given as a function.');\n      }\n      return insertionNode(thisNode);\n    }\n    if (typeof insertionNode === 'string') {\n      if (insertionTraversal) {\n        return thisNode[insertionTraversal](insertionNode);\n      } else {\n        return insertionNode === 'this' ? thisNode : document.querySelector(insertionNode);\n      }\n    }\n  };\n  var cocoonDetach = function (node) {\n    return node.parentElement.removeChild(node);\n  };\n  var cocoonGetPreviousSibling = function (elem, selector) {\n    var sibling = elem.previousElementSibling;\n    if (!selector) return sibling;\n    while (sibling) {\n      var match = sibling.matches(selector);\n      if (match) return sibling;\n      sibling = sibling.previousElementSibling;\n    }\n  };\n  var cocoonAddFields = function (e, target) {\n    e.preventDefault();\n    e.stopPropagation();\n    var thisNode = target;\n    var assoc = thisNode.getAttribute('data-association');\n    var assocs = thisNode.getAttribute('data-associations');\n    var content = thisNode.getAttribute('data-association-insertion-template');\n    var insertionMethod = thisNode.getAttribute('data-association-insertion-method') || thisNode.getAttribute('data-association-insertion-position') || 'before';\n    var insertionNode = thisNode.getAttribute('data-association-insertion-node');\n    var insertionTraversal = thisNode.getAttribute('data-association-insertion-traversal');\n    var count = parseInt(thisNode.getAttribute('data-count'), 10);\n    var regexpBraced = new RegExp('\\\\[new_' + assoc + '\\\\](.*?\\\\s)', 'g');\n    var regexpUnderscored = new RegExp('_new_' + assoc + '_(\\\\w*)', 'g');\n    var newId = createNewID();\n    var newContent = content.replace(regexpBraced, newcontentBraced(newId));\n    var newContents = [];\n    var originalEvent = e;\n    if (newContent === content) {\n      regexpBraced = new RegExp('\\\\[new_' + assocs + '\\\\](.*?\\\\s)', 'g');\n      regexpUnderscored = new RegExp('_new_' + assocs + '_(\\\\w*)', 'g');\n      newContent = content.replace(regexpBraced, newcontentBraced(newId));\n    }\n    newContent = newContent.replace(regexpUnderscored, newcontentUnderscored(newId));\n    newContents = [newContent];\n    count = isNaN(count) ? 1 : Math.max(count, 1);\n    count -= 1;\n    while (count) {\n      newId = createNewID();\n      newContent = content.replace(regexpBraced, newcontentBraced(newId));\n      newContent = newContent.replace(regexpUnderscored, newcontentUnderscored(newId));\n      newContents.push(newContent);\n      count -= 1;\n    }\n    var insertionNodeElem = getInsertionNodeElem(insertionNode, insertionTraversal, thisNode);\n    if (!insertionNodeElem || insertionNodeElem.length === 0) {\n      console.warn(\"Couldn't find the element to insert the template. Make sure your `data-association-insertion-*` on `link_to_add_association` is correct.\");\n    }\n    newContents.forEach(function (node, i) {\n      var contentNode = node;\n      var beforeInsert = new CustomEvent('cocoon:before-insert', {\n        bubbles: true,\n        cancelable: true,\n        detail: [contentNode, originalEvent]\n      });\n      insertionNodeElem.dispatchEvent(beforeInsert);\n      if (!beforeInsert.defaultPrevented) {\n        // allow any of the jquery dom manipulation methods (after, before, append, prepend, etc)\n        // to be called on the node.  allows the insertion node to be the parent of the inserted\n        // code and doesn't force it to be a sibling like after/before does. default: 'before'\n        var htmlMapping = {\n          before: 'beforebegin',\n          prepend: 'afterbegin',\n          append: 'beforeend',\n          after: 'afterend'\n        };\n        var htmlMethod = htmlMapping[insertionMethod];\n        var addedContent = insertionNodeElem.insertAdjacentHTML(htmlMethod, contentNode);\n        if (htmlMethod === htmlMapping.before) {\n          addedContent = insertionNodeElem.previousElementSibling;\n        } else if (htmlMethod === htmlMapping.prepend) {\n          addedContent = insertionNodeElem.firstElementChild;\n        } else if (htmlMethod === htmlMapping.append) {\n          addedContent = insertionNodeElem.lastElementChild;\n        } else if (htmlMethod === htmlMapping.after) {\n          addedContent = insertionNodeElem.nextElementSibling;\n        }\n        var afterInsert = new CustomEvent('cocoon:after-insert', {\n          bubbles: true,\n          detail: [contentNode, originalEvent, addedContent]\n        });\n        insertionNodeElem.dispatchEvent(afterInsert);\n      }\n    });\n  };\n  var cocoonRemoveFields = function (e, target) {\n    var thisNode = target;\n    var wrapperClass = thisNode.getAttribute('data-wrapper-class') || 'nested-fields';\n    var nodeToDelete = thisNode.closest('.' + wrapperClass);\n    var triggerNode = nodeToDelete.parentNode;\n    var originalEvent = e;\n    e.preventDefault();\n    e.stopPropagation();\n    var beforeRemove = new CustomEvent('cocoon:before-remove', {\n      bubbles: true,\n      cancelable: true,\n      detail: [nodeToDelete, originalEvent]\n    });\n    triggerNode.dispatchEvent(beforeRemove);\n    if (!beforeRemove.defaultPrevented) {\n      var timeout = triggerNode.getAttribute('data-remove-timeout') || 0;\n      setTimeout(function () {\n        if (thisNode.classList.contains('dynamic')) {\n          cocoonDetach(nodeToDelete);\n        } else {\n          var hiddenInput = cocoonGetPreviousSibling(thisNode, 'input[type=hidden]');\n          hiddenInput.value = '1';\n          nodeToDelete.style.display = 'none';\n        }\n        var afterRemove = new CustomEvent('cocoon:after-remove', {\n          bubbles: true,\n          detail: [nodeToDelete, originalEvent]\n        });\n        triggerNode.dispatchEvent(afterRemove);\n      }, timeout);\n    }\n  };\n  document.addEventListener('click', function (e) {\n    for (var target = e.target; target && target !== this; target = target.parentNode) {\n      if (target.matches('.add_fields')) {\n        cocoonAddFields(e, target);\n        return;\n      }\n      if (target.matches('.remove_fields')) {\n        cocoonRemoveFields(e, target);\n        return;\n      }\n    }\n  }, false);\n});\n\n// TODO - Test this\n// document.addEventListener(\"DOMContentLoaded page:load turbolinks:load\", function () {\n//   var destroyedFields = document.querySelectorAll(\".remove_fields.existing.destroyed\");\n//   Array.prototype.forEach.call(destroyedFields, function (el) {\n//     var wrapperClass = el.getAttribute(\"data-wrapper-class\") || \"nested-fields\";\n//     el.closest(\".\" + wrapperClass).style.display = \"none\";\n//   });\n// });","import './public-path';\nimport escapeTextContentForBrowser from 'escape-html';\nimport loadPolyfills from '../mastodon/load_polyfills';\nimport ready from '../mastodon/ready';\nimport { start } from '../mastodon/common';\nimport loadKeyboardExtensions from '../mastodon/load_keyboard_extensions';\nimport 'cocoon-js-vanilla';\n\nstart();\n\nwindow.addEventListener('message', e => {\n  const data = e.data || {};\n\n  if (!window.parent || data.type !== 'setHeight') {\n    return;\n  }\n\n  ready(() => {\n    window.parent.postMessage({\n      type: 'setHeight',\n      id: data.id,\n      height: document.getElementsByTagName('html')[0].scrollHeight,\n    }, '*');\n  });\n});\n\nfunction main() {\n  const IntlMessageFormat = require('intl-messageformat').default;\n  const { timeAgoString } = require('../mastodon/components/relative_timestamp');\n  const { delegate } = require('@rails/ujs');\n  const emojify = require('../mastodon/features/emoji/emoji').default;\n  const { getLocale } = require('../mastodon/locales');\n  const { messages } = getLocale();\n  const React = require('react');\n  const ReactDOM = require('react-dom');\n  const { createBrowserHistory } = require('history');\n\n  const scrollToDetailedStatus = () => {\n    const history = createBrowserHistory();\n    const detailedStatuses = document.querySelectorAll('.public-layout .detailed-status');\n    const location = history.location;\n\n    if (detailedStatuses.length === 1 && (!location.state || !location.state.scrolledToDetailedStatus)) {\n      detailedStatuses[0].scrollIntoView();\n      history.replace(location.pathname, { ...location.state, scrolledToDetailedStatus: true });\n    }\n  };\n\n  const getEmojiAnimationHandler = (swapTo) => {\n    return ({ target }) => {\n      target.src = target.getAttribute(swapTo);\n    };\n  };\n\n  ready(() => {\n    const locale = document.documentElement.lang;\n\n    const dateTimeFormat = new Intl.DateTimeFormat(locale, {\n      year: 'numeric',\n      month: 'long',\n      day: 'numeric',\n      hour: 'numeric',\n      minute: 'numeric',\n    });\n\n    const dateFormat = new Intl.DateTimeFormat(locale, {\n      year: 'numeric',\n      month: 'short',\n      day: 'numeric',\n      timeFormat: false,\n    });\n\n    const timeFormat = new Intl.DateTimeFormat(locale, {\n      timeStyle: 'short',\n      hour12: false,\n    });\n\n    [].forEach.call(document.querySelectorAll('.emojify'), (content) => {\n      content.innerHTML = emojify(content.innerHTML);\n    });\n\n    [].forEach.call(document.querySelectorAll('time.formatted'), (content) => {\n      const datetime = new Date(content.getAttribute('datetime'));\n      const formattedDate = dateTimeFormat.format(datetime);\n\n      content.title = formattedDate;\n      content.textContent = formattedDate;\n    });\n\n    const isToday = date => {\n      const today = new Date();\n\n      return date.getDate() === today.getDate() &&\n        date.getMonth() === today.getMonth() &&\n        date.getFullYear() === today.getFullYear();\n    };\n    const todayFormat = new IntlMessageFormat(messages['relative_format.today'] || 'Today at {time}', locale);\n\n    [].forEach.call(document.querySelectorAll('time.relative-formatted'), (content) => {\n      const datetime = new Date(content.getAttribute('datetime'));\n\n      let formattedContent;\n\n      if (isToday(datetime)) {\n        const formattedTime = timeFormat.format(datetime);\n\n        formattedContent = todayFormat.format({ time: formattedTime });\n      } else {\n        formattedContent = dateFormat.format(datetime);\n      }\n\n      content.title = formattedContent;\n      content.textContent = formattedContent;\n    });\n\n    [].forEach.call(document.querySelectorAll('time.time-ago'), (content) => {\n      const datetime = new Date(content.getAttribute('datetime'));\n      const now      = new Date();\n\n      content.title = dateTimeFormat.format(datetime);\n      content.textContent = timeAgoString({\n        formatMessage: ({ id, defaultMessage }, values) => (new IntlMessageFormat(messages[id] || defaultMessage, locale)).format(values),\n        formatDate: (date, options) => (new Intl.DateTimeFormat(locale, options)).format(date),\n      }, datetime, now, now.getFullYear(), content.getAttribute('datetime').includes('T'));\n    });\n\n    const reactComponents = document.querySelectorAll('[data-component]');\n\n    if (reactComponents.length > 0) {\n      import(/* webpackChunkName: \"containers/media_container\" */ '../mastodon/containers/media_container')\n        .then(({ default: MediaContainer }) => {\n          [].forEach.call(reactComponents, (component) => {\n            [].forEach.call(component.children, (child) => {\n              component.removeChild(child);\n            });\n          });\n\n          const content = document.createElement('div');\n\n          ReactDOM.render(<MediaContainer locale={locale} components={reactComponents} />, content);\n          document.body.appendChild(content);\n          scrollToDetailedStatus();\n        })\n        .catch(error => {\n          console.error(error);\n          scrollToDetailedStatus();\n        });\n    } else {\n      scrollToDetailedStatus();\n    }\n\n    delegate(document, '#registration_user_password_confirmation,#registration_user_password', 'input', () => {\n      const password = document.getElementById('registration_user_password');\n      const confirmation = document.getElementById('registration_user_password_confirmation');\n      if (confirmation.value && confirmation.value.length > password.maxLength) {\n        confirmation.setCustomValidity((new IntlMessageFormat(messages['password_confirmation.exceeds_maxlength'] || 'Password confirmation exceeds the maximum password length', locale)).format());\n      } else if (password.value && password.value !== confirmation.value) {\n        confirmation.setCustomValidity((new IntlMessageFormat(messages['password_confirmation.mismatching'] || 'Password confirmation does not match', locale)).format());\n      } else {\n        confirmation.setCustomValidity('');\n      }\n    });\n\n    delegate(document, '#user_password,#user_password_confirmation', 'input', () => {\n      const password = document.getElementById('user_password');\n      const confirmation = document.getElementById('user_password_confirmation');\n      if (!confirmation) return;\n\n      if (confirmation.value && confirmation.value.length > password.maxLength) {\n        confirmation.setCustomValidity((new IntlMessageFormat(messages['password_confirmation.exceeds_maxlength'] || 'Password confirmation exceeds the maximum password length', locale)).format());\n      } else if (password.value && password.value !== confirmation.value) {\n        confirmation.setCustomValidity((new IntlMessageFormat(messages['password_confirmation.mismatching'] || 'Password confirmation does not match', locale)).format());\n      } else {\n        confirmation.setCustomValidity('');\n      }\n    });\n\n    delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));\n    delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));\n\n    delegate(document, '.status__content__spoiler-link', 'click', function() {\n      const statusEl = this.parentNode.parentNode;\n\n      if (statusEl.dataset.spoiler === 'expanded') {\n        statusEl.dataset.spoiler = 'folded';\n        this.textContent = (new IntlMessageFormat(messages['status.show_more'] || 'Show more', locale)).format();\n      } else {\n        statusEl.dataset.spoiler = 'expanded';\n        this.textContent = (new IntlMessageFormat(messages['status.show_less'] || 'Show less', locale)).format();\n      }\n\n      return false;\n    });\n\n    [].forEach.call(document.querySelectorAll('.status__content__spoiler-link'), (spoilerLink) => {\n      const statusEl = spoilerLink.parentNode.parentNode;\n      const message = (statusEl.dataset.spoiler === 'expanded') ? (messages['status.show_less'] || 'Show less') : (messages['status.show_more'] || 'Show more');\n      spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();\n    });\n  });\n\n  delegate(document, '#account_display_name', 'input', ({ target }) => {\n    const name = document.querySelector('.card .display-name strong');\n    if (name) {\n      if (target.value) {\n        name.innerHTML = emojify(escapeTextContentForBrowser(target.value));\n      } else {\n        name.textContent = target.dataset.default;\n      }\n    }\n  });\n\n  delegate(document, '#account_avatar', 'change', ({ target }) => {\n    const avatar = document.querySelector('.card .avatar img');\n    const [file] = target.files || [];\n    const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;\n\n    avatar.src = url;\n  });\n\n  const getProfileAvatarAnimationHandler = (swapTo) => {\n    //animate avatar gifs on the profile page when moused over\n    return ({ target }) => {\n      const swapSrc = target.getAttribute(swapTo);\n      //only change the img source if autoplay is off and the image src is actually different\n      if(target.getAttribute('data-autoplay') !== 'true' && target.src !== swapSrc) {\n        target.src = swapSrc;\n      }\n    };\n  };\n\n  delegate(document, 'img#profile_page_avatar', 'mouseover', getProfileAvatarAnimationHandler('data-original'));\n\n  delegate(document, 'img#profile_page_avatar', 'mouseout', getProfileAvatarAnimationHandler('data-static'));\n\n  delegate(document, '#account_header', 'change', ({ target }) => {\n    const header = document.querySelector('.card .card__img img');\n    const [file] = target.files || [];\n    const url = file ? URL.createObjectURL(file) : header.dataset.originalSrc;\n\n    header.src = url;\n  });\n\n  delegate(document, '#account_locked', 'change', ({ target }) => {\n    const lock = document.querySelector('.card .display-name i');\n\n    if (lock) {\n      if (target.checked) {\n        delete lock.dataset.hidden;\n      } else {\n        lock.dataset.hidden = 'true';\n      }\n    }\n  });\n\n  delegate(document, '.input-copy input', 'click', ({ target }) => {\n    target.focus();\n    target.select();\n    target.setSelectionRange(0, target.value.length);\n  });\n\n  delegate(document, '.input-copy button', 'click', ({ target }) => {\n    const input = target.parentNode.querySelector('.input-copy__wrapper input');\n\n    const oldReadOnly = input.readonly;\n\n    input.readonly = false;\n    input.focus();\n    input.select();\n    input.setSelectionRange(0, input.value.length);\n\n    try {\n      if (document.execCommand('copy')) {\n        input.blur();\n        target.parentNode.classList.add('copied');\n\n        setTimeout(() => {\n          target.parentNode.classList.remove('copied');\n        }, 700);\n      }\n    } catch (err) {\n      console.error(err);\n    }\n\n    input.readonly = oldReadOnly;\n  });\n\n  const toggleSidebar = () => {\n    const sidebar = document.querySelector('.sidebar ul');\n    const toggleButton = document.querySelector('.sidebar__toggle__icon');\n\n    if (sidebar.classList.contains('visible')) {\n      document.body.style.overflow = null;\n      toggleButton.setAttribute('aria-expanded', false);\n    } else {\n      document.body.style.overflow = 'hidden';\n      toggleButton.setAttribute('aria-expanded', true);\n    }\n\n    toggleButton.classList.toggle('active');\n    sidebar.classList.toggle('visible');\n  };\n\n  delegate(document, '.sidebar__toggle__icon', 'click', () => {\n    toggleSidebar();\n  });\n\n  delegate(document, '.sidebar__toggle__icon', 'keydown', e => {\n    if (e.key === ' ' || e.key === 'Enter') {\n      e.preventDefault();\n      toggleSidebar();\n    }\n  });\n\n  // Empty the honeypot fields in JS in case something like an extension\n  // automatically filled them.\n  delegate(document, '#registration_new_user,#new_user', 'submit', () => {\n    ['user_website', 'user_confirm_password', 'registration_user_website', 'registration_user_confirm_password'].forEach(id => {\n      const field = document.getElementById(id);\n      if (field) {\n        field.value = '';\n      }\n    });\n  });\n}\n\nloadPolyfills()\n  .then(main)\n  .then(loadKeyboardExtensions)\n  .catch(error => {\n    console.error(error);\n  });\n","// On KaiOS, we may not be able to use a mouse cursor or navigate using Tab-based focus, so we install\n// special left/right focus navigation keyboard listeners, at least on public pages (i.e. so folks\n// can at least log in using KaiOS devices).\n\nfunction importArrowKeyNavigation() {\n  return import(/* webpackChunkName: \"arrow-key-navigation\" */ 'arrow-key-navigation');\n}\n\nexport default function loadKeyboardExtensions() {\n  if (/KAIOS/.test(navigator.userAgent)) {\n    return importArrowKeyNavigation().then(arrowKeyNav => {\n      arrowKeyNav.register();\n    });\n  }\n  return Promise.resolve();\n}\n"],"sourceRoot":""}