<script lang="ts">
/** @type {import('./$types').LayoutData} */
export let data: any;

import { goto } from '$app/navigation';
import { onMount } from 'svelte';

// import type { key_val } from '$lib/ae_stores';
// import { ae_util } from '$lib/ae_utils/ae_utils';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores';


$events_loc.qry__enabled = 'enabled';
$events_loc.qry__hidden = 'not_hidden';
$events_loc.qry__limit = 25;
$events_loc.qry__offset = 0;

// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
$slct.account_id = data.account_id;
console.log(`$slct.account_id = `, $slct.account_id);
let ae_acct = data[$slct.account_id];
console.log(`ae_acct = `, ae_acct);

$events_slct.event_id = ae_acct.slct.event_id;
$events_slct.event_obj = ae_acct.slct.event_obj;
$events_slct.exhibit_obj_li = ae_acct.slct.event_exhibit_obj_li;


onMount(() => {
    console.log('Events Leads: +layout.svelte');

    // let href_url = window.location.href;
    // $ae_loc.href_url = href_url;
    // console.log(`$ae_loc.href_url = `, $ae_loc.href_url);

    // $slct_trigger = 'msg_parent';
    // ae_util.handle_url_and_message('event_id', $events_slct.event_id);
    // ae_util.handle_url_and_message('exhibit_id', $events_slct.exhibit_id);
    // if ($events_slct.exhibit_id) {
    //     console.log(`Got an ID. Let's do something!?`);
    //     modalStore.trigger(modal_view__exhibit_obj);
    // }
});
</script>


<svelte:head>
	<title>Events Leads - {$events_loc.title ?? 'Æ loading...'}</title>
</svelte:head>


<slot></slot>
