{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "latte helpers (class merge, variants, attributes) used by every template",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "{\n  \"name\": \"ui8kit/latte-kit\",\n  \"description\": \"UI8Kit Latte primitives and compositions (installed by the ui8kit CLI)\",\n  \"require\": {\n    \"php\": \">=8.2\",\n    \"latte/latte\": \"^3.0\"\n  },\n  \"autoload\": {\n    \"psr-4\": {\n      \"UI8Kit\\\\Latte\\\\\": \"runtime/\",\n      \"CodegenX\\\\Compose\\\\Latte\\\\\": \"compose/\",\n      \"CodegenX\\\\Organisms\\\\Latte\\\\\": \"organisms/\"\n    }\n  }\n}\n",
      "path": "composer.json",
      "target": "composer.json"
    },
    {
      "content": "<?php\n\n// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n\ndeclare(strict_types=1);\n\nnamespace CodegenX\\Organisms\\Latte;\n\n/**\n * cn: clsx-joined class fragments with tailwind-merge conflict resolution (the last class of a group wins, and a\n * class removes the earlier classes of the groups it overrides: p-2 removes px-4, not the reverse). Port of cn_merge.go.\n */\nfinal class CnMerge\n{\n    public static function merge(array $classes): string\n    {\n        $tokens = [];\n        foreach ($classes as $chunk) {\n            foreach (preg_split('/\\s+/', trim((string) $chunk)) ?: [] as $t) {\n                if ($t !== '') {\n                    $tokens[] = $t;\n                }\n            }\n        }\n        $kept = [];\n        foreach ($tokens as $token) {\n            [$prefix, $key, $removes] = self::classKey($token);\n            if ($key !== '') {\n                $drop = [$key => true];\n                foreach ($removes as $g) {\n                    $drop[$prefix . $g] = true;\n                }\n                $kept = array_values(array_filter($kept, fn ($it) => !isset($drop[$it[1]])));\n            }\n            $kept[] = [$token, $key];\n        }\n        return implode(' ', array_map(fn ($it) => $it[0], $kept));\n    }\n\n    private static function classKey(string $token): array\n    {\n        [$prefix, $core] = self::splitVariant($token);\n        if ($core === '') {\n            return ['', '', []];\n        }\n        $groups = self::utilityGroups($core);\n        if (!$groups) {\n            return [$prefix, '=' . $token, []];\n        }\n        return [$prefix, $prefix . $groups[0], array_slice($groups, 1)];\n    }\n\n    private static function splitVariant(string $token): array\n    {\n        $depth = 0;\n        $cut = -1;\n        $n = strlen($token);\n        for ($i = 0; $i < $n; $i++) {\n            $c = $token[$i];\n            if ($c === '[') {\n                $depth++;\n            } elseif ($c === ']') {\n                if ($depth > 0) {\n                    $depth--;\n                }\n            } elseif ($c === ':' && $depth === 0) {\n                $cut = $i;\n            }\n        }\n        if ($cut === -1) {\n            return ['', self::noBang($token)];\n        }\n        return [substr($token, 0, $cut + 1), self::noBang(substr($token, $cut + 1))];\n    }\n\n    private static function noBang(string $s): string\n    {\n        return str_starts_with($s, '!') ? substr($s, 1) : $s;\n    }\n\n    private static function utilityGroups(string $core): array\n    {\n        switch ($core) {\n            case 'block': case 'inline': case 'inline-block': case 'inline-flex': case 'flex': case 'grid': case 'contents': case 'hidden':\n                return ['display'];\n            case 'flex-row': case 'flex-col': case 'flex-row-reverse': case 'flex-col-reverse':\n                return ['flex-direction'];\n            case 'static': case 'relative': case 'absolute': case 'fixed': case 'sticky':\n                return ['position'];\n            case 'isolate': case 'isolation-auto':\n                return ['isolation'];\n        }\n        foreach (['inset-ring', 'ring'] as $kind) {\n            if ($core === $kind) {\n                return [$kind . '-width'];\n            }\n            if (str_starts_with($core, $kind . '-')) {\n                $rest = substr($core, strlen($kind) + 1);\n                return [self::isNumber($rest) ? $kind . '-width' : $kind . '-color'];\n            }\n        }\n        $prefixes = [\n            ['gap-x-', 'gap-x'], ['gap-y-', 'gap-y'], ['items-', 'align-items'], ['justify-', 'justify-content'],\n            ['self-', 'align-self'], ['content-', 'align-content'], ['overflow-x-', 'overflow-x'], ['overflow-y-', 'overflow-y'],\n            ['inset-x-', 'inset-x'], ['inset-y-', 'inset-y'], ['min-w-', 'min-width'], ['min-h-', 'min-height'],\n            ['max-w-', 'max-width'], ['max-h-', 'max-height'], ['shadow-', 'shadow'], ['ring-', 'ring'], ['rounded-', 'rounded'],\n            ['leading-', 'leading'], ['tracking-', 'tracking'], ['opacity-', 'opacity'], ['z-', 'z'], ['top-', 'top'],\n            ['right-', 'right'], ['bottom-', 'bottom'], ['left-', 'left'],\n        ];\n        foreach ($prefixes as [$p, $g]) {\n            if (str_starts_with($core, $p)) {\n                return [$g];\n            }\n        }\n        if (str_starts_with($core, 'gap-')) {\n            return ['gap', 'gap-x', 'gap-y'];\n        }\n        if (str_starts_with($core, 'inset-')) {\n            return ['inset', 'inset-x', 'inset-y', 'top', 'right', 'bottom', 'left'];\n        }\n        if (str_starts_with($core, 'overflow-')) {\n            return ['overflow', 'overflow-x', 'overflow-y'];\n        }\n        if ($core === 'border' || (str_starts_with($core, 'border-') && self::isNumber(substr($core, 7)))) {\n            return ['border-width', 'border-w-x', 'border-w-y', 'border-w-t', 'border-w-r', 'border-w-b', 'border-w-l', 'border-w-s', 'border-w-e'];\n        }\n        if (strlen($core) >= 8 && str_starts_with($core, 'border-') && str_contains('xytrblse', $core[7])\n            && (strlen($core) === 8 || ($core[8] === '-' && self::isNumber(substr($core, 9))))) {\n            $side = $core[7];\n            if ($side === 'x') {\n                return ['border-w-x', 'border-w-r', 'border-w-l', 'border-w-s', 'border-w-e'];\n            }\n            if ($side === 'y') {\n                return ['border-w-y', 'border-w-t', 'border-w-b'];\n            }\n            return ['border-w-' . $side];\n        }\n        if (in_array($core, ['text-left', 'text-center', 'text-right', 'text-justify', 'text-start', 'text-end'], true)) {\n            return ['text-align'];\n        }\n        if ($core === 'rounded') {\n            return ['rounded'];\n        }\n        if ($core === 'shadow' || $core === 'shadow-none') {\n            return ['shadow'];\n        }\n        if (in_array($core, ['flex-1', 'flex-auto', 'flex-none', 'flex-initial'], true)) {\n            return ['flex-size', 'flex-grow', 'flex-shrink', 'flex-basis'];\n        }\n        if ($core === 'grow' || str_starts_with($core, 'grow-')) {\n            return ['flex-grow'];\n        }\n        if ($core === 'shrink' || $core === 'shrink-0') {\n            return ['flex-shrink'];\n        }\n        if (str_starts_with($core, 'size-')) {\n            return ['size', 'width', 'height'];\n        }\n        if (str_starts_with($core, 'w-')) {\n            return ['width'];\n        }\n        if (str_starts_with($core, 'h-')) {\n            return ['height'];\n        }\n        foreach (['p' => 'padding', 'm' => 'margin'] as $kind => $name) {\n            if (str_starts_with($core, $kind . '-') && !self::hasDirectionPrefix($core, $kind)) {\n                return [$name, \"$name-x\", \"$name-y\", \"$name-t\", \"$name-r\", \"$name-b\", \"$name-l\", \"$name-s\", \"$name-e\"];\n            }\n            $axis = self::spaceAxis($core, $kind, $name);\n            if ($axis) {\n                return $axis;\n            }\n        }\n        if (str_starts_with($core, 'bg-')) {\n            return ['bg'];\n        }\n        if (self::isTextSize($core)) {\n            return ['text-size', 'leading'];\n        }\n        if (str_starts_with($core, 'text-')) {\n            return ['text-color'];\n        }\n        if (in_array($core, ['font-thin', 'font-extralight', 'font-light', 'font-normal', 'font-medium', 'font-semibold', 'font-bold', 'font-extrabold', 'font-black'], true)) {\n            return ['font-weight'];\n        }\n        return [];\n    }\n\n    private static function hasDirectionPrefix(string $core, string $kind): bool\n    {\n        foreach (['x-', 'y-', 't-', 'r-', 'b-', 'l-', 's-', 'e-'] as $d) {\n            if (str_starts_with($core, $kind . $d)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private static function spaceAxis(string $core, string $kind, string $n): array\n    {\n        if (str_starts_with($core, $kind . 'x-')) {\n            return [\"$n-x\", \"$n-r\", \"$n-l\", \"$n-s\", \"$n-e\"];\n        }\n        if (str_starts_with($core, $kind . 'y-')) {\n            return [\"$n-y\", \"$n-t\", \"$n-b\"];\n        }\n        foreach (['t', 'r', 'b', 'l'] as $s) {\n            if (str_starts_with($core, $kind . $s . '-')) {\n                return [\"$n-$s\"];\n            }\n        }\n        return [];\n    }\n\n    private static function isTextSize(string $core): bool\n    {\n        if (in_array($core, ['text-xs', 'text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl', 'text-3xl', 'text-4xl', 'text-5xl', 'text-6xl', 'text-7xl', 'text-8xl', 'text-9xl'], true)) {\n            return true;\n        }\n        if (str_starts_with($core, 'text-[')) {\n            $rest = substr($core, 6);\n            return $rest !== '' && (ctype_digit($rest[0]) || $rest[0] === '.');\n        }\n        return false;\n    }\n\n    private static function isNumber(string $s): bool\n    {\n        if (str_starts_with($s, '[')) {\n            return true;\n        }\n        return $s !== '' && strspn($s, '0123456789.') === strlen($s);\n    }\n}\n",
      "path": "organisms/CnMerge.php",
      "target": "organisms/CnMerge.php"
    },
    {
      "content": "<?php\n\n// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n\ndeclare(strict_types=1);\n\nnamespace CodegenX\\Organisms\\Latte;\n\nuse Latte\\Engine;\nuse Latte\\Loaders\\FileLoader;\nuse Latte\\Runtime\\Html;\n\n/**\n * The og_* functions (organism templates) of the generated templates. engine() makes a Latte Engine over the package folder (templates are\n * rendered as ui/<brick>/<part>.latte and blocks/<organism>.latte) with the functions registered. og_include renders\n * another template with only the given variables and returns its markup.\n */\nfinal class OrganismExtension extends \\Latte\\Extension\n{\n    private Runtime $rt;\n\n    public function __construct(string $root, private readonly Engine $engine)\n    {\n        $this->rt = new Runtime($root);\n    }\n\n    /** an Engine over the package folder with the extension added; templates compile to $tempDir when given, else in memory */\n    public static function engine(string $root, ?string $tempDir = null): Engine\n    {\n        $latte = new Engine();\n        $latte->setLoader(new FileLoader($root));\n        $latte->setTempDirectory($tempDir);\n        $latte->addExtension(new self($root, $latte));\n        return $latte;\n    }\n\n    public function getFunctions(): array\n    {\n        $static = [\n            'get', 'field', 's', 'text', 'html', 't', 'n', 'i', 'eq', 'lt', 'gt', 'le', 'ge', 'add', 'sub', 'mul', 'div', 'and', 'or',\n            'coalesce', 'def', 'l', 'len', 'spread', 'str', 'has', 'cnv', 'tpl', 'num', 'money', 'at', 'page_window',\n            'fit_cols', 'uniq', 'words', 'nbsp', 'nth', 'range', 'max', 'min', 'round', 'count', 'where', 'match', 'pick',\n            'sum_by', 'first_of', 'max_by', 'css', 'attrs', 'is_set_str', 'default_if_empty', 'map_or', 'int_map_or',\n            'bool_str', 'concat_trim', 'cn', 'resolve_tag', 'title_tag', 'url', 'srcset', 'style', 'slot', 'markup',\n        ];\n        $fns = [];\n        foreach ($static as $name) {\n            $fns['og_' . $name] = [Runtime::class, lcfirst(str_replace('_', '', ucwords($name, '_')))];\n        }\n        $fns['og_attr_html'] = fn (mixed $a): Html => new Html(Runtime::attrHtml($a));\n        $fns['og_compose'] = [$this->rt, 'compose'];\n        $fns['og_recipe'] = [$this->rt, 'recipe'];\n        $fns['og_preset'] = [$this->rt, 'preset'];\n        $fns['og_lucide'] = fn (mixed $name): Html => new Html($this->rt->lucide($name));\n        $fns['og_include'] = fn (string $template, array $vars = []): Html => new Html($this->engine->renderToString($template, $vars));\n        return $fns;\n    }\n}\n",
      "path": "organisms/OrganismExtension.php",
      "target": "organisms/OrganismExtension.php"
    },
    {
      "content": "<?php\n\n// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n\ndeclare(strict_types=1);\n\nnamespace CodegenX\\Organisms\\Latte;\n\n/**\n * The helpers of the generated templates. Values are the JSON shapes of the TypeScript props (string, int/float,\n * bool, null, list, map) and are read with the rules of the TypeScript output: JS truthiness, strict equality,\n * String(), clsx + tailwind-merge. Every helper is null-safe, like `?.`. Port of the Go runtime (dyn.go, expr.go,\n * utils.go) so all static runtimes print the same DOM.\n */\nfinal class Runtime\n{\n    /** @var array<string, mixed> parsed JSON files (recipes, presets, the Lucide registry) */\n    private array $json = [];\n\n    public function __construct(private readonly string $root)\n    {\n    }\n\n    public function json(string $path): mixed\n    {\n        if (!array_key_exists($path, $this->json)) {\n            $text = file_get_contents($this->root . '/' . $path);\n            if ($text === false) {\n                throw new \\RuntimeException(\"ui8kit: cannot read $path\");\n            }\n            $this->json[$path] = json_decode($text, true, 512, JSON_THROW_ON_ERROR);\n        }\n        return $this->json[$path];\n    }\n\n    // ---------------------------------------------------------------- values\n\n    private static function isNum(mixed $v): bool\n    {\n        return is_int($v) || is_float($v);\n    }\n\n    /** a path of fields: get(plan, ['price', 'amount']); `length` of a list or a text is its size */\n    public static function get(mixed $v, array $path): mixed\n    {\n        foreach ($path as $k) {\n            $k = (string) $k;\n            if (is_array($v)) {\n                if (array_is_list($v) && ($k === 'length' || ctype_digit($k))) {\n                    if ($k === 'length') {\n                        $v = count($v);\n                    } else {\n                        $v = $v[(int) $k] ?? null;\n                    }\n                } else {\n                    $v = $v[$k] ?? null;\n                }\n            } elseif (is_string($v) && $k === 'length') {\n                $v = mb_strlen($v);\n            } else {\n                return null;\n            }\n        }\n        return $v;\n    }\n\n    /** a field of a brick record (BreadcrumbItem): the JSON key matched without regard to case, as Go json does */\n    public static function field(mixed $item, string $name, mixed $zero): mixed\n    {\n        if (!is_array($item)) {\n            return $zero;\n        }\n        if (array_key_exists($name, $item)) {\n            return $item[$name] ?? $zero;\n        }\n        foreach ($item as $k => $v) {\n            if (strcasecmp((string) $k, $name) === 0) {\n                return $v ?? $zero;\n            }\n        }\n        return $zero;\n    }\n\n    /** String(n) of JavaScript for the numbers the views print: 3, 2.5, -1 */\n    public static function fmtNum(int|float $f): string\n    {\n        if (is_int($f)) {\n            return (string) $f;\n        }\n        if (is_nan($f)) {\n            return 'NaN';\n        }\n        if (is_infinite($f)) {\n            return $f > 0 ? 'Infinity' : '-Infinity';\n        }\n        if ($f == floor($f) && abs($f) < 1e21) {\n            return sprintf('%.0f', $f);\n        }\n        return json_encode($f);\n    }\n\n    public static function s(mixed $v): string\n    {\n        if ($v === null) {\n            return '';\n        }\n        if (is_string($v)) {\n            return $v;\n        }\n        if (is_bool($v)) {\n            return $v ? 'true' : 'false';\n        }\n        if (self::isNum($v)) {\n            return self::fmtNum($v);\n        }\n        if ($v instanceof \\Stringable) {\n            return (string) $v;\n        }\n        return json_encode($v, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);\n    }\n\n    /** what a text node shows: nothing for null and booleans */\n    public static function text(mixed $v): string\n    {\n        return is_bool($v) ? '' : self::s($v);\n    }\n\n    /**\n     * the markup an html node prints (printed with |raw, |noescape): the trusted markup ({\"__html\": \"...\"}, a TrustedHtml prop) as it\n     * is; any other value is text, escaped (& < > \" ' as entities, like htmlOf of the TypeScript runtimes)\n     */\n    public static function html(mixed $v): string\n    {\n        if (is_array($v) && isset($v['__html']) && is_string($v['__html'])) {\n            return $v['__html'];\n        }\n        return strtr(self::text($v), ['&' => '&amp;', '<' => '&lt;', '>' => '&gt;', '\"' => '&quot;', \"'\" => '&#39;']);\n    }\n\n    /**\n     * a slot prop printed in place (|raw, |noescape): the markup the calling template captured ({\"__html\": \"...\"}, made by\n     * markup()) as it is; any other value (a plain string from a caller) is text, escaped, so a sub-template called directly\n     * with a string prints no markup of it\n     */\n    public static function slot(mixed $v): string\n    {\n        return self::html($v);\n    }\n\n    /** captured markup (a fill of a slot) as a TrustedHtml marker, which slot() prints as it is */\n    public static function markup(mixed $v): array\n    {\n        return ['__html' => $v === null ? '' : (string) $v];\n    }\n\n    // ---------------------------------------------------------------- output safety (assets/ts/safe.ts, test/safety-vectors.json)\n\n    /** the named character references the URL check decodes */\n    public const NAMED_ENTITIES = [\n        'Tab' => \"\\t\", 'NewLine' => \"\\n\", 'colon' => ':', 'sol' => '/', 'bsol' => '\\\\', 'lpar' => '(', 'rpar' => ')', 'amp' => '&',\n        'lt' => '<', 'gt' => '>', 'quot' => '\"', 'apos' => \"'\", 'nbsp' => \"\\u{00a0}\", 'period' => '.', 'comma' => ',', 'excl' => '!',\n        'num' => '#', 'quest' => '?', 'equals' => '=', 'plus' => '+', 'semi' => ';', 'percnt' => '%', 'lowbar' => '_', 'ast' => '*',\n        'commat' => '@', 'dollar' => '$', 'Hat' => '^', 'grave' => '`', 'lsqb' => '[', 'rsqb' => ']', 'lcub' => '{', 'rcub' => '}',\n        'verbar' => '|', 'vert' => '|',\n    ];\n    public const URL_SCHEMES = ['http', 'https', 'mailto', 'tel'];\n    public const URL_ATTRS = ['href', 'src', 'action', 'formaction', 'poster', 'cite', 'background', 'data', 'xlink:href'];\n    public const IMAGE_ATTRS = ['src', 'poster', 'background'];\n\n    private static function fromCode(int|float $n): string\n    {\n        return $n > 0 && $n <= 0x10FFFF && !($n >= 0xD800 && $n <= 0xDFFF) ? (string) mb_chr((int) $n, 'UTF-8') : \"\\u{FFFD}\";\n    }\n\n    /** character references decoded as a browser would (numeric with or without ;, the named ones of NAMED_ENTITIES), up to 3 rounds */\n    public static function decodeEntities(string $s): string\n    {\n        for ($i = 0; $i < 3 && str_contains($s, '&'); $i++) {\n            $s = (string) preg_replace_callback('/&(?:#[xX]([0-9a-fA-F]{1,8});?|#([0-9]{1,10});?|([a-zA-Z][a-zA-Z0-9]{0,31});)/u', static function (array $m): string {\n                if (($m[1] ?? '') !== '') {\n                    return self::fromCode(hexdec($m[1]));\n                }\n                if (($m[2] ?? '') !== '') {\n                    return self::fromCode((float) $m[2]);\n                }\n                return self::NAMED_ENTITIES[$m[3] ?? ''] ?? $m[0];\n            }, $s);\n        }\n        return $s;\n    }\n\n    private static function compact(string $s): string\n    {\n        return (string) preg_replace('/[\\x00-\\x20\\x7F]+/u', '', self::decodeEntities($s));\n    }\n\n    /** true when the URL is allowed: no scheme and not //host, or http(s), mailto, tel; an image also data:image/* */\n    public static function isSafeUrl(string $v, bool $image = false): bool\n    {\n        $k = self::compact($v);\n        if (preg_match('#^[/\\\\\\\\]{2}#', $k) === 1) {\n            return false;\n        }\n        if (preg_match('/^([a-zA-Z][a-zA-Z0-9+.\\-]*):/', $k, $m) !== 1) {\n            // no scheme: a path, unless a ':' comes before any '/' (as written or decoded), as templ.URL\n            return preg_match('#^[^/]*:#', $k) !== 1 && preg_match('#^[^/]*:#', $v) !== 1;\n        }\n        $scheme = strtolower($m[1]);\n        if ($scheme === 'data') {\n            return $image && preg_match('#^data:image/(png|jpeg|gif|webp|avif|svg\\+xml)[;,]#', strtolower($k)) === 1;\n        }\n        return in_array($scheme, self::URL_SCHEMES, true);\n    }\n\n    private static function safeStr(mixed $v): string\n    {\n        return is_string($v) ? $v : (self::isNum($v) ? self::fmtNum($v) : '');\n    }\n\n    /** a URL attribute value: the value when allowed, else '' */\n    public static function url(mixed $v, bool $image = false): string\n    {\n        $s = self::safeStr($v);\n        return self::isSafeUrl($s, $image) ? $s : '';\n    }\n\n    /** the URLs of a srcset, candidate by candidate */\n    public static function srcsetUrls(string $v): array\n    {\n        $s = self::decodeEntities($v);\n        $out = [];\n        $n = strlen($s);\n        $i = 0;\n        $ws = static fn (string $c): bool => $c === \"\\t\" || $c === \"\\n\" || $c === \"\\f\" || $c === \"\\r\" || $c === ' ';\n        while ($i < $n) {\n            while ($i < $n && ($ws($s[$i]) || $s[$i] === ',')) {\n                $i++;\n            }\n            if ($i >= $n) {\n                break;\n            }\n            $j = $i;\n            while ($j < $n && !$ws($s[$j])) {\n                $j++;\n            }\n            $url = substr($s, $i, $j - $i);\n            if (preg_match('/,+$/', $url, $cut) === 1) {\n                $out[] = substr($url, 0, -strlen($cut[0]));\n                $i = $j;\n                continue;\n            }\n            $out[] = $url;\n            $depth = 0;\n            while ($j < $n && ($depth > 0 || $s[$j] !== ',')) {\n                if ($s[$j] === '(') {\n                    $depth++;\n                } elseif ($s[$j] === ')') {\n                    $depth = max(0, $depth - 1);\n                }\n                $j++;\n            }\n            $i = $j + 1;\n        }\n        return $out;\n    }\n\n    /** a srcset value: the value when every candidate is an allowed image URL, else '' */\n    public static function srcset(mixed $v): string\n    {\n        $s = self::safeStr($v);\n        foreach (self::srcsetUrls($s) as $u) {\n            if (!self::isSafeUrl($u, true)) {\n                return '';\n            }\n        }\n        return $s;\n    }\n\n    /** a style value: '' when a url(...) is not an image URL or it holds a script form or a CSS escape, else the value */\n    public static function style(mixed $v): string\n    {\n        $s = self::safeStr($v);\n        $d = self::decodeEntities($s);\n        $k = strtolower(self::compact($s));\n        if (str_contains($d, '\\\\') || preg_match('/expression\\(|javascript:|vbscript:|-moz-binding|behavior:/', $k) === 1) {\n            return '';\n        }\n        preg_match_all('/url\\(([^)]*)\\)?/i', $d, $all);\n        foreach ($all[1] as $arg) {\n            $u = (string) preg_replace('/^([\"\\'])(.*)\\1$/s', '$2', trim($arg, \" \\t\\n\\r\\f\\v\"));\n            if (!self::isSafeUrl($u, true)) {\n                return '';\n            }\n        }\n        return $s;\n    }\n\n    /** a value of an inline style declaration (the css op): kept when plain (numbers, words, %, #, +, -, ., commas, spaces), else '' */\n    public static function cssValue(mixed $v): string\n    {\n        $s = self::safeStr($v);\n        return preg_match('/^[-+.%#a-zA-Z0-9 ,]*$/', $s) === 1 ? $s : '';\n    }\n\n    /** an attribute name that may be printed: a valid name, not an event handler (on*) */\n    public static function isSafeAttrName(string $name): bool\n    {\n        return preg_match('/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/', $name) === 1 && preg_match('/^on/i', $name) !== 1;\n    }\n\n    /** the value of attribute $name as it may be printed: URL, srcset and style checked */\n    public static function attrValue(string $name, mixed $v): mixed\n    {\n        $n = strtolower($name);\n        if ($n === 'srcset' || $n === 'imagesrcset') {\n            return self::srcset($v);\n        }\n        if ($n === 'style') {\n            return self::style($v);\n        }\n        if (in_array($n, self::URL_ATTRS, true)) {\n            return self::url($v, in_array($n, self::IMAGE_ATTRS, true));\n        }\n        return $v;\n    }\n\n    /** JS truthiness: null, false, 0, NaN and '' are false */\n    public static function t(mixed $v): bool\n    {\n        if ($v === null) {\n            return false;\n        }\n        if (is_bool($v)) {\n            return $v;\n        }\n        if (is_string($v)) {\n            return $v !== '';\n        }\n        if (self::isNum($v)) {\n            return $v != 0 && !is_nan((float) $v);\n        }\n        if ($v instanceof \\Stringable) {\n            return (string) $v !== '';\n        }\n        return true;\n    }\n\n    /** Number(v) */\n    public static function n(mixed $v): float\n    {\n        if (self::isNum($v)) {\n            return (float) $v;\n        }\n        if (is_string($v) && is_numeric(trim($v))) {\n            return (float) trim($v);\n        }\n        if (is_bool($v)) {\n            return $v ? 1.0 : 0.0;\n        }\n        return 0.0;\n    }\n\n    /** an int for an int prop of a brick */\n    public static function i(mixed $v): int\n    {\n        return (int) round(self::n($v));\n    }\n\n    /** strict equality (===) */\n    public static function eq(mixed $a, mixed $b): bool\n    {\n        $na = self::isNum($a);\n        $nb = self::isNum($b);\n        if ($na || $nb) {\n            return $na && $nb && (float) $a == (float) $b;\n        }\n        if ($a === null || is_string($a) || is_bool($a)) {\n            return $a === $b;\n        }\n        return false;\n    }\n\n    private static function cmp(mixed $a, mixed $b): ?int\n    {\n        if (is_string($a) && is_string($b)) {\n            return strcmp($a, $b) <=> 0;\n        }\n        if ($a === null || $b === null) {\n            return null;\n        }\n        return self::n($a) <=> self::n($b);\n    }\n\n    public static function lt(mixed $a, mixed $b): bool { $c = self::cmp($a, $b); return $c !== null && $c < 0; }\n    public static function gt(mixed $a, mixed $b): bool { $c = self::cmp($a, $b); return $c !== null && $c > 0; }\n    public static function le(mixed $a, mixed $b): bool { $c = self::cmp($a, $b); return $c !== null && $c <= 0; }\n    public static function ge(mixed $a, mixed $b): bool { $c = self::cmp($a, $b); return $c !== null && $c >= 0; }\n\n    /** `a + b`: text when either side is text, else a sum */\n    public static function add(mixed $a, mixed $b): string|float\n    {\n        if (is_string($a) || is_string($b)) {\n            return self::s($a) . self::s($b);\n        }\n        return self::n($a) + self::n($b);\n    }\n    public static function sub(mixed $a, mixed $b): float { return self::n($a) - self::n($b); }\n    public static function mul(mixed $a, mixed $b): float { return self::n($a) * self::n($b); }\n    public static function div(mixed $a, mixed $b): float { return fdiv(self::n($a), self::n($b)); }\n\n    /** the first falsy operand, else the last (JS &&) */\n    public static function and(array $vs): mixed\n    {\n        $last = null;\n        foreach ($vs as $v) {\n            if (!self::t($v)) {\n                return $v;\n            }\n            $last = $v;\n        }\n        return $last;\n    }\n\n    /** the first truthy operand, else the last (JS ||) */\n    public static function or(array $vs): mixed\n    {\n        $last = null;\n        foreach ($vs as $v) {\n            if (self::t($v)) {\n                return $v;\n            }\n            $last = $v;\n        }\n        return $last;\n    }\n\n    public static function coalesce(array $vs): mixed\n    {\n        foreach ($vs as $v) {\n            if ($v !== null) {\n                return $v;\n            }\n        }\n        return null;\n    }\n\n    /** a prop with its default: the default when the prop is null */\n    public static function def(mixed $v, mixed $d): mixed\n    {\n        return $v ?? $d;\n    }\n\n    /** a list to loop over; null and other values are empty */\n    public static function l(mixed $v): array\n    {\n        return is_array($v) && array_is_list($v) ? $v : [];\n    }\n\n    public static function len(mixed $v): int\n    {\n        if (is_string($v)) {\n            return mb_strlen($v);\n        }\n        return count(self::l($v));\n    }\n\n    /** a literal group with the fields of a named group first (`{ ...BASE, mode: \"two\" }`) */\n    public static function spread(mixed $base, array $fields): array\n    {\n        $out = is_array($base) && !array_is_list($base) ? $base : [];\n        foreach ($fields as $k => $v) {\n            $out[$k] = $v;\n        }\n        return $out;\n    }\n\n    /** String(x) with undefined kept undefined */\n    public static function str(mixed $v): ?string\n    {\n        return $v === null ? null : self::s($v);\n    }\n\n    public static function has(mixed $v): bool\n    {\n        return $v !== null;\n    }\n\n    /** cn over values: clsx skips the falsy ones, tailwind-merge resolves conflicts */\n    public static function cnv(array $vs): string\n    {\n        $parts = [];\n        foreach ($vs as $v) {\n            if (self::t($v)) {\n                $parts[] = self::s($v);\n            }\n        }\n        return CnMerge::merge($parts);\n    }\n\n    /** {0}, {1}... of a content template */\n    public static function tpl(mixed $t, array $vals): string\n    {\n        return preg_replace_callback('/\\{(\\d+)\\}/', fn ($m) => (int) $m[1] < count($vals) ? self::s($vals[(int) $m[1]]) : '', self::s($t));\n    }\n\n    private static function group(float $f, int $decimals): string\n    {\n        $s = number_format(abs($f), $decimals, '.', '');\n        [$int, $frac] = array_pad(explode('.', $s, 2), 2, '');\n        $out = '';\n        $n = strlen($int);\n        for ($i = 0; $i < $n; $i++) {\n            if ($i > 0 && ($n - $i) % 3 === 0) {\n                $out .= ',';\n            }\n            $out .= $int[$i];\n        }\n        $frac = rtrim($frac, '0');\n        if ($frac !== '') {\n            $out .= '.' . $frac;\n        }\n        if ($f < 0 && $out !== '0') {\n            $out = '-' . $out;\n        }\n        return $out;\n    }\n\n    /** Intl.NumberFormat(\"en-US\"): grouped, up to 3 decimals */\n    public static function num(mixed $v): string\n    {\n        return self::group(self::n($v), 3);\n    }\n\n    private const CURRENCY = ['USD' => '$', 'EUR' => \"\\u{20AC}\", 'GBP' => \"\\u{00A3}\", 'JPY' => \"\\u{00A5}\", 'INR' => \"\\u{20B9}\", 'CAD' => 'CA$', 'AUD' => 'A$'];\n\n    /** digits of the minor unit (ISO 4217): 2, or 0 for JPY and KRW */\n    public static function minorDigits(string $c): int\n    {\n        return in_array($c, ['JPY', 'KRW'], true) ? 0 : 2;\n    }\n\n    /** integer minor units (Codex v0.4: 1250 = 12.50) -> \"$12.50\"; whole amounts without the fraction: 149900 -> \"$1,499\" */\n    public static function money(mixed $amount, mixed $currency): string\n    {\n        $c = self::s($currency);\n        $sym = self::CURRENCY[$c] ?? $c . \"\\u{00A0}\";\n        $minor = (int) round(self::n($amount));\n        $sign = $minor < 0 ? '-' : '';\n        $minor = abs($minor);\n        $d = self::minorDigits($c);\n        $unit = 10 ** $d;\n        $whole = intdiv($minor, $unit);\n        $rest = $minor % $unit;\n        $out = $sign . $sym . self::group((float) $whole, 0);\n        return $d > 0 && $rest !== 0 ? $out . '.' . str_pad((string) $rest, $d, '0', STR_PAD_LEFT) : $out;\n    }\n\n    /** a content word by key, the key itself when the dictionary has no entry */\n    public static function at(mixed $dict, mixed $key): string\n    {\n        $v = self::get($dict, [self::s($key)]);\n        return $v !== null ? self::s($v) : self::s($key);\n    }\n\n    /** the pages a pager shows: the first, the last and the neighbours of the current one; null is a gap */\n    public static function pageWindow(mixed $pageV, mixed $pagesV): array\n    {\n        $page = (int) self::n($pageV);\n        $pages = (int) self::n($pagesV);\n        $keep = [];\n        foreach ([1, $pages, $page - 1, $page, $page + 1] as $n) {\n            if ($n >= 1 && $n <= $pages) {\n                $keep[$n] = true;\n            }\n        }\n        $out = [];\n        $prev = 0;\n        for ($n = 1; $n <= $pages; $n++) {\n            if (!isset($keep[$n])) {\n                continue;\n            }\n            if ($n - $prev > 1) {\n                $out[] = null;\n            }\n            $out[] = $n;\n            $prev = $n;\n        }\n        return $out;\n    }\n\n    /** a responsive column variant capped by the number of items: (\"1-4\", 3) -> \"1-3\" */\n    public static function fitCols(mixed $colsV, mixed $nV): string\n    {\n        $cols = self::s($colsV);\n        $n = (int) self::n($nV);\n        if (!preg_match('/^(-?\\d+)-(-?\\d+)$/', $cols, $m)) {\n            return $cols;\n        }\n        [$l, $h] = [(int) $m[1], (int) $m[2]];\n        if ($n >= $h) {\n            return $cols;\n        }\n        $top = max($l, $n);\n        $known = ['1-2', '1-3', '1-4', '2-3', '2-4', '2-6', '3-6'];\n        for ($k = $top; $k > $l; $k--) {\n            if (in_array(\"$l-$k\", $known, true)) {\n                return \"$l-$k\";\n            }\n        }\n        return (string) min(max($n, 1), $l);\n    }\n\n    /** drops a segment of a \", \" label equal (case-insensitive) to the one before it */\n    public static function uniq(mixed $v): string\n    {\n        $parts = explode(', ', self::s($v));\n        $out = [];\n        foreach ($parts as $i => $s) {\n            if ($i === 0 || strcasecmp($s, $parts[$i - 1]) !== 0) {\n                $out[] = $s;\n            }\n        }\n        return implode(', ', $out);\n    }\n\n    public static function words(mixed $v): array\n    {\n        return explode(' ', self::s($v));\n    }\n\n    public static function nbsp(mixed $v): string\n    {\n        return str_replace(' ', \"\\u{00A0}\", self::s($v));\n    }\n\n    public static function nth(mixed $list, mixed $i): mixed\n    {\n        $l = self::l($list);\n        $n = (int) self::n($i);\n        return $n >= 0 && $n < count($l) ? $l[$n] : null;\n    }\n\n    public static function range(mixed $n): array\n    {\n        $c = (int) self::n($n);\n        return $c > 0 ? range(0, $c - 1) : [];\n    }\n\n    public static function max(array $vs): float\n    {\n        $m = -INF;\n        foreach ($vs as $v) {\n            $m = max($m, self::n($v));\n        }\n        return $m;\n    }\n\n    public static function min(array $vs): float\n    {\n        $m = INF;\n        foreach ($vs as $v) {\n            $m = min($m, self::n($v));\n        }\n        return $m;\n    }\n\n    /** Math.round (halves up) */\n    public static function round(mixed $v): float\n    {\n        return floor(self::n($v) + 0.5);\n    }\n\n    public static function count(mixed $items, mixed $field): int\n    {\n        $n = 0;\n        foreach (self::l($items) as $it) {\n            if (self::t(self::get($it, [self::s($field)]))) {\n                $n++;\n            }\n        }\n        return $n;\n    }\n\n    public static function where(mixed $items, mixed $field, mixed $value): array\n    {\n        if (!self::t($value)) {\n            return self::l($items);\n        }\n        return array_values(array_filter(self::l($items), fn ($it) => self::eq(self::get($it, [self::s($field)]), $value)));\n    }\n\n    public static function match(mixed $items, mixed $field, mixed $query): array\n    {\n        if (!self::t($query)) {\n            return self::l($items);\n        }\n        $q = mb_strtolower(self::s($query));\n        return array_values(array_filter(self::l($items), fn ($it) => str_contains(mb_strtolower(self::s(self::get($it, [self::s($field)]))), $q)));\n    }\n\n    public static function pick(mixed $items, mixed $id): mixed\n    {\n        foreach (self::l($items) as $it) {\n            if (self::eq(self::get($it, ['id']), $id)) {\n                return $it;\n            }\n        }\n        return null;\n    }\n\n    public static function sumBy(mixed $items, string $a, string $b): float\n    {\n        $s = 0.0;\n        foreach (self::l($items) as $it) {\n            $s += self::n(self::get($it, [$a])) * self::n(self::get($it, [$b]));\n        }\n        return $s;\n    }\n\n    public static function firstOf(mixed $items, string $field): mixed\n    {\n        $l = self::l($items);\n        return $l ? (self::get($l[0], [$field]) ?? '') : '';\n    }\n\n    public static function maxBy(mixed $items, string $field): float\n    {\n        $m = 0.0;\n        foreach (self::l($items) as $it) {\n            $m = max($m, self::n(self::get($it, [$field])));\n        }\n        return $m;\n    }\n\n    /** an inline style from (property, value, unit) triples */\n    public static function css(array $triples): string\n    {\n        $parts = [];\n        for ($i = 0; $i + 2 < count($triples); $i += 3) {\n            $parts[] = self::s($triples[$i]) . ':' . self::cssValue($triples[$i + 1]) . self::s($triples[$i + 2]);\n        }\n        return implode(';', $parts);\n    }\n\n    /** the class string of a recipe table for a selection (organisms: base, each key, the matching compounds) */\n    public function recipe(string $path, array $sel): string\n    {\n        $r = $this->json($path);\n        $pick = function (string $k) use ($r, $sel): string {\n            $v = trim(self::s($sel[$k] ?? null));\n            return $v !== '' ? $v : trim((string) ($r['defaults'][$k] ?? ''));\n        };\n        $parts = [(string) ($r['base'] ?? '')];\n        foreach ($r['keys'] ?? [] as $k) {\n            $parts[] = (string) ($r['byKey'][$k][$pick($k)] ?? '');\n        }\n        foreach ($r['compound'] ?? [] as $c) {\n            if (self::compoundHits($c, $pick)) {\n                $parts[] = (string) ($c['class'] ?? '');\n            }\n        }\n        return CnMerge::merge(array_filter(array_map('trim', $parts), fn ($p) => $p !== ''));\n    }\n\n    private static function compoundHits(array $c, callable $pick): bool\n    {\n        foreach ($c as $k => $want) {\n            if ($k === 'class') {\n                continue;\n            }\n            if (!in_array($pick((string) $k), explode('|', (string) $want), true)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /** a preset value of the kit */\n    public function preset(string $path, array $keys): mixed\n    {\n        return self::get(self::get($this->json($path), ['values']), $keys);\n    }\n\n    /** free DOM attributes from (name, value) pairs, as React prints them */\n    public static function attrs(array $kv): array\n    {\n        $out = [];\n        for ($i = 0; $i + 1 < count($kv); $i += 2) {\n            $k = self::s($kv[$i]);\n            $v = $kv[$i + 1];\n            if ($v === null || !self::isSafeAttrName($k)) {\n                continue;\n            }\n            if (!is_bool($v)) {\n                $v = self::attrValue($k, $v);\n            }\n            if (is_bool($v)) {\n                if (str_starts_with($k, 'data-') || str_starts_with($k, 'aria-')) {\n                    $out[$k] = self::s($v);\n                } elseif ($v) {\n                    $out[$k] = true;\n                }\n                continue;\n            }\n            $out[$k] = self::s($v);\n        }\n        return $out;\n    }\n\n    /** an attribute map as markup (` name=\"value\"`, a bare name for true, nothing for null and false) */\n    public static function attrHtml(mixed $attrs): string\n    {\n        if (!is_array($attrs)) {\n            return '';\n        }\n        $out = '';\n        foreach ($attrs as $k => $v) {\n            if ($v === null || $v === false || !self::isSafeAttrName((string) $k)) {\n                continue;\n            }\n            $name = (string) $k;\n            $out .= $v === true ? \" $name\" : \" $name=\\\"\" . htmlspecialchars(self::s(self::attrValue($name, $v)), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . '\"';\n        }\n        return $out;\n    }\n\n    // ---------------------------------------------------------------- bricks (expr.go, utils.go, tags.go)\n\n    public static function isSetStr(mixed $v): bool\n    {\n        return trim(self::s($v)) !== '';\n    }\n\n    public static function defaultIfEmpty(mixed $v, string $fallback): string\n    {\n        $t = trim(self::s($v));\n        return $t === '' ? $fallback : $t;\n    }\n\n    /** a decision table over a trimmed text: mapping[trim(v)] or the fallback */\n    public static function mapOr(mixed $v, array $mapping, string $fallback, bool $lower = false): string\n    {\n        $t = trim(self::s($v));\n        if ($lower) {\n            $t = strtolower($t);\n        }\n        return array_key_exists($t, $mapping) ? (string) $mapping[$t] : $fallback;\n    }\n\n    public static function intMapOr(mixed $v, array $mapping, string $fallback): string\n    {\n        $n = self::i($v);\n        return array_key_exists($n, $mapping) ? (string) $mapping[$n] : $fallback;\n    }\n\n    public static function boolStr(mixed $v): string\n    {\n        return self::t($v) ? 'true' : 'false';\n    }\n\n    public static function concatTrim(array $parts): string\n    {\n        return implode('', array_map(fn ($p) => trim(self::s($p)), $parts));\n    }\n\n    /** class fragments merged with tailwind-merge (strings only, empty ones skipped) */\n    public static function cn(array $parts): string\n    {\n        return CnMerge::merge(array_map(fn ($p) => self::s($p), $parts));\n    }\n\n    /** the brick class contract: recipe base, the selected variants (defaults for empty), compounds, then the tail */\n    public function compose(string $path, array $selection, array $extra): string\n    {\n        $r = $this->json($path);\n        $parts = [];\n        if (trim((string) ($r['base'] ?? '')) !== '') {\n            $parts[] = trim((string) $r['base']);\n        }\n        $pick = function (string $k) use ($r, $selection): string {\n            $c = trim(self::s($selection[$k] ?? null));\n            return $c !== '' ? $c : trim((string) ($r['defaults'][$k] ?? ''));\n        };\n        foreach ($r['keys'] ?? [] as $key) {\n            $choices = $r['byKey'][$key] ?? null;\n            if ($choices === null) {\n                continue;\n            }\n            $choice = $pick($key);\n            if ($choice === '') {\n                if ($choices) {\n                    throw new \\RuntimeException(\"[compose] missing default for key $key\");\n                }\n                continue;\n            }\n            if (isset($choices[$choice]) && trim((string) $choices[$choice]) !== '') {\n                $parts[] = (string) $choices[$choice];\n            }\n        }\n        foreach ($r['compound'] ?? [] as $c) {\n            if (self::compoundHits($c, $pick) && trim((string) ($c['class'] ?? '')) !== '') {\n                $parts[] = (string) $c['class'];\n            }\n        }\n        return self::cn([...$parts, ...$extra]);\n    }\n\n    /** the tag of a primitive: the requested one when the allow-list has it, else the fallback */\n    public static function resolveTag(mixed $tag, string $fallback, array $allowed): string\n    {\n        $t = strtolower(trim(self::s($tag)));\n        return $t !== '' && in_array($t, $allowed, true) ? $t : $fallback;\n    }\n\n    /** h1-h6 from a level, h2 by default */\n    public static function titleTag(mixed $level): string\n    {\n        $n = self::i($level);\n        return $n >= 1 && $n <= 6 ? \"h$n\" : 'h2';\n    }\n\n    /** the inner markup of a Lucide glyph: its nodes with attributes in name order (circle for an unknown name) */\n    public function lucide(mixed $name): string\n    {\n        $icons = $this->json('icons/lucide-icons.json')['icons'];\n        $nodes = $icons[self::s($name)] ?? $icons['circle'];\n        $out = '';\n        foreach ($nodes as [$tag, $attrs]) {\n            ksort($attrs, SORT_STRING);\n            $out .= '<' . $tag;\n            foreach ($attrs as $k => $v) {\n                $out .= ' ' . $k . '=\"' . htmlspecialchars((string) $v, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . '\"';\n            }\n            $out .= '></' . $tag . '>';\n        }\n        return $out;\n    }\n}\n",
      "path": "organisms/Runtime.php",
      "target": "organisms/Runtime.php"
    },
    {
      "content": "<?php\n\n// Code generated by @ui8kit/codegen. DO NOT EDIT.\n\ndeclare(strict_types=1);\n\nnamespace UI8Kit\\Latte;\n\n/**\n * Class contracts of every primitive. Recipes are the shared *.variants.json\n * files, inlined verbatim; merge order and tailwind-merge semantics match cn()\n * in the TS runtimes and Cn/Compose in Go.\n */\nfinal class Classes\n{\n    public const RECIPES = [\n        'icon' => [\n            'base' => 'inline-flex shrink-0 items-center justify-center',\n            'byKey' => [\n                'size' => [\n                    'xs' => 'size-3',\n                    'sm' => 'size-4',\n                    'md' => 'size-5',\n                    'lg' => 'size-6',\n                    'xl' => 'size-8',\n                ],\n            ],\n            'defaults' => [\n                'size' => 'sm',\n            ],\n            'id' => 'ui.icon',\n            'keys' => [\n                'size',\n            ],\n        ],\n    ];\n\n    /**\n     * Box classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, tag?: string} $p\n     */\n    public static function boxClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Text classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, tag?: string} $p\n     */\n    public static function textClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Button classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, type?: string, form?: string, href?: string, disabled?: bool, pressed?: bool, expanded?: bool, ariaLabel?: string, ariaPressed?: string, ariaExpanded?: string, ariaControls?: string} $p\n     */\n    public static function buttonClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Link classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, href?: string, target?: string, rel?: string, external?: bool, download?: string, ariaCurrent?: string, ariaLabel?: string} $p\n     */\n    public static function linkClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Label classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, htmlFor?: string} $p\n     */\n    public static function labelClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Form classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, id?: string, name?: string, action?: string, method?: string, encType?: string, noValidate?: bool, autoComplete?: string, target?: string, ariaLabel?: string, ariaLabelledBy?: string, ariaDescribedBy?: string} $p\n     */\n    public static function formClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Input classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, type?: string, id?: string, name?: string, value?: string, placeholder?: string, min?: string, max?: string, step?: string, required?: bool, disabled?: bool, readOnly?: bool, ariaInvalid?: string, ariaDescribedBy?: string} $p\n     */\n    public static function inputClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Textarea classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, id?: string, name?: string, value?: string, placeholder?: string, rows?: string, required?: bool, disabled?: bool, readOnly?: bool, ariaInvalid?: string, ariaDescribedBy?: string} $p\n     */\n    public static function textareaClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Select classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, id?: string, name?: string, value?: string, multiple?: bool, required?: bool, disabled?: bool, ariaInvalid?: string, ariaDescribedBy?: string} $p\n     */\n    public static function selectClasses(array $p = []): string\n    {\n        return Rt::cn(['pr-2', ($p['class'] ?? '')]);\n    }\n\n    /**\n     * Checkbox classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, id?: string, name?: string, value?: string, checked?: bool, required?: bool, disabled?: bool, ariaInvalid?: string, ariaDescribedBy?: string} $p\n     */\n    public static function checkboxClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Radio classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, id?: string, name?: string, value?: string, checked?: bool, required?: bool, disabled?: bool, ariaInvalid?: string, ariaDescribedBy?: string} $p\n     */\n    public static function radioClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Switch classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, checked?: bool, disabled?: bool, id?: string, name?: string, value?: string, ariaLabel?: string, ariaLabelledBy?: string} $p\n     */\n    public static function switchClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Image classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, src?: string, alt?: string, srcSet?: string, sizes?: string, width?: string, height?: string, loading?: string, decoding?: string} $p\n     */\n    public static function imageClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Picture classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string} $p\n     */\n    public static function pictureClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Icon classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{size?: string, class?: string, label?: string} $p\n     */\n    public static function iconClasses(array $p = []): string\n    {\n        return Rt::compose(self::RECIPES['icon'], ['size' => ($p['size'] ?? '')], [($p['class'] ?? '')]);\n    }\n\n    /**\n     * Dialog classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, id?: string, open?: bool, ariaLabelledBy?: string, ariaDescribedBy?: string, ariaLabel?: string} $p\n     */\n    public static function dialogClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Disclosure classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, open?: bool, name?: string} $p\n     */\n    public static function disclosureClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Summary classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string} $p\n     */\n    public static function summaryClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Meter classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, value?: string, min?: string, max?: string, low?: string, high?: string, optimum?: string, ariaLabel?: string} $p\n     */\n    public static function meterClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Progress classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, value?: string, max?: string, ariaLabel?: string} $p\n     */\n    public static function progressClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n\n    /**\n     * Separator classes without rendering — the asChild replacement for custom roots.\n     *\n     * @param array{class?: string, orientation?: string, decorative?: bool} $p\n     */\n    public static function separatorClasses(array $p = []): string\n    {\n        return Rt::cn([($p['class'] ?? '')]);\n    }\n}\n",
      "path": "runtime/Classes.php",
      "target": "runtime/Classes.php"
    },
    {
      "content": "<?php\n\n// Code generated by @ui8kit/codegen. DO NOT EDIT.\n\ndeclare(strict_types=1);\n\nnamespace UI8Kit\\Latte;\n\n/**\n * cn: clsx-joined class fragments with tailwind-merge conflict resolution (the last class of a group wins, and a\n * class removes the earlier classes of the groups it overrides: p-2 removes px-4, not the reverse). Port of cn_merge.go.\n */\nfinal class CnMerge\n{\n    public static function merge(array $classes): string\n    {\n        $tokens = [];\n        foreach ($classes as $chunk) {\n            foreach (preg_split('/\\s+/', trim((string) $chunk)) ?: [] as $t) {\n                if ($t !== '') {\n                    $tokens[] = $t;\n                }\n            }\n        }\n        $kept = [];\n        foreach ($tokens as $token) {\n            [$prefix, $key, $removes] = self::classKey($token);\n            if ($key !== '') {\n                $drop = [$key => true];\n                foreach ($removes as $g) {\n                    $drop[$prefix . $g] = true;\n                }\n                $kept = array_values(array_filter($kept, fn ($it) => !isset($drop[$it[1]])));\n            }\n            $kept[] = [$token, $key];\n        }\n        return implode(' ', array_map(fn ($it) => $it[0], $kept));\n    }\n\n    private static function classKey(string $token): array\n    {\n        [$prefix, $core] = self::splitVariant($token);\n        if ($core === '') {\n            return ['', '', []];\n        }\n        $groups = self::utilityGroups($core);\n        if (!$groups) {\n            return [$prefix, '=' . $token, []];\n        }\n        return [$prefix, $prefix . $groups[0], array_slice($groups, 1)];\n    }\n\n    private static function splitVariant(string $token): array\n    {\n        $depth = 0;\n        $cut = -1;\n        $n = strlen($token);\n        for ($i = 0; $i < $n; $i++) {\n            $c = $token[$i];\n            if ($c === '[') {\n                $depth++;\n            } elseif ($c === ']') {\n                if ($depth > 0) {\n                    $depth--;\n                }\n            } elseif ($c === ':' && $depth === 0) {\n                $cut = $i;\n            }\n        }\n        if ($cut === -1) {\n            return ['', self::noBang($token)];\n        }\n        return [substr($token, 0, $cut + 1), self::noBang(substr($token, $cut + 1))];\n    }\n\n    private static function noBang(string $s): string\n    {\n        return str_starts_with($s, '!') ? substr($s, 1) : $s;\n    }\n\n    private static function utilityGroups(string $core): array\n    {\n        switch ($core) {\n            case 'block': case 'inline': case 'inline-block': case 'inline-flex': case 'flex': case 'grid': case 'contents': case 'hidden':\n                return ['display'];\n            case 'flex-row': case 'flex-col': case 'flex-row-reverse': case 'flex-col-reverse':\n                return ['flex-direction'];\n            case 'static': case 'relative': case 'absolute': case 'fixed': case 'sticky':\n                return ['position'];\n            case 'isolate': case 'isolation-auto':\n                return ['isolation'];\n            case 'object-contain': case 'object-cover': case 'object-fill': case 'object-none': case 'object-scale-down':\n                return ['object-fit'];\n            case 'object-bottom': case 'object-center': case 'object-left': case 'object-left-bottom': case 'object-left-top': case 'object-right': case 'object-right-bottom': case 'object-right-top': case 'object-top':\n                return ['object-position'];\n        }\n        if (str_starts_with($core, 'aspect-')) {\n            return ['aspect'];\n        }\n        // ring-offset-N (width) and ring-offset-<color> are their own groups\n        if (str_starts_with($core, 'ring-offset-')) {\n            return [self::isNumber(substr($core, 12)) ? 'ring-offset-width' : 'ring-offset-color'];\n        }\n        foreach (['inset-ring', 'ring'] as $kind) {\n            if ($core === $kind) {\n                return [$kind . '-width'];\n            }\n            if (str_starts_with($core, $kind . '-')) {\n                $rest = substr($core, strlen($kind) + 1);\n                return [self::isNumber($rest) ? $kind . '-width' : $kind . '-color'];\n            }\n        }\n        $prefixes = [\n            ['gap-x-', 'gap-x'], ['gap-y-', 'gap-y'], ['items-', 'align-items'], ['justify-', 'justify-content'],\n            ['self-', 'align-self'], ['content-', 'align-content'], ['overflow-x-', 'overflow-x'], ['overflow-y-', 'overflow-y'],\n            ['inset-x-', 'inset-x'], ['inset-y-', 'inset-y'], ['min-w-', 'min-width'], ['min-h-', 'min-height'],\n            ['max-w-', 'max-width'], ['max-h-', 'max-height'], ['shadow-', 'shadow'], ['ring-', 'ring'], ['rounded-', 'rounded'],\n            ['leading-', 'leading'], ['tracking-', 'tracking'], ['opacity-', 'opacity'], ['z-', 'z'], ['top-', 'top'],\n            ['right-', 'right'], ['bottom-', 'bottom'], ['left-', 'left'],\n        ];\n        foreach ($prefixes as [$p, $g]) {\n            if (str_starts_with($core, $p)) {\n                return [$g];\n            }\n        }\n        if (str_starts_with($core, 'gap-')) {\n            return ['gap', 'gap-x', 'gap-y'];\n        }\n        if (str_starts_with($core, 'inset-')) {\n            return ['inset', 'inset-x', 'inset-y', 'top', 'right', 'bottom', 'left'];\n        }\n        if (str_starts_with($core, 'overflow-')) {\n            return ['overflow', 'overflow-x', 'overflow-y'];\n        }\n        if ($core === 'border' || (str_starts_with($core, 'border-') && self::isNumber(substr($core, 7)))) {\n            return ['border-width', 'border-w-x', 'border-w-y', 'border-w-t', 'border-w-r', 'border-w-b', 'border-w-l', 'border-w-s', 'border-w-e'];\n        }\n        if (strlen($core) >= 8 && str_starts_with($core, 'border-') && str_contains('xytrblse', $core[7])\n            && (strlen($core) === 8 || ($core[8] === '-' && self::isNumber(substr($core, 9))))) {\n            $side = $core[7];\n            if ($side === 'x') {\n                return ['border-w-x', 'border-w-r', 'border-w-l', 'border-w-s', 'border-w-e'];\n            }\n            if ($side === 'y') {\n                return ['border-w-y', 'border-w-t', 'border-w-b'];\n            }\n            return ['border-w-' . $side];\n        }\n        if (in_array($core, ['text-left', 'text-center', 'text-right', 'text-justify', 'text-start', 'text-end'], true)) {\n            return ['text-align'];\n        }\n        if ($core === 'rounded') {\n            return ['rounded'];\n        }\n        if ($core === 'shadow' || $core === 'shadow-none') {\n            return ['shadow'];\n        }\n        if (in_array($core, ['flex-1', 'flex-auto', 'flex-none', 'flex-initial'], true)) {\n            return ['flex-size', 'flex-grow', 'flex-shrink', 'flex-basis'];\n        }\n        if ($core === 'grow' || str_starts_with($core, 'grow-')) {\n            return ['flex-grow'];\n        }\n        if ($core === 'shrink' || $core === 'shrink-0') {\n            return ['flex-shrink'];\n        }\n        if (str_starts_with($core, 'size-')) {\n            return ['size', 'width', 'height'];\n        }\n        if (str_starts_with($core, 'w-')) {\n            return ['width'];\n        }\n        if (str_starts_with($core, 'h-')) {\n            return ['height'];\n        }\n        foreach (['p' => 'padding', 'm' => 'margin'] as $kind => $name) {\n            if (str_starts_with($core, $kind . '-') && !self::hasDirectionPrefix($core, $kind)) {\n                return [$name, \"$name-x\", \"$name-y\", \"$name-t\", \"$name-r\", \"$name-b\", \"$name-l\", \"$name-s\", \"$name-e\"];\n            }\n            $axis = self::spaceAxis($core, $kind, $name);\n            if ($axis) {\n                return $axis;\n            }\n        }\n        if (str_starts_with($core, 'bg-')) {\n            return ['bg'];\n        }\n        if (self::isTextSize($core)) {\n            return ['text-size', 'leading'];\n        }\n        if (str_starts_with($core, 'text-')) {\n            return ['text-color'];\n        }\n        if (in_array($core, ['font-thin', 'font-extralight', 'font-light', 'font-normal', 'font-medium', 'font-semibold', 'font-bold', 'font-extrabold', 'font-black'], true)) {\n            return ['font-weight'];\n        }\n        return [];\n    }\n\n    private static function hasDirectionPrefix(string $core, string $kind): bool\n    {\n        foreach (['x-', 'y-', 't-', 'r-', 'b-', 'l-', 's-', 'e-'] as $d) {\n            if (str_starts_with($core, $kind . $d)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private static function spaceAxis(string $core, string $kind, string $n): array\n    {\n        if (str_starts_with($core, $kind . 'x-')) {\n            return [\"$n-x\", \"$n-r\", \"$n-l\", \"$n-s\", \"$n-e\"];\n        }\n        if (str_starts_with($core, $kind . 'y-')) {\n            return [\"$n-y\", \"$n-t\", \"$n-b\"];\n        }\n        foreach (['t', 'r', 'b', 'l'] as $s) {\n            if (str_starts_with($core, $kind . $s . '-')) {\n                return [\"$n-$s\"];\n            }\n        }\n        return [];\n    }\n\n    private static function isTextSize(string $core): bool\n    {\n        if (in_array($core, ['text-xs', 'text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl', 'text-3xl', 'text-4xl', 'text-5xl', 'text-6xl', 'text-7xl', 'text-8xl', 'text-9xl'], true)) {\n            return true;\n        }\n        if (str_starts_with($core, 'text-[')) {\n            $rest = substr($core, 6);\n            return $rest !== '' && (ctype_digit($rest[0]) || $rest[0] === '.');\n        }\n        return false;\n    }\n\n    private static function isNumber(string $s): bool\n    {\n        if (str_starts_with($s, '[')) {\n            return true;\n        }\n        return $s !== '' && strspn($s, '0123456789.') === strlen($s);\n    }\n}\n",
      "path": "runtime/CnMerge.php",
      "target": "runtime/CnMerge.php"
    },
    {
      "content": "<?php\n\n// Code generated by @ui8kit/codegen. DO NOT EDIT.\n\ndeclare(strict_types=1);\n\nnamespace UI8Kit\\Latte;\n\n/**\n * UI8Kit PHP runtime helpers used by the generated Twig and Latte templates.\n * One implementation of every decision-table primitive; mirrors\n * runtime/go/expr.go + utils.go and runtime/ts/expr.ts so all runtimes\n * resolve defaults identically. Variadic Go helpers take arrays here so\n * Twig and Latte call them with the same shape.\n */\nfinal class Rt\n{\n    private static function s(mixed $v): string\n    {\n        return is_bool($v) ? ($v ? 'true' : 'false') : (string) ($v ?? '');\n    }\n\n    /** cn = clsx join + tailwind-merge conflict resolution (CnMerge, port of cn_merge.go). */\n    public static function cn(array $classes): string\n    {\n        return CnMerge::merge(array_map([self::class, 's'], $classes));\n    }\n\n    /** Omit-if-empty attribute value: blank → null so the attribute is dropped. */\n    public static function orNull(mixed $v): ?string\n    {\n        $s = self::s($v);\n        return trim($s) === '' ? null : $s;\n    }\n\n    public static function isSetStr(mixed $v): bool\n    {\n        return trim(self::s($v)) !== '';\n    }\n\n    public static function defaultIfEmpty(mixed $v, string $fallback): string\n    {\n        $t = trim(self::s($v));\n        return $t === '' ? $fallback : $t;\n    }\n\n    public static function oneOfOr(mixed $v, string $fallback, array $allowed): string\n    {\n        $t = trim(self::s($v));\n        return in_array($t, $allowed, true) ? $t : $fallback;\n    }\n\n    public static function oneOfOrLower(mixed $v, string $fallback, array $allowed): string\n    {\n        return self::oneOfOr(strtolower(trim(self::s($v))), $fallback, $allowed);\n    }\n\n    /** Decision table: mapping[trim(v)] ?? fallback. */\n    public static function mapOr(mixed $v, array $mapping, string $fallback): string\n    {\n        $k = trim(self::s($v));\n        return array_key_exists($k, $mapping) ? (string) $mapping[$k] : $fallback;\n    }\n\n    public static function mapOrLower(mixed $v, array $mapping, string $fallback): string\n    {\n        return self::mapOr(strtolower(trim(self::s($v))), $mapping, $fallback);\n    }\n\n    /** Integer decision table: mapping[v] ?? fallback. */\n    public static function intMapOr(mixed $v, array $mapping, string $fallback): string\n    {\n        $k = (int) ($v ?? 0);\n        return array_key_exists($k, $mapping) ? (string) $mapping[$k] : $fallback;\n    }\n\n    /** ARIA state stringification: always 'true'/'false', never omitted. */\n    public static function boolStr(mixed $v): string\n    {\n        return $v ? 'true' : 'false';\n    }\n\n    /** Tri-state ARIA state: 'true'/'false' when set, '' when null (attribute omitted). */\n    public static function optBoolStr(mixed $v): string\n    {\n        return $v === null ? '' : ($v ? 'true' : 'false');\n    }\n\n    /** Concatenation of trimmed parts (icon Prefix + Name). */\n    public static function concatTrim(array $parts): string\n    {\n        $out = '';\n        foreach ($parts as $p) {\n            $out .= trim(self::s($p));\n        }\n        return $out;\n    }\n\n    /** Returns tag when allowed for the group, otherwise fallback (tag groups: Tags::GROUPS). */\n    public static function resolveTag(mixed $tag, string $fallback, string $group): string\n    {\n        $t = strtolower(trim(self::s($tag)));\n        if ($t === '') {\n            return $fallback;\n        }\n        return in_array($t, Tags::GROUPS[$group] ?? [], true) ? $t : $fallback;\n    }\n\n    /**\n     * Merge recipe base, keyed variant selections, compound variants and tail\n     * classes (Go Compose). Recipe shape is *.variants.json: base, keys,\n     * defaults, byKey, compound. Unknown choices are silently dropped.\n     */\n    public static function compose(array $recipe, array $selection, array $extra = []): string\n    {\n        $parts = [];\n        $base = trim((string) ($recipe['base'] ?? ''));\n        if ($base !== '') {\n            $parts[] = $base;\n        }\n        $pick = static function (string $key) use ($recipe, $selection): string {\n            $choice = trim(self::s($selection[$key] ?? ''));\n            return $choice !== '' ? $choice : trim((string) ($recipe['defaults'][$key] ?? ''));\n        };\n        foreach (($recipe['keys'] ?? []) as $key) {\n            $choices = $recipe['byKey'][$key] ?? null;\n            if ($choices === null) {\n                continue;\n            }\n            $choice = $pick($key);\n            if ($choice === '') {\n                if (count($choices) > 0) {\n                    throw new \\LogicException(\"[compose] missing default for key \\\"$key\\\"\");\n                }\n                continue;\n            }\n            $cls = $choices[$choice] ?? null;\n            if ($cls !== null && trim((string) $cls) !== '') {\n                $parts[] = (string) $cls;\n            }\n        }\n        foreach (($recipe['compound'] ?? []) as $c) {\n            $ok = true;\n            foreach ($c as $k => $want) {\n                if ($k === 'class') {\n                    continue;\n                }\n                $ok = $ok && in_array($pick((string) $k), explode('|', (string) $want), true);\n            }\n            if ($ok && trim((string) ($c['class'] ?? '')) !== '') {\n                $parts[] = (string) $c['class'];\n            }\n        }\n        return self::cn([...$parts, ...$extra]);\n    }\n\n    /**\n     * Attribute string for Twig templates. Computed attrs first, caller\n     * attrs merged last so the caller wins. null/false omit, true prints a\n     * bare boolean attribute, everything else stringifies and escapes.\n     */\n    private const URL_ATTRS = ['href', 'src', 'action', 'formaction', 'poster', 'cite', 'background', 'xlink:href'];\n\n    /** URL attribute value: '' for javascript:, vbscript: and data: (ASCII whitespace/control chars removed, case-insensitive). */\n    public static function safeUrl(mixed $v): string\n    {\n        $s = self::s($v);\n        return self::unsafeUrl($s, false) ? '' : $s;\n    }\n\n    private static function unsafeUrl(string $s, bool $dataImage): bool\n    {\n        $k = strtolower((string) preg_replace('/[\\x00-\\x20]/', '', $s));\n        if ($dataImage && preg_match('#^data:image/(png|jpeg|gif|webp|avif|svg\\+xml)[;,]#', $k)) {\n            return false;\n        }\n        return (bool) preg_match('/^(javascript|vbscript|data):/', $k);\n    }\n\n    /** Optional URL attribute: null (omitted) when unset, blank or an unsafe scheme, else the value as given. */\n    public static function urlOrNull(mixed $v): ?string\n    {\n        $s = self::s($v);\n        return trim($s) === '' || self::unsafeUrl($s, false) ? null : $s;\n    }\n\n    /** urlOrNull for <img src>: data:image/(png|jpeg|gif|webp|avif|svg+xml) placeholders are allowed. */\n    public static function imgUrlOrNull(mixed $v): ?string\n    {\n        $s = self::s($v);\n        return trim($s) === '' || self::unsafeUrl($s, true) ? null : $s;\n    }\n\n    /** Drops URL attributes with an unsafe URL (kept for callers of 3.2; generated templates use restAttrs). */\n    public static function safeAttrs(array $attrs): array\n    {\n        foreach ($attrs as $name => $value) {\n            if (is_string($value) && $value !== '' && in_array(strtolower((string) $name), self::URL_ATTRS, true) && self::safeUrl($value) === '') {\n                unset($attrs[$name]);\n            }\n        }\n        return $attrs;\n    }\n\n    /**\n     * The caller's attrs as rendered: an unsafe URL (data:image allowed in <img src> when $img) or a blank optional\n     * attribute ($blank, lowercase names; never value) becomes null. The key stays, so the caller still wins over\n     * the named attribute of the same name and the attribute is omitted.\n     */\n    public static function restAttrs(array $attrs, bool $img = false, array $blank = []): array\n    {\n        foreach ($attrs as $name => $value) {\n            if (!is_string($value)) {\n                continue;\n            }\n            $key = strtolower((string) $name);\n            if (trim($value) === '' && in_array($key, $blank, true)) {\n                $attrs[$name] = null;\n            } elseif ($value !== '' && in_array($key, self::URL_ATTRS, true) && self::unsafeUrl($value, $img && $key === 'src')) {\n                $attrs[$name] = null;\n            }\n        }\n        return $attrs;\n    }\n\n    /** Twig attribute string: named attrs, then the caller's attrs (restAttrs) merged last so the caller wins. */\n    public static function attrs(array $attrs, array $rest = [], bool $img = false, array $blank = []): string\n    {\n        $out = '';\n        foreach (array_merge($attrs, self::restAttrs($rest, $img, $blank)) as $name => $value) {\n            if ($value === null || $value === false) {\n                continue;\n            }\n            if ($value === true) {\n                $out .= ' ' . $name;\n                continue;\n            }\n            $out .= ' ' . $name . '=\"' . htmlspecialchars(self::s($value), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . '\"';\n        }\n        return $out;\n    }\n}\n",
      "path": "runtime/Rt.php",
      "target": "runtime/Rt.php"
    },
    {
      "content": "<?php\n\n// Code generated by @ui8kit/codegen. DO NOT EDIT.\n// Source of truth: src/domain/tags.ts.\n\ndeclare(strict_types=1);\n\nnamespace UI8Kit\\Latte;\n\n/** Allowed tags per semantic group (polymorphic Tag props). */\nfinal class Tags\n{\n    public const GROUPS = [\n        'Box' => ['div', 'section', 'article', 'aside', 'header', 'footer', 'main', 'nav', 'figure', 'search', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'fieldset', 'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td', 'caption', 'colgroup', 'col'],\n        'Text' => ['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'figcaption', 'pre', 'code', 'small', 'strong', 'em', 'time', 'legend', 'del', 'ins'],\n    ];\n}\n",
      "path": "runtime/Tags.php",
      "target": "runtime/Tags.php"
    }
  ],
  "meta": {
    "category": "utils",
    "kind": "utils",
    "tags": [
      "latte",
      "utils"
    ]
  },
  "name": "utils",
  "registryDependencies": [],
  "runtime": "latte",
  "title": "Utils",
  "type": "registry:utils"
}
