// 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":"*","age":"3435801","cross-origin-resource-policy":"cross-origin","cache-control":"public, max-age=31536000, immutable","accept-ranges":"bytes","x-robots-tag":"noindex","date":"Tue, 06 Oct 2026 08:53:19 GMT","alt-svc":"h3=\":443\"; ma=86400","x-content-type-options":"nosniff","server":"cloudflare","cf-cache-status":"HIT","content-type":"text/typescript","set-cookie":"__cf_bm=kUgkjrEqi_TNTCjeaF4mkxdQVr0.Sbj1ZZB_m1mGd.g-1791276799.9639287-1.0.1.1-u19g66WIBGvMpO6c0t_6pfGhIgX3tNXQt3LuG3prueTQWxkfVNZ_i7WBUG6wJL7fhyBDNZ7.k3rwYob8ws1cYukTQzGLC8Mdg_rpsWCaj6v7IGMbfKDqCfbyt2ojJ1L2; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 06 Oct 2026 09:23:19 GMT","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","vary":"Origin","cf-ray":"a4636f5fa82fe5b8-IAD","content-length":"1044","etag":"\"243c373f1b78bf9cda22c8b82ac6b91c\"","x-jsr-backend":"modules","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=MiWQpYseOaTdCS%2BzHCpfu0rdnPRqhkhg%2FiPpE%2FBeeKUzBZAxIdbV4rW810Lv4vSxTxxXkN4CRDhDvLNCR1I%2FRoeJATdPXUKRC2zI%2FH%2FnzxrnpVdnnH1l3Qo%3D\"}]}","access-control-expose-headers":"*","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';"},"url":"https://jsr.io/@std/yaml/1.0.5/_type.ts","time":1791276799}