1import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{n as r,t as i}from"./createServerFn-CNKq9Hvl.js";import{t as a}from"./link-DVZq_O1S.js";import{t as o}from"./breadcrumbs-Bci7b5os.js";import{n as s}from"./Match-CqqFfJLT.js";import{t as c}from"./useRouterState-BIdieNG6.js";import{t as l}from"./middleware.fn-BM1VjY0a.js";import{i as u}from"./client-Y06w4xU6.js";import{t as d}from"./useMutation-0fdNU087.js";import{t as f}from"./useQuery-C5QBIBlr.js";import{n as p}from"./session-query-DWzf6op4.js";import{t as m}from"./utils-DOQQTBMN.js";import{t as h}from"./user-sidebar-footer-DygzrJwE.js";import{t as g}from"./upload-rights-gate-vV2UYkJy.js";import{t as _}from"./separator-D9BW1m96.js";import{t as v}from"./button-BBzvRDfy.js";import{t as y}from"./createLucideIcon-Cn6LRB4K.js";import{n as ee}from"./billing-gate-dialog-BT9ITN1D.js";import"./boxes-B1m7Zp7C.js";import{t as te}from"./clapperboard-DWrWPWmj.js";import{t as ne}from"./film-B3ZtYz7O.js";import{t as b}from"./images-BFjoUsrb.js";import{t as x}from"./life-buoy-DxIWeNCj.js";import{t as S}from"./mail-C78eKCjD.js";import{t as C}from"./map-pin-BY67jDVs.js";import{a as w,c as re,d as T,f as ie,h as ae,i as oe,l as E,m as se,n as ce,p as le,r as ue,s as de,t as fe,u as D}from"./sidebar-BtvEafrN.js";import{t as pe}from"./plus-ZFRCmWX_.js";import{t as me}from"./shield-alert-DkjgE_eM.js";import{t as he}from"./users-BLVRo68A.js";import{t as ge}from"./video-Bcidsxwg.js";import{t as O}from"./wallet-DNzp2xXX.js";import{n as k}from"./esm-C4OmYAsV.js";import{n as A}from"./dist-35_2mp6M.js";import{t as j}from"./use-user-ClKJJXWo.js";import{i as M}from"./constants-CcqGLEgp.js";import{a as N}from"./money-DxasrwKd.js";import{j as P}from"./models-D3HYm5Ng.js";import"./constants-DyfRhd-n.js";import{i as F}from"./use-billing-balance-DfppK9PT.js";import{n as I}from"./aspect-ratios-BiXOf5f_.js";import{t as L}from"./input-G2gxU_5X.js";import{a as R,i as z,o as B,r as _e,s as V,t as ve}from"./dialog-qaVeuhxi.js";import{r as H,t as U}from"./alert-CeMuNjSx.js";import{t as ye}from"./auth-gate-provider-ZLAC5n-n.js";import{Tt as be,jt as W}from"./index-DVD5oPJ-.js";import{t as xe}from"./textarea-LKsr2Sx2.js";import{r as G,s as Se}from"./use-billing-gate-CFKUI7jF.js";import{t as Ce}from"./use-show-costs-C0Adv4us.js";import{A as we,c as K,j as Te,k as Ee}from"./pipeline-D0H9469_.js";import{l as De,r as Oe}from"./cost-estimation-Bsoe9F9d.js";import{r as q}from"./use-add-credits-dialog-DvWsvEl7.js";import{i as ke}from"./use-balance-flash-Cs8X3wAb.js";import{n as Ae}from"./use-billing-balance-realtime-LPN2PIN4.js";import{n as je,t as Me}from"./openstory-logo-B89lMope.js";import"./snap-duration-7FtnyYdV.js";import{i as Ne,n as Pe,o as Fe}from"./enhance-duration-D1xANkCg.js";import{t as Ie}from"./add-credits-dialog-B61rpiVm.js";import{t as Le}from"./github-icon-CAJ5pfLs.js";import{t as Re}from"./x-icon-BZrGedDQ.js";import{r as ze}from"./time-estimate-BUyuPsM_.js";var J={name:`badge-dollar-sign`,size:24,node:[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};J.node;var Be=y(J),Y={name:`palette`,size:24,node:[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]};Y.node;var Ve=y(Y),X=n();function He({className:e}){return(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,X.jsx)(`path`,{d:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`})})}var Ue=i({method:`POST`}).handler(r(`submitFeedbackFn`)),Z=e(t(),1);function We({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),{data:i}=j(),a=d({mutationFn:e=>Ue({data:e}),onSuccess:()=>{r(``)}}),o=e=>{t(e),e||(r(``),a.reset())};return(0,X.jsx)(ve,{open:e,onOpenChange:o,children:(0,X.jsx)(_e,{className:`sm:max-w-md`,children:a.isSuccess?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(B,{children:[(0,X.jsx)(V,{children:`Thanks`}),(0,X.jsx)(z,{children:`We got your message and will read it soon.`})]}),(0,X.jsx)(R,{children:(0,X.jsx)(v,{onClick:()=>o(!1),children:`Done`})})]}):(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=n.trim();if(!t||a.isPending)return;let r=new FormData(e.currentTarget).get(`email`);a.mutate({message:t,email:typeof r==`string`?r:void 0})},className:`flex flex-col gap-4`,children:[(0,X.jsxs)(B,{children:[(0,X.jsx)(V,{children:`Feedback`}),(0,X.jsx)(z,{children:`Bugs, ideas, or anything else â send a short note.`})]}),!i&&(0,X.jsx)(L,{type:`email`,name:`email`,autoComplete:`email`,inputMode:`email`,maxLength:254,placeholder:`Email (optional â if you'd like a reply)`,"aria-label":`Email (optional)`}),(0,X.jsx)(xe,{name:`message`,value:n,onChange:e=>r(e.target.value),placeholder:`What's on your mind?`,rows:5,required:!0,maxLength:2e3,className:`min-h-28 resize-y`}),a.isError&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a.error instanceof Error?a.error.message:`Failed to send`}),(0,X.jsxs)(R,{children:[(0,X.jsx)(v,{type:`button`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`}),(0,X.jsx)(v,{type:`submit`,disabled:a.isPending||!n.trim(),children:a.isPending?`Sendingâ¦`:`Send`})]})]})})})}var Q=`openstory:balance-gain`,Ge=1800;function Ke(e,t,n){let r=1-(1-n)**3;return Math.max(0,e-t*(1-r))}function qe(e){let[t,n]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{let e=0,t=t=>{if(!(t instanceof CustomEvent)||typeof t.detail!=`number`)return;let r=t.detail,i=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=performance.now();cancelAnimationFrame(e),e=requestAnimationFrame(function t(o){let s=Math.min(1,(o-a)/Ge);if(s===1){n(null);return}n({gain:r,progress:i?1:s}),e=requestAnimationFrame(t)})};return window.addEventListener(Q,t),()=>{window.removeEventListener(Q,t),cancelAnimationFrame(e)}},[]);let r=e??0;return{shown:t?Ke(r,t.gain,t.progress):r,gain:t?.gain??null}}var Je=()=>{let{data:e,isLoading:t}=j(),{balance:n,reserved:r,teamId:i,isLowBalance:a}=F(),{data:o}=G(),{showCosts:s}=Ce(),{isFlashing:c}=ke(),{shown:l,gain:u}=qe(n),d=!t&&!e,f=o?.hasAutoTopUp||o?.hasFalKey,p=a&&!f,m=p||s||c;if(Ae(i,!d&&m),d||!m)return null;let h=c||u!==null?`text-emerald-600 dark:text-emerald-400 hover:text-emerald-600 dark:hover:text-emerald-400`:p?`text-amber-600 dar
1k:text-amber-400 hover:text-amber-600 dark:hover:text-amber-400`:void 0,g=`$${n?.toFixed(2)??`0.00`}`,_=r>0?`Credits · ${g} available`:`Credits · ${g}`;return(0,X.jsx)($,{amount:g,shown:l,gain:u,tooltip:_,toneClass:h})},$=({amount:e,shown:t,gain:n,tooltip:r,toneClass:i})=>(0,X.jsx)(E,{children:(0,X.jsxs)(T,{children:[(0,X.jsxs)(D,{tooltip:r,onClick:()=>q(`sidebar_pill`),"aria-label":`Credit balance ${e}. Add credits.`,className:m(`animate-[balance-flash-in_300ms_ease-out_both]`,i),children:[(0,X.jsx)(O,{}),(0,X.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:e}),(0,X.jsxs)(`span`,{className:`tabular-nums`,"aria-hidden":!0,children:[`$`,t.toFixed(2)]})]}),n===null?null:(0,X.jsxs)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute -top-2.5 left-8 text-xs font-semibold tabular-nums text-emerald-600 animate-[balance-gain_1800ms_ease-out_both] group-data-[collapsible=icon]:hidden dark:text-emerald-400`,children:[`+$`,n.toFixed(2)]})]})});function Ye({balanceUsd:e,isZeroBalance:t,runCostUsd:n,onAddCredits:r,onOtherOptions:i}){let a={label:`Add $10`,onClick:r},o={label:`Other options`,onClick:i},s={"--width":`440px`};if(t){A.error(`Your credit balance is $0`,{id:`low-balance`,description:`Generation is off until you add credits.`,action:a,cancel:o,style:s,duration:1e4});return}A.warning(`Balance is $${e.toFixed(2)}`,{id:`low-balance`,description:`Another short is about $${Math.round(n)}.`,action:a,cancel:o,style:s,duration:8e3})}function Xe(e){return e.split(/\s+/).filter(Boolean).length}function Ze(e){return Math.max(3,Math.round(Xe(e)/3))}function Qe(e){let t=e.videoModels?.[0]??`seedance_v2`,n=Pe(e.script,t).snappedSeconds,r=e.targetDurationSeconds!=null&&e.targetDurationSeconds>=5?e.targetDurationSeconds:void 0,i=r??n??Ze(e.script),a=ze(e.script,{targetDurationSeconds:r}),o=P(t),s=o[Math.floor(o.length/2)]??5,c=Fe(e.script).length,l;l=e.shotCount!=null&&e.shotCount>0?e.shotCount:c>0?c:r==null&&n==null?Math.max(a,Math.ceil(i/s)):a;let u=e.stopAt?K(e.stopAt,`motion`)&&!!e.videoModels?.length:!!(e.autoGenerateMotion&&e.videoModels?.length),d=e.stopAt?K(e.stopAt,`music`)&&!!e.audioModels?.length:!!(u&&e.autoGenerateMusic&&e.audioModels?.length),f=u?Ne({script:e.script,targetSeconds:i,sceneCount:l,model:t}):void 0;return Oe({imageModel:e.imageModel,imageModelCount:e.imageModelCount,aspectRatio:e.aspectRatio,resolution:e.resolution,estimatedSceneCount:l,autoGenerateMotion:u,stopAt:e.stopAt,videoModels:u?e.videoModels:void 0,videoDurationSeconds:f?.perShotSeconds,autoGenerateMusic:d,referenceOnly:e.referenceOnly,generateVoices:e.generateVoices,draftMotion:e.draftMotion,audioModels:d?e.audioModels:void 0,audioDurationSeconds:d?f?.totalSeconds??i:void 0,pricing:e.pricing})}var $e=30;function et(e){return!e||Object.keys(e).length===0?13:N(Qe({script:``,imageModel:we,aspectRatio:I,autoGenerateMotion:!0,videoModels:[Te],autoGenerateMusic:!0,audioModels:[Ee],referenceOnly:!0,targetDurationSeconds:$e,pricing:e}))}function tt(){let{balance:e,isLowBalance:t,isZeroBalance:n,lowBalanceThreshold:r}=F(),{pricing:i}=De(),a=k(),o=(0,Z.useRef)(null),s=(0,Z.useRef)(!1),c=(0,Z.useCallback)(t=>{let r=e??0,o=e===null||n,s={balance_usd:r,is_zero:o,source:t};a.capture(`low_balance_toast_shown`,s);let c=e=>a.capture(`low_balance_toast_clicked`,{...s,choice:e});Ye({balanceUsd:r,isZeroBalance:o,runCostUsd:et(i),onAddCredits:()=>{c(`add_credits`),q(`low_balance_toast`)},onOtherOptions:()=>{c(`other_options`),Se(o?`zero`:`insufficient`)}})},[e,n,a,i]);(0,Z.useEffect)(()=>u(()=>{c(`insufficient_credits`)}),[c]),(0,Z.useEffect)(()=>{if(e===null)return;let i=o.current;if(o.current=e,i!==null){if(e>=i){e>r&&(s.current=!1);return}s.current||(n||t)&&(s.current=!0,c(`balance_drop`))}},[e,c,t,n,r])}var nt=[{to:`/sequences`,label:`Sequences`,icon:ne},{to:`/images`,label:`Images`,icon:b},{to:`/clips`,label:`Clips`,icon:ge},{to:`/styles`,label:`Styles`,icon:Ve},{to:`/talent`,label:`Talent`,icon:he},{to:`/locations`,label:`Locations`,icon:C},{to:`/gallery`,label:`Gallery`,icon:te}];function rt(){tt();let{isMobile:e,setOpenMobile:t}=ae(),n=k(),r=c({select:e=>e.location.pathname}),[i,o]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{e&&t(!1)},[r,e,t]),(0,X.jsxs)(fe,{collapsible:`icon`,children:[(0,X.jsx)(de,{children:(0,X.jsxs)(a,{to:`/`,className:`flex h-10 items-center px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0`,children:[(0,X.jsx)(je,{size:`md`,className:`group-data-[collapsible=icon]:hidden`}),(0,X.jsx)(Me,{size:`md`,className:`hidden group-data-[collapsible=icon]:block`})]})}),(0,X.jsx)(ce,{children:(0,X.jsx)(oe,{children:(0,X.jsx)(w,{children:(0,X.jsxs)(E,{children:[(0,X.jsx)(T,{children:(0,X.jsx)(D,{asChild:!0,tooltip:`New sequence`,children:(0,X.jsxs)(a,{to:`/`,onClick:()=>n.capture(`make_another_clicked`,{surface:`sidebar`}),children:[(0,X.jsx)(pe,{}),(0,X.jsx)(`span`,{children:`New sequence`})]})})}),nt.map(({to:e,label:t,icon:n})=>(0,X.jsx)(T,{children:(0,X.jsx)(D,{asChild:!0,tooltip:t,children:(0,X.jsxs)(a,{to:e,activeProps:{"data-active":`true`},activeOptions:{exact:!1},children:[(0,X.jsx)(n,{}),(0,X.jsx)(`span`,{children:t})]})})},t))]})})})}),(0,X.jsxs)(ue,{children:[(0,X.jsxs)(E,{children:[(0,X.jsx)(T,{children:(0,X.jsx)(D,{asChild:!0,tooltip:`Docs`,children:(0,X.jsxs)(a,{to:`/docs`,children:[(0,X.jsx)(x,{}),(0,X.jsx)(`span`,{children:`Docs`})]})})}),(0,X.jsx)(T,{children:(0,X.jsx)(D,{asChild:!0,tooltip:`Pricing`,children:(0,X.jsxs)(a,{to:`/pricing`,children:[(0,X.jsx)(Be,{}),(0,X.jsx)(`span`,{children:`Pricing`})]})})}),(0,X.jsx)(T,{children:(0,X.jsxs)(D,{tooltip:`Feedback`,onClick:()=>o(!0),children:[(0,X.jsx)(S,{}),(0,X.jsx)(`span`,{children:`Feedback`})]})}),(0,X.jsx)(T,{children:(0,X.jsx)(D,{asChild:!0,tooltip:`GitHub`,children:(0,X.jsxs)(`a`,{href:M.githubHref,target:`_blank`,rel:`noreferrer`,children:[(0,X.jsx)(Le,{className:`size-4`}),(0,X.jsx)(`span`,{children:`GitHub`})]})})}),(0,X.jsx)(T,{children:(0,X.jsx)(D,{asChild:!0,tooltip:`YouTube`,children:(0,X.jsxs)(`a`,{href:M.youtubeHref,target:`_blank`,rel:`noreferrer`,children:[(0,X.jsx)(He,{className:`size-4`}),(0,X.jsx)(`span`,{children:`YouTube`})]})})}),(0,X.jsx)(T,{children:(0,X.jsx)(D,{asChild:!0,tooltip:`Follow OpenStory`,children:(0,X.jsxs)(`a`,{href:M.xHref,target:`_blank`,rel:`noreferrer`,children:[(0,X.jsx)(Re,{className:`size-4`}),(0,X.jsx)(`span`,{children:`Follow OpenStory`})]})})})]}),(0,X.jsx)(le,{}),(0,X.jsx)(Je,{}),(0,X.jsx)(E,{children:(0,X.jsx)(h,{})})]}),(0,X.jsx)(We,{open:i,onOpenChange:o})]})}var it=()=>{let{data:e}=G();return e?.autoTopUpFailed?(0,X.jsxs)(U,{variant:`destructive`,className:`rounded-none border-x-0 border-t-0`,children:[(0,X.jsx)(W,{className:`h-4 w-4`}),(0,X.jsxs)(H,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsx)(`span`,{children:`Auto-reload is paused â your card was declined. Generation stops when your balance runs out.`}),(0,X.jsx)(a,{to:`/credits`,className:`shrink-0 font-medium underline`,children:`Update card â`})]})]}):null},at=i({method:`GET`}).middleware([l]).handler(r(`getComplianceStatusFn`)),ot=()=>{let{data:e}=p(),{data:t}=f({queryKey:[`compliance-status`],queryFn:()=>at(),staleTime:3e4,retry:!1,enabled:!!e});return t?.restrictionNotice?(0,X.jsxs)(U,{variant:`destructive`,className:`rounded-none border-x-0 border-t-0`,children:[(0,X.jsx)(me,{className:`h-4 w-4`}),(0,X.jsxs)(H,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsx)(`span`,{children:t.restrictionNotice}),(0,X.jsx)(a,{to:`/report`,className:`shrink-0 font-medium underline`,children:`Appeal or report â`})]})]}):null},st=()=>{let{data:e}=G();return e?.openRouterKeyInvalid?(0,X.jsxs)(U,{variant:`destructive`,className:`rounded-none border-x-0 border-t-0`,children:[(0,X.jsx)(W,{className:`h-4 w-4`}),(0,X.jsxs)(H,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsx)(`span`,{children:`Your Open
1Router API key is invalid. Generations are falling back to the platform key until you fix it.`}),(0,X.jsx)(a,{to:`/settings/api-keys`,className:`shrink-0 font-medium underline`,children:`Fix in settings â`})]})]}):null},ct=({className:e,children:t,...n})=>(0,X.jsx)(ye,{children:(0,X.jsx)(g,{children:(0,X.jsx)(be,{children:(0,X.jsxs)(ie,{className:`h-svh`,children:[(0,X.jsx)(rt,{}),(0,X.jsx)(Ie,{}),(0,X.jsx)(ee,{}),(0,X.jsxs)(re,{className:`min-w-0 min-h-0`,children:[(0,X.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-2 border-b px-4`,children:[(0,X.jsx)(se,{className:`-ml-1`}),(0,X.jsx)(_,{orientation:`vertical`,className:`mr-2 data-vertical:h-4 data-vertical:self-auto`}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(o,{})})]}),(0,X.jsx)(ot,{}),(0,X.jsx)(st,{}),(0,X.jsx)(it,{}),(0,X.jsx)(`div`,{className:m(`flex flex-col flex-1 min-w-0 min-h-0 overflow-x-hidden overflow-y-auto [scrollbar-gutter:stable]`,e),...n,children:t})]})]})})})});function lt(){return(0,X.jsx)(ct,{children:(0,X.jsx)(s,{})})}export{lt as component};
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.