decord/source/15301__isNativeReflectConstruct.js

293 lines
8.9 KiB
JavaScript
Raw Normal View History

2026-07-27 11:26:19 +00:00
// Module ID: 15301
// Function ID: 116702
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-27 11:26:19 +00:00
// Dependencies: [6, 7, 15, 17, 18, 31, 27, 33, 15302]
2026-07-20 16:05:17 +00:00
// Exports: captureScreen
2026-07-27 11:26:19 +00:00
// Module 15301 (_isNativeReflectConstruct)
2026-07-23 10:11:24 +00:00
import getActivityIndicator from "get ActivityIndicator";
import jsxProd from "jsxProd";
import _possibleConstructorReturn from "_possibleConstructorReturn";
import _getPrototypeOf from "_getPrototypeOf";
import _inherits from "_inherits";
import "result";
import get_ActivityIndicator from "get ActivityIndicator";
import { jsx } from "jsxProd";
2026-07-20 16:05:17 +00:00
let Platform;
let StyleProp;
2026-07-23 10:11:24 +00:00
let closure_7;
let closure_8;
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
let closure_0 = !valueOf.call(Reflect.construct(Boolean, [], () => {
}));
function _isNativeReflectConstruct() {
return closure_0;
}
const result = _isNativeReflectConstruct();
}
function validateOptions(options) {
options = Object.assign({}, closure_13, options);
const errors = [];
let tmp = "width" in options;
if (tmp) {
let tmp2 = "number" !== typeof options.width;
if (!tmp2) {
tmp2 = options.width <= 0;
}
tmp = tmp2;
}
if (tmp) {
errors.push("option width should be a positive number");
2026-07-23 10:11:24 +00:00
delete size.width;
2026-07-20 16:05:17 +00:00
}
let tmp4 = "height" in options;
if (tmp4) {
let tmp5 = "number" !== typeof options.height;
if (!tmp5) {
tmp5 = options.height <= 0;
}
tmp4 = tmp5;
}
if (tmp4) {
errors.push("option height should be a positive number");
2026-07-23 10:11:24 +00:00
delete size.height;
2026-07-20 16:05:17 +00:00
}
let tmp7 = "number" !== typeof options.quality;
if (!tmp7) {
tmp7 = options.quality < 0;
}
if (!tmp7) {
tmp7 = options.quality > 1;
}
if (tmp7) {
errors.push("option quality should be a number between 0.0 and 1.0");
options.quality = closure_13.quality;
}
if ("boolean" !== typeof options.snapshotContentContainer) {
errors.push("option snapshotContentContainer should be a boolean");
}
if ("boolean" !== typeof options.handleGLSurfaceViewOnAndroid) {
errors.push("option handleGLSurfaceViewOnAndroid should be a boolean");
}
if (-1 === closure_11.indexOf(options.format)) {
options.format = closure_13.format;
2026-07-23 10:11:24 +00:00
const text = `option format '${size2.format}`;
errors.push(`${`option format '${size2.format}`}' is not in valid formats: ${closure_11.join(" | ")}`);
2026-07-20 16:05:17 +00:00
}
if (-1 === closure_12.indexOf(options.result)) {
options.result = closure_13.result;
2026-07-23 10:11:24 +00:00
const text1 = `option result '${size2.result}`;
errors.push(`${`option result '${size2.result}`}' is not in valid formats: ${closure_12.join(" | ")}`);
2026-07-20 16:05:17 +00:00
}
return { options, errors };
}
function ensureModuleIsLoaded() {
2026-07-27 11:26:19 +00:00
if (!importDefault(15302)) {
2026-07-20 16:05:17 +00:00
const _Error = Error;
const error = new Error("react-native-view-shot: NativeModules.RNViewShot is undefined. Make sure the library is linked on the native side.");
throw error;
}
}
function captureRef(current, options) {
ensureModuleIsLoaded();
let tmp2 = current;
if (current) {
tmp2 = current;
if ("object" === typeof current) {
tmp2 = current;
if ("current" in current) {
tmp2 = current;
if (current.current) {
if (!current.current) {
const _Error = Error;
const error = new Error("ref.current is null");
return Promise.reject(error);
}
}
}
}
}
let tmp8 = tmp2;
if ("number" !== typeof tmp2) {
tmp8 = callback3(tmp2);
if (!tmp8) {
const _Error2 = Error;
const _String = String;
const error1 = new Error("findNodeHandle failed to resolve view=" + String(tmp2));
return Promise.reject(error1);
}
}
const tmp15 = validateOptions(options);
2026-07-27 11:26:19 +00:00
return importDefault(15302).captureRef(tmp8, tmp15.options);
2026-07-20 16:05:17 +00:00
}
function releaseCapture(arg0) {
if ("string" === typeof arg0) {
2026-07-27 11:26:19 +00:00
importDefault(15302).releaseCapture(arg0);
const obj = importDefault(15302);
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
({ View: closure_7, Platform, findNodeHandle: closure_8, StyleProp } = get_ActivityIndicator);
2026-07-20 16:05:17 +00:00
const promise = new Promise(() => {
});
2026-07-23 10:11:24 +00:00
if (!require("get ActivityIndicator")) {
2026-07-20 16:05:17 +00:00
const _console = console;
console.warn("react-native-view-shot: NativeModules.RNViewShot is undefined. Make sure the library is linked on the native side.");
}
2026-07-23 10:11:24 +00:00
let items = ["png", "jpg"];
let closure_11 = items.concat(["webm", "raw"]);
const items1 = ["tmpfile", "base64", "data-uri"];
let closure_12 = items1.concat(["zip-base64"]);
let closure_13 = { format: "png", quality: 1, result: "tmpfile", snapshotContentContainer: false, handleGLSurfaceViewOnAndroid: false };
const tmp6 = ((Component) => {
2026-07-20 16:05:17 +00:00
class ViewShot {
constructor() {
self = this;
2026-07-23 10:11:24 +00:00
tmp = outer1_2(this, apply);
2026-07-20 16:05:17 +00:00
length = arguments.length;
array = new Array(length);
for (let num = 0; num < length; num = num + 1) {
array[num] = arguments[num];
}
items = [];
combined = items.concat(array);
2026-07-23 10:11:24 +00:00
obj = outer1_5(apply);
tmp3 = outer1_4;
if (outer1_14()) {
2026-07-20 16:05:17 +00:00
if (!combined) {
combined = [];
}
2026-07-23 10:11:24 +00:00
tmp5 = outer1_5;
constructResult = Reflect.construct(obj, combined, outer1_5(self).constructor);
2026-07-20 16:05:17 +00:00
} else {
constructResult = obj.apply(self, combined);
}
tmp3Result = tmp3(self, constructResult);
2026-07-23 10:11:24 +00:00
apply = tmp3Result;
2026-07-20 16:05:17 +00:00
promise = new Promise((resolveFirstLayout) => {
2026-07-23 10:11:24 +00:00
closure_0.resolveFirstLayout = resolveFirstLayout;
2026-07-20 16:05:17 +00:00
});
tmp3Result.firstLayoutPromise = promise;
tmp3Result.capture = () => tmp3Result.firstLayoutPromise.then(() => {
2026-07-23 10:11:24 +00:00
const root = outer1_0.root;
2026-07-20 16:05:17 +00:00
if (root) {
2026-07-23 10:11:24 +00:00
let tmp = outer3_17(root, outer1_0.props.options);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
tmp = outer3_10;
2026-07-20 16:05:17 +00:00
}
return tmp;
}).then((arg0) => {
2026-07-23 10:11:24 +00:00
outer1_0.onCapture(arg0);
2026-07-20 16:05:17 +00:00
return arg0;
}, (arg0) => {
2026-07-23 10:11:24 +00:00
outer1_0.onCaptureFailure(arg0);
2026-07-20 16:05:17 +00:00
throw arg0;
});
tmp3Result.onCapture = (lastCapturedURI) => {
if (tmp3Result.root) {
if (tmp3Result.lastCapturedURI) {
const _setTimeout = setTimeout;
2026-07-23 10:11:24 +00:00
const timerId = setTimeout(outer2_18, 500, tmp3Result.lastCapturedURI);
2026-07-20 16:05:17 +00:00
}
tmp3Result.lastCapturedURI = lastCapturedURI;
const onCapture = tmp3Result.props.onCapture;
if (onCapture) {
onCapture(lastCapturedURI);
}
}
};
tmp3Result.onCaptureFailure = (arg0) => {
if (tmp3Result.root) {
const onCaptureFailure = tmp3Result.props.onCaptureFailure;
if (onCaptureFailure) {
onCaptureFailure(arg0);
}
}
};
tmp3Result.syncCaptureLoop = (arg0) => {
2026-07-23 10:11:24 +00:00
cancelAnimationFrame(tmp3Result._raf);
2026-07-20 16:05:17 +00:00
if ("continuous" === arg0) {
function loop() {
_var._raf = requestAnimationFrame(loop);
2026-07-23 10:11:24 +00:00
if (lastCapturedURI !== _var.lastCapturedURI) {
lastCapturedURI = _var.lastCapturedURI;
2026-07-20 16:05:17 +00:00
_var.capture();
}
}
const _requestAnimationFrame = requestAnimationFrame;
2026-07-23 10:11:24 +00:00
"-"._raf = requestAnimationFrame(loop);
2026-07-20 16:05:17 +00:00
}
};
tmp3Result.onRef = (root) => {
2026-07-23 10:11:24 +00:00
closure_0.root = root;
2026-07-20 16:05:17 +00:00
};
tmp3Result.onLayout = (nativeEvent) => {
const onLayout = tmp3Result.props.onLayout;
const firstLayout = tmp3Result.resolveFirstLayout(nativeEvent.nativeEvent.layout);
if (onLayout) {
onLayout(nativeEvent);
}
};
return tmp3Result;
}
}
callback2(ViewShot, Component);
let obj = {
key: "componentDidMount",
value: function componentDidMount() {
const self = this;
if ("mount" === this.props.captureMode) {
self.capture();
} else {
self.syncCaptureLoop(self.props.captureMode);
}
}
};
2026-07-23 10:11:24 +00:00
let items = [obj, , , ];
2026-07-20 16:05:17 +00:00
obj = {
key: "componentDidUpdate",
value: function componentDidUpdate(captureMode) {
const self = this;
let tmp = undefined !== this.props.captureMode;
if (tmp) {
tmp = self.props.captureMode !== captureMode.captureMode;
}
if (tmp) {
self.syncCaptureLoop(self.props.captureMode);
}
if ("update" === self.props.captureMode) {
self.capture();
}
}
};
items[1] = obj;
obj = {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.syncCaptureLoop(null);
}
};
items[2] = obj;
items[3] = {
key: "render",
value: function render() {
2026-07-23 10:11:24 +00:00
return outer1_9(outer1_7, { ref: this.onRef, collapsable: false, onLayout: this.onLayout, style: this.props.style, children: this.props.children });
2026-07-20 16:05:17 +00:00
}
};
return callback(ViewShot, items);
2026-07-23 10:11:24 +00:00
})(require("result").Component);
2026-07-20 16:05:17 +00:00
tmp6.captureRef = captureRef;
tmp6.releaseCapture = releaseCapture;
export default tmp6;
export { ensureModuleIsLoaded };
export { captureRef };
export { releaseCapture };
export const captureScreen = function captureScreen(options) {
ensureModuleIsLoaded();
const tmp2 = validateOptions(options);
2026-07-27 11:26:19 +00:00
return importDefault(15302).captureScreen(tmp2.options);
2026-07-20 16:05:17 +00:00
};