/* Saved-file rows share one accessible action area in both layouts. */
(function(root) {
'use strict';
const matches = (video, query) => !query || `${video.title || video.id} ${video.channel || ''}`.toLowerCase().includes(query.toLowerCase());
const paths = {
export: '',
delete: ''
};
function button(doc, kind, label, action) {
const b = doc.createElement('button'); b.type = 'button';
b.className = `saved-file-action${kind === 'delete' ? ' danger' : ''}`;
b.setAttribute('aria-label', label); b.title = label;
b.innerHTML = ``;
b.onclick = e => { e.stopPropagation(); action(); }; return b;
}
function actions(row, video, exportFile, deleteFile) {
const doc = row.ownerDocument, group = doc.createElement('div');
group.className = 'saved-file-actions'; group.setAttribute('role', 'group');
group.setAttribute('aria-label', `File actions for ${video.title || video.id}`);
group.append(button(doc, 'export', `Save to this device: ${video.title || video.id}`, exportFile), button(doc, 'delete', `Delete saved file: ${video.title || video.id}`, deleteFile));
row.append(group);
}
const api = { matches, actions };
if (typeof module !== 'undefined') module.exports = api; else root.SavedPage = api;
})(typeof window !== 'undefined' ? window : globalThis);