✨
未処理の提案はありません
「Museへ渡す」タブからプロンプトをコピーしてMuseに調査を依頼し、muse_feed.json を更新するか「JSON貼付」タブから取り込んでください。
`;
return;
}
const dna = computeUserDNA();
const blocks = [];
// Section 1: Work Proposals
if (ms.pendingWorks.length) {
blocks.push(`
🎬 新作・おすすめ作品提案 (${ms.pendingWorks.length}件)
${ms.pendingWorks.length > 1 ? `
` : ''}
${ms.pendingWorks.map((wp) => {
const matchedActress = findActressByLooseName(wp.actressName);
const tagHtml = [
...(wp.costumeTags || []).map((t) => `
${esc(t)}`),
...(wp.situationTags || []).map((t) => `
${esc(t)}`),
...(wp.playTags || []).map((t) => `
${esc(t)}`)
].join('');
return `
${esc(wp.code || 'NO-CODE')}
${matchedActress ? `✓ ${esc(matchedActress.name)} に自動紐付け` : (wp.actressName ? `出演: ${esc(wp.actressName)}(未登録)` : '出演女優未指定')}
${esc(wp.title)}
${tagHtml ? `
${tagHtml}
` : ''}
${wp.memo ? `
${esc(wp.memo)}
` : ''}
`;
}).join('')}
`);
}
// Section 2: Actress Profile Updates (Safe Non-Destructive Append)
if (ms.pendingUpdates.length) {
blocks.push(`
📝 既存女優の情報補強 (${ms.pendingUpdates.length}件)
${ms.pendingUpdates.map((upd) => {
const target = findActressByLooseName(upd.actressName);
return `
${esc(upd.actressName)}
${target ? '登録済みに安全追記' : '女優DBに未登録'}
${upd.addTags.length ? `
${upd.addTags.map((t) => `+#${esc(t)}`).join('')}
` : ''}
${upd.appendMemo ? `
${esc(upd.appendMemo)}
` : ''}
※ あなたの★評価・スライダー・既存メモは上書きされません。
`;
}).join('')}
`);
}
// Section 3: New Scout Candidates
if (ms.pendingScouts.length) {
blocks.push(`
✨ 新規スカウト候補 (${ms.pendingScouts.length}名)
${ms.pendingScouts.map((sc, idx) => {
const matchPct = calculateMatchScore(sc, dna);
return `
${esc(sc.name)}
推定一致 ${matchPct}%
${(sc.tags || []).length ? `
${sc.tags.map((t) => `#${esc(t)}`).join('')}
` : ''}
${sc.memo ? `
${esc(sc.memo)}
` : ''}
`;
}).join('')}
`);
}
listEl.innerHTML = blocks.join('');
}
function approveMuseWork(propId) {
const ms = normalizeMuseState(state.museState);
const idx = ms.pendingWorks.findIndex((w) => w.id === propId);
if (idx === -1) return;
const wp = ms.pendingWorks[idx];
const matchedActress = findActressByLooseName(wp.actressName);
const newWork = {
id: `wrk-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
code: wp.code || '',
title: wp.title,
actressId: matchedActress ? matchedActress.id : '',
thumbnail: wp.thumbnailUrl || generateWorkArt(wp.code || 'MUSE', 'MUSE PICK', `${matchedActress ? matchedActress.name + ' / ' : ''}${wp.title.slice(0, 14)}`, 'crimson', 0),
thumbnailPosition: normalizeCrop(null, 50),
subPhotos: [],
watched: false,
rating: 4,
repeatCount: 0,
costumeTags: [...(wp.costumeTags || [])],
situationTags: [...(wp.situationTags || [])],
playTags: [...(wp.playTags || [])],
memo: wp.memo || '',
createdAt: Date.now()
};
state.works.unshift(newWork);
ms.pendingWorks.splice(idx, 1);
if (!ms.dismissedIds.includes(propId)) ms.dismissedIds.push(propId);
state.museState = ms;
saveState();
updateAllViews();
renderMuseModal();
showToast(`🎬 「${wp.code || wp.title.slice(0, 14)}」を未視聴に追加しました`, 'gold');
}
function approveAllMuseWorks() {
const ms = normalizeMuseState(state.museState);
if (!ms.pendingWorks.length) return;
const count = ms.pendingWorks.length;
const baseTs = Date.now();
ms.pendingWorks.forEach((wp, i) => {
const matchedActress = findActressByLooseName(wp.actressName);
state.works.unshift({
id: `wrk-${baseTs}-${i}-${Math.random().toString(36).slice(2, 5)}`,
code: wp.code || '',
title: wp.title,
actressId: matchedActress ? matchedActress.id : '',
thumbnail: wp.thumbnailUrl || generateWorkArt(wp.code || 'MUSE', 'MUSE PICK', `${matchedActress ? matchedActress.name + ' / ' : ''}${wp.title.slice(0, 14)}`, 'crimson', i % 4),
thumbnailPosition: normalizeCrop(null, 50),
subPhotos: [],
watched: false,
rating: 4,
repeatCount: 0,
costumeTags: [...(wp.costumeTags || [])],
situationTags: [...(wp.situationTags || [])],
playTags: [...(wp.playTags || [])],
memo: wp.memo || '',
createdAt: baseTs + i
});
if (!ms.dismissedIds.includes(wp.id)) ms.dismissedIds.push(wp.id);
});
ms.pendingWorks = [];
state.museState = ms;
saveState();
updateAllViews();
renderMuseModal();
showToast(`🎬 ${count}本の作品をまとめて未視聴に追加しました`, 'gold');
}
function dismissMuseWork(propId) {
const ms = normalizeMuseState(state.museState);
ms.pendingWorks = ms.pendingWorks.filter((w) => w.id !== propId);
if (!ms.dismissedIds.includes(propId)) ms.dismissedIds.push(propId);
state.museState = ms;
saveState();
renderMuseModal();
showToast('作品提案をスキップしました', 'neutral');
}
function approveMuseActressUpdate(updId) {
const ms = normalizeMuseState(state.museState);
const idx = ms.pendingUpdates.findIndex((u) => u.id === updId);
if (idx === -1) return;
const upd = ms.pendingUpdates[idx];
const target = findActressByLooseName(upd.actressName);
if (!target) {
showToast('対象の女優が登録されていません', 'error');
return;
}
// Safe merge: append only new tags & append memo without overwriting existing data
const existingTags = new Set(target.tags || []);
(upd.addTags || []).forEach((t) => existingTags.add(t));
target.tags = Array.from(existingTags);
if (upd.appendMemo) {
target.memo = target.memo
? `${target.memo}\n\n${upd.appendMemo}`
: upd.appendMemo;
}
ms.pendingUpdates.splice(idx, 1);
if (!ms.dismissedIds.includes(updId)) ms.dismissedIds.push(updId);
state.museState = ms;
saveState();
updateAllViews();
renderMuseModal();
showToast(`✓ ${target.name} にタグ・メモを追記しました`, 'gold');
}
function dismissMuseActressUpdate(updId) {
const ms = normalizeMuseState(state.museState);
ms.pendingUpdates = ms.pendingUpdates.filter((u) => u.id !== updId);
if (!ms.dismissedIds.includes(updId)) ms.dismissedIds.push(updId);
state.museState = ms;
saveState();
renderMuseModal();
showToast('プロフィール追記をスキップしました', 'neutral');
}
function approveMuseScoutToDb(index) {
const ms = normalizeMuseState(state.museState);
const sc = ms.pendingScouts[index];
if (!sc) return;
const newActress = {
id: `act-${Date.now()}`,
name: sc.name,
rating: 4,
isMvp: state.actresses.length === 0,
theme: sc.theme || 'gold',
photo: sc.photoUrl || generatePortraitArt(sc.name, sc.theme || 'gold', 'MUSE'),
photoPosition: normalizeCrop(null, 20),
bipolar: { ...(sc.bipolar || {}) },
radar: { ...(sc.radar || { looks: 4, style: 4, voiceScore: 4, expression: 4, gap: 4 }) },
tags: [...(sc.tags || [])],
memo: sc.memo || '',
createdAt: Date.now()
};
state.actresses.unshift(newActress);
ms.pendingScouts.splice(index, 1);
state.museState = ms;
saveState();
updateAllViews();
renderMuseModal();
showToast(`★ ${sc.name} を女優DBに登録しました`, 'gold');
}
function sendMuseScoutToDeck(index) {
const ms = normalizeMuseState(state.museState);
const sc = ms.pendingScouts[index];
if (!sc) return;
state.scoutCandidates.unshift({
id: `sc-${Date.now()}`,
name: sc.name,
theme: sc.theme || 'crimson',
photo: sc.photoUrl || generatePortraitArt(sc.name, sc.theme || 'crimson', 'MUSE'),
bipolar: { ...(sc.bipolar || {}) },
radar: { ...(sc.radar || { looks: 4, style: 4, voiceScore: 4, expression: 4, gap: 4 }) },
tags: [...(sc.tags || [])],
memo: sc.memo || ''
});
ms.pendingScouts.splice(index, 1);
state.museState = ms;
saveState();
updateAllViews();
renderMuseModal();
showToast(`🃏 ${sc.name} をスカウトタブへ送りました`, 'gold');
}
function dismissMuseScout(index) {
const ms = normalizeMuseState(state.museState);
const sc = ms.pendingScouts[index];
if (!sc) return;
const key = normalizeNameKey(sc.name);
if (key && !ms.dismissedScoutNames.includes(key)) {
ms.dismissedScoutNames.push(key);
}
ms.pendingScouts.splice(index, 1);
state.museState = ms;
saveState();
renderMuseModal();
showToast(`${sc.name} をスキップしました`, 'neutral');
}
function handleMuseManualPaste() {
const input = document.getElementById('muse-paste-input');
const raw = input.value;
try {
const parsed = parseJsonFromRawText(raw);
ingestMuseFeed(parsed, { sourceLabel: '貼り付けJSON', silent: false });
input.value = '';
switchMuseModalTab('inbox');
} catch (err) {
showToast(err.message || 'JSONの解析に失敗しました', 'error');
}
}
function loadSampleMusePaste() {
const firstActress = state.actresses[0]?.name || '桐生 玲奈';
const sample = {
updatedAt: new Date().toISOString(),
summary: `テスト配信:${firstActress}のおすすめ作品1本・プロフィール追記1件・新スカウト候補1名をピックアップしました。`,
newScouts: [
{
name: '黒木 蓮華',
bipolar: { hierarchy: -4, face: -4, vibe: -1, distance: -3, body: -2, voice: 4 },
radar: { looks: 4.5, style: 4.5, voiceScore: 5.0, expression: 4.5, gap: 4.5 },
tags: ['低音ボイス', '知的オーラ', '黒髪ロング'],
memo: '落ち着いた低めボイスとクールな立ち振る舞いが好み座標と高一致。'
}
],
workProposals: [
{
id: `prop-sample-${Date.now()}`,
actressName: firstActress,
code: 'MUSE-001',
title: '深夜のプライベートラウンジ — 静かな囁きと二人だけの時間',
costumeTags: ['ドレス', 'スーツ'],
situationTags: ['ホテル夜景', '秘密の関係'],
playTags: ['囁き・耳元', 'スロー展開'],
memo: 'Museテスト提案:高評価レビュー多数の人気作。'
}
],
actressUpdates: [
{
id: `upd-sample-${Date.now()}`,
actressName: firstActress,
addTags: ['ドラマ重視', '大人の色気'],
appendMemo: '【Muse調査】落ち着いた掛け合いと終盤のギャップ演出が特に高評価。'
}
]
};
document.getElementById('muse-paste-input').value = JSON.stringify(sample, null, 2);
showToast('テスト用JSONを入力しました。「解析して取り込む」を押してください', 'gold');
}
/* ==========================================================================
BACKUP, INDEXEDDB STORAGE USAGE BAR & JSON IMPORT/EXPORT
========================================================================== */
// ... existing code ...
const payload = {
version: SCHEMA_VERSION,
exportedAt: now.toISOString(),
lastBackupAt: exportedTs,
actresses: state.actresses,
works: state.works,
scoutCandidates: state.scoutCandidates,
galleryPhotos: state.galleryPhotos || [],
favoriteWorkPhotos: state.favoriteWorkPhotos || {},
museState: normalizeMuseState(state.museState)
};
// ... existing code ...
function updateAllViews() {
renderDnaTab();
renderActressesTab();
renderWorksTab();
renderGalleryTab();
renderScoutTab();
updateBackupReminderDot();
updateMuseBadge();
}
// ... existing code ...
// Sheet Backdrop Close
document.getElementById('sheet-overlay').addEventListener('click', (e) => {
if (e.target.id === 'sheet-overlay') popView();
});
// Lightbox Controls, Gestures (Swipe/Pinch/Pan/Pull-Dismiss) & Keyboard
document.getElementById('lb-back-btn').addEventListener('click', closeLightbox);
document.getElementById('lb-prev-btn').addEventListener('click', () => stepLightbox(-1, true));
document.getElementById('lb-next-btn').addEventListener('click', () => stepLightbox(1, true));
document.getElementById('lb-zoom-out').addEventListener('click', () => adjustLightboxZoom(-0.5));
document.getElementById('lb-zoom-in').addEventListener('click', () => adjustLightboxZoom(0.5));
document.getElementById('lb-zoom-reset').addEventListener('click', () => resetLightboxZoom(true));
document.getElementById('lb-fav-btn').addEventListener('click', toggleLightboxFavorite);
document.getElementById('lb-set-main-btn').addEventListener('click', setLightboxPhotoAsActressMain);
document.getElementById('lb-open-work-btn').addEventListener('click', openLightboxSourceWork);
document.getElementById('lb-delete-btn').addEventListener('click', deleteLightboxStandalonePhoto);
initLightboxGestures();
window.addEventListener('keydown', (e) => {
const lbModal = document.getElementById('lightbox-modal');
if (!lbModal.classList.contains('hidden')) {
if (e.key === 'Escape') closeLightbox();
else if (e.key === 'ArrowLeft') stepLightbox(-1, true);
else if (e.key === 'ArrowRight') stepLightbox(1, true);
else if (e.key === '+' || e.key === '=') adjustLightboxZoom(0.4);
else if (e.key === '-') adjustLightboxZoom(-0.4);
else if (e.key === '0') resetLightboxZoom(true);
}
});
// Muse Inbox & Sync Modal Controls
document.getElementById('btn-open-muse').addEventListener('click', () => openMuseModal('inbox'));
document.getElementById('btn-close-muse').addEventListener('click', closeMuseModal);
document.getElementById('muse-modal').addEventListener('click', (e) => {
if (e.target.id === 'muse-modal') closeMuseModal();
});
document.querySelectorAll('.muse-tab-btn').forEach((btn) => {
btn.addEventListener('click', () => switchMuseModalTab(btn.dataset.museTab));
});
document.getElementById('btn-muse-fetch').addEventListener('click', () => fetchMuseFeed({ silent: false }));
document.getElementById('btn-muse-parse-paste').addEventListener('click', handleMuseManualPaste);
document.getElementById('btn-muse-clear-paste').addEventListener('click', () => {
document.getElementById('muse-paste-input').value = '';
});
document.getElementById('btn-muse-load-sample').addEventListener('click', loadSampleMusePaste);
document.getElementById('btn-muse-export-profile').addEventListener('click', exportTasteProfileJson);
document.getElementById('btn-muse-copy-profile').addEventListener('click', () => {
copyTextSafe(JSON.stringify(buildTasteProfilePayload(), null, 2), '📋 taste_profile.json をコピーしました');
});
document.getElementById('btn-muse-copy-prompt').addEventListener('click', () => {
copyTextSafe(buildMusePromptText(), '🤖 Muse用・調査指示プロンプトをコピーしました');
});
document.getElementById('btn-muse-save-url').addEventListener('click', () => {
const val = document.getElementById('muse-feed-url-input').value.trim() || './muse_feed.json';
state.museState = normalizeMuseState(state.museState);
state.museState.feedUrl = val;
saveState();
renderMuseModal();
showToast('受信フィードURLを保存しました', 'gold');
});
document.getElementById('btn-muse-reset-history').addEventListener('click', () => {
openConfirmModal(
'Muse処理履歴をリセット',
'スキップ済み・既読済みのIDとスカウト除外リストをクリアしますか?(同じ muse_feed.json を再度取り込み直せます)',
() => {
const ms = normalizeMuseState(state.museState);
ms.dismissedIds = [];
ms.dismissedScoutNames = [];
state.museState = ms;
saveState();
renderMuseModal();
showToast('Museの処理履歴をクリアしました', 'gold');
}
);
});
// Backup Modal & JSON Import/Export Controls
// ... existing code ...
// Initial Render & Background Muse Feed Check
updateAllViews();
fetchMuseFeed({ silent: true });
});