UNPKG

sandstone-proxy

Version:

An experimental web proxy utilizing sandboxed iframes and no service worker.

20 lines (18 loc) 2.3 MB
/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ var proxy_host; /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./dist/frame.js": /*!***********************!*\ !*** ./dist/frame.js ***! \***********************/ /***/ ((module) => { eval("module.exports = \"/*\\n * ATTENTION: The \\\"eval\\\" devtool has been used (maybe by default in mode: \\\"development\\\").\\n * This devtool is neither made for production nor for readable output files.\\n * It uses \\\"eval()\\\" calls to create a separate source file in the browser devtools.\\n * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)\\n * or disable the default devtool with \\\"devtool: false\\\".\\n * If you are looking for production-ready output files, see mode: \\\"production\\\" (https://webpack.js.org/configuration/mode/).\\n */\\nvar proxy_frame;\\n/******/ (() => { // webpackBootstrap\\n/******/ \\t\\\"use strict\\\";\\n/******/ \\tvar __webpack_modules__ = ({\\n\\n/***/ \\\"./src/frame/context.mjs\\\":\\n/*!*******************************!*\\\\\\n !*** ./src/frame/context.mjs ***!\\n \\\\*******************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"convert_url\\\\\\\": () => (/* binding */ convert_url),\\\\n/* harmony export */ \\\\\\\"ctx\\\\\\\": () => (/* binding */ ctx),\\\\n/* harmony export */ \\\\\\\"intercept_property\\\\\\\": () => (/* binding */ intercept_property),\\\\n/* harmony export */ \\\\\\\"is_worker\\\\\\\": () => (/* binding */ is_worker),\\\\n/* harmony export */ \\\\\\\"proxy_function\\\\\\\": () => (/* binding */ proxy_function),\\\\n/* harmony export */ \\\\\\\"run_script\\\\\\\": () => (/* binding */ run_script),\\\\n/* harmony export */ \\\\\\\"run_script_safe\\\\\\\": () => (/* binding */ run_script_safe),\\\\n/* harmony export */ \\\\\\\"safe_script_template\\\\\\\": () => (/* binding */ safe_script_template),\\\\n/* harmony export */ \\\\\\\"update_ctx\\\\\\\": () => (/* binding */ update_ctx),\\\\n/* harmony export */ \\\\\\\"wrap_function\\\\\\\": () => (/* binding */ wrap_function),\\\\n/* harmony export */ \\\\\\\"wrap_obj\\\\\\\": () => (/* binding */ wrap_obj)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _network_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./network.mjs */ \\\\\\\"./src/frame/network.mjs\\\\\\\");\\\\n/* harmony import */ var _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./polyfill/index.mjs */ \\\\\\\"./src/frame/polyfill/index.mjs\\\\\\\");\\\\n/* harmony import */ var _intercept_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intercept/index.mjs */ \\\\\\\"./src/frame/intercept/index.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\n\\\\nconst is_worker = typeof importScripts === \\\\\\\"function\\\\\\\";\\\\nconst internal = {\\\\n location: null,\\\\n self: null,\\\\n globalThis: null,\\\\n eval: null,\\\\n history: null,\\\\n localStorage: null,\\\\n sessionStorage: null\\\\n};\\\\n\\\\nclass CustomCTX {\\\\n set location(value) {internal.location.assign(value)}\\\\n get location() {return internal.location}\\\\n\\\\n set self(value) {internal.self = value}\\\\n get self() {return internal.self}\\\\n set globalThis(value) {internal.globalThis = value}\\\\n get globalThis() {return internal.globalThis}\\\\n\\\\n get window() {return this}\\\\n get origin() {return this.location.origin}\\\\n get document() {return is_worker ? undefined : _intercept_index_mjs__WEBPACK_IMPORTED_MODULE_2__.document} \\\\n\\\\n fetch() {return _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.fetch(...arguments)}\\\\n get URL() {return _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.FakeURL}\\\\n get Worker() {return _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.FakeWorker}\\\\n get importScripts() {return is_worker ? _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.fakeImportScripts : undefined}\\\\n get XMLHttpRequest() {return _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.FakeXMLHttpRequest}\\\\n get history() {return internal.history}\\\\n\\\\n get localStorage() {return internal.localStorage}\\\\n get sessionStorage() {return internal.sessionStorage}\\\\n get WebSocket() {return _network_mjs__WEBPACK_IMPORTED_MODULE_0__.WebSocket}\\\\n}\\\\n\\\\nconst ctx = new CustomCTX();\\\\n\\\\nfunction proxy_function(target, key, apply_callback) {\\\\n if (!target) return;\\\\n target[key] = new Proxy(target[key], {apply: apply_callback});\\\\n}\\\\n\\\\nfunction wrap_function(key, wrapper, target) {\\\\n wrapper[key] = new Proxy(target[key], {\\\\n apply: function(func_target, this_arg, arguments_list) {\\\\n return Reflect.apply(func_target, target, arguments_list);\\\\n }\\\\n });\\\\n}\\\\n\\\\nfunction wrap_obj(wrapper, target) {\\\\n wrapper.__target__ = target;\\\\n let wrapper_proto = Object.getPrototypeOf(wrapper);\\\\n let target_keys = Reflect.ownKeys(target);\\\\n let target_proto = Object.getPrototypeOf(target);\\\\n while (target_proto != null) {\\\\n target_keys.push(...Reflect.ownKeys(target_proto));\\\\n target_proto = Object.getPrototypeOf(target_proto);\\\\n }\\\\n\\\\n let exclude = [\\\\\\\"eval\\\\\\\"];\\\\n for (let key of target_keys) {\\\\n if (wrapper_proto.hasOwnProperty(key)) continue;\\\\n if (key === \\\\\\\"__proto__\\\\\\\") continue;\\\\n if (exclude.includes(key)) continue;\\\\n try {\\\\n if (typeof target[key] === \\\\\\\"function\\\\\\\") {\\\\n wrap_function(key, wrapper, target);\\\\n continue;\\\\n }\\\\n try {\\\\n wrapper[key] = target[key];\\\\n }\\\\n catch {\\\\n Object.defineProperty(wrapper, key, {\\\\n configurable: true,\\\\n value: target[key],\\\\n writable: true\\\\n })\\\\n }\\\\n }\\\\n catch (e) {\\\\n if (e instanceof DOMException) continue;\\\\n if (e instanceof TypeError) continue;\\\\n }\\\\n }\\\\n}\\\\n\\\\nfunction update_ctx() {\\\\n internal.location = new _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.FakeLocation();\\\\n internal.self = ctx;\\\\n internal.globalThis = ctx;\\\\n internal.history = new _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.FakeHistory();\\\\n internal.localStorage = new _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.FakeStorage(\\\\\\\"local\\\\\\\");\\\\n internal.sessionStorage = new _polyfill_index_mjs__WEBPACK_IMPORTED_MODULE_1__.FakeStorage(\\\\\\\"session\\\\\\\");\\\\n\\\\n //wrap function calls\\\\n wrap_obj(ctx, globalThis);\\\\n delete ctx.eval;\\\\n\\\\n //wrap window events\\\\n for (let key of Reflect.ownKeys(globalThis)) {\\\\n if (!key.startsWith(\\\\\\\"on\\\\\\\")) continue;\\\\n Object.defineProperty(ctx, key, {\\\\n get: () => {return globalThis[key]},\\\\n set: (value) => {globalThis[key] = value}\\\\n });\\\\n }\\\\n}\\\\n\\\\nfunction convert_url(url, base) {\\\\n let url_obj = new URL(url, base);\\\\n return url_obj.href;\\\\n}\\\\n\\\\nfunction safe_script_template(js) {\\\\n return `\\\\n try {\\\\n ${js}\\\\n }\\\\n catch (__e__) {\\\\n console.error(__e__);\\\\n }\\\\n `;\\\\n}\\\\n\\\\nfunction run_script_safe(js, this_arg=ctx) {\\\\n run_script(safe_script_template(js), this_arg);\\\\n}\\\\n\\\\nfunction run_script(js, this_obj=ctx) {\\\\n return Reflect.apply(Function(\\\\\\\"globalThis\\\\\\\", `\\\\n with (globalThis) {\\\\n ${js}\\\\n }\\\\n `), this_obj, [ctx]);\\\\n}\\\\n\\\\nfunction intercept_property(target, key, handler) {\\\\n let descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(target), key);\\\\n if (!descriptor) return;\\\\n Object.defineProperty(target, key, handler);\\\\n return descriptor;\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/context.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/index.mjs\\\":\\n/*!*****************************!*\\\\\\n !*** ./src/frame/index.mjs ***!\\n \\\\*****************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"context\\\\\\\": () => (/* reexport module object */ _context_mjs__WEBPACK_IMPORTED_MODULE_2__),\\\\n/* harmony export */ \\\\\\\"loader\\\\\\\": () => (/* reexport module object */ _loader_mjs__WEBPACK_IMPORTED_MODULE_0__),\\\\n/* harmony export */ \\\\\\\"network\\\\\\\": () => (/* reexport module object */ _network_mjs__WEBPACK_IMPORTED_MODULE_1__),\\\\n/* harmony export */ \\\\\\\"rpc\\\\\\\": () => (/* reexport module object */ _rpc_mjs__WEBPACK_IMPORTED_MODULE_3__)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _loader_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./loader.mjs */ \\\\\\\"./src/frame/loader.mjs\\\\\\\");\\\\n/* harmony import */ var _network_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./network.mjs */ \\\\\\\"./src/frame/network.mjs\\\\\\\");\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n/* harmony import */ var _rpc_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../rpc.mjs */ \\\\\\\"./src/rpc.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n_rpc_mjs__WEBPACK_IMPORTED_MODULE_3__.set_role(\\\\\\\"frame\\\\\\\");\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/index.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/intercept/document.mjs\\\":\\n/*!******************************************!*\\\\\\n !*** ./src/frame/intercept/document.mjs ***!\\n \\\\******************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"custom_document\\\\\\\": () => (/* binding */ custom_document)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n\\\\n\\\\nconst internal = {\\\\n currentScript: null,\\\\n activeElement: null\\\\n}\\\\n\\\\nclass CustomDocument {\\\\n get cookie() {return \\\\\\\"\\\\\\\"}\\\\n set cookie(value) {}\\\\n get body() {return this.__target__.body}\\\\n get location() {return _context_mjs__WEBPACK_IMPORTED_MODULE_0__.ctx.location}\\\\n get URL() {return _context_mjs__WEBPACK_IMPORTED_MODULE_0__.ctx.location.href}\\\\n get currentScript() {return internal.currentScript}\\\\n set currentScript(value) {internal.currentScript = value}\\\\n get activeElement() {return internal.activeElement || document.body}\\\\n set activeElement(value) {internal.activeElement = value;}\\\\n\\\\n createElement(tag_name, options) {\\\\n return this.__target__.createElement(tag_name, options);\\\\n }\\\\n}\\\\n\\\\nconst custom_document = new CustomDocument();\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/intercept/document.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/intercept/dom.mjs\\\":\\n/*!*************************************!*\\\\\\n !*** ./src/frame/intercept/dom.mjs ***!\\n \\\\*************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony import */ var _rewrite_index_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../rewrite/index.mjs */ \\\\\\\"./src/frame/rewrite/index.mjs\\\\\\\");\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\nfunction handle_append(element) {\\\\n _rewrite_index_mjs__WEBPACK_IMPORTED_MODULE_0__.element(element);\\\\n}\\\\n\\\\n(0,_context_mjs__WEBPACK_IMPORTED_MODULE_1__.proxy_function)(globalThis?.HTMLElement?.prototype, \\\\\\\"append\\\\\\\", (target, this_arg, args) => {\\\\n handle_append(args[0]);\\\\n return Reflect.apply(target, this_arg, args);\\\\n})\\\\n\\\\n;(0,_context_mjs__WEBPACK_IMPORTED_MODULE_1__.proxy_function)(globalThis?.HTMLElement?.prototype, \\\\\\\"appendChild\\\\\\\", (target, this_arg, args) => {\\\\n handle_append(args[0]);\\\\n return Reflect.apply(target, this_arg, args);\\\\n})\\\\n\\\\n;(0,_context_mjs__WEBPACK_IMPORTED_MODULE_1__.proxy_function)(globalThis?.HTMLElement?.prototype, \\\\\\\"insertBefore\\\\\\\", (target, this_arg, args) => {\\\\n handle_append(args[0]);\\\\n return Reflect.apply(target, this_arg, args);\\\\n})\\\\n\\\\n;(0,_context_mjs__WEBPACK_IMPORTED_MODULE_1__.proxy_function)(globalThis?.HTMLElement?.prototype, \\\\\\\"replaceChild\\\\\\\", (target, this_arg, args) => {\\\\n handle_append(args[0]);\\\\n return Reflect.apply(target, this_arg, args);\\\\n})\\\\n\\\\nif (globalThis.Image) {\\\\n globalThis.Image = new Proxy(globalThis.Image, {\\\\n construct(target, args) {\\\\n let ret = Reflect.construct(target, args);\\\\n _rewrite_index_mjs__WEBPACK_IMPORTED_MODULE_0__.element(ret);\\\\n return ret;\\\\n }\\\\n });\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/intercept/dom.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/intercept/index.mjs\\\":\\n/*!***************************************!*\\\\\\n !*** ./src/frame/intercept/index.mjs ***!\\n \\\\***************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"document\\\\\\\": () => (/* reexport safe */ _document_mjs__WEBPACK_IMPORTED_MODULE_0__.custom_document),\\\\n/* harmony export */ \\\\\\\"dom\\\\\\\": () => (/* reexport module object */ _dom_mjs__WEBPACK_IMPORTED_MODULE_1__),\\\\n/* harmony export */ \\\\\\\"mutation_observer\\\\\\\": () => (/* reexport module object */ _mutation_observer_mjs__WEBPACK_IMPORTED_MODULE_3__),\\\\n/* harmony export */ \\\\\\\"navigator\\\\\\\": () => (/* reexport module object */ _navigator_mjs__WEBPACK_IMPORTED_MODULE_2__)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _document_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./document.mjs */ \\\\\\\"./src/frame/intercept/document.mjs\\\\\\\");\\\\n/* harmony import */ var _dom_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom.mjs */ \\\\\\\"./src/frame/intercept/dom.mjs\\\\\\\");\\\\n/* harmony import */ var _navigator_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./navigator.mjs */ \\\\\\\"./src/frame/intercept/navigator.mjs\\\\\\\");\\\\n/* harmony import */ var _mutation_observer_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mutation_observer.mjs */ \\\\\\\"./src/frame/intercept/mutation_observer.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/intercept/index.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/intercept/mutation_observer.mjs\\\":\\n/*!***************************************************!*\\\\\\n !*** ./src/frame/intercept/mutation_observer.mjs ***!\\n \\\\***************************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n\\\\n\\\\nif (typeof MutationObserver !== \\\\\\\"undefined\\\\\\\") {\\\\n MutationObserver.prototype.observe = new Proxy(MutationObserver.prototype.observe, {\\\\n apply: (target, this_arg, args) => {\\\\n if (args[0] === _context_mjs__WEBPACK_IMPORTED_MODULE_0__.ctx.document)\\\\n args[0] = _context_mjs__WEBPACK_IMPORTED_MODULE_0__.ctx.document.documentElement;\\\\n return Reflect.apply(target, this_arg, args);\\\\n }\\\\n })\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/intercept/mutation_observer.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/intercept/navigator.mjs\\\":\\n/*!*******************************************!*\\\\\\n !*** ./src/frame/intercept/navigator.mjs ***!\\n \\\\*******************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\nif (typeof Navigator !== \\\\\\\"undefined\\\\\\\")\\\\n Navigator.prototype.sendBeacon = () => {}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/intercept/navigator.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/loader.mjs\\\":\\n/*!******************************!*\\\\\\n !*** ./src/frame/loader.mjs ***!\\n \\\\******************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"frame_id\\\\\\\": () => (/* binding */ frame_id),\\\\n/* harmony export */ \\\\\\\"is_loaded\\\\\\\": () => (/* binding */ is_loaded),\\\\n/* harmony export */ \\\\\\\"local_storage\\\\\\\": () => (/* binding */ local_storage),\\\\n/* harmony export */ \\\\\\\"navigate\\\\\\\": () => (/* binding */ navigate),\\\\n/* harmony export */ \\\\\\\"runtime_src\\\\\\\": () => (/* binding */ runtime_src),\\\\n/* harmony export */ \\\\\\\"set_frame_id\\\\\\\": () => (/* binding */ set_frame_id),\\\\n/* harmony export */ \\\\\\\"set_url\\\\\\\": () => (/* binding */ set_url),\\\\n/* harmony export */ \\\\\\\"url\\\\\\\": () => (/* binding */ url)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../rpc.mjs */ \\\\\\\"./src/rpc.mjs\\\\\\\");\\\\n/* harmony import */ var _rewrite_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rewrite/index.mjs */ \\\\\\\"./src/frame/rewrite/index.mjs\\\\\\\");\\\\n/* harmony import */ var _network_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./network.mjs */ \\\\\\\"./src/frame/network.mjs\\\\\\\");\\\\n/* harmony import */ var _intercept_document_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intercept/document.mjs */ \\\\\\\"./src/frame/intercept/document.mjs\\\\\\\");\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n/* harmony import */ var _rewrite_script_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./rewrite/script.mjs */ \\\\\\\"./src/frame/rewrite/script.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\nconst navigate = _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.create_rpc_wrapper(\\\\\\\"parent\\\\\\\", \\\\\\\"navigate\\\\\\\");\\\\nconst local_storage = _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.create_rpc_wrapper(\\\\\\\"parent\\\\\\\", \\\\\\\"local_storage\\\\\\\");\\\\n\\\\nconst runtime_src = self.document?.currentScript?.innerHTML;\\\\nlet url; //the proxied page url\\\\nlet frame_id; //the current frame id\\\\nlet is_loaded = false;\\\\n\\\\nfunction evaluate_scripts() {\\\\n let script_elements = document.getElementsByTagName(\\\\\\\"script\\\\\\\");\\\\n let script_strings = [];\\\\n\\\\n for (let i = 0; i < script_elements.length; i++) {\\\\n let script_element = script_elements[i];\\\\n\\\\n if (script_element.hasAttribute(\\\\\\\"__script_id\\\\\\\")) {\\\\n let script_id = script_element.getAttribute(\\\\\\\"__script_id\\\\\\\");\\\\n script_strings.push([script_id, _rewrite_script_mjs__WEBPACK_IMPORTED_MODULE_5__.pending_scripts[script_id]]);\\\\n delete _rewrite_script_mjs__WEBPACK_IMPORTED_MODULE_5__.pending_scripts[script_id];\\\\n }\\\\n else if ((0,_rewrite_script_mjs__WEBPACK_IMPORTED_MODULE_5__.should_load)(script_element)) {\\\\n script_strings.push([script_id, script_element.innerHTML]);\\\\n }\\\\n }\\\\n \\\\n let wrapped_scripts = [];\\\\n for (let [script_id, script] of script_strings) {\\\\n let script_part = `\\\\n document.currentScript = document.querySelector(\\\\\\\"script[__script_id='${script_id}']\\\\\\\");\\\\n ${(0,_context_mjs__WEBPACK_IMPORTED_MODULE_4__.safe_script_template)(script)}\\\\n document.currentScript = null;\\\\n `;\\\\n wrapped_scripts.push(script_part);\\\\n }\\\\n (0,_context_mjs__WEBPACK_IMPORTED_MODULE_4__.run_script)(wrapped_scripts.join(\\\\\\\"\\\\\\\\n\\\\\\\\n\\\\\\\"));\\\\n}\\\\n\\\\nfunction set_frame_id(id) {\\\\n frame_id = id;\\\\n}\\\\nfunction set_url(_url) {\\\\n url = _url;\\\\n}\\\\n\\\\nasync function load_html(options) {\\\\n _network_mjs__WEBPACK_IMPORTED_MODULE_2__.known_urls[location.href] = options.url;\\\\n _network_mjs__WEBPACK_IMPORTED_MODULE_2__.enable_network();\\\\n set_url(options.url);\\\\n set_frame_id(options.frame_id);\\\\n (0,_context_mjs__WEBPACK_IMPORTED_MODULE_4__.update_ctx)();\\\\n\\\\n if (options.error) {\\\\n document.getElementById(\\\\\\\"loading_text\\\\\\\").style.display = \\\\\\\"none\\\\\\\";\\\\n document.getElementById(\\\\\\\"error_div\\\\\\\").style.display = \\\\\\\"initial\\\\\\\";\\\\n document.getElementById(\\\\\\\"error_msg\\\\\\\").innerText = options.error;\\\\n document.getElementById(\\\\\\\"version_text\\\\\\\").innerText = `Sandstone v${options.version.ver} (${options.version.hash})`;\\\\n return;\\\\n }\\\\n\\\\n //load local storage\\\\n if (options.local_storage) {\\\\n for (let [key, value] of options.local_storage) {\\\\n _context_mjs__WEBPACK_IMPORTED_MODULE_4__.ctx.localStorage.setItem(key, value);\\\\n }\\\\n }\\\\n\\\\n let parser = new DOMParser();\\\\n let html = parser.parseFromString(options.html, \\\\\\\"text/html\\\\\\\"); \\\\n \\\\n //rewrite all html elements\\\\n await _rewrite_index_mjs__WEBPACK_IMPORTED_MODULE_1__.element(html.documentElement);\\\\n\\\\n //add handler for navigation\\\\n document.addEventListener(\\\\\\\"click\\\\\\\", (event) => {\\\\n if (event.defaultPrevented) return;\\\\n let element = event.target;\\\\n while (element && !(element instanceof HTMLAnchorElement)) {\\\\n element = element.parentElement;\\\\n }\\\\n if (!element) return;\\\\n \\\\n let original_href = (0,_context_mjs__WEBPACK_IMPORTED_MODULE_4__.convert_url)(element.href, _context_mjs__WEBPACK_IMPORTED_MODULE_4__.ctx.location.href);\\\\n navigate(frame_id, original_href);\\\\n event.preventDefault();\\\\n event.stopImmediatePropagation();\\\\n });\\\\n\\\\n //parse elements with ids and add them to the scope\\\\n let id_elements = html.querySelectorAll(\\\\\\\"*[id]\\\\\\\");\\\\n let ctx_proto = Object.getPrototypeOf(_context_mjs__WEBPACK_IMPORTED_MODULE_4__.ctx);\\\\n for (let i = 0; i < id_elements.length; i++) {\\\\n let element = id_elements[i];\\\\n if (ctx_proto.hasOwnProperty(element.id)) continue;\\\\n _context_mjs__WEBPACK_IMPORTED_MODULE_4__.ctx[element.id] = element;\\\\n }\\\\n\\\\n //apply the rewritten html\\\\n console.log(\\\\\\\"done downloading page\\\\\\\");\\\\n document.documentElement.replaceWith(html.documentElement);\\\\n (0,_context_mjs__WEBPACK_IMPORTED_MODULE_4__.wrap_obj)(_intercept_document_mjs__WEBPACK_IMPORTED_MODULE_3__.custom_document, document);\\\\n evaluate_scripts();\\\\n\\\\n //trigger load events\\\\n is_loaded = true;\\\\n _context_mjs__WEBPACK_IMPORTED_MODULE_4__.ctx.document.dispatchEvent(new Event(\\\\\\\"DOMContentLoaded\\\\\\\"));\\\\n _context_mjs__WEBPACK_IMPORTED_MODULE_4__.ctx.document.dispatchEvent(new Event(\\\\\\\"load\\\\\\\"));\\\\n _context_mjs__WEBPACK_IMPORTED_MODULE_4__.ctx.dispatchEvent(new Event(\\\\\\\"load\\\\\\\"));\\\\n}\\\\n\\\\nasync function get_favicon() {\\\\n var favicon_url = \\\\\\\"/favicon.ico\\\\\\\";\\\\n var link_elements = document.getElementsByTagName(\\\\\\\"link\\\\\\\");\\\\n for (var i = 0; i < link_elements.length; i++) {\\\\n let link = link_elements[i];\\\\n if (link.getAttribute(\\\\\\\"rel\\\\\\\") === \\\\\\\"icon\\\\\\\") \\\\n favicon_url = link.getAttribute(\\\\\\\"href\\\\\\\");\\\\n if (link.getAttribute(\\\\\\\"rel\\\\\\\") === \\\\\\\"shortcut icon\\\\\\\") \\\\n favicon_url = link.getAttribute(\\\\\\\"href\\\\\\\");\\\\n }\\\\n\\\\n let response = await _network_mjs__WEBPACK_IMPORTED_MODULE_2__.fetch(favicon_url);\\\\n if (!response.ok) return null;\\\\n return await response.blob();\\\\n}\\\\n\\\\n_rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.rpc_handlers.html = load_html;\\\\n_rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.rpc_handlers.favicon = get_favicon;\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/loader.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/network.mjs\\\":\\n/*!*******************************!*\\\\\\n !*** ./src/frame/network.mjs ***!\\n \\\\*******************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"WebSocket\\\\\\\": () => (/* binding */ WebSocket),\\\\n/* harmony export */ \\\\\\\"cache_put\\\\\\\": () => (/* binding */ cache_put),\\\\n/* harmony export */ \\\\\\\"create_blob_url\\\\\\\": () => (/* binding */ create_blob_url),\\\\n/* harmony export */ \\\\\\\"enable_network\\\\\\\": () => (/* binding */ enable_network),\\\\n/* harmony export */ \\\\\\\"fetch\\\\\\\": () => (/* binding */ fetch),\\\\n/* harmony export */ \\\\\\\"known_urls\\\\\\\": () => (/* binding */ known_urls),\\\\n/* harmony export */ \\\\\\\"requests_allowed\\\\\\\": () => (/* binding */ requests_allowed),\\\\n/* harmony export */ \\\\\\\"resource_cache\\\\\\\": () => (/* binding */ resource_cache),\\\\n/* harmony export */ \\\\\\\"rpc_fetch\\\\\\\": () => (/* binding */ rpc_fetch),\\\\n/* harmony export */ \\\\\\\"rpc_ws_close\\\\\\\": () => (/* binding */ rpc_ws_close),\\\\n/* harmony export */ \\\\\\\"rpc_ws_event\\\\\\\": () => (/* binding */ rpc_ws_event),\\\\n/* harmony export */ \\\\\\\"rpc_ws_new\\\\\\\": () => (/* binding */ rpc_ws_new),\\\\n/* harmony export */ \\\\\\\"rpc_ws_send\\\\\\\": () => (/* binding */ rpc_ws_send)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../rpc.mjs */ \\\\\\\"./src/rpc.mjs\\\\\\\");\\\\n/* harmony import */ var _loader_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./loader.mjs */ \\\\\\\"./src/frame/loader.mjs\\\\\\\");\\\\n/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util.mjs */ \\\\\\\"./src/util.mjs\\\\\\\");\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\n\\\\n\\\\nconst rpc_fetch = _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.create_rpc_wrapper(\\\\\\\"parent\\\\\\\", \\\\\\\"fetch\\\\\\\");\\\\nconst rpc_ws_new = _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.create_rpc_wrapper(\\\\\\\"parent\\\\\\\", \\\\\\\"ws_new\\\\\\\");\\\\nconst rpc_ws_event = _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.create_rpc_wrapper(\\\\\\\"parent\\\\\\\", \\\\\\\"ws_event\\\\\\\");\\\\nconst rpc_ws_send = _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.create_rpc_wrapper(\\\\\\\"parent\\\\\\\", \\\\\\\"ws_send\\\\\\\");\\\\nconst rpc_ws_close = _rpc_mjs__WEBPACK_IMPORTED_MODULE_0__.create_rpc_wrapper(\\\\\\\"parent\\\\\\\", \\\\\\\"ws_close\\\\\\\");\\\\n\\\\nconst known_urls = {};\\\\nconst resource_cache = {};\\\\nlet requests_allowed = false;\\\\n\\\\nfunction enable_network(allowed=true) {\\\\n requests_allowed = allowed;\\\\n}\\\\n\\\\nfunction cache_put(url, data) {\\\\n resource_cache[url] = data; //put a blob into the cache\\\\n}\\\\n\\\\nasync function fetch(url, options) {\\\\n if (!requests_allowed) throw \\\\\\\"Network request blocked\\\\\\\";\\\\n\\\\n let base_url = _context_mjs__WEBPACK_IMPORTED_MODULE_3__.ctx.location?.href || _loader_mjs__WEBPACK_IMPORTED_MODULE_1__.url;\\\\n url = new URL(url, base_url);\\\\n if (url.protocol === \\\\\\\"data:\\\\\\\" || url.protocol === \\\\\\\"blob:\\\\\\\") {\\\\n return await globalThis.fetch(url.href, options);\\\\n }\\\\n if (url.protocol !== \\\\\\\"http:\\\\\\\" && url.protocol !== \\\\\\\"https:\\\\\\\") {\\\\n throw TypeError(\\\\\\\"Invalid URL\\\\\\\");\\\\n }\\\\n\\\\n let fetch_data = await rpc_fetch(url.href, options);\\\\n let response = new Response(fetch_data.body);\\\\n for (let key in fetch_data.items) {\\\\n Object.defineProperty(response, key, {\\\\n value: fetch_data.items[key]\\\\n });\\\\n }\\\\n\\\\n let headers = new Headers();\\\\n for (let [key, value] of fetch_data.headers) {\\\\n headers.append(key, value)\\\\n }\\\\n Object.defineProperty(response, \\\\\\\"headers\\\\\\\", {\\\\n value: headers\\\\n });\\\\n\\\\n return response;\\\\n};\\\\n\\\\nfunction create_blob_url(blob, target_url = null) {\\\\n let url = URL.createObjectURL(blob);\\\\n if (target_url)\\\\n known_urls[url] = target_url;\\\\n return url;\\\\n}\\\\n\\\\nclass WebSocket extends EventTarget {\\\\n #ws_id;\\\\n\\\\n constructor(url, protocols=[]) {\\\\n super();\\\\n\\\\n this.url = url;\\\\n this.protocols = protocols;\\\\n this.binaryType = \\\\\\\"blob\\\\\\\";\\\\n this.bufferedAmount = 0;\\\\n\\\\n //legacy event handlers\\\\n this.onopen = () => {};\\\\n this.onerror = () => {};\\\\n this.onmessage = () => {};\\\\n this.onclose = () => {};\\\\n\\\\n this.CONNECTING = 0;\\\\n this.OPEN = 1;\\\\n this.CLOSING = 2;\\\\n this.CLOSED = 3;\\\\n this.status = this.CONNECTING;\\\\n\\\\n this.#ws_id = null;\\\\n this.#connect();\\\\n }\\\\n\\\\n async #connect() {\\\\n this.#ws_id = await rpc_ws_new(_loader_mjs__WEBPACK_IMPORTED_MODULE_1__.frame_id, this.url, this.protocols, {\\\\n headers: {\\\\\\\"Origin\\\\\\\": _context_mjs__WEBPACK_IMPORTED_MODULE_3__.ctx.location.origin}\\\\n });\\\\n this.#event_loop();\\\\n }\\\\n\\\\n async #event_loop() {\\\\n while (true) {\\\\n let events = await rpc_ws_event(_loader_mjs__WEBPACK_IMPORTED_MODULE_1__.frame_id, this.#ws_id);\\\\n if (!events) break;\\\\n for (let [event_name, data] of events) {\\\\n this.#forward_event(event_name, data);\\\\n }\\\\n }\\\\n }\\\\n\\\\n #forward_event(event_name, data) {\\\\n if (event_name === \\\\\\\"open\\\\\\\") {\\\\n this.status = this.OPEN;\\\\n this.#dispatch_event(new Event(\\\\\\\"open\\\\\\\"));\\\\n }\\\\n else if (event_name === \\\\\\\"close\\\\\\\") {\\\\n this.status = this.CLOSED;\\\\n this.#dispatch_event(new CloseEvent(\\\\\\\"close\\\\\\\"));\\\\n }\\\\n else if (event_name === \\\\\\\"message\\\\\\\") {\\\\n let converted;\\\\n if (typeof data === \\\\\\\"string\\\\\\\")\\\\n converted = data;\\\\n else if (this.binaryType == \\\\\\\"arraybuffer\\\\\\\") \\\\n converted = data.buffer;\\\\n else \\\\n converted = new Blob([data]);\\\\n this.#dispatch_event(new MessageEvent(\\\\\\\"message\\\\\\\", {data: converted}));\\\\n }\\\\n else if (event_name === \\\\\\\"error\\\\\\\") {\\\\n this.#dispatch_event(new Event(\\\\\\\"error\\\\\\\"));\\\\n }\\\\n }\\\\n\\\\n #dispatch_event(event) {\\\\n try {\\\\n this[\\\\\\\"on\\\\\\\" + event.type](event);\\\\n }\\\\n catch (e) {\\\\n console.error(e);\\\\n }\\\\n this.dispatchEvent(event);\\\\n }\\\\n\\\\n send(data) {\\\\n if (this.status === this.CONNECTING) {\\\\n throw new DOMException(\\\\\\\"Websocket not ready yet.\\\\\\\");\\\\n }\\\\n if (this.status === this.CLOSED) {\\\\n return;\\\\n }\\\\n\\\\n if (data instanceof Blob) {\\\\n (async () => {\\\\n let array_buffer = await data.arrayBuffer();\\\\n this.send(new Uint8Array(array_buffer));\\\\n })();\\\\n }\\\\n else if (typeof data === \\\\\\\"string\\\\\\\") {\\\\n rpc_ws_send(_loader_mjs__WEBPACK_IMPORTED_MODULE_1__.frame_id, this.#ws_id, data);\\\\n }\\\\n else {\\\\n let converted = _util_mjs__WEBPACK_IMPORTED_MODULE_2__.data_to_array(data);\\\\n rpc_ws_send(_loader_mjs__WEBPACK_IMPORTED_MODULE_1__.frame_id, this.#ws_id, converted);\\\\n }\\\\n }\\\\n\\\\n close() {\\\\n this.status = this.CLOSING;\\\\n rpc_ws_close(_loader_mjs__WEBPACK_IMPORTED_MODULE_1__.frame_id, this.#ws_id);\\\\n }\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/network.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/polyfill/fetch.mjs\\\":\\n/*!**************************************!*\\\\\\n !*** ./src/frame/polyfill/fetch.mjs ***!\\n \\\\**************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"fetch\\\\\\\": () => (/* binding */ fetch)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n/* harmony import */ var _network_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../network.mjs */ \\\\\\\"./src/frame/network.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\nasync function fetch(resource, params={}) {\\\\n console.log(\\\\\\\"DEBUG fetch\\\\\\\", resource, params);\\\\n //parse resources and convert to a friendly form\\\\n let url = resource;\\\\n if (resource instanceof Request) {\\\\n url = resource.url;\\\\n params.body = params.body || await resource.blob();\\\\n params.headers = params.headers || Object.fromEntries(resource.headers);\\\\n params.method = params.method || resource.method;\\\\n }\\\\n url = (new URL(url, _context_mjs__WEBPACK_IMPORTED_MODULE_0__.ctx.location.href)).href;\\\\n if (params.body instanceof ReadableStream) {\\\\n params.duplex = \\\\\\\"half\\\\\\\";\\\\n }\\\\n if (params.signal) //abortsignal cant be cloned\\\\n delete params.signal;\\\\n\\\\n //figure out the request body\\\\n let request_obj = new Request(\\\\\\\"http://127.0.0.1/\\\\\\\", params);\\\\n let array_buffer = await request_obj.arrayBuffer();\\\\n params.body = array_buffer.byteLength ? array_buffer : undefined;\\\\n\\\\n //perform the request\\\\n return await _network_mjs__WEBPACK_IMPORTED_MODULE_1__.fetch(url, params);\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/polyfill/fetch.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/polyfill/history.mjs\\\":\\n/*!****************************************!*\\\\\\n !*** ./src/frame/polyfill/history.mjs ***!\\n \\\\****************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"FakeHistory\\\\\\\": () => (/* binding */ FakeHistory)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _loader_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../loader.mjs */ \\\\\\\"./src/frame/loader.mjs\\\\\\\");\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n/* harmony import */ var _location_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./location.mjs */ \\\\\\\"./src/frame/polyfill/location.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\n\\\\nclass FakeHistory {\\\\n #state;\\\\n #url;\\\\n scrollRestoration = \\\\\\\"auto\\\\\\\";\\\\n\\\\n get length() {return 1}\\\\n get state() {return this.#state}\\\\n\\\\n back() {}\\\\n forward() {}\\\\n go() {}\\\\n \\\\n pushState(state, unused, url) {\\\\n this.#state = state;\\\\n this.#url = url;\\\\n let full_url = (0,_context_mjs__WEBPACK_IMPORTED_MODULE_1__.convert_url)(url, _context_mjs__WEBPACK_IMPORTED_MODULE_1__.ctx.location.href);\\\\n _location_mjs__WEBPACK_IMPORTED_MODULE_2__.internal.href = full_url;\\\\n _loader_mjs__WEBPACK_IMPORTED_MODULE_0__.navigate(_loader_mjs__WEBPACK_IMPORTED_MODULE_0__.frame_id, full_url, false);\\\\n }\\\\n\\\\n replaceState(state, unused, url) {\\\\n this.pushState(state, unused, url);\\\\n }\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/polyfill/history.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/polyfill/index.mjs\\\":\\n/*!**************************************!*\\\\\\n !*** ./src/frame/polyfill/index.mjs ***!\\n \\\\**************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"FakeHistory\\\\\\\": () => (/* reexport safe */ _history_mjs__WEBPACK_IMPORTED_MODULE_2__.FakeHistory),\\\\n/* harmony export */ \\\\\\\"FakeLocation\\\\\\\": () => (/* reexport safe */ _location_mjs__WEBPACK_IMPORTED_MODULE_0__.FakeLocation),\\\\n/* harmony export */ \\\\\\\"FakeStorage\\\\\\\": () => (/* reexport safe */ _storage_mjs__WEBPACK_IMPORTED_MODULE_3__.FakeStorage),\\\\n/* harmony export */ \\\\\\\"FakeURL\\\\\\\": () => (/* reexport safe */ _url_mjs__WEBPACK_IMPORTED_MODULE_1__.FakeURL),\\\\n/* harmony export */ \\\\\\\"FakeWorker\\\\\\\": () => (/* reexport safe */ _worker_mjs__WEBPACK_IMPORTED_MODULE_4__.FakeWorker),\\\\n/* harmony export */ \\\\\\\"FakeXMLHttpRequest\\\\\\\": () => (/* reexport safe */ _xhr_mjs__WEBPACK_IMPORTED_MODULE_6__.FakeXMLHttpRequest),\\\\n/* harmony export */ \\\\\\\"fakeImportScripts\\\\\\\": () => (/* reexport safe */ _worker_mjs__WEBPACK_IMPORTED_MODULE_4__.fakeImportScripts),\\\\n/* harmony export */ \\\\\\\"fetch\\\\\\\": () => (/* reexport safe */ _fetch_mjs__WEBPACK_IMPORTED_MODULE_5__.fetch)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _location_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./location.mjs */ \\\\\\\"./src/frame/polyfill/location.mjs\\\\\\\");\\\\n/* harmony import */ var _url_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./url.mjs */ \\\\\\\"./src/frame/polyfill/url.mjs\\\\\\\");\\\\n/* harmony import */ var _history_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./history.mjs */ \\\\\\\"./src/frame/polyfill/history.mjs\\\\\\\");\\\\n/* harmony import */ var _storage_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./storage.mjs */ \\\\\\\"./src/frame/polyfill/storage.mjs\\\\\\\");\\\\n/* harmony import */ var _worker_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./worker.mjs */ \\\\\\\"./src/frame/polyfill/worker.mjs\\\\\\\");\\\\n/* harmony import */ var _fetch_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fetch.mjs */ \\\\\\\"./src/frame/polyfill/fetch.mjs\\\\\\\");\\\\n/* harmony import */ var _xhr_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./xhr.mjs */ \\\\\\\"./src/frame/polyfill/xhr.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/polyfill/index.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/polyfill/location.mjs\\\":\\n/*!*****************************************!*\\\\\\n !*** ./src/frame/polyfill/location.mjs ***!\\n \\\\*****************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"FakeLocation\\\\\\\": () => (/* binding */ FakeLocation),\\\\n/* harmony export */ \\\\\\\"internal\\\\\\\": () => (/* binding */ internal)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _loader_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../loader.mjs */ \\\\\\\"./src/frame/loader.mjs\\\\\\\");\\\\n\\\\n\\\\nlet internal = null;\\\\n\\\\nclass FakeLocation {\\\\n constructor() {\\\\n internal = new URL(_loader_mjs__WEBPACK_IMPORTED_MODULE_0__.url);\\\\n \\\\n for (let key in internal) {\\\\n if (typeof key === \\\\\\\"function\\\\\\\") continue;\\\\n\\\\n Object.defineProperty(this, key, {\\\\n get: () => {\\\\n return internal[key];\\\\n },\\\\n set: (value) => {\\\\n if (key === \\\\\\\"href\\\\\\\") {\\\\n this.assign(value);\\\\n return;\\\\n }\\\\n internal[key] = value;\\\\n this.assign(internal.href);\\\\n }\\\\n })\\\\n }\\\\n }\\\\n\\\\n assign(url) {\\\\n internal = new URL(url, internal);\\\\n _loader_mjs__WEBPACK_IMPORTED_MODULE_0__.navigate(_loader_mjs__WEBPACK_IMPORTED_MODULE_0__.frame_id, internal.href);\\\\n }\\\\n replace(url) {\\\\n this.assign(url);\\\\n }\\\\n reload() {\\\\n this.assign(this.href);\\\\n }\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/polyfill/location.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/polyfill/storage.mjs\\\":\\n/*!****************************************!*\\\\\\n !*** ./src/frame/polyfill/storage.mjs ***!\\n \\\\****************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"FakeStorage\\\\\\\": () => (/* binding */ FakeStorage)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _loader_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../loader.mjs */ \\\\\\\"./src/frame/loader.mjs\\\\\\\");\\\\n\\\\n\\\\nclass FakeStorage {\\\\n #map;\\\\n #mode;\\\\n #pending_sync;\\\\n\\\\n constructor(mode) {\\\\n this.#map = new Map();\\\\n this.#mode = mode;\\\\n this.#pending_sync = false;\\\\n\\\\n return new Proxy(this, {\\\\n get: (target, key, receiver) => {\\\\n if (typeof this[key] === \\\\\\\"function\\\\\\\")\\\\n return this[key].bind(this);\\\\n if (this.#map.has(key)) \\\\n return this.#map.get(key);\\\\n return this[key];\\\\n },\\\\n set: (target, key, value) => {\\\\n this.setItem(key, value);\\\\n }\\\\n })\\\\n }\\\\n\\\\n #sync() {\\\\n if (this.#pending_sync) return;\\\\n this.#pending_sync = true;\\\\n setTimeout(() => {\\\\n let storage_entries = [...this.#map];\\\\n if (this.#mode === \\\\\\\"local\\\\\\\")\\\\n _loader_mjs__WEBPACK_IMPORTED_MODULE_0__.local_storage(_loader_mjs__WEBPACK_IMPORTED_MODULE_0__.frame_id, storage_entries);\\\\n this.#pending_sync = false;\\\\n }, 100);\\\\n }\\\\n\\\\n clear() {\\\\n this.#map.clear();\\\\n this.#sync();\\\\n }\\\\n\\\\n getItem(key) {\\\\n return this.#map.get(key+\\\\\\\"\\\\\\\");\\\\n }\\\\n\\\\n setItem(key, value) {\\\\n this.#map.set(key+\\\\\\\"\\\\\\\", value+\\\\\\\"\\\\\\\");\\\\n this.#sync();\\\\n }\\\\n \\\\n removeItem(key) {\\\\n this.#map.delete(key+\\\\\\\"\\\\\\\");\\\\n this.#sync();\\\\n }\\\\n\\\\n _get_entries() {\\\\n return [...this.#map];\\\\n }\\\\n\\\\n toString() {\\\\n return \\\\\\\"[object Storage]\\\\\\\";\\\\n }\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/polyfill/storage.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/polyfill/url.mjs\\\":\\n/*!************************************!*\\\\\\n !*** ./src/frame/polyfill/url.mjs ***!\\n \\\\************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"FakeURL\\\\\\\": () => (/* binding */ FakeURL)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _network_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../network.mjs */ \\\\\\\"./src/frame/network.mjs\\\\\\\");\\\\n\\\\n\\\\nclass FakeURL extends URL {\\\\n constructor(url, base) {\\\\n url = url instanceof URL ? url.href : url;\\\\n base = base instanceof URL ? base.href : base;\\\\n url = _network_mjs__WEBPACK_IMPORTED_MODULE_0__.known_urls[url] || url;\\\\n base = _network_mjs__WEBPACK_IMPORTED_MODULE_0__.known_urls[base] || base;\\\\n super(url, base);\\\\n }\\\\n}\\\\n\\\\n//# sourceURL=webpack://proxy_frame/./src/frame/polyfill/url.mjs?\\\");\\n\\n/***/ }),\\n\\n/***/ \\\"./src/frame/polyfill/worker.mjs\\\":\\n/*!***************************************!*\\\\\\n !*** ./src/frame/polyfill/worker.mjs ***!\\n \\\\***************************************/\\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\\n\\neval(\\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\\\n/* harmony export */ \\\\\\\"FakeWorker\\\\\\\": () => (/* binding */ FakeWorker),\\\\n/* harmony export */ \\\\\\\"fakeImportScripts\\\\\\\": () => (/* binding */ fakeImportScripts)\\\\n/* harmony export */ });\\\\n/* harmony import */ var _network_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../network.mjs */ \\\\\\\"./src/frame/network.mjs\\\\\\\");\\\\n/* harmony import */ var _loader_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../loader.mjs */ \\\\\\\"./src/frame/loader.mjs\\\\\\\");\\\\n/* harmony import */ var _rpc_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../rpc.mjs */ \\\\\\\"./src/rpc.mjs\\\\\\\");\\\\n/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util.mjs */ \\\\\\\"./src/util.mjs\\\\\\\");\\\\n/* harmony import */ var _context_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../context.mjs */ \\\\\\\"./src/frame/context.mjs\\\\\\\");\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\nfunction fakeImportScripts(...paths) {\\\\n let script_urls = paths.map((path) => (0,_context_mjs__WEBPACK_IMPORTED_MODULE_4__.convert_url)(path, _loader_mjs__WEBPACK_IMPORTED_MODULE_1__.url));\\\\n console.log(\\\\\\\"DEBUG importScripts\\\\\\\", _network_mjs__WEBPACK_IMPORTED_MODULE_0__.requests_allowed, script_urls)\\\\n\\\\n //requests are allowed, we are running as the real worker \\\\n if (_network_mjs__WEBPACK_IMPORTED_MODULE_0__.requests_allowed) {\\\\n for (let url of script_urls) {\\\\n if (typeof _network_mjs__WEBPACK_IMPORTED_MODULE_0__.resource_cache[url] === \\\\\\\"string\\\\\\\") {\\\\n (0,_context_mjs__WEBPACK_IMPORTED_MODULE_4__.run_script)(_network_mjs__WEBPACK_IMPORTED_MODULE_0__.resource_cache[url]);\\\\n }\\\\n else if (_network_mjs__WEBPACK_IMPORTED_MODULE_0__.resource_cache[url] === false) {\\\\n throw Error(\\\\\\\"Script network request failed\\\\\\\");\\\\n }\\\\n else {\\\\n //cache miss - try to load the script async anyways\\\\n console.warn(\\\\\\\"WARN importScripts cache miss for\\\\\\\", url);\\\\n _network_mjs__WEBPACK_IMPORTED_MODULE_0__.fetch(url).then(r => r.text()).then(_context_mjs__WEBPACK_IMPORTED_MODULE_4__.run_script)\\\\n }\\\\n }\\\\n }\\\\n //otherwise just log the url that was fetched\\\\n else {\\\\n self.postMessage({\\\\n frame_id: _loader_mjs__WEBPACK_IMPORTED_MODULE_1__.frame_id,\\\\n urls: script_urls\\\\n })\\\\n }\\\\n}\\\\n\\\\nclass FakeWorker extends EventTarget {\\\\n #url; #options; #worker; #msg_queue; #terminated;\\\\n\\\\n constructor(url, options) {\\\\n console.log(\\\\\\\"DEBUG new Worker\\\\\\\", url, options);\\\\n super();\\\\n this.#url = url;\\\\n this.#options = options;\\\\n this.#worker = null;\\\\n this.#msg_queue = [];\\\\n this.#terminated = false;\\\\n\\\\n this.onerror = () => {};\\\\n this.onmessage = () => {};\\\\n this.onmessageerror = () => {};\\\\n\\\\n this.#load_worker();\\\\n }\\\\n\\\\n async #load_worker() {\\\\n let response = await _network_mjs__WEBPACK_IMPORTED_MODULE_0__.fetch(this.#url);\\\\n let worker_js = JSON.stringify(await response.text());\\\\n let worker_id = \\\\\\\"\\\\\\\" + Math.random();\\\\n