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UA,EAAAA,GAEdjD,SAAU,CACNkD,uBAAwBhD,EAAAA,KAGhCiD,QAAS,CACLnD,SAAW,CACPoD,kCAAmClD,EAAAA,GACnCmD,mBAAoBnD,EAAAA,GACpBoD,eAAgBpD,EAAAA,IAEpBqD,YAAa,CACTC,8BAA+BtD,EAAAA,IAEnCE,OAAQ,CACJqD,UAASC,EAAAhC,EACTiC,SAAQC,EAAAC,EACRC,cAAaC,EAAAxD,EACbyD,SAAQC,EAAAC,EACRC,WAAUC,EAAAC,EACVC,eAAcC,EAAAC,EACdC,aAAYC,EAAApC,EACZqC,YAAWC,EAAAC,EACXC,YAAWA,EAAAA,GAEfrE,WAAasE,KAEjBC,4BAA6B,CACzBhF,SAAU,CACNiF,kCAAmC/E,EAAAA,IAGvCO,WAAY,CACRyE,6CAA8C9H,IAAAA,+CAGtD+H,UAAW,CACP/E,OAAQ,CACJgF,iBAAgBA,EAAAA,IAGxBC,kBAAiBC,EAAAC,EACjBC,eAAcC,EAAAC,GACdC,iBAAgBC,EAAAC,EAChBC,aAAYC,EAAAC,GACZC,cAAaA,EAAAA","sources":["webpack://bevspot/./src/main/web/typescript/shared/global/awsAmplify.js","webpack://bevspot/./src/main/web/typescript/shared/global/error.ts","webpack://bevspot/./src/main/web/typescript/shared/lib/LegacyClient.ts"],"sourcesContent":["import { Amplify, Auth } from \"aws-amplify\";\nimport Cookies from \"js-cookie\";\nimport \"url-search-params-polyfill\";\nimport { cookieManager } from \"shared/lib/manager\";\nimport { USER_SESSION_COOKIE_NAME } from \"shared/lib/cookie/impl/CookieManagerImpl\";\n\n// Note: The keys for configs must match those in Environment.java\n// \"dev\" | \"staging\" | \"prod\"\nconst currentEnvironment = Cookies.get(\"Environment\");\nconst configs = {\n  // Local/Development (shared)\n  dev: {\n    AMPLIFY_AUTH: {\n      mandatorySignIn: true,\n      region: \"us-east-1\",\n      userPoolId: \"us-east-1_Q7wUTr8lj\",\n      // identityPoolId: config.cognito.IDENTITY_POOL_ID,\n      userPoolWebClientId: \"i33ef66i1sgp2jmvfk498dvbh\",\n    },\n    authBaseUrl: \"/auth\",\n    authCookieDomain: \"localhost\",\n    lambdaApiBase: \"https://11u2oteuxc.execute-api.us-east-1.amazonaws.com/api\",\n  },\n\n  // Production\n  prod: {\n    AMPLIFY_AUTH: {\n      mandatorySignIn: true,\n      region: \"us-east-1\",\n      userPoolId: \"us-east-1_yfLnl9Agj\",\n      // identityPoolId: config.cognito.IDENTITY_POOL_ID,\n      // This should match user_auth/webpack/config.js configs.prod.userPoolWebClientId\n      userPoolWebClientId: \"31hub3vm9i6gfl6poji5c3h0tg\",\n    },\n    authBaseUrl: \"/auth\",\n    authCookieDomain: \".bevspot.com\",\n    lambdaApiBase: \"https://api.bevspot.com/auth\",\n  },\n\n  // Staging, etc\n  staging: {\n    AMPLIFY_AUTH: {\n      mandatorySignIn: true,\n      region: \"us-east-1\",\n      userPoolId: \"us-east-1_HX1blXNbZ\",\n      // identityPoolId: config.cognito.IDENTITY_POOL_ID,\n\n      // userPoolWebClientId should match user_auth/webpack/config.js\n      // See configs.staging.userPoolWebClientId\n      userPoolWebClientId: \"1lgr7n6iv1opl5qmetucjjka11\",\n    },\n    authBaseUrl: \"/auth\",\n    authCookieDomain: \".bevspot.net\",\n    lambdaApiBase: \"https://api-staging.bevspot.net/auth\",\n  },\n};\n\nconst currentConfig = configs[currentEnvironment];\n\nAmplify.configure({\n  Auth: {\n    mandatorySignIn: currentConfig.AMPLIFY_AUTH.mandatorySignIn,\n    region: currentConfig.AMPLIFY_AUTH.region,\n    userPoolId: currentConfig.AMPLIFY_AUTH.userPoolId,\n    userPoolWebClientId: currentConfig.AMPLIFY_AUTH.userPoolWebClientId,\n  },\n});\nwindow.AMPLIFY_CONFIG = Auth.configure();\nwindow.AMPLIFY_CONFIG.urls = {\n  authBaseUrl: currentConfig.authBaseUrl,\n  lambdaApiBase: currentConfig.lambdaApiBase,\n};\nwindow.AMPLIFY_CONFIG.authCookieDomain = currentConfig.authCookieDomain;\n\nconst setLocalStorageAttrs = () => {\n  // Grab refresh token and user email from cookie\n  // We need to store the refresh token in localStorage for Cognito\n  const userPoolWebClientId = currentConfig.AMPLIFY_AUTH.userPoolWebClientId;\n  const refreshToken = Cookies.get(\"refreshToken\");\n  const userEmail = Cookies.get(\"currentUserEmail\");\n  const userToken = Cookies.get(USER_SESSION_COOKIE_NAME);\n  const accessToken = Cookies.get(\"accessToken\");\n\n  // If any of these are missing, have the user log in again\n  if (!userEmail || !refreshToken || !accessToken || !userToken) {\n    window.location.href = window.AMPLIFY_CONFIG.urls.authBaseUrl;\n    return;\n  }\n\n  // Set data in localstorage where AWS expects it\n  localStorage.setItem(`CognitoIdentityServiceProvider.${userPoolWebClientId}.LastAuthUser`, userEmail);\n  localStorage.setItem(`CognitoIdentityServiceProvider.${userPoolWebClientId}.${userEmail}.refreshToken`, refreshToken);\n  localStorage.setItem(`CognitoIdentityServiceProvider.${userPoolWebClientId}.${userEmail}.idToken`, userToken);\n  localStorage.setItem(`CognitoIdentityServiceProvider.${userPoolWebClientId}.${userEmail}.accessToken`, accessToken);\n\n  // Kill the unneeded cookies (we need userSessionIdentifier for auth)\n  cookieManager.deleteCookie(\"refreshToken\");\n  cookieManager.deleteCookie(\"accessToken\");\n  cookieManager.deleteCookie(\"currentUserEmail\");\n};\n\n// Users don't need to be authenticated for /drink_price_tool\nif (window.location.href.indexOf(\"drink_price_tool\") === -1) {\n  Auth.currentAuthenticatedUser()\n  // The user is authenticated as far as Cognito knows (localStorage)\n  .then(() => {\n    // Redirect accordingly.\n    const urlParams = new URLSearchParams(window.location.search);\n    if (window.location.href.indexOf(\"/login/\") === -1 && urlParams.has(\"next\")) {\n      window.location.href = decodeURIComponent(urlParams.get(\"next\"));\n    }\n  })\n  // The user is NOT authenticated as far as Cognito knows (localStorage)\n  // We will set their localStorage manually as if Cognito had done it\n  .catch((err) => {\n    setLocalStorageAttrs();\n  });\n}\n","import AccountsExceptions from 'gen-thrift/accounts_Exceptions_types';\nimport UnauthenticatedUserSessionExceptions from 'gen-thrift/unauthenticated_user_session_Exceptions_types';\n\nimport { cookieManager, userSessionManager } from 'shared/lib/manager';\nimport { logJsError } from 'shared/global/datadogLogger';\nimport { getLegacyDjangoErrorType, isLegacyErrorRejection, isRestApiRejection } from \"api/Core/apiQueryBase\";\nconst runtimeExceptionMessage = 'handle RuntimeException';\n\nconst browserExtensionUrlPrefixes = [\n    'chrome-extension://',\n    'moz-extension://',\n    'safari-extension://',\n    'safari-web-extension://',\n    'webkit-masked-url://',\n];\n\n// V8 stacks start with the message line; Firefox/Safari stacks start directly with frames\nconst getTopStackFrame = (stack: string): string => {\n    const stackLines = stack.split('\\n');\n    return stackLines.find((line) => /^\\s*at\\s/.test(line)) ?? stackLines[0];\n};\n\n// only the throwing frame counts: extensions that wrap addEventListener/fetch/etc. leave frames below our own code\nexport const isFromBrowserExtension = (error?: unknown, filename?: string): boolean => {\n    const stack = (error as { stack?: unknown } | null | undefined)?.stack;\n    const topStackFrame = typeof stack === 'string' ? getTopStackFrame(stack) : undefined;\n    return [filename, topStackFrame].some((source) =>\n        typeof source === 'string' && browserExtensionUrlPrefixes.some((prefix) => source.includes(prefix))\n    );\n};\n\n// IMPORTANT: this should have already been logged, all this does is determine whether or not to show the \"something went wrong\" modal\n// this is only called by the two window listeners: error and unhandledrejection. do not use it in other places.\nconst handleCustomErrors = (error : Error) => {\n    // Thrift errors\n    if (error instanceof UnauthenticatedUserSessionExceptions.UnknownUnauthenticatedUserSessionIdException) {\n        cookieManager.deleteCookie('unauthenticatedUserSessionId');\n        window.location.reload();\n        return;\n    }\n\n    if ((error instanceof AccountsExceptions.UnknownSessionIdentifierException) || (error instanceof AccountsExceptions.UnknownActorException)) {\n        void userSessionManager.terminateSession();\n        window.location.reload();\n        return;\n    }\n\n    if (error.name === \"AccountDoesNotHavePermissionException\") {\n        window.showGlobalErrorDialog('You do not have permission to perform this operation', 403);\n        return;\n    }\n\n    if (getLegacyDjangoErrorType(error.cause) === 'ProductIsDeletedException') {\n        window.showGlobalErrorDialog(\n            'This product has been deleted and can no longer be modified. Please restore it first if you need to make changes.',\n            410,\n        );\n        return;\n    }\n\n    if (error && (error.message === runtimeExceptionMessage)) { // Checking this to make sure we are not dealing with the same Error in a loop/\n        return;\n    }\n\n    // this used to throw an error so it would go over to error_catching.js but that's not necessary now. we should try to get rid of that code when we can\n    window.showGlobalErrorDialog(null, 500); // no message for now, just use the default\n};\n\nwindow.showGlobalErrorDialog = (\n    optionalMessage: string | null,\n    statusCode?: number,  // could use some enum/type to express error type... unclear what paradigm we want\n) => {\n    // if for some reason this has not been put on the page, do not try to call it - this will result in an infinite error loop\n    if (!window.handleAjaxError) {\n        // eslint-disable-next-line no-console\n        console.error(\"window error handling function is not defined\");\n        logJsError(\n            `[ERROR HANDLING BUG] ${optionalMessage ?? \"cannot find handleAjaxError\"}`,\n            { isHandled: true },\n            new Error(\"window.handleAjaxError is not set on this page\")\n        );\n        return;\n    }\n\n    // sadly, handleAjaxError requires jquery. if for some reason it's not on the page,\n    // trying to show the global error dialog will result in an infinite error loop\n    if (!window.$) {\n        // eslint-disable-next-line no-console\n        console.error(\"ReferenceError: $ is not defined\");\n        logJsError(\n            `[ERROR HANDLING BUG] cannot find jQuery on window`,\n            { isHandled: true },\n            new Error(\"jQuery has not been loaded on the page\")\n        );\n        return;\n    }\n\n    const status = statusCode === undefined ? 500 : statusCode;\n    window.handleAjaxError(status, null, null, optionalMessage);\n};\n\nwindow.addEventListener('error', (event : ErrorEvent) => {\n    // error occurs in script served from another domain\n    if ((event.message === 'Script error.') || (event.message === 'Script error')) {\n        // we are getting spammed by these errors, and they are probably originating from errors in third party tracking libraries\n        // eslint-disable-next-line no-console\n        console.error('JS Error not logged!', event);\n        return;\n    }\n\n    // unclear which library is using ResizeObserver but it throws intermittant errors (not reproduceable). Can safely ignore.\n    // https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded\n    if (event.message === 'ResizeObserver loop limit exceeded') {\n        // eslint-disable-next-line no-console\n        console.error('ResizeObserver error not logged!', event);\n        return;\n    }\n\n    // extensions (e.g. MetaMask) inject scripts that throw on every page; log them but don't block the user with the dialog\n    if (!isFromBrowserExtension(event.error, event.filename)) {\n        setTimeout(() => handleCustomErrors(event.error), 0);\n    }\n\n    if (window.navigator.onLine) {\n        logJsError(\n            event.message,\n            { isHandled: true },\n            event.error\n        );\n    }\n});\n\n// Error Tracking groups by error message, so a constant message puts every rejected request in one issue.\n// Status and exception type split them by kind; the full reason (with IDs) stays in the log message.\nconst getRejectionErrorMessage = (reason : unknown) : string => {\n    if (isRestApiRejection(reason) && reason.type) {\n        return `Unhandled request rejection (${reason.status}, ${reason.type})`;\n    }\n    if (isRestApiRejection(reason) || isLegacyErrorRejection(reason)) {\n        return `Unhandled request rejection (${reason.status})`;\n    }\n    return 'Unexpected unhandledrejection event';\n};\n\nexport const handleUnhandledRejection = (event : Event) => {\n    // typescript 2.7's strictFunctionTypes prevents us from typing event as PromiseRejectionEvent\n    // https://stackoverflow.com/a/47171216/3100850\n    const promiseRejectionEvent = event as PromiseRejectionEvent;\n\n    // eslint-disable-next-line no-console\n    console.log('unhandledrejection was actually found');\n\n    if (typeof window.PromiseRejectionEvent === 'undefined' ||\n        !(event instanceof window.PromiseRejectionEvent)) {\n        // we've seen browser extentions throwing this event with \"custom events\", missing the info we need to report on it\n        // @see Honey https://chrome.google.com/webstore/detail/honey/bmnlcjabgnpnenekpadlanbbkooimhnj\n        // eslint-disable-next-line no-console\n        console.error('Unrecognized `unhandledrejection` event', event);\n        return;\n    }\n\n    // all downstream code expects an actual error object, but the reason can be a number of non-error things\n    const reasonAsError = promiseRejectionEvent.reason instanceof Error ? promiseRejectionEvent.reason :\n        new Error(getRejectionErrorMessage(promiseRejectionEvent.reason), {cause: promiseRejectionEvent.reason})\n\n    if (event.isTrusted && !isFromBrowserExtension(promiseRejectionEvent.reason)) {\n        // trigger separately from the logging flow\n        setTimeout(() => handleCustomErrors(reasonAsError), 0);\n    }\n\n    if (window.navigator.onLine) {\n        let rejectionMsg: string;\n        if (typeof promiseRejectionEvent.reason === \"string\") {\n            rejectionMsg = promiseRejectionEvent.reason;\n        } else if (typeof promiseRejectionEvent.reason === \"object\" && \"message\" in promiseRejectionEvent.reason) {\n            rejectionMsg = promiseRejectionEvent.reason.message; // probably an IRestAPIRejection\n        } else {\n            rejectionMsg = JSON.stringify(promiseRejectionEvent.reason)\n        }\n\n        logJsError(\n            '(' + event.type + ') ' + rejectionMsg,\n            { isHandled: true },\n            reasonAsError\n        );\n    }\n};\n\nwindow.addEventListener('unhandledrejection', handleUnhandledRejection);\n\nwindow.addEventListener('offline', (event) => {\n    // throw new NoInternetConnectionException('window offline event triggered');\n});\n\n// window.addEventListener('online', function(event) { console.log('online'); });\n","import * as manager from 'shared/lib/manager';\n\n// Lesman 1-31-2017\n// Unfortunately these are not modules and cannot be loaded in the same way\n// that the manager is loaded into a namespace because the thrift compiler bad\n// Jeff 2017-02-08\n// these are modules now, so maybe we should revisit this\nimport AccountsExceptions from 'gen-thrift/accounts_Exceptions_types';\nimport CorePrimitivesModel from 'gen-thrift/core_primitives_Model_types';\nimport DistributorExceptions from 'gen-thrift/distributor_Exceptions_types';\nimport LocationModel from 'gen-thrift/location_Model_types';\nimport ProductExceptions from 'gen-thrift/product_Exceptions_types';\nimport UnauthenticatedUserSessionExceptions from 'gen-thrift/unauthenticated_user_session_Exceptions_types';\n\nimport { StringValueSet } from 'api/Core/StringValueSet';\nimport { Distributor } from 'api/Distributor/model/Distributor';\nimport { DistributorId } from 'api/Distributor/model/DistributorId';\nimport { DistributorRegionId } from 'api/Distributor/model/DistributorRegionId';\nimport { DistributorObjectToJSONSerializer } from 'api/Distributor/serializer/DistributorObjectToJSONSerializer';\nimport { InventoryCountId } from 'api/InventoryCount/model/InventoryCountId';\nimport { LocationId } from 'api/Location/model/LocationId';\nimport { Scope } from 'api/Location/model/Scope';\nimport { BaseUnit } from 'api/Product/model/BaseUnit';\nimport { MassUnit } from 'api/Product/model/MassUnit';\nimport { OldPackaging } from 'api/Product/model/OldPackaging';\nimport { PackagingId } from 'api/Product/model/PackagingId';\nimport { PackagingUnit } from 'api/Product/model/PackagingUnit';\nimport { ProductCost } from 'api/Product/model/ProductCost';\nimport { ProductId } from 'api/Product/model/ProductId';\nimport { QuantityInUnit } from 'api/Product/model/QuantityInUnit';\nimport { VolumeUnit } from 'api/Product/model/VolumeUnit';\nimport { oldPackagingUtils } from 'api/Product/utils/oldPackagingUtils';\nimport { PackagingUtils } from 'api/Product/utils/PackagingUtils';\nimport { CategoryUtils } from 'api/Product/utils/categoryUtils';\nimport { productCostUtils } from 'api/Product/utils/productCostUtils';\nimport { UserAccountId } from 'api/UserAccount/model/UserAccountId';\nimport { UserEmailAddressVerificationCredential } from 'api/UserAccount/model/UserEmailAddressVerificationCredential';\nimport { logJsError } from 'shared/global/datadogLogger';\nimport { getCurrencySymbol } from 'shared/models/Currency';\nimport { DateTime } from 'shared/models/DateTime';\nimport { Integer } from 'shared/models/Integer';\nimport { AjaxUtils } from 'shared/utils/ajaxUtils';\nimport { decimalUtils } from 'shared/utils/decimalUtils';\nimport { Observer } from 'shared/utils/observer';\n\nwindow.BevspotPlatformClient = {\n    logJsError,\n    Observer,\n    accounts: {\n        managers: {\n            userEmailAddressVerifier: manager.userEmailAddressVerifier,\n            userAccountManager: manager.userAccountManager,\n            userSessionManager: manager.userSessionManager\n        },\n\n        models: {\n            UserEmailAddressVerificationCredential,\n            UserAccountId\n        },\n\n        exceptions: {\n            UnknownEmailAddressVerificationCredentialException: AccountsExceptions.UnknownEmailAddressVerificationCredentialException,\n            ExpiredEmailAddressVerificationCredentialException: AccountsExceptions.ExpiredEmailAddressVerificationCredentialException,\n            EmailAddressVerificationCredentialAlreadyUsedException: AccountsExceptions.EmailAddressVerificationCredentialAlreadyUsedException,\n            EmailAddressAlreadyAssociatedWithAnAccountException: AccountsExceptions.EmailAddressAlreadyAssociatedWithAnAccountException,\n        },\n    },\n    corePrimitives: {\n        models: {\n            EmailAddress: CorePrimitivesModel.EmailAddress,\n        },\n    },\n    AjaxUtils,\n    core: {\n        DateTime,\n        StringValueSet,\n        Integer,\n        getCurrencySymbol,\n    },\n    distributor: {\n        services: {\n            DistributorServiceInstance: manager.DistributorServiceInstance,\n            serializer: DistributorObjectToJSONSerializer,\n        },\n        models: {\n            Scope,\n            Distributor,\n            DistributorId,\n            DistributorRegionId,\n        },\n        exceptions: DistributorExceptions\n    },\n    location: {\n        models: {\n            ThriftLocationIdentifier: LocationModel.LocationIdentifier,\n            LocationId\n        },\n        managers: {\n            locationProductService: manager.locationProductService,\n        }\n    },\n    product: {\n        managers : {\n            ProductDistributorServiceInstance: manager.ProductDistributorServiceInstance,\n            productCostService: manager.productCostService,\n            productService: manager.productService,\n        },\n        serializers: {\n            productJSONToObjectSerializer: manager.productJSONToObjectSerializer\n        },\n        models: {\n            ProductId,\n            MassUnit,\n            PackagingUnit,\n            BaseUnit,\n            VolumeUnit,\n            QuantityInUnit,\n            OldPackaging,\n            ProductCost,\n            PackagingId,\n        },\n        exceptions : ProductExceptions\n    },\n    unauthenticatedUserSessions: {\n        managers: {\n            unauthenticatedUserSessionManager: manager.unauthenticatedUserSessionManager,\n        },\n\n        exceptions: {\n            UnknownUnauthenticatedUserSessionIdException: UnauthenticatedUserSessionExceptions.UnknownUnauthenticatedUserSessionIdException,\n        },\n    },\n    inventory: {\n        models: {\n            InventoryCountId,\n        },\n    },\n    oldPackagingUtils,\n    PackagingUtils,\n    productCostUtils,\n    decimalUtils,\n    CategoryUtils,\n};\n"],"names":["currentConfig","dev","AMPLIFY_AUTH","mandatorySignIn","region","userPoolId","userPoolWebClientId","authBaseUrl","authCookieDomain","lambdaApiBase","prod","staging","Cookies","Amplify","configure","Auth","window","AMPLIFY_CONFIG","urls","location","href","indexOf","currentAuthenticatedUser","then","urlParams","URLSearchParams","search","has","decodeURIComponent","get","catch","err","setLocalStorageAttrs","refreshToken","userEmail","userToken","USER_SESSION_COOKIE_NAME","accessToken","localStorage","setItem","cookieManager","deleteCookie","browserExtensionUrlPrefixes","isFromBrowserExtension","error","filename","stack","topStackFrame","_stackLines$find","stackLines","split","find","line","test","getTopStackFrame","undefined","some","source","prefix","includes","handleCustomErrors","UnauthenticatedUserSessionExceptions","reload","AccountsExceptions","userSessionManager","terminateSession","name","getLegacyDjangoErrorType","cause","message","showGlobalErrorDialog","optionalMessage","statusCode","handleAjaxError","console","logJsError","isHandled","Error","$","status","addEventListener","event","setTimeout","navigator","onLine","handleUnhandledRejection","promiseRejectionEvent","log","PromiseRejectionEvent","reasonAsError","reason","isRestApiRejection","type","isLegacyErrorRejection","isTrusted","rejectionMsg","JSON","stringify","BevspotPlatformClient","shared_global_datadogLogger__WEBPACK_IMPORTED_MODULE_30__","cf","Observer","shared_utils_observer__WEBPACK_IMPORTED_MODULE_36__","n","accounts","managers","userEmailAddressVerifier","manager","userAccountManager","models","UserEmailAddressVerificationCredential","api_UserAccount_model_UserEmailAddressVerificationCredential__WEBPACK_IMPORTED_MODULE_29__","u","UserAccountId","exceptions","UnknownEmailAddressVerificationCredentialException","ExpiredEmailAddressVerificationCredentialException","EmailAddressVerificationCredentialAlreadyUsedException","EmailAddressAlreadyAssociatedWithAnAccountException","corePrimitives","EmailAddress","CorePrimitivesModel","AjaxUtils","shared_utils_ajaxUtils__WEBPACK_IMPORTED_MODULE_34__","i","core","DateTime","shared_models_DateTime__WEBPACK_IMPORTED_MODULE_32__","c9","StringValueSet","api_Core_StringValueSet__WEBPACK_IMPORTED_MODULE_7__","v","Integer","shared_models_Integer__WEBPACK_IMPORTED_MODULE_33__","j","getCurrencySymbol","distributor","services","DistributorServiceInstance","serializer","DistributorObjectToJSONSerializer","Scope","api_Location_model_Scope__WEBPACK_IMPORTED_MODULE_14__","H","Distributor","api_Distributor_model_Distributor__WEBPACK_IMPORTED_MODULE_8__","e","DistributorId","api_Distributor_model_DistributorId__WEBPACK_IMPORTED_MODULE_9__","b","DistributorRegionId","DistributorExceptions","ThriftLocationIdentifier","LocationModel","LocationId","locationProductService","product","ProductDistributorServiceInstance","productCostService","productService","serializers","productJSONToObjectSerializer","ProductId","api_Product_model_ProductId__WEBPACK_IMPORTED_MODULE_21__","MassUnit","api_Product_model_MassUnit__WEBPACK_IMPORTED_MODULE_16__","F","PackagingUnit","api_Product_model_PackagingUnit__WEBPACK_IMPORTED_MODULE_19__","BaseUnit","api_Product_model_BaseUnit__WEBPACK_IMPORTED_MODULE_15__","E","VolumeUnit","api_Product_model_VolumeUnit__WEBPACK_IMPORTED_MODULE_23__","r","QuantityInUnit","api_Product_model_QuantityInUnit__WEBPACK_IMPORTED_MODULE_22__","d","OldPackaging","api_Product_model_OldPackaging__WEBPACK_IMPORTED_MODULE_17__","ProductCost","api_Product_model_ProductCost__WEBPACK_IMPORTED_MODULE_20__","T","PackagingId","ProductExceptions","unauthenticatedUserSessions","unauthenticatedUserSessionManager","UnknownUnauthenticatedUserSessionIdException","inventory","InventoryCountId","oldPackagingUtils","api_Product_utils_oldPackagingUtils__WEBPACK_IMPORTED_MODULE_24__","Y","PackagingUtils","api_Product_utils_PackagingUtils__WEBPACK_IMPORTED_MODULE_25__","pY","productCostUtils","api_Product_utils_productCostUtils__WEBPACK_IMPORTED_MODULE_27__","q","decimalUtils","shared_utils_decimalUtils__WEBPACK_IMPORTED_MODULE_35__","Zu","CategoryUtils"],"sourceRoot":""}