var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
import { canonicalURL as getCanonicalURL } from "../util.js";
import { renderSlot } from "../../runtime/server/index.js";
function createResult(args) {
  const { astroConfig, origin, params, pathname, renderers } = args;
  const result = {
    styles: new Set(),
    scripts: new Set(),
    links: new Set(),
    createAstro(astroGlobal, props, slots) {
      const site = new URL(origin);
      const url = new URL("." + pathname, site);
      const canonicalURL = getCanonicalURL("." + pathname, astroConfig.buildOptions.site || origin);
      return {
        __proto__: astroGlobal,
        props,
        request: {
          canonicalURL,
          params,
          url
        },
        slots: Object.fromEntries(Object.entries(slots || {}).map(([slotName]) => [slotName, true])),
        privateRenderSlotDoNotUse(slotName) {
          return renderSlot(result, slots ? slots[slotName] : null);
        },
        async privateRenderMarkdownDoNotUse(content, opts) {
          let mdRender = astroConfig.markdownOptions.render;
          let renderOpts = {};
          if (Array.isArray(mdRender)) {
            renderOpts = mdRender[1];
            mdRender = mdRender[0];
          }
          if (typeof mdRender === "string") {
            ({ default: mdRender } = await import(mdRender));
          } else if (mdRender instanceof Promise) {
            ({ default: mdRender } = await mdRender);
          }
          const { code } = await mdRender(content, __spreadValues(__spreadValues({}, renderOpts), opts != null ? opts : {}));
          return code;
        }
      };
    },
    async resolve(s) {
      return "";
    },
    _metadata: {
      renderers,
      pathname,
      experimentalStaticBuild: astroConfig.buildOptions.experimentalStaticBuild
    }
  };
  return result;
}
export {
  createResult
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