{"version":3,"sources":["webpack:///./node_modules/cocoon-js-vanilla/index.js","webpack:///./node_modules/rellax/rellax.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","cancelable","detail","dispatchEvent","defaultPrevented","htmlMethod","before","prepend","append","after","addedContent","insertAdjacentHTML","afterInsert","cocoonRemoveFields","wrapperClass","nodeToDelete","closest","triggerNode","beforeRemove","timeout","setTimeout","classList","contains","parentElement","removeChild","elem","selector","sibling","previousElementSibling","matches","cocoonGetPreviousSibling","value","style","display","afterRemove","this","window","Rellax","el","options","self","Object","create","prototype","posY","screenY","posX","screenX","blocks","pause","loop","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","msRequestAnimationFrame","oRequestAnimationFrame","callback","loopId","supportsPassive","opts","defineProperty","get","removeEventListener","clearLoop","cancelAnimationFrame","mozCancelAnimationFrame","clearTimeout","transformProp","testEl","createElement","transform","vendors","vendor","undefined","validateCustomBreakpoints","breakpoints","Array","isArray","lastVal","isAscending","isNumerical","speed","verticalSpeed","horizontalSpeed","center","wrapper","relativeToWrapper","round","vertical","horizontal","verticalScrollAxis","horizontalScrollAxis","keys","key","elements","querySelectorAll","elems","nodeType","currentBreakpoint","getCurrentBreakpoint","w","bp","cacheBlocks","block","createBlock","init","cssText","innerHeight","innerWidth","setPosition","animate","update","mapBreakpoints","dataPercentage","dataSpeed","dataXsSpeed","dataMobileSpeed","dataTabletSpeed","dataDesktopSpeed","dataVerticalSpeed","dataHorizontalSpeed","dataVericalScrollAxis","dataHorizontalScrollAxis","dataZindex","dataMin","dataMax","dataMinX","dataMaxX","dataMinY","dataMaxY","wrapperPosY","scrollTop","pageYOffset","documentElement","body","offsetTop","scrollLeft","pageXOffset","blockTop","getBoundingClientRect","top","blockHeight","clientHeight","offsetHeight","scrollHeight","blockLeft","left","blockWidth","clientWidth","offsetWidth","scrollWidth","percentageY","percentageX","Number","bases","updatePosition","searchResult","exec","index","trimmedStyle","slice","delimiter","indexOf","baseX","x","baseY","y","height","width","zindex","min","minX","maxX","minY","maxY","oldY","oldX","scrollPosY","result","valueX","valueY","deferredUpdate","passive","positions","toLowerCase","verticalScrollX","verticalScrollY","horizontalScrollX","positionY","positionX","translate","destroy","refresh","start","data","parent","type","ready","postMessage","getElementsByTagName","loadPolyfills","then","IntlMessageFormat","require","default","timeAgoString","delegate","emojify","getLocale","messages","ReactDOM","createBrowserHistory","scrollToDetailedStatus","history","detailedStatuses","location","state","scrolledToDetailedStatus","scrollIntoView","pathname","getEmojiAnimationHandler","swapTo","src","call","now","locale","lang","dateTimeFormat","Intl","DateTimeFormat","year","month","day","hour","minute","innerHTML","datetime","formattedDate","format","title","textContent","formatMessage","values","defaultMessage","formatDate","date","getFullYear","includes","reactComponents","MediaContainer","component","children","child","render","components","appendChild","catch","error","password","getElementById","confirmation","maxLength","setCustomValidity","statusEl","dataset","spoiler","spoilerLink","message","button","href","nodeName","open","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","toggle","hostname","split","field","test","navigator","userAgent","arrowKeyNav","register","Promise","resolve"],"mappings":"6EAAAA,SAASC,iBAAiB,oBAAoB,WAC5C,IAAIC,EAAuB,EAEvBC,EAAc,WAChB,OAAO,IAAIC,MAAOC,UAAYH,KAG5BI,EAAmB,SAAUC,GAC/B,MAAO,IAAMA,EAAK,OAGhBC,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AAQ,kBACfrD,EAAOqD,QAAQ,iBACf,OAAO,EAGT,IAAIqQ,EAAM1T,EAAOqD,QAAQ,iBAAiBhD,aAAa,WAYvD,OAXIL,EAAOqD,QAAQ,yBACjBqQ,EAAM1T,EAAOqD,QAAQ,yBAAyBhD,aAAa,QAClDL,EAAOqD,QAAQ,kBACxBqQ,EAAM1T,EAAOqD,QAAQ,gBAAgBhD,aAAa,SAGhDoE,OAAOmL,SAASoF,WAAatB,EAAIuB,MAAM,KAAK,GAAGA,MAAM,KAAK,GAC5DxQ,OAAOmL,SAASsD,KAAOQ,EAEvBjP,OAAO2O,KAAKM,EAAK,UAEZ,KAKTvE,EAAS9P,SAAU,mCAAoC,UAAU,KAC/D,CAAC,eAAgB,wBAAyB,4BAA6B,sCAAsC2C,SAAQpC,IACnH,MAAMsV,EAAQ7V,SAASmT,eAAe5S,GAClCsV,IACFA,EAAM9Q,MAAQ,aAQnB0K,MClUY,WACb,MAAI,QAAQqG,KAAKC,UAAUC,WAJpB,gCAK6BvG,MAAKwG,IACrCA,EAAYC,cAGTC,QAAQC,aD6TdpD,OAAMC,IACL5Q,QAAQ4Q,MAAMA,Q","file":"js/public-5a554cd2440a28470ba5.chunk.js","sourcesContent":["document.addEventListener('DOMContentLoaded', function () {\n var cocoonElementCounter = 0;\n\n var createNewID = function () {\n return new Date().getTime() + cocoonElementCounter++;\n };\n\n var newcontentBraced = function (id) {\n return '[' + id + ']$1';\n };\n\n var newcontentUnderscored = function (id) {\n return '_' + id + '_$1';\n };\n\n var getInsertionNodeElem = function (insertionNode, insertionTraversal, thisNode) {\n if (!insertionNode) {\n return thisNode.parentNode;\n }\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\n return insertionNode(thisNode);\n }\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\n var cocoonDetach = function (node) {\n return node.parentElement.removeChild(node);\n };\n\n var cocoonGetPreviousSibling = function (elem, selector) {\n var sibling = elem.previousElementSibling;\n if (!selector) return sibling;\n\n while (sibling) {\n var match = sibling.matches(selector);\n if (match) return sibling;\n sibling = sibling.previousElementSibling;\n }\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\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\n newContent = newContent.replace(regexpUnderscored, newcontentUnderscored(newId));\n newContents = [newContent];\n count = isNaN(count) ? 1 : Math.max(count, 1);\n count -= 1;\n\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\n var insertionNodeElem = getInsertionNodeElem(insertionNode, insertionTraversal, thisNode);\n\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\n newContents.forEach(function (node, i) {\n var contentNode = node;\n var beforeInsert = new CustomEvent('cocoon:before-insert', {\n cancelable: true,\n detail: [contentNode, originalEvent]\n });\n insertionNodeElem.dispatchEvent(beforeInsert);\n\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 var afterInsert = new CustomEvent('cocoon:after-insert', {\n detail: [contentNode, originalEvent, addedContent]\n });\n insertionNodeElem.dispatchEvent(afterInsert);\n }\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 cancelable: true,\n detail: [nodeToDelete, originalEvent]\n });\n triggerNode.dispatchEvent(beforeRemove);\n\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\n var afterRemove = new CustomEvent('cocoon:after-remove', {\n detail: [nodeToDelete, originalEvent]\n });\n triggerNode.dispatchEvent(afterRemove);\n }, timeout);\n }\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\n if (target.matches('.remove_fields')) {\n cocoonRemoveFields(e, target);\n return;\n }\n }\n }, false);\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// });","// ------------------------------------------\n// Rellax.js\n// Buttery smooth parallax library\n// Copyright (c) 2016 Moe Amaya (@moeamaya)\n// MIT license\n//\n// Thanks to Paraxify.js and Jaime Cabllero\n// for parallax concepts\n// ------------------------------------------\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], factory);\n } else if (typeof module === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n // Browser globals (root is window)\n root.Rellax = factory();\n }\n})(typeof window !== \"undefined\" ? window : global, function () {\n var Rellax = function (el, options) {\n \"use strict\";\n\n var self = Object.create(Rellax.prototype);\n var posY = 0;\n var screenY = 0;\n var posX = 0;\n var screenX = 0;\n var blocks = [];\n var pause = true; // check what requestAnimationFrame to use, and if\n // it's not supported, use the onscroll event\n\n var loop = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function (callback) {\n return setTimeout(callback, 1000 / 60);\n }; // store the id for later use\n\n\n var loopId = null; // Test via a getter in the options object to see if the passive property is accessed\n\n var supportsPassive = false;\n\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function () {\n supportsPassive = true;\n }\n });\n window.addEventListener(\"testPassive\", null, opts);\n window.removeEventListener(\"testPassive\", null, opts);\n } catch (e) {} // check what cancelAnimation method to use\n\n\n var clearLoop = window.cancelAnimationFrame || window.mozCancelAnimationFrame || clearTimeout; // check which transform property to use\n\n var transformProp = window.transformProp || function () {\n var testEl = document.createElement('div');\n\n if (testEl.style.transform === null) {\n var vendors = ['Webkit', 'Moz', 'ms'];\n\n for (var vendor in vendors) {\n if (testEl.style[vendors[vendor] + 'Transform'] !== undefined) {\n return vendors[vendor] + 'Transform';\n }\n }\n }\n\n return 'transform';\n }(); // Default Settings\n\n\n self.options = {\n speed: -2,\n verticalSpeed: null,\n horizontalSpeed: null,\n breakpoints: [576, 768, 1201],\n center: false,\n wrapper: null,\n relativeToWrapper: false,\n round: true,\n vertical: true,\n horizontal: false,\n verticalScrollAxis: \"y\",\n horizontalScrollAxis: \"x\",\n callback: function () {}\n }; // User defined options (might have more in the future)\n\n if (options) {\n Object.keys(options).forEach(function (key) {\n self.options[key] = options[key];\n });\n }\n\n function validateCustomBreakpoints() {\n if (self.options.breakpoints.length === 3 && Array.isArray(self.options.breakpoints)) {\n var isAscending = true;\n var isNumerical = true;\n var lastVal;\n self.options.breakpoints.forEach(function (i) {\n if (typeof i !== 'number') isNumerical = false;\n\n if (lastVal !== null) {\n if (i < lastVal) isAscending = false;\n }\n\n lastVal = i;\n });\n if (isAscending && isNumerical) return;\n } // revert defaults if set incorrectly\n\n\n self.options.breakpoints = [576, 768, 1201];\n console.warn(\"Rellax: You must pass an array of 3 numbers in ascending order to the breakpoints option. Defaults reverted\");\n }\n\n if (options && options.breakpoints) {\n validateCustomBreakpoints();\n } // By default, rellax class\n\n\n if (!el) {\n el = '.rellax';\n } // check if el is a className or a node\n\n\n var elements = typeof el === 'string' ? document.querySelectorAll(el) : [el]; // Now query selector\n\n if (elements.length > 0) {\n self.elems = elements;\n } // The elements don't exist\n else {\n console.warn(\"Rellax: The elements you're trying to select don't exist.\");\n return;\n } // Has a wrapper and it exists\n\n\n if (self.options.wrapper) {\n if (!self.options.wrapper.nodeType) {\n var wrapper = document.querySelector(self.options.wrapper);\n\n if (wrapper) {\n self.options.wrapper = wrapper;\n } else {\n console.warn(\"Rellax: The wrapper you're trying to use doesn't exist.\");\n return;\n }\n }\n } // set a placeholder for the current breakpoint\n\n\n var currentBreakpoint; // helper to determine current breakpoint\n\n var getCurrentBreakpoint = function (w) {\n var bp = self.options.breakpoints;\n if (w < bp[0]) return 'xs';\n if (w >= bp[0] && w < bp[1]) return 'sm';\n if (w >= bp[1] && w < bp[2]) return 'md';\n return 'lg';\n }; // Get and cache initial position of all elements\n\n\n var cacheBlocks = function () {\n for (var i = 0; i < self.elems.length; i++) {\n var block = createBlock(self.elems[i]);\n blocks.push(block);\n }\n }; // Let's kick this script off\n // Build array for cached element values\n\n\n var init = function () {\n for (var i = 0; i < blocks.length; i++) {\n self.elems[i].style.cssText = blocks[i].style;\n }\n\n blocks = [];\n screenY = window.innerHeight;\n screenX = window.innerWidth;\n currentBreakpoint = getCurrentBreakpoint(screenX);\n setPosition();\n cacheBlocks();\n animate(); // If paused, unpause and set listener for window resizing events\n\n if (pause) {\n window.addEventListener('resize', init);\n pause = false; // Start the loop\n\n update();\n }\n }; // We want to cache the parallax blocks'\n // values: base, top, height, speed\n // el: is dom object, return: el cache values\n\n\n var createBlock = function (el) {\n var dataPercentage = el.getAttribute('data-rellax-percentage');\n var dataSpeed = el.getAttribute('data-rellax-speed');\n var dataXsSpeed = el.getAttribute('data-rellax-xs-speed');\n var dataMobileSpeed = el.getAttribute('data-rellax-mobile-speed');\n var dataTabletSpeed = el.getAttribute('data-rellax-tablet-speed');\n var dataDesktopSpeed = el.getAttribute('data-rellax-desktop-speed');\n var dataVerticalSpeed = el.getAttribute('data-rellax-vertical-speed');\n var dataHorizontalSpeed = el.getAttribute('data-rellax-horizontal-speed');\n var dataVericalScrollAxis = el.getAttribute('data-rellax-vertical-scroll-axis');\n var dataHorizontalScrollAxis = el.getAttribute('data-rellax-horizontal-scroll-axis');\n var dataZindex = el.getAttribute('data-rellax-zindex') || 0;\n var dataMin = el.getAttribute('data-rellax-min');\n var dataMax = el.getAttribute('data-rellax-max');\n var dataMinX = el.getAttribute('data-rellax-min-x');\n var dataMaxX = el.getAttribute('data-rellax-max-x');\n var dataMinY = el.getAttribute('data-rellax-min-y');\n var dataMaxY = el.getAttribute('data-rellax-max-y');\n var mapBreakpoints;\n var breakpoints = true;\n\n if (!dataXsSpeed && !dataMobileSpeed && !dataTabletSpeed && !dataDesktopSpeed) {\n breakpoints = false;\n } else {\n mapBreakpoints = {\n 'xs': dataXsSpeed,\n 'sm': dataMobileSpeed,\n 'md': dataTabletSpeed,\n 'lg': dataDesktopSpeed\n };\n } // initializing at scrollY = 0 (top of browser), scrollX = 0 (left of browser)\n // ensures elements are positioned based on HTML layout.\n //\n // If the element has the percentage attribute, the posY and posX needs to be\n // the current scroll position's value, so that the elements are still positioned based on HTML layout\n\n\n var wrapperPosY = self.options.wrapper ? self.options.wrapper.scrollTop : window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; // If the option relativeToWrapper is true, use the wrappers offset to top, subtracted from the current page scroll.\n\n if (self.options.relativeToWrapper) {\n var scrollPosY = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;\n wrapperPosY = scrollPosY - self.options.wrapper.offsetTop;\n }\n\n var posY = self.options.vertical ? dataPercentage || self.options.center ? wrapperPosY : 0 : 0;\n var posX = self.options.horizontal ? dataPercentage || self.options.center ? self.options.wrapper ? self.options.wrapper.scrollLeft : window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft : 0 : 0;\n var blockTop = posY + el.getBoundingClientRect().top;\n var blockHeight = el.clientHeight || el.offsetHeight || el.scrollHeight;\n var blockLeft = posX + el.getBoundingClientRect().left;\n var blockWidth = el.clientWidth || el.offsetWidth || el.scrollWidth; // apparently parallax equation everyone uses\n\n var percentageY = dataPercentage ? dataPercentage : (posY - blockTop + screenY) / (blockHeight + screenY);\n var percentageX = dataPercentage ? dataPercentage : (posX - blockLeft + screenX) / (blockWidth + screenX);\n\n if (self.options.center) {\n percentageX = 0.5;\n percentageY = 0.5;\n } // Optional individual block speed as data attr, otherwise global speed\n\n\n var speed = breakpoints && mapBreakpoints[currentBreakpoint] !== null ? Number(mapBreakpoints[currentBreakpoint]) : dataSpeed ? dataSpeed : self.options.speed;\n var verticalSpeed = dataVerticalSpeed ? dataVerticalSpeed : self.options.verticalSpeed;\n var horizontalSpeed = dataHorizontalSpeed ? dataHorizontalSpeed : self.options.horizontalSpeed; // Optional individual block movement axis direction as data attr, otherwise gobal movement direction\n\n var verticalScrollAxis = dataVericalScrollAxis ? dataVericalScrollAxis : self.options.verticalScrollAxis;\n var horizontalScrollAxis = dataHorizontalScrollAxis ? dataHorizontalScrollAxis : self.options.horizontalScrollAxis;\n var bases = updatePosition(percentageX, percentageY, speed, verticalSpeed, horizontalSpeed); // ~~Store non-translate3d transforms~~\n // Store inline styles and extract transforms\n\n var style = el.style.cssText;\n var transform = ''; // Check if there's an inline styled transform\n\n var searchResult = /transform\\s*:/i.exec(style);\n\n if (searchResult) {\n // Get the index of the transform\n var index = searchResult.index; // Trim the style to the transform point and get the following semi-colon index\n\n var trimmedStyle = style.slice(index);\n var delimiter = trimmedStyle.indexOf(';'); // Remove \"transform\" string and save the attribute\n\n if (delimiter) {\n transform = \" \" + trimmedStyle.slice(11, delimiter).replace(/\\s/g, '');\n } else {\n transform = \" \" + trimmedStyle.slice(11).replace(/\\s/g, '');\n }\n }\n\n return {\n baseX: bases.x,\n baseY: bases.y,\n top: blockTop,\n left: blockLeft,\n height: blockHeight,\n width: blockWidth,\n speed: speed,\n verticalSpeed: verticalSpeed,\n horizontalSpeed: horizontalSpeed,\n verticalScrollAxis: verticalScrollAxis,\n horizontalScrollAxis: horizontalScrollAxis,\n style: style,\n transform: transform,\n zindex: dataZindex,\n min: dataMin,\n max: dataMax,\n minX: dataMinX,\n maxX: dataMaxX,\n minY: dataMinY,\n maxY: dataMaxY\n };\n }; // set scroll position (posY, posX)\n // side effect method is not ideal, but okay for now\n // returns true if the scroll changed, false if nothing happened\n\n\n var setPosition = function () {\n var oldY = posY;\n var oldX = posX;\n posY = self.options.wrapper ? self.options.wrapper.scrollTop : (document.documentElement || document.body.parentNode || document.body).scrollTop || window.pageYOffset;\n posX = self.options.wrapper ? self.options.wrapper.scrollLeft : (document.documentElement || document.body.parentNode || document.body).scrollLeft || window.pageXOffset; // If option relativeToWrapper is true, use relative wrapper value instead.\n\n if (self.options.relativeToWrapper) {\n var scrollPosY = (document.documentElement || document.body.parentNode || document.body).scrollTop || window.pageYOffset;\n posY = scrollPosY - self.options.wrapper.offsetTop;\n }\n\n if (oldY != posY && self.options.vertical) {\n // scroll changed, return true\n return true;\n }\n\n if (oldX != posX && self.options.horizontal) {\n // scroll changed, return true\n return true;\n } // scroll did not change\n\n\n return false;\n }; // Ahh a pure function, gets new transform value\n // based on scrollPosition and speed\n // Allow for decimal pixel values\n\n\n var updatePosition = function (percentageX, percentageY, speed, verticalSpeed, horizontalSpeed) {\n var result = {};\n var valueX = (horizontalSpeed ? horizontalSpeed : speed) * (100 * (1 - percentageX));\n var valueY = (verticalSpeed ? verticalSpeed : speed) * (100 * (1 - percentageY));\n result.x = self.options.round ? Math.round(valueX) : Math.round(valueX * 100) / 100;\n result.y = self.options.round ? Math.round(valueY) : Math.round(valueY * 100) / 100;\n return result;\n }; // Remove event listeners and loop again\n\n\n var deferredUpdate = function () {\n window.removeEventListener('resize', deferredUpdate);\n window.removeEventListener('orientationchange', deferredUpdate);\n (self.options.wrapper ? self.options.wrapper : window).removeEventListener('scroll', deferredUpdate);\n (self.options.wrapper ? self.options.wrapper : document).removeEventListener('touchmove', deferredUpdate); // loop again\n\n loopId = loop(update);\n }; // Loop\n\n\n var update = function () {\n if (setPosition() && pause === false) {\n animate(); // loop again\n\n loopId = loop(update);\n } else {\n loopId = null; // Don't animate until we get a position updating event\n\n window.addEventListener('resize', deferredUpdate);\n window.addEventListener('orientationchange', deferredUpdate);\n (self.options.wrapper ? self.options.wrapper : window).addEventListener('scroll', deferredUpdate, supportsPassive ? {\n passive: true\n } : false);\n (self.options.wrapper ? self.options.wrapper : document).addEventListener('touchmove', deferredUpdate, supportsPassive ? {\n passive: true\n } : false);\n }\n }; // Transform3d on parallax element\n\n\n var animate = function () {\n var positions;\n\n for (var i = 0; i < self.elems.length; i++) {\n // Determine relevant movement directions\n var verticalScrollAxis = blocks[i].verticalScrollAxis.toLowerCase();\n var horizontalScrollAxis = blocks[i].horizontalScrollAxis.toLowerCase();\n var verticalScrollX = verticalScrollAxis.indexOf(\"x\") != -1 ? posY : 0;\n var verticalScrollY = verticalScrollAxis.indexOf(\"y\") != -1 ? posY : 0;\n var horizontalScrollX = horizontalScrollAxis.indexOf(\"x\") != -1 ? posX : 0;\n var horizontalScrollY = horizontalScrollAxis.indexOf(\"y\") != -1 ? posX : 0;\n var percentageY = (verticalScrollY + horizontalScrollY - blocks[i].top + screenY) / (blocks[i].height + screenY);\n var percentageX = (verticalScrollX + horizontalScrollX - blocks[i].left + screenX) / (blocks[i].width + screenX); // Subtracting initialize value, so element stays in same spot as HTML\n\n positions = updatePosition(percentageX, percentageY, blocks[i].speed, blocks[i].verticalSpeed, blocks[i].horizontalSpeed);\n var positionY = positions.y - blocks[i].baseY;\n var positionX = positions.x - blocks[i].baseX; // The next two \"if\" blocks go like this:\n // Check if a limit is defined (first \"min\", then \"max\");\n // Check if we need to change the Y or the X\n // (Currently working only if just one of the axes is enabled)\n // Then, check if the new position is inside the allowed limit\n // If so, use new position. If not, set position to limit.\n // Check if a min limit is defined\n\n if (blocks[i].min !== null) {\n if (self.options.vertical && !self.options.horizontal) {\n positionY = positionY <= blocks[i].min ? blocks[i].min : positionY;\n }\n\n if (self.options.horizontal && !self.options.vertical) {\n positionX = positionX <= blocks[i].min ? blocks[i].min : positionX;\n }\n } // Check if directional min limits are defined\n\n\n if (blocks[i].minY != null) {\n positionY = positionY <= blocks[i].minY ? blocks[i].minY : positionY;\n }\n\n if (blocks[i].minX != null) {\n positionX = positionX <= blocks[i].minX ? blocks[i].minX : positionX;\n } // Check if a max limit is defined\n\n\n if (blocks[i].max !== null) {\n if (self.options.vertical && !self.options.horizontal) {\n positionY = positionY >= blocks[i].max ? blocks[i].max : positionY;\n }\n\n if (self.options.horizontal && !self.options.vertical) {\n positionX = positionX >= blocks[i].max ? blocks[i].max : positionX;\n }\n } // Check if directional max limits are defined\n\n\n if (blocks[i].maxY != null) {\n positionY = positionY >= blocks[i].maxY ? blocks[i].maxY : positionY;\n }\n\n if (blocks[i].maxX != null) {\n positionX = positionX >= blocks[i].maxX ? blocks[i].maxX : positionX;\n }\n\n var zindex = blocks[i].zindex; // Move that element\n // (Set the new translation and append initial inline transforms.)\n\n var translate = 'translate3d(' + (self.options.horizontal ? positionX : '0') + 'px,' + (self.options.vertical ? positionY : '0') + 'px,' + zindex + 'px) ' + blocks[i].transform;\n self.elems[i].style[transformProp] = translate;\n }\n\n self.options.callback(positions);\n };\n\n self.destroy = function () {\n for (var i = 0; i < self.elems.length; i++) {\n self.elems[i].style.cssText = blocks[i].style;\n } // Remove resize event listener if not pause, and pause\n\n\n if (!pause) {\n window.removeEventListener('resize', init);\n pause = true;\n } // Clear the animation loop to prevent possible memory leak\n\n\n clearLoop(loopId);\n loopId = null;\n }; // Init\n\n\n init(); // Allow to recalculate the initial values whenever we want\n\n self.refresh = init;\n return self;\n };\n\n return Rellax;\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 Rellax = require('rellax');\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 [].forEach.call(document.querySelectorAll('img.rucaptcha-image'), (content) => {\n content.addEventListener('click', e => {\n content.src = '/rucaptcha/?t=' + Date.now();\n });\n });\n\n [].forEach.call(document.querySelectorAll('iframe.custom-full-width-iframe'), (content) => {\n content.width = '100%';\n content.height = content.offsetWidth * content.getAttribute('data-height') / content.getAttribute('data-width');\n });\n\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 const parallaxComponents = document.querySelectorAll('.parallax');\n\n if (parallaxComponents.length > 0 ) {\n new Rellax('.parallax', { speed: -1 });\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, '.webapp-btn', 'click', ({ target, button }) => {\n if (button !== 0) {\n return true;\n }\n window.location.href = target.href;\n return false;\n });\n\n delegate(document, '.modal-button', 'click', e => {\n e.preventDefault();\n\n let href;\n\n if (e.target.nodeName !== 'A') {\n href = e.target.parentNode.href;\n } else {\n href = e.target.href;\n }\n\n window.open(href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes');\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 delegate(document, '.sidebar__toggle__icon', 'click', () => {\n document.querySelector('.sidebar ul').classList.toggle('visible');\n });\n\n delegate(document, '.quote-status', 'click', ({ target }) => {\n if (target.closest('.status__content__spoiler-link') ||\n target.closest('.media-gallery') ||\n target.closest('.video-player') ||\n target.closest('.audio-player')) {\n return false;\n }\n\n let url = target.closest('.quote-status').getAttribute('dataurl');\n if (target.closest('.status__display-name')) {\n url = target.closest('.status__display-name').getAttribute('href');\n } else if (target.closest('.status-card')) {\n url = target.closest('.status-card').getAttribute('href');\n }\n\n if (window.location.hostname === url.split('/')[2].split(':')[0]) {\n window.location.href = url;\n } else {\n window.open(url, 'blank');\n }\n return false;\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":""}