"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-DGUM43GV.js');

// src/metadata/generatePageMetadata.ts
function generatePageMetadata(input) {
  const { page, site, path, siteUrl, overrides, googleSiteVerification } = input;
  const pageTitle = _nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _ => _.title]), () => ( page.name));
  const fullTitle = pageTitle === site.title ? pageTitle : `${pageTitle} | ${site.title}`;
  const description = _nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _2 => _2.description]), () => ( page.purpose));
  const canonicalUrl = _nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _3 => _3.canonicalUrl]), () => ( `${siteUrl}${path}`));
  const fullUrl = `${siteUrl}${path}`;
  const metadata = {
    title: fullTitle,
    description: _nullishCoalesce(description, () => ( void 0)),
    alternates: {
      canonical: canonicalUrl
    },
    openGraph: {
      title: pageTitle,
      description: _nullishCoalesce(description, () => ( void 0)),
      url: fullUrl,
      siteName: site.title,
      type: "website",
      ..._optionalChain([overrides, 'optionalAccess', _4 => _4.ogImage]) ? {
        images: [
          {
            url: overrides.ogImage,
            alt: pageTitle
          }
        ]
      } : {}
    },
    twitter: {
      card: "summary_large_image",
      title: pageTitle,
      description: _nullishCoalesce(description, () => ( void 0)),
      ..._optionalChain([overrides, 'optionalAccess', _5 => _5.ogImage]) ? {
        images: [overrides.ogImage]
      } : {}
    }
  };
  if (_optionalChain([overrides, 'optionalAccess', _6 => _6.robots])) {
    metadata.robots = {
      index: _nullishCoalesce(overrides.robots.index, () => ( true)),
      follow: _nullishCoalesce(overrides.robots.follow, () => ( true))
    };
  }
  if (googleSiteVerification) {
    metadata.verification = {
      google: googleSiteVerification
    };
  }
  return metadata;
}
function generatePreviewMetadata(input) {
  return generatePageMetadata({
    ...input,
    overrides: {
      ...input.overrides,
      robots: {
        index: false,
        follow: false
      }
    }
  });
}



exports.generatePageMetadata = generatePageMetadata; exports.generatePreviewMetadata = generatePreviewMetadata;
//# sourceMappingURL=metadata.js.map