function handleClick(e, isContextMenu) {
			/**
			 * @type {HTMLElement}
			 */
			const $el = e.target;

			if (isSelectionMode) {
				const checkbox = $el.closest(".tile")?.querySelector(".input-checkbox");
				if (checkbox && !$el.closest(".selection-header")) {
					checkbox.checked = !checkbox.checked;
					const url = $el
						.closest(".tile")
						.querySelector("data-url").textContent;
					if (checkbox.checked) {
						selectedItems.add(url);
					} else {
						selectedItems.delete(url);
					}
					const $count = $content.querySelector(".selection-count");
					updateSelectionCount($count);
				}
				return;
			}

			let action = $el.getAttribute("action") || $el.dataset.action;
			if (!action) return;

			let url = $el.dataset.url;
			let name = $el.dataset.name || $el.getAttribute("name");
			const idOpenDoc = $el.hasAttribute("open-doc");
			const uuid = $el.getAttribute("uuid");
			const type = $el.getAttribute("type");
			const storageType = $el.getAttribute("storageType");
			const home = $el.getAttribute("home");
			const isDir = ["dir", "directory", "folder"].includes(type);

			if (!url) {
				const $url = $el.get("data-url");
				if ($url) {
					url = $url.textContent;
				}
			}

			if (storageType === "notification") {
				switch (uuid) {
					case "addstorage":
						addStorage();
						break;

					default:
						break;
				}
				return;
			}

			if (!url && action === "open" && isDir && !idOpenDoc && !isContextMenu) {
				loader.hide();
				util.addPath(name, uuid).then((res) => {
					const storage = allStorages.find((storage) => storage.uuid === uuid);
					storage.url = res.uri;
					storage.name = res.name;
					name = res.name;
					updateStorage(storage, false);
					url = res.uri;
					folder();
				});
				return;
			}

			if (isContextMenu) action = "contextmenu";
			else if (idOpenDoc) action = "open-doc";

			switch (action) {
				case "navigation":
					folder();
					break;
				case "contextmenu":
					contextMenuHandler();
					break;
				case "open":
					if (isDir) folder();
					else if (!$el.hasAttribute("disabled")) file();
					break;
				case "open-doc":
					openDoc();
					break;
			}

			function folder() {
				if (home) {
					navigateToHome();
					return;
				}
				navigate(url, name);
			}

			function navigateToHome() {
				const navigationArray = [];
				const dirs = home.split("/");
				const { url: parsedUrl, query } = Url.parse(url);
				let path = "";

				for (let dir of dirs) {
					path = Url.join(path, dir);
					navigationArray.push({
						url: `${Url.join(parsedUrl, path, "")}${query}`,
						name: dir || name,
					});
				}

				loadStates(navigationArray);
			}

			function file() {
				$page.hide();
				resolve({
					type: "file",
					url,
					name,
				});
			}

			async function contextMenuHandler() {
				if (appSettings.value.vibrateOnTap) {
					navigator.vibrate(constants.VIBRATION_TIME);
				}
				if ($el.getAttribute("open-doc") === "true") return;

				const deleteText =
					currentDir.url === "/" ? strings.remove : strings.delete;
				const options = [
					["delete", deleteText, "delete"],
					["rename", strings.rename, "text_format"],
				];

				if (/s?ftp/.test(storageType)) {
					options.push(["edit", strings.edit, "edit"]);
				}

				if (helpers.isFile(type)) {
					options.push(["info", strings.info, "info"]);
					options.push(["open_with", strings["open with"], "open_in_browser"]);
				}

				if (currentDir.url !== "/" && url) {
					options.push(["copyuri", strings["copy uri"], "copy"]);
				}

				const option = await select(strings["select"], options);
				switch (option) {
					case "delete": {
						let deleteFunction = removeFile;
						let message = strings["delete entry"].replace("{name}", name);
						if (uuid) {
							deleteFunction = removeStorage;
							message = strings["remove entry"].replace("{name}", name);
						}

						const confirmation = await confirm(strings.warning, message);
						if (!confirmation) break;
						deleteFunction();
						break;
					}

					case "rename": {
						let newname = await prompt(strings.rename, name, "text", {
							match: constants.FILE_NAME_REGEX,
						});

						newname = helpers.fixFilename(newname);
						if (!newname || newname === name) break;

						if (uuid) renameStorage(newname);
						else renameFile(newname);
						break;
					}

					case "edit": {
						const storage = await remoteStorage.edit(
							storageList.find((storage) => storage.uuid === uuid),
						);
						if (!storage) break;
						storage.uuid = uuid;
						updateStorage(storage);
						break;
					}

					case "info":
						acode.exec("file-info", url);
						break;

					case "copyuri":
						navigator.clipboard.writeText(url);
						alert(strings.success, strings["copied to clipboard"]);
						break;

					case "open_with":
						try {
							let mimeType = mimeTypes.lookup(name || "text/plain");
							const fs = fsOperation(url);
							if (/^s?ftp:/.test(url)) return fs.localName;

							system.fileAction(
								(await fs.stat()).url,
								name,
								"VIEW",
								mimeType,
								() => {
									toast(strings["no app found to handle this file"]);
								},
							);
						} catch (error) {
							console.error(error);
							toast(strings.error);
						}
						break;
				}
			}

			async function renameFile(newname) {
				if (url.startsWith("content://com.termux.documents/tree/")) {
					if (helpers.isDir(type)) {
						alert(strings.warning, strings["rename not supported"]);
						return;
					} else {
						// Special handling for Termux content files
						const fs = fsOperation(url);
						try {
							const content = await fs.readFile();
							const newUrl = Url.join(Url.dirname(url), newname);
							await fsOperation(Url.dirname(url)).createFile(newname, content);
							await fs.delete();

							recents.removeFile(url);
							recents.addFile(newUrl);
							const file = editorManager.getFile(url, "uri");
							if (file) {
								file.uri = newUrl;
								file.filename = newname;
							}
							openFolder.renameItem(url, newUrl, newname);
							toast(strings.success);
							reload();
							return;
						} catch (err) {
							window.log("error", err);
							helpers.error(err);
							return;
						}
					}
				}
				const fs = fsOperation(url);
				try {
					const newUrl = await fs.renameTo(newname);
					recents.removeFile(url);
					recents.addFile(newUrl);
					const file = editorManager.getFile(url, "uri");
					if (file) {
						file.uri = newUrl;
						file.filename = newname;
					}
					openFolder.renameItem(url, newUrl, newname);
					toast(strings.success);
					reload();
				} catch (err) {
					window.log("error", err);
					helpers.error(err);
				}
			}

			async function removeFile() {
				try {
					if (helpers.isDir(type)) {
						if (url.startsWith("content://com.termux.documents/tree/")) {
							const fs = fsOperation(url);
							const entries = await fs.lsDir();
							if (entries.length === 0) {
								await fs.delete();
							} else {
								const deleteRecursively = async (currentUrl) => {
									const currentFs = fsOperation(currentUrl);
									const currentEntries = await currentFs.lsDir();
									for (const entry of currentEntries) {
										if (entry.isDirectory) {
											await deleteRecursively(entry.url);
										} else {
											await fsOperation(entry.url).delete();
										}
									}
									await currentFs.delete();
								};
								await deleteRecursively(url);
							}
						} else {
							await fsOperation(url).delete();
						}
						helpers.updateUriOfAllActiveFiles(url);
						recents.removeFolder(url);
					} else {
						const fs = fsOperation(url);
						await fs.delete();
						const openedFile = editorManager.getFile(url, "uri");
						if (openedFile) openedFile.uri = null;
					}
					recents.removeFile(url);
					openFolder.removeItem(url);
					toast(strings.success);
					delete cachedDir[url];
					reload();
				} catch (err) {
					window.log("error", err);
					helpers.error(err);
				}
			}

			function removeStorage() {
				if (url) {
					recents.removeFolder(url);
					recents.removeFile(url);
				}
				storageList = storageList.filter((storage) => {
					if (storage.uuid !== uuid) {
						return true;
					}

					if (storage.url) {
						const parsedUrl = URLParse(storage.url, true);
						const keyFile = decodeURIComponent(
							parsedUrl.query["keyFile"] || "",
						);
						if (keyFile) {
							fsOperation(keyFile).delete();
						}
					}
					return false;
				});
				localStorage.storageList = JSON.stringify(storageList);
				reload();
			}

			function renameStorage(newname) {
				storageList = storageList.map((storage) => {
					if (storage.uuid === uuid) storage.name = newname;
					return storage;
				});
				localStorage.storageList = JSON.stringify(storageList);
				reload();
			}

			function openDoc() {
				checkFiles.check = false;
				sdcard.openDocumentFile(
					(res) => {
						res.url = res.uri;
						resolve({
							type: "file",
							...res,
							name: res.filename,
							mode: "single",
						});
						$page.hide();
					},
					(err) => {
						helpers.error(err);
					},
				);
			}
		}
Called when any file folder is clicked
@param {MouseEvent} e
@param {"contextmenu"} [isContextMenu]