{"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","call","innerHTML","datetime","formattedDate","format","title","textContent","now","formatMessage","values","defaultMessage","formatDate","date","options","getFullYear","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,EAAclB,EAAiBqB,KACpCE,QAAQH,EAAmBlB,EAAsBmB,IACzEG,EAAYK,KAAKP,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C,EAAUvM,SAASuC,cAAc,eACjCiK,EAAexM,SAASuC,cAAc,0BAExCgK,EAAQ5H,UAAUC,SAAS,YAC7B5E,SAAS8J,KAAKzE,MAAMoH,SAAW,KAC/BD,EAAaE,aAAa,iBAAiB,KAE3C1M,SAAS8J,KAAKzE,MAAMoH,SAAW,SAC/BD,EAAaE,aAAa,iBAAiB,IAG7CF,EAAa7H,UAAUgI,OAAO,UAC9BJ,EAAQ5H,UAAUgI,OAAO,YAG3BlG,EAASzG,SAAU,yBAA0B,SAAS,KACpDsM,OAGF7F,EAASzG,SAAU,yBAA0B,WAAWU,IACxC,MAAVA,EAAEkM,KAAyB,UAAVlM,EAAEkM,MACrBlM,EAAEE,iBACF0L,QAMJ7F,EAASzG,SAAU,mCAAoC,UAAU,KAC/D,CAAC,eAAgB,wBAAyB,4BAA6B,sCAAsC2C,SAAQpC,IACnH,MAAMsM,EAAQ7M,SAASmK,eAAe5J,GAClCsM,IACFA,EAAMzH,MAAQ,aAQnBgB,MC1RY,WACb,MAAI,QAAQ0G,KAAKC,UAAUC,WAJpB,+BAK6B5G,MAAK6G,IACrCA,EAAYC,cAGTC,QAAQC,aDqRdpD,OAAMC,IACL5H,QAAQ4H,MAAMA,Q","file":"js/public-9692477d67d6c957393e.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 [].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 [].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(, 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":""}