1import{C as e,S as t,_ as n,g as r,t as i,v as a,w as o,x as s,y as c}from"./dist-LbJpdy86.js";var l=class extends c{constructor(...e){super(...e),this._isRetrying=!1,this._isRegenerating=!1}static{this.styles=t` 2 :host { 3 display: block; 4 flex: 1; 5 min-width: 350px; 6 border-radius: var(--theme-radius-card); 7 padding: 1.5rem; 8 background: var(--md-sys-color-surface-container-low); 9 box-shadow: var(--theme-shadow-card); 10 border: var(--theme-border-card); 11 display: flex; 12 flex-direction: column; 13 } 14 .variation-header { 15 font-weight: 700; 16 margin-bottom: 0.5rem; 17 font-size: 1.4rem; 18 color: var(--md-sys-color-primary); 19 font-family: var(--theme-font-headline); 20 letter-spacing: -0.02em; 21 } 22 ui-audio-tag-editor { 23 display: block; 24 margin-bottom: 1rem; 25 min-height: 100px; 26 background: var(--md-sys-color-surface-container-high); 27 border-radius: var(--theme-radius-button); 28 color: var(--md-sys-color-on-surface); 29 padding: 0.5rem; 30 flex-grow: 1; 31 } 32 ui-audio-player { 33 width: 100%; 34 max-width: 100%; 35 box-sizing: border-box; 36 overflow: hidden; 37 } 38 .meta-details { 39 font-size: 0.9em; 40 margin-bottom: 1rem; 41 color: var(--md-sys-color-on-surface-variant); 42 background: var(--md-sys-color-surface-container); 43 padding: 0.75rem; 44 border-radius: var(--theme-radius-button); 45 } 46 .meta-details strong { 47 color: var(--md-sys-color-on-surface); 48 } 49 .actions { 50 display: flex; 51 flex-direction: row; 52 gap: 0.5rem; 53 align-items: center; 54 margin-top: 1rem; 55 min-width: 0; 56 width: 100%; 57 } 58 md-circular-progress { 59 --md-circular-progress-size: 24px; 60 } 61 62 @media (max-width: 600px) { 63 :host { 64 padding: 1rem; 65 min-width: 0; 66 } 67 .variation-header { 68 font-size: 1.2rem; 69 } 70 .actions { 71 flex-direction: column; 72 align-items: stretch; 73 } 74 .actions md-outlined-button, .actions md-text-button { 75 width: 100%; 76 } 77 } 78 79 md-outlined-button { 80 --md-outlined-button-container-shape: var(--theme-radius-button); 81 } 82 `}async _downloadAudio(e,t){try{let n=await(await fetch(e)).blob(),r=window.URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}catch(e){console.error(`Failed to download audio:`,e),alert(`Failed to download audio. Please try again.`)}}async _handleRetry(){this._isRetrying=!0;try{let e=await fetch(`/api/retry-audio`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({variation:this.variation,voiceActor:this.voiceActor})});e.ok?(this.variation=await e.json(),this.requestUpdate()):console.error(`Retry failed:`,await e.text())}catch(e){console.error(`Retry failed:`,e)}finally{this._isRetrying=!1}}async _handleRegenerate(){this._isRegenerating=!0;let e=this.shadowRoot?.querySelector(`ui-audio-tag-editor`),t=e?e.value:this.variation.text,n={...this.variation,text:o(t)};try{let e=await fetch(`/api/retry-audio`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({variation:n,voiceActor:this.voiceActor})});e.ok?(this.variation=await e.json(),this.requestUpdate()):console.error(`Regenerate failed:`,await e.text())}catch(e){console.error(`Regenerate failed:`,e)}finally{this._isRegenerating=!1}}render(){return this.variation?s` 83 <div class="variation-header">${this.variation.take}</div> 84 <div class="meta-details"> 85 <div><strong>Persona:</strong> ${this.variation.persona}</div> 86 <div><strong>Subtext:</strong> ${this.variation.subtext}</div> 87 <div><strong>Energy:</strong> ${this.variation.technicalEnergy}</div> 88 </div> 89 <ui-audio-tag-editor 90 .tags=${e} 91 .value=${o(this.variation.text)} 92 pillPadding="2" 93 pillOffsetY="-2" 94 ></ui-audio-tag-editor> 95 96 <div class="actions" style="width: 100%; min-width: 0;"> 97 ${this.variation.audio?s` 98 <ui-audio-player style="flex: 1; min-width: 0; width: 100%;" .item=${{id:this.variation.take,src:this.variation.audio}}></ui-audio-player> 99 `:s` 100 <p style="flex: 1; margin: 0; color: var(--md-sys-color-error);">No audio returned.</p> 101 <md-outlined-button @click=${this._handleRetry} ?disabled=${this._isRetrying}> 102 Retry Audio 103 </md-outlined-button> 104 ${this._isRetrying?s`<md-circular-progress indeterminate></md-circular-progress>`:``} 105 `} 106 </div> 107 108 <div class="actions" style="margin-top: 1rem; border-top: 1px solid var(--md-sys-color-outline-variant); padding-top: 1rem; justify-content: flex-end;"> 109 ${this.variation.audio?s`<md-text-button @click=${()=>this._downloadAudio(this.variation.audio,`take-${this.variation.take}.wav`)}>Download</md-text-button>`:``} 110 <md-outlined-button @click=${this._handleRegenerate} ?disabled=${this._isRegenerating}> 111 Regenerate Audio from Text 112 </md-outlined-button> 113 ${this._isRegenerating?s`<md-circular-progress indeterminate></md-circular-progress>`:``} 114 </div> 115 `:s``}};i([n({type:Object})],l.prototype,`variation`,void 0),i([n({type:Object})],l.prototype,`voiceActor`,void 0),i([r()],l.prototype,`_isRetrying`,void 0),i([r()],l.prototype,`_isRegenerating`,void 0),l=i([a(`variation-card`)],l);var u=[{label:`Kittens`,texts:[{text:`Our kittens are raised in a cage-free environment with 24/7 medical supervision.`},{text:`Every kitten goes home with a full starter kit, including their favorite toys and premium food.`},{text:`We believe that a happy kitten makes a happy home, which is why we focus on early socialization.`}]},{label:`Hamlet`,texts:[{text:`To be, or not to be, that is the question: Whether 'tis nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles and by opposing end them.`,attribution:`William Shakespeare`},{text:`There is nothing either good or bad, but thinking makes it so.`,attribution:`William Shakespeare`},{text:`This above all: to thine own self be true, And it must follow, as the night the day, Thou
115canst not then be false to any man.`,attribution:`William Shakespeare`}]},{label:`Wuthering Heights`,texts:[{text:`I lingered round them, under that benign sky; watched the moths fluttering among the heath and harebells, listened to the soft wind breathing through the grass, and wondered how any one could ever imagine unquiet slumbers for the sleepers in that quiet earth.`,attribution:`Emily Brontë`},{text:`He's more myself than I am. Whatever our souls are made of, his and mine are the same.`,attribution:`Emily Brontë`},{text:`If all else perished, and he remained, I should still continue to be; and if all else remained, and he were annihilated, the universe would turn to a mighty stranger.`,attribution:`Emily Brontë`},{text:`My love for Linton is like the foliage in the woods: time will change it, Iâm well aware, as winter changes the trees. My love for Heathcliff resembles the eternal rocks beneath: a source of little visible delight, but necessary. Nelly, I am Heathcliff! Heâs always, always in my mind: not as a pleasure, any more than I am always a pleasure to myself, but as my own being.`,attribution:`Emily Brontë`}]},{label:`Inspiring`,texts:[{text:`We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard. Because that goal will serve to organize and measure the best of our energies and skills.`,attribution:`John F. Kennedy`},{text:`Earth is the cradle of humanity, but one cannot live in a cradle forever. The pursuit of light and space will lead us to penetrate the bounds of the atmosphere, timidly at first, but in the end to conquer the whole of solar space.`,attribution:`Konstantin Tsiolkovsky`},{text:`We shall go to the moon, we shall go to the planets, we shall travel to the stars just as today we go from Liverpool to New York. The oceans of space will be crossed like the seas of the moon!`,attribution:`Jules Verne, From the Earth to the Moon (1865)`},{text:`Houston, Tranquility Base here. The Eagle has landed. Itâs one small step for a man, one giant leap for mankind. Looking back at the Earth, it is a magnificent desolation.`,attribution:`Neil Armstrong & Buzz Aldrin (NASA Historic Archive)`},{text:`Marvel not, my comrade, if I appear talking to you on super-terrestrial and aerial topics. The long and the short of the matter is that I am running over the order of a journey I have lately made to the moon.`,attribution:`Lucian of Samosata, 2nd Century AD (A True Story)`},{text:`We don't build for the quiet days. We build for the moments when the pressure spikes, the lights flicker, and the room goes completely silent. Because playing it safe never changed the world. We are the architects of 'what's next.' And we're just getting started.`}]}];export{u as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.