1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,686675,e=>{"use strict";var t=e.i(743265);let r=(0,e.i(478790).forwardRef)(function(e,r){return(0,t.jsxs)("svg",{ref:r,width:"24",height:"24",viewBox:"-0.83 -0.83 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"AutoRun",...e,children:[(0,t.jsx)("path",{fill:"currentColor",d:"M0.5 8.14583C0.776142 8.14583 1 8.36969 1 8.64583V9.68555C1 10.8827 1.96948 11.8522 3.16667 11.8522H5.68685C5.80302 11.8523 5.90858 11.8937 5.99349 11.9603C5.99955 11.965 6.00583 11.9696 6.01172 11.9746C6.02994 11.9903 6.0467 12.0073 6.0625 12.0254C6.06936 12.0332 6.07575 12.0413 6.08203 12.0495C6.14669 12.1337 6.18679 12.2379 6.18685 12.3522C6.18685 12.3929 6.18042 12.4322 6.17122 12.4701C6.16522 12.4953 6.15775 12.5201 6.14779 12.5443L6.14714 12.5475C6.12275 12.6057 6.08708 12.6603 6.03971 12.7077L4.5599 14.1875C4.36466 14.3827 4.04813 14.3827 3.85287 14.1875C3.65769 13.9922 3.65763 13.6757 3.85287 13.4805L4.48112 12.8522H3.16667C1.41719 12.8522 0 11.435 0 9.68555V8.64583C0 8.36969 0.223858 8.14583 0.5 8.14583Z"}),(0,t.jsx)("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M11.8333 7.40625C13.214 7.40625 14.3333 8.5255 14.3333 9.90625V11.8327C14.3333 13.2134 13.214 14.3327 11.8333 14.3327H9.9069C8.52615 14.3327 7.4069 13.2133 7.4069 11.8327V9.90625C7.4069 8.52551 8.52616 7.40625 9.9069 7.40625H11.8333ZM9.9069 8.40625C9.07845 8.40625 8.4069 9.07779 8.4069 9.90625V11.8327C8.4069 12.6611 9.07846 13.3327 9.9069 13.3327H11.8333C12.6617 13.3327 13.3333 12.6611 13.3333 11.8327V9.90625C13.3333 9.0778 12.6617 8.40625 11.8333 8.40625H9.9069Z"}),(0,t.jsx)("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M4.42643 0C5.80714 0 6.92643 1.11929 6.92643 2.5V4.42643C6.92643 5.80714 5.80714 6.92643 4.42643 6.92643H2.5C1.11929 6.92643 0 5.80714 0 4.42643V2.5C0 1.11929 1.11929 0 2.5 0H4.42643ZM2.5 1C1.67158 1 1 1.67158 1 2.5V4.42643C1 5.25486 1.67158 5.92643 2.5 5.92643H4.42643C5.25486 5.92643 5.92643 5.25486 5.92643 4.42643V2.5C5.92643 1.67158 5.25486 1 4.42643 1H2.5Z"}),(0,t.jsx)("path",{fill:"currentColor",d:"M9.77279 0.146484C9.96802 -0.0487475 10.2845 -0.0486869 10.4798 0.146484C10.675 0.341753 10.6751 0.658281 10.4798 0.853516L9.85417 1.47917H11.1667C12.9161 1.47927 14.3333 2.89642 14.3333 4.64583V5.68555C14.3333 5.96163 14.1094 6.18545 13.8333 6.18555C13.5572 6.18555 13.3333 5.96169 13.3333 5.68555V4.64583C13.3333 3.4487 12.3638 2.47927 11.1667 2.47917H8.653C8.64582 2.47926 8.63869 2.47808 8.63151 2.47786C8.61005 2.47723 8.58906 2.47526 8.56836 2.47201C8.52883 2.46577 8.48987 2.45585 8.45247 2.4401C8.448 2.43822 8.44386 2.43561 8.43945 2.43359C8.38657 2.40949 8.3365 2.37684 8.29297 2.33333C8.25393 2.29428 8.2246 2.24929 8.20117 2.20247C8.19587 2.19192 8.18881 2.18219 8.18425 2.17122C8.17014 2.13713 8.16054 2.10164 8.1543 2.06576C8.14938 2.03761 8.14649 2.00872 8.14649 1.97917C8.14649 1.94869 8.14973 1.91895 8.15495 1.88997C8.1555 1.88696 8.15565 1.88387 8.15625 1.88086C8.15946 1.86476 8.16521 1.84949 8.16992 1.83398C8.17442 1.81924 8.17771 1.80407 8.18359 1.78971C8.19126 1.771 8.2018 1.75383 8.21159 1.73633C8.23223 1.69949 8.25641 1.66388 8.28711 1.63216C8.29052 1.62863 8.29401 1.62518 8.29753 1.62174L9.77279 0.146484Z"})]})});e.s(["IconAutoRun",0,r])},275348,e=>{"use strict";var t=e.i(647163);let r=(0,t.cn)("rounded-[32px] border border-white/5 bg-background-container-page-base p-[2px]","shadow-[0px_4px_48px_rgba(0,0,0,0.45)]"),a=(0,t.cn)("text-text-icon-neutral-high-contrast","shadow-[inset_0px_1px_0px_0px_rgba(255,255,255,0.2)]","bg-[linear-gradient(-45deg,rgba(214,225,255,0.1)_0%,rgba(214,225,255,0.25)_100%)]","hover:bg-[linear-gradient(-45deg,rgba(214,225,255,0.1)_0%,rgba(214,225,255,0.45)_100%)]","active:opacity-[0.82]"),n=(0,t.cn)("flex h-[40px] cursor-pointer items-center gap-[4px] rounded-[100px] pl-[16px] pr-[12px] outline-none","text-[14px] font-medium leading-[20px] tracking-[-0.03px] text-text-icon-neutral-high-contrast","hover:bg-[linear-gradient(-17deg,rgba(214,225,255,0.1)_0%,rgba(214,225,255,0.25)_100%)]","hover:shadow-[inset_0px_1px_0px_0px_rgba(255,255,255,0.2)]","data-[state=open]:bg-[linear-gradient(-17deg,rgba(214,225,255,0.1)_0%,rgba(214,225,255,0.45)_100%)]","data-[state=open]:shadow-[inset_0px_1px_0px_0px_rgba(255,255,255,0.2)]");function i(e){return(0,t.cn)("flex size-[40px] shrink-0 items-center justify-center rounded-full transition-opacity",e?"cursor-not-allowed bg-background-neutral-ghost-hover text-text-icon-neutral-default":(0,t.cn)("cursor-pointer bg-linear-to-br from-[#FFB8E9] to-[#FF00BC]","text-text-icon-fixed-white-solid-high-contrast","shadow-[inset_0px_1px_0px_0px_rgba(255,255,255,0.45)]","hover:opacity-[0.88] active:opacity-[0.82]"))}e.s(["CHATBOX_BORDER_STYLE",0,{padding:"1px",background:"radial-gradient(101.25% 41.48% at 100% 45.43%, rgba(255,36,197,0.98431) 0%, rgba(255,63,204,0.86127) 12.5%, rgba(255,91,212,0.73824) 25%, rgba(255,146,226,0.49216) 50%, rgba(255,255,255,0) 100%), linear-gradient(180deg, #8a8589 0%, #414141 100%)",WebkitMask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude"},"CHATBOX_CARD_CLASS",0,r,"CHATBOX_GLASS_BUTTON_CLASS",0,a,"CHATBOX_PILL_TRIGGER_CLASS",0,n,"chatboxSubmitClass",()=>i])},359651,e=>{"use strict";
1var t=e.i(743265),r=e.i(478790),a=e.i(647163);let n="#ffffff",i="#696e77";function s(e,t,r){return getComputedStyle(e).getPropertyValue(t).trim()||r}function l({getAmplitude:e,isTranscribing:l=!1,className:o}){let c=(0,r.useRef)(null),u=(0,r.useRef)(null),d=(0,r.useRef)(e);d.current=e;let p=(0,r.useRef)(l);return p.current=l,(0,r.useEffect)(()=>{let e=c.current,t=u.current,r=t?.getContext("2d");if(!e||!t||!r)return;let a=0,l=0,o=[],f=0,m=0,h=0,g=0,x=0,b=n,C=i,y=()=>{let c=window.devicePixelRatio||1,u=Math.max(1,Math.floor(e.clientWidth)),d=Math.max(1,Math.floor(e.clientHeight));u===a&&d===l||(a=u,l=d,t.width=u*c,t.height=d*c,t.style.width=`${u}px`,t.style.height=`${d}px`,r.setTransform(c,0,0,c,0,0),o=Array(Math.max(1,Math.floor(a/6))).fill(0),m=0,b=s(t,"--color-text-icon-neutral-primary",n),C=s(t,"--color-text-icon-neutral-secondary",i))},v=(e,t)=>.28+(1-(t-1-e)/Math.max(1,t-1))**1.2*.62,w=(e,t)=>a-4-2-((t-1-e)*6+m),A=e=>{if(a&&l&&o.length){g||(g=e);let t=Math.min((e-g)/1e3,.1);g=e;let n=l/2;if(p.current){h+=28*t,r.clearRect(0,0,a,l);let e=h%(o.length+15)-7;for(let t=0;t<o.length;t++){let i=w(t,o.length);if(i+2<0||i>a)continue;let s=Math.max(.12,Math.exp(-((Math.abs(t-e)/3.2)**2)));r.globalAlpha=v(t,o.length)*(.2+.8*s),r.fillStyle=b,r.beginPath(),r.arc(i+1,n,1.5,0,2*Math.PI),r.fill()}r.globalAlpha=1}else{let e=d.current(),i=1-Math.exp(-(16*t));for(f+=(e-f)*i,m+=60*t;m>=6;)m-=6,o.shift(),o.push(f);o[o.length-1]=f,r.clearRect(0,0,a,l);let s=l-6;for(let e=0;e<o.length;e++){let t=o[e],i=w(e,o.length);if(i+2<0||i>a+2)continue;let l=v(e,o.length);if(t<.06){r.globalAlpha=.7*l,r.fillStyle=C,r.beginPath(),r.arc(i+1,n,1.5,0,2*Math.PI),r.fill();continue}r.globalAlpha=.95*l,r.fillStyle=b;let c=5+t*(s-5);r.beginPath(),r.roundRect(i,n-c/2,2,c,2),r.fill()}r.globalAlpha=1}}x=requestAnimationFrame(A)};y();let M=new ResizeObserver(y);return M.observe(e),x=requestAnimationFrame(A),()=>{cancelAnimationFrame(x),M.disconnect()}},[]),(0,t.jsx)("div",{ref:c,className:(0,a.cn)("relative h-7 min-w-0 flex-1 overflow-hidden","mask-[linear-gradient(to_right,transparent,#000_64px,#000_calc(100%-64px),transparent)]",o),children:(0,t.jsx)("canvas",{ref:u,className:"block h-full w-full"})})}e.s(["VoiceWaveform",()=>l])},761205,e=>{"use strict";e.s(["COUNTDOWN_THRESHOLD_MS",0,15e3,"MAX_RECORDING_MS",0,6e4,"MIN_RECORDING_MS",0,500])},652650,e=>{"use strict";var t=e.i(478790),r=e.i(761205);function a(e,a){let[n,i]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{if(null==e||a)return;let t=window.setInterval(()=>i(Date.now()),500);return()=>window.clearInterval(t)},[e,a]);let s=null!=e?e+r.MAX_RECORDING_MS-n:1/0;return{showCountdown:!a&&s<=r.COUNTDOWN_THRESHOLD_MS,countdownLabel:`Auto-finishing in ${Math.max(0,Math.ceil(s/1e3))}s`}}e.s(["useRecordingCountdown",()=>a])},349761,e=>{"use strict";var t=e.i(629408);function r(e,r){let a=[];for(let n of e){let e=[...r,...a];a.push({id:(0,t.createAttachmentId)(),type:n.mediaType,previewUrl:n.thumbnailUrl??n.url,url:n.url,uploadId:n.id,sourceType:n.sourceType??"upload",...n.referenceMode?{referenceMode:n.referenceMode}:{},name:("audio"===n.mediaType||n.assetKind)&&n.label||(0,t.mediaAttachmentName)(n.mediaType,e),..."generation"!==n.sourceType&&!n.assetKind&&n.label?{fileName:n.label}:{},mimeType:"",status:"ready",...null!=n.durationMs?{durationMs:n.durationMs}:{},...n.assetKind?{assetKind:n.assetKind}:{}})}return a}e.s(["pendingAttachmentsFromMediaPicks",()=>r])},437505,419543,e=>{"use strict";var t=e.i(478790),r=e.i(779342),a=e.i(914005),n=e.i(369050),i=e.i(349761),s=e.i(629408);function l(e){return"character"===e.type||"object"===e.type||"background"===e.type}function o({attachmentsRef:e,removeAttachment:o,setAttachments:c,assetPicks:u,onAudioPicks:d}){let p=(0,t.useRef)(new Map),f=(0,t.useRef)({assetIds:new Set,mediaIds:new Set});return{seed:(0,t.useCallback)(()=>{let t=[],r=new Set,a=new Set;for(let n of e.current)(0,s.isAssetAttachment)(n)?(t.push(p.current.get(n.entity
1Id)??{id:n.entityId,sourceType:"generation",userId:"",url:n.resourceUrl??n.previewUrl,thumbnailUrl:n.previewUrl||void 0,resourceType:"character",status:"completed",isStarred:!1,isDownloaded:!1,label:n.name,input:{featureType:`director_${n.mentionType}`},createdAt:Date.now()}),r.add(n.entityId)):(0,s.isMentionableMediaAttachment)(n)&&(t.push(p.current.get(n.uploadId)??{id:n.uploadId,sourceType:"generation",userId:"",url:n.url,thumbnailUrl:n.previewUrl||void 0,resourceType:n.type,status:"completed",isStarred:!1,isDownloaded:!1,label:n.name,createdAt:Date.now()}),a.add(n.uploadId));return f.current={assetIds:r,mediaIds:a},{items:t,max:Math.max(0,s.MAX_COMPOSER_ATTACHMENTS-(e.current.length-t.length))}},[e]),apply:(0,t.useCallback)(t=>{for(let e of t)p.current.set(e.id,e);let m=f.current,h=new Set(t.map(e=>e.id)),g=e.current,x=g.filter(e=>(0,s.isAssetAttachment)(e)&&m.assetIds.has(e.entityId)?!h.has(e.entityId):!!((0,s.isMediaAttachment)(e)&&e.uploadId&&m.mediaIds.has(e.uploadId))&&!h.has(e.uploadId));for(let e of x)o(e);let b=new Set(g.flatMap(e=>(0,s.isAssetAttachment)(e)?[e.entityId]:(0,s.isMediaAttachment)(e)&&e.uploadId?[e.uploadId]:[])),C=t.filter(e=>!b.has(e.id)),y=g.filter(e=>!x.includes(e)),v=[],w=[];if("media-chip"===u)v.push(...(0,i.pendingAttachmentsFromMediaPicks)((0,a.myAssetsPicksFromSelection)(C),y));else{let{mentions:e,media:t}=(0,n.partitionMyAssetsSelection)(C),r=t;for(let a of(d&&(w=t.filter(e=>"audio"===e.mediaType),r=t.filter(e=>"audio"!==e.mediaType)),e.filter(l)))v.push({id:(0,s.createAttachmentId)(),name:a.label,mimeType:"",status:"ready",type:"asset",entityId:a.id,mentionType:a.type,previewUrl:a.thumbnailUrl??"",resourceUrl:a.resourceUrl,voiceUrl:a.voiceUrl??null});v.push(...(0,i.pendingAttachmentsFromMediaPicks)(r.map(e=>({...e,sourceType:"generation"})),[...y,...v]))}let A=Math.max(0,s.MAX_COMPOSER_ATTACHMENTS-y.length),M=v.slice(0,A),T=Math.max(0,A-M.length),k=w.slice(0,T);return(M.length<v.length||k.length<w.length)&&r.toast.warning(`Supports up to ${s.MAX_COMPOSER_ATTACHMENTS} Attached`),M.length>0&&c(e=>[...e,...M]),k.length>0&&d?.(k),x},[e,o,c,u,d])}}e.s(["useComposerMyAssets",()=>o],437505);var c=e.i(743265),u=e.i(647163);e.i(814368);var d=e.i(416019);function p({className:e}){return(0,c.jsx)(d.CachedImage,{src:"https://cdn.openart.ai/assets/internal/uploads/image_oGOOnATx_48x48_1779860345492.webp",alt:"",width:48,height:48,"aria-hidden":!0,className:(0,u.cn)("block shrink-0 object-contain",e)})}e.s(["OpenArtChromaticMark",()=>p],419543)},125096,e=>{"use strict";var t=e.i(743265),r=e.i(804628),a=e.i(419543),n=e.i(647163),i=e.i(612003);e.i(563178);var s=e.i(211811),l=e.i(493745),o=e.i(30823),c=e.i(275348);let u=(0,n.cn)("flex cursor-pointer select-none flex-col items-start justify-center rounded-lg p-2 outline-none","transition-colors duration-100","data-[highlighted]:bg-background-neutral-soft-hover"),d=(0,n.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95");function p({open:e,onOpenChange:l,defaultOpen:c,disabled:d,trigger:p,triggerLabel:f="Attach file",triggerClassName:m,triggerVariant:h="outline",localSubtitle:g,myAssetsSubtitle:x="Characters / Media",onUploadFromLocal:b,onUploadFromMyAssets:C,side:y="top",contentClassName:v,contentRef:w,children:A}){return(0,t.jsxs)(r.Root,{defaultOpen:c,onOpenChange:l,open:e,children:[(0,t.jsx)(r.Trigger,{asChild:!0,disabled:d,children:p??(0,t.jsx)(i.IconButton,{"aria-label":f,className:m,color:"neutral",disabled:d,icon:s.IconAdd2Bold,size:"36",variant:h})}),(0,t.jsx)(r.Portal,{children:(0,t.jsxs)(r.Content,{align:"start",className:(0,n.cn)("z-50 w-[237px] rounded-2xl p-2","border border-border-container-overlay-base bg-background-container-overlay-base","shadow-[0_8px_64px_rgba(0,0,0,0.85)]",v),ref:w,side:y,sideOffset:8,children:[(0,t.jsxs)(r.Item,{className:u,onSelect:b,children:[(0,t.jsxs)("span",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(o.IconUploadArrowBold,{"aria-hidden":"true",className:"size-4 shrink-0 text-text-icon-neutral-high-contrast"}),(0,t.jsx)("span",{className:"text-[13px] font-medium leading-5 text-text-icon-neutral-high-contrast",children:"Upload from local"})]}),(0,t.jsx)("span",{className:"pl-[26px] text-[12px] leading-4 tracking-[0.05px] text-text-icon-neutral-default",children:g})]}),(0,t.jsxs)(r.Item,{className:u,onSelect:C,children:[(0,t.jsxs)("span",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(a.OpenArtChromaticMark,{className:"size-4 rounded-[6px]"}),(0,t.jsx)("span",{className:"text-[13px] font-medium leading-5 text-text-icon-neutral-high-contrast",children:"Upload from my assets"})]}),(0,t.jsx)("span",{className:"pl-[26px] text-[12px] leading-4 tracking-[0.05px] text-text-icon-neutral-default",children:x})]}),A]})})]})}function f({className:e,...r}){return(0,t.jsx)("button",{type:"button","aria-label":"Attach file",...r,className:(0,n.cn)("flex size-[40px] cursor-pointer items-center justify-center rounded-full transition-opacity","outline-none focus:outline-none focus-visible:outline-none",c.CHATBOX_GLASS_BUTTON_CLASS,"data-[state=open]:bg-[linear-gradient(-45deg,rgba(214,225,255,0.1)_0%,rgba(214,225,255,0.45)_100%)]",e),children:(0,t.jsx)(l.IconAddBold,{className:"size-[20px]"})})}e.s(["COMPOSER_ATTACH_MENU_ANIMATION_CLASS",0,d,"ComposerAttachMenu",()=>p,"ComposerGlassAttachTrigger",()=>f])},389077,e=>{"use strict";var t=e.i(647345);let r=e=>e.map(e=>`.${e}`).join(","),a=[r(t.UPLOAD_POLICIES.image.allowedExtensions),r(t.UPLOAD_POLICIES.audio.allowedExtensions)].join(","),n=r(t.UPLOAD_POLICIES.video.allowedExtensions);e.s(["COMPOSER_MEDIA_ACCEPT",0,a,"COMPOSER_VIDEO_ACCEPT",0,n])},438826,e=>{"use strict";
1var t=e.i(743265),r=e.i(629389),a=e.i(478790),n=e.i(398918),i=e.i(647163);e.i(563178);var s=e.i(954629),l=e.i(276810),o=e.i(116043),c=e.i(291533);function u({trigger:e,thumbnailUrl:u,videoUrl:d,audioUrl:p,label:f,duration:m,variant:h="media",disabled:g=!1}){let[x,b]=(0,a.useState)(!1),[C,y]=(0,a.useState)(!1),v=(0,a.useRef)(null),w=(0,a.useRef)(null),A=(0,a.useCallback)(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),M=(0,a.useCallback)(()=>{A(),b(!0)},[A]),T=(0,a.useCallback)(()=>{A(),v.current=setTimeout(()=>{b(!1)},120)},[A]),k=(0,a.useCallback)(()=>{if(p){if(!w.current||w.current.src!==p){w.current?.pause();let e=new Audio(p);e.addEventListener("ended",()=>y(!1)),e.addEventListener("pause",()=>y(!1)),e.addEventListener("play",()=>y(!0)),w.current=e}if(C)return void w.current.pause();w.current.play().catch(()=>y(!1))}},[p,C]);return((0,a.useEffect)(()=>()=>{A(),w.current?.pause(),w.current=null},[A]),(0,a.useEffect)(()=>{x||w.current?.pause()},[x]),g)?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsxs)(r.Root,{open:x,onOpenChange:b,children:[(0,t.jsx)(r.Trigger,{asChild:!0,children:(0,t.jsx)("div",{onMouseEnter:M,onMouseLeave:T,onFocus:M,onBlur:T,children:e})}),(0,t.jsx)(r.Portal,{children:(0,t.jsx)(r.Content,{side:"top",align:"start",sideOffset:8,onOpenAutoFocus:e=>e.preventDefault(),onMouseEnter:M,onMouseLeave:T,className:(0,i.cn)("pointer-events-auto z-50 flex flex-col items-start rounded-[16px] p-[4px]","bg-background-container-overlay-base","border border-border-container-overlay-base","shadow-[0px_9px_64px_0px_rgba(0,0,0,0.45)]","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:"script"===h?(0,t.jsx)(c.ScriptReferenceTile,{label:f,size:"lg"}):"audio"===h?(0,t.jsxs)("div",{className:"relative flex size-[240px] flex-col justify-end overflow-hidden rounded-[12px] bg-background-neutral-surface p-[4px]",children:[u?(0,t.jsx)("img",{src:u,alt:"",className:"pointer-events-none absolute inset-0 size-full object-cover"}):null,(0,t.jsx)("p",{className:"relative z-10 mb-[18px] line-clamp-2 px-[8px] text-[12px] font-medium leading-[16px] tracking-[0.05px] text-text-icon-neutral-primary",children:f}),(0,t.jsxs)("div",{className:"relative z-10 flex items-end justify-between",children:["number"==typeof m?(0,t.jsxs)("div",{className:(0,i.cn)("inline-flex items-center gap-[3px] rounded-[52px] px-[6px] py-[2px]","bg-background-fixed-black-surface-active backdrop-blur-[6px]","text-[11px] font-medium leading-[16px] tracking-[0.1px] text-text-icon-fixed-white-high-contrast"),children:[(0,t.jsx)(o.IconSound,{className:"size-[12px]"}),(0,n.formatDuration)(m)]}):(0,t.jsx)("span",{}),(0,t.jsx)("button",{type:"button","aria-label":C?"Pause audio":"Play audio",disabled:!p,onClick:e=>{e.stopPropagation(),k()},className:(0,i.cn)("flex size-[32px] items-center justify-center rounded-[8px]","bg-background-fixed-white-solid-high-contrast text-text-icon-fixed-black-solid-high-contrast","shadow-[0px_4px_16px_0px_rgba(0,0,0,0.2)] backdrop-blur-[6px]","transition-transform active:scale-95 disabled:cursor-not-allowed disabled:opacity-60"),children:C?(0,t.jsx)(s.IconPauseFill,{className:"size-[16px]"}):(0,t.jsx)(l.IconPlayFill,{className:"size-[16px]"})})]})]}):(0,t.jsxs)("div",{className:"relative flex size-[240px] items-end justify-between overflow-hidden rounded-[12px] bg-background-neutral-surface p-[4px]",children:[d?(0,t.jsx)("video",{src:d,poster:u,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"pointer-events-none absolute inset-0 size-full object-cover"}):u?(0,t.jsx)("img",{src:u,alt:"",className:"pointer-events-none absolute inset-0 size-full object-cover"}):null,(0,t.jsxs)("p",{className:"relative px-[4px] py-[2px] text-[13px] font-medium leading-[20px] text-text-icon-fixed-white-high-contrast",children:["@",f]})]})})})]})}e.s(["ReferencePreviewCard",()=>u])},776637,e=>{"use strict";var t=e.i(241794),r=e.i(880755);let a=new Set(["mp4","mov","m4v","avi","mkv","quicktime"]),n=new Set(["mp3","wav","m4a","aac","ogg","oga","webm","flac"]);function i(e){let t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}function s(e){if(e.type.startsWith("audio/"))return!0;let t=i(e.name);return"video/webm"===e.type&&"webm"===t||(!e.type||"application/octet-stream"
1===e.type)&&n.has(t)}function l(e){return!s(e)&&(e.type?e.type.startsWith("video/"):a.has(i(e.name)))}function o(e){return e.type.startsWith("image/")||(0,t.isHeicFile)(e)}function c(e,t){return o(e)?"image":s(e)?"audio":l(e)?"video":t.documents&&(0,r.isDocumentUploadFile)(e)?"text":null}e.s(["detectAttachmentType",()=>c,"isAudioFile",()=>s,"isImageFile",()=>o,"isVideoFile",()=>l])},353509,e=>{"use strict";var t=e.i(332097),r=e.i(647345),a=e.i(478790),n=e.i(779342),i=e.i(35487),s=e.i(241794),l=e.i(880755),o=e.i(813153),c=e.i(210044),u=e.i(272842),d=e.i(776637),p=e.i(349761),f=e.i(629408);let m=f.MAX_COMPOSER_ATTACHMENTS;async function h(e,r){let a=e.filter(e=>(0,d.isImageFile)(e)&&e.size>r);if(0===a.length)return e;if(!await (0,i.confirmCompress)(a.map(e=>({error:(0,t.createFileSizeValidationError)(e.size,r)})))){n.toast.warning(1===a.length?"The maximum size for a single file is 10 MB":`${a.length} files exceed the 10 MB limit`);let t=new Set(a);return e.filter(e=>!t.has(e))}let l=new Map;await Promise.all(a.map(async e=>{let t=URL.createObjectURL(e);try{let a,n=await (0,s.compressImageToSize)(t,r);l.set(e,(a=e.name.replace(/\.[^./\\]+$/,"")||"image",new File([n],`${a}.jpg`,{type:n.type,lastModified:n.lastModified})))}catch(t){console.error("[useComposerAttachments] compression failed",t),l.set(e,null)}finally{URL.revokeObjectURL(t)}}));let o=[...l.values()].filter(e=>null===e).length;return o>0&&n.toast.error(1===o?"Couldn't compress a file - it's still over 10 MB":`Couldn't compress ${o} files - they're still over 10 MB`),e.flatMap(e=>{if(!l.has(e))return[e];let t=l.get(e);return t?[t]:[]})}function g(e){let t=(0,c.useOptionalProjectId)(),i=e?.projectId??t??"",g=(0,a.useCallback)(e=>(0,u.uploadAsset)({...e,projectId:i}),[i]),x=e?.upload??g,b=!e?.upload,C=e?.dedupePicks??!1,y=e?.compressOversizedImages??!1,v=e?.documents,w=e?.audioTrim,[A,M]=(0,a.useState)([]),T=e?.state,k=T?.attachments??A,_=T?.setAttachments??M,R=(0,a.useRef)(k);R.current=k;let j=!T;(0,a.useEffect)(()=>{if(j)return()=>{for(let e of R.current)e.previewUrl.startsWith("blob:")&&URL.revokeObjectURL(e.previewUrl)}},[j]);let S=(0,a.useCallback)(e=>{_(t=>{let r=t.find(t=>t.id===e);return r?.previewUrl.startsWith("blob:")&&URL.revokeObjectURL(r.previewUrl),t.filter(t=>t.id!==e)})},[_]),I=(0,a.useCallback)(()=>{for(let e of R.current)e.previewUrl.startsWith("blob:")&&URL.revokeObjectURL(e.previewUrl);_(e=>e.filter(e=>"uploading"===e.status))},[_]),U=(0,a.useRef)(()=>{}),N=(0,a.useCallback)((e,t)=>{if(0===e.length)return;if(b&&!i)return void n.toast.error("Couldn't resolve your project. Please refresh and retry.");if(y&&!t?.skipImageCompress){let r=e.filter(e=>(0,d.isImageFile)(e)&&e.size>f.MEDIA_ATTACHMENT_MAX_BYTES);if(r.length>0){let a=new Set(r),n=e.filter(e=>!a.has(e));n.length>0&&U.current(n,{...t,skipImageCompress:!0}),(async()=>
1{let e=await h(r,f.MEDIA_ATTACHMENT_MAX_BYTES);e.length>0&&U.current(e,{...t,skipImageCompress:!0})})();return}}let a=[];for(let t of e){let e=function(e,t){if((0,d.isVideoFile)(e)){let t=(0,r.isUploadAllowed)({resourceType:"video",filename:e.name,contentType:e.type,size:e.size,businessType:"create-video"});if(!t.ok)return{ok:!1,rejection:{kind:"error",title:"Unsupported video",description:`${e.name} â ${t.reason.toLowerCase()}`}}}let a=(0,d.detectAttachmentType)(e,{documents:void 0!==t});if(!a)return{ok:!1,rejection:{kind:"error",title:"Unsupported file",description:t?`${e.name} â only images, audio, and supported documents are supported.`:`${e.name} â only images, audio, and video are supported.`}};if("text"===a){if(!t?.enabled)return{ok:!1,rejection:{kind:"error",title:"Documents aren't supported here",description:"Open a story chat to attach documents."}};if((0,l.isDocumentUploadTooLarge)(e))return{ok:!1,rejection:{kind:"error",title:"Document is too large",description:(0,l.documentUploadTooLargeDescription)(e)}}}return"video"!==a&&"text"!==a&&e.size>f.MEDIA_ATTACHMENT_MAX_BYTES?{ok:!1,rejection:{kind:"warning",title:"The maximum size for a single file is 10 MB"}}:{ok:!0,file:e,type:a}}(t,v);if(!e.ok){var c;"warning"===(c=e.rejection).kind?n.toast.warning(c.title):n.toast.error(c.title,c.description?{description:c.description}:void 0);continue}a.push(e)}if(0===a.length)return;let u=m-R.current.length;if(u<=0)return void n.toast.warning(`Supports up to ${m} Attached`);let p=a.length>u?a.slice(0,u):a;if(p.length<a.length&&n.toast.warning(`Supports up to ${m} Attached`),w&&!t?.skipAudioTrim){let e=p.filter(e=>"audio"===e.type||(0,d.isAudioFile)(e.file));if(e.length>0){let r=p.filter(t=>!e.includes(t)).map(e=>e.file);r.length>0&&U.current(r,{...t,skipAudioTrim:!0}),(async()=>{for(let{file:r}of e){let e=URL.createObjectURL(r),a=await (0,o.probeMediaDuration)("audio",e);if(a<=0){URL.revokeObjectURL(e),n.toast.error("Couldn't read this audio file â please try a different one.");continue}if(a<w.minDurationMs){URL.revokeObjectURL(e),U.current([r],{...t,skipAudioTrim:!0});continue}w.onTrimRequested({file:r,url:e,durationSec:a/1e3})}})();return}}let g=[];for(let{file:e,type:t}of p){let r=(0,f.createAttachmentId)();if("text"===t){let t=v?.sessionPathFor;if(!t)continue;_(a=>[...a,{id:r,type:"text",previewUrl:"",name:e.name,mimeType:e.type||"text/plain",status:"uploading",textContent:"",sessionFilePath:t(r,e.name)}]),(async()=>{try{let{text:t,mimeType:a}=await (0,l.readDocumentUploadText)(e);_(e=>e.map(e=>e.id===r?{...e,status:"ready",mimeType:a,textContent:t}:e))}catch(a){let t=a instanceof Error?a.message:"Could not read file";n.toast.error("Couldn't read document",{description:`${e.name}: ${t}`}),_(e=>e.filter(e=>e.id!==r))}})();continue}let a=(0,s.isHeicFile)(e)?"":URL.createObjectURL(e);_(n=>[...n,{id:r,type:t,previewUrl:a,name:(0,f.mediaAttachmentName)(t,n),fileName:e.name,mimeType:e.type,status:"uploading",sourceType:"upload"}]),"video"===t&&a&&(0,o.probeMediaDuration)("video",a).then(e=>{e<=0||_(t=>t.map(t=>t.id===r?{...t,durationMs:e}:t))}),g.push((async()=>{try{let n=await x({file:e,resourceType:t,businessType:"image"===t?"create-image":"video"===t?"create-video":"create-audio"});a&&URL.revokeObjectURL(a),_(e=>e.map(e=>e.id===r&&(0,f.isMediaAttachment)(e)?{...e,status:"ready",previewUrl:n.accessURL,url:n.accessURL,uploadId:n.uploadId}:e))}catch(e){throw _(e=>e.filter(e=>e.id!==r)),a&&URL.revokeObjectURL(a),e}})())}g.length>0&&Promise.allSettled(g).then(e=>{let t=e.filter(e=>"rejected"===e.status).length;t>0&&n.toast.error(`${t} ${1===t?"file":"files"} failed to upload`)})},[x,i,b,y,v,w,_]);U.current=N;let O=(0,a.useCallback)(e=>{if(0===e.length)return[];let t=R.current,r=new Map;if(C)for(let e of t)(0,f.isMediaAttachment)(e)&&e.uploadId&&r.set(e.uploadId,e);let a=e.filter(e=>!r.has(e.id)),i=Math.max(0,m-t.length),s=a.slice(0,i);s.length<a.length&&n.toast.warning(`Supports up to ${m} Attached`);let l=(0,p.pendingAttachmentsFromMediaPicks)(s,t);l.length>0&&_(e=>[...e,...l]);let o=new Map(l.map(e=>[e.uploadId,e]));return e.flatMap(e=>{let t=r.get(e.id)??o.get(e.id);return t?[t]:[]})},[C,_]),E=(0,a.useCallback)(e=>{for(let e of R.current)e.previewUrl.startsWith("blob:")&&URL.revokeObjectURL(e.previewUrl);let t=new Set,r=e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0)).slice(0,m);r.length<e.length&&n.toast.warning(`Supports up to ${m} Attached`),_((0,p.pendingAttachmentsFromMediaPicks)(r,[]))},[_]),L=(0,a.useCallback)(()=>R.current.filter(e=>(0,f.isMediaAttachment)(e)&&"ready"===e.status&&!!e.url).map(e=>({type:e.type,url:e.url,...!e.assetKind&&"url-only"!==e.referenceMode&&"generation"===e.sourceType&&e.uploadId?{resourceId:e.uploadId}:{},...!e.assetKind&&"url-only"!==e.referenceMode&&"generation"!==e.sourceType&&e.uploadId?{uploadedAssetId:e.uploadId}:{},name:e.name,mimeType:e.mimeType,...e.fileName?{originalFileName:e.fileName}:{},...null!=e.durationMs?{durationMs:e.durationMs}:{}})),[]);return{attachments:k,attachmentsRef:R,isUploading:k.some(e=>"uploading"===e.status),hasReady:k.some(e=>"ready"===e.status),ingestFiles:N,addMediaPicks:O,replaceMediaPicks:E,removeAttachment:S,clear:I,setAttachments:_,collect:L}}e.s(["useComposerAttachments",()=>g])},328293,e=>{"use strict";function t(e,t){var r;return`/files/uploads/${e}-${r=t,(Array.from(r.split(/[\\/]/).pop()?.trim()||"uploaded-document.txt").filter(e=>{let t=e.charCodeAt(0);return t>=32&&127!==t}).join("").replace(/\s+/g,"-").replace(/[^A-Za-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^\.+/,"").slice(0,120)||"uploaded-document.txt").replace(/\.(pdf|docx)$/i,".txt")}`}function r(e,t){return`@[${e}](textfile:${t})`}e.s(["textFileMentionToken",()=>r,"textFileSessionPath",()=>t])},682503,e=>{"use strict";var t=e.i(478790),r=e.i(779342),a=e.i(53462),n=e.i(861569),i=e.i(244547),s=e.i(613211),l=e.i(901736),o=e.i(155289),c=e.i(368709),u=e.i(761205);function d({onTranscript:e,disabled:d=!1}){let{status:p,isRecording:f,isTranscribing:m,isSupported:h,recordingStartedAt:g,startRecording:x,stopAndTranscribe:b,cancelRecording:C,getAmplitude:y}=function(e={}){let[r,a]=(0,t.useState)("idle"),[n,i]=(0,t.useState)(null),s=(0,t.useRef)([]),d=(0,t.useRef)(null),p=(0,t.useRef)(null),f=(0,t.useRef)(null),m=(0,t.useRef)(null),h=(0,t.useRef)(null),g=(0,t.useRef)(null),x=(0,t.useRef)(null),b=(0,t.useRef)(null),C=(0,t.useRef)(null),y=(0,t.useRef)(!1),v=(0,t.useRef)(!0),w=(0,t.useRef)(e);(0,t.useEffect)(()=>{w.current=e});let A=(0,t.useCallback)(()=>{C.current&&(clearTimeout(C.current),C.current=null)},[]),M=(0,t.useCallback)(()=>
1{d.current?.getTracks().forEach(e=>{e.stop()}),d.current=null,p.current=null,x.current=null,g.current=null,m.current=null,h.current=null;let e=f.current;f.current=null,e&&"closed"!==e.state&&e.close().catch(()=>{})},[]),T=(0,t.useCallback)(()=>{let e=m.current;if(!e)return 0;let t=h.current;t&&t.length===e.fftSize||(h.current=t=new Uint8Array(e.fftSize)),e.getByteTimeDomainData(t);let r=0;for(let e of t){let t=(e-128)/128;r+=t*t}return Math.min(1,4.5*Math.sqrt(r/t.length))},[]),k=(0,t.useCallback)(async()=>{let e=p.current,t=g.current;if(!e||!t||y.current)return;y.current=!0,A();let r=b.current;b.current=null,a("transcribing"),i(null),"inactive"!==e.state&&e.stop();let n=await t;M();let{onTranscript:s,onEmpty:d,onError:f}=w.current;try{let e;if(r&&Date.now()-r<u.MIN_RECORDING_MS)return void d?.();try{e=await (0,o.blobToWav16kMono)(n)}catch(e){l.captureException(e,{tags:{component:"useVoiceTranscription",phase:"encode"}}),f?.(Error("Couldn't process the recording. Please try again."));return}let t=await (0,o.blobToBase64)(e),a=await (0,c.post)("/api/transcribe",{audioData:t,format:"wav",language:"auto"}),i=a?.text?.trim();i?s?.(i):d?.()}catch(e){f?.(e)}finally{y.current=!1,a("idle")}},[M,A]),_=(0,t.useRef)(k);_.current=k;let R=(0,t.useCallback)(async()=>{if("idle"!==r)return;let e=await navigator.mediaDevices.getUserMedia({audio:!0});if(!v.current)return void e.getTracks().forEach(e=>{e.stop()});try{let t=(0,o.getSupportedAudioMimeType)(),r=new MediaRecorder(e,{mimeType:t});d.current=e,p.current=r,s.current=[],y.current=!1;let n=(0,o.createAmplitudeAnalyser)(e);f.current=n?.audioContext??null,m.current=n?.analyser??null,h.current=n?.buffer??null,g.current=new Promise(e=>{x.current=e}),r.ondataavailable=e=>{e.data.size>0&&s.current.push(e.data)},r.onstop=()=>{let e=new Blob(s.current,{type:r.mimeType||t});x.current?.(e)},r.start();let l=Date.now();b.current=l,i(l),a("recording"),A(),C.current=setTimeout(()=>{_.current()},u.MAX_RECORDING_MS)}catch(t){throw M(),e.getTracks().forEach(e=>{e.stop()}),a("idle"),t}},[M,A,r]),j=(0,t.useCallback)(()=>{A(),y.current=!1;let e=p.current;e&&"inactive"!==e.state&&(e.onstop=null,e.stop()),M(),s.current=[],b.current=null,i(null),a("idle")},[M,A]),S=(0,t.useRef)(r);S.current=r;let I=(0,t.useRef)(j);return I.current=j,(0,t.useEffect)(()=>{let e=()=>{"recording"===S.current&&I.current()},t=()=>{"hidden"===document.visibilityState&&e()};return document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",e),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("pagehide",e)}},[]),(0,t.useEffect)(()=>(v.current=!0,()=>{v.current=!1,A(),M()}),[M,A]),{status:r,isRecording:"recording"===r,isTranscribing:"transcribing"===r,isSupported:"undefined"!=typeof navigator&&!!navigator.mediaDevices?.getUserMedia&&"undefined"!=typeof MediaRecorder,recordingStartedAt:n,startRecording:R,stopAndTranscribe:k,cancelRecording:j,getAmplitude:T}}({onTranscript:e,onEmpty:()=>r.toast.info("No speech was detected. Please try again."),onError:e=>r.toast.error(e instanceof Error?e.message:"Failed to transcribe voice input.")}),{checkAuth:v}=(0,n.useRequireAuth)(),{data:w}=(0,i.useCurrentWorkspace)(),A=(0,t.useRef)(p);A.current=p;let M=(0,t.useCallback)(()=>!!v()&&(!w||!!(0,s.isEnterprise)(w)||!!w.subscription_active||((0,a.showUpgradeAddCreditsDialog)({errorData:{scenario:"feature_locked"},onCompareAllFeatures:()=>{}}),!1)),[v,w]),T=(0,t.useCallback)(()=>{d||(h?"idle"!==A.current||M()&&x().catch(()=>{r.toast.error("Couldn't access the microphone. Please check permissions.")}):r.toast.error("Voice input is not supported in this browser."))},[d,h,M,x]);return{isSupported:h,isRecording:f,isTranscribing:m,isUiVisible:f||m,recordingStartedAt:g,getAmplitude:y,micButtonProps:{onClick:T},commit:(0,t.useCallback)(()=>{b()},[b]),cancel:(0,t.useCallback)(()=>{C()},[C])}}e.s(["useVoiceComposer",()=>d],682503)},478297,e=>{"use strict";var t=e.i(743265),r=e.i(478790),a=e.i(546254),n=e.i(752712),i=e.i(82787),s=e.i(430369),l=e.i(397184),o=e.i(741559),c=e.i(856609),u=e.i(360037);let d=[{value:"character",label:"Character"},{value:"background",label:"Location"},{value:"object",label:"Objects"}],p={character:"No characters yet",background:"No locations yet",object:"No objects yet"};function f(e){function f({max:f,selectedItems:m,onSelectionChange:h,characterFilter:g}){let[x,b]=(0,r.useState)("character"),{projectId:C}=(0,c.useProjectContext)(),y=(0,a.useAssetScopeStore)(e=>e.scope),v="all"===y.kind?{kind:"workspace"}:{kind:"story",storyId:y.storyId,label:""},w="story"===v.kind?!!v.storyId:!!C,{data:A,isLoading:M,fetchNextPage:T,hasNextPage:k,isFetchingNextPage:_}=(0,o.useScopedAssets)(v,x,e,w,C),R=(0,r.useMemo)(()=>(A?.pages.flatMap(e=>e.characters)??[]).filter(e=>"completed"===e.status),[A]),j=(0,r.useMemo)(()=>m.filter(e=>"character"===e.resourceType||"other"===e.resourceType).map(e=>s.MediaConverter.toCharacter(e)),[m]);return(0,t.jsxs)("div",{className:"flex flex-col gap-[4px] w-full flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 pr-[4px]",children:[(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)(i.SimpleTabs,{tabs:d,value:x,onValueChange:e=>b(e)})}),(0,t.jsx)("div",{className:"shrink-0",children:(0,t.jsx)(l.AssetScopeDropdown,{currentStoryId:e,enabled:!0})})]}),(0,t.jsx)(u.ScrollArea,{className:"flex-1 min-h-0 p-[4px]",children:(0,t.jsx)(n.CharacterGridContent,{characters:R,characterFilter:g,max:f,selectedItems:j,onSelectionChange:e=>h(s.MediaConverter.fromCharacter(e)),isLoading:M,hasNextPage:k,fetchNextPage:T,isFetchingNextPage:_,hideCreateButton:!0,emptyStateText:p[x]})})]})}return f.displayName="MyAssetsCharactersTab",{Component:f}}e.s(["buildMyAssetsCharactersTab",()=>f])}]);
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.