var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var build_stick_to_distance_expressions_exports = {};
__export(build_stick_to_distance_expressions_exports, {
  buildCircleStickToDistanceExpression: () => buildCircleStickToDistanceExpression,
  buildOutlineStickToDistanceExpression: () => buildOutlineStickToDistanceExpression
});
module.exports = __toCommonJS(build_stick_to_distance_expressions_exports);
var import_add_outline_size = require("./add-outline-size.js");
const MAP_MAX_ZOOM_LEVEL = 22;
const MAP_MIN_ZOOM_LEVEL = 0;
const EQUATOR_METERS_BY_PIXEL_MAX_ZOOM_LEVEL_RATIO = 0.019;
const shrinkFactor = 4;
const gainAtMaxZoomLevel = 1e4;
const mercatorLatitudeScalingFactor = [
  "cos",
  ["*", ["get", "__lat"], ["/", Math.PI, 180]]
];
const minZoomLevelCalculation = [
  "/",
  ["get", "__radius"],
  shrinkFactor
];
const maxZoomLevelCalculation = [
  "/",
  [
    "/",
    ["*", ["get", "__radius"], gainAtMaxZoomLevel],
    EQUATOR_METERS_BY_PIXEL_MAX_ZOOM_LEVEL_RATIO
  ],
  mercatorLatitudeScalingFactor
];
const buildCircleStickToDistanceExpression = () => {
  return [
    "interpolate",
    ["exponential", 2],
    ["zoom"],
    MAP_MIN_ZOOM_LEVEL,
    minZoomLevelCalculation,
    MAP_MAX_ZOOM_LEVEL,
    maxZoomLevelCalculation
  ];
};
const buildOutlineStickToDistanceExpression = () => {
  return [
    "interpolate",
    ["exponential", 2],
    ["zoom"],
    MAP_MIN_ZOOM_LEVEL,
    (0, import_add_outline_size.addOutlineSize)(minZoomLevelCalculation),
    MAP_MAX_ZOOM_LEVEL,
    (0, import_add_outline_size.addOutlineSize)(maxZoomLevelCalculation)
  ];
};
