// Ported from js-yaml v3.13.1:
// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

export type KindType = "sequence" | "scalar" | "mapping";
/**
 * The style variation for `styles` option of {@linkcode stringify}
 */
export type StyleVariant =
  | "lowercase"
  | "uppercase"
  | "camelcase"
  | "decimal"
  | "binary"
  | "octal"
  | "hexadecimal";

export type RepresentFn<D> = (data: D, style?: StyleVariant) => string;

// deno-lint-ignore no-explicit-any
export interface Type<K extends KindType, D = any> {
  tag: string;
  kind: K;
  predicate?: (data: unknown) => data is D;
  represent?: RepresentFn<D> | Record<string, RepresentFn<D>>;
  defaultStyle?: StyleVariant;
  // deno-lint-ignore no-explicit-any
  resolve: (data: any) => boolean;
  // deno-lint-ignore no-explicit-any
  construct: (data: any) => D;
}

// denoCacheMetadata={"headers":{"access-control-allow-origin":"*","x-content-type-options":"nosniff","server":"cloudflare","cf-ray":"a2035caf3c7bcf1e-SJC","x-robots-tag":"noindex","set-cookie":"__cf_bm=QLBadreJrFV_sC3h6.C5ZM0I5CgbijzKcNeRBbRp6fI-1784900692.365173-1.0.1.1-89xVZzzFgIYfQXHkHoYlqLYTgUxuTsX0e18Q_Vyj2UcGMgNizsIxseyz6sYGdkuNnWLKOx77sK_xwWIHkkc4GUO5yy5cnXuLqQyxI8Ky6KvsnM0_sH7GiLEhEZ2qGTtT; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Fri, 24 Jul 2026 14:14:52 GMT","etag":"\"243c373f1b78bf9cda22c8b82ac6b91c\"","accept-ranges":"bytes","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=q9W%2B4GmM2IR%2FbY5J%2BajziVesrRK2aqBCYDVNaUqQPdElZRsExErjs0mZBvd4NeugiAoK30nEROdjhu0TRcaWFc5%2FPPqAiOUQpGABmGq5tmUxde%2BOXEt%2FYdo%3D\"}]}","content-type":"text/typescript","cf-cache-status":"HIT","age":"2753579","vary":"Origin","cross-origin-resource-policy":"cross-origin","x-jsr-backend":"modules","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","cache-control":"public, max-age=31536000, immutable","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","date":"Fri, 24 Jul 2026 13:44:52 GMT","alt-svc":"h3=\":443\"; ma=86400","access-control-expose-headers":"*","content-length":"1044"},"url":"https://jsr.io/@std/yaml/1.0.5/_type.ts","time":1784900692}