HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/design.system/node_modules/@svgr/babel-preset/dist/index.js
'use strict';

var addJSXAttribute = require('@svgr/babel-plugin-add-jsx-attribute');
var removeJSXAttribute = require('@svgr/babel-plugin-remove-jsx-attribute');
var removeJSXEmptyExpression = require('@svgr/babel-plugin-remove-jsx-empty-expression');
var replaceJSXAttributeValue = require('@svgr/babel-plugin-replace-jsx-attribute-value');
var svgDynamicTitle = require('@svgr/babel-plugin-svg-dynamic-title');
var svgEmDimensions = require('@svgr/babel-plugin-svg-em-dimensions');
var transformReactNativeSVG = require('@svgr/babel-plugin-transform-react-native-svg');
var transformSvgComponent = require('@svgr/babel-plugin-transform-svg-component');

const getAttributeValue = (value) => {
  const literal = typeof value === "string" && value.startsWith("{") && value.endsWith("}");
  return { value: literal ? value.slice(1, -1) : value, literal };
};
const propsToAttributes = (props) => {
  return Object.keys(props).map((name) => {
    const { literal, value } = getAttributeValue(props[name]);
    return { name, literal, value };
  });
};
function replaceMapToValues(replaceMap) {
  return Object.keys(replaceMap).map((value) => {
    const { literal, value: newValue } = getAttributeValue(replaceMap[value]);
    return { value, newValue, literal };
  });
}
const plugin = (_, opts) => {
  let toRemoveAttributes = ["version"];
  let toAddAttributes = [];
  if (opts.svgProps) {
    toAddAttributes = [...toAddAttributes, ...propsToAttributes(opts.svgProps)];
  }
  if (opts.ref) {
    toAddAttributes = [
      ...toAddAttributes,
      {
        name: "ref",
        value: "ref",
        literal: true
      }
    ];
  }
  if (opts.titleProp) {
    toAddAttributes = [
      ...toAddAttributes,
      {
        name: "aria-labelledby",
        value: "titleId",
        literal: true
      }
    ];
  }
  if (opts.descProp) {
    toAddAttributes = [
      ...toAddAttributes,
      {
        name: "aria-describedby",
        value: "descId",
        literal: true
      }
    ];
  }
  if (opts.expandProps) {
    toAddAttributes = [
      ...toAddAttributes,
      {
        name: "props",
        spread: true,
        position: opts.expandProps === "start" || opts.expandProps === "end" ? opts.expandProps : void 0
      }
    ];
  }
  if (!opts.dimensions) {
    toRemoveAttributes = [...toRemoveAttributes, "width", "height"];
  }
  const plugins = [
    [transformSvgComponent, opts],
    ...opts.icon !== false && opts.dimensions ? [
      [
        svgEmDimensions,
        opts.icon !== true ? { width: opts.icon, height: opts.icon } : opts.native ? { width: 24, height: 24 } : {}
      ]
    ] : [],
    [
      removeJSXAttribute,
      { elements: ["svg", "Svg"], attributes: toRemoveAttributes }
    ],
    [
      addJSXAttribute,
      { elements: ["svg", "Svg"], attributes: toAddAttributes }
    ],
    removeJSXEmptyExpression
  ];
  if (opts.replaceAttrValues) {
    plugins.push([
      replaceJSXAttributeValue,
      { values: replaceMapToValues(opts.replaceAttrValues) }
    ]);
  }
  if (opts.titleProp) {
    plugins.push(svgDynamicTitle);
  }
  if (opts.descProp) {
    plugins.push([svgDynamicTitle, { tag: "desc" }, "desc"]);
  }
  if (opts.native) {
    plugins.push(transformReactNativeSVG);
  }
  return { plugins };
};

module.exports = plugin;
//# sourceMappingURL=index.js.map