import { __esm } from "./chunk-DSsiIF1Z.mjs";

//#region src/utils/misc.ts
function arraify(value) {
	return Array.isArray(value) ? value : [value];
}
function isNullish(value) {
	return value === null || value === void 0;
}
function isPromiseLike(value) {
	return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
}
function unimplemented(info) {
	if (info) throw new Error(`unimplemented: ${info}`);
	throw new Error("unimplemented");
}
function unreachable(info) {
	if (info) throw new Error(`unreachable: ${info}`);
	throw new Error("unreachable");
}
function unsupported(info) {
	throw new Error(`UNSUPPORTED: ${info}`);
}
function noop(..._args) {}
var init_misc = __esm({ "src/utils/misc.ts"() {} });

//#endregion
//#region ../pluginutils/dist/index.js
function and(...args) {
	return new And(...args);
}
function or(...args) {
	return new Or(...args);
}
function not(expr) {
	return new Not(expr);
}
function id(pattern, params) {
	return new Id(pattern, params);
}
function moduleType(pattern) {
	return new ModuleType(pattern);
}
function code(pattern) {
	return new Code(pattern);
}
function query(key, pattern) {
	return new Query(key, pattern);
}
function include(expr) {
	return new Include(expr);
}
function exclude(expr) {
	return new Exclude(expr);
}
/**
* convert a queryObject to FilterExpression like
* ```js
*   and(query(k1, v1), query(k2, v2))
* ```
* @param queryFilterObject The query filter object needs to be matched.
* @returns a `And` FilterExpression
*/
function queries(queryFilter) {
	let arr = Object.entries(queryFilter).map(([key, value]) => {
		return new Query(key, value);
	});
	return and(...arr);
}
var And, Or, Not, Id, ModuleType, Code, Query, Include, Exclude;
var init_dist = __esm({ "../pluginutils/dist/index.js"() {
	And = class {
		kind;
		args;
		constructor(...args) {
			if (args.length === 0) throw new Error("`And` expects at least one operand");
			this.args = args;
			this.kind = "and";
		}
	};
	Or = class {
		kind;
		args;
		constructor(...args) {
			if (args.length === 0) throw new Error("`Or` expects at least one operand");
			this.args = args;
			this.kind = "or";
		}
	};
	Not = class {
		kind;
		expr;
		constructor(expr) {
			this.expr = expr;
			this.kind = "not";
		}
	};
	Id = class {
		kind;
		pattern;
		params;
		constructor(pattern, params) {
			this.pattern = pattern;
			this.kind = "id";
			this.params = params ?? { cleanUrl: false };
		}
	};
	ModuleType = class {
		kind;
		pattern;
		constructor(pattern) {
			this.pattern = pattern;
			this.kind = "moduleType";
		}
	};
	Code = class {
		kind;
		pattern;
		constructor(expr) {
			this.pattern = expr;
			this.kind = "code";
		}
	};
	Query = class {
		kind;
		key;
		pattern;
		constructor(key, pattern) {
			this.pattern = pattern;
			this.key = key;
			this.kind = "query";
		}
	};
	Include = class {
		kind;
		expr;
		constructor(expr) {
			this.expr = expr;
			this.kind = "include";
		}
	};
	Exclude = class {
		kind;
		expr;
		constructor(expr) {
			this.expr = expr;
			this.kind = "exclude";
		}
	};
} });

//#endregion
export { and as and$1, arraify, code as code$1, exclude as exclude$1, id as id$1, include as include$1, init_dist, init_misc, isNullish, isPromiseLike, moduleType as moduleType$1, noop, not as not$1, or as or$1, queries as queries$1, query as query$1, unimplemented, unreachable, unsupported };