{"version":3,"file":"bullet-train.umd.js","sources":["../../../node_modules/@stimulus/webpack-helpers/dist/index.js","../../javascript/controllers/clipboard_controller.js","../../javascript/controllers/form_controller.js","../../javascript/controllers/mobile_menu_controller.js","../../javascript/controllers/index.js","../../javascript/electron/index.js"],"sourcesContent":["export function definitionsFromContext(context) {\n    return context.keys()\n        .map(function (key) { return definitionForModuleWithContextAndKey(context, key); })\n        .filter(function (value) { return value; });\n}\nfunction definitionForModuleWithContextAndKey(context, key) {\n    var identifier = identifierForContextKey(key);\n    if (identifier) {\n        return definitionForModuleAndIdentifier(context(key), identifier);\n    }\n}\nfunction definitionForModuleAndIdentifier(module, identifier) {\n    var controllerConstructor = module.default;\n    if (typeof controllerConstructor == \"function\") {\n        return { identifier: identifier, controllerConstructor: controllerConstructor };\n    }\n}\nexport function identifierForContextKey(key) {\n    var logicalName = (key.match(/^(?:\\.\\/)?(.+)(?:[_-]controller\\..+?)$/) || [])[1];\n    if (logicalName) {\n        return logicalName.replace(/_/g, \"-\").replace(/\\//g, \"--\");\n    }\n}\n//# sourceMappingURL=index.js.map","import { Controller } from 'stimulus'\n\nexport default class extends Controller {\n  static targets = ['source', 'input', 'button']\n\n  copy() {\n    this.inputTarget.value = this.sourceTarget.innerText\n    this.inputTarget.select()\n    document.execCommand('copy')\n    this.buttonTarget.innerHTML = '<i id=\"copied\" class=\"fas fa-check w-4 h-4 block text-green-600\"></i>'\n    setTimeout(function () {\n      document.getElementById('copied').innerHTML = '<i class=\"far fa-copy w-4 h-4 block text-gray-600\"></i>'\n    }, 1500)\n  }\n}\n","import { Controller } from 'stimulus'\n\n// TODO Some of this feels really specific to the conversation messages form. Should we rename this controller?\nexport default class extends Controller {\n  static targets = ['trixField', 'scroll']\n\n  resetOnSuccess(e){\n    if(e.detail.success) {\n      e.target.reset();\n    }\n  }\n\n  stripTrix(){\n    this.trixFieldTargets.forEach(element => {\n      this.removeTrailingNewlines(element.editor)\n      this.removeTrailingWhitespace(element.editor)\n      // When doing this as part of the form submission, Trix does not update the input element's value attribute fast enough.\n      // In order to submit the stripped value, we manually update it here to fix the race condition\n      element.parentElement.querySelector(\"input\").value = element.innerHTML\n    })\n  }\n\n  submitOnReturn(e) {\n    if((e.metaKey || e.ctrlKey) &&  e.keyCode == 13) {\n      e.preventDefault();\n      let form = e.target.closest(\"form\")\n      this.submitForm(form)\n    }\n  }\n\n  removeTrailingNewlines = (trixEditor) => {\n    if (trixEditor.element.innerHTML.match(/<br><\\/div>$/)) {\n      trixEditor.element.innerHTML = trixEditor.element.innerHTML.slice(0, -10) + \"</div>\"\n      this.removeTrailingNewlines(trixEditor)\n    }\n  }\n\n  removeTrailingWhitespace = (trixEditor) => {\n    if (trixEditor.element.innerHTML.match(/&nbsp;<\\/div>$/)) {\n      trixEditor.element.innerHTML = trixEditor.element.innerHTML.slice(0, -12) + \"</div>\"\n      this.removeTrailingWhitespace(trixEditor)\n    } else if (trixEditor.element.innerHTML.match(/&nbsp; <\\/div>$/)) {\n      trixEditor.element.innerHTML = trixEditor.element.innerHTML.slice(0, -13) + \"</div>\"\n      this.removeTrailingWhitespace(trixEditor)\n    }\n  }\n\n  submitForm(form) {\n    // Right now, Safari and IE don't support the requestSubmit method which is required for Turbo\n    // Doing form.submit() doesn't actually fire the submit event which Turbo needs\n    if (form.requestSubmit) {\n      form.requestSubmit()\n    } else {\n      form.querySelector(\"[type=submit]\").click()\n    }\n  }\n}\n","import { Controller } from \"stimulus\"\n\nexport default class extends Controller {\n  static targets = [ \"wrapper\"]\n  static classes = [ \"hidden\" ] // necessary because stimulus-reveal will mess with the [hidden] attribute on the wrapper\n  static values = {\n    showEventName: String,\n    hideEventName: String,\n  }\n\n  toggle() {\n    const eventName = this.isWrapperHidden? this.showEventNameValue: this.hideEventNameValue\n    if (this.isWrapperHidden) {\n      this.showWrapper()\n    }\n    \n    this.wrapperTarget.dispatchEvent(new CustomEvent(eventName))\n  }\n  \n  get isWrapperHidden() {\n    return this.wrapperTarget.classList.contains(this.hiddenClass)\n  }\n  \n  showWrapper() {\n    this.wrapperTarget.classList.remove(this.hiddenClass)\n  }\n  \n  hideWrapper() {\n    this.wrapperTarget.classList.add(this.hiddenClass)\n  }\n}","import { identifierForContextKey } from \"@stimulus/webpack-helpers\"\n\nimport ClipboardController from './clipboard_controller'\nimport FormController from './form_controller'\nimport MobileMenuController from './mobile_menu_controller'\n\nexport const controllerDefinitions = [\n  [ClipboardController, 'clipboard_controller.js'],\n  [FormController, 'form_controller.js'],\n  [MobileMenuController, 'mobile_menu_controller.js'],\n].map(function(d) {\n  const key = d[1]\n  const controller = d[0]\n  return {\n    identifier: identifierForContextKey(key),\n    controllerConstructor: controller\n  }\n})\n","document.addEventListener(\"turbo:load\", () => {\n  if (navigator.userAgent.toLocaleLowerCase().includes('electron')) {\n    document.body.classList.add('electron')\n  }\n})"],"names":["identifierForContextKey","key","logicalName","match","replace","copy","this","inputTarget","value","sourceTarget","innerText","select","document","execCommand","buttonTarget","innerHTML","setTimeout","getElementById","Controller","targets","removeTrailingNewlines","trixEditor","element","slice","_this","removeTrailingWhitespace","resetOnSuccess","e","detail","success","target","reset","stripTrix","trixFieldTargets","forEach","_this2","editor","parentElement","querySelector","submitOnReturn","metaKey","ctrlKey","keyCode","preventDefault","form","closest","submitForm","requestSubmit","click","toggle","eventName","isWrapperHidden","showEventNameValue","hideEventNameValue","showWrapper","wrapperTarget","dispatchEvent","CustomEvent","classList","remove","hiddenClass","hideWrapper","add","contains","classes","values","showEventName","String","hideEventName","controllerDefinitions","ClipboardController","FormController","MobileMenuController","map","d","controller","identifier","controllerConstructor","addEventListener","navigator","userAgent","toLocaleLowerCase","includes","body"],"mappings":"iRAiBO,SAASA,EAAwBC,GACpC,IAAIC,GAAeD,EAAIE,MAAM,2CAA6C,IAAI,GAC9E,GAAID,EACA,OAAOA,EAAYE,QAAQ,KAAM,KAAKA,QAAQ,MAAO,yRCf3DC,KAAA,WACEC,KAAKC,YAAYC,MAAQF,KAAKG,aAAaC,UAC3CJ,KAAKC,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