human/dist/human.esm-nobundle.js

13741 lines
459 KiB
JavaScript

/*
Human
homepage: <https://github.com/vladmandic/human>
author: <https://github.com/vladmandic>'
*/
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all2) => {
__markAsModule(target);
for (var name in all2)
__defProp(target, name, { get: all2[name], enumerable: true });
};
var __reExport = (target, module, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
}
return target;
};
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
__accessCheck(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
__accessCheck(obj, member, "write to private field");
setter ? setter.call(obj, value) : member.set(obj, value);
return value;
};
// src/util/util.ts
function log(...msg) {
const dt = new Date();
const ts = `${dt.getHours().toString().padStart(2, "0")}:${dt.getMinutes().toString().padStart(2, "0")}:${dt.getSeconds().toString().padStart(2, "0")}.${dt.getMilliseconds().toString().padStart(3, "0")}`;
if (msg)
console.log(ts, "Human:", ...msg);
}
function join(folder, file) {
const separator = folder.endsWith("/") ? "" : "/";
const skipJoin = file.startsWith(".") || file.startsWith("/") || file.startsWith("http:") || file.startsWith("https:") || file.startsWith("file:");
const path = skipJoin ? `${file}` : `${folder}${separator}${file}`;
if (!path.toLocaleLowerCase().includes(".json"))
throw new Error(`modelpath error: expecting json file: ${path}`);
return path;
}
var now = () => {
if (typeof performance !== "undefined")
return performance.now();
return parseInt((Number(process.hrtime.bigint()) / 1e3 / 1e3).toString());
};
function validate(defaults, config3, parent = "config", msgs = []) {
for (const key of Object.keys(config3)) {
if (typeof config3[key] === "object") {
validate(defaults[key], config3[key], key, msgs);
} else {
const defined = defaults && typeof defaults[key] !== "undefined";
if (!defined)
msgs.push({ reason: "unknown property", where: `${parent}.${key} = ${config3[key]}` });
const same = defaults && typeof defaults[key] === typeof config3[key];
if (defined && !same)
msgs.push({ reason: "property type mismatch", where: `${parent}.${key} = ${config3[key]}`, expected: typeof defaults[key] });
}
}
if (config3.debug && parent === "config" && msgs.length > 0)
log("invalid configuration", msgs);
return msgs;
}
function mergeDeep(...objects) {
const isObject = (obj) => obj && typeof obj === "object";
return objects.reduce((prev, obj) => {
Object.keys(obj || {}).forEach((key) => {
const pVal = prev[key];
const oVal = obj[key];
if (Array.isArray(pVal) && Array.isArray(oVal))
prev[key] = pVal.concat(...oVal);
else if (isObject(pVal) && isObject(oVal))
prev[key] = mergeDeep(pVal, oVal);
else
prev[key] = oVal;
});
return prev;
}, {});
}
// src/config.ts
var config = {
backend: "",
modelBasePath: "",
wasmPath: "",
debug: true,
async: true,
warmup: "full",
cacheSensitivity: 0.7,
skipAllowed: false,
deallocate: false,
filter: {
enabled: true,
equalization: false,
width: 0,
height: 0,
flip: false,
return: true,
brightness: 0,
contrast: 0,
sharpness: 0,
blur: 0,
saturation: 0,
hue: 0,
negative: false,
sepia: false,
vintage: false,
kodachrome: false,
technicolor: false,
polaroid: false,
pixelate: 0
},
gesture: {
enabled: true
},
face: {
enabled: true,
detector: {
modelPath: "blazeface.json",
rotation: true,
maxDetected: 1,
skipFrames: 99,
skipTime: 2500,
minConfidence: 0.2,
iouThreshold: 0.1,
cropFactor: 1.6,
mask: false,
return: false
},
mesh: {
enabled: true,
modelPath: "facemesh.json"
},
iris: {
enabled: true,
modelPath: "iris.json"
},
emotion: {
enabled: true,
minConfidence: 0.1,
skipFrames: 99,
skipTime: 1500,
modelPath: "emotion.json"
},
description: {
enabled: true,
modelPath: "faceres.json",
skipFrames: 99,
skipTime: 3e3,
minConfidence: 0.1
},
antispoof: {
enabled: false,
skipFrames: 99,
skipTime: 4e3,
modelPath: "antispoof.json"
},
liveness: {
enabled: false,
skipFrames: 99,
skipTime: 4e3,
modelPath: "liveness.json"
}
},
body: {
enabled: true,
modelPath: "movenet-lightning.json",
maxDetected: -1,
minConfidence: 0.3,
skipFrames: 1,
skipTime: 200
},
hand: {
enabled: true,
rotation: true,
skipFrames: 99,
skipTime: 1e3,
minConfidence: 0.5,
iouThreshold: 0.2,
maxDetected: -1,
landmarks: true,
detector: {
modelPath: "handtrack.json"
},
skeleton: {
modelPath: "handlandmark-full.json"
}
},
object: {
enabled: false,
modelPath: "mb3-centernet.json",
minConfidence: 0.2,
iouThreshold: 0.4,
maxDetected: 10,
skipFrames: 99,
skipTime: 2e3
},
segmentation: {
enabled: false,
modelPath: "selfie.json",
blur: 8
}
};
// dist/tfjs.esm.js
var tfjs_esm_exports = {};
__export(tfjs_esm_exports, {
GraphModel: () => GraphModel,
Tensor: () => Tensor,
version: () => version9
});
__reExport(tfjs_esm_exports, dist_star);
__reExport(tfjs_esm_exports, dist_star2);
import * as dist_star from "@tensorflow/tfjs/dist/index.js";
import * as dist_star2 from "@tensorflow/tfjs-backend-webgl/dist/index.js";
import { Tensor } from "@tensorflow/tfjs/dist/index.js";
import { GraphModel } from "@tensorflow/tfjs-converter/dist/index";
var version = "3.11.0";
var version2 = "3.11.0";
var version3 = "3.11.0";
var version4 = "3.11.0";
var version5 = "3.11.0";
var version6 = "3.11.0";
var version7 = "3.11.0";
var version8 = "3.11.0";
var version9 = {
tfjs: version,
"tfjs-core": version2,
"tfjs-data": version3,
"tfjs-layers": version4,
"tfjs-converter": version5,
"tfjs-backend-cpu": version6,
"tfjs-backend-webgl": version7,
"tfjs-backend-wasm": version8
};
// src/image/imagefxshaders.ts
var vertexIdentity = `
precision highp float;
attribute vec2 pos;
attribute vec2 uv;
varying vec2 vUv;
uniform float flipY;
void main(void) {
vUv = uv;
gl_Position = vec4(pos.x, pos.y*flipY, 0.0, 1.);
}
`;
var colorMatrixWithAlpha = `
precision highp float;
varying vec2 vUv;
uniform sampler2D texture;
uniform float m[20];
void main(void) {
vec4 c = texture2D(texture, vUv);
gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4];
gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9];
gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14];
gl_FragColor.a = m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19];
}
`;
var colorMatrixWithoutAlpha = `
precision highp float;
varying vec2 vUv;
uniform sampler2D texture;
uniform float m[20];
void main(void) {
vec4 c = texture2D(texture, vUv);
gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[4];
gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[9];
gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[14];
gl_FragColor.a = c.a;
}
`;
var pixelate = `
precision highp float;
varying vec2 vUv;
uniform vec2 size;
uniform sampler2D texture;
vec2 pixelate(vec2 coord, vec2 size) {
return floor( coord / size ) * size;
}
void main(void) {
gl_FragColor = vec4(0.0);
vec2 coord = pixelate(vUv, size);
gl_FragColor += texture2D(texture, coord);
}
`;
var blur = `
precision highp float;
varying vec2 vUv;
uniform sampler2D texture;
uniform vec2 px;
void main(void) {
gl_FragColor = vec4(0.0);
gl_FragColor += texture2D(texture, vUv + vec2(-7.0*px.x, -7.0*px.y))*0.0044299121055113265;
gl_FragColor += texture2D(texture, vUv + vec2(-6.0*px.x, -6.0*px.y))*0.00895781211794;
gl_FragColor += texture2D(texture, vUv + vec2(-5.0*px.x, -5.0*px.y))*0.0215963866053;
gl_FragColor += texture2D(texture, vUv + vec2(-4.0*px.x, -4.0*px.y))*0.0443683338718;
gl_FragColor += texture2D(texture, vUv + vec2(-3.0*px.x, -3.0*px.y))*0.0776744219933;
gl_FragColor += texture2D(texture, vUv + vec2(-2.0*px.x, -2.0*px.y))*0.115876621105;
gl_FragColor += texture2D(texture, vUv + vec2(-1.0*px.x, -1.0*px.y))*0.147308056121;
gl_FragColor += texture2D(texture, vUv )*0.159576912161;
gl_FragColor += texture2D(texture, vUv + vec2( 1.0*px.x, 1.0*px.y))*0.147308056121;
gl_FragColor += texture2D(texture, vUv + vec2( 2.0*px.x, 2.0*px.y))*0.115876621105;
gl_FragColor += texture2D(texture, vUv + vec2( 3.0*px.x, 3.0*px.y))*0.0776744219933;
gl_FragColor += texture2D(texture, vUv + vec2( 4.0*px.x, 4.0*px.y))*0.0443683338718;
gl_FragColor += texture2D(texture, vUv + vec2( 5.0*px.x, 5.0*px.y))*0.0215963866053;
gl_FragColor += texture2D(texture, vUv + vec2( 6.0*px.x, 6.0*px.y))*0.00895781211794;
gl_FragColor += texture2D(texture, vUv + vec2( 7.0*px.x, 7.0*px.y))*0.0044299121055113265;
}
`;
var convolution = `
precision highp float;
varying vec2 vUv;
uniform sampler2D texture;
uniform vec2 px;
uniform float m[9];
void main(void) {
vec4 c11 = texture2D(texture, vUv - px); // top left
vec4 c12 = texture2D(texture, vec2(vUv.x, vUv.y - px.y)); // top center
vec4 c13 = texture2D(texture, vec2(vUv.x + px.x, vUv.y - px.y)); // top right
vec4 c21 = texture2D(texture, vec2(vUv.x - px.x, vUv.y) ); // mid left
vec4 c22 = texture2D(texture, vUv); // mid center
vec4 c23 = texture2D(texture, vec2(vUv.x + px.x, vUv.y) ); // mid right
vec4 c31 = texture2D(texture, vec2(vUv.x - px.x, vUv.y + px.y) ); // bottom left
vec4 c32 = texture2D(texture, vec2(vUv.x, vUv.y + px.y) ); // bottom center
vec4 c33 = texture2D(texture, vUv + px ); // bottom right
gl_FragColor =
c11 * m[0] + c12 * m[1] + c22 * m[2] +
c21 * m[3] + c22 * m[4] + c23 * m[5] +
c31 * m[6] + c32 * m[7] + c33 * m[8];
gl_FragColor.a = c22.a;
}
`;
// src/image/imagefx.ts
var collect = (source, prefix, collection) => {
const r = new RegExp("\\b" + prefix + " \\w+ (\\w+)", "ig");
source.replace(r, (match4, name) => {
collection[name] = 0;
return match4;
});
};
var GLProgram = class {
constructor(gl, vertexSource, fragmentSource) {
__publicField(this, "uniform", {});
__publicField(this, "attribute", {});
__publicField(this, "gl");
__publicField(this, "id");
__publicField(this, "compile", (source, type) => {
const shader = this.gl.createShader(type);
if (!shader) {
log("filter: could not create shader");
return null;
}
this.gl.shaderSource(shader, source);
this.gl.compileShader(shader);
if (!this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS)) {
log(`filter: gl compile failed: ${this.gl.getShaderInfoLog(shader)}`);
return null;
}
return shader;
});
this.gl = gl;
const vertexShader = this.compile(vertexSource, this.gl.VERTEX_SHADER);
const fragmentShader = this.compile(fragmentSource, this.gl.FRAGMENT_SHADER);
this.id = this.gl.createProgram();
if (!vertexShader || !fragmentShader)
return;
if (!this.id) {
log("filter: could not create webgl program");
return;
}
this.gl.attachShader(this.id, vertexShader);
this.gl.attachShader(this.id, fragmentShader);
this.gl.linkProgram(this.id);
if (!this.gl.getProgramParameter(this.id, this.gl.LINK_STATUS)) {
log(`filter: gl link failed: ${this.gl.getProgramInfoLog(this.id)}`);
return;
}
this.gl.useProgram(this.id);
collect(vertexSource, "attribute", this.attribute);
for (const a in this.attribute)
this.attribute[a] = this.gl.getAttribLocation(this.id, a);
collect(vertexSource, "uniform", this.uniform);
collect(fragmentSource, "uniform", this.uniform);
for (const u in this.uniform)
this.uniform[u] = this.gl.getUniformLocation(this.id, u);
}
};
function GLImageFilter() {
let drawCount = 0;
let sourceTexture = null;
let lastInChain = false;
let currentFramebufferIndex = -1;
let tempFramebuffers = [null, null];
let filterChain = [];
let vertexBuffer = null;
let currentProgram = null;
const fxcanvas = canvas(100, 100);
const shaderProgramCache = {};
const DRAW = { INTERMEDIATE: 1 };
const gl = fxcanvas.getContext("webgl");
this.gl = gl;
if (!gl) {
log("filter: cannot get webgl context");
return;
}
function resize(width, height) {
if (width === fxcanvas.width && height === fxcanvas.height)
return;
fxcanvas.width = width;
fxcanvas.height = height;
if (!vertexBuffer) {
const vertices = new Float32Array([-1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0, -1, 1, 0, 0, 1, -1, 1, 1, 1, 1, 1, 0]);
vertexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
}
gl.viewport(0, 0, fxcanvas.width, fxcanvas.height);
tempFramebuffers = [null, null];
}
function createFramebufferTexture(width, height) {
const fbo = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
const renderbuffer = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
gl.bindTexture(gl.TEXTURE_2D, null);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
return { fbo, texture };
}
function getTempFramebuffer(index2) {
tempFramebuffers[index2] = tempFramebuffers[index2] || createFramebufferTexture(fxcanvas.width, fxcanvas.height);
return tempFramebuffers[index2];
}
function draw2(flags = 0) {
if (!currentProgram)
return;
let source = null;
let target = null;
let flipY = false;
if (drawCount === 0)
source = sourceTexture;
else
source = getTempFramebuffer(currentFramebufferIndex).texture || null;
drawCount++;
if (lastInChain && !(flags & DRAW.INTERMEDIATE)) {
target = null;
flipY = drawCount % 2 === 0;
} else {
currentFramebufferIndex = (currentFramebufferIndex + 1) % 2;
target = getTempFramebuffer(currentFramebufferIndex).fbo || null;
}
gl.bindTexture(gl.TEXTURE_2D, source);
gl.bindFramebuffer(gl.FRAMEBUFFER, target);
gl.uniform1f(currentProgram.uniform["flipY"], flipY ? -1 : 1);
gl.drawArrays(gl.TRIANGLES, 0, 6);
}
function compileShader(fragmentSource) {
if (shaderProgramCache[fragmentSource]) {
currentProgram = shaderProgramCache[fragmentSource];
gl.useProgram((currentProgram ? currentProgram.id : null) || null);
return currentProgram;
}
currentProgram = new GLProgram(gl, vertexIdentity, fragmentSource);
if (!currentProgram) {
log("filter: could not get webgl program");
return null;
}
const floatSize = Float32Array.BYTES_PER_ELEMENT;
const vertSize = 4 * floatSize;
gl.enableVertexAttribArray(currentProgram.attribute["pos"]);
gl.vertexAttribPointer(currentProgram.attribute["pos"], 2, gl.FLOAT, false, vertSize, 0 * floatSize);
gl.enableVertexAttribArray(currentProgram.attribute["uv"]);
gl.vertexAttribPointer(currentProgram.attribute["uv"], 2, gl.FLOAT, false, vertSize, 2 * floatSize);
shaderProgramCache[fragmentSource] = currentProgram;
return currentProgram;
}
const filter = {
colorMatrix: (matrix) => {
const m = new Float32Array(matrix);
m[4] /= 255;
m[9] /= 255;
m[14] /= 255;
m[19] /= 255;
const shader = m[18] === 1 && m[3] === 0 && m[8] === 0 && m[13] === 0 && m[15] === 0 && m[16] === 0 && m[17] === 0 && m[19] === 0 ? colorMatrixWithoutAlpha : colorMatrixWithAlpha;
const program = compileShader(shader);
if (!program)
return;
gl.uniform1fv(program.uniform["m"], m);
draw2();
},
brightness: (brightness) => {
const b = (brightness || 0) + 1;
filter.colorMatrix([
b,
0,
0,
0,
0,
0,
b,
0,
0,
0,
0,
0,
b,
0,
0,
0,
0,
0,
1,
0
]);
},
saturation: (amount) => {
const x = (amount || 0) * 2 / 3 + 1;
const y = (x - 1) * -0.5;
filter.colorMatrix([
x,
y,
y,
0,
0,
y,
x,
y,
0,
0,
y,
y,
x,
0,
0,
0,
0,
0,
1,
0
]);
},
desaturate: () => {
filter.saturation(-1);
},
contrast: (amount) => {
const v = (amount || 0) + 1;
const o = -128 * (v - 1);
filter.colorMatrix([
v,
0,
0,
0,
o,
0,
v,
0,
0,
o,
0,
0,
v,
0,
o,
0,
0,
0,
1,
0
]);
},
negative: () => {
filter.contrast(-2);
},
hue: (rotation) => {
rotation = (rotation || 0) / 180 * Math.PI;
const cos = Math.cos(rotation);
const sin = Math.sin(rotation);
const lumR = 0.213;
const lumG = 0.715;
const lumB = 0.072;
filter.colorMatrix([
lumR + cos * (1 - lumR) + sin * -lumR,
lumG + cos * -lumG + sin * -lumG,
lumB + cos * -lumB + sin * (1 - lumB),
0,
0,
lumR + cos * -lumR + sin * 0.143,
lumG + cos * (1 - lumG) + sin * 0.14,
lumB + cos * -lumB + sin * -0.283,
0,
0,
lumR + cos * -lumR + sin * -(1 - lumR),
lumG + cos * -lumG + sin * lumG,
lumB + cos * (1 - lumB) + sin * lumB,
0,
0,
0,
0,
0,
1,
0
]);
},
desaturateLuminance: () => {
filter.colorMatrix([
0.2764723,
0.929708,
0.0938197,
0,
-37.1,
0.2764723,
0.929708,
0.0938197,
0,
-37.1,
0.2764723,
0.929708,
0.0938197,
0,
-37.1,
0,
0,
0,
1,
0
]);
},
sepia: () => {
filter.colorMatrix([
0.393,
0.7689999,
0.18899999,
0,
0,
0.349,
0.6859999,
0.16799999,
0,
0,
0.272,
0.5339999,
0.13099999,
0,
0,
0,
0,
0,
1,
0
]);
},
brownie: () => {
filter.colorMatrix([
0.5997023498159715,
0.34553243048391263,
-0.2708298674538042,
0,
47.43192855600873,
-0.037703249837783157,
0.8609577587992641,
0.15059552388459913,
0,
-36.96841498319127,
0.24113635128153335,
-0.07441037908422492,
0.44972182064877153,
0,
-7.562075277591283,
0,
0,
0,
1,
0
]);
},
vintagePinhole: () => {
filter.colorMatrix([
0.6279345635605994,
0.3202183420819367,
-0.03965408211312453,
0,
9.651285835294123,
0.02578397704808868,
0.6441188644374771,
0.03259127616149294,
0,
7.462829176470591,
0.0466055556782719,
-0.0851232987247891,
0.5241648018700465,
0,
5.159190588235296,
0,
0,
0,
1,
0
]);
},
kodachrome: () => {
filter.colorMatrix([
1.1285582396593525,
-0.3967382283601348,
-0.03992559172921793,
0,
63.72958762196502,
-0.16404339962244616,
1.0835251566291304,
-0.05498805115633132,
0,
24.732407896706203,
-0.16786010706155763,
-0.5603416277695248,
1.6014850761964943,
0,
35.62982807460946,
0,
0,
0,
1,
0
]);
},
technicolor: () => {
filter.colorMatrix([
1.9125277891456083,
-0.8545344976951645,
-0.09155508482755585,
0,
11.793603434377337,
-0.3087833385928097,
1.7658908555458428,
-0.10601743074722245,
0,
-70.35205161461398,
-0.231103377548616,
-0.7501899197440212,
1.847597816108189,
0,
30.950940869491138,
0,
0,
0,
1,
0
]);
},
polaroid: () => {
filter.colorMatrix([
1.438,
-0.062,
-0.062,
0,
0,
-0.122,
1.378,
-0.122,
0,
0,
-0.016,
-0.016,
1.483,
0,
0,
0,
0,
0,
1,
0
]);
},
shiftToBGR: () => {
filter.colorMatrix([
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
1,
0
]);
},
convolution: (matrix) => {
const m = new Float32Array(matrix);
const pixelSizeX = 1 / fxcanvas.width;
const pixelSizeY = 1 / fxcanvas.height;
const program = compileShader(convolution);
if (!program)
return;
gl.uniform1fv(program.uniform["m"], m);
gl.uniform2f(program.uniform["px"], pixelSizeX, pixelSizeY);
draw2();
},
detectEdges: () => {
filter.convolution.call(this, [
0,
1,
0,
1,
-4,
1,
0,
1,
0
]);
},
sobelX: () => {
filter.convolution.call(this, [
-1,
0,
1,
-2,
0,
2,
-1,
0,
1
]);
},
sobelY: () => {
filter.convolution.call(this, [
-1,
-2,
-1,
0,
0,
0,
1,
2,
1
]);
},
sharpen: (amount) => {
const a = amount || 1;
filter.convolution.call(this, [
0,
-1 * a,
0,
-1 * a,
1 + 4 * a,
-1 * a,
0,
-1 * a,
0
]);
},
emboss: (size2) => {
const s = size2 || 1;
filter.convolution.call(this, [
-2 * s,
-1 * s,
0,
-1 * s,
1,
1 * s,
0,
1 * s,
2 * s
]);
},
blur: (size2) => {
const blurSizeX = size2 / 7 / fxcanvas.width;
const blurSizeY = size2 / 7 / fxcanvas.height;
const program = compileShader(blur);
if (!program)
return;
gl.uniform2f(program.uniform["px"], 0, blurSizeY);
draw2(DRAW.INTERMEDIATE);
gl.uniform2f(program.uniform["px"], blurSizeX, 0);
draw2();
},
pixelate: (size2) => {
const blurSizeX = size2 / fxcanvas.width;
const blurSizeY = size2 / fxcanvas.height;
const program = compileShader(pixelate);
if (!program)
return;
gl.uniform2f(program.uniform["size"], blurSizeX, blurSizeY);
draw2();
}
};
this.add = function(name) {
const args = Array.prototype.slice.call(arguments, 1);
const func = filter[name];
filterChain.push({ func, args });
};
this.reset = function() {
filterChain = [];
};
this.get = function() {
return filterChain;
};
this.apply = function(image29) {
resize(image29.width, image29.height);
drawCount = 0;
if (!sourceTexture)
sourceTexture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, sourceTexture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image29);
for (let i = 0; i < filterChain.length; i++) {
lastInChain = i === filterChain.length - 1;
const f = filterChain[i];
f.func.apply(this, f.args || []);
}
return fxcanvas;
};
this.draw = function(image29) {
this.add("brightness", 0);
return this.apply(image29);
};
}
// src/image/enhance.ts
async function histogramEqualization(inputImage) {
const squeeze11 = inputImage.shape.length === 4 ? tfjs_esm_exports.squeeze(inputImage) : inputImage;
const channels = tfjs_esm_exports.split(squeeze11, 3, 2);
const min2 = [tfjs_esm_exports.min(channels[0]), tfjs_esm_exports.min(channels[1]), tfjs_esm_exports.min(channels[2])];
const max4 = [tfjs_esm_exports.max(channels[0]), tfjs_esm_exports.max(channels[1]), tfjs_esm_exports.max(channels[2])];
const absMax = await Promise.all(max4.map((channel) => channel.data()));
const maxValue = 0.99 * Math.max(absMax[0][0], absMax[1][0], absMax[2][0]);
const sub10 = [tfjs_esm_exports.sub(channels[0], min2[0]), tfjs_esm_exports.sub(channels[1], min2[1]), tfjs_esm_exports.sub(channels[2], min2[2])];
const range = [tfjs_esm_exports.sub(max4[0], min2[0]), tfjs_esm_exports.sub(max4[1], min2[1]), tfjs_esm_exports.sub(max4[2], min2[2])];
const fact = [tfjs_esm_exports.div(maxValue, range[0]), tfjs_esm_exports.div(maxValue, range[1]), tfjs_esm_exports.div(maxValue, range[2])];
const enh = [tfjs_esm_exports.mul(sub10[0], fact[0]), tfjs_esm_exports.mul(sub10[1], fact[1]), tfjs_esm_exports.mul(sub10[2], fact[2])];
const rgb2 = tfjs_esm_exports.stack([enh[0], enh[1], enh[2]], 2);
const reshape8 = tfjs_esm_exports.reshape(rgb2, [1, squeeze11.shape[0], squeeze11.shape[1], 3]);
tfjs_esm_exports.dispose([...channels, ...min2, ...max4, ...sub10, ...range, ...fact, ...enh, rgb2, squeeze11]);
return reshape8;
}
// src/image/image.ts
var maxSize = 2048;
var inCanvas = null;
var outCanvas = null;
var tmpCanvas = null;
var fx;
var last = {
inputSum: 0,
cacheDiff: 1,
sumMethod: 0,
inputTensor: void 0
};
function canvas(width, height) {
let c;
if (env.browser) {
if (env.worker) {
if (typeof OffscreenCanvas === "undefined")
throw new Error("canvas error: attempted to run in web worker but OffscreenCanvas is not supported");
c = new OffscreenCanvas(width, height);
} else {
if (typeof document === "undefined")
throw new Error("canvas error: attempted to run in browser but DOM is not defined");
c = document.createElement("canvas");
c.width = width;
c.height = height;
}
} else {
if (typeof env.Canvas !== "undefined")
c = new env.Canvas(width, height);
else if (typeof globalThis.Canvas !== "undefined")
c = new globalThis.Canvas(width, height);
}
return c;
}
function copy(input, output) {
const outputCanvas = output || canvas(input.width, input.height);
const ctx = outputCanvas.getContext("2d");
ctx.drawImage(input, 0, 0);
return outputCanvas;
}
async function process2(input, config3, getTensor = true) {
if (!input) {
if (config3.debug)
log("input error: input is missing");
return { tensor: null, canvas: null };
}
if (!(input instanceof Tensor) && !(typeof Image !== "undefined" && input instanceof Image) && !(typeof env.Canvas !== "undefined" && input instanceof env.Canvas) && !(typeof globalThis.Canvas !== "undefined" && input instanceof globalThis.Canvas) && !(typeof ImageData !== "undefined" && input instanceof ImageData) && !(typeof ImageBitmap !== "undefined" && input instanceof ImageBitmap) && !(typeof HTMLImageElement !== "undefined" && input instanceof HTMLImageElement) && !(typeof HTMLMediaElement !== "undefined" && input instanceof HTMLMediaElement) && !(typeof HTMLVideoElement !== "undefined" && input instanceof HTMLVideoElement) && !(typeof HTMLCanvasElement !== "undefined" && input instanceof HTMLCanvasElement) && !(typeof OffscreenCanvas !== "undefined" && input instanceof OffscreenCanvas)) {
throw new Error("input error: type is not recognized");
}
if (input instanceof Tensor) {
let tensor3 = null;
if (input["isDisposedInternal"])
throw new Error("input error: attempted to use tensor but it is disposed");
if (!input["shape"])
throw new Error("input error: attempted to use tensor without a shape");
if (input.shape.length === 3) {
if (input.shape[2] === 3) {
tensor3 = tfjs_esm_exports.expandDims(input, 0);
} else if (input.shape[2] === 4) {
const rgb2 = tfjs_esm_exports.slice3d(input, [0, 0, 0], [-1, -1, 3]);
tensor3 = tfjs_esm_exports.expandDims(rgb2, 0);
tfjs_esm_exports.dispose(rgb2);
}
} else if (input.shape.length === 4) {
if (input.shape[3] === 3) {
tensor3 = tfjs_esm_exports.clone(input);
} else if (input.shape[3] === 4) {
tensor3 = tfjs_esm_exports.slice4d(input, [0, 0, 0, 0], [-1, -1, -1, 3]);
}
}
if (tensor3 == null || tensor3.shape.length !== 4 || tensor3.shape[0] !== 1 || tensor3.shape[3] !== 3)
throw new Error(`input error: attempted to use tensor with unrecognized shape: ${input["shape"]}`);
if (tensor3.dtype === "int32") {
const cast5 = tfjs_esm_exports.cast(tensor3, "float32");
tfjs_esm_exports.dispose(tensor3);
tensor3 = cast5;
}
return { tensor: tensor3, canvas: config3.filter.return ? outCanvas : null };
} else {
if (typeof input["readyState"] !== "undefined" && input["readyState"] <= 2) {
if (config3.debug)
log("input stream is not ready");
return { tensor: null, canvas: inCanvas };
}
const originalWidth = input["naturalWidth"] || input["videoWidth"] || input["width"] || input["shape"] && input["shape"][1] > 0;
const originalHeight = input["naturalHeight"] || input["videoHeight"] || input["height"] || input["shape"] && input["shape"][2] > 0;
if (!originalWidth || !originalHeight) {
if (config3.debug)
log("cannot determine input dimensions");
return { tensor: null, canvas: inCanvas };
}
let targetWidth = originalWidth;
let targetHeight = originalHeight;
if (targetWidth > maxSize) {
targetWidth = maxSize;
targetHeight = Math.trunc(targetWidth * originalHeight / originalWidth);
}
if (targetHeight > maxSize) {
targetHeight = maxSize;
targetWidth = Math.trunc(targetHeight * originalWidth / originalHeight);
}
if ((config3.filter.width || 0) > 0)
targetWidth = config3.filter.width;
else if ((config3.filter.height || 0) > 0)
targetWidth = originalWidth * ((config3.filter.height || 0) / originalHeight);
if ((config3.filter.height || 0) > 0)
targetHeight = config3.filter.height;
else if ((config3.filter.width || 0) > 0)
targetHeight = originalHeight * ((config3.filter.width || 0) / originalWidth);
if (!targetWidth || !targetHeight)
throw new Error("input error: cannot determine dimension");
if (!inCanvas || (inCanvas == null ? void 0 : inCanvas.width) !== targetWidth || (inCanvas == null ? void 0 : inCanvas.height) !== targetHeight)
inCanvas = canvas(targetWidth, targetHeight);
const inCtx = inCanvas.getContext("2d");
if (typeof ImageData !== "undefined" && input instanceof ImageData) {
inCtx.putImageData(input, 0, 0);
} else {
if (config3.filter.flip && typeof inCtx.translate !== "undefined") {
inCtx.translate(originalWidth, 0);
inCtx.scale(-1, 1);
inCtx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas == null ? void 0 : inCanvas.width, inCanvas == null ? void 0 : inCanvas.height);
inCtx.setTransform(1, 0, 0, 1, 0, 0);
} else {
inCtx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas == null ? void 0 : inCanvas.width, inCanvas == null ? void 0 : inCanvas.height);
}
}
if (!outCanvas || inCanvas.width !== outCanvas.width || (inCanvas == null ? void 0 : inCanvas.height) !== (outCanvas == null ? void 0 : outCanvas.height))
outCanvas = canvas(inCanvas.width, inCanvas.height);
if (config3.filter.enabled && env.webgl.supported) {
if (!fx)
fx = env.browser ? new GLImageFilter() : null;
env.filter = !!fx;
if (!fx || !fx.add) {
if (config3.debug)
log("input process error: cannot initialize filters");
return { tensor: null, canvas: inCanvas };
}
fx.reset();
if (config3.filter.brightness !== 0)
fx.add("brightness", config3.filter.brightness);
if (config3.filter.contrast !== 0)
fx.add("contrast", config3.filter.contrast);
if (config3.filter.sharpness !== 0)
fx.add("sharpen", config3.filter.sharpness);
if (config3.filter.blur !== 0)
fx.add("blur", config3.filter.blur);
if (config3.filter.saturation !== 0)
fx.add("saturation", config3.filter.saturation);
if (config3.filter.hue !== 0)
fx.add("hue", config3.filter.hue);
if (config3.filter.negative)
fx.add("negative");
if (config3.filter.sepia)
fx.add("sepia");
if (config3.filter.vintage)
fx.add("brownie");
if (config3.filter.sepia)
fx.add("sepia");
if (config3.filter.kodachrome)
fx.add("kodachrome");
if (config3.filter.technicolor)
fx.add("technicolor");
if (config3.filter.polaroid)
fx.add("polaroid");
if (config3.filter.pixelate !== 0)
fx.add("pixelate", config3.filter.pixelate);
if (fx.get() > 0)
outCanvas = fx.apply(inCanvas);
else
outCanvas = fx.draw(inCanvas);
} else {
copy(inCanvas, outCanvas);
if (fx)
fx = null;
env.filter = !!fx;
}
if (!getTensor)
return { tensor: null, canvas: outCanvas };
if (!outCanvas)
throw new Error("canvas error: cannot create output");
let pixels;
let depth = 3;
if (typeof ImageData !== "undefined" && input instanceof ImageData || input["data"] && input["width"] && input["height"]) {
if (env.browser && tfjs_esm_exports.browser) {
pixels = tfjs_esm_exports.browser ? tfjs_esm_exports.browser.fromPixels(input) : null;
} else {
depth = input["data"].length / input["height"] / input["width"];
const arr = new Uint8Array(input["data"]["buffer"]);
pixels = tfjs_esm_exports.tensor(arr, [input["height"], input["width"], depth], "int32");
}
} else {
if (!tmpCanvas || outCanvas.width !== tmpCanvas.width || outCanvas.height !== tmpCanvas.height)
tmpCanvas = canvas(outCanvas.width, outCanvas.height);
if (tfjs_esm_exports.browser && env.browser) {
if (config3.backend === "webgl" || config3.backend === "humangl" || config3.backend === "webgpu") {
pixels = tfjs_esm_exports.browser.fromPixels(outCanvas);
} else {
tmpCanvas = copy(outCanvas);
pixels = tfjs_esm_exports.browser.fromPixels(tmpCanvas);
}
} else {
const tempCanvas = copy(outCanvas);
const tempCtx = tempCanvas.getContext("2d");
const tempData = tempCtx.getImageData(0, 0, targetWidth, targetHeight);
depth = tempData.data.length / targetWidth / targetHeight;
const arr = new Uint8Array(tempData.data.buffer);
pixels = tfjs_esm_exports.tensor(arr, [targetWidth, targetHeight, depth]);
}
}
if (depth === 4) {
const rgb2 = tfjs_esm_exports.slice3d(pixels, [0, 0, 0], [-1, -1, 3]);
tfjs_esm_exports.dispose(pixels);
pixels = rgb2;
}
if (!pixels)
throw new Error("input error: cannot create tensor");
const casted = tfjs_esm_exports.cast(pixels, "float32");
const tensor3 = config3.filter.equalization ? await histogramEqualization(casted) : tfjs_esm_exports.expandDims(casted, 0);
tfjs_esm_exports.dispose([pixels, casted]);
return { tensor: tensor3, canvas: config3.filter.return ? outCanvas : null };
}
}
async function skip(config3, input) {
let skipFrame = false;
if (config3.cacheSensitivity === 0 || !input.shape || input.shape.length !== 4 || input.shape[1] > 2048 || input.shape[2] > 2048)
return skipFrame;
if (!last.inputTensor) {
last.inputTensor = tfjs_esm_exports.clone(input);
} else if (last.inputTensor.shape[1] !== input.shape[1] || last.inputTensor.shape[2] !== input.shape[2]) {
tfjs_esm_exports.dispose(last.inputTensor);
last.inputTensor = tfjs_esm_exports.clone(input);
} else {
const t = {};
t.diff = tfjs_esm_exports.sub(input, last.inputTensor);
t.squared = tfjs_esm_exports.mul(t.diff, t.diff);
t.sum = tfjs_esm_exports.sum(t.squared);
const diffSum = await t.sum.data();
const diffRelative = diffSum[0] / (input.shape[1] || 1) / (input.shape[2] || 1) / 255 / 3;
tfjs_esm_exports.dispose([last.inputTensor, t.diff, t.squared, t.sum]);
last.inputTensor = tfjs_esm_exports.clone(input);
skipFrame = diffRelative <= config3.cacheSensitivity;
}
return skipFrame;
}
async function compare(config3, input1, input2) {
const t = {};
if (!input1 || !input2 || input1.shape.length !== 4 || input1.shape.length !== input2.shape.length) {
if (!config3.debug)
log("invalid input tensor or tensor shapes do not match:", input1.shape, input2.shape);
return 0;
}
if (input1.shape[0] !== 1 || input2.shape[0] !== 1 || input1.shape[3] !== 3 || input2.shape[3] !== 3) {
if (!config3.debug)
log("input tensors must be of shape [1, height, width, 3]:", input1.shape, input2.shape);
return 0;
}
t.input1 = tfjs_esm_exports.clone(input1);
t.input2 = input1.shape[1] !== input2.shape[1] || input1.shape[2] !== input2.shape[2] ? tfjs_esm_exports.image.resizeBilinear(input2, [input1.shape[1], input1.shape[2]]) : tfjs_esm_exports.clone(input2);
t.diff = tfjs_esm_exports.sub(t.input1, t.input2);
t.squared = tfjs_esm_exports.mul(t.diff, t.diff);
t.sum = tfjs_esm_exports.sum(t.squared);
const diffSum = await t.sum.data();
const diffRelative = diffSum[0] / (input1.shape[1] || 1) / (input1.shape[2] || 1) / 255 / 3;
tfjs_esm_exports.dispose([t.input1, t.input2, t.diff, t.squared, t.sum]);
return diffRelative;
}
// src/util/env.ts
var Env = class {
constructor() {
__publicField(this, "browser");
__publicField(this, "node");
__publicField(this, "worker");
__publicField(this, "platform", "");
__publicField(this, "agent", "");
__publicField(this, "backends", []);
__publicField(this, "initial");
__publicField(this, "filter");
__publicField(this, "tfjs");
__publicField(this, "offscreen");
__publicField(this, "perfadd", false);
__publicField(this, "wasm", {
supported: void 0,
backend: void 0,
simd: void 0,
multithread: void 0
});
__publicField(this, "webgl", {
supported: void 0,
backend: void 0,
version: void 0,
renderer: void 0
});
__publicField(this, "webgpu", {
supported: void 0,
backend: void 0,
adapter: void 0
});
__publicField(this, "cpu", {
model: void 0,
flags: []
});
__publicField(this, "kernels", []);
__publicField(this, "Canvas");
__publicField(this, "Image");
__publicField(this, "ImageData");
this.browser = typeof navigator !== "undefined";
this.node = typeof process !== "undefined";
this.tfjs = { version: version9["tfjs-core"] };
this.offscreen = typeof OffscreenCanvas !== "undefined";
this.initial = true;
this.worker = this.browser && this.offscreen ? typeof WorkerGlobalScope !== "undefined" : void 0;
if (typeof navigator !== "undefined") {
const raw = navigator.userAgent.match(/\(([^()]+)\)/g);
if (raw && raw[0]) {
const platformMatch = raw[0].match(/\(([^()]+)\)/g);
this.platform = platformMatch && platformMatch[0] ? platformMatch[0].replace(/\(|\)/g, "") : "";
this.agent = navigator.userAgent.replace(raw[0], "");
if (this.platform[1])
this.agent = this.agent.replace(raw[1], "");
this.agent = this.agent.replace(/ /g, " ");
}
} else if (typeof process !== "undefined") {
this.platform = `${process.platform} ${process.arch}`;
this.agent = `NodeJS ${process.version}`;
}
}
async updateBackend() {
this.backends = Object.keys(tfjs_esm_exports.engine().registryFactory);
this.wasm.supported = typeof WebAssembly !== "undefined";
this.wasm.backend = this.backends.includes("wasm");
if (this.wasm.supported && this.wasm.backend && tfjs_esm_exports.getBackend() === "wasm") {
this.wasm.simd = await tfjs_esm_exports.env().getAsync("WASM_HAS_SIMD_SUPPORT");
this.wasm.multithread = await tfjs_esm_exports.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");
}
const c = canvas(100, 100);
const ctx = c ? c.getContext("webgl2") : void 0;
this.webgl.supported = typeof ctx !== "undefined";
this.webgl.backend = this.backends.includes("webgl");
if (this.webgl.supported && this.webgl.backend && (tfjs_esm_exports.getBackend() === "webgl" || tfjs_esm_exports.getBackend() === "humangl")) {
const gl = tfjs_esm_exports.backend().gpgpu !== "undefined" ? await tfjs_esm_exports.backend().getGPGPUContext().gl : null;
if (gl) {
this.webgl.version = gl.getParameter(gl.VERSION);
this.webgl.renderer = gl.getParameter(gl.RENDERER);
}
}
this.webgpu.supported = this.browser && typeof navigator["gpu"] !== "undefined";
this.webgpu.backend = this.backends.includes("webgpu");
try {
if (this.webgpu.supported)
this.webgpu.adapter = (await navigator["gpu"].requestAdapter()).name;
} catch (e) {
this.webgpu.supported = false;
}
try {
this.kernels = tfjs_esm_exports.getKernelsForBackend(tfjs_esm_exports.getBackend()).map((kernel) => kernel.kernelName.toLowerCase());
} catch (e) {
}
}
async updateCPU() {
const cpu = { model: "", flags: [] };
if (this.node && this.platform.startsWith("linux")) {
}
if (!this["cpu"])
Object.defineProperty(this, "cpu", { value: cpu });
else
this["cpu"] = cpu;
}
};
var env = new Env();
// package.json
var version10 = "2.5.4";
// src/gear/gear.ts
var model;
var last2 = [];
var raceNames = ["white", "black", "asian", "indian", "other"];
var ageWeights = [15, 23, 28, 35.5, 45.5, 55.5, 65];
var lastCount = 0;
var lastTime = 0;
var skipped = Number.MAX_SAFE_INTEGER;
async function load(config3) {
if (env.initial)
model = null;
if (!model) {
model = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.face["gear"].modelPath));
if (!model || !model["modelUrl"])
log("load model failed:", config3.face["gear"].modelPath);
else if (config3.debug)
log("load model:", model["modelUrl"]);
} else if (config3.debug)
log("cached model:", model["modelUrl"]);
return model;
}
async function predict(image29, config3, idx, count2) {
var _a, _b;
if (!model)
return { age: 0, gender: "unknown", genderScore: 0, race: [] };
const skipFrame = skipped < (((_a = config3.face["gear"]) == null ? void 0 : _a.skipFrames) || 0);
const skipTime = (((_b = config3.face["gear"]) == null ? void 0 : _b.skipTime) || 0) > now() - lastTime;
if (config3.skipAllowed && skipTime && skipFrame && lastCount === count2 && last2[idx]) {
skipped++;
return last2[idx];
}
skipped = 0;
return new Promise(async (resolve) => {
var _a2, _b2;
if (!(model == null ? void 0 : model.inputs[0].shape))
return;
const t = {};
const box4 = [[0, 0.1, 0.9, 0.9]];
t.resize = tfjs_esm_exports.image.cropAndResize(image29, box4, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]);
const obj = { age: 0, gender: "unknown", genderScore: 0, race: [] };
if ((_a2 = config3.face["gear"]) == null ? void 0 : _a2.enabled)
[t.age, t.gender, t.race] = model.execute(t.resize, ["age_output", "gender_output", "race_output"]);
const gender = await t.gender.data();
obj.gender = gender[0] > gender[1] ? "male" : "female";
obj.genderScore = Math.round(100 * (gender[0] > gender[1] ? gender[0] : gender[1])) / 100;
const race = await t.race.data();
for (let i = 0; i < race.length; i++) {
if (race[i] > (((_b2 = config3.face["gear"]) == null ? void 0 : _b2.minConfidence) || 0.2))
obj.race.push({ score: Math.round(100 * race[i]) / 100, race: raceNames[i] });
}
obj.race.sort((a, b) => b.score - a.score);
const ageDistribution = Array.from(await t.age.data());
const ageSorted = ageDistribution.map((a, i) => [ageWeights[i], a]).sort((a, b) => b[1] - a[1]);
let age = ageSorted[0][0];
for (let i = 1; i < ageSorted.length; i++)
age += ageSorted[i][1] * (ageSorted[i][0] - age);
obj.age = Math.round(10 * age) / 10;
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
last2[idx] = obj;
lastCount = count2;
lastTime = now();
resolve(obj);
});
}
// src/tfjs/constants.ts
var constants = {
tf255: 255,
tf1: 1,
tf2: 2,
tf05: 0.5,
tf127: 127.5,
rgb: [0.2989, 0.587, 0.114]
};
function init() {
constants.tf255 = tfjs_esm_exports.scalar(255, "float32");
constants.tf1 = tfjs_esm_exports.scalar(1, "float32");
constants.tf2 = tfjs_esm_exports.scalar(2, "float32");
constants.tf05 = tfjs_esm_exports.scalar(0.5, "float32");
constants.tf127 = tfjs_esm_exports.scalar(127.5, "float32");
constants.rgb = tfjs_esm_exports.tensor1d([0.2989, 0.587, 0.114], "float32");
}
// src/gear/ssrnet-age.ts
var model2;
var last3 = [];
var lastCount2 = 0;
var lastTime2 = 0;
var skipped2 = Number.MAX_SAFE_INTEGER;
async function load2(config3) {
if (env.initial)
model2 = null;
if (!model2) {
model2 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.face["ssrnet"].modelPathAge));
if (!model2 || !model2["modelUrl"])
log("load model failed:", config3.face["ssrnet"].modelPathAge);
else if (config3.debug)
log("load model:", model2["modelUrl"]);
} else {
if (config3.debug)
log("cached model:", model2["modelUrl"]);
}
return model2;
}
async function predict2(image29, config3, idx, count2) {
var _a, _b, _c, _d;
if (!model2)
return { age: 0 };
const skipFrame = skipped2 < (((_a = config3.face["ssrnet"]) == null ? void 0 : _a.skipFrames) || 0);
const skipTime = (((_b = config3.face["ssrnet"]) == null ? void 0 : _b.skipTime) || 0) > now() - lastTime2;
if (config3.skipAllowed && skipFrame && skipTime && lastCount2 === count2 && ((_c = last3[idx]) == null ? void 0 : _c.age) && ((_d = last3[idx]) == null ? void 0 : _d.age) > 0) {
skipped2++;
return last3[idx];
}
skipped2 = 0;
return new Promise(async (resolve) => {
if (!(model2 == null ? void 0 : model2.inputs) || !model2.inputs[0] || !model2.inputs[0].shape)
return;
const t = {};
t.resize = tfjs_esm_exports.image.resizeBilinear(image29, [model2.inputs[0].shape[2], model2.inputs[0].shape[1]], false);
t.enhance = tfjs_esm_exports.mul(t.resize, constants.tf255);
const obj = { age: 0 };
if (config3.face["ssrnet"].enabled)
t.age = model2.execute(t.enhance);
if (t.age) {
const data = await t.age.data();
obj.age = Math.trunc(10 * data[0]) / 10;
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
last3[idx] = obj;
lastCount2 = count2;
lastTime2 = now();
resolve(obj);
});
}
// src/gear/ssrnet-gender.ts
var model3;
var last4 = [];
var lastCount3 = 0;
var lastTime3 = 0;
var skipped3 = Number.MAX_SAFE_INTEGER;
var rgb = [0.2989, 0.587, 0.114];
async function load3(config3) {
if (env.initial)
model3 = null;
if (!model3) {
model3 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.face["ssrnet"].modelPathGender));
if (!model3 || !model3["modelUrl"])
log("load model failed:", config3.face["ssrnet"].modelPathGender);
else if (config3.debug)
log("load model:", model3["modelUrl"]);
} else if (config3.debug)
log("cached model:", model3["modelUrl"]);
return model3;
}
async function predict3(image29, config3, idx, count2) {
var _a, _b, _c, _d;
if (!model3)
return { gender: "unknown", genderScore: 0 };
const skipFrame = skipped3 < (((_a = config3.face["ssrnet"]) == null ? void 0 : _a.skipFrames) || 0);
const skipTime = (((_b = config3.face["ssrnet"]) == null ? void 0 : _b.skipTime) || 0) > now() - lastTime3;
if (config3.skipAllowed && skipFrame && skipTime && lastCount3 === count2 && ((_c = last4[idx]) == null ? void 0 : _c.gender) && ((_d = last4[idx]) == null ? void 0 : _d.genderScore) > 0) {
skipped3++;
return last4[idx];
}
skipped3 = 0;
return new Promise(async (resolve) => {
if (!(model3 == null ? void 0 : model3.inputs[0].shape))
return;
const t = {};
t.resize = tfjs_esm_exports.image.resizeBilinear(image29, [model3.inputs[0].shape[2], model3.inputs[0].shape[1]], false);
t.enhance = tfjs_esm_exports.tidy(() => {
const [red, green, blue] = tfjs_esm_exports.split(t.resize, 3, 3);
const redNorm = tfjs_esm_exports.mul(red, rgb[0]);
const greenNorm = tfjs_esm_exports.mul(green, rgb[1]);
const blueNorm = tfjs_esm_exports.mul(blue, rgb[2]);
const grayscale = tfjs_esm_exports.addN([redNorm, greenNorm, blueNorm]);
const normalize = tfjs_esm_exports.mul(tfjs_esm_exports.sub(grayscale, constants.tf05), 2);
return normalize;
});
const obj = { gender: "", genderScore: 0 };
if (config3.face["ssrnet"].enabled)
t.gender = model3.execute(t.enhance);
const data = await t.gender.data();
obj.gender = data[0] > data[1] ? "female" : "male";
obj.genderScore = data[0] > data[1] ? Math.trunc(100 * data[0]) / 100 : Math.trunc(100 * data[1]) / 100;
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
last4[idx] = obj;
lastCount3 = count2;
lastTime3 = now();
resolve(obj);
});
}
// src/face/antispoof.ts
var model4;
var cached = [];
var skipped4 = Number.MAX_SAFE_INTEGER;
var lastCount4 = 0;
var lastTime4 = 0;
async function load4(config3) {
var _a, _b;
if (env.initial)
model4 = null;
if (!model4) {
model4 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.face.antispoof) == null ? void 0 : _a.modelPath) || ""));
if (!model4 || !model4["modelUrl"])
log("load model failed:", (_b = config3.face.antispoof) == null ? void 0 : _b.modelPath);
else if (config3.debug)
log("load model:", model4["modelUrl"]);
} else if (config3.debug)
log("cached model:", model4["modelUrl"]);
return model4;
}
async function predict4(image29, config3, idx, count2) {
var _a, _b;
if (!model4)
return 0;
const skipTime = (((_a = config3.face.antispoof) == null ? void 0 : _a.skipTime) || 0) > now() - lastTime4;
const skipFrame = skipped4 < (((_b = config3.face.antispoof) == null ? void 0 : _b.skipFrames) || 0);
if (config3.skipAllowed && skipTime && skipFrame && lastCount4 === count2 && cached[idx]) {
skipped4++;
return cached[idx];
}
skipped4 = 0;
return new Promise(async (resolve) => {
const resize = tfjs_esm_exports.image.resizeBilinear(image29, [(model4 == null ? void 0 : model4.inputs[0].shape) ? model4.inputs[0].shape[2] : 0, (model4 == null ? void 0 : model4.inputs[0].shape) ? model4.inputs[0].shape[1] : 0], false);
const res = model4 == null ? void 0 : model4.execute(resize);
const num = (await res.data())[0];
cached[idx] = Math.round(100 * num) / 100;
lastCount4 = count2;
lastTime4 = now();
tfjs_esm_exports.dispose([resize, res]);
resolve(cached[idx]);
});
}
// src/face/facemeshcoords.ts
var meshAnnotations = {
silhouette: [
10,
338,
297,
332,
284,
251,
389,
356,
454,
323,
361,
288,
397,
365,
379,
378,
400,
377,
152,
148,
176,
149,
150,
136,
172,
58,
132,
93,
234,
127,
162,
21,
54,
103,
67,
109
],
lipsUpperOuter: [61, 185, 40, 39, 37, 0, 267, 269, 270, 409, 291],
lipsLowerOuter: [146, 91, 181, 84, 17, 314, 405, 321, 375, 291],
lipsUpperInner: [78, 191, 80, 81, 82, 13, 312, 311, 310, 415, 308],
lipsLowerInner: [78, 95, 88, 178, 87, 14, 317, 402, 318, 324, 308],
rightEyeUpper0: [246, 161, 160, 159, 158, 157, 173],
rightEyeLower0: [33, 7, 163, 144, 145, 153, 154, 155, 133],
rightEyeUpper1: [247, 30, 29, 27, 28, 56, 190],
rightEyeLower1: [130, 25, 110, 24, 23, 22, 26, 112, 243],
rightEyeUpper2: [113, 225, 224, 223, 222, 221, 189],
rightEyeLower2: [226, 31, 228, 229, 230, 231, 232, 233, 244],
rightEyeLower3: [143, 111, 117, 118, 119, 120, 121, 128, 245],
rightEyebrowUpper: [156, 70, 63, 105, 66, 107, 55, 193],
rightEyebrowLower: [35, 124, 46, 53, 52, 65],
rightEyeIris: [473, 474, 475, 476, 477],
leftEyeUpper0: [466, 388, 387, 386, 385, 384, 398],
leftEyeLower0: [263, 249, 390, 373, 374, 380, 381, 382, 362],
leftEyeUpper1: [467, 260, 259, 257, 258, 286, 414],
leftEyeLower1: [359, 255, 339, 254, 253, 252, 256, 341, 463],
leftEyeUpper2: [342, 445, 444, 443, 442, 441, 413],
leftEyeLower2: [446, 261, 448, 449, 450, 451, 452, 453, 464],
leftEyeLower3: [372, 340, 346, 347, 348, 349, 350, 357, 465],
leftEyebrowUpper: [383, 300, 293, 334, 296, 336, 285, 417],
leftEyebrowLower: [265, 353, 276, 283, 282, 295],
leftEyeIris: [468, 469, 470, 471, 472],
midwayBetweenEyes: [168],
noseTip: [1],
noseBottom: [2],
noseRightCorner: [98],
noseLeftCorner: [327],
rightCheek: [205],
leftCheek: [425]
};
var meshLandmarks = {
count: 468,
mouth: 13,
symmetryLine: [13, meshAnnotations["midwayBetweenEyes"][0]]
};
var blazeFaceLandmarks = {
leftEye: 0,
rightEye: 1,
nose: 2,
mouth: 3,
leftEar: 4,
rightEar: 5,
symmetryLine: [3, 2]
};
var MESH_TO_IRIS_INDICES_MAP = [
{ key: "EyeUpper0", indices: [9, 10, 11, 12, 13, 14, 15] },
{ key: "EyeUpper1", indices: [25, 26, 27, 28, 29, 30, 31] },
{ key: "EyeUpper2", indices: [41, 42, 43, 44, 45, 46, 47] },
{ key: "EyeLower0", indices: [0, 1, 2, 3, 4, 5, 6, 7, 8] },
{ key: "EyeLower1", indices: [16, 17, 18, 19, 20, 21, 22, 23, 24] },
{ key: "EyeLower2", indices: [32, 33, 34, 35, 36, 37, 38, 39, 40] },
{ key: "EyeLower3", indices: [54, 55, 56, 57, 58, 59, 60, 61, 62] }
];
var UV468 = [
[0.499976992607117, 0.652534008026123],
[0.500025987625122, 0.547487020492554],
[0.499974012374878, 0.602371990680695],
[0.482113003730774, 0.471979022026062],
[0.500150978565216, 0.527155995368958],
[0.499909996986389, 0.498252987861633],
[0.499523013830185, 0.40106201171875],
[0.289712011814117, 0.380764007568359],
[0.499954998493195, 0.312398016452789],
[0.499987006187439, 0.269918978214264],
[0.500023007392883, 0.107050001621246],
[0.500023007392883, 0.666234016418457],
[0.5000159740448, 0.679224014282227],
[0.500023007392883, 0.692348003387451],
[0.499976992607117, 0.695277988910675],
[0.499976992607117, 0.70593398809433],
[0.499976992607117, 0.719385027885437],
[0.499976992607117, 0.737019002437592],
[0.499967992305756, 0.781370997428894],
[0.499816000461578, 0.562981009483337],
[0.473773002624512, 0.573909997940063],
[0.104906998574734, 0.254140973091125],
[0.365929991006851, 0.409575998783112],
[0.338757991790771, 0.41302502155304],
[0.311120003461838, 0.409460008144379],
[0.274657994508743, 0.389131009578705],
[0.393361985683441, 0.403706014156342],
[0.345234006643295, 0.344011008739471],
[0.370094001293182, 0.346076011657715],
[0.319321990013123, 0.347265005111694],
[0.297903001308441, 0.353591024875641],
[0.24779200553894, 0.410809993743896],
[0.396889001131058, 0.842755019664764],
[0.280097991228104, 0.375599980354309],
[0.106310002505779, 0.399955987930298],
[0.2099249958992, 0.391353011131287],
[0.355807989835739, 0.534406006336212],
[0.471751004457474, 0.65040397644043],
[0.474155008792877, 0.680191993713379],
[0.439785003662109, 0.657229006290436],
[0.414617002010345, 0.66654098033905],
[0.450374007225037, 0.680860996246338],
[0.428770989179611, 0.682690978050232],
[0.374971002340317, 0.727805018424988],
[0.486716985702515, 0.547628998756409],
[0.485300987958908, 0.527395009994507],
[0.257764995098114, 0.314490020275116],
[0.401223003864288, 0.455172002315521],
[0.429818987846375, 0.548614978790283],
[0.421351999044418, 0.533740997314453],
[0.276895999908447, 0.532056987285614],
[0.483370006084442, 0.499586999416351],
[0.33721199631691, 0.282882988452911],
[0.296391993761063, 0.293242990970612],
[0.169294998049736, 0.193813979625702],
[0.447580009698868, 0.302609980106354],
[0.392390012741089, 0.353887975215912],
[0.354490011930466, 0.696784019470215],
[0.067304998636246, 0.730105042457581],
[0.442739009857178, 0.572826027870178],
[0.457098007202148, 0.584792017936707],
[0.381974011659622, 0.694710969924927],
[0.392388999462128, 0.694203019142151],
[0.277076005935669, 0.271932005882263],
[0.422551989555359, 0.563233017921448],
[0.385919004678726, 0.281364023685455],
[0.383103013038635, 0.255840003490448],
[0.331431001424789, 0.119714021682739],
[0.229923993349075, 0.232002973556519],
[0.364500999450684, 0.189113974571228],
[0.229622006416321, 0.299540996551514],
[0.173287004232407, 0.278747975826263],
[0.472878992557526, 0.666198015213013],
[0.446828007698059, 0.668527007102966],
[0.422762006521225, 0.673889994621277],
[0.445307999849319, 0.580065965652466],
[0.388103008270264, 0.693961024284363],
[0.403039008378983, 0.706539988517761],
[0.403629004955292, 0.693953037261963],
[0.460041999816895, 0.557139039039612],
[0.431158006191254, 0.692366003990173],
[0.452181994915009, 0.692366003990173],
[0.475387006998062, 0.692366003990173],
[0.465828001499176, 0.779190003871918],
[0.472328990697861, 0.736225962638855],
[0.473087012767792, 0.717857003211975],
[0.473122000694275, 0.704625964164734],
[0.473033010959625, 0.695277988910675],
[0.427942007780075, 0.695277988910675],
[0.426479011774063, 0.703539967536926],
[0.423162013292313, 0.711845993995667],
[0.4183090031147, 0.720062971115112],
[0.390094995498657, 0.639572978019714],
[0.013953999616206, 0.560034036636353],
[0.499913990497589, 0.58014702796936],
[0.413199990987778, 0.69539999961853],
[0.409626007080078, 0.701822996139526],
[0.468080013990402, 0.601534962654114],
[0.422728985548019, 0.585985004901886],
[0.463079988956451, 0.593783974647522],
[0.37211999297142, 0.47341400384903],
[0.334562003612518, 0.496073007583618],
[0.411671012639999, 0.546965003013611],
[0.242175996303558, 0.14767599105835],
[0.290776997804642, 0.201445996761322],
[0.327338010072708, 0.256527006626129],
[0.399509996175766, 0.748921036720276],
[0.441727995872498, 0.261676013469696],
[0.429764986038208, 0.187834024429321],
[0.412198007106781, 0.108901023864746],
[0.288955003023148, 0.398952007293701],
[0.218936994671822, 0.435410976409912],
[0.41278201341629, 0.398970007896423],
[0.257135003805161, 0.355440020561218],
[0.427684992551804, 0.437960982322693],
[0.448339998722076, 0.536936044692993],
[0.178560003638268, 0.45755398273468],
[0.247308000922203, 0.457193970680237],
[0.286267012357712, 0.467674970626831],
[0.332827985286713, 0.460712015628815],
[0.368755996227264, 0.447206974029541],
[0.398963987827301, 0.432654976844788],
[0.476410001516342, 0.405806005001068],
[0.189241006970406, 0.523923993110657],
[0.228962004184723, 0.348950982093811],
[0.490725994110107, 0.562400996685028],
[0.404670000076294, 0.485132992267609],
[0.019469000399113, 0.401564002037048],
[0.426243007183075, 0.420431017875671],
[0.396993011236191, 0.548797011375427],
[0.266469985246658, 0.376977026462555],
[0.439121007919312, 0.51895797252655],
[0.032313998788595, 0.644356966018677],
[0.419054001569748, 0.387154996395111],
[0.462783008813858, 0.505746960639954],
[0.238978996872902, 0.779744982719421],
[0.198220998048782, 0.831938028335571],
[0.107550002634525, 0.540755033493042],
[0.183610007166862, 0.740257024765015],
[0.134409993886948, 0.333683013916016],
[0.385764002799988, 0.883153975009918],
[0.490967005491257, 0.579378008842468],
[0.382384985685349, 0.508572995662689],
[0.174399003386497, 0.397670984268188],
[0.318785011768341, 0.39623498916626],
[0.343364000320435, 0.400596976280212],
[0.396100014448166, 0.710216999053955],
[0.187885001301765, 0.588537991046906],
[0.430987000465393, 0.944064974784851],
[0.318993002176285, 0.898285031318665],
[0.266247987747192, 0.869701027870178],
[0.500023007392883, 0.190576016902924],
[0.499976992607117, 0.954452991485596],
[0.366169989109039, 0.398822009563446],
[0.393207013607025, 0.39553701877594],
[0.410373002290726, 0.391080021858215],
[0.194993004202843, 0.342101991176605],
[0.388664990663528, 0.362284004688263],
[0.365961998701096, 0.355970978736877],
[0.343364000320435, 0.355356991291046],
[0.318785011768341, 0.35834002494812],
[0.301414996385574, 0.363156020641327],
[0.058132998645306, 0.319076001644135],
[0.301414996385574, 0.387449026107788],
[0.499987989664078, 0.618434011936188],
[0.415838003158569, 0.624195992946625],
[0.445681989192963, 0.566076993942261],
[0.465844005346298, 0.620640993118286],
[0.49992299079895, 0.351523995399475],
[0.288718998432159, 0.819945991039276],
[0.335278987884521, 0.852819979190826],
[0.440512001514435, 0.902418971061707],
[0.128294005990028, 0.791940987110138],
[0.408771991729736, 0.373893976211548],
[0.455606997013092, 0.451801002025604],
[0.499877005815506, 0.908990025520325],
[0.375436991453171, 0.924192011356354],
[0.11421000212431, 0.615022003650665],
[0.448662012815475, 0.695277988910675],
[0.4480200111866, 0.704632043838501],
[0.447111994028091, 0.715808033943176],
[0.444831997156143, 0.730794012546539],
[0.430011987686157, 0.766808986663818],
[0.406787008047104, 0.685672998428345],
[0.400738000869751, 0.681069016456604],
[0.392399996519089, 0.677703022956848],
[0.367855995893478, 0.663918972015381],
[0.247923001646996, 0.601333022117615],
[0.452769994735718, 0.420849978923798],
[0.43639200925827, 0.359887003898621],
[0.416164010763168, 0.368713974952698],
[0.413385987281799, 0.692366003990173],
[0.228018000721931, 0.683571994304657],
[0.468268007040024, 0.352671027183533],
[0.411361992359161, 0.804327011108398],
[0.499989002943039, 0.469825029373169],
[0.479153990745544, 0.442654013633728],
[0.499974012374878, 0.439637005329132],
[0.432112008333206, 0.493588984012604],
[0.499886006116867, 0.866917014122009],
[0.49991300702095, 0.821729004383087],
[0.456548988819122, 0.819200992584229],
[0.344549000263214, 0.745438992977142],
[0.37890899181366, 0.574010014533997],
[0.374292999505997, 0.780184984207153],
[0.319687992334366, 0.570737957954407],
[0.357154995203018, 0.604269981384277],
[0.295284003019333, 0.621580958366394],
[0.447750002145767, 0.862477004528046],
[0.410986006259918, 0.508723020553589],
[0.31395098567009, 0.775308012962341],
[0.354128003120422, 0.812552988529205],
[0.324548006057739, 0.703992962837219],
[0.189096003770828, 0.646299958229065],
[0.279776990413666, 0.71465802192688],
[0.1338230073452, 0.682700991630554],
[0.336768001317978, 0.644733011722565],
[0.429883986711502, 0.466521978378296],
[0.455527991056442, 0.548622965812683],
[0.437114000320435, 0.558896005153656],
[0.467287987470627, 0.529924988746643],
[0.414712011814117, 0.335219979286194],
[0.37704598903656, 0.322777986526489],
[0.344107985496521, 0.320150971412659],
[0.312875986099243, 0.32233202457428],
[0.283526003360748, 0.333190023899078],
[0.241245999932289, 0.382785975933075],
[0.102986000478268, 0.468762993812561],
[0.267612010240555, 0.424560010433197],
[0.297879010438919, 0.433175981044769],
[0.333433985710144, 0.433878004550934],
[0.366427004337311, 0.426115989685059],
[0.396012008190155, 0.416696012020111],
[0.420121014118195, 0.41022801399231],
[0.007561000064015, 0.480777025222778],
[0.432949006557465, 0.569517970085144],
[0.458638995885849, 0.479089021682739],
[0.473466008901596, 0.545744001865387],
[0.476087987422943, 0.563830018043518],
[0.468472003936768, 0.555056989192963],
[0.433990985155106, 0.582361996173859],
[0.483518004417419, 0.562983989715576],
[0.482482999563217, 0.57784903049469],
[0.42645001411438, 0.389798998832703],
[0.438998997211456, 0.39649498462677],
[0.450067013502121, 0.400434017181396],
[0.289712011814117, 0.368252992630005],
[0.276670008897781, 0.363372981548309],
[0.517862021923065, 0.471948027610779],
[0.710287988185883, 0.380764007568359],
[0.526226997375488, 0.573909997940063],
[0.895093023777008, 0.254140973091125],
[0.634069979190826, 0.409575998783112],
[0.661242008209229, 0.41302502155304],
[0.688880026340485, 0.409460008144379],
[0.725341975688934, 0.389131009578705],
[0.606630027294159, 0.40370500087738],
[0.654766023159027, 0.344011008739471],
[0.629905998706818, 0.346076011657715],
[0.680678009986877, 0.347265005111694],
[0.702096998691559, 0.353591024875641],
[0.75221198797226, 0.410804986953735],
[0.602918028831482, 0.842862963676453],
[0.719901978969574, 0.375599980354309],
[0.893692970275879, 0.399959981441498],
[0.790081977844238, 0.391354024410248],
[0.643998026847839, 0.534487962722778],
[0.528249025344849, 0.65040397644043],
[0.525849997997284, 0.680191040039062],
[0.560214996337891, 0.657229006290436],
[0.585384011268616, 0.66654098033905],
[0.549625992774963, 0.680860996246338],
[0.57122802734375, 0.682691991329193],
[0.624852001667023, 0.72809898853302],
[0.513050019741058, 0.547281980514526],
[0.51509702205658, 0.527251958847046],
[0.742246985435486, 0.314507007598877],
[0.598631024360657, 0.454979002475739],
[0.570338010787964, 0.548575043678284],
[0.578631997108459, 0.533622980117798],
[0.723087012767792, 0.532054007053375],
[0.516445994377136, 0.499638974666595],
[0.662801027297974, 0.282917976379395],
[0.70362401008606, 0.293271005153656],
[0.830704987049103, 0.193813979625702],
[0.552385985851288, 0.302568018436432],
[0.607609987258911, 0.353887975215912],
[0.645429015159607, 0.696707010269165],
[0.932694971561432, 0.730105042457581],
[0.557260990142822, 0.572826027870178],
[0.542901992797852, 0.584792017936707],
[0.6180260181427, 0.694710969924927],
[0.607590973377228, 0.694203019142151],
[0.722943007946014, 0.271963000297546],
[0.577413976192474, 0.563166975975037],
[0.614082992076874, 0.281386971473694],
[0.616907000541687, 0.255886018276215],
[0.668509006500244, 0.119913995265961],
[0.770092010498047, 0.232020974159241],
[0.635536015033722, 0.189248979091644],
[0.77039098739624, 0.299556016921997],
[0.826722025871277, 0.278755009174347],
[0.527121007442474, 0.666198015213013],
[0.553171992301941, 0.668527007102966],
[0.577238023281097, 0.673889994621277],
[0.554691970348358, 0.580065965652466],
[0.611896991729736, 0.693961024284363],
[0.59696102142334, 0.706539988517761],
[0.596370995044708, 0.693953037261963],
[0.539958000183105, 0.557139039039612],
[0.568841993808746, 0.692366003990173],
[0.547818005084991, 0.692366003990173],
[0.52461302280426, 0.692366003990173],
[0.534089982509613, 0.779141008853912],
[0.527670979499817, 0.736225962638855],
[0.526912987232208, 0.717857003211975],
[0.526877999305725, 0.704625964164734],
[0.526966989040375, 0.695277988910675],
[0.572058022022247, 0.695277988910675],
[0.573521018028259, 0.703539967536926],
[0.57683801651001, 0.711845993995667],
[0.581691026687622, 0.720062971115112],
[0.609944999217987, 0.639909982681274],
[0.986046016216278, 0.560034036636353],
[0.5867999792099, 0.69539999961853],
[0.590372025966644, 0.701822996139526],
[0.531915009021759, 0.601536989212036],
[0.577268004417419, 0.585934996604919],
[0.536915004253387, 0.593786001205444],
[0.627542972564697, 0.473352015018463],
[0.665585994720459, 0.495950996875763],
[0.588353991508484, 0.546862006187439],
[0.757824003696442, 0.14767599105835],
[0.709249973297119, 0.201507985591888],
[0.672684013843536, 0.256581008434296],
[0.600408971309662, 0.74900496006012],
[0.55826598405838, 0.261672019958496],
[0.570303976535797, 0.187870979309082],
[0.588165998458862, 0.109044015407562],
[0.711045026779175, 0.398952007293701],
[0.781069993972778, 0.435405015945435],
[0.587247014045715, 0.398931980133057],
[0.742869973182678, 0.355445981025696],
[0.572156012058258, 0.437651991844177],
[0.55186802148819, 0.536570012569427],
[0.821442008018494, 0.457556009292603],
[0.752701997756958, 0.457181990146637],
[0.71375697851181, 0.467626988887787],
[0.66711300611496, 0.460672974586487],
[0.631101012229919, 0.447153985500336],
[0.6008620262146, 0.432473003864288],
[0.523481011390686, 0.405627012252808],
[0.810747981071472, 0.523926019668579],
[0.771045982837677, 0.348959028720856],
[0.509127020835876, 0.562718033790588],
[0.595292985439301, 0.485023975372314],
[0.980530977249146, 0.401564002037048],
[0.573499977588654, 0.420000016689301],
[0.602994978427887, 0.548687994480133],
[0.733529984951019, 0.376977026462555],
[0.560611009597778, 0.519016981124878],
[0.967685997486115, 0.644356966018677],
[0.580985009670258, 0.387160003185272],
[0.537728011608124, 0.505385041236877],
[0.760966002941132, 0.779752969741821],
[0.801778972148895, 0.831938028335571],
[0.892440974712372, 0.54076099395752],
[0.816350996494293, 0.740260004997253],
[0.865594983100891, 0.333687007427216],
[0.614073991775513, 0.883246004581451],
[0.508952975273132, 0.579437971115112],
[0.617941975593567, 0.508316040039062],
[0.825608015060425, 0.397674977779388],
[0.681214988231659, 0.39623498916626],
[0.656635999679565, 0.400596976280212],
[0.603900015354156, 0.710216999053955],
[0.81208598613739, 0.588539004325867],
[0.56801301240921, 0.944564998149872],
[0.681007981300354, 0.898285031318665],
[0.733752012252808, 0.869701027870178],
[0.633830010890961, 0.398822009563446],
[0.606792986392975, 0.39553701877594],
[0.589659988880157, 0.391062021255493],
[0.805015981197357, 0.342108011245728],
[0.611334979534149, 0.362284004688263],
[0.634037971496582, 0.355970978736877],
[0.656635999679565, 0.355356991291046],
[0.681214988231659, 0.35834002494812],
[0.698584973812103, 0.363156020641327],
[0.941866993904114, 0.319076001644135],
[0.698584973812103, 0.387449026107788],
[0.584177017211914, 0.624107003211975],
[0.554318010807037, 0.566076993942261],
[0.534153997898102, 0.62064003944397],
[0.711217999458313, 0.819975018501282],
[0.664629995822906, 0.852871000766754],
[0.559099972248077, 0.902631998062134],
[0.871706008911133, 0.791940987110138],
[0.591234028339386, 0.373893976211548],
[0.544341027736664, 0.451583981513977],
[0.624562978744507, 0.924192011356354],
[0.88577002286911, 0.615028977394104],
[0.551338016986847, 0.695277988910675],
[0.551980018615723, 0.704632043838501],
[0.552887976169586, 0.715808033943176],
[0.555167973041534, 0.730794012546539],
[0.569944024085999, 0.767035007476807],
[0.593203008174896, 0.685675978660583],
[0.599261999130249, 0.681069016456604],
[0.607599973678589, 0.677703022956848],
[0.631937980651855, 0.663500010967255],
[0.752032995223999, 0.601315021514893],
[0.547226011753082, 0.420395016670227],
[0.563543975353241, 0.359827995300293],
[0.583841025829315, 0.368713974952698],
[0.586614012718201, 0.692366003990173],
[0.771915018558502, 0.683578014373779],
[0.531597018241882, 0.352482974529266],
[0.588370978832245, 0.804440975189209],
[0.52079701423645, 0.442565023899078],
[0.567984998226166, 0.493479013442993],
[0.543282985687256, 0.819254994392395],
[0.655317008495331, 0.745514988899231],
[0.621008992195129, 0.574018001556396],
[0.625559985637665, 0.78031200170517],
[0.680198013782501, 0.570719003677368],
[0.64276397228241, 0.604337990283966],
[0.704662978649139, 0.621529996395111],
[0.552012026309967, 0.862591981887817],
[0.589071989059448, 0.508637011051178],
[0.685944974422455, 0.775357007980347],
[0.645735025405884, 0.812640011310577],
[0.675342977046967, 0.703978002071381],
[0.810858011245728, 0.646304965019226],
[0.72012197971344, 0.714666962623596],
[0.866151988506317, 0.682704985141754],
[0.663187026977539, 0.644596993923187],
[0.570082008838654, 0.466325998306274],
[0.544561982154846, 0.548375964164734],
[0.562758982181549, 0.558784961700439],
[0.531987011432648, 0.530140042304993],
[0.585271000862122, 0.335177004337311],
[0.622952997684479, 0.32277899980545],
[0.655896008014679, 0.320163011550903],
[0.687132000923157, 0.322345972061157],
[0.716481983661652, 0.333200991153717],
[0.758756995201111, 0.382786989212036],
[0.897013008594513, 0.468769013881683],
[0.732392013072968, 0.424547016620636],
[0.70211398601532, 0.433162987232208],
[0.66652500629425, 0.433866024017334],
[0.633504986763, 0.426087975502014],
[0.603875994682312, 0.416586995124817],
[0.579657971858978, 0.409945011138916],
[0.992439985275269, 0.480777025222778],
[0.567192018032074, 0.569419980049133],
[0.54136598110199, 0.478899002075195],
[0.526564002037048, 0.546118021011353],
[0.523913025856018, 0.563830018043518],
[0.531529009342194, 0.555056989192963],
[0.566035985946655, 0.582329034805298],
[0.51631098985672, 0.563053965568542],
[0.5174720287323, 0.577877044677734],
[0.573594987392426, 0.389806985855103],
[0.560697972774506, 0.395331978797913],
[0.549755990505219, 0.399751007556915],
[0.710287988185883, 0.368252992630005],
[0.723330020904541, 0.363372981548309]
];
var TRI468 = [
127,
34,
139,
11,
0,
37,
232,
231,
120,
72,
37,
39,
128,
121,
47,
232,
121,
128,
104,
69,
67,
175,
171,
148,
157,
154,
155,
118,
50,
101,
73,
39,
40,
9,
151,
108,
48,
115,
131,
194,
204,
211,
74,
40,
185,
80,
42,
183,
40,
92,
186,
230,
229,
118,
202,
212,
214,
83,
18,
17,
76,
61,
146,
160,
29,
30,
56,
157,
173,
106,
204,
194,
135,
214,
192,
203,
165,
98,
21,
71,
68,
51,
45,
4,
144,
24,
23,
77,
146,
91,
205,
50,
187,
201,
200,
18,
91,
106,
182,
90,
91,
181,
85,
84,
17,
206,
203,
36,
148,
171,
140,
92,
40,
39,
193,
189,
244,
159,
158,
28,
247,
246,
161,
236,
3,
196,
54,
68,
104,
193,
168,
8,
117,
228,
31,
189,
193,
55,
98,
97,
99,
126,
47,
100,
166,
79,
218,
155,
154,
26,
209,
49,
131,
135,
136,
150,
47,
126,
217,
223,
52,
53,
45,
51,
134,
211,
170,
140,
67,
69,
108,
43,
106,
91,
230,
119,
120,
226,
130,
247,
63,
53,
52,
238,
20,
242,
46,
70,
156,
78,
62,
96,
46,
53,
63,
143,
34,
227,
173,
155,
133,
123,
117,
111,
44,
125,
19,
236,
134,
51,
216,
206,
205,
154,
153,
22,
39,
37,
167,
200,
201,
208,
36,
142,
100,
57,
212,
202,
20,
60,
99,
28,
158,
157,
35,
226,
113,
160,
159,
27,
204,
202,
210,
113,
225,
46,
43,
202,
204,
62,
76,
77,
137,
123,
116,
41,
38,
72,
203,
129,
142,
64,
98,
240,
49,
102,
64,
41,
73,
74,
212,
216,
207,
42,
74,
184,
169,
170,
211,
170,
149,
176,
105,
66,
69,
122,
6,
168,
123,
147,
187,
96,
77,
90,
65,
55,
107,
89,
90,
180,
101,
100,
120,
63,
105,
104,
93,
137,
227,
15,
86,
85,
129,
102,
49,
14,
87,
86,
55,
8,
9,
100,
47,
121,
145,
23,
22,
88,
89,
179,
6,
122,
196,
88,
95,
96,
138,
172,
136,
215,
58,
172,
115,
48,
219,
42,
80,
81,
195,
3,
51,
43,
146,
61,
171,
175,
199,
81,
82,
38,
53,
46,
225,
144,
163,
110,
246,
33,
7,
52,
65,
66,
229,
228,
117,
34,
127,
234,
107,
108,
69,
109,
108,
151,
48,
64,
235,
62,
78,
191,
129,
209,
126,
111,
35,
143,
163,
161,
246,
117,
123,
50,
222,
65,
52,
19,
125,
141,
221,
55,
65,
3,
195,
197,
25,
7,
33,
220,
237,
44,
70,
71,
139,
122,
193,
245,
247,
130,
33,
71,
21,
162,
153,
158,
159,
170,
169,
150,
188,
174,
196,
216,
186,
92,
144,
160,
161,
2,
97,
167,
141,
125,
241,
164,
167,
37,
72,
38,
12,
145,
159,
160,
38,
82,
13,
63,
68,
71,
226,
35,
111,
158,
153,
154,
101,
50,
205,
206,
92,
165,
209,
198,
217,
165,
167,
97,
220,
115,
218,
133,
112,
243,
239,
238,
241,
214,
135,
169,
190,
173,
133,
171,
208,
32,
125,
44,
237,
86,
87,
178,
85,
86,
179,
84,
85,
180,
83,
84,
181,
201,
83,
182,
137,
93,
132,
76,
62,
183,
61,
76,
184,
57,
61,
185,
212,
57,
186,
214,
207,
187,
34,
143,
156,
79,
239,
237,
123,
137,
177,
44,
1,
4,
201,
194,
32,
64,
102,
129,
213,
215,
138,
59,
166,
219,
242,
99,
97,
2,
94,
141,
75,
59,
235,
24,
110,
228,
25,
130,
226,
23,
24,
229,
22,
23,
230,
26,
22,
231,
112,
26,
232,
189,
190,
243,
221,
56,
190,
28,
56,
221,
27,
28,
222,
29,
27,
223,
30,
29,
224,
247,
30,
225,
238,
79,
20,
166,
59,
75,
60,
75,
240,
147,
177,
215,
20,
79,
166,
187,
147,
213,
112,
233,
244,
233,
128,
245,
128,
114,
188,
114,
217,
174,
131,
115,
220,
217,
198,
236,
198,
131,
134,
177,
132,
58,
143,
35,
124,
110,
163,
7,
228,
110,
25,
356,
389,
368,
11,
302,
267,
452,
350,
349,
302,
303,
269,
357,
343,
277,
452,
453,
357,
333,
332,
297,
175,
152,
377,
384,
398,
382,
347,
348,
330,
303,
304,
270,
9,
336,
337,
278,
279,
360,
418,
262,
431,
304,
408,
409,
310,
415,
407,
270,
409,
410,
450,
348,
347,
422,
430,
434,
313,
314,
17,
306,
307,
375,
387,
388,
260,
286,
414,
398,
335,
406,
418,
364,
367,
416,
423,
358,
327,
251,
284,
298,
281,
5,
4,
373,
374,
253,
307,
320,
321,
425,
427,
411,
421,
313,
18,
321,
405,
406,
320,
404,
405,
315,
16,
17,
426,
425,
266,
377,
400,
369,
322,
391,
269,
417,
465,
464,
386,
257,
258,
466,
260,
388,
456,
399,
419,
284,
332,
333,
417,
285,
8,
346,
340,
261,
413,
441,
285,
327,
460,
328,
355,
371,
329,
392,
439,
438,
382,
341,
256,
429,
420,
360,
364,
394,
379,
277,
343,
437,
443,
444,
283,
275,
440,
363,
431,
262,
369,
297,
338,
337,
273,
375,
321,
450,
451,
349,
446,
342,
467,
293,
334,
282,
458,
461,
462,
276,
353,
383,
308,
324,
325,
276,
300,
293,
372,
345,
447,
382,
398,
362,
352,
345,
340,
274,
1,
19,
456,
248,
281,
436,
427,
425,
381,
256,
252,
269,
391,
393,
200,
199,
428,
266,
330,
329,
287,
273,
422,
250,
462,
328,
258,
286,
384,
265,
353,
342,
387,
259,
257,
424,
431,
430,
342,
353,
276,
273,
335,
424,
292,
325,
307,
366,
447,
345,
271,
303,
302,
423,
266,
371,
294,
455,
460,
279,
278,
294,
271,
272,
304,
432,
434,
427,
272,
407,
408,
394,
430,
431,
395,
369,
400,
334,
333,
299,
351,
417,
168,
352,
280,
411,
325,
319,
320,
295,
296,
336,
319,
403,
404,
330,
348,
349,
293,
298,
333,
323,
454,
447,
15,
16,
315,
358,
429,
279,
14,
15,
316,
285,
336,
9,
329,
349,
350,
374,
380,
252,
318,
402,
403,
6,
197,
419,
318,
319,
325,
367,
364,
365,
435,
367,
397,
344,
438,
439,
272,
271,
311,
195,
5,
281,
273,
287,
291,
396,
428,
199,
311,
271,
268,
283,
444,
445,
373,
254,
339,
263,
466,
249,
282,
334,
296,
449,
347,
346,
264,
447,
454,
336,
296,
299,
338,
10,
151,
278,
439,
455,
292,
407,
415,
358,
371,
355,
340,
345,
372,
390,
249,
466,
346,
347,
280,
442,
443,
282,
19,
94,
370,
441,
442,
295,
248,
419,
197,
263,
255,
359,
440,
275,
274,
300,
383,
368,
351,
412,
465,
263,
467,
466,
301,
368,
389,
380,
374,
386,
395,
378,
379,
412,
351,
419,
436,
426,
322,
373,
390,
388,
2,
164,
393,
370,
462,
461,
164,
0,
267,
302,
11,
12,
374,
373,
387,
268,
12,
13,
293,
300,
301,
446,
261,
340,
385,
384,
381,
330,
266,
425,
426,
423,
391,
429,
355,
437,
391,
327,
326,
440,
457,
438,
341,
382,
362,
459,
457,
461,
434,
430,
394,
414,
463,
362,
396,
369,
262,
354,
461,
457,
316,
403,
402,
315,
404,
403,
314,
405,
404,
313,
406,
405,
421,
418,
406,
366,
401,
361,
306,
408,
407,
291,
409,
408,
287,
410,
409,
432,
436,
410,
434,
416,
411,
264,
368,
383,
309,
438,
457,
352,
376,
401,
274,
275,
4,
421,
428,
262,
294,
327,
358,
433,
416,
367,
289,
455,
439,
462,
370,
326,
2,
326,
370,
305,
460,
455,
254,
449,
448,
255,
261,
446,
253,
450,
449,
252,
451,
450,
256,
452,
451,
341,
453,
452,
413,
464,
463,
441,
413,
414,
258,
442,
441,
257,
443,
442,
259,
444,
443,
260,
445,
444,
467,
342,
445,
459,
458,
250,
289,
392,
290,
290,
328,
460,
376,
433,
435,
250,
290,
392,
411,
416,
433,
341,
463,
464,
453,
464,
465,
357,
465,
412,
343,
412,
399,
360,
363,
440,
437,
399,
456,
420,
456,
363,
401,
435,
288,
372,
383,
353,
339,
255,
249,
448,
261,
255,
133,
243,
190,
133,
155,
112,
33,
246,
247,
33,
130,
25,
398,
384,
286,
362,
398,
414,
362,
463,
341,
263,
359,
467,
263,
249,
255,
466,
467,
260,
75,
60,
166,
238,
239,
79,
162,
127,
139,
72,
11,
37,
121,
232,
120,
73,
72,
39,
114,
128,
47,
233,
232,
128,
103,
104,
67,
152,
175,
148,
173,
157,
155,
119,
118,
101,
74,
73,
40,
107,
9,
108,
49,
48,
131,
32,
194,
211,
184,
74,
185,
191,
80,
183,
185,
40,
186,
119,
230,
118,
210,
202,
214,
84,
83,
17,
77,
76,
146,
161,
160,
30,
190,
56,
173,
182,
106,
194,
138,
135,
192,
129,
203,
98,
54,
21,
68,
5,
51,
4,
145,
144,
23,
90,
77,
91,
207,
205,
187,
83,
201,
18,
181,
91,
182,
180,
90,
181,
16,
85,
17,
205,
206,
36,
176,
148,
140,
165,
92,
39,
245,
193,
244,
27,
159,
28,
30,
247,
161,
174,
236,
196,
103,
54,
104,
55,
193,
8,
111,
117,
31,
221,
189,
55,
240,
98,
99,
142,
126,
100,
219,
166,
218,
112,
155,
26,
198,
209,
131,
169,
135,
150,
114,
47,
217,
224,
223,
53,
220,
45,
134,
32,
211,
140,
109,
67,
108,
146,
43,
91,
231,
230,
120,
113,
226,
247,
105,
63,
52,
241,
238,
242,
124,
46,
156,
95,
78,
96,
70,
46,
63,
116,
143,
227,
116,
123,
111,
1,
44,
19,
3,
236,
51,
207,
216,
205,
26,
154,
22,
165,
39,
167,
199,
200,
208,
101,
36,
100,
43,
57,
202,
242,
20,
99,
56,
28,
157,
124,
35,
113,
29,
160,
27,
211,
204,
210,
124,
113,
46,
106,
43,
204,
96,
62,
77,
227,
137,
116,
73,
41,
72,
36,
203,
142,
235,
64,
240,
48,
49,
64,
42,
41,
74,
214,
212,
207,
183,
42,
184,
210,
169,
211,
140,
170,
176,
104,
105,
69,
193,
122,
168,
50,
123,
187,
89,
96,
90,
66,
65,
107,
179,
89,
180,
119,
101,
120,
68,
63,
104,
234,
93,
227,
16,
15,
85,
209,
129,
49,
15,
14,
86,
107,
55,
9,
120,
100,
121,
153,
145,
22,
178,
88,
179,
197,
6,
196,
89,
88,
96,
135,
138,
136,
138,
215,
172,
218,
115,
219,
41,
42,
81,
5,
195,
51,
57,
43,
61,
208,
171,
199,
41,
81,
38,
224,
53,
225,
24,
144,
110,
105,
52,
66,
118,
229,
117,
227,
34,
234,
66,
107,
69,
10,
109,
151,
219,
48,
235,
183,
62,
191,
142,
129,
126,
116,
111,
143,
7,
163,
246,
118,
117,
50,
223,
222,
52,
94,
19,
141,
222,
221,
65,
196,
3,
197,
45,
220,
44,
156,
70,
139,
188,
122,
245,
139,
71,
162,
145,
153,
159,
149,
170,
150,
122,
188,
196,
206,
216,
92,
163,
144,
161,
164,
2,
167,
242,
141,
241,
0,
164,
37,
11,
72,
12,
144,
145,
160,
12,
38,
13,
70,
63,
71,
31,
226,
111,
157,
158,
154,
36,
101,
205,
203,
206,
165,
126,
209,
217,
98,
165,
97,
237,
220,
218,
237,
239,
241,
210,
214,
169,
140,
171,
32,
241,
125,
237,
179,
86,
178,
180,
85,
179,
181,
84,
180,
182,
83,
181,
194,
201,
182,
177,
137,
132,
184,
76,
183,
185,
61,
184,
186,
57,
185,
216,
212,
186,
192,
214,
187,
139,
34,
156,
218,
79,
237,
147,
123,
177,
45,
44,
4,
208,
201,
32,
98,
64,
129,
192,
213,
138,
235,
59,
219,
141,
242,
97,
97,
2,
141,
240,
75,
235,
229,
24,
228,
31,
25,
226,
230,
23,
229,
231,
22,
230,
232,
26,
231,
233,
112,
232,
244,
189,
243,
189,
221,
190,
222,
28,
221,
223,
27,
222,
224,
29,
223,
225,
30,
224,
113,
247,
225,
99,
60,
240,
213,
147,
215,
60,
20,
166,
192,
187,
213,
243,
112,
244,
244,
233,
245,
245,
128,
188,
188,
114,
174,
134,
131,
220,
174,
217,
236,
236,
198,
134,
215,
177,
58,
156,
143,
124,
25,
110,
7,
31,
228,
25,
264,
356,
368,
0,
11,
267,
451,
452,
349,
267,
302,
269,
350,
357,
277,
350,
452,
357,
299,
333,
297,
396,
175,
377,
381,
384,
382,
280,
347,
330,
269,
303,
270,
151,
9,
337,
344,
278,
360,
424,
418,
431,
270,
304,
409,
272,
310,
407,
322,
270,
410,
449,
450,
347,
432,
422,
434,
18,
313,
17,
291,
306,
375,
259,
387,
260,
424,
335,
418,
434,
364,
416,
391,
423,
327,
301,
251,
298,
275,
281,
4,
254,
373,
253,
375,
307,
321,
280,
425,
411,
200,
421,
18,
335,
321,
406,
321,
320,
405,
314,
315,
17,
423,
426,
266,
396,
377,
369,
270,
322,
269,
413,
417,
464,
385,
386,
258,
248,
456,
419,
298,
284,
333,
168,
417,
8,
448,
346,
261,
417,
413,
285,
326,
327,
328,
277,
355,
329,
309,
392,
438,
381,
382,
256,
279,
429,
360,
365,
364,
379,
355,
277,
437,
282,
443,
283,
281,
275,
363,
395,
431,
369,
299,
297,
337,
335,
273,
321,
348,
450,
349,
359,
446,
467,
283,
293,
282,
250,
458,
462,
300,
276,
383,
292,
308,
325,
283,
276,
293,
264,
372,
447,
346,
352,
340,
354,
274,
19,
363,
456,
281,
426,
436,
425,
380,
381,
252,
267,
269,
393,
421,
200,
428,
371,
266,
329,
432,
287,
422,
290,
250,
328,
385,
258,
384,
446,
265,
342,
386,
387,
257,
422,
424,
430,
445,
342,
276,
422,
273,
424,
306,
292,
307,
352,
366,
345,
268,
271,
302,
358,
423,
371,
327,
294,
460,
331,
279,
294,
303,
271,
304,
436,
432,
427,
304,
272,
408,
395,
394,
431,
378,
395,
400,
296,
334,
299,
6,
351,
168,
376,
352,
411,
307,
325,
320,
285,
295,
336,
320,
319,
404,
329,
330,
349,
334,
293,
333,
366,
323,
447,
316,
15,
315,
331,
358,
279,
317,
14,
316,
8,
285,
9,
277,
329,
350,
253,
374,
252,
319,
318,
403,
351,
6,
419,
324,
318,
325,
397,
367,
365,
288,
435,
397,
278,
344,
439,
310,
272,
311,
248,
195,
281,
375,
273,
291,
175,
396,
199,
312,
311,
268,
276,
283,
445,
390,
373,
339,
295,
282,
296,
448,
449,
346,
356,
264,
454,
337,
336,
299,
337,
338,
151,
294,
278,
455,
308,
292,
415,
429,
358,
355,
265,
340,
372,
388,
390,
466,
352,
346,
280,
295,
442,
282,
354,
19,
370,
285,
441,
295,
195,
248,
197,
457,
440,
274,
301,
300,
368,
417,
351,
465,
251,
301,
389,
385,
380,
386,
394,
395,
379,
399,
412,
419,
410,
436,
322,
387,
373,
388,
326,
2,
393,
354,
370,
461,
393,
164,
267,
268,
302,
12,
386,
374,
387,
312,
268,
13,
298,
293,
301,
265,
446,
340,
380,
385,
381,
280,
330,
425,
322,
426,
391,
420,
429,
437,
393,
391,
326,
344,
440,
438,
458,
459,
461,
364,
434,
394,
428,
396,
262,
274,
354,
457,
317,
316,
402,
316,
315,
403,
315,
314,
404,
314,
313,
405,
313,
421,
406,
323,
366,
361,
292,
306,
407,
306,
291,
408,
291,
287,
409,
287,
432,
410,
427,
434,
411,
372,
264,
383,
459,
309,
457,
366,
352,
401,
1,
274,
4,
418,
421,
262,
331,
294,
358,
435,
433,
367,
392,
289,
439,
328,
462,
326,
94,
2,
370,
289,
305,
455,
339,
254,
448,
359,
255,
446,
254,
253,
449,
253,
252,
450,
252,
256,
451,
256,
341,
452,
414,
413,
463,
286,
441,
414,
286,
258,
441,
258,
257,
442,
257,
259,
443,
259,
260,
444,
260,
467,
445,
309,
459,
250,
305,
289,
290,
305,
290,
460,
401,
376,
435,
309,
250,
392,
376,
411,
433,
453,
341,
464,
357,
453,
465,
343,
357,
412,
437,
343,
399,
344,
360,
440,
420,
437,
456,
360,
420,
363,
361,
401,
288,
265,
372,
353,
390,
339,
249,
339,
448,
255
];
var VTX68 = [
127,
234,
132,
58,
172,
150,
149,
148,
152,
377,
378,
379,
397,
288,
361,
454,
356,
70,
63,
105,
66,
107,
336,
296,
334,
293,
300,
168,
6,
195,
4,
98,
97,
2,
326,
327,
33,
160,
158,
133,
153,
144,
362,
385,
387,
263,
373,
380,
57,
40,
37,
0,
267,
270,
287,
321,
314,
17,
84,
91,
78,
81,
13,
311,
308,
402,
14,
178
];
var VTX33 = [33, 133, 362, 263, 1, 62, 308, 159, 145, 386, 374, 6, 102, 331, 2, 13, 14, 70, 105, 107, 336, 334, 300, 54, 10, 284, 50, 280, 234, 454, 58, 288, 152];
var VTX7 = [33, 133, 362, 263, 1, 78, 308];
var UV68 = VTX68.map((x) => UV468[x]);
var UV33 = VTX33.map((x) => UV468[x]);
var UV7 = VTX7.map((x) => UV468[x]);
// src/face/facemeshutil.ts
var getBoxSize = (box4) => [Math.abs(box4.endPoint[0] - box4.startPoint[0]), Math.abs(box4.endPoint[1] - box4.startPoint[1])];
var getBoxCenter = (box4) => [box4.startPoint[0] + (box4.endPoint[0] - box4.startPoint[0]) / 2, box4.startPoint[1] + (box4.endPoint[1] - box4.startPoint[1]) / 2];
var getClampedBox = (box4, input) => box4 ? [
Math.trunc(Math.max(0, box4.startPoint[0])),
Math.trunc(Math.max(0, box4.startPoint[1])),
Math.trunc(Math.min(input.shape[2] || 0, box4.endPoint[0]) - Math.max(0, box4.startPoint[0])),
Math.trunc(Math.min(input.shape[1] || 0, box4.endPoint[1]) - Math.max(0, box4.startPoint[1]))
] : [0, 0, 0, 0];
var getRawBox = (box4, input) => box4 ? [
box4.startPoint[0] / (input.shape[2] || 0),
box4.startPoint[1] / (input.shape[1] || 0),
(box4.endPoint[0] - box4.startPoint[0]) / (input.shape[2] || 0),
(box4.endPoint[1] - box4.startPoint[1]) / (input.shape[1] || 0)
] : [0, 0, 0, 0];
var scaleBoxCoordinates = (box4, factor) => {
const startPoint = [box4.startPoint[0] * factor[0], box4.startPoint[1] * factor[1]];
const endPoint = [box4.endPoint[0] * factor[0], box4.endPoint[1] * factor[1]];
return { startPoint, endPoint, landmarks: box4.landmarks, confidence: box4.confidence };
};
var cutBoxFromImageAndResize = (box4, image29, cropSize) => {
const h = image29.shape[1];
const w = image29.shape[2];
const crop2 = tfjs_esm_exports.image.cropAndResize(image29, [[box4.startPoint[1] / h, box4.startPoint[0] / w, box4.endPoint[1] / h, box4.endPoint[0] / w]], [0], cropSize);
const norm = tfjs_esm_exports.div(crop2, constants.tf255);
tfjs_esm_exports.dispose(crop2);
return norm;
};
var enlargeBox = (box4, factor) => {
const center = getBoxCenter(box4);
const size2 = getBoxSize(box4);
const halfSize = [factor * size2[0] / 2, factor * size2[1] / 2];
return { startPoint: [center[0] - halfSize[0], center[1] - halfSize[1]], endPoint: [center[0] + halfSize[0], center[1] + halfSize[1]], landmarks: box4.landmarks, confidence: box4.confidence };
};
var squarifyBox = (box4) => {
const centers = getBoxCenter(box4);
const size2 = getBoxSize(box4);
const halfSize = Math.max(...size2) / 2;
return { startPoint: [Math.round(centers[0] - halfSize), Math.round(centers[1] - halfSize)], endPoint: [Math.round(centers[0] + halfSize), Math.round(centers[1] + halfSize)], landmarks: box4.landmarks, confidence: box4.confidence };
};
var calculateLandmarksBoundingBox = (landmarks) => {
const xs = landmarks.map((d) => d[0]);
const ys = landmarks.map((d) => d[1]);
return { startPoint: [Math.min(...xs), Math.min(...ys)], endPoint: [Math.max(...xs), Math.max(...ys)], landmarks };
};
var fixedRotationMatrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];
var normalizeRadians = (angle) => angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));
var computeRotation = (point1, point2) => normalizeRadians(Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]));
var buildTranslationMatrix = (x, y) => [[1, 0, x], [0, 1, y], [0, 0, 1]];
var dot = (v1, v2) => {
let product = 0;
for (let i = 0; i < v1.length; i++)
product += v1[i] * v2[i];
return product;
};
var getColumnFrom2DArr = (arr, columnIndex) => {
const column = [];
for (let i = 0; i < arr.length; i++)
column.push(arr[i][columnIndex]);
return column;
};
var multiplyTransformMatrices = (mat1, mat2) => {
const product = [];
const size2 = mat1.length;
for (let row = 0; row < size2; row++) {
product.push([]);
for (let col = 0; col < size2; col++)
product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));
}
return product;
};
var buildRotationMatrix = (rotation, center) => {
const cosA = Math.cos(rotation);
const sinA = Math.sin(rotation);
const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];
const translationMatrix = buildTranslationMatrix(center[0], center[1]);
const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);
const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);
return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);
};
var invertTransformMatrix = (matrix) => {
const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];
const translationComponent = [matrix[0][2], matrix[1][2]];
const invertedTranslation = [-dot(rotationComponent[0], translationComponent), -dot(rotationComponent[1], translationComponent)];
return [rotationComponent[0].concat(invertedTranslation[0]), rotationComponent[1].concat(invertedTranslation[1]), [0, 0, 1]];
};
var rotatePoint = (homogeneousCoordinate, rotationMatrix) => [dot(homogeneousCoordinate, rotationMatrix[0]), dot(homogeneousCoordinate, rotationMatrix[1])];
function generateAnchors(inputSize9) {
const spec = { strides: [inputSize9 / 16, inputSize9 / 8], anchors: [2, 6] };
const anchors4 = [];
for (let i = 0; i < spec.strides.length; i++) {
const stride = spec.strides[i];
const gridRows = Math.floor((inputSize9 + stride - 1) / stride);
const gridCols = Math.floor((inputSize9 + stride - 1) / stride);
const anchorsNum = spec.anchors[i];
for (let gridY = 0; gridY < gridRows; gridY++) {
const anchorY = stride * (gridY + 0.5);
for (let gridX = 0; gridX < gridCols; gridX++) {
const anchorX = stride * (gridX + 0.5);
for (let n = 0; n < anchorsNum; n++)
anchors4.push([anchorX, anchorY]);
}
}
}
return anchors4;
}
function transformRawCoords(coordsRaw, box4, angle, rotationMatrix, inputSize9) {
const boxSize = getBoxSize(box4);
const coordsScaled = coordsRaw.map((coord) => [
boxSize[0] / inputSize9 * (coord[0] - inputSize9 / 2),
boxSize[1] / inputSize9 * (coord[1] - inputSize9 / 2),
coord[2] || 0
]);
const largeAngle = angle && angle !== 0 && Math.abs(angle) > 0.2;
const coordsRotationMatrix = largeAngle ? buildRotationMatrix(angle, [0, 0]) : fixedRotationMatrix;
const coordsRotated = largeAngle ? coordsScaled.map((coord) => [...rotatePoint(coord, coordsRotationMatrix), coord[2]]) : coordsScaled;
const inverseRotationMatrix = largeAngle ? invertTransformMatrix(rotationMatrix) : fixedRotationMatrix;
const boxCenter = [...getBoxCenter({ startPoint: box4.startPoint, endPoint: box4.endPoint }), 1];
return coordsRotated.map((coord) => [
Math.round(coord[0] + dot(boxCenter, inverseRotationMatrix[0])),
Math.round(coord[1] + dot(boxCenter, inverseRotationMatrix[1])),
Math.round(coord[2] || 0)
]);
}
function correctFaceRotation(rotate, box4, input, inputSize9) {
const symmetryLine = box4.landmarks.length >= meshLandmarks.count ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;
let angle = 0;
let rotationMatrix = fixedRotationMatrix;
let face5;
if (rotate && env.kernels.includes("rotatewithoffset")) {
angle = computeRotation(box4.landmarks[symmetryLine[0]], box4.landmarks[symmetryLine[1]]);
const largeAngle = angle && angle !== 0 && Math.abs(angle) > 0.2;
if (largeAngle) {
const center = getBoxCenter({ startPoint: box4.startPoint, endPoint: box4.endPoint });
const centerRaw = [center[0] / input.shape[2], center[1] / input.shape[1]];
const rotated = tfjs_esm_exports.image.rotateWithOffset(input, angle, 0, centerRaw);
rotationMatrix = buildRotationMatrix(-angle, center);
face5 = cutBoxFromImageAndResize(box4, rotated, [inputSize9, inputSize9]);
tfjs_esm_exports.dispose(rotated);
} else {
face5 = cutBoxFromImageAndResize(box4, input, [inputSize9, inputSize9]);
}
} else {
face5 = cutBoxFromImageAndResize(box4, input, [inputSize9, inputSize9]);
}
return [angle, rotationMatrix, face5];
}
// src/face/blazeface.ts
var keypointsCount = 6;
var model5;
var anchors = null;
var inputSize = 0;
var inputSizeT = null;
var size = () => inputSize;
async function load5(config3) {
var _a, _b;
if (env.initial)
model5 = null;
if (!model5) {
model5 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.face.detector) == null ? void 0 : _a.modelPath) || ""));
if (!model5 || !model5["modelUrl"])
log("load model failed:", (_b = config3.face.detector) == null ? void 0 : _b.modelPath);
else if (config3.debug)
log("load model:", model5["modelUrl"]);
} else if (config3.debug)
log("cached model:", model5["modelUrl"]);
inputSize = model5.inputs[0].shape ? model5.inputs[0].shape[2] : 0;
inputSizeT = tfjs_esm_exports.scalar(inputSize, "int32");
anchors = tfjs_esm_exports.tensor2d(generateAnchors(inputSize));
return model5;
}
function decodeBounds(boxOutputs) {
const t = {};
t.boxStarts = tfjs_esm_exports.slice(boxOutputs, [0, 1], [-1, 2]);
t.centers = tfjs_esm_exports.add(t.boxStarts, anchors);
t.boxSizes = tfjs_esm_exports.slice(boxOutputs, [0, 3], [-1, 2]);
t.boxSizesNormalized = tfjs_esm_exports.div(t.boxSizes, inputSizeT);
t.centersNormalized = tfjs_esm_exports.div(t.centers, inputSizeT);
t.halfBoxSize = tfjs_esm_exports.div(t.boxSizesNormalized, constants.tf2);
t.starts = tfjs_esm_exports.sub(t.centersNormalized, t.halfBoxSize);
t.ends = tfjs_esm_exports.add(t.centersNormalized, t.halfBoxSize);
t.startNormalized = tfjs_esm_exports.mul(t.starts, inputSizeT);
t.endNormalized = tfjs_esm_exports.mul(t.ends, inputSizeT);
const boxes = tfjs_esm_exports.concat2d([t.startNormalized, t.endNormalized], 1);
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return boxes;
}
async function getBoxes(inputImage, config3) {
var _a, _b, _c, _d;
if (!inputImage || inputImage["isDisposedInternal"] || inputImage.shape.length !== 4 || inputImage.shape[1] < 1 || inputImage.shape[2] < 1)
return { boxes: [] };
const t = {};
t.resized = tfjs_esm_exports.image.resizeBilinear(inputImage, [inputSize, inputSize]);
t.div = tfjs_esm_exports.div(t.resized, constants.tf127);
t.normalized = tfjs_esm_exports.sub(t.div, constants.tf05);
const res = model5 == null ? void 0 : model5.execute(t.normalized);
if (Array.isArray(res)) {
const sorted = res.sort((a, b) => a.size - b.size);
t.concat384 = tfjs_esm_exports.concat([sorted[0], sorted[2]], 2);
t.concat512 = tfjs_esm_exports.concat([sorted[1], sorted[3]], 2);
t.concat = tfjs_esm_exports.concat([t.concat512, t.concat384], 1);
t.batch = tfjs_esm_exports.squeeze(t.concat, 0);
} else {
t.batch = tfjs_esm_exports.squeeze(res);
}
tfjs_esm_exports.dispose(res);
t.boxes = decodeBounds(t.batch);
t.logits = tfjs_esm_exports.slice(t.batch, [0, 0], [-1, 1]);
t.sigmoid = tfjs_esm_exports.sigmoid(t.logits);
t.scores = tfjs_esm_exports.squeeze(t.sigmoid);
t.nms = await tfjs_esm_exports.image.nonMaxSuppressionAsync(t.boxes, t.scores, ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || 0, ((_b = config3.face.detector) == null ? void 0 : _b.iouThreshold) || 0, ((_c = config3.face.detector) == null ? void 0 : _c.minConfidence) || 0);
const nms = await t.nms.array();
const boxes = [];
const scores = await t.scores.data();
for (let i = 0; i < nms.length; i++) {
const confidence = scores[nms[i]];
if (confidence > (((_d = config3.face.detector) == null ? void 0 : _d.minConfidence) || 0)) {
const b = {};
b.bbox = tfjs_esm_exports.slice(t.boxes, [nms[i], 0], [1, -1]);
b.slice = tfjs_esm_exports.slice(t.batch, [nms[i], keypointsCount - 1], [1, -1]);
b.squeeze = tfjs_esm_exports.squeeze(b.slice);
b.landmarks = tfjs_esm_exports.reshape(b.squeeze, [keypointsCount, -1]);
const points = await b.bbox.data();
boxes.push({
box: {
startPoint: [points[0], points[1]],
endPoint: [points[2], points[3]]
},
landmarks: await b.landmarks.array(),
confidence
});
Object.keys(b).forEach((tensor3) => tfjs_esm_exports.dispose(b[tensor3]));
}
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return { boxes, scaleFactor: [inputImage.shape[2] / inputSize, inputImage.shape[1] / inputSize] };
}
// src/body/blazeposecoords.ts
var blazeposecoords_exports = {};
__export(blazeposecoords_exports, {
connected: () => connected,
kpt: () => kpt
});
var kpt = [
"nose",
"leftEyeInside",
"leftEye",
"leftEyeOutside",
"rightEyeInside",
"rightEye",
"rightEyeOutside",
"leftEar",
"rightEar",
"leftMouth",
"rightMouth",
"leftShoulder",
"rightShoulder",
"leftElbow",
"rightElbow",
"leftWrist",
"rightWrist",
"leftPinky",
"rightPinky",
"leftIndex",
"rightIndex",
"leftThumb",
"rightThumb",
"leftHip",
"rightHip",
"leftKnee",
"rightKnee",
"leftAnkle",
"rightAnkle",
"leftHeel",
"rightHeel",
"leftFoot",
"rightFoot",
"bodyCenter",
"bodyTop",
"leftPalm",
"leftHand",
"rightPalm",
"rightHand"
];
var connected = {
leftLeg: ["leftHip", "leftKnee", "leftAnkle", "leftHeel", "leftFoot"],
rightLeg: ["rightHip", "rightKnee", "rightAnkle", "rightHeel", "rightFoot"],
torso: ["leftShoulder", "rightShoulder", "rightHip", "leftHip", "leftShoulder", "rightShoulder"],
leftArm: ["leftShoulder", "leftElbow", "leftWrist", "leftPalm"],
rightArm: ["rightShoulder", "rightElbow", "rightWrist", "rightPalm"],
leftEye: ["leftEyeInside", "leftEye", "leftEyeOutside"],
rightEye: ["rightEyeInside", "rightEye", "rightEyeOutside"],
mouth: ["leftMouth", "rightMouth"]
};
// src/body/blazeposedetector.ts
var inputSize2 = 224;
var anchorTensor;
var numLayers = 5;
var strides = [8, 16, 32, 32, 32];
async function createAnchors() {
const anchors4 = [];
let layerId = 0;
while (layerId < numLayers) {
let anchorCount = 0;
let lastSameStrideLayer = layerId;
while (lastSameStrideLayer < strides.length && strides[lastSameStrideLayer] === strides[layerId]) {
anchorCount += 2;
lastSameStrideLayer++;
}
const stride = strides[layerId];
const featureMapHeight = Math.ceil(inputSize2 / stride);
const featureMapWidth = Math.ceil(inputSize2 / stride);
for (let y = 0; y < featureMapHeight; ++y) {
for (let x = 0; x < featureMapWidth; ++x) {
for (let anchorId = 0; anchorId < anchorCount; ++anchorId) {
anchors4.push({ x: (x + 0.5) / featureMapWidth, y: (y + 0.5) / featureMapHeight });
}
}
}
layerId = lastSameStrideLayer;
}
anchorTensor = { x: tfjs_esm_exports.tensor1d(anchors4.map((a) => a.x)), y: tfjs_esm_exports.tensor1d(anchors4.map((a) => a.y)) };
}
var cropFactor = [5, 5];
function decodeBoxes(boxesTensor, anchor) {
return tfjs_esm_exports.tidy(() => {
const split5 = tfjs_esm_exports.split(boxesTensor, 12, 1);
let xCenter = tfjs_esm_exports.squeeze(split5[0]);
let yCenter = tfjs_esm_exports.squeeze(split5[1]);
let width = tfjs_esm_exports.squeeze(split5[2]);
let height = tfjs_esm_exports.squeeze(split5[3]);
xCenter = tfjs_esm_exports.add(tfjs_esm_exports.div(xCenter, inputSize2), anchor.x);
yCenter = tfjs_esm_exports.add(tfjs_esm_exports.div(yCenter, inputSize2), anchor.y);
width = tfjs_esm_exports.mul(tfjs_esm_exports.div(width, inputSize2), cropFactor[0]);
height = tfjs_esm_exports.mul(tfjs_esm_exports.div(height, inputSize2), cropFactor[1]);
const xMin = tfjs_esm_exports.sub(xCenter, tfjs_esm_exports.div(width, 2));
const yMin = tfjs_esm_exports.sub(yCenter, tfjs_esm_exports.div(height, 2));
const boxes = tfjs_esm_exports.stack([xMin, yMin, width, height], 1);
return boxes;
});
}
async function decode(boxesTensor, logitsTensor, config3, outputSize2) {
const t = {};
t.boxes = decodeBoxes(boxesTensor, anchorTensor);
t.scores = tfjs_esm_exports.sigmoid(logitsTensor);
t.argmax = tfjs_esm_exports.argMax(t.scores);
const i = (await t.argmax.data())[0];
const scores = await t.scores.data();
const detected = [];
const minScore = config3.body["detector"] && config3.body["detector"]["minConfidence"] ? config3.body["detector"]["minConfidence"] : 0;
if (scores[i] >= minScore) {
const boxes = await t.boxes.array();
const boxRaw = boxes[i];
const box4 = [boxRaw[0] * outputSize2[0], boxRaw[1] * outputSize2[1], boxRaw[2] * outputSize2[0], boxRaw[3] * outputSize2[1]];
detected.push({ box: box4, boxRaw, score: scores[i] });
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return detected;
}
// src/body/blazepose.ts
var env3 = { initial: true };
var models = { detector: null, landmarks: null };
var inputSize3 = { detector: [224, 224], landmarks: [256, 256] };
var skipped5 = Number.MAX_SAFE_INTEGER;
var outputNodes = {
landmarks: ["ld_3d", "activation_segmentation", "activation_heatmap", "world_3d", "output_poseflag"],
detector: []
};
var cache = null;
var lastBox;
var padding = [[0, 0], [0, 0], [0, 0], [0, 0]];
var lastTime5 = 0;
var sigmoid3 = (x) => 1 - 1 / (1 + Math.exp(x));
async function loadDetect(config3) {
if (env3.initial)
models.detector = null;
if (!models.detector && config3.body["detector"] && config3.body["detector"]["modelPath"] || "") {
models.detector = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body["detector"]["modelPath"] || ""));
const inputs = Object.values(models.detector.modelSignature["inputs"]);
inputSize3.detector[0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize3.detector[1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
if (!models.detector || !models.detector["modelUrl"])
log("load model failed:", config3.body["detector"]["modelPath"]);
else if (config3.debug)
log("load model:", models.detector["modelUrl"]);
} else if (config3.debug && models.detector)
log("cached model:", models.detector["modelUrl"]);
await createAnchors();
return models.detector;
}
async function loadPose(config3) {
if (env3.initial)
models.landmarks = null;
if (!models.landmarks) {
models.landmarks = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
const inputs = Object.values(models.landmarks.modelSignature["inputs"]);
inputSize3.landmarks[0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize3.landmarks[1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
if (!models.landmarks || !models.landmarks["modelUrl"])
log("load model failed:", config3.body.modelPath);
else if (config3.debug)
log("load model:", models.landmarks["modelUrl"]);
} else if (config3.debug)
log("cached model:", models.landmarks["modelUrl"]);
return models.landmarks;
}
function calculateBoxes(keypoints, outputSize2) {
const x = keypoints.map((a) => a.position[0]);
const y = keypoints.map((a) => a.position[1]);
const keypointsBox = [Math.min(...x), Math.min(...y), Math.max(...x) - Math.min(...x), Math.max(...y) - Math.min(...y)];
const keypointsBoxRaw = [keypointsBox[0] / outputSize2[0], keypointsBox[1] / outputSize2[1], keypointsBox[2] / outputSize2[0], keypointsBox[3] / outputSize2[1]];
return { keypointsBox, keypointsBoxRaw };
}
async function prepareImage(input, size2, box4) {
const t = {};
if (!input.shape || !input.shape[1] || !input.shape[2])
return input;
let final;
if (input.shape[1] !== input.shape[2]) {
const height = box4 ? [Math.trunc(input.shape[1] * box4[1]), Math.trunc(input.shape[1] * (box4[1] + box4[3]))] : [input.shape[2] > input.shape[1] ? Math.trunc((input.shape[2] - input.shape[1]) / 2) : 0, input.shape[2] > input.shape[1] ? Math.trunc((input.shape[2] - input.shape[1]) / 2) : 0];
const width = box4 ? [Math.trunc(input.shape[2] * box4[0]), Math.trunc(input.shape[2] * (box4[0] + box4[2]))] : [input.shape[1] > input.shape[2] ? Math.trunc((input.shape[1] - input.shape[2]) / 2) : 0, input.shape[1] > input.shape[2] ? Math.trunc((input.shape[1] - input.shape[2]) / 2) : 0];
padding = [
[0, 0],
height,
width,
[0, 0]
];
if (box4) {
t.resize = tfjs_esm_exports.image.cropAndResize(input, [box4], [0], [size2, size2]);
} else {
t.pad = tfjs_esm_exports.pad(input, padding);
t.resize = tfjs_esm_exports.image.resizeBilinear(t.pad, [size2, size2]);
}
final = tfjs_esm_exports.div(t.resize, constants.tf255);
} else if (input.shape[1] !== size2) {
t.resize = tfjs_esm_exports.image.resizeBilinear(input, [size2, size2]);
final = tfjs_esm_exports.div(t.resize, constants.tf255);
} else {
final = tfjs_esm_exports.div(input, constants.tf255);
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return final;
}
function rescaleKeypoints(keypoints, outputSize2) {
for (const kpt4 of keypoints) {
kpt4.position = [
Math.trunc(kpt4.position[0] * (outputSize2[0] + padding[2][0] + padding[2][1]) / outputSize2[0] - padding[2][0]),
Math.trunc(kpt4.position[1] * (outputSize2[1] + padding[1][0] + padding[1][1]) / outputSize2[1] - padding[1][0]),
kpt4.position[2]
];
kpt4.positionRaw = [kpt4.position[0] / outputSize2[0], kpt4.position[1] / outputSize2[1], kpt4.position[2]];
}
return keypoints;
}
function rescaleBoxes(boxes, outputSize2) {
for (const box4 of boxes) {
box4.box = [
Math.trunc(box4.box[0] * (outputSize2[0] + padding[2][0] + padding[2][1]) / outputSize2[0]),
Math.trunc(box4.box[1] * (outputSize2[1] + padding[1][0] + padding[1][1]) / outputSize2[1]),
Math.trunc(box4.box[2] * (outputSize2[0] + padding[2][0] + padding[2][1]) / outputSize2[0]),
Math.trunc(box4.box[3] * (outputSize2[1] + padding[1][0] + padding[1][1]) / outputSize2[1])
];
box4.boxRaw = [box4.box[0] / outputSize2[0], box4.box[1] / outputSize2[1], box4.box[2] / outputSize2[0], box4.box[3] / outputSize2[1]];
}
return boxes;
}
async function detectLandmarks(input, config3, outputSize2) {
var _a;
const t = {};
[t.ld, t.segmentation, t.heatmap, t.world, t.poseflag] = (_a = models.landmarks) == null ? void 0 : _a.execute(input, outputNodes.landmarks);
const poseScore = (await t.poseflag.data())[0];
const points = await t.ld.data();
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
const keypointsRelative = [];
const depth = 5;
for (let i = 0; i < points.length / depth; i++) {
const score = sigmoid3(points[depth * i + 3]);
const presence = sigmoid3(points[depth * i + 4]);
const adjScore = Math.trunc(100 * score * presence * poseScore) / 100;
const positionRaw = [points[depth * i + 0] / inputSize3.landmarks[0], points[depth * i + 1] / inputSize3.landmarks[1], points[depth * i + 2] + 0];
const position = [Math.trunc(outputSize2[0] * positionRaw[0]), Math.trunc(outputSize2[1] * positionRaw[1]), positionRaw[2]];
keypointsRelative.push({ part: kpt[i], positionRaw, position, score: adjScore });
}
if (poseScore < (config3.body.minConfidence || 0))
return null;
const keypoints = rescaleKeypoints(keypointsRelative, outputSize2);
const boxes = calculateBoxes(keypoints, [outputSize2[0], outputSize2[1]]);
const annotations2 = {};
for (const [name, indexes] of Object.entries(connected)) {
const pt = [];
for (let i = 0; i < indexes.length - 1; i++) {
const pt0 = keypoints.find((kpt4) => kpt4.part === indexes[i]);
const pt1 = keypoints.find((kpt4) => kpt4.part === indexes[i + 1]);
if (pt0 && pt1)
pt.push([pt0.position, pt1.position]);
}
annotations2[name] = pt;
}
const body4 = { id: 0, score: Math.trunc(100 * poseScore) / 100, box: boxes.keypointsBox, boxRaw: boxes.keypointsBoxRaw, keypoints, annotations: annotations2 };
return body4;
}
async function detectBoxes(input, config3, outputSize2) {
var _a;
const t = {};
t.res = (_a = models.detector) == null ? void 0 : _a.execute(input, ["Identity"]);
t.logitsRaw = tfjs_esm_exports.slice(t.res, [0, 0, 0], [1, -1, 1]);
t.boxesRaw = tfjs_esm_exports.slice(t.res, [0, 0, 1], [1, -1, -1]);
t.logits = tfjs_esm_exports.squeeze(t.logitsRaw);
t.boxes = tfjs_esm_exports.squeeze(t.boxesRaw);
const boxes = await decode(t.boxes, t.logits, config3, outputSize2);
rescaleBoxes(boxes, outputSize2);
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return boxes;
}
async function predict5(input, config3) {
const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
const skipTime = (config3.body.skipTime || 0) > now() - lastTime5;
const skipFrame = skipped5 < (config3.body.skipFrames || 0);
if (config3.skipAllowed && skipTime && skipFrame && cache !== null) {
skipped5++;
} else {
const t = {};
if (config3.body["detector"] && config3.body["detector"]["enabled"]) {
t.detector = await prepareImage(input, 224);
const boxes = await detectBoxes(t.detector, config3, outputSize2);
if (boxes && boxes.length === 1) {
t.landmarks = await prepareImage(input, 256, boxes[0].box);
cache = await detectLandmarks(t.landmarks, config3, outputSize2);
}
if (cache)
cache.score = boxes[0].score;
} else {
t.landmarks = await prepareImage(input, 256, lastBox);
cache = await detectLandmarks(t.landmarks, config3, outputSize2);
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
lastTime5 = now();
skipped5 = 0;
}
if (cache)
return [cache];
return [];
}
// src/object/labels.ts
var labels = [
{ class: 1, label: "person" },
{ class: 2, label: "bicycle" },
{ class: 3, label: "car" },
{ class: 4, label: "motorcycle" },
{ class: 5, label: "airplane" },
{ class: 6, label: "bus" },
{ class: 7, label: "train" },
{ class: 8, label: "truck" },
{ class: 9, label: "boat" },
{ class: 10, label: "traffic light" },
{ class: 11, label: "fire hydrant" },
{ class: 12, label: "stop sign" },
{ class: 13, label: "parking meter" },
{ class: 14, label: "bench" },
{ class: 15, label: "bird" },
{ class: 16, label: "cat" },
{ class: 17, label: "dog" },
{ class: 18, label: "horse" },
{ class: 19, label: "sheep" },
{ class: 20, label: "cow" },
{ class: 21, label: "elephant" },
{ class: 22, label: "bear" },
{ class: 23, label: "zebra" },
{ class: 24, label: "giraffe" },
{ class: 25, label: "backpack" },
{ class: 26, label: "umbrella" },
{ class: 27, label: "handbag" },
{ class: 28, label: "tie" },
{ class: 29, label: "suitcase" },
{ class: 30, label: "frisbee" },
{ class: 31, label: "skis" },
{ class: 32, label: "snowboard" },
{ class: 33, label: "sports ball" },
{ class: 34, label: "kite" },
{ class: 35, label: "baseball bat" },
{ class: 36, label: "baseball glove" },
{ class: 37, label: "skateboard" },
{ class: 38, label: "surfboard" },
{ class: 39, label: "tennis racket" },
{ class: 40, label: "bottle" },
{ class: 41, label: "wine glass" },
{ class: 42, label: "cup" },
{ class: 43, label: "fork" },
{ class: 44, label: "knife" },
{ class: 45, label: "spoon" },
{ class: 46, label: "bowl" },
{ class: 47, label: "banana" },
{ class: 48, label: "apple" },
{ class: 49, label: "sandwich" },
{ class: 50, label: "orange" },
{ class: 51, label: "broccoli" },
{ class: 52, label: "carrot" },
{ class: 53, label: "hot dog" },
{ class: 54, label: "pizza" },
{ class: 55, label: "donut" },
{ class: 56, label: "cake" },
{ class: 57, label: "chair" },
{ class: 58, label: "couch" },
{ class: 59, label: "potted plant" },
{ class: 60, label: "bed" },
{ class: 61, label: "dining table" },
{ class: 62, label: "toilet" },
{ class: 63, label: "tv" },
{ class: 64, label: "laptop" },
{ class: 65, label: "mouse" },
{ class: 66, label: "remote" },
{ class: 67, label: "keyboard" },
{ class: 68, label: "cell phone" },
{ class: 69, label: "microwave" },
{ class: 70, label: "oven" },
{ class: 71, label: "toaster" },
{ class: 72, label: "sink" },
{ class: 73, label: "refrigerator" },
{ class: 74, label: "book" },
{ class: 75, label: "clock" },
{ class: 76, label: "vase" },
{ class: 77, label: "scissors" },
{ class: 78, label: "teddy bear" },
{ class: 79, label: "hair drier" },
{ class: 80, label: "toothbrush" }
];
// src/object/centernet.ts
var model6;
var inputSize4 = 0;
var last5 = [];
var lastTime6 = 0;
var skipped6 = Number.MAX_SAFE_INTEGER;
async function load6(config3) {
if (env.initial)
model6 = null;
if (!model6) {
model6 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
const inputs = Object.values(model6.modelSignature["inputs"]);
inputSize4 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
if (!model6 || !model6["modelUrl"])
log("load model failed:", config3.object.modelPath);
else if (config3.debug)
log("load model:", model6["modelUrl"]);
} else if (config3.debug)
log("cached model:", model6["modelUrl"]);
return model6;
}
async function process3(res, outputShape, config3) {
if (!res)
return [];
const t = {};
const results = [];
const detections = await res.array();
t.squeeze = tfjs_esm_exports.squeeze(res);
const arr = tfjs_esm_exports.split(t.squeeze, 6, 1);
t.stack = tfjs_esm_exports.stack([arr[1], arr[0], arr[3], arr[2]], 1);
t.boxes = tfjs_esm_exports.squeeze(t.stack);
t.scores = tfjs_esm_exports.squeeze(arr[4]);
t.classes = tfjs_esm_exports.squeeze(arr[5]);
tfjs_esm_exports.dispose([res, ...arr]);
t.nms = await tfjs_esm_exports.image.nonMaxSuppressionAsync(t.boxes, t.scores, config3.object.maxDetected, config3.object.iouThreshold, config3.object.minConfidence);
const nms = await t.nms.data();
let i = 0;
for (const id of Array.from(nms)) {
const score = Math.trunc(100 * detections[0][id][4]) / 100;
const classVal = detections[0][id][5];
const label = labels[classVal].label;
const [x, y] = [
detections[0][id][0] / inputSize4,
detections[0][id][1] / inputSize4
];
const boxRaw = [
x,
y,
detections[0][id][2] / inputSize4 - x,
detections[0][id][3] / inputSize4 - y
];
const box4 = [
Math.trunc(boxRaw[0] * outputShape[0]),
Math.trunc(boxRaw[1] * outputShape[1]),
Math.trunc(boxRaw[2] * outputShape[0]),
Math.trunc(boxRaw[3] * outputShape[1])
];
results.push({ id: i++, score, class: classVal, label, box: box4, boxRaw });
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return results;
}
async function predict6(input, config3) {
const skipTime = (config3.object.skipTime || 0) > now() - lastTime6;
const skipFrame = skipped6 < (config3.object.skipFrames || 0);
if (config3.skipAllowed && skipTime && skipFrame && last5.length > 0) {
skipped6++;
return last5;
}
skipped6 = 0;
return new Promise(async (resolve) => {
const outputSize2 = [input.shape[2], input.shape[1]];
const resize = tfjs_esm_exports.image.resizeBilinear(input, [inputSize4, inputSize4]);
const objectT = config3.object.enabled ? model6 == null ? void 0 : model6.execute(resize, ["tower_0/detections"]) : null;
lastTime6 = now();
tfjs_esm_exports.dispose(resize);
const obj = await process3(objectT, outputSize2, config3);
last5 = obj;
resolve(obj);
});
}
// src/body/efficientposecoords.ts
var efficientposecoords_exports = {};
__export(efficientposecoords_exports, {
connected: () => connected2,
kpt: () => kpt2
});
var kpt2 = [
"head",
"neck",
"rightShoulder",
"rightElbow",
"rightWrist",
"chest",
"leftShoulder",
"leftElbow",
"leftWrist",
"bodyCenter",
"rightHip",
"rightKnee",
"rightAnkle",
"leftHip",
"leftKnee",
"leftAnkle"
];
var connected2 = {
leftLeg: ["leftHip", "leftKnee", "leftAnkle"],
rightLeg: ["rightHip", "rightKnee", "rightAnkle"],
torso: ["leftShoulder", "rightShoulder", "rightHip", "leftHip", "leftShoulder"],
leftArm: ["leftShoulder", "leftElbow", "leftWrist"],
rightArm: ["rightShoulder", "rightElbow", "rightWrist"],
head: []
};
// src/body/efficientpose.ts
var model7;
var lastTime7 = 0;
var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} };
var skipped7 = Number.MAX_SAFE_INTEGER;
async function load7(config3) {
if (env.initial)
model7 = null;
if (!model7) {
model7 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
if (!model7 || !model7["modelUrl"])
log("load model failed:", config3.body.modelPath);
else if (config3.debug)
log("load model:", model7["modelUrl"]);
} else if (config3.debug)
log("cached model:", model7["modelUrl"]);
return model7;
}
async function max2d(inputs, minScore) {
const [width, height] = inputs.shape;
const reshaped = tfjs_esm_exports.reshape(inputs, [height * width]);
const max4 = tfjs_esm_exports.max(reshaped, 0);
const newScore = (await max4.data())[0];
tfjs_esm_exports.dispose([reshaped, max4]);
if (newScore > minScore) {
const coordinates = tfjs_esm_exports.argMax(reshaped, 0);
const mod2 = tfjs_esm_exports.mod(coordinates, width);
const x = (await mod2.data())[0];
const div13 = tfjs_esm_exports.div(coordinates, tfjs_esm_exports.scalar(width, "int32"));
const y = (await div13.data())[0];
tfjs_esm_exports.dispose([mod2, div13]);
return [x, y, newScore];
}
return [0, 0, newScore];
}
async function predict7(image29, config3) {
const skipTime = (config3.body.skipTime || 0) > now() - lastTime7;
const skipFrame = skipped7 < (config3.body.skipFrames || 0);
if (config3.skipAllowed && skipTime && skipFrame && Object.keys(cache2.keypoints).length > 0) {
skipped7++;
return [cache2];
}
skipped7 = 0;
return new Promise(async (resolve) => {
var _a;
const tensor3 = tfjs_esm_exports.tidy(() => {
if (!(model7 == null ? void 0 : model7.inputs[0].shape))
return null;
const resize = tfjs_esm_exports.image.resizeBilinear(image29, [model7.inputs[0].shape[2], model7.inputs[0].shape[1]], false);
const enhance3 = tfjs_esm_exports.mul(resize, constants.tf2);
const norm = tfjs_esm_exports.sub(enhance3, constants.tf1);
return norm;
});
let resT;
if (config3.body.enabled)
resT = model7 == null ? void 0 : model7.execute(tensor3);
lastTime7 = now();
tfjs_esm_exports.dispose(tensor3);
if (resT) {
cache2.keypoints.length = 0;
const squeeze11 = resT.squeeze();
tfjs_esm_exports.dispose(resT);
const stack5 = squeeze11.unstack(2);
tfjs_esm_exports.dispose(squeeze11);
for (let id = 0; id < stack5.length; id++) {
const [x2, y2, partScore] = await max2d(stack5[id], config3.body.minConfidence);
if (partScore > (((_a = config3.body) == null ? void 0 : _a.minConfidence) || 0)) {
cache2.keypoints.push({
score: Math.round(100 * partScore) / 100,
part: kpt2[id],
positionRaw: [
x2 / model7.inputs[0].shape[2],
y2 / model7.inputs[0].shape[1]
],
position: [
Math.round(image29.shape[2] * x2 / model7.inputs[0].shape[2]),
Math.round(image29.shape[1] * y2 / model7.inputs[0].shape[1])
]
});
}
}
stack5.forEach((s) => tfjs_esm_exports.dispose(s));
}
cache2.score = cache2.keypoints.reduce((prev, curr) => curr.score > prev ? curr.score : prev, 0);
const x = cache2.keypoints.map((a) => a.position[0]);
const y = cache2.keypoints.map((a) => a.position[1]);
cache2.box = [
Math.min(...x),
Math.min(...y),
Math.max(...x) - Math.min(...x),
Math.max(...y) - Math.min(...y)
];
const xRaw = cache2.keypoints.map((a) => a.positionRaw[0]);
const yRaw = cache2.keypoints.map((a) => a.positionRaw[1]);
cache2.boxRaw = [
Math.min(...xRaw),
Math.min(...yRaw),
Math.max(...xRaw) - Math.min(...xRaw),
Math.max(...yRaw) - Math.min(...yRaw)
];
for (const [name, indexes] of Object.entries(connected2)) {
const pt = [];
for (let i = 0; i < indexes.length - 1; i++) {
const pt0 = cache2.keypoints.find((kpt4) => kpt4.part === indexes[i]);
const pt1 = cache2.keypoints.find((kpt4) => kpt4.part === indexes[i + 1]);
if (pt0 && pt1 && pt0.score > (config3.body.minConfidence || 0) && pt1.score > (config3.body.minConfidence || 0))
pt.push([pt0.position, pt1.position]);
}
cache2.annotations[name] = pt;
}
resolve([cache2]);
});
}
// src/gear/emotion.ts
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
var model8;
var last6 = [];
var lastCount5 = 0;
var lastTime8 = 0;
var skipped8 = Number.MAX_SAFE_INTEGER;
async function load8(config3) {
var _a, _b;
if (env.initial)
model8 = null;
if (!model8) {
model8 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.face.emotion) == null ? void 0 : _a.modelPath) || ""));
if (!model8 || !model8["modelUrl"])
log("load model failed:", (_b = config3.face.emotion) == null ? void 0 : _b.modelPath);
else if (config3.debug)
log("load model:", model8["modelUrl"]);
} else if (config3.debug)
log("cached model:", model8["modelUrl"]);
return model8;
}
async function predict8(image29, config3, idx, count2) {
var _a, _b;
if (!model8)
return [];
const skipFrame = skipped8 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0);
const skipTime = (((_b = config3.face.emotion) == null ? void 0 : _b.skipTime) || 0) > now() - lastTime8;
if (config3.skipAllowed && skipTime && skipFrame && lastCount5 === count2 && last6[idx] && last6[idx].length > 0) {
skipped8++;
return last6[idx];
}
skipped8 = 0;
return new Promise(async (resolve) => {
var _a2, _b2;
const obj = [];
if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) {
const t = {};
const inputSize9 = (model8 == null ? void 0 : model8.inputs[0].shape) ? model8.inputs[0].shape[2] : 0;
t.resize = tfjs_esm_exports.image.resizeBilinear(image29, [inputSize9, inputSize9], false);
t.channels = tfjs_esm_exports.mul(t.resize, constants.rgb);
t.grayscale = tfjs_esm_exports.sum(t.channels, 3, true);
t.grayscaleSub = tfjs_esm_exports.sub(t.grayscale, constants.tf05);
t.grayscaleMul = tfjs_esm_exports.mul(t.grayscaleSub, constants.tf2);
t.emotion = model8 == null ? void 0 : model8.execute(t.grayscaleMul);
lastTime8 = now();
const data = await t.emotion.data();
for (let i = 0; i < data.length; i++) {
if (data[i] > (((_b2 = config3.face.emotion) == null ? void 0 : _b2.minConfidence) || 0))
obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });
}
obj.sort((a, b) => b.score - a.score);
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
}
last6[idx] = obj;
lastCount5 = count2;
resolve(obj);
});
}
// src/face/mobilefacenet.ts
var model9;
var last7 = [];
var lastCount6 = 0;
var lastTime9 = 0;
var skipped9 = Number.MAX_SAFE_INTEGER;
async function load9(config3) {
const modelUrl = join(config3.modelBasePath, config3.face["mobilefacenet"].modelPath);
if (env.initial)
model9 = null;
if (!model9) {
model9 = await tfjs_esm_exports.loadGraphModel(modelUrl);
if (!model9)
log("load model failed:", config3.face["mobilefacenet"].modelPath);
else if (config3.debug)
log("load model:", modelUrl);
} else if (config3.debug)
log("cached model:", modelUrl);
return model9;
}
async function predict9(input, config3, idx, count2) {
var _a, _b;
if (!model9)
return [];
const skipFrame = skipped9 < (((_a = config3.face["embedding"]) == null ? void 0 : _a.skipFrames) || 0);
const skipTime = (((_b = config3.face["embedding"]) == null ? void 0 : _b.skipTime) || 0) > now() - lastTime9;
if (config3.skipAllowed && skipTime && skipFrame && lastCount6 === count2 && last7[idx]) {
skipped9++;
return last7[idx];
}
return new Promise(async (resolve) => {
var _a2;
let data = [];
if (((_a2 = config3.face["embedding"]) == null ? void 0 : _a2.enabled) && (model9 == null ? void 0 : model9.inputs[0].shape)) {
const t = {};
t.crop = tfjs_esm_exports.image.resizeBilinear(input, [model9.inputs[0].shape[2], model9.inputs[0].shape[1]], false);
t.data = model9 == null ? void 0 : model9.execute(t.crop);
const output = await t.data.data();
data = Array.from(output);
}
last7[idx] = data;
lastCount6 = count2;
lastTime9 = now();
resolve(data);
});
}
// src/face/iris.ts
var model10;
var inputSize5 = 0;
var irisEnlarge = 2.3;
var leftOutline = meshAnnotations["leftEyeLower0"];
var rightOutline = meshAnnotations["rightEyeLower0"];
var eyeLandmarks = {
leftBounds: [leftOutline[0], leftOutline[leftOutline.length - 1]],
rightBounds: [rightOutline[0], rightOutline[rightOutline.length - 1]]
};
var irisLandmarks = {
upperCenter: 3,
lowerCenter: 4,
index: 71,
numCoordinates: 76
};
async function load10(config3) {
var _a, _b;
if (env.initial)
model10 = null;
if (!model10) {
model10 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.face.iris) == null ? void 0 : _a.modelPath) || ""));
if (!model10 || !model10["modelUrl"])
log("load model failed:", (_b = config3.face.iris) == null ? void 0 : _b.modelPath);
else if (config3.debug)
log("load model:", model10["modelUrl"]);
} else if (config3.debug)
log("cached model:", model10["modelUrl"]);
inputSize5 = model10.inputs[0].shape ? model10.inputs[0].shape[2] : 0;
if (inputSize5 === -1)
inputSize5 = 64;
return model10;
}
function replaceRawCoordinates(rawCoords, newCoords, prefix, keys) {
for (let i = 0; i < MESH_TO_IRIS_INDICES_MAP.length; i++) {
const { key, indices } = MESH_TO_IRIS_INDICES_MAP[i];
const originalIndices = meshAnnotations[`${prefix}${key}`];
if (!keys || keys.includes(key)) {
for (let j = 0; j < indices.length; j++) {
const index2 = indices[j];
rawCoords[originalIndices[j]] = [
newCoords[index2][0],
newCoords[index2][1],
(newCoords[index2][2] + rawCoords[originalIndices[j]][2]) / 2
];
}
}
}
}
var getLeftToRightEyeDepthDifference = (rawCoords) => {
const leftEyeZ = rawCoords[eyeLandmarks.leftBounds[0]][2];
const rightEyeZ = rawCoords[eyeLandmarks.rightBounds[0]][2];
return leftEyeZ - rightEyeZ;
};
var getEyeBox = (rawCoords, face5, eyeInnerCornerIndex, eyeOuterCornerIndex, meshSize, flip = false) => {
const box4 = squarifyBox(enlargeBox(calculateLandmarksBoundingBox([rawCoords[eyeInnerCornerIndex], rawCoords[eyeOuterCornerIndex]]), irisEnlarge));
const boxSize = getBoxSize(box4);
let crop2 = tfjs_esm_exports.image.cropAndResize(face5, [[
box4.startPoint[1] / meshSize,
box4.startPoint[0] / meshSize,
box4.endPoint[1] / meshSize,
box4.endPoint[0] / meshSize
]], [0], [inputSize5, inputSize5]);
if (flip && env.kernels.includes("flipleftright")) {
const flipped = tfjs_esm_exports.image.flipLeftRight(crop2);
tfjs_esm_exports.dispose(crop2);
crop2 = flipped;
}
return { box: box4, boxSize, crop: crop2 };
};
var getEyeCoords = (eyeData, eyeBox, eyeBoxSize, flip = false) => {
const eyeRawCoords = [];
for (let i = 0; i < irisLandmarks.numCoordinates; i++) {
const x = eyeData[i * 3];
const y = eyeData[i * 3 + 1];
const z = eyeData[i * 3 + 2];
eyeRawCoords.push([
(flip ? 1 - x / inputSize5 : x / inputSize5) * eyeBoxSize[0] + eyeBox.startPoint[0],
y / inputSize5 * eyeBoxSize[1] + eyeBox.startPoint[1],
z
]);
}
return { rawCoords: eyeRawCoords, iris: eyeRawCoords.slice(irisLandmarks.index) };
};
var getAdjustedIrisCoords = (rawCoords, irisCoords, direction) => {
const upperCenterZ = rawCoords[meshAnnotations[`${direction}EyeUpper0`][irisLandmarks.upperCenter]][2];
const lowerCenterZ = rawCoords[meshAnnotations[`${direction}EyeLower0`][irisLandmarks.lowerCenter]][2];
const averageZ = (upperCenterZ + lowerCenterZ) / 2;
return irisCoords.map((coord, i) => {
let z = averageZ;
if (i === 2) {
z = upperCenterZ;
} else if (i === 4) {
z = lowerCenterZ;
}
return [coord[0], coord[1], z];
});
};
async function augmentIris(rawCoords, face5, config3, meshSize) {
if (!model10) {
if (config3.debug)
log("face mesh iris detection requested, but model is not loaded");
return rawCoords;
}
const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = getEyeBox(rawCoords, face5, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], meshSize, true);
const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = getEyeBox(rawCoords, face5, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1], meshSize, true);
const combined = tfjs_esm_exports.concat([leftEyeCrop, rightEyeCrop]);
tfjs_esm_exports.dispose(leftEyeCrop);
tfjs_esm_exports.dispose(rightEyeCrop);
const eyePredictions = model10.execute(combined);
tfjs_esm_exports.dispose(combined);
const eyePredictionsData = await eyePredictions.data();
tfjs_esm_exports.dispose(eyePredictions);
const leftEyeData = eyePredictionsData.slice(0, irisLandmarks.numCoordinates * 3);
const { rawCoords: leftEyeRawCoords, iris: leftIrisRawCoords } = getEyeCoords(leftEyeData, leftEyeBox, leftEyeBoxSize, true);
const rightEyeData = eyePredictionsData.slice(irisLandmarks.numCoordinates * 3);
const { rawCoords: rightEyeRawCoords, iris: rightIrisRawCoords } = getEyeCoords(rightEyeData, rightEyeBox, rightEyeBoxSize);
const leftToRightEyeDepthDifference = getLeftToRightEyeDepthDifference(rawCoords);
if (Math.abs(leftToRightEyeDepthDifference) < 30) {
replaceRawCoordinates(rawCoords, leftEyeRawCoords, "left", null);
replaceRawCoordinates(rawCoords, rightEyeRawCoords, "right", null);
} else if (leftToRightEyeDepthDifference < 1) {
replaceRawCoordinates(rawCoords, leftEyeRawCoords, "left", ["EyeUpper0", "EyeLower0"]);
} else {
replaceRawCoordinates(rawCoords, rightEyeRawCoords, "right", ["EyeUpper0", "EyeLower0"]);
}
const adjustedLeftIrisCoords = getAdjustedIrisCoords(rawCoords, leftIrisRawCoords, "left");
const adjustedRightIrisCoords = getAdjustedIrisCoords(rawCoords, rightIrisRawCoords, "right");
const newCoords = rawCoords.concat(adjustedLeftIrisCoords).concat(adjustedRightIrisCoords);
return newCoords;
}
// src/face/facemesh.ts
var boxCache = [];
var model11 = null;
var inputSize6 = 0;
var skipped10 = Number.MAX_SAFE_INTEGER;
var lastTime10 = 0;
async function predict10(input, config3) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
const skipTime = (((_a = config3.face.detector) == null ? void 0 : _a.skipTime) || 0) > now() - lastTime10;
const skipFrame = skipped10 < (((_b = config3.face.detector) == null ? void 0 : _b.skipFrames) || 0);
if (!config3.skipAllowed || !skipTime || !skipFrame || boxCache.length === 0) {
const possibleBoxes = await getBoxes(input, config3);
lastTime10 = now();
boxCache = [];
for (const possible of possibleBoxes.boxes) {
const box4 = {
startPoint: possible.box.startPoint,
endPoint: possible.box.endPoint,
landmarks: possible.landmarks,
confidence: possible.confidence
};
const boxScaled = scaleBoxCoordinates(box4, possibleBoxes.scaleFactor);
const calcFactor = (((_c = config3.face.detector) == null ? void 0 : _c.cropFactor) || 1.6) * 1400 / (boxScaled.endPoint[0] - boxScaled.startPoint[0] + 1400);
const boxEnlarged = enlargeBox(boxScaled, calcFactor);
const boxSquared = squarifyBox(boxEnlarged);
boxCache.push(boxSquared);
}
skipped10 = 0;
} else {
skipped10++;
}
const faces = [];
const newCache = [];
let id = 0;
for (let i = 0; i < boxCache.length; i++) {
let box4 = boxCache[i];
let angle = 0;
let rotationMatrix;
const face5 = {
id: id++,
mesh: [],
meshRaw: [],
box: [0, 0, 0, 0],
boxRaw: [0, 0, 0, 0],
score: 0,
boxScore: 0,
faceScore: 0,
annotations: {}
};
[angle, rotationMatrix, face5.tensor] = correctFaceRotation((_d = config3.face.detector) == null ? void 0 : _d.rotation, box4, input, ((_e = config3.face.mesh) == null ? void 0 : _e.enabled) ? inputSize6 : size());
if ((_f = config3 == null ? void 0 : config3.filter) == null ? void 0 : _f.equalization) {
const equilized = await histogramEqualization(face5.tensor);
tfjs_esm_exports.dispose(face5.tensor);
face5.tensor = equilized;
}
face5.boxScore = Math.round(100 * box4.confidence) / 100;
if (!((_g = config3.face.mesh) == null ? void 0 : _g.enabled)) {
face5.box = getClampedBox(box4, input);
face5.boxRaw = getRawBox(box4, input);
face5.score = face5.boxScore;
face5.mesh = box4.landmarks.map((pt) => [
(box4.startPoint[0] + box4.endPoint[0]) / 2 + (box4.endPoint[0] + box4.startPoint[0]) * pt[0] / size(),
(box4.startPoint[1] + box4.endPoint[1]) / 2 + (box4.endPoint[1] + box4.startPoint[1]) * pt[1] / size()
]);
face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize6]);
for (const key of Object.keys(blazeFaceLandmarks))
face5.annotations[key] = [face5.mesh[blazeFaceLandmarks[key]]];
} else if (!model11) {
if (config3.debug)
log("face mesh detection requested, but model is not loaded");
} else {
const [contours, confidence, contourCoords] = model11.execute(face5.tensor);
const faceConfidence = await confidence.data();
face5.faceScore = Math.round(100 * faceConfidence[0]) / 100;
const coordsReshaped = tfjs_esm_exports.reshape(contourCoords, [-1, 3]);
let rawCoords = await coordsReshaped.array();
tfjs_esm_exports.dispose([contourCoords, coordsReshaped, confidence, contours]);
if (face5.faceScore < (((_h = config3.face.detector) == null ? void 0 : _h.minConfidence) || 1)) {
box4.confidence = face5.faceScore;
} else {
if ((_i = config3.face.iris) == null ? void 0 : _i.enabled)
rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize6);
face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize6);
face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize6]);
for (const key of Object.keys(meshAnnotations))
face5.annotations[key] = meshAnnotations[key].map((index2) => face5.mesh[index2]);
const boxCalculated = calculateLandmarksBoundingBox(face5.mesh);
const boxEnlarged = enlargeBox(boxCalculated, ((_j = config3.face.detector) == null ? void 0 : _j.cropFactor) || 1.6);
const boxSquared = squarifyBox(boxEnlarged);
box4 = { ...boxSquared, confidence: box4.confidence };
face5.box = getClampedBox(box4, input);
face5.boxRaw = getRawBox(box4, input);
face5.score = face5.faceScore;
newCache.push(box4);
tfjs_esm_exports.dispose(face5.tensor);
[angle, rotationMatrix, face5.tensor] = correctFaceRotation((_k = config3.face.detector) == null ? void 0 : _k.rotation, box4, input, inputSize6);
}
}
faces.push(face5);
}
boxCache = [...newCache];
return faces;
}
async function load11(config3) {
var _a, _b;
if (env.initial)
model11 = null;
if (!model11) {
model11 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.face.mesh) == null ? void 0 : _a.modelPath) || ""));
if (!model11 || !model11["modelUrl"])
log("load model failed:", (_b = config3.face.mesh) == null ? void 0 : _b.modelPath);
else if (config3.debug)
log("load model:", model11["modelUrl"]);
} else if (config3.debug)
log("cached model:", model11["modelUrl"]);
inputSize6 = model11.inputs[0].shape ? model11.inputs[0].shape[2] : 0;
return model11;
}
var triangulation = TRI468;
var uvmap = UV468;
// src/face/faceres.ts
var model12;
var last8 = [];
var lastTime11 = 0;
var lastCount7 = 0;
var skipped11 = Number.MAX_SAFE_INTEGER;
async function load12(config3) {
var _a, _b;
const modelUrl = join(config3.modelBasePath, ((_a = config3.face.description) == null ? void 0 : _a.modelPath) || "");
if (env.initial)
model12 = null;
if (!model12) {
model12 = await tfjs_esm_exports.loadGraphModel(modelUrl);
if (!model12)
log("load model failed:", ((_b = config3.face.description) == null ? void 0 : _b.modelPath) || "");
else if (config3.debug)
log("load model:", modelUrl);
} else if (config3.debug)
log("cached model:", modelUrl);
return model12;
}
function enhance2(input) {
const tensor3 = input.image || input.tensor || input;
if (!(model12 == null ? void 0 : model12.inputs[0].shape))
return tensor3;
const crop2 = tfjs_esm_exports.image.resizeBilinear(tensor3, [model12.inputs[0].shape[2], model12.inputs[0].shape[1]], false);
const norm = tfjs_esm_exports.mul(crop2, constants.tf255);
tfjs_esm_exports.dispose(crop2);
return norm;
}
async function predict11(image29, config3, idx, count2) {
var _a, _b, _c, _d;
if (!model12)
return { age: 0, gender: "unknown", genderScore: 0, descriptor: [] };
const skipFrame = skipped11 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0);
const skipTime = (((_b = config3.face.description) == null ? void 0 : _b.skipTime) || 0) > now() - lastTime11;
if (config3.skipAllowed && skipFrame && skipTime && lastCount7 === count2 && ((_c = last8[idx]) == null ? void 0 : _c.age) && ((_d = last8[idx]) == null ? void 0 : _d.age) > 0) {
skipped11++;
return last8[idx];
}
skipped11 = 0;
return new Promise(async (resolve) => {
var _a2, _b2;
const obj = {
age: 0,
gender: "unknown",
genderScore: 0,
descriptor: []
};
if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) {
const enhanced = enhance2(image29);
const resT = model12 == null ? void 0 : model12.execute(enhanced);
lastTime11 = now();
tfjs_esm_exports.dispose(enhanced);
const genderT = await resT.find((t) => t.shape[1] === 1);
const gender = await genderT.data();
const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100;
if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) {
obj.gender = gender[0] <= 0.5 ? "female" : "male";
obj.genderScore = Math.min(0.99, confidence);
}
const argmax = tfjs_esm_exports.argMax(resT.find((t) => t.shape[1] === 100), 1);
const age = (await argmax.data())[0];
tfjs_esm_exports.dispose(argmax);
const ageT = resT.find((t) => t.shape[1] === 100);
const all2 = await ageT.data();
obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10;
const desc = resT.find((t) => t.shape[1] === 1024);
const descriptor = desc ? await desc.data() : [];
obj.descriptor = Array.from(descriptor);
resT.forEach((t) => tfjs_esm_exports.dispose(t));
}
last8[idx] = obj;
lastCount7 = count2;
resolve(obj);
});
}
// src/hand/handposeutil.ts
function getBoxSize2(box4) {
return [
Math.abs(box4.endPoint[0] - box4.startPoint[0]),
Math.abs(box4.endPoint[1] - box4.startPoint[1])
];
}
function getBoxCenter2(box4) {
return [
box4.startPoint[0] + (box4.endPoint[0] - box4.startPoint[0]) / 2,
box4.startPoint[1] + (box4.endPoint[1] - box4.startPoint[1]) / 2
];
}
function cutBoxFromImageAndResize2(box4, image29, cropSize) {
const h = image29.shape[1];
const w = image29.shape[2];
const boxes = [[
box4.startPoint[1] / h,
box4.startPoint[0] / w,
box4.endPoint[1] / h,
box4.endPoint[0] / w
]];
return tfjs_esm_exports.image.cropAndResize(image29, boxes, [0], cropSize);
}
function scaleBoxCoordinates2(box4, factor) {
const startPoint = [box4.startPoint[0] * factor[0], box4.startPoint[1] * factor[1]];
const endPoint = [box4.endPoint[0] * factor[0], box4.endPoint[1] * factor[1]];
const palmLandmarks = box4.palmLandmarks.map((coord) => {
const scaledCoord = [coord[0] * factor[0], coord[1] * factor[1]];
return scaledCoord;
});
return { startPoint, endPoint, palmLandmarks, confidence: box4.confidence };
}
function enlargeBox2(box4, factor = 1.5) {
const center = getBoxCenter2(box4);
const size2 = getBoxSize2(box4);
const newHalfSize = [factor * size2[0] / 2, factor * size2[1] / 2];
const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];
const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];
return { startPoint, endPoint, palmLandmarks: box4.palmLandmarks };
}
function squarifyBox2(box4) {
const centers = getBoxCenter2(box4);
const size2 = getBoxSize2(box4);
const maxEdge = Math.max(...size2);
const halfSize = maxEdge / 2;
const startPoint = [centers[0] - halfSize, centers[1] - halfSize];
const endPoint = [centers[0] + halfSize, centers[1] + halfSize];
return { startPoint, endPoint, palmLandmarks: box4.palmLandmarks };
}
function normalizeRadians2(angle) {
return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));
}
function computeRotation2(point1, point2) {
const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);
return normalizeRadians2(radians);
}
var buildTranslationMatrix2 = (x, y) => [[1, 0, x], [0, 1, y], [0, 0, 1]];
function dot2(v1, v2) {
let product = 0;
for (let i = 0; i < v1.length; i++) {
product += v1[i] * v2[i];
}
return product;
}
function getColumnFrom2DArr2(arr, columnIndex) {
const column = [];
for (let i = 0; i < arr.length; i++) {
column.push(arr[i][columnIndex]);
}
return column;
}
function multiplyTransformMatrices2(mat1, mat2) {
const product = [];
const size2 = mat1.length;
for (let row = 0; row < size2; row++) {
product.push([]);
for (let col = 0; col < size2; col++) {
product[row].push(dot2(mat1[row], getColumnFrom2DArr2(mat2, col)));
}
}
return product;
}
function buildRotationMatrix2(rotation, center) {
const cosA = Math.cos(rotation);
const sinA = Math.sin(rotation);
const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];
const translationMatrix = buildTranslationMatrix2(center[0], center[1]);
const translationTimesRotation = multiplyTransformMatrices2(translationMatrix, rotationMatrix);
const negativeTranslationMatrix = buildTranslationMatrix2(-center[0], -center[1]);
return multiplyTransformMatrices2(translationTimesRotation, negativeTranslationMatrix);
}
function invertTransformMatrix2(matrix) {
const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];
const translationComponent = [matrix[0][2], matrix[1][2]];
const invertedTranslation = [
-dot2(rotationComponent[0], translationComponent),
-dot2(rotationComponent[1], translationComponent)
];
return [
rotationComponent[0].concat(invertedTranslation[0]),
rotationComponent[1].concat(invertedTranslation[1]),
[0, 0, 1]
];
}
function rotatePoint2(homogeneousCoordinate, rotationMatrix) {
return [
dot2(homogeneousCoordinate, rotationMatrix[0]),
dot2(homogeneousCoordinate, rotationMatrix[1])
];
}
// src/hand/handposeanchors.ts
var anchors2 = [
{ x: 0.015625, y: 0.015625 },
{ x: 0.015625, y: 0.015625 },
{ x: 0.046875, y: 0.015625 },
{ x: 0.046875, y: 0.015625 },
{ x: 0.078125, y: 0.015625 },
{ x: 0.078125, y: 0.015625 },
{ x: 0.109375, y: 0.015625 },
{ x: 0.109375, y: 0.015625 },
{ x: 0.140625, y: 0.015625 },
{ x: 0.140625, y: 0.015625 },
{ x: 0.171875, y: 0.015625 },
{ x: 0.171875, y: 0.015625 },
{ x: 0.203125, y: 0.015625 },
{ x: 0.203125, y: 0.015625 },
{ x: 0.234375, y: 0.015625 },
{ x: 0.234375, y: 0.015625 },
{ x: 0.265625, y: 0.015625 },
{ x: 0.265625, y: 0.015625 },
{ x: 0.296875, y: 0.015625 },
{ x: 0.296875, y: 0.015625 },
{ x: 0.328125, y: 0.015625 },
{ x: 0.328125, y: 0.015625 },
{ x: 0.359375, y: 0.015625 },
{ x: 0.359375, y: 0.015625 },
{ x: 0.390625, y: 0.015625 },
{ x: 0.390625, y: 0.015625 },
{ x: 0.421875, y: 0.015625 },
{ x: 0.421875, y: 0.015625 },
{ x: 0.453125, y: 0.015625 },
{ x: 0.453125, y: 0.015625 },
{ x: 0.484375, y: 0.015625 },
{ x: 0.484375, y: 0.015625 },
{ x: 0.515625, y: 0.015625 },
{ x: 0.515625, y: 0.015625 },
{ x: 0.546875, y: 0.015625 },
{ x: 0.546875, y: 0.015625 },
{ x: 0.578125, y: 0.015625 },
{ x: 0.578125, y: 0.015625 },
{ x: 0.609375, y: 0.015625 },
{ x: 0.609375, y: 0.015625 },
{ x: 0.640625, y: 0.015625 },
{ x: 0.640625, y: 0.015625 },
{ x: 0.671875, y: 0.015625 },
{ x: 0.671875, y: 0.015625 },
{ x: 0.703125, y: 0.015625 },
{ x: 0.703125, y: 0.015625 },
{ x: 0.734375, y: 0.015625 },
{ x: 0.734375, y: 0.015625 },
{ x: 0.765625, y: 0.015625 },
{ x: 0.765625, y: 0.015625 },
{ x: 0.796875, y: 0.015625 },
{ x: 0.796875, y: 0.015625 },
{ x: 0.828125, y: 0.015625 },
{ x: 0.828125, y: 0.015625 },
{ x: 0.859375, y: 0.015625 },
{ x: 0.859375, y: 0.015625 },
{ x: 0.890625, y: 0.015625 },
{ x: 0.890625, y: 0.015625 },
{ x: 0.921875, y: 0.015625 },
{ x: 0.921875, y: 0.015625 },
{ x: 0.953125, y: 0.015625 },
{ x: 0.953125, y: 0.015625 },
{ x: 0.984375, y: 0.015625 },
{ x: 0.984375, y: 0.015625 },
{ x: 0.015625, y: 0.046875 },
{ x: 0.015625, y: 0.046875 },
{ x: 0.046875, y: 0.046875 },
{ x: 0.046875, y: 0.046875 },
{ x: 0.078125, y: 0.046875 },
{ x: 0.078125, y: 0.046875 },
{ x: 0.109375, y: 0.046875 },
{ x: 0.109375, y: 0.046875 },
{ x: 0.140625, y: 0.046875 },
{ x: 0.140625, y: 0.046875 },
{ x: 0.171875, y: 0.046875 },
{ x: 0.171875, y: 0.046875 },
{ x: 0.203125, y: 0.046875 },
{ x: 0.203125, y: 0.046875 },
{ x: 0.234375, y: 0.046875 },
{ x: 0.234375, y: 0.046875 },
{ x: 0.265625, y: 0.046875 },
{ x: 0.265625, y: 0.046875 },
{ x: 0.296875, y: 0.046875 },
{ x: 0.296875, y: 0.046875 },
{ x: 0.328125, y: 0.046875 },
{ x: 0.328125, y: 0.046875 },
{ x: 0.359375, y: 0.046875 },
{ x: 0.359375, y: 0.046875 },
{ x: 0.390625, y: 0.046875 },
{ x: 0.390625, y: 0.046875 },
{ x: 0.421875, y: 0.046875 },
{ x: 0.421875, y: 0.046875 },
{ x: 0.453125, y: 0.046875 },
{ x: 0.453125, y: 0.046875 },
{ x: 0.484375, y: 0.046875 },
{ x: 0.484375, y: 0.046875 },
{ x: 0.515625, y: 0.046875 },
{ x: 0.515625, y: 0.046875 },
{ x: 0.546875, y: 0.046875 },
{ x: 0.546875, y: 0.046875 },
{ x: 0.578125, y: 0.046875 },
{ x: 0.578125, y: 0.046875 },
{ x: 0.609375, y: 0.046875 },
{ x: 0.609375, y: 0.046875 },
{ x: 0.640625, y: 0.046875 },
{ x: 0.640625, y: 0.046875 },
{ x: 0.671875, y: 0.046875 },
{ x: 0.671875, y: 0.046875 },
{ x: 0.703125, y: 0.046875 },
{ x: 0.703125, y: 0.046875 },
{ x: 0.734375, y: 0.046875 },
{ x: 0.734375, y: 0.046875 },
{ x: 0.765625, y: 0.046875 },
{ x: 0.765625, y: 0.046875 },
{ x: 0.796875, y: 0.046875 },
{ x: 0.796875, y: 0.046875 },
{ x: 0.828125, y: 0.046875 },
{ x: 0.828125, y: 0.046875 },
{ x: 0.859375, y: 0.046875 },
{ x: 0.859375, y: 0.046875 },
{ x: 0.890625, y: 0.046875 },
{ x: 0.890625, y: 0.046875 },
{ x: 0.921875, y: 0.046875 },
{ x: 0.921875, y: 0.046875 },
{ x: 0.953125, y: 0.046875 },
{ x: 0.953125, y: 0.046875 },
{ x: 0.984375, y: 0.046875 },
{ x: 0.984375, y: 0.046875 },
{ x: 0.015625, y: 0.078125 },
{ x: 0.015625, y: 0.078125 },
{ x: 0.046875, y: 0.078125 },
{ x: 0.046875, y: 0.078125 },
{ x: 0.078125, y: 0.078125 },
{ x: 0.078125, y: 0.078125 },
{ x: 0.109375, y: 0.078125 },
{ x: 0.109375, y: 0.078125 },
{ x: 0.140625, y: 0.078125 },
{ x: 0.140625, y: 0.078125 },
{ x: 0.171875, y: 0.078125 },
{ x: 0.171875, y: 0.078125 },
{ x: 0.203125, y: 0.078125 },
{ x: 0.203125, y: 0.078125 },
{ x: 0.234375, y: 0.078125 },
{ x: 0.234375, y: 0.078125 },
{ x: 0.265625, y: 0.078125 },
{ x: 0.265625, y: 0.078125 },
{ x: 0.296875, y: 0.078125 },
{ x: 0.296875, y: 0.078125 },
{ x: 0.328125, y: 0.078125 },
{ x: 0.328125, y: 0.078125 },
{ x: 0.359375, y: 0.078125 },
{ x: 0.359375, y: 0.078125 },
{ x: 0.390625, y: 0.078125 },
{ x: 0.390625, y: 0.078125 },
{ x: 0.421875, y: 0.078125 },
{ x: 0.421875, y: 0.078125 },
{ x: 0.453125, y: 0.078125 },
{ x: 0.453125, y: 0.078125 },
{ x: 0.484375, y: 0.078125 },
{ x: 0.484375, y: 0.078125 },
{ x: 0.515625, y: 0.078125 },
{ x: 0.515625, y: 0.078125 },
{ x: 0.546875, y: 0.078125 },
{ x: 0.546875, y: 0.078125 },
{ x: 0.578125, y: 0.078125 },
{ x: 0.578125, y: 0.078125 },
{ x: 0.609375, y: 0.078125 },
{ x: 0.609375, y: 0.078125 },
{ x: 0.640625, y: 0.078125 },
{ x: 0.640625, y: 0.078125 },
{ x: 0.671875, y: 0.078125 },
{ x: 0.671875, y: 0.078125 },
{ x: 0.703125, y: 0.078125 },
{ x: 0.703125, y: 0.078125 },
{ x: 0.734375, y: 0.078125 },
{ x: 0.734375, y: 0.078125 },
{ x: 0.765625, y: 0.078125 },
{ x: 0.765625, y: 0.078125 },
{ x: 0.796875, y: 0.078125 },
{ x: 0.796875, y: 0.078125 },
{ x: 0.828125, y: 0.078125 },
{ x: 0.828125, y: 0.078125 },
{ x: 0.859375, y: 0.078125 },
{ x: 0.859375, y: 0.078125 },
{ x: 0.890625, y: 0.078125 },
{ x: 0.890625, y: 0.078125 },
{ x: 0.921875, y: 0.078125 },
{ x: 0.921875, y: 0.078125 },
{ x: 0.953125, y: 0.078125 },
{ x: 0.953125, y: 0.078125 },
{ x: 0.984375, y: 0.078125 },
{ x: 0.984375, y: 0.078125 },
{ x: 0.015625, y: 0.109375 },
{ x: 0.015625, y: 0.109375 },
{ x: 0.046875, y: 0.109375 },
{ x: 0.046875, y: 0.109375 },
{ x: 0.078125, y: 0.109375 },
{ x: 0.078125, y: 0.109375 },
{ x: 0.109375, y: 0.109375 },
{ x: 0.109375, y: 0.109375 },
{ x: 0.140625, y: 0.109375 },
{ x: 0.140625, y: 0.109375 },
{ x: 0.171875, y: 0.109375 },
{ x: 0.171875, y: 0.109375 },
{ x: 0.203125, y: 0.109375 },
{ x: 0.203125, y: 0.109375 },
{ x: 0.234375, y: 0.109375 },
{ x: 0.234375, y: 0.109375 },
{ x: 0.265625, y: 0.109375 },
{ x: 0.265625, y: 0.109375 },
{ x: 0.296875, y: 0.109375 },
{ x: 0.296875, y: 0.109375 },
{ x: 0.328125, y: 0.109375 },
{ x: 0.328125, y: 0.109375 },
{ x: 0.359375, y: 0.109375 },
{ x: 0.359375, y: 0.109375 },
{ x: 0.390625, y: 0.109375 },
{ x: 0.390625, y: 0.109375 },
{ x: 0.421875, y: 0.109375 },
{ x: 0.421875, y: 0.109375 },
{ x: 0.453125, y: 0.109375 },
{ x: 0.453125, y: 0.109375 },
{ x: 0.484375, y: 0.109375 },
{ x: 0.484375, y: 0.109375 },
{ x: 0.515625, y: 0.109375 },
{ x: 0.515625, y: 0.109375 },
{ x: 0.546875, y: 0.109375 },
{ x: 0.546875, y: 0.109375 },
{ x: 0.578125, y: 0.109375 },
{ x: 0.578125, y: 0.109375 },
{ x: 0.609375, y: 0.109375 },
{ x: 0.609375, y: 0.109375 },
{ x: 0.640625, y: 0.109375 },
{ x: 0.640625, y: 0.109375 },
{ x: 0.671875, y: 0.109375 },
{ x: 0.671875, y: 0.109375 },
{ x: 0.703125, y: 0.109375 },
{ x: 0.703125, y: 0.109375 },
{ x: 0.734375, y: 0.109375 },
{ x: 0.734375, y: 0.109375 },
{ x: 0.765625, y: 0.109375 },
{ x: 0.765625, y: 0.109375 },
{ x: 0.796875, y: 0.109375 },
{ x: 0.796875, y: 0.109375 },
{ x: 0.828125, y: 0.109375 },
{ x: 0.828125, y: 0.109375 },
{ x: 0.859375, y: 0.109375 },
{ x: 0.859375, y: 0.109375 },
{ x: 0.890625, y: 0.109375 },
{ x: 0.890625, y: 0.109375 },
{ x: 0.921875, y: 0.109375 },
{ x: 0.921875, y: 0.109375 },
{ x: 0.953125, y: 0.109375 },
{ x: 0.953125, y: 0.109375 },
{ x: 0.984375, y: 0.109375 },
{ x: 0.984375, y: 0.109375 },
{ x: 0.015625, y: 0.140625 },
{ x: 0.015625, y: 0.140625 },
{ x: 0.046875, y: 0.140625 },
{ x: 0.046875, y: 0.140625 },
{ x: 0.078125, y: 0.140625 },
{ x: 0.078125, y: 0.140625 },
{ x: 0.109375, y: 0.140625 },
{ x: 0.109375, y: 0.140625 },
{ x: 0.140625, y: 0.140625 },
{ x: 0.140625, y: 0.140625 },
{ x: 0.171875, y: 0.140625 },
{ x: 0.171875, y: 0.140625 },
{ x: 0.203125, y: 0.140625 },
{ x: 0.203125, y: 0.140625 },
{ x: 0.234375, y: 0.140625 },
{ x: 0.234375, y: 0.140625 },
{ x: 0.265625, y: 0.140625 },
{ x: 0.265625, y: 0.140625 },
{ x: 0.296875, y: 0.140625 },
{ x: 0.296875, y: 0.140625 },
{ x: 0.328125, y: 0.140625 },
{ x: 0.328125, y: 0.140625 },
{ x: 0.359375, y: 0.140625 },
{ x: 0.359375, y: 0.140625 },
{ x: 0.390625, y: 0.140625 },
{ x: 0.390625, y: 0.140625 },
{ x: 0.421875, y: 0.140625 },
{ x: 0.421875, y: 0.140625 },
{ x: 0.453125, y: 0.140625 },
{ x: 0.453125, y: 0.140625 },
{ x: 0.484375, y: 0.140625 },
{ x: 0.484375, y: 0.140625 },
{ x: 0.515625, y: 0.140625 },
{ x: 0.515625, y: 0.140625 },
{ x: 0.546875, y: 0.140625 },
{ x: 0.546875, y: 0.140625 },
{ x: 0.578125, y: 0.140625 },
{ x: 0.578125, y: 0.140625 },
{ x: 0.609375, y: 0.140625 },
{ x: 0.609375, y: 0.140625 },
{ x: 0.640625, y: 0.140625 },
{ x: 0.640625, y: 0.140625 },
{ x: 0.671875, y: 0.140625 },
{ x: 0.671875, y: 0.140625 },
{ x: 0.703125, y: 0.140625 },
{ x: 0.703125, y: 0.140625 },
{ x: 0.734375, y: 0.140625 },
{ x: 0.734375, y: 0.140625 },
{ x: 0.765625, y: 0.140625 },
{ x: 0.765625, y: 0.140625 },
{ x: 0.796875, y: 0.140625 },
{ x: 0.796875, y: 0.140625 },
{ x: 0.828125, y: 0.140625 },
{ x: 0.828125, y: 0.140625 },
{ x: 0.859375, y: 0.140625 },
{ x: 0.859375, y: 0.140625 },
{ x: 0.890625, y: 0.140625 },
{ x: 0.890625, y: 0.140625 },
{ x: 0.921875, y: 0.140625 },
{ x: 0.921875, y: 0.140625 },
{ x: 0.953125, y: 0.140625 },
{ x: 0.953125, y: 0.140625 },
{ x: 0.984375, y: 0.140625 },
{ x: 0.984375, y: 0.140625 },
{ x: 0.015625, y: 0.171875 },
{ x: 0.015625, y: 0.171875 },
{ x: 0.046875, y: 0.171875 },
{ x: 0.046875, y: 0.171875 },
{ x: 0.078125, y: 0.171875 },
{ x: 0.078125, y: 0.171875 },
{ x: 0.109375, y: 0.171875 },
{ x: 0.109375, y: 0.171875 },
{ x: 0.140625, y: 0.171875 },
{ x: 0.140625, y: 0.171875 },
{ x: 0.171875, y: 0.171875 },
{ x: 0.171875, y: 0.171875 },
{ x: 0.203125, y: 0.171875 },
{ x: 0.203125, y: 0.171875 },
{ x: 0.234375, y: 0.171875 },
{ x: 0.234375, y: 0.171875 },
{ x: 0.265625, y: 0.171875 },
{ x: 0.265625, y: 0.171875 },
{ x: 0.296875, y: 0.171875 },
{ x: 0.296875, y: 0.171875 },
{ x: 0.328125, y: 0.171875 },
{ x: 0.328125, y: 0.171875 },
{ x: 0.359375, y: 0.171875 },
{ x: 0.359375, y: 0.171875 },
{ x: 0.390625, y: 0.171875 },
{ x: 0.390625, y: 0.171875 },
{ x: 0.421875, y: 0.171875 },
{ x: 0.421875, y: 0.171875 },
{ x: 0.453125, y: 0.171875 },
{ x: 0.453125, y: 0.171875 },
{ x: 0.484375, y: 0.171875 },
{ x: 0.484375, y: 0.171875 },
{ x: 0.515625, y: 0.171875 },
{ x: 0.515625, y: 0.171875 },
{ x: 0.546875, y: 0.171875 },
{ x: 0.546875, y: 0.171875 },
{ x: 0.578125, y: 0.171875 },
{ x: 0.578125, y: 0.171875 },
{ x: 0.609375, y: 0.171875 },
{ x: 0.609375, y: 0.171875 },
{ x: 0.640625, y: 0.171875 },
{ x: 0.640625, y: 0.171875 },
{ x: 0.671875, y: 0.171875 },
{ x: 0.671875, y: 0.171875 },
{ x: 0.703125, y: 0.171875 },
{ x: 0.703125, y: 0.171875 },
{ x: 0.734375, y: 0.171875 },
{ x: 0.734375, y: 0.171875 },
{ x: 0.765625, y: 0.171875 },
{ x: 0.765625, y: 0.171875 },
{ x: 0.796875, y: 0.171875 },
{ x: 0.796875, y: 0.171875 },
{ x: 0.828125, y: 0.171875 },
{ x: 0.828125, y: 0.171875 },
{ x: 0.859375, y: 0.171875 },
{ x: 0.859375, y: 0.171875 },
{ x: 0.890625, y: 0.171875 },
{ x: 0.890625, y: 0.171875 },
{ x: 0.921875, y: 0.171875 },
{ x: 0.921875, y: 0.171875 },
{ x: 0.953125, y: 0.171875 },
{ x: 0.953125, y: 0.171875 },
{ x: 0.984375, y: 0.171875 },
{ x: 0.984375, y: 0.171875 },
{ x: 0.015625, y: 0.203125 },
{ x: 0.015625, y: 0.203125 },
{ x: 0.046875, y: 0.203125 },
{ x: 0.046875, y: 0.203125 },
{ x: 0.078125, y: 0.203125 },
{ x: 0.078125, y: 0.203125 },
{ x: 0.109375, y: 0.203125 },
{ x: 0.109375, y: 0.203125 },
{ x: 0.140625, y: 0.203125 },
{ x: 0.140625, y: 0.203125 },
{ x: 0.171875, y: 0.203125 },
{ x: 0.171875, y: 0.203125 },
{ x: 0.203125, y: 0.203125 },
{ x: 0.203125, y: 0.203125 },
{ x: 0.234375, y: 0.203125 },
{ x: 0.234375, y: 0.203125 },
{ x: 0.265625, y: 0.203125 },
{ x: 0.265625, y: 0.203125 },
{ x: 0.296875, y: 0.203125 },
{ x: 0.296875, y: 0.203125 },
{ x: 0.328125, y: 0.203125 },
{ x: 0.328125, y: 0.203125 },
{ x: 0.359375, y: 0.203125 },
{ x: 0.359375, y: 0.203125 },
{ x: 0.390625, y: 0.203125 },
{ x: 0.390625, y: 0.203125 },
{ x: 0.421875, y: 0.203125 },
{ x: 0.421875, y: 0.203125 },
{ x: 0.453125, y: 0.203125 },
{ x: 0.453125, y: 0.203125 },
{ x: 0.484375, y: 0.203125 },
{ x: 0.484375, y: 0.203125 },
{ x: 0.515625, y: 0.203125 },
{ x: 0.515625, y: 0.203125 },
{ x: 0.546875, y: 0.203125 },
{ x: 0.546875, y: 0.203125 },
{ x: 0.578125, y: 0.203125 },
{ x: 0.578125, y: 0.203125 },
{ x: 0.609375, y: 0.203125 },
{ x: 0.609375, y: 0.203125 },
{ x: 0.640625, y: 0.203125 },
{ x: 0.640625, y: 0.203125 },
{ x: 0.671875, y: 0.203125 },
{ x: 0.671875, y: 0.203125 },
{ x: 0.703125, y: 0.203125 },
{ x: 0.703125, y: 0.203125 },
{ x: 0.734375, y: 0.203125 },
{ x: 0.734375, y: 0.203125 },
{ x: 0.765625, y: 0.203125 },
{ x: 0.765625, y: 0.203125 },
{ x: 0.796875, y: 0.203125 },
{ x: 0.796875, y: 0.203125 },
{ x: 0.828125, y: 0.203125 },
{ x: 0.828125, y: 0.203125 },
{ x: 0.859375, y: 0.203125 },
{ x: 0.859375, y: 0.203125 },
{ x: 0.890625, y: 0.203125 },
{ x: 0.890625, y: 0.203125 },
{ x: 0.921875, y: 0.203125 },
{ x: 0.921875, y: 0.203125 },
{ x: 0.953125, y: 0.203125 },
{ x: 0.953125, y: 0.203125 },
{ x: 0.984375, y: 0.203125 },
{ x: 0.984375, y: 0.203125 },
{ x: 0.015625, y: 0.234375 },
{ x: 0.015625, y: 0.234375 },
{ x: 0.046875, y: 0.234375 },
{ x: 0.046875, y: 0.234375 },
{ x: 0.078125, y: 0.234375 },
{ x: 0.078125, y: 0.234375 },
{ x: 0.109375, y: 0.234375 },
{ x: 0.109375, y: 0.234375 },
{ x: 0.140625, y: 0.234375 },
{ x: 0.140625, y: 0.234375 },
{ x: 0.171875, y: 0.234375 },
{ x: 0.171875, y: 0.234375 },
{ x: 0.203125, y: 0.234375 },
{ x: 0.203125, y: 0.234375 },
{ x: 0.234375, y: 0.234375 },
{ x: 0.234375, y: 0.234375 },
{ x: 0.265625, y: 0.234375 },
{ x: 0.265625, y: 0.234375 },
{ x: 0.296875, y: 0.234375 },
{ x: 0.296875, y: 0.234375 },
{ x: 0.328125, y: 0.234375 },
{ x: 0.328125, y: 0.234375 },
{ x: 0.359375, y: 0.234375 },
{ x: 0.359375, y: 0.234375 },
{ x: 0.390625, y: 0.234375 },
{ x: 0.390625, y: 0.234375 },
{ x: 0.421875, y: 0.234375 },
{ x: 0.421875, y: 0.234375 },
{ x: 0.453125, y: 0.234375 },
{ x: 0.453125, y: 0.234375 },
{ x: 0.484375, y: 0.234375 },
{ x: 0.484375, y: 0.234375 },
{ x: 0.515625, y: 0.234375 },
{ x: 0.515625, y: 0.234375 },
{ x: 0.546875, y: 0.234375 },
{ x: 0.546875, y: 0.234375 },
{ x: 0.578125, y: 0.234375 },
{ x: 0.578125, y: 0.234375 },
{ x: 0.609375, y: 0.234375 },
{ x: 0.609375, y: 0.234375 },
{ x: 0.640625, y: 0.234375 },
{ x: 0.640625, y: 0.234375 },
{ x: 0.671875, y: 0.234375 },
{ x: 0.671875, y: 0.234375 },
{ x: 0.703125, y: 0.234375 },
{ x: 0.703125, y: 0.234375 },
{ x: 0.734375, y: 0.234375 },
{ x: 0.734375, y: 0.234375 },
{ x: 0.765625, y: 0.234375 },
{ x: 0.765625, y: 0.234375 },
{ x: 0.796875, y: 0.234375 },
{ x: 0.796875, y: 0.234375 },
{ x: 0.828125, y: 0.234375 },
{ x: 0.828125, y: 0.234375 },
{ x: 0.859375, y: 0.234375 },
{ x: 0.859375, y: 0.234375 },
{ x: 0.890625, y: 0.234375 },
{ x: 0.890625, y: 0.234375 },
{ x: 0.921875, y: 0.234375 },
{ x: 0.921875, y: 0.234375 },
{ x: 0.953125, y: 0.234375 },
{ x: 0.953125, y: 0.234375 },
{ x: 0.984375, y: 0.234375 },
{ x: 0.984375, y: 0.234375 },
{ x: 0.015625, y: 0.265625 },
{ x: 0.015625, y: 0.265625 },
{ x: 0.046875, y: 0.265625 },
{ x: 0.046875, y: 0.265625 },
{ x: 0.078125, y: 0.265625 },
{ x: 0.078125, y: 0.265625 },
{ x: 0.109375, y: 0.265625 },
{ x: 0.109375, y: 0.265625 },
{ x: 0.140625, y: 0.265625 },
{ x: 0.140625, y: 0.265625 },
{ x: 0.171875, y: 0.265625 },
{ x: 0.171875, y: 0.265625 },
{ x: 0.203125, y: 0.265625 },
{ x: 0.203125, y: 0.265625 },
{ x: 0.234375, y: 0.265625 },
{ x: 0.234375, y: 0.265625 },
{ x: 0.265625, y: 0.265625 },
{ x: 0.265625, y: 0.265625 },
{ x: 0.296875, y: 0.265625 },
{ x: 0.296875, y: 0.265625 },
{ x: 0.328125, y: 0.265625 },
{ x: 0.328125, y: 0.265625 },
{ x: 0.359375, y: 0.265625 },
{ x: 0.359375, y: 0.265625 },
{ x: 0.390625, y: 0.265625 },
{ x: 0.390625, y: 0.265625 },
{ x: 0.421875, y: 0.265625 },
{ x: 0.421875, y: 0.265625 },
{ x: 0.453125, y: 0.265625 },
{ x: 0.453125, y: 0.265625 },
{ x: 0.484375, y: 0.265625 },
{ x: 0.484375, y: 0.265625 },
{ x: 0.515625, y: 0.265625 },
{ x: 0.515625, y: 0.265625 },
{ x: 0.546875, y: 0.265625 },
{ x: 0.546875, y: 0.265625 },
{ x: 0.578125, y: 0.265625 },
{ x: 0.578125, y: 0.265625 },
{ x: 0.609375, y: 0.265625 },
{ x: 0.609375, y: 0.265625 },
{ x: 0.640625, y: 0.265625 },
{ x: 0.640625, y: 0.265625 },
{ x: 0.671875, y: 0.265625 },
{ x: 0.671875, y: 0.265625 },
{ x: 0.703125, y: 0.265625 },
{ x: 0.703125, y: 0.265625 },
{ x: 0.734375, y: 0.265625 },
{ x: 0.734375, y: 0.265625 },
{ x: 0.765625, y: 0.265625 },
{ x: 0.765625, y: 0.265625 },
{ x: 0.796875, y: 0.265625 },
{ x: 0.796875, y: 0.265625 },
{ x: 0.828125, y: 0.265625 },
{ x: 0.828125, y: 0.265625 },
{ x: 0.859375, y: 0.265625 },
{ x: 0.859375, y: 0.265625 },
{ x: 0.890625, y: 0.265625 },
{ x: 0.890625, y: 0.265625 },
{ x: 0.921875, y: 0.265625 },
{ x: 0.921875, y: 0.265625 },
{ x: 0.953125, y: 0.265625 },
{ x: 0.953125, y: 0.265625 },
{ x: 0.984375, y: 0.265625 },
{ x: 0.984375, y: 0.265625 },
{ x: 0.015625, y: 0.296875 },
{ x: 0.015625, y: 0.296875 },
{ x: 0.046875, y: 0.296875 },
{ x: 0.046875, y: 0.296875 },
{ x: 0.078125, y: 0.296875 },
{ x: 0.078125, y: 0.296875 },
{ x: 0.109375, y: 0.296875 },
{ x: 0.109375, y: 0.296875 },
{ x: 0.140625, y: 0.296875 },
{ x: 0.140625, y: 0.296875 },
{ x: 0.171875, y: 0.296875 },
{ x: 0.171875, y: 0.296875 },
{ x: 0.203125, y: 0.296875 },
{ x: 0.203125, y: 0.296875 },
{ x: 0.234375, y: 0.296875 },
{ x: 0.234375, y: 0.296875 },
{ x: 0.265625, y: 0.296875 },
{ x: 0.265625, y: 0.296875 },
{ x: 0.296875, y: 0.296875 },
{ x: 0.296875, y: 0.296875 },
{ x: 0.328125, y: 0.296875 },
{ x: 0.328125, y: 0.296875 },
{ x: 0.359375, y: 0.296875 },
{ x: 0.359375, y: 0.296875 },
{ x: 0.390625, y: 0.296875 },
{ x: 0.390625, y: 0.296875 },
{ x: 0.421875, y: 0.296875 },
{ x: 0.421875, y: 0.296875 },
{ x: 0.453125, y: 0.296875 },
{ x: 0.453125, y: 0.296875 },
{ x: 0.484375, y: 0.296875 },
{ x: 0.484375, y: 0.296875 },
{ x: 0.515625, y: 0.296875 },
{ x: 0.515625, y: 0.296875 },
{ x: 0.546875, y: 0.296875 },
{ x: 0.546875, y: 0.296875 },
{ x: 0.578125, y: 0.296875 },
{ x: 0.578125, y: 0.296875 },
{ x: 0.609375, y: 0.296875 },
{ x: 0.609375, y: 0.296875 },
{ x: 0.640625, y: 0.296875 },
{ x: 0.640625, y: 0.296875 },
{ x: 0.671875, y: 0.296875 },
{ x: 0.671875, y: 0.296875 },
{ x: 0.703125, y: 0.296875 },
{ x: 0.703125, y: 0.296875 },
{ x: 0.734375, y: 0.296875 },
{ x: 0.734375, y: 0.296875 },
{ x: 0.765625, y: 0.296875 },
{ x: 0.765625, y: 0.296875 },
{ x: 0.796875, y: 0.296875 },
{ x: 0.796875, y: 0.296875 },
{ x: 0.828125, y: 0.296875 },
{ x: 0.828125, y: 0.296875 },
{ x: 0.859375, y: 0.296875 },
{ x: 0.859375, y: 0.296875 },
{ x: 0.890625, y: 0.296875 },
{ x: 0.890625, y: 0.296875 },
{ x: 0.921875, y: 0.296875 },
{ x: 0.921875, y: 0.296875 },
{ x: 0.953125, y: 0.296875 },
{ x: 0.953125, y: 0.296875 },
{ x: 0.984375, y: 0.296875 },
{ x: 0.984375, y: 0.296875 },
{ x: 0.015625, y: 0.328125 },
{ x: 0.015625, y: 0.328125 },
{ x: 0.046875, y: 0.328125 },
{ x: 0.046875, y: 0.328125 },
{ x: 0.078125, y: 0.328125 },
{ x: 0.078125, y: 0.328125 },
{ x: 0.109375, y: 0.328125 },
{ x: 0.109375, y: 0.328125 },
{ x: 0.140625, y: 0.328125 },
{ x: 0.140625, y: 0.328125 },
{ x: 0.171875, y: 0.328125 },
{ x: 0.171875, y: 0.328125 },
{ x: 0.203125, y: 0.328125 },
{ x: 0.203125, y: 0.328125 },
{ x: 0.234375, y: 0.328125 },
{ x: 0.234375, y: 0.328125 },
{ x: 0.265625, y: 0.328125 },
{ x: 0.265625, y: 0.328125 },
{ x: 0.296875, y: 0.328125 },
{ x: 0.296875, y: 0.328125 },
{ x: 0.328125, y: 0.328125 },
{ x: 0.328125, y: 0.328125 },
{ x: 0.359375, y: 0.328125 },
{ x: 0.359375, y: 0.328125 },
{ x: 0.390625, y: 0.328125 },
{ x: 0.390625, y: 0.328125 },
{ x: 0.421875, y: 0.328125 },
{ x: 0.421875, y: 0.328125 },
{ x: 0.453125, y: 0.328125 },
{ x: 0.453125, y: 0.328125 },
{ x: 0.484375, y: 0.328125 },
{ x: 0.484375, y: 0.328125 },
{ x: 0.515625, y: 0.328125 },
{ x: 0.515625, y: 0.328125 },
{ x: 0.546875, y: 0.328125 },
{ x: 0.546875, y: 0.328125 },
{ x: 0.578125, y: 0.328125 },
{ x: 0.578125, y: 0.328125 },
{ x: 0.609375, y: 0.328125 },
{ x: 0.609375, y: 0.328125 },
{ x: 0.640625, y: 0.328125 },
{ x: 0.640625, y: 0.328125 },
{ x: 0.671875, y: 0.328125 },
{ x: 0.671875, y: 0.328125 },
{ x: 0.703125, y: 0.328125 },
{ x: 0.703125, y: 0.328125 },
{ x: 0.734375, y: 0.328125 },
{ x: 0.734375, y: 0.328125 },
{ x: 0.765625, y: 0.328125 },
{ x: 0.765625, y: 0.328125 },
{ x: 0.796875, y: 0.328125 },
{ x: 0.796875, y: 0.328125 },
{ x: 0.828125, y: 0.328125 },
{ x: 0.828125, y: 0.328125 },
{ x: 0.859375, y: 0.328125 },
{ x: 0.859375, y: 0.328125 },
{ x: 0.890625, y: 0.328125 },
{ x: 0.890625, y: 0.328125 },
{ x: 0.921875, y: 0.328125 },
{ x: 0.921875, y: 0.328125 },
{ x: 0.953125, y: 0.328125 },
{ x: 0.953125, y: 0.328125 },
{ x: 0.984375, y: 0.328125 },
{ x: 0.984375, y: 0.328125 },
{ x: 0.015625, y: 0.359375 },
{ x: 0.015625, y: 0.359375 },
{ x: 0.046875, y: 0.359375 },
{ x: 0.046875, y: 0.359375 },
{ x: 0.078125, y: 0.359375 },
{ x: 0.078125, y: 0.359375 },
{ x: 0.109375, y: 0.359375 },
{ x: 0.109375, y: 0.359375 },
{ x: 0.140625, y: 0.359375 },
{ x: 0.140625, y: 0.359375 },
{ x: 0.171875, y: 0.359375 },
{ x: 0.171875, y: 0.359375 },
{ x: 0.203125, y: 0.359375 },
{ x: 0.203125, y: 0.359375 },
{ x: 0.234375, y: 0.359375 },
{ x: 0.234375, y: 0.359375 },
{ x: 0.265625, y: 0.359375 },
{ x: 0.265625, y: 0.359375 },
{ x: 0.296875, y: 0.359375 },
{ x: 0.296875, y: 0.359375 },
{ x: 0.328125, y: 0.359375 },
{ x: 0.328125, y: 0.359375 },
{ x: 0.359375, y: 0.359375 },
{ x: 0.359375, y: 0.359375 },
{ x: 0.390625, y: 0.359375 },
{ x: 0.390625, y: 0.359375 },
{ x: 0.421875, y: 0.359375 },
{ x: 0.421875, y: 0.359375 },
{ x: 0.453125, y: 0.359375 },
{ x: 0.453125, y: 0.359375 },
{ x: 0.484375, y: 0.359375 },
{ x: 0.484375, y: 0.359375 },
{ x: 0.515625, y: 0.359375 },
{ x: 0.515625, y: 0.359375 },
{ x: 0.546875, y: 0.359375 },
{ x: 0.546875, y: 0.359375 },
{ x: 0.578125, y: 0.359375 },
{ x: 0.578125, y: 0.359375 },
{ x: 0.609375, y: 0.359375 },
{ x: 0.609375, y: 0.359375 },
{ x: 0.640625, y: 0.359375 },
{ x: 0.640625, y: 0.359375 },
{ x: 0.671875, y: 0.359375 },
{ x: 0.671875, y: 0.359375 },
{ x: 0.703125, y: 0.359375 },
{ x: 0.703125, y: 0.359375 },
{ x: 0.734375, y: 0.359375 },
{ x: 0.734375, y: 0.359375 },
{ x: 0.765625, y: 0.359375 },
{ x: 0.765625, y: 0.359375 },
{ x: 0.796875, y: 0.359375 },
{ x: 0.796875, y: 0.359375 },
{ x: 0.828125, y: 0.359375 },
{ x: 0.828125, y: 0.359375 },
{ x: 0.859375, y: 0.359375 },
{ x: 0.859375, y: 0.359375 },
{ x: 0.890625, y: 0.359375 },
{ x: 0.890625, y: 0.359375 },
{ x: 0.921875, y: 0.359375 },
{ x: 0.921875, y: 0.359375 },
{ x: 0.953125, y: 0.359375 },
{ x: 0.953125, y: 0.359375 },
{ x: 0.984375, y: 0.359375 },
{ x: 0.984375, y: 0.359375 },
{ x: 0.015625, y: 0.390625 },
{ x: 0.015625, y: 0.390625 },
{ x: 0.046875, y: 0.390625 },
{ x: 0.046875, y: 0.390625 },
{ x: 0.078125, y: 0.390625 },
{ x: 0.078125, y: 0.390625 },
{ x: 0.109375, y: 0.390625 },
{ x: 0.109375, y: 0.390625 },
{ x: 0.140625, y: 0.390625 },
{ x: 0.140625, y: 0.390625 },
{ x: 0.171875, y: 0.390625 },
{ x: 0.171875, y: 0.390625 },
{ x: 0.203125, y: 0.390625 },
{ x: 0.203125, y: 0.390625 },
{ x: 0.234375, y: 0.390625 },
{ x: 0.234375, y: 0.390625 },
{ x: 0.265625, y: 0.390625 },
{ x: 0.265625, y: 0.390625 },
{ x: 0.296875, y: 0.390625 },
{ x: 0.296875, y: 0.390625 },
{ x: 0.328125, y: 0.390625 },
{ x: 0.328125, y: 0.390625 },
{ x: 0.359375, y: 0.390625 },
{ x: 0.359375, y: 0.390625 },
{ x: 0.390625, y: 0.390625 },
{ x: 0.390625, y: 0.390625 },
{ x: 0.421875, y: 0.390625 },
{ x: 0.421875, y: 0.390625 },
{ x: 0.453125, y: 0.390625 },
{ x: 0.453125, y: 0.390625 },
{ x: 0.484375, y: 0.390625 },
{ x: 0.484375, y: 0.390625 },
{ x: 0.515625, y: 0.390625 },
{ x: 0.515625, y: 0.390625 },
{ x: 0.546875, y: 0.390625 },
{ x: 0.546875, y: 0.390625 },
{ x: 0.578125, y: 0.390625 },
{ x: 0.578125, y: 0.390625 },
{ x: 0.609375, y: 0.390625 },
{ x: 0.609375, y: 0.390625 },
{ x: 0.640625, y: 0.390625 },
{ x: 0.640625, y: 0.390625 },
{ x: 0.671875, y: 0.390625 },
{ x: 0.671875, y: 0.390625 },
{ x: 0.703125, y: 0.390625 },
{ x: 0.703125, y: 0.390625 },
{ x: 0.734375, y: 0.390625 },
{ x: 0.734375, y: 0.390625 },
{ x: 0.765625, y: 0.390625 },
{ x: 0.765625, y: 0.390625 },
{ x: 0.796875, y: 0.390625 },
{ x: 0.796875, y: 0.390625 },
{ x: 0.828125, y: 0.390625 },
{ x: 0.828125, y: 0.390625 },
{ x: 0.859375, y: 0.390625 },
{ x: 0.859375, y: 0.390625 },
{ x: 0.890625, y: 0.390625 },
{ x: 0.890625, y: 0.390625 },
{ x: 0.921875, y: 0.390625 },
{ x: 0.921875, y: 0.390625 },
{ x: 0.953125, y: 0.390625 },
{ x: 0.953125, y: 0.390625 },
{ x: 0.984375, y: 0.390625 },
{ x: 0.984375, y: 0.390625 },
{ x: 0.015625, y: 0.421875 },
{ x: 0.015625, y: 0.421875 },
{ x: 0.046875, y: 0.421875 },
{ x: 0.046875, y: 0.421875 },
{ x: 0.078125, y: 0.421875 },
{ x: 0.078125, y: 0.421875 },
{ x: 0.109375, y: 0.421875 },
{ x: 0.109375, y: 0.421875 },
{ x: 0.140625, y: 0.421875 },
{ x: 0.140625, y: 0.421875 },
{ x: 0.171875, y: 0.421875 },
{ x: 0.171875, y: 0.421875 },
{ x: 0.203125, y: 0.421875 },
{ x: 0.203125, y: 0.421875 },
{ x: 0.234375, y: 0.421875 },
{ x: 0.234375, y: 0.421875 },
{ x: 0.265625, y: 0.421875 },
{ x: 0.265625, y: 0.421875 },
{ x: 0.296875, y: 0.421875 },
{ x: 0.296875, y: 0.421875 },
{ x: 0.328125, y: 0.421875 },
{ x: 0.328125, y: 0.421875 },
{ x: 0.359375, y: 0.421875 },
{ x: 0.359375, y: 0.421875 },
{ x: 0.390625, y: 0.421875 },
{ x: 0.390625, y: 0.421875 },
{ x: 0.421875, y: 0.421875 },
{ x: 0.421875, y: 0.421875 },
{ x: 0.453125, y: 0.421875 },
{ x: 0.453125, y: 0.421875 },
{ x: 0.484375, y: 0.421875 },
{ x: 0.484375, y: 0.421875 },
{ x: 0.515625, y: 0.421875 },
{ x: 0.515625, y: 0.421875 },
{ x: 0.546875, y: 0.421875 },
{ x: 0.546875, y: 0.421875 },
{ x: 0.578125, y: 0.421875 },
{ x: 0.578125, y: 0.421875 },
{ x: 0.609375, y: 0.421875 },
{ x: 0.609375, y: 0.421875 },
{ x: 0.640625, y: 0.421875 },
{ x: 0.640625, y: 0.421875 },
{ x: 0.671875, y: 0.421875 },
{ x: 0.671875, y: 0.421875 },
{ x: 0.703125, y: 0.421875 },
{ x: 0.703125, y: 0.421875 },
{ x: 0.734375, y: 0.421875 },
{ x: 0.734375, y: 0.421875 },
{ x: 0.765625, y: 0.421875 },
{ x: 0.765625, y: 0.421875 },
{ x: 0.796875, y: 0.421875 },
{ x: 0.796875, y: 0.421875 },
{ x: 0.828125, y: 0.421875 },
{ x: 0.828125, y: 0.421875 },
{ x: 0.859375, y: 0.421875 },
{ x: 0.859375, y: 0.421875 },
{ x: 0.890625, y: 0.421875 },
{ x: 0.890625, y: 0.421875 },
{ x: 0.921875, y: 0.421875 },
{ x: 0.921875, y: 0.421875 },
{ x: 0.953125, y: 0.421875 },
{ x: 0.953125, y: 0.421875 },
{ x: 0.984375, y: 0.421875 },
{ x: 0.984375, y: 0.421875 },
{ x: 0.015625, y: 0.453125 },
{ x: 0.015625, y: 0.453125 },
{ x: 0.046875, y: 0.453125 },
{ x: 0.046875, y: 0.453125 },
{ x: 0.078125, y: 0.453125 },
{ x: 0.078125, y: 0.453125 },
{ x: 0.109375, y: 0.453125 },
{ x: 0.109375, y: 0.453125 },
{ x: 0.140625, y: 0.453125 },
{ x: 0.140625, y: 0.453125 },
{ x: 0.171875, y: 0.453125 },
{ x: 0.171875, y: 0.453125 },
{ x: 0.203125, y: 0.453125 },
{ x: 0.203125, y: 0.453125 },
{ x: 0.234375, y: 0.453125 },
{ x: 0.234375, y: 0.453125 },
{ x: 0.265625, y: 0.453125 },
{ x: 0.265625, y: 0.453125 },
{ x: 0.296875, y: 0.453125 },
{ x: 0.296875, y: 0.453125 },
{ x: 0.328125, y: 0.453125 },
{ x: 0.328125, y: 0.453125 },
{ x: 0.359375, y: 0.453125 },
{ x: 0.359375, y: 0.453125 },
{ x: 0.390625, y: 0.453125 },
{ x: 0.390625, y: 0.453125 },
{ x: 0.421875, y: 0.453125 },
{ x: 0.421875, y: 0.453125 },
{ x: 0.453125, y: 0.453125 },
{ x: 0.453125, y: 0.453125 },
{ x: 0.484375, y: 0.453125 },
{ x: 0.484375, y: 0.453125 },
{ x: 0.515625, y: 0.453125 },
{ x: 0.515625, y: 0.453125 },
{ x: 0.546875, y: 0.453125 },
{ x: 0.546875, y: 0.453125 },
{ x: 0.578125, y: 0.453125 },
{ x: 0.578125, y: 0.453125 },
{ x: 0.609375, y: 0.453125 },
{ x: 0.609375, y: 0.453125 },
{ x: 0.640625, y: 0.453125 },
{ x: 0.640625, y: 0.453125 },
{ x: 0.671875, y: 0.453125 },
{ x: 0.671875, y: 0.453125 },
{ x: 0.703125, y: 0.453125 },
{ x: 0.703125, y: 0.453125 },
{ x: 0.734375, y: 0.453125 },
{ x: 0.734375, y: 0.453125 },
{ x: 0.765625, y: 0.453125 },
{ x: 0.765625, y: 0.453125 },
{ x: 0.796875, y: 0.453125 },
{ x: 0.796875, y: 0.453125 },
{ x: 0.828125, y: 0.453125 },
{ x: 0.828125, y: 0.453125 },
{ x: 0.859375, y: 0.453125 },
{ x: 0.859375, y: 0.453125 },
{ x: 0.890625, y: 0.453125 },
{ x: 0.890625, y: 0.453125 },
{ x: 0.921875, y: 0.453125 },
{ x: 0.921875, y: 0.453125 },
{ x: 0.953125, y: 0.453125 },
{ x: 0.953125, y: 0.453125 },
{ x: 0.984375, y: 0.453125 },
{ x: 0.984375, y: 0.453125 },
{ x: 0.015625, y: 0.484375 },
{ x: 0.015625, y: 0.484375 },
{ x: 0.046875, y: 0.484375 },
{ x: 0.046875, y: 0.484375 },
{ x: 0.078125, y: 0.484375 },
{ x: 0.078125, y: 0.484375 },
{ x: 0.109375, y: 0.484375 },
{ x: 0.109375, y: 0.484375 },
{ x: 0.140625, y: 0.484375 },
{ x: 0.140625, y: 0.484375 },
{ x: 0.171875, y: 0.484375 },
{ x: 0.171875, y: 0.484375 },
{ x: 0.203125, y: 0.484375 },
{ x: 0.203125, y: 0.484375 },
{ x: 0.234375, y: 0.484375 },
{ x: 0.234375, y: 0.484375 },
{ x: 0.265625, y: 0.484375 },
{ x: 0.265625, y: 0.484375 },
{ x: 0.296875, y: 0.484375 },
{ x: 0.296875, y: 0.484375 },
{ x: 0.328125, y: 0.484375 },
{ x: 0.328125, y: 0.484375 },
{ x: 0.359375, y: 0.484375 },
{ x: 0.359375, y: 0.484375 },
{ x: 0.390625, y: 0.484375 },
{ x: 0.390625, y: 0.484375 },
{ x: 0.421875, y: 0.484375 },
{ x: 0.421875, y: 0.484375 },
{ x: 0.453125, y: 0.484375 },
{ x: 0.453125, y: 0.484375 },
{ x: 0.484375, y: 0.484375 },
{ x: 0.484375, y: 0.484375 },
{ x: 0.515625, y: 0.484375 },
{ x: 0.515625, y: 0.484375 },
{ x: 0.546875, y: 0.484375 },
{ x: 0.546875, y: 0.484375 },
{ x: 0.578125, y: 0.484375 },
{ x: 0.578125, y: 0.484375 },
{ x: 0.609375, y: 0.484375 },
{ x: 0.609375, y: 0.484375 },
{ x: 0.640625, y: 0.484375 },
{ x: 0.640625, y: 0.484375 },
{ x: 0.671875, y: 0.484375 },
{ x: 0.671875, y: 0.484375 },
{ x: 0.703125, y: 0.484375 },
{ x: 0.703125, y: 0.484375 },
{ x: 0.734375, y: 0.484375 },
{ x: 0.734375, y: 0.484375 },
{ x: 0.765625, y: 0.484375 },
{ x: 0.765625, y: 0.484375 },
{ x: 0.796875, y: 0.484375 },
{ x: 0.796875, y: 0.484375 },
{ x: 0.828125, y: 0.484375 },
{ x: 0.828125, y: 0.484375 },
{ x: 0.859375, y: 0.484375 },
{ x: 0.859375, y: 0.484375 },
{ x: 0.890625, y: 0.484375 },
{ x: 0.890625, y: 0.484375 },
{ x: 0.921875, y: 0.484375 },
{ x: 0.921875, y: 0.484375 },
{ x: 0.953125, y: 0.484375 },
{ x: 0.953125, y: 0.484375 },
{ x: 0.984375, y: 0.484375 },
{ x: 0.984375, y: 0.484375 },
{ x: 0.015625, y: 0.515625 },
{ x: 0.015625, y: 0.515625 },
{ x: 0.046875, y: 0.515625 },
{ x: 0.046875, y: 0.515625 },
{ x: 0.078125, y: 0.515625 },
{ x: 0.078125, y: 0.515625 },
{ x: 0.109375, y: 0.515625 },
{ x: 0.109375, y: 0.515625 },
{ x: 0.140625, y: 0.515625 },
{ x: 0.140625, y: 0.515625 },
{ x: 0.171875, y: 0.515625 },
{ x: 0.171875, y: 0.515625 },
{ x: 0.203125, y: 0.515625 },
{ x: 0.203125, y: 0.515625 },
{ x: 0.234375, y: 0.515625 },
{ x: 0.234375, y: 0.515625 },
{ x: 0.265625, y: 0.515625 },
{ x: 0.265625, y: 0.515625 },
{ x: 0.296875, y: 0.515625 },
{ x: 0.296875, y: 0.515625 },
{ x: 0.328125, y: 0.515625 },
{ x: 0.328125, y: 0.515625 },
{ x: 0.359375, y: 0.515625 },
{ x: 0.359375, y: 0.515625 },
{ x: 0.390625, y: 0.515625 },
{ x: 0.390625, y: 0.515625 },
{ x: 0.421875, y: 0.515625 },
{ x: 0.421875, y: 0.515625 },
{ x: 0.453125, y: 0.515625 },
{ x: 0.453125, y: 0.515625 },
{ x: 0.484375, y: 0.515625 },
{ x: 0.484375, y: 0.515625 },
{ x: 0.515625, y: 0.515625 },
{ x: 0.515625, y: 0.515625 },
{ x: 0.546875, y: 0.515625 },
{ x: 0.546875, y: 0.515625 },
{ x: 0.578125, y: 0.515625 },
{ x: 0.578125, y: 0.515625 },
{ x: 0.609375, y: 0.515625 },
{ x: 0.609375, y: 0.515625 },
{ x: 0.640625, y: 0.515625 },
{ x: 0.640625, y: 0.515625 },
{ x: 0.671875, y: 0.515625 },
{ x: 0.671875, y: 0.515625 },
{ x: 0.703125, y: 0.515625 },
{ x: 0.703125, y: 0.515625 },
{ x: 0.734375, y: 0.515625 },
{ x: 0.734375, y: 0.515625 },
{ x: 0.765625, y: 0.515625 },
{ x: 0.765625, y: 0.515625 },
{ x: 0.796875, y: 0.515625 },
{ x: 0.796875, y: 0.515625 },
{ x: 0.828125, y: 0.515625 },
{ x: 0.828125, y: 0.515625 },
{ x: 0.859375, y: 0.515625 },
{ x: 0.859375, y: 0.515625 },
{ x: 0.890625, y: 0.515625 },
{ x: 0.890625, y: 0.515625 },
{ x: 0.921875, y: 0.515625 },
{ x: 0.921875, y: 0.515625 },
{ x: 0.953125, y: 0.515625 },
{ x: 0.953125, y: 0.515625 },
{ x: 0.984375, y: 0.515625 },
{ x: 0.984375, y: 0.515625 },
{ x: 0.015625, y: 0.546875 },
{ x: 0.015625, y: 0.546875 },
{ x: 0.046875, y: 0.546875 },
{ x: 0.046875, y: 0.546875 },
{ x: 0.078125, y: 0.546875 },
{ x: 0.078125, y: 0.546875 },
{ x: 0.109375, y: 0.546875 },
{ x: 0.109375, y: 0.546875 },
{ x: 0.140625, y: 0.546875 },
{ x: 0.140625, y: 0.546875 },
{ x: 0.171875, y: 0.546875 },
{ x: 0.171875, y: 0.546875 },
{ x: 0.203125, y: 0.546875 },
{ x: 0.203125, y: 0.546875 },
{ x: 0.234375, y: 0.546875 },
{ x: 0.234375, y: 0.546875 },
{ x: 0.265625, y: 0.546875 },
{ x: 0.265625, y: 0.546875 },
{ x: 0.296875, y: 0.546875 },
{ x: 0.296875, y: 0.546875 },
{ x: 0.328125, y: 0.546875 },
{ x: 0.328125, y: 0.546875 },
{ x: 0.359375, y: 0.546875 },
{ x: 0.359375, y: 0.546875 },
{ x: 0.390625, y: 0.546875 },
{ x: 0.390625, y: 0.546875 },
{ x: 0.421875, y: 0.546875 },
{ x: 0.421875, y: 0.546875 },
{ x: 0.453125, y: 0.546875 },
{ x: 0.453125, y: 0.546875 },
{ x: 0.484375, y: 0.546875 },
{ x: 0.484375, y: 0.546875 },
{ x: 0.515625, y: 0.546875 },
{ x: 0.515625, y: 0.546875 },
{ x: 0.546875, y: 0.546875 },
{ x: 0.546875, y: 0.546875 },
{ x: 0.578125, y: 0.546875 },
{ x: 0.578125, y: 0.546875 },
{ x: 0.609375, y: 0.546875 },
{ x: 0.609375, y: 0.546875 },
{ x: 0.640625, y: 0.546875 },
{ x: 0.640625, y: 0.546875 },
{ x: 0.671875, y: 0.546875 },
{ x: 0.671875, y: 0.546875 },
{ x: 0.703125, y: 0.546875 },
{ x: 0.703125, y: 0.546875 },
{ x: 0.734375, y: 0.546875 },
{ x: 0.734375, y: 0.546875 },
{ x: 0.765625, y: 0.546875 },
{ x: 0.765625, y: 0.546875 },
{ x: 0.796875, y: 0.546875 },
{ x: 0.796875, y: 0.546875 },
{ x: 0.828125, y: 0.546875 },
{ x: 0.828125, y: 0.546875 },
{ x: 0.859375, y: 0.546875 },
{ x: 0.859375, y: 0.546875 },
{ x: 0.890625, y: 0.546875 },
{ x: 0.890625, y: 0.546875 },
{ x: 0.921875, y: 0.546875 },
{ x: 0.921875, y: 0.546875 },
{ x: 0.953125, y: 0.546875 },
{ x: 0.953125, y: 0.546875 },
{ x: 0.984375, y: 0.546875 },
{ x: 0.984375, y: 0.546875 },
{ x: 0.015625, y: 0.578125 },
{ x: 0.015625, y: 0.578125 },
{ x: 0.046875, y: 0.578125 },
{ x: 0.046875, y: 0.578125 },
{ x: 0.078125, y: 0.578125 },
{ x: 0.078125, y: 0.578125 },
{ x: 0.109375, y: 0.578125 },
{ x: 0.109375, y: 0.578125 },
{ x: 0.140625, y: 0.578125 },
{ x: 0.140625, y: 0.578125 },
{ x: 0.171875, y: 0.578125 },
{ x: 0.171875, y: 0.578125 },
{ x: 0.203125, y: 0.578125 },
{ x: 0.203125, y: 0.578125 },
{ x: 0.234375, y: 0.578125 },
{ x: 0.234375, y: 0.578125 },
{ x: 0.265625, y: 0.578125 },
{ x: 0.265625, y: 0.578125 },
{ x: 0.296875, y: 0.578125 },
{ x: 0.296875, y: 0.578125 },
{ x: 0.328125, y: 0.578125 },
{ x: 0.328125, y: 0.578125 },
{ x: 0.359375, y: 0.578125 },
{ x: 0.359375, y: 0.578125 },
{ x: 0.390625, y: 0.578125 },
{ x: 0.390625, y: 0.578125 },
{ x: 0.421875, y: 0.578125 },
{ x: 0.421875, y: 0.578125 },
{ x: 0.453125, y: 0.578125 },
{ x: 0.453125, y: 0.578125 },
{ x: 0.484375, y: 0.578125 },
{ x: 0.484375, y: 0.578125 },
{ x: 0.515625, y: 0.578125 },
{ x: 0.515625, y: 0.578125 },
{ x: 0.546875, y: 0.578125 },
{ x: 0.546875, y: 0.578125 },
{ x: 0.578125, y: 0.578125 },
{ x: 0.578125, y: 0.578125 },
{ x: 0.609375, y: 0.578125 },
{ x: 0.609375, y: 0.578125 },
{ x: 0.640625, y: 0.578125 },
{ x: 0.640625, y: 0.578125 },
{ x: 0.671875, y: 0.578125 },
{ x: 0.671875, y: 0.578125 },
{ x: 0.703125, y: 0.578125 },
{ x: 0.703125, y: 0.578125 },
{ x: 0.734375, y: 0.578125 },
{ x: 0.734375, y: 0.578125 },
{ x: 0.765625, y: 0.578125 },
{ x: 0.765625, y: 0.578125 },
{ x: 0.796875, y: 0.578125 },
{ x: 0.796875, y: 0.578125 },
{ x: 0.828125, y: 0.578125 },
{ x: 0.828125, y: 0.578125 },
{ x: 0.859375, y: 0.578125 },
{ x: 0.859375, y: 0.578125 },
{ x: 0.890625, y: 0.578125 },
{ x: 0.890625, y: 0.578125 },
{ x: 0.921875, y: 0.578125 },
{ x: 0.921875, y: 0.578125 },
{ x: 0.953125, y: 0.578125 },
{ x: 0.953125, y: 0.578125 },
{ x: 0.984375, y: 0.578125 },
{ x: 0.984375, y: 0.578125 },
{ x: 0.015625, y: 0.609375 },
{ x: 0.015625, y: 0.609375 },
{ x: 0.046875, y: 0.609375 },
{ x: 0.046875, y: 0.609375 },
{ x: 0.078125, y: 0.609375 },
{ x: 0.078125, y: 0.609375 },
{ x: 0.109375, y: 0.609375 },
{ x: 0.109375, y: 0.609375 },
{ x: 0.140625, y: 0.609375 },
{ x: 0.140625, y: 0.609375 },
{ x: 0.171875, y: 0.609375 },
{ x: 0.171875, y: 0.609375 },
{ x: 0.203125, y: 0.609375 },
{ x: 0.203125, y: 0.609375 },
{ x: 0.234375, y: 0.609375 },
{ x: 0.234375, y: 0.609375 },
{ x: 0.265625, y: 0.609375 },
{ x: 0.265625, y: 0.609375 },
{ x: 0.296875, y: 0.609375 },
{ x: 0.296875, y: 0.609375 },
{ x: 0.328125, y: 0.609375 },
{ x: 0.328125, y: 0.609375 },
{ x: 0.359375, y: 0.609375 },
{ x: 0.359375, y: 0.609375 },
{ x: 0.390625, y: 0.609375 },
{ x: 0.390625, y: 0.609375 },
{ x: 0.421875, y: 0.609375 },
{ x: 0.421875, y: 0.609375 },
{ x: 0.453125, y: 0.609375 },
{ x: 0.453125, y: 0.609375 },
{ x: 0.484375, y: 0.609375 },
{ x: 0.484375, y: 0.609375 },
{ x: 0.515625, y: 0.609375 },
{ x: 0.515625, y: 0.609375 },
{ x: 0.546875, y: 0.609375 },
{ x: 0.546875, y: 0.609375 },
{ x: 0.578125, y: 0.609375 },
{ x: 0.578125, y: 0.609375 },
{ x: 0.609375, y: 0.609375 },
{ x: 0.609375, y: 0.609375 },
{ x: 0.640625, y: 0.609375 },
{ x: 0.640625, y: 0.609375 },
{ x: 0.671875, y: 0.609375 },
{ x: 0.671875, y: 0.609375 },
{ x: 0.703125, y: 0.609375 },
{ x: 0.703125, y: 0.609375 },
{ x: 0.734375, y: 0.609375 },
{ x: 0.734375, y: 0.609375 },
{ x: 0.765625, y: 0.609375 },
{ x: 0.765625, y: 0.609375 },
{ x: 0.796875, y: 0.609375 },
{ x: 0.796875, y: 0.609375 },
{ x: 0.828125, y: 0.609375 },
{ x: 0.828125, y: 0.609375 },
{ x: 0.859375, y: 0.609375 },
{ x: 0.859375, y: 0.609375 },
{ x: 0.890625, y: 0.609375 },
{ x: 0.890625, y: 0.609375 },
{ x: 0.921875, y: 0.609375 },
{ x: 0.921875, y: 0.609375 },
{ x: 0.953125, y: 0.609375 },
{ x: 0.953125, y: 0.609375 },
{ x: 0.984375, y: 0.609375 },
{ x: 0.984375, y: 0.609375 },
{ x: 0.015625, y: 0.640625 },
{ x: 0.015625, y: 0.640625 },
{ x: 0.046875, y: 0.640625 },
{ x: 0.046875, y: 0.640625 },
{ x: 0.078125, y: 0.640625 },
{ x: 0.078125, y: 0.640625 },
{ x: 0.109375, y: 0.640625 },
{ x: 0.109375, y: 0.640625 },
{ x: 0.140625, y: 0.640625 },
{ x: 0.140625, y: 0.640625 },
{ x: 0.171875, y: 0.640625 },
{ x: 0.171875, y: 0.640625 },
{ x: 0.203125, y: 0.640625 },
{ x: 0.203125, y: 0.640625 },
{ x: 0.234375, y: 0.640625 },
{ x: 0.234375, y: 0.640625 },
{ x: 0.265625, y: 0.640625 },
{ x: 0.265625, y: 0.640625 },
{ x: 0.296875, y: 0.640625 },
{ x: 0.296875, y: 0.640625 },
{ x: 0.328125, y: 0.640625 },
{ x: 0.328125, y: 0.640625 },
{ x: 0.359375, y: 0.640625 },
{ x: 0.359375, y: 0.640625 },
{ x: 0.390625, y: 0.640625 },
{ x: 0.390625, y: 0.640625 },
{ x: 0.421875, y: 0.640625 },
{ x: 0.421875, y: 0.640625 },
{ x: 0.453125, y: 0.640625 },
{ x: 0.453125, y: 0.640625 },
{ x: 0.484375, y: 0.640625 },
{ x: 0.484375, y: 0.640625 },
{ x: 0.515625, y: 0.640625 },
{ x: 0.515625, y: 0.640625 },
{ x: 0.546875, y: 0.640625 },
{ x: 0.546875, y: 0.640625 },
{ x: 0.578125, y: 0.640625 },
{ x: 0.578125, y: 0.640625 },
{ x: 0.609375, y: 0.640625 },
{ x: 0.609375, y: 0.640625 },
{ x: 0.640625, y: 0.640625 },
{ x: 0.640625, y: 0.640625 },
{ x: 0.671875, y: 0.640625 },
{ x: 0.671875, y: 0.640625 },
{ x: 0.703125, y: 0.640625 },
{ x: 0.703125, y: 0.640625 },
{ x: 0.734375, y: 0.640625 },
{ x: 0.734375, y: 0.640625 },
{ x: 0.765625, y: 0.640625 },
{ x: 0.765625, y: 0.640625 },
{ x: 0.796875, y: 0.640625 },
{ x: 0.796875, y: 0.640625 },
{ x: 0.828125, y: 0.640625 },
{ x: 0.828125, y: 0.640625 },
{ x: 0.859375, y: 0.640625 },
{ x: 0.859375, y: 0.640625 },
{ x: 0.890625, y: 0.640625 },
{ x: 0.890625, y: 0.640625 },
{ x: 0.921875, y: 0.640625 },
{ x: 0.921875, y: 0.640625 },
{ x: 0.953125, y: 0.640625 },
{ x: 0.953125, y: 0.640625 },
{ x: 0.984375, y: 0.640625 },
{ x: 0.984375, y: 0.640625 },
{ x: 0.015625, y: 0.671875 },
{ x: 0.015625, y: 0.671875 },
{ x: 0.046875, y: 0.671875 },
{ x: 0.046875, y: 0.671875 },
{ x: 0.078125, y: 0.671875 },
{ x: 0.078125, y: 0.671875 },
{ x: 0.109375, y: 0.671875 },
{ x: 0.109375, y: 0.671875 },
{ x: 0.140625, y: 0.671875 },
{ x: 0.140625, y: 0.671875 },
{ x: 0.171875, y: 0.671875 },
{ x: 0.171875, y: 0.671875 },
{ x: 0.203125, y: 0.671875 },
{ x: 0.203125, y: 0.671875 },
{ x: 0.234375, y: 0.671875 },
{ x: 0.234375, y: 0.671875 },
{ x: 0.265625, y: 0.671875 },
{ x: 0.265625, y: 0.671875 },
{ x: 0.296875, y: 0.671875 },
{ x: 0.296875, y: 0.671875 },
{ x: 0.328125, y: 0.671875 },
{ x: 0.328125, y: 0.671875 },
{ x: 0.359375, y: 0.671875 },
{ x: 0.359375, y: 0.671875 },
{ x: 0.390625, y: 0.671875 },
{ x: 0.390625, y: 0.671875 },
{ x: 0.421875, y: 0.671875 },
{ x: 0.421875, y: 0.671875 },
{ x: 0.453125, y: 0.671875 },
{ x: 0.453125, y: 0.671875 },
{ x: 0.484375, y: 0.671875 },
{ x: 0.484375, y: 0.671875 },
{ x: 0.515625, y: 0.671875 },
{ x: 0.515625, y: 0.671875 },
{ x: 0.546875, y: 0.671875 },
{ x: 0.546875, y: 0.671875 },
{ x: 0.578125, y: 0.671875 },
{ x: 0.578125, y: 0.671875 },
{ x: 0.609375, y: 0.671875 },
{ x: 0.609375, y: 0.671875 },
{ x: 0.640625, y: 0.671875 },
{ x: 0.640625, y: 0.671875 },
{ x: 0.671875, y: 0.671875 },
{ x: 0.671875, y: 0.671875 },
{ x: 0.703125, y: 0.671875 },
{ x: 0.703125, y: 0.671875 },
{ x: 0.734375, y: 0.671875 },
{ x: 0.734375, y: 0.671875 },
{ x: 0.765625, y: 0.671875 },
{ x: 0.765625, y: 0.671875 },
{ x: 0.796875, y: 0.671875 },
{ x: 0.796875, y: 0.671875 },
{ x: 0.828125, y: 0.671875 },
{ x: 0.828125, y: 0.671875 },
{ x: 0.859375, y: 0.671875 },
{ x: 0.859375, y: 0.671875 },
{ x: 0.890625, y: 0.671875 },
{ x: 0.890625, y: 0.671875 },
{ x: 0.921875, y: 0.671875 },
{ x: 0.921875, y: 0.671875 },
{ x: 0.953125, y: 0.671875 },
{ x: 0.953125, y: 0.671875 },
{ x: 0.984375, y: 0.671875 },
{ x: 0.984375, y: 0.671875 },
{ x: 0.015625, y: 0.703125 },
{ x: 0.015625, y: 0.703125 },
{ x: 0.046875, y: 0.703125 },
{ x: 0.046875, y: 0.703125 },
{ x: 0.078125, y: 0.703125 },
{ x: 0.078125, y: 0.703125 },
{ x: 0.109375, y: 0.703125 },
{ x: 0.109375, y: 0.703125 },
{ x: 0.140625, y: 0.703125 },
{ x: 0.140625, y: 0.703125 },
{ x: 0.171875, y: 0.703125 },
{ x: 0.171875, y: 0.703125 },
{ x: 0.203125, y: 0.703125 },
{ x: 0.203125, y: 0.703125 },
{ x: 0.234375, y: 0.703125 },
{ x: 0.234375, y: 0.703125 },
{ x: 0.265625, y: 0.703125 },
{ x: 0.265625, y: 0.703125 },
{ x: 0.296875, y: 0.703125 },
{ x: 0.296875, y: 0.703125 },
{ x: 0.328125, y: 0.703125 },
{ x: 0.328125, y: 0.703125 },
{ x: 0.359375, y: 0.703125 },
{ x: 0.359375, y: 0.703125 },
{ x: 0.390625, y: 0.703125 },
{ x: 0.390625, y: 0.703125 },
{ x: 0.421875, y: 0.703125 },
{ x: 0.421875, y: 0.703125 },
{ x: 0.453125, y: 0.703125 },
{ x: 0.453125, y: 0.703125 },
{ x: 0.484375, y: 0.703125 },
{ x: 0.484375, y: 0.703125 },
{ x: 0.515625, y: 0.703125 },
{ x: 0.515625, y: 0.703125 },
{ x: 0.546875, y: 0.703125 },
{ x: 0.546875, y: 0.703125 },
{ x: 0.578125, y: 0.703125 },
{ x: 0.578125, y: 0.703125 },
{ x: 0.609375, y: 0.703125 },
{ x: 0.609375, y: 0.703125 },
{ x: 0.640625, y: 0.703125 },
{ x: 0.640625, y: 0.703125 },
{ x: 0.671875, y: 0.703125 },
{ x: 0.671875, y: 0.703125 },
{ x: 0.703125, y: 0.703125 },
{ x: 0.703125, y: 0.703125 },
{ x: 0.734375, y: 0.703125 },
{ x: 0.734375, y: 0.703125 },
{ x: 0.765625, y: 0.703125 },
{ x: 0.765625, y: 0.703125 },
{ x: 0.796875, y: 0.703125 },
{ x: 0.796875, y: 0.703125 },
{ x: 0.828125, y: 0.703125 },
{ x: 0.828125, y: 0.703125 },
{ x: 0.859375, y: 0.703125 },
{ x: 0.859375, y: 0.703125 },
{ x: 0.890625, y: 0.703125 },
{ x: 0.890625, y: 0.703125 },
{ x: 0.921875, y: 0.703125 },
{ x: 0.921875, y: 0.703125 },
{ x: 0.953125, y: 0.703125 },
{ x: 0.953125, y: 0.703125 },
{ x: 0.984375, y: 0.703125 },
{ x: 0.984375, y: 0.703125 },
{ x: 0.015625, y: 0.734375 },
{ x: 0.015625, y: 0.734375 },
{ x: 0.046875, y: 0.734375 },
{ x: 0.046875, y: 0.734375 },
{ x: 0.078125, y: 0.734375 },
{ x: 0.078125, y: 0.734375 },
{ x: 0.109375, y: 0.734375 },
{ x: 0.109375, y: 0.734375 },
{ x: 0.140625, y: 0.734375 },
{ x: 0.140625, y: 0.734375 },
{ x: 0.171875, y: 0.734375 },
{ x: 0.171875, y: 0.734375 },
{ x: 0.203125, y: 0.734375 },
{ x: 0.203125, y: 0.734375 },
{ x: 0.234375, y: 0.734375 },
{ x: 0.234375, y: 0.734375 },
{ x: 0.265625, y: 0.734375 },
{ x: 0.265625, y: 0.734375 },
{ x: 0.296875, y: 0.734375 },
{ x: 0.296875, y: 0.734375 },
{ x: 0.328125, y: 0.734375 },
{ x: 0.328125, y: 0.734375 },
{ x: 0.359375, y: 0.734375 },
{ x: 0.359375, y: 0.734375 },
{ x: 0.390625, y: 0.734375 },
{ x: 0.390625, y: 0.734375 },
{ x: 0.421875, y: 0.734375 },
{ x: 0.421875, y: 0.734375 },
{ x: 0.453125, y: 0.734375 },
{ x: 0.453125, y: 0.734375 },
{ x: 0.484375, y: 0.734375 },
{ x: 0.484375, y: 0.734375 },
{ x: 0.515625, y: 0.734375 },
{ x: 0.515625, y: 0.734375 },
{ x: 0.546875, y: 0.734375 },
{ x: 0.546875, y: 0.734375 },
{ x: 0.578125, y: 0.734375 },
{ x: 0.578125, y: 0.734375 },
{ x: 0.609375, y: 0.734375 },
{ x: 0.609375, y: 0.734375 },
{ x: 0.640625, y: 0.734375 },
{ x: 0.640625, y: 0.734375 },
{ x: 0.671875, y: 0.734375 },
{ x: 0.671875, y: 0.734375 },
{ x: 0.703125, y: 0.734375 },
{ x: 0.703125, y: 0.734375 },
{ x: 0.734375, y: 0.734375 },
{ x: 0.734375, y: 0.734375 },
{ x: 0.765625, y: 0.734375 },
{ x: 0.765625, y: 0.734375 },
{ x: 0.796875, y: 0.734375 },
{ x: 0.796875, y: 0.734375 },
{ x: 0.828125, y: 0.734375 },
{ x: 0.828125, y: 0.734375 },
{ x: 0.859375, y: 0.734375 },
{ x: 0.859375, y: 0.734375 },
{ x: 0.890625, y: 0.734375 },
{ x: 0.890625, y: 0.734375 },
{ x: 0.921875, y: 0.734375 },
{ x: 0.921875, y: 0.734375 },
{ x: 0.953125, y: 0.734375 },
{ x: 0.953125, y: 0.734375 },
{ x: 0.984375, y: 0.734375 },
{ x: 0.984375, y: 0.734375 },
{ x: 0.015625, y: 0.765625 },
{ x: 0.015625, y: 0.765625 },
{ x: 0.046875, y: 0.765625 },
{ x: 0.046875, y: 0.765625 },
{ x: 0.078125, y: 0.765625 },
{ x: 0.078125, y: 0.765625 },
{ x: 0.109375, y: 0.765625 },
{ x: 0.109375, y: 0.765625 },
{ x: 0.140625, y: 0.765625 },
{ x: 0.140625, y: 0.765625 },
{ x: 0.171875, y: 0.765625 },
{ x: 0.171875, y: 0.765625 },
{ x: 0.203125, y: 0.765625 },
{ x: 0.203125, y: 0.765625 },
{ x: 0.234375, y: 0.765625 },
{ x: 0.234375, y: 0.765625 },
{ x: 0.265625, y: 0.765625 },
{ x: 0.265625, y: 0.765625 },
{ x: 0.296875, y: 0.765625 },
{ x: 0.296875, y: 0.765625 },
{ x: 0.328125, y: 0.765625 },
{ x: 0.328125, y: 0.765625 },
{ x: 0.359375, y: 0.765625 },
{ x: 0.359375, y: 0.765625 },
{ x: 0.390625, y: 0.765625 },
{ x: 0.390625, y: 0.765625 },
{ x: 0.421875, y: 0.765625 },
{ x: 0.421875, y: 0.765625 },
{ x: 0.453125, y: 0.765625 },
{ x: 0.453125, y: 0.765625 },
{ x: 0.484375, y: 0.765625 },
{ x: 0.484375, y: 0.765625 },
{ x: 0.515625, y: 0.765625 },
{ x: 0.515625, y: 0.765625 },
{ x: 0.546875, y: 0.765625 },
{ x: 0.546875, y: 0.765625 },
{ x: 0.578125, y: 0.765625 },
{ x: 0.578125, y: 0.765625 },
{ x: 0.609375, y: 0.765625 },
{ x: 0.609375, y: 0.765625 },
{ x: 0.640625, y: 0.765625 },
{ x: 0.640625, y: 0.765625 },
{ x: 0.671875, y: 0.765625 },
{ x: 0.671875, y: 0.765625 },
{ x: 0.703125, y: 0.765625 },
{ x: 0.703125, y: 0.765625 },
{ x: 0.734375, y: 0.765625 },
{ x: 0.734375, y: 0.765625 },
{ x: 0.765625, y: 0.765625 },
{ x: 0.765625, y: 0.765625 },
{ x: 0.796875, y: 0.765625 },
{ x: 0.796875, y: 0.765625 },
{ x: 0.828125, y: 0.765625 },
{ x: 0.828125, y: 0.765625 },
{ x: 0.859375, y: 0.765625 },
{ x: 0.859375, y: 0.765625 },
{ x: 0.890625, y: 0.765625 },
{ x: 0.890625, y: 0.765625 },
{ x: 0.921875, y: 0.765625 },
{ x: 0.921875, y: 0.765625 },
{ x: 0.953125, y: 0.765625 },
{ x: 0.953125, y: 0.765625 },
{ x: 0.984375, y: 0.765625 },
{ x: 0.984375, y: 0.765625 },
{ x: 0.015625, y: 0.796875 },
{ x: 0.015625, y: 0.796875 },
{ x: 0.046875, y: 0.796875 },
{ x: 0.046875, y: 0.796875 },
{ x: 0.078125, y: 0.796875 },
{ x: 0.078125, y: 0.796875 },
{ x: 0.109375, y: 0.796875 },
{ x: 0.109375, y: 0.796875 },
{ x: 0.140625, y: 0.796875 },
{ x: 0.140625, y: 0.796875 },
{ x: 0.171875, y: 0.796875 },
{ x: 0.171875, y: 0.796875 },
{ x: 0.203125, y: 0.796875 },
{ x: 0.203125, y: 0.796875 },
{ x: 0.234375, y: 0.796875 },
{ x: 0.234375, y: 0.796875 },
{ x: 0.265625, y: 0.796875 },
{ x: 0.265625, y: 0.796875 },
{ x: 0.296875, y: 0.796875 },
{ x: 0.296875, y: 0.796875 },
{ x: 0.328125, y: 0.796875 },
{ x: 0.328125, y: 0.796875 },
{ x: 0.359375, y: 0.796875 },
{ x: 0.359375, y: 0.796875 },
{ x: 0.390625, y: 0.796875 },
{ x: 0.390625, y: 0.796875 },
{ x: 0.421875, y: 0.796875 },
{ x: 0.421875, y: 0.796875 },
{ x: 0.453125, y: 0.796875 },
{ x: 0.453125, y: 0.796875 },
{ x: 0.484375, y: 0.796875 },
{ x: 0.484375, y: 0.796875 },
{ x: 0.515625, y: 0.796875 },
{ x: 0.515625, y: 0.796875 },
{ x: 0.546875, y: 0.796875 },
{ x: 0.546875, y: 0.796875 },
{ x: 0.578125, y: 0.796875 },
{ x: 0.578125, y: 0.796875 },
{ x: 0.609375, y: 0.796875 },
{ x: 0.609375, y: 0.796875 },
{ x: 0.640625, y: 0.796875 },
{ x: 0.640625, y: 0.796875 },
{ x: 0.671875, y: 0.796875 },
{ x: 0.671875, y: 0.796875 },
{ x: 0.703125, y: 0.796875 },
{ x: 0.703125, y: 0.796875 },
{ x: 0.734375, y: 0.796875 },
{ x: 0.734375, y: 0.796875 },
{ x: 0.765625, y: 0.796875 },
{ x: 0.765625, y: 0.796875 },
{ x: 0.796875, y: 0.796875 },
{ x: 0.796875, y: 0.796875 },
{ x: 0.828125, y: 0.796875 },
{ x: 0.828125, y: 0.796875 },
{ x: 0.859375, y: 0.796875 },
{ x: 0.859375, y: 0.796875 },
{ x: 0.890625, y: 0.796875 },
{ x: 0.890625, y: 0.796875 },
{ x: 0.921875, y: 0.796875 },
{ x: 0.921875, y: 0.796875 },
{ x: 0.953125, y: 0.796875 },
{ x: 0.953125, y: 0.796875 },
{ x: 0.984375, y: 0.796875 },
{ x: 0.984375, y: 0.796875 },
{ x: 0.015625, y: 0.828125 },
{ x: 0.015625, y: 0.828125 },
{ x: 0.046875, y: 0.828125 },
{ x: 0.046875, y: 0.828125 },
{ x: 0.078125, y: 0.828125 },
{ x: 0.078125, y: 0.828125 },
{ x: 0.109375, y: 0.828125 },
{ x: 0.109375, y: 0.828125 },
{ x: 0.140625, y: 0.828125 },
{ x: 0.140625, y: 0.828125 },
{ x: 0.171875, y: 0.828125 },
{ x: 0.171875, y: 0.828125 },
{ x: 0.203125, y: 0.828125 },
{ x: 0.203125, y: 0.828125 },
{ x: 0.234375, y: 0.828125 },
{ x: 0.234375, y: 0.828125 },
{ x: 0.265625, y: 0.828125 },
{ x: 0.265625, y: 0.828125 },
{ x: 0.296875, y: 0.828125 },
{ x: 0.296875, y: 0.828125 },
{ x: 0.328125, y: 0.828125 },
{ x: 0.328125, y: 0.828125 },
{ x: 0.359375, y: 0.828125 },
{ x: 0.359375, y: 0.828125 },
{ x: 0.390625, y: 0.828125 },
{ x: 0.390625, y: 0.828125 },
{ x: 0.421875, y: 0.828125 },
{ x: 0.421875, y: 0.828125 },
{ x: 0.453125, y: 0.828125 },
{ x: 0.453125, y: 0.828125 },
{ x: 0.484375, y: 0.828125 },
{ x: 0.484375, y: 0.828125 },
{ x: 0.515625, y: 0.828125 },
{ x: 0.515625, y: 0.828125 },
{ x: 0.546875, y: 0.828125 },
{ x: 0.546875, y: 0.828125 },
{ x: 0.578125, y: 0.828125 },
{ x: 0.578125, y: 0.828125 },
{ x: 0.609375, y: 0.828125 },
{ x: 0.609375, y: 0.828125 },
{ x: 0.640625, y: 0.828125 },
{ x: 0.640625, y: 0.828125 },
{ x: 0.671875, y: 0.828125 },
{ x: 0.671875, y: 0.828125 },
{ x: 0.703125, y: 0.828125 },
{ x: 0.703125, y: 0.828125 },
{ x: 0.734375, y: 0.828125 },
{ x: 0.734375, y: 0.828125 },
{ x: 0.765625, y: 0.828125 },
{ x: 0.765625, y: 0.828125 },
{ x: 0.796875, y: 0.828125 },
{ x: 0.796875, y: 0.828125 },
{ x: 0.828125, y: 0.828125 },
{ x: 0.828125, y: 0.828125 },
{ x: 0.859375, y: 0.828125 },
{ x: 0.859375, y: 0.828125 },
{ x: 0.890625, y: 0.828125 },
{ x: 0.890625, y: 0.828125 },
{ x: 0.921875, y: 0.828125 },
{ x: 0.921875, y: 0.828125 },
{ x: 0.953125, y: 0.828125 },
{ x: 0.953125, y: 0.828125 },
{ x: 0.984375, y: 0.828125 },
{ x: 0.984375, y: 0.828125 },
{ x: 0.015625, y: 0.859375 },
{ x: 0.015625, y: 0.859375 },
{ x: 0.046875, y: 0.859375 },
{ x: 0.046875, y: 0.859375 },
{ x: 0.078125, y: 0.859375 },
{ x: 0.078125, y: 0.859375 },
{ x: 0.109375, y: 0.859375 },
{ x: 0.109375, y: 0.859375 },
{ x: 0.140625, y: 0.859375 },
{ x: 0.140625, y: 0.859375 },
{ x: 0.171875, y: 0.859375 },
{ x: 0.171875, y: 0.859375 },
{ x: 0.203125, y: 0.859375 },
{ x: 0.203125, y: 0.859375 },
{ x: 0.234375, y: 0.859375 },
{ x: 0.234375, y: 0.859375 },
{ x: 0.265625, y: 0.859375 },
{ x: 0.265625, y: 0.859375 },
{ x: 0.296875, y: 0.859375 },
{ x: 0.296875, y: 0.859375 },
{ x: 0.328125, y: 0.859375 },
{ x: 0.328125, y: 0.859375 },
{ x: 0.359375, y: 0.859375 },
{ x: 0.359375, y: 0.859375 },
{ x: 0.390625, y: 0.859375 },
{ x: 0.390625, y: 0.859375 },
{ x: 0.421875, y: 0.859375 },
{ x: 0.421875, y: 0.859375 },
{ x: 0.453125, y: 0.859375 },
{ x: 0.453125, y: 0.859375 },
{ x: 0.484375, y: 0.859375 },
{ x: 0.484375, y: 0.859375 },
{ x: 0.515625, y: 0.859375 },
{ x: 0.515625, y: 0.859375 },
{ x: 0.546875, y: 0.859375 },
{ x: 0.546875, y: 0.859375 },
{ x: 0.578125, y: 0.859375 },
{ x: 0.578125, y: 0.859375 },
{ x: 0.609375, y: 0.859375 },
{ x: 0.609375, y: 0.859375 },
{ x: 0.640625, y: 0.859375 },
{ x: 0.640625, y: 0.859375 },
{ x: 0.671875, y: 0.859375 },
{ x: 0.671875, y: 0.859375 },
{ x: 0.703125, y: 0.859375 },
{ x: 0.703125, y: 0.859375 },
{ x: 0.734375, y: 0.859375 },
{ x: 0.734375, y: 0.859375 },
{ x: 0.765625, y: 0.859375 },
{ x: 0.765625, y: 0.859375 },
{ x: 0.796875, y: 0.859375 },
{ x: 0.796875, y: 0.859375 },
{ x: 0.828125, y: 0.859375 },
{ x: 0.828125, y: 0.859375 },
{ x: 0.859375, y: 0.859375 },
{ x: 0.859375, y: 0.859375 },
{ x: 0.890625, y: 0.859375 },
{ x: 0.890625, y: 0.859375 },
{ x: 0.921875, y: 0.859375 },
{ x: 0.921875, y: 0.859375 },
{ x: 0.953125, y: 0.859375 },
{ x: 0.953125, y: 0.859375 },
{ x: 0.984375, y: 0.859375 },
{ x: 0.984375, y: 0.859375 },
{ x: 0.015625, y: 0.890625 },
{ x: 0.015625, y: 0.890625 },
{ x: 0.046875, y: 0.890625 },
{ x: 0.046875, y: 0.890625 },
{ x: 0.078125, y: 0.890625 },
{ x: 0.078125, y: 0.890625 },
{ x: 0.109375, y: 0.890625 },
{ x: 0.109375, y: 0.890625 },
{ x: 0.140625, y: 0.890625 },
{ x: 0.140625, y: 0.890625 },
{ x: 0.171875, y: 0.890625 },
{ x: 0.171875, y: 0.890625 },
{ x: 0.203125, y: 0.890625 },
{ x: 0.203125, y: 0.890625 },
{ x: 0.234375, y: 0.890625 },
{ x: 0.234375, y: 0.890625 },
{ x: 0.265625, y: 0.890625 },
{ x: 0.265625, y: 0.890625 },
{ x: 0.296875, y: 0.890625 },
{ x: 0.296875, y: 0.890625 },
{ x: 0.328125, y: 0.890625 },
{ x: 0.328125, y: 0.890625 },
{ x: 0.359375, y: 0.890625 },
{ x: 0.359375, y: 0.890625 },
{ x: 0.390625, y: 0.890625 },
{ x: 0.390625, y: 0.890625 },
{ x: 0.421875, y: 0.890625 },
{ x: 0.421875, y: 0.890625 },
{ x: 0.453125, y: 0.890625 },
{ x: 0.453125, y: 0.890625 },
{ x: 0.484375, y: 0.890625 },
{ x: 0.484375, y: 0.890625 },
{ x: 0.515625, y: 0.890625 },
{ x: 0.515625, y: 0.890625 },
{ x: 0.546875, y: 0.890625 },
{ x: 0.546875, y: 0.890625 },
{ x: 0.578125, y: 0.890625 },
{ x: 0.578125, y: 0.890625 },
{ x: 0.609375, y: 0.890625 },
{ x: 0.609375, y: 0.890625 },
{ x: 0.640625, y: 0.890625 },
{ x: 0.640625, y: 0.890625 },
{ x: 0.671875, y: 0.890625 },
{ x: 0.671875, y: 0.890625 },
{ x: 0.703125, y: 0.890625 },
{ x: 0.703125, y: 0.890625 },
{ x: 0.734375, y: 0.890625 },
{ x: 0.734375, y: 0.890625 },
{ x: 0.765625, y: 0.890625 },
{ x: 0.765625, y: 0.890625 },
{ x: 0.796875, y: 0.890625 },
{ x: 0.796875, y: 0.890625 },
{ x: 0.828125, y: 0.890625 },
{ x: 0.828125, y: 0.890625 },
{ x: 0.859375, y: 0.890625 },
{ x: 0.859375, y: 0.890625 },
{ x: 0.890625, y: 0.890625 },
{ x: 0.890625, y: 0.890625 },
{ x: 0.921875, y: 0.890625 },
{ x: 0.921875, y: 0.890625 },
{ x: 0.953125, y: 0.890625 },
{ x: 0.953125, y: 0.890625 },
{ x: 0.984375, y: 0.890625 },
{ x: 0.984375, y: 0.890625 },
{ x: 0.015625, y: 0.921875 },
{ x: 0.015625, y: 0.921875 },
{ x: 0.046875, y: 0.921875 },
{ x: 0.046875, y: 0.921875 },
{ x: 0.078125, y: 0.921875 },
{ x: 0.078125, y: 0.921875 },
{ x: 0.109375, y: 0.921875 },
{ x: 0.109375, y: 0.921875 },
{ x: 0.140625, y: 0.921875 },
{ x: 0.140625, y: 0.921875 },
{ x: 0.171875, y: 0.921875 },
{ x: 0.171875, y: 0.921875 },
{ x: 0.203125, y: 0.921875 },
{ x: 0.203125, y: 0.921875 },
{ x: 0.234375, y: 0.921875 },
{ x: 0.234375, y: 0.921875 },
{ x: 0.265625, y: 0.921875 },
{ x: 0.265625, y: 0.921875 },
{ x: 0.296875, y: 0.921875 },
{ x: 0.296875, y: 0.921875 },
{ x: 0.328125, y: 0.921875 },
{ x: 0.328125, y: 0.921875 },
{ x: 0.359375, y: 0.921875 },
{ x: 0.359375, y: 0.921875 },
{ x: 0.390625, y: 0.921875 },
{ x: 0.390625, y: 0.921875 },
{ x: 0.421875, y: 0.921875 },
{ x: 0.421875, y: 0.921875 },
{ x: 0.453125, y: 0.921875 },
{ x: 0.453125, y: 0.921875 },
{ x: 0.484375, y: 0.921875 },
{ x: 0.484375, y: 0.921875 },
{ x: 0.515625, y: 0.921875 },
{ x: 0.515625, y: 0.921875 },
{ x: 0.546875, y: 0.921875 },
{ x: 0.546875, y: 0.921875 },
{ x: 0.578125, y: 0.921875 },
{ x: 0.578125, y: 0.921875 },
{ x: 0.609375, y: 0.921875 },
{ x: 0.609375, y: 0.921875 },
{ x: 0.640625, y: 0.921875 },
{ x: 0.640625, y: 0.921875 },
{ x: 0.671875, y: 0.921875 },
{ x: 0.671875, y: 0.921875 },
{ x: 0.703125, y: 0.921875 },
{ x: 0.703125, y: 0.921875 },
{ x: 0.734375, y: 0.921875 },
{ x: 0.734375, y: 0.921875 },
{ x: 0.765625, y: 0.921875 },
{ x: 0.765625, y: 0.921875 },
{ x: 0.796875, y: 0.921875 },
{ x: 0.796875, y: 0.921875 },
{ x: 0.828125, y: 0.921875 },
{ x: 0.828125, y: 0.921875 },
{ x: 0.859375, y: 0.921875 },
{ x: 0.859375, y: 0.921875 },
{ x: 0.890625, y: 0.921875 },
{ x: 0.890625, y: 0.921875 },
{ x: 0.921875, y: 0.921875 },
{ x: 0.921875, y: 0.921875 },
{ x: 0.953125, y: 0.921875 },
{ x: 0.953125, y: 0.921875 },
{ x: 0.984375, y: 0.921875 },
{ x: 0.984375, y: 0.921875 },
{ x: 0.015625, y: 0.953125 },
{ x: 0.015625, y: 0.953125 },
{ x: 0.046875, y: 0.953125 },
{ x: 0.046875, y: 0.953125 },
{ x: 0.078125, y: 0.953125 },
{ x: 0.078125, y: 0.953125 },
{ x: 0.109375, y: 0.953125 },
{ x: 0.109375, y: 0.953125 },
{ x: 0.140625, y: 0.953125 },
{ x: 0.140625, y: 0.953125 },
{ x: 0.171875, y: 0.953125 },
{ x: 0.171875, y: 0.953125 },
{ x: 0.203125, y: 0.953125 },
{ x: 0.203125, y: 0.953125 },
{ x: 0.234375, y: 0.953125 },
{ x: 0.234375, y: 0.953125 },
{ x: 0.265625, y: 0.953125 },
{ x: 0.265625, y: 0.953125 },
{ x: 0.296875, y: 0.953125 },
{ x: 0.296875, y: 0.953125 },
{ x: 0.328125, y: 0.953125 },
{ x: 0.328125, y: 0.953125 },
{ x: 0.359375, y: 0.953125 },
{ x: 0.359375, y: 0.953125 },
{ x: 0.390625, y: 0.953125 },
{ x: 0.390625, y: 0.953125 },
{ x: 0.421875, y: 0.953125 },
{ x: 0.421875, y: 0.953125 },
{ x: 0.453125, y: 0.953125 },
{ x: 0.453125, y: 0.953125 },
{ x: 0.484375, y: 0.953125 },
{ x: 0.484375, y: 0.953125 },
{ x: 0.515625, y: 0.953125 },
{ x: 0.515625, y: 0.953125 },
{ x: 0.546875, y: 0.953125 },
{ x: 0.546875, y: 0.953125 },
{ x: 0.578125, y: 0.953125 },
{ x: 0.578125, y: 0.953125 },
{ x: 0.609375, y: 0.953125 },
{ x: 0.609375, y: 0.953125 },
{ x: 0.640625, y: 0.953125 },
{ x: 0.640625, y: 0.953125 },
{ x: 0.671875, y: 0.953125 },
{ x: 0.671875, y: 0.953125 },
{ x: 0.703125, y: 0.953125 },
{ x: 0.703125, y: 0.953125 },
{ x: 0.734375, y: 0.953125 },
{ x: 0.734375, y: 0.953125 },
{ x: 0.765625, y: 0.953125 },
{ x: 0.765625, y: 0.953125 },
{ x: 0.796875, y: 0.953125 },
{ x: 0.796875, y: 0.953125 },
{ x: 0.828125, y: 0.953125 },
{ x: 0.828125, y: 0.953125 },
{ x: 0.859375, y: 0.953125 },
{ x: 0.859375, y: 0.953125 },
{ x: 0.890625, y: 0.953125 },
{ x: 0.890625, y: 0.953125 },
{ x: 0.921875, y: 0.953125 },
{ x: 0.921875, y: 0.953125 },
{ x: 0.953125, y: 0.953125 },
{ x: 0.953125, y: 0.953125 },
{ x: 0.984375, y: 0.953125 },
{ x: 0.984375, y: 0.953125 },
{ x: 0.015625, y: 0.984375 },
{ x: 0.015625, y: 0.984375 },
{ x: 0.046875, y: 0.984375 },
{ x: 0.046875, y: 0.984375 },
{ x: 0.078125, y: 0.984375 },
{ x: 0.078125, y: 0.984375 },
{ x: 0.109375, y: 0.984375 },
{ x: 0.109375, y: 0.984375 },
{ x: 0.140625, y: 0.984375 },
{ x: 0.140625, y: 0.984375 },
{ x: 0.171875, y: 0.984375 },
{ x: 0.171875, y: 0.984375 },
{ x: 0.203125, y: 0.984375 },
{ x: 0.203125, y: 0.984375 },
{ x: 0.234375, y: 0.984375 },
{ x: 0.234375, y: 0.984375 },
{ x: 0.265625, y: 0.984375 },
{ x: 0.265625, y: 0.984375 },
{ x: 0.296875, y: 0.984375 },
{ x: 0.296875, y: 0.984375 },
{ x: 0.328125, y: 0.984375 },
{ x: 0.328125, y: 0.984375 },
{ x: 0.359375, y: 0.984375 },
{ x: 0.359375, y: 0.984375 },
{ x: 0.390625, y: 0.984375 },
{ x: 0.390625, y: 0.984375 },
{ x: 0.421875, y: 0.984375 },
{ x: 0.421875, y: 0.984375 },
{ x: 0.453125, y: 0.984375 },
{ x: 0.453125, y: 0.984375 },
{ x: 0.484375, y: 0.984375 },
{ x: 0.484375, y: 0.984375 },
{ x: 0.515625, y: 0.984375 },
{ x: 0.515625, y: 0.984375 },
{ x: 0.546875, y: 0.984375 },
{ x: 0.546875, y: 0.984375 },
{ x: 0.578125, y: 0.984375 },
{ x: 0.578125, y: 0.984375 },
{ x: 0.609375, y: 0.984375 },
{ x: 0.609375, y: 0.984375 },
{ x: 0.640625, y: 0.984375 },
{ x: 0.640625, y: 0.984375 },
{ x: 0.671875, y: 0.984375 },
{ x: 0.671875, y: 0.984375 },
{ x: 0.703125, y: 0.984375 },
{ x: 0.703125, y: 0.984375 },
{ x: 0.734375, y: 0.984375 },
{ x: 0.734375, y: 0.984375 },
{ x: 0.765625, y: 0.984375 },
{ x: 0.765625, y: 0.984375 },
{ x: 0.796875, y: 0.984375 },
{ x: 0.796875, y: 0.984375 },
{ x: 0.828125, y: 0.984375 },
{ x: 0.828125, y: 0.984375 },
{ x: 0.859375, y: 0.984375 },
{ x: 0.859375, y: 0.984375 },
{ x: 0.890625, y: 0.984375 },
{ x: 0.890625, y: 0.984375 },
{ x: 0.921875, y: 0.984375 },
{ x: 0.921875, y: 0.984375 },
{ x: 0.953125, y: 0.984375 },
{ x: 0.953125, y: 0.984375 },
{ x: 0.984375, y: 0.984375 },
{ x: 0.984375, y: 0.984375 },
{ x: 0.03125, y: 0.03125 },
{ x: 0.03125, y: 0.03125 },
{ x: 0.09375, y: 0.03125 },
{ x: 0.09375, y: 0.03125 },
{ x: 0.15625, y: 0.03125 },
{ x: 0.15625, y: 0.03125 },
{ x: 0.21875, y: 0.03125 },
{ x: 0.21875, y: 0.03125 },
{ x: 0.28125, y: 0.03125 },
{ x: 0.28125, y: 0.03125 },
{ x: 0.34375, y: 0.03125 },
{ x: 0.34375, y: 0.03125 },
{ x: 0.40625, y: 0.03125 },
{ x: 0.40625, y: 0.03125 },
{ x: 0.46875, y: 0.03125 },
{ x: 0.46875, y: 0.03125 },
{ x: 0.53125, y: 0.03125 },
{ x: 0.53125, y: 0.03125 },
{ x: 0.59375, y: 0.03125 },
{ x: 0.59375, y: 0.03125 },
{ x: 0.65625, y: 0.03125 },
{ x: 0.65625, y: 0.03125 },
{ x: 0.71875, y: 0.03125 },
{ x: 0.71875, y: 0.03125 },
{ x: 0.78125, y: 0.03125 },
{ x: 0.78125, y: 0.03125 },
{ x: 0.84375, y: 0.03125 },
{ x: 0.84375, y: 0.03125 },
{ x: 0.90625, y: 0.03125 },
{ x: 0.90625, y: 0.03125 },
{ x: 0.96875, y: 0.03125 },
{ x: 0.96875, y: 0.03125 },
{ x: 0.03125, y: 0.09375 },
{ x: 0.03125, y: 0.09375 },
{ x: 0.09375, y: 0.09375 },
{ x: 0.09375, y: 0.09375 },
{ x: 0.15625, y: 0.09375 },
{ x: 0.15625, y: 0.09375 },
{ x: 0.21875, y: 0.09375 },
{ x: 0.21875, y: 0.09375 },
{ x: 0.28125, y: 0.09375 },
{ x: 0.28125, y: 0.09375 },
{ x: 0.34375, y: 0.09375 },
{ x: 0.34375, y: 0.09375 },
{ x: 0.40625, y: 0.09375 },
{ x: 0.40625, y: 0.09375 },
{ x: 0.46875, y: 0.09375 },
{ x: 0.46875, y: 0.09375 },
{ x: 0.53125, y: 0.09375 },
{ x: 0.53125, y: 0.09375 },
{ x: 0.59375, y: 0.09375 },
{ x: 0.59375, y: 0.09375 },
{ x: 0.65625, y: 0.09375 },
{ x: 0.65625, y: 0.09375 },
{ x: 0.71875, y: 0.09375 },
{ x: 0.71875, y: 0.09375 },
{ x: 0.78125, y: 0.09375 },
{ x: 0.78125, y: 0.09375 },
{ x: 0.84375, y: 0.09375 },
{ x: 0.84375, y: 0.09375 },
{ x: 0.90625, y: 0.09375 },
{ x: 0.90625, y: 0.09375 },
{ x: 0.96875, y: 0.09375 },
{ x: 0.96875, y: 0.09375 },
{ x: 0.03125, y: 0.15625 },
{ x: 0.03125, y: 0.15625 },
{ x: 0.09375, y: 0.15625 },
{ x: 0.09375, y: 0.15625 },
{ x: 0.15625, y: 0.15625 },
{ x: 0.15625, y: 0.15625 },
{ x: 0.21875, y: 0.15625 },
{ x: 0.21875, y: 0.15625 },
{ x: 0.28125, y: 0.15625 },
{ x: 0.28125, y: 0.15625 },
{ x: 0.34375, y: 0.15625 },
{ x: 0.34375, y: 0.15625 },
{ x: 0.40625, y: 0.15625 },
{ x: 0.40625, y: 0.15625 },
{ x: 0.46875, y: 0.15625 },
{ x: 0.46875, y: 0.15625 },
{ x: 0.53125, y: 0.15625 },
{ x: 0.53125, y: 0.15625 },
{ x: 0.59375, y: 0.15625 },
{ x: 0.59375, y: 0.15625 },
{ x: 0.65625, y: 0.15625 },
{ x: 0.65625, y: 0.15625 },
{ x: 0.71875, y: 0.15625 },
{ x: 0.71875, y: 0.15625 },
{ x: 0.78125, y: 0.15625 },
{ x: 0.78125, y: 0.15625 },
{ x: 0.84375, y: 0.15625 },
{ x: 0.84375, y: 0.15625 },
{ x: 0.90625, y: 0.15625 },
{ x: 0.90625, y: 0.15625 },
{ x: 0.96875, y: 0.15625 },
{ x: 0.96875, y: 0.15625 },
{ x: 0.03125, y: 0.21875 },
{ x: 0.03125, y: 0.21875 },
{ x: 0.09375, y: 0.21875 },
{ x: 0.09375, y: 0.21875 },
{ x: 0.15625, y: 0.21875 },
{ x: 0.15625, y: 0.21875 },
{ x: 0.21875, y: 0.21875 },
{ x: 0.21875, y: 0.21875 },
{ x: 0.28125, y: 0.21875 },
{ x: 0.28125, y: 0.21875 },
{ x: 0.34375, y: 0.21875 },
{ x: 0.34375, y: 0.21875 },
{ x: 0.40625, y: 0.21875 },
{ x: 0.40625, y: 0.21875 },
{ x: 0.46875, y: 0.21875 },
{ x: 0.46875, y: 0.21875 },
{ x: 0.53125, y: 0.21875 },
{ x: 0.53125, y: 0.21875 },
{ x: 0.59375, y: 0.21875 },
{ x: 0.59375, y: 0.21875 },
{ x: 0.65625, y: 0.21875 },
{ x: 0.65625, y: 0.21875 },
{ x: 0.71875, y: 0.21875 },
{ x: 0.71875, y: 0.21875 },
{ x: 0.78125, y: 0.21875 },
{ x: 0.78125, y: 0.21875 },
{ x: 0.84375, y: 0.21875 },
{ x: 0.84375, y: 0.21875 },
{ x: 0.90625, y: 0.21875 },
{ x: 0.90625, y: 0.21875 },
{ x: 0.96875, y: 0.21875 },
{ x: 0.96875, y: 0.21875 },
{ x: 0.03125, y: 0.28125 },
{ x: 0.03125, y: 0.28125 },
{ x: 0.09375, y: 0.28125 },
{ x: 0.09375, y: 0.28125 },
{ x: 0.15625, y: 0.28125 },
{ x: 0.15625, y: 0.28125 },
{ x: 0.21875, y: 0.28125 },
{ x: 0.21875, y: 0.28125 },
{ x: 0.28125, y: 0.28125 },
{ x: 0.28125, y: 0.28125 },
{ x: 0.34375, y: 0.28125 },
{ x: 0.34375, y: 0.28125 },
{ x: 0.40625, y: 0.28125 },
{ x: 0.40625, y: 0.28125 },
{ x: 0.46875, y: 0.28125 },
{ x: 0.46875, y: 0.28125 },
{ x: 0.53125, y: 0.28125 },
{ x: 0.53125, y: 0.28125 },
{ x: 0.59375, y: 0.28125 },
{ x: 0.59375, y: 0.28125 },
{ x: 0.65625, y: 0.28125 },
{ x: 0.65625, y: 0.28125 },
{ x: 0.71875, y: 0.28125 },
{ x: 0.71875, y: 0.28125 },
{ x: 0.78125, y: 0.28125 },
{ x: 0.78125, y: 0.28125 },
{ x: 0.84375, y: 0.28125 },
{ x: 0.84375, y: 0.28125 },
{ x: 0.90625, y: 0.28125 },
{ x: 0.90625, y: 0.28125 },
{ x: 0.96875, y: 0.28125 },
{ x: 0.96875, y: 0.28125 },
{ x: 0.03125, y: 0.34375 },
{ x: 0.03125, y: 0.34375 },
{ x: 0.09375, y: 0.34375 },
{ x: 0.09375, y: 0.34375 },
{ x: 0.15625, y: 0.34375 },
{ x: 0.15625, y: 0.34375 },
{ x: 0.21875, y: 0.34375 },
{ x: 0.21875, y: 0.34375 },
{ x: 0.28125, y: 0.34375 },
{ x: 0.28125, y: 0.34375 },
{ x: 0.34375, y: 0.34375 },
{ x: 0.34375, y: 0.34375 },
{ x: 0.40625, y: 0.34375 },
{ x: 0.40625, y: 0.34375 },
{ x: 0.46875, y: 0.34375 },
{ x: 0.46875, y: 0.34375 },
{ x: 0.53125, y: 0.34375 },
{ x: 0.53125, y: 0.34375 },
{ x: 0.59375, y: 0.34375 },
{ x: 0.59375, y: 0.34375 },
{ x: 0.65625, y: 0.34375 },
{ x: 0.65625, y: 0.34375 },
{ x: 0.71875, y: 0.34375 },
{ x: 0.71875, y: 0.34375 },
{ x: 0.78125, y: 0.34375 },
{ x: 0.78125, y: 0.34375 },
{ x: 0.84375, y: 0.34375 },
{ x: 0.84375, y: 0.34375 },
{ x: 0.90625, y: 0.34375 },
{ x: 0.90625, y: 0.34375 },
{ x: 0.96875, y: 0.34375 },
{ x: 0.96875, y: 0.34375 },
{ x: 0.03125, y: 0.40625 },
{ x: 0.03125, y: 0.40625 },
{ x: 0.09375, y: 0.40625 },
{ x: 0.09375, y: 0.40625 },
{ x: 0.15625, y: 0.40625 },
{ x: 0.15625, y: 0.40625 },
{ x: 0.21875, y: 0.40625 },
{ x: 0.21875, y: 0.40625 },
{ x: 0.28125, y: 0.40625 },
{ x: 0.28125, y: 0.40625 },
{ x: 0.34375, y: 0.40625 },
{ x: 0.34375, y: 0.40625 },
{ x: 0.40625, y: 0.40625 },
{ x: 0.40625, y: 0.40625 },
{ x: 0.46875, y: 0.40625 },
{ x: 0.46875, y: 0.40625 },
{ x: 0.53125, y: 0.40625 },
{ x: 0.53125, y: 0.40625 },
{ x: 0.59375, y: 0.40625 },
{ x: 0.59375, y: 0.40625 },
{ x: 0.65625, y: 0.40625 },
{ x: 0.65625, y: 0.40625 },
{ x: 0.71875, y: 0.40625 },
{ x: 0.71875, y: 0.40625 },
{ x: 0.78125, y: 0.40625 },
{ x: 0.78125, y: 0.40625 },
{ x: 0.84375, y: 0.40625 },
{ x: 0.84375, y: 0.40625 },
{ x: 0.90625, y: 0.40625 },
{ x: 0.90625, y: 0.40625 },
{ x: 0.96875, y: 0.40625 },
{ x: 0.96875, y: 0.40625 },
{ x: 0.03125, y: 0.46875 },
{ x: 0.03125, y: 0.46875 },
{ x: 0.09375, y: 0.46875 },
{ x: 0.09375, y: 0.46875 },
{ x: 0.15625, y: 0.46875 },
{ x: 0.15625, y: 0.46875 },
{ x: 0.21875, y: 0.46875 },
{ x: 0.21875, y: 0.46875 },
{ x: 0.28125, y: 0.46875 },
{ x: 0.28125, y: 0.46875 },
{ x: 0.34375, y: 0.46875 },
{ x: 0.34375, y: 0.46875 },
{ x: 0.40625, y: 0.46875 },
{ x: 0.40625, y: 0.46875 },
{ x: 0.46875, y: 0.46875 },
{ x: 0.46875, y: 0.46875 },
{ x: 0.53125, y: 0.46875 },
{ x: 0.53125, y: 0.46875 },
{ x: 0.59375, y: 0.46875 },
{ x: 0.59375, y: 0.46875 },
{ x: 0.65625, y: 0.46875 },
{ x: 0.65625, y: 0.46875 },
{ x: 0.71875, y: 0.46875 },
{ x: 0.71875, y: 0.46875 },
{ x: 0.78125, y: 0.46875 },
{ x: 0.78125, y: 0.46875 },
{ x: 0.84375, y: 0.46875 },
{ x: 0.84375, y: 0.46875 },
{ x: 0.90625, y: 0.46875 },
{ x: 0.90625, y: 0.46875 },
{ x: 0.96875, y: 0.46875 },
{ x: 0.96875, y: 0.46875 },
{ x: 0.03125, y: 0.53125 },
{ x: 0.03125, y: 0.53125 },
{ x: 0.09375, y: 0.53125 },
{ x: 0.09375, y: 0.53125 },
{ x: 0.15625, y: 0.53125 },
{ x: 0.15625, y: 0.53125 },
{ x: 0.21875, y: 0.53125 },
{ x: 0.21875, y: 0.53125 },
{ x: 0.28125, y: 0.53125 },
{ x: 0.28125, y: 0.53125 },
{ x: 0.34375, y: 0.53125 },
{ x: 0.34375, y: 0.53125 },
{ x: 0.40625, y: 0.53125 },
{ x: 0.40625, y: 0.53125 },
{ x: 0.46875, y: 0.53125 },
{ x: 0.46875, y: 0.53125 },
{ x: 0.53125, y: 0.53125 },
{ x: 0.53125, y: 0.53125 },
{ x: 0.59375, y: 0.53125 },
{ x: 0.59375, y: 0.53125 },
{ x: 0.65625, y: 0.53125 },
{ x: 0.65625, y: 0.53125 },
{ x: 0.71875, y: 0.53125 },
{ x: 0.71875, y: 0.53125 },
{ x: 0.78125, y: 0.53125 },
{ x: 0.78125, y: 0.53125 },
{ x: 0.84375, y: 0.53125 },
{ x: 0.84375, y: 0.53125 },
{ x: 0.90625, y: 0.53125 },
{ x: 0.90625, y: 0.53125 },
{ x: 0.96875, y: 0.53125 },
{ x: 0.96875, y: 0.53125 },
{ x: 0.03125, y: 0.59375 },
{ x: 0.03125, y: 0.59375 },
{ x: 0.09375, y: 0.59375 },
{ x: 0.09375, y: 0.59375 },
{ x: 0.15625, y: 0.59375 },
{ x: 0.15625, y: 0.59375 },
{ x: 0.21875, y: 0.59375 },
{ x: 0.21875, y: 0.59375 },
{ x: 0.28125, y: 0.59375 },
{ x: 0.28125, y: 0.59375 },
{ x: 0.34375, y: 0.59375 },
{ x: 0.34375, y: 0.59375 },
{ x: 0.40625, y: 0.59375 },
{ x: 0.40625, y: 0.59375 },
{ x: 0.46875, y: 0.59375 },
{ x: 0.46875, y: 0.59375 },
{ x: 0.53125, y: 0.59375 },
{ x: 0.53125, y: 0.59375 },
{ x: 0.59375, y: 0.59375 },
{ x: 0.59375, y: 0.59375 },
{ x: 0.65625, y: 0.59375 },
{ x: 0.65625, y: 0.59375 },
{ x: 0.71875, y: 0.59375 },
{ x: 0.71875, y: 0.59375 },
{ x: 0.78125, y: 0.59375 },
{ x: 0.78125, y: 0.59375 },
{ x: 0.84375, y: 0.59375 },
{ x: 0.84375, y: 0.59375 },
{ x: 0.90625, y: 0.59375 },
{ x: 0.90625, y: 0.59375 },
{ x: 0.96875, y: 0.59375 },
{ x: 0.96875, y: 0.59375 },
{ x: 0.03125, y: 0.65625 },
{ x: 0.03125, y: 0.65625 },
{ x: 0.09375, y: 0.65625 },
{ x: 0.09375, y: 0.65625 },
{ x: 0.15625, y: 0.65625 },
{ x: 0.15625, y: 0.65625 },
{ x: 0.21875, y: 0.65625 },
{ x: 0.21875, y: 0.65625 },
{ x: 0.28125, y: 0.65625 },
{ x: 0.28125, y: 0.65625 },
{ x: 0.34375, y: 0.65625 },
{ x: 0.34375, y: 0.65625 },
{ x: 0.40625, y: 0.65625 },
{ x: 0.40625, y: 0.65625 },
{ x: 0.46875, y: 0.65625 },
{ x: 0.46875, y: 0.65625 },
{ x: 0.53125, y: 0.65625 },
{ x: 0.53125, y: 0.65625 },
{ x: 0.59375, y: 0.65625 },
{ x: 0.59375, y: 0.65625 },
{ x: 0.65625, y: 0.65625 },
{ x: 0.65625, y: 0.65625 },
{ x: 0.71875, y: 0.65625 },
{ x: 0.71875, y: 0.65625 },
{ x: 0.78125, y: 0.65625 },
{ x: 0.78125, y: 0.65625 },
{ x: 0.84375, y: 0.65625 },
{ x: 0.84375, y: 0.65625 },
{ x: 0.90625, y: 0.65625 },
{ x: 0.90625, y: 0.65625 },
{ x: 0.96875, y: 0.65625 },
{ x: 0.96875, y: 0.65625 },
{ x: 0.03125, y: 0.71875 },
{ x: 0.03125, y: 0.71875 },
{ x: 0.09375, y: 0.71875 },
{ x: 0.09375, y: 0.71875 },
{ x: 0.15625, y: 0.71875 },
{ x: 0.15625, y: 0.71875 },
{ x: 0.21875, y: 0.71875 },
{ x: 0.21875, y: 0.71875 },
{ x: 0.28125, y: 0.71875 },
{ x: 0.28125, y: 0.71875 },
{ x: 0.34375, y: 0.71875 },
{ x: 0.34375, y: 0.71875 },
{ x: 0.40625, y: 0.71875 },
{ x: 0.40625, y: 0.71875 },
{ x: 0.46875, y: 0.71875 },
{ x: 0.46875, y: 0.71875 },
{ x: 0.53125, y: 0.71875 },
{ x: 0.53125, y: 0.71875 },
{ x: 0.59375, y: 0.71875 },
{ x: 0.59375, y: 0.71875 },
{ x: 0.65625, y: 0.71875 },
{ x: 0.65625, y: 0.71875 },
{ x: 0.71875, y: 0.71875 },
{ x: 0.71875, y: 0.71875 },
{ x: 0.78125, y: 0.71875 },
{ x: 0.78125, y: 0.71875 },
{ x: 0.84375, y: 0.71875 },
{ x: 0.84375, y: 0.71875 },
{ x: 0.90625, y: 0.71875 },
{ x: 0.90625, y: 0.71875 },
{ x: 0.96875, y: 0.71875 },
{ x: 0.96875, y: 0.71875 },
{ x: 0.03125, y: 0.78125 },
{ x: 0.03125, y: 0.78125 },
{ x: 0.09375, y: 0.78125 },
{ x: 0.09375, y: 0.78125 },
{ x: 0.15625, y: 0.78125 },
{ x: 0.15625, y: 0.78125 },
{ x: 0.21875, y: 0.78125 },
{ x: 0.21875, y: 0.78125 },
{ x: 0.28125, y: 0.78125 },
{ x: 0.28125, y: 0.78125 },
{ x: 0.34375, y: 0.78125 },
{ x: 0.34375, y: 0.78125 },
{ x: 0.40625, y: 0.78125 },
{ x: 0.40625, y: 0.78125 },
{ x: 0.46875, y: 0.78125 },
{ x: 0.46875, y: 0.78125 },
{ x: 0.53125, y: 0.78125 },
{ x: 0.53125, y: 0.78125 },
{ x: 0.59375, y: 0.78125 },
{ x: 0.59375, y: 0.78125 },
{ x: 0.65625, y: 0.78125 },
{ x: 0.65625, y: 0.78125 },
{ x: 0.71875, y: 0.78125 },
{ x: 0.71875, y: 0.78125 },
{ x: 0.78125, y: 0.78125 },
{ x: 0.78125, y: 0.78125 },
{ x: 0.84375, y: 0.78125 },
{ x: 0.84375, y: 0.78125 },
{ x: 0.90625, y: 0.78125 },
{ x: 0.90625, y: 0.78125 },
{ x: 0.96875, y: 0.78125 },
{ x: 0.96875, y: 0.78125 },
{ x: 0.03125, y: 0.84375 },
{ x: 0.03125, y: 0.84375 },
{ x: 0.09375, y: 0.84375 },
{ x: 0.09375, y: 0.84375 },
{ x: 0.15625, y: 0.84375 },
{ x: 0.15625, y: 0.84375 },
{ x: 0.21875, y: 0.84375 },
{ x: 0.21875, y: 0.84375 },
{ x: 0.28125, y: 0.84375 },
{ x: 0.28125, y: 0.84375 },
{ x: 0.34375, y: 0.84375 },
{ x: 0.34375, y: 0.84375 },
{ x: 0.40625, y: 0.84375 },
{ x: 0.40625, y: 0.84375 },
{ x: 0.46875, y: 0.84375 },
{ x: 0.46875, y: 0.84375 },
{ x: 0.53125, y: 0.84375 },
{ x: 0.53125, y: 0.84375 },
{ x: 0.59375, y: 0.84375 },
{ x: 0.59375, y: 0.84375 },
{ x: 0.65625, y: 0.84375 },
{ x: 0.65625, y: 0.84375 },
{ x: 0.71875, y: 0.84375 },
{ x: 0.71875, y: 0.84375 },
{ x: 0.78125, y: 0.84375 },
{ x: 0.78125, y: 0.84375 },
{ x: 0.84375, y: 0.84375 },
{ x: 0.84375, y: 0.84375 },
{ x: 0.90625, y: 0.84375 },
{ x: 0.90625, y: 0.84375 },
{ x: 0.96875, y: 0.84375 },
{ x: 0.96875, y: 0.84375 },
{ x: 0.03125, y: 0.90625 },
{ x: 0.03125, y: 0.90625 },
{ x: 0.09375, y: 0.90625 },
{ x: 0.09375, y: 0.90625 },
{ x: 0.15625, y: 0.90625 },
{ x: 0.15625, y: 0.90625 },
{ x: 0.21875, y: 0.90625 },
{ x: 0.21875, y: 0.90625 },
{ x: 0.28125, y: 0.90625 },
{ x: 0.28125, y: 0.90625 },
{ x: 0.34375, y: 0.90625 },
{ x: 0.34375, y: 0.90625 },
{ x: 0.40625, y: 0.90625 },
{ x: 0.40625, y: 0.90625 },
{ x: 0.46875, y: 0.90625 },
{ x: 0.46875, y: 0.90625 },
{ x: 0.53125, y: 0.90625 },
{ x: 0.53125, y: 0.90625 },
{ x: 0.59375, y: 0.90625 },
{ x: 0.59375, y: 0.90625 },
{ x: 0.65625, y: 0.90625 },
{ x: 0.65625, y: 0.90625 },
{ x: 0.71875, y: 0.90625 },
{ x: 0.71875, y: 0.90625 },
{ x: 0.78125, y: 0.90625 },
{ x: 0.78125, y: 0.90625 },
{ x: 0.84375, y: 0.90625 },
{ x: 0.84375, y: 0.90625 },
{ x: 0.90625, y: 0.90625 },
{ x: 0.90625, y: 0.90625 },
{ x: 0.96875, y: 0.90625 },
{ x: 0.96875, y: 0.90625 },
{ x: 0.03125, y: 0.96875 },
{ x: 0.03125, y: 0.96875 },
{ x: 0.09375, y: 0.96875 },
{ x: 0.09375, y: 0.96875 },
{ x: 0.15625, y: 0.96875 },
{ x: 0.15625, y: 0.96875 },
{ x: 0.21875, y: 0.96875 },
{ x: 0.21875, y: 0.96875 },
{ x: 0.28125, y: 0.96875 },
{ x: 0.28125, y: 0.96875 },
{ x: 0.34375, y: 0.96875 },
{ x: 0.34375, y: 0.96875 },
{ x: 0.40625, y: 0.96875 },
{ x: 0.40625, y: 0.96875 },
{ x: 0.46875, y: 0.96875 },
{ x: 0.46875, y: 0.96875 },
{ x: 0.53125, y: 0.96875 },
{ x: 0.53125, y: 0.96875 },
{ x: 0.59375, y: 0.96875 },
{ x: 0.59375, y: 0.96875 },
{ x: 0.65625, y: 0.96875 },
{ x: 0.65625, y: 0.96875 },
{ x: 0.71875, y: 0.96875 },
{ x: 0.71875, y: 0.96875 },
{ x: 0.78125, y: 0.96875 },
{ x: 0.78125, y: 0.96875 },
{ x: 0.84375, y: 0.96875 },
{ x: 0.84375, y: 0.96875 },
{ x: 0.90625, y: 0.96875 },
{ x: 0.90625, y: 0.96875 },
{ x: 0.96875, y: 0.96875 },
{ x: 0.96875, y: 0.96875 },
{ x: 0.0625, y: 0.0625 },
{ x: 0.0625, y: 0.0625 },
{ x: 0.0625, y: 0.0625 },
{ x: 0.0625, y: 0.0625 },
{ x: 0.0625, y: 0.0625 },
{ x: 0.0625, y: 0.0625 },
{ x: 0.1875, y: 0.0625 },
{ x: 0.1875, y: 0.0625 },
{ x: 0.1875, y: 0.0625 },
{ x: 0.1875, y: 0.0625 },
{ x: 0.1875, y: 0.0625 },
{ x: 0.1875, y: 0.0625 },
{ x: 0.3125, y: 0.0625 },
{ x: 0.3125, y: 0.0625 },
{ x: 0.3125, y: 0.0625 },
{ x: 0.3125, y: 0.0625 },
{ x: 0.3125, y: 0.0625 },
{ x: 0.3125, y: 0.0625 },
{ x: 0.4375, y: 0.0625 },
{ x: 0.4375, y: 0.0625 },
{ x: 0.4375, y: 0.0625 },
{ x: 0.4375, y: 0.0625 },
{ x: 0.4375, y: 0.0625 },
{ x: 0.4375, y: 0.0625 },
{ x: 0.5625, y: 0.0625 },
{ x: 0.5625, y: 0.0625 },
{ x: 0.5625, y: 0.0625 },
{ x: 0.5625, y: 0.0625 },
{ x: 0.5625, y: 0.0625 },
{ x: 0.5625, y: 0.0625 },
{ x: 0.6875, y: 0.0625 },
{ x: 0.6875, y: 0.0625 },
{ x: 0.6875, y: 0.0625 },
{ x: 0.6875, y: 0.0625 },
{ x: 0.6875, y: 0.0625 },
{ x: 0.6875, y: 0.0625 },
{ x: 0.8125, y: 0.0625 },
{ x: 0.8125, y: 0.0625 },
{ x: 0.8125, y: 0.0625 },
{ x: 0.8125, y: 0.0625 },
{ x: 0.8125, y: 0.0625 },
{ x: 0.8125, y: 0.0625 },
{ x: 0.9375, y: 0.0625 },
{ x: 0.9375, y: 0.0625 },
{ x: 0.9375, y: 0.0625 },
{ x: 0.9375, y: 0.0625 },
{ x: 0.9375, y: 0.0625 },
{ x: 0.9375, y: 0.0625 },
{ x: 0.0625, y: 0.1875 },
{ x: 0.0625, y: 0.1875 },
{ x: 0.0625, y: 0.1875 },
{ x: 0.0625, y: 0.1875 },
{ x: 0.0625, y: 0.1875 },
{ x: 0.0625, y: 0.1875 },
{ x: 0.1875, y: 0.1875 },
{ x: 0.1875, y: 0.1875 },
{ x: 0.1875, y: 0.1875 },
{ x: 0.1875, y: 0.1875 },
{ x: 0.1875, y: 0.1875 },
{ x: 0.1875, y: 0.1875 },
{ x: 0.3125, y: 0.1875 },
{ x: 0.3125, y: 0.1875 },
{ x: 0.3125, y: 0.1875 },
{ x: 0.3125, y: 0.1875 },
{ x: 0.3125, y: 0.1875 },
{ x: 0.3125, y: 0.1875 },
{ x: 0.4375, y: 0.1875 },
{ x: 0.4375, y: 0.1875 },
{ x: 0.4375, y: 0.1875 },
{ x: 0.4375, y: 0.1875 },
{ x: 0.4375, y: 0.1875 },
{ x: 0.4375, y: 0.1875 },
{ x: 0.5625, y: 0.1875 },
{ x: 0.5625, y: 0.1875 },
{ x: 0.5625, y: 0.1875 },
{ x: 0.5625, y: 0.1875 },
{ x: 0.5625, y: 0.1875 },
{ x: 0.5625, y: 0.1875 },
{ x: 0.6875, y: 0.1875 },
{ x: 0.6875, y: 0.1875 },
{ x: 0.6875, y: 0.1875 },
{ x: 0.6875, y: 0.1875 },
{ x: 0.6875, y: 0.1875 },
{ x: 0.6875, y: 0.1875 },
{ x: 0.8125, y: 0.1875 },
{ x: 0.8125, y: 0.1875 },
{ x: 0.8125, y: 0.1875 },
{ x: 0.8125, y: 0.1875 },
{ x: 0.8125, y: 0.1875 },
{ x: 0.8125, y: 0.1875 },
{ x: 0.9375, y: 0.1875 },
{ x: 0.9375, y: 0.1875 },
{ x: 0.9375, y: 0.1875 },
{ x: 0.9375, y: 0.1875 },
{ x: 0.9375, y: 0.1875 },
{ x: 0.9375, y: 0.1875 },
{ x: 0.0625, y: 0.3125 },
{ x: 0.0625, y: 0.3125 },
{ x: 0.0625, y: 0.3125 },
{ x: 0.0625, y: 0.3125 },
{ x: 0.0625, y: 0.3125 },
{ x: 0.0625, y: 0.3125 },
{ x: 0.1875, y: 0.3125 },
{ x: 0.1875, y: 0.3125 },
{ x: 0.1875, y: 0.3125 },
{ x: 0.1875, y: 0.3125 },
{ x: 0.1875, y: 0.3125 },
{ x: 0.1875, y: 0.3125 },
{ x: 0.3125, y: 0.3125 },
{ x: 0.3125, y: 0.3125 },
{ x: 0.3125, y: 0.3125 },
{ x: 0.3125, y: 0.3125 },
{ x: 0.3125, y: 0.3125 },
{ x: 0.3125, y: 0.3125 },
{ x: 0.4375, y: 0.3125 },
{ x: 0.4375, y: 0.3125 },
{ x: 0.4375, y: 0.3125 },
{ x: 0.4375, y: 0.3125 },
{ x: 0.4375, y: 0.3125 },
{ x: 0.4375, y: 0.3125 },
{ x: 0.5625, y: 0.3125 },
{ x: 0.5625, y: 0.3125 },
{ x: 0.5625, y: 0.3125 },
{ x: 0.5625, y: 0.3125 },
{ x: 0.5625, y: 0.3125 },
{ x: 0.5625, y: 0.3125 },
{ x: 0.6875, y: 0.3125 },
{ x: 0.6875, y: 0.3125 },
{ x: 0.6875, y: 0.3125 },
{ x: 0.6875, y: 0.3125 },
{ x: 0.6875, y: 0.3125 },
{ x: 0.6875, y: 0.3125 },
{ x: 0.8125, y: 0.3125 },
{ x: 0.8125, y: 0.3125 },
{ x: 0.8125, y: 0.3125 },
{ x: 0.8125, y: 0.3125 },
{ x: 0.8125, y: 0.3125 },
{ x: 0.8125, y: 0.3125 },
{ x: 0.9375, y: 0.3125 },
{ x: 0.9375, y: 0.3125 },
{ x: 0.9375, y: 0.3125 },
{ x: 0.9375, y: 0.3125 },
{ x: 0.9375, y: 0.3125 },
{ x: 0.9375, y: 0.3125 },
{ x: 0.0625, y: 0.4375 },
{ x: 0.0625, y: 0.4375 },
{ x: 0.0625, y: 0.4375 },
{ x: 0.0625, y: 0.4375 },
{ x: 0.0625, y: 0.4375 },
{ x: 0.0625, y: 0.4375 },
{ x: 0.1875, y: 0.4375 },
{ x: 0.1875, y: 0.4375 },
{ x: 0.1875, y: 0.4375 },
{ x: 0.1875, y: 0.4375 },
{ x: 0.1875, y: 0.4375 },
{ x: 0.1875, y: 0.4375 },
{ x: 0.3125, y: 0.4375 },
{ x: 0.3125, y: 0.4375 },
{ x: 0.3125, y: 0.4375 },
{ x: 0.3125, y: 0.4375 },
{ x: 0.3125, y: 0.4375 },
{ x: 0.3125, y: 0.4375 },
{ x: 0.4375, y: 0.4375 },
{ x: 0.4375, y: 0.4375 },
{ x: 0.4375, y: 0.4375 },
{ x: 0.4375, y: 0.4375 },
{ x: 0.4375, y: 0.4375 },
{ x: 0.4375, y: 0.4375 },
{ x: 0.5625, y: 0.4375 },
{ x: 0.5625, y: 0.4375 },
{ x: 0.5625, y: 0.4375 },
{ x: 0.5625, y: 0.4375 },
{ x: 0.5625, y: 0.4375 },
{ x: 0.5625, y: 0.4375 },
{ x: 0.6875, y: 0.4375 },
{ x: 0.6875, y: 0.4375 },
{ x: 0.6875, y: 0.4375 },
{ x: 0.6875, y: 0.4375 },
{ x: 0.6875, y: 0.4375 },
{ x: 0.6875, y: 0.4375 },
{ x: 0.8125, y: 0.4375 },
{ x: 0.8125, y: 0.4375 },
{ x: 0.8125, y: 0.4375 },
{ x: 0.8125, y: 0.4375 },
{ x: 0.8125, y: 0.4375 },
{ x: 0.8125, y: 0.4375 },
{ x: 0.9375, y: 0.4375 },
{ x: 0.9375, y: 0.4375 },
{ x: 0.9375, y: 0.4375 },
{ x: 0.9375, y: 0.4375 },
{ x: 0.9375, y: 0.4375 },
{ x: 0.9375, y: 0.4375 },
{ x: 0.0625, y: 0.5625 },
{ x: 0.0625, y: 0.5625 },
{ x: 0.0625, y: 0.5625 },
{ x: 0.0625, y: 0.5625 },
{ x: 0.0625, y: 0.5625 },
{ x: 0.0625, y: 0.5625 },
{ x: 0.1875, y: 0.5625 },
{ x: 0.1875, y: 0.5625 },
{ x: 0.1875, y: 0.5625 },
{ x: 0.1875, y: 0.5625 },
{ x: 0.1875, y: 0.5625 },
{ x: 0.1875, y: 0.5625 },
{ x: 0.3125, y: 0.5625 },
{ x: 0.3125, y: 0.5625 },
{ x: 0.3125, y: 0.5625 },
{ x: 0.3125, y: 0.5625 },
{ x: 0.3125, y: 0.5625 },
{ x: 0.3125, y: 0.5625 },
{ x: 0.4375, y: 0.5625 },
{ x: 0.4375, y: 0.5625 },
{ x: 0.4375, y: 0.5625 },
{ x: 0.4375, y: 0.5625 },
{ x: 0.4375, y: 0.5625 },
{ x: 0.4375, y: 0.5625 },
{ x: 0.5625, y: 0.5625 },
{ x: 0.5625, y: 0.5625 },
{ x: 0.5625, y: 0.5625 },
{ x: 0.5625, y: 0.5625 },
{ x: 0.5625, y: 0.5625 },
{ x: 0.5625, y: 0.5625 },
{ x: 0.6875, y: 0.5625 },
{ x: 0.6875, y: 0.5625 },
{ x: 0.6875, y: 0.5625 },
{ x: 0.6875, y: 0.5625 },
{ x: 0.6875, y: 0.5625 },
{ x: 0.6875, y: 0.5625 },
{ x: 0.8125, y: 0.5625 },
{ x: 0.8125, y: 0.5625 },
{ x: 0.8125, y: 0.5625 },
{ x: 0.8125, y: 0.5625 },
{ x: 0.8125, y: 0.5625 },
{ x: 0.8125, y: 0.5625 },
{ x: 0.9375, y: 0.5625 },
{ x: 0.9375, y: 0.5625 },
{ x: 0.9375, y: 0.5625 },
{ x: 0.9375, y: 0.5625 },
{ x: 0.9375, y: 0.5625 },
{ x: 0.9375, y: 0.5625 },
{ x: 0.0625, y: 0.6875 },
{ x: 0.0625, y: 0.6875 },
{ x: 0.0625, y: 0.6875 },
{ x: 0.0625, y: 0.6875 },
{ x: 0.0625, y: 0.6875 },
{ x: 0.0625, y: 0.6875 },
{ x: 0.1875, y: 0.6875 },
{ x: 0.1875, y: 0.6875 },
{ x: 0.1875, y: 0.6875 },
{ x: 0.1875, y: 0.6875 },
{ x: 0.1875, y: 0.6875 },
{ x: 0.1875, y: 0.6875 },
{ x: 0.3125, y: 0.6875 },
{ x: 0.3125, y: 0.6875 },
{ x: 0.3125, y: 0.6875 },
{ x: 0.3125, y: 0.6875 },
{ x: 0.3125, y: 0.6875 },
{ x: 0.3125, y: 0.6875 },
{ x: 0.4375, y: 0.6875 },
{ x: 0.4375, y: 0.6875 },
{ x: 0.4375, y: 0.6875 },
{ x: 0.4375, y: 0.6875 },
{ x: 0.4375, y: 0.6875 },
{ x: 0.4375, y: 0.6875 },
{ x: 0.5625, y: 0.6875 },
{ x: 0.5625, y: 0.6875 },
{ x: 0.5625, y: 0.6875 },
{ x: 0.5625, y: 0.6875 },
{ x: 0.5625, y: 0.6875 },
{ x: 0.5625, y: 0.6875 },
{ x: 0.6875, y: 0.6875 },
{ x: 0.6875, y: 0.6875 },
{ x: 0.6875, y: 0.6875 },
{ x: 0.6875, y: 0.6875 },
{ x: 0.6875, y: 0.6875 },
{ x: 0.6875, y: 0.6875 },
{ x: 0.8125, y: 0.6875 },
{ x: 0.8125, y: 0.6875 },
{ x: 0.8125, y: 0.6875 },
{ x: 0.8125, y: 0.6875 },
{ x: 0.8125, y: 0.6875 },
{ x: 0.8125, y: 0.6875 },
{ x: 0.9375, y: 0.6875 },
{ x: 0.9375, y: 0.6875 },
{ x: 0.9375, y: 0.6875 },
{ x: 0.9375, y: 0.6875 },
{ x: 0.9375, y: 0.6875 },
{ x: 0.9375, y: 0.6875 },
{ x: 0.0625, y: 0.8125 },
{ x: 0.0625, y: 0.8125 },
{ x: 0.0625, y: 0.8125 },
{ x: 0.0625, y: 0.8125 },
{ x: 0.0625, y: 0.8125 },
{ x: 0.0625, y: 0.8125 },
{ x: 0.1875, y: 0.8125 },
{ x: 0.1875, y: 0.8125 },
{ x: 0.1875, y: 0.8125 },
{ x: 0.1875, y: 0.8125 },
{ x: 0.1875, y: 0.8125 },
{ x: 0.1875, y: 0.8125 },
{ x: 0.3125, y: 0.8125 },
{ x: 0.3125, y: 0.8125 },
{ x: 0.3125, y: 0.8125 },
{ x: 0.3125, y: 0.8125 },
{ x: 0.3125, y: 0.8125 },
{ x: 0.3125, y: 0.8125 },
{ x: 0.4375, y: 0.8125 },
{ x: 0.4375, y: 0.8125 },
{ x: 0.4375, y: 0.8125 },
{ x: 0.4375, y: 0.8125 },
{ x: 0.4375, y: 0.8125 },
{ x: 0.4375, y: 0.8125 },
{ x: 0.5625, y: 0.8125 },
{ x: 0.5625, y: 0.8125 },
{ x: 0.5625, y: 0.8125 },
{ x: 0.5625, y: 0.8125 },
{ x: 0.5625, y: 0.8125 },
{ x: 0.5625, y: 0.8125 },
{ x: 0.6875, y: 0.8125 },
{ x: 0.6875, y: 0.8125 },
{ x: 0.6875, y: 0.8125 },
{ x: 0.6875, y: 0.8125 },
{ x: 0.6875, y: 0.8125 },
{ x: 0.6875, y: 0.8125 },
{ x: 0.8125, y: 0.8125 },
{ x: 0.8125, y: 0.8125 },
{ x: 0.8125, y: 0.8125 },
{ x: 0.8125, y: 0.8125 },
{ x: 0.8125, y: 0.8125 },
{ x: 0.8125, y: 0.8125 },
{ x: 0.9375, y: 0.8125 },
{ x: 0.9375, y: 0.8125 },
{ x: 0.9375, y: 0.8125 },
{ x: 0.9375, y: 0.8125 },
{ x: 0.9375, y: 0.8125 },
{ x: 0.9375, y: 0.8125 },
{ x: 0.0625, y: 0.9375 },
{ x: 0.0625, y: 0.9375 },
{ x: 0.0625, y: 0.9375 },
{ x: 0.0625, y: 0.9375 },
{ x: 0.0625, y: 0.9375 },
{ x: 0.0625, y: 0.9375 },
{ x: 0.1875, y: 0.9375 },
{ x: 0.1875, y: 0.9375 },
{ x: 0.1875, y: 0.9375 },
{ x: 0.1875, y: 0.9375 },
{ x: 0.1875, y: 0.9375 },
{ x: 0.1875, y: 0.9375 },
{ x: 0.3125, y: 0.9375 },
{ x: 0.3125, y: 0.9375 },
{ x: 0.3125, y: 0.9375 },
{ x: 0.3125, y: 0.9375 },
{ x: 0.3125, y: 0.9375 },
{ x: 0.3125, y: 0.9375 },
{ x: 0.4375, y: 0.9375 },
{ x: 0.4375, y: 0.9375 },
{ x: 0.4375, y: 0.9375 },
{ x: 0.4375, y: 0.9375 },
{ x: 0.4375, y: 0.9375 },
{ x: 0.4375, y: 0.9375 },
{ x: 0.5625, y: 0.9375 },
{ x: 0.5625, y: 0.9375 },
{ x: 0.5625, y: 0.9375 },
{ x: 0.5625, y: 0.9375 },
{ x: 0.5625, y: 0.9375 },
{ x: 0.5625, y: 0.9375 },
{ x: 0.6875, y: 0.9375 },
{ x: 0.6875, y: 0.9375 },
{ x: 0.6875, y: 0.9375 },
{ x: 0.6875, y: 0.9375 },
{ x: 0.6875, y: 0.9375 },
{ x: 0.6875, y: 0.9375 },
{ x: 0.8125, y: 0.9375 },
{ x: 0.8125, y: 0.9375 },
{ x: 0.8125, y: 0.9375 },
{ x: 0.8125, y: 0.9375 },
{ x: 0.8125, y: 0.9375 },
{ x: 0.8125, y: 0.9375 },
{ x: 0.9375, y: 0.9375 },
{ x: 0.9375, y: 0.9375 },
{ x: 0.9375, y: 0.9375 },
{ x: 0.9375, y: 0.9375 },
{ x: 0.9375, y: 0.9375 },
{ x: 0.9375, y: 0.9375 }
];
// src/hand/handposedetector.ts
var HandDetector = class {
constructor(model18) {
__publicField(this, "model");
__publicField(this, "anchors");
__publicField(this, "anchorsTensor");
__publicField(this, "inputSize");
__publicField(this, "inputSizeTensor");
__publicField(this, "doubleInputSizeTensor");
this.model = model18;
this.anchors = anchors2.map((anchor) => [anchor.x, anchor.y]);
this.anchorsTensor = tfjs_esm_exports.tensor2d(this.anchors);
this.inputSize = this.model && this.model.inputs && this.model.inputs[0].shape ? this.model.inputs[0].shape[2] : 0;
this.inputSizeTensor = tfjs_esm_exports.tensor1d([this.inputSize, this.inputSize]);
this.doubleInputSizeTensor = tfjs_esm_exports.tensor1d([this.inputSize * 2, this.inputSize * 2]);
}
normalizeBoxes(boxes) {
const t = {};
t.boxOffsets = tfjs_esm_exports.slice(boxes, [0, 0], [-1, 2]);
t.boxSizes = tfjs_esm_exports.slice(boxes, [0, 2], [-1, 2]);
t.div = tfjs_esm_exports.div(t.boxOffsets, this.inputSizeTensor);
t.boxCenterPoints = tfjs_esm_exports.add(t.div, this.anchorsTensor);
t.halfBoxSizes = tfjs_esm_exports.div(t.boxSizes, this.doubleInputSizeTensor);
t.sub = tfjs_esm_exports.sub(t.boxCenterPoints, t.halfBoxSizes);
t.startPoints = tfjs_esm_exports.mul(t.sub, this.inputSizeTensor);
t.add = tfjs_esm_exports.add(t.boxCenterPoints, t.halfBoxSizes);
t.endPoints = tfjs_esm_exports.mul(t.add, this.inputSizeTensor);
const res = tfjs_esm_exports.concat2d([t.startPoints, t.endPoints], 1);
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return res;
}
normalizeLandmarks(rawPalmLandmarks, index2) {
const t = {};
t.reshape = tfjs_esm_exports.reshape(rawPalmLandmarks, [-1, 7, 2]);
t.div = tfjs_esm_exports.div(t.reshape, this.inputSizeTensor);
t.landmarks = tfjs_esm_exports.add(t.div, this.anchors[index2]);
const res = tfjs_esm_exports.mul(t.landmarks, this.inputSizeTensor);
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return res;
}
async predict(input, config3) {
const t = {};
t.resize = tfjs_esm_exports.image.resizeBilinear(input, [this.inputSize, this.inputSize]);
t.div = tfjs_esm_exports.div(t.resize, constants.tf127);
t.image = tfjs_esm_exports.sub(t.div, constants.tf1);
t.batched = this.model.execute(t.image);
t.predictions = tfjs_esm_exports.squeeze(t.batched);
t.slice = tfjs_esm_exports.slice(t.predictions, [0, 0], [-1, 1]);
t.sigmoid = tfjs_esm_exports.sigmoid(t.slice);
t.scores = tfjs_esm_exports.squeeze(t.sigmoid);
const scores = await t.scores.data();
t.boxes = tfjs_esm_exports.slice(t.predictions, [0, 1], [-1, 4]);
t.norm = this.normalizeBoxes(t.boxes);
t.nms = await tfjs_esm_exports.image.nonMaxSuppressionAsync(t.norm, t.scores, 3 * config3.hand.maxDetected, config3.hand.iouThreshold, config3.hand.minConfidence);
const nms = await t.nms.array();
const hands = [];
for (const index2 of nms) {
const p = {};
p.box = tfjs_esm_exports.slice(t.norm, [index2, 0], [1, -1]);
p.slice = tfjs_esm_exports.slice(t.predictions, [index2, 5], [1, 14]);
p.norm = this.normalizeLandmarks(p.slice, index2);
p.palmLandmarks = tfjs_esm_exports.reshape(p.norm, [-1, 2]);
const box4 = await p.box.data();
const startPoint = box4.slice(0, 2);
const endPoint = box4.slice(2, 4);
const palmLandmarks = await p.palmLandmarks.array();
const hand3 = { startPoint, endPoint, palmLandmarks, confidence: scores[index2] };
const scaled = scaleBoxCoordinates2(hand3, [input.shape[2] / this.inputSize, input.shape[1] / this.inputSize]);
hands.push(scaled);
Object.keys(p).forEach((tensor3) => tfjs_esm_exports.dispose(p[tensor3]));
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return hands;
}
};
// src/hand/handposepipeline.ts
var palmBoxEnlargeFactor = 5;
var handBoxEnlargeFactor = 1.65;
var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];
var palmLandmarksPalmBase = 0;
var palmLandmarksMiddleFingerBase = 2;
var lastTime12 = 0;
var HandPipeline = class {
constructor(handDetector, handPoseModel2) {
__publicField(this, "handDetector");
__publicField(this, "handPoseModel");
__publicField(this, "inputSize");
__publicField(this, "storedBoxes");
__publicField(this, "skipped");
__publicField(this, "detectedHands");
this.handDetector = handDetector;
this.handPoseModel = handPoseModel2;
this.inputSize = this.handPoseModel && this.handPoseModel.inputs[0].shape ? this.handPoseModel.inputs[0].shape[2] : 0;
this.storedBoxes = [];
this.skipped = Number.MAX_SAFE_INTEGER;
this.detectedHands = 0;
}
calculateLandmarksBoundingBox(landmarks) {
const xs = landmarks.map((d) => d[0]);
const ys = landmarks.map((d) => d[1]);
const startPoint = [Math.min(...xs), Math.min(...ys)];
const endPoint = [Math.max(...xs), Math.max(...ys)];
return { startPoint, endPoint };
}
getBoxForPalmLandmarks(palmLandmarks, rotationMatrix) {
const rotatedPalmLandmarks = palmLandmarks.map((coord) => rotatePoint2([...coord, 1], rotationMatrix));
const boxAroundPalm = this.calculateLandmarksBoundingBox(rotatedPalmLandmarks);
return enlargeBox2(squarifyBox2(boxAroundPalm), palmBoxEnlargeFactor);
}
getBoxForHandLandmarks(landmarks) {
const boundingBox = this.calculateLandmarksBoundingBox(landmarks);
const boxAroundHand = enlargeBox2(squarifyBox2(boundingBox), handBoxEnlargeFactor);
boxAroundHand.palmLandmarks = [];
for (let i = 0; i < palmLandmarkIds.length; i++) {
boxAroundHand.palmLandmarks.push(landmarks[palmLandmarkIds[i]].slice(0, 2));
}
return boxAroundHand;
}
transformRawCoords(rawCoords, box22, angle, rotationMatrix) {
const boxSize = getBoxSize2(box22);
const scaleFactor = [boxSize[0] / this.inputSize, boxSize[1] / this.inputSize, (boxSize[0] + boxSize[1]) / this.inputSize / 2];
const coordsScaled = rawCoords.map((coord) => [
scaleFactor[0] * (coord[0] - this.inputSize / 2),
scaleFactor[1] * (coord[1] - this.inputSize / 2),
scaleFactor[2] * coord[2]
]);
const coordsRotationMatrix = buildRotationMatrix2(angle, [0, 0]);
const coordsRotated = coordsScaled.map((coord) => {
const rotated = rotatePoint2(coord, coordsRotationMatrix);
return [...rotated, coord[2]];
});
const inverseRotationMatrix = invertTransformMatrix2(rotationMatrix);
const boxCenter = [...getBoxCenter2(box22), 1];
const originalBoxCenter = [
dot2(boxCenter, inverseRotationMatrix[0]),
dot2(boxCenter, inverseRotationMatrix[1])
];
return coordsRotated.map((coord) => [
Math.trunc(coord[0] + originalBoxCenter[0]),
Math.trunc(coord[1] + originalBoxCenter[1]),
Math.trunc(coord[2])
]);
}
async estimateHands(image29, config3) {
let useFreshBox = false;
let boxes;
const skipTime = (config3.hand.skipTime || 0) > now() - lastTime12;
const skipFrame = this.skipped < (config3.hand.skipFrames || 0);
if (config3.skipAllowed && skipTime && skipFrame) {
boxes = await this.handDetector.predict(image29, config3);
this.skipped = 0;
}
if (config3.skipAllowed)
this.skipped++;
if (boxes && boxes.length > 0 && (boxes.length !== this.detectedHands && this.detectedHands !== config3.hand.maxDetected || !config3.hand.landmarks)) {
this.detectedHands = 0;
this.storedBoxes = [...boxes];
if (this.storedBoxes.length > 0)
useFreshBox = true;
}
const hands = [];
for (let i = 0; i < this.storedBoxes.length; i++) {
const currentBox = this.storedBoxes[i];
if (!currentBox)
continue;
if (config3.hand.landmarks) {
const angle = config3.hand.rotation ? computeRotation2(currentBox.palmLandmarks[palmLandmarksPalmBase], currentBox.palmLandmarks[palmLandmarksMiddleFingerBase]) : 0;
const palmCenter = getBoxCenter2(currentBox);
const palmCenterNormalized = [palmCenter[0] / image29.shape[2], palmCenter[1] / image29.shape[1]];
const rotatedImage = config3.hand.rotation && env.kernels.includes("rotatewithoffset") ? tfjs_esm_exports.image.rotateWithOffset(image29, angle, 0, palmCenterNormalized) : image29.clone();
const rotationMatrix = buildRotationMatrix2(-angle, palmCenter);
const newBox = useFreshBox ? this.getBoxForPalmLandmarks(currentBox.palmLandmarks, rotationMatrix) : currentBox;
const croppedInput = cutBoxFromImageAndResize2(newBox, rotatedImage, [this.inputSize, this.inputSize]);
const handImage = tfjs_esm_exports.div(croppedInput, constants.tf255);
tfjs_esm_exports.dispose(croppedInput);
tfjs_esm_exports.dispose(rotatedImage);
const [confidenceT, keypoints] = this.handPoseModel.execute(handImage);
lastTime12 = now();
tfjs_esm_exports.dispose(handImage);
const confidence = (await confidenceT.data())[0];
tfjs_esm_exports.dispose(confidenceT);
if (confidence >= config3.hand.minConfidence / 4) {
const keypointsReshaped = tfjs_esm_exports.reshape(keypoints, [-1, 3]);
const rawCoords = await keypointsReshaped.array();
tfjs_esm_exports.dispose(keypoints);
tfjs_esm_exports.dispose(keypointsReshaped);
const coords8 = this.transformRawCoords(rawCoords, newBox, angle, rotationMatrix);
const nextBoundingBox = this.getBoxForHandLandmarks(coords8);
this.storedBoxes[i] = { ...nextBoundingBox, confidence };
const result = {
landmarks: coords8,
confidence,
boxConfidence: currentBox.confidence,
fingerConfidence: confidence,
box: { topLeft: nextBoundingBox.startPoint, bottomRight: nextBoundingBox.endPoint }
};
hands.push(result);
} else {
this.storedBoxes[i] = null;
}
tfjs_esm_exports.dispose(keypoints);
} else {
const enlarged = enlargeBox2(squarifyBox2(currentBox), handBoxEnlargeFactor);
const result = {
confidence: currentBox.confidence,
boxConfidence: currentBox.confidence,
fingerConfidence: 0,
box: { topLeft: enlarged.startPoint, bottomRight: enlarged.endPoint },
landmarks: []
};
hands.push(result);
}
}
this.storedBoxes = this.storedBoxes.filter((a) => a !== null);
this.detectedHands = hands.length;
if (hands.length > config3.hand.maxDetected)
hands.length = config3.hand.maxDetected;
return hands;
}
};
// src/hand/fingerdef.ts
var Finger = {
thumb: 0,
index: 1,
middle: 2,
ring: 3,
pinky: 4,
all: [0, 1, 2, 3, 4],
nameMapping: { 0: "thumb", 1: "index", 2: "middle", 3: "ring", 4: "pinky" },
pointsMapping: {
0: [[0, 1], [1, 2], [2, 3], [3, 4]],
1: [[0, 5], [5, 6], [6, 7], [7, 8]],
2: [[0, 9], [9, 10], [10, 11], [11, 12]],
3: [[0, 13], [13, 14], [14, 15], [15, 16]],
4: [[0, 17], [17, 18], [18, 19], [19, 20]]
},
getName: (value) => Finger.nameMapping[value],
getPoints: (value) => Finger.pointsMapping[value]
};
var FingerCurl = {
none: 0,
half: 1,
full: 2,
nameMapping: { 0: "none", 1: "half", 2: "full" },
getName: (value) => FingerCurl.nameMapping[value]
};
var FingerDirection = {
verticalUp: 0,
verticalDown: 1,
horizontalLeft: 2,
horizontalRight: 3,
diagonalUpRight: 4,
diagonalUpLeft: 5,
diagonalDownRight: 6,
diagonalDownLeft: 7,
nameMapping: { 0: "verticalUp", 1: "verticalDown", 2: "horizontalLeft", 3: "horizontalRight", 4: "diagonalUpRight", 5: "diagonalUpLeft", 6: "diagonalDownRight", 7: "diagonalDownLeft" },
getName: (value) => FingerDirection.nameMapping[value]
};
var FingerGesture = class {
constructor(name) {
__publicField(this, "name");
__publicField(this, "curls");
__publicField(this, "directions");
__publicField(this, "weights");
__publicField(this, "weightsRelative");
this.name = name;
this.curls = {};
this.directions = {};
this.weights = [1, 1, 1, 1, 1];
this.weightsRelative = [1, 1, 1, 1, 1];
}
curl(finger, curl, confidence) {
if (typeof this.curls[finger] === "undefined")
this.curls[finger] = [];
this.curls[finger].push([curl, confidence]);
}
direction(finger, position, confidence) {
if (!this.directions[finger])
this.directions[finger] = [];
this.directions[finger].push([position, confidence]);
}
weight(finger, weight) {
this.weights[finger] = weight;
const total = this.weights.reduce((a, b) => a + b, 0);
this.weightsRelative = this.weights.map((el) => el * 5 / total);
}
matchAgainst(detectedCurls, detectedDirections) {
let confidence = 0;
for (const fingerIdx in detectedCurls) {
const detectedCurl = detectedCurls[fingerIdx];
const expectedCurls = this.curls[fingerIdx];
if (typeof expectedCurls === "undefined") {
confidence += this.weightsRelative[fingerIdx];
continue;
}
for (const [expectedCurl, score] of expectedCurls) {
if (detectedCurl === expectedCurl) {
confidence += score * this.weightsRelative[fingerIdx];
break;
}
}
}
for (const fingerIdx in detectedDirections) {
const detectedDirection = detectedDirections[fingerIdx];
const expectedDirections = this.directions[fingerIdx];
if (typeof expectedDirections === "undefined") {
confidence += this.weightsRelative[fingerIdx];
continue;
}
for (const [expectedDirection, score] of expectedDirections) {
if (detectedDirection === expectedDirection) {
confidence += score * this.weightsRelative[fingerIdx];
break;
}
}
}
return confidence / 10;
}
};
// src/hand/fingergesture.ts
var { thumb, index, middle, ring, pinky } = Finger;
var { none, half, full } = FingerCurl;
var { verticalUp, verticalDown, horizontalLeft, horizontalRight, diagonalUpRight, diagonalUpLeft, diagonalDownRight, diagonalDownLeft } = FingerDirection;
var ThumbsUp = new FingerGesture("thumbs up");
ThumbsUp.curl(thumb, none, 1);
ThumbsUp.direction(thumb, verticalUp, 1);
ThumbsUp.direction(thumb, diagonalUpLeft, 0.25);
ThumbsUp.direction(thumb, diagonalUpRight, 0.25);
for (const finger of [Finger.index, Finger.middle, Finger.ring, Finger.pinky]) {
ThumbsUp.curl(finger, full, 1);
ThumbsUp.direction(finger, horizontalLeft, 1);
ThumbsUp.direction(finger, horizontalRight, 1);
}
var Victory = new FingerGesture("victory");
Victory.curl(thumb, half, 0.5);
Victory.curl(thumb, none, 0.5);
Victory.direction(thumb, verticalUp, 1);
Victory.direction(thumb, diagonalUpLeft, 1);
Victory.curl(index, none, 1);
Victory.direction(index, verticalUp, 0.75);
Victory.direction(index, diagonalUpLeft, 1);
Victory.curl(middle, none, 1);
Victory.direction(middle, verticalUp, 1);
Victory.direction(middle, diagonalUpLeft, 0.75);
Victory.curl(ring, full, 1);
Victory.direction(ring, verticalUp, 0.2);
Victory.direction(ring, diagonalUpLeft, 1);
Victory.direction(ring, horizontalLeft, 0.2);
Victory.curl(pinky, full, 1);
Victory.direction(pinky, verticalUp, 0.2);
Victory.direction(pinky, diagonalUpLeft, 1);
Victory.direction(pinky, horizontalLeft, 0.2);
Victory.weight(index, 2);
Victory.weight(middle, 2);
var Point = new FingerGesture("point");
Point.curl(thumb, full, 1);
Point.curl(index, none, 0.5);
Point.curl(middle, full, 0.5);
Point.curl(ring, full, 0.5);
Point.curl(pinky, full, 0.5);
Point.weight(index, 2);
Point.weight(middle, 2);
var MiddleFinger = new FingerGesture("middle finger");
MiddleFinger.curl(thumb, none, 1);
MiddleFinger.curl(index, full, 0.5);
MiddleFinger.curl(middle, full, 0.5);
MiddleFinger.curl(ring, full, 0.5);
MiddleFinger.curl(pinky, full, 0.5);
MiddleFinger.weight(index, 2);
MiddleFinger.weight(middle, 2);
var OpenPalm = new FingerGesture("open palm");
OpenPalm.curl(thumb, none, 0.75);
OpenPalm.curl(index, none, 0.75);
OpenPalm.curl(middle, none, 0.75);
OpenPalm.curl(ring, none, 0.75);
OpenPalm.curl(pinky, none, 0.75);
var fingergesture_default = [ThumbsUp, Victory, Point, MiddleFinger, OpenPalm];
// src/hand/fingerpose.ts
var minConfidence = 0.7;
var options = {
HALF_CURL_START_LIMIT: 60,
NO_CURL_START_LIMIT: 130,
DISTANCE_VOTE_POWER: 1.1,
SINGLE_ANGLE_VOTE_POWER: 0.9,
TOTAL_ANGLE_VOTE_POWER: 1.6
};
function calculateSlope(point1x, point1y, point2x, point2y) {
const value = (point1y - point2y) / (point1x - point2x);
let slope = Math.atan(value) * 180 / Math.PI;
if (slope <= 0)
slope = -slope;
else if (slope > 0)
slope = 180 - slope;
return slope;
}
function getSlopes(point1, point2) {
if (!point1 || !point2)
return [0, 0];
const slopeXY = calculateSlope(point1[0], point1[1], point2[0], point2[1]);
if (point1.length === 2)
return slopeXY;
const slopeYZ = calculateSlope(point1[1], point1[2], point2[1], point2[2]);
return [slopeXY, slopeYZ];
}
function angleOrientationAt(angle, weightageAt = 1) {
let isVertical = 0;
let isDiagonal = 0;
let isHorizontal = 0;
if (angle >= 75 && angle <= 105)
isVertical = 1 * weightageAt;
else if (angle >= 25 && angle <= 155)
isDiagonal = 1 * weightageAt;
else
isHorizontal = 1 * weightageAt;
return [isVertical, isDiagonal, isHorizontal];
}
function estimateFingerCurl(startPoint, midPoint, endPoint) {
const start_mid_x_dist = startPoint[0] - midPoint[0];
const start_end_x_dist = startPoint[0] - endPoint[0];
const mid_end_x_dist = midPoint[0] - endPoint[0];
const start_mid_y_dist = startPoint[1] - midPoint[1];
const start_end_y_dist = startPoint[1] - endPoint[1];
const mid_end_y_dist = midPoint[1] - endPoint[1];
const start_mid_z_dist = startPoint[2] - midPoint[2];
const start_end_z_dist = startPoint[2] - endPoint[2];
const mid_end_z_dist = midPoint[2] - endPoint[2];
const start_mid_dist = Math.sqrt(start_mid_x_dist * start_mid_x_dist + start_mid_y_dist * start_mid_y_dist + start_mid_z_dist * start_mid_z_dist);
const start_end_dist = Math.sqrt(start_end_x_dist * start_end_x_dist + start_end_y_dist * start_end_y_dist + start_end_z_dist * start_end_z_dist);
const mid_end_dist = Math.sqrt(mid_end_x_dist * mid_end_x_dist + mid_end_y_dist * mid_end_y_dist + mid_end_z_dist * mid_end_z_dist);
let cos_in = (mid_end_dist * mid_end_dist + start_mid_dist * start_mid_dist - start_end_dist * start_end_dist) / (2 * mid_end_dist * start_mid_dist);
if (cos_in > 1)
cos_in = 1;
else if (cos_in < -1)
cos_in = -1;
let angleOfCurve = Math.acos(cos_in);
angleOfCurve = 57.2958 * angleOfCurve % 180;
let fingerCurl;
if (angleOfCurve > options.NO_CURL_START_LIMIT)
fingerCurl = FingerCurl.none;
else if (angleOfCurve > options.HALF_CURL_START_LIMIT)
fingerCurl = FingerCurl.half;
else
fingerCurl = FingerCurl.full;
return fingerCurl;
}
function estimateHorizontalDirection(start_end_x_dist, start_mid_x_dist, mid_end_x_dist, max_dist_x) {
let estimatedDirection;
if (max_dist_x === Math.abs(start_end_x_dist)) {
if (start_end_x_dist > 0)
estimatedDirection = FingerDirection.horizontalLeft;
else
estimatedDirection = FingerDirection.horizontalRight;
} else if (max_dist_x === Math.abs(start_mid_x_dist)) {
if (start_mid_x_dist > 0)
estimatedDirection = FingerDirection.horizontalLeft;
else
estimatedDirection = FingerDirection.horizontalRight;
} else {
if (mid_end_x_dist > 0)
estimatedDirection = FingerDirection.horizontalLeft;
else
estimatedDirection = FingerDirection.horizontalRight;
}
return estimatedDirection;
}
function estimateVerticalDirection(start_end_y_dist, start_mid_y_dist, mid_end_y_dist, max_dist_y) {
let estimatedDirection;
if (max_dist_y === Math.abs(start_end_y_dist)) {
if (start_end_y_dist < 0)
estimatedDirection = FingerDirection.verticalDown;
else
estimatedDirection = FingerDirection.verticalUp;
} else if (max_dist_y === Math.abs(start_mid_y_dist)) {
if (start_mid_y_dist < 0)
estimatedDirection = FingerDirection.verticalDown;
else
estimatedDirection = FingerDirection.verticalUp;
} else {
if (mid_end_y_dist < 0)
estimatedDirection = FingerDirection.verticalDown;
else
estimatedDirection = FingerDirection.verticalUp;
}
return estimatedDirection;
}
function estimateDiagonalDirection(start_end_y_dist, start_mid_y_dist, mid_end_y_dist, max_dist_y, start_end_x_dist, start_mid_x_dist, mid_end_x_dist, max_dist_x) {
let estimatedDirection;
const reqd_vertical_direction = estimateVerticalDirection(start_end_y_dist, start_mid_y_dist, mid_end_y_dist, max_dist_y);
const reqd_horizontal_direction = estimateHorizontalDirection(start_end_x_dist, start_mid_x_dist, mid_end_x_dist, max_dist_x);
if (reqd_vertical_direction === FingerDirection.verticalUp) {
if (reqd_horizontal_direction === FingerDirection.horizontalLeft)
estimatedDirection = FingerDirection.diagonalUpLeft;
else
estimatedDirection = FingerDirection.diagonalUpRight;
} else {
if (reqd_horizontal_direction === FingerDirection.horizontalLeft)
estimatedDirection = FingerDirection.diagonalDownLeft;
else
estimatedDirection = FingerDirection.diagonalDownRight;
}
return estimatedDirection;
}
function calculateFingerDirection(startPoint, midPoint, endPoint, fingerSlopes) {
const start_mid_x_dist = startPoint[0] - midPoint[0];
const start_end_x_dist = startPoint[0] - endPoint[0];
const mid_end_x_dist = midPoint[0] - endPoint[0];
const start_mid_y_dist = startPoint[1] - midPoint[1];
const start_end_y_dist = startPoint[1] - endPoint[1];
const mid_end_y_dist = midPoint[1] - endPoint[1];
const max_dist_x = Math.max(Math.abs(start_mid_x_dist), Math.abs(start_end_x_dist), Math.abs(mid_end_x_dist));
const max_dist_y = Math.max(Math.abs(start_mid_y_dist), Math.abs(start_end_y_dist), Math.abs(mid_end_y_dist));
let voteVertical = 0;
let voteDiagonal = 0;
let voteHorizontal = 0;
const start_end_x_y_dist_ratio = max_dist_y / (max_dist_x + 1e-5);
if (start_end_x_y_dist_ratio > 1.5)
voteVertical += options.DISTANCE_VOTE_POWER;
else if (start_end_x_y_dist_ratio > 0.66)
voteDiagonal += options.DISTANCE_VOTE_POWER;
else
voteHorizontal += options.DISTANCE_VOTE_POWER;
const start_mid_dist = Math.sqrt(start_mid_x_dist * start_mid_x_dist + start_mid_y_dist * start_mid_y_dist);
const start_end_dist = Math.sqrt(start_end_x_dist * start_end_x_dist + start_end_y_dist * start_end_y_dist);
const mid_end_dist = Math.sqrt(mid_end_x_dist * mid_end_x_dist + mid_end_y_dist * mid_end_y_dist);
const max_dist = Math.max(start_mid_dist, start_end_dist, mid_end_dist);
let calc_start_point_x = startPoint[0];
let calc_start_point_y = startPoint[1];
let calc_end_point_x = endPoint[0];
let calc_end_point_y = endPoint[1];
if (max_dist === start_mid_dist) {
calc_end_point_x = endPoint[0];
calc_end_point_y = endPoint[1];
} else if (max_dist === mid_end_dist) {
calc_start_point_x = midPoint[0];
calc_start_point_y = midPoint[1];
}
const calcStartPoint = [calc_start_point_x, calc_start_point_y];
const calcEndPoint = [calc_end_point_x, calc_end_point_y];
const totalAngle = getSlopes(calcStartPoint, calcEndPoint);
const votes = angleOrientationAt(totalAngle, options.TOTAL_ANGLE_VOTE_POWER);
voteVertical += votes[0];
voteDiagonal += votes[1];
voteHorizontal += votes[2];
for (const fingerSlope of fingerSlopes) {
const fingerVotes = angleOrientationAt(fingerSlope, options.SINGLE_ANGLE_VOTE_POWER);
voteVertical += fingerVotes[0];
voteDiagonal += fingerVotes[1];
voteHorizontal += fingerVotes[2];
}
let estimatedDirection;
if (voteVertical === Math.max(voteVertical, voteDiagonal, voteHorizontal)) {
estimatedDirection = estimateVerticalDirection(start_end_y_dist, start_mid_y_dist, mid_end_y_dist, max_dist_y);
} else if (voteHorizontal === Math.max(voteDiagonal, voteHorizontal)) {
estimatedDirection = estimateHorizontalDirection(start_end_x_dist, start_mid_x_dist, mid_end_x_dist, max_dist_x);
} else {
estimatedDirection = estimateDiagonalDirection(start_end_y_dist, start_mid_y_dist, mid_end_y_dist, max_dist_y, start_end_x_dist, start_mid_x_dist, mid_end_x_dist, max_dist_x);
}
return estimatedDirection;
}
function estimate(landmarks) {
const slopesXY = [];
const slopesYZ = [];
const fingerCurls = [];
const fingerDirections = [];
if (!landmarks)
return { curls: fingerCurls, directions: fingerDirections };
for (const finger of Finger.all) {
const points = Finger.getPoints(finger);
const slopeAtXY = [];
const slopeAtYZ = [];
for (const point2 of points) {
const point1 = landmarks[point2[0]];
const point22 = landmarks[point2[1]];
const slopes = getSlopes(point1, point22);
const slopeXY = slopes[0];
const slopeYZ = slopes[1];
slopeAtXY.push(slopeXY);
slopeAtYZ.push(slopeYZ);
}
slopesXY.push(slopeAtXY);
slopesYZ.push(slopeAtYZ);
}
for (const finger of Finger.all) {
const pointIndexAt = finger === Finger.thumb ? 1 : 0;
const fingerPointsAt = Finger.getPoints(finger);
const startPoint = landmarks[fingerPointsAt[pointIndexAt][0]];
const midPoint = landmarks[fingerPointsAt[pointIndexAt + 1][1]];
const endPoint = landmarks[fingerPointsAt[3][1]];
const fingerCurled = estimateFingerCurl(startPoint, midPoint, endPoint);
const fingerPosition = calculateFingerDirection(startPoint, midPoint, endPoint, slopesXY[finger].slice(pointIndexAt));
fingerCurls[finger] = fingerCurled;
fingerDirections[finger] = fingerPosition;
}
return { curls: fingerCurls, directions: fingerDirections };
}
function analyze(keypoints) {
if (!keypoints || keypoints.length === 0)
return null;
const estimatorRes = estimate(keypoints);
const landmarks = {};
for (const fingerIdx of Finger.all) {
landmarks[Finger.getName(fingerIdx)] = {
curl: FingerCurl.getName(estimatorRes.curls[fingerIdx]),
direction: FingerDirection.getName(estimatorRes.directions[fingerIdx])
};
}
return landmarks;
}
function match(keypoints) {
const poses = [];
if (!keypoints || keypoints.length === 0)
return poses;
const estimatorRes = estimate(keypoints);
for (const gesture3 of fingergesture_default) {
const confidence = gesture3.matchAgainst(estimatorRes.curls, estimatorRes.directions);
if (confidence >= minConfidence)
poses.push({ name: gesture3.name, confidence });
}
return poses;
}
// src/hand/handpose.ts
var meshAnnotations2 = {
thumb: [1, 2, 3, 4],
index: [5, 6, 7, 8],
middle: [9, 10, 11, 12],
ring: [13, 14, 15, 16],
pinky: [17, 18, 19, 20],
palm: [0]
};
var handDetectorModel;
var handPoseModel;
var handPipeline;
async function predict12(input, config3) {
const predictions = await handPipeline.estimateHands(input, config3);
if (!predictions)
return [];
const hands = [];
for (let i = 0; i < predictions.length; i++) {
const annotations2 = {};
if (predictions[i].landmarks) {
for (const key of Object.keys(meshAnnotations2)) {
annotations2[key] = meshAnnotations2[key].map((index2) => predictions[i].landmarks[index2]);
}
}
const keypoints = predictions[i].landmarks;
let box4 = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];
let boxRaw = [0, 0, 0, 0];
if (keypoints && keypoints.length > 0) {
for (const pt of keypoints) {
if (pt[0] < box4[0])
box4[0] = pt[0];
if (pt[1] < box4[1])
box4[1] = pt[1];
if (pt[0] > box4[2])
box4[2] = pt[0];
if (pt[1] > box4[3])
box4[3] = pt[1];
}
box4[2] -= box4[0];
box4[3] -= box4[1];
boxRaw = [box4[0] / (input.shape[2] || 0), box4[1] / (input.shape[1] || 0), box4[2] / (input.shape[2] || 0), box4[3] / (input.shape[1] || 0)];
} else {
box4 = predictions[i].box ? [
Math.trunc(Math.max(0, predictions[i].box.topLeft[0])),
Math.trunc(Math.max(0, predictions[i].box.topLeft[1])),
Math.trunc(Math.min(input.shape[2] || 0, predictions[i].box.bottomRight[0]) - Math.max(0, predictions[i].box.topLeft[0])),
Math.trunc(Math.min(input.shape[1] || 0, predictions[i].box.bottomRight[1]) - Math.max(0, predictions[i].box.topLeft[1]))
] : [0, 0, 0, 0];
boxRaw = [
predictions[i].box.topLeft[0] / (input.shape[2] || 0),
predictions[i].box.topLeft[1] / (input.shape[1] || 0),
(predictions[i].box.bottomRight[0] - predictions[i].box.topLeft[0]) / (input.shape[2] || 0),
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / (input.shape[1] || 0)
];
}
const landmarks = analyze(keypoints);
hands.push({
id: i,
score: Math.round(100 * predictions[i].confidence) / 100,
boxScore: Math.round(100 * predictions[i].boxConfidence) / 100,
fingerScore: Math.round(100 * predictions[i].fingerConfidence) / 100,
label: "hand",
box: box4,
boxRaw,
keypoints,
annotations: annotations2,
landmarks
});
}
return hands;
}
async function load13(config3) {
var _a, _b, _c, _d, _e, _f;
if (env.initial) {
handDetectorModel = null;
handPoseModel = null;
}
if (!handDetectorModel || !handPoseModel) {
[handDetectorModel, handPoseModel] = await Promise.all([
config3.hand.enabled ? tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.hand.detector) == null ? void 0 : _a.modelPath) || ""), { fromTFHub: (((_b = config3.hand.detector) == null ? void 0 : _b.modelPath) || "").includes("tfhub.dev") }) : null,
config3.hand.landmarks ? tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_c = config3.hand.skeleton) == null ? void 0 : _c.modelPath) || ""), { fromTFHub: (((_d = config3.hand.skeleton) == null ? void 0 : _d.modelPath) || "").includes("tfhub.dev") }) : null
]);
if (config3.hand.enabled) {
if (!handDetectorModel || !handDetectorModel["modelUrl"])
log("load model failed:", ((_e = config3.hand.detector) == null ? void 0 : _e.modelPath) || "");
else if (config3.debug)
log("load model:", handDetectorModel["modelUrl"]);
if (!handPoseModel || !handPoseModel["modelUrl"])
log("load model failed:", ((_f = config3.hand.skeleton) == null ? void 0 : _f.modelPath) || "");
else if (config3.debug)
log("load model:", handPoseModel["modelUrl"]);
}
} else {
if (config3.debug)
log("cached model:", handDetectorModel["modelUrl"]);
if (config3.debug)
log("cached model:", handPoseModel["modelUrl"]);
}
const handDetector = new HandDetector(handDetectorModel);
handPipeline = new HandPipeline(handDetector, handPoseModel);
return [handDetectorModel, handPoseModel];
}
// src/util/box.ts
function calc(keypoints, outputSize2 = [1, 1]) {
const coords8 = [keypoints.map((pt) => pt[0]), keypoints.map((pt) => pt[1])];
const min2 = [Math.min(...coords8[0]), Math.min(...coords8[1])];
const max4 = [Math.max(...coords8[0]), Math.max(...coords8[1])];
const box4 = [min2[0], min2[1], max4[0] - min2[0], max4[1] - min2[1]];
const boxRaw = [box4[0] / outputSize2[0], box4[1] / outputSize2[1], box4[2] / outputSize2[0], box4[3] / outputSize2[1]];
return { box: box4, boxRaw };
}
function square(keypoints, outputSize2 = [1, 1]) {
const coords8 = [keypoints.map((pt) => pt[0]), keypoints.map((pt) => pt[1])];
const min2 = [Math.min(...coords8[0]), Math.min(...coords8[1])];
const max4 = [Math.max(...coords8[0]), Math.max(...coords8[1])];
const center = [(min2[0] + max4[0]) / 2, (min2[1] + max4[1]) / 2];
const dist = Math.max(center[0] - min2[0], center[1] - min2[1], -center[0] + max4[0], -center[1] + max4[1]);
const box4 = [Math.trunc(center[0] - dist), Math.trunc(center[1] - dist), Math.trunc(2 * dist), Math.trunc(2 * dist)];
const boxRaw = [box4[0] / outputSize2[0], box4[1] / outputSize2[1], box4[2] / outputSize2[0], box4[3] / outputSize2[1]];
return { box: box4, boxRaw };
}
function scale(box4, scaleFact) {
const dist = [box4[2] * scaleFact, box4[3] * scaleFact];
const newBox = [
box4[0] - (dist[0] - box4[2]) / 2,
box4[1] - (dist[1] - box4[3]) / 2,
dist[0],
dist[1]
];
return newBox;
}
function crop(box4) {
const yxBox = [Math.max(0, box4[1]), Math.max(0, box4[0]), Math.min(1, box4[3] + box4[1]), Math.min(1, box4[2] + box4[0])];
return yxBox;
}
// src/hand/handtrack.ts
var models2 = [null, null];
var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"];
var inputSize7 = [[0, 0], [0, 0]];
var classes = ["hand", "fist", "pinch", "point", "face", "tip", "pinchtip"];
var faceIndex = 4;
var boxExpandFact = 1.6;
var maxDetectorResolution = 512;
var detectorExpandFact = 1.4;
var skipped12 = Number.MAX_SAFE_INTEGER;
var lastTime13 = 0;
var outputSize = [0, 0];
var cache3 = {
boxes: [],
hands: []
};
var fingerMap = {
thumb: [1, 2, 3, 4],
index: [5, 6, 7, 8],
middle: [9, 10, 11, 12],
ring: [13, 14, 15, 16],
pinky: [17, 18, 19, 20],
palm: [0]
};
async function loadDetect2(config3) {
var _a, _b;
if (env.initial)
models2[0] = null;
if (!models2[0]) {
fakeOps(["tensorlistreserve", "enter", "tensorlistfromtensor", "merge", "loopcond", "switch", "exit", "tensorliststack", "nextiteration", "tensorlistsetitem", "tensorlistgetitem", "reciprocal", "shape", "split", "where"], config3);
models2[0] = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.hand.detector) == null ? void 0 : _a.modelPath) || ""));
const inputs = Object.values(models2[0].modelSignature["inputs"]);
inputSize7[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize7[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
if (!models2[0] || !models2[0]["modelUrl"])
log("load model failed:", (_b = config3.hand.detector) == null ? void 0 : _b.modelPath);
else if (config3.debug)
log("load model:", models2[0]["modelUrl"]);
} else if (config3.debug)
log("cached model:", models2[0]["modelUrl"]);
return models2[0];
}
async function loadSkeleton(config3) {
var _a, _b;
if (env.initial)
models2[1] = null;
if (!models2[1]) {
models2[1] = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.hand.skeleton) == null ? void 0 : _a.modelPath) || ""));
const inputs = Object.values(models2[1].modelSignature["inputs"]);
inputSize7[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize7[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
if (!models2[1] || !models2[1]["modelUrl"])
log("load model failed:", (_b = config3.hand.skeleton) == null ? void 0 : _b.modelPath);
else if (config3.debug)
log("load model:", models2[1]["modelUrl"]);
} else if (config3.debug)
log("cached model:", models2[1]["modelUrl"]);
return models2[1];
}
async function detectHands(input, config3) {
const hands = [];
if (!input || !models2[0])
return hands;
const t = {};
const ratio = (input.shape[2] || 1) / (input.shape[1] || 1);
const height = Math.min(Math.round((input.shape[1] || 0) / 8) * 8, maxDetectorResolution);
const width = Math.round(height * ratio / 8) * 8;
t.resize = tfjs_esm_exports.image.resizeBilinear(input, [height, width]);
t.cast = tfjs_esm_exports.cast(t.resize, "int32");
[t.rawScores, t.rawBoxes] = await models2[0].executeAsync(t.cast, modelOutputNodes);
t.boxes = tfjs_esm_exports.squeeze(t.rawBoxes, [0, 2]);
t.scores = tfjs_esm_exports.squeeze(t.rawScores, [0]);
const classScores = tfjs_esm_exports.unstack(t.scores, 1);
tfjs_esm_exports.dispose(classScores[faceIndex]);
classScores.splice(faceIndex, 1);
t.filtered = tfjs_esm_exports.stack(classScores, 1);
tfjs_esm_exports.dispose(classScores);
t.max = tfjs_esm_exports.max(t.filtered, 1);
t.argmax = tfjs_esm_exports.argMax(t.filtered, 1);
let id = 0;
t.nms = await tfjs_esm_exports.image.nonMaxSuppressionAsync(t.boxes, t.max, config3.hand.maxDetected, config3.hand.iouThreshold, config3.hand.minConfidence);
const nms = await t.nms.data();
const scores = await t.max.data();
const classNum = await t.argmax.data();
for (const nmsIndex of Array.from(nms)) {
const boxSlice = tfjs_esm_exports.slice(t.boxes, nmsIndex, 1);
const boxYX = await boxSlice.data();
tfjs_esm_exports.dispose(boxSlice);
const boxData = [boxYX[1], boxYX[0], boxYX[3] - boxYX[1], boxYX[2] - boxYX[0]];
const boxRaw = scale(boxData, detectorExpandFact);
const boxCrop = crop(boxRaw);
const boxFull = [Math.trunc(boxData[0] * outputSize[0]), Math.trunc(boxData[1] * outputSize[1]), Math.trunc(boxData[2] * outputSize[0]), Math.trunc(boxData[3] * outputSize[1])];
const score = scores[nmsIndex];
const label = classes[classNum[nmsIndex]];
const hand3 = { id: id++, score, box: boxFull, boxRaw, boxCrop, label };
hands.push(hand3);
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
hands.sort((a, b) => b.score - a.score);
if (hands.length > (config3.hand.maxDetected || 1))
hands.length = config3.hand.maxDetected || 1;
return hands;
}
async function detectFingers(input, h, config3) {
const hand3 = {
id: h.id,
score: Math.round(100 * h.score) / 100,
boxScore: Math.round(100 * h.score) / 100,
fingerScore: 0,
box: h.box,
boxRaw: h.boxRaw,
label: h.label,
keypoints: [],
landmarks: {},
annotations: {}
};
if (input && models2[1] && config3.hand.landmarks && h.score > (config3.hand.minConfidence || 0)) {
const t = {};
t.crop = tfjs_esm_exports.image.cropAndResize(input, [h.boxCrop], [0], [inputSize7[1][0], inputSize7[1][1]], "bilinear");
t.div = tfjs_esm_exports.div(t.crop, constants.tf255);
[t.score, t.keypoints] = models2[1].execute(t.div, ["Identity_1", "Identity"]);
const rawScore = (await t.score.data())[0];
const score = (100 - Math.trunc(100 / (1 + Math.exp(rawScore)))) / 100;
if (score >= (config3.hand.minConfidence || 0)) {
hand3.fingerScore = score;
t.reshaped = tfjs_esm_exports.reshape(t.keypoints, [-1, 3]);
const coordsData = await t.reshaped.array();
const coordsRaw = coordsData.map((kpt4) => [kpt4[0] / inputSize7[1][1], kpt4[1] / inputSize7[1][0], kpt4[2] || 0]);
const coordsNorm = coordsRaw.map((kpt4) => [kpt4[0] * h.boxRaw[2], kpt4[1] * h.boxRaw[3], kpt4[2] || 0]);
hand3.keypoints = coordsNorm.map((kpt4) => [
outputSize[0] * (kpt4[0] + h.boxRaw[0]),
outputSize[1] * (kpt4[1] + h.boxRaw[1]),
kpt4[2] || 0
]);
hand3.landmarks = analyze(hand3.keypoints);
for (const key of Object.keys(fingerMap)) {
hand3.annotations[key] = fingerMap[key].map((index2) => hand3.landmarks && hand3.keypoints[index2] ? hand3.keypoints[index2] : null);
}
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
}
return hand3;
}
async function predict13(input, config3) {
var _a, _b;
if (!models2[0] || !models2[1] || !((_a = models2[0]) == null ? void 0 : _a.inputs[0].shape) || !((_b = models2[1]) == null ? void 0 : _b.inputs[0].shape))
return [];
outputSize = [input.shape[2] || 0, input.shape[1] || 0];
skipped12++;
const skipTime = (config3.hand.skipTime || 0) > now() - lastTime13;
const skipFrame = skipped12 < (config3.hand.skipFrames || 0);
if (config3.skipAllowed && skipTime && skipFrame) {
return cache3.hands;
}
return new Promise(async (resolve) => {
const skipTimeExtended = 3 * (config3.hand.skipTime || 0) > now() - lastTime13;
const skipFrameExtended = skipped12 < 3 * (config3.hand.skipFrames || 0);
if (config3.skipAllowed && cache3.hands.length === config3.hand.maxDetected) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else if (config3.skipAllowed && skipTimeExtended && skipFrameExtended && cache3.hands.length > 0) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else {
cache3.boxes = await detectHands(input, config3);
lastTime13 = now();
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
skipped12 = 0;
}
const oldCache = [...cache3.boxes];
cache3.boxes.length = 0;
if (config3.cacheSensitivity > 0) {
for (let i = 0; i < cache3.hands.length; i++) {
const boxKpt = square(cache3.hands[i].keypoints, outputSize);
if (boxKpt.box[2] / (input.shape[2] || 1) > 0.05 && boxKpt.box[3] / (input.shape[1] || 1) > 0.05 && cache3.hands[i].fingerScore && cache3.hands[i].fingerScore > (config3.hand.minConfidence || 0)) {
const boxScale = scale(boxKpt.box, boxExpandFact);
const boxScaleRaw = scale(boxKpt.boxRaw, boxExpandFact);
const boxCrop = crop(boxScaleRaw);
cache3.boxes.push({ ...oldCache[i], box: boxScale, boxRaw: boxScaleRaw, boxCrop });
}
}
}
for (let i = 0; i < cache3.hands.length; i++) {
const bbox = calc(cache3.hands[i].keypoints, outputSize);
cache3.hands[i].box = bbox.box;
cache3.hands[i].boxRaw = bbox.boxRaw;
}
resolve(cache3.hands);
});
}
// src/face/liveness.ts
var model13;
var cached2 = [];
var skipped13 = Number.MAX_SAFE_INTEGER;
var lastCount8 = 0;
var lastTime14 = 0;
async function load14(config3) {
var _a, _b;
if (env.initial)
model13 = null;
if (!model13) {
model13 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.face.liveness) == null ? void 0 : _a.modelPath) || ""));
if (!model13 || !model13["modelUrl"])
log("load model failed:", (_b = config3.face.liveness) == null ? void 0 : _b.modelPath);
else if (config3.debug)
log("load model:", model13["modelUrl"]);
} else if (config3.debug)
log("cached model:", model13["modelUrl"]);
return model13;
}
async function predict14(image29, config3, idx, count2) {
var _a, _b;
if (!model13)
return 0;
const skipTime = (((_a = config3.face.liveness) == null ? void 0 : _a.skipTime) || 0) > now() - lastTime14;
const skipFrame = skipped13 < (((_b = config3.face.liveness) == null ? void 0 : _b.skipFrames) || 0);
if (config3.skipAllowed && skipTime && skipFrame && lastCount8 === count2 && cached2[idx]) {
skipped13++;
return cached2[idx];
}
skipped13 = 0;
return new Promise(async (resolve) => {
const resize = tfjs_esm_exports.image.resizeBilinear(image29, [(model13 == null ? void 0 : model13.inputs[0].shape) ? model13.inputs[0].shape[2] : 0, (model13 == null ? void 0 : model13.inputs[0].shape) ? model13.inputs[0].shape[1] : 0], false);
const res = model13 == null ? void 0 : model13.execute(resize);
const num = (await res.data())[0];
cached2[idx] = Math.round(100 * num) / 100;
lastCount8 = count2;
lastTime14 = now();
tfjs_esm_exports.dispose([resize, res]);
resolve(cached2[idx]);
});
}
// src/body/movenetcoords.ts
var movenetcoords_exports = {};
__export(movenetcoords_exports, {
connected: () => connected3,
horizontal: () => horizontal,
kpt: () => kpt3,
relative: () => relative,
vertical: () => vertical
});
var kpt3 = [
"nose",
"leftEye",
"rightEye",
"leftEar",
"rightEar",
"leftShoulder",
"rightShoulder",
"leftElbow",
"rightElbow",
"leftWrist",
"rightWrist",
"leftHip",
"rightHip",
"leftKnee",
"rightKnee",
"leftAnkle",
"rightAnkle"
];
var horizontal = [
["leftEye", "rightEye"],
["leftEar", "rightEar"],
["leftShoulder", "rightShoulder"],
["leftElbow", "rightElbow"],
["leftWrist", "rightWrist"],
["leftHip", "rightHip"],
["leftKnee", "rightKnee"],
["leftAnkle", "rightAnkle"]
];
var vertical = [
["leftKnee", "leftShoulder"],
["rightKnee", "rightShoulder"],
["leftAnkle", "leftKnee"],
["rightAnkle", "rightKnee"]
];
var relative = [
[["leftHip", "rightHip"], ["leftShoulder", "rightShoulder"]],
[["leftElbow", "rightElbow"], ["leftShoulder", "rightShoulder"]]
];
var connected3 = {
leftLeg: ["leftHip", "leftKnee", "leftAnkle"],
rightLeg: ["rightHip", "rightKnee", "rightAnkle"],
torso: ["leftShoulder", "rightShoulder", "rightHip", "leftHip", "leftShoulder"],
leftArm: ["leftShoulder", "leftElbow", "leftWrist"],
rightArm: ["rightShoulder", "rightElbow", "rightWrist"],
head: []
};
// src/body/movenetfix.ts
var maxJitter = 5e-3;
var cache4 = {
keypoints: [],
padding: [[0, 0], [0, 0], [0, 0], [0, 0]]
};
function bodyParts(body4) {
for (const pair of horizontal) {
const left = body4.keypoints.findIndex((kp) => kp.part === pair[0]);
const right = body4.keypoints.findIndex((kp) => kp.part === pair[1]);
if (body4.keypoints[left] && body4.keypoints[right]) {
if (body4.keypoints[left].position[0] < body4.keypoints[right].position[0]) {
const tmp = body4.keypoints[left];
body4.keypoints[left] = body4.keypoints[right];
body4.keypoints[right] = tmp;
}
}
}
for (const pair of vertical) {
const lower = body4.keypoints.findIndex((kp) => kp && kp.part === pair[0]);
const higher = body4.keypoints.findIndex((kp) => kp && kp.part === pair[1]);
if (body4.keypoints[lower] && body4.keypoints[higher]) {
if (body4.keypoints[lower].position[1] < body4.keypoints[higher].position[1]) {
body4.keypoints.splice(lower, 1);
}
}
}
for (const [pair, compare2] of relative) {
const left = body4.keypoints.findIndex((kp) => kp && kp.part === pair[0]);
const right = body4.keypoints.findIndex((kp) => kp && kp.part === pair[1]);
const leftTo = body4.keypoints.findIndex((kp) => kp && kp.part === compare2[0]);
const rightTo = body4.keypoints.findIndex((kp) => kp && kp.part === compare2[1]);
if (!body4.keypoints[leftTo] || !body4.keypoints[rightTo])
continue;
const distanceLeft = body4.keypoints[left] ? [
Math.abs(body4.keypoints[leftTo].position[0] - body4.keypoints[left].position[0]),
Math.abs(body4.keypoints[rightTo].position[0] - body4.keypoints[left].position[0])
] : [0, 0];
const distanceRight = body4.keypoints[right] ? [
Math.abs(body4.keypoints[rightTo].position[0] - body4.keypoints[right].position[0]),
Math.abs(body4.keypoints[leftTo].position[0] - body4.keypoints[right].position[0])
] : [0, 0];
if (distanceLeft[0] > distanceLeft[1] || distanceRight[0] > distanceRight[1]) {
const tmp = body4.keypoints[left];
body4.keypoints[left] = body4.keypoints[right];
body4.keypoints[right] = tmp;
}
}
}
function jitter(keypoints) {
for (let i = 0; i < keypoints.length; i++) {
if (keypoints[i] && cache4.keypoints[i]) {
const diff = [Math.abs(keypoints[i].positionRaw[0] - cache4.keypoints[i].positionRaw[0]), Math.abs(keypoints[i].positionRaw[1] - cache4.keypoints[i].positionRaw[1])];
if (diff[0] < maxJitter && diff[1] < maxJitter) {
keypoints[i] = cache4.keypoints[i];
} else {
cache4.keypoints[i] = keypoints[i];
}
} else {
cache4.keypoints[i] = keypoints[i];
}
}
return keypoints;
}
function padInput(input, inputSize9) {
const t = {};
if (!input.shape || !input.shape[1] || !input.shape[2])
return input;
cache4.padding = [
[0, 0],
[input.shape[2] > input.shape[1] ? Math.trunc((input.shape[2] - input.shape[1]) / 2) : 0, input.shape[2] > input.shape[1] ? Math.trunc((input.shape[2] - input.shape[1]) / 2) : 0],
[input.shape[1] > input.shape[2] ? Math.trunc((input.shape[1] - input.shape[2]) / 2) : 0, input.shape[1] > input.shape[2] ? Math.trunc((input.shape[1] - input.shape[2]) / 2) : 0],
[0, 0]
];
t.pad = tfjs_esm_exports.pad(input, cache4.padding);
t.resize = tfjs_esm_exports.image.resizeBilinear(t.pad, [inputSize9, inputSize9]);
const final = tfjs_esm_exports.cast(t.resize, "int32");
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return final;
}
function rescaleBody(body4, outputSize2) {
body4.keypoints = body4.keypoints.filter((kpt4) => kpt4 && kpt4.position);
for (const kpt4 of body4.keypoints) {
kpt4.position = [
kpt4.position[0] * (outputSize2[0] + cache4.padding[2][0] + cache4.padding[2][1]) / outputSize2[0] - cache4.padding[2][0],
kpt4.position[1] * (outputSize2[1] + cache4.padding[1][0] + cache4.padding[1][1]) / outputSize2[1] - cache4.padding[1][0]
];
kpt4.positionRaw = [
kpt4.position[0] / outputSize2[0],
kpt4.position[1] / outputSize2[1]
];
}
const rescaledBoxes = calc(body4.keypoints.map((pt) => pt.position), outputSize2);
body4.box = rescaledBoxes.box;
body4.boxRaw = rescaledBoxes.boxRaw;
return body4;
}
// src/body/movenet.ts
var model14;
var inputSize8 = 0;
var skipped14 = Number.MAX_SAFE_INTEGER;
var cache5 = {
boxes: [],
bodies: [],
last: 0
};
async function load15(config3) {
if (env.initial)
model14 = null;
if (!model14) {
fakeOps(["size"], config3);
model14 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
if (!model14 || !model14["modelUrl"])
log("load model failed:", config3.body.modelPath);
else if (config3.debug)
log("load model:", model14["modelUrl"]);
} else if (config3.debug)
log("cached model:", model14["modelUrl"]);
inputSize8 = model14.inputs[0].shape ? model14.inputs[0].shape[2] : 0;
return model14;
}
async function parseSinglePose(res, config3, image29) {
const kpt4 = res[0][0];
const keypoints = [];
let score = 0;
for (let id = 0; id < kpt4.length; id++) {
score = kpt4[id][2];
if (score > config3.body.minConfidence) {
const positionRaw = [kpt4[id][1], kpt4[id][0]];
keypoints.push({
score: Math.round(100 * score) / 100,
part: kpt3[id],
positionRaw,
position: [
Math.round((image29.shape[2] || 0) * positionRaw[0]),
Math.round((image29.shape[1] || 0) * positionRaw[1])
]
});
}
}
score = keypoints.reduce((prev, curr) => curr.score > prev ? curr.score : prev, 0);
const bodies = [];
const newBox = calc(keypoints.map((pt) => pt.position), [image29.shape[2], image29.shape[1]]);
const annotations2 = {};
for (const [name, indexes] of Object.entries(connected3)) {
const pt = [];
for (let i = 0; i < indexes.length - 1; i++) {
const pt0 = keypoints.find((kp) => kp.part === indexes[i]);
const pt1 = keypoints.find((kp) => kp.part === indexes[i + 1]);
if (pt0 && pt1 && pt0.score > (config3.body.minConfidence || 0) && pt1.score > (config3.body.minConfidence || 0))
pt.push([pt0.position, pt1.position]);
}
annotations2[name] = pt;
}
const body4 = { id: 0, score, box: newBox.box, boxRaw: newBox.boxRaw, keypoints, annotations: annotations2 };
bodyParts(body4);
bodies.push(body4);
return bodies;
}
async function parseMultiPose(res, config3, image29) {
const bodies = [];
for (let id = 0; id < res[0].length; id++) {
const kpt4 = res[0][id];
const totalScore = Math.round(100 * kpt4[51 + 4]) / 100;
if (totalScore > config3.body.minConfidence) {
const keypoints = [];
for (let i = 0; i < 17; i++) {
const score = kpt4[3 * i + 2];
if (score > config3.body.minConfidence) {
const positionRaw = [kpt4[3 * i + 1], kpt4[3 * i + 0]];
keypoints.push({
part: kpt3[i],
score: Math.round(100 * score) / 100,
positionRaw,
position: [Math.round((image29.shape[2] || 0) * positionRaw[0]), Math.round((image29.shape[1] || 0) * positionRaw[1])]
});
}
}
const newBox = calc(keypoints.map((pt) => pt.position), [image29.shape[2], image29.shape[1]]);
const annotations2 = {};
for (const [name, indexes] of Object.entries(connected3)) {
const pt = [];
for (let i = 0; i < indexes.length - 1; i++) {
const pt0 = keypoints.find((kp) => kp.part === indexes[i]);
const pt1 = keypoints.find((kp) => kp.part === indexes[i + 1]);
if (pt0 && pt1 && pt0.score > (config3.body.minConfidence || 0) && pt1.score > (config3.body.minConfidence || 0))
pt.push([pt0.position, pt1.position]);
}
annotations2[name] = pt;
}
const body4 = { id, score: totalScore, box: newBox.box, boxRaw: newBox.boxRaw, keypoints: [...keypoints], annotations: annotations2 };
bodyParts(body4);
bodies.push(body4);
}
}
bodies.sort((a, b) => b.score - a.score);
if (bodies.length > config3.body.maxDetected)
bodies.length = config3.body.maxDetected;
return bodies;
}
async function predict15(input, config3) {
if (!model14 || !(model14 == null ? void 0 : model14.inputs[0].shape))
return [];
if (!config3.skipAllowed)
cache5.boxes.length = 0;
skipped14++;
const skipTime = (config3.body.skipTime || 0) > now() - cache5.last;
const skipFrame = skipped14 < (config3.body.skipFrames || 0);
if (config3.skipAllowed && skipTime && skipFrame) {
return cache5.bodies;
}
return new Promise(async (resolve) => {
const t = {};
skipped14 = 0;
t.input = padInput(input, inputSize8);
t.res = model14 == null ? void 0 : model14.execute(t.input);
cache5.last = now();
const res = await t.res.array();
cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input) : await parseMultiPose(res, config3, input);
for (const body4 of cache5.bodies) {
rescaleBody(body4, [input.shape[2] || 1, input.shape[1] || 1]);
jitter(body4.keypoints);
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
resolve(cache5.bodies);
});
}
// src/object/nanodet.ts
var model15;
var last9 = [];
var lastTime15 = 0;
var skipped15 = Number.MAX_SAFE_INTEGER;
var scaleBox = 2.5;
async function load16(config3) {
if (!model15 || env.initial) {
model15 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
const inputs = Object.values(model15.modelSignature["inputs"]);
model15.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
if (!model15 || !model15.modelUrl)
log("load model failed:", config3.object.modelPath);
else if (config3.debug)
log("load model:", model15.modelUrl);
} else if (config3.debug)
log("cached model:", model15.modelUrl);
return model15;
}
async function process4(res, inputSize9, outputShape, config3) {
let id = 0;
let results = [];
for (const strideSize of [1, 2, 4]) {
tfjs_esm_exports.tidy(async () => {
var _a, _b;
const baseSize = strideSize * 13;
const scoresT = (_a = res.find((a) => a.shape[1] === baseSize ** 2 && a.shape[2] === labels.length)) == null ? void 0 : _a.squeeze();
const featuresT = (_b = res.find((a) => a.shape[1] === baseSize ** 2 && a.shape[2] < labels.length)) == null ? void 0 : _b.squeeze();
const boxesMax = featuresT.reshape([-1, 4, featuresT.shape[1] / 4]);
const boxIdx = await boxesMax.argMax(2).array();
const scores = await scoresT.array();
for (let i = 0; i < scoresT.shape[0]; i++) {
for (let j = 0; j < scoresT.shape[1]; j++) {
const score = scores[i][j];
if (score > config3.object.minConfidence && j !== 61) {
const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize;
const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize;
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize9));
const [x, y] = [
cx - scaleBox / strideSize * boxOffset[0],
cy - scaleBox / strideSize * boxOffset[1]
];
const [w, h] = [
cx + scaleBox / strideSize * boxOffset[2] - x,
cy + scaleBox / strideSize * boxOffset[3] - y
];
let boxRaw = [x, y, w, h];
boxRaw = boxRaw.map((a) => Math.max(0, Math.min(a, 1)));
const box4 = [
boxRaw[0] * outputShape[0],
boxRaw[1] * outputShape[1],
boxRaw[2] * outputShape[0],
boxRaw[3] * outputShape[1]
];
const result = {
id: id++,
score: Math.round(100 * score) / 100,
class: j + 1,
label: labels[j].label,
box: box4.map((a) => Math.trunc(a)),
boxRaw
};
results.push(result);
}
}
}
});
}
res.forEach((t) => tfjs_esm_exports.dispose(t));
const nmsBoxes = results.map((a) => [a.boxRaw[1], a.boxRaw[0], a.boxRaw[3], a.boxRaw[2]]);
const nmsScores = results.map((a) => a.score);
let nmsIdx = [];
if (nmsBoxes && nmsBoxes.length > 0) {
const nms = await tfjs_esm_exports.image.nonMaxSuppressionAsync(nmsBoxes, nmsScores, config3.object.maxDetected, config3.object.iouThreshold, config3.object.minConfidence);
nmsIdx = await nms.data();
tfjs_esm_exports.dispose(nms);
}
results = results.filter((_val, idx) => nmsIdx.includes(idx)).sort((a, b) => b.score - a.score);
return results;
}
async function predict16(image29, config3) {
const skipTime = (config3.object.skipTime || 0) > now() - lastTime15;
const skipFrame = skipped15 < (config3.object.skipFrames || 0);
if (config3.skipAllowed && skipTime && skipFrame && last9.length > 0) {
skipped15++;
return last9;
}
skipped15 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last9;
return new Promise(async (resolve) => {
const outputSize2 = [image29.shape[2], image29.shape[1]];
const resize = tfjs_esm_exports.image.resizeBilinear(image29, [model15.inputSize, model15.inputSize], false);
const norm = tfjs_esm_exports.div(resize, constants.tf255);
const transpose = norm.transpose([0, 3, 1, 2]);
tfjs_esm_exports.dispose(norm);
tfjs_esm_exports.dispose(resize);
let objectT;
if (config3.object.enabled)
objectT = model15.execute(transpose);
lastTime15 = now();
tfjs_esm_exports.dispose(transpose);
const obj = await process4(objectT, model15.inputSize, outputSize2, config3);
last9 = obj;
resolve(obj);
});
}
// src/body/posenetutils.ts
var partNames = [
"nose",
"leftEye",
"rightEye",
"leftEar",
"rightEar",
"leftShoulder",
"rightShoulder",
"leftElbow",
"rightElbow",
"leftWrist",
"rightWrist",
"leftHip",
"rightHip",
"leftKnee",
"rightKnee",
"leftAnkle",
"rightAnkle"
];
var count = partNames.length;
var partIds = partNames.reduce((result, jointName, i) => {
result[jointName] = i;
return result;
}, {});
var connectedPartNames = [
["leftHip", "leftShoulder"],
["leftElbow", "leftShoulder"],
["leftElbow", "leftWrist"],
["leftHip", "leftKnee"],
["leftKnee", "leftAnkle"],
["rightHip", "rightShoulder"],
["rightElbow", "rightShoulder"],
["rightElbow", "rightWrist"],
["rightHip", "rightKnee"],
["rightKnee", "rightAnkle"],
["leftShoulder", "rightShoulder"],
["leftHip", "rightHip"]
];
var connectedPartIndices = connectedPartNames.map(([jointNameA, jointNameB]) => [partIds[jointNameA], partIds[jointNameB]]);
var poseChain = [
["nose", "leftEye"],
["leftEye", "leftEar"],
["nose", "rightEye"],
["rightEye", "rightEar"],
["nose", "leftShoulder"],
["leftShoulder", "leftElbow"],
["leftElbow", "leftWrist"],
["leftShoulder", "leftHip"],
["leftHip", "leftKnee"],
["leftKnee", "leftAnkle"],
["nose", "rightShoulder"],
["rightShoulder", "rightElbow"],
["rightElbow", "rightWrist"],
["rightShoulder", "rightHip"],
["rightHip", "rightKnee"],
["rightKnee", "rightAnkle"]
];
function getBoundingBox(keypoints) {
const coord = keypoints.reduce(({ maxX, maxY, minX, minY }, { position: { x, y } }) => ({
maxX: Math.max(maxX, x),
maxY: Math.max(maxY, y),
minX: Math.min(minX, x),
minY: Math.min(minY, y)
}), {
maxX: Number.NEGATIVE_INFINITY,
maxY: Number.NEGATIVE_INFINITY,
minX: Number.POSITIVE_INFINITY,
minY: Number.POSITIVE_INFINITY
});
return [coord.minX, coord.minY, coord.maxX - coord.minX, coord.maxY - coord.minY];
}
function scalePoses(poses, [height, width], [inputResolutionHeight, inputResolutionWidth]) {
const scaleY = height / inputResolutionHeight;
const scaleX = width / inputResolutionWidth;
const scalePose = (pose, i) => ({
id: i,
score: pose.score,
boxRaw: [pose.box[0] / inputResolutionWidth, pose.box[1] / inputResolutionHeight, pose.box[2] / inputResolutionWidth, pose.box[3] / inputResolutionHeight],
box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],
keypoints: pose.keypoints.map(({ score, part, position }) => ({
score,
part,
position: [Math.trunc(position.x * scaleX), Math.trunc(position.y * scaleY)],
positionRaw: [position.x / inputResolutionHeight, position.y / inputResolutionHeight]
}))
});
const scaledPoses = poses.map((pose, i) => scalePose(pose, i));
return scaledPoses;
}
var MaxHeap = class {
constructor(maxSize2, getElementValue) {
__publicField(this, "priorityQueue");
__publicField(this, "numberOfElements");
__publicField(this, "getElementValue");
this.priorityQueue = new Array(maxSize2);
this.numberOfElements = -1;
this.getElementValue = getElementValue;
}
enqueue(x) {
this.priorityQueue[++this.numberOfElements] = x;
this.swim(this.numberOfElements);
}
dequeue() {
const max4 = this.priorityQueue[0];
this.exchange(0, this.numberOfElements--);
this.sink(0);
this.priorityQueue[this.numberOfElements + 1] = null;
return max4;
}
empty() {
return this.numberOfElements === -1;
}
size() {
return this.numberOfElements + 1;
}
all() {
return this.priorityQueue.slice(0, this.numberOfElements + 1);
}
max() {
return this.priorityQueue[0];
}
swim(k) {
while (k > 0 && this.less(Math.floor(k / 2), k)) {
this.exchange(k, Math.floor(k / 2));
k = Math.floor(k / 2);
}
}
sink(k) {
while (2 * k <= this.numberOfElements) {
let j = 2 * k;
if (j < this.numberOfElements && this.less(j, j + 1))
j++;
if (!this.less(k, j))
break;
this.exchange(k, j);
k = j;
}
}
getValueAt(i) {
return this.getElementValue(this.priorityQueue[i]);
}
less(i, j) {
return this.getValueAt(i) < this.getValueAt(j);
}
exchange(i, j) {
const t = this.priorityQueue[i];
this.priorityQueue[i] = this.priorityQueue[j];
this.priorityQueue[j] = t;
}
};
function getOffsetPoint(y, x, keypoint, offsets) {
return {
y: offsets.get(y, x, keypoint),
x: offsets.get(y, x, keypoint + count)
};
}
function getImageCoords(part, outputStride2, offsets) {
const { heatmapY, heatmapX, id: keypoint } = part;
const { y, x } = getOffsetPoint(heatmapY, heatmapX, keypoint, offsets);
return {
x: part.heatmapX * outputStride2 + x,
y: part.heatmapY * outputStride2 + y
};
}
function clamp(a, min2, max4) {
if (a < min2)
return min2;
if (a > max4)
return max4;
return a;
}
function squaredDistance(y1, x1, y2, x2) {
const dy = y2 - y1;
const dx = x2 - x1;
return dy * dy + dx * dx;
}
function addVectors(a, b) {
return { x: a.x + b.x, y: a.y + b.y };
}
// src/body/posenet.ts
var model16;
var poseNetOutputs = ["MobilenetV1/offset_2/BiasAdd", "MobilenetV1/heatmap_2/BiasAdd", "MobilenetV1/displacement_fwd_2/BiasAdd", "MobilenetV1/displacement_bwd_2/BiasAdd"];
var localMaximumRadius = 1;
var outputStride = 16;
var squaredNmsRadius = 50 ** 2;
function traverse(edgeId, sourceKeypoint, targetId, scores, offsets, displacements, offsetRefineStep = 2) {
const getDisplacement = (point2) => ({
y: displacements.get(point2.y, point2.x, edgeId),
x: displacements.get(point2.y, point2.x, displacements.shape[2] / 2 + edgeId)
});
const getStridedIndexNearPoint = (point2, height2, width2) => ({
y: clamp(Math.round(point2.y / outputStride), 0, height2 - 1),
x: clamp(Math.round(point2.x / outputStride), 0, width2 - 1)
});
const [height, width] = scores.shape;
const sourceKeypointIndices = getStridedIndexNearPoint(sourceKeypoint.position, height, width);
const displacement = getDisplacement(sourceKeypointIndices);
const displacedPoint = addVectors(sourceKeypoint.position, displacement);
let targetKeypoint = displacedPoint;
for (let i = 0; i < offsetRefineStep; i++) {
const targetKeypointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);
const offsetPoint = getOffsetPoint(targetKeypointIndices.y, targetKeypointIndices.x, targetId, offsets);
targetKeypoint = addVectors({ x: targetKeypointIndices.x * outputStride, y: targetKeypointIndices.y * outputStride }, { x: offsetPoint.x, y: offsetPoint.y });
}
const targetKeyPointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);
const score = scores.get(targetKeyPointIndices.y, targetKeyPointIndices.x, targetId);
return { position: targetKeypoint, part: partNames[targetId], score };
}
function decodePose(root, scores, offsets, displacementsFwd, displacementsBwd) {
const tuples = poseChain.map(([parentJoinName, childJoinName]) => [partIds[parentJoinName], partIds[childJoinName]]);
const edgesFwd = tuples.map(([, childJointId]) => childJointId);
const edgesBwd = tuples.map(([parentJointId]) => parentJointId);
const numParts = scores.shape[2];
const numEdges = edgesFwd.length;
const keypoints = new Array(numParts);
const rootPoint = getImageCoords(root.part, outputStride, offsets);
keypoints[root.part.id] = {
score: root.score,
part: partNames[root.part.id],
position: rootPoint
};
for (let edge = numEdges - 1; edge >= 0; --edge) {
const sourceId = edgesFwd[edge];
const targetId = edgesBwd[edge];
if (keypoints[sourceId] && !keypoints[targetId]) {
keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsBwd);
}
}
for (let edge = 0; edge < numEdges; ++edge) {
const sourceId = edgesBwd[edge];
const targetId = edgesFwd[edge];
if (keypoints[sourceId] && !keypoints[targetId]) {
keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsFwd);
}
}
return keypoints;
}
function scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores) {
const [height, width] = scores.shape;
let localMaximum = true;
const yStart = Math.max(heatmapY - localMaximumRadius, 0);
const yEnd = Math.min(heatmapY + localMaximumRadius + 1, height);
for (let yCurrent = yStart; yCurrent < yEnd; ++yCurrent) {
const xStart = Math.max(heatmapX - localMaximumRadius, 0);
const xEnd = Math.min(heatmapX + localMaximumRadius + 1, width);
for (let xCurrent = xStart; xCurrent < xEnd; ++xCurrent) {
if (scores.get(yCurrent, xCurrent, keypointId) > score) {
localMaximum = false;
break;
}
}
if (!localMaximum)
break;
}
return localMaximum;
}
function buildPartWithScoreQueue(minConfidence2, scores) {
const [height, width, numKeypoints] = scores.shape;
const queue = new MaxHeap(height * width * numKeypoints, ({ score }) => score);
for (let heatmapY = 0; heatmapY < height; ++heatmapY) {
for (let heatmapX = 0; heatmapX < width; ++heatmapX) {
for (let keypointId = 0; keypointId < numKeypoints; ++keypointId) {
const score = scores.get(heatmapY, heatmapX, keypointId);
if (score < minConfidence2)
continue;
if (scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores))
queue.enqueue({ score, part: { heatmapY, heatmapX, id: keypointId } });
}
}
}
return queue;
}
function withinRadius(poses, { x, y }, keypointId) {
return poses.some(({ keypoints }) => {
var _a;
const correspondingKeypoint = (_a = keypoints[keypointId]) == null ? void 0 : _a.position;
if (!correspondingKeypoint)
return false;
return squaredDistance(y, x, correspondingKeypoint.y, correspondingKeypoint.x) <= squaredNmsRadius;
});
}
function getInstanceScore(existingPoses, keypoints) {
const notOverlappedKeypointScores = keypoints.reduce((result, { position, score }, keypointId) => {
if (!withinRadius(existingPoses, position, keypointId))
result += score;
return result;
}, 0);
return notOverlappedKeypointScores / keypoints.length;
}
function decode2(offsets, scores, displacementsFwd, displacementsBwd, maxDetected, minConfidence2) {
const poses = [];
const queue = buildPartWithScoreQueue(minConfidence2, scores);
while (poses.length < maxDetected && !queue.empty()) {
const root = queue.dequeue();
const rootImageCoords = getImageCoords(root.part, outputStride, offsets);
if (withinRadius(poses, rootImageCoords, root.part.id))
continue;
let keypoints = decodePose(root, scores, offsets, displacementsFwd, displacementsBwd);
keypoints = keypoints.filter((a) => a.score > minConfidence2);
const score = getInstanceScore(poses, keypoints);
const box4 = getBoundingBox(keypoints);
if (score > minConfidence2)
poses.push({ keypoints, box: box4, score: Math.round(100 * score) / 100 });
}
return poses;
}
async function predict17(input, config3) {
const res = tfjs_esm_exports.tidy(() => {
if (!model16.inputs[0].shape)
return [];
const resized = tfjs_esm_exports.image.resizeBilinear(input, [model16.inputs[0].shape[2], model16.inputs[0].shape[1]]);
const normalized = tfjs_esm_exports.sub(tfjs_esm_exports.div(tfjs_esm_exports.cast(resized, "float32"), 127.5), 1);
const results = model16.execute(normalized, poseNetOutputs);
const results3d = results.map((y) => tfjs_esm_exports.squeeze(y, [0]));
results3d[1] = results3d[1].sigmoid();
return results3d;
});
const buffers = await Promise.all(res.map((tensor3) => tensor3.buffer()));
for (const t of res)
tfjs_esm_exports.dispose(t);
const decoded = await decode2(buffers[0], buffers[1], buffers[2], buffers[3], config3.body.maxDetected, config3.body.minConfidence);
if (!model16.inputs[0].shape)
return [];
const scaled = scalePoses(decoded, [input.shape[1], input.shape[2]], [model16.inputs[0].shape[2], model16.inputs[0].shape[1]]);
return scaled;
}
async function load17(config3) {
if (!model16 || env.initial) {
model16 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
if (!model16 || !model16["modelUrl"])
log("load model failed:", config3.body.modelPath);
else if (config3.debug)
log("load model:", model16["modelUrl"]);
} else if (config3.debug)
log("cached model:", model16["modelUrl"]);
return model16;
}
// src/segmentation/segmentation.ts
var model17;
var busy = false;
async function load18(config3) {
if (!model17 || env.initial) {
model17 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
if (!model17 || !model17["modelUrl"])
log("load model failed:", config3.segmentation.modelPath);
else if (config3.debug)
log("load model:", model17["modelUrl"]);
} else if (config3.debug)
log("cached model:", model17["modelUrl"]);
return model17;
}
async function process5(input, background, config3) {
var _a, _b;
if (busy)
return { data: [], canvas: null, alpha: null };
busy = true;
if (!model17)
await load18(config3);
const inputImage = await process2(input, config3);
const width = ((_a = inputImage.tensor) == null ? void 0 : _a.shape[2]) || 0;
const height = ((_b = inputImage.tensor) == null ? void 0 : _b.shape[1]) || 0;
if (!inputImage.tensor)
return { data: [], canvas: null, alpha: null };
const t = {};
t.resize = tfjs_esm_exports.image.resizeBilinear(inputImage.tensor, [model17.inputs[0].shape ? model17.inputs[0].shape[1] : 0, model17.inputs[0].shape ? model17.inputs[0].shape[2] : 0], false);
tfjs_esm_exports.dispose(inputImage.tensor);
t.norm = tfjs_esm_exports.div(t.resize, constants.tf255);
t.res = model17.execute(t.norm);
t.squeeze = tfjs_esm_exports.squeeze(t.res, 0);
if (t.squeeze.shape[2] === 2) {
t.softmax = tfjs_esm_exports.softmax(t.squeeze);
[t.bg, t.fg] = tfjs_esm_exports.unstack(t.softmax, 2);
t.expand = tfjs_esm_exports.expandDims(t.fg, 2);
t.pad = tfjs_esm_exports.expandDims(t.expand, 0);
t.crop = tfjs_esm_exports.image.cropAndResize(t.pad, [[0, 0, 0.5, 0.5]], [0], [width, height]);
t.data = tfjs_esm_exports.squeeze(t.crop, 0);
} else {
t.data = tfjs_esm_exports.image.resizeBilinear(t.squeeze, [height, width]);
}
const data = Array.from(await t.data.data());
if (env.node && !env.Canvas && typeof ImageData === "undefined") {
if (config3.debug)
log("canvas support missing");
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
return { data, canvas: null, alpha: null };
}
const alphaCanvas = canvas(width, height);
await tfjs_esm_exports.browser.toPixels(t.data, alphaCanvas);
const alphaCtx = alphaCanvas.getContext("2d");
if (config3.segmentation.blur && config3.segmentation.blur > 0)
alphaCtx.filter = `blur(${config3.segmentation.blur}px)`;
const alphaData = alphaCtx.getImageData(0, 0, width, height);
const compositeCanvas = canvas(width, height);
const compositeCtx = compositeCanvas.getContext("2d");
if (inputImage.canvas)
compositeCtx.drawImage(inputImage.canvas, 0, 0);
compositeCtx.globalCompositeOperation = "darken";
if (config3.segmentation.blur && config3.segmentation.blur > 0)
compositeCtx.filter = `blur(${config3.segmentation.blur}px)`;
compositeCtx.drawImage(alphaCanvas, 0, 0);
compositeCtx.globalCompositeOperation = "source-over";
compositeCtx.filter = "none";
const compositeData = compositeCtx.getImageData(0, 0, width, height);
for (let i = 0; i < width * height; i++)
compositeData.data[4 * i + 3] = alphaData.data[4 * i + 0];
compositeCtx.putImageData(compositeData, 0, 0);
let mergedCanvas = null;
if (background && compositeCanvas) {
mergedCanvas = canvas(width, height);
const bgImage = await process2(background, config3);
tfjs_esm_exports.dispose(bgImage.tensor);
const ctxMerge = mergedCanvas.getContext("2d");
ctxMerge.drawImage(bgImage.canvas, 0, 0, mergedCanvas.width, mergedCanvas.height);
ctxMerge.drawImage(compositeCanvas, 0, 0);
}
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
busy = false;
return { data, canvas: compositeCanvas, alpha: alphaCanvas };
}
// src/models.ts
var Models = class {
constructor() {
__publicField(this, "ssrnetage", null);
__publicField(this, "gear", null);
__publicField(this, "blazeposedetect", null);
__publicField(this, "blazepose", null);
__publicField(this, "centernet", null);
__publicField(this, "efficientpose", null);
__publicField(this, "mobilefacenet", null);
__publicField(this, "emotion", null);
__publicField(this, "facedetect", null);
__publicField(this, "faceiris", null);
__publicField(this, "facemesh", null);
__publicField(this, "faceres", null);
__publicField(this, "ssrnetgender", null);
__publicField(this, "handpose", null);
__publicField(this, "handskeleton", null);
__publicField(this, "handtrack", null);
__publicField(this, "liveness", null);
__publicField(this, "movenet", null);
__publicField(this, "nanodet", null);
__publicField(this, "posenet", null);
__publicField(this, "segmentation", null);
__publicField(this, "antispoof", null);
}
};
function reset(instance) {
for (const model18 of Object.keys(instance.models))
instance.models[model18] = null;
}
async function load19(instance) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
if (env.initial)
reset(instance);
if (instance.config.hand.enabled) {
if (!instance.models.handpose && ((_b = (_a = instance.config.hand.detector) == null ? void 0 : _a.modelPath) == null ? void 0 : _b.includes("handdetect")))
[instance.models.handpose, instance.models.handskeleton] = await load13(instance.config);
if (!instance.models.handskeleton && instance.config.hand.landmarks && ((_d = (_c = instance.config.hand.detector) == null ? void 0 : _c.modelPath) == null ? void 0 : _d.includes("handdetect")))
[instance.models.handpose, instance.models.handskeleton] = await load13(instance.config);
}
if (instance.config.body.enabled && !instance.models.blazepose && ((_f = (_e = instance.config.body) == null ? void 0 : _e.modelPath) == null ? void 0 : _f.includes("blazepose")))
instance.models.blazepose = loadPose(instance.config);
if (instance.config.body.enabled && !instance.models.blazeposedetect && instance.config.body["detector"] && instance.config.body["detector"]["modelPath"])
instance.models.blazeposedetect = loadDetect(instance.config);
if (instance.config.body.enabled && !instance.models.efficientpose && ((_h = (_g = instance.config.body) == null ? void 0 : _g.modelPath) == null ? void 0 : _h.includes("efficientpose")))
instance.models.efficientpose = load7(instance.config);
if (instance.config.body.enabled && !instance.models.movenet && ((_j = (_i = instance.config.body) == null ? void 0 : _i.modelPath) == null ? void 0 : _j.includes("movenet")))
instance.models.movenet = load15(instance.config);
if (instance.config.body.enabled && !instance.models.posenet && ((_l = (_k = instance.config.body) == null ? void 0 : _k.modelPath) == null ? void 0 : _l.includes("posenet")))
instance.models.posenet = load17(instance.config);
if (instance.config.face.enabled && !instance.models.facedetect)
instance.models.facedetect = load5(instance.config);
if (instance.config.face.enabled && ((_m = instance.config.face.antispoof) == null ? void 0 : _m.enabled) && !instance.models.antispoof)
instance.models.antispoof = load4(instance.config);
if (instance.config.face.enabled && ((_n = instance.config.face.liveness) == null ? void 0 : _n.enabled) && !instance.models.liveness)
instance.models.liveness = load14(instance.config);
if (instance.config.face.enabled && ((_o = instance.config.face.description) == null ? void 0 : _o.enabled) && !instance.models.faceres)
instance.models.faceres = load12(instance.config);
if (instance.config.face.enabled && ((_p = instance.config.face.emotion) == null ? void 0 : _p.enabled) && !instance.models.emotion)
instance.models.emotion = load8(instance.config);
if (instance.config.face.enabled && ((_q = instance.config.face.iris) == null ? void 0 : _q.enabled) && !instance.models.faceiris)
instance.models.faceiris = load10(instance.config);
if (instance.config.face.enabled && ((_r = instance.config.face.mesh) == null ? void 0 : _r.enabled) && !instance.models.facemesh)
instance.models.facemesh = load11(instance.config);
if (instance.config.face.enabled && ((_s = instance.config.face["gear"]) == null ? void 0 : _s.enabled) && !instance.models.gear)
instance.models.gear = load(instance.config);
if (instance.config.face.enabled && ((_t = instance.config.face["ssrnet"]) == null ? void 0 : _t.enabled) && !instance.models.ssrnetage)
instance.models.ssrnetage = load2(instance.config);
if (instance.config.face.enabled && ((_u = instance.config.face["ssrnet"]) == null ? void 0 : _u.enabled) && !instance.models.ssrnetgender)
instance.models.ssrnetgender = load3(instance.config);
if (instance.config.face.enabled && ((_v = instance.config.face["mobilefacenet"]) == null ? void 0 : _v.enabled) && !instance.models.mobilefacenet)
instance.models.mobilefacenet = load9(instance.config);
if (instance.config.hand.enabled && !instance.models.handtrack && ((_x = (_w = instance.config.hand.detector) == null ? void 0 : _w.modelPath) == null ? void 0 : _x.includes("handtrack")))
instance.models.handtrack = loadDetect2(instance.config);
if (instance.config.hand.enabled && instance.config.hand.landmarks && !instance.models.handskeleton && ((_z = (_y = instance.config.hand.detector) == null ? void 0 : _y.modelPath) == null ? void 0 : _z.includes("handtrack")))
instance.models.handskeleton = loadSkeleton(instance.config);
if (instance.config.object.enabled && !instance.models.centernet && ((_B = (_A = instance.config.object) == null ? void 0 : _A.modelPath) == null ? void 0 : _B.includes("centernet")))
instance.models.centernet = load6(instance.config);
if (instance.config.object.enabled && !instance.models.nanodet && ((_D = (_C = instance.config.object) == null ? void 0 : _C.modelPath) == null ? void 0 : _D.includes("nanodet")))
instance.models.nanodet = load16(instance.config);
if (instance.config.segmentation.enabled && !instance.models.segmentation)
instance.models.segmentation = load18(instance.config);
for await (const model18 of Object.keys(instance.models)) {
if (instance.models[model18] && typeof instance.models[model18] !== "undefined")
instance.models[model18] = await instance.models[model18];
}
}
async function validate2(instance) {
const simpleOps = ["const", "placeholder", "noop", "pad", "squeeze", "add", "sub", "mul", "div"];
for (const defined of Object.keys(instance.models)) {
if (instance.models[defined]) {
let models5 = [];
if (Array.isArray(instance.models[defined])) {
models5 = instance.models[defined].filter((model18) => model18 !== null).map((model18) => model18 && model18.executor ? model18 : model18.model);
} else {
models5 = [instance.models[defined]];
}
for (const model18 of models5) {
if (!model18) {
if (instance.config.debug)
log("model marked as loaded but not defined:", defined);
continue;
}
const ops = [];
const executor = model18 == null ? void 0 : model18.executor;
if (executor && executor.graph.nodes) {
for (const kernel of Object.values(executor.graph.nodes)) {
const op = kernel.op.toLowerCase();
if (!ops.includes(op))
ops.push(op);
}
} else {
if (!executor && instance.config.debug)
log("model signature not determined:", defined);
}
const missing = [];
for (const op of ops) {
if (!simpleOps.includes(op) && !instance.env.kernels.includes(op) && !instance.env.kernels.includes(op.replace("_", "")) && !instance.env.kernels.includes(op.replace("native", "")) && !instance.env.kernels.includes(op.replace("v2", ""))) {
missing.push(op);
}
}
if (missing.length > 0 && instance.config.debug)
log("model validation:", defined, missing);
}
}
}
}
// src/tfjs/humangl.ts
var config2 = {
name: "humangl",
priority: 999,
canvas: null,
gl: null,
extensions: [],
webGLattr: {
alpha: false,
antialias: false,
premultipliedAlpha: false,
preserveDrawingBuffer: false,
depth: false,
stencil: false,
failIfMajorPerformanceCaveat: false,
desynchronized: true
}
};
function extensions() {
const gl = config2.gl;
if (!gl)
return;
config2.extensions = gl.getSupportedExtensions();
}
async function register(instance) {
var _a;
if (instance.config.backend !== "humangl")
return;
if (config2.name in tfjs_esm_exports.engine().registry && (!config2.gl || !config2.gl.getParameter(config2.gl.VERSION))) {
log("error: humangl backend invalid context");
reset(instance);
}
if (!tfjs_esm_exports.findBackend(config2.name)) {
try {
config2.canvas = await canvas(100, 100);
} catch (err) {
log("error: cannot create canvas:", err);
return;
}
try {
config2.gl = (_a = config2.canvas) == null ? void 0 : _a.getContext("webgl2", config2.webGLattr);
const glv2 = config2.gl.getParameter(config2.gl.VERSION).includes("2.0");
if (!glv2) {
log("override: using fallback webgl backend as webgl 2.0 is not detected");
instance.config.backend = "webgl";
return;
}
if (config2.canvas) {
config2.canvas.addEventListener("webglcontextlost", async (e) => {
log("error: humangl:", e.type);
log("possible browser memory leak using webgl or conflict with multiple backend registrations");
instance.emit("error");
throw new Error("backend error: webgl context lost");
});
config2.canvas.addEventListener("webglcontextrestored", (e) => {
log("error: humangl context restored:", e);
});
config2.canvas.addEventListener("webglcontextcreationerror", (e) => {
log("error: humangl context create:", e);
});
}
} catch (err) {
log("error: cannot get WebGL context:", err);
return;
}
try {
tfjs_esm_exports.setWebGLContext(2, config2.gl);
} catch (err) {
log("error: cannot set WebGL context:", err);
return;
}
try {
const ctx = new tfjs_esm_exports.GPGPUContext(config2.gl);
tfjs_esm_exports.registerBackend(config2.name, () => new tfjs_esm_exports.MathBackendWebGL(ctx), config2.priority);
} catch (err) {
log("error: cannot register WebGL backend:", err);
return;
}
try {
const kernels = tfjs_esm_exports.getKernelsForBackend("webgl");
kernels.forEach((kernelConfig) => {
const newKernelConfig = { ...kernelConfig, backendName: config2.name };
tfjs_esm_exports.registerKernel(newKernelConfig);
});
} catch (err) {
log("error: cannot update WebGL backend registration:", err);
return;
}
const current = tfjs_esm_exports.backend().getGPGPUContext ? tfjs_esm_exports.backend().getGPGPUContext().gl : null;
if (current) {
log(`humangl webgl version:${current.getParameter(current.VERSION)} renderer:${current.getParameter(current.RENDERER)}`);
} else {
log("error: no current gl context:", current, config2.gl);
return;
}
try {
tfjs_esm_exports.ENV.set("WEBGL_VERSION", 2);
} catch (err) {
log("error: cannot set WebGL backend flags:", err);
return;
}
extensions();
log("backend registered:", config2.name);
}
}
// src/tfjs/backend.ts
function registerCustomOps() {
if (!env.kernels.includes("mod")) {
const kernelMod = {
kernelName: "Mod",
backendName: tfjs_esm_exports.getBackend(),
kernelFunc: (op) => tfjs_esm_exports.tidy(() => tfjs_esm_exports.sub(op.inputs.a, tfjs_esm_exports.mul(tfjs_esm_exports.div(op.inputs.a, op.inputs.b), op.inputs.b)))
};
tfjs_esm_exports.registerKernel(kernelMod);
env.kernels.push("mod");
}
if (!env.kernels.includes("floormod")) {
const kernelMod = {
kernelName: "FloorMod",
backendName: tfjs_esm_exports.getBackend(),
kernelFunc: (op) => tfjs_esm_exports.tidy(() => tfjs_esm_exports.floorDiv(op.inputs.a / op.inputs.b) * op.inputs.b + tfjs_esm_exports.mod(op.inputs.a, op.inputs.b))
};
tfjs_esm_exports.registerKernel(kernelMod);
env.kernels.push("floormod");
}
}
async function check(instance, force = false) {
instance.state = "backend";
if (force || env.initial || instance.config.backend && instance.config.backend.length > 0 && tfjs_esm_exports.getBackend() !== instance.config.backend) {
const timeStamp = now();
if (instance.config.backend && instance.config.backend.length > 0) {
if (typeof window === "undefined" && typeof WorkerGlobalScope !== "undefined" && instance.config.debug) {
if (instance.config.debug)
log("running inside web worker");
}
if (env.browser && instance.config.backend === "tensorflow") {
if (instance.config.debug)
log("override: backend set to tensorflow while running in browser");
instance.config.backend = "humangl";
}
if (env.node && (instance.config.backend === "webgl" || instance.config.backend === "humangl")) {
if (instance.config.debug)
log(`override: backend set to ${instance.config.backend} while running in nodejs`);
instance.config.backend = "tensorflow";
}
if (env.browser && instance.config.backend === "webgpu") {
if (typeof navigator === "undefined" || typeof navigator["gpu"] === "undefined") {
log("override: backend set to webgpu but browser does not support webgpu");
instance.config.backend = "humangl";
} else {
const adapter = await navigator["gpu"].requestAdapter();
if (instance.config.debug)
log("enumerated webgpu adapter:", adapter);
}
}
if (instance.config.backend === "humangl")
await register(instance);
const available = Object.keys(tfjs_esm_exports.engine().registryFactory);
if (instance.config.debug)
log("available backends:", available);
if (!available.includes(instance.config.backend)) {
log(`error: backend ${instance.config.backend} not found in registry`);
instance.config.backend = env.node ? "tensorflow" : "webgl";
if (instance.config.debug)
log(`override: setting backend ${instance.config.backend}`);
}
if (instance.config.debug)
log("setting backend:", instance.config.backend);
if (instance.config.backend === "wasm") {
if (instance.config.debug)
log("wasm path:", instance.config.wasmPath);
if (typeof (tfjs_esm_exports == null ? void 0 : tfjs_esm_exports.setWasmPaths) !== "undefined")
await tfjs_esm_exports.setWasmPaths(instance.config.wasmPath);
else
throw new Error("backend error: attempting to use wasm backend but wasm path is not set");
const simd = await tfjs_esm_exports.env().getAsync("WASM_HAS_SIMD_SUPPORT");
const mt = await tfjs_esm_exports.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");
if (instance.config.debug)
log(`wasm execution: ${simd ? "SIMD" : "no SIMD"} ${mt ? "multithreaded" : "singlethreaded"}`);
if (instance.config.debug && !simd)
log("warning: wasm simd support is not enabled");
}
try {
await tfjs_esm_exports.setBackend(instance.config.backend);
await tfjs_esm_exports.ready();
init();
} catch (err) {
log("error: cannot set backend:", instance.config.backend, err);
return false;
}
}
if (tfjs_esm_exports.getBackend() === "humangl") {
tfjs_esm_exports.ENV.set("CHECK_COMPUTATION_FOR_ERRORS", false);
tfjs_esm_exports.ENV.set("WEBGL_CPU_FORWARD", true);
tfjs_esm_exports.ENV.set("WEBGL_USE_SHAPES_UNIFORMS", true);
tfjs_esm_exports.ENV.set("CPU_HANDOFF_SIZE_THRESHOLD", 256);
if (typeof instance.config["deallocate"] !== "undefined" && instance.config["deallocate"]) {
log("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:", true);
tfjs_esm_exports.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD", 0);
}
if (tfjs_esm_exports.backend().getGPGPUContext) {
const gl = await tfjs_esm_exports.backend().getGPGPUContext().gl;
if (instance.config.debug)
log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
}
}
if (tfjs_esm_exports.getBackend() === "webgpu") {
}
tfjs_esm_exports.enableProdMode();
await tfjs_esm_exports.ready();
instance.performance.initBackend = Math.trunc(now() - timeStamp);
instance.config.backend = tfjs_esm_exports.getBackend();
await env.updateBackend();
registerCustomOps();
}
return true;
}
function fakeOps(kernelNames, config3) {
for (const kernelName of kernelNames) {
const kernelConfig = {
kernelName,
backendName: config3.backend,
kernelFunc: () => {
if (config3.debug)
log("kernelFunc", kernelName, config3.backend);
}
};
tfjs_esm_exports.registerKernel(kernelConfig);
}
env.kernels = tfjs_esm_exports.getKernelsForBackend(tfjs_esm_exports.getBackend()).map((kernel) => kernel.kernelName.toLowerCase());
}
// src/util/draw.ts
var options2 = {
color: "rgba(173, 216, 230, 0.6)",
labelColor: "rgba(173, 216, 230, 1)",
shadowColor: "black",
font: 'small-caps 16px "Segoe UI"',
lineHeight: 18,
lineWidth: 4,
pointSize: 2,
roundRect: 8,
drawPoints: false,
drawLabels: true,
drawBoxes: true,
drawGestures: true,
drawPolygons: true,
drawGaze: true,
fillPolygons: false,
useDepth: true,
useCurves: false
};
var drawTime = 0;
var getCanvasContext = (input) => {
if (!input)
log("draw error: invalid canvas");
else if (!input.getContext)
log("draw error: canvas context not defined");
else {
const ctx = input.getContext("2d");
if (!ctx)
log("draw error: cannot get canvas context");
else
return ctx;
}
return null;
};
var rad2deg = (theta) => Math.round(theta * 180 / Math.PI);
function point(ctx, x, y, z, localOptions) {
z = z || 0;
ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + 2 * z}, ${127.5 - 2 * z}, 255, 0.3)` : localOptions.color;
ctx.beginPath();
ctx.arc(x, y, localOptions.pointSize, 0, 2 * Math.PI);
ctx.fill();
}
function rect(ctx, x, y, width, height, localOptions) {
ctx.beginPath();
if (localOptions.useCurves) {
const cx = (x + x + width) / 2;
const cy = (y + y + height) / 2;
ctx.ellipse(cx, cy, width / 2, height / 2, 0, 0, 2 * Math.PI);
} else {
ctx.lineWidth = localOptions.lineWidth;
ctx.moveTo(x + localOptions.roundRect, y);
ctx.lineTo(x + width - localOptions.roundRect, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + localOptions.roundRect);
ctx.lineTo(x + width, y + height - localOptions.roundRect);
ctx.quadraticCurveTo(x + width, y + height, x + width - localOptions.roundRect, y + height);
ctx.lineTo(x + localOptions.roundRect, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - localOptions.roundRect);
ctx.lineTo(x, y + localOptions.roundRect);
ctx.quadraticCurveTo(x, y, x + localOptions.roundRect, y);
ctx.closePath();
}
ctx.stroke();
}
function lines(ctx, points, localOptions) {
if (points.length < 2)
return;
ctx.beginPath();
ctx.moveTo(points[0][0], points[0][1]);
for (const pt of points) {
const z = pt[2] || 0;
ctx.strokeStyle = localOptions.useDepth && z !== 0 ? `rgba(${127.5 + 2 * z}, ${127.5 - 2 * z}, 255, 0.3)` : localOptions.color;
ctx.fillStyle = localOptions.useDepth && z !== 0 ? `rgba(${127.5 + 2 * z}, ${127.5 - 2 * z}, 255, 0.3)` : localOptions.color;
ctx.lineTo(pt[0], Math.round(pt[1]));
}
ctx.stroke();
if (localOptions.fillPolygons) {
ctx.closePath();
ctx.fill();
}
}
function curves(ctx, points, localOptions) {
if (points.length < 2)
return;
if (!localOptions.useCurves || points.length <= 2) {
lines(ctx, points, localOptions);
return;
}
ctx.moveTo(points[0][0], points[0][1]);
for (let i = 0; i < points.length - 2; i++) {
const xc = (points[i][0] + points[i + 1][0]) / 2;
const yc = (points[i][1] + points[i + 1][1]) / 2;
ctx.quadraticCurveTo(points[i][0], points[i][1], xc, yc);
}
ctx.quadraticCurveTo(points[points.length - 2][0], points[points.length - 2][1], points[points.length - 1][0], points[points.length - 1][1]);
ctx.stroke();
if (localOptions.fillPolygons) {
ctx.closePath();
ctx.fill();
}
}
function arrow(ctx, from, to, radius = 5) {
let angle;
let x;
let y;
ctx.beginPath();
ctx.moveTo(from[0], from[1]);
ctx.lineTo(to[0], to[1]);
angle = Math.atan2(to[1] - from[1], to[0] - from[0]);
x = radius * Math.cos(angle) + to[0];
y = radius * Math.sin(angle) + to[1];
ctx.moveTo(x, y);
angle += 1 / 3 * (2 * Math.PI);
x = radius * Math.cos(angle) + to[0];
y = radius * Math.sin(angle) + to[1];
ctx.lineTo(x, y);
angle += 1 / 3 * (2 * Math.PI);
x = radius * Math.cos(angle) + to[0];
y = radius * Math.sin(angle) + to[1];
ctx.lineTo(x, y);
ctx.closePath();
ctx.stroke();
ctx.fill();
}
async function gesture(inCanvas2, result, drawOptions) {
const localOptions = mergeDeep(options2, drawOptions);
if (!result || !inCanvas2)
return;
if (localOptions.drawGestures) {
const ctx = getCanvasContext(inCanvas2);
if (!ctx)
return;
ctx.font = localOptions.font;
ctx.fillStyle = localOptions.color;
let i = 1;
for (let j = 0; j < result.length; j++) {
let where = [];
let what = [];
[where, what] = Object.entries(result[j]);
if (what.length > 1 && what[1].length > 0) {
const who = where[1] > 0 ? `#${where[1]}` : "";
const label = `${where[0]} ${who}: ${what[1]}`;
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
ctx.fillStyle = localOptions.shadowColor;
ctx.fillText(label, 8, 2 + i * localOptions.lineHeight);
}
ctx.fillStyle = localOptions.labelColor;
ctx.fillText(label, 6, 0 + i * localOptions.lineHeight);
i += 1;
}
}
}
}
async function face(inCanvas2, result, drawOptions) {
var _a, _b, _c, _d, _e;
const localOptions = mergeDeep(options2, drawOptions);
if (!result || !inCanvas2)
return;
const ctx = getCanvasContext(inCanvas2);
if (!ctx)
return;
for (const f of result) {
ctx.font = localOptions.font;
ctx.strokeStyle = localOptions.color;
ctx.fillStyle = localOptions.color;
if (localOptions.drawBoxes)
rect(ctx, f.box[0], f.box[1], f.box[2], f.box[3], localOptions);
if (localOptions.drawLabels) {
const labels2 = [];
labels2.push(`face: ${Math.trunc(100 * f.score)}%`);
if (f.genderScore)
labels2.push(`${f.gender || ""} ${Math.trunc(100 * f.genderScore)}%`);
if (f.age)
labels2.push(`age: ${f.age || ""}`);
if (f.iris)
labels2.push(`distance: ${f.iris}`);
if (f.real)
labels2.push(`real: ${Math.trunc(100 * f.real)}%`);
if (f.live)
labels2.push(`live: ${Math.trunc(100 * f.live)}%`);
if (f.emotion && f.emotion.length > 0) {
const emotion3 = f.emotion.map((a) => `${Math.trunc(100 * a.score)}% ${a.emotion}`);
if (emotion3.length > 3)
emotion3.length = 3;
labels2.push(emotion3.join(" "));
}
if (f.rotation && f.rotation.angle && f.rotation.gaze) {
if (f.rotation.angle.roll)
labels2.push(`roll: ${rad2deg(f.rotation.angle.roll)}\xB0 yaw:${rad2deg(f.rotation.angle.yaw)}\xB0 pitch:${rad2deg(f.rotation.angle.pitch)}\xB0`);
if (f.rotation.gaze.bearing)
labels2.push(`gaze: ${rad2deg(f.rotation.gaze.bearing)}\xB0`);
}
if (labels2.length === 0)
labels2.push("face");
ctx.fillStyle = localOptions.color;
for (let i = labels2.length - 1; i >= 0; i--) {
const x = Math.max(f.box[0], 0);
const y = i * localOptions.lineHeight + f.box[1];
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
ctx.fillStyle = localOptions.shadowColor;
ctx.fillText(labels2[i], x + 5, y + 16);
}
ctx.fillStyle = localOptions.labelColor;
ctx.fillText(labels2[i], x + 4, y + 15);
}
}
ctx.lineWidth = 1;
if (f.mesh && f.mesh.length > 0) {
if (localOptions.drawPoints) {
for (const pt of f.mesh)
point(ctx, pt[0], pt[1], pt[2], localOptions);
}
if (localOptions.drawPolygons) {
ctx.lineWidth = 1;
if (f.mesh.length > 450) {
for (let i = 0; i < TRI468.length / 3; i++) {
const points = [
TRI468[i * 3 + 0],
TRI468[i * 3 + 1],
TRI468[i * 3 + 2]
].map((index2) => f.mesh[index2]);
lines(ctx, points, localOptions);
}
}
if (f.annotations && f.annotations["leftEyeIris"] && f.annotations["leftEyeIris"][0]) {
ctx.strokeStyle = localOptions.useDepth ? "rgba(255, 200, 255, 0.3)" : localOptions.color;
ctx.beginPath();
const sizeX = Math.abs(f.annotations["leftEyeIris"][3][0] - f.annotations["leftEyeIris"][1][0]) / 2;
const sizeY = Math.abs(f.annotations["leftEyeIris"][4][1] - f.annotations["leftEyeIris"][2][1]) / 2;
ctx.ellipse(f.annotations["leftEyeIris"][0][0], f.annotations["leftEyeIris"][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
ctx.stroke();
if (localOptions.fillPolygons) {
ctx.fillStyle = localOptions.useDepth ? "rgba(255, 255, 200, 0.3)" : localOptions.color;
ctx.fill();
}
}
if (f.annotations && f.annotations["rightEyeIris"] && f.annotations["rightEyeIris"][0]) {
ctx.strokeStyle = localOptions.useDepth ? "rgba(255, 200, 255, 0.3)" : localOptions.color;
ctx.beginPath();
const sizeX = Math.abs(f.annotations["rightEyeIris"][3][0] - f.annotations["rightEyeIris"][1][0]) / 2;
const sizeY = Math.abs(f.annotations["rightEyeIris"][4][1] - f.annotations["rightEyeIris"][2][1]) / 2;
ctx.ellipse(f.annotations["rightEyeIris"][0][0], f.annotations["rightEyeIris"][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
ctx.stroke();
if (localOptions.fillPolygons) {
ctx.fillStyle = localOptions.useDepth ? "rgba(255, 255, 200, 0.3)" : localOptions.color;
ctx.fill();
}
}
if (localOptions.drawGaze && ((_a = f.rotation) == null ? void 0 : _a.angle) && typeof Path2D !== "undefined") {
ctx.strokeStyle = "pink";
const valX = f.box[0] + f.box[2] / 2 - f.box[3] * rad2deg(f.rotation.angle.yaw) / 90;
const valY = f.box[1] + f.box[3] / 2 + f.box[2] * rad2deg(f.rotation.angle.pitch) / 90;
const pathV = new Path2D(`
M ${f.box[0] + f.box[2] / 2} ${f.box[1]}
C
${valX} ${f.box[1]},
${valX} ${f.box[1] + f.box[3]},
${f.box[0] + f.box[2] / 2} ${f.box[1] + f.box[3]}
`);
const pathH = new Path2D(`
M ${f.box[0]} ${f.box[1] + f.box[3] / 2}
C
${f.box[0]} ${valY},
${f.box[0] + f.box[2]} ${valY},
${f.box[0] + f.box[2]} ${f.box[1] + f.box[3] / 2}
`);
ctx.stroke(pathH);
ctx.stroke(pathV);
}
if (localOptions.drawGaze && ((_c = (_b = f.rotation) == null ? void 0 : _b.gaze) == null ? void 0 : _c.strength) && ((_e = (_d = f.rotation) == null ? void 0 : _d.gaze) == null ? void 0 : _e.bearing) && f.annotations["leftEyeIris"] && f.annotations["rightEyeIris"] && f.annotations["leftEyeIris"][0] && f.annotations["rightEyeIris"][0]) {
ctx.strokeStyle = "pink";
ctx.fillStyle = "pink";
const leftGaze = [
f.annotations["leftEyeIris"][0][0] + Math.sin(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[3],
f.annotations["leftEyeIris"][0][1] + Math.cos(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[2]
];
arrow(ctx, [f.annotations["leftEyeIris"][0][0], f.annotations["leftEyeIris"][0][1]], [leftGaze[0], leftGaze[1]], 4);
const rightGaze = [
f.annotations["rightEyeIris"][0][0] + Math.sin(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[3],
f.annotations["rightEyeIris"][0][1] + Math.cos(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[2]
];
arrow(ctx, [f.annotations["rightEyeIris"][0][0], f.annotations["rightEyeIris"][0][1]], [rightGaze[0], rightGaze[1]], 4);
}
}
}
}
}
async function body(inCanvas2, result, drawOptions) {
var _a;
const localOptions = mergeDeep(options2, drawOptions);
if (!result || !inCanvas2)
return;
const ctx = getCanvasContext(inCanvas2);
if (!ctx)
return;
ctx.lineJoin = "round";
for (let i = 0; i < result.length; i++) {
ctx.strokeStyle = localOptions.color;
ctx.fillStyle = localOptions.color;
ctx.lineWidth = localOptions.lineWidth;
ctx.font = localOptions.font;
if (localOptions.drawBoxes && result[i].box && ((_a = result[i].box) == null ? void 0 : _a.length) === 4) {
rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);
if (localOptions.drawLabels) {
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
ctx.fillStyle = localOptions.shadowColor;
ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);
}
ctx.fillStyle = localOptions.labelColor;
ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);
}
}
if (localOptions.drawPoints && result[i].keypoints) {
for (let pt = 0; pt < result[i].keypoints.length; pt++) {
if (!result[i].keypoints[pt].score || result[i].keypoints[pt].score === 0)
continue;
ctx.fillStyle = localOptions.useDepth && result[i].keypoints[pt].position[2] ? `rgba(${127.5 + 2 * (result[i].keypoints[pt].position[2] || 0)}, ${127.5 - 2 * (result[i].keypoints[pt].position[2] || 0)}, 255, 0.5)` : localOptions.color;
point(ctx, result[i].keypoints[pt].position[0], result[i].keypoints[pt].position[1], 0, localOptions);
}
}
if (localOptions.drawLabels && result[i].keypoints) {
ctx.font = localOptions.font;
for (const pt of result[i].keypoints) {
if (!pt.score || pt.score === 0)
continue;
ctx.fillStyle = localOptions.useDepth && pt.position[2] ? `rgba(${127.5 + 2 * pt.position[2]}, ${127.5 - 2 * pt.position[2]}, 255, 0.5)` : localOptions.color;
ctx.fillText(`${pt.part} ${Math.trunc(100 * pt.score)}%`, pt.position[0] + 4, pt.position[1] + 4);
}
}
if (localOptions.drawPolygons && result[i].keypoints && result[i].annotations) {
for (const part of Object.values(result[i].annotations)) {
for (const connected4 of part)
curves(ctx, connected4, localOptions);
}
}
}
}
async function hand(inCanvas2, result, drawOptions) {
const localOptions = mergeDeep(options2, drawOptions);
if (!result || !inCanvas2)
return;
const ctx = getCanvasContext(inCanvas2);
if (!ctx)
return;
ctx.lineJoin = "round";
ctx.font = localOptions.font;
for (const h of result) {
if (localOptions.drawBoxes) {
ctx.strokeStyle = localOptions.color;
ctx.fillStyle = localOptions.color;
rect(ctx, h.box[0], h.box[1], h.box[2], h.box[3], localOptions);
if (localOptions.drawLabels) {
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
ctx.fillStyle = localOptions.shadowColor;
ctx.fillText(`hand:${Math.trunc(100 * h.score)}%`, h.box[0] + 3, 1 + h.box[1] + localOptions.lineHeight, h.box[2]);
}
ctx.fillStyle = localOptions.labelColor;
ctx.fillText(`hand:${Math.trunc(100 * h.score)}%`, h.box[0] + 2, 0 + h.box[1] + localOptions.lineHeight, h.box[2]);
}
ctx.stroke();
}
if (localOptions.drawPoints) {
if (h.keypoints && h.keypoints.length > 0) {
for (const pt of h.keypoints) {
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + 2 * (pt[2] || 0)}, ${127.5 - 2 * (pt[2] || 0)}, 255, 0.5)` : localOptions.color;
point(ctx, pt[0], pt[1], 0, localOptions);
}
}
}
if (localOptions.drawLabels && h.annotations) {
const addHandLabel = (part, title) => {
if (!part || part.length === 0 || !part[0])
return;
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + 2 * part[part.length - 1][2]}, ${127.5 - 2 * part[part.length - 1][2]}, 255, 0.5)` : localOptions.color;
ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);
};
ctx.font = localOptions.font;
addHandLabel(h.annotations["index"], "index");
addHandLabel(h.annotations["middle"], "middle");
addHandLabel(h.annotations["ring"], "ring");
addHandLabel(h.annotations["pinky"], "pinky");
addHandLabel(h.annotations["thumb"], "thumb");
addHandLabel(h.annotations["palm"], "palm");
}
if (localOptions.drawPolygons && h.annotations) {
const addHandLine = (part) => {
if (!part || part.length === 0 || !part[0])
return;
for (let i = 0; i < part.length; i++) {
ctx.beginPath();
ctx.strokeStyle = localOptions.useDepth ? `rgba(${127.5 + i * part[i][2]}, ${127.5 - i * part[i][2]}, 255, 0.5)` : localOptions.color;
ctx.moveTo(part[i > 0 ? i - 1 : 0][0], part[i > 0 ? i - 1 : 0][1]);
ctx.lineTo(part[i][0], part[i][1]);
ctx.stroke();
}
};
ctx.lineWidth = localOptions.lineWidth;
addHandLine(h.annotations["index"]);
addHandLine(h.annotations["middle"]);
addHandLine(h.annotations["ring"]);
addHandLine(h.annotations["pinky"]);
addHandLine(h.annotations["thumb"]);
}
}
}
async function object(inCanvas2, result, drawOptions) {
const localOptions = mergeDeep(options2, drawOptions);
if (!result || !inCanvas2)
return;
const ctx = getCanvasContext(inCanvas2);
if (!ctx)
return;
ctx.lineJoin = "round";
ctx.font = localOptions.font;
for (const h of result) {
if (localOptions.drawBoxes) {
ctx.strokeStyle = localOptions.color;
ctx.fillStyle = localOptions.color;
rect(ctx, h.box[0], h.box[1], h.box[2], h.box[3], localOptions);
if (localOptions.drawLabels) {
const label = `${h.label} ${Math.round(100 * h.score)}%`;
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
ctx.fillStyle = localOptions.shadowColor;
ctx.fillText(label, h.box[0] + 3, 1 + h.box[1] + localOptions.lineHeight, h.box[2]);
}
ctx.fillStyle = localOptions.labelColor;
ctx.fillText(label, h.box[0] + 2, 0 + h.box[1] + localOptions.lineHeight, h.box[2]);
}
ctx.stroke();
}
}
}
async function person(inCanvas2, result, drawOptions) {
const localOptions = mergeDeep(options2, drawOptions);
if (!result || !inCanvas2)
return;
const ctx = getCanvasContext(inCanvas2);
if (!ctx)
return;
ctx.lineJoin = "round";
ctx.font = localOptions.font;
for (let i = 0; i < result.length; i++) {
if (localOptions.drawBoxes) {
ctx.strokeStyle = localOptions.color;
ctx.fillStyle = localOptions.color;
rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);
if (localOptions.drawLabels) {
const label = `person #${i}`;
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
ctx.fillStyle = localOptions.shadowColor;
ctx.fillText(label, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);
}
ctx.fillStyle = localOptions.labelColor;
ctx.fillText(label, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);
}
ctx.stroke();
}
}
}
async function canvas2(input, output) {
if (!input || !output)
return;
const ctx = getCanvasContext(output);
if (!ctx)
return;
ctx.drawImage(input, 0, 0);
}
async function all(inCanvas2, result, drawOptions) {
if (!result || !result.performance || !result || !inCanvas2)
return null;
const timeStamp = now();
const localOptions = mergeDeep(options2, drawOptions);
const promise = Promise.all([
face(inCanvas2, result.face, localOptions),
body(inCanvas2, result.body, localOptions),
hand(inCanvas2, result.hand, localOptions),
object(inCanvas2, result.object, localOptions),
gesture(inCanvas2, result.gesture, localOptions)
]);
drawTime = env.perfadd ? drawTime + Math.round(now() - timeStamp) : Math.round(now() - timeStamp);
result.performance.draw = drawTime;
return promise;
}
// src/face/mask.ts
var expandFact = 0.1;
var alpha = 0.5;
function insidePoly(x, y, polygon) {
let inside = false;
let j = polygon.length - 1;
for (let i = 0; i < polygon.length; j = i++) {
if (polygon[i].y > y !== polygon[j].y > y && x < (polygon[j].x - polygon[i].x) * (y - polygon[i].y) / (polygon[j].y - polygon[i].y) + polygon[i].x)
inside = !inside;
}
return inside;
}
async function mask(face5) {
if (!face5.tensor)
return face5.tensor;
if (!face5.mesh || face5.mesh.length < 100)
return face5.tensor;
const width = face5.tensor.shape[2] || 0;
const height = face5.tensor.shape[1] || 0;
const buffer = await face5.tensor.buffer();
let silhouette = [];
for (const pt of meshAnnotations.silhouette)
silhouette.push({ x: (face5.mesh[pt][0] - face5.box[0]) / face5.box[2], y: (face5.mesh[pt][1] - face5.box[1]) / face5.box[3] });
if (expandFact && expandFact > 0)
silhouette = silhouette.map((pt) => ({ x: pt.x > 0.5 ? pt.x + expandFact : pt.x - expandFact, y: pt.y > 0.5 ? pt.y + expandFact : pt.y - expandFact }));
for (let x = 0; x < width; x++) {
for (let y = 0; y < height; y++) {
const inside = insidePoly(x / width, y / width, silhouette);
if (!inside) {
buffer.set(alpha * buffer.get(0, y, x, 0), 0, y, x, 0);
buffer.set(alpha * buffer.get(0, y, x, 1), 0, y, x, 1);
buffer.set(alpha * buffer.get(0, y, x, 2), 0, y, x, 2);
}
}
}
const output = buffer.toTensor();
tfjs_esm_exports.dispose(buffer);
return output;
}
// src/face/angles.ts
var calculateGaze = (face5) => {
const radians = (pt1, pt2) => Math.atan2(pt1[1] - pt2[1], pt1[0] - pt2[0]);
if (!face5.annotations["rightEyeIris"] || !face5.annotations["leftEyeIris"])
return { bearing: 0, strength: 0 };
const offsetIris = [0, -0.1];
const eyeRatio = 1;
const left = face5.mesh[33][2] > face5.mesh[263][2];
const irisCenter = left ? face5.mesh[473] : face5.mesh[468];
const eyeCenter = left ? [(face5.mesh[133][0] + face5.mesh[33][0]) / 2, (face5.mesh[133][1] + face5.mesh[33][1]) / 2] : [(face5.mesh[263][0] + face5.mesh[362][0]) / 2, (face5.mesh[263][1] + face5.mesh[362][1]) / 2];
const eyeSize = left ? [face5.mesh[133][0] - face5.mesh[33][0], face5.mesh[23][1] - face5.mesh[27][1]] : [face5.mesh[263][0] - face5.mesh[362][0], face5.mesh[253][1] - face5.mesh[257][1]];
const eyeDiff = [
(eyeCenter[0] - irisCenter[0]) / eyeSize[0] - offsetIris[0],
eyeRatio * (irisCenter[1] - eyeCenter[1]) / eyeSize[1] - offsetIris[1]
];
let strength = Math.sqrt(eyeDiff[0] ** 2 + eyeDiff[1] ** 2);
strength = Math.min(strength, face5.boxRaw[2] / 2, face5.boxRaw[3] / 2);
const bearing = (radians([0, 0], eyeDiff) + Math.PI / 2) % Math.PI;
return { bearing, strength };
};
var calculateFaceAngle = (face5, imageSize) => {
const normalize = (v) => {
const length = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
v[0] /= length;
v[1] /= length;
v[2] /= length;
return v;
};
const subVectors = (a, b) => {
const x = a[0] - b[0];
const y = a[1] - b[1];
const z = a[2] - b[2];
return [x, y, z];
};
const crossVectors = (a, b) => {
const x = a[1] * b[2] - a[2] * b[1];
const y = a[2] * b[0] - a[0] * b[2];
const z = a[0] * b[1] - a[1] * b[0];
return [x, y, z];
};
const rotationMatrixToEulerAngle = (r) => {
const [r00, r01, r02, r10, r11, r12, r20, r21, r22] = r;
let thetaX;
let thetaY;
let thetaZ;
if (r10 < 1) {
if (r10 > -1) {
thetaZ = Math.asin(r10);
thetaY = Math.atan2(-r20, r00);
thetaX = Math.atan2(-r12, r11);
} else {
thetaZ = -Math.PI / 2;
thetaY = -Math.atan2(r21, r22);
thetaX = 0;
}
} else {
thetaZ = Math.PI / 2;
thetaY = Math.atan2(r21, r22);
thetaX = 0;
}
if (isNaN(thetaX))
thetaX = 0;
if (isNaN(thetaY))
thetaY = 0;
if (isNaN(thetaZ))
thetaZ = 0;
return { pitch: 2 * -thetaX, yaw: 2 * -thetaY, roll: 2 * -thetaZ };
};
const meshToEulerAngle = (mesh2) => {
const radians = (a1, a2, b1, b2) => Math.atan2(b2 - a2, b1 - a1);
const angle2 = {
pitch: radians(mesh2[10][1], mesh2[10][2], mesh2[152][1], mesh2[152][2]),
yaw: radians(mesh2[33][0], mesh2[33][2], mesh2[263][0], mesh2[263][2]),
roll: radians(mesh2[33][0], mesh2[33][1], mesh2[263][0], mesh2[263][1])
};
return angle2;
};
const mesh = face5.meshRaw;
if (!mesh || mesh.length < 300)
return { angle: { pitch: 0, yaw: 0, roll: 0 }, matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1], gaze: { bearing: 0, strength: 0 } };
const size2 = Math.max(face5.boxRaw[2] * imageSize[0], face5.boxRaw[3] * imageSize[1]) / 1.5;
const pts = [mesh[10], mesh[152], mesh[234], mesh[454]].map((pt) => [
pt[0] * imageSize[0] / size2,
pt[1] * imageSize[1] / size2,
pt[2]
]);
const y_axis = normalize(subVectors(pts[1], pts[0]));
let x_axis = normalize(subVectors(pts[3], pts[2]));
const z_axis = normalize(crossVectors(x_axis, y_axis));
x_axis = crossVectors(y_axis, z_axis);
const matrix = [
x_axis[0],
x_axis[1],
x_axis[2],
y_axis[0],
y_axis[1],
y_axis[2],
z_axis[0],
z_axis[1],
z_axis[2]
];
const angle = rotationMatrixToEulerAngle(matrix);
const gaze = mesh.length === 478 ? calculateGaze(face5) : { bearing: 0, strength: 0 };
return { angle, matrix, gaze };
};
// src/face/face.ts
var detectFace = async (instance, input) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
let timeStamp;
let ageRes;
let gearRes;
let genderRes;
let emotionRes;
let mobilefacenetRes;
let antispoofRes;
let livenessRes;
let descRes;
const faceRes = [];
instance.state = "run:face";
timeStamp = now();
const faces = await predict10(input, instance.config);
instance.performance.face = env.perfadd ? (instance.performance.face || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
if (!input.shape || input.shape.length !== 4)
return [];
if (!faces)
return [];
for (let i = 0; i < faces.length; i++) {
instance.analyze("Get Face");
if (!faces[i].tensor || faces[i].tensor["isDisposedInternal"]) {
log("Face object is disposed:", faces[i].tensor);
continue;
}
if ((_a = instance.config.face.detector) == null ? void 0 : _a.mask) {
const masked = await mask(faces[i]);
tfjs_esm_exports.dispose(faces[i].tensor);
faces[i].tensor = masked;
}
const rotation = faces[i].mesh && faces[i].mesh.length > 200 ? calculateFaceAngle(faces[i], [input.shape[2], input.shape[1]]) : null;
instance.analyze("Start Emotion:");
if (instance.config.async) {
emotionRes = ((_b = instance.config.face.emotion) == null ? void 0 : _b.enabled) ? predict8(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : null;
} else {
instance.state = "run:emotion";
timeStamp = now();
emotionRes = ((_c = instance.config.face.emotion) == null ? void 0 : _c.enabled) ? await predict8(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : null;
instance.performance.emotion = env.perfadd ? (instance.performance.emotion || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
}
instance.analyze("End Emotion:");
instance.analyze("Start AntiSpoof:");
if (instance.config.async) {
antispoofRes = ((_d = instance.config.face.antispoof) == null ? void 0 : _d.enabled) ? predict4(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : null;
} else {
instance.state = "run:antispoof";
timeStamp = now();
antispoofRes = ((_e = instance.config.face.antispoof) == null ? void 0 : _e.enabled) ? await predict4(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : null;
instance.performance.antispoof = env.perfadd ? (instance.performance.antispoof || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
}
instance.analyze("End AntiSpoof:");
instance.analyze("Start Liveness:");
if (instance.config.async) {
livenessRes = ((_f = instance.config.face.liveness) == null ? void 0 : _f.enabled) ? predict14(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : null;
} else {
instance.state = "run:liveness";
timeStamp = now();
livenessRes = ((_g = instance.config.face.liveness) == null ? void 0 : _g.enabled) ? await predict14(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : null;
instance.performance.liveness = env.perfadd ? (instance.performance.antispoof || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
}
instance.analyze("End Liveness:");
instance.analyze("Start GEAR:");
if (instance.config.async) {
gearRes = ((_h = instance.config.face["gear"]) == null ? void 0 : _h.enabled) ? predict(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : {};
} else {
instance.state = "run:gear";
timeStamp = now();
gearRes = ((_i = instance.config.face["gear"]) == null ? void 0 : _i.enabled) ? await predict(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : {};
instance.performance.gear = Math.trunc(now() - timeStamp);
}
instance.analyze("End GEAR:");
instance.analyze("Start SSRNet:");
if (instance.config.async) {
ageRes = ((_j = instance.config.face["ssrnet"]) == null ? void 0 : _j.enabled) ? predict2(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : {};
genderRes = ((_k = instance.config.face["ssrnet"]) == null ? void 0 : _k.enabled) ? predict3(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : {};
} else {
instance.state = "run:ssrnet";
timeStamp = now();
ageRes = ((_l = instance.config.face["ssrnet"]) == null ? void 0 : _l.enabled) ? await predict2(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : {};
genderRes = ((_m = instance.config.face["ssrnet"]) == null ? void 0 : _m.enabled) ? await predict3(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : {};
instance.performance.ssrnet = Math.trunc(now() - timeStamp);
}
instance.analyze("End SSRNet:");
instance.analyze("Start MobileFaceNet:");
if (instance.config.async) {
mobilefacenetRes = ((_n = instance.config.face["mobilefacenet"]) == null ? void 0 : _n.enabled) ? predict9(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : {};
} else {
instance.state = "run:mobilefacenet";
timeStamp = now();
mobilefacenetRes = ((_o = instance.config.face["mobilefacenet"]) == null ? void 0 : _o.enabled) ? await predict9(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : {};
instance.performance.mobilefacenet = Math.trunc(now() - timeStamp);
}
instance.analyze("End MobileFaceNet:");
instance.analyze("Start Description:");
if (instance.config.async) {
descRes = ((_p = instance.config.face.description) == null ? void 0 : _p.enabled) ? predict11(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : null;
} else {
instance.state = "run:description";
timeStamp = now();
descRes = ((_q = instance.config.face.description) == null ? void 0 : _q.enabled) ? await predict11(faces[i].tensor || tfjs_esm_exports.tensor([]), instance.config, i, faces.length) : null;
instance.performance.description = env.perfadd ? (instance.performance.description || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
}
instance.analyze("End Description:");
if (instance.config.async) {
[ageRes, genderRes, emotionRes, mobilefacenetRes, descRes, gearRes, antispoofRes, livenessRes] = await Promise.all([ageRes, genderRes, emotionRes, mobilefacenetRes, descRes, gearRes, antispoofRes, livenessRes]);
}
instance.analyze("Finish Face:");
if (((_r = instance.config.face["ssrnet"]) == null ? void 0 : _r.enabled) && ageRes && genderRes)
descRes = { age: ageRes.age, gender: genderRes.gender, genderScore: genderRes.genderScore };
if (((_s = instance.config.face["gear"]) == null ? void 0 : _s.enabled) && gearRes)
descRes = { age: gearRes.age, gender: gearRes.gender, genderScore: gearRes.genderScore, race: gearRes.race };
if (((_t = instance.config.face["mobilefacenet"]) == null ? void 0 : _t.enabled) && mobilefacenetRes)
descRes.descriptor = mobilefacenetRes;
if (!((_u = instance.config.face.iris) == null ? void 0 : _u.enabled) && ((_w = (_v = faces[i]) == null ? void 0 : _v.annotations) == null ? void 0 : _w.leftEyeIris) && ((_y = (_x = faces[i]) == null ? void 0 : _x.annotations) == null ? void 0 : _y.rightEyeIris)) {
delete faces[i].annotations.leftEyeIris;
delete faces[i].annotations.rightEyeIris;
}
const irisSize = faces[i].annotations && faces[i].annotations.leftEyeIris && faces[i].annotations.leftEyeIris[0] && faces[i].annotations.rightEyeIris && faces[i].annotations.rightEyeIris[0] && faces[i].annotations.leftEyeIris.length > 0 && faces[i].annotations.rightEyeIris.length > 0 && faces[i].annotations.leftEyeIris[0] !== null && faces[i].annotations.rightEyeIris[0] !== null ? Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) / input.shape[2] : 0;
const tensor3 = ((_z = instance.config.face.detector) == null ? void 0 : _z.return) ? tfjs_esm_exports.squeeze(faces[i].tensor) : null;
tfjs_esm_exports.dispose(faces[i].tensor);
if (faces[i].tensor)
delete faces[i].tensor;
const res = {
...faces[i],
id: i
};
if (descRes == null ? void 0 : descRes.age)
res.age = descRes.age;
if (descRes == null ? void 0 : descRes.gender)
res.gender = descRes.gender;
if (descRes == null ? void 0 : descRes.genderScore)
res.genderScore = descRes == null ? void 0 : descRes.genderScore;
if (descRes == null ? void 0 : descRes.descriptor)
res.embedding = descRes == null ? void 0 : descRes.descriptor;
if (descRes == null ? void 0 : descRes.race)
res.race = descRes == null ? void 0 : descRes.race;
if (emotionRes)
res.emotion = emotionRes;
if (antispoofRes)
res.real = antispoofRes;
if (livenessRes)
res.live = livenessRes;
if (irisSize && irisSize !== 0)
res.iris = Math.trunc(500 / irisSize / 11.7) / 100;
if (rotation)
res.rotation = rotation;
if (tensor3)
res.tensor = tensor3;
faceRes.push(res);
instance.analyze("End Face");
}
instance.analyze("End FaceMesh:");
if (instance.config.async) {
if (instance.performance.face)
delete instance.performance.face;
if (instance.performance.age)
delete instance.performance.age;
if (instance.performance.gender)
delete instance.performance.gender;
if (instance.performance.emotion)
delete instance.performance.emotion;
}
return faceRes;
};
// src/gesture/gesture.ts
var body2 = (res) => {
if (!res)
return [];
const gestures = [];
for (let i = 0; i < res.length; i++) {
const leftWrist = res[i].keypoints.find((a) => a.part === "leftWrist");
const rightWrist = res[i].keypoints.find((a) => a.part === "rightWrist");
const nose = res[i].keypoints.find((a) => a.part === "nose");
if (nose && leftWrist && rightWrist && leftWrist.position[1] < nose.position[1] && rightWrist.position[1] < nose.position[1])
gestures.push({ body: i, gesture: "i give up" });
else if (nose && leftWrist && leftWrist.position[1] < nose.position[1])
gestures.push({ body: i, gesture: "raise left hand" });
else if (nose && rightWrist && rightWrist.position[1] < nose.position[1])
gestures.push({ body: i, gesture: "raise right hand" });
const leftShoulder = res[i].keypoints.find((a) => a.part === "leftShoulder");
const rightShoulder = res[i].keypoints.find((a) => a.part === "rightShoulder");
if (leftShoulder && rightShoulder && Math.abs(leftShoulder.positionRaw[1] - rightShoulder.positionRaw[1]) > 0.1) {
gestures.push({ body: i, gesture: `leaning ${leftShoulder.position[1] > rightShoulder.position[1] ? "left" : "right"}` });
}
}
return gestures;
};
var face2 = (res) => {
if (!res)
return [];
const gestures = [];
for (let i = 0; i < res.length; i++) {
if (res[i].mesh && res[i].mesh.length > 450) {
const zDiff = (res[i].mesh[33][2] || 0) - (res[i].mesh[263][2] || 0);
const xDiff = res[i].mesh[33][0] - res[i].mesh[263][0];
if (Math.abs(zDiff / xDiff) <= 0.15)
gestures.push({ face: i, gesture: "facing center" });
else
gestures.push({ face: i, gesture: `facing ${zDiff < 0 ? "left" : "right"}` });
const openLeft = Math.abs(res[i].mesh[374][1] - res[i].mesh[386][1]) / Math.abs(res[i].mesh[443][1] - res[i].mesh[450][1]);
if (openLeft < 0.2)
gestures.push({ face: i, gesture: "blink left eye" });
const openRight = Math.abs(res[i].mesh[145][1] - res[i].mesh[159][1]) / Math.abs(res[i].mesh[223][1] - res[i].mesh[230][1]);
if (openRight < 0.2)
gestures.push({ face: i, gesture: "blink right eye" });
const mouthOpen = Math.min(100, 500 * Math.abs(res[i].mesh[13][1] - res[i].mesh[14][1]) / Math.abs(res[i].mesh[10][1] - res[i].mesh[152][1]));
if (mouthOpen > 10)
gestures.push({ face: i, gesture: `mouth ${Math.trunc(mouthOpen)}% open` });
const chinDepth = res[i].mesh[152][2] || 0;
if (Math.abs(chinDepth) > 10)
gestures.push({ face: i, gesture: `head ${chinDepth < 0 ? "up" : "down"}` });
}
}
return gestures;
};
var iris3 = (res) => {
if (!res)
return [];
const gestures = [];
for (let i = 0; i < res.length; i++) {
if (!res[i].annotations || !res[i].annotations.leftEyeIris || !res[i].annotations.leftEyeIris[0] || !res[i].annotations.rightEyeIris || !res[i].annotations.rightEyeIris[0])
continue;
const sizeXLeft = res[i].annotations.leftEyeIris[3][0] - res[i].annotations.leftEyeIris[1][0];
const sizeYLeft = res[i].annotations.leftEyeIris[4][1] - res[i].annotations.leftEyeIris[2][1];
const areaLeft = Math.abs(sizeXLeft * sizeYLeft);
const sizeXRight = res[i].annotations.rightEyeIris[3][0] - res[i].annotations.rightEyeIris[1][0];
const sizeYRight = res[i].annotations.rightEyeIris[4][1] - res[i].annotations.rightEyeIris[2][1];
const areaRight = Math.abs(sizeXRight * sizeYRight);
let center = false;
const difference = Math.abs(areaLeft - areaRight) / Math.max(areaLeft, areaRight);
if (difference < 0.25) {
center = true;
gestures.push({ iris: i, gesture: "facing center" });
}
const leftIrisCenterX = Math.abs(res[i].mesh[263][0] - res[i].annotations.leftEyeIris[0][0]) / res[i].box[2];
const rightIrisCenterX = Math.abs(res[i].mesh[33][0] - res[i].annotations.rightEyeIris[0][0]) / res[i].box[2];
if (leftIrisCenterX > 0.06 || rightIrisCenterX > 0.06)
center = false;
if (leftIrisCenterX > rightIrisCenterX) {
if (leftIrisCenterX > 0.05)
gestures.push({ iris: i, gesture: "looking right" });
} else {
if (rightIrisCenterX > 0.05)
gestures.push({ iris: i, gesture: "looking left" });
}
const rightIrisCenterY = Math.abs(res[i].mesh[145][1] - res[i].annotations.rightEyeIris[0][1]) / res[i].box[3];
const leftIrisCenterY = Math.abs(res[i].mesh[374][1] - res[i].annotations.leftEyeIris[0][1]) / res[i].box[3];
if (leftIrisCenterY < 0.01 || rightIrisCenterY < 0.01 || leftIrisCenterY > 0.022 || rightIrisCenterY > 0.022)
center = false;
if (leftIrisCenterY < 0.01 || rightIrisCenterY < 0.01)
gestures.push({ iris: i, gesture: "looking down" });
if (leftIrisCenterY > 0.022 || rightIrisCenterY > 0.022)
gestures.push({ iris: i, gesture: "looking up" });
if (center)
gestures.push({ iris: i, gesture: "looking center" });
}
return gestures;
};
var hand2 = (res) => {
if (!res)
return [];
const gestures = [];
for (let i = 0; i < res.length; i++) {
const fingers = [];
if (res[i]["annotations"]) {
for (const [finger, pos] of Object.entries(res[i]["annotations"])) {
if (finger !== "palmBase" && Array.isArray(pos) && pos[0])
fingers.push({ name: finger.toLowerCase(), position: pos[0] });
}
}
if (fingers && fingers.length > 0) {
const closest = fingers.reduce((best, a) => (best.position[2] || 0) < (a.position[2] || 0) ? best : a);
gestures.push({ hand: i, gesture: `${closest.name} forward` });
const highest = fingers.reduce((best, a) => best.position[1] < a.position[1] ? best : a);
gestures.push({ hand: i, gesture: `${highest.name} up` });
}
if (res[i]["keypoints"]) {
const poses = match(res[i]["keypoints"]);
for (const pose of poses)
gestures.push({ hand: i, gesture: pose.name });
}
}
return gestures;
};
// src/util/interpolate.ts
var bufferedResult = { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0, error: null };
var interpolateTime = 0;
function calc2(newResult, config3) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
const t0 = now();
if (!newResult)
return { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0, error: null };
const elapsed = Date.now() - newResult.timestamp;
const bufferedFactor = elapsed < 1e3 ? 8 - Math.log(elapsed + 1) : 1;
if (newResult.canvas)
bufferedResult.canvas = newResult.canvas;
if (newResult.error)
bufferedResult.error = newResult.error;
if (!bufferedResult.body || newResult.body.length !== bufferedResult.body.length) {
bufferedResult.body = JSON.parse(JSON.stringify(newResult.body));
} else {
for (let i = 0; i < newResult.body.length; i++) {
const box4 = newResult.body[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.body[i].box[j] + b) / bufferedFactor);
const boxRaw = newResult.body[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.body[i].boxRaw[j] + b) / bufferedFactor);
const keypoints = newResult.body[i].keypoints.map((keypoint, j) => ({
score: keypoint.score,
part: keypoint.part,
position: [
bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].position[0] + keypoint.position[0]) / bufferedFactor : keypoint.position[0],
bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].position[1] + keypoint.position[1]) / bufferedFactor : keypoint.position[1],
bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * (bufferedResult.body[i].keypoints[j].position[2] || 0) + (keypoint.position[2] || 0)) / bufferedFactor : keypoint.position[2]
],
positionRaw: [
bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].positionRaw[0] + keypoint.positionRaw[0]) / bufferedFactor : keypoint.position[0],
bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].positionRaw[1] + keypoint.positionRaw[1]) / bufferedFactor : keypoint.position[1],
bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * (bufferedResult.body[i].keypoints[j].positionRaw[2] || 0) + (keypoint.positionRaw[2] || 0)) / bufferedFactor : keypoint.position[1]
]
}));
const annotations2 = {};
let coords8 = { connected: {} };
if ((_b = (_a = config3.body) == null ? void 0 : _a.modelPath) == null ? void 0 : _b.includes("efficientpose"))
coords8 = efficientposecoords_exports;
else if ((_d = (_c = config3.body) == null ? void 0 : _c.modelPath) == null ? void 0 : _d.includes("blazepose"))
coords8 = blazeposecoords_exports;
else if ((_f = (_e = config3.body) == null ? void 0 : _e.modelPath) == null ? void 0 : _f.includes("movenet"))
coords8 = movenetcoords_exports;
for (const [name, indexes] of Object.entries(coords8.connected)) {
const pt = [];
for (let j = 0; j < indexes.length - 1; j++) {
const pt0 = keypoints.find((kp) => kp.part === indexes[j]);
const pt1 = keypoints.find((kp) => kp.part === indexes[j + 1]);
if (pt0 && pt1 && pt0.score > (config3.body.minConfidence || 0) && pt1.score > (config3.body.minConfidence || 0))
pt.push([pt0.position, pt1.position]);
}
annotations2[name] = pt;
}
bufferedResult.body[i] = { ...newResult.body[i], box: box4, boxRaw, keypoints, annotations: annotations2 };
}
}
if (!bufferedResult.hand || newResult.hand.length !== bufferedResult.hand.length) {
bufferedResult.hand = JSON.parse(JSON.stringify(newResult.hand));
} else {
for (let i = 0; i < newResult.hand.length; i++) {
const box4 = newResult.hand[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor);
const boxRaw = newResult.hand[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor);
if (bufferedResult.hand[i].keypoints.length !== newResult.hand[i].keypoints.length)
bufferedResult.hand[i].keypoints = newResult.hand[i].keypoints;
const keypoints = newResult.hand[i].keypoints && newResult.hand[i].keypoints.length > 0 ? newResult.hand[i].keypoints.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * (bufferedResult.hand[i].keypoints[j][k] || 1) + (coord || 0)) / bufferedFactor)) : [];
let annotations2 = {};
if (Object.keys(bufferedResult.hand[i].annotations).length !== Object.keys(newResult.hand[i].annotations).length) {
bufferedResult.hand[i].annotations = newResult.hand[i].annotations;
annotations2 = bufferedResult.hand[i].annotations;
} else if (newResult.hand[i].annotations) {
for (const key of Object.keys(newResult.hand[i].annotations)) {
annotations2[key] = newResult.hand[i].annotations[key] && newResult.hand[i].annotations[key][0] ? newResult.hand[i].annotations[key].map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor)) : null;
}
}
bufferedResult.hand[i] = { ...newResult.hand[i], box: box4, boxRaw, keypoints, annotations: annotations2 };
}
}
if (!bufferedResult.face || newResult.face.length !== bufferedResult.face.length) {
bufferedResult.face = JSON.parse(JSON.stringify(newResult.face));
} else {
for (let i = 0; i < newResult.face.length; i++) {
const box4 = newResult.face[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.face[i].box[j] + b) / bufferedFactor);
const boxRaw = newResult.face[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.face[i].boxRaw[j] + b) / bufferedFactor);
if (newResult.face[i].rotation) {
const rotation = { matrix: [0, 0, 0, 0, 0, 0, 0, 0, 0], angle: { roll: 0, yaw: 0, pitch: 0 }, gaze: { bearing: 0, strength: 0 } };
rotation.matrix = (_g = newResult.face[i].rotation) == null ? void 0 : _g.matrix;
rotation.angle = {
roll: ((bufferedFactor - 1) * (((_i = (_h = bufferedResult.face[i].rotation) == null ? void 0 : _h.angle) == null ? void 0 : _i.roll) || 0) + (((_k = (_j = newResult.face[i].rotation) == null ? void 0 : _j.angle) == null ? void 0 : _k.roll) || 0)) / bufferedFactor,
yaw: ((bufferedFactor - 1) * (((_m = (_l = bufferedResult.face[i].rotation) == null ? void 0 : _l.angle) == null ? void 0 : _m.yaw) || 0) + (((_o = (_n = newResult.face[i].rotation) == null ? void 0 : _n.angle) == null ? void 0 : _o.yaw) || 0)) / bufferedFactor,
pitch: ((bufferedFactor - 1) * (((_q = (_p = bufferedResult.face[i].rotation) == null ? void 0 : _p.angle) == null ? void 0 : _q.pitch) || 0) + (((_s = (_r = newResult.face[i].rotation) == null ? void 0 : _r.angle) == null ? void 0 : _s.pitch) || 0)) / bufferedFactor
};
rotation.gaze = {
bearing: ((bufferedFactor - 1) * (((_u = (_t = bufferedResult.face[i].rotation) == null ? void 0 : _t.gaze) == null ? void 0 : _u.bearing) || 0) + (((_w = (_v = newResult.face[i].rotation) == null ? void 0 : _v.gaze) == null ? void 0 : _w.bearing) || 0)) / bufferedFactor,
strength: ((bufferedFactor - 1) * (((_y = (_x = bufferedResult.face[i].rotation) == null ? void 0 : _x.gaze) == null ? void 0 : _y.strength) || 0) + (((_A = (_z = newResult.face[i].rotation) == null ? void 0 : _z.gaze) == null ? void 0 : _A.strength) || 0)) / bufferedFactor
};
bufferedResult.face[i] = { ...newResult.face[i], rotation, box: box4, boxRaw };
}
bufferedResult.face[i] = { ...newResult.face[i], box: box4, boxRaw };
}
}
if (!bufferedResult.object || newResult.object.length !== bufferedResult.object.length) {
bufferedResult.object = JSON.parse(JSON.stringify(newResult.object));
} else {
for (let i = 0; i < newResult.object.length; i++) {
const box4 = newResult.object[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].box[j] + b) / bufferedFactor);
const boxRaw = newResult.object[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].boxRaw[j] + b) / bufferedFactor);
bufferedResult.object[i] = { ...newResult.object[i], box: box4, boxRaw };
}
}
if (newResult.persons) {
const newPersons = newResult.persons;
if (!bufferedResult.persons || newPersons.length !== bufferedResult.persons.length) {
bufferedResult.persons = JSON.parse(JSON.stringify(newPersons));
} else {
for (let i = 0; i < newPersons.length; i++) {
bufferedResult.persons[i].box = newPersons[i].box.map((box4, j) => ((bufferedFactor - 1) * bufferedResult.persons[i].box[j] + box4) / bufferedFactor);
}
}
}
if (newResult.gesture)
bufferedResult.gesture = newResult.gesture;
const t1 = now();
interpolateTime = env.perfadd ? interpolateTime + Math.round(t1 - t0) : Math.round(t1 - t0);
if (newResult.performance)
bufferedResult.performance = { ...newResult.performance, interpolate: interpolateTime };
return bufferedResult;
}
// src/face/match.ts
function distance(descriptor1, descriptor2, options3 = { order: 2, multiplier: 25 }) {
let sum3 = 0;
for (let i = 0; i < descriptor1.length; i++) {
const diff = !options3.order || options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
sum3 += !options3.order || options3.order === 2 ? diff * diff : diff ** options3.order;
}
return (options3.multiplier || 20) * sum3;
}
var normalizeDistance = (dist, order, min2, max4) => {
if (dist === 0)
return 1;
const root = order === 2 ? Math.sqrt(dist) : dist ** (1 / order);
const norm = (1 - root / 100 - min2) / (max4 - min2);
const clamp2 = Math.max(Math.min(norm, 1), 0);
return clamp2;
};
function similarity(descriptor1, descriptor2, options3 = { order: 2, multiplier: 25, min: 0.2, max: 0.8 }) {
const dist = distance(descriptor1, descriptor2, options3);
return normalizeDistance(dist, options3.order || 2, options3.min || 0, options3.max || 1);
}
function match2(descriptor, descriptors, options3 = { order: 2, multiplier: 25, threshold: 0, min: 0.2, max: 0.8 }) {
if (!Array.isArray(descriptor) || !Array.isArray(descriptors) || descriptor.length < 64 || descriptors.length === 0 || descriptor.length !== descriptors[0].length) {
return { index: -1, distance: Number.POSITIVE_INFINITY, similarity: 0 };
}
let lowestDistance = Number.MAX_SAFE_INTEGER;
let index2 = -1;
for (let i = 0; i < descriptors.length; i++) {
const res = distance(descriptor, descriptors[i], options3);
if (res < lowestDistance) {
lowestDistance = res;
index2 = i;
}
if (lowestDistance < (options3.threshold || 0))
break;
}
const normalizedSimilarity = normalizeDistance(lowestDistance, options3.order || 2, options3.min || 0, options3.max || 1);
return { index: index2, distance: lowestDistance, similarity: normalizedSimilarity };
}
// src/util/persons.ts
function join2(faces, bodies, hands, gestures, shape) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
let id = 0;
const persons2 = [];
for (const face5 of faces) {
const person2 = { id: id++, face: face5, body: null, hands: { left: null, right: null }, gestures: [], box: [0, 0, 0, 0] };
for (const body4 of bodies) {
if (face5.box[0] > body4.box[0] && face5.box[0] < body4.box[0] + body4.box[2] && face5.box[1] + face5.box[3] > body4.box[1] && face5.box[1] + face5.box[3] < body4.box[1] + body4.box[3]) {
person2.body = body4;
}
}
if (person2.body) {
for (const hand3 of hands) {
if (hand3.box[0] + hand3.box[2] > person2.body.box[0] && hand3.box[0] + hand3.box[2] < person2.body.box[0] + person2.body.box[2] && hand3.box[1] + hand3.box[3] > person2.body.box[1] && hand3.box[1] + hand3.box[3] < person2.body.box[1] + person2.body.box[3]) {
if (person2.hands)
person2.hands.left = hand3;
}
if (hand3.box[0] < person2.body.box[0] + person2.body.box[2] && hand3.box[0] > person2.body.box[0] && hand3.box[1] + hand3.box[3] > person2.body.box[1] && hand3.box[1] + hand3.box[3] < person2.body.box[1] + person2.body.box[3]) {
if (person2.hands)
person2.hands.right = hand3;
}
}
}
for (const gesture3 of gestures) {
if (gesture3["face"] !== void 0 && gesture3["face"] === face5.id)
(_a = person2.gestures) == null ? void 0 : _a.push(gesture3);
else if (gesture3["iris"] !== void 0 && gesture3["iris"] === face5.id)
(_b = person2.gestures) == null ? void 0 : _b.push(gesture3);
else if (gesture3["body"] !== void 0 && gesture3["body"] === ((_c = person2.body) == null ? void 0 : _c.id))
(_d = person2.gestures) == null ? void 0 : _d.push(gesture3);
else if (gesture3["hand"] !== void 0 && gesture3["hand"] === ((_f = (_e = person2.hands) == null ? void 0 : _e.left) == null ? void 0 : _f.id))
(_g = person2.gestures) == null ? void 0 : _g.push(gesture3);
else if (gesture3["hand"] !== void 0 && gesture3["hand"] === ((_i = (_h = person2.hands) == null ? void 0 : _h.right) == null ? void 0 : _i.id))
(_j = person2.gestures) == null ? void 0 : _j.push(gesture3);
}
const x = [];
const y = [];
const extractXY = (box4) => {
if (box4 && box4.length === 4) {
x.push(box4[0], box4[0] + box4[2]);
y.push(box4[1], box4[1] + box4[3]);
}
};
extractXY((_k = person2.face) == null ? void 0 : _k.box);
extractXY((_l = person2.body) == null ? void 0 : _l.box);
extractXY((_n = (_m = person2.hands) == null ? void 0 : _m.left) == null ? void 0 : _n.box);
extractXY((_p = (_o = person2.hands) == null ? void 0 : _o.right) == null ? void 0 : _p.box);
const minX = Math.min(...x);
const minY = Math.min(...y);
person2.box = [minX, minY, Math.max(...x) - minX, Math.max(...y) - minY];
if (shape && shape[1] && shape[2])
person2.boxRaw = [person2.box[0] / shape[2], person2.box[1] / shape[1], person2.box[2] / shape[2], person2.box[3] / shape[1]];
persons2.push(person2);
}
return persons2;
}
// src/sample.ts
var face3 = `
/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA
AAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu
bmV0IDQuMi4xMwAA/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxob
IxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgo
KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgBAAEAAwEhAAIRAQMRAf/E
AB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAE
EQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZH
SElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1
tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEB
AQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXET
IjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFla
Y2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqK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besz3tPrMuhGO
IjpDOKrK9YVpsyiGUQnYGOyUgI2SlAIEmwMWMs9kTAMJYzDOYRMArmGErZhhMArlHmzmGMwDE3Ts
bAbs4swj5pgFkSziVcM4BZEsolXDKAZwyhjCYBkACQhIAAAAAAAJAAAAAAAAAAAAAAAAAAAShIAA
AAAAAAJAAAAAAAAAAAAAABAJEAAAAAAAAAAAAAAAIEoBKAAAAAAAAAAAAAAABAlAAAAAAAIAAAAA
BAkBAkBAkBAlACEgMZjdjbFW8bWrEx8YWANb6Fp+bfwab+vLDKMFK9qxH5L0bAr8OPRPKz2AY7J2
SbAjYZAI2E7AIEgIEgIEgMdkSy2NgY7MdlmyNoBXsxmFuyNgVTVjNV3KjlBRNTlXTVHKCrlIqt5T
lBhEMohlFerLlBjEMohMVTEARDKCITsAk2AEgAAAkAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAD/
2Q==`;
// src/warmup.ts
async function warmupBitmap(instance) {
const b64toBlob = (base64, type = "application/octet-stream") => fetch(`data:${type};base64,${base64}`).then((res2) => res2.blob());
let blob;
let res;
switch (instance.config.warmup) {
case "face":
blob = await b64toBlob(face3);
break;
case "body":
case "full":
blob = await b64toBlob(body3);
break;
default:
blob = null;
}
if (blob) {
const bitmap = await createImageBitmap(blob);
res = await instance.detect(bitmap, instance.config);
bitmap.close();
}
return res;
}
async function warmupCanvas(instance) {
return new Promise((resolve) => {
let src;
switch (instance.config.warmup) {
case "face":
src = "data:image/jpeg;base64," + face3;
break;
case "full":
case "body":
src = "data:image/jpeg;base64," + body3;
break;
default:
src = null;
}
let img;
if (typeof Image !== "undefined")
img = new Image();
else if (env.Image)
img = new env.Image();
else
return;
img.onload = async () => {
const canvas3 = canvas(img.naturalWidth, img.naturalHeight);
if (!canvas3) {
log("Warmup: Canvas not found");
resolve({});
} else {
const ctx = canvas3.getContext("2d");
if (ctx)
ctx.drawImage(img, 0, 0);
const tensor3 = await instance.image(canvas3);
const res = await instance.detect(tensor3.tensor, instance.config);
resolve(res);
}
};
if (src)
img.src = src;
else
resolve(null);
});
}
async function warmupNode(instance) {
const atob = (str) => Buffer.from(str, "base64");
let img;
if (instance.config.warmup === "face")
img = atob(face3);
if (instance.config.warmup === "body" || instance.config.warmup === "full")
img = atob(body3);
if (!img)
return null;
let res;
if (typeof tfjs_esm_exports["node"] !== "undefined") {
const data = tfjs_esm_exports["node"].decodeJpeg(img);
const expanded = data.expandDims(0);
instance.tf.dispose(data);
res = await instance.detect(expanded, instance.config);
instance.tf.dispose(expanded);
} else {
if (instance.config.debug)
log("Warmup tfjs-node not loaded");
}
return res;
}
async function warmup(instance, userConfig) {
const t0 = now();
instance.state = "warmup";
if (userConfig)
instance.config = mergeDeep(instance.config, userConfig);
if (!instance.config.warmup || instance.config.warmup.length === 0 || instance.config.warmup === "none") {
return { face: [], body: [], hand: [], gesture: [], object: [], performance: instance.performance, timestamp: now(), persons: [], error: null };
}
let res;
return new Promise(async (resolve) => {
if (typeof createImageBitmap === "function")
res = await warmupBitmap(instance);
else if (typeof Image !== "undefined" || env.Canvas !== void 0)
res = await warmupCanvas(instance);
else
res = await warmupNode(instance);
const t1 = now();
if (instance.config.debug)
log("Warmup", instance.config.warmup, Math.round(t1 - t0), "ms");
instance.emit("warmup");
resolve(res);
});
}
// src/human.ts
var _numTensors, _analyzeMemoryLeaks, _checkSanity, _sanity;
var Human = class {
constructor(userConfig) {
__publicField(this, "version");
__publicField(this, "config");
__publicField(this, "result");
__publicField(this, "state");
__publicField(this, "process");
__publicField(this, "tf");
__publicField(this, "env");
__publicField(this, "draw");
__publicField(this, "models");
__publicField(this, "events");
__publicField(this, "faceTriangulation");
__publicField(this, "faceUVMap");
__publicField(this, "performance");
__privateAdd(this, _numTensors, void 0);
__privateAdd(this, _analyzeMemoryLeaks, void 0);
__privateAdd(this, _checkSanity, void 0);
__publicField(this, "gl");
__publicField(this, "analyze", (...msg) => {
if (!__privateGet(this, _analyzeMemoryLeaks))
return;
const currentTensors = this.tf.engine().state.numTensors;
const previousTensors = __privateGet(this, _numTensors);
__privateSet(this, _numTensors, currentTensors);
const leaked = currentTensors - previousTensors;
if (leaked !== 0)
log(...msg, leaked);
});
__privateAdd(this, _sanity, (input) => {
if (!__privateGet(this, _checkSanity))
return null;
if (!input)
return "input is not defined";
if (this.env.node && !(input instanceof Tensor))
return "input must be a tensor";
try {
this.tf.getBackend();
} catch (e) {
return "backend not loaded";
}
return null;
});
__publicField(this, "similarity", similarity);
__publicField(this, "distance", distance);
__publicField(this, "match", match2);
__publicField(this, "emit", (event) => {
var _a;
if (this.events && this.events.dispatchEvent)
(_a = this.events) == null ? void 0 : _a.dispatchEvent(new Event(event));
});
this.env = env;
config.wasmPath = version9["tfjs-core"].includes("-") ? "https://vladmandic.github.io/tfjs/dist/" : `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tfjs_esm_exports.version_core}/dist/`;
config.modelBasePath = env.browser ? "../models/" : "file://models/";
config.backend = env.browser ? "humangl" : "tensorflow";
this.version = version10;
Object.defineProperty(this, "version", { value: version10 });
this.config = JSON.parse(JSON.stringify(config));
Object.seal(this.config);
if (userConfig)
this.config = mergeDeep(this.config, userConfig);
this.tf = tfjs_esm_exports;
this.state = "idle";
__privateSet(this, _numTensors, 0);
__privateSet(this, _analyzeMemoryLeaks, false);
__privateSet(this, _checkSanity, false);
this.performance = {};
this.events = typeof EventTarget !== "undefined" ? new EventTarget() : void 0;
this.models = new Models();
this.draw = {
options: options2,
canvas: (input, output) => canvas2(input, output),
face: (output, result, options3) => face(output, result, options3),
body: (output, result, options3) => body(output, result, options3),
hand: (output, result, options3) => hand(output, result, options3),
gesture: (output, result, options3) => gesture(output, result, options3),
object: (output, result, options3) => object(output, result, options3),
person: (output, result, options3) => person(output, result, options3),
all: (output, result, options3) => all(output, result, options3)
};
this.result = { face: [], body: [], hand: [], gesture: [], object: [], performance: {}, timestamp: 0, persons: [], error: null };
this.process = { tensor: null, canvas: null };
this.faceTriangulation = triangulation;
this.faceUVMap = uvmap;
this.gl = config2;
this.emit("create");
}
reset() {
const currentBackend = this.config.backend;
this.config = JSON.parse(JSON.stringify(config));
this.config.backend = currentBackend;
}
validate(userConfig) {
return validate(config, userConfig || this.config);
}
now() {
return now();
}
image(input, getTensor = true) {
return process2(input, this.config, getTensor);
}
async segmentation(input, background) {
return process5(input, background, this.config);
}
enhance(input) {
return enhance2(input);
}
compare(firstImageTensor, secondImageTensor) {
return compare(this.config, firstImageTensor, secondImageTensor);
}
async init() {
await check(this, true);
await this.tf.ready();
}
async load(userConfig) {
this.state = "load";
const timeStamp = now();
const count2 = Object.values(this.models).filter((model18) => model18).length;
if (userConfig)
this.config = mergeDeep(this.config, userConfig);
if (this.env.initial) {
if (this.config.debug)
log(`version: ${this.version}`);
if (this.config.debug)
log(`tfjs version: ${this.tf.version["tfjs-core"]}`);
if (!await check(this))
log("error: backend check failed");
await tfjs_esm_exports.ready();
if (this.env.browser) {
if (this.config.debug)
log("configuration:", this.config);
if (this.config.debug)
log("environment:", this.env);
if (this.config.debug)
log("tf flags:", this.tf.ENV["flags"]);
}
}
await load19(this);
if (this.env.initial && this.config.debug)
log("tf engine state:", this.tf.engine().state.numBytes, "bytes", this.tf.engine().state.numTensors, "tensors");
this.env.initial = false;
const loaded = Object.values(this.models).filter((model18) => model18).length;
if (loaded !== count2) {
await validate2(this);
this.emit("load");
}
const current = Math.trunc(now() - timeStamp);
if (current > (this.performance.loadModels || 0))
this.performance.loadModels = this.env.perfadd ? (this.performance.loadModels || 0) + current : current;
}
next(result = this.result) {
return calc2(result, this.config);
}
async warmup(userConfig) {
const t0 = now();
const res = await warmup(this, userConfig);
const t1 = now();
this.performance.warmup = Math.trunc(t1 - t0);
return res;
}
async profile(input, userConfig) {
const profile = await this.tf.profile(() => this.detect(input, userConfig));
const kernels = {};
for (const kernel of profile.kernels) {
if (kernels[kernel.name])
kernels[kernel.name] += kernel.kernelTimeMs;
else
kernels[kernel.name] = kernel.kernelTimeMs;
}
const kernelArr = [];
Object.entries(kernels).forEach((key) => kernelArr.push({ name: key[0], ms: key[1] }));
kernelArr.sort((a, b) => b.ms - a.ms);
kernelArr.length = 20;
const res = {};
for (const kernel of kernelArr)
res[kernel.name] = kernel.ms;
return res;
}
async detect(input, userConfig) {
this.state = "detect";
return new Promise(async (resolve) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
this.state = "config";
let timeStamp;
this.config = mergeDeep(this.config, userConfig);
this.state = "check";
const error = __privateGet(this, _sanity).call(this, input);
if (error) {
log(error, input);
this.emit("error");
resolve({ face: [], body: [], hand: [], gesture: [], object: [], performance: this.performance, timestamp: now(), persons: [], error });
}
const timeStart = now();
await check(this);
await this.load();
timeStamp = now();
this.state = "image";
const img = await process2(input, this.config);
this.process = img;
this.performance.inputProcess = this.env.perfadd ? (this.performance.inputProcess || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
this.analyze("Get Image:");
if (!img.tensor) {
if (this.config.debug)
log("could not convert input to tensor");
this.emit("error");
resolve({ face: [], body: [], hand: [], gesture: [], object: [], performance: this.performance, timestamp: now(), persons: [], error: "could not convert input to tensor" });
return;
}
this.emit("image");
timeStamp = now();
this.config.skipAllowed = await skip(this.config, img.tensor);
if (!this.performance.totalFrames)
this.performance.totalFrames = 0;
if (!this.performance.cachedFrames)
this.performance.cachedFrames = 0;
this.performance.totalFrames++;
if (this.config.skipAllowed)
this.performance.cachedFrames++;
this.performance.cacheCheck = this.env.perfadd ? (this.performance.cacheCheck || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
this.analyze("Check Changed:");
let faceRes = [];
let bodyRes = [];
let handRes = [];
let objectRes = [];
this.state = "detect:face";
if (this.config.async) {
faceRes = this.config.face.enabled ? detectFace(this, img.tensor) : [];
if (this.performance.face)
delete this.performance.face;
} else {
timeStamp = now();
faceRes = this.config.face.enabled ? await detectFace(this, img.tensor) : [];
this.performance.face = this.env.perfadd ? (this.performance.face || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
}
if (this.config.async && (this.config.body.maxDetected === -1 || this.config.hand.maxDetected === -1))
faceRes = await faceRes;
this.analyze("Start Body:");
this.state = "detect:body";
const bodyConfig = this.config.body.maxDetected === -1 ? mergeDeep(this.config, { body: { maxDetected: this.config.face.enabled ? 1 * faceRes.length : 1 } }) : this.config;
if (this.config.async) {
if ((_a = this.config.body.modelPath) == null ? void 0 : _a.includes("posenet"))
bodyRes = this.config.body.enabled ? predict17(img.tensor, bodyConfig) : [];
else if ((_b = this.config.body.modelPath) == null ? void 0 : _b.includes("blazepose"))
bodyRes = this.config.body.enabled ? predict5(img.tensor, bodyConfig) : [];
else if ((_c = this.config.body.modelPath) == null ? void 0 : _c.includes("efficientpose"))
bodyRes = this.config.body.enabled ? predict7(img.tensor, bodyConfig) : [];
else if ((_d = this.config.body.modelPath) == null ? void 0 : _d.includes("movenet"))
bodyRes = this.config.body.enabled ? predict15(img.tensor, bodyConfig) : [];
if (this.performance.body)
delete this.performance.body;
} else {
timeStamp = now();
if ((_e = this.config.body.modelPath) == null ? void 0 : _e.includes("posenet"))
bodyRes = this.config.body.enabled ? await predict17(img.tensor, bodyConfig) : [];
else if ((_f = this.config.body.modelPath) == null ? void 0 : _f.includes("blazepose"))
bodyRes = this.config.body.enabled ? await predict5(img.tensor, bodyConfig) : [];
else if ((_g = this.config.body.modelPath) == null ? void 0 : _g.includes("efficientpose"))
bodyRes = this.config.body.enabled ? await predict7(img.tensor, bodyConfig) : [];
else if ((_h = this.config.body.modelPath) == null ? void 0 : _h.includes("movenet"))
bodyRes = this.config.body.enabled ? await predict15(img.tensor, bodyConfig) : [];
this.performance.body = this.env.perfadd ? (this.performance.body || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
}
this.analyze("End Body:");
this.analyze("Start Hand:");
this.state = "detect:hand";
const handConfig = this.config.hand.maxDetected === -1 ? mergeDeep(this.config, { hand: { maxDetected: this.config.face.enabled ? 2 * faceRes.length : 1 } }) : this.config;
if (this.config.async) {
if ((_j = (_i = this.config.hand.detector) == null ? void 0 : _i.modelPath) == null ? void 0 : _j.includes("handdetect"))
handRes = this.config.hand.enabled ? predict12(img.tensor, handConfig) : [];
else if ((_l = (_k = this.config.hand.detector) == null ? void 0 : _k.modelPath) == null ? void 0 : _l.includes("handtrack"))
handRes = this.config.hand.enabled ? predict13(img.tensor, handConfig) : [];
if (this.performance.hand)
delete this.performance.hand;
} else {
timeStamp = now();
if ((_n = (_m = this.config.hand.detector) == null ? void 0 : _m.modelPath) == null ? void 0 : _n.includes("handdetect"))
handRes = this.config.hand.enabled ? await predict12(img.tensor, handConfig) : [];
else if ((_p = (_o = this.config.hand.detector) == null ? void 0 : _o.modelPath) == null ? void 0 : _p.includes("handtrack"))
handRes = this.config.hand.enabled ? await predict13(img.tensor, handConfig) : [];
this.performance.hand = this.env.perfadd ? (this.performance.hand || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
}
this.analyze("End Hand:");
this.analyze("Start Object:");
this.state = "detect:object";
if (this.config.async) {
if ((_q = this.config.object.modelPath) == null ? void 0 : _q.includes("nanodet"))
objectRes = this.config.object.enabled ? predict16(img.tensor, this.config) : [];
else if ((_r = this.config.object.modelPath) == null ? void 0 : _r.includes("centernet"))
objectRes = this.config.object.enabled ? predict6(img.tensor, this.config) : [];
if (this.performance.object)
delete this.performance.object;
} else {
timeStamp = now();
if ((_s = this.config.object.modelPath) == null ? void 0 : _s.includes("nanodet"))
objectRes = this.config.object.enabled ? await predict16(img.tensor, this.config) : [];
else if ((_t = this.config.object.modelPath) == null ? void 0 : _t.includes("centernet"))
objectRes = this.config.object.enabled ? await predict6(img.tensor, this.config) : [];
this.performance.object = this.env.perfadd ? (this.performance.object || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
}
this.analyze("End Object:");
this.state = "detect:await";
if (this.config.async)
[faceRes, bodyRes, handRes, objectRes] = await Promise.all([faceRes, bodyRes, handRes, objectRes]);
this.state = "detect:gesture";
let gestureRes = [];
if (this.config.gesture.enabled) {
timeStamp = now();
gestureRes = [...face2(faceRes), ...body2(bodyRes), ...hand2(handRes), ...iris3(faceRes)];
if (!this.config.async)
this.performance.gesture = this.env.perfadd ? (this.performance.gesture || 0) + Math.trunc(now() - timeStamp) : Math.trunc(now() - timeStamp);
else if (this.performance.gesture)
delete this.performance.gesture;
}
this.performance.total = this.env.perfadd ? (this.performance.total || 0) + Math.trunc(now() - timeStart) : Math.trunc(now() - timeStart);
const shape = ((_v = (_u = this.process) == null ? void 0 : _u.tensor) == null ? void 0 : _v.shape) || [];
this.result = {
face: faceRes,
body: bodyRes,
hand: handRes,
gesture: gestureRes,
object: objectRes,
performance: this.performance,
canvas: this.process.canvas,
timestamp: Date.now(),
error: null,
get persons() {
return join2(faceRes, bodyRes, handRes, gestureRes, shape);
}
};
tfjs_esm_exports.dispose(img.tensor);
this.emit("detect");
this.state = "idle";
resolve(this.result);
});
}
};
_numTensors = new WeakMap();
_analyzeMemoryLeaks = new WeakMap();
_checkSanity = new WeakMap();
_sanity = new WeakMap();
export {
Human,
Human as default,
config as defaults,
env
};
/**
* Human main module
* @default Human Library
* @summary <https://github.com/vladmandic/human>
* @author <https://github.com/vladmandic>
* @copyright <https://github.com/vladmandic>
* @license MIT
*/
//# sourceMappingURL=human.esm-nobundle.js.map