@tldraw/utils
Version:
tldraw infinite canvas SDK (private utilities).
45 lines (44 loc) • 1.51 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var webp_exports = {};
__export(webp_exports, {
isWebpAnimated: () => isWebpAnimated
});
module.exports = __toCommonJS(webp_exports);
/*!
* MIT License: https://github.com/sindresorhus/is-webp/blob/main/license
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
*/
function isWebp(view) {
if (!view || view.length < 12) {
return false;
}
return view[8] === 87 && view[9] === 69 && view[10] === 66 && view[11] === 80;
}
function isWebpAnimated(buffer) {
const view = new Uint8Array(buffer);
if (!isWebp(view)) {
return false;
}
if (!view || view.length < 21) {
return false;
}
return (view[20] >> 1 & 1) === 1;
}
//# sourceMappingURL=webp.js.map