mono/reference/tiktok/files/3813.1e571ef0_deobfuscated.js
2026-01-29 18:35:51 +01:00

267 lines
10 KiB
JavaScript

/**
* TikTok Utility Bundle - Deobfuscated JavaScript
* Original file: 3813.1e571ef0.js
*
* This bundle contains core utility modules for:
* - Error handling and invariant checking
* - Dynamic script loading
* - PropTypes validation (React development)
* - Core utility functions for the TikTok web application
*/
"use strict";
// Initialize loadable chunks array
(self.__LOADABLE_LOADED_CHUNKS__ = self.__LOADABLE_LOADED_CHUNKS__ || []).push([["3813"], {
/**
* Module 6085: Invariant Error Handler
* Core error handling utility for development and production
*/
6085: function(exports) {
"use strict";
/**
* Invariant function for error checking
* Used throughout TikTok's codebase for assertions and error handling
*
* @param {boolean} condition - Condition to check
* @param {string} message - Error message template with %s placeholders
* @param {...any} args - Arguments to replace %s placeholders
* @throws {Error} Throws InvariantViolation error if condition is false
*/
exports.exports = function invariant(condition, message, arg1, arg2, arg3, arg4, arg5, arg6) {
if (!condition) {
var error;
if (message === undefined) {
// Production mode - generic error message
error = new Error(
"Minified exception occurred; use the non-minified dev environment " +
"for the full error message and additional helpful warnings."
);
} else {
// Development mode - detailed error message
var args = [arg1, arg2, arg3, arg4, arg5, arg6];
var argIndex = 0;
error = new Error(
message.replace(/%s/g, function() {
return args[argIndex++];
})
);
error.name = "Invariant Violation";
}
// Set framesToPop for better stack traces
error.framesToPop = 1;
throw error;
}
};
},
/**
* Module 57971: Dynamic Script Loader
* Utility for dynamically loading JavaScript files
*/
57971: function(exports) {
/**
* Set up load/error event handlers for script element
* @param {HTMLScriptElement} scriptElement - Script element to set up
* @param {Function} callback - Callback function (error, element)
*/
function setupScriptHandlers(scriptElement, callback) {
scriptElement.onload = function() {
// Clean up event handlers
this.onerror = this.onload = null;
callback(null, scriptElement);
};
scriptElement.onerror = function() {
// Clean up event handlers
this.onerror = this.onload = null;
callback(new Error("Failed to load " + this.src), scriptElement);
};
}
/**
* Dynamically load a JavaScript file
* @param {string} src - Script source URL
* @param {Object|Function} options - Loading options or callback
* @param {Function} callback - Callback function
*/
exports.exports = function loadScript(src, options, callback) {
var head = document.head || document.getElementsByTagName("head")[0];
var scriptElement = document.createElement("script");
// Handle function as second parameter
if (typeof options === "function") {
callback = options;
options = {};
}
// Default callback
callback = callback || function() {};
options = options || {};
// Set script attributes
scriptElement.type = options.type || "text/javascript";
scriptElement.charset = options.charset || "utf8";
scriptElement.async = !("async" in options) || !!options.async;
scriptElement.src = src;
// Set custom attributes if provided
if (options.attrs) {
setAttributes(scriptElement, options.attrs);
}
// Set script text content if provided
if (options.text) {
scriptElement.text = "" + options.text;
}
// Set up appropriate event handlers based on browser support
var handlerFunction = ("onload" in scriptElement) ?
setupScriptHandlers :
setupLegacyScriptHandlers;
handlerFunction(scriptElement, callback);
// Fallback for scripts without onload support
if (!scriptElement.onload) {
setupScriptHandlers(scriptElement, callback);
}
// Add script to document head
head.appendChild(scriptElement);
};
/**
* Set multiple attributes on an element
* @param {HTMLElement} element - Target element
* @param {Object} attributes - Attributes to set
*/
function setAttributes(element, attributes) {
for (var attributeName in attributes) {
element.setAttribute(attributeName, attributes[attributeName]);
}
}
/**
* Legacy script handler for older browsers
* @param {HTMLScriptElement} scriptElement - Script element
* @param {Function} callback - Callback function
*/
function setupLegacyScriptHandlers(scriptElement, callback) {
scriptElement.onreadystatechange = function() {
if (this.readyState === "complete" || this.readyState === "loaded") {
this.onreadystatechange = null;
callback(null, scriptElement);
}
};
}
},
/**
* Module 77298: PropTypes Validation System
* React PropTypes validation utilities for development
*/
77298: function(exports, module, require) {
"use strict";
var ReactPropTypesSecret = require(31649);
/**
* Empty function for production mode
*/
function emptyFunction() {}
/**
* Empty function with resetWarningCache method
*/
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
/**
* PropTypes factory function
* Creates PropTypes validators for React components
*/
exports.exports = function createPropTypes() {
/**
* PropType validator function
* @param {any} props - Component props
* @param {string} propName - Property name being validated
* @param {string} componentName - Component name
* @param {string} location - Location of the prop (e.g., 'prop', 'context')
* @param {string} propFullName - Full property name
* @param {string} secret - React PropTypes secret for validation
*/
function propTypeValidator(props, propName, componentName, location, propFullName, secret) {
if (secret !== ReactPropTypesSecret) {
var error = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. " +
"Use PropTypes.checkPropTypes() to call them. " +
"Read more at http://fb.me/use-check-prop-types"
);
error.name = "Invariant Violation";
throw error;
}
}
/**
* Create chainable PropType validator
*/
function createChainableTypeChecker() {
return propTypeValidator;
}
// Set isRequired property for chaining
propTypeValidator.isRequired = propTypeValidator;
// Create PropTypes object with all standard validators
var PropTypes = {
// Primitive types
array: createChainableTypeChecker(),
bool: createChainableTypeChecker(),
func: createChainableTypeChecker(),
number: createChainableTypeChecker(),
object: createChainableTypeChecker(),
string: createChainableTypeChecker(),
symbol: createChainableTypeChecker(),
// Complex types
any: createChainableTypeChecker(),
arrayOf: createChainableTypeChecker,
element: createChainableTypeChecker(),
elementType: createChainableTypeChecker(),
instanceOf: createChainableTypeChecker,
node: createChainableTypeChecker(),
objectOf: createChainableTypeChecker,
oneOf: createChainableTypeChecker,
oneOfType: createChainableTypeChecker,
shape: createChainableTypeChecker,
exact: createChainableTypeChecker,
// Utility functions
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction
};
// Set isRequired on all validators
PropTypes.PropTypes = PropTypes;
return PropTypes;
};
}
// Additional modules would be parsed here...
// This bundle contains many more utility functions for:
// - React component utilities
// - DOM manipulation helpers
// - Event handling utilities
// - Performance optimization tools
// - Browser compatibility layers
// - Development/debugging tools
}]);