"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('./chunk-QMEBSUXP.js');
require('./chunk-5MHMD5JX.js');


var _chunkIHUBTSSWjs = require('./chunk-IHUBTSSW.js');
require('./chunk-UXPZNWPH.js');
require('./chunk-LQ2VYIYD.js');

// src/evaluation.ts
var _fs = require('fs');
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
var _img = require('@aico-test/shared/img');
async function buildContext(targetDir) {
  const resizeOutputImgP = _path2.default.join(targetDir, "output_without_text.png");
  const originalInputImgP = _path2.default.join(targetDir, "input.png");
  const snapshotJsonPath = _path2.default.join(targetDir, "element-snapshot.json");
  const elementTreeJsonPath = _path2.default.join(targetDir, "element-tree.json");
  const snapshotJson = _fs.readFileSync.call(void 0, snapshotJsonPath, { encoding: "utf-8" });
  const elementSnapshot = JSON.parse(snapshotJson);
  const elementTree = JSON.parse(
    _fs.readFileSync.call(void 0, elementTreeJsonPath, { encoding: "utf-8" })
  );
  const screenshotBase64 = _img.base64Encoded.call(void 0, resizeOutputImgP);
  const originalScreenshotBase64 = _img.base64Encoded.call(void 0, originalInputImgP);
  const size = await _img.imageInfoOfBase64.call(void 0, screenshotBase64);
  const baseContext = {
    size,
    content: elementSnapshot,
    tree: elementTree,
    screenshotBase64,
    originalScreenshotBase64
  };
  return {
    context: {
      ...baseContext,
      describer: async () => {
        return _chunkIHUBTSSWjs.describeUserPage.call(void 0, baseContext);
      }
    },
    snapshotJson,
    screenshotBase64,
    originalScreenshotBase64
  };
}
async function getContextFromFixture(pageName) {
  const targetDir = _path2.default.join(
    __dirname,
    `../../evaluation/page-data/${pageName}`
  );
  return await buildContext(targetDir);
}



exports.buildContext = buildContext; exports.getContextFromFixture = getContextFromFixture;

//# sourceMappingURL=evaluation.js.map