@nextcloud/files 4.0.0-beta.5 → 4.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +46 -48
- package/dist/index.mjs.map +1 -1
- package/dist/navigation/column.d.ts +10 -4
- package/dist/navigation/view.d.ts +19 -16
- package/dist/newMenu/NewMenu.d.ts +5 -5
- package/dist/newMenu/functions.d.ts +3 -3
- package/dist/utils/objectValidation.d.ts +9 -0
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -896,10 +896,23 @@ const getFileListHeaders = function() {
|
|
|
896
896
|
}
|
|
897
897
|
return window._nc_filelistheader;
|
|
898
898
|
};
|
|
899
|
+
function checkOptionalProperty(obj, property, type) {
|
|
900
|
+
if (typeof obj[property] !== "undefined") {
|
|
901
|
+
if (type === "array") {
|
|
902
|
+
if (!Array.isArray(obj[property])) {
|
|
903
|
+
throw new Error(`View ${property} must be an array`);
|
|
904
|
+
}
|
|
905
|
+
} else if (typeof obj[property] !== type) {
|
|
906
|
+
throw new Error(`View ${property} must be a ${type}`);
|
|
907
|
+
} else if (type === "object" && (obj[property] === null || Array.isArray(obj[property]))) {
|
|
908
|
+
throw new Error(`View ${property} must be an object`);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
899
912
|
class Column {
|
|
900
913
|
_column;
|
|
901
914
|
constructor(column) {
|
|
902
|
-
|
|
915
|
+
validateColumn(column);
|
|
903
916
|
this._column = column;
|
|
904
917
|
}
|
|
905
918
|
get id() {
|
|
@@ -918,7 +931,10 @@ class Column {
|
|
|
918
931
|
return this._column.summary;
|
|
919
932
|
}
|
|
920
933
|
}
|
|
921
|
-
|
|
934
|
+
function validateColumn(column) {
|
|
935
|
+
if (typeof column !== "object" || column === null) {
|
|
936
|
+
throw new Error("View column must be an object");
|
|
937
|
+
}
|
|
922
938
|
if (!column.id || typeof column.id !== "string") {
|
|
923
939
|
throw new Error("A column id is required");
|
|
924
940
|
}
|
|
@@ -928,14 +944,9 @@ const isValidColumn = function(column) {
|
|
|
928
944
|
if (!column.render || typeof column.render !== "function") {
|
|
929
945
|
throw new Error("A render function is required");
|
|
930
946
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
if (column.summary && typeof column.summary !== "function") {
|
|
935
|
-
throw new Error("Column summary must be a function");
|
|
936
|
-
}
|
|
937
|
-
return true;
|
|
938
|
-
};
|
|
947
|
+
checkOptionalProperty(column, "sort", "function");
|
|
948
|
+
checkOptionalProperty(column, "summary", "function");
|
|
949
|
+
}
|
|
939
950
|
class View {
|
|
940
951
|
_view;
|
|
941
952
|
constructor(view) {
|
|
@@ -1007,51 +1018,37 @@ class View {
|
|
|
1007
1018
|
}
|
|
1008
1019
|
}
|
|
1009
1020
|
function validateView(view) {
|
|
1021
|
+
if (!view.icon || typeof view.icon !== "string" || !isSvg(view.icon)) {
|
|
1022
|
+
throw new Error("View icon is required and must be a valid svg string");
|
|
1023
|
+
}
|
|
1010
1024
|
if (!view.id || typeof view.id !== "string") {
|
|
1011
1025
|
throw new Error("View id is required and must be a string");
|
|
1012
1026
|
}
|
|
1013
|
-
if (!view.name || typeof view.name !== "string") {
|
|
1014
|
-
throw new Error("View name is required and must be a string");
|
|
1015
|
-
}
|
|
1016
|
-
if ("caption" in view && typeof view.caption !== "string") {
|
|
1017
|
-
throw new Error("View caption must be a string");
|
|
1018
|
-
}
|
|
1019
1027
|
if (!view.getContents || typeof view.getContents !== "function") {
|
|
1020
1028
|
throw new Error("View getContents is required and must be a function");
|
|
1021
1029
|
}
|
|
1022
|
-
if (
|
|
1023
|
-
throw new Error("View
|
|
1024
|
-
}
|
|
1025
|
-
if (!view.icon || typeof view.icon !== "string" || !isSvg(view.icon)) {
|
|
1026
|
-
throw new Error("View icon is required and must be a valid svg string");
|
|
1027
|
-
}
|
|
1028
|
-
if ("order" in view && typeof view.order !== "number") {
|
|
1029
|
-
throw new Error("View order must be a number");
|
|
1030
|
+
if (!view.name || typeof view.name !== "string") {
|
|
1031
|
+
throw new Error("View name is required and must be a string");
|
|
1030
1032
|
}
|
|
1033
|
+
checkOptionalProperty(view, "caption", "string");
|
|
1034
|
+
checkOptionalProperty(view, "columns", "array");
|
|
1035
|
+
checkOptionalProperty(view, "defaultSortKey", "string");
|
|
1036
|
+
checkOptionalProperty(view, "emptyCaption", "string");
|
|
1037
|
+
checkOptionalProperty(view, "emptyTitle", "string");
|
|
1038
|
+
checkOptionalProperty(view, "emptyView", "function");
|
|
1039
|
+
checkOptionalProperty(view, "expanded", "boolean");
|
|
1040
|
+
checkOptionalProperty(view, "hidden", "boolean");
|
|
1041
|
+
checkOptionalProperty(view, "loadChildViews", "function");
|
|
1042
|
+
checkOptionalProperty(view, "order", "number");
|
|
1043
|
+
checkOptionalProperty(view, "params", "object");
|
|
1044
|
+
checkOptionalProperty(view, "parent", "string");
|
|
1045
|
+
checkOptionalProperty(view, "sticky", "boolean");
|
|
1031
1046
|
if (view.columns) {
|
|
1032
|
-
view.columns.forEach(
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
if (view.emptyView && typeof view.emptyView !== "function") {
|
|
1039
|
-
throw new Error("View emptyView must be a function");
|
|
1040
|
-
}
|
|
1041
|
-
if (view.parent && typeof view.parent !== "string") {
|
|
1042
|
-
throw new Error("View parent must be a string");
|
|
1043
|
-
}
|
|
1044
|
-
if ("sticky" in view && typeof view.sticky !== "boolean") {
|
|
1045
|
-
throw new Error("View sticky must be a boolean");
|
|
1046
|
-
}
|
|
1047
|
-
if ("expanded" in view && typeof view.expanded !== "boolean") {
|
|
1048
|
-
throw new Error("View expanded must be a boolean");
|
|
1049
|
-
}
|
|
1050
|
-
if (view.defaultSortKey && typeof view.defaultSortKey !== "string") {
|
|
1051
|
-
throw new Error("View defaultSortKey must be a string");
|
|
1052
|
-
}
|
|
1053
|
-
if (view.loadChildViews && typeof view.loadChildViews !== "function") {
|
|
1054
|
-
throw new Error("View loadChildViews must be a function");
|
|
1047
|
+
view.columns.forEach(validateColumn);
|
|
1048
|
+
const columnIds = view.columns.reduce((set, column) => set.add(column.id), /* @__PURE__ */ new Set());
|
|
1049
|
+
if (columnIds.size !== view.columns.length) {
|
|
1050
|
+
throw new Error("View columns must have unique ids");
|
|
1051
|
+
}
|
|
1055
1052
|
}
|
|
1056
1053
|
}
|
|
1057
1054
|
class Navigation extends TypedEventTarget {
|
|
@@ -1146,7 +1143,7 @@ class NewMenu {
|
|
|
1146
1143
|
/**
|
|
1147
1144
|
* Get the list of registered entries
|
|
1148
1145
|
*
|
|
1149
|
-
* @param
|
|
1146
|
+
* @param context - The creation context. Usually the current folder
|
|
1150
1147
|
*/
|
|
1151
1148
|
getEntries(context) {
|
|
1152
1149
|
if (context) {
|
|
@@ -1537,6 +1534,7 @@ export {
|
|
|
1537
1534
|
removeNewFileMenuEntry,
|
|
1538
1535
|
sortNodes,
|
|
1539
1536
|
unregisterFileListFilter,
|
|
1537
|
+
validateColumn,
|
|
1540
1538
|
validateFilename,
|
|
1541
1539
|
validateView
|
|
1542
1540
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../lib/actions/fileAction.ts","../lib/actions/fileListAction.ts","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/debug.js","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/constants.js","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/re.js","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/parse-options.js","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/identifiers.js","../node_modules/@nextcloud/event-bus/node_modules/semver/classes/semver.js","../node_modules/@nextcloud/event-bus/node_modules/semver/functions/major.js","../node_modules/@nextcloud/event-bus/node_modules/semver/functions/parse.js","../node_modules/@nextcloud/event-bus/node_modules/semver/functions/valid.js","../node_modules/@nextcloud/event-bus/dist/index.mjs","../lib/fileListFilters.ts","../lib/fileListHeaders.ts","../lib/navigation/column.ts","../lib/navigation/view.ts","../lib/navigation/navigation.ts","../lib/newMenu/NewMenu.ts","../lib/newMenu/functions.ts","../lib/sidebar/SidebarTab.ts","../lib/sidebar/Sidebar.ts","../lib/utils/filename-validation.ts","../lib/utils/filename.ts","../lib/utils/fileSize.ts","../lib/utils/sorting.ts","../lib/utils/fileSorting.ts"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { ActionContext, ActionContextSingle } from '../types.ts'\n\nimport logger from '../utils/logger.ts'\n\nexport enum DefaultType {\n\tDEFAULT = 'default',\n\tHIDDEN = 'hidden',\n}\n\nexport interface IHotkeyConfig {\n\t/**\n\t * Short, translated, description what this action is doing.\n\t * This will be used as the description next to the hotkey in the shortcuts overview.\n\t */\n\tdescription: string\n\n\t/**\n\t * The key to be pressed.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key\n\t */\n\tkey: string\n\n\t/**\n\t * If set then the callback is only called when the shift key is (not) pressed.\n\t * When left `undefined` a pressed shift key is ignored (callback is run with and without shift pressed).\n\t */\n\tshift?: boolean\n\n\t/**\n\t * Only execute the action if the control key is pressed.\n\t * On Mac devices the command key is used instead.\n\t */\n\tctrl?: true\n\n\t/**\n\t * Only execute the action if the alt key is pressed\n\t */\n\talt?: true\n}\n\nexport interface FileActionData {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: (context: ActionContext) => string\n\t/** Translatable title for of the action */\n\ttitle?: (context: ActionContext) => string\n\t/** Svg as inline string. <svg><path fill=\"...\" /></svg> */\n\ticonSvgInline: (context: ActionContext) => string\n\t/** Condition wether this action is shown or not */\n\tenabled?: (context: ActionContext) => boolean\n\n\t/**\n\t * Function executed on single file action\n\t * @return true if the action was executed successfully,\n\t * false otherwise and null if the action is silent/undefined.\n\t * @throws Error if the action failed\n\t */\n\texec: (context: ActionContextSingle) => Promise<boolean|null>,\n\t/**\n\t * Function executed on multiple files action\n\t * @return true if the action was executed successfully,\n\t * false otherwise and null if the action is silent/undefined.\n\t * @throws Error if the action failed\n\t */\n\texecBatch?: (context: ActionContext) => Promise<(boolean|null)[]>\n\n\t/** This action order in the list */\n\torder?: number\n\n\t/**\n\t * Allows to define a hotkey which will trigger this action for the selected node.\n\t */\n\thotkey?: IHotkeyConfig\n\n\t/**\n\t * Set to true if this action is a destructive action, like \"delete\".\n\t * This will change the appearance in the action menu more prominent (e.g. red colored)\n\t */\n\tdestructive?: boolean\n\n\t/**\n\t * This action's parent id in the list.\n\t * If none found, will be displayed as a top-level action.\n\t */\n\tparent?: string,\n\n\t/**\n\t * Make this action the default.\n\t * If multiple actions are default, the first one\n\t * will be used. The other ones will be put as first\n\t * entries in the actions menu iff DefaultType.Hidden is not used.\n\t * A DefaultType.Hidden action will never be shown\n\t * in the actions menu even if another action takes\n\t * its place as default.\n\t */\n\tdefault?: DefaultType,\n\t/**\n\t * If true, the renderInline function will be called\n\t */\n\tinline?: (context: ActionContextSingle) => boolean,\n\t/**\n\t * If defined, the returned html element will be\n\t * appended before the actions menu.\n\t */\n\trenderInline?: (context: ActionContextSingle) => Promise<HTMLElement | null>,\n}\n\nexport class FileAction {\n\n\tprivate _action: FileActionData\n\n\tconstructor(action: FileActionData) {\n\t\tthis.validateAction(action)\n\t\tthis._action = action\n\t}\n\n\tget id() {\n\t\treturn this._action.id\n\t}\n\n\tget displayName() {\n\t\treturn this._action.displayName\n\t}\n\n\tget title() {\n\t\treturn this._action.title\n\t}\n\n\tget iconSvgInline() {\n\t\treturn this._action.iconSvgInline\n\t}\n\n\tget enabled() {\n\t\treturn this._action.enabled\n\t}\n\n\tget exec() {\n\t\treturn this._action.exec\n\t}\n\n\tget execBatch() {\n\t\treturn this._action.execBatch\n\t}\n\n\tget hotkey() {\n\t\treturn this._action.hotkey\n\t}\n\n\tget order() {\n\t\treturn this._action.order\n\t}\n\n\tget parent() {\n\t\treturn this._action.parent\n\t}\n\n\tget default() {\n\t\treturn this._action.default\n\t}\n\n\tget destructive() {\n\t\treturn this._action.destructive\n\t}\n\n\tget inline() {\n\t\treturn this._action.inline\n\t}\n\n\tget renderInline() {\n\t\treturn this._action.renderInline\n\t}\n\n\tprivate validateAction(action: FileActionData) {\n\t\tif (!action.id || typeof action.id !== 'string') {\n\t\t\tthrow new Error('Invalid id')\n\t\t}\n\n\t\tif (!action.displayName || typeof action.displayName !== 'function') {\n\t\t\tthrow new Error('Invalid displayName function')\n\t\t}\n\n\t\tif ('title' in action && typeof action.title !== 'function') {\n\t\t\tthrow new Error('Invalid title function')\n\t\t}\n\n\t\tif (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {\n\t\t\tthrow new Error('Invalid iconSvgInline function')\n\t\t}\n\n\t\tif (!action.exec || typeof action.exec !== 'function') {\n\t\t\tthrow new Error('Invalid exec function')\n\t\t}\n\n\t\t// Optional properties --------------------------------------------\n\t\tif ('enabled' in action && typeof action.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled function')\n\t\t}\n\n\t\tif ('execBatch' in action && typeof action.execBatch !== 'function') {\n\t\t\tthrow new Error('Invalid execBatch function')\n\t\t}\n\n\t\tif ('order' in action && typeof action.order !== 'number') {\n\t\t\tthrow new Error('Invalid order')\n\t\t}\n\n\t\tif (action.destructive !== undefined && typeof action.destructive !== 'boolean') {\n\t\t\tthrow new Error('Invalid destructive flag')\n\t\t}\n\n\t\tif ('parent' in action && typeof action.parent !== 'string') {\n\t\t\tthrow new Error('Invalid parent')\n\t\t}\n\n\t\tif (action.default && !Object.values(DefaultType).includes(action.default)) {\n\t\t\tthrow new Error('Invalid default')\n\t\t}\n\n\t\tif ('inline' in action && typeof action.inline !== 'function') {\n\t\t\tthrow new Error('Invalid inline function')\n\t\t}\n\n\t\tif ('renderInline' in action && typeof action.renderInline !== 'function') {\n\t\t\tthrow new Error('Invalid renderInline function')\n\t\t}\n\n\t\tif ('hotkey' in action && action.hotkey !== undefined) {\n\t\t\tif (typeof action.hotkey !== 'object') {\n\t\t\t\tthrow new Error('Invalid hotkey configuration')\n\t\t\t}\n\n\t\t\tif (typeof action.hotkey.key !== 'string' || !action.hotkey.key) {\n\t\t\t\tthrow new Error('Missing or invalid hotkey key')\n\t\t\t}\n\n\t\t\tif (typeof action.hotkey.description !== 'string' || !action.hotkey.description) {\n\t\t\t\tthrow new Error('Missing or invalid hotkey description')\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nexport const registerFileAction = function(action: FileAction): void {\n\tif (typeof window._nc_fileactions === 'undefined') {\n\t\twindow._nc_fileactions = []\n\t\tlogger.debug('FileActions initialized')\n\t}\n\n\t// Check duplicates\n\tif (window._nc_fileactions.find(search => search.id === action.id)) {\n\t\tlogger.error(`FileAction ${action.id} already registered`, { action })\n\t\treturn\n\t}\n\n\twindow._nc_fileactions.push(action)\n}\n\nexport const getFileActions = function(): FileAction[] {\n\tif (typeof window._nc_fileactions === 'undefined') {\n\t\twindow._nc_fileactions = []\n\t\tlogger.debug('FileActions initialized')\n\t}\n\n\treturn window._nc_fileactions\n}\n","/**\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { ViewActionContext } from '../types.ts'\n\nimport logger from '../utils/logger.ts'\n\ninterface FileListActionData {\n\t/** Unique ID */\n\tid: string\n\n\t/** Translated name of the action */\n\tdisplayName: (context: ViewActionContext) => string\n\n\t/** Raw svg string */\n\ticonSvgInline?: (context: ViewActionContext) => string\n\n\t/** Sort order */\n\torder: number\n\n\t/**\n\t * Condition whether this action is shown or not\n\t */\n\tenabled?: (context: ViewActionContext) => boolean\n\n\t/**\n\t * Function executed on single file action\n\t * @return true if the action was executed successfully,\n\t * false otherwise and null if the action is silent/undefined.\n\t * @throws Error if the action failed\n\t */\n\texec: (context: ViewActionContext) => Promise<boolean|null>,\n}\n\nexport class FileListAction {\n\n\tprivate _action: FileListActionData\n\n\tconstructor(action: FileListActionData) {\n\t\tthis.validateAction(action)\n\t\tthis._action = action\n\t}\n\n\tget id() {\n\t\treturn this._action.id\n\t}\n\n\tget displayName() {\n\t\treturn this._action.displayName\n\t}\n\n\tget iconSvgInline() {\n\t\treturn this._action.iconSvgInline\n\t}\n\n\tget order() {\n\t\treturn this._action.order\n\t}\n\n\tget enabled() {\n\t\treturn this._action.enabled\n\t}\n\n\tget exec() {\n\t\treturn this._action.exec\n\t}\n\n\tprivate validateAction(action: FileListActionData) {\n\t\tif (!action.id || typeof action.id !== 'string') {\n\t\t\tthrow new Error('Invalid id')\n\t\t}\n\n\t\tif (!action.displayName || typeof action.displayName !== 'function') {\n\t\t\tthrow new Error('Invalid displayName function')\n\t\t}\n\n\t\tif ('iconSvgInline' in action && typeof action.iconSvgInline !== 'function') {\n\t\t\tthrow new Error('Invalid iconSvgInline function')\n\t\t}\n\n\t\tif ('order' in action && typeof action.order !== 'number') {\n\t\t\tthrow new Error('Invalid order')\n\t\t}\n\n\t\tif ('enabled' in action && typeof action.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled function')\n\t\t}\n\n\t\tif (!action.exec || typeof action.exec !== 'function') {\n\t\t\tthrow new Error('Invalid exec function')\n\t\t}\n\t}\n\n}\n\nexport const registerFileListAction = (action: FileListAction) => {\n\tif (typeof window._nc_filelistactions === 'undefined') {\n\t\twindow._nc_filelistactions = []\n\t}\n\n\tif (window._nc_filelistactions.find(listAction => listAction.id === action.id)) {\n\t\tlogger.error(`FileListAction with id \"${action.id}\" is already registered`, { action })\n\t\treturn\n\t}\n\n\twindow._nc_filelistactions.push(action)\n}\n\nexport const getFileListActions = (): FileListAction[] => {\n\tif (typeof window._nc_filelistactions === 'undefined') {\n\t\twindow._nc_filelistactions = []\n\t}\n\n\treturn window._nc_filelistactions\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numberic identifiers include numberic identifiers but can be longer.\n// Therefore non-numberic identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","import major from \"semver/functions/major.js\";\nimport valid from \"semver/functions/valid.js\";\n/*!\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\nclass ProxyBus {\n bus;\n constructor(bus2) {\n if (typeof bus2.getVersion !== \"function\" || !valid(bus2.getVersion())) {\n console.warn(\"Proxying an event bus with an unknown or invalid version\");\n } else if (major(bus2.getVersion()) !== major(this.getVersion())) {\n console.warn(\n \"Proxying an event bus of version \" + bus2.getVersion() + \" with \" + this.getVersion()\n );\n }\n this.bus = bus2;\n }\n getVersion() {\n return \"3.3.3\";\n }\n subscribe(name, handler) {\n this.bus.subscribe(name, handler);\n }\n unsubscribe(name, handler) {\n this.bus.unsubscribe(name, handler);\n }\n emit(name, ...event) {\n this.bus.emit(name, ...event);\n }\n}\n/*!\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\nclass SimpleBus {\n handlers = /* @__PURE__ */ new Map();\n getVersion() {\n return \"3.3.3\";\n }\n subscribe(name, handler) {\n this.handlers.set(\n name,\n (this.handlers.get(name) || []).concat(\n handler\n )\n );\n }\n unsubscribe(name, handler) {\n this.handlers.set(\n name,\n (this.handlers.get(name) || []).filter((h) => h !== handler)\n );\n }\n emit(name, ...event) {\n const handlers = this.handlers.get(name) || [];\n handlers.forEach((h) => {\n try {\n ;\n h(event[0]);\n } catch (e) {\n console.error(\"could not invoke event listener\", e);\n }\n });\n }\n}\n/*!\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\nlet bus = null;\nfunction getBus() {\n if (bus !== null) {\n return bus;\n }\n if (typeof window === \"undefined\") {\n return new Proxy({}, {\n get: () => {\n return () => console.error(\n \"Window not available, EventBus can not be established!\"\n );\n }\n });\n }\n if (window.OC?._eventBus && typeof window._nc_event_bus === \"undefined\") {\n console.warn(\n \"found old event bus instance at OC._eventBus. Update your version!\"\n );\n window._nc_event_bus = window.OC._eventBus;\n }\n if (typeof window?._nc_event_bus !== \"undefined\") {\n bus = new ProxyBus(window._nc_event_bus);\n } else {\n bus = window._nc_event_bus = new SimpleBus();\n }\n return bus;\n}\nfunction subscribe(name, handler) {\n getBus().subscribe(name, handler);\n}\nfunction unsubscribe(name, handler) {\n getBus().unsubscribe(name, handler);\n}\nfunction emit(name, ...event) {\n getBus().emit(name, ...event);\n}\nexport {\n ProxyBus,\n SimpleBus,\n emit,\n subscribe,\n unsubscribe\n};\n//# sourceMappingURL=index.mjs.map\n","/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { INode } from './node/index.ts'\n\nimport { emit } from '@nextcloud/event-bus'\nimport { TypedEventTarget } from 'typescript-event-target'\n\n/**\n * Active filters can provide one or more \"chips\" to show the currently active state.\n * Must at least provide a text representing the filters state and a callback to unset that state (disable this filter).\n */\nexport interface IFileListFilterChip {\n\t/**\n\t * Text of the chip\n\t */\n\ttext: string\n\n\t/**\n\t * Optional icon to be used on the chip (inline SVG as string)\n\t */\n\ticon?: string\n\n\t/**\n\t * Optional pass a user id to use a user avatar instead of an icon\n\t */\n\tuser?: string\n\n\t/**\n\t * Handler to be called on click\n\t */\n\tonclick: () => void\n}\n\n/**\n * This event is emitted when the the filter value changed and the file list needs to be updated\n */\nexport interface FilterUpdateEvent extends CustomEvent<never> {\n\ttype: 'update:filter'\n}\n\n/**\n * This event is emitted when the the filter value changed and the file list needs to be updated\n */\nexport interface FilterUpdateChipsEvent extends CustomEvent<IFileListFilterChip[]> {\n\ttype: 'update:chips'\n}\n\ninterface IFileListFilterEvents {\n\t[name: string]: CustomEvent,\n\t'update:filter': FilterUpdateEvent\n\t'update:chips' : FilterUpdateChipsEvent\n}\n\nexport interface IFileListFilter extends TypedEventTarget<IFileListFilterEvents> {\n\n\t/**\n\t * Unique ID of this filter\n\t */\n\treadonly id: string\n\n\t/**\n\t * Order of the filter\n\t *\n\t * Use a low number to make this filter ordered in front.\n\t */\n\treadonly order: number\n\n\t/**\n\t * Filter function to decide if a node is shown.\n\t *\n\t * @param nodes Nodes to filter\n\t * @return Subset of the `nodes` parameter to show\n\t */\n\tfilter(nodes: INode[]): INode[]\n\n\t/**\n\t * If the filter needs a visual element for settings it can provide a function to mount it.\n\t * @param el The DOM element to mount to\n\t */\n\tmount?(el: HTMLElement): void\n\n\t/**\n\t * Reset the filter to the initial state.\n\t * This is called by the files app.\n\t * Implementations should make sure,that if they provide chips they need to emit the `update:chips` event.\n\t *\n\t * @since 3.10.0\n\t */\n\treset?(): void\n}\n\nexport class FileListFilter extends TypedEventTarget<IFileListFilterEvents> implements IFileListFilter {\n\n\tpublic id: string\n\n\tpublic order: number\n\n\tconstructor(id: string, order: number = 100) {\n\t\tsuper()\n\t\tthis.id = id\n\t\tthis.order = order\n\t}\n\n\tpublic filter(nodes: INode[]): INode[] {\n\t\tthrow new Error('Not implemented')\n\t\treturn nodes\n\t}\n\n\tprotected updateChips(chips: IFileListFilterChip[]) {\n\t\tthis.dispatchTypedEvent('update:chips', new CustomEvent('update:chips', { detail: chips }) as FilterUpdateChipsEvent)\n\t}\n\n\tprotected filterUpdated() {\n\t\tthis.dispatchTypedEvent('update:filter', new CustomEvent('update:filter') as FilterUpdateEvent)\n\t}\n\n}\n\n/**\n * Register a new filter on the file list\n *\n * This only must be called once to register the filter,\n * when the filter state changes you need to call `filterUpdated` on the filter instead.\n *\n * @param filter The filter to register on the file list\n */\nexport function registerFileListFilter(filter: IFileListFilter): void {\n\tif (!window._nc_filelist_filters) {\n\t\twindow._nc_filelist_filters = new Map<string, IFileListFilter>()\n\t}\n\tif (window._nc_filelist_filters.has(filter.id)) {\n\t\tthrow new Error(`File list filter \"${filter.id}\" already registered`)\n\t}\n\twindow._nc_filelist_filters.set(filter.id, filter)\n\temit('files:filter:added', filter)\n}\n\n/**\n * Remove a registered filter from the file list\n * @param filterId The unique ID of the filter to remove\n */\nexport function unregisterFileListFilter(filterId: string): void {\n\tif (window._nc_filelist_filters && window._nc_filelist_filters.has(filterId)) {\n\t\twindow._nc_filelist_filters.delete(filterId)\n\t\temit('files:filter:removed', filterId)\n\t}\n}\n\n/**\n * Get all registered file list filters\n */\nexport function getFileListFilters(): IFileListFilter[] {\n\tif (!window._nc_filelist_filters) {\n\t\treturn []\n\t}\n\treturn [...window._nc_filelist_filters.values()]\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IFolder } from './node/folder.ts'\nimport type { IView } from './navigation/view.ts'\n\nimport logger from './utils/logger.ts'\n\nexport interface HeaderData {\n\t/** Unique ID */\n\tid: string\n\t/** Order */\n\torder: number\n\t/** Condition wether this header is shown or not */\n\tenabled?: (folder: IFolder, view: IView) => boolean\n\t/** Executed when file list is initialized */\n\trender: (el: HTMLElement, folder: IFolder, view: IView) => void\n\t/** Executed when root folder changed */\n\tupdated(folder: IFolder, view: IView)\n}\n\nexport class Header {\n\n\tprivate _header: HeaderData\n\n\tconstructor(header: HeaderData) {\n\t\tthis.validateHeader(header)\n\t\tthis._header = header\n\t}\n\n\tget id() {\n\t\treturn this._header.id\n\t}\n\n\tget order() {\n\t\treturn this._header.order\n\t}\n\n\tget enabled() {\n\t\treturn this._header.enabled\n\t}\n\n\tget render() {\n\t\treturn this._header.render\n\t}\n\n\tget updated() {\n\t\treturn this._header.updated\n\t}\n\n\tprivate validateHeader(header: HeaderData) {\n\t\tif (!header.id || !header.render || !header.updated) {\n\t\t\tthrow new Error('Invalid header: id, render and updated are required')\n\t\t}\n\n\t\tif (typeof header.id !== 'string') {\n\t\t\tthrow new Error('Invalid id property')\n\t\t}\n\n\t\tif (header.enabled !== undefined && typeof header.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled property')\n\t\t}\n\n\t\tif (header.render && typeof header.render !== 'function') {\n\t\t\tthrow new Error('Invalid render property')\n\t\t}\n\n\t\tif (header.updated && typeof header.updated !== 'function') {\n\t\t\tthrow new Error('Invalid updated property')\n\t\t}\n\t}\n\n}\n\nexport const registerFileListHeaders = function(header: Header): void {\n\tif (typeof window._nc_filelistheader === 'undefined') {\n\t\twindow._nc_filelistheader = []\n\t\tlogger.debug('FileListHeaders initialized')\n\t}\n\n\t// Check duplicates\n\tif (window._nc_filelistheader.find(search => search.id === header.id)) {\n\t\tlogger.error(`Header ${header.id} already registered`, { header })\n\t\treturn\n\t}\n\n\twindow._nc_filelistheader.push(header)\n}\n\nexport const getFileListHeaders = function(): Header[] {\n\tif (typeof window._nc_filelistheader === 'undefined') {\n\t\twindow._nc_filelistheader = []\n\t\tlogger.debug('FileListHeaders initialized')\n\t}\n\n\treturn window._nc_filelistheader\n}\n","/*\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { INode } from '../node/node.ts'\nimport type { IView } from './view.ts'\n\ninterface ColumnData {\n\t/** Unique column ID */\n\tid: string\n\t/** Translated column title */\n\ttitle: string\n\t/** The content of the cell. The element will be appended within */\n\trender: (node: INode, view: IView) => HTMLElement\n\t/** Function used to sort INodes between them */\n\tsort?: (nodeA: INode, nodeB: INode) => number\n\t/**\n\t * Custom summary of the column to display at the end of the list.\n\t * Will not be displayed if nothing is provided\n\t */\n\tsummary?: (node: INode[], view: IView) => string\n}\n\nexport class Column implements ColumnData {\n\n\tprivate _column: ColumnData\n\n\tconstructor(column: ColumnData) {\n\t\tisValidColumn(column)\n\t\tthis._column = column\n\t}\n\n\tget id() {\n\t\treturn this._column.id\n\t}\n\n\tget title() {\n\t\treturn this._column.title\n\t}\n\n\tget render() {\n\t\treturn this._column.render\n\t}\n\n\tget sort() {\n\t\treturn this._column.sort\n\t}\n\n\tget summary() {\n\t\treturn this._column.summary\n\t}\n\n}\n\n/**\n * Typescript cannot validate an interface.\n * Please keep in sync with the Column interface requirements.\n *\n * @param {ColumnData} column the column to check\n * @return {boolean} true if the column is valid\n */\nconst isValidColumn = function(column: ColumnData): boolean {\n\tif (!column.id || typeof column.id !== 'string') {\n\t\tthrow new Error('A column id is required')\n\t}\n\n\tif (!column.title || typeof column.title !== 'string') {\n\t\tthrow new Error('A column title is required')\n\t}\n\n\tif (!column.render || typeof column.render !== 'function') {\n\t\tthrow new Error('A render function is required')\n\t}\n\n\t// Optional properties\n\tif (column.sort && typeof column.sort !== 'function') {\n\t\tthrow new Error('Column sortFunction must be a function')\n\t}\n\n\tif (column.summary && typeof column.summary !== 'function') {\n\t\tthrow new Error('Column summary must be a function')\n\t}\n\n\treturn true\n}\n","/*\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { Folder } from '../node/folder.ts'\nimport type { Node } from '../node/node.ts'\n\nimport isSvg from 'is-svg'\nimport { Column } from './column.ts'\n\nexport type ContentsWithRoot = {\n\tfolder: Folder,\n\tcontents: Node[]\n}\n\nexport interface IView {\n\t/** Unique view ID */\n\tid: string\n\t/** Translated view name */\n\tname: string\n\t/** Translated accessible description of the view */\n\tcaption?: string\n\n\t/** Translated title of the empty view */\n\temptyTitle?: string\n\t/** Translated description of the empty view */\n\temptyCaption?: string\n\t/**\n\t * Custom implementation of the empty view.\n\t * If set and no content is found for the current view,\n\t * then this method is called with the container element\n\t * where to render your empty view implementation.\n\t *\n\t * @param div - The container element to render into\n\t */\n\temptyView?: (div: HTMLDivElement) => void\n\n\t/**\n\t * Method return the content of the provided path.\n\t *\n\t * This method _must_ also return the current directory\n\t * information alongside with its content.\n\t *\n\t * Usually a abort signal is provided to be able to\n\t * cancel the request if the user change directory\n\t * {@see https://developer.mozilla.org/en-US/docs/Web/API/AbortController }.\n\t */\n\tgetContents(path: string, options: { signal: AbortSignal }): Promise<ContentsWithRoot>\n\n\t/**\n\t * If set then the view will be hidden from the navigation unless its the active view.\n\t */\n\thidden?: true\n\n\t/** The view icon as an inline svg */\n\ticon: string\n\n\t/**\n\t * The view order.\n\t * If not set will be natural sorted by view name.\n\t */\n\torder?: number\n\n\t/**\n\t * Custom params to give to the router on click\n\t * If defined, will be treated as a dummy view and\n\t * will just redirect and not fetch any contents.\n\t */\n\tparams?: Record<string, string>\n\n\t/**\n\t * This view column(s). Name and actions are\n\t * by default always included\n\t */\n\tcolumns?: Column[]\n\n\t/** The parent unique ID */\n\tparent?: string\n\t/** This view is sticky (sent at the bottom) */\n\tsticky?: boolean\n\n\t/**\n\t * This view has children and is expanded (by default)\n\t * or not. This will be overridden by user config.\n\t */\n\texpanded?: boolean\n\n\t/**\n\t * Will be used as default if the user\n\t * haven't customized their sorting column\n\t */\n\tdefaultSortKey?: string\n\n\t/**\n\t * Method called to load child views if any\n\t */\n\t// eslint-disable-next-line no-use-before-define\n\tloadChildViews?: (view: View) => Promise<void>\n}\n\nexport class View implements IView {\n\n\tprivate _view: IView\n\n\tconstructor(view: IView) {\n\t\tvalidateView(view)\n\t\tthis._view = view\n\t}\n\n\tget id() {\n\t\treturn this._view.id\n\t}\n\n\tget name() {\n\t\treturn this._view.name\n\t}\n\n\tget caption() {\n\t\treturn this._view.caption\n\t}\n\n\tget emptyTitle() {\n\t\treturn this._view.emptyTitle\n\t}\n\n\tget emptyCaption() {\n\t\treturn this._view.emptyCaption\n\t}\n\n\tget getContents() {\n\t\treturn this._view.getContents\n\t}\n\n\tget hidden() {\n\t\treturn this._view.hidden\n\t}\n\n\tget icon() {\n\t\treturn this._view.icon\n\t}\n\n\tset icon(icon) {\n\t\tthis._view.icon = icon\n\t}\n\n\tget order() {\n\t\treturn this._view.order\n\t}\n\n\tset order(order) {\n\t\tthis._view.order = order\n\t}\n\n\tget params() {\n\t\treturn this._view.params\n\t}\n\n\tset params(params) {\n\t\tthis._view.params = params\n\t}\n\n\tget columns() {\n\t\treturn this._view.columns\n\t}\n\n\tget emptyView() {\n\t\treturn this._view.emptyView\n\t}\n\n\tget parent() {\n\t\treturn this._view.parent\n\t}\n\n\tget sticky() {\n\t\treturn this._view.sticky\n\t}\n\n\tget expanded() {\n\t\treturn this._view.expanded\n\t}\n\n\tset expanded(expanded: boolean | undefined) {\n\t\tthis._view.expanded = expanded\n\t}\n\n\tget defaultSortKey() {\n\t\treturn this._view.defaultSortKey\n\t}\n\n\tget loadChildViews() {\n\t\treturn this._view.loadChildViews\n\t}\n\n}\n\n/**\n * Validate a view interface to check all required properties are satisfied.\n *\n * @param view the view to check\n * @throws {Error} if the view is not valid\n */\nexport function validateView(view: IView) {\n\tif (!view.id || typeof view.id !== 'string') {\n\t\tthrow new Error('View id is required and must be a string')\n\t}\n\n\tif (!view.name || typeof view.name !== 'string') {\n\t\tthrow new Error('View name is required and must be a string')\n\t}\n\n\tif ('caption' in view && typeof view.caption !== 'string') {\n\t\tthrow new Error('View caption must be a string')\n\t}\n\n\tif (!view.getContents || typeof view.getContents !== 'function') {\n\t\tthrow new Error('View getContents is required and must be a function')\n\t}\n\n\tif ('hidden' in view && typeof view.hidden !== 'boolean') {\n\t\tthrow new Error('View hidden must be a boolean')\n\t}\n\n\tif (!view.icon || typeof view.icon !== 'string' || !isSvg(view.icon)) {\n\t\tthrow new Error('View icon is required and must be a valid svg string')\n\t}\n\n\tif ('order' in view && typeof view.order !== 'number') {\n\t\tthrow new Error('View order must be a number')\n\t}\n\n\t// Optional properties\n\tif (view.columns) {\n\t\tview.columns.forEach((column) => {\n\t\t\tif (!(column instanceof Column)) {\n\t\t\t\tthrow new Error('View columns must be an array of Column. Invalid column found')\n\t\t\t}\n\t\t})\n\t}\n\n\tif (view.emptyView && typeof view.emptyView !== 'function') {\n\t\tthrow new Error('View emptyView must be a function')\n\t}\n\n\tif (view.parent && typeof view.parent !== 'string') {\n\t\tthrow new Error('View parent must be a string')\n\t}\n\n\tif ('sticky' in view && typeof view.sticky !== 'boolean') {\n\t\tthrow new Error('View sticky must be a boolean')\n\t}\n\n\tif ('expanded' in view && typeof view.expanded !== 'boolean') {\n\t\tthrow new Error('View expanded must be a boolean')\n\t}\n\n\tif (view.defaultSortKey && typeof view.defaultSortKey !== 'string') {\n\t\tthrow new Error('View defaultSortKey must be a string')\n\t}\n\n\tif (view.loadChildViews && typeof view.loadChildViews !== 'function') {\n\t\tthrow new Error('View loadChildViews must be a function')\n\t}\n}\n","/**\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IView } from './view'\n\nimport { validateView } from './view'\nimport { TypedEventTarget } from 'typescript-event-target'\nimport logger from '../utils/logger'\n\n/**\n * The event is emitted when the navigation view was updated.\n * It contains the new active view in the `detail` attribute.\n */\ninterface UpdateActiveViewEvent extends CustomEvent<IView | null> {\n\ttype: 'updateActive'\n}\n\n/**\n * This event is emitted when the list of registered views is changed\n */\ninterface UpdateViewsEvent extends CustomEvent<never> {\n\ttype: 'update'\n}\n\n/**\n * The files navigation manages the available and active views\n *\n * Custom views for the files app can be registered (examples are the favorites views or the shared-with-you view).\n * It is also possible to listen on changes of the registered views or when the current active view is changed.\n * @example\n * ```js\n * const navigation = getNavigation()\n * navigation.addEventListener('update', () => {\n * // This will be called whenever a new view is registered or a view is removed\n * const viewNames = navigation.views.map((view) => view.name)\n * console.warn('Registered views changed', viewNames)\n * })\n * // Or you can react to changes of the current active view\n * navigation.addEventListener('updateActive', (event) => {\n * // This will be called whenever the active view changed\n * const newView = event.detail // you could also use `navigation.active`\n * console.warn('Active view changed to ' + newView.name)\n * })\n * ```\n */\nexport class Navigation extends TypedEventTarget<{ updateActive: UpdateActiveViewEvent, update: UpdateViewsEvent }> {\n\n\tprivate _views: IView[] = []\n\tprivate _currentView: IView | null = null\n\n\t/**\n\t * Register a new view on the navigation\n\t * @param view The view to register\n\t * @throws {Error} if a view with the same id is already registered\n\t * @throws {Error} if the registered view is invalid\n\t */\n\tregister(view: IView): void {\n\t\tif (this._views.find(search => search.id === view.id)) {\n\t\t\tthrow new Error(`IView id ${view.id} is already registered`)\n\t\t}\n\n\t\tvalidateView(view)\n\n\t\tthis._views.push(view)\n\t\tthis.dispatchTypedEvent('update', new CustomEvent<never>('update') as UpdateViewsEvent)\n\t}\n\n\t/**\n\t * Remove a registered view\n\t * @param id The id of the view to remove\n\t */\n\tremove(id: string): void {\n\t\tconst index = this._views.findIndex(view => view.id === id)\n\t\tif (index !== -1) {\n\t\t\tthis._views.splice(index, 1)\n\t\t\tthis.dispatchTypedEvent('update', new CustomEvent('update') as UpdateViewsEvent)\n\t\t}\n\t}\n\n\t/**\n\t * Set the currently active view\n\t *\n\t * @param id - The id of the view to set as active\n\t * @throws {Error} If no view with the given id was registered\n\t * @fires UpdateActiveViewEvent\n\t */\n\tsetActive(id: string | null): void {\n\t\tif (id === null) {\n\t\t\tthis._currentView = null\n\t\t} else {\n\t\t\tconst view = this._views.find(({ id: viewId }) => viewId === id)\n\t\t\tif (!view) {\n\t\t\t\tthrow new Error(`No view with ${id} registered`)\n\t\t\t}\n\t\t\tthis._currentView = view\n\t\t}\n\n\t\tconst event = new CustomEvent<IView | null>('updateActive', { detail: this._currentView })\n\t\tthis.dispatchTypedEvent('updateActive', event as UpdateActiveViewEvent)\n\t}\n\n\t/**\n\t * The currently active files view\n\t */\n\tget active(): IView | null {\n\t\treturn this._currentView\n\t}\n\n\t/**\n\t * All registered views\n\t */\n\tget views(): IView[] {\n\t\treturn this._views\n\t}\n\n}\n\n/**\n * Get the current files navigation\n */\nexport const getNavigation = function(): Navigation {\n\tif (typeof window._nc_navigation === 'undefined') {\n\t\twindow._nc_navigation = new Navigation()\n\t\tlogger.debug('Navigation service initialized')\n\t}\n\n\treturn window._nc_navigation\n}\n","/*\n * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { Folder, Node } from '../node/index.ts'\n\nimport logger from '../utils/logger.ts'\n\nexport enum NewMenuEntryCategory {\n\t/**\n\t * For actions where the user is intended to upload from their device\n\t */\n\tUploadFromDevice = 0,\n\n\t/**\n\t * For actions that create new nodes on the server without uploading\n\t */\n\tCreateNew = 1,\n\n\t/**\n\t * For everything not matching the other categories\n\t */\n\tOther = 2,\n}\n\nexport interface NewMenuEntry {\n\t/** Unique ID */\n\tid: string\n\n\t/**\n\t * Category to put this entry in\n\t * (supported since Nextcloud 30)\n\t * @since 3.3.0\n\t * @default NewMenuEntryCategory.CreateNew\n\t */\n\tcategory?: NewMenuEntryCategory\n\n\t/** Translatable string displayed in the menu */\n\tdisplayName: string\n\n\t/**\n\t * Condition wether this entry is shown or not\n\t * @param context the creation context. Usually the current folder\n\t */\n\tenabled?: (context: Folder) => boolean\n\n\t/**\n\t * Either iconSvgInline or iconClass must be defined\n\t * Svg as inline string. <svg><path fill=\"...\" /></svg>\n\t */\n\ticonSvgInline?: string\n\n\t/** Order of the entry in the menu */\n\torder?: number\n\n\t/**\n\t * Function to be run after creation\n\t * @param context - The creation context. Usually the current folder\n\t * @param content - List of file/folders present in the context folder\n\t */\n\thandler: (context: Folder, content: Node[]) => void\n}\n\nexport class NewMenu {\n\n\tprivate _entries: Array<NewMenuEntry> = []\n\n\tpublic registerEntry(entry: NewMenuEntry) {\n\t\tthis.validateEntry(entry)\n\t\tentry.category = entry.category ?? NewMenuEntryCategory.CreateNew\n\t\tthis._entries.push(entry)\n\t}\n\n\tpublic unregisterEntry(entry: NewMenuEntry | string) {\n\t\tconst entryIndex = typeof entry === 'string'\n\t\t\t? this.getEntryIndex(entry)\n\t\t\t: this.getEntryIndex(entry.id)\n\n\t\tif (entryIndex === -1) {\n\t\t\tlogger.warn('Entry not found, nothing removed', { entry, entries: this.getEntries() })\n\t\t\treturn\n\t\t}\n\n\t\tthis._entries.splice(entryIndex, 1)\n\t}\n\n\t/**\n\t * Get the list of registered entries\n\t *\n\t * @param {Folder} context the creation context. Usually the current folder\n\t */\n\tpublic getEntries(context?: Folder): Array<NewMenuEntry> {\n\t\tif (context) {\n\t\t\treturn this._entries\n\t\t\t\t.filter(entry => typeof entry.enabled === 'function' ? entry.enabled(context) : true)\n\t\t}\n\t\treturn this._entries\n\t}\n\n\tprivate getEntryIndex(id: string): number {\n\t\treturn this._entries.findIndex(entry => entry.id === id)\n\t}\n\n\tprivate validateEntry(entry: NewMenuEntry) {\n\t\tif (!entry.id || !entry.displayName || !entry.iconSvgInline || !entry.handler) {\n\t\t\tthrow new Error('Invalid entry')\n\t\t}\n\n\t\tif (typeof entry.id !== 'string'\n\t\t\t|| typeof entry.displayName !== 'string') {\n\t\t\tthrow new Error('Invalid id or displayName property')\n\t\t}\n\n\t\tif (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string') {\n\t\t\tthrow new Error('Invalid icon provided')\n\t\t}\n\n\t\tif (entry.enabled !== undefined && typeof entry.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled property')\n\t\t}\n\n\t\tif (typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid handler property')\n\t\t}\n\n\t\tif ('order' in entry && typeof entry.order !== 'number') {\n\t\t\tthrow new Error('Invalid order property')\n\t\t}\n\n\t\tif (this.getEntryIndex(entry.id) !== -1) {\n\t\t\tthrow new Error('Duplicate entry')\n\t\t}\n\t}\n\n}\n","/*\n * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { Folder } from '../node/index.ts'\nimport type { NewMenuEntry } from './NewMenu.ts'\n\nimport { NewMenu } from './NewMenu.ts'\nimport logger from '../utils/logger.ts'\n\n/**\n * Get the NewMenu instance used by the files app.\n */\nexport function getNewFileMenu(): NewMenu {\n\tif (typeof window._nc_newfilemenu === 'undefined') {\n\t\twindow._nc_newfilemenu = new NewMenu()\n\t\tlogger.debug('NewFileMenu initialized')\n\t}\n\treturn window._nc_newfilemenu\n}\n\n/**\n * Add a new menu entry to the upload manager menu\n *\n * @param entry - The new file menu entry\n */\nexport function addNewFileMenuEntry(entry: NewMenuEntry): void {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.registerEntry(entry)\n}\n\n/**\n * Remove a previously registered entry from the upload menu\n *\n * @param entry - Entry or id of entry to remove\n */\nexport function removeNewFileMenuEntry(entry: NewMenuEntry | string) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.unregisterEntry(entry)\n}\n\n/**\n * Get the list of registered entries from the upload menu\n *\n * @param {Folder} context - The current folder to get the available entries\n */\nexport function getNewFileMenuEntries(context?: Folder): NewMenuEntry[] {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.getEntries(context).sort((a: NewMenuEntry, b: NewMenuEntry) => {\n\t\t// If defined and different, sort by order\n\t\tif (a.order !== undefined\n\t\t\t&& b.order !== undefined\n\t\t\t&& a.order !== b.order) {\n\t\t\treturn a.order - b.order\n\t\t}\n\t\t// else sort by display name\n\t\treturn a.displayName.localeCompare(b.displayName, undefined, { numeric: true, sensitivity: 'base' })\n\t})\n}\n","/*\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IView } from '../navigation/view.ts'\nimport type { IFolder, INode } from '../node/index.ts'\n\nimport isSvg from 'is-svg'\nimport logger from '../utils/logger.ts'\n\nexport interface ISidebarContext {\n\t/**\n\t * The active node in the sidebar\n\t */\n\tnode: INode\n\n\t/**\n\t * The current open folder in the files app\n\t */\n\tfolder: IFolder\n\n\t/**\n\t * The currently active view\n\t */\n\tview: IView\n}\n\n/**\n * This component describes the custom web component that should be registered for a sidebar tab.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components\n * @see https://vuejs.org/guide/extras/web-components#building-custom-elements-with-vue\n */\nexport interface SidebarComponent extends HTMLElement, ISidebarContext {\n\t/**\n\t * This method is called by the files app if the sidebar tab state changes.\n\t *\n\t * @param active - The new active state\n\t */\n\tsetActive(active: boolean): Promise<void>\n}\n\n/**\n * Implementation of a custom sidebar tab within the files app.\n */\nexport interface ISidebarTab {\n\t/**\n\t * Unique id of the sidebar tab.\n\t * This has to conform to the HTML id attribute specification.\n\t */\n\tid: string\n\n\t/**\n\t * The localized name of the sidebar tab.\n\t */\n\tdisplayName: string\n\n\t/**\n\t * The icon, as SVG, of the sidebar tab.\n\t */\n\ticonSvgInline: string\n\n\t/**\n\t * The order of this tab.\n\t * Use a low number to make this tab ordered in front.\n\t */\n\torder: number\n\n\t/**\n\t * The tag name of the web component.\n\t * The web component must already be registered under that tag name with `CustomElementRegistry.define()`.\n\t *\n\t * To avoid name clashes the name has to start with your appid (e.g. `your_app`).\n\t * So in addition with the web component naming rules a good name would be `your_app-files-sidebar-tab`.\n\t */\n\ttagName: string\n\n\t/**\n\t * Callback to check if the sidebar tab should be shown for the selected node.\n\t *\n\t * @param context - The current context of the files app\n\t */\n\tenabled: (context: ISidebarContext) => boolean\n}\n\n/**\n * Register a new sidebar tab for the files app.\n *\n * @param tab - The sidebar tab to register\n * @throws If the provided tab is not a valid sidebar tab and thus cannot be registered.\n */\nexport function registerSidebarTab(tab: ISidebarTab): void {\n\tvalidateSidebarTab(tab)\n\n\twindow._nc_files_sidebar_tabs ??= new Map<string, ISidebarTab>()\n\tif (window._nc_files_sidebar_tabs.has(tab.id)) {\n\t\tlogger.warn(`Sidebar tab with id \"${tab.id}\" already registered. Skipping.`)\n\t\treturn\n\t}\n\twindow._nc_files_sidebar_tabs.set(tab.id, tab)\n\tlogger.debug(`New sidebar tab with id \"${tab.id}\" registered.`)\n}\n\n/**\n * Get all currently registered sidebar tabs.\n */\nexport function getSidebarTabs(): ISidebarTab[] {\n\tif (window._nc_files_sidebar_tabs) {\n\t\treturn [...window._nc_files_sidebar_tabs.values()]\n\t}\n\treturn []\n}\n\n/**\n * Check if a given sidebar tab objects implements all necessary fields.\n *\n * @param tab - The sidebar tab to validate\n */\nfunction validateSidebarTab(tab: ISidebarTab): void {\n\tif (typeof tab !== 'object') {\n\t\tthrow new Error('Sidebar tab is not an object')\n\t}\n\n\tif (!tab.id || (typeof tab.id !== 'string') || tab.id !== CSS.escape(tab.id)) {\n\t\tthrow new Error('Sidebar tabs need to have an id conforming to the HTML id attribute specifications')\n\t}\n\n\tif (!tab.tagName || typeof tab.tagName !== 'string') {\n\t\tthrow new Error('Sidebar tabs need to have the tagName name set')\n\t}\n\n\tif (!tab.tagName.match(/^[a-z][a-z0-9-_]+$/)) {\n\t\tthrow new Error('Sidebar tabs tagName name is invalid')\n\t}\n\n\tif (!tab.displayName || typeof tab.displayName !== 'string') {\n\t\tthrow new Error('Sidebar tabs need to have a name set')\n\t}\n\n\tif (typeof tab.iconSvgInline !== 'string' || !isSvg(tab.iconSvgInline)) {\n\t\tthrow new Error('Sidebar tabs need to have an valid SVG icon')\n\t}\n\n\tif (typeof tab.order !== 'number') {\n\t\tthrow new Error('Sidebar tabs need to have a numeric order set')\n\t}\n\n\tif (typeof tab.enabled !== 'function') {\n\t\tthrow new Error('Sidebar tabs need to have an \"enabled\" method')\n\t}\n\n\t// now check the custom element constructor\n\tconst tagConstructor = window.customElements.get(tab.tagName)\n\tif (!tagConstructor) {\n\t\tthrow new Error('Sidebar tab element not registered')\n\t}\n\n\tif (!('setActive' in tagConstructor.prototype)) {\n\t\t// we cannot check properties like `node` or `view` because those are not necessarily defined in the prototype.\n\t\tthrow new Error('Sidebar tab elements must have the `setActive` method')\n\t}\n}\n","/*\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { ISidebarContext, ISidebarTab } from './SidebarTab.ts'\n\nimport { getSidebarTabs, registerSidebarTab } from './SidebarTab.ts'\n\nexport interface ISidebar {\n\t/**\n\t * If the files sidebar can currently be accessed.\n\t * Registering tabs also works if the sidebar is currently not available.\n\t */\n\treadonly available: boolean\n\n\t/**\n\t * The current open state of the sidebar\n\t */\n\treadonly open: boolean\n\n\t/**\n\t * Open or close the sidebar\n\t *\n\t * @param open - The new open state\n\t */\n\tsetOpen(open: boolean): void\n\n\t/**\n\t * Register a new sidebar tab\n\t *\n\t * @param tab - The sidebar tab to register\n\t */\n\tregisterTab(tab: ISidebarTab): void\n\n\t/**\n\t * Get all registered sidebar tabs.\n\t * If a node is passed only the enabled tabs are retrieved.\n\t */\n\tgetTabs(context?: ISidebarContext): ISidebarTab[]\n}\n\n/**\n * This is just a proxy allowing an arbitrary `@nextcloud/files` library version to access the defined interface of the sidebar.\n * By proxying this instead of providing the implementation here we ensure that if apps use different versions of the library,\n * we do not end up with version conflicts between them.\n *\n * If we add new properties they just will be available in new library versions.\n * If we decide to do a breaking change we can either add compatibility wrappers in the implementation in the files app.\n */\nclass SidebarProxy implements ISidebar {\n\n\tget available(): boolean {\n\t\treturn !!window.OCA?.Files?.Sidebar\n\t}\n\n\tget open(): boolean {\n\t\treturn !!window.OCA?.Files?.Sidebar?.state.file\n\t}\n\n\tsetOpen(open: boolean): void {\n\t\tif (open) {\n\t\t\twindow.OCA?.Files?.Sidebar?.open()\n\t\t} else {\n\t\t\twindow.OCA?.Files?.Sidebar?.close()\n\t\t}\n\t}\n\n\tsetActiveTab(tabId: string): void {\n\t\twindow.OCA?.Files?.Sidebar?.setActiveTab(tabId)\n\t}\n\n\tregisterTab(tab: ISidebarTab): void {\n\t\tregisterSidebarTab(tab)\n\t}\n\n\tgetTabs(context?: ISidebarContext): ISidebarTab[] {\n\t\tconst tabs = getSidebarTabs()\n\t\tif (context) {\n\t\t\treturn tabs.filter((tab) => tab.enabled(context))\n\t\t}\n\t\treturn tabs\n\t}\n\n}\n\n/**\n * Get a reference to the files sidebar.\n */\nexport function getSidebar(): ISidebar {\n\treturn new SidebarProxy()\n}\n","/**\n * SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later\n */\n\nimport { getCapabilities } from '@nextcloud/capabilities'\n\ninterface NextcloudCapabilities extends Record<string, unknown> {\n\tfiles: {\n\t\t'bigfilechunking': boolean\n\t\t// those are new in Nextcloud 30\n\t\t'forbidden_filenames'?: string[]\n\t\t'forbidden_filename_basenames'?: string[]\n\t\t'forbidden_filename_characters'?: string[]\n\t\t'forbidden_filename_extensions'?: string[]\n\t}\n}\n\nexport enum InvalidFilenameErrorReason {\n\tReservedName = 'reserved name',\n\tCharacter = 'character',\n\tExtension = 'extension',\n}\n\ninterface InvalidFilenameErrorOptions {\n\t/**\n\t * The filename that was validated\n\t */\n\tfilename: string\n\n\t/**\n\t * Reason why the validation failed\n\t */\n\treason: InvalidFilenameErrorReason\n\n\t/**\n\t * Part of the filename that caused this error\n\t */\n\tsegment: string\n}\n\nexport class InvalidFilenameError extends Error {\n\n\tpublic constructor(options: InvalidFilenameErrorOptions) {\n\t\tsuper(`Invalid ${options.reason} '${options.segment}' in filename '${options.filename}'`, { cause: options })\n\t}\n\n\t/**\n\t * The filename that was validated\n\t */\n\tpublic get filename() {\n\t\treturn (this.cause as InvalidFilenameErrorOptions).filename\n\t}\n\n\t/**\n\t * Reason why the validation failed\n\t */\n\tpublic get reason() {\n\t\treturn (this.cause as InvalidFilenameErrorOptions).reason\n\t}\n\n\t/**\n\t * Part of the filename that caused this error\n\t */\n\tpublic get segment() {\n\t\treturn (this.cause as InvalidFilenameErrorOptions).segment\n\t}\n\n}\n\n/**\n * Validate a given filename\n * @param filename The filename to check\n * @throws {InvalidFilenameError}\n */\nexport function validateFilename(filename: string): void {\n\tconst capabilities = (getCapabilities() as NextcloudCapabilities).files\n\n\t// Handle forbidden characters\n\t// This needs to be done first as the other checks are case insensitive!\n\tconst forbiddenCharacters = capabilities.forbidden_filename_characters ?? ['/', '\\\\']\n\tfor (const character of forbiddenCharacters) {\n\t\tif (filename.includes(character)) {\n\t\t\tthrow new InvalidFilenameError({ segment: character, reason: InvalidFilenameErrorReason.Character, filename })\n\t\t}\n\t}\n\n\t// everything else is case insensitive (the capabilities are returned lowercase)\n\tfilename = filename.toLocaleLowerCase()\n\n\t// Handle forbidden filenames, on older Nextcloud versions without this capability it was hardcoded in the backend to '.htaccess'\n\tconst forbiddenFilenames = capabilities.forbidden_filenames ?? ['.htaccess']\n\tif (forbiddenFilenames.includes(filename)) {\n\t\tthrow new InvalidFilenameError({ filename, segment: filename, reason: InvalidFilenameErrorReason.ReservedName })\n\t}\n\n\t// Handle forbidden basenames\n\tconst endOfBasename = filename.indexOf('.', 1)\n\tconst basename = filename.substring(0, endOfBasename === -1 ? undefined : endOfBasename)\n\tconst forbiddenFilenameBasenames = capabilities.forbidden_filename_basenames ?? []\n\tif (forbiddenFilenameBasenames.includes(basename)) {\n\t\tthrow new InvalidFilenameError({ filename, segment: basename, reason: InvalidFilenameErrorReason.ReservedName })\n\t}\n\n\tconst forbiddenFilenameExtensions = capabilities.forbidden_filename_extensions ?? []\n\tfor (const extension of forbiddenFilenameExtensions) {\n\t\tif (filename.length > extension.length && filename.endsWith(extension)) {\n\t\t\tthrow new InvalidFilenameError({ segment: extension, reason: InvalidFilenameErrorReason.Extension, filename })\n\t\t}\n\t}\n}\n\n/**\n * Check the validity of a filename\n * This is a convenient wrapper for `checkFilenameValidity` to only return a boolean for the valid\n * @param filename Filename to check validity\n */\nexport function isFilenameValid(filename: string): boolean {\n\ttry {\n\t\tvalidateFilename(filename)\n\t\treturn true\n\t} catch (error) {\n\t\tif (error instanceof InvalidFilenameError) {\n\t\t\treturn false\n\t\t}\n\t\tthrow error\n\t}\n}\n","/**\n * SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later\n */\n\nimport { basename, extname } from '@nextcloud/paths'\n\ninterface UniqueNameOptions {\n\t/**\n\t * A function that takes an index and returns a suffix to add to the file name, defaults to '(index)'\n\t * @param index The current index to add\n\t */\n\tsuffix?: (index: number) => string\n\t/**\n\t * Set to true to ignore the file extension when adding the suffix (when getting a unique directory name)\n\t */\n\tignoreFileExtension?: boolean\n}\n\n/**\n * Create an unique file name\n * @param name The initial name to use\n * @param otherNames Other names that are already used\n * @param options Optional parameters for tuning the behavior\n * @return {string} Either the initial name, if unique, or the name with the suffix so that the name is unique\n */\nexport function getUniqueName(\n\tname: string,\n\totherNames: string[],\n\toptions?: UniqueNameOptions,\n): string {\n\tconst opts = {\n\t\tsuffix: (n: number) => `(${n})`,\n\t\tignoreFileExtension: false,\n\t\t...options,\n\t}\n\n\tlet newName = name\n\tlet i = 1\n\twhile (otherNames.includes(newName)) {\n\t\tconst ext = opts.ignoreFileExtension ? '' : extname(name)\n\t\tconst base = basename(name, ext)\n\t\tnewName = `${base} ${opts.suffix(i++)}${ext}`\n\t}\n\treturn newName\n}\n","/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { getCanonicalLocale } from '@nextcloud/l10n'\n\nconst humanList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']\nconst humanListBinary = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB']\n\n/**\n * Format a file size in a human-like format. e.g. 42GB\n *\n * The default for Nextcloud is like Windows using binary sizes but showing decimal units,\n * meaning 1024 bytes will show as 1KB instead of 1KiB or like on Apple 1.02 KB\n *\n * @param size in bytes\n * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead\n * @param binaryPrefixes True if size binary prefixes like `KiB` should be used as per IEC 80000-13\n * @param base1000 Set to true to use base 1000 as per SI or used by Apple (default is base 1024 like Linux or Windows)\n */\nexport function formatFileSize(size: number|string, skipSmallSizes = false, binaryPrefixes = false, base1000 = false): string {\n\t// Binary prefixes only work with base 1024\n\tbinaryPrefixes = binaryPrefixes && !base1000\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t// Calculate Log with base 1024 or 1000: size = base ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(base1000 ? 1000 : 1024)) : 0\n\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min((binaryPrefixes ? humanListBinary.length : humanList.length) - 1, order)\n\n\tconst readableFormat = binaryPrefixes ? humanListBinary[order] : humanList[order]\n\tlet relativeSize = (size / Math.pow(base1000 ? 1000 : 1024, order)).toFixed(1)\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\treturn (relativeSize !== '0.0' ? '< 1 ' : '0 ') + (binaryPrefixes ? humanListBinary[1] : humanList[1])\n\t}\n\n\tif (order < 2) {\n\t\trelativeSize = parseFloat(relativeSize).toFixed(0)\n\t} else {\n\t\trelativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale())\n\t}\n\n\treturn relativeSize + ' ' + readableFormat\n}\n\n/**\n * Returns a file size in bytes from a humanly readable string\n * Note: `b` and `B` are both parsed as bytes and not as bit or byte.\n *\n * @param {string} value file size in human-readable format\n * @param {boolean} forceBinary for backwards compatibility this allows values to be base 2 (so 2KB means 2048 bytes instead of 2000 bytes)\n * @return {number} or null if string could not be parsed\n */\nexport function parseFileSize(value: string, forceBinary = false) {\n\ttry {\n\t\tvalue = `${value}`.toLocaleLowerCase().replaceAll(/\\s+/g, '').replaceAll(',', '.')\n\t} catch (e) {\n\t\treturn null\n\t}\n\n\tconst match = value.match(/^([0-9]*(\\.[0-9]*)?)([kmgtp]?)(i?)b?$/)\n\t// ignore not found, missing pre- and decimal, empty number\n\tif (match === null || match[1] === '.' || match[1] === '') {\n\t\treturn null\n\t}\n\n\tconst bytesArray = {\n\t\t'': 0,\n\t\tk: 1,\n\t\tm: 2,\n\t\tg: 3,\n\t\tt: 4,\n\t\tp: 5,\n\t\te: 6,\n\t}\n\n\tconst decimalString = `${match[1]}`\n\tconst base = (match[4] === 'i' || forceBinary) ? 1024 : 1000\n\n\treturn Math.round(Number.parseFloat(decimalString) * (base ** bytesArray[match[3]]))\n}\n","/**\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { getCanonicalLocale, getLanguage } from '@nextcloud/l10n'\n\ntype IdentifierFn<T> = (v: T) => unknown\nexport type SortingOrder = 'asc'|'desc'\n\n/**\n * Helper to create string representation\n * @param value Value to stringify\n */\nfunction stringify(value: unknown) {\n\t// The default representation of Date is not sortable because of the weekday names in front of it\n\tif (value instanceof Date) {\n\t\treturn value.toISOString()\n\t}\n\treturn String(value)\n}\n\n/**\n * Natural order a collection\n * You can define identifiers as callback functions, that get the element and return the value to sort.\n *\n * @param collection The collection to order\n * @param identifiers An array of identifiers to use, by default the identity of the element is used\n * @param orders Array of orders, by default all identifiers are sorted ascening\n */\nexport function orderBy<T>(collection: readonly T[], identifiers?: IdentifierFn<T>[], orders?: SortingOrder[]): T[] {\n\t// If not identifiers are set we use the identity of the value\n\tidentifiers = identifiers ?? [(value) => value]\n\t// By default sort the collection ascending\n\torders = orders ?? []\n\tconst sorting = identifiers.map((_, index) => (orders[index] ?? 'asc') === 'asc' ? 1 : -1)\n\n\tconst collator = Intl.Collator(\n\t\t[getLanguage(), getCanonicalLocale()],\n\t\t{\n\t\t\t// handle 10 as ten and not as one-zero\n\t\t\tnumeric: true,\n\t\t\tusage: 'sort',\n\t\t},\n\t)\n\n\treturn [...collection].sort((a, b) => {\n\t\tfor (const [index, identifier] of identifiers.entries()) {\n\t\t\t// Get the local compare of stringified value a and b\n\t\t\tconst value = collator.compare(stringify(identifier(a)), stringify(identifier(b)))\n\t\t\t// If they do not match return the order\n\t\t\tif (value !== 0) {\n\t\t\t\treturn value * sorting[index]\n\t\t\t}\n\t\t\t// If they match we need to continue with the next identifier\n\t\t}\n\t\t// If all are equal we need to return equality\n\t\treturn 0\n\t})\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { INode } from '../node/node.ts'\nimport type { SortingOrder } from './sorting.ts'\n\nimport { FileType } from '../node/fileType.ts'\nimport { orderBy } from './sorting.ts'\n\nexport enum FilesSortingMode {\n\tName = 'basename',\n\tModified = 'mtime',\n\tSize = 'size',\n}\n\nexport interface FilesSortingOptions {\n\t/**\n\t * They key to order the files by\n\t * @default FilesSortingMode.Name\n\t */\n\tsortingMode?: FilesSortingMode | string\n\n\t/**\n\t * @default 'asc'\n\t */\n\tsortingOrder?: SortingOrder\n\n\t/**\n\t * If set to true nodes marked as favorites are ordered on top of all other nodes\n\t * @default false\n\t */\n\tsortFavoritesFirst?: boolean\n\n\t/**\n\t * If set to true folders are ordered on top of files\n\t * @default false\n\t */\n\tsortFoldersFirst?: boolean\n}\n\n/**\n * Sort files and folders according to the sorting options\n * @param nodes Nodes to sort\n * @param options Sorting options\n */\nexport function sortNodes(nodes: readonly INode[], options: FilesSortingOptions = {}): INode[] {\n\tconst sortingOptions = {\n\t\t// Default to sort by name\n\t\tsortingMode: FilesSortingMode.Name,\n\t\t// Default to sort ascending\n\t\tsortingOrder: 'asc' as const,\n\t\t...options,\n\t}\n\n\t/**\n\t * Get the basename without any extension if the current node is a file\n\t *\n\t * @param node - The node to get the basename of\n\t */\n\tfunction basename(node: INode): string {\n\t\tconst name = node.displayname || node.attributes?.displayname || node.basename || ''\n\t\tif (node.type === FileType.Folder) {\n\t\t\treturn name\n\t\t}\n\n\t\treturn name.lastIndexOf('.') > 0\n\t\t\t? name.slice(0, name.lastIndexOf('.'))\n\t\t\t: name\n\t}\n\n\tconst identifiers = [\n\t\t// 1: Sort favorites first if enabled\n\t\t...(sortingOptions.sortFavoritesFirst ? [(v: INode) => v.attributes?.favorite !== 1] : []),\n\t\t// 2: Sort folders first if sorting by name\n\t\t...(sortingOptions.sortFoldersFirst ? [(v: INode) => v.type !== 'folder'] : []),\n\t\t// 3: Use sorting mode if NOT basename (to be able to use display name too)\n\t\t...(sortingOptions.sortingMode !== FilesSortingMode.Name ? [(v: INode) => v[sortingOptions.sortingMode] ?? v.attributes[sortingOptions.sortingMode]] : []),\n\t\t// 4: Use display name if available, fallback to name\n\t\t(v: INode) => basename(v),\n\t\t// 5: Finally, use basename if all previous sorting methods failed\n\t\t(v: INode) => v.basename,\n\t]\n\tconst orders = [\n\t\t// (for 1): always sort favorites before normal files\n\t\t...(sortingOptions.sortFavoritesFirst ? ['asc'] : []),\n\t\t// (for 2): always sort folders before files\n\t\t...(sortingOptions.sortFoldersFirst ? ['asc'] : []),\n\t\t// (for 3): Reverse if sorting by mtime as mtime higher means edited more recent -> lower\n\t\t...(sortingOptions.sortingMode === FilesSortingMode.Modified ? [sortingOptions.sortingOrder === 'asc' ? 'desc' : 'asc'] : []),\n\t\t// (also for 3 so make sure not to conflict with 2 and 3)\n\t\t...(sortingOptions.sortingMode !== FilesSortingMode.Modified && sortingOptions.sortingMode !== FilesSortingMode.Name ? [sortingOptions.sortingOrder] : []),\n\t\t// for 4: use configured sorting direction\n\t\tsortingOptions.sortingOrder,\n\t\t// for 5: use configured sorting direction\n\t\tsortingOptions.sortingOrder,\n\t] as ('asc'|'desc')[]\n\n\treturn orderBy(nodes, identifiers, orders)\n}\n"],"names":["DefaultType","require$$0","require$$1","re","a","b","require$$2","require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BAAiB,QAAQ,SAAS,KAAK,IAAI,CAAA;AAAA;AAAA,IAE1H,GAAI,eAAe,gBAAgB,WAA6B,eAAe,gBAAgB,aAAwB,CAAC,eAAe,YAAY,IAAI,CAAA;AAAA;AAAA,IAEvJ,eAAe;AAAA;AAAA,IAEf,eAAe;AAAA,EAAA;AAGhB,SAAO,QAAQ,OAAOC,cAAa,MAAM;AAC1C;","x_google_ignoreList":[2,3,4,5,6,7,8,9,10,11]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../lib/actions/fileAction.ts","../lib/actions/fileListAction.ts","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/debug.js","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/constants.js","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/re.js","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/parse-options.js","../node_modules/@nextcloud/event-bus/node_modules/semver/internal/identifiers.js","../node_modules/@nextcloud/event-bus/node_modules/semver/classes/semver.js","../node_modules/@nextcloud/event-bus/node_modules/semver/functions/major.js","../node_modules/@nextcloud/event-bus/node_modules/semver/functions/parse.js","../node_modules/@nextcloud/event-bus/node_modules/semver/functions/valid.js","../node_modules/@nextcloud/event-bus/dist/index.mjs","../lib/fileListFilters.ts","../lib/fileListHeaders.ts","../lib/utils/objectValidation.ts","../lib/navigation/column.ts","../lib/navigation/view.ts","../lib/navigation/navigation.ts","../lib/newMenu/NewMenu.ts","../lib/newMenu/functions.ts","../lib/sidebar/SidebarTab.ts","../lib/sidebar/Sidebar.ts","../lib/utils/filename-validation.ts","../lib/utils/filename.ts","../lib/utils/fileSize.ts","../lib/utils/sorting.ts","../lib/utils/fileSorting.ts"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { ActionContext, ActionContextSingle } from '../types.ts'\n\nimport logger from '../utils/logger.ts'\n\nexport enum DefaultType {\n\tDEFAULT = 'default',\n\tHIDDEN = 'hidden',\n}\n\nexport interface IHotkeyConfig {\n\t/**\n\t * Short, translated, description what this action is doing.\n\t * This will be used as the description next to the hotkey in the shortcuts overview.\n\t */\n\tdescription: string\n\n\t/**\n\t * The key to be pressed.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key\n\t */\n\tkey: string\n\n\t/**\n\t * If set then the callback is only called when the shift key is (not) pressed.\n\t * When left `undefined` a pressed shift key is ignored (callback is run with and without shift pressed).\n\t */\n\tshift?: boolean\n\n\t/**\n\t * Only execute the action if the control key is pressed.\n\t * On Mac devices the command key is used instead.\n\t */\n\tctrl?: true\n\n\t/**\n\t * Only execute the action if the alt key is pressed\n\t */\n\talt?: true\n}\n\nexport interface FileActionData {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: (context: ActionContext) => string\n\t/** Translatable title for of the action */\n\ttitle?: (context: ActionContext) => string\n\t/** Svg as inline string. <svg><path fill=\"...\" /></svg> */\n\ticonSvgInline: (context: ActionContext) => string\n\t/** Condition wether this action is shown or not */\n\tenabled?: (context: ActionContext) => boolean\n\n\t/**\n\t * Function executed on single file action\n\t * @return true if the action was executed successfully,\n\t * false otherwise and null if the action is silent/undefined.\n\t * @throws Error if the action failed\n\t */\n\texec: (context: ActionContextSingle) => Promise<boolean|null>,\n\t/**\n\t * Function executed on multiple files action\n\t * @return true if the action was executed successfully,\n\t * false otherwise and null if the action is silent/undefined.\n\t * @throws Error if the action failed\n\t */\n\texecBatch?: (context: ActionContext) => Promise<(boolean|null)[]>\n\n\t/** This action order in the list */\n\torder?: number\n\n\t/**\n\t * Allows to define a hotkey which will trigger this action for the selected node.\n\t */\n\thotkey?: IHotkeyConfig\n\n\t/**\n\t * Set to true if this action is a destructive action, like \"delete\".\n\t * This will change the appearance in the action menu more prominent (e.g. red colored)\n\t */\n\tdestructive?: boolean\n\n\t/**\n\t * This action's parent id in the list.\n\t * If none found, will be displayed as a top-level action.\n\t */\n\tparent?: string,\n\n\t/**\n\t * Make this action the default.\n\t * If multiple actions are default, the first one\n\t * will be used. The other ones will be put as first\n\t * entries in the actions menu iff DefaultType.Hidden is not used.\n\t * A DefaultType.Hidden action will never be shown\n\t * in the actions menu even if another action takes\n\t * its place as default.\n\t */\n\tdefault?: DefaultType,\n\t/**\n\t * If true, the renderInline function will be called\n\t */\n\tinline?: (context: ActionContextSingle) => boolean,\n\t/**\n\t * If defined, the returned html element will be\n\t * appended before the actions menu.\n\t */\n\trenderInline?: (context: ActionContextSingle) => Promise<HTMLElement | null>,\n}\n\nexport class FileAction {\n\n\tprivate _action: FileActionData\n\n\tconstructor(action: FileActionData) {\n\t\tthis.validateAction(action)\n\t\tthis._action = action\n\t}\n\n\tget id() {\n\t\treturn this._action.id\n\t}\n\n\tget displayName() {\n\t\treturn this._action.displayName\n\t}\n\n\tget title() {\n\t\treturn this._action.title\n\t}\n\n\tget iconSvgInline() {\n\t\treturn this._action.iconSvgInline\n\t}\n\n\tget enabled() {\n\t\treturn this._action.enabled\n\t}\n\n\tget exec() {\n\t\treturn this._action.exec\n\t}\n\n\tget execBatch() {\n\t\treturn this._action.execBatch\n\t}\n\n\tget hotkey() {\n\t\treturn this._action.hotkey\n\t}\n\n\tget order() {\n\t\treturn this._action.order\n\t}\n\n\tget parent() {\n\t\treturn this._action.parent\n\t}\n\n\tget default() {\n\t\treturn this._action.default\n\t}\n\n\tget destructive() {\n\t\treturn this._action.destructive\n\t}\n\n\tget inline() {\n\t\treturn this._action.inline\n\t}\n\n\tget renderInline() {\n\t\treturn this._action.renderInline\n\t}\n\n\tprivate validateAction(action: FileActionData) {\n\t\tif (!action.id || typeof action.id !== 'string') {\n\t\t\tthrow new Error('Invalid id')\n\t\t}\n\n\t\tif (!action.displayName || typeof action.displayName !== 'function') {\n\t\t\tthrow new Error('Invalid displayName function')\n\t\t}\n\n\t\tif ('title' in action && typeof action.title !== 'function') {\n\t\t\tthrow new Error('Invalid title function')\n\t\t}\n\n\t\tif (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {\n\t\t\tthrow new Error('Invalid iconSvgInline function')\n\t\t}\n\n\t\tif (!action.exec || typeof action.exec !== 'function') {\n\t\t\tthrow new Error('Invalid exec function')\n\t\t}\n\n\t\t// Optional properties --------------------------------------------\n\t\tif ('enabled' in action && typeof action.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled function')\n\t\t}\n\n\t\tif ('execBatch' in action && typeof action.execBatch !== 'function') {\n\t\t\tthrow new Error('Invalid execBatch function')\n\t\t}\n\n\t\tif ('order' in action && typeof action.order !== 'number') {\n\t\t\tthrow new Error('Invalid order')\n\t\t}\n\n\t\tif (action.destructive !== undefined && typeof action.destructive !== 'boolean') {\n\t\t\tthrow new Error('Invalid destructive flag')\n\t\t}\n\n\t\tif ('parent' in action && typeof action.parent !== 'string') {\n\t\t\tthrow new Error('Invalid parent')\n\t\t}\n\n\t\tif (action.default && !Object.values(DefaultType).includes(action.default)) {\n\t\t\tthrow new Error('Invalid default')\n\t\t}\n\n\t\tif ('inline' in action && typeof action.inline !== 'function') {\n\t\t\tthrow new Error('Invalid inline function')\n\t\t}\n\n\t\tif ('renderInline' in action && typeof action.renderInline !== 'function') {\n\t\t\tthrow new Error('Invalid renderInline function')\n\t\t}\n\n\t\tif ('hotkey' in action && action.hotkey !== undefined) {\n\t\t\tif (typeof action.hotkey !== 'object') {\n\t\t\t\tthrow new Error('Invalid hotkey configuration')\n\t\t\t}\n\n\t\t\tif (typeof action.hotkey.key !== 'string' || !action.hotkey.key) {\n\t\t\t\tthrow new Error('Missing or invalid hotkey key')\n\t\t\t}\n\n\t\t\tif (typeof action.hotkey.description !== 'string' || !action.hotkey.description) {\n\t\t\t\tthrow new Error('Missing or invalid hotkey description')\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nexport const registerFileAction = function(action: FileAction): void {\n\tif (typeof window._nc_fileactions === 'undefined') {\n\t\twindow._nc_fileactions = []\n\t\tlogger.debug('FileActions initialized')\n\t}\n\n\t// Check duplicates\n\tif (window._nc_fileactions.find(search => search.id === action.id)) {\n\t\tlogger.error(`FileAction ${action.id} already registered`, { action })\n\t\treturn\n\t}\n\n\twindow._nc_fileactions.push(action)\n}\n\nexport const getFileActions = function(): FileAction[] {\n\tif (typeof window._nc_fileactions === 'undefined') {\n\t\twindow._nc_fileactions = []\n\t\tlogger.debug('FileActions initialized')\n\t}\n\n\treturn window._nc_fileactions\n}\n","/**\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { ViewActionContext } from '../types.ts'\n\nimport logger from '../utils/logger.ts'\n\ninterface FileListActionData {\n\t/** Unique ID */\n\tid: string\n\n\t/** Translated name of the action */\n\tdisplayName: (context: ViewActionContext) => string\n\n\t/** Raw svg string */\n\ticonSvgInline?: (context: ViewActionContext) => string\n\n\t/** Sort order */\n\torder: number\n\n\t/**\n\t * Condition whether this action is shown or not\n\t */\n\tenabled?: (context: ViewActionContext) => boolean\n\n\t/**\n\t * Function executed on single file action\n\t * @return true if the action was executed successfully,\n\t * false otherwise and null if the action is silent/undefined.\n\t * @throws Error if the action failed\n\t */\n\texec: (context: ViewActionContext) => Promise<boolean|null>,\n}\n\nexport class FileListAction {\n\n\tprivate _action: FileListActionData\n\n\tconstructor(action: FileListActionData) {\n\t\tthis.validateAction(action)\n\t\tthis._action = action\n\t}\n\n\tget id() {\n\t\treturn this._action.id\n\t}\n\n\tget displayName() {\n\t\treturn this._action.displayName\n\t}\n\n\tget iconSvgInline() {\n\t\treturn this._action.iconSvgInline\n\t}\n\n\tget order() {\n\t\treturn this._action.order\n\t}\n\n\tget enabled() {\n\t\treturn this._action.enabled\n\t}\n\n\tget exec() {\n\t\treturn this._action.exec\n\t}\n\n\tprivate validateAction(action: FileListActionData) {\n\t\tif (!action.id || typeof action.id !== 'string') {\n\t\t\tthrow new Error('Invalid id')\n\t\t}\n\n\t\tif (!action.displayName || typeof action.displayName !== 'function') {\n\t\t\tthrow new Error('Invalid displayName function')\n\t\t}\n\n\t\tif ('iconSvgInline' in action && typeof action.iconSvgInline !== 'function') {\n\t\t\tthrow new Error('Invalid iconSvgInline function')\n\t\t}\n\n\t\tif ('order' in action && typeof action.order !== 'number') {\n\t\t\tthrow new Error('Invalid order')\n\t\t}\n\n\t\tif ('enabled' in action && typeof action.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled function')\n\t\t}\n\n\t\tif (!action.exec || typeof action.exec !== 'function') {\n\t\t\tthrow new Error('Invalid exec function')\n\t\t}\n\t}\n\n}\n\nexport const registerFileListAction = (action: FileListAction) => {\n\tif (typeof window._nc_filelistactions === 'undefined') {\n\t\twindow._nc_filelistactions = []\n\t}\n\n\tif (window._nc_filelistactions.find(listAction => listAction.id === action.id)) {\n\t\tlogger.error(`FileListAction with id \"${action.id}\" is already registered`, { action })\n\t\treturn\n\t}\n\n\twindow._nc_filelistactions.push(action)\n}\n\nexport const getFileListActions = (): FileListAction[] => {\n\tif (typeof window._nc_filelistactions === 'undefined') {\n\t\twindow._nc_filelistactions = []\n\t}\n\n\treturn window._nc_filelistactions\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numberic identifiers include numberic identifiers but can be longer.\n// Therefore non-numberic identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","import major from \"semver/functions/major.js\";\nimport valid from \"semver/functions/valid.js\";\n/*!\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\nclass ProxyBus {\n bus;\n constructor(bus2) {\n if (typeof bus2.getVersion !== \"function\" || !valid(bus2.getVersion())) {\n console.warn(\"Proxying an event bus with an unknown or invalid version\");\n } else if (major(bus2.getVersion()) !== major(this.getVersion())) {\n console.warn(\n \"Proxying an event bus of version \" + bus2.getVersion() + \" with \" + this.getVersion()\n );\n }\n this.bus = bus2;\n }\n getVersion() {\n return \"3.3.3\";\n }\n subscribe(name, handler) {\n this.bus.subscribe(name, handler);\n }\n unsubscribe(name, handler) {\n this.bus.unsubscribe(name, handler);\n }\n emit(name, ...event) {\n this.bus.emit(name, ...event);\n }\n}\n/*!\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\nclass SimpleBus {\n handlers = /* @__PURE__ */ new Map();\n getVersion() {\n return \"3.3.3\";\n }\n subscribe(name, handler) {\n this.handlers.set(\n name,\n (this.handlers.get(name) || []).concat(\n handler\n )\n );\n }\n unsubscribe(name, handler) {\n this.handlers.set(\n name,\n (this.handlers.get(name) || []).filter((h) => h !== handler)\n );\n }\n emit(name, ...event) {\n const handlers = this.handlers.get(name) || [];\n handlers.forEach((h) => {\n try {\n ;\n h(event[0]);\n } catch (e) {\n console.error(\"could not invoke event listener\", e);\n }\n });\n }\n}\n/*!\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\nlet bus = null;\nfunction getBus() {\n if (bus !== null) {\n return bus;\n }\n if (typeof window === \"undefined\") {\n return new Proxy({}, {\n get: () => {\n return () => console.error(\n \"Window not available, EventBus can not be established!\"\n );\n }\n });\n }\n if (window.OC?._eventBus && typeof window._nc_event_bus === \"undefined\") {\n console.warn(\n \"found old event bus instance at OC._eventBus. Update your version!\"\n );\n window._nc_event_bus = window.OC._eventBus;\n }\n if (typeof window?._nc_event_bus !== \"undefined\") {\n bus = new ProxyBus(window._nc_event_bus);\n } else {\n bus = window._nc_event_bus = new SimpleBus();\n }\n return bus;\n}\nfunction subscribe(name, handler) {\n getBus().subscribe(name, handler);\n}\nfunction unsubscribe(name, handler) {\n getBus().unsubscribe(name, handler);\n}\nfunction emit(name, ...event) {\n getBus().emit(name, ...event);\n}\nexport {\n ProxyBus,\n SimpleBus,\n emit,\n subscribe,\n unsubscribe\n};\n//# sourceMappingURL=index.mjs.map\n","/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { INode } from './node/index.ts'\n\nimport { emit } from '@nextcloud/event-bus'\nimport { TypedEventTarget } from 'typescript-event-target'\n\n/**\n * Active filters can provide one or more \"chips\" to show the currently active state.\n * Must at least provide a text representing the filters state and a callback to unset that state (disable this filter).\n */\nexport interface IFileListFilterChip {\n\t/**\n\t * Text of the chip\n\t */\n\ttext: string\n\n\t/**\n\t * Optional icon to be used on the chip (inline SVG as string)\n\t */\n\ticon?: string\n\n\t/**\n\t * Optional pass a user id to use a user avatar instead of an icon\n\t */\n\tuser?: string\n\n\t/**\n\t * Handler to be called on click\n\t */\n\tonclick: () => void\n}\n\n/**\n * This event is emitted when the the filter value changed and the file list needs to be updated\n */\nexport interface FilterUpdateEvent extends CustomEvent<never> {\n\ttype: 'update:filter'\n}\n\n/**\n * This event is emitted when the the filter value changed and the file list needs to be updated\n */\nexport interface FilterUpdateChipsEvent extends CustomEvent<IFileListFilterChip[]> {\n\ttype: 'update:chips'\n}\n\ninterface IFileListFilterEvents {\n\t[name: string]: CustomEvent,\n\t'update:filter': FilterUpdateEvent\n\t'update:chips' : FilterUpdateChipsEvent\n}\n\nexport interface IFileListFilter extends TypedEventTarget<IFileListFilterEvents> {\n\n\t/**\n\t * Unique ID of this filter\n\t */\n\treadonly id: string\n\n\t/**\n\t * Order of the filter\n\t *\n\t * Use a low number to make this filter ordered in front.\n\t */\n\treadonly order: number\n\n\t/**\n\t * Filter function to decide if a node is shown.\n\t *\n\t * @param nodes Nodes to filter\n\t * @return Subset of the `nodes` parameter to show\n\t */\n\tfilter(nodes: INode[]): INode[]\n\n\t/**\n\t * If the filter needs a visual element for settings it can provide a function to mount it.\n\t * @param el The DOM element to mount to\n\t */\n\tmount?(el: HTMLElement): void\n\n\t/**\n\t * Reset the filter to the initial state.\n\t * This is called by the files app.\n\t * Implementations should make sure,that if they provide chips they need to emit the `update:chips` event.\n\t *\n\t * @since 3.10.0\n\t */\n\treset?(): void\n}\n\nexport class FileListFilter extends TypedEventTarget<IFileListFilterEvents> implements IFileListFilter {\n\n\tpublic id: string\n\n\tpublic order: number\n\n\tconstructor(id: string, order: number = 100) {\n\t\tsuper()\n\t\tthis.id = id\n\t\tthis.order = order\n\t}\n\n\tpublic filter(nodes: INode[]): INode[] {\n\t\tthrow new Error('Not implemented')\n\t\treturn nodes\n\t}\n\n\tprotected updateChips(chips: IFileListFilterChip[]) {\n\t\tthis.dispatchTypedEvent('update:chips', new CustomEvent('update:chips', { detail: chips }) as FilterUpdateChipsEvent)\n\t}\n\n\tprotected filterUpdated() {\n\t\tthis.dispatchTypedEvent('update:filter', new CustomEvent('update:filter') as FilterUpdateEvent)\n\t}\n\n}\n\n/**\n * Register a new filter on the file list\n *\n * This only must be called once to register the filter,\n * when the filter state changes you need to call `filterUpdated` on the filter instead.\n *\n * @param filter The filter to register on the file list\n */\nexport function registerFileListFilter(filter: IFileListFilter): void {\n\tif (!window._nc_filelist_filters) {\n\t\twindow._nc_filelist_filters = new Map<string, IFileListFilter>()\n\t}\n\tif (window._nc_filelist_filters.has(filter.id)) {\n\t\tthrow new Error(`File list filter \"${filter.id}\" already registered`)\n\t}\n\twindow._nc_filelist_filters.set(filter.id, filter)\n\temit('files:filter:added', filter)\n}\n\n/**\n * Remove a registered filter from the file list\n * @param filterId The unique ID of the filter to remove\n */\nexport function unregisterFileListFilter(filterId: string): void {\n\tif (window._nc_filelist_filters && window._nc_filelist_filters.has(filterId)) {\n\t\twindow._nc_filelist_filters.delete(filterId)\n\t\temit('files:filter:removed', filterId)\n\t}\n}\n\n/**\n * Get all registered file list filters\n */\nexport function getFileListFilters(): IFileListFilter[] {\n\tif (!window._nc_filelist_filters) {\n\t\treturn []\n\t}\n\treturn [...window._nc_filelist_filters.values()]\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IFolder } from './node/folder.ts'\nimport type { IView } from './navigation/view.ts'\n\nimport logger from './utils/logger.ts'\n\nexport interface HeaderData {\n\t/** Unique ID */\n\tid: string\n\t/** Order */\n\torder: number\n\t/** Condition wether this header is shown or not */\n\tenabled?: (folder: IFolder, view: IView) => boolean\n\t/** Executed when file list is initialized */\n\trender: (el: HTMLElement, folder: IFolder, view: IView) => void\n\t/** Executed when root folder changed */\n\tupdated(folder: IFolder, view: IView)\n}\n\nexport class Header {\n\n\tprivate _header: HeaderData\n\n\tconstructor(header: HeaderData) {\n\t\tthis.validateHeader(header)\n\t\tthis._header = header\n\t}\n\n\tget id() {\n\t\treturn this._header.id\n\t}\n\n\tget order() {\n\t\treturn this._header.order\n\t}\n\n\tget enabled() {\n\t\treturn this._header.enabled\n\t}\n\n\tget render() {\n\t\treturn this._header.render\n\t}\n\n\tget updated() {\n\t\treturn this._header.updated\n\t}\n\n\tprivate validateHeader(header: HeaderData) {\n\t\tif (!header.id || !header.render || !header.updated) {\n\t\t\tthrow new Error('Invalid header: id, render and updated are required')\n\t\t}\n\n\t\tif (typeof header.id !== 'string') {\n\t\t\tthrow new Error('Invalid id property')\n\t\t}\n\n\t\tif (header.enabled !== undefined && typeof header.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled property')\n\t\t}\n\n\t\tif (header.render && typeof header.render !== 'function') {\n\t\t\tthrow new Error('Invalid render property')\n\t\t}\n\n\t\tif (header.updated && typeof header.updated !== 'function') {\n\t\t\tthrow new Error('Invalid updated property')\n\t\t}\n\t}\n\n}\n\nexport const registerFileListHeaders = function(header: Header): void {\n\tif (typeof window._nc_filelistheader === 'undefined') {\n\t\twindow._nc_filelistheader = []\n\t\tlogger.debug('FileListHeaders initialized')\n\t}\n\n\t// Check duplicates\n\tif (window._nc_filelistheader.find(search => search.id === header.id)) {\n\t\tlogger.error(`Header ${header.id} already registered`, { header })\n\t\treturn\n\t}\n\n\twindow._nc_filelistheader.push(header)\n}\n\nexport const getFileListHeaders = function(): Header[] {\n\tif (typeof window._nc_filelistheader === 'undefined') {\n\t\twindow._nc_filelistheader = []\n\t\tlogger.debug('FileListHeaders initialized')\n\t}\n\n\treturn window._nc_filelistheader\n}\n","/*\n * SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Check an optional property type\n *\n * @param obj - the object to check\n * @param property - the property name\n * @param type - the expected type\n * @throws {Error} if the property is defined and not of the expected type\n */\nexport function checkOptionalProperty<T extends object>(\n\tobj: T,\n\tproperty: Exclude<keyof T, symbol>,\n\ttype: 'array' | 'function' | 'string' | 'boolean' | 'number' | 'object',\n): void {\n\tif (typeof obj[property] !== 'undefined') {\n\t\tif (type === 'array') {\n\t\t\tif (!Array.isArray(obj[property])) {\n\t\t\t\tthrow new Error(`View ${property} must be an array`)\n\t\t\t}\n\t\t// eslint-disable-next-line valid-typeof\n\t\t} else if (typeof obj[property] !== type) {\n\t\t\tthrow new Error(`View ${property} must be a ${type}`)\n\t\t} else if (type === 'object' && (obj[property] === null || Array.isArray(obj[property]))) {\n\t\t\tthrow new Error(`View ${property} must be an object`)\n\t\t}\n\t}\n}\n","/*\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { INode } from '../node/node.ts'\nimport type { IView } from './view.ts'\n\nimport { checkOptionalProperty } from '../utils/objectValidation.ts'\n\nexport interface IColumn {\n\t/** Unique column ID */\n\tid: string\n\t/** Translated column title */\n\ttitle: string\n\t/** The content of the cell. The element will be appended within */\n\trender: (node: INode, view: IView) => HTMLElement\n\t/** Function used to sort INodes between them */\n\tsort?: (nodeA: INode, nodeB: INode) => number\n\t/**\n\t * Custom summary of the column to display at the end of the list.\n\t * Will not be displayed if nothing is provided\n\t */\n\tsummary?: (node: INode[], view: IView) => string\n}\n\nexport class Column implements IColumn {\n\n\tprivate _column: IColumn\n\n\tconstructor(column: IColumn) {\n\t\tvalidateColumn(column)\n\t\tthis._column = column\n\t}\n\n\tget id() {\n\t\treturn this._column.id\n\t}\n\n\tget title() {\n\t\treturn this._column.title\n\t}\n\n\tget render() {\n\t\treturn this._column.render\n\t}\n\n\tget sort() {\n\t\treturn this._column.sort\n\t}\n\n\tget summary() {\n\t\treturn this._column.summary\n\t}\n\n}\n\n/**\n * Validate a column definition\n *\n * @param column - the column to check\n * @throws {Error} if the column is not valid\n */\nexport function validateColumn(column: IColumn): void {\n\tif (typeof column !== 'object' || column === null) {\n\t\tthrow new Error('View column must be an object')\n\t}\n\n\tif (!column.id || typeof column.id !== 'string') {\n\t\tthrow new Error('A column id is required')\n\t}\n\n\tif (!column.title || typeof column.title !== 'string') {\n\t\tthrow new Error('A column title is required')\n\t}\n\n\tif (!column.render || typeof column.render !== 'function') {\n\t\tthrow new Error('A render function is required')\n\t}\n\n\t// Optional properties\n\tcheckOptionalProperty(column, 'sort', 'function')\n\tcheckOptionalProperty(column, 'summary', 'function')\n}\n","/*\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IFolder, INode } from '../node/index.ts'\nimport type { IColumn } from './column.ts'\n\nimport isSvg from 'is-svg'\nimport { validateColumn } from './column.ts'\nimport { checkOptionalProperty } from '../utils/objectValidation.ts'\n\nexport type ContentsWithRoot = {\n\tfolder: IFolder,\n\tcontents: INode[]\n}\n\nexport interface IGetContentsOptions {\n\t/**\n\t * Abort signal to be able to cancel the request.\n\t *\n\t *@see https://developer.mozilla.org/en-US/docs/Web/API/AbortController\n\t */\n\tsignal: AbortSignal\n}\n\nexport interface IView {\n\t/** Unique view ID */\n\tid: string\n\t/** Translated view name */\n\tname: string\n\t/** Translated accessible description of the view */\n\tcaption?: string\n\n\t/** Translated title of the empty view */\n\temptyTitle?: string\n\t/** Translated description of the empty view */\n\temptyCaption?: string\n\t/**\n\t * Custom implementation of the empty view.\n\t * If set and no content is found for the current view,\n\t * then this method is called with the container element\n\t * where to render your empty view implementation.\n\t *\n\t * @param div - The container element to render into\n\t */\n\temptyView?: (div: HTMLDivElement) => void\n\n\t/**\n\t * Method return the content of the provided path.\n\t *\n\t * This method _must_ also return the current directory\n\t * information alongside with its content.\n\t *\n\t * An abort signal is provided to be able to\n\t * cancel the request if the user change directory\n\t * {@see https://developer.mozilla.org/en-US/docs/Web/API/AbortController }.\n\t */\n\tgetContents(path: string, options: IGetContentsOptions): Promise<ContentsWithRoot>\n\n\t/**\n\t * If set then the view will be hidden from the navigation unless its the active view.\n\t */\n\thidden?: true\n\n\t/** The view icon as an inline svg */\n\ticon: string\n\n\t/**\n\t * The view order.\n\t * If not set will be natural sorted by view name.\n\t */\n\torder?: number\n\n\t/**\n\t * Custom params to give to the router on click\n\t * If defined, will be treated as a dummy view and\n\t * will just redirect and not fetch any contents.\n\t */\n\tparams?: Record<string, string>\n\n\t/**\n\t * This view column(s). Name and actions are\n\t * by default always included\n\t */\n\tcolumns?: IColumn[]\n\n\t/** The parent unique ID */\n\tparent?: string\n\t/** This view is sticky (sent at the bottom) */\n\tsticky?: boolean\n\n\t/**\n\t * This view has children and is expanded (by default)\n\t * or not. This will be overridden by user config.\n\t */\n\texpanded?: boolean\n\n\t/**\n\t * Will be used as default if the user\n\t * haven't customized their sorting column\n\t */\n\tdefaultSortKey?: string\n\n\t/**\n\t * Method called to load child views if any\n\t */\n\tloadChildViews?: (view: IView) => Promise<void>\n}\n\nexport class View implements IView {\n\n\tprivate _view: IView\n\n\tconstructor(view: IView) {\n\t\tvalidateView(view)\n\t\tthis._view = view\n\t}\n\n\tget id() {\n\t\treturn this._view.id\n\t}\n\n\tget name() {\n\t\treturn this._view.name\n\t}\n\n\tget caption() {\n\t\treturn this._view.caption\n\t}\n\n\tget emptyTitle() {\n\t\treturn this._view.emptyTitle\n\t}\n\n\tget emptyCaption() {\n\t\treturn this._view.emptyCaption\n\t}\n\n\tget getContents() {\n\t\treturn this._view.getContents\n\t}\n\n\tget hidden() {\n\t\treturn this._view.hidden\n\t}\n\n\tget icon() {\n\t\treturn this._view.icon\n\t}\n\n\tset icon(icon) {\n\t\tthis._view.icon = icon\n\t}\n\n\tget order() {\n\t\treturn this._view.order\n\t}\n\n\tset order(order) {\n\t\tthis._view.order = order\n\t}\n\n\tget params() {\n\t\treturn this._view.params\n\t}\n\n\tset params(params) {\n\t\tthis._view.params = params\n\t}\n\n\tget columns() {\n\t\treturn this._view.columns\n\t}\n\n\tget emptyView() {\n\t\treturn this._view.emptyView\n\t}\n\n\tget parent() {\n\t\treturn this._view.parent\n\t}\n\n\tget sticky() {\n\t\treturn this._view.sticky\n\t}\n\n\tget expanded() {\n\t\treturn this._view.expanded\n\t}\n\n\tset expanded(expanded: boolean | undefined) {\n\t\tthis._view.expanded = expanded\n\t}\n\n\tget defaultSortKey() {\n\t\treturn this._view.defaultSortKey\n\t}\n\n\tget loadChildViews() {\n\t\treturn this._view.loadChildViews\n\t}\n\n}\n\n/**\n * Validate a view interface to check all required properties are satisfied.\n *\n * @param view the view to check\n * @throws {Error} if the view is not valid\n */\nexport function validateView(view: IView) {\n\tif (!view.icon || typeof view.icon !== 'string' || !isSvg(view.icon)) {\n\t\tthrow new Error('View icon is required and must be a valid svg string')\n\t}\n\n\tif (!view.id || typeof view.id !== 'string') {\n\t\tthrow new Error('View id is required and must be a string')\n\t}\n\n\tif (!view.getContents || typeof view.getContents !== 'function') {\n\t\tthrow new Error('View getContents is required and must be a function')\n\t}\n\n\tif (!view.name || typeof view.name !== 'string') {\n\t\tthrow new Error('View name is required and must be a string')\n\t}\n\n\t// optional properties type checks\n\n\tcheckOptionalProperty(view, 'caption', 'string')\n\tcheckOptionalProperty(view, 'columns', 'array')\n\tcheckOptionalProperty(view, 'defaultSortKey', 'string')\n\tcheckOptionalProperty(view, 'emptyCaption', 'string')\n\tcheckOptionalProperty(view, 'emptyTitle', 'string')\n\tcheckOptionalProperty(view, 'emptyView', 'function')\n\tcheckOptionalProperty(view, 'expanded', 'boolean')\n\tcheckOptionalProperty(view, 'hidden', 'boolean')\n\tcheckOptionalProperty(view, 'loadChildViews', 'function')\n\tcheckOptionalProperty(view, 'order', 'number')\n\tcheckOptionalProperty(view, 'params', 'object')\n\tcheckOptionalProperty(view, 'parent', 'string')\n\tcheckOptionalProperty(view, 'sticky', 'boolean')\n\n\tif (view.columns) {\n\t\t// we cannot use `instanceof` here because if the Navigation and the Column class are loaded by different apps\n\t\t// (Navigation is set by files app and Column by a 3rd party app),\n\t\t// the `instanceof` check will fail even if the object has the correct shape because they are different classes in memory.\n\t\tview.columns.forEach(validateColumn)\n\t\tconst columnIds = view.columns.reduce((set, column) => set.add(column.id), new Set<string>())\n\t\tif (columnIds.size !== view.columns.length) {\n\t\t\tthrow new Error('View columns must have unique ids')\n\t\t}\n\t}\n}\n","/**\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IView } from './view'\n\nimport { validateView } from './view'\nimport { TypedEventTarget } from 'typescript-event-target'\nimport logger from '../utils/logger'\n\n/**\n * The event is emitted when the navigation view was updated.\n * It contains the new active view in the `detail` attribute.\n */\ninterface UpdateActiveViewEvent extends CustomEvent<IView | null> {\n\ttype: 'updateActive'\n}\n\n/**\n * This event is emitted when the list of registered views is changed\n */\ninterface UpdateViewsEvent extends CustomEvent<never> {\n\ttype: 'update'\n}\n\n/**\n * The files navigation manages the available and active views\n *\n * Custom views for the files app can be registered (examples are the favorites views or the shared-with-you view).\n * It is also possible to listen on changes of the registered views or when the current active view is changed.\n * @example\n * ```js\n * const navigation = getNavigation()\n * navigation.addEventListener('update', () => {\n * // This will be called whenever a new view is registered or a view is removed\n * const viewNames = navigation.views.map((view) => view.name)\n * console.warn('Registered views changed', viewNames)\n * })\n * // Or you can react to changes of the current active view\n * navigation.addEventListener('updateActive', (event) => {\n * // This will be called whenever the active view changed\n * const newView = event.detail // you could also use `navigation.active`\n * console.warn('Active view changed to ' + newView.name)\n * })\n * ```\n */\nexport class Navigation extends TypedEventTarget<{ updateActive: UpdateActiveViewEvent, update: UpdateViewsEvent }> {\n\n\tprivate _views: IView[] = []\n\tprivate _currentView: IView | null = null\n\n\t/**\n\t * Register a new view on the navigation\n\t * @param view The view to register\n\t * @throws {Error} if a view with the same id is already registered\n\t * @throws {Error} if the registered view is invalid\n\t */\n\tregister(view: IView): void {\n\t\tif (this._views.find(search => search.id === view.id)) {\n\t\t\tthrow new Error(`IView id ${view.id} is already registered`)\n\t\t}\n\n\t\tvalidateView(view)\n\n\t\tthis._views.push(view)\n\t\tthis.dispatchTypedEvent('update', new CustomEvent<never>('update') as UpdateViewsEvent)\n\t}\n\n\t/**\n\t * Remove a registered view\n\t * @param id The id of the view to remove\n\t */\n\tremove(id: string): void {\n\t\tconst index = this._views.findIndex(view => view.id === id)\n\t\tif (index !== -1) {\n\t\t\tthis._views.splice(index, 1)\n\t\t\tthis.dispatchTypedEvent('update', new CustomEvent('update') as UpdateViewsEvent)\n\t\t}\n\t}\n\n\t/**\n\t * Set the currently active view\n\t *\n\t * @param id - The id of the view to set as active\n\t * @throws {Error} If no view with the given id was registered\n\t * @fires UpdateActiveViewEvent\n\t */\n\tsetActive(id: string | null): void {\n\t\tif (id === null) {\n\t\t\tthis._currentView = null\n\t\t} else {\n\t\t\tconst view = this._views.find(({ id: viewId }) => viewId === id)\n\t\t\tif (!view) {\n\t\t\t\tthrow new Error(`No view with ${id} registered`)\n\t\t\t}\n\t\t\tthis._currentView = view\n\t\t}\n\n\t\tconst event = new CustomEvent<IView | null>('updateActive', { detail: this._currentView })\n\t\tthis.dispatchTypedEvent('updateActive', event as UpdateActiveViewEvent)\n\t}\n\n\t/**\n\t * The currently active files view\n\t */\n\tget active(): IView | null {\n\t\treturn this._currentView\n\t}\n\n\t/**\n\t * All registered views\n\t */\n\tget views(): IView[] {\n\t\treturn this._views\n\t}\n\n}\n\n/**\n * Get the current files navigation\n */\nexport const getNavigation = function(): Navigation {\n\tif (typeof window._nc_navigation === 'undefined') {\n\t\twindow._nc_navigation = new Navigation()\n\t\tlogger.debug('Navigation service initialized')\n\t}\n\n\treturn window._nc_navigation\n}\n","/*\n * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IFolder, INode } from '../node/index.ts'\n\nimport logger from '../utils/logger.ts'\n\nexport enum NewMenuEntryCategory {\n\t/**\n\t * For actions where the user is intended to upload from their device\n\t */\n\tUploadFromDevice = 0,\n\n\t/**\n\t * For actions that create new nodes on the server without uploading\n\t */\n\tCreateNew = 1,\n\n\t/**\n\t * For everything not matching the other categories\n\t */\n\tOther = 2,\n}\n\nexport interface NewMenuEntry {\n\t/** Unique ID */\n\tid: string\n\n\t/**\n\t * Category to put this entry in\n\t * (supported since Nextcloud 30)\n\t * @since 3.3.0\n\t * @default NewMenuEntryCategory.CreateNew\n\t */\n\tcategory?: NewMenuEntryCategory\n\n\t/** Translatable string displayed in the menu */\n\tdisplayName: string\n\n\t/**\n\t * Condition wether this entry is shown or not\n\t * @param context the creation context. Usually the current folder\n\t */\n\tenabled?: (context: IFolder) => boolean\n\n\t/**\n\t * Either iconSvgInline or iconClass must be defined\n\t * Svg as inline string. <svg><path fill=\"...\" /></svg>\n\t */\n\ticonSvgInline?: string\n\n\t/** Order of the entry in the menu */\n\torder?: number\n\n\t/**\n\t * Function to be run after creation\n\t * @param context - The creation context. Usually the current folder\n\t * @param content - List of file/folders present in the context folder\n\t */\n\thandler: (context: IFolder, content: INode[]) => void\n}\n\nexport class NewMenu {\n\n\tprivate _entries: Array<NewMenuEntry> = []\n\n\tpublic registerEntry(entry: NewMenuEntry) {\n\t\tthis.validateEntry(entry)\n\t\tentry.category = entry.category ?? NewMenuEntryCategory.CreateNew\n\t\tthis._entries.push(entry)\n\t}\n\n\tpublic unregisterEntry(entry: NewMenuEntry | string) {\n\t\tconst entryIndex = typeof entry === 'string'\n\t\t\t? this.getEntryIndex(entry)\n\t\t\t: this.getEntryIndex(entry.id)\n\n\t\tif (entryIndex === -1) {\n\t\t\tlogger.warn('Entry not found, nothing removed', { entry, entries: this.getEntries() })\n\t\t\treturn\n\t\t}\n\n\t\tthis._entries.splice(entryIndex, 1)\n\t}\n\n\t/**\n\t * Get the list of registered entries\n\t *\n\t * @param context - The creation context. Usually the current folder\n\t */\n\tpublic getEntries(context?: IFolder): Array<NewMenuEntry> {\n\t\tif (context) {\n\t\t\treturn this._entries\n\t\t\t\t.filter(entry => typeof entry.enabled === 'function' ? entry.enabled(context) : true)\n\t\t}\n\t\treturn this._entries\n\t}\n\n\tprivate getEntryIndex(id: string): number {\n\t\treturn this._entries.findIndex(entry => entry.id === id)\n\t}\n\n\tprivate validateEntry(entry: NewMenuEntry) {\n\t\tif (!entry.id || !entry.displayName || !entry.iconSvgInline || !entry.handler) {\n\t\t\tthrow new Error('Invalid entry')\n\t\t}\n\n\t\tif (typeof entry.id !== 'string'\n\t\t\t|| typeof entry.displayName !== 'string') {\n\t\t\tthrow new Error('Invalid id or displayName property')\n\t\t}\n\n\t\tif (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string') {\n\t\t\tthrow new Error('Invalid icon provided')\n\t\t}\n\n\t\tif (entry.enabled !== undefined && typeof entry.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled property')\n\t\t}\n\n\t\tif (typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid handler property')\n\t\t}\n\n\t\tif ('order' in entry && typeof entry.order !== 'number') {\n\t\t\tthrow new Error('Invalid order property')\n\t\t}\n\n\t\tif (this.getEntryIndex(entry.id) !== -1) {\n\t\t\tthrow new Error('Duplicate entry')\n\t\t}\n\t}\n\n}\n","/*\n * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IFolder } from '../node/index.ts'\nimport type { NewMenuEntry } from './NewMenu.ts'\n\nimport { NewMenu } from './NewMenu.ts'\nimport logger from '../utils/logger.ts'\n\n/**\n * Get the NewMenu instance used by the files app.\n */\nexport function getNewFileMenu(): NewMenu {\n\tif (typeof window._nc_newfilemenu === 'undefined') {\n\t\twindow._nc_newfilemenu = new NewMenu()\n\t\tlogger.debug('NewFileMenu initialized')\n\t}\n\treturn window._nc_newfilemenu\n}\n\n/**\n * Add a new menu entry to the upload manager menu\n *\n * @param entry - The new file menu entry\n */\nexport function addNewFileMenuEntry(entry: NewMenuEntry): void {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.registerEntry(entry)\n}\n\n/**\n * Remove a previously registered entry from the upload menu\n *\n * @param entry - Entry or id of entry to remove\n */\nexport function removeNewFileMenuEntry(entry: NewMenuEntry | string) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.unregisterEntry(entry)\n}\n\n/**\n * Get the list of registered entries from the upload menu\n *\n * @param context - The current folder to get the available entries\n */\nexport function getNewFileMenuEntries(context?: IFolder): NewMenuEntry[] {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.getEntries(context).sort((a: NewMenuEntry, b: NewMenuEntry) => {\n\t\t// If defined and different, sort by order\n\t\tif (a.order !== undefined\n\t\t\t&& b.order !== undefined\n\t\t\t&& a.order !== b.order) {\n\t\t\treturn a.order - b.order\n\t\t}\n\t\t// else sort by display name\n\t\treturn a.displayName.localeCompare(b.displayName, undefined, { numeric: true, sensitivity: 'base' })\n\t})\n}\n","/*\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IView } from '../navigation/view.ts'\nimport type { IFolder, INode } from '../node/index.ts'\n\nimport isSvg from 'is-svg'\nimport logger from '../utils/logger.ts'\n\nexport interface ISidebarContext {\n\t/**\n\t * The active node in the sidebar\n\t */\n\tnode: INode\n\n\t/**\n\t * The current open folder in the files app\n\t */\n\tfolder: IFolder\n\n\t/**\n\t * The currently active view\n\t */\n\tview: IView\n}\n\n/**\n * This component describes the custom web component that should be registered for a sidebar tab.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components\n * @see https://vuejs.org/guide/extras/web-components#building-custom-elements-with-vue\n */\nexport interface SidebarComponent extends HTMLElement, ISidebarContext {\n\t/**\n\t * This method is called by the files app if the sidebar tab state changes.\n\t *\n\t * @param active - The new active state\n\t */\n\tsetActive(active: boolean): Promise<void>\n}\n\n/**\n * Implementation of a custom sidebar tab within the files app.\n */\nexport interface ISidebarTab {\n\t/**\n\t * Unique id of the sidebar tab.\n\t * This has to conform to the HTML id attribute specification.\n\t */\n\tid: string\n\n\t/**\n\t * The localized name of the sidebar tab.\n\t */\n\tdisplayName: string\n\n\t/**\n\t * The icon, as SVG, of the sidebar tab.\n\t */\n\ticonSvgInline: string\n\n\t/**\n\t * The order of this tab.\n\t * Use a low number to make this tab ordered in front.\n\t */\n\torder: number\n\n\t/**\n\t * The tag name of the web component.\n\t * The web component must already be registered under that tag name with `CustomElementRegistry.define()`.\n\t *\n\t * To avoid name clashes the name has to start with your appid (e.g. `your_app`).\n\t * So in addition with the web component naming rules a good name would be `your_app-files-sidebar-tab`.\n\t */\n\ttagName: string\n\n\t/**\n\t * Callback to check if the sidebar tab should be shown for the selected node.\n\t *\n\t * @param context - The current context of the files app\n\t */\n\tenabled: (context: ISidebarContext) => boolean\n}\n\n/**\n * Register a new sidebar tab for the files app.\n *\n * @param tab - The sidebar tab to register\n * @throws If the provided tab is not a valid sidebar tab and thus cannot be registered.\n */\nexport function registerSidebarTab(tab: ISidebarTab): void {\n\tvalidateSidebarTab(tab)\n\n\twindow._nc_files_sidebar_tabs ??= new Map<string, ISidebarTab>()\n\tif (window._nc_files_sidebar_tabs.has(tab.id)) {\n\t\tlogger.warn(`Sidebar tab with id \"${tab.id}\" already registered. Skipping.`)\n\t\treturn\n\t}\n\twindow._nc_files_sidebar_tabs.set(tab.id, tab)\n\tlogger.debug(`New sidebar tab with id \"${tab.id}\" registered.`)\n}\n\n/**\n * Get all currently registered sidebar tabs.\n */\nexport function getSidebarTabs(): ISidebarTab[] {\n\tif (window._nc_files_sidebar_tabs) {\n\t\treturn [...window._nc_files_sidebar_tabs.values()]\n\t}\n\treturn []\n}\n\n/**\n * Check if a given sidebar tab objects implements all necessary fields.\n *\n * @param tab - The sidebar tab to validate\n */\nfunction validateSidebarTab(tab: ISidebarTab): void {\n\tif (typeof tab !== 'object') {\n\t\tthrow new Error('Sidebar tab is not an object')\n\t}\n\n\tif (!tab.id || (typeof tab.id !== 'string') || tab.id !== CSS.escape(tab.id)) {\n\t\tthrow new Error('Sidebar tabs need to have an id conforming to the HTML id attribute specifications')\n\t}\n\n\tif (!tab.tagName || typeof tab.tagName !== 'string') {\n\t\tthrow new Error('Sidebar tabs need to have the tagName name set')\n\t}\n\n\tif (!tab.tagName.match(/^[a-z][a-z0-9-_]+$/)) {\n\t\tthrow new Error('Sidebar tabs tagName name is invalid')\n\t}\n\n\tif (!tab.displayName || typeof tab.displayName !== 'string') {\n\t\tthrow new Error('Sidebar tabs need to have a name set')\n\t}\n\n\tif (typeof tab.iconSvgInline !== 'string' || !isSvg(tab.iconSvgInline)) {\n\t\tthrow new Error('Sidebar tabs need to have an valid SVG icon')\n\t}\n\n\tif (typeof tab.order !== 'number') {\n\t\tthrow new Error('Sidebar tabs need to have a numeric order set')\n\t}\n\n\tif (typeof tab.enabled !== 'function') {\n\t\tthrow new Error('Sidebar tabs need to have an \"enabled\" method')\n\t}\n\n\t// now check the custom element constructor\n\tconst tagConstructor = window.customElements.get(tab.tagName)\n\tif (!tagConstructor) {\n\t\tthrow new Error('Sidebar tab element not registered')\n\t}\n\n\tif (!('setActive' in tagConstructor.prototype)) {\n\t\t// we cannot check properties like `node` or `view` because those are not necessarily defined in the prototype.\n\t\tthrow new Error('Sidebar tab elements must have the `setActive` method')\n\t}\n}\n","/*\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { ISidebarContext, ISidebarTab } from './SidebarTab.ts'\n\nimport { getSidebarTabs, registerSidebarTab } from './SidebarTab.ts'\n\nexport interface ISidebar {\n\t/**\n\t * If the files sidebar can currently be accessed.\n\t * Registering tabs also works if the sidebar is currently not available.\n\t */\n\treadonly available: boolean\n\n\t/**\n\t * The current open state of the sidebar\n\t */\n\treadonly open: boolean\n\n\t/**\n\t * Open or close the sidebar\n\t *\n\t * @param open - The new open state\n\t */\n\tsetOpen(open: boolean): void\n\n\t/**\n\t * Register a new sidebar tab\n\t *\n\t * @param tab - The sidebar tab to register\n\t */\n\tregisterTab(tab: ISidebarTab): void\n\n\t/**\n\t * Get all registered sidebar tabs.\n\t * If a node is passed only the enabled tabs are retrieved.\n\t */\n\tgetTabs(context?: ISidebarContext): ISidebarTab[]\n}\n\n/**\n * This is just a proxy allowing an arbitrary `@nextcloud/files` library version to access the defined interface of the sidebar.\n * By proxying this instead of providing the implementation here we ensure that if apps use different versions of the library,\n * we do not end up with version conflicts between them.\n *\n * If we add new properties they just will be available in new library versions.\n * If we decide to do a breaking change we can either add compatibility wrappers in the implementation in the files app.\n */\nclass SidebarProxy implements ISidebar {\n\n\tget available(): boolean {\n\t\treturn !!window.OCA?.Files?.Sidebar\n\t}\n\n\tget open(): boolean {\n\t\treturn !!window.OCA?.Files?.Sidebar?.state.file\n\t}\n\n\tsetOpen(open: boolean): void {\n\t\tif (open) {\n\t\t\twindow.OCA?.Files?.Sidebar?.open()\n\t\t} else {\n\t\t\twindow.OCA?.Files?.Sidebar?.close()\n\t\t}\n\t}\n\n\tsetActiveTab(tabId: string): void {\n\t\twindow.OCA?.Files?.Sidebar?.setActiveTab(tabId)\n\t}\n\n\tregisterTab(tab: ISidebarTab): void {\n\t\tregisterSidebarTab(tab)\n\t}\n\n\tgetTabs(context?: ISidebarContext): ISidebarTab[] {\n\t\tconst tabs = getSidebarTabs()\n\t\tif (context) {\n\t\t\treturn tabs.filter((tab) => tab.enabled(context))\n\t\t}\n\t\treturn tabs\n\t}\n\n}\n\n/**\n * Get a reference to the files sidebar.\n */\nexport function getSidebar(): ISidebar {\n\treturn new SidebarProxy()\n}\n","/**\n * SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later\n */\n\nimport { getCapabilities } from '@nextcloud/capabilities'\n\ninterface NextcloudCapabilities extends Record<string, unknown> {\n\tfiles: {\n\t\t'bigfilechunking': boolean\n\t\t// those are new in Nextcloud 30\n\t\t'forbidden_filenames'?: string[]\n\t\t'forbidden_filename_basenames'?: string[]\n\t\t'forbidden_filename_characters'?: string[]\n\t\t'forbidden_filename_extensions'?: string[]\n\t}\n}\n\nexport enum InvalidFilenameErrorReason {\n\tReservedName = 'reserved name',\n\tCharacter = 'character',\n\tExtension = 'extension',\n}\n\ninterface InvalidFilenameErrorOptions {\n\t/**\n\t * The filename that was validated\n\t */\n\tfilename: string\n\n\t/**\n\t * Reason why the validation failed\n\t */\n\treason: InvalidFilenameErrorReason\n\n\t/**\n\t * Part of the filename that caused this error\n\t */\n\tsegment: string\n}\n\nexport class InvalidFilenameError extends Error {\n\n\tpublic constructor(options: InvalidFilenameErrorOptions) {\n\t\tsuper(`Invalid ${options.reason} '${options.segment}' in filename '${options.filename}'`, { cause: options })\n\t}\n\n\t/**\n\t * The filename that was validated\n\t */\n\tpublic get filename() {\n\t\treturn (this.cause as InvalidFilenameErrorOptions).filename\n\t}\n\n\t/**\n\t * Reason why the validation failed\n\t */\n\tpublic get reason() {\n\t\treturn (this.cause as InvalidFilenameErrorOptions).reason\n\t}\n\n\t/**\n\t * Part of the filename that caused this error\n\t */\n\tpublic get segment() {\n\t\treturn (this.cause as InvalidFilenameErrorOptions).segment\n\t}\n\n}\n\n/**\n * Validate a given filename\n * @param filename The filename to check\n * @throws {InvalidFilenameError}\n */\nexport function validateFilename(filename: string): void {\n\tconst capabilities = (getCapabilities() as NextcloudCapabilities).files\n\n\t// Handle forbidden characters\n\t// This needs to be done first as the other checks are case insensitive!\n\tconst forbiddenCharacters = capabilities.forbidden_filename_characters ?? ['/', '\\\\']\n\tfor (const character of forbiddenCharacters) {\n\t\tif (filename.includes(character)) {\n\t\t\tthrow new InvalidFilenameError({ segment: character, reason: InvalidFilenameErrorReason.Character, filename })\n\t\t}\n\t}\n\n\t// everything else is case insensitive (the capabilities are returned lowercase)\n\tfilename = filename.toLocaleLowerCase()\n\n\t// Handle forbidden filenames, on older Nextcloud versions without this capability it was hardcoded in the backend to '.htaccess'\n\tconst forbiddenFilenames = capabilities.forbidden_filenames ?? ['.htaccess']\n\tif (forbiddenFilenames.includes(filename)) {\n\t\tthrow new InvalidFilenameError({ filename, segment: filename, reason: InvalidFilenameErrorReason.ReservedName })\n\t}\n\n\t// Handle forbidden basenames\n\tconst endOfBasename = filename.indexOf('.', 1)\n\tconst basename = filename.substring(0, endOfBasename === -1 ? undefined : endOfBasename)\n\tconst forbiddenFilenameBasenames = capabilities.forbidden_filename_basenames ?? []\n\tif (forbiddenFilenameBasenames.includes(basename)) {\n\t\tthrow new InvalidFilenameError({ filename, segment: basename, reason: InvalidFilenameErrorReason.ReservedName })\n\t}\n\n\tconst forbiddenFilenameExtensions = capabilities.forbidden_filename_extensions ?? []\n\tfor (const extension of forbiddenFilenameExtensions) {\n\t\tif (filename.length > extension.length && filename.endsWith(extension)) {\n\t\t\tthrow new InvalidFilenameError({ segment: extension, reason: InvalidFilenameErrorReason.Extension, filename })\n\t\t}\n\t}\n}\n\n/**\n * Check the validity of a filename\n * This is a convenient wrapper for `checkFilenameValidity` to only return a boolean for the valid\n * @param filename Filename to check validity\n */\nexport function isFilenameValid(filename: string): boolean {\n\ttry {\n\t\tvalidateFilename(filename)\n\t\treturn true\n\t} catch (error) {\n\t\tif (error instanceof InvalidFilenameError) {\n\t\t\treturn false\n\t\t}\n\t\tthrow error\n\t}\n}\n","/**\n * SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later\n */\n\nimport { basename, extname } from '@nextcloud/paths'\n\ninterface UniqueNameOptions {\n\t/**\n\t * A function that takes an index and returns a suffix to add to the file name, defaults to '(index)'\n\t * @param index The current index to add\n\t */\n\tsuffix?: (index: number) => string\n\t/**\n\t * Set to true to ignore the file extension when adding the suffix (when getting a unique directory name)\n\t */\n\tignoreFileExtension?: boolean\n}\n\n/**\n * Create an unique file name\n * @param name The initial name to use\n * @param otherNames Other names that are already used\n * @param options Optional parameters for tuning the behavior\n * @return {string} Either the initial name, if unique, or the name with the suffix so that the name is unique\n */\nexport function getUniqueName(\n\tname: string,\n\totherNames: string[],\n\toptions?: UniqueNameOptions,\n): string {\n\tconst opts = {\n\t\tsuffix: (n: number) => `(${n})`,\n\t\tignoreFileExtension: false,\n\t\t...options,\n\t}\n\n\tlet newName = name\n\tlet i = 1\n\twhile (otherNames.includes(newName)) {\n\t\tconst ext = opts.ignoreFileExtension ? '' : extname(name)\n\t\tconst base = basename(name, ext)\n\t\tnewName = `${base} ${opts.suffix(i++)}${ext}`\n\t}\n\treturn newName\n}\n","/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { getCanonicalLocale } from '@nextcloud/l10n'\n\nconst humanList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']\nconst humanListBinary = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB']\n\n/**\n * Format a file size in a human-like format. e.g. 42GB\n *\n * The default for Nextcloud is like Windows using binary sizes but showing decimal units,\n * meaning 1024 bytes will show as 1KB instead of 1KiB or like on Apple 1.02 KB\n *\n * @param size in bytes\n * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead\n * @param binaryPrefixes True if size binary prefixes like `KiB` should be used as per IEC 80000-13\n * @param base1000 Set to true to use base 1000 as per SI or used by Apple (default is base 1024 like Linux or Windows)\n */\nexport function formatFileSize(size: number|string, skipSmallSizes = false, binaryPrefixes = false, base1000 = false): string {\n\t// Binary prefixes only work with base 1024\n\tbinaryPrefixes = binaryPrefixes && !base1000\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t// Calculate Log with base 1024 or 1000: size = base ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(base1000 ? 1000 : 1024)) : 0\n\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min((binaryPrefixes ? humanListBinary.length : humanList.length) - 1, order)\n\n\tconst readableFormat = binaryPrefixes ? humanListBinary[order] : humanList[order]\n\tlet relativeSize = (size / Math.pow(base1000 ? 1000 : 1024, order)).toFixed(1)\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\treturn (relativeSize !== '0.0' ? '< 1 ' : '0 ') + (binaryPrefixes ? humanListBinary[1] : humanList[1])\n\t}\n\n\tif (order < 2) {\n\t\trelativeSize = parseFloat(relativeSize).toFixed(0)\n\t} else {\n\t\trelativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale())\n\t}\n\n\treturn relativeSize + ' ' + readableFormat\n}\n\n/**\n * Returns a file size in bytes from a humanly readable string\n * Note: `b` and `B` are both parsed as bytes and not as bit or byte.\n *\n * @param {string} value file size in human-readable format\n * @param {boolean} forceBinary for backwards compatibility this allows values to be base 2 (so 2KB means 2048 bytes instead of 2000 bytes)\n * @return {number} or null if string could not be parsed\n */\nexport function parseFileSize(value: string, forceBinary = false) {\n\ttry {\n\t\tvalue = `${value}`.toLocaleLowerCase().replaceAll(/\\s+/g, '').replaceAll(',', '.')\n\t} catch (e) {\n\t\treturn null\n\t}\n\n\tconst match = value.match(/^([0-9]*(\\.[0-9]*)?)([kmgtp]?)(i?)b?$/)\n\t// ignore not found, missing pre- and decimal, empty number\n\tif (match === null || match[1] === '.' || match[1] === '') {\n\t\treturn null\n\t}\n\n\tconst bytesArray = {\n\t\t'': 0,\n\t\tk: 1,\n\t\tm: 2,\n\t\tg: 3,\n\t\tt: 4,\n\t\tp: 5,\n\t\te: 6,\n\t}\n\n\tconst decimalString = `${match[1]}`\n\tconst base = (match[4] === 'i' || forceBinary) ? 1024 : 1000\n\n\treturn Math.round(Number.parseFloat(decimalString) * (base ** bytesArray[match[3]]))\n}\n","/**\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { getCanonicalLocale, getLanguage } from '@nextcloud/l10n'\n\ntype IdentifierFn<T> = (v: T) => unknown\nexport type SortingOrder = 'asc'|'desc'\n\n/**\n * Helper to create string representation\n * @param value Value to stringify\n */\nfunction stringify(value: unknown) {\n\t// The default representation of Date is not sortable because of the weekday names in front of it\n\tif (value instanceof Date) {\n\t\treturn value.toISOString()\n\t}\n\treturn String(value)\n}\n\n/**\n * Natural order a collection\n * You can define identifiers as callback functions, that get the element and return the value to sort.\n *\n * @param collection The collection to order\n * @param identifiers An array of identifiers to use, by default the identity of the element is used\n * @param orders Array of orders, by default all identifiers are sorted ascening\n */\nexport function orderBy<T>(collection: readonly T[], identifiers?: IdentifierFn<T>[], orders?: SortingOrder[]): T[] {\n\t// If not identifiers are set we use the identity of the value\n\tidentifiers = identifiers ?? [(value) => value]\n\t// By default sort the collection ascending\n\torders = orders ?? []\n\tconst sorting = identifiers.map((_, index) => (orders[index] ?? 'asc') === 'asc' ? 1 : -1)\n\n\tconst collator = Intl.Collator(\n\t\t[getLanguage(), getCanonicalLocale()],\n\t\t{\n\t\t\t// handle 10 as ten and not as one-zero\n\t\t\tnumeric: true,\n\t\t\tusage: 'sort',\n\t\t},\n\t)\n\n\treturn [...collection].sort((a, b) => {\n\t\tfor (const [index, identifier] of identifiers.entries()) {\n\t\t\t// Get the local compare of stringified value a and b\n\t\t\tconst value = collator.compare(stringify(identifier(a)), stringify(identifier(b)))\n\t\t\t// If they do not match return the order\n\t\t\tif (value !== 0) {\n\t\t\t\treturn value * sorting[index]\n\t\t\t}\n\t\t\t// If they match we need to continue with the next identifier\n\t\t}\n\t\t// If all are equal we need to return equality\n\t\treturn 0\n\t})\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { INode } from '../node/node.ts'\nimport type { SortingOrder } from './sorting.ts'\n\nimport { FileType } from '../node/fileType.ts'\nimport { orderBy } from './sorting.ts'\n\nexport enum FilesSortingMode {\n\tName = 'basename',\n\tModified = 'mtime',\n\tSize = 'size',\n}\n\nexport interface FilesSortingOptions {\n\t/**\n\t * They key to order the files by\n\t * @default FilesSortingMode.Name\n\t */\n\tsortingMode?: FilesSortingMode | string\n\n\t/**\n\t * @default 'asc'\n\t */\n\tsortingOrder?: SortingOrder\n\n\t/**\n\t * If set to true nodes marked as favorites are ordered on top of all other nodes\n\t * @default false\n\t */\n\tsortFavoritesFirst?: boolean\n\n\t/**\n\t * If set to true folders are ordered on top of files\n\t * @default false\n\t */\n\tsortFoldersFirst?: boolean\n}\n\n/**\n * Sort files and folders according to the sorting options\n * @param nodes Nodes to sort\n * @param options Sorting options\n */\nexport function sortNodes(nodes: readonly INode[], options: FilesSortingOptions = {}): INode[] {\n\tconst sortingOptions = {\n\t\t// Default to sort by name\n\t\tsortingMode: FilesSortingMode.Name,\n\t\t// Default to sort ascending\n\t\tsortingOrder: 'asc' as const,\n\t\t...options,\n\t}\n\n\t/**\n\t * Get the basename without any extension if the current node is a file\n\t *\n\t * @param node - The node to get the basename of\n\t */\n\tfunction basename(node: INode): string {\n\t\tconst name = node.displayname || node.attributes?.displayname || node.basename || ''\n\t\tif (node.type === FileType.Folder) {\n\t\t\treturn name\n\t\t}\n\n\t\treturn name.lastIndexOf('.') > 0\n\t\t\t? name.slice(0, name.lastIndexOf('.'))\n\t\t\t: name\n\t}\n\n\tconst identifiers = [\n\t\t// 1: Sort favorites first if enabled\n\t\t...(sortingOptions.sortFavoritesFirst ? [(v: INode) => v.attributes?.favorite !== 1] : []),\n\t\t// 2: Sort folders first if sorting by name\n\t\t...(sortingOptions.sortFoldersFirst ? [(v: INode) => v.type !== 'folder'] : []),\n\t\t// 3: Use sorting mode if NOT basename (to be able to use display name too)\n\t\t...(sortingOptions.sortingMode !== FilesSortingMode.Name ? [(v: INode) => v[sortingOptions.sortingMode] ?? v.attributes[sortingOptions.sortingMode]] : []),\n\t\t// 4: Use display name if available, fallback to name\n\t\t(v: INode) => basename(v),\n\t\t// 5: Finally, use basename if all previous sorting methods failed\n\t\t(v: INode) => v.basename,\n\t]\n\tconst orders = [\n\t\t// (for 1): always sort favorites before normal files\n\t\t...(sortingOptions.sortFavoritesFirst ? ['asc'] : []),\n\t\t// (for 2): always sort folders before files\n\t\t...(sortingOptions.sortFoldersFirst ? ['asc'] : []),\n\t\t// (for 3): Reverse if sorting by mtime as mtime higher means edited more recent -> lower\n\t\t...(sortingOptions.sortingMode === FilesSortingMode.Modified ? [sortingOptions.sortingOrder === 'asc' ? 'desc' : 'asc'] : []),\n\t\t// (also for 3 so make sure not to conflict with 2 and 3)\n\t\t...(sortingOptions.sortingMode !== FilesSortingMode.Modified && sortingOptions.sortingMode !== FilesSortingMode.Name ? [sortingOptions.sortingOrder] : []),\n\t\t// for 4: use configured sorting direction\n\t\tsortingOptions.sortingOrder,\n\t\t// for 5: use configured sorting direction\n\t\tsortingOptions.sortingOrder,\n\t] as ('asc'|'desc')[]\n\n\treturn orderBy(nodes, identifiers, orders)\n}\n"],"names":["DefaultType","require$$0","require$$1","re","a","b","require$$2","require$$3","require$$4","major","valid","NewMenuEntryCategory","InvalidFilenameErrorReason","basename","identifiers","FilesSortingMode"],"mappings":";;;;;;;AAQO,IAAK,gCAAAA,iBAAL;AACNA,eAAA,SAAA,IAAU;AACVA,eAAA,QAAA,IAAS;AAFE,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAwGL,MAAM,WAAW;AAAA,EAEf;AAAA,EAER,YAAY,QAAwB;AACnC,SAAK,eAAe,MAAM;AAC1B,SAAK,UAAU;AAAA,EAChB;AAAA,EAEA,IAAI,KAAK;AACR,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,cAAc;AACjB,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,QAAQ;AACX,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,gBAAgB;AACnB,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACb,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,OAAO;AACV,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,YAAY;AACf,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,SAAS;AACZ,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,QAAQ;AACX,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,SAAS;AACZ,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACb,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEA,IAAI,cAAc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K,EAAE,WAAW,eAAe,WAAW,CAAC,IAAI,CAAA;AAAA;AAAA,IAEvJ,CAAC,MAAaD,UAAS,CAAC;AAAA;AAAA,IAExB,CAAC,MAAa,EAAE;AAAA,EAAA;AAEjB,QAAM,SAAS;AAAA;AAAA,IAEd,GAAI,eAAe,qBAAqB,CAAC,KAAK,IAAI,CAAA;AAAA;AAAA,IAElD,GAAI,eAAe,mBAAmB,CAAC,KAAK,IAAI,CAAA;AAAA;AAAA,IAEhD,GAAI,eAAe,gBAAgB,UAA4B,CAAC,eAAe,iBAAiB,QAAQ,SAAS,KAAK,IAAI,CAAA;AAAA;AAAA,IAE1H,GAAI,eAAe,gBAAgB,WAA6B,eAAe,gBAAgB,aAAwB,CAAC,eAAe,YAAY,IAAI,CAAA;AAAA;AAAA,IAEvJ,eAAe;AAAA;AAAA,IAEf,eAAe;AAAA,EAAA;AAGhB,SAAO,QAAQ,OAAOC,cAAa,MAAM;AAC1C;","x_google_ignoreList":[2,3,4,5,6,7,8,9,10,11]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { INode } from '../node/node.ts';
|
|
2
2
|
import { IView } from './view.ts';
|
|
3
|
-
interface
|
|
3
|
+
export interface IColumn {
|
|
4
4
|
/** Unique column ID */
|
|
5
5
|
id: string;
|
|
6
6
|
/** Translated column title */
|
|
@@ -15,13 +15,19 @@ interface ColumnData {
|
|
|
15
15
|
*/
|
|
16
16
|
summary?: (node: INode[], view: IView) => string;
|
|
17
17
|
}
|
|
18
|
-
export declare class Column implements
|
|
18
|
+
export declare class Column implements IColumn {
|
|
19
19
|
private _column;
|
|
20
|
-
constructor(column:
|
|
20
|
+
constructor(column: IColumn);
|
|
21
21
|
get id(): string;
|
|
22
22
|
get title(): string;
|
|
23
23
|
get render(): (node: INode, view: IView) => HTMLElement;
|
|
24
24
|
get sort(): ((nodeA: INode, nodeB: INode) => number) | undefined;
|
|
25
25
|
get summary(): ((node: INode[], view: IView) => string) | undefined;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Validate a column definition
|
|
29
|
+
*
|
|
30
|
+
* @param column - the column to check
|
|
31
|
+
* @throws {Error} if the column is not valid
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateColumn(column: IColumn): void;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Column } from './column.ts';
|
|
1
|
+
import { IFolder, INode } from '../node/index.ts';
|
|
2
|
+
import { IColumn } from './column.ts';
|
|
4
3
|
export type ContentsWithRoot = {
|
|
5
|
-
folder:
|
|
6
|
-
contents:
|
|
4
|
+
folder: IFolder;
|
|
5
|
+
contents: INode[];
|
|
7
6
|
};
|
|
7
|
+
export interface IGetContentsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Abort signal to be able to cancel the request.
|
|
10
|
+
*
|
|
11
|
+
*@see https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
|
12
|
+
*/
|
|
13
|
+
signal: AbortSignal;
|
|
14
|
+
}
|
|
8
15
|
export interface IView {
|
|
9
16
|
/** Unique view ID */
|
|
10
17
|
id: string;
|
|
@@ -31,13 +38,11 @@ export interface IView {
|
|
|
31
38
|
* This method _must_ also return the current directory
|
|
32
39
|
* information alongside with its content.
|
|
33
40
|
*
|
|
34
|
-
*
|
|
41
|
+
* An abort signal is provided to be able to
|
|
35
42
|
* cancel the request if the user change directory
|
|
36
43
|
* {@see https://developer.mozilla.org/en-US/docs/Web/API/AbortController }.
|
|
37
44
|
*/
|
|
38
|
-
getContents(path: string, options:
|
|
39
|
-
signal: AbortSignal;
|
|
40
|
-
}): Promise<ContentsWithRoot>;
|
|
45
|
+
getContents(path: string, options: IGetContentsOptions): Promise<ContentsWithRoot>;
|
|
41
46
|
/**
|
|
42
47
|
* If set then the view will be hidden from the navigation unless its the active view.
|
|
43
48
|
*/
|
|
@@ -59,7 +64,7 @@ export interface IView {
|
|
|
59
64
|
* This view column(s). Name and actions are
|
|
60
65
|
* by default always included
|
|
61
66
|
*/
|
|
62
|
-
columns?:
|
|
67
|
+
columns?: IColumn[];
|
|
63
68
|
/** The parent unique ID */
|
|
64
69
|
parent?: string;
|
|
65
70
|
/** This view is sticky (sent at the bottom) */
|
|
@@ -77,7 +82,7 @@ export interface IView {
|
|
|
77
82
|
/**
|
|
78
83
|
* Method called to load child views if any
|
|
79
84
|
*/
|
|
80
|
-
loadChildViews?: (view:
|
|
85
|
+
loadChildViews?: (view: IView) => Promise<void>;
|
|
81
86
|
}
|
|
82
87
|
export declare class View implements IView {
|
|
83
88
|
private _view;
|
|
@@ -87,9 +92,7 @@ export declare class View implements IView {
|
|
|
87
92
|
get caption(): string | undefined;
|
|
88
93
|
get emptyTitle(): string | undefined;
|
|
89
94
|
get emptyCaption(): string | undefined;
|
|
90
|
-
get getContents(): (path: string, options:
|
|
91
|
-
signal: AbortSignal;
|
|
92
|
-
}) => Promise<ContentsWithRoot>;
|
|
95
|
+
get getContents(): (path: string, options: IGetContentsOptions) => Promise<ContentsWithRoot>;
|
|
93
96
|
get hidden(): true | undefined;
|
|
94
97
|
get icon(): string;
|
|
95
98
|
set icon(icon: string);
|
|
@@ -97,14 +100,14 @@ export declare class View implements IView {
|
|
|
97
100
|
set order(order: number | undefined);
|
|
98
101
|
get params(): Record<string, string> | undefined;
|
|
99
102
|
set params(params: Record<string, string> | undefined);
|
|
100
|
-
get columns():
|
|
103
|
+
get columns(): IColumn[] | undefined;
|
|
101
104
|
get emptyView(): ((div: HTMLDivElement) => void) | undefined;
|
|
102
105
|
get parent(): string | undefined;
|
|
103
106
|
get sticky(): boolean | undefined;
|
|
104
107
|
get expanded(): boolean | undefined;
|
|
105
108
|
set expanded(expanded: boolean | undefined);
|
|
106
109
|
get defaultSortKey(): string | undefined;
|
|
107
|
-
get loadChildViews(): ((view:
|
|
110
|
+
get loadChildViews(): ((view: IView) => Promise<void>) | undefined;
|
|
108
111
|
}
|
|
109
112
|
/**
|
|
110
113
|
* Validate a view interface to check all required properties are satisfied.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IFolder, INode } from '../node/index.ts';
|
|
2
2
|
export declare enum NewMenuEntryCategory {
|
|
3
3
|
/**
|
|
4
4
|
* For actions where the user is intended to upload from their device
|
|
@@ -29,7 +29,7 @@ export interface NewMenuEntry {
|
|
|
29
29
|
* Condition wether this entry is shown or not
|
|
30
30
|
* @param context the creation context. Usually the current folder
|
|
31
31
|
*/
|
|
32
|
-
enabled?: (context:
|
|
32
|
+
enabled?: (context: IFolder) => boolean;
|
|
33
33
|
/**
|
|
34
34
|
* Either iconSvgInline or iconClass must be defined
|
|
35
35
|
* Svg as inline string. <svg><path fill="..." /></svg>
|
|
@@ -42,7 +42,7 @@ export interface NewMenuEntry {
|
|
|
42
42
|
* @param context - The creation context. Usually the current folder
|
|
43
43
|
* @param content - List of file/folders present in the context folder
|
|
44
44
|
*/
|
|
45
|
-
handler: (context:
|
|
45
|
+
handler: (context: IFolder, content: INode[]) => void;
|
|
46
46
|
}
|
|
47
47
|
export declare class NewMenu {
|
|
48
48
|
private _entries;
|
|
@@ -51,9 +51,9 @@ export declare class NewMenu {
|
|
|
51
51
|
/**
|
|
52
52
|
* Get the list of registered entries
|
|
53
53
|
*
|
|
54
|
-
* @param
|
|
54
|
+
* @param context - The creation context. Usually the current folder
|
|
55
55
|
*/
|
|
56
|
-
getEntries(context?:
|
|
56
|
+
getEntries(context?: IFolder): Array<NewMenuEntry>;
|
|
57
57
|
private getEntryIndex;
|
|
58
58
|
private validateEntry;
|
|
59
59
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IFolder } from '../node/index.ts';
|
|
2
2
|
import { NewMenuEntry, NewMenu } from './NewMenu.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Get the NewMenu instance used by the files app.
|
|
@@ -19,6 +19,6 @@ export declare function removeNewFileMenuEntry(entry: NewMenuEntry | string): vo
|
|
|
19
19
|
/**
|
|
20
20
|
* Get the list of registered entries from the upload menu
|
|
21
21
|
*
|
|
22
|
-
* @param
|
|
22
|
+
* @param context - The current folder to get the available entries
|
|
23
23
|
*/
|
|
24
|
-
export declare function getNewFileMenuEntries(context?:
|
|
24
|
+
export declare function getNewFileMenuEntries(context?: IFolder): NewMenuEntry[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check an optional property type
|
|
3
|
+
*
|
|
4
|
+
* @param obj - the object to check
|
|
5
|
+
* @param property - the property name
|
|
6
|
+
* @param type - the expected type
|
|
7
|
+
* @throws {Error} if the property is defined and not of the expected type
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkOptionalProperty<T extends object>(obj: T, property: Exclude<keyof T, symbol>, type: 'array' | 'function' | 'string' | 'boolean' | 'number' | 'object'): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/files",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.7",
|
|
4
4
|
"description": "Nextcloud files utils",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextcloud",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"test": "vitest run",
|
|
41
41
|
"test:coverage": "vitest run --coverage",
|
|
42
42
|
"test:watch": "vitest watch",
|
|
43
|
+
"ts:check": "tsc --noEmit",
|
|
43
44
|
"watch": "vite --mode development build --watch"
|
|
44
45
|
},
|
|
45
46
|
"overrides": {
|
|
@@ -65,8 +66,8 @@
|
|
|
65
66
|
"@nextcloud/event-bus": "^3.3.3",
|
|
66
67
|
"@nextcloud/typings": "^1.10.0",
|
|
67
68
|
"@nextcloud/vite-config": "^2.5.2",
|
|
68
|
-
"@types/node": "^25.0.
|
|
69
|
-
"@vitest/coverage-istanbul": "^4.0.
|
|
69
|
+
"@types/node": "^25.0.3",
|
|
70
|
+
"@vitest/coverage-istanbul": "^4.0.16",
|
|
70
71
|
"css.escape": "^1.5.1",
|
|
71
72
|
"fast-xml-parser": "^5.3.3",
|
|
72
73
|
"jsdom": "^27.3.0",
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
"typedoc": "^0.28.15",
|
|
75
76
|
"typedoc-plugin-missing-exports": "^4.1.2",
|
|
76
77
|
"typescript": "^5.9.3",
|
|
77
|
-
"vite": "^7.
|
|
78
|
+
"vite": "^7.3.0",
|
|
78
79
|
"vitest": "^4.0.14"
|
|
79
80
|
},
|
|
80
81
|
"engines": {
|