// AUTO-GENERATED by mizan — do not edit import { readable, type Readable } from 'svelte/store' import { registerContext, type ContextState } from '@mizan/base' {% if !stage1_imports.is_empty() -%} import { {{ stage1_imports|join(", ") }} } from '../index' {% endif -%} {% for ctx in contexts -%} export function create{{ ctx.pascal }}Context({% if ctx.has_params %}params: {{ ctx.pascal }}ContextParams{% endif %}) { const store = readable>( { data: null, status: 'idle', error: null }, (set) => { const handle = registerContext('{{ ctx.name }}', {{ ctx.params_arg }}, () => fetch{{ ctx.pascal }}Context({{ ctx.params_arg }})) const unsub = handle.subscribe(() => set(handle.getState())) handle.refetch() return () => { unsub(); handle.unregister() } }, ) return store } {% endfor -%} {% for call in call_exports -%} export { call{{ call }} } from '../index' {% endfor %} export type { ContextState } from '@mizan/base' export { configure, initSession, MizanError } from '@mizan/base'