"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _utils = require("../utils");

let {
  app: {
    publicPaths,
    cdnMapping: {
      isCdnEnabled,
      variableName
    },
    server: {
      mode
    }
  }
} = (0, _utils.getOptions)();
let isDevelopment = mode === 'dev' || mode === 'prod' || mode === 'dev-no-warn';

var _default = url => {
  let type = (0, _utils.getFileType)(url);

  if (!isDevelopment) {
    if (publicPaths && publicPaths.callback) {
      return `${publicPaths.callback}(${JSON.stringify(type)}) + ${JSON.stringify(url)}`;
    } else if (isCdnEnabled) {
      return `window["${variableName}"] + ${JSON.stringify(url)}`;
    } else if (publicPaths) {
      return `__REACT_CLI_${type.toUpperCase()}_PUBLIC_PATH__ + ${JSON.stringify(url)}`;
    }
  }

  return `__webpack_public_path__ + ${JSON.stringify(url)}`;
};

exports.default = _default;