{"version":3,"file":"filesystem.mjs","sources":["../../../lib/upload/utils/filesystem.ts"],"sourcesContent":["/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n// Helpers for the File and Directory API\n//\n// The interfaces of the (legacy) File and Directory Entries API are not exposed as global\n// constructors by Chromium, so `instanceof` can not be used and we check the shape instead.\n// This also works for browsers that do not support the API at all.\n\n/**\n * Check whether the given object is a `FileSystemEntry`\n *\n * @param o - The object to check\n */\nexport function isFileSystemEntry(o: unknown): o is FileSystemEntry {\n\treturn typeof o === 'object' && o !== null\n\t\t&& 'isFile' in o && typeof o.isFile === 'boolean'\n\t\t&& 'isDirectory' in o && typeof o.isDirectory === 'boolean'\n\t\t&& 'fullPath' in o && typeof o.fullPath === 'string'\n}\n\n/**\n * Check whether the given object is a `FileSystemDirectoryEntry`\n *\n * @param o - The object to check\n */\nexport function isFileSystemDirectoryEntry(o: unknown): o is FileSystemDirectoryEntry {\n\treturn isFileSystemEntry(o) && o.isDirectory && typeof (o as FileSystemDirectoryEntry).createReader === 'function'\n}\n\n/**\n * Check whether the given object is a `FileSystemFileEntry`\n *\n * @param o - The object to check\n */\nexport function isFileSystemFileEntry(o: unknown): o is FileSystemFileEntry {\n\treturn isFileSystemEntry(o) && o.isFile && typeof (o as FileSystemFileEntry).file === 'function'\n}\n"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,kBAAkB,GAAkC;AACnE,SAAO,OAAO,MAAM,YAAY,MAAM,QAClC,YAAY,KAAK,OAAO,EAAE,WAAW,aACrC,iBAAiB,KAAK,OAAO,EAAE,gBAAgB,aAC/C,cAAc,KAAK,OAAO,EAAE,aAAa;AAC9C;AAOO,SAAS,2BAA2B,GAA2C;AACrF,SAAO,kBAAkB,CAAC,KAAK,EAAE,eAAe,OAAQ,EAA+B,iBAAiB;AACzG;AAOO,SAAS,sBAAsB,GAAsC;AAC3E,SAAO,kBAAkB,CAAC,KAAK,EAAE,UAAU,OAAQ,EAA0B,SAAS;AACvF;"}