(()=>{var Y={randomSeed:!0,seed:1};function we(t,e){let o=document.createElement("section");o.className="panel canvas-controls";let s=document.createElement("h3");s.textContent="\u753B\u50CF\u306E\u8A2D\u5B9A",o.append(s);let i=Object.values(t).filter(g=>g.class_type==="KSampler"),a=Object.values(t).find(g=>g.class_type==="EmptyLatentImage"),n=document.createElement("div");n.className="fields";function l(g,b,P=n){let G=document.createElement("label");G.className="field";let v=document.createElement("span");v.textContent=g,G.append(v,b),P.append(G)}function d(g,b,P,G,v,D,R,$=n){let q=document.createElement("input");return q.type="number",q.name=b,q.min=String(G),q.max=String(v),q.step=String(D),q.value=String(P),q.required=!0,q.oninput=()=>{q.validity.valid&&q.value!==""&&R(Number(q.value))},l(g,q,$),q}let r=[...new Set(i.map(g=>String(g.inputs.negative?.[0])))].map(g=>t[g]).filter(g=>g?.class_type==="CLIPTextEncode");if(r.length){let g=document.createElement("textarea");g.name="negative_prompt",g.rows=3,g.value=String(r[0].inputs.text),g.oninput=()=>r.forEach(b=>b.inputs.text=g.value),l("\u30CD\u30AC\u30C6\u30A3\u30D6\u30D7\u30ED\u30F3\u30D7\u30C8",g,o)}if(o.append(n),a){let g=document.createElement("select");g.name="canvas_size";for(let[v,D]of[["1024x1024","\u6B63\u65B9\u5F62 1024 \xD7 1024"],["768x1024","\u7E26\u9577 768 \xD7 1024"],["1024x768","\u6A2A\u9577 1024 \xD7 768"],["576x1024","\u7E26\u9577 576 \xD7 1024"],["1024x576","\u6A2A\u9577 1024 \xD7 576"],["custom","\u30AB\u30B9\u30BF\u30E0"]]){let R=document.createElement("option");R.value=v,R.textContent=D,g.append(R)}let b=a.inputs.width+"x"+a.inputs.height;g.value=Array.from(g.options).some(v=>v.value===b)?b:"custom",l("\u30B5\u30A4\u30BA",g);let P=d("\u5E45\uFF08px\uFF09","canvas_width",Number(a.inputs.width),256,1024,64,v=>{a.inputs.width=v,g.value="custom"}),G=d("\u9AD8\u3055\uFF08px\uFF09","canvas_height",Number(a.inputs.height),256,1024,64,v=>{a.inputs.height=v,g.value="custom"});g.onchange=()=>{if(g.value==="custom")return;let[v,D]=g.value.split("x").map(Number);P.value=String(v),G.value=String(D),a.inputs.width=v,a.inputs.height=D},d("\u751F\u6210\u679A\u6570","canvas_batch",Number(a.inputs.batch_size),1,4,1,v=>a.inputs.batch_size=v)}i.length&&(d("\u30B9\u30C6\u30C3\u30D7\u6570","canvas_steps",Number(i[0].inputs.steps),1,60,1,g=>i.forEach(b=>b.inputs.steps=g)),d("\u30D7\u30ED\u30F3\u30D7\u30C8\u306E\u5F37\u3055\uFF08CFG\uFF09","canvas_cfg",Number(i[0].inputs.cfg),1,20,.5,g=>i.forEach(b=>b.inputs.cfg=g)));let f=document.createElement("input");f.type="checkbox",f.name="canvas_random_seed",f.checked=Y.randomSeed,l("\u30B7\u30FC\u30C9\u3092\u6BCE\u56DE\u30E9\u30F3\u30C0\u30E0\u306B\u3059\u308B",f);let y=d("\u30B7\u30FC\u30C9","canvas_seed",Y.seed,0,Number.MAX_SAFE_INTEGER,1,g=>Y.seed=g);y.disabled=f.checked,f.onchange=()=>{Y.randomSeed=f.checked,y.disabled=f.checked};let L=document.createElement("details"),k=document.createElement("summary");k.textContent="\u8A73\u7D30\u8A2D\u5B9A",L.append(k);let N=document.createElement("div");N.className="fields",L.append(N),o.append(L);for(let[g,b]of[["sampler_name","\u30B5\u30F3\u30D7\u30E9\u30FC"],["scheduler","\u30B9\u30B1\u30B8\u30E5\u30FC\u30E9\u30FC"]]){if(!i.length)continue;let P=document.createElement("select");P.name="canvas_"+g;let G=e.KSampler?.input?.required?.[g]?.[0],v=[...new Set([String(i[0].inputs[g]),...Array.isArray(G)?G:[]])];for(let D of v){let R=document.createElement("option");R.value=String(D),R.textContent=String(D),P.append(R)}P.onchange=()=>i.forEach(D=>D.inputs[g]=P.value),l(b,P,N)}let w=Object.values(t).filter(g=>g.class_type==="CLIPSetLastLayer");return w.length&&d("CLIP\u30B9\u30AD\u30C3\u30D7","canvas_clip_skip",Math.abs(Number(w[0].inputs.stop_at_clip_layer)),1,12,1,g=>w.forEach(b=>b.inputs.stop_at_clip_layer=-g),N),o}function Fe(t){return Object.values(t).flatMap(e=>(e.class_type==="Krea2EditModelPatch"?["source_latent_b","source_image_b"]:e.class_type==="Krea2EditGroundedEncode"?["image_b"]:[]).filter(s=>Array.isArray(e.inputs[s])).map(s=>({node:e,key:s})))}function Ge(t){let e=new Set,o=new Set,s=Fe(t).map(({node:i,key:a})=>String(i.inputs[a][0]));for(;s.length;){let i=s.pop();if(o.has(i))continue;o.add(i);let a=t[i];if(a){if(a.class_type==="LoadImage"){e.add(i);continue}for(let n of Object.values(a.inputs))Array.isArray(n)&&n.length===2&&s.push(String(n[0]))}}return e}function qe(t){for(let{node:e,key:o}of Fe(t))delete e.inputs[o]}(()=>{let t=Symbol.for("app.seisuiPrompts.v1");if(document[t])return;document[t]=!0;let e=()=>{let o=document.querySelector("#workflow-form");if(!o)return;let s=()=>{let i=o.querySelector("#lora-j")?.closest(".video-lora-control");if(!i||i.querySelector("[data-seisui-prompts]"))return;let a=document.createElement("select");a.className="lora-prompt-presets",a.dataset.seisuiPrompts="",a.setAttribute("aria-label","Seisui \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["a woman, jumpcut, after the transition, she is nude sitting with her legs spread, she is pissing on the ground","a woman, jumpcut, after the transition, she is nude on all fours, a nude man is standing in front of her, he is holding his penis and pissing into her mouth","a woman, jumpcut, after the transition, she is nude lying on her back with her legs back, she is pissing on her own face, piss splashes against her face, soaking her skin and dripping down her body"]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}a.addEventListener("change",()=>{let l=o.querySelector('textarea[name="prompt"]');a.value&&l&&(l.value=a.value,l.dispatchEvent(new Event("input",{bubbles:!0})),a.value="")}),i.append(a)};new MutationObserver(s).observe(o,{childList:!0,subtree:!0}),s()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()})();(()=>{let t=document.querySelector("#app-config");if(!t||JSON.parse(t.textContent).id!=="image-edit-prime")return;let e=window.appSdk,o=Symbol.for("app.imageEditPrimeBranding.v1");if(!e||e[o])return;e[o]=!0;let s=/flux/i,i=_=>typeof _=="string"&&s.test(_)?"Image Edit Prime\u306E\u51E6\u7406\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u5165\u529B\u3068\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3057\u3066\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002":_,a=_=>typeof _=="string"?_.replace(/flux(?:\d+(?:\.\d+)*)?/ig,"ImageEditPrime"):_,n=e.onStatus.bind(e);e.onStatus=_=>n(r=>_({...r,message:i(r.message)}));let l=e.onResult.bind(e);e.onResult=_=>l(r=>{let f=r.output&&typeof r.output=="object"?{...r.output}:r.output;if(f)for(let y of["files","images"])Array.isArray(f[y])&&(f[y]=f[y].map(L=>({...L,filename:a(L.filename)})));return _({...r,error:i(r.error),output:f})});let d=e.onGenerate.bind(e);e.onGenerate=_=>d(async()=>{try{return await _()}catch(r){let f=i(r?.message);throw f!==r?.message?new Error(f):r}})})();(()=>{let t=document.querySelector("#app-config");if(!t||JSON.parse(t.textContent).id!=="video-karma")return;let e=window.appSdk,o=Symbol.for("app.videoKarmaBranding.v1");if(!e||e[o])return;e[o]=!0;let s=/(?:^|[^a-z])wan(?=$|[^a-z]|image|video|model|text|vae|i2v|t2v)/i,i=_=>typeof _=="string"&&s.test(_)?"Video Karma\u306E\u51E6\u7406\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u5165\u529B\u3068\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3057\u3066\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002":_,a=_=>typeof _=="string"?_.replace(/wan(?:\d+(?:\.\d+)*)?/ig,"VideoKarma"):_,n=e.onStatus.bind(e);e.onStatus=_=>n(r=>_({...r,message:i(r.message)}));let l=e.onResult.bind(e);e.onResult=_=>l(r=>{let f=r.output&&typeof r.output=="object"?{...r.output}:r.output;if(f)for(let y of["files","images"])Array.isArray(f[y])&&(f[y]=f[y].map(L=>({...L,filename:a(L.filename)})));return _({...r,error:i(r.error),output:f})});let d=e.onGenerate.bind(e);e.onGenerate=_=>d(async()=>{try{return await _()}catch(r){let f=i(r?.message);throw f!==r?.message?new Error(f):r}})})();(()=>{let t=Symbol.for("app.sideGreetings.v1");if(document[t])return;document[t]=!0;let e=()=>{let o=document.querySelector("#workflow-form");if(!o)return;let s=()=>{let i=o.querySelector("#lora-i")?.closest(".video-lora-control");if(!i||i.querySelector("[data-side-prompts]"))return;let a=document.createElement("select");a.className="lora-prompt-presets",a.dataset.sidePrompts="",a.setAttribute("aria-label","Side \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["changed to scene cuts and she is having sex with her leg aside "]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}a.addEventListener("change",()=>{let l=o.querySelector('textarea[name="prompt"]');a.value&&l&&(l.value=a.value,l.dispatchEvent(new Event("input",{bubbles:!0})),a.value="")}),i.append(a)};new MutationObserver(s).observe(o,{childList:!0,subtree:!0}),s()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()})();(()=>{let t=Symbol.for("app.fellaGreetings.v1");if(document[t])return;document[t]=!0;let e=()=>{let o=document.querySelector("#workflow-form");if(!o)return;let s=()=>{let i=o.querySelector("#lora-g")?.closest(".video-lora-control");if(!i||i.querySelector("[data-fella-prompts]"))return;let a=document.createElement("select");a.className="lora-prompt-presets",a.dataset.fellaPrompts="",a.setAttribute("aria-label","Fella \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["A woman looking at the camera. The video then jumpcuts to the same woman giving a blowjob to a man standing in the same location, looking up as she performs the blowjob on the man, she is kneeling in front of him, she is holding his penis with both hands. she looks at the camera the entire time. she shoves the penis deep in her mouth."]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}a.addEventListener("change",()=>{let l=o.querySelector('textarea[name="prompt"]');a.value&&l&&(l.value=a.value,l.dispatchEvent(new Event("input",{bubbles:!0})),a.value="")}),i.append(a)};new MutationObserver(s).observe(o,{childList:!0,subtree:!0}),s()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()})();(()=>{let t=Symbol.for("app.backGreetings.v1");if(document[t])return;document[t]=!0;let e=()=>{let o=document.querySelector("#workflow-form");if(!o)return;let s=()=>{let i=o.querySelector("#lora-h")?.closest(".video-lora-control");if(!i||i.querySelector("[data-back-prompts]"))return;let a=document.createElement("select");a.className="lora-prompt-presets",a.dataset.backPrompts="",a.setAttribute("aria-label","Back \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["The video begins with a close-up of a woman. The video then jumpcuts to the same woman now having sex in doggystyle position. She is lying on her stomach, facing forward, with her head turned slightly to the side as she reacts to the sensations of intercourse. Her facial expressions change throughout the sequence, showing moments of pleasure and exertion, including wide eyes, an open mouth, and clenched fists.","The video begins with a close-up of a woman. The video then jumpcuts to the same woman now having sex with a man in doggystyle position in the the same location. She is positioned standing, while the man stands behind her, The man is muscular his hands are wrapped around the womanss stomach holding her upright while embracing her from behind, he holds her close as he thrusts into her. As the scene progresses, she moves rhythmically with him. she is fully nude. the man aggressively rams his hips into her.","The video begins with a close-up of a woman. The video then jumpcuts to the same woman now having sex with a man in doggystyle position in the same location. She is bent over with her back arched and her head tilted down as he stands behind her, He is muscular. The womans expression changes throughout the sequence as she reacts to their movements, sometimes looking down, other times up at the camera with an open mouth. The scene is recorded from below looking up. she looks at the camera the entire time. The man agressively has sex with her. she is fully nude."]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}a.addEventListener("change",()=>{let l=o.querySelector('textarea[name="prompt"]');a.value&&l&&(l.value=a.value,l.dispatchEvent(new Event("input",{bubbles:!0})),a.value="")}),i.append(a)};new MutationObserver(s).observe(o,{childList:!0,subtree:!0}),s()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()})();(()=>{let t=Symbol.for("app.kijyoGreetings.v1");if(document[t])return;document[t]=!0;let e=()=>{let o=document.querySelector("#workflow-form");if(!o)return;let s=()=>{let i=o.querySelector("#lora-d")?.closest(".video-lora-control");if(!i||i.querySelector("[data-kijyo-prompts]"))return;let a=document.createElement("select");a.className="lora-prompt-presets",a.dataset.kijyoPrompts="",a.setAttribute("aria-label","Kijyo \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["The video begins with a close-up of a woman. The video then jumpcuts to the same woman now having sex with a man in squatting cowgirl position her face fills the screen she is leaning over forwards as she bounces up and down aggressively. His erect penis is in her vagina.she looks at the camera throughout the video.The video is shot from above looking down on the scene.","The video begins with a close-up of a woman. The video then jumpcuts to the same woman now having sex with a man in squatting cowgirl position she is leaning backwards as she bounces up and down aggressively. His erect penis is in her vagina.she looks at the camera throughout the video."]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}a.addEventListener("change",()=>{let l=o.querySelector('textarea[name="prompt"]');a.value&&l&&(l.value=a.value,l.dispatchEvent(new Event("input",{bubbles:!0})),a.value="")}),i.append(a)};new MutationObserver(s).observe(o,{childList:!0,subtree:!0}),s()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()})();(()=>{let t=Symbol.for("app.ganshaGreetings.v1");if(document[t])return;document[t]=!0;let e=()=>{let o=document.querySelector("#workflow-form");if(!o)return;let s=()=>{let i=o.querySelector("#lora-e")?.closest(".video-lora-control");if(!i||i.querySelector("[data-gansha-prompts]"))return;let a=document.createElement("select");a.className="lora-prompt-presets",a.dataset.ganshaPrompts="",a.setAttribute("aria-label","Gansha \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["The video begins with a close-up of a woman. The video then jumpcuts to the same woman now receiving a facial from a mans penis. She is kneeling on the floor looking up with a open mouth. The cum shoots all over her face. The mans hand holds his erect penis masturbating his penis and shooting the thick white cum directly onto her face, forehead, eyes, cheek and mouth. The thick white cum slowly drips down her face onto her body. An explosion of thick white cum blasts her face. she looks directly at the camera throughout the video.","The video begins with a close-up of a woman. The video then jumpcuts to the same woman now receiving a facial from a mans penis. She is lying on her back. The cum shoots all over her face. The mans hand holds his erect penis masturbating his penis and shooting the thick white cum directly onto her face, forehead, eyes, cheek and mouth. The thick white cum slowly drips down her onto her body. an explosion of thick white cum blasts her face.she looks directly at the camera throughout the video."]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}a.addEventListener("change",()=>{let l=o.querySelector('textarea[name="prompt"]');a.value&&l&&(l.value=a.value,l.dispatchEvent(new Event("input",{bubbles:!0})),a.value="")}),i.append(a)};new MutationObserver(s).observe(o,{childList:!0,subtree:!0}),s()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()})();(()=>{let t=Symbol.for("app.tekokiGreetings.v1");if(document[t])return;document[t]=!0;let e=()=>{let o=document.querySelector("#workflow-form");if(!o)return;let s=()=>{let i=o.querySelector("#lora-f")?.closest(".video-lora-control");if(!i||i.querySelector("[data-tekoki-prompts]"))return;let a=document.createElement("select");a.className="lora-prompt-presets",a.dataset.tekokiPrompts="",a.setAttribute("aria-label","Tekoki \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["The video begins with a close-up of a woman. The video then jumpcuts to the same woman on her stomach with her head resting low in the frame on a mans thigh next to his penis on the left of the frame with her right hand she grasps the mans erect penis and moves it up and down the shaft in a steady rhythm, performing the handjob. She goes through various facial expressions throughout the video from happy to gasping she looks like she is talking.She looks at the camera throughout the video","The video begins with a close-up of a woman. The video then jumpcuts to the same woman now kneeling between a mans legs with her upper body is bent forward over him, and her face is close to his lap. With one hand, she grasps the mans erect penis and moves it up and down its shaft in a steady rhythm, performing the handjob. She goes through various facial expressions throughout the video from happy to gasping she looks like she is talking.She looks at the camera throughout the video She mans feet are seen in the background","The video begins with close-up of a woman. The video then jumpcuts to the same woman now kneeling on the floor in front of the man who is sitting high above her. She is giving the mans penis a handjob with both hands moving them up and down along the shaft. she goes through various facial expressions throughout the video from happy to gasping she looks like she is talking. The woman is looking up to the man.She looks at the camera throughout the video"]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}a.addEventListener("change",()=>{let l=o.querySelector('textarea[name="prompt"]');a.value&&l&&(l.value=a.value,l.dispatchEvent(new Event("input",{bubbles:!0})),a.value="")}),i.append(a)};new MutationObserver(s).observe(o,{childList:!0,subtree:!0}),s()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()})();(()=>{let t=Symbol.for("app.seijyoGreetings.v1");if(document[t])return;document[t]=!0;let e=()=>{let o=document.querySelector("#workflow-form");if(!o)return;let s=()=>{let i=o.querySelector("#lora-c")?.closest(".video-lora-control");if(!i||i.querySelector("[data-seijyo-prompts]"))return;let a=document.createElement("select");a.className="lora-prompt-presets",a.dataset.seijyoPrompts="",a.setAttribute("aria-label","Seijyo \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["The video begins with a close-up of a woman. The video then jumpcuts to the same woman now having sex in missionary position. She is lying on her back on a bed with a patterned bed spread and pillow with her legs spread wide. A mans large penis is visible entering her vagina from below. The man is positioned kneeling between her legs infront of her thrusting his penis into her vagina. Throughout the scene, she appears to be experiencing pleasure, often with her mouth open or eyes closed as she lies back. Her hands hold onto her thighs spreading her legs.","The video begins with a close-up of a woman. The video then jumpcuts to the same woman now having sex in missionary position. She is lying on her back on a bed with a patterned bed spread and pillow with her legs spread with her knees to her chest. A mans large penis is visible entering her vagina from below. The man is positioned kneeling between her legs infront of her thrusting his penis into her vagina. Throughout the scene, she appears to be experiencing pleasure, often with her mouth open or eyes closed as she lies back. Her hands hold onto her thighs spreading her legs.","The video begins with a close-up of a woman.The video then jumpcuts to the same woman having sex in missionary position on the edge of a bed with a mans erect penis is in her vagina she is shown experiencing various stages of sexual pleasure, with her facial expressions changing from contentment to intense enjoyment as the act continues.she looks at the camera throughout the video."]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}a.addEventListener("change",()=>{let l=o.querySelector('textarea[name="prompt"]');a.value&&l&&(l.value=a.value,l.dispatchEvent(new Event("input",{bubbles:!0})),a.value="")}),i.append(a)};new MutationObserver(s).observe(o,{childList:!0,subtree:!0}),s()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()})();(()=>{let t=Symbol.for("app.loraTouch.v1");if(document[t])return;document[t]=!0;let e=null;function o(i){let{slider:a,offset:n}=e,l=a.getBoundingClientRect(),d=12,_=Number(a.min||0),r=Number(a.max||100),f=Number(a.step)||1,y=Math.max(0,Math.min(1,(i.clientX-n-l.left-d)/Math.max(1,l.width-d*2))),L=Math.min(r,Math.max(_,_+Math.round(y*(r-_)/f)*f)),k=Number(L.toFixed(8));a.valueAsNumber!==k&&(a.value=String(k),a.dispatchEvent(new Event("input",{bubbles:!0})))}document.addEventListener("pointerdown",i=>{if(e||!i.isPrimary||!["touch","pen"].includes(i.pointerType))return;let a=i.target instanceof Element?i.target.closest('input[type="range"][data-lora-slider]'):null;if(!a||a.disabled)return;let n=a.getBoundingClientRect(),l=Number(a.min||0),d=Number(a.max||100),_=n.left+12+(a.valueAsNumber-l)/(d-l)*(n.width-24);e={slider:a,id:i.pointerId,offset:Math.abs(i.clientX-_)<=12?i.clientX-_:0},i.preventDefault(),a.focus({preventScroll:!0}),a.setPointerCapture(i.pointerId),o(i)},{capture:!0,passive:!1}),document.addEventListener("pointermove",i=>{!e||i.pointerId!==e.id||(i.preventDefault(),o(i))},{capture:!0,passive:!1});function s(i){if(!e||i.pointerId!==e.id)return;let{slider:a,id:n}=e;i.type==="pointerup"&&(i.preventDefault(),o(i)),e=null,a.hasPointerCapture(n)&&a.releasePointerCapture(n),a.dispatchEvent(new Event("change",{bubbles:!0}))}document.addEventListener("pointerup",s,{capture:!0,passive:!1}),document.addEventListener("pointercancel",s,!0),document.addEventListener("lostpointercapture",s,!0)})();var De=["cream","cream2","mllti","fella","moving"],mt={cream:"zamen1",cream2:"zamen2",mllti:"dynamic move",moving:"dynamic move2",fella:"fella"},_t=["cream","cream2","mllti","moving","fella"],Ve=()=>Object.fromEntries(De.map(t=>[t,0]));function Pe(t,e){let o=De.filter(l=>{let d=e[l];if(!Number.isFinite(d)||d<0||d>2)throw new Error("LoRA strength must be between 0 and 2: "+l);return d!==0});if(!o.length)return;let s=Object.entries(t).filter(([,l])=>l.class_type==="CheckpointLoaderSimple");if(s.length!==1)throw new Error("Expected one VIDEO checkpoint loader");let i=s[0][0],a=Object.values(t).flatMap(l=>Object.entries(l.inputs).filter(([,d])=>Array.isArray(d)&&d[0]===i&&d[1]===0).map(([d])=>({node:l,key:d})));if(!a.length)throw new Error("VIDEO checkpoint model has no consumers");let n=[i,0];for(let l of o){let d="video_user_lora_"+l;if(t[d])throw new Error("LoRA node already exists: "+d);t[d]={class_type:"LoraLoaderModelOnly",inputs:{model:n,lora_name:l+".safetensors",strength_model:e[l]},_meta:{title:l}},n=[d,0]}for(let{node:l,key:d}of a)l.inputs[d]=n}function se(t,e=_t,o=mt){let s=document.createElement("fieldset");s.className="video-loras",s.id="video-loras";let i=document.createElement("legend");i.textContent="LoRA",s.append(i);let a=[],n=document.createElement("p");n.className="hint",n.textContent="0 = \u7121\u52B9 / 1 = \u6A19\u6E96\u306E\u5F37\u3055\u3002LoRA\u306F\u5358\u4F53\u3067\u306E\u4F7F\u7528\u3092\u63A8\u5968\u3057\u307E\u3059\u3002",s.append(n);for(let d of e){let _=document.createElement("div");_.className="video-lora-control";let r=document.createElement("label");r.htmlFor="lora-"+d,r.textContent=o[d];let f=document.createElement("input");f.type="range",f.setAttribute("aria-label",o[d]+" LoRA \u5F37\u3055"),f.dataset.loraSlider=d;let y=document.createElement("input");y.type="number",y.id="lora-"+d,y.name="lora_"+d,y.required=!0,y.setAttribute("aria-label",o[d]+" LoRA \u5F37\u3055\uFF08\u6570\u5024\uFF09");for(let k of[f,y])k.min="0",k.max="2",k.step="0.05",k.value=String(t[d]);y.inputMode="decimal";let L=k=>{t[d]=k,y.value=String(k),f.value=String(k),f.style.setProperty("--lora-fill",String(k/2*100)+"%")};f.addEventListener("input",()=>L(f.valueAsNumber)),y.addEventListener("input",()=>{y.validity.valid&&L(y.valueAsNumber)}),a.push(()=>L(0)),L(t[d]),_.append(r,y,f),s.append(_)}let l=document.createElement("button");return l.type="button",l.textContent="\u3059\u3079\u3066\u7121\u52B9\u306B\u3059\u308B",l.addEventListener("click",()=>{for(let d of a)d()}),s.append(l),s}var ge=["a","b","c","d","e","f","g","h","i","j"],Re=()=>Object.fromEntries(ge.map(t=>[t,0]));function Be(t,e){let o=document.createElement("details");o.className="wan-lora-settings";let s=document.createElement("summary");s.textContent="LoRA \u8A2D\u5B9A",o.append(s,se(t,ge,{a:"Multi Motion",b:"PaiPai",c:"Seijyo",d:"Kijyo",e:"Gansha",f:"Tekoki",g:"Fella",h:"Back",i:"Side",j:"Seisui"}));let i=o.querySelector("#lora-b").closest(".video-lora-control"),a=document.createElement("select");a.className="lora-prompt-presets",a.setAttribute("aria-label","PaiPai \u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u7F6E\u63DB\uFF09");let n=document.createElement("option");n.value="",n.textContent="\u304A\u3059\u3059\u3081\u30D7\u30ED\u30F3\u30D7\u30C8\uFF08\u9078\u3076\u3068\u7F6E\u63DB\uFF09",a.append(n);for(let l of["The video begins with a close up of a woman. The video then jumpcuts to the same woman now lying down on a tiled floor of the the same location with her breasts positioned around the mans erect penis as he thrusts his penis up and down in a titjob motion sliding it between her breasts. she makes various facial expressions during the video she looks like she is talking and has her eyes wide open with a crazy expression.","The video begins with a close up of a woman. The video then jumpcuts to the same woman kneeling in the same location with her breasts positioned around the mans erect penis as she moves them up and down in a sliding motion. she makes various facial expressions she looks like she is talking and has her eyes wide open with a crazy expression."]){let d=document.createElement("option");d.value=l,d.textContent=l,a.append(d)}return a.addEventListener("change",()=>{a.value&&(e(a.value),a.value="")}),i.append(a),o}function Ue(t,e){let o=ge.filter(s=>{let i=e[s];if(!Number.isFinite(i)||i<0||i>2)throw new Error("LoRA strength must be between 0 and 2: "+s);return i!==0});if(o.length){for(let[s,i,a]of[["high","101","104"],["low","102","103"]]){if(t[i]?.class_type!=="LoraLoaderModelOnly"||t[a]?.class_type!=="ModelSamplingSD3"||JSON.stringify(t[a].inputs.model)!==JSON.stringify([i,0]))throw new Error("Unexpected Video Karma "+s+" model chain");for(let n of o)if(t["wan_user_lora_"+n+"_"+s])throw new Error("Duplicate Video Karma LoRA node")}if(o.some(s=>s!=="a")){if(t[86]?.class_type!=="KSamplerAdvanced"||t[85]?.class_type!=="KSamplerAdvanced")throw new Error("Unexpected Video Karma sampler pair");Object.assign(t[86].inputs,{steps:4,start_at_step:0,end_at_step:1}),Object.assign(t[85].inputs,{steps:4,start_at_step:1,end_at_step:4}),t[104].inputs.shift=2,t[103].inputs.shift=2}for(let[s,i,a]of[["high","101","104"],["low","102","103"]]){let n=[i,0];for(let l of o){let d="wan_user_lora_"+l+"_"+s;t[d]={class_type:"LoraLoaderModelOnly",inputs:{model:n,lora_name:l+"-"+s+".safetensors",strength_model:e[l]},_meta:{title:l+" "+s}},n=[d,0]}t[a].inputs.model=n}}}function We(t,e){return t==="video-flow"&&/^(i2v|t2v)/.test(e)?64:["video-flow","video-fusion","image-edit-super","image-studio"].includes(t)?32:t==="image-canvas"?64:16}function ne(t,e){return t.startsWith("image-")||t==="media-enhance"&&e==="image"?1024:768}function ze(t,e,o=!1){return o?256:t==="video-flow"&&/^(i2v|t2v)/.test(e)?128:64}function Ke(t,e,o=768,s=64){if(!Number.isFinite(t.width)||!Number.isFinite(t.height)||t.width<=0||t.height<=0)throw Error("\u7D20\u6750\u306E\u30B5\u30A4\u30BA\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3002");let i=Math.min(1,o/Math.max(t.width,t.height)),a=Math.round(t.width*i/e)*e,n=Math.round(t.height*i/e)*e;if(Math.min(a,n)0&&!e[o]&&(e[o]=n)}}return{width:e.width||768,height:e.height||768}}function ee(t,e){for(let o of Object.values(t))for(let s of["width","height"]){for(let i of[s,"custom_"+s,"resize_type."+s])typeof o.inputs[i]=="number"&&(o.inputs[i]=e[s]);if(new RegExp("(?:^|\\s)"+s+"(?:$|\\s)","i").test(o._meta?.title||"")&&(/^Primitive(?:Int|Float)$/.test(o.class_type)&&typeof o.inputs.value=="number"&&(o.inputs.value=e[s]),o.class_type==="mxSlider"))for(let i of["Xi","Xf"])typeof o.inputs[i]=="number"&&(o.inputs[i]=e[s])}}function He(t,e,o){for(let s of new Set(e.map(i=>i[0]))){if(!/loadimage/i.test(t[s]?.class_type||""))continue;let i="input_size_"+s;for(;t[i];)i+="_";for(let a of Object.values(t))for(let[n,l]of Object.entries(a.inputs))Array.isArray(l)&&String(l[0])===s&&l[1]===0&&(a.inputs[n]=[i,0]);t[i]={class_type:"ImageScale",inputs:{image:[s,0],upscale_method:"lanczos",width:o.width,height:o.height,crop:"disabled"}}}}async function Xe(t,e,o){if(e==="audio")return null;let s=URL.createObjectURL(t);try{return await new Promise((i,a)=>{let n=document.createElement(e==="image"?"img":"video"),l=setTimeout(()=>d(new Error("\u7D20\u6750\u306E\u30B5\u30A4\u30BA\u78BA\u8A8D\u304C\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\u3002")),15e3);function d(_){clearTimeout(l),n.onerror=null,!_&&o!==void 0&&n instanceof HTMLVideoElement&&(!Number.isFinite(n.duration)||n.duration<=0?_=new Error("\u7D20\u6750\u52D5\u753B\u306E\u9577\u3055\u3092\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3002"):n.duration>o&&(_=new Error("\u7D20\u6750\u52D5\u753B\u306F10\u79D2\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002")));let r=n instanceof HTMLImageElement?n.naturalWidth:n.videoWidth,f=n instanceof HTMLImageElement?n.naturalHeight:n.videoHeight;n instanceof HTMLVideoElement?(n.onloadedmetadata=null,n.removeAttribute("src"),n.load()):n.onload=null,_?a(_):r&&f?i({width:r,height:f}):a(new Error("\u7D20\u6750\u306E\u30B5\u30A4\u30BA\u3092\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3002"))}n.onerror=()=>d(new Error("\u3053\u306E\u7D20\u6750\u306E\u30B5\u30A4\u30BA\u3092\u30D6\u30E9\u30A6\u30B6\u3067\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3002\u5225\u306E\u753B\u50CF\u30FB\u52D5\u753B\u5F62\u5F0F\u3067\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002")),n instanceof HTMLImageElement?n.onload=()=>d():(n.preload="metadata",n.onloadedmetadata=()=>d()),n.src=s})}finally{URL.revokeObjectURL(s)}}var Ae=(t,e)=>{let o=Object.entries(t).filter(([,n])=>e[n.class_type]?.output_node===!0).map(([n])=>n);if(!o.length)return 0;let s=new Set,i=[...o];for(;i.length;){let n=i.pop();if(s.has(n))continue;let l=t[n];if(l){s.add(n);for(let d of Object.values(l.inputs))Array.isArray(d)&&d.length===2&&i.push(String(d[0]))}}let a=0;for(let n of Object.keys(t))s.has(n)||(delete t[n],a+=1);return a};var Je=t=>{let e=t.class_type.toLowerCase(),o=Object.keys(t.inputs).map(i=>i.toLowerCase()),s=(t._meta?.title??"").toLowerCase();return e.includes("lora")||/lora|turbo|4\s*steps?/.test(s)?"lora":e.includes("loadimage")||e.includes("loadvideo")?"input":e.includes("loader")||o.some(i=>["ckpt_name","unet_name","model_name","vae_name","clip_name"].includes(i))?"model":e.includes("textencode")||o.some(i=>["text","prompt","positive","negative"].includes(i))||typeof t.inputs.value=="string"&&(e.includes("primitivestring")||e.includes("stringmultiline")||e.includes("multilinestring")||/prompt|text \(multiline\)|プロンプト/.test(s))&&!/replace|regex|concatenate|combine/.test(e)?"prompt":e.includes("sampler")||/steps?|cfg|seed/.test(s)||o.some(i=>["steps","cfg","sampler_name","scheduler","seed","noise_seed"].includes(i))?"sampling":/fps|frame rate|frames?|duration|seconds?|width|height|size|length/.test(s)||o.some(i=>["width","target_width","output_width","height","target_height","output_height","length","duration","duration_seconds","seconds","num_frames","video_frames","frame_count","frames","fps","frame_rate"].includes(i))?"size":e.includes("save")||e.includes("preview")||e.includes("combine")?"output":"advanced"};var je=t=>{let e=t.toLowerCase().replace(/[^a-z0-9]+/g,"_");return/(?:^|_)negative(?:_|$)/.test(e)||e==="neg"?"negative":/(?:^|_)positive(?:_|$)/.test(e)||e==="pos"?"positive":null},Ye=t=>{let e={},o=(i,a)=>{let n=e[i];e[i]=n&&n!==a?"both":a},s=(i,a,n)=>{if(n.has(i))return;n.add(i);let l=t[i];if(!l)return;Je(l)==="prompt"&&o(i,a);let d=Object.entries(l.inputs).filter(([r,f])=>je(r)===a&&Array.isArray(f)&&f.length===2),_=d.length?d.map(([,r])=>r):Object.values(l.inputs);for(let r of _)Array.isArray(r)&&r.length===2&&s(String(r[0]),a,n)};for(let i of Object.values(t))for(let[a,n]of Object.entries(i.inputs)){let l=je(a);!l||!Array.isArray(n)||n.length!==2||s(String(n[0]),l,new Set)}for(let[i,a]of Object.entries(t)){if(e[i]||Je(a)!=="prompt")continue;let n=(a._meta?.title??"").toLowerCase();/negative|ネガティブ|除外/.test(n)?o(i,"negative"):/positive|ポジティブ|肯定/.test(n)&&o(i,"positive")}return e};var te=t=>typeof t=="number"&&Number.isFinite(t),ae=(t,e)=>t[e.id]?.inputs[e.key],K=(t,e,o)=>{for(let s of e)t[s.id].inputs[s.key]=o},Qe=t=>t._meta?.title||"";function Ze(t,e,o){let s=document.createElement("section");s.className="panel basic-controls";let i=document.createElement("div");i.className="basic-prompts";let a=document.createElement("div");a.className="fields",s.append(i,a);let n=Object.entries(t),l=()=>s.dispatchEvent(new CustomEvent("workflowchange",{bubbles:!0}));function d(u,c,m,p={}){let h=document.createElement("label");h.className="field";let A=document.createElement("span");A.textContent=u,h.append(A);let x=p.multiline?document.createElement("textarea"):document.createElement("input");return x instanceof HTMLTextAreaElement?x.rows=3:(x.type="number",p.min!==void 0&&(x.min=String(p.min)),p.max!==void 0&&(x.max=String(p.max)),x.step=String(p.step??1)),x.value=String(c),p.name&&(x.name=p.name),p.ref&&(x.dataset.node=p.ref.id,x.dataset.input=p.ref.key),x.addEventListener("input",()=>{if(x instanceof HTMLInputElement){if(x.value===""||!x.validity.valid)return;let C=Number(x.value);if(!Number.isFinite(C))return;m(C)}else m(x.value);l()}),h.append(x),(p.container||(p.multiline?i:a)).append(h),x}let _=Ye(t),r=new Map;for(let[u,c]of n)if(!(_[u]==="negative"||/negative|ネガティブ|除外/i.test(Qe(c))))for(let[m,p]of Object.entries(c.inputs)){if(typeof p!="string"||!(/^(text|prompt)$/.test(m)||m==="value"&&/PrimitiveString|StringMultiline|MultilineString/.test(c.class_type))||o.angleControls?.node===u&&o.angleControls.key===m||!p.trim()&&_[u]!=="positive")continue;let h=r.get(p)||{refs:[],value:p};h.refs.push({id:u,key:m}),r.set(p,h)}let k=0;for(let u of r.values()){if(e.id==="image-edit-super"&&o.id==="pose")continue;k++;let c=e.id==="sound-sync"?"\u97F3\u306E\u5185\u5BB9":e.id==="dialogue"?"\u52D5\u753B\u306E\u5185\u5BB9":r.size>1?"\u30D7\u30ED\u30F3\u30D7\u30C8 "+k:"\u30D7\u30ED\u30F3\u30D7\u30C8",m=e.id==="dialogue"&&u.value.match(/^; she says: [^\n]*\n*/)?.[0]||"",p=d(c,m?u.value.slice(m.length):u.value,h=>K(t,u.refs,m+h),{multiline:!0,ref:u.refs[0],name:"prompt"+(k>1?"_"+k:"")});e.id==="video-flow"&&(p.placeholder="\u5973\u6027\u304C\u30B3\u30C3\u30D7\u3092\u624B\u306B\u53D6\u3063\u3066\u98F2\u3080"),e.id==="image-edit-prime"&&(p.placeholder="\u5973\u6027\u304C\u7B11\u3046")}if(["video-karma","video-flow","video-extend"].includes(e.id)){let u=new Map;for(let[m,p]of n)if(!(_[m]!=="negative"&&!/negative|ネガティブ|除外/i.test(Qe(p))))for(let[h,A]of Object.entries(p.inputs)){if(typeof A!="string"||!(/^(text|prompt)$/.test(h)||h==="value"&&/PrimitiveString|StringMultiline|MultilineString/.test(p.class_type)))continue;let x=u.get(A)||{refs:[],value:A};x.refs.push({id:m,key:h}),u.set(A,x)}let c=0;for(let m of u.values())c++,d("\u30CD\u30AC\u30C6\u30A3\u30D6\u30D7\u30ED\u30F3\u30D7\u30C8"+(u.size>1?" "+c:""),m.value,h=>K(t,m.refs,h),{multiline:!0,ref:m.refs[0],name:"negative_prompt"+(c>1?"_"+c:"")}).setAttribute("placeholder","\u907F\u3051\u305F\u3044\u5185\u5BB9\u3092\u5165\u529B\uFF08\u4EFB\u610F\uFF09")}let N=(u,c,m)=>{let p=t[u]?.inputs[c];return te(p)?p:m},w=(u,c,m)=>{te(t[u]?.inputs[c])&&(t[u].inputs[c]=m)};function g(){return n.flatMap(([u,c])=>Object.entries(c.inputs).filter(([m,p])=>te(p)&&(m==="length"&&/LatentVideo|ImageToVideo|BerniniConditioning/.test(c.class_type)||m==="frames_number"||m==="frame_load_cap"&&p>0)).map(([m])=>({id:u,key:m})))}let Q;function H(u,c,m,p=.25,h,A={}){Q=d(u,c,m,{name:"seconds",min:A.min??p,max:A.max??30,step:p,ref:h})}let Z=N("24","frame_rate",20),rt=Math.max(1,N("26","multiplier",2)),fe=5;function Ce(){let u=Z/rt,c=Math.max(5,Math.round(fe*u/4)*4+1);w("24","frame_rate",Z),K(t,g(),c);for(let[,m]of n)/^VHS_LoadVideo/.test(m.class_type)&&typeof m.inputs.force_rate=="number"&&(m.inputs.force_rate=u)}if(e.id==="video-extend"){let u=document.createElement("label");u.className="field bernini-fps-control";let c=document.createElement("span");c.textContent="FPS\uFF08\u51FA\u529B\uFF09";let m=document.createElement("output");m.textContent=String(Z);let p=document.createElement("input");p.type="range",p.name="fps",p.id="bernini-fps",p.min="1",p.max="24",p.step="1",p.value=String(Z),p.style.cssText="width:100%;min-height:44px;touch-action:pan-y",p.setAttribute("aria-valuetext",Z+" FPS"),p.addEventListener("input",()=>{let h=Number(p.value);!Number.isInteger(h)||h<1||h>24||(Z=h,m.textContent=String(h),p.setAttribute("aria-valuetext",h+" FPS"),Ce(),l())}),u.append(c,m,p),a.append(u)}if(!o.continuation)if(e.id==="video-karma"){let u=g(),c=N("94","fps",16),m=u.length?Number(ae(t,u[0])):81,p=Number(((m-1)/c).toFixed(2)),h=10,A=n.flatMap(([B,J])=>Object.entries(J.inputs).filter(([j,z])=>/^(fps|frame_rate)$/.test(j)&&te(z)).map(([j])=>({id:B,key:j}))),x=B=>{let J=Math.max(5,Math.round(B*h/4)*4+1);K(t,u,J)};H("\u79D2\u6570",p,x,.25,u[0]);let C=document.createElement("label");C.className="field karma-fps-control";let O=document.createElement("span");O.textContent="FPS";let E=document.createElement("output");E.textContent=String(h);let S=document.createElement("input");S.type="range",S.name="fps",S.id="karma-fps",S.min="1",S.max="24",S.step="1",S.value=String(h),S.dataset.loraSlider="",E.htmlFor=S.id;let X=()=>{h=Number(S.value),E.textContent=String(h),S.setAttribute("aria-valuetext",h+" FPS"),K(t,A,h),x(Number(Q.value)),l()};S.addEventListener("input",X),C.append(O,E,S),a.append(C),X()}else if(e.id==="video-flow"&&/^(i2v|t2v)/.test(o.id)){let u=N("300","value",24);H("\u79D2\u6570",N("301","value",5),c=>{w("301","value",c)},1,{id:"301",key:"value"})}else if(e.id==="video-flow"){let u=o.id==="crossview",c=u?N("616","value",24):N("133","frame_rate",24),m=g(),p=u?N("614","value",121):N("113","length",121);H("\u79D2\u6570",u?N("615","value",5):Number(((p-1)/c).toFixed(2)),h=>{let A=Math.max(9,Math.round(h*c/8)*8+1);K(t,m,A),u?(w("614","value",A),w("615","value",h)):(w("116","video_end_time",h),w("116","audio_end_time",h))},1,u?{id:"615",key:"value"}:{id:"113",key:"length"})}else if(e.id==="dialogue"){let u=N("542","value",24);H("\u52D5\u753B\u306E\u79D2\u6570",N("796","Xi",144)/u,c=>{let m=Math.max(8,Math.round(c*u/8)*8);w("796","Xi",m),w("796","Xf",m),w("535","frames_number",m+1)},1,{id:"796",key:"Xi"})}else if(e.id==="video-fusion")if(t[21]?.class_type==="MiniMaxH3Easy")H("\u79D2\u6570",N("21","seconds",5),u=>w("21","seconds",u),1,{id:"21",key:"seconds"},{min:1,max:20});else{let u=N("132","fps",24),c=N("133","length",124);H("\u79D2\u6570",Math.round(c/u*2)/2,m=>w("133","length",Math.max(5,Math.ceil((m*u-5)/17)*17+5)),.5,{id:"133",key:"length"})}else e.id==="video-extend"?H("\u79D2\u6570",fe,u=>{fe=u,Ce()},.1,{id:"20",key:"length"}):e.id==="sound-sync"&&H("\u97F3\u58F0\u306E\u79D2\u6570",N("92","duration",5),u=>w("92","duration",u),.5,{id:"92",key:"duration"});if(e.id==="motion-smooth"){let u=n.find(([,c])=>c.class_type==="FrameInterpolate");if(u){let[c,m]=u,p=Number(m.inputs.multiplier)||2,h=n.find(([,x])=>x.class_type==="VHS_VideoCombine"),A=h&&te(h[1].inputs.frame_rate)?h[1].inputs.frame_rate/p:void 0;d("\u306A\u3081\u3089\u304B\u3055\uFF08\u500D\uFF09",p,x=>{m.inputs.multiplier=x,h&&A!==void 0&&(h[1].inputs.frame_rate=A*x)},{name:"interpolation",ref:{id:c,key:"multiplier"},min:2,max:8,step:1})}}return s.hidden=!i.children.length&&!a.children.length,s}var $e={"CLIPSave":{"output_node":true},"CheckpointPerturbWeights":{"output_node":true},"CheckpointSave":{"output_node":true},"ConsoleDebug+":{"output_node":true},"CreateBoundingBoxes":{"output_node":true},"DebugTensorShape+":{"output_node":true},"DecodeAndSaveVideo":{"output_node":true},"Display Any (rgthree)":{"output_node":true},"Display Int (rgthree)":{"output_node":true},"DisplayAny":{"output_node":true},"DummyOut":{"output_node":true},"FastPreview":{"output_node":true},"FastPreviewBatch":{"output_node":true},"HDRPreviewKJ":{"output_node":true},"IPAdapterSaveEmbeds":{"output_node":true},"Image Comparer (rgthree)":{"output_node":true},"ImageAndMaskPreview":{"output_node":true},"ImageCompare":{"output_node":true},"ImageCompositor":{"output_node":true},"ImageOnlyCheckpointSave":{"output_node":true},"ImagePreviewFromLatent+":{"output_node":true},"LTXVGemmaEnhancePrompt":{"output_node":true},"LTXVHDRDecodePostprocess":{"output_node":true},"LTXVSaveConditioning":{"output_node":true},"LTXVSparseTrackEditor":{"output_node":true},"LoraExtractKJ":{"output_node":true},"LoraReduceRankKJ":{"output_node":true},"LoraSave":{"output_node":true},"LossGraphNode":{"output_node":true},"MaskPreview":{"output_node":true},"MaskPreview+":{"output_node":true},"ModelSave":{"output_node":true},"ModelSaveKJ":{"output_node":true},"PlaySoundKJ":{"output_node":true},"Preview3D":{"output_node":true},"Preview3DAdvanced":{"output_node":true},"PreviewAnimation":{"output_node":true},"PreviewAny":{"output_node":true},"PreviewAudio":{"output_node":true},"PreviewGaussianSplat":{"output_node":true},"PreviewImage":{"output_node":true},"PreviewImageOrMask":{"output_node":true},"PreviewPointCloud":{"output_node":true},"SAM3_TrackPreview":{"output_node":true},"Save3DAdvanced":{"output_node":true},"SaveAnimatedPNG":{"output_node":true},"SaveAnimatedWEBP":{"output_node":true},"SaveAudio":{"output_node":true},"SaveAudioAdvanced":{"output_node":true},"SaveAudioMP3":{"output_node":true},"SaveAudioOpus":{"output_node":true},"SaveCondition_EditUtils":{"output_node":true},"SaveGLB":{"output_node":true},"SaveGaussianSplat":{"output_node":true},"SaveImage":{"output_node":true},"SaveImageAdvanced":{"output_node":true},"SaveImageDataSetToFolder":{"output_node":true},"SaveImageKJ":{"output_node":true},"SaveImageTextDataSetToFolder":{"output_node":true},"SaveImageWebsocket":{"output_node":true},"SaveImageWithAlpha":{"output_node":true},"SaveLatent":{"output_node":true},"SaveLoRA":{"output_node":true},"SavePointCloud":{"output_node":true},"SavePoseKpsAsJsonFile":{"output_node":true},"SaveSVGNode":{"output_node":true},"SaveStringKJ":{"output_node":true},"SaveText":{"output_node":true},"SaveTrainingDataset":{"output_node":true},"SaveVideo":{"output_node":true},"SaveWEBM":{"output_node":true},"SeparateMasks":{"output_node":true},"VAESave":{"output_node":true},"VHS_PruneOutputs":{"output_node":true},"VHS_VideoCombine":{"output_node":true},"VisualizeCUDAMemoryHistory":{"output_node":true},"KSampler":{"input":{"required":{"sampler_name":[["euler","euler_cfg_pp","euler_ancestral","euler_ancestral_cfg_pp","heun","heunpp2","exp_heun_2_x0","exp_heun_2_x0_sde","dpm_2","dpm_2_ancestral","lms","dpm_fast","dpm_adaptive","dpmpp_2s_ancestral","dpmpp_2s_ancestral_cfg_pp","dpmpp_sde","dpmpp_sde_gpu","dpmpp_2m","dpmpp_2m_cfg_pp","dpmpp_2m_sde","dpmpp_2m_sde_gpu","dpmpp_2m_sde_heun","dpmpp_2m_sde_heun_gpu","dpmpp_3m_sde","dpmpp_3m_sde_gpu","ddpm","lcm","ipndm","ipndm_v","deis","res_multistep","res_multistep_cfg_pp","res_multistep_ancestral","res_multistep_ancestral_cfg_pp","gradient_estimation","gradient_estimation_cfg_pp","er_sde","seeds_2","seeds_3","sa_solver","sa_solver_pece","ddim","uni_pc","uni_pc_bh2"],{"tooltip":"The algorithm used when sampling, this can affect the quality, speed, and style of the generated output."}],"scheduler":[["simple","sgm_uniform","karras","exponential","ddim_uniform","beta","normal","linear_quadratic","kl_optimal"],{"tooltip":"The scheduler controls how noise is gradually removed to form the image."}]}}}};var I=JSON.parse(document.querySelector("#app-config").textContent),xe=$e,T=t=>document.querySelector(t),de=t=>structuredClone(t),M=I.modes[0],U=de(M?.workflow||{}),et=Ve(),tt=Re(),V=new Map,ue=[],Te="",re=1,pe=768;function at(){return ne(I.id,M.id)===768?pe:1024}function be(){if(I.id==="image-canvas")return ye(U);let t=ye(M.workflow),e=ne(I.id,M.id)===768&&pe===1024?1024/Math.max(t.width,t.height):1;return nt({width:t.width*e,height:t.height*e})}var F=(t,e,o)=>{let s=document.createElement(t);return s.textContent=e,o&&(s.className=o),s};function W(t,e=!1){T("#ui-status").textContent=t,T("#ui-status").classList.toggle("error",e)}function ie(t,e,o,s={}){let i=document.createElement("label");i.className="field",i.append(F("span",t));let a;if(s.choices){a=document.createElement("select");for(let n of[...new Set([String(e),...s.choices])]){let l=document.createElement("option");l.value=n,l.textContent=n,a.append(l)}}else s.rows?(a=document.createElement("textarea"),a.rows=s.rows):(a=document.createElement("input"),a.type=typeof e=="boolean"?"checkbox":s.type||(typeof e=="number"?"number":"text"));return a instanceof HTMLInputElement&&a.type==="checkbox"?(a.checked=!!e,i.classList.add("check-field")):a.value=String(e),a instanceof HTMLInputElement&&(s.min!==void 0&&(a.min=String(s.min)),s.max!==void 0&&(a.max=String(s.max)),s.step!==void 0?a.step=String(s.step):typeof e=="number"&&(a.step="any")),a.addEventListener("input",()=>{let n=a instanceof HTMLInputElement&&a.type==="checkbox"?a.checked:typeof e=="number"?Number(a.value):a.value;o(n)}),i.append(a),s.help&&i.append(F("small",s.help)),{wrapper:i,field:a}}var ft=t=>"upload-"+crypto.randomUUID()+"."+(t.name.split(".").pop()?.toLowerCase().replace(/[^a-z0-9]/g,"").slice(0,8)||"bin"),Ie=t=>/loadaudio/i.test(t.class_type)?"audio":/loadvideo/i.test(t.class_type)?"video":/loadimage/i.test(t.class_type)?"image":null,ve=t=>Object.keys(t.inputs).find(e=>/^(image|video|audio|file|path|filename|audiofile|audiopath)$/i.test(e)&&typeof t.inputs[e]=="string");function me(t,e,o,s,i=!0,a=!1){let n=e==="video"&&(I.id==="video-extend"||o==="continuation-source"||I.id==="video-flow"&&M?.id==="crossview"),l=document.createElement("div");l.className="media-card",l.append(F("strong",t));let d=document.createElement("input");d.type="file",d.accept=e+"/*",d.multiple=a,d.dataset.upload=o,d.setAttribute("aria-label",t);let _=document.createElement("div");_.className="media-preview";let r=F("small",i?"\u7D20\u6750\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002":"\u4EFB\u610F\u306E\u53C2\u8003\u7D20\u6750");return n&&l.append(F("small","\u7D20\u6750\u52D5\u753B\u306F10\u79D2\u4EE5\u5185\u3002")),d.onchange=()=>{d.setCustomValidity("");for(let[y,L]of V)(y===o||y.startsWith(o+"::"))&&(URL.revokeObjectURL(L.url),V.delete(y));_.replaceChildren();let f=Array.from(d.files||[]);try{if(f.length>20)throw new Error("\u53C2\u8003\u7D20\u6750\u306F20\u4EF6\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");if(f.reduce((y,L)=>y+L.size,0)>2*1024*1024*1024)throw new Error("\u5165\u529B\u7D20\u6750\u306F\u5408\u8A082 GiB\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");f.forEach((y,L)=>{if(y.size>512*1024*1024)throw new Error("\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306F512 MiB\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");let k=URL.createObjectURL(y),N=ft(y),w=Xe(y,e,n?10:void 0);w.catch(b=>{n&&V.get(o)?.file===y&&d.isConnected&&(d.setCustomValidity(b.message),r.textContent=b.message,W(b.message,!0))}),V.set(a?o+"::"+L:o,{file:y,name:N,refs:s,url:k,kind:e,dimensions:w});let g=document.createElement(e==="image"?"img":e==="audio"?"audio":"video");g.src=k,g instanceof HTMLMediaElement?(g.controls=!0,g.preload="metadata",g instanceof HTMLVideoElement&&(g.playsInline=!0)):g.alt=y.name,_.append(g)}),r.textContent=f.length?f.map(y=>y.name+" \xB7 "+(y.size/1048576).toFixed(1)+" MiB").join(", "):i?"\u7D20\u6750\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002":"\u4EFB\u610F\u306E\u53C2\u8003\u7D20\u6750",W(f.length?"\u7D20\u6750\u3092\u8AAD\u307F\u8FBC\u307F\u307E\u3057\u305F\u3002\u5B9F\u884C\u30DC\u30BF\u30F3\u3067\u958B\u59CB\u3067\u304D\u307E\u3059\u3002":"\u7D20\u6750\u3092\u89E3\u9664\u3057\u307E\u3057\u305F\u3002"),Le().catch(y=>W(y.message,!0))}catch(y){W(y.message,!0),d.value=""}},l.append(d,_,r),l}function ht(){for(let t of V.values())URL.revokeObjectURL(t.url);V.clear()}function gt(t){let e=I.modes.find(o=>o.id===t);e&&(M=e,U=de(e.workflow),ht(),st(),W("\u5165\u529B\u3092\u8A2D\u5B9A\u3057\u3001\u30B5\u30A4\u30C8\u4E0A\u306E\u300C\u751F\u6210\u3059\u308B\u300D\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044\u3002"))}function it(t){return I.task==="dialogue"&&t==="dialogue-generated.wav"||M?.continuation&&t===M.continuation.last_frame_name}function ot(t){return I.id==="image-studio"&&M.id==="reference"?Ge(t):I.id!=="image-edit-super"||M.id!=="reference"?new Set:new Set(Object.values(t).filter(e=>e.class_type==="TextEncodeQwenImageEditPlus").flatMap(e=>{let o=e.inputs.image2;return Array.isArray(o)&&t[String(o[0])]?.class_type==="LoadImage"?[String(o[0])]:[]}))}function st(){T("#workflow-form").replaceChildren(),T("#upload-list").replaceChildren();let t=new Map,e={};for(let[i,a]of Object.entries(U)){let n=Ie(a),l=ve(a);if(n&&l&&!it(a.inputs[l])){let d=n+":"+String(a.inputs[l]),_=t.get(d);if(!_){e[n]=(e[n]||0)+1;let r={image:"\u753B\u50CF",video:"\u52D5\u753B",audio:"\u97F3\u58F0"},f=a._meta?.title||"",y=I.id==="video-extend"&&n==="image"?"\u30B5\u30D6\u753B\u50CF":/reference|参考|参照/i.test(f)?"\u53C2\u8003"+r[n]:/pose|姿勢/i.test(f)?"\u59FF\u52E2\u306E\u53C2\u8003\u753B\u50CF":r[n];_={kind:n,label:I.id==="image-edit-super"&&M.id==="pose"&&n==="image"&&e[n]===2?"\u30DD\u30FC\u30BA\u53C2\u7167\u753B\u50CF":y+(e[n]>1?" "+e[n]:""),refs:[]},t.set(d,_)}_.refs.push([i,l])}}let o=ot(U);for(let[i,a]of t){let n=!a.refs.every(([l])=>o.has(l));T("#upload-list").append(me(a.label+(n?"":"\uFF08\u4EFB\u610F\uFF09"),a.kind,i,a.refs,n))}M?.continuation&&T("#upload-list").prepend(me("\u5EF6\u9577\u3059\u308B\u5143\u52D5\u753B","video","continuation-source",[])),At(),ee(U,be()),T("#workflow-form").append(Ze(U,I,M)),I.id==="image-canvas"&&T("#workflow-form").append(we(U,xe)),I.id==="video-flow"&&T("#workflow-form").append(se(et)),I.id==="video-karma"&&T("#workflow-form").append(Be(tt,i=>{let a=T('#workflow-form textarea[name="prompt"]');a.value=i,a.dispatchEvent(new Event("input",{bubbles:!0}))}));let s=F("p","\u30B5\u30A4\u30BA\u306F\u81EA\u52D5\u8ABF\u6574\uFF08\u9577\u8FBA\u6700\u5927"+at()+"px\uFF09\u3002\u7D20\u6750\u306E\u7E26\u6A2A\u6BD4\u3092\u57FA\u6E96\u306B\u3057\u307E\u3059\u3002","hint");s.id="output-size-hint",I.id==="image-canvas"&&(s.textContent="\u5E45\u30FB\u9AD8\u3055\u306F256\u301C1024px\u300164px\u5358\u4F4D\u3067\u8A2D\u5B9A\u3067\u304D\u307E\u3059\u3002"),T("#workflow-form").append(s)}function Oe(){let t=V.get("continuation-source");if(t)return t;let e=Array.from(document.querySelectorAll("[data-upload]")).flatMap(o=>{let s=V.get(o.dataset.upload);return s&&s.kind!=="audio"?[s]:[]});return e.find(o=>o.kind==="video")||e[0]}function nt(t){return Ke(t,We(I.id,M.id),at(),ze(I.id,M.id,!!M.continuation))}async function Le(){let t=Oe();if(!t)return null;let e=await t.dimensions;if(t!==Oe()||!e)return null;let o=nt(e);ee(U,o);let s=document.querySelector("#output-size-hint");return s&&(s.textContent="\u51FA\u529B\u30B5\u30A4\u30BA\uFF1A"+o.width+" \xD7 "+o.height+" px\uFF08\u7D20\u6750\u306E\u7E26\u6A2A\u6BD4\u306B\u5408\u308F\u305B\u3001\u5BFE\u5FDC\u3059\u308B\u30B5\u30A4\u30BA\u5358\u4F4D\u306B\u8ABF\u6574\uFF09"),o}function Ee(){let t=crypto.getRandomValues(new Uint32Array(2)),e=(t[0]&2097151)*4294967296+t[1];return e===re&&(e=(e+1)%Number.MAX_SAFE_INTEGER),re=e,e}async function lt(){let t=Array.from(V.values());if(t.length>20)throw new Error("\u5165\u529B\u7D20\u6750\u306F\u6700\u592720\u30D5\u30A1\u30A4\u30EB\u3067\u3059\u3002");if(t.some(e=>e.file.size>512*1024*1024))throw new Error("\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306F512 MiB\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");if(t.reduce((e,o)=>e+o.file.size,0)>2*1024*1024*1024)throw new Error("\u5165\u529B\u7D20\u6750\u306E\u5408\u8A08\u306F2 GiB\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return t.map(e=>({name:e.name,mime_type:e.file.type||yt(e.file.name),blob:e.file}))}function yt(t){let e=t.split(".").pop()?.toLowerCase();return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",wav:"audio/wav",mp3:"audio/mpeg",flac:"audio/flac",ogg:"audio/ogg"}[e||""]||"application/octet-stream"}async function dt(){let t=await Le();if(!T("#app-form").reportValidity())throw new Error("\u5165\u529B\u5185\u5BB9\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");let e=de(U);for(let d of ot(e)){let _=e[d],r=ve(_);if(r&&!V.has("image:"+_.inputs[r])){I.id==="image-studio"&&qe(e);for(let f of Object.values(e))f.class_type==="TextEncodeQwenImageEditPlus"&&Array.isArray(f.inputs.image2)&&String(f.inputs.image2[0])===d&&delete f.inputs.image2}}["image-edit-super","image-studio"].includes(I.id)&&M.id==="reference"&&Ae(e,xe);let o=new Set;for(let d of Object.values(e)){let _=ve(d);Ie(d)&&_&&!it(d.inputs[_])&&o.add(Ie(d)+":"+d.inputs[_])}for(let d of o)if(!V.has(d))throw new Error("\u5165\u529B\u7D20\u6750\u304C\u672A\u9078\u629E\u3067\u3059: "+d.split(":").slice(1).join(":"));for(let d of V.values())for(let[_,r]of d.refs)e[_]&&(e[_].inputs[r]=d.name);let s=I.id==="image-canvas"&&!Y.randomSeed?Y.seed:Ee();re=s;for(let[d,_]of Object.entries(e))for(let r of Object.keys(_.inputs))if(/^(seed|noise_seed)$/i.test(r)&&typeof _.inputs[r]=="number"){_.inputs[r]=s,U[d].inputs[r]=s;let f=document.querySelector(`[data-node="${CSS.escape(d)}"][data-input="${r}"]`);f&&(f.value=String(s))}let i=t||be();ee(e,i);let a=Oe();a?.kind==="image"&&He(e,a.refs,i),I.id==="video-flow"&&Pe(e,et),I.id==="video-karma"&&Ue(e,tt),Ae(e,xe);let n=await lt();W("\u751F\u6210\u7528\u306E\u5165\u529B\u3092\u30B5\u30A4\u30C8\u3078\u6E21\u3057\u307E\u3057\u305F\u3002");let l;if(M?.continuation){let d=V.get("continuation-source");if(!d)throw new Error("\u5EF6\u9577\u3059\u308B\u5143\u52D5\u753B\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002");l={...de(M.continuation),source_video_name:d.name};let _=e[20]?.inputs,r=e[24]?.inputs;_&&(l.width=_.width,l.height=_.height),r&&(l.fps=r.frame_rate)}return{workflow:e,files:n,...l?{continuation:l}:{}}}function At(){let t=T("#quick-controls");t.replaceChildren();let e=M?.angleControls;if(ne(I.id,M.id)===768){let o=ie("\u52D5\u753B\u306E\u89E3\u50CF\u5EA6",String(pe),()=>{},{choices:["768","1024"],help:"\u6700\u59271024\u306F\u751F\u6210\u6642\u9593\u304C\u5897\u3048\u307E\u3059\u3002"}),s=o.field;s.name="video_max_edge";for(let i of Array.from(s.options))i.textContent="\u6700\u5927"+i.value+" px";s.onchange=()=>{pe=s.value==="1024"?1024:768,Le().then(i=>{if(!i){let a=be();ee(U,a);let n=document.querySelector("#output-size-hint");n&&(n.textContent="\u51FA\u529B\u30B5\u30A4\u30BA\uFF1A"+a.width+" \xD7 "+a.height+" px")}}).catch(i=>W(i.message,!0))},t.append(o.wrapper)}if(e){let o=document.createElement("div");o.className="panel";let s={};for(let[i,a]of[["azimuth","\u5DE6\u53F3\u306E\u30A2\u30F3\u30B0\u30EB"],["elevation","\u30AB\u30E1\u30E9\u306E\u9AD8\u3055"],["distance","\u30AB\u30E1\u30E9\u306E\u8DDD\u96E2"]]){let n=e[i]||[];s[i]=n.find(_=>String(U[e.node]?.inputs[e.key]||"").includes(_.prompt))?.prompt||n[0]?.prompt||"";let l=document.createElement("label");l.className="field",l.append(F("span",a));let d=document.createElement("select");d.name=i;for(let _ of n){let r=document.createElement("option");r.value=_.prompt,r.textContent=_.label,d.append(r)}d.value=s[i],d.onchange=()=>{s[i]=d.value;let _=e.prefix+" "+Object.values(s).join(e.prefix.startsWith("crossview")?", ":" ");U[e.node].inputs[e.key]=_;let r=document.querySelector('[data-node="'+e.node+'"][data-input="'+e.key+'"]');r&&(r.value=_)},l.append(d),o.append(l)}t.append(o)}if(M?.continuation){let o=ie("\u7D50\u5408\u5F8C\u306E\u76EE\u6A19\u79D2\u6570",Number(M.continuation.target_duration_seconds)||10,i=>{M.continuation.target_duration_seconds=i},{min:1,max:120,step:.1}),s=document.createElement("div");s.className="panel",s.append(o.wrapper),t.append(s)}}function xt(){let t=document.createElement("section");t.className="panel",t.id="dialogue-controls",t.append(F("h3","\u30BB\u30EA\u30D5\u3068\u58F0"));let e={text:"\u3053\u3093\u306B\u3061\u306F\u3002\u4ECA\u65E5\u306F\u3044\u3044\u5929\u6C17\u3067\u3059\u306D\u3002",caption:"A calm, natural Japanese voice.",num_steps:60,cfg_scale_text:3,cfg_scale_caption:3,cfg_scale_speaker:10,duration_scale:1,useCaptionWithReference:!1};for(let[o,s,i]of[["text","\u30BB\u30EA\u30D5",{rows:4}],["caption","\u58F0\u306E\u8AAC\u660E",{rows:3}],["duration_scale","\u767A\u8A71\u306E\u9577\u3055\u500D\u7387",{min:.5,max:2,step:.05}]]){let a=ie(s,e[o],n=>e[o]=n,i);a.field.setAttribute("name","dialogue_"+o),t.append(a.wrapper)}return T("#quick-controls").after(t),T("#upload-list").append(me("\u58F0\u306E\u53C2\u8003\u97F3\u58F0\uFF08\u4EFB\u610F\uFF09","audio","dialogue-voice",[],!1,!0)),async()=>{if(!e.text.trim()||e.text.length>1e3)throw new Error("\u30BB\u30EA\u30D5\u306F1\u301C1000\u6587\u5B57\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");let o=await dt(),s=Array.from(V.entries()).filter(([i])=>i.startsWith("dialogue-voice")).map(([,i])=>i);if(s.reduce((i,a)=>i+a.file.size,0)>20*1024*1024)throw new Error("\u53C2\u8003\u97F3\u58F0\u306F\u5408\u8A0820 MiB\u4EE5\u5185\u3067\u3059\u3002");return o.workflow[536]&&(o.workflow[536].inputs.text=String(o.workflow[536].inputs.text).replace(/^; she says: [^\n]*/,"; she says: "+String(e.text).trim().replace(/[\"']/g,"").replace(/\s+/g," ")+".")),{...o,task:"dialogue",irodori:{...e,caption:s.length&&!e.useCaptionWithReference?"":e.caption,cfg_scale_speaker:s.length?e.cfg_scale_speaker:0,seed:re,reference_audios:s.map(i=>i.name)}}}}function Tt(){let t=T("#workflow-form");t.replaceChildren();let e={text:"\u3053\u3093\u306B\u3061\u306F\u3002\u4ECA\u65E5\u3082\u826F\u3044\u4E00\u65E5\u3092\u3002",caption:"\u843D\u3061\u7740\u3044\u305F\u81EA\u7136\u306A\u58F0",num_steps:60,cfg_scale_text:3,cfg_scale_caption:3,cfg_scale_speaker:10,speed:1,seconds:0,useCaptionWithReference:!1};for(let[o,s,i]of[["text","\u8AAD\u307F\u4E0A\u3052\u308B\u6587\u7AE0",{rows:4}],["caption","\u58F0\u306E\u8AAC\u660E",{rows:3}],["speed","\u8A71\u3059\u901F\u5EA6",{min:.5,max:2,step:.05}],["seconds","\u9577\u3055\uFF080\u306F\u81EA\u52D5\uFF09",{min:0,max:45,step:.5}]]){let a=ie(s,e[o],n=>e[o]=n,i);a.field.setAttribute("name",o),t.append(a.wrapper)}return T("#upload-list").append(me("\u53C2\u8003\u97F3\u58F0\uFF08\u4EFB\u610F\u30FB\u8907\u6570\u5BFE\u5FDC\uFF09","audio","voice",[],!1,!0)),async()=>{if(!String(e.text).trim()||String(e.text).length>1e3)throw new Error("\u8AAD\u307F\u4E0A\u3052\u308B\u6587\u7AE0\u306F1\u301C1000\u6587\u5B57\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");let o=Array.from(V.values());if(o.length>20||o.reduce((i,a)=>i+a.file.size,0)>20*1024*1024)throw new Error("\u53C2\u8003\u97F3\u58F0\u306F\u6700\u592720\u4EF6\u3001\u5408\u8A0820 MiB\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");let s=Ee();return{task:"irodori",text:e.text,caption:o.length&&!e.useCaptionWithReference?"":e.caption,num_steps:e.num_steps,cfg_scale_text:e.cfg_scale_text,cfg_scale_caption:e.cfg_scale_caption,cfg_scale_speaker:o.length?e.cfg_scale_speaker:0,duration_scale:1/e.speed,...e.seconds>0?{seconds:e.seconds}:{},seed:s,reference_audios:o.map(i=>i.name),files:await lt()}}}function It(){let t={system:"\u65E5\u672C\u8A9E\u3067\u308F\u304B\u308A\u3084\u3059\u304F\u5FDC\u7B54\u3057\u3066\u304F\u3060\u3055\u3044\u3002",message:"",max_tokens:1024,temperature:.8,top_p:.95,repetition_penalty:1.1},e=T("#workflow-form");e.replaceChildren();for(let[s,i,a]of[["message","\u30E1\u30C3\u30BB\u30FC\u30B8",{rows:4}]]){let n=ie(i,t[s],l=>t[s]=l,a);n.field.setAttribute("name",s),e.append(n.wrapper)}let o=F("button","\u4F1A\u8A71\u5C65\u6B74\u3092\u6D88\u53BB");return o.type="button",o.onclick=()=>{ue=[],T("#chat-history").replaceChildren()},e.append(o,F("div","","chat-history")),e.lastElementChild.id="chat-history",async()=>{if(!t.message.trim())throw new Error("\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");Te=t.message.trim();let s=Ee();return{task:"chat",messages:[{role:"system",content:t.system},...ue.slice(-8),{role:"user",content:Te}],max_tokens:t.max_tokens,temperature:t.temperature,top_p:t.top_p,repetition_penalty:t.repetition_penalty,seed:s,files:[]}}}function vt(t){if(t.url){let e=new URL(t.url);if(e.protocol!=="https:")throw new Error("\u51FA\u529BURL\u304C\u4E0D\u6B63\u3067\u3059\u3002");return e.href}if(t.data&&/^(image|video|audio)\//.test(t.mime_type))return"data:"+t.mime_type+";base64,"+t.data;throw new Error("\u7D50\u679C\u306B\u30E1\u30C7\u30A3\u30A2URL\u304C\u3042\u308A\u307E\u305B\u3093\u3002")}function le(t){T("#preview-loading").hidden=!t,T("#results").hidden=t,T(".output").setAttribute("aria-busy",String(t))}function Ot({output:t,error:e}){le(!1);let o=T("#results");if(o.replaceChildren(),e){o.append(F("p",e,"error")),W(e,!0);return}if(t?.text&&(o.append(F("pre",String(t.text),"text-result")),I.task==="chat")){ue.push({role:"user",content:Te},{role:"assistant",content:String(t.text)});let i=T("#chat-history");i.replaceChildren();for(let a of ue.slice(-8))i.append(F("p",(a.role==="user"?"\u3042\u306A\u305F: ":"AI: ")+a.content))}let s=Array.isArray(t?.files)?t.files:Array.isArray(t?.images)?t.images:[];for(let i of s)try{let a=vt(i),n=document.createElement("article");n.className="result-card",n.append(F("h3",i.filename||"\u751F\u6210\u7D50\u679C"));let l;i.mime_type?.startsWith("image/")?(l=document.createElement("img"),l.alt=i.filename):i.mime_type?.startsWith("video/")?(l=document.createElement("video"),l.controls=!0,l.playsInline=!0):i.mime_type?.startsWith("audio/")&&(l=document.createElement("audio"),l.controls=!0),l&&(l.src=a,n.append(l));let d=document.createElement("a");d.href=a,d.download=i.filename||"output",d.textContent="\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",d.rel="noreferrer",n.append(d),i.size&&n.append(F("small",(i.size/1048576).toFixed(2)+" MiB")),o.append(n)}catch(a){o.append(F("p",a.message,"error"))}!s.length&&!t?.text&&o.append(F("p","\u751F\u6210\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002")),W("\u751F\u6210\u7D50\u679C\u3092\u53D7\u3051\u53D6\u308A\u307E\u3057\u305F\u3002")}T("#title").textContent=I.title;T("#description").textContent=I.description;document.title=I.title+" \xB7 GPU App";var Ne=T("#mode");for(let t of I.modes){let e=document.createElement("option");e.value=t.id,e.textContent=t.label,Ne.append(e)}Ne.onchange=()=>gt(Ne.value);T(".top-panel").hidden=I.modes.length<2;T("#app-form").onsubmit=t=>t.preventDefault();I.modes.length&&st();var Nt=I.task==="irodori"?Tt():I.task==="chat"?It():I.task==="dialogue"?xt():dt;if(window.appSdk){let t=window.appSdk,e=document.createElement("dialog");e.id="app-run-confirm",e.setAttribute("aria-labelledby","app-run-confirm-title"),e.setAttribute("aria-describedby","app-run-confirm-message"),e.append(F("h2","GPU\u3067\u5B9F\u884C\u3057\u307E\u3059\u304B\uFF1F")),e.firstElementChild.id="app-run-confirm-title";let o=F("p","\u5B9F\u884C\u4E2D\u306F\u753B\u9762\u9589\u3058\u305A\u306B\u304A\u5F85\u3061\u304F\u3060\u3055\u3044");o.id="app-run-confirm-message",e.append(o);let s=document.createElement("div");s.className="app-confirm-actions";let i=document.createElement("button");i.type="button",i.textContent="\u30AD\u30E3\u30F3\u30BB\u30EB",i.autofocus=!0,i.onclick=()=>e.close();let a=document.createElement("button");a.type="button",a.id="app-run-approve",a.textContent="\u5B9F\u884C\u3059\u308B",s.append(i,a),e.append(s),document.body.append(e);let n=document.createElement("style");n.textContent="#app-run-confirm{box-sizing:border-box;width:min(440px,calc(100% - 32px));padding:24px;border:1px solid #35455d;border-radius:16px;background:#141c29;color:#eef3ff}#app-run-confirm::backdrop{background:rgba(0,0,0,.65)}#app-run-confirm h2{font-size:20px;margin:0 0 16px}#app-run-confirm p{line-height:1.7}.app-confirm-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:24px}.app-confirm-actions button{padding:12px 18px;border:1px solid #43526a;border-radius:10px;background:#263449;color:#fff;font-size:16px;cursor:pointer}#app-run-approve{background:#2865df}",document.head.append(n);let l,d=async()=>{try{if(!t.getTokenBalance)throw Error("SDK update required");let r=await t.getTokenBalance();T("#token-balance").textContent="保有: "+(r.balance+(Number(r.reservedTokens)||0))+" \u30C8\u30FC\u30AF\u30F3"+(r.reservedTokens?"\uFF08\u5B9F\u884C\u7528\u306B "+r.reservedTokens+" \u78BA\u4FDD\u4E2D\uFF09":"")}catch{T("#token-balance").textContent="\u30C8\u30FC\u30AF\u30F3\u6B8B\u9AD8\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093"}},_=(r,f=0)=>{clearTimeout(l),r.status==="settled"?(T("#token-usage").textContent="\u4ECA\u56DE\u306E\u6D88\u8CBB: "+r.consumedTokens+" \u30C8\u30FC\u30AF\u30F3",d()):(T("#token-usage").textContent="\u6D88\u8CBB\u30C8\u30FC\u30AF\u30F3\u3092\u7CBE\u7B97\u4E2D\u2026",t.getUsage&&f<20&&(l=setTimeout(()=>{t.getUsage(r.jobId).then(y=>_(y,f+1)).catch(()=>{T("#token-usage").textContent="\u7CBE\u7B97\u7D50\u679C\u3092\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3002\u518D\u8868\u793A\u3057\u3066\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"})},3e3)))};t.onUsage?.(r=>_(r)),d(),t.onGenerate(Nt),t.onResult(Ot),t.onStatus(r=>{le(["collecting","preparing_input","uploading","starting","queued","running"].includes(r.phase)),T("#app-execute").disabled=!r.canRun,a.disabled=!r.canRun,!r.canRun&&e.open&&e.close(),W(r.message,r.phase==="failed");let f=T("#transfer-progress");f.hidden=!r.progress,r.progress&&(f.max=r.progress.totalBytes||1,f.value=r.progress.bytes||0)}),T("#app-execute").onclick=()=>{e.open||e.showModal()},a.onclick=()=>{a.disabled||!e.open||(e.close(),le(!0),T("#token-usage").textContent="",t.run().catch(r=>W(r.message,!0)).finally(()=>{le(!1),d()}))}}else W("\u3053\u306Eindex.html\u306FGPU App\u304B\u3089\u958B\u304F\u3068\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002");})(); ;/* media selection removal */ (()=>{var c=new WeakMap;function u(e){if(c.has(e))return;let n=document.createElement("div");n.className="media-clear-actions",e.insertAdjacentElement("afterend",n);let t=()=>{n.replaceChildren();let r=Array.from(e.files||[]);n.hidden=r.length===0,r.forEach((s,b)=>{let d=document.createElement("div");d.className="media-clear-row";let l=document.createElement("span");l.textContent=s.name;let a=document.createElement("button");a.type="button",a.className="media-clear-button",a.textContent="\xD7",a.title="\u7D20\u6750\u3092\u89E3\u9664",a.setAttribute("aria-label",s.name+"\u3092\u89E3\u9664"),a.disabled=e.disabled,a.addEventListener("click",()=>{if(e.disabled)return;let m=Array.from(e.files||[]).filter((i,o)=>o!==b);if(m.length){let i=new DataTransfer;m.forEach(o=>i.items.add(o)),e.files=i.files}else e.value="";e.setCustomValidity(""),e.dispatchEvent(new Event("change",{bubbles:!0})),t(),(n.querySelector("button")||e).focus()}),d.append(l,a),n.append(d)})};c.set(e,t),e.addEventListener("change",()=>queueMicrotask(t)),t()}function f(){if(document.getElementById("media-clear-style"))return;let e=document.createElement("style");e.id="media-clear-style",e.textContent=".media-clear-actions{display:grid;gap:6px;min-width:0;margin-top:6px}.media-clear-actions[hidden]{display:none!important}.media-clear-row{display:flex;align-items:center;gap:8px;min-width:0}.media-clear-row>span{flex:1;min-width:0;overflow-wrap:anywhere;font-size:12px;color:var(--muted,#63776a)}button.media-clear-button{flex:none;width:36px;min-width:36px;height:36px;min-height:36px;margin:0;padding:0;display:inline-flex;align-items:center;justify-content:center;border:1px solid #bed0c4;border-radius:8px;background:#fff;color:#245b43;font:24px/1 system-ui;cursor:pointer}button.media-clear-button:hover{background:#edf4ef}button.media-clear-button:disabled{opacity:.45;cursor:default}",document.head.append(e);let n=t=>{(t instanceof Element||t instanceof Document)&&(t instanceof HTMLInputElement&&t.type==="file"&&u(t),t.querySelectorAll('input[type="file"]').forEach(u))};n(document),new MutationObserver(t=>{for(let r of t)r.type==="attributes"?c.get(r.target)?.():r.addedNodes.forEach(n)}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f,{once:!0}):f();})();