{"version":3,"file":"formHelpers-292717d6.js","sources":["../../../../../../app/node_modules/invariant/browser.js","../../../app/javascript/components/helpers/formHelpers.tsx"],"sourcesContent":["/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","import React from 'react'\nimport { isNewCompany } from 'shared/helper/companyHelpers'\nimport Shipment from 'shared/models/Shipment.model'\nimport AdviceRole from 'shared/models/AdviceRole.model'\nimport ShipmentRole from 'shared/models/ShipmentRole.model'\n\nexport const isEnterKeyEvent = (\n event: KeyboardEvent | React.KeyboardEvent | Event | null | undefined,\n): boolean => {\n if (!event || !(event instanceof KeyboardEvent)) return false\n\n return event.key === 'Enter' || event.code === 'Enter'\n}\n\nexport const submitBtnSpinnerClass = 'kt-spinner kt-spinner--right kt-spinner--md kt-spinner--light'\n\nexport const removeTmpCompanyIdsFrom = (data: Shipment[]) => {\n data.forEach((shipment) => removeTmpCompanyIdsFromRoles(shipment.shipmentRoles))\n return data\n}\n\nexport const removeTmpCompanyIdsFromRoles = (roles: AdviceRole[] | ShipmentRole[]) => (\n roles.forEach((role) => {\n if (isNewCompany(role.company?.id)) {\n role.company = { name: role.company?.name } // deleting company.id\n }\n })\n)\n"],"names":["invariant","condition","format","a","b","c","d","e","f","error","args","argIndex","browser","isEnterKeyEvent","event","submitBtnSpinnerClass","removeTmpCompanyIdsFrom","data","shipment","removeTmpCompanyIdsFromRoles","roles","role","isNewCompany","_a","_b"],"mappings":"iGAoBA,IAAIA,EAAY,SAASC,EAAWC,EAAQC,EAAGC,EAAGC,EAAGC,EAAGC,EAAGC,EAAG,CAO5D,GAAI,CAACP,EAAW,CACd,IAAIQ,EACJ,GAAIP,IAAW,OACbO,EAAQ,IAAI,MACV,+HAER,MACW,CACL,IAAIC,EAAO,CAACP,EAAGC,EAAGC,EAAGC,EAAGC,EAAGC,CAAC,EACxBG,EAAW,EACfF,EAAQ,IAAI,MACVP,EAAO,QAAQ,MAAO,UAAW,CAAE,OAAOQ,EAAKC,GAAU,EAAI,CACrE,EACMF,EAAM,KAAO,qBACd,CAED,MAAAA,EAAM,YAAc,EACdA,CACP,CACH,EAEAG,EAAiBZ,eC1CJa,EACXC,GAEI,CAACA,GAAS,EAAEA,aAAiB,eAAuB,GAEjDA,EAAM,MAAQ,SAAWA,EAAM,OAAS,QAGpCC,EAAwB,gEAExBC,EAA2BC,IACtCA,EAAK,QAASC,GAAaC,EAA6BD,EAAS,aAAa,CAAC,EACxED,GAGIE,EAAgCC,GAC3CA,EAAM,QAASC,GAAS,SAClBC,GAAaC,EAAAF,EAAK,UAAL,YAAAE,EAAc,EAAE,IAC/BF,EAAK,QAAU,CAAE,MAAMG,EAAAH,EAAK,UAAL,YAAAG,EAAc,MAEzC,CAAC","x_google_ignoreList":[0]}