import define from "../../../define.js";
import { createWorker } from "tesseract.js";
export const meta = {
    tags: [
        "drive"
    ],
    requireCredential: true,
    kind: "read:drive",
    description: "Return caption of image",
    res: {
        type: "string",
        optional: false,
        nullable: false
    }
};
export const paramDef = {
    type: "object",
    properties: {
        url: {
            type: "string"
        }
    },
    required: [
        "url"
    ]
};
export default define(meta, paramDef, async (ps)=>{
    const worker = await createWorker("eng", undefined, {
        logger: (m)=>console.log(m)
    });
    const { data: { text } } = await worker.recognize(ps.url);
    await worker.terminate();
    return text;
});
