/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Tiles
 */
import { assert } from "@itwin/core-bentley";
import { RenderSchedule } from "@itwin/core-common";
import { collectTransferables } from "../../common/imdl/ImdlModel";
import { parseImdlDocument } from "../../common/imdl/ParseImdlDocument";
import { registerWorker } from "../RegisterWorker";
let timeline;
registerWorker({
    parse: (options) => {
        const result = parseImdlDocument({
            ...options,
            data: options.data,
            timeline,
        });
        if (typeof result === "number")
            return result;
        return { result, transfer: collectTransferables(result) };
    },
    setTimeline: (arg) => {
        assert(undefined === timeline, "setTimeline must be called only once");
        timeline = Array.isArray(arg) ? RenderSchedule.Script.fromJSON(arg) : RenderSchedule.ModelTimeline.fromJSON(arg);
    },
});
//# sourceMappingURL=Worker.js.map