bry-biometric-collector
Version:
BRy web-collector component for biometric capture.
1,705 lines • 251 kB
JavaScript
import { bA as us, bB as hs } from "./main_8f1a8854_3.3.6.js";
function fs(e, t) {
for (var n = 0; n < t.length; n++) {
const s = t[n];
if (typeof s != "string" && !Array.isArray(s)) {
for (const r in s)
if (r !== "default" && !(r in e)) {
const o = Object.getOwnPropertyDescriptor(s, r);
o && Object.defineProperty(e, r, o.get ? o : {
enumerable: !0,
get: () => s[r]
});
}
}
}
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const ds = 1e-7, gs = 1e-4;
class Ia {
constructor(t, n) {
this.backend = t, this.dataMover = n, this.data = /* @__PURE__ */ new WeakMap(), this.dataIdsCount = 0;
}
get(t) {
return this.data.has(t) || this.dataMover.moveData(this.backend, t), this.data.get(t);
}
set(t, n) {
this.dataIdsCount++, this.data.set(t, n);
}
has(t) {
return this.data.has(t);
}
delete(t) {
return this.dataIdsCount--, this.data.delete(t);
}
numDataIds() {
return this.dataIdsCount;
}
}
class ms {
refCount(t) {
return U("refCount");
}
incRef(t) {
return U("incRef");
}
timerAvailable() {
return !0;
}
time(t) {
return U("time");
}
read(t) {
return U("read");
}
readSync(t) {
return U("readSync");
}
readToGPU(t, n) {
return U("readToGPU");
}
numDataIds() {
return U("numDataIds");
}
disposeData(t, n) {
return U("disposeData");
}
write(t, n, s) {
return U("write");
}
move(t, n, s, r, o) {
return U("move");
}
createTensorFromGPUData(t, n, s) {
return U("createTensorFromGPUData");
}
memory() {
return U("memory");
}
/** Returns the highest precision for floats in bits (e.g. 16 or 32) */
floatPrecision() {
return U("floatPrecision");
}
/** Returns the smallest representable number. */
epsilon() {
return this.floatPrecision() === 32 ? ds : gs;
}
dispose() {
return U("dispose");
}
}
function U(e) {
throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`);
}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function ka(e) {
let t = e.length, n = 0;
for (; t > 0; )
n = Math.random() * t | 0, t--, ps(e, t, n);
}
function Vt(e, t, n) {
return Math.max(e, Math.min(t, n));
}
function Aa(e) {
return e % 2 === 0 ? e : e + 1;
}
function ps(e, t, n) {
const s = e[t];
e[t] = e[n], e[n] = s;
}
function Ta(e) {
let t = 0;
for (let n = 0; n < e.length; n++)
t += e[n];
return t;
}
function E(e, t) {
if (!e)
throw new Error(typeof t == "string" ? t : t());
}
function $a(e, t, n = "") {
E(Me(e, t), () => n + ` Shapes ${e} and ${t} must match`);
}
function Fa(e) {
E(e != null, () => "The input to the tensor constructor must be a non-null value.");
}
function _(e) {
if (e.length === 0)
return 1;
let t = e[0];
for (let n = 1; n < e.length; n++)
t *= e[n];
return t;
}
function Me(e, t) {
if (e === t)
return !0;
if (e == null || t == null || e.length !== t.length)
return !1;
for (let n = 0; n < e.length; n++)
if (e[n] !== t[n])
return !1;
return !0;
}
function ce(e) {
return e % 1 === 0;
}
function Ma(e) {
const t = Math.ceil(Math.sqrt(e));
return [t, Math.ceil(e / t)];
}
function zt(e, t) {
return t <= e.length ? e : e + " ".repeat(t - e.length);
}
function va(e, t = (r) => 0, n, s) {
return new Promise((r, o) => {
let i = 0;
const a = () => {
if (e()) {
r();
return;
}
i++;
const c = t(i);
if (n != null && i >= n) {
o();
return;
}
s != null ? s(a, c) : setTimeout(a, c);
};
a();
});
}
function xa(e, t) {
let n = 1, s = -1;
for (let o = 0; o < e.length; ++o)
if (e[o] >= 0)
n *= e[o];
else if (e[o] === -1) {
if (s !== -1)
throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${s} and dim ${o}`);
s = o;
} else if (e[o] < 0)
throw Error(`Shapes can not be < 0. Found ${e[o]} at dim ${o}`);
if (s === -1) {
if (t > 0 && t !== n)
throw Error(`Size(${t}) must match the product of shape ${e}`);
return e;
}
if (n === 0)
throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);
if (t % n !== 0)
throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);
const r = e.slice();
return r[s] = t / n, r;
}
function un(e, t) {
const n = t.length;
return e = e == null ? t.map((s, r) => r) : [].concat(e), E(e.every((s) => s >= -n && s < n), () => `All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`), E(e.every((s) => ce(s)), () => `All values in axis param must be integers but got axis ${e}`), e.map((s) => s < 0 ? n + s : s);
}
function Na(e, t) {
const n = [], s = [], r = t != null && Array.isArray(t) && t.length === 0, o = t == null || r ? null : un(t, e).sort();
let i = 0;
for (let a = 0; a < e.length; ++a) {
if (o != null) {
if (o[i] === a && e[a] !== 1)
throw new Error(`Can't squeeze axis ${a} since its dim '${e[a]}' is not 1`);
(o[i] == null || o[i] > a) && e[a] === 1 && (n.push(e[a]), s.push(a)), o[i] <= a && i++;
}
e[a] !== 1 && (n.push(e[a]), s.push(a));
}
return { newShape: n, keptDims: s };
}
function Ra(e, t) {
return Rt(e, t);
}
function Rt(e, t) {
let n = null;
if (e == null || e === "float32")
n = new Float32Array(t);
else if (e === "int32")
n = new Int32Array(t);
else if (e === "bool")
n = new Uint8Array(t);
else if (e === "string")
n = new Array(t);
else
throw new Error(`Unknown data type ${e}`);
return n;
}
function ys(e, t) {
for (let n = 0; n < e.length; n++) {
const s = e[n];
if (isNaN(s) || !isFinite(s))
throw Error(`A tensor of type ${t} being uploaded contains ${s}.`);
}
}
function bs(e) {
return e === "bool" || e === "complex64" || e === "float32" || e === "int32" || e === "string";
}
function Ba(e, t) {
return !(t === "complex64" || t === "float32" && e !== "complex64" || t === "int32" && e !== "float32" && e !== "complex64" || t === "bool" && e === "bool");
}
function le(e) {
if (e === "float32" || e === "int32")
return 4;
if (e === "complex64")
return 8;
if (e === "bool")
return 1;
throw new Error(`Unknown dtype ${e}`);
}
function ws(e) {
if (e == null)
return 0;
let t = 0;
return e.forEach((n) => t += n.length), t;
}
function ve(e) {
return typeof e == "string" || e instanceof String;
}
function Ss(e) {
return typeof e == "boolean";
}
function Es(e) {
return typeof e == "number";
}
function Yt(e) {
return Array.isArray(e) ? Yt(e[0]) : e instanceof Float32Array ? "float32" : e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray ? "int32" : Es(e) ? "float32" : ve(e) ? "string" : Ss(e) ? "bool" : "float32";
}
function ue(e) {
return !!(e && e.constructor && e.call && e.apply);
}
function he(e, t) {
for (let n = t; n < e; ++n)
if (e % n === 0)
return n;
return e;
}
function Bt(e) {
const t = e.length;
if (t < 2)
return [];
const n = new Array(t - 1);
n[t - 2] = e[t - 1];
for (let s = t - 3; s >= 0; --s)
n[s] = n[s + 1] * e[s + 1];
return n;
}
function hn(e, t, n, s = !1) {
const r = new Array();
if (t.length === 1) {
const o = t[0] * (s ? 2 : 1);
for (let i = 0; i < o; i++)
r[i] = n[e + i];
} else {
const o = t[0], i = t.slice(1), a = i.reduce((c, l) => c * l) * (s ? 2 : 1);
for (let c = 0; c < o; c++)
r[c] = hn(e + c * a, i, n, s);
}
return r;
}
function Ct(e, t, n = !1) {
if (e.length === 0)
return t[0];
const s = e.reduce((r, o) => r * o) * (n ? 2 : 1);
if (s === 0)
return [];
if (s !== t.length)
throw new Error(`[${e}] does not match the input size ${t.length}${n ? " for a complex tensor" : ""}.`);
return hn(0, e, t, n);
}
function Da(e, t) {
if (Array.isArray(e))
return e;
if (t === "float32")
return e instanceof Float32Array ? e : new Float32Array(e);
if (t === "int32")
return e instanceof Int32Array ? e : new Int32Array(e);
if (t === "bool" || t === "string")
return Uint8Array.from(new Int32Array(e));
throw new Error(`Unknown dtype ${t}`);
}
function Is(e, t) {
const n = jt(e, t);
for (let s = 0; s < n.length; s++)
n[s] = 1;
return n;
}
function jt(e, t) {
if (t == null || t === "float32" || t === "complex64")
return new Float32Array(e);
if (t === "int32")
return new Int32Array(e);
if (t === "bool")
return new Uint8Array(e);
throw new Error(`Unknown data type ${t}`);
}
function _a(e, t) {
const n = e.reduce((s, r) => s * r, 1);
if (t == null || t === "float32")
return Ct(e, new Float32Array(n));
if (t === "int32")
return Ct(e, new Int32Array(n));
if (t === "bool")
return Ct(e, new Uint8Array(n));
throw new Error(`Unknown data type ${t}`);
}
function xe(e) {
e.forEach((t) => {
E(Number.isInteger(t) && t >= 0, () => `Tensor must have a shape comprised of positive integers but got shape [${e}].`);
});
}
function Oa(e, t, n) {
if (t === 0)
return 0;
if (t === 1)
return e[0];
let s = e[e.length - 1];
for (let r = 0; r < e.length - 1; ++r)
s += n[r] * e[r];
return s;
}
function La(e, t, n) {
if (t === 0)
return [];
if (t === 1)
return [e];
const s = new Array(t);
for (let r = 0; r < s.length - 1; ++r)
s[r] = Math.floor(e / n[r]), e -= s[r] * n[r];
return s[s.length - 1] = e, s;
}
function Ne(e) {
return e && e.then && typeof e.then == "function";
}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const We = "tfjsflags";
class ks {
// tslint:disable-next-line: no-any
constructor(t) {
this.global = t, this.flags = {}, this.flagRegistry = {}, this.urlFlags = {}, this.getQueryParams = As, this.populateURLFlags();
}
setPlatform(t, n) {
this.platform != null && (A().getBool("IS_TEST") || A().getBool("PROD") || console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${t}.`)), this.platformName = t, this.platform = n;
}
registerFlag(t, n, s) {
if (this.flagRegistry[t] = { evaluationFn: n, setHook: s }, this.urlFlags[t] != null) {
const r = this.urlFlags[t];
A().getBool("IS_TEST") || A().getBool("PROD") || console.warn(`Setting feature override from URL ${t}: ${r}.`), this.set(t, r);
}
}
async getAsync(t) {
return t in this.flags ? this.flags[t] : (this.flags[t] = await this.evaluateFlag(t), this.flags[t]);
}
get(t) {
if (t in this.flags)
return this.flags[t];
const n = this.evaluateFlag(t);
if (Ne(n))
throw new Error(`Flag ${t} cannot be synchronously evaluated. Please use getAsync() instead.`);
return this.flags[t] = n, this.flags[t];
}
getNumber(t) {
return this.get(t);
}
getBool(t) {
return this.get(t);
}
getString(t) {
return this.get(t);
}
getFlags() {
return this.flags;
}
// For backwards compatibility.
get features() {
return this.flags;
}
set(t, n) {
if (this.flagRegistry[t] == null)
throw new Error(`Cannot set flag ${t} as it has not been registered.`);
this.flags[t] = n, this.flagRegistry[t].setHook != null && this.flagRegistry[t].setHook(n);
}
evaluateFlag(t) {
if (this.flagRegistry[t] == null)
throw new Error(`Cannot evaluate flag '${t}': no evaluation function found.`);
return this.flagRegistry[t].evaluationFn();
}
setFlags(t) {
this.flags = Object.assign({}, t);
}
reset() {
this.flags = {}, this.urlFlags = {}, this.populateURLFlags();
}
populateURLFlags() {
if (typeof this.global > "u" || typeof this.global.location > "u" || typeof this.global.location.search > "u")
return;
const t = this.getQueryParams(this.global.location.search);
We in t && t[We].split(",").forEach((s) => {
const [r, o] = s.split(":");
this.urlFlags[r] = $s(r, o);
});
}
}
function As(e) {
const t = {};
return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, (n, ...s) => (Ts(t, s[0], s[1]), s.join("="))), t;
}
function Ts(e, t, n) {
e[decodeURIComponent(t)] = decodeURIComponent(n || "");
}
function $s(e, t) {
const n = t.toLowerCase();
return n === "true" || n === "false" ? n === "true" : `${+n}` === n ? +n : t;
}
function A() {
return fn;
}
let fn = null;
function Fs(e) {
fn = e;
}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
let se;
function dn() {
if (se == null) {
let e;
if (typeof window < "u")
e = window;
else if (typeof global < "u")
e = global;
else if (typeof process < "u")
e = process;
else if (typeof self < "u")
e = self;
else
throw new Error("Could not find a global object");
se = e;
}
return se;
}
function Ms() {
const e = dn();
return e._tfGlobals == null && (e._tfGlobals = /* @__PURE__ */ new Map()), e._tfGlobals;
}
function Re(e, t) {
const n = Ms();
if (n.has(e))
return n.get(e);
{
const s = t();
return n.set(e, s), n.get(e);
}
}
const vs = "Abs", Ca = "Acos", Pa = "Acosh", gn = "Add", Ua = "AddN", Ga = "All", Wa = "Any", za = "ArgMax", qa = "ArgMin", Va = "Asin", ja = "Asinh", Ha = "Atan", Ka = "Atanh", Za = "Atan2", Xa = "AvgPool", Ja = "AvgPoolGrad", Ya = "AvgPool3D", Qa = "AvgPool3DGrad", tc = "BatchMatMul", ec = "BatchToSpaceND", nc = "Bincount", sc = "BitwiseAnd", rc = "BroadcastTo", oc = "BroadcastArgs", mn = "Cast", ic = "Ceil", ac = "ClipByValue", cc = "Complex", xs = "ComplexAbs", lc = "Concat", uc = "Conv2D", hc = "Conv2DBackpropFilter", fc = "Conv2DBackpropInput", dc = "Conv3D", gc = "Conv3DBackpropFilterV2", mc = "Conv3DBackpropInputV2", pc = "Cos", yc = "Cosh", bc = "Cumprod", wc = "Cumsum", Sc = "CropAndResize", Ec = "DenseBincount", Ic = "DepthToSpace", kc = "DepthwiseConv2dNative", Ac = "DepthwiseConv2dNativeBackpropFilter", Tc = "DepthwiseConv2dNativeBackpropInput", $c = "Diag", Fc = "Dilation2D", Mc = "Dilation2DBackpropInput", vc = "Dilation2DBackpropFilter", xc = "Draw", Ns = "RealDiv", Nc = "Einsum", Rs = "Elu", Rc = "EluGrad", Bc = "Erf", Dc = "Equal", _c = "Exp", Oc = "ExpandDims", Lc = "Expm1", Cc = "FFT", Bs = "Fill", Pc = "FlipLeftRight", Uc = "Floor", Ds = "FloorDiv", Gc = "FusedBatchNorm", Wc = "GatherV2", zc = "GatherNd", qc = "Greater", Vc = "GreaterEqual", pn = "Identity", jc = "IFFT", Hc = "Imag", Kc = "IsFinite", Zc = "IsInf", Xc = "IsNan", _s = "LeakyRelu", Jc = "Less", Yc = "LessEqual", Qc = "LinSpace", tl = "Log", el = "Log1p", nl = "LogicalAnd", sl = "LogicalNot", rl = "LogicalOr", ol = "LogicalXor", il = "LogSoftmax", al = "LRN", cl = "LRNGrad", ll = "Max", Os = "Maximum", ul = "MaxPool", hl = "MaxPoolGrad", fl = "MaxPool3D", dl = "MaxPool3DGrad", gl = "MaxPoolWithArgmax", ml = "Mean", pl = "Min", yl = "Minimum", bl = "MirrorPad", wl = "Mod", Sl = "Multinomial", Ls = "Multiply", El = "Neg", Il = "NotEqual", kl = "NonMaxSuppressionV3", Al = "NonMaxSuppressionV4", Tl = "NonMaxSuppressionV5", $l = "OnesLike", Fl = "OneHot", Ml = "Pack", vl = "PadV2", Cs = "Pow", Ps = "Prelu", xl = "Prod", Nl = "RaggedGather", Rl = "RaggedRange", Bl = "RaggedTensorToTensor", Dl = "Range", _l = "Real", Ol = "Reciprocal", Us = "Relu", Gs = "Reshape", Ll = "ResizeNearestNeighbor", Cl = "ResizeNearestNeighborGrad", Pl = "ResizeBilinear", Ul = "ResizeBilinearGrad", Ws = "Relu6", Gl = "Reverse", Wl = "Round", zl = "Rsqrt", ql = "ScatterNd", Vl = "TensorScatterUpdate", jl = "SearchSorted", Hl = "Select", Kl = "Selu", zs = "Slice", Zl = "Sin", Xl = "Sinh", Jl = "Sign", qs = "Sigmoid", Yl = "Softplus", Vs = "Sqrt", js = "Sum", Ql = "SpaceToBatchND", tu = "SplitV", eu = "Softmax", nu = "SparseFillEmptyRows", su = "SparseReshape", ru = "SparseSegmentMean", ou = "SparseSegmentSum", iu = "SparseToDense", au = "SquaredDifference", cu = "Square", lu = "StaticRegexReplace", uu = "StridedSlice", hu = "StringNGrams", fu = "StringSplit", du = "StringToHashBucketFast", Hs = "Sub", gu = "Tan", mu = "Tanh", pu = "Tile", yu = "TopK", bu = "Transform", wu = "Transpose", Su = "Unique", Eu = "Unpack", Iu = "UnsortedSegmentSum", Ks = "ZerosLike", Zs = "Step", ku = "FromPixels", Au = "RotateWithOffset", Tu = "_FusedMatMul", $u = "FusedConv2D", Fu = "FusedDepthwiseConv2D";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function it(...e) {
A().getBool("IS_TEST") || A().getBool("PROD") || console.warn(...e);
}
function Xs(...e) {
A().getBool("IS_TEST") || A().getBool("PROD") || console.log(...e);
}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ht = Re("kernelRegistry", () => /* @__PURE__ */ new Map()), fe = Re("gradRegistry", () => /* @__PURE__ */ new Map());
function ze(e, t) {
const n = yn(e, t);
return Ht.get(n);
}
function qe(e) {
return fe.get(e);
}
function Ve(e) {
const t = Ht.entries(), n = [];
for (; ; ) {
const { done: s, value: r } = t.next();
if (s)
break;
const [o, i] = r, [a] = o.split("_");
a === e && n.push(i);
}
return n;
}
function Mu(e) {
const { kernelName: t, backendName: n } = e, s = yn(t, n);
Ht.has(s) && it(`The kernel '${t}' for backend '${n}' is already registered`), Ht.set(s, e);
}
function vu(e) {
const { kernelName: t } = e;
fe.has(t) && A().getBool("DEBUG") && it(`Overriding the gradient for '${t}'`), fe.set(t, e);
}
function yn(e, t) {
return `${t}_${e}`;
}
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function bn(e) {
return e instanceof Float32Array || e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray;
}
var wn = v, V = null;
try {
V = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
0,
97,
115,
109,
1,
0,
0,
0,
1,
13,
2,
96,
0,
1,
127,
96,
4,
127,
127,
127,
127,
1,
127,
3,
7,
6,
0,
1,
1,
1,
1,
1,
6,
6,
1,
127,
1,
65,
0,
11,
7,
50,
6,
3,
109,
117,
108,
0,
1,
5,
100,
105,
118,
95,
115,
0,
2,
5,
100,
105,
118,
95,
117,
0,
3,
5,
114,
101,
109,
95,
115,
0,
4,
5,
114,
101,
109,
95,
117,
0,
5,
8,
103,
101,
116,
95,
104,
105,
103,
104,
0,
0,
10,
191,
1,
6,
4,
0,
35,
0,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
126,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
127,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
128,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
129,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
130,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11
])), {}).exports;
} catch {
}
function v(e, t, n) {
this.low = e | 0, this.high = t | 0, this.unsigned = !!n;
}
v.prototype.__isLong__;
Object.defineProperty(v.prototype, "__isLong__", { value: !0 });
function W(e) {
return (e && e.__isLong__) === !0;
}
v.isLong = W;
var je = {}, He = {};
function wt(e, t) {
var n, s, r;
return t ? (e >>>= 0, (r = 0 <= e && e < 256) && (s = He[e], s) ? s : (n = x(e, (e | 0) < 0 ? -1 : 0, !0), r && (He[e] = n), n)) : (e |= 0, (r = -128 <= e && e < 128) && (s = je[e], s) ? s : (n = x(e, e < 0 ? -1 : 0, !1), r && (je[e] = n), n));
}
v.fromInt = wt;
function j(e, t) {
if (isNaN(e))
return t ? dt : H;
if (t) {
if (e < 0)
return dt;
if (e >= Sn)
return kn;
} else {
if (e <= -Ze)
return G;
if (e + 1 >= Ze)
return In;
}
return e < 0 ? j(-e, t).neg() : x(e % vt | 0, e / vt | 0, t);
}
v.fromNumber = j;
function x(e, t, n) {
return new v(e, t, n);
}
v.fromBits = x;
var Kt = Math.pow;
function Be(e, t, n) {
if (e.length === 0)
throw Error("empty string");
if (e === "NaN" || e === "Infinity" || e === "+Infinity" || e === "-Infinity")
return H;
if (typeof t == "number" ? (n = t, t = !1) : t = !!t, n = n || 10, n < 2 || 36 < n)
throw RangeError("radix");
var s;
if ((s = e.indexOf("-")) > 0)
throw Error("interior hyphen");
if (s === 0)
return Be(e.substring(1), t, n).neg();
for (var r = j(Kt(n, 8)), o = H, i = 0; i < e.length; i += 8) {
var a = Math.min(8, e.length - i), c = parseInt(e.substring(i, i + a), n);
if (a < 8) {
var l = j(Kt(n, a));
o = o.mul(l).add(j(c));
} else
o = o.mul(r), o = o.add(j(c));
}
return o.unsigned = t, o;
}
v.fromString = Be;
function Y(e, t) {
return typeof e == "number" ? j(e, t) : typeof e == "string" ? Be(e, t) : x(e.low, e.high, typeof t == "boolean" ? t : e.unsigned);
}
v.fromValue = Y;
var Ke = 65536, Js = 1 << 24, vt = Ke * Ke, Sn = vt * vt, Ze = Sn / 2, Xe = wt(Js), H = wt(0);
v.ZERO = H;
var dt = wt(0, !0);
v.UZERO = dt;
var Tt = wt(1);
v.ONE = Tt;
var En = wt(1, !0);
v.UONE = En;
var de = wt(-1);
v.NEG_ONE = de;
var In = x(-1, 2147483647, !1);
v.MAX_VALUE = In;
var kn = x(-1, -1, !0);
v.MAX_UNSIGNED_VALUE = kn;
var G = x(0, -2147483648, !1);
v.MIN_VALUE = G;
var p = v.prototype;
p.toInt = function() {
return this.unsigned ? this.low >>> 0 : this.low;
};
p.toNumber = function() {
return this.unsigned ? (this.high >>> 0) * vt + (this.low >>> 0) : this.high * vt + (this.low >>> 0);
};
p.toString = function(t) {
if (t = t || 10, t < 2 || 36 < t)
throw RangeError("radix");
if (this.isZero())
return "0";
if (this.isNegative())
if (this.eq(G)) {
var n = j(t), s = this.div(n), r = s.mul(n).sub(this);
return s.toString(t) + r.toInt().toString(t);
} else
return "-" + this.neg().toString(t);
for (var o = j(Kt(t, 6), this.unsigned), i = this, a = ""; ; ) {
var c = i.div(o), l = i.sub(c.mul(o)).toInt() >>> 0, f = l.toString(t);
if (i = c, i.isZero())
return f + a;
for (; f.length < 6; )
f = "0" + f;
a = "" + f + a;
}
};
p.getHighBits = function() {
return this.high;
};
p.getHighBitsUnsigned = function() {
return this.high >>> 0;
};
p.getLowBits = function() {
return this.low;
};
p.getLowBitsUnsigned = function() {
return this.low >>> 0;
};
p.getNumBitsAbs = function() {
if (this.isNegative())
return this.eq(G) ? 64 : this.neg().getNumBitsAbs();
for (var t = this.high != 0 ? this.high : this.low, n = 31; n > 0 && !(t & 1 << n); n--)
;
return this.high != 0 ? n + 33 : n + 1;
};
p.isZero = function() {
return this.high === 0 && this.low === 0;
};
p.eqz = p.isZero;
p.isNegative = function() {
return !this.unsigned && this.high < 0;
};
p.isPositive = function() {
return this.unsigned || this.high >= 0;
};
p.isOdd = function() {
return (this.low & 1) === 1;
};
p.isEven = function() {
return (this.low & 1) === 0;
};
p.equals = function(t) {
return W(t) || (t = Y(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? !1 : this.high === t.high && this.low === t.low;
};
p.eq = p.equals;
p.notEquals = function(t) {
return !this.eq(
/* validates */
t
);
};
p.neq = p.notEquals;
p.ne = p.notEquals;
p.lessThan = function(t) {
return this.comp(
/* validates */
t
) < 0;
};
p.lt = p.lessThan;
p.lessThanOrEqual = function(t) {
return this.comp(
/* validates */
t
) <= 0;
};
p.lte = p.lessThanOrEqual;
p.le = p.lessThanOrEqual;
p.greaterThan = function(t) {
return this.comp(
/* validates */
t
) > 0;
};
p.gt = p.greaterThan;
p.greaterThanOrEqual = function(t) {
return this.comp(
/* validates */
t
) >= 0;
};
p.gte = p.greaterThanOrEqual;
p.ge = p.greaterThanOrEqual;
p.compare = function(t) {
if (W(t) || (t = Y(t)), this.eq(t))
return 0;
var n = this.isNegative(), s = t.isNegative();
return n && !s ? -1 : !n && s ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1;
};
p.comp = p.compare;
p.negate = function() {
return !this.unsigned && this.eq(G) ? G : this.not().add(Tt);
};
p.neg = p.negate;
p.add = function(t) {
W(t) || (t = Y(t));
var n = this.high >>> 16, s = this.high & 65535, r = this.low >>> 16, o = this.low & 65535, i = t.high >>> 16, a = t.high & 65535, c = t.low >>> 16, l = t.low & 65535, f = 0, u = 0, h = 0, d = 0;
return d += o + l, h += d >>> 16, d &= 65535, h += r + c, u += h >>> 16, h &= 65535, u += s + a, f += u >>> 16, u &= 65535, f += n + i, f &= 65535, x(h << 16 | d, f << 16 | u, this.unsigned);
};
p.subtract = function(t) {
return W(t) || (t = Y(t)), this.add(t.neg());
};
p.sub = p.subtract;
p.multiply = function(t) {
if (this.isZero())
return H;
if (W(t) || (t = Y(t)), V) {
var n = V.mul(
this.low,
this.high,
t.low,
t.high
);
return x(n, V.get_high(), this.unsigned);
}
if (t.isZero())
return H;
if (this.eq(G))
return t.isOdd() ? G : H;
if (t.eq(G))
return this.isOdd() ? G : H;
if (this.isNegative())
return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg();
if (t.isNegative())
return this.mul(t.neg()).neg();
if (this.lt(Xe) && t.lt(Xe))
return j(this.toNumber() * t.toNumber(), this.unsigned);
var s = this.high >>> 16, r = this.high & 65535, o = this.low >>> 16, i = this.low & 65535, a = t.high >>> 16, c = t.high & 65535, l = t.low >>> 16, f = t.low & 65535, u = 0, h = 0, d = 0, g = 0;
return g += i * f, d += g >>> 16, g &= 65535, d += o * f, h += d >>> 16, d &= 65535, d += i * l, h += d >>> 16, d &= 65535, h += r * f, u += h >>> 16, h &= 65535, h += o * l, u += h >>> 16, h &= 65535, h += i * c, u += h >>> 16, h &= 65535, u += s * f + r * l + o * c + i * a, u &= 65535, x(d << 16 | g, u << 16 | h, this.unsigned);
};
p.mul = p.multiply;
p.divide = function(t) {
if (W(t) || (t = Y(t)), t.isZero())
throw Error("division by zero");
if (V) {
if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1)
return this;
var n = (this.unsigned ? V.div_u : V.div_s)(
this.low,
this.high,
t.low,
t.high
);
return x(n, V.get_high(), this.unsigned);
}
if (this.isZero())
return this.unsigned ? dt : H;
var s, r, o;
if (this.unsigned) {
if (t.unsigned || (t = t.toUnsigned()), t.gt(this))
return dt;
if (t.gt(this.shru(1)))
return En;
o = dt;
} else {
if (this.eq(G)) {
if (t.eq(Tt) || t.eq(de))
return G;
if (t.eq(G))
return Tt;
var i = this.shr(1);
return s = i.div(t).shl(1), s.eq(H) ? t.isNegative() ? Tt : de : (r = this.sub(t.mul(s)), o = s.add(r.div(t)), o);
} else if (t.eq(G))
return this.unsigned ? dt : H;
if (this.isNegative())
return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg();
if (t.isNegative())
return this.div(t.neg()).neg();
o = H;
}
for (r = this; r.gte(t); ) {
s = Math.max(1, Math.floor(r.toNumber() / t.toNumber()));
for (var a = Math.ceil(Math.log(s) / Math.LN2), c = a <= 48 ? 1 : Kt(2, a - 48), l = j(s), f = l.mul(t); f.isNegative() || f.gt(r); )
s -= c, l = j(s, this.unsigned), f = l.mul(t);
l.isZero() && (l = Tt), o = o.add(l), r = r.sub(f);
}
return o;
};
p.div = p.divide;
p.modulo = function(t) {
if (W(t) || (t = Y(t)), V) {
var n = (this.unsigned ? V.rem_u : V.rem_s)(
this.low,
this.high,
t.low,
t.high
);
return x(n, V.get_high(), this.unsigned);
}
return this.sub(this.div(t).mul(t));
};
p.mod = p.modulo;
p.rem = p.modulo;
p.not = function() {
return x(~this.low, ~this.high, this.unsigned);
};
p.and = function(t) {
return W(t) || (t = Y(t)), x(this.low & t.low, this.high & t.high, this.unsigned);
};
p.or = function(t) {
return W(t) || (t = Y(t)), x(this.low | t.low, this.high | t.high, this.unsigned);
};
p.xor = function(t) {
return W(t) || (t = Y(t)), x(this.low ^ t.low, this.high ^ t.high, this.unsigned);
};
p.shiftLeft = function(t) {
return W(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? x(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : x(0, this.low << t - 32, this.unsigned);
};
p.shl = p.shiftLeft;
p.shiftRight = function(t) {
return W(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? x(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : x(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned);
};
p.shr = p.shiftRight;
p.shiftRightUnsigned = function(t) {
if (W(t) && (t = t.toInt()), t &= 63, t === 0)
return this;
var n = this.high;
if (t < 32) {
var s = this.low;
return x(s >>> t | n << 32 - t, n >>> t, this.unsigned);
} else
return t === 32 ? x(n, 0, this.unsigned) : x(n >>> t - 32, 0, this.unsigned);
};
p.shru = p.shiftRightUnsigned;
p.shr_u = p.shiftRightUnsigned;
p.toSigned = function() {
return this.unsigned ? x(this.low, this.high, !1) : this;
};
p.toUnsigned = function() {
return this.unsigned ? this : x(this.low, this.high, !0);
};
p.toBytes = function(t) {
return t ? this.toBytesLE() : this.toBytesBE();
};
p.toBytesLE = function() {
var t = this.high, n = this.low;
return [
n & 255,
n >>> 8 & 255,
n >>> 16 & 255,
n >>> 24,
t & 255,
t >>> 8 & 255,
t >>> 16 & 255,
t >>> 24
];
};
p.toBytesBE = function() {
var t = this.high, n = this.low;
return [
t >>> 24,
t >>> 16 & 255,
t >>> 8 & 255,
t & 255,
n >>> 24,
n >>> 16 & 255,
n >>> 8 & 255,
n & 255
];
};
v.fromBytes = function(t, n, s) {
return s ? v.fromBytesLE(t, n) : v.fromBytesBE(t, n);
};
v.fromBytesLE = function(t, n) {
return new v(
t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24,
t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24,
n
);
};
v.fromBytesBE = function(t, n) {
return new v(
t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7],
t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3],
n
);
};
const An = /* @__PURE__ */ us(wn), Ys = /* @__PURE__ */ fs({
__proto__: null,
default: An
}, [wn]);
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const ht = (
// tslint:disable-next-line
An || Ys
);
function Qt(e) {
return ht.fromString(e, !0, 16);
}
const Tn = Qt("c3a5c85c97cb3127"), ut = Qt("b492b66fbe98f273"), L = Qt("9ae16a3b2f90404f");
function ge(e) {
return e.xor(e.shru(47));
}
function $n(e, t, n) {
const s = e.slice(t, t + n);
return ht.fromBytes(Array.from(s), !0, !0);
}
function F(e, t) {
return $n(e, t, 8);
}
function Je(e, t) {
return $n(e, t, 4);
}
function B(e, t) {
return t === 0 ? e : e.shru(t).or(e.shl(64 - t));
}
function ct(e, t, n = Qt("9ddfea08eb382d69")) {
let s = e.xor(t).mul(n);
s = s.xor(s.shru(47));
let r = t.xor(s).mul(n);
return r = r.xor(r.shru(47)), r = r.mul(n), r;
}
function Qs(e, t, n, s, r, o) {
r = r.add(e), o = B(o.add(r).add(s), 21);
const i = r;
return r = r.add(t), r = r.add(n), o = o.add(B(r, 44)), [r.add(s), o.add(i)];
}
function Wt(e, t, n, s) {
return Qs(F(e, t), F(e, t + 8), F(e, t + 16), F(e, t + 24), n, s);
}
function tr(e, t = e.length) {
if (t >= 8) {
const n = L.add(t * 2), s = F(e, 0).add(L), r = F(e, t - 8), o = B(r, 37).mul(n).add(s), i = B(s, 25).add(r).mul(n);
return ct(o, i, n);
}
if (t >= 4) {
const n = L.add(t * 2), s = Je(e, 0);
return ct(s.shl(3).add(t), Je(e, t - 4), n);
}
if (t > 0) {
const n = e[0], s = e[t >> 1], r = e[t - 1], o = n + (s << 8), i = t + (r << 2);
return ge(L.mul(o).xor(Tn.mul(i))).mul(L);
}
return L;
}
function er(e, t = e.length) {
const n = L.add(t * 2), s = F(e, 0).mul(ut), r = F(e, 8), o = F(e, t - 8).mul(n), i = F(e, t - 16).mul(L);
return ct(B(s.add(r), 43).add(B(o, 30)).add(i), s.add(B(r.add(L), 18)).add(o), n);
}
function nr(e, t = e.length) {
const n = L.add(t * 2), s = F(e, 0).mul(L), r = F(e, 8), o = F(e, t - 8).mul(n), i = F(e, t - 16).mul(L), a = B(s.add(r), 43).add(B(o, 30)).add(i), c = ct(a, s.add(B(r.add(L), 18)).add(o), n), l = F(e, 16).mul(n), f = F(e, 24), u = a.add(F(e, t - 32)).mul(n), h = c.add(F(e, t - 24)).mul(n);
return ct(B(l.add(f), 43).add(B(u, 30)).add(h), l.add(B(f.add(s), 18)).add(u), n);
}
function sr(e, t = e.length) {
const n = ht.fromNumber(81, !0);
if (t <= 32)
return t <= 16 ? tr(e, t) : er(e, t);
if (t <= 64)
return nr(e, t);
let s = n, r = n.mul(ut).add(113), o = ge(r.mul(L).add(113)).mul(L), i = [ht.UZERO, ht.UZERO], a = [ht.UZERO, ht.UZERO];
s = s.mul(L).add(F(e, 0));
let c = 0;
const l = (t - 1 >> 6) * 64, f = l + (t - 1 & 63) - 63;
do
s = B(s.add(r).add(i[0]).add(F(e, c + 8)), 37).mul(ut), r = B(r.add(i[1]).add(F(e, c + 48)), 42).mul(ut), s = s.xor(a[1]), r = r.add(i[0]).add(F(e, c + 40)), o = B(o.add(a[0]), 33).mul(ut), i = Wt(e, c, i[1].mul(ut), s.add(a[0])), a = Wt(e, c + 32, o.add(a[1]), r.add(F(e, c + 16))), [o, s] = [s, o], c += 64;
while (c !== l);
const u = ut.add(o.and(255).shl(1));
return c = f, a[0] = a[0].add(t - 1 & 63), i[0] = i[0].add(a[0]), a[0] = a[0].add(i[0]), s = B(s.add(r).add(i[0]).add(F(e, c + 8)), 37).mul(u), r = B(r.add(i[1]).add(F(e, c + 48)), 42).mul(u), s = s.xor(a[1].mul(9)), r = r.add(i[0].mul(9).add(F(e, c + 40))), o = B(o.add(a[0]), 33).mul(u), i = Wt(e, c, i[1].mul(u), s.add(a[0])), a = Wt(e, c + 32, o.add(a[1]), r.add(F(e, c + 16))), [o, s] = [s, o], ct(ct(i[0], a[0], u).add(ge(r).mul(Tn)).add(o), ct(i[1], a[1], u).add(s), u);
}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function xu(e, t) {
return t === "string" ? $t(e) : De([e], t);
}
function rr(e, t) {
return e instanceof Float32Array && t === "float32" || e instanceof Int32Array && t === "int32" || e instanceof Uint8Array && t === "bool";
}
function De(e, t) {
if (t === "string")
throw new Error("Cannot convert a string[] to a TypedArray");
if (Array.isArray(e) && (e = Pt(e)), A().getBool("DEBUG") && ys(e, t), rr(e, t))
return e;
if (t == null || t === "float32" || t === "complex64")
return new Float32Array(e);
if (t === "int32")
return new Int32Array(e);
if (t === "bool") {
const n = new Uint8Array(e.length);
for (let s = 0; s < n.length; ++s)
Math.round(e[s]) !== 0 && (n[s] = 1);
return n;
} else
throw new Error(`Unknown data type ${t}`);
}
function Zt() {
return A().platform.now();
}
function Nu(e, t) {
return A().platform.fetch(e, t);
}
function $t(e, t = "utf-8") {
return t = t || "utf-8", A().platform.encode(e, t);
}
function me(e, t = "utf-8") {
return t = t || "utf-8", A().platform.decode(e, t);
}
function K(e) {
return A().platform.isTypedArray != null ? A().platform.isTypedArray(e) : bn(e);
}
function Pt(e, t = [], n = !1) {
if (t == null && (t = []), typeof e == "boolean" || typeof e == "number" || typeof e == "string" || Ne(e) || e == null || K(e) && n)
t.push(e);
else if (Array.isArray(e) || K(e))
for (let s = 0; s < e.length; ++s)
Pt(e[s], t, n);
else {
let s = -1;
for (const r of Object.keys(e))
/^([1-9]+[0-9]*|0)$/.test(r) && (s = Math.max(s, Number(r)));
for (let r = 0; r <= s; r++)
Pt(e[r], t, n);
}
return t;
}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class or {
constructor(t, n) {
this.backendTimer = t, this.logger = n, n == null && (this.logger = new ar());
}
profileKernel(t, n, s) {
let r;
const o = () => {
r = s();
};
let i;
const a = Zt();
if (this.backendTimer.timerAvailable())
i = this.backendTimer.time(o);
else {
o();
for (const l of r)
l.dataSync();
i = Promise.resolve({ kernelMs: Zt() - a });
}
if (A().getBool("CHECK_COMPUTATION_FOR_ERRORS"))
for (let l = 0; l < r.length; l++) {
const f = r[l];
f.data().then((u) => {
ir(u, f.dtype, t);
});
}
return {
kernelName: t,
outputs: r,
inputs: n,
timeMs: i.then((l) => l.kernelMs),
extraInfo: i.then((l) => l.getExtraProfileInfo != null ? l.getExtraProfileInfo() : "")
};
}
logKernelProfile(t) {
const { kernelName: n, outputs: s, timeMs: r, inputs: o, extraInfo: i } = t;
s.forEach((a) => {
Promise.all([a.data(), r, i]).then((c) => {
this.logger.logKernelProfile(n, a, c[0], c[1], o, c[2]);
});
});
}
}
function ir(e, t, n) {
if (t !== "float32")
return !1;
for (let s = 0; s < e.length; s++) {
const r = e[s];
if (isNaN(r) || !isFinite(r))
return console.warn(`Found ${r} in the result of '${n}'`), !0;
}
return !1;
}
class ar {
logKernelProfile(t, n, s, r, o, i) {
const a = typeof r == "number" ? zt(`${r}ms`, 9) : r.error, c = zt(t, 25), l = n.rank, f = n.size, u = zt(n.shape.toString(), 14);
let h = "";
for (const d in o) {
const g = o[d];
if (g != null) {
const m = g.shape || n.shape, b = m.length;
h += `${d}: ${b}D ${b > 0 ? m : ""} `;
}
}
console.log(`%c${c} %c${a} %c${l}D ${u} %c${f} %c${h} %c${i}`, "font-weight:bold", "color:red", "color:blue", "color: orange", "color: green", "color: steelblue");
}
}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function cr(e, t, n) {
const s = {}, r = {};
for (let c = 0; c < t.length; c++)
s[t[c].id] = !0;
for (let c = 0; c < e.length; c++) {
const l = e[c], f = l.inputs;
for (const u in f) {
const h = f[u];
let d = !1;
for (let g = 0; g < t.length; g++)
if (s[h.id]) {
l.outputs.forEach((m) => s[m.id] = !0), d = !0, r[l.id] = !0;
break;
}
if (d)
break;
}
}
const o = {};
o[n.id] = !0;
const i = {};
for (let c = e.length - 1; c >= 0; c--) {
const l = e[c], f = l.inputs;
for (let u = 0; u < l.outputs.length; u++)
if (o[l.outputs[u].id]) {
for (const h in f)
o[f[h].id] = !0, i[l.id] = !0;
break;
}
}
const a = [];
for (let c = 0; c < e.length; c++) {
const l = e[c];
if (r[l.id] && i[l.id]) {
const f = {};
for (const h in l.inputs) {
const d = l.inputs[h];
s[d.id] && (f[h] = d);
}
const u = Object.assign({}, l);
u.inputs = f, u.outputs = l.outputs, a.push(u);
}
}
return a;
}
function lr(e, t, n, s) {
for (let r = t.length - 1; r >= 0; r--) {
const o = t[r], i = [];
if (o.outputs.forEach((c) => {
const l = e[c.id];
l != null ? i.push(l) : i.push(null);
}), o.gradient == null)
throw new Error(`Cannot compute gradient: gradient function not found for ${o.kernelName}.`);
const a = o.gradient(i);
for (const c in o.inputs) {
if (!(c in a))
throw new Error(`Cannot backprop through input ${c}. Available gradients found: ${Object.keys(a)}.`);
const l = n(() => a[c]());
if (l.dtype !== "float32")
throw new Error(`Error in gradient for op ${o.kernelName}. The gradient of input ${c} must have 'float32' dtype, but has '${l.dtype}'`);
const f = o.inputs[c];
if (!Me(l.shape, f.shape))
throw new Error(`Error in gradient for op ${o.kernelName}. The gradient of input '${c}' has shape '${l.shape}', which does not match the shape of the input '${f.shape}'`);
if (e[f.id] == null)
e[f.id] = l;
else {
const u = e[f.id];
e[f.id] = s(u, l), u.dispose();
}
}
}
}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ye = 20, _t = 3, re = 7;
function ur(e, t, n, s) {
const r = Bt(t), o = hr(e, t, n, r), i = t.length, a = qt(e, t, n, r, o), c = ["Tensor"];
return s && (c.push(` dtype: ${n}`), c.push(` rank: ${i}`), c.push(` shape: [${t}]`), c.push(" values:")), c.push(a.map((l) => " " + l).join(`
`)), c.join(`
`);
}
function hr(e, t, n, s) {
const r = _(t), o = s[s.length - 1], i = new Array(o).fill(0), a = t.length, c = n === "complex64" ? Lt(e) : e;
if (a > 1)
for (let l = 0; l < r / o; l++) {
const f = l * o;
for (let u = 0; u < o; u++)
i[u] = Math.max(i[u], Ot(c[f + u], 0, n).length);
}
return i;
}
function Ot(e, t, n) {
let s;
return Array.isArray(e) ? s = `${parseFloat(e[0].toFixed(re))} + ${parseFloat(e[1].toFixed(re))}j` : ve(e) ? s = `'${e}'` : n === "bool" ? s = Fn(e) : s = parseFloat(e.toFixed(re)).toString(), zt(s, t);
}
function Fn(e) {
return e === 0 ? "false" : "true";
}
function qt(e, t, n, s, r, o = !0) {
const i = n === "complex64" ? 2 : 1, a = t[0], c = t.length;
if (c === 0) {
if (n === "complex64") {
const m = Lt(e);
return [Ot(m[0], 0, n)];
}
return n === "bool" ? [Fn(e[0])] : [e[0].toString()];
}
if (c === 1) {
if (a > Ye) {
const b = _t * i;
let w = Array.from(e.slice(0, b)), I = Array.from(e.slice((a - _t) * i, a * i));
return n === "complex64" && (w = Lt(w), I = Lt(I)), [
"[" + w.map((y, M) => Ot(y, r[M], n)).join(", ") + "