UNPKG

@winner-fed/plugin-element-ui

Version:

A WinJS plugin for Element UI to automatically import components and use tree-shaking to reduce the size of the bundle.

1,326 lines 83.1 kB
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os"; import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty"; import * as __WEBPACK_EXTERNAL_MODULE_util__ from "util"; import { dirname as external_node_path_dirname } from "node:path"; import { deepmerge, resolve } from "@winner-fed/utils"; import node_process from "node:process"; import "node:fs"; var __webpack_modules__ = { "./node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/browser.js": function(module, exports, __webpack_require__) { exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = localstorage(); exports.destroy = (()=>{ let warned = false; return ()=>{ if (!warned) { warned = true; console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); } }; })(); exports.colors = [ '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' ]; function useColors() { if ('undefined' != typeof window && window.process && ('renderer' === window.process.type || window.process.__nwjs)) return true; if ('undefined' != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false; let m; return 'undefined' != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || 'undefined' != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || 'undefined' != typeof navigator && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || 'undefined' != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } function formatArgs(args) { args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); if (!this.useColors) return; const c = 'color: ' + this.color; args.splice(1, 0, c, 'color: inherit'); let index = 0; let lastC = 0; args[0].replace(/%[a-zA-Z%]/g, (match)=>{ if ('%%' === match) return; index++; if ('%c' === match) lastC = index; }); args.splice(lastC, 0, c); } exports.log = console.debug || console.log || (()=>{}); function save(namespaces) { try { if (namespaces) exports.storage.setItem('debug', namespaces); else exports.storage.removeItem('debug'); } catch (error) {} } function load() { let r; try { r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG'); } catch (error) {} if (!r && 'undefined' != typeof process && 'env' in process) r = process.env.DEBUG; return r; } function localstorage() { try { return localStorage; } catch (error) {} } module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/common.js")(exports); const { formatters } = module.exports; formatters.j = function(v) { try { return JSON.stringify(v); } catch (error) { return '[UnexpectedJSONParseError]: ' + error.message; } }; }, "./node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/common.js": function(module, __unused_webpack_exports, __webpack_require__) { function setup(env) { createDebug.debug = createDebug; createDebug.default = createDebug; createDebug.coerce = coerce; createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = __webpack_require__("./node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"); createDebug.destroy = destroy; Object.keys(env).forEach((key)=>{ createDebug[key] = env[key]; }); createDebug.names = []; createDebug.skips = []; createDebug.formatters = {}; function selectColor(namespace) { let hash = 0; for(let i = 0; i < namespace.length; i++){ hash = (hash << 5) - hash + namespace.charCodeAt(i); hash |= 0; } return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; } createDebug.selectColor = selectColor; function createDebug(namespace) { let prevTime; let enableOverride = null; let namespacesCache; let enabledCache; function debug(...args) { if (!debug.enabled) return; const self = debug; const curr = Number(new Date()); const ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime; self.curr = curr; prevTime = curr; args[0] = createDebug.coerce(args[0]); if ('string' != typeof args[0]) args.unshift('%O'); let index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format)=>{ if ('%%' === match) return '%'; index++; const formatter = createDebug.formatters[format]; if ('function' == typeof formatter) { const val = args[index]; match = formatter.call(self, val); args.splice(index, 1); index--; } return match; }); createDebug.formatArgs.call(self, args); const logFn = self.log || createDebug.log; logFn.apply(self, args); } debug.namespace = namespace; debug.useColors = createDebug.useColors(); debug.color = createDebug.selectColor(namespace); debug.extend = extend; debug.destroy = createDebug.destroy; Object.defineProperty(debug, 'enabled', { enumerable: true, configurable: false, get: ()=>{ if (null !== enableOverride) return enableOverride; if (namespacesCache !== createDebug.namespaces) { namespacesCache = createDebug.namespaces; enabledCache = createDebug.enabled(namespace); } return enabledCache; }, set: (v)=>{ enableOverride = v; } }); if ('function' == typeof createDebug.init) createDebug.init(debug); return debug; } function extend(namespace, delimiter) { const newDebug = createDebug(this.namespace + (void 0 === delimiter ? ':' : delimiter) + namespace); newDebug.log = this.log; return newDebug; } function enable(namespaces) { createDebug.save(namespaces); createDebug.namespaces = namespaces; createDebug.names = []; createDebug.skips = []; const split = ('string' == typeof namespaces ? namespaces : '').trim().replace(/\s+/g, ',').split(',').filter(Boolean); for (const ns of split)if ('-' === ns[0]) createDebug.skips.push(ns.slice(1)); else createDebug.names.push(ns); } function matchesTemplate(search, template) { let searchIndex = 0; let templateIndex = 0; let starIndex = -1; let matchIndex = 0; while(searchIndex < search.length)if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || '*' === template[templateIndex])) if ('*' === template[templateIndex]) { starIndex = templateIndex; matchIndex = searchIndex; templateIndex++; } else { searchIndex++; templateIndex++; } else { if (-1 === starIndex) return false; templateIndex = starIndex + 1; matchIndex++; searchIndex = matchIndex; } while(templateIndex < template.length && '*' === template[templateIndex])templateIndex++; return templateIndex === template.length; } function disable() { const namespaces = [ ...createDebug.names, ...createDebug.skips.map((namespace)=>'-' + namespace) ].join(','); createDebug.enable(''); return namespaces; } function enabled(name) { for (const skip of createDebug.skips)if (matchesTemplate(name, skip)) return false; for (const ns of createDebug.names)if (matchesTemplate(name, ns)) return true; return false; } function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } function destroy() { console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); } createDebug.enable(createDebug.load()); return createDebug; } module.exports = setup; }, "./node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/index.js": function(module, __unused_webpack_exports, __webpack_require__) { if ('undefined' == typeof process || 'renderer' === process.type || true === process.browser || process.__nwjs) module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/browser.js"); else module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js"); }, "./node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js": function(module, exports, __webpack_require__) { const tty = __webpack_require__("tty"); const util = __webpack_require__("util"); exports.init = init; exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.destroy = util.deprecate(()=>{}, 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); exports.colors = [ 6, 2, 3, 4, 5, 1 ]; try { const supportsColor = __webpack_require__("./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js"); if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ]; } catch (error) {} exports.inspectOpts = Object.keys(process.env).filter((key)=>/^debug_/i.test(key)).reduce((obj, key)=>{ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k)=>k.toUpperCase()); let val = process.env[key]; val = /^(yes|on|true|enabled)$/i.test(val) ? true : /^(no|off|false|disabled)$/i.test(val) ? false : 'null' === val ? null : Number(val); obj[prop] = val; return obj; }, {}); function useColors() { return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); } function formatArgs(args) { const { namespace: name, useColors } = this; if (useColors) { const c = this.color; const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); const prefix = ` ${colorCode};1m${name} \u001B[0m`; args[0] = prefix + args[0].split('\n').join('\n' + prefix); args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); } else args[0] = getDate() + name + ' ' + args[0]; } function getDate() { if (exports.inspectOpts.hideDate) return ''; return new Date().toISOString() + ' '; } function log(...args) { return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); } function save(namespaces) { if (namespaces) process.env.DEBUG = namespaces; else delete process.env.DEBUG; } function load() { return process.env.DEBUG; } function init(debug) { debug.inspectOpts = {}; const keys = Object.keys(exports.inspectOpts); for(let i = 0; i < keys.length; i++)debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; } module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/common.js")(exports); const { formatters } = module.exports; formatters.o = function(v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts).split('\n').map((str)=>str.trim()).join(' '); }; formatters.O = function(v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts); }; }, "./node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js": function(module) { module.exports = (flag, argv = process.argv)=>{ const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--'; const position = argv.indexOf(prefix + flag); const terminatorPosition = argv.indexOf('--'); return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition); }; }, "./node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js": function(module) { var s = 1000; var m = 60 * s; var h = 60 * m; var d = 24 * h; var w = 7 * d; var y = 365.25 * d; module.exports = function(val, options) { options = options || {}; var type = typeof val; if ('string' === type && val.length > 0) return parse(val); if ('number' === type && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val); throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); }; function parse(str) { str = String(str); if (str.length > 100) return; var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); if (!match) return; var n = parseFloat(match[1]); var type = (match[2] || 'ms').toLowerCase(); switch(type){ case 'years': case 'year': case 'yrs': case 'yr': case 'y': return n * y; case 'weeks': case 'week': case 'w': return n * w; case 'days': case 'day': case 'd': return n * d; case 'hours': case 'hour': case 'hrs': case 'hr': case 'h': return n * h; case 'minutes': case 'minute': case 'mins': case 'min': case 'm': return n * m; case 'seconds': case 'second': case 'secs': case 'sec': case 's': return n * s; case 'milliseconds': case 'millisecond': case 'msecs': case 'msec': case 'ms': return n; default: return; } } function fmtShort(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) return Math.round(ms / d) + 'd'; if (msAbs >= h) return Math.round(ms / h) + 'h'; if (msAbs >= m) return Math.round(ms / m) + 'm'; if (msAbs >= s) return Math.round(ms / s) + 's'; return ms + 'ms'; } function fmtLong(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) return plural(ms, msAbs, d, 'day'); if (msAbs >= h) return plural(ms, msAbs, h, 'hour'); if (msAbs >= m) return plural(ms, msAbs, m, 'minute'); if (msAbs >= s) return plural(ms, msAbs, s, 'second'); return ms + ' ms'; } function plural(ms, msAbs, n, name) { var isPlural = msAbs >= 1.5 * n; return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); } }, "./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js": function(module, __unused_webpack_exports, __webpack_require__) { const os = __webpack_require__("os"); const tty = __webpack_require__("tty"); const hasFlag = __webpack_require__("./node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"); const { env } = process; let flagForceColor; if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0; else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1; function envForceColor() { if ('FORCE_COLOR' in env) { if ('true' === env.FORCE_COLOR) return 1; if ('false' === env.FORCE_COLOR) return 0; return 0 === env.FORCE_COLOR.length ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3); } } function translateLevel(level) { if (0 === level) return false; return { level, hasBasic: true, has256: level >= 2, has16m: level >= 3 }; } function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) { const noFlagForceColor = envForceColor(); if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor; const forceColor = sniffFlags ? flagForceColor : noFlagForceColor; if (0 === forceColor) return 0; if (sniffFlags) { if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3; if (hasFlag('color=256')) return 2; } if (haveStream && !streamIsTTY && void 0 === forceColor) return 0; const min = forceColor || 0; if ('dumb' === env.TERM) return min; if ('win32' === process.platform) { const osRelease = os.release().split('.'); if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2; return 1; } if ('CI' in env) { if ([ 'TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE' ].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1; return min; } if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; if ('truecolor' === env.COLORTERM) return 3; if ('TERM_PROGRAM' in env) { const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); switch(env.TERM_PROGRAM){ case 'iTerm.app': return version >= 3 ? 3 : 2; case 'Apple_Terminal': return 2; } } if (/-256(color)?$/i.test(env.TERM)) return 2; if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1; if ('COLORTERM' in env) return 1; return min; } function getSupportLevel(stream, options = {}) { const level = supportsColor(stream, { streamIsTTY: stream && stream.isTTY, ...options }); return translateLevel(level); } module.exports = { supportsColor: getSupportLevel, stdout: getSupportLevel({ isTTY: tty.isatty(1) }), stderr: getSupportLevel({ isTTY: tty.isatty(2) }) }; }, os: function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE_os__; }, tty: function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE_tty__; }, util: function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE_util__; } }; var __webpack_module_cache__ = {}; function __webpack_require__(moduleId) { var cachedModule = __webpack_module_cache__[moduleId]; if (void 0 !== cachedModule) return cachedModule.exports; var module = __webpack_module_cache__[moduleId] = { exports: {} }; __webpack_modules__[moduleId](module, module.exports, __webpack_require__); return module.exports; } var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod)=>function() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc)=>{ if (from && "object" == typeof from || "function" == typeof from) { 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 __toESM = (mod, isNodeMode, target)=>(target = null != mod ? __create(__getProtoOf(mod)) : {}, __copyProps(!isNodeMode && mod && mod.__esModule ? target : __defProp(target, "default", { value: mod, enumerable: true }), mod)); var require_balanced_match = __commonJS({ "node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js" (exports, module) { "use strict"; module.exports = balanced; function balanced(a, b, str) { if (a instanceof RegExp) a = maybeMatch(a, str); if (b instanceof RegExp) b = maybeMatch(b, str); var r = range(a, b, str); return r && { start: r[0], end: r[1], pre: str.slice(0, r[0]), body: str.slice(r[0] + a.length, r[1]), post: str.slice(r[1] + b.length) }; } function maybeMatch(reg, str) { var m = str.match(reg); return m ? m[0] : null; } balanced.range = range; function range(a, b, str) { var begs, beg, left, right, result; var ai = str.indexOf(a); var bi = str.indexOf(b, ai + 1); var i = ai; if (ai >= 0 && bi > 0) { if (a === b) return [ ai, bi ]; begs = []; left = str.length; while(i >= 0 && !result){ if (i == ai) { begs.push(i); ai = str.indexOf(a, i + 1); } else if (1 == begs.length) result = [ begs.pop(), bi ]; else { beg = begs.pop(); if (beg < left) { left = beg; right = bi; } bi = str.indexOf(b, i + 1); } i = ai < bi && ai >= 0 ? ai : bi; } if (begs.length) result = [ left, right ]; } return result; } } }); var require_brace_expansion = __commonJS({ "node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js" (exports, module) { "use strict"; var balanced = require_balanced_match(); module.exports = expandTop; var escSlash = "\0SLASH" + Math.random() + "\0"; var escOpen = "\0OPEN" + Math.random() + "\0"; var escClose = "\0CLOSE" + Math.random() + "\0"; var escComma = "\0COMMA" + Math.random() + "\0"; var escPeriod = "\0PERIOD" + Math.random() + "\0"; function numeric(str) { return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0); } function escapeBraces(str) { return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod); } function unescapeBraces(str) { return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join("."); } function parseCommaParts(str) { if (!str) return [ "" ]; var parts = []; var m = balanced("{", "}", str); if (!m) return str.split(","); var pre = m.pre; var body = m.body; var post = m.post; var p = pre.split(","); p[p.length - 1] += "{" + body + "}"; var postParts = parseCommaParts(post); if (post.length) { p[p.length - 1] += postParts.shift(); p.push.apply(p, postParts); } parts.push.apply(parts, p); return parts; } function expandTop(str) { if (!str) return []; if ("{}" === str.substr(0, 2)) str = "\\{\\}" + str.substr(2); return expand2(escapeBraces(str), true).map(unescapeBraces); } function embrace(str) { return "{" + str + "}"; } function isPadded(el) { return /^-?0\d/.test(el); } function lte(i, y) { return i <= y; } function gte(i, y) { return i >= y; } function expand2(str, isTop) { var expansions = []; var m = balanced("{", "}", str); if (!m) return [ str ]; var pre = m.pre; var post = m.post.length ? expand2(m.post, false) : [ "" ]; if (/\$$/.test(m.pre)) for(var k = 0; k < post.length; k++){ var expansion = pre + "{" + m.body + "}" + post[k]; expansions.push(expansion); } else { var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); var isSequence = isNumericSequence || isAlphaSequence; var isOptions = m.body.indexOf(",") >= 0; if (!isSequence && !isOptions) { if (m.post.match(/,.*\}/)) { str = m.pre + "{" + m.body + escClose + m.post; return expand2(str); } return [ str ]; } var n; if (isSequence) n = m.body.split(/\.\./); else { n = parseCommaParts(m.body); if (1 === n.length) { n = expand2(n[0], false).map(embrace); if (1 === n.length) return post.map(function(p) { return m.pre + n[0] + p; }); } } var N; if (isSequence) { var x = numeric(n[0]); var y = numeric(n[1]); var width = Math.max(n[0].length, n[1].length); var incr = 3 == n.length ? Math.abs(numeric(n[2])) : 1; var test = lte; var reverse = y < x; if (reverse) { incr *= -1; test = gte; } var pad = n.some(isPadded); N = []; for(var i = x; test(i, y); i += incr){ var c; if (isAlphaSequence) { c = String.fromCharCode(i); if ("\\" === c) c = ""; } else { c = String(i); if (pad) { var need = width - c.length; if (need > 0) { var z = new Array(need + 1).join("0"); c = i < 0 ? "-" + z + c.slice(1) : z + c; } } } N.push(c); } } else { N = []; for(var j = 0; j < n.length; j++)N.push.apply(N, expand2(n[j], false)); } for(var j = 0; j < N.length; j++)for(var k = 0; k < post.length; k++){ var expansion = pre + N[j] + post[k]; if (!isTop || isSequence || expansion) expansions.push(expansion); } } return expansions; } } }); Symbol("p-void"); var import_brace_expansion = __toESM(require_brace_expansion(), 1); var MAX_PATTERN_LENGTH = 65536; var assertValidPattern = (pattern)=>{ if ("string" != typeof pattern) throw new TypeError("invalid pattern"); if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long"); }; var posixClasses = { "[:alnum:]": [ "\\p{L}\\p{Nl}\\p{Nd}", true ], "[:alpha:]": [ "\\p{L}\\p{Nl}", true ], "[:ascii:]": [ "\\x00-\\x7f", false ], "[:blank:]": [ "\\p{Zs}\\t", true ], "[:cntrl:]": [ "\\p{Cc}", true ], "[:digit:]": [ "\\p{Nd}", true ], "[:graph:]": [ "\\p{Z}\\p{C}", true, true ], "[:lower:]": [ "\\p{Ll}", true ], "[:print:]": [ "\\p{C}", true ], "[:punct:]": [ "\\p{P}", true ], "[:space:]": [ "\\p{Z}\\t\\r\\n\\v\\f", true ], "[:upper:]": [ "\\p{Lu}", true ], "[:word:]": [ "\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true ], "[:xdigit:]": [ "A-Fa-f0-9", false ] }; var braceEscape = (s)=>s.replace(/[[\]\\-]/g, "\\$&"); var regexpEscape = (s)=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); var rangesToString = (ranges)=>ranges.join(""); var parseClass = (glob, position)=>{ const pos = position; if ("[" !== glob.charAt(pos)) throw new Error("not in a brace expression"); const ranges = []; const negs = []; let i = pos + 1; let sawStart = false; let uflag = false; let escaping = false; let negate = false; let endPos = pos; let rangeStart = ""; WHILE: while(i < glob.length){ const c = glob.charAt(i); if (("!" === c || "^" === c) && i === pos + 1) { negate = true; i++; continue; } if ("]" === c && sawStart && !escaping) { endPos = i + 1; break; } sawStart = true; if ("\\" === c) { if (!escaping) { escaping = true; i++; continue; } } if ("[" === c && !escaping) { for (const [cls, [unip, u, neg]] of Object.entries(posixClasses))if (glob.startsWith(cls, i)) { if (rangeStart) return [ "$.", false, glob.length - pos, true ]; i += cls.length; if (neg) negs.push(unip); else ranges.push(unip); uflag = uflag || u; continue WHILE; } } escaping = false; if (rangeStart) { if (c > rangeStart) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c)); else if (c === rangeStart) ranges.push(braceEscape(c)); rangeStart = ""; i++; continue; } if (glob.startsWith("-]", i + 1)) { ranges.push(braceEscape(c + "-")); i += 2; continue; } if (glob.startsWith("-", i + 1)) { rangeStart = c; i += 2; continue; } ranges.push(braceEscape(c)); i++; } if (endPos < i) return [ "", false, 0, false ]; if (!ranges.length && !negs.length) return [ "$.", false, glob.length - pos, true ]; if (0 === negs.length && 1 === ranges.length && /^\\?.$/.test(ranges[0]) && !negate) { const r = 2 === ranges[0].length ? ranges[0].slice(-1) : ranges[0]; return [ regexpEscape(r), false, endPos - pos, false ]; } const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]"; const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]"; const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs; return [ comb, uflag, endPos - pos, true ]; }; var chunk_GDTH3WEN_unescape = (s, { windowsPathsNoEscape = false } = {})=>windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"); var types = /* @__PURE__ */ new Set([ "!", "?", "+", "*", "@" ]); var isExtglobType = (c)=>types.has(c); var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))"; var startNoDot = "(?!\\.)"; var addPatternStart = /* @__PURE__ */ new Set([ "[", "." ]); var justDots = /* @__PURE__ */ new Set([ "..", "." ]); var reSpecials = new Set("().*{}+?[]^$\\!"); var regExpEscape = (s)=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); var qmark = "[^/]"; var star = qmark + "*?"; var starNoEmpty = qmark + "+?"; var chunk_GDTH3WEN_AST = class _AST { type; #root; #hasMagic; #uflag = false; #parts = []; #parent; #parentIndex; #negs; #filledNegs = false; #options; #toString; #emptyExt = false; constructor(type, parent, options = {}){ this.type = type; if (type) this.#hasMagic = true; this.#parent = parent; this.#root = this.#parent ? this.#parent.#root : this; this.#options = this.#root === this ? options : this.#root.#options; this.#negs = this.#root === this ? [] : this.#root.#negs; if ("!" === type && !this.#root.#filledNegs) this.#negs.push(this); this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0; } get hasMagic() { if (void 0 !== this.#hasMagic) return this.#hasMagic; for (const p of this.#parts)if ("string" != typeof p) { if (p.type || p.hasMagic) return this.#hasMagic = true; } return this.#hasMagic; } toString() { if (void 0 !== this.#toString) return this.#toString; if (!this.type) return this.#toString = this.#parts.map((p)=>String(p)).join(""); return this.#toString = this.type + "(" + this.#parts.map((p)=>String(p)).join("|") + ")"; } #fillNegs() { if (this !== this.#root) throw new Error("should only call on root"); if (this.#filledNegs) return this; this.toString(); this.#filledNegs = true; let n; while(n = this.#negs.pop()){ if ("!" !== n.type) continue; let p = n; let pp = p.#parent; while(pp){ for(let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++)for (const part of n.#parts){ if ("string" == typeof part) throw new Error("string part in extglob AST??"); part.copyIn(pp.#parts[i]); } p = pp; pp = p.#parent; } } return this; } push(...parts) { for (const p of parts)if ("" !== p) { if ("string" != typeof p && !(p instanceof _AST && p.#parent === this)) throw new Error("invalid part: " + p); this.#parts.push(p); } } toJSON() { const ret = null === this.type ? this.#parts.slice().map((p)=>"string" == typeof p ? p : p.toJSON()) : [ this.type, ...this.#parts.map((p)=>p.toJSON()) ]; if (this.isStart() && !this.type) ret.unshift([]); if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) ret.push({}); return ret; } isStart() { if (this.#root === this) return true; if (!this.#parent?.isStart()) return false; if (0 === this.#parentIndex) return true; const p = this.#parent; for(let i = 0; i < this.#parentIndex; i++){ const pp = p.#parts[i]; if (!(pp instanceof _AST && "!" === pp.type)) return false; } return true; } isEnd() { if (this.#root === this) return true; if (this.#parent?.type === "!") return true; if (!this.#parent?.isEnd()) return false; if (!this.type) return this.#parent?.isEnd(); const pl = this.#parent ? this.#parent.#parts.length : 0; return this.#parentIndex === pl - 1; } copyIn(part) { if ("string" == typeof part) this.push(part); else this.push(part.clone(this)); } clone(parent) { const c = new _AST(this.type, parent); for (const p of this.#parts)c.copyIn(p); return c; } static #parseAST(str, ast, pos, opt) { let escaping = false; let inBrace = false; let braceStart = -1; let braceNeg = false; if (null === ast.type) { let i2 = pos; let acc2 = ""; while(i2 < str.length){ const c = str.charAt(i2++); if (escaping || "\\" === c) { escaping = !escaping; acc2 += c; continue; } if (inBrace) { if (i2 === braceStart + 1) { if ("^" === c || "!" === c) braceNeg = true; } else if ("]" === c && !(i2 === braceStart + 2 && braceNeg)) inBrace = false; acc2 += c; continue; } if ("[" === c) { inBrace = true; braceStart = i2; braceNeg = false; acc2 += c; continue; } if (!opt.noext && isExtglobType(c) && "(" === str.charAt(i2)) { ast.push(acc2); acc2 = ""; const ext2 = new _AST(c, ast); i2 = _AST.#parseAST(str, ext2, i2, opt); ast.push(ext2); continue; } acc2 += c; } ast.push(acc2); return i2; } let i = pos + 1; let part = new _AST(null, ast); const parts = []; let acc = ""; while(i < str.length){ const c = str.charAt(i++); if (escaping || "\\" === c) { escaping = !escaping; acc += c; continue; } if (inBrace) { if (i === braceStart + 1) { if ("^" === c || "!" === c) braceNeg = true; } else if ("]" === c && !(i === braceStart + 2 && braceNeg)) inBrace = false; acc += c; continue; } if ("[" === c) { inBrace = true; braceStart = i; braceNeg = false; acc += c; continue; } if (isExtglobType(c) && "(" === str.charAt(i)) { part.push(acc); acc = ""; const ext2 = new _AST(c, part); part.push(ext2); i = _AST.#parseAST(str, ext2, i, opt); continue; } if ("|" === c) { part.push(acc); acc = ""; parts.push(part); part = new _AST(null, ast); continue; } if (")" === c) { if ("" === acc && 0 === ast.#parts.length) ast.#emptyExt = true; part.push(acc); acc = ""; ast.push(...parts, part); return i; } acc += c; } ast.type = null; ast.#hasMagic = void 0; ast.#parts = [ str.substring(pos - 1) ]; return i; } static fromGlob(pattern, options = {}) { const ast = new _AST(null, void 0, options); _AST.#parseAST(pattern, ast, 0, options); return ast; } toMMPattern() { if (this !== this.#root) return this.#root.toMMPattern(); const glob = this.toString(); const [re, body, hasMagic, uflag] = this.toRegExpSource(); const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase(); if (!anyMagic) return body; const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : ""); return Object.assign(new RegExp(`^${re}$`, flags), { _src: re, _glob: glob }); } get options() { return this.#options; } toRegExpSource(allowDot) { const dot = allowDot ?? !!this.#options.dot; if (this.#root === this) this.#fillNegs(); if (!this.type) { const noEmpty = this.isStart() && this.isEnd(); const src = this.#parts.map((p)=>{ const [re, _, hasMagic, uflag] = "string" == typeof p ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot); this.#hasMagic = this.#hasMagic || hasMagic; this.#uflag = this.#uflag || uflag; return re; }).join(""); let start2 = ""; if (this.isStart()) { if ("string" == typeof this.#parts[0]) { const dotTravAllowed = 1 === this.#parts.length && justDots.has(this.#parts[0]); if (!dotTravAllowed) { const aps = addPatternStart; const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4)); const needNoDot = !dot && !allowDot && aps.has(src.charAt(0)); start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : ""; } } } let end = ""; if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") end = "(?:$|\\/)"; const final2 = start2 + src + end; return [ final2, chunk_GDTH3WEN_unescape(src), this.#hasMagic = !!this.#hasMagic, this.#uflag ]; } const repeated = "*" === this.type || "+" === this.type; const start = "!" === this.type ? "(?:(?!(?:" : "(?:"; let body = this.#partsToRegExp(dot); if (this.isStart() && this.isEnd() && !body && "!" !== this.type) { const s = this.toString(); this.#parts = [ s ]; this.type = null; this.#hasMagic = void 0; return [ s, chunk_GDTH3WEN_unescape(this.toString()), false, false ]; }