import { getAssetPath } from "@stencil/core";
import { Data, Effect } from "effect";
export class URLCreationError extends Data.TaggedError('URLCreationError') {
}
export const createAssetUrlWithBasePath = (file, basePath) => Effect.try(() => getAssetPath([basePath ?? '/assets', file].filter(Boolean).join('/').replace('//', '/'))).pipe(Effect.tapError(() => Effect.logWarning(`Failed to create URL for icon "${file}".
           Please provide an absolute URL in your app's 'setAssetPath(...)' configuration!
           Falling back to /assets/`)), Effect.orElseSucceed(() => window.location.origin + '/assets/' + file));
