// Module ID: 16599 // Function ID: 16600 // Dependencies: [41, 42, 93, 95, 98, 19, 17, 21, 16600] // Exports: captureScreen, ensureModuleIsLoaded // Module 16599 import _modDef16600 from "module_16600" /* 16600 */; import _classCallCheck from "_classCallCheck" /* 41 */; import _createClass from "_createClass" /* 42 */; import c3 from "_possibleConstructorReturn" /* 93 */; import _getPrototypeOf from "_getPrototypeOf" /* 95 */; import _inherits from "_inherits" /* 98 */; import noop from "module_19" /* 19 */; const ViewShot = importDefault; function _isNativeReflectConstruct() { try { const _Boolean = Boolean; const call = valueOf.call; const _Reflect = Reflect; const _Boolean2 = Boolean; if (typeof call === "unknown") { let callResult = valueOf(); } else { callResult = call(constructResult); } closure_0 = !callResult; _isNativeReflectConstruct = function _isNativeReflectConstruct() { return closure_0; }; return _isNativeReflectConstruct(); } catch (err) { } } function validateOptions(options) { options = {}; const merged = Object.assign(closure_12); const merged1 = Object.assign(options); let tmp6 = "width" in options; if (tmp6) { const width = options.width; let tmp7 = typeof width !== "number"; if (typeof width === "number") { tmp7 = options.width <= 0; } tmp6 = tmp7; } const errors = []; if (tmp6) { errors.push("option width should be a positive number"); delete tmp[tmp2]; } let tmp9 = "height" in options; if (tmp9) { const height = options.height; let tmp10 = typeof height !== "number"; if (typeof height === "number") { tmp10 = options.height <= 0; } tmp9 = tmp10; } if (tmp9) { errors.push("option height should be a positive number"); delete tmp[tmp2]; } const quality = options.quality; let tmp12 = typeof quality !== "number"; if (typeof quality === "number") { tmp12 = options.quality < 0; } if (!tmp12) { tmp12 = options.quality > 1; } if (tmp12) { errors.push("option quality should be a number between 0.0 and 1.0"); options.quality = tmp3.quality; } if (typeof options.snapshotContentContainer !== "boolean") { errors.push("option snapshotContentContainer should be a boolean"); } if (typeof options.handleGLSurfaceViewOnAndroid !== "boolean") { errors.push("option handleGLSurfaceViewOnAndroid should be a boolean"); } if (-1 === closure_10.indexOf(options.format)) { options.format = tmp3.format; const text = `option format '${size.format}`; errors.push(`${`option format '${size.format}`}' is not in valid formats: ${obj.join(" | ")}`); } if (-1 === closure_11.indexOf(options.result)) { options.result = tmp3.result; const text1 = `option result '${size.result}`; errors.push(`${`option result '${size.result}`}' is not in valid formats: ${obj2.join(" | ")}`); } return { options, errors }; } function captureRef(current, options) { if (ViewShot(16600)) { let tmp9 = current; if (current) { tmp9 = current; if (typeof current === "object") { tmp9 = current; if ("current" in current) { tmp9 = current; if (current.current) { if (!current.current) { const _Error2 = Error; const error = new Error("ref.current is null"); return Promise.reject(error); } } } } } let tmp15 = tmp9; if (typeof tmp9 !== "number") { tmp15 = timestampProducer(tmp9); if (!tmp15) { const _Error3 = Error; const _String = String; const error1 = new Error("findNodeHandle failed to resolve view=" + String(tmp9)); return Promise.reject(error1); } } ({ errors, options } = validateOptions(options)); const tmp23 = validateOptions(options); return tmp(16600).captureRef(tmp15, options); } else { const _Error = Error; const error2 = new Error("react-native-view-shot: NativeModules.RNViewShot is undefined. Make sure the library is linked on the native side."); throw error2; } tmp = ViewShot; } function releaseCapture(str) { if (typeof str === "string") { ViewShot(16600).releaseCapture(str); const obj = ViewShot(16600); } } get_ActivityIndicator = fn(17); ({ View: hasOwnProperty, Platform, findNodeHandle: metroRequire, StyleProp } = get_ActivityIndicator); const jsx = fn(21).jsx; const promise = new Promise(() => { }); if (!_modDef16600) { const _console = console; console.warn("react-native-view-shot: NativeModules.RNViewShot is undefined. Make sure the library is linked on the native side."); } let items = ["png", "jpg"]; function ensureModuleIsLoaded() { if (!ViewShot(16600)) { 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; } } let closure_10 = items.concat(["webm", "raw"]); let items1 = ["tmpfile", "base64", "data-uri"]; let closure_11 = items1.concat(["zip-base64"]); let closure_12 = { format: "png", quality: 1, result: "tmpfile", snapshotContentContainer: false, handleGLSurfaceViewOnAndroid: false }; class ViewShot { constructor() { self = this; items = [...arguments]; closure_0 = undefined; tmp = c2(this, ViewShot); items1 = [...items]; tmp2 = closure_4; obj = closure_4(ViewShot); tmp3 = closure_3; if (closure_8()) { tmp5 = globalThis; _Reflect = Reflect; constructResult = Reflect.construct(obj, items1, tmp2(self).constructor); } else { constructResult = obj.apply(self, items1); } tmp3Result = tmp3(self, constructResult); closure_0 = tmp3Result; promise = new Promise((resolveFirstLayout) => { closure_0.resolveFirstLayout = resolveFirstLayout; }); tmp3Result.firstLayoutPromise = promise; tmp3Result.capture = () => closure_0.firstLayoutPromise.then(() => { const root = closure_1_0.root; if (root) { let tmp2 = captureRef(root, tmp.props.options); } else { tmp2 = promise; } return tmp2; }).then((result) => { closure_1_0.onCapture(result); return result; }, (arg0) => { closure_1_0.onCaptureFailure(arg0); throw arg0; }); tmp3Result.onCapture = (lastCapturedURI) => { if (closure_0.root) { if (tmp.lastCapturedURI) { const _setTimeout = setTimeout; const timerId = setTimeout(releaseCapture, 500, tmp.lastCapturedURI); } tmp.lastCapturedURI = lastCapturedURI; const onCapture = tmp.props.onCapture; if (onCapture) { onCapture(lastCapturedURI); } } }; tmp3Result.onCaptureFailure = (arg0) => { if (closure_0.root) { const onCaptureFailure = closure_0.props.onCaptureFailure; if (onCaptureFailure) { onCaptureFailure(arg0); } } }; tmp3Result.syncCaptureLoop = (arg0) => { cancelAnimationFrame(lastCapturedURI._raf); if ("continuous" === arg0) { lastCapturedURI = "-"; function loop() { lastCapturedURI._raf = requestAnimationFrame(loop); if (lastCapturedURI !== lastCapturedURI.lastCapturedURI) { lastCapturedURI = obj.lastCapturedURI; obj.capture(); } } const _requestAnimationFrame = requestAnimationFrame; lastCapturedURI._raf = requestAnimationFrame(loop); } }; tmp3Result.onRef = (root) => { closure_0.root = root; }; tmp3Result.onLayout = (nativeEvent) => { const onLayout = closure_0.props.onLayout; const firstLayout = closure_0.resolveFirstLayout(nativeEvent.nativeEvent.layout); if (onLayout) { onLayout(nativeEvent); } }; return tmp3Result; } } _inherits(ViewShot, fn(19).Component); const entry = { key: "componentDidMount", value: function componentDidMount() { const self = this; if ("mount" === this.props.captureMode) { self.capture(); } else { self.syncCaptureLoop(self.props.captureMode); } } }; const items2 = [ entry, { 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(); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.syncCaptureLoop(null); } }, { key: "render", value: function render() { return {this.props.children}; } } ]; const importDefaultResultResult = _createClass(ViewShot, items2); importDefaultResultResult.captureRef = captureRef; importDefaultResultResult.releaseCapture = releaseCapture; export default importDefaultResultResult; export { ensureModuleIsLoaded }; export { captureRef }; export { releaseCapture }; export const captureScreen = function captureScreen(options) { if (ViewShot(16600)) { ({ errors, options } = validateOptions(options)); const tmp10 = validateOptions(options); return tmp(16600).captureScreen(options); } else { 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; } tmp = ViewShot; };