// 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":{"x-content-type-options":"nosniff","x-guploader-uploadid":"AJRbA5UCkZx-eHwCjOXDYAwjDfTmKW1eaRaYnsZ0UoKuM-2rW8-GiQtNUT071E_mkNlk6qgANtBRhKM","x-robots-tag":"noindex","x-goog-metageneration":"1","access-control-allow-origin":"*","via":"1.1 google","x-goog-storage-class":"STANDARD","x-goog-stored-content-encoding":"identity","content-type":"text/typescript","x-jsr-cache-id":"ORD-770aa22e","cross-origin-resource-policy":"cross-origin","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","x-goog-hash":"crc32c=lGl9GA==,md5=JDw3Pxt4v5zaIsi4Ksa5HA==","x-goog-generation":"1725446508273548","accept-ranges":"bytes","x-goog-stored-content-length":"1044","content-length":"1044","server":"UploadServer","date":"Fri, 16 Jan 2026 09:04:01 GMT","cache-control":"public, max-age=31536000, immutable","last-modified":"Wed, 04 Sep 2024 10:41:48 GMT","etag":"\"243c373f1b78bf9cda22c8b82ac6b91c\"","expires":"Sat, 16 Jan 2027 09:04:01 GMT","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';","x-jsr-cache-status":"hit","age":"0","access-control-expose-headers":"*"},"url":"https://jsr.io/@std/yaml/1.0.5/_type.ts","time":1768554241}