@barcode-bakery/barcode-react
Version:
Generates barcodes for React.
324 lines (323 loc) • 9.89 kB
JavaScript
import ne, { useState as M, useRef as oe, useMemo as ae, useEffect as A } from "react";
import { BCGDrawing as L } from "@barcode-bakery/barcode-common";
var h = { exports: {} }, _ = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var W;
function ce() {
if (W)
return _;
W = 1;
var u = Symbol.for("react.transitional.element"), E = Symbol.for("react.fragment");
function s(f, a, c) {
var v = null;
if (c !== void 0 && (v = "" + c), a.key !== void 0 && (v = "" + a.key), "key" in a) {
c = {};
for (var d in a)
d !== "key" && (c[d] = a[d]);
} else
c = a;
return a = c.ref, {
$$typeof: u,
type: f,
key: v,
ref: a !== void 0 ? a : null,
props: c
};
}
return _.Fragment = E, _.jsx = s, _.jsxs = s, _;
}
var T = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var U;
function se() {
return U || (U = 1, process.env.NODE_ENV !== "production" && function() {
function u(e) {
if (e == null)
return null;
if (typeof e == "function")
return e.$$typeof === ee ? null : e.displayName || e.name || null;
if (typeof e == "string")
return e;
switch (e) {
case w:
return "Fragment";
case q:
return "Profiler";
case V:
return "StrictMode";
case H:
return "Suspense";
case Z:
return "SuspenseList";
case K:
return "Activity";
}
if (typeof e == "object")
switch (typeof e.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), e.$$typeof) {
case G:
return "Portal";
case X:
return (e.displayName || "Context") + ".Provider";
case J:
return (e._context.displayName || "Context") + ".Consumer";
case B:
var r = e.render;
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
case Q:
return r = e.displayName || null, r !== null ? r : u(e.type) || "Memo";
case C:
r = e._payload, e = e._init;
try {
return u(e(r));
} catch {
}
}
return null;
}
function E(e) {
return "" + e;
}
function s(e) {
try {
E(e);
var r = !1;
} catch {
r = !0;
}
if (r) {
r = console;
var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
return t.call(
r,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
n
), E(e);
}
}
function f(e) {
if (e === w)
return "<>";
if (typeof e == "object" && e !== null && e.$$typeof === C)
return "<...>";
try {
var r = u(e);
return r ? "<" + r + ">" : "<...>";
} catch {
return "<...>";
}
}
function a() {
var e = k.A;
return e === null ? null : e.getOwner();
}
function c() {
return Error("react-stack-top-frame");
}
function v(e) {
if (N.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning)
return !1;
}
return e.key !== void 0;
}
function d(e, r) {
function t() {
Y || (Y = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
r
));
}
t.isReactWarning = !0, Object.defineProperty(e, "key", {
get: t,
configurable: !0
});
}
function m() {
var e = u(this.type);
return D[e] || (D[e] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), e = this.props.ref, e !== void 0 ? e : null;
}
function i(e, r, t, n, R, l, O, x) {
return t = l.ref, e = {
$$typeof: y,
type: e,
key: r,
props: l,
_owner: R
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
enumerable: !1,
get: m
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(e, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(e, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: O
}), Object.defineProperty(e, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: x
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
}
function P(e, r, t, n, R, l, O, x) {
var o = r.children;
if (o !== void 0)
if (n)
if (re(o)) {
for (n = 0; n < o.length; n++)
j(o[n]);
Object.freeze && Object.freeze(o);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else
j(o);
if (N.call(r, "key")) {
o = u(e);
var b = Object.keys(r).filter(function(te) {
return te !== "key";
});
n = 0 < b.length ? "{key: someKey, " + b.join(": ..., ") + ": ...}" : "{key: someKey}", F[o + n] || (b = 0 < b.length ? "{" + b.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
n,
o,
b,
o
), F[o + n] = !0);
}
if (o = null, t !== void 0 && (s(t), o = "" + t), v(r) && (s(r.key), o = "" + r.key), "key" in r) {
t = {};
for (var S in r)
S !== "key" && (t[S] = r[S]);
} else
t = r;
return o && d(
t,
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
), i(
e,
o,
l,
R,
a(),
t,
O,
x
);
}
function j(e) {
typeof e == "object" && e !== null && e.$$typeof === y && e._store && (e._store.validated = 1);
}
var p = ne, y = Symbol.for("react.transitional.element"), G = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), q = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), X = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), H = Symbol.for("react.suspense"), Z = Symbol.for("react.suspense_list"), Q = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), k = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, re = Array.isArray, g = console.createTask ? console.createTask : function() {
return null;
};
p = {
"react-stack-bottom-frame": function(e) {
return e();
}
};
var Y, D = {}, I = p["react-stack-bottom-frame"].bind(
p,
c
)(), $ = g(f(c)), F = {};
T.Fragment = w, T.jsx = function(e, r, t, n, R) {
var l = 1e4 > k.recentlyCreatedOwnerStacks++;
return P(
e,
r,
t,
!1,
n,
R,
l ? Error("react-stack-top-frame") : I,
l ? g(f(e)) : $
);
}, T.jsxs = function(e, r, t, n, R) {
var l = 1e4 > k.recentlyCreatedOwnerStacks++;
return P(
e,
r,
t,
!0,
n,
R,
l ? Error("react-stack-top-frame") : I,
l ? g(f(e)) : $
);
};
}()), T;
}
process.env.NODE_ENV === "production" ? h.exports = ce() : h.exports = se();
var ue = h.exports;
const z = (u, E) => {
const s = document.createElement("canvas");
return s.width = u, s.height = E, {
context: s.getContext("2d"),
createSurface: z
};
}, fe = (u, E, s) => {
const [f, a] = M(), [c, v] = M(), d = oe(null), m = ae(() => {
const i = d.current;
return i ? {
context: i.getContext("2d"),
createSurface: z
} : null;
}, [d.current]);
return A(() => {
f && m && new L(m).draw(f);
}, [f, m]), A(
() => {
try {
a(void 0), v(void 0);
const i = new u();
E(i), a(i);
} catch (i) {
v(i);
}
},
s == null ? void 0 : s.concat([a, m])
), A(() => {
c && m && new L(m).drawException(c);
}, [c, m]), {
component: /* @__PURE__ */ ue.jsx("canvas", { width: 1, height: 1, ref: d })
};
};
export {
fe as u
};