function FetchMixin(superClass) {
	class FetchElement extends superClass {
		constructor(..._args) {
			super(..._args);
			this.fetch = (url, init) => {
				try {
					const workbench = this.closest("ef-workbench");
					if (workbench?.fetch) return workbench.fetch(url, init);
					const preview = this.closest("ef-preview");
					if (preview?.fetch) return preview.fetch(url, init);
					const configuration = this.closest("ef-configuration");
					if (configuration?.fetch) return configuration.fetch(url, init);
					return window.fetch(url, init);
				} catch (error) {
					console.error("FetchMixin error", url, error);
					throw error;
				}
			};
		}
	}
	return FetchElement;
}
export { FetchMixin };
