import { app } from "/scripts/app.js"; const NODE_NAME = "DumasAnchorStyle"; const STYLE_INPUT = "anchor_style"; const DESCRIPTION_INPUT = "style_description"; const PRESETS = { "cinematic action movie": "Big-screen action cinema with assertive visual storytelling: dynamic camera placement, strong forward momentum, crisp geography, muscular lighting contrast, practical atmosphere, and a sense of physical consequence. Favor heroic framing, controlled handheld energy or motivated tracking moves, dramatic silhouettes, tasteful lens flares, impact-driven pacing, and polished studio spectacle without drifting into comic-book unreality unless the shot explicitly asks for it.", "comedy": "Play the scene for comedic readability and timing: clear staging, expressive performances, slightly heightened reactions, clean eyelines, and visual beats that leave room for the joke to land. Use bright approachable lighting, grounded but playful production design, readable framing, and a tone that feels observant, awkward, or absurd without becoming broad parody unless the action supports it.", "found footage": "Captured as raw found-footage material by someone physically present in the scene: imperfect handheld movement, reactive reframing, clipped composition, sudden zooms or focus hunts, practical exposure changes, and the feeling that the camera operator is discovering events in real time. Keep the image messy but legible, accidental rather than cinematic, with authentic panic, hesitation, and ambient noise.", "90s sitcom": "Classic 1990s multi-camera sitcom language: bright even stage lighting, cozy production design, clean master coverage, medium-wide proscenium framing, fast readable blocking, and performances calibrated for studio audience laughs. The world should feel warm, slightly idealized, and television-friendly, with practical interiors, punchy pauses, and visual simplicity that prioritizes character business.", "mobile/cell phone captured": "Looks like it was shot casually on a phone by an ordinary person: vertical-video instincts even when the frame is horizontal, imperfect stabilization, auto-exposure breathing, clipped highlights, shallow device-grade dynamic range, and opportunistic framing. Keep it intimate, immediate, and plausibly amateur, with sudden pans, uncertain focus, and informal proximity that feel genuinely captured.", "news broadcast": "Television news coverage with clear institutional polish: composed framing, practical key lighting, sober color balance, authoritative pacing, and a documentarian sense of informational clarity. Favor reporter or live-hit visual grammar, observational cutaway logic, steady camera operation, concise emphasis, and a tone that feels current, factual, and broadcast-safe rather than entertainment-first.", "prestige tv drama": "Prestige television drama with premium streaming polish: restrained confidence, textured naturalism, nuanced performances, motivated camera movement, and carefully shaped practical lighting. The mood should feel mature and expensive, with layered production design, cinematic color separation, and emotionally observant framing that trusts silence and subtext.", "psychological thriller": "Unsettling psychological-thriller grammar: controlled tension, negative space, ambiguous visual information, subtle distortion of normality, and lighting that suggests emotional danger more than physical spectacle. Favor lingering compositions, invasive close-ups, reflective surfaces, uneasy stillness, and a slow escalation of dread.", "horror": "Lean into horror atmosphere and threat: moody low-key lighting, oppressive space, directional contrast, tactile production texture, and suspenseful framing that weaponizes what is barely seen. The scene should feel unsafe and anticipatory, with sound-implied menace, uneasy empty areas in frame, and a commitment to dread over cheap chaos.", "science fiction epic": "Expansive science-fiction worldbuilding with polished futuristic scale: elegant production design, disciplined visual effects logic, atmospheric depth, and camera language that makes technology feel integrated and believable. Balance awe with clarity, using sleek surfaces, volumetric light, controlled color motifs, and a sense of society beyond the immediate shot.", "space opera": "Large-scale space opera with mythic emotion and visual grandeur: bold silhouettes, operatic lighting, sweeping camera movement, heroic compositions, and a heightened sense of destiny. Keep the worlds rich and theatrical, with dramatic color, iconic staging, and spectacle that feels earnest and adventurous.", "western": "Cinematic western visual language: expansive landscapes, strong horizon lines, weathered textures, harsh natural light, deliberate blocking, and a sense of moral tension embedded in open space. Favor patient compositions, boots-on-dust realism, iconic stand-off geometry, and tactile period detail without romanticizing away the grit.", "neo-noir": "Neo-noir mood with urban tension and seductive darkness: hard contrast, reflective surfaces, sodium vapor or neon accents, morally complicated framing, and a sense that every location hides compromise. Use rain, smoke, glass, and deep shadow strategically, with stylish but controlled camera work.", "period drama": "Refined period-drama treatment with historical texture, tailored production design, graceful camera movement, and careful social observation. Light the world with soft elegance and believable practical motivation, prioritizing fabric, architecture, etiquette, and emotional restraint over flashy stylization.", "documentary vérité": "Observational documentary vérité: minimally intrusive camera behavior, natural available light, patient real-time watchfulness, and an emphasis on lived-in truth over visual perfection. The frame can breathe, drift, and adjust as events unfold, but it should always feel honestly present rather than staged.", "music video": "Stylized music-video direction with strong visual authorship: rhythmic movement, bold color design, heightened pose, graphic composition, and a willingness to prioritize vibe and image over literal realism. Keep it polished and intent-driven, with kinetic transitions, fashion-forward staging, and synchronized intensity.", "luxury commercial": "Premium commercial polish aimed at aspiration and desirability: immaculate composition, glossy surfaces, refined lighting control, slow confident camera movement, and tactile focus on premium materials. Everything should feel precise, expensive, and seductively curated, with no accidental mess unless it serves the concept.", "true crime reenactment": "True-crime reenactment style with documentary dramatization: moody but legible lighting, restrained suspense, partial visual withholding, and a tone that suggests reconstruction rather than action filmmaking. Use practical locations, careful anonymity or selective detail, and sober tension that feels broadcast-doc adjacent.", "surveillance / cctv": "Fixed surveillance-camera capture with institutional detachment: elevated or corner-mounted viewpoint, wide coverage, unflattering perspective, limited dynamic range, compressed detail, and an impersonal observational tone. Avoid cinematic composition; the power comes from banality, distance, and timestamp-era bluntness.", "bodycam": "Police or security bodycam perspective: chest-mounted, wide-angle, unstable, close to breath and motion, with abrupt tilts, partial occlusion, clipped framing, and urgent first-person proximity. The footage should feel evidentiary and high-stress, more reactive than composed, while remaining coherent enough to follow action.", "vlog / creator video": "Online creator or vlog visual style: personable direct address, flattering but casual framing, expressive presentation, and a self-aware sense of on-camera performance. Lighting should feel creator-friendly and approachable, with clean image quality, lifestyle polish, and a balance between authenticity and charisma.", "anime cinematic": "High-end anime feature or prestige series look translated into shot design: expressive composition, dynamic perspective, graphic silhouette readability, emotionally heightened staging, and clean intentional shape language. Push atmosphere, color motifs, and dramatic key moments while keeping spatial storytelling clear.", "indie mumblecore": "Low-budget indie mumblecore naturalism: intimate handheld or locked-off simplicity, imperfect but observant framing, natural light or modest practicals, and performances that feel conversational rather than plot-driven. Let awkward pauses, environmental plainness, and human messiness carry the tone instead of visual over-design.", "elevated fantasy": "Sophisticated fantasy realism with mythic texture and grounded physical detail: rich environments, atmospheric scale, carefully motivated magical elements, and a serious emotional register. The world should feel old, inhabited, and culturally specific, with visual wonder rooted in tactile materials rather than generic glow.", "procedural cop show": "Mainstream procedural television style: efficient visual clarity, stable coverage, lightly stylized realism, and quick storytelling that privileges evidence, reactions, and spatial logic. Use functional but polished lighting, confident blocking, and a tone that feels network-accessible, competent, and case-driven.", "romantic drama": "Emotion-first romantic drama treatment: tender close observation, flattering naturalistic light, soft but not mushy contrast, and framing that prioritizes vulnerability, chemistry, and meaningful silence. The scene should feel intimate, earnest, and visually attentive to touch, glance, and emotional hesitation.", "grindhouse exploitation": "Aggressive grindhouse/exploitation texture: rough-edged energy, dirty contrast, oversaturated or faded color bias, abrasive zooms, tactile film wear vibes, and sensational staging that feels dangerous, pulpy, and disreputable. Keep the image gleefully imperfect and confrontational rather than polished.", "video essay b-roll": "Thoughtful video-essay b-roll style: visually articulate, idea-supporting imagery with tasteful motion, strong graphic clarity, and composition that feels editorially useful. The tone should be polished but not flashy, descriptive rather than dramatic, with images that communicate theme, context, and texture efficiently.", "reality tv": "Unscripted reality-TV coverage: reactive zooms, multiple-camera energy implied in the framing, practical interiors, performance-aware spontaneity, and a tone that amplifies interpersonal drama. Keep it bright, legible, and emotionally available, with visual beats that feel captured in the moment rather than authored.", }; function findWidget(node, name) { return (node.widgets || []).find((widget) => widget?.name === name) || null; } app.registerExtension({ name: "Dumas.AnchorStyle", async beforeRegisterNodeDef(nodeType, nodeData) { if (nodeData?.name !== NODE_NAME) return; const originalOnNodeCreated = nodeType.prototype.onNodeCreated; nodeType.prototype.onNodeCreated = function onNodeCreated() { const created = originalOnNodeCreated?.apply(this, arguments); const styleWidget = findWidget(this, STYLE_INPUT); const descriptionWidget = findWidget(this, DESCRIPTION_INPUT); if (!styleWidget || !descriptionWidget) return created; const originalCallback = styleWidget.callback; styleWidget.callback = (...args) => { const selected = String(styleWidget.value || ""); if (Object.hasOwn(PRESETS, selected)) { descriptionWidget.value = PRESETS[selected]; descriptionWidget.inputEl?.dispatchEvent(new Event("input", { bubbles: true })); } this.setDirtyCanvas?.(true, true); return originalCallback?.apply(styleWidget, args); }; return created; }; }, });