, prefix: string, segs: Segment[], depth: number)}
{@const entries = Object.entries(obj)}
{#each entries as [key, child], idx}
{@const path = kp(prefix, key)}
{@const onPath = segs.length > 0 && segs[0].key === key}
{@const seg = onPath ? segs[0] : null}
{@const rest = onPath ? segs.slice(1) : []}
{@const comma = idx < entries.length - 1 ? ',' : ''}
{@const matched = onPath && rest.length === 0 && seg !== null && seg.qualifiers.length === 0}
{#if isLeaf(child)}
:
{#if typeof child === 'string' && isAtUri(child)}
{#if onLoadUri}{/if}
{:else}
{/if}{comma}
{:else if Array.isArray(child)}
: [
{@render arrayEntries(child, path, seg, rest, depth + 1)}
]{comma}
{:else}
{@const isUnion = isObj(child) && !!child.$type}
{@const qualPrefix = isUnion ? `${path}{${(child as Record).$type}}` : path}
{@const cSegs = childSegs(onPath, seg, rest, child)}
: {'{'}
{@render objectEntries(child as Record, qualPrefix, cSegs, depth + 1)}
{'}'}{comma}
{/if}
{/each}
{/snippet}
{#snippet arrayEntries(arr: unknown[], prefix: string, seg: Segment | null, restSegs: Segment[], depth: number)}
{#each arr as elem, idx}
{@const comma = idx < arr.length - 1 ? ',' : ''}
{@const onPath = elemOnPath(seg, elem)}
{@const eSegs = onPath ? restSegs : []}
{@const ePrefix = isObj(elem) && elem.$type ? `${prefix}[${elem.$type}]` : `${prefix}[]`}
{@const matched = onPath && eSegs.length === 0}
{#if isLeaf(elem)}
{#if typeof elem === 'string' && isAtUri(elem)}
{#if onLoadUri}{/if}
{:else}
{/if}{comma}
{:else if Array.isArray(elem)}
[
{@render arrayEntries(elem, ePrefix, null, [], depth + 1)}
]{comma}
{:else}
{@const isUnion = isObj(elem) && !!elem.$type}
{@const qualPrefix = isUnion ? `${prefix}[${(elem as Record).$type}]` : `${prefix}[]`}
{'{'}
{@render objectEntries(elem as Record, qualPrefix, eSegs, depth + 1)}
{'}'}{comma}
{/if}
{/each}
{/snippet}