@gentbajko/slopify 3.4.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/image/fal.js +2 -2
- package/dist/adapters/image/openai.js +2 -0
- package/dist/assets/models.yaml +7 -0
- package/dist/catalog/schema.js +1 -1
- package/dist/extension/slopify-studio-chrome.zip +0 -0
- package/dist/extension/slopify-studio-firefox.zip +0 -0
- package/dist/kernel/db/migrations/0049-square-format.sql +10 -0
- package/dist/kernel/pipeline.js +6 -1
- package/dist/kernel/ports/host-cli.js +1 -1
- package/dist/patch-notes/3.4.2.md +12 -0
- package/dist/patch-notes/3.5.0.md +14 -0
- package/dist/patch-notes/index.json +12 -0
- package/dist/slices/rebuild/recipe-describe.js +1 -1
- package/dist/slices/rebuild/recipe-input-schema.js +1 -1
- package/dist/slices/rebuild/recipe-visual.js +2 -1
- package/dist/slices/rebuild/runtime-figure-card.js +2 -2
- package/dist/slices/rebuild/runtime-subtitles.js +2 -3
- package/dist/slices/storage/schema.js +1 -1
- package/dist/slices/style-preview/render.js +1 -0
- package/dist/slices/subtitles/layout.js +5 -1
- package/dist/slices/thumbnail/by-llm.js +2 -1
- package/dist/slices/thumbnail/run.js +2 -1
- package/dist/slices/video/plan.js +1 -0
- package/dist/slices/voices/portraits.js +2 -1
- package/dist/web/assets/index-BGnKvlNS.css +1 -0
- package/dist/web/assets/{index-B4HZ24q0.js → index-Bd6u9m2c.js} +7 -7
- package/dist/web/assets/{pdf-Dsbuwxiz.js → pdf-BinfD_My.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-GnlzADIB.css +0 -1
|
@@ -47,9 +47,9 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
`},Wp=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Gp=function(){m.useEffect(function(){return document.body.setAttribute(Hp,(Wp()+1).toString()),function(){var e=Wp()-1;e<=0?document.body.removeAttribute(Hp):document.body.setAttribute(Hp,e.toString())}},[])},Kp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Gp();var a=m.useMemo(function(){return Bp(i)},[i]);return m.createElement(Vp,{styles:Up(a,!t,i,n?``:`!important`)})},qp=!1;if(typeof window<`u`)try{var Jp=Object.defineProperty({},"passive",{get:function(){return qp=!0,!0}});window.addEventListener(`test`,Jp,Jp),window.removeEventListener(`test`,Jp,Jp)}catch{qp=!1}var Yp=qp?{passive:!1}:!1,Xp=function(e){return e.tagName===`TEXTAREA`},Zp=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Xp(e)&&n[t]===`visible`)},Qp=function(e){return Zp(e,`overflowY`)},$p=function(e){return Zp(e,`overflowX`)},em=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),rm(e,r)){var i=im(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tm=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},nm=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},rm=function(e,t){return e===`v`?Qp(t):$p(t)},im=function(e,t){return e===`v`?tm(t):nm(t)},am=function(e,t){return e===`h`&&t===`rtl`?-1:1},om=function(e,t,n,r,i){var a=am(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=im(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&rm(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},sm=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cm=function(e){return[e.deltaX,e.deltaY]},lm=function(e){return e&&`current`in e?e.current:e},um=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dm=function(e){return`
|
|
48
48
|
.block-interactivity-${e} {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
-
`},fm=0,pm=[];function mm(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(fm++)[0],a=m.useState(Ip)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fp([e.lockRef.current],(e.shards||[]).map(lm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sm(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=em(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=em(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return om(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(pm.length&&pm[pm.length-1]===a){var r=`deltaY`in n?cm(n):sm(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&um(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(lm).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:hm(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=sm(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,cm(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,sm(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return pm.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Yp),document.addEventListener(`touchmove`,c,Yp),document.addEventListener(`touchstart`,u,Yp),function(){pm=pm.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Yp),document.removeEventListener(`touchmove`,c,Yp),document.removeEventListener(`touchstart`,u,Yp)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:dm(i)}):null,p?m.createElement(Kp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hm(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gm=Ep(Dp,mm),_m=m.forwardRef(function(e,t){return m.createElement(kp,up({},e,{ref:t,sideCar:gm}))});_m.classNames=kp.classNames;var vm=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},ym=new WeakMap,bm=new WeakMap,xm={},Sm=0,Cm=function(e){return e&&(e.host||Cm(e.parentNode))},eee=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Cm(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},tee=function(e,t,n,r){var i=eee(t,Array.isArray(e)?e:[e]);xm[n]||(xm[n]=new WeakMap);var a=xm[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(ym.get(e)||0)+1,l=(a.get(e)||0)+1;ym.set(e,c),a.set(e,l),o.push(e),c===1&&i&&bm.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Sm++,function(){o.forEach(function(e){var t=ym.get(e)-1,i=a.get(e)-1;ym.set(e,t),a.set(e,i),t||(bm.has(e)||e.removeAttribute(r),bm.delete(e)),i||e.removeAttribute(n)}),Sm--,Sm||(ym=new WeakMap,ym=new WeakMap,bm=new WeakMap,xm={})}},wm=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||vm(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),tee(r,i,n,`aria-hidden`)):function(){return null}},nee=Object.defineProperty,Tm=(e,t)=>nee(e,`name`,{value:t,configurable:!0}),Em=`Dialog`,[Dm,ree]=yd(Em),[iee,Om]=Dm(Em),km=Tm(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=Zd({prop:r,defaultProp:i??!1,onChange:a,caller:Em}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(iee,{scope:t,triggerRef:s,contentRef:c,contentId:gf(),titleId:gf(),descriptionId:gf(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:g,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Am=`DialogPortal`,[aee,jm]=Dm(Am,{forceMount:void 0}),Mm=Tm(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Om(Am,t);return(0,h.jsx)(aee,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(of,{present:n||a.open,children:(0,h.jsx)(np,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Nm=`DialogOverlay`,Pm=m.forwardRef(Tm(function(e,t){let n=jm(Nm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Om(Nm,e.__scopeDialog);return a.modal?(0,h.jsx)(of,{present:r||a.open,children:(0,h.jsx)(Fm,{...i,ref:t})}):null},`DialogOverlay`)),oee=Zu(`DialogOverlay.RemoveScroll`),Fm=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,...r}=e,i=Om(Nm,n),a=Ju(t,Mf());return(0,h.jsx)(_m,{as:oee,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(md.div,{"data-state":Gm(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Im=`DialogContent`,Lm=m.forwardRef(Tm(function(e,t){let n=jm(Im,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Om(Im,e.__scopeDialog);return(0,h.jsx)(of,{present:r||a.open,children:a.modal?(0,h.jsx)(Rm,{...i,ref:t}):(0,h.jsx)(zm,{...i,ref:t})})},`DialogContent`)),Rm=m.forwardRef(Tm(function(e,t){let n=Om(Im,e.__scopeDialog),r=m.useRef(null),i=Ju(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return wm(e)},[]),(0,h.jsx)(Bm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ld(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ld(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Ld(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),zm=m.forwardRef(Tm(function(e,t){let n=Om(Im,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(Bm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Bm=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Om(Im,n);return cp(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(Uf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(jf,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Gm(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Vm=`DialogTitle`,Hm=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,...r}=e,i=Om(Vm,n),{setTitleCount:a}=i;return Hd(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(md.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Um=`DialogDescription`,see=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,...r}=e,i=Om(Um,n),{setDescriptionCount:a}=i;return Hd(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(md.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),cee=`DialogClose`,Wm=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,...r}=e,i=Om(cee,n);return(0,h.jsx)(md.button,{type:`button`,...r,ref:t,onClick:Ld(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Gm(e){return e?`open`:`closed`}Tm(Gm,`getState`);var Km=Object.defineProperty,qm=(e,t)=>Km(e,`name`,{value:t,configurable:!0});function Jm(e){let[t,n]=m.useState(void 0);return Hd(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}qm(Jm,`useSize`);var Ym=[`top`,`right`,`bottom`,`left`],Xm=Math.min,Zm=Math.max,Qm=Math.round,$m=Math.floor,eh=e=>({x:e,y:e}),th={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function nh(e,t,n){return Zm(e,Xm(t,n))}function rh(e,t){return typeof e==`function`?e(t):e}function ih(e){return e.split(`-`)[0]}function ah(e){return e.split(`-`)[1]}function oh(e){return e===`x`?`y`:`x`}function sh(e){return e===`y`?`height`:`width`}function ch(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function lh(e){return oh(ch(e))}function uh(e,t,n){n===void 0&&(n=!1);let r=ah(e),i=lh(e),a=sh(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=hh(o)),[o,hh(o)]}function dh(e){let t=hh(e);return[fh(e),t,fh(t)]}function fh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ph=[`left`,`right`],mh=[`right`,`left`],lee=[`top`,`bottom`],uee=[`bottom`,`top`];function dee(e,t,n){switch(e){case`top`:case`bottom`:return n?t?mh:ph:t?ph:mh;case`left`:case`right`:return t?lee:uee;default:return[]}}function fee(e,t,n,r){let i=ah(e),a=dee(ih(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(fh)))),a}function hh(e){let t=ih(e);return th[t]+e.slice(t.length)}function pee(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function gh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:pee(e)}function _h(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function vh(e,t,n){let{reference:r,floating:i}=e,a=ch(t),o=lh(t),s=sh(o),c=ih(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=ah(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function mee(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=rh(t,e),p=gh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_h(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=_h(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var hee=50,gee=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mee},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=vh(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<hee&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=vh(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},yh=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=rh(e,t)||{};if(l==null)return{};let d=gh(u),f={x:n,y:r},p=lh(i),m=sh(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Xm(d[_],T),D=Xm(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=nh(E,k,O),ee=!c.arrow&&ah(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,te=ee?k<E?k-E:k-O:0;return{[p]:f[p]+te,data:{[p]:A,centerOffset:k-A-te,...ee&&{alignmentOffset:te}},reset:ee}}}),bh=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=rh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ih(r),_=ch(o),v=ih(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[hh(o)]:dh(o)),x=p!==`none`;!d&&x&&b.push(...fee(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=uh(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===ch(t)||T.every(e=>ch(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=ch(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function xh(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Sh(e){return Ym.some(t=>e[t]>=0)}var Ch=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=rh(e,t);switch(i){case`referenceHidden`:{let e=xh(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Sh(e)}}}case`escaped`:{let e=xh(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Sh(e)}}}default:return{}}}}},wh=new Set([`left`,`top`]);async function Th(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ih(n),s=ah(n),c=ch(n)===`y`,l=wh.has(o)?-1:1,u=a&&c?-1:1,d=rh(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Eh=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Th(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Dh=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=rh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ch(i),p=oh(f),m=u[p],h=u[f],g=(e,t)=>nh(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Oh=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=rh(e,t),u={x:n,y:r},d=ch(i),f=oh(d),p=u[f],m=u[d],h=rh(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=wh.has(ih(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},kh=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=rh(e,t),c=await i.detectOverflow(t,s),l=ih(n),u=ah(n),d=ch(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Xm(p-c[m],g),y=Xm(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Zm(c.left,c.right):S=p-2*Zm(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ah(){return typeof window<`u`}function jh(e){return Ph(e)?(e.nodeName||``).toLowerCase():`#document`}function Mh(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nh(e){return((Ph(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ph(e){return Ah()?e instanceof Node||e instanceof Mh(e).Node:!1}function Fh(e){return Ah()?e instanceof Element||e instanceof Mh(e).Element:!1}function Ih(e){return Ah()?e instanceof HTMLElement||e instanceof Mh(e).HTMLElement:!1}function Lh(e){return!Ah()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Mh(e).ShadowRoot}function Rh(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Yh(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function zh(e){return/^(table|td|th)$/.test(jh(e))}function Bh(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Vh=/transform|translate|scale|rotate|perspective|filter/,Hh=/paint|layout|strict|content/,Uh=e=>!!e&&e!==`none`,Wh;function Gh(e){let t=Fh(e)?Yh(e):e;return Uh(t.transform)||Uh(t.translate)||Uh(t.scale)||Uh(t.rotate)||Uh(t.perspective)||!qh()&&(Uh(t.backdropFilter)||Uh(t.filter))||Vh.test(t.willChange||``)||Hh.test(t.contain||``)}function Kh(e){let t=Zh(e);for(;Ih(t)&&!Jh(t);){if(Gh(t))return t;if(Bh(t))return null;t=Zh(t)}return null}function qh(){return Wh??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Wh}function Jh(e){return/^(html|body|#document)$/.test(jh(e))}function Yh(e){return Mh(e).getComputedStyle(e)}function Xh(e){return Fh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zh(e){if(jh(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Lh(e)&&e.host||Nh(e);return Lh(t)?t.host:t}function Qh(e){let t=Zh(e);return Jh(t)?(e.ownerDocument||e).body:Ih(t)&&Rh(t)?t:Qh(t)}function $h(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Qh(e),i=r===e.ownerDocument?.body,a=Mh(r);if(i){let e=eg(a);return t.concat(a,a.visualViewport||[],Rh(r)?r:[],e&&n?$h(e):[])}return t.concat(r,$h(r,[],n))}function eg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tg(e){let t=Yh(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ih(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Qm(n)!==a||Qm(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ng(e){return Fh(e)?e:e.contextElement}function rg(e){let t=ng(e);if(!Ih(t))return eh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=tg(t),o=(a?Qm(n.width):n.width)/r,s=(a?Qm(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ig=eh(0);function ag(e){let t=Mh(e);return!qh()||!t.visualViewport?ig:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function og(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Mh(e)}function sg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ng(e),o=eh(1);t&&(r?Fh(r)&&(o=rg(r)):o=rg(e));let s=og(a,n,r)?ag(a):eh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Mh(a),t=Fh(r)?Mh(r):r,n=e,i=eg(n);for(;i&&t!==n;){let e=rg(i),t=i.getBoundingClientRect(),r=Yh(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Mh(i),i=eg(n)}}return _h({width:u,height:d,x:c,y:l})}function cg(e,t){let n=Xh(e).scrollLeft;return t?t.left+n:sg(Nh(e)).left+n}function lg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-cg(e,n),y:n.top+t.scrollTop}}function ug(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Nh(r),s=t?Bh(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=eh(1),u=eh(0),d=Ih(r);if((d||!a)&&((jh(r)!==`body`||Rh(o))&&(c=Xh(r)),d)){let e=sg(r);l=rg(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?lg(o,c):eh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function dg(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function fg(e){let t=Xh(e),n=e.ownerDocument.body,r=Zm(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Zm(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+cg(e),o=-t.scrollTop;return Yh(n).direction===`rtl`&&(a+=Zm(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var pg=25;function mg(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Mh(e),a=Nh(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!qh()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(cg(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=pg&&(s-=o)}return{width:s,height:c,x:l,y:u}}function hg(e,t){let n=sg(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=rg(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function gg(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=mg(e,n,t);else if(t===`document`)r=fg(Nh(e));else if(Fh(t))r=hg(t,n);else{let n=ag(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _h(r)}function _g(e,t){let n=t.get(e);if(n)return n;let r=$h(e,[],!1).filter(e=>Fh(e)&&jh(e)!==`body`),i=null,a=Yh(e).position===`fixed`,o=a?Zh(e):e;for(;Fh(o)&&!Jh(o);){let e=Yh(o),t=Gh(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Zh(o)}return t.set(e,r),r}function vg(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Bh(t)?[]:_g(t,this._c):[].concat(n),r],o=gg(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=gg(t,a[e],i);s=Zm(n.top,s),c=Xm(n.right,c),l=Xm(n.bottom,l),u=Zm(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function yg(e){let{width:t,height:n}=tg(e);return{width:t,height:n}}function bg(e,t,n){let r=Ih(t),i=Nh(t),a=n===`fixed`,o=sg(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=eh(0);if((r||!a)&&((jh(t)!==`body`||Rh(i))&&(s=Xh(t)),r)){let e=sg(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=cg(i));let l=i&&!r&&!a?lg(i,s):eh(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function xg(e){return Yh(e).position===`static`}function Sg(e,t){if(!Ih(e)||Yh(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Nh(e)===n&&(n=n.ownerDocument.body),n}function Cg(e,t){let n=Mh(e);if(Bh(e))return n;if(!Ih(e)){let t=Zh(e);for(;t&&!Jh(t);){if(Fh(t)&&!xg(t))return t;t=Zh(t)}return n}let r=Sg(e,t);for(;r&&zh(r)&&xg(r);)r=Sg(r,t);return r&&Jh(r)&&xg(r)&&!Gh(r)?n:r||Kh(e)||n}var wg=async function(e){let t=this.getOffsetParent||Cg,n=this.getDimensions,r=await n(e.floating);return{reference:bg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tg(e){return Yh(e).direction===`rtl`}var Eg={convertOffsetParentRelativeRectToViewportRelativeRect:ug,getDocumentElement:Nh,getClippingRect:vg,getOffsetParent:Cg,getElementRects:wg,getClientRects:dg,getDimensions:yg,getScale:rg,isElement:Fh,isRTL:Tg};function Dg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Og(e,t,n){let r=null,i,a=Nh(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=$m(d),h=$m(a.clientWidth-(u+f)),g=$m(a.clientHeight-(d+p)),_=$m(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Zm(0,Xm(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Dg(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Mh(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function kg(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ng(e),u=i||a?[...l?$h(l):[],...t?$h(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Og(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?sg(e):null;c&&g();function g(){let t=sg(e);h&&!Dg(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ag=Eh,jg=Dh,Mg=bh,Ng=kh,Pg=Ch,Fg=yh,Ig=Oh,Lg=(e,t,n)=>{let r=new Map,i=n??{},a={...Eg,...i.platform,_c:r};return gee(e,t,{...i,platform:a})},Rg=typeof document<`u`?m.useLayoutEffect:function(){};function zg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!zg(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!zg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Bg(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vg(e,t){let n=Bg(e);return Math.round(t*n)/n}function Hg(e){let t=m.useRef(e);return Rg(()=>{t.current=e}),t}function Ug(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);zg(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=Hg(c),O=Hg(i),k=Hg(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Lg(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};ee.current&&!zg(T.current,t)&&(T.current=t,dd.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Rg(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ee=m.useRef(!1);Rg(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Rg(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let te=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),ne=m.useMemo(()=>({reference:x,floating:S}),[x,S]),j=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!ne.floating)return e;let t=Vg(ne.floating,u.x),r=Vg(ne.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Bg(ne.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ne.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:te,elements:ne,floatingStyles:j}),[u,A,te,ne,j])}var Wg=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Fg({element:r.current,padding:i}).fn(n):r?Fg({element:r,padding:i}).fn(n):{}}}},Gg=(e,t)=>{let n=Ag(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kg=(e,t)=>{let n=jg(e);return{name:n.name,fn:n.fn,options:[e,t]}},qg=(e,t)=>({fn:Ig(e).fn,options:[e,t]}),Jg=(e,t)=>{let n=Mg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yg=(e,t)=>{let n=Ng(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xg=(e,t)=>{let n=Pg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zg=(e,t)=>{let n=Wg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qg=Object.defineProperty,$g=(e,t)=>Qg(e,`name`,{value:t,configurable:!0}),e_=`Popper`,[t_,n_]=yd(e_),[_ee,r_]=t_(e_),vee=$g(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(_ee,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),yee=`PopperAnchor`,bee=m.forwardRef($g(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=r_(yee,n),o=m.useRef(null),s=a.onAnchorChange,c=Ju(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&o_(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(md.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),i_=`PopperContent`,[xee,See]=t_(i_),Cee=m.forwardRef($g(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:g,..._}=e,v=r_(i_,n),[y,b]=m.useState(null),x=Ju(t,b),[S,C]=m.useState(null),w=Jm(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,ee={padding:O,boundary:k.filter(a_),altBoundary:A},{refs:te,floatingStyles:ne,placement:j,isPositioned:re,middlewareData:M}=Ug({strategy:`fixed`,placement:D,whileElementsMounted:$g((...e)=>kg(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[Gg({mainAxis:i+E,alignmentAxis:o}),c&&Kg({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?qg():void 0,...ee}),c&&Jg({...ee}),Yg({...ee,apply:$g(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&Zg({element:S,padding:s}),wee({arrowWidth:T,arrowHeight:E}),f&&Xg({strategy:`referenceHidden`,...ee,boundary:A?ee.boundary:void 0})]}),ie=v.setPlacementState;Hd(()=>(ie(j),()=>{ie(void 0)}),[j,ie]);let[ae,oe]=o_(j),se=Cf(g);Hd(()=>{re&&se?.()},[re,se]);let ce=M.arrow?.x,le=M.arrow?.y,ue=M.arrow?.centerOffset!==0,[de,fe]=m.useState();return Hd(()=>{y&&fe(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:re?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(xee,{scope:n,placedSide:ae,placedAlign:oe,onArrowChange:C,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,h.jsx)(md.div,{"data-side":ae,"data-align":oe,..._,ref:x,style:{..._.style,animation:re?_.style?.animation:`none`}})})})},`PopperContent`));function a_(e){return e!==null}$g(a_,`isNotNull`);var wee=$g(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=o_(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function o_(e){let[t,n=`center`]=e.split(`-`);return[t,n]}$g(o_,`getSideAndAlignFromPlacement`);var s_=vee,c_=bee,l_=Cee,Tee=Object.defineProperty,u_=(e,t)=>Tee(e,`name`,{value:t,configurable:!0}),d_=!1;function f_(){let[e,t]=m.useState(d_);return m.useEffect(()=>{d_||(d_=!0,t(!0))},[]),e}u_(f_,`useIsHydrated`);var p_=m.useSyncExternalStore;function m_(){return()=>{}}u_(m_,`subscribe`);function h_(){return p_(m_,()=>!0,()=>!1)}u_(h_,`useIsHydratedModern`);var Eee=typeof p_==`function`?h_:f_,Dee=Object.defineProperty,g_=(e,t)=>Dee(e,`name`,{value:t,configurable:!0}),__=`rovingFocusGroup.onEntryFocus`,Oee={bubbles:!1,cancelable:!0},v_=`RovingFocusGroup`,[y_,b_,kee]=Cd(v_),[Aee,x_]=yd(v_,[kee]),[jee,Mee]=Aee(v_),Nee=m.forwardRef(g_(function(e,t){return(0,h.jsx)(y_.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(y_.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Pee,{...e,ref:t})})})},`RovingFocusGroup`)),Pee=m.forwardRef(g_(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=Ju(t,f),g=bf(a),[_,v]=Zd({prop:o,defaultProp:s??null,onChange:c,caller:v_}),[y,b]=m.useState(!1),x=Cf(l),S=b_(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(__,x),()=>e.removeEventListener(__,x)},[x]),(0,h.jsx)(jee,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:m.useCallback(e=>v(e),[v]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>T(e=>e-1),[]),children:(0,h.jsx)(md.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Ld(e.onMouseDown,()=>{C.current=!0}),onFocus:Ld(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(__,Oee);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);w_([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:Ld(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Fee=`RovingFocusGroupItem`,Iee=m.forwardRef(g_(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=gf(),l=a||c,u=Mee(Fee,n),d=u.currentTabStopId===l,f=b_(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=Eee();return Hd(()=>{if(v&&r)return p(),()=>g()},[v,r,p,g]),m.useEffect(()=>{if(!v&&r)return p(),()=>g()},[v,r,p,g]),(0,h.jsx)(y_.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(md.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Ld(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Ld(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Ld(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=C_(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?T_(n,r+1):n.slice(r+1)}setTimeout(()=>w_(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Lee={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function S_(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}g_(S_,`getDirectionAwareKey`);function C_(e,t,n){let r=S_(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Lee[r]}g_(C_,`getFocusIntent`);function w_(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}g_(w_,`focusFirst`);function T_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}g_(T_,`wrapArray`);var E_=Nee,D_=Iee,Ree=Object.defineProperty,O_=(e,t)=>Ree(e,`name`,{value:t,configurable:!0}),k_=[`Enter`,` `],zee=[`ArrowDown`,`PageUp`,`Home`],A_=[`ArrowUp`,`PageDown`,`End`],Bee=[...zee,...A_];[...k_],[...k_];var j_=`Menu`,[M_,Vee,Hee]=Cd(j_),[N_,P_]=yd(j_,[Hee,n_,x_]),F_=n_(),I_=x_(),[Uee,L_]=N_(j_),[Wee,R_]=N_(j_),Gee=O_(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=F_(t),[c,l]=m.useState(null),u=m.useRef(!1),d=Cf(a),f=bf(i);return m.useEffect(()=>{let e=O_(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=O_(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;let e=O_(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,h.jsx)(s_,{...s,children:(0,h.jsx)(Uee,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(Wee,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Kee=m.forwardRef(O_(function(e,t){let{__scopeMenu:n,...r}=e,i=F_(n);return(0,h.jsx)(c_,{...i,...r,ref:t})},`MenuAnchor`)),z_=`MenuPortal`,[qee,Jee]=N_(z_,{forceMount:void 0}),Yee=O_(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=L_(z_,t);return(0,h.jsx)(qee,{scope:t,forceMount:n,children:(0,h.jsx)(of,{present:n||a.open,children:(0,h.jsx)(np,{asChild:!0,container:i,children:r})})})},`MenuPortal`),B_=`MenuContent`,[Xee,V_]=N_(B_),Zee=m.forwardRef(O_(function(e,t){let n=Jee(B_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=L_(B_,e.__scopeMenu),o=R_(B_,e.__scopeMenu);return(0,h.jsx)(M_.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(of,{present:r||a.open,children:(0,h.jsx)(M_.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(Qee,{...i,ref:t}):(0,h.jsx)(H_,{...i,ref:t})})})})},`MenuContent`)),Qee=m.forwardRef(O_(function(e,t){let n=L_(B_,e.__scopeMenu),r=m.useRef(null),i=Ju(t,r);return m.useEffect(()=>{let e=r.current;if(e)return wm(e)},[]),(0,h.jsx)(W_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ld(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),H_=m.forwardRef(O_(function(e,t){let n=L_(B_,e.__scopeMenu);return(0,h.jsx)(W_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),U_=Zu(`MenuContent.ScrollLock`),W_=m.forwardRef(O_(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,..._}=e,v=L_(B_,n),y=R_(B_,n),b=F_(n),x=I_(n),S=Vee(n),[C,w]=m.useState(null),T=m.useRef(null),E=Ju(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),A=m.useRef(null),ee=m.useRef(`right`),te=m.useRef(0),ne=g?_m:m.Fragment,j=g?{as:U_,allowPinchZoom:!0}:void 0,re=O_(e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Q_(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;O_((function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);m.useEffect(()=>()=>window.clearTimeout(D.current),[]),cp();let M=m.useCallback(e=>ee.current===A.current?.side&&ev(e,A.current?.area),[]);return(0,h.jsx)(Xee,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:m.useCallback(e=>{M(e)||(T.current?.focus(),w(null))},[M]),onTriggerLeave:m.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{A.current=e},[]),children:(0,h.jsx)(ne,{...j,children:(0,h.jsx)(Uf,{asChild:!0,trapped:i,onMountAutoFocus:Ld(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(jf,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)(E_,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:Ld(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(l_,{role:`menu`,"aria-orientation":`vertical`,"data-state":J_(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:Ld(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&re(e.key));let i=T.current;if(e.target!==i||!Bee.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);A_.includes(e.key)&&a.reverse(),X_(a)}),onBlur:Ld(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:Ld(e.onPointerMove,tv(e=>{let t=e.target,n=te.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>te.current?`right`:`left`;ee.current=t,te.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),G_=`MenuItem`,K_=`menu.itemSelect`,$ee=m.forwardRef(O_(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=R_(G_,e.__scopeMenu),s=V_(G_,e.__scopeMenu),c=Ju(t,a),l=m.useRef(!1),u=O_(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(K_,{bubbles:!0,cancelable:!0});e.addEventListener(K_,e=>r?.(e),{once:!0}),hd(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(ete,{...i,ref:c,disabled:n,onClick:Ld(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Ld(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Ld(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&k_.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),ete=m.forwardRef(O_(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=V_(G_,n),s=I_(n),c=m.useRef(null),l=Ju(t,c),[u,d]=m.useState(!1),[f,p]=m.useState(``);return m.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,h.jsx)(M_.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(D_,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(md.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Ld(e.onPointerMove,tv(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ld(e.onPointerLeave,tv(e=>o.onItemLeave(e))),onFocus:Ld(e.onFocus,()=>d(!0)),onBlur:Ld(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[tte,nte]=N_(`MenuRadioGroup`,{value:void 0,onValueChange:O_(()=>{},`onValueChange`)}),[rte,ite]=N_(`MenuItemIndicator`,{checked:!1}),q_=m.forwardRef(O_(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(md.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[ate,ote]=N_(`MenuSub`);function J_(e){return e?`open`:`closed`}O_(J_,`getOpenState`);function Y_(e){return e===`indeterminate`}O_(Y_,`isIndeterminate`);function ste(e){return Y_(e)?`indeterminate`:e?`checked`:`unchecked`}O_(ste,`getCheckedState`);function X_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}O_(X_,`focusFirst`);function Z_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}O_(Z_,`wrapArray`);function Q_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Z_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}O_(Q_,`getNextMatch`);function $_(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}O_($_,`isPointInPolygon`);function ev(e,t){return t?$_({x:e.clientX,y:e.clientY},t):!1}O_(ev,`isPointerInGraceArea`);function tv(e){return t=>t.pointerType===`mouse`?e(t):void 0}O_(tv,`whenMouse`);var nv=Gee,rv=Kee,iv=Yee,av=Zee,ov=$ee,sv=q_,cv=Object.defineProperty,lv=(e,t)=>cv(e,`name`,{value:t,configurable:!0}),uv=`DropdownMenu`,[dv,cte]=yd(uv,[P_]),fv=P_(),[pv,mv]=dv(uv),hv=lv(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=fv(t),l=m.useRef(null),[u,d]=Zd({prop:i,defaultProp:a??!1,onChange:o,caller:uv});return(0,h.jsx)(pv,{scope:t,triggerId:gf(),triggerRef:l,contentId:gf(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(nv,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),gv=`DropdownMenuTrigger`,_v=m.forwardRef(lv(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=mv(gv,n),o=fv(n),s=Ju(t,a.triggerRef);return(0,h.jsx)(rv,{asChild:!0,...o,children:(0,h.jsx)(md.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:Ld(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Ld(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),vv=lv(e=>{let{__scopeDropdownMenu:t,...n}=e,r=fv(t);return(0,h.jsx)(iv,{...r,...n})},`DropdownMenuPortal`),yv=`DropdownMenuContent`,bv=m.forwardRef(lv(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=mv(yv,n),a=fv(n),o=m.useRef(!1);return(0,h.jsx)(av,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Ld(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Ld(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),xv=m.forwardRef(lv(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=fv(n);return(0,h.jsx)(ov,{...i,...r,ref:t})},`DropdownMenuItem`)),Sv=m.forwardRef(lv(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=fv(n);return(0,h.jsx)(sv,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Cv=hv,wv=_v,Tv=vv,Ev=bv,Dv=xv,Ov=Sv,kv=Object.defineProperty,Av=m.forwardRef(((e,t)=>kv(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,h.jsx)(md.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),jv=Object.defineProperty,Mv=(e,t)=>jv(e,`name`,{value:t,configurable:!0}),Nv=`Popover`,[Pv,lte]=yd(Nv,[n_]),Fv=n_(),[Iv,Lv]=Pv(Nv),Rv=Mv(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Fv(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=Zd({prop:r,defaultProp:i??!1,onChange:a,caller:Nv});return(0,h.jsx)(s_,{...s,children:(0,h.jsx)(Iv,{scope:t,contentId:gf(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),ute=`PopoverAnchor`,dte=m.forwardRef(Mv(function(e,t){let{__scopePopover:n,...r}=e,i=Lv(ute,n),a=Fv(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(o(),()=>s()),[o,s]),(0,h.jsx)(c_,{...a,...r,ref:t})},`PopoverAnchor`)),fte=`PopoverTrigger`,pte=m.forwardRef(Mv(function(e,t){let{__scopePopover:n,...r}=e,i=Lv(fte,n),a=Fv(n),o=Ju(t,i.triggerRef),s=(0,h.jsx)(md.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Hv(i.open),...r,ref:o,onClick:Ld(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(c_,{asChild:!0,...a,children:s})},`PopoverTrigger`)),zv=`PopoverPortal`,[mte,hte]=Pv(zv,{forceMount:void 0}),gte=Mv(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Lv(zv,t);return(0,h.jsx)(mte,{scope:t,forceMount:n,children:(0,h.jsx)(of,{present:n||a.open,children:(0,h.jsx)(np,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Bv=`PopoverContent`,_te=m.forwardRef(Mv(function(e,t){let n=hte(Bv,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Lv(Bv,e.__scopePopover);return(0,h.jsx)(of,{present:r||a.open,children:a.modal?(0,h.jsx)(yte,{...i,ref:t}):(0,h.jsx)(bte,{...i,ref:t})})},`PopoverContent`)),vte=Zu(`PopoverContent.RemoveScroll`),yte=m.forwardRef(Mv(function(e,t){let n=Lv(Bv,e.__scopePopover),r=m.useRef(null),i=Ju(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return wm(e)},[]),(0,h.jsx)(_m,{as:vte,allowPinchZoom:!0,children:(0,h.jsx)(Vv,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ld(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ld(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Ld(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),bte=m.forwardRef(Mv(function(e,t){let n=Lv(Bv,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(Vv,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Vv=m.forwardRef(Mv(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Lv(Bv,n),p=Fv(n);return cp(),(0,h.jsx)(Uf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(jf,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(l_,{"data-state":Hv(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`)),xte=`PopoverClose`,Ste=m.forwardRef(Mv(function(e,t){let{__scopePopover:n,...r}=e,i=Lv(xte,n);return(0,h.jsx)(md.button,{type:`button`,...r,ref:t,onClick:Ld(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function Hv(e){return e?`open`:`closed`}Mv(Hv,`getState`);var Cte=Rv,wte=dte,Tte=pte,Ete=gte,Dte=_te,Ote=Ste,kte=Object.defineProperty,Uv=(e,t)=>kte(e,`name`,{value:t,configurable:!0}),Wv=`Toggle`,Gv=m.forwardRef(Uv(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=Zd({prop:n,onChange:i,defaultProp:r??!1,caller:Wv});return(0,h.jsx)(md.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:Ld(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Kv=Object.defineProperty,qv=(e,t)=>Kv(e,`name`,{value:t,configurable:!0}),Jv=`ToggleGroup`,[Yv,Ate]=yd(Jv,[x_]),Xv=x_(),Zv=m.forwardRef(qv(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(ey,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(ty,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${Jv}\``)},`ToggleGroup`)),[Qv,$v]=Yv(Jv),ey=m.forwardRef(qv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=qv(()=>{},`onValueChange`),...a}=e,[o,s]=Zd({prop:n,defaultProp:r??``,onChange:i,caller:Jv});return(0,h.jsx)(Qv,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(iy,{...a,ref:t})})},`ToggleGroupImplSingle`)),ty=m.forwardRef(qv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=qv(()=>{},`onValueChange`),...a}=e,[o,s]=Zd({prop:n,defaultProp:r??[],onChange:i,caller:Jv}),c=m.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=m.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,h.jsx)(Qv,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,h.jsx)(iy,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[ny,ry]=Yv(Jv),iy=m.forwardRef(qv(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=Xv(n),u=bf(o),d={dir:u,...c};return(0,h.jsx)(ny,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)(E_,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,h.jsx)(md.div,{...d,ref:t})}):(0,h.jsx)(md.div,{...d,ref:t})})},`ToggleGroupImpl`)),ay=`ToggleGroupItem`,oy=m.forwardRef(qv(function(e,t){let n=$v(ay,e.__scopeToggleGroup),r=ry(ay,e.__scopeToggleGroup),i=Xv(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=m.useRef(null);return r.rovingFocus?(0,h.jsx)(D_,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(sy,{...s,ref:t})}):(0,h.jsx)(sy,{...s,ref:t})},`ToggleGroupItem`)),sy=m.forwardRef(qv(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=$v(ay,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,h.jsx)(Gv,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`));function cy({variant:e=`secondary`,size:t=`default`}={}){return I(`sl-btn`,`sl-btn--${e}`,t===`small`&&`sl-btn--small`)}function L({variant:e=`secondary`,size:t=`default`,disabledReason:n,className:r,type:i,title:a,...o}){return(0,h.jsx)(`button`,{"data-slot":`button`,"data-variant":e,type:i??`button`,title:o.disabled&&n!==void 0?n:a,className:I(cy({variant:e,size:t}),r),...o})}function ly({label:e,tip:t,title:n,children:r,...i}){let a=t===void 0||t===!1?void 0:t===!0?e:t;return(0,h.jsx)(L,{variant:`icon`,"aria-label":e,...a===void 0?{title:n??e}:{"data-tip":a},...i,children:r})}function uy({className:e,asChild:t=!1,type:n,...r}){let i=t?Qu:`button`;return(0,h.jsx)(i,{"data-slot":`play-key`,...t?{}:{type:n??`button`},className:I(`sl-key`,e),...r})}function dy({className:e,...t}){return(0,h.jsx)(`div`,{className:I(`sl-btn-row`,e),...t})}var fy=4e3,py=8e3,my=(0,m.createContext)(void 0);function hy({children:e}){let[t,n]=(0,m.useState)([]),r=(0,m.useRef)(0),i=(0,m.useRef)(new Map),a=(0,m.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t!==void 0&&clearTimeout(t),i.current.delete(e)},[]),o=(0,m.useCallback)((e,t=`info`,o)=>{r.current+=1;let s=r.current;n(n=>[...n.filter(t=>t.message!==e).slice(-2),{id:s,message:e,tone:t,action:o}]),i.current.set(s,setTimeout(()=>a(s),o===void 0?fy:py))},[a]);(0,m.useEffect)(()=>{let e=i.current;return()=>{for(let t of e.values())clearTimeout(t)}},[]);let s=(0,m.useMemo)(()=>o,[o]);return(0,h.jsxs)(my.Provider,{value:s,children:[e,(0,h.jsx)(`section`,{"aria-label":`Notifications`,className:`sl-toasts`,children:t.map(e=>(0,h.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"data-tone":e.tone,className:I(`sl-toast sl-enter`,e.tone===`error`&&`sl-toast--failed`,e.tone===`success`&&`sl-toast--done`),children:[e.tone===`error`?(0,h.jsx)(el,{"aria-hidden":`true`,strokeWidth:1.75}):e.tone===`success`?(0,h.jsx)(Sc,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(Ic,{"aria-hidden":`true`,strokeWidth:1.75,className:`text-ink-2`}),(0,h.jsx)(`p`,{className:`sl-toast__text m-0 min-w-0 break-words`,children:e.message}),e.action===void 0?null:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:()=>{a(e.id),e.action?.run()},children:e.action.label}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Dismiss notification`,onClick:()=>a(e.id),className:`sl-btn sl-btn--icon sl-btn--small -mr-1 w-[30px]`,children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]},e.id))})]})}function gy(){return(0,m.useContext)(my)??_y}function _y(){}var vy=(0,m.createContext)(void 0);function yy({deps:e,children:t}){return(0,h.jsx)(vy.Provider,{value:e,children:(0,h.jsx)(hy,{children:t})})}function R(){let e=(0,m.useContext)(vy);if(e===void 0)throw Error(`useApp was called outside AppProvider`);return e}var by=km,xy=Mm;function Sy({className:e,...t}){return(0,h.jsx)(Pm,{"data-slot":`dialog-overlay`,className:I(`fixed inset-0 z-40 bg-scrim`,e),...t})}function Cy({className:e,children:t,...n}){return(0,h.jsxs)(xy,{children:[(0,h.jsx)(Sy,{}),(0,h.jsx)(Lm,{"data-slot":`dialog-content`,className:I(`sl-dialog fixed top-1/2 left-1/2 z-50 max-h-[calc(100vh-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`data-[state=open]:animate-dialog-in motion-reduce:animate-none`,e),...n,children:t})]})}function wy({className:e,...t}){return(0,h.jsx)(Hm,{"data-slot":`dialog-title`,className:I(`sl-dialog__title text-ink`,e),...t})}function Ty({className:e,...t}){return(0,h.jsx)(see,{"data-slot":`dialog-description`,className:I(`m-0 text-body text-ink-2`,e),...t})}function Ey({open:e,onOpenChange:t,title:n,description:r,footer:i,children:a,className:o,dismissible:s=!0}){return(0,h.jsx)(by,{open:e,...t===void 0?{}:{onOpenChange:t},children:(0,h.jsxs)(Cy,{className:o,...s?{}:{onEscapeKeyDown:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()},...r===void 0?{"aria-describedby":void 0}:{},children:[(0,h.jsx)(wy,{children:n}),r===void 0?null:(0,h.jsx)(Ty,{children:r}),a,i===void 0?null:(0,h.jsx)(`div`,{className:`sl-dialog__foot`,children:i})]})})}function Dy({open:e,title:t,consequence:n,confirmLabel:r,cancelLabel:i=`Cancel`,tone:a=`destructive`,pending:o=!1,onConfirm:s,onCancel:c}){return(0,h.jsx)(Ey,{open:e,onOpenChange:e=>{e||c()},title:t,description:n,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`secondary`,autoFocus:!0,onClick:c,children:i}),(0,h.jsx)(L,{variant:a,disabled:o,disabledReason:`Working on it`,onClick:s,children:r})]})})}var Oy=[`onboarding`],ky=[`onboarding`,`sample`],Ay=(e,t)=>[`narration-peaks`,e,t],jy=(e,t,n)=>e.fetch(`${e.origin}/api/onboarding${t}`,{method:`POST`,...n===void 0?{}:{headers:{"content-type":`application/json`},body:JSON.stringify(n)}});async function My(e){return F(await e.fetch(`${e.origin}/api/onboarding`))}async function Ny(e){await F(await jy(e,`/dismiss`))}async function Py(e,t){return F(await jy(e,`/packs/${encodeURIComponent(t)}`))}async function Fy(e,t){return F(await jy(e,`/short`,t))}async function Iy(e,t){return F(await jy(e,`/full-video`,t))}async function Ly(e){return F(await e.fetch(`${e.origin}/api/onboarding/sample`))}function Ry(e,t){return e!==void 0&&Object.values(e.samples).includes(t)}async function zy(e){return F(await jy(e,`/sample/restore`))}async function By(e,t=Vy()){return F(await jy(e,`/sample/copy`,t===void 0?void 0:{projectId:t}))}function Vy(){if(typeof window>`u`)return;let e=/\/projects\/([^/?#]+)/.exec(window.location.pathname);return e?.[1]===void 0?void 0:decodeURIComponent(e[1])}async function Hy(e,t){return F(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/narration/peaks`))}var z={projects:[`projects`],revisions:e=>[`project`,e,`revisions`],revision:(e,t)=>[`project`,e,`revision`,t],revisionFile:(e,t,n)=>[`revision-file`,e,t,n],project:e=>[`project`,e],runCost:e=>[`project`,e,`run-cost`],article:(e,t=null)=>[`project`,e,`article`,t],audioPreview:(e,t)=>[`audio-preview`,e,t],file:(e,t)=>[`file`,e,t],staging:[`staging`],notice:[`notice`],usage:[`usage`],providers:[`providers`],voices:[`voices`],prompts:[`prompts`],entries:[`entries`],documentThemes:[`document-themes`],narrationAliases:[`narration-aliases`],settings:[`settings`],youtubeEdits:e=>[`project`,e,`youtube-edits`],channelLinks:[`channel-links`],projectChannelLinks:e=>[`channel-links`,`project`,e]},Uy=15e3,Wy=new Set([`running`,`pending`]);function Gy(e){return ct({queryKey:z.projects,queryFn:()=>jo(e),refetchInterval:e=>e.state.data?.projects.some(e=>Wy.has(e.status))===!0&&Uy})}function Ky(e,t){return ct({queryKey:z.project(t),queryFn:()=>Mo(e,t),refetchInterval:e=>e.state.data!==void 0&&Wy.has(e.state.data.project.status)?Uy:!1})}function qy(e,t){return ct({queryKey:z.runCost(t),queryFn:()=>No(e,t)})}function Jy(e){return ct({queryKey:z.notice,queryFn:()=>Go(e)})}function Yy(e){return ct({queryKey:z.usage,queryFn:()=>Wo(e)})}function Xy(e){return ct({queryKey:z.providers,queryFn:()=>Jo(e)})}function Zy(e){return ct({queryKey:z.voices,queryFn:()=>Es(e)})}function Qy(e){return ct({queryKey:z.prompts,queryFn:()=>Ns(e)})}function $y(e){return ct({queryKey:z.entries,queryFn:()=>Gs(e)})}function eb(e){return ct({queryKey:z.documentThemes,queryFn:()=>qs(e)})}function jte(e){return ct({queryKey:z.narrationAliases,queryFn:()=>Qs(e)})}function tb(e){return ct({queryKey:z.settings,queryFn:()=>Qo(e)})}var Mte={"library.prompt.kind":{title:`Prompt kind`,body:`What the prompt is for, which decides where Play offers it. Article writes the video's text, Image and Thumbnail describe pictures, Narration Preparation adds delivery cues, YouTube Description writes the description, Shorts picks the short clips, Review checks a finished stage, Script writes speaker turns for several voices.`,tutorial:{page:`Prompts`,anchor:`prompt-kinds`}},"library.prompt.name":{title:`Prompt name`,body:`What Play and Edit project list this prompt by. Up to 200 characters, and unique within its kind. Templates remember a prompt by name, so after a rename they use the copy saved with them until you pick it again.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.article":{title:`Article prompt`,body:`The instruction the text model gets to write the video's article, which becomes the narration. Each {{keyword}} becomes a field on Play. One call on the project's LLM, plus up to 3 more when the answer runs out of room; research notes go first when research ran. The answer's sources and pronunciation sections are never narrated.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.image":{title:`Image prompt`,body:`Sent as written to the image model, with the keywords filled in; no text model rewrites it. Play sets how many pictures each prompt makes (1 to 20, at most 60 a run), and each picture is one image call. Pictures show for 15 s each by default and repeat until the video ends.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.thumbnail":{title:`Thumbnail prompt`,body:`Sent to the image model to draw the thumbnail. With Thumbnail set to Prompt by LLM, the text model first turns it into a picture prompt using the title and article, one extra call. 1 thumbnail by default, or 3: the second a close-up, the third a wider shot, each one image call.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.narration":{title:`Narration Preparation prompt`,body:`Tells the text model how the narration should be delivered. It only adds cues, such as a short speaking direction or a laugh or sigh, and never rewrites the words. One call each for the body, the intro and the outro. Works only with the Inworld TTS-2 voice model. With several speakers, each speaker on TTS-2 gets cues suited to their role.`,tutorial:{page:`Play-Narration`,anchor:`narration-preparation`}},"library.prompt.body.description":{title:`YouTube Description prompt`,body:`Tells the text model how to write the video's YouTube description, chapters, hashtags and tags from the timestamped transcript. One call per video. Each {{keyword}} becomes a field on Play. A project that picks none uses the Built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.shorts":{title:`Shorts prompt`,body:`Tells the text model which moments of the video to cut into vertical shorts (3 of 60 to 120 s by default). One call picks them, then one call per short writes its picture prompts, and each picture is one image call. A project that picks none uses the Built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.review":{title:`Review prompt`,body:`Tells the reviewer what to check in a finished article, set of images, narration, thumbnail or shorts, and when to flag or redo it. One reviewer call per item checked; pictures can only be judged by the Claude Code and Codex reviewers. A stage with none picked uses its own built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.script":{title:`Script prompt`,body:`Used in place of an Article prompt when a run has several voices and writes a script. The text model answers with # section headings and Name: words turns, one speaker per paragraph; text in [square brackets] is not spoken. One call on the project's LLM.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.starter":{title:`Starter text`,body:`Fills the body with ready-made text to start from: the documentary delivery cues for Narration Preparation, or the Built-in wording YouTube Description and Shorts use when no prompt is picked. When the body already has text you confirm first. Nothing is saved until you choose Save.`,tutorial:{page:`Prompts`,anchor:`start-from-ready-made-text`}},"library.prompt.photorealistic":{title:`Draws photorealistic pictures`,body:`Turn on when this prompt's style looks like real photos or film. Prepare upload then answers Yes to YouTube's AI use question (a realistic-looking scene that didn't happen) for videos and shorts drawn with it. Leave off for painterly or illustrated styles. Applies at once, apart from Save; a channel's Always Yes or Always No wins. Default: off.`,tutorial:{page:`Prompts`,anchor:`mark-an-image-prompt-as-photorealistic`}},"library.slots":{title:`Detected slots`,body:`Every {{keyword}} in the body, listed as you type. Each becomes one field on Play, typed once and filled into every prompt that names it. Names are case-sensitive, so {{Topic}} and {{topic}} are two fields. A keyword the project title also names is typed per video and saved empty in templates.`,tutorial:{page:`Prompts`,anchor:`keywords-slots`}},"library.used-by":{title:`Used by`,body:`The templates, schedules and projects that name this item, matched by name within its kind. For a project it says how many of its revisions used it and whether the current one does. Projects keep their own text, so editing here changes only runs started later.`,tutorial:{page:`Prompts`,anchor:`used-by`}},"library.history":{title:`History`,body:`Every save that changes the name or text adds a version, and every version is kept. Here you see the latest change with the changed words marked. Compare versions opens them all side by side, with Restore for an older one.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.history.compare":{title:`Compare versions`,body:`Pick any two saved versions to see them side by side, with the words that changed marked. Older and Newer can be any versions; a rename between them is said above the text.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.history.versions":{title:`Versions`,body:`Every saved version, newest first. Restore saves an older version again as a new version, so nothing after it is lost and History notes where it came from. Projects already made keep their text.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.entry.category":{title:`Intro or outro`,body:`An intro is narrated before the body of the video, an outro after it, in the same voice. Play offers each in its own picker. A name only needs to be unique within its category.`,tutorial:{page:`Intros-and-Outros`,anchor:`text-or-llm`}},"library.inline-rename":{title:`Rename in the list`,body:`Changes only the name, right in the list; the text stays as it is. Enter saves, Escape keeps the old name, and Undo on the notice renames it back. A prompt or intro/outro keeps the rename in History; templates that picked the old name use the copy saved with them until you pick it again. A template saves a new version; schedules keep the version they were made from.`,tutorial:{page:`Library-Overview`,anchor:`rename-in-the-row`}},"library.entry.name":{title:`Entry name`,body:`What Play and Edit project list this intro or outro by. Up to 200 characters, and unique within its category.`,tutorial:{page:`Intros-and-Outros`,anchor:`write-an-intro-or-outro`}},"library.entry.mode":{title:`Mode`,body:`Text is narrated as written, with the keywords filled in and no extra call. LLM sends the body as an instruction to the project's text model, with the title, keyword values and article, and narrates the answer: one call per entry, and the run then needs an LLM. Default: Text.`,tutorial:{page:`Intros-and-Outros`,anchor:`text-or-llm`}},"library.entry.body":{title:`Entry body`,body:`In Text mode, the words the narrator says; in LLM mode, the instruction whose answer is said. Each {{keyword}} becomes a field on Play. It is narrated as its own audio file with the run's voice, one voice request each.`,tutorial:{page:`Intros-and-Outros`,anchor:`write-an-intro-or-outro`}},"library.aliases":{title:`Narration aliases`,body:`Words the narrator says differently from how they are written, such as Dr. as Doctor. Only what the voice and Narration Preparation receive changes; the article and captions keep the written words. A project copies this list when it starts and uses it while Use narration aliases is on. Up to 1000 aliases, saved as a whole.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`narration-aliases`}},"library.aliases.written":{title:`Written`,body:`The word or phrase as it appears in the article, up to 200 characters. Spaces inside it match any spacing. Two aliases can't share a written form; where two overlap, the one starting first wins, then the longer.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.spoken":{title:`Say it as`,body:`What the narrator says instead, spelled the way it sounds, up to 500 characters. Only the audio changes. An alias wins over a Pronunciation Glossary entry for the same words.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.whole-word":{title:`Whole word`,body:`On: matches only where the written form stands as a word of its own, so it never fires inside a longer word. Off: matches inside other words too. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.match-case":{title:`Match case`,body:`On: matches only with the same capital letters, so US is not us. Off: capitals are ignored. Default: off.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"templates.show-channel":{title:`Show templates of`,body:`Shows only the templates of one channel, or of all. A template's channel is the one a draft made from it runs in. Choosing here changes nothing about the templates.`,tutorial:{page:`Templates`,anchor:`filter-by-channel`}},"templates.apply":{title:`Use in Play`,body:`Makes a new Play draft from the template and opens it in Play for you to review; nothing starts. Keywords the project title names start empty for this video's topic, and uploaded files keep their names but must be attached again. The template itself is unchanged.`,tutorial:{page:`Templates`,anchor:`use-a-template`}},"templates.save":{title:`Save a setup`,body:`Keeps a saved Play draft as a reusable template: every setting and checkpoint choice, plus a copy of each picked prompt and intro or outro. Keywords the project title names, like {{Topic}}, are saved empty; other keywords keep their values. Queued extra videos and uploaded fonts are left out.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.save.draft":{title:`Saved Play draft`,body:`The Play draft whose setup the template keeps. Only drafts saved in Play are listed; open Play to prepare one first. The draft itself stays as it is.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.save.name":{title:`Template name`,body:`What the template is called in this list and wherever you pick a template, such as a schedule. Up to 120 characters.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.edit":{title:`Edit a template`,body:`Shows the keywords the template fills and what each feeds. The pencil beside its name renames it; every save adds a version that History keeps. To change its settings, use it in Play, change the draft, then Save a setup.`,tutorial:{page:`Templates`,anchor:`see-a-templates-keywords`}},"templates.history":{title:`Template versions`,body:`Every saved version of the template, newest first. Pick one to compare its setup with the current one. Restore saves the older setup again as a new version, so nothing is lost. Drafts and projects made from it keep their setup.`,tutorial:{page:`Templates`,anchor:`history`}},"templates.save.channel":{title:`Template channel`,body:`The channel the template belongs to, and the one a draft made from it runs in. Default: the draft's own channel, or its template's channel when it has none.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"library.themes.yours":{title:`Your themes`,body:`Themes you made or copied from a built-in. Pick one on the Document row in Play or in Edit project. A project keeps its own copy of the settings, so editing or deleting a theme here never changes a PDF already made or queued.`,tutorial:{page:`Document-Themes`,anchor:`built-in-and-your-own-themes`}},"library.themes.built-in":{title:`Built-in themes`,body:`Looks that ship with Slopify and can't be changed. Plain is an unbranded flat page and what a new project gets. Copy one to make a theme of your own you can edit.`,tutorial:{page:`Document-Themes`,anchor:`built-in-and-your-own-themes`}},"library.theme.name":{title:`Theme name`,body:`What the theme is called on the Document row in Play and in Edit project. Up to 80 characters.`,tutorial:{page:`Document-Themes`,anchor:`make-a-theme`}},"library.theme.preview":{title:`Preview`,body:`A sample article laid out with this theme by the same renderer that makes a project's PDF, redrawn about half a second after you stop typing. It runs on your computer and costs nothing. Your projects use their own text and thumbnail.`,tutorial:{page:`Document-Themes`,anchor:`make-a-theme`}},"library.theme.page.format":{title:`Paper size`,body:`The page size of the PDF. A4 (210 × 297 mm) is used in most of the world; US Letter (216 × 279 mm) in the US and Canada. Pick the one your readers print on. Default: A4.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.page.margin":{title:`Margins`,body:`Blank space kept on every edge of each page, in millimetres. Wider margins mean shorter lines and more pages. From 5 to 60 mm. Default: 22 mm.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.page.content-top":{title:`Text starts at`,body:`How far from the top of the page the text begins on pages that carry the running header, in millimetres. Raise it when text crowds the header. From 5 to 80 mm. Default: 32 mm.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.background.image":{title:`Background`,body:`Parchment texture stretches an aged-paper picture over every page. Flat colour fills each page with the Page colour, drawn slightly darker at the edges. Default: Flat colour.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.background.color":{title:`Page colour`,body:`The colour of every page when Background is Flat colour; ignored with the parchment texture. Type a hex code like #fdfaf3 or use the picker. Default: #fdfaf3, a warm off-white.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.colors.heading":{title:`Heading colour`,body:`The colour of headings, drop caps, the brand name and links. Type a hex code like #1f3a5f or use the picker. Default: #1f3a5f, a dark blue.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.text":{title:`Body text colour`,body:`The colour of paragraphs, lists and bold or italic text. Keep it dark against the page colour so it reads and prints well. Default: #1a1a1a, near black.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.muted":{title:`Muted colour`,body:`The colour of dates, bullets, quotes and the dotted lines on the contents page. Default: #555555, a mid grey.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.faint":{title:`Faint colour`,body:`The colour of the running header and the page numbers, kept light so they stay out of the way. Default: #888888, a light grey.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.fonts.body":{title:`Body font`,body:`The font of paragraphs and lists. The first box picks the family, the second its weight or italic, the number adds space between letters in millimetres (-0.5 to 2). Cinzel is bundled and has no italics; Times, Helvetica and Courier are built into every PDF reader. Default: Cinzel Regular, 0.01 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.strong":{title:`Bold text font`,body:`The font of bold words inside paragraphs. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Bold, 0.02 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.emphasis":{title:`Italic text font`,body:`The font of italic words inside paragraphs. Cinzel has no italics, so the default borrows Times. Family, style and letter spacing in millimetres, as for Body. Default: Times Italic, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.heading":{title:`Heading font`,body:`The font of the article's headings and of the contents, sources and closing page titles. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Bold, 0.02 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.dramatic":{title:`Chapter numbers and brand font`,body:`The font of the big number in a heading like "Chapter 3:" and of the brand name on the title page. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Black, 0.03 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.decorative":{title:`Tagline and link font`,body:`The font of the tagline and the linked line on the title page, and of the link and closing line on the closing page. Default: Cinzel Medium, 0.015 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.drop-cap":{title:`Drop cap font`,body:`The font of the large first letter that starts a paragraph after a heading, when drop caps are on. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Black, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.footer":{title:`Header and page number font`,body:`The font of the running header and the page numbers. Family, style and letter spacing in millimetres, as for Body. Default: Times Regular, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.sizes.title":{title:`Title size`,body:`The size of the article's title on the title page, in points (1 pt is about 0.35 mm). From 6 to 72 pt. Default: 22 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.brand":{title:`Brand size`,body:`The size of the brand name on the title page, in points. Shown only when Branding has a brand name. From 6 to 72 pt. Default: 31 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.section":{title:`Top-level heading size`,body:`The size of top-level headings and of the contents, sources and closing page titles, in points. From 6 to 72 pt. Default: 19 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.heading":{title:`Second-level heading size`,body:`The size of second-level headings, the ones inside a top-level section, in points. From 6 to 72 pt. Default: 17 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.subheading":{title:`Third-level heading size`,body:`The size of third-level and deeper headings, in points. From 6 to 72 pt. Default: 13 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.body":{title:`Body size`,body:`The size of paragraphs, lists and the closing page text, in points. Bigger text means more pages. From 6 to 24 pt. Default: 10.5 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.meta":{title:`Date and word count size`,body:`The size of the date, word count and link lines under the title on the title page, in points. From 5 to 24 pt. Default: 10 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.footer":{title:`Header and page number size`,body:`The size of the running header and the page numbers, in points. From 5 to 24 pt. Default: 9 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.spacing.body-line":{title:`Body line height`,body:`The distance from one line of body text to the next, in millimetres. Raise it for airier pages, lower it to fit more on each page. From 3 to 20 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.heading-line":{title:`Heading line height`,body:`The distance between the lines of a top- or second-level heading that wraps, in millimetres. From 3 to 30 mm. Default: 11 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.subheading-line":{title:`Subheading line height`,body:`The distance between the lines of a third-level heading that wraps, in millimetres. From 3 to 30 mm. Default: 9 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.paragraph-gap":{title:`After a paragraph`,body:`Extra space after each paragraph, as a share of a body line: 0.5 is half a line. From 0 to 3. Default: 0.5.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.heading-gap":{title:`Before a heading`,body:`Extra space above each heading, as a share of a body line: 1 is one full line. From 0 to 5. Default: 1.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.item-gap":{title:`After a list item`,body:`Extra space after each bulleted or numbered item, as a share of a body line. From 0 to 3. Default: 0.2.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.list-indent":{title:`List indent`,body:`How far bulleted and numbered lists are pushed in from the left margin, in millimetres. From 0 to 30 mm. Default: 6 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.quote-indent":{title:`Quote indent`,body:`How far quotes are pushed in from the left margin, in millimetres. From 0 to 40 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.rule-width":{title:`Divider width`,body:`The width of the short centred line a --- in the article becomes, in millimetres. From 0 to 150 mm. Default: 30 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.drop-cap.enabled":{title:`Drop caps`,body:`Starts the first paragraph after each heading with a large first letter that spans several lines, as in printed books. Turn it off for a plainer page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.lines":{title:`Drop cap lines tall`,body:`How many lines of body text the large first letter spans. Default: 3 lines.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.scale":{title:`Drop cap letter size`,body:`The size of the large first letter, as a multiple of the height of the lines it spans. From 1 to 5. Default: 3.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.gap":{title:`Gap beside the drop cap`,body:`The space between the large first letter and the text beside it, in millimetres. From 0 to 20 mm. Default: 4 mm.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.min-length":{title:`Shortest paragraph`,body:`A paragraph shorter than this many characters starts plainly, so a one-line paragraph never gets a huge letter. From 0 to 2000. Default: 50.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.min-room":{title:`Room needed`,body:`With less than this share of the page left, a paragraph that starts with a drop cap moves to the next page. 0.25 is a quarter of the page. From 0 to 1. Default: 0.25.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.title-page.brand-y":{title:`Brand from top`,body:`Where the brand name sits on the title page, measured from the top edge of the page in millimetres. From 10 to 200 mm. Default: 60 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.tagline-offset":{title:`Tagline below brand`,body:`The distance from the brand name down to the tagline, in millimetres. From 0 to 60 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.title-y":{title:`Title from top`,body:`Where the article's title sits on the title page, measured from the top edge of the page in millimetres. From 10 to 250 mm. Default: 80 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.title-line":{title:`Title line height`,body:`The distance between the lines of a title that wraps, in millimetres. From 3 to 40 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.meta-offset":{title:`Details below title`,body:`The distance from the title down to the date and word count, in millimetres, when there is no cover picture. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.meta-line":{title:`Details line height`,body:`The distance between the date, word count and link lines on the title page, in millimetres. From 3 to 30 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.show-date":{title:`Show the date`,body:`Prints "Written on" and the date the PDF was made under the title on the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.show-word-count":{title:`Show the word count`,body:`Prints the article's word count under the title on the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover":{title:`Thumbnail as cover`,body:`Puts the project's thumbnail on the title page, between the title and the date, when the project has one. Without a thumbnail the page is laid out as if this were off. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover-gap":{title:`Space around cover`,body:`The space above and below the cover picture on the title page, in millimetres. From 0 to 40 mm. Default: 6 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover-height":{title:`Cover height at most`,body:`The tallest the cover picture may be, in millimetres. It keeps its shape and shrinks further when the page has less room. From 20 to 200 mm. Default: 110 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.brand.name":{title:`Brand name`,body:`Your channel or brand, printed large at the top of the title page and before the title in the running header ("Brand | Title"). Leave it empty to show no brand. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.tagline":{title:`Tagline`,body:`A short line under the brand name on the title page. Leave it empty to hide it. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.url":{title:`Website`,body:`The web address the brand name and the title-page link open when clicked in the PDF. Leave it empty for no link. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.link-label":{title:`Link text`,body:`The words of a linked line under the word count on the title page; it opens Website. Leave it empty to hide the line. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.contents.enabled":{title:`Contents page`,body:`Adds a table of contents after the title page, listing the article's headings with their page numbers. Each entry is a link to its page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.title":{title:`Contents page title`,body:`The heading at the top of the contents page. Up to 300 characters. Default: Table of Contents.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.depth":{title:`Lists headings down to`,body:`Which headings the contents page lists: only top-level ones, down to second-level, or down to third-level. Deeper lists take more room and can add a page. Default: Second level.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.title-offset":{title:`Contents title position`,body:`The distance from the top margin down to the contents page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.first-entry-offset":{title:`First entry position`,body:`The distance from the top margin down to the first entry of the contents, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.line":{title:`Contents line height`,body:`The distance from one contents entry to the next, in millimetres. From 3 to 30 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.indent":{title:`Indent per level`,body:`How much further in each deeper heading level is listed on the contents page, in millimetres. From 0 to 30 mm. Default: 5 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.header.enabled":{title:`Running header`,body:`Prints the brand and the article title ("Brand | Title") at the top of every page after the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.header.top":{title:`Header from top`,body:`The distance from the top edge of the page to the running header, in millimetres. From 3 to 60 mm. Default: 15 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.header.max-title":{title:`Header title at most`,body:`A title longer than this many characters is cut short in the running header so it fits on one line. From 5 to 200. Default: 35.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.enabled":{title:`Page numbers`,body:`Prints a page number at the bottom of every page after the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.text":{title:`Page number text`,body:`The words around the page number; {page} becomes the number, so "Page {page}" prints "Page 4". Default: Page {page}.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.bottom":{title:`Page number from the bottom`,body:`The distance from the bottom edge of the page to the page number, in millimetres. From 3 to 60 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.reserve":{title:`Space kept above page number`,body:`Space kept free above the page number, so body text always stops short of it, in millimetres. From 0 to 60 mm. Default: 15 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.sources.enabled":{title:`Sources page`,body:`Adds a page listing the web links the article and its research used, each one clickable. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.title":{title:`Sources page title`,body:`The heading at the top of the sources page. Up to 300 characters. Default: Sources Consulted.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.title-offset":{title:`Sources title position`,body:`The distance from the top margin down to the sources page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.body-offset":{title:`Sources list position`,body:`The distance from the top margin down to the first source, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.line":{title:`Sources line height`,body:`The distance between the lines of one source, in millimetres. From 3 to 30 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.gap":{title:`Gap between sources`,body:`Extra space between one source and the next, in millimetres. From 0 to 20 mm. Default: 2 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.end-page.enabled":{title:`Closing page`,body:`Adds a last page with your own text, such as an about section, a thank-you or a link to your site. Default: off.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.title":{title:`Closing page title`,body:`The heading at the top of the closing page. Up to 300 characters. Default: About.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.lines":{title:`Closing page text`,body:`The closing page text, one line per row, up to 60 lines of 300 characters. A line starting with "•" becomes a muted bullet, one ending with ":" a bold label, an empty line a gap. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.details":{title:`Add date, word and page counts`,body:`Adds a Document Details list under your text: the date written, the total words and the total pages. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.link":{title:`Closing page link`,body:`Adds a clickable line after your text: the words to show and the web address it opens. Leave the address empty to show the words without a link. Default: off.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.closing":{title:`Closing line`,body:`A last line after the text and the link, such as a sign-off, in the decorative font. Leave it empty to leave it out. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.title-offset":{title:`Closing title position`,body:`The distance from the top margin down to the closing page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.body-offset":{title:`Closing text position`,body:`The distance from the top margin down to the first line of the closing text, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.metadata.author":{title:`PDF author`,body:`The author a PDF reader shows in the document properties; it is not printed on the pages. {title} becomes the article title. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.subject":{title:`PDF subject`,body:`The subject a PDF reader shows in the document properties. {title} becomes the article title. Default: {title}.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.keywords":{title:`PDF keywords`,body:`Search words a PDF reader shows in the document properties, usually separated by commas. Up to 1000 characters. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.creator":{title:`PDF creator`,body:`The app or person a PDF reader shows as the creator in the document properties. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}}},Nte={"planning.schedules":{title:`Schedules`,body:`A schedule starts a new project from a saved template at a local time, while Slopify is open on this machine. Each run makes a fresh project, so changing the template later never rewrites an old run. It uses the template version you picked and never includes uploaded media. Each run costs what that template's project costs.`,tutorial:{page:`Schedules`}},"planning.schedule.name":{title:`Schedule name`,body:`A name to tell this schedule apart in the list, on the calendar and on the channel page. It never appears in the videos. Up to 200 characters.`,tutorial:{page:`Schedules`,anchor:`create-a-schedule`}},"planning.schedule.template":{title:`Template`,body:`The saved template each run starts from, with its version. The schedule keeps this version when you save the template again; pick the template again here to use the newer one. The template decides the providers, and so what each run costs. Save templates from Play; they are listed in Library → Templates.`,tutorial:{page:`Schedules`,anchor:`create-a-schedule`}},"planning.schedule.cadence":{title:`Cadence`,body:`How often the schedule runs. Every day runs once a day at the local time. Selected weekdays runs on the days you tick. One time runs once at a date and time, then completes. Each run starts one project. Default: Every day at 09:00.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.time":{title:`Local time`,body:`The clock time each run starts, read in the timezone below. Default: 09:00. A run only starts while Slopify is open; Missed run decides what happens when it was closed.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.once-at":{title:`Run at`,body:`The date and time of the single run, read in the timezone below. After that run starts, the schedule shows as completed.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.weekdays":{title:`Weekdays`,body:`The days a Selected weekdays schedule runs, each at the local time. Tick at least one; each ticked day is one project a week. Default: Mon, Wed and Fri.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.timezone":{title:`Timezone`,body:`The IANA zone the run time is read in, such as Europe/Tirane or America/New_York. Default: this computer's zone. When clocks go back, a repeated time uses the earlier one; a time skipped when clocks go forward moves forward by the gap.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.timezone-once":{title:`Timezone`,body:`The IANA zone the one-off date and time are read in, such as Europe/Tirane or America/New_York. Default: this computer's zone. When clocks go back, a repeated time uses the earlier one; nonexistent spring-forward times are refused, so pick another.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.missed":{title:`Missed run`,body:`What happens to a run that came due while Slopify was closed or asleep. Skip drops it when it is more than 1 minute late and waits for the next time. Run once when Slopify reopens starts one catch-up run, however many were missed. Default: Skip.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.spend":{title:`Spend ceiling`,body:`The most one run may cost, in US cents: 500 is $5.00. Before each run Slopify estimates the project's cost; when the high estimate is over this, or a cost can't be estimated, the run fails instead of starting. Leave it empty for no ceiling. Default: empty.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.topics":{title:`Topics`,body:`Each run takes the first topic, starts one project with it and removes it from the list. The schedule completes when the list is empty, unless topic generation is on. With no topics and generation off, every run uses the template as saved. Up to 500 topics.`,tutorial:{page:`Schedules`,anchor:`topics`}},"planning.schedule.inline-topics":{title:`Queued topics`,body:`Change the queue right here: type a topic and press Enter to add it, edit one in its field and press Enter to rename it, use the arrows to move it and the cross to remove it. Each change saves at once and changes only the queue; Undo on the notice puts it back. For a topic's own keyword values, press Edit.`,tutorial:{page:`Schedules`,anchor:`edit-the-queued-topics-in-place`}},"planning.schedule.topic-format":{title:`How to write the topics`,body:`Three ways to write the same list; switching keeps everything. One per line fills only the topic keyword. Table adds a column for each keyword a topic sets itself, such as its word count. YAML / JSON holds the same as text, for pasting or keeping in a file.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-lines":{title:`Topics, one per line`,body:`Type or paste one topic per line; blank lines are skipped. Each topic fills the keyword under Each topic fills, and the first line is the next run. Every other keyword uses its every-run value.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-yaml":{title:`Topics as YAML or JSON`,body:`A list such as "- Cleopatra", or one map per topic such as "- Topic: Cleopatra" with a line for each keyword it sets, like "Min. Word Count: 12000". A JSON array works too. A keyword a topic leaves out uses its every-run value. The schedule saves only once the list reads.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-table":{title:`Topic table`,body:`One row per run, in order. The first column fills the topic keyword; each extra column sets that keyword for that topic's run only, and a blank cell uses the every-run value. Set a keyword per topic adds a column; the x in a column's header drops it. Project title shows the result.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-keyword":{title:`Each topic fills`,body:`The template keyword, such as {{Topic}}, that each queued topic replaces. Default: the keyword the template's project title uses, else the first one. When the title doesn't use it, every project gets the same title.`,tutorial:{page:`Schedules`,anchor:`which-keyword-a-topic-fills`}},"planning.schedule.every-run":{title:`Every-run value`,body:`The value this keyword gets on every run, such as a word count. Default: the template's own value. A topic that sets the keyword itself, in Table or YAML / JSON, overrides it for that one run.`,tutorial:{page:`Schedules`,anchor:`which-keyword-a-topic-fills`}},"planning.schedule.generation":{title:`Topic generation`,body:`When the queue holds fewer topics than you ask for, Slopify asks an LLM for more: one call for what is missing plus 5 spare, at most 50. It sends the series brief and every title this schedule, your projects and the channel's existing videos already have, and drops near duplicates.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.brief":{title:`Series brief`,body:`What the series covers, its style and what makes a topic worth a video. Only topic generation reads it. Leave it empty to use the channel's series brief from the channel's Brand tab. Up to 4,000 characters.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.new-topics":{title:`New topics`,body:`Off: you add every topic yourself. Generate and queue directly: new topics join the end of the list. Generate and hold for approval: they wait under Topics waiting, and beside the calendar, until you approve them. Each generation is one LLM call. Default: Off.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.keep-count":{title:`Keep at least this many queued`,body:`Slopify asks for new topics whenever the queue, plus the topics waiting for approval when holding, drops below this number. A higher number keeps more topics lined up ahead of the runs, for you to review. From 1 to 100. Default: 10.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.generation-llm":{title:`Topic generation LLM`,body:`The text model that suggests topics. Ticked, it uses the provider and model the template writes with. Untick to pick another, such as a cheaper model. Either way each generation is one call on that provider. Default: the template's LLM.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.generate-now":{title:`Generate topics now`,body:`Asks the LLM for new topics right away, at least 5, even when the queue is full and even during the 5 minutes Slopify waits after a failed try. One LLM call. When holding for approval they wait for you; otherwise they join the queue.`,tutorial:{page:`Schedules`,anchor:`generate-topics-now`}},"planning.schedule.held-keywords":{title:`Keywords of a waiting topic`,body:`The template's other keywords, set for this one topic's run, the same as a column in the queue's table. Leave one empty to use the schedule's every-run value (shown greyed). They go with the topic into the queue when you approve it.`,tutorial:{page:`Schedules`,anchor:`approve-held-topics`}},"planning.schedule.held":{title:`Topics waiting`,body:`Topics the LLM suggested, waiting for you. Approve adds one to the end of the queue; Edit changes its words first; Reject drops it for good, so it is never suggested again. Approve all queues every one in order. Waiting topics count toward Keep at least.`,tutorial:{page:`Schedules`,anchor:`approve-held-topics`}},"planning.calendar.view":{title:`Calendar view`,body:`Weeks shows the coming 4 weeks as a grid: drag a topic to another day or onto another schedule's run, or focus it and press Alt+arrow keys. List shows the same runs day by day, with buttons to move each topic. This browser remembers your choice.`,tutorial:{page:`Calendar`,anchor:`switch-between-weeks-and-a-list`}},"planning.calendar.move":{title:`Moving topics`,body:`Earlier and later swap a topic with its neighbour in the same schedule's queue, so it takes the other's run. Move to puts it at the end of another schedule's queue, so it takes that schedule's next free run. No schedule runs outside its own times.`,tutorial:{page:`Calendar`,anchor:`move-a-topic-to-another-day`}},"planning.calendar.add-schedule":{title:`Schedule`,body:`The schedule the topics join. They go to the end of its queue, after the topics already there (the count beside each name), so they take its next free runs. Only active and paused schedules are listed.`,tutorial:{page:`Calendar`,anchor:`add-topics`}},"planning.calendar.add-topics":{title:`Topics, one per line`,body:`Each line becomes one topic, in order; blank lines are skipped. A topic fills the schedule's topic keyword, and every other keyword keeps its every-run value. To give topics their own values, edit the schedule's topics as a table under Schedules.`,tutorial:{page:`Calendar`,anchor:`add-topics`}},"planning.channels":{title:`Channels`,body:`A channel is one series: its brand kit, series brief, cast, templates and schedules. Every template belongs to one channel, and each run from it uses that channel's look and cast. The default channel holds everything made before channels and can't be deleted.`,tutorial:{page:`Channels`,anchor:`the-channels-page`}},"planning.channel.current":{title:`Current channel`,body:`Home, Projects and the calendar show only this channel's work. All channels shows everything. It only filters what you see; every project and schedule keeps its own channel. This browser remembers your choice.`,tutorial:{page:`Channels`,anchor:`show-one-channels-work`}},"planning.channel.name":{title:`Channel name`,body:`The name you see in the channel picker, on Play and on the calendar. It stays inside Slopify and doesn't have to match your YouTube channel. Up to 200 characters.`,tutorial:{page:`Channels`,anchor:`create-a-channel`}},"planning.channel.brief":{title:`Series brief`,body:`What the channel covers, its style and what makes a topic worth a video. Topic generation reads it for every schedule of this channel that has no brief of its own. It doesn't change how videos are written. Up to 10,000 characters.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.ai-disclosure":{title:`YouTube AI disclosure`,body:`Studio's AI use answer for this channel's videos and Shorts, given by Prepare upload and the Studio extension. Automatic says Yes only for YouTube's three cases: a voice marked as imitating a real person, real footage altered, or photorealistic AI pictures from a marked Image prompt. Saves as you pick. Default: Automatic.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`override-per-channel`}},"planning.channel.language":{title:`Language of new projects`,body:`The language this channel's new projects are written and narrated in when Play or the template picks none. It applies with the brand kit off too, since it is not styling. Pick voices that speak it. Not set means English. Projects already made keep their language.`,tutorial:{page:`Other-Languages`,anchor:`set-a-channels-language`}},"planning.channel.brand-kit":{title:`Brand kit`,body:`The look every template of this channel gets unless it sets its own: fonts, colours, end screen, intro, outro, document theme and ambient sound. It fills only what a template leaves at its default, and a blank field adds nothing. Turn it off for one video on Play or in Edit project.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-font":{title:`Caption font`,body:`The subtitle font for this channel's videos whose template leaves the font at Default. Not set leaves the template's font alone. Fonts you upload in the subtitle font picker on Play appear here.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-colour":{title:`Caption colour`,body:`The subtitle text colour, as # and six hex digits such as #FFFFFF, for videos whose template sets no colour of its own. Blank leaves the template's colour alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-outline":{title:`Caption outline`,body:`The colour of the line around each subtitle letter, as # and six hex digits such as #000000, for videos whose template sets none. A dark outline keeps light captions readable on bright pictures. Blank leaves the template's outline alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.font":{title:`Title font`,body:`The font of chapter cards and the end screen for videos whose template sets no title style. Not set leaves the template's font alone. Fonts you upload in the subtitle font picker on Play appear here.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.title-colour":{title:`Title colour`,body:`The text colour of chapter cards and the end screen, as # and six hex digits such as #FFD700, for videos whose template sets no title style. Blank leaves the template's colour alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.end-screen":{title:`End screen text`,body:`A line shown over the last 5 seconds of every video of this channel whose template sets no end screen, such as Subscribe for more. Up to 200 characters. Blank shows no end screen text.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.intro":{title:`Intro`,body:`An entry from Library → Intros & Outros, narrated before every video of this channel whose template has no intro. Not set adds none. It adds its own length to each video and costs one voice request, since it is narrated.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.outro":{title:`Outro`,body:`An entry from Library → Intros & Outros, narrated after every video of this channel whose template has no outro. Not set adds none. It adds its own length to each video and costs one voice request, since it is narrated.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.document-theme":{title:`Document theme`,body:`The look of the PDF document for videos of this channel whose template picks no theme: a built-in theme or one you saved. Not set leaves the template's choice alone. A saved theme that was deleted is skipped.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.template-move":{title:`Move a template`,body:`Moves a template, and every schedule that runs it, to another channel. Their next runs use that channel's brand kit, cast and series brief. Projects already made keep what they were made with.`,tutorial:{page:`Channels`,anchor:`templates`}},"planning.channel.episode-memory":{title:`Episode memory`,body:`When a video of this channel finishes, one short call to its text model writes a summary of up to 150 words. A new episode about the same cast or title words gets up to 5 related summaries in its writing prompt, so it agrees with them. Videos already made never change. Default: on for new channels.`,tutorial:{page:`Channels`,anchor:`episodes-episode-memory`}},"planning.channel.episode-summary":{title:`Episode summary`,body:`What the text model wrote this episode covered. Related new episodes read it before they are written. Edit it to correct a fact; your text is kept even if the video finishes again.`,tutorial:{page:`Channels`,anchor:`episodes-episode-memory`}},"planning.channel.videos-paste":{title:`Existing video titles`,body:`Titles of videos this channel made before Slopify, one per line. Topic generation and its duplicate checks skip them, as they skip the videos made here. Titles already listed are skipped, whatever their case.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-csv":{title:`Import a YouTube Studio CSV`,body:`In YouTube Studio open Analytics → Content → Advanced mode and export the table as a CSV. Slopify reads its titles on this machine and lists them with ticks first, so you keep only this channel's videos.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-filter":{title:`Keep only titles containing`,body:`Ticks only the titles containing this text, in any case, such as "Egypt" or "History at Bedtime"; empty ticks them all. Use it when one Studio export holds several series. Remembered for this channel's next import.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-ticks":{title:`Titles in the CSV`,body:`Only ticked titles are added when you press Add. Untick videos of other series in the same export, or type in Keep only titles containing to tick by text.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.cast.kind":{title:`Kind`,body:`Character, creature, place or object. A generated reference picture of a character or creature is portrait (9:16), of a place or object landscape (16:9), and its starting prompt asks for the whole figure, place or object in view. It doesn't change how the member is matched.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.name":{title:`Name`,body:`The name matched against video titles and image briefs, as whole words, ignoring case. When it is found, this member's pictures go with that image as references. Add other spellings and plurals as aliases. Up to 200 characters.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.aliases":{title:`Aliases`,body:`Other names that count as this member, matched as whole words, ignoring case: Cleopatra is found in Cleopatra's palace but not in Cleopatraic. Add plurals and titles such as the Last Pharaoh. Up to 20.`,tutorial:{page:`Cast-Library`,anchor:`how-names-are-matched`}},"planning.cast.description":{title:`Description for the image model`,body:`What the member looks like, in a sentence. It goes to the image model with the member's reference pictures for every image that names it, and starts the prompt of a generated picture. Up to 2,000 characters.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.voice":{title:`Cast voice`,body:`How this member speaks in multi-voice runs: pick them under Speakers on Play and they read with this voice, model and pace in every episode. The list shows voices that speak the channel's language. Leave the provider empty for no voice. A run keeps the voice it started with.`,tutorial:{page:`Cast-Library`,anchor:`give-a-cast-member-a-voice`}},"planning.cast.host":{title:`Channel host`,body:`A recurring voice of this channel. When you pick Podcast or Interview on Play, the draft starts with the channel's hosts that have a voice as its hosts, so you don't add them every episode. You can still remove or add speakers on the draft. Projects already made are unchanged.`,tutorial:{page:`Cast-Library`,anchor:`make-a-member-one-of-the-channels-hosts`}},"planning.cast.pictures":{title:`Reference pictures`,body:`Up to 4 pictures per member, sent with every image whose brief, or the video's title, names it, so it looks the same each time. Upload a PNG or JPEG up to 10 MB, or generate one below. Videos already made keep the pictures they started with.`,tutorial:{page:`Cast-Library`,anchor:`add-reference-pictures`}},"planning.cast.generate":{title:`Make a reference picture`,body:`Pick an image provider and model, describe the picture, then press Generate a picture. Each press is one image call on that provider, billed at its price for one image. A plain background with the whole figure in view makes the best reference.`,tutorial:{page:`Cast-Library`,anchor:`generate-a-picture`}},"planning.cast.picture-prompt":{title:`Picture to make`,body:`The prompt for the generated reference picture. It starts from the name, the description and a request for a plain background; edit it as you like. Up to 4,000 characters.`,tutorial:{page:`Cast-Library`,anchor:`generate-a-picture`}},"planning.links.named":{title:`Named links`,body:`Write {{Name}} in a YouTube description, or ask for it in a Description prompt, and it becomes the link of that name when the description is shown, copied or downloaded, such as {{Patreon}} or {{Discord}}. Each channel keeps its own list on its Brand tab, so a project fills from its channel's links; its own {{Previous video}} wins over the channel's. A name with no link stays as typed. Save channel keeps the list.`,tutorial:{page:`YouTube-Description`,anchor:`links-in-the-description`}}},Pte={"play.template":{title:`Template`,body:`Starts this video from a saved setup: prompts, voice, images, style, outputs and reviews. Picking one opens a fresh draft made from it and carries the topic you typed. No template starts from the default setup. Save a setup you like with Save as template in the right rail.`,tutorial:{page:`Play-Overview`,anchor:`template`}},"play.title":{title:`Title`,body:`The video's name, shown on the project and in Projects. Write a keyword in double braces, like {{Topic}}, and the title becomes a pattern: you type the topic per video, and Add topic queues more videos from the same setup. Up to 200 characters.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.title-pattern":{title:`Title pattern`,body:`The title with its keywords in double braces, like History: {{Topic}}. Each keyword in it is a topic you type at the top of Play, once per video, and templates save it empty. Change the pattern here; the topic values stay at the top.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.topic":{title:`Topic`,body:`What this video is about. The title names this keyword, so its value fills the title and every prompt that names it. Each video from this setup gets its own value, and a template leaves it empty. Up to 200 characters.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.keyword":{title:`Keyword`,body:`A value a picked prompt or the title asks for with {{name}}. You type it once and it fills every place that names it; the line under it lists where. Up to 200 characters. A keyword the title does not name is saved with a template.`,tutorial:{page:`Play-Overview`,anchor:`keywords`}},"play.more-videos":{title:`More videos from the same setup`,body:`Add topic queues another video with everything else the same: only its title and keywords differ. Press a chip to change that video's keywords. Start queues all of them, and they run one at a time. One Start queues at most 50 videos.`,tutorial:{page:`Play-Overview`,anchor:`more-videos-from-the-same-setup`}},"play.drafts":{title:`Drafts`,body:`Play saves every change to this draft on its own; nothing starts until you press the Play key. Drafts lists your saved setups to open again or discard. New draft starts an empty one and keeps this one in the list.`,tutorial:{page:`Play-Overview`,anchor:`drafts`}},"play.draft-conflict":{title:`Changed elsewhere`,body:`This draft was saved from another tab or window since you opened it. Reload saved draft shows that version and drops your unsaved change. Save as a new draft keeps your version as a separate draft and leaves the other one alone.`,tutorial:{page:`Play-Overview`,anchor:`when-a-draft-was-changed-elsewhere`}},"play.source.research":{title:`Research source`,body:`Generate has the text model plan chapters, research each one on the web and combine the notes before the article is written: one call to plan, one per chapter and one to combine. Provide uses notes you paste. Off, the default, writes from the prompt alone.`,tutorial:{page:`Play-Title-and-Article`,anchor:`research`}},"play.source.article":{title:`Article source`,body:`Generate has the text model write the article from the article prompt, one call. Provide narrates text you paste, word for word, with no text-model cost. The article is what the narration reads and the PDF lays out. Default: Generate.`,tutorial:{page:`Play-Title-and-Article`,anchor:`choose-where-the-article-comes-from`}},"play.source.audio":{title:`Narration source`,body:`Generate reads the article aloud with a text-to-speech voice, charged by the provider per character. Provide uses an audio file you upload, as it is. Off makes a silent video with no captions, YouTube description or shorts. Default: Generate.`,tutorial:{page:`Play-Narration`,anchor:`choose-where-the-narration-comes-from`}},"play.source.images":{title:`Images source`,body:`Generate draws images from the ticked image prompts, one image-model call each. Provide uses your own PNG, JPEG or WebP files in the order you pick them. Off turns off the video too. Default: Generate.`,tutorial:{page:`Play-Images`,anchor:`choose-where-the-images-come-from`}},"play.source.thumbnail":{title:`Thumbnail source`,body:`From prompt draws the thumbnail straight from the thumbnail prompt, one image call. Prompt by LLM first has the text model write the image prompt from yours, the title and the article, then draws it. Provide uses your own image. Default: Off.`,tutorial:{page:`Play-Outputs`,anchor:`thumbnail`}},"play.source.video":{title:`Video source`,body:`Generate renders the slideshow video on this computer from the images and narration; it costs no provider money, only time. Off leaves each finished stage to download on its own. It needs images, so it is Off while Images is Off. Default: Generate.`,tutorial:{page:`Play-Video-and-Style`,anchor:`choose-whether-to-render-a-video`}},"play.source.document":{title:`Document source`,body:`Generate lays out a PDF of the article and title on this computer, in the theme you pick. It needs no provider and costs nothing. Default: Off.`,tutorial:{page:`PDF-Documents`,anchor:`make-a-pdf`}},"play.article-prompt":{title:`Article prompt`,body:`The Library prompt the text model is sent to write the article, with its keywords filled in. A Script prompt, used when several speakers read, asks for speaker turns instead. Write or change prompts on Prompts; View prompt shows the text.`,tutorial:{page:`Play-Title-and-Article`,anchor:`generate-an-article-from-a-prompt`}},"play.provided.article":{title:`Article text`,body:`The article you paste is narrated word for word, and no text model writes one. Include everything that should be read, headings too. The count under it helps you judge the length: about 150 words is one minute of narration.`,tutorial:{page:`Play-Title-and-Article`,anchor:`paste-your-own-article`}},"play.provided.research":{title:`Research notes`,body:`Notes you paste are given to the text model with the article prompt, in place of web research. Paste facts, sources and quotes the article should draw on. Nothing is looked up.`,tutorial:{page:`Play-Title-and-Article`,anchor:`give-your-own-research-notes`}},"play.text-generation":{title:`Text generation`,body:`One text model writes everything this run needs in words: the article, research, the thumbnail's image prompt, entries set to LLM, Narration Preparation, the YouTube description and picking shorts. Each is a separate call, counted in usage. Set the default under Settings.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.provider":{title:`LLM`,body:`Who runs the text model: a command-line tool you are signed in to, such as Claude Code or Codex, or a keyed service such as OpenRouter, billed per token. A greyed provider says why it cannot be used; fix it under Settings.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.model":{title:`Text model`,body:`The model the provider runs for every text step. Bigger models write better and cost more per token. Refresh asks the provider for its current list; Custom ID lets you type a model the list does not show.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.thinking":{title:`Thinking`,body:`How long the model reasons before it answers, for models that offer it. Higher levels can write more carefully but take longer and use more tokens. Model default leaves it to the provider.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.tts.provider":{title:`TTS`,body:`The text-to-speech service that reads the narration, charged by the provider per character of text. A greyed provider says why it cannot be used; add its key under Settings. Changing it clears the model and voice.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.tts.model":{title:`TTS model`,body:`The provider's speech model. Models differ in quality, languages, speed and price per character. Some features need a particular model: Narration Preparation needs Inworld TTS-2. Refresh asks the provider for its current list.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.voice":{title:`Voice`,body:`Who reads the narration. The list holds the voices you added under Settings → Voices for this provider, filtered to the project's language. With several speakers, this voice reads the intro and outro.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.show-all-voices":{title:`Show all voices`,body:`The voice list hides voices listed for other languages than the project's. Tick this to pick one anyway, for example a multilingual voice whose languages are listed wrong. A voice with unknown languages is always shown.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.intro":{title:`Intro`,body:`A Library entry read before the article. A text entry is read as written; an LLM entry is written by the text model for each video, one extra call. Off reads no intro. Write entries in Library → Intros & Outros.`,tutorial:{page:`Play-Narration`,anchor:`intro-and-outro`}},"play.outro":{title:`Outro`,body:`A Library entry read after the article, such as a sign-off. A text entry is read as written; an LLM entry is written by the text model for each video, one extra call. Off reads no outro.`,tutorial:{page:`Play-Narration`,anchor:`intro-and-outro`}},"play.chunking":{title:`Chunking`,body:`How the narration is split into text-to-speech requests. Whole sends it in one request; Paragraph sends one per paragraph; Every N words or characters ends each at a sentence end. Split when a provider refuses long text. Default: Whole. It changes the number of requests, not the characters charged.`,tutorial:{page:`Play-Narration`,anchor:`chunking`}},"play.chunking.count":{title:`Chunk size`,body:`How long each text-to-speech request may be. Each request ends at the last whole sentence that fits, so a single longer sentence stays whole. Defaults: 500 words or 3000 characters, spaces included.`,tutorial:{page:`Play-Narration`,anchor:`chunking`}},"play.narration-preparation":{title:`Narration Preparation`,body:`Has the text model add delivery directions and sounds, such as a sigh or a laugh, following the Library narration prompt you pick. One text-model call per narration chunk and per entry. Needs Inworld TTS-2. The article and captions stay unchanged. Default: Off.`,tutorial:{page:`Play-Narration`,anchor:`narration-preparation`}},"play.pronunciation-glossary":{title:`Pronunciation Glossary`,body:`Reads names with the IPA in the article's Pronunciation Glossary, such as Arda: /ˈɑɹdə/, with no extra text-model call. In your article prompt, ask for a glossary in slash-delimited standard-English IPA (Term: /IPA/), with an English approximation for foreign names; a line with sounds English lacks is read as plain text. Works with Inworld TTS-2 and TTS-2 Flash. The written text stays unchanged. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"play.share-glossary":{title:`Pronunciations from other projects`,body:`Adds every term from your other projects' glossaries, copied when this project starts. This project's own glossary wins where they differ. Turn it off to use only this article's glossary. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"play.describe-figures":{title:`Describe tables and figures`,body:`Instead of skipping tables, pictures, equations and code or reading them cell by cell, the text model writes a short spoken passage for each (a table's pattern, what a figure or equation means, what code does) and the narration says it in its place. One extra text-model call per block, in the estimate, kept for reuse. The article and PDF keep the real table; captions show what is said. Needs a text model. Default: on.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"play.show-figures":{title:`Show tables and figures on screen`,body:`Each table, figure, equation and code block the narration describes is also shown in the video while it is described: the article's own picture for a figure, a card drawn in your brand kit's title font and colour for the rest. The images take turns around them, and Shorts that include one show it upright. Drawn on this computer at no cost. Needs Describe tables and figures. Default: on.`,tutorial:{page:`Play-Outputs`,anchor:`show-tables-and-figures-on-screen`}},"play.skip-code":{title:`Leave code out`,body:`Drops code blocks from the narration instead of summarising each in a sentence or two. Tables, figures and equations are still described. Default: off.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"play.narration-aliases":{title:`Narration aliases`,body:`Says the words listed in Library → Aliases the way they are written there, such as Dr. as Doctor, with any generated voice. They are copied when the project starts. The article and captions keep the written words. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`use-aliases-in-a-video`}},"play.speakers.format":{title:`Speakers format`,body:`Narration uses one voice. Audiobook, Podcast, Radio drama and Interview give lines to several speakers, each with a voice. Several speakers need the text model to write or split the script. A new Podcast or Interview starts with the channel's hosts (cast members marked as hosts, with a voice).`,tutorial:{page:`Multiple-Voices`,anchor:`formats`}},"play.speakers.script":{title:`Script`,body:`Write a script has the text model write speaker turns from a Script prompt, one Name: words paragraph each. Split the article keeps the article as written and has the text model hand its narration and dialogue to the speakers, one extra call.`,tutorial:{page:`Multiple-Voices`,anchor:`the-script`}},"play.speakers.add-from-cast":{title:`Add from the cast`,body:`Adds a member of this channel's cast as a speaker, with their name and voice. Only members with a voice are listed. Edit the cast on the channel's page.`,tutorial:{page:`Multiple-Voices`,anchor:`speakers-from-a-channels-cast`}},"play.speakers.book":{title:`A chapter of a book`,body:`Makes this audiobook one chapter of a book. The MP3 and M4B are tagged with the book as their album and the chapter as their track, so a player keeps the chapters together and in order. When the chapter is done, Make the next chapter on its project page starts the next one with the same speakers and settings.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.book-title":{title:`Book title`,body:`The book this chapter belongs to, the same for every chapter. It becomes the album of the MP3 and M4B files.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.book-chapter":{title:`Chapter`,body:`This chapter's number in the book, from 1 to 9999. It becomes the track number of the MP3 and M4B files.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.turn-gap":{title:`Gap between turns`,body:`The pause between one speaker's turn and the next, from 0 to 1.2 seconds. Longer feels calmer; shorter feels like a lively talk. Default: 0.35 s.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.name-tags":{title:`Speaker names on captions`,body:`Puts the speaker's name before their captions, like Ada: and their words, so viewers know who is talking. On by default for a podcast or interview.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.native-dialogue":{title:`One request for consecutive turns`,body:`Sends back-to-back turns as one multi-speaker request where the provider has one (ElevenLabs v3 with up to 10 voices, Gemini TTS with 2), so the voices react to each other. Fewer requests, same characters charged. Other providers read each turn on its own.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.audio-files":{title:`MP3 and M4B files`,body:`Also saves the narration as an MP3 and an M4B audiobook file with a chapter marker at each chapter, beside the video. Made on this computer at no provider cost.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speaker.name":{title:`Speaker name`,body:`The name the script uses for this speaker's turns (Name: words) and the one captions and the speaker panel show. Up to 40 characters.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.role":{title:`Role`,body:`What this speaker does in the format: narrator, host, guest or character. The text model is told each speaker's role when it writes or splits the script.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.provider":{title:`Voice provider`,body:`The text-to-speech service for this speaker, charged per character of their lines. Speakers may use different providers. Changing it clears the model and voice.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.model":{title:`Voice model`,body:`The provider's speech model for this speaker. Models differ in quality, languages and price per character. Pronunciations need an Inworld TTS-2 model.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.voice":{title:`Speaker voice`,body:`This speaker's voice, from the voices you added under Settings → Voices for their provider, filtered to the project's language. Press Audition to hear it read their first line.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.pace":{title:`Pace`,body:`How fast this speaker talks, from 0.8× to 1.2× of the voice's own speed. Default: Normal.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.pronunciations":{title:`Speaker pronunciations`,body:`One Term: /IPA/ per line, like the article's Pronunciation Glossary, for this speaker only. Used on Inworld TTS-2 voices, ahead of the glossary. A line with sounds the language does not use is skipped and read as ordinary text.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.audition":{title:`Audition`,body:`Speaks this speaker's first line in their voice so you can hear it before the run. It is one real text-to-speech request, charged by the provider at about the price shown on the button.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.images.provider":{title:`Image provider`,body:`Who draws the images, the thumbnail and the shorts' pictures: a keyed service such as fal.ai, billed per image, or a command-line tool you are signed in to. A greyed provider says why it cannot be used; fix it under Settings.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-provider-and-model`}},"play.images.model":{title:`Image model`,body:`The provider's image model. Models differ in quality, speed and price per image; the estimate in the right rail shows what this run costs. Refresh asks the provider for its current list.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-provider-and-model`}},"play.images.effort":{title:`Effort`,body:`How long an image agent, such as the Codex CLI, reasons before it draws. Higher effort can follow the prompt more closely but takes longer and uses more tokens. Model default leaves it to the provider.`,tutorial:{page:`Play-Images`,anchor:`drawing-with-the-codex-cli`}},"play.image-prompts":{title:`Image prompts`,body:`Tick the Library prompts that draw the video's images, and give each a number: how many images it makes, 1 to 20. A run makes at most 60 this way. Each image is one image-model call. The images play in the order you ticked the prompts.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-prompts`}},"play.reference":{title:`Establishing image`,body:`Made first and never shown in the video. Every other image, the shorts' and, if ticked, the thumbnail is drawn with it as a reference, so characters, style and palette stay the same. From a prompt costs one more image; Upload uses yours. Changing it marks those images outdated. Default: Off.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.reference.prompt":{title:`Establishing prompt`,body:`The Library image prompt that draws the establishing image, its keywords filled like the others. Describe the characters, setting and style every other image should share.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.reference.thumbnail":{title:`Thumbnail from the establishing image`,body:`Draws the thumbnail with the establishing image as a reference too, so it matches the video. Untick it for a thumbnail drawn on its own. Default: on.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.image-scale":{title:`More images for long videos`,body:`Adds images as the narration gets longer, planned from the expected length when the run starts. The extra images are shared among the ticked prompts in order, up to 240 in all; each is one more image call. The line under it shows the count. Turning it on switches Motion from Zoom to Mix of both.`,tutorial:{page:`Play-Images`,anchor:`more-images-for-long-videos`}},"play.batch-queue":{title:`Queue`,body:`With more than one video on the page: on, they run one after another, each starting when the one before finishes (Calendar → Batch queue shows the order); off, they all start at once. At once finishes sooner when the steps wait on providers, but the video renders share your computer's processor and plan limits are reached sooner. Default: on.`,tutorial:{page:`Play-Overview`,anchor:`queue-or-all-at-once`}},"play.image-scenes":{title:`Scenes from the article`,body:`Gives every image its own moment. The project's AI model reads the article once and writes a scene per image, from the opening to the ending in slideshow order. The scene goes where a prompt has {{Scene}}, or after its first paragraph. A thumbnail prompt with {{Scene}} gets a scene too: the article's most striking moment, a different one per thumbnail. Off, a {{Scene}} line is left out. One more AI call per run.`,tutorial:{page:`Play-Images`,anchor:`scenes-from-the-article`}},"play.image-scale.rate":{title:`Image rate`,body:`Give the rate as one image every N minutes of narration (0.25 to 60) or as N images per hour (1 to 240); switching keeps the same rate. Narration runs about 150 words a minute. Starts at one image every 2 minutes.`,tutorial:{page:`Play-Images`,anchor:`more-images-for-long-videos`}},"play.image-seconds":{title:`Seconds per image`,body:`How long each image stays on screen, 1 to 600 seconds. When cuts follow the narration, it is the target and a cut waits for a sentence end. When images run out they start again. Default: 15.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.zoom":{title:`Zoom`,body:`How far each image zooms in or out over its time on screen, 0 to 50 percent. 0 keeps images still. Default: 22.5 percent.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.motion":{title:`Motion`,body:`How each image moves while on screen: Zoom in and out, Pan across, a Mix of both by turns, or Still. A mix keeps a long video watchable. Default: Zoom in and out.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.edge-silence":{title:`Silence at start and end`,body:`Quiet time before the narration starts and after it ends, 0 to 30 seconds. Default: 2.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.silence-gap":{title:`Silence between segments`,body:`Seconds of quiet between the intro and the narration, and between the narration and the outro, 0 to 30. It only matters when an intro or outro is set. Leave it empty to use the gap set in Settings, 3 seconds unless you changed it.`,tutorial:{page:`Play-Narration`,anchor:`silence-at-the-edges-and-between-segments`}},"play.format":{title:`Frame format`,body:`16:9 is a landscape video for YouTube and screens. 9:16 is a portrait video for phones. Images are drawn in this shape and captions are placed for it. Default: 16:9.`,tutorial:{page:`Play-Video-and-Style`,anchor:`frame-format`}},"play.preview-text":{title:`Preview text`,body:`The sample sentence the style preview shows in your caption font, size and position. It is only for the preview and never reaches the video; real captions come from the narration.`,tutorial:{page:`Play-Video-and-Style`,anchor:`style-preview`}},"play.thumbnail-prompt":{title:`Thumbnail prompt`,body:`The Library thumbnail prompt, keywords filled in. From prompt sends it to the image model as it is; Prompt by LLM gives it to the text model with the title and article to write the image prompt. Write prompts on Prompts.`,tutorial:{page:`Play-Outputs`,anchor:`thumbnail`}},"play.thumbnail-count":{title:`Thumbnails`,body:`Three makes two more thumbnails from the same prompt with different compositions, for YouTube's Test & compare. Each costs one more image, so 3 thumbnails are 3 image calls. You can remake each on its own on the project page. Default: 1.`,tutorial:{page:`Play-Outputs`,anchor:`make-three-thumbnails-for-test--compare`}},"play.youtube-description":{title:`YouTube description`,body:`After subtitle timing, the text model writes a description with chapters at the narration's real times, hashtags at the end, and a separate list of tags, ready to copy. One text-model call. It runs beside the render. Needs narration. Default: off.`,tutorial:{page:`YouTube-Description`,anchor:`turn-it-on`}},"play.description-prompt":{title:`Description prompt`,body:`The Library prompt the description is written from. Built-in asks for a short summary, 5 to 12 chapters, 3 to 5 hashtags and 15 to 25 tags. Write your own description prompt on Prompts to change the tone or add links.`,tutorial:{page:`YouTube-Description`,anchor:`turn-it-on`}},"play.shorts":{title:`Shorts`,body:`After subtitle timing, the text model picks the best self-contained moments of the narration. Each becomes a vertical 1080×1920 clip with new images, big word-by-word captions and its own title, description and hashtags. It runs beside the render; its images are charged like any other. Needs narration. Default: off.`,tutorial:{page:`Shorts`,anchor:`turn-on-shorts`}},"play.shorts.count":{title:`How many shorts`,body:`How many shorts to cut from this video, 1 to 10. Each needs its own new images, so more shorts cost more image calls and render time. Default: 3.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.length":{title:`Short length`,body:`The shortest and longest a short may run, in seconds, between 15 and 180. The text model picks moments within these bounds. Default: 60 to 120.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.prompt":{title:`Shorts prompt`,body:`The Library prompt the text model follows to pick the moments and write each short's title, description and hashtags. Built-in picks moments that make sense alone and open on a hook.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.image-style":{title:`Image style`,body:`The Library image prompt the shorts' new vertical images are drawn from. Built-in draws cinematic, uncluttered images with the subject centred. Pick one of your image prompts to match the long video.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.title-on-screen":{title:`Title on screen`,body:`Keeps the short's title at the top for the whole clip, large and bold in the caption font, below where the apps draw their own buttons. Default: on.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.preview":{title:`Shorts preview`,body:`A few seconds of the sample project's narration and images as a short: vertical, through the same renderer your shorts use, with the big word-by-word captions in your caption font, the title on screen when it is on, and the speed you chose. It renders again by itself a moment after you change a setting, costs no API calls, and Render again forces a fresh one.`,tutorial:{page:`Shorts`,anchor:`shorts-preview`}},"play.shorts.speed":{title:`Speed`,body:`Plays each short faster than the narration, 1.00× to 1.25× in steps of 0.05, with the pitch kept. A little faster suits short-form viewers. Default: 1.00×.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.music-volume":{title:`Music volume`,body:`How loud the background music plays under every short, 0 to 100 percent; it dips while the narrator speaks. Only used when you add a music file below. Default: 15.`,tutorial:{page:`Shorts`,anchor:`add-background-music`}},"play.shorts.full-video-link":{title:`Full video link`,body:`Each short's description ends with a line pointing to the full video. Paste the video's link here; without it the line says [PASTE THE FULL VIDEO LINK HERE] for you to fill in.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.document-theme":{title:`Theme`,body:`How the PDF looks: a built-in theme or one of yours from Library → Documents. A theme of yours is copied into the project, so editing it later leaves this project alone until you pick it again. Edit themes opens the list.`,tutorial:{page:`PDF-Documents`,anchor:`options`}},"play.checkpoints":{title:`Review checkpoints`,body:`Holds the run before a step so you can check and edit what came before it. Steps that do not depend on it carry on. Approve each checkpoint on the project page to continue. A step must be generated to have a checkpoint.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`add-a-checkpoint-on-play`}},"play.reviews":{title:`Automatic reviews`,body:`A reviewer model checks each finished item and saves its verdict and reasons on the project page. Flag only marks a failed item; Flag and redo makes it again, up to the redos per item, then keeps and flags it. Each review is a text-model call, counted in usage. Default: Off.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.provider":{title:`Reviewer`,body:`Who runs the review model. Picture reviews, for images, the thumbnail and shorts, need Claude Code or Codex, which can look at images; other providers review text only.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.model":{title:`Reviewer model`,body:`The model that judges each item. A stronger model catches more but costs more per review. It can differ from the model that wrote the text.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.retries":{title:`Redos per item`,body:`How many times Flag and redo makes a failed item again before it keeps the last one and flags it, 0 to 5. Each redo costs the item again plus one more review. Default: 2.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.channel":{title:`Channel`,body:`The channel this video belongs to. Its brand kit fills what this setup leaves at its default, and its cast of characters goes with the images. A draft that picks none runs in its template's channel, or the default one.`,tutorial:{page:`Play-Overview`,anchor:`channel-row`}},"play.brand-kit":{title:`Channel's brand kit`,body:`Fills what this setup leaves at its default from the channel: the caption font, intro, outro, document theme and ambient sound. What you set here wins. Turn it off to take none of it; the cast and language still apply. Default: on.`,tutorial:{page:`Play-Overview`,anchor:`channel-row`}},"play.language":{title:`Language`,body:`The language the article, narration, YouTube description and shorts titles are written in. Pick a voice that speaks it. Outside English, captions are timed with a free 248 MB model, downloaded once, where one exists. On Play, blank uses the channel's language.`,tutorial:{page:`Other-Languages`,anchor:`pick-a-language-for-one-video`}},"play.estimate":{title:`Estimated cost`,body:`What the providers are likely to charge for this run, in US dollars, from their published prices. Actual usage can differ, and the estimate does not cap spending.`,tutorial:{page:`Play-Overview`,anchor:`estimated-cost`}},"play.expected-words":{title:`Expected article words`,body:`How long you expect each generated article to be. It drives the cost estimate and how many images More images for long videos adds; the article's real length is used once it is written. About 150 words is one minute. Default: 1500.`,tutorial:{page:`Play-Overview`,anchor:`expected-article-words-per-video`}},"play.refresh-review":{title:`Refresh review`,body:`Asks the server to check the setup again and recalculate the estimate now, instead of waiting for you to pause typing. Use it after changing a prompt in the Library.`,tutorial:{page:`Play-Overview`,anchor:`review-the-whole-setup`}},"play.template-name":{title:`Template name`,body:`The name the template is listed under on Play and Templates. The template keeps this setup's settings; the topic you typed and any extra videos are left out, as the list below says.`,tutorial:{page:`Play-Overview`,anchor:`save-as-template`}},"play.queue":{title:`Video queue`,body:`Videos started together run one at a time, in this order. Pausing a project holds the queue; when one fails or is cancelled, the next one starts.`,tutorial:{page:`Play-Overview`,anchor:`the-video-queue`}},"play.voices.name":{title:`Voice name`,body:`The name you pick this voice by on Play and in Edit project. Only you see it.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.provider":{title:`Voice provider`,body:`The text-to-speech service the voice ID belongs to. Only providers set up under Settings are listed.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.voice-id":{title:`Voice ID`,body:`The provider's own id for the voice, copied from its voice library. It is not checked now; a wrong id fails when a run's narration uses it. For Google Gemini, pick one of its 30 prebuilt voices instead.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.languages":{title:`Voice languages`,body:`The languages the voice speaks, as codes such as es, de. Play lists the voice only for projects in these languages. Blank asks the provider when it can say; a voice with unknown languages is offered for every language.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.real-person":{title:`Real person`,body:`Turn this on for a voice cloned from, or made to sound like, a real person. Prepare upload then answers Yes to YouTube's AI use question for videos it narrates. An AI voice that imitates no one stays off.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}}},Fte={"project.next-chapter":{title:`Make the next chapter`,body:`Opens a new draft on Play for this book's next chapter: the same speakers and voices, channel and cast, prompts and settings, with the chapter number one higher. Write or paste the new chapter's text there, then start it. The MP3 and M4B carry the book as their album and the chapter as their track. An audiobook that is not a book yet becomes one, named after it, starting at chapter 2.`,tutorial:{page:`Multiple-Voices`,anchor:`make-the-next-chapter`}},"project.video.cuts":{title:`Cuts`,body:`Every N seconds holds each image for Seconds per image. Follow the narration cuts in the pause after a sentence, as close to that length as the sentences allow (never under 40% of it), and starts a new image at every chapter. It needs word timing, so it works in English and the languages that have it. New projects default to Follow the narration.`,tutorial:{page:`Video-Editing`,anchor:`cuts`}},"project.video.transition":{title:`Transition`,body:`How one image hands over to the next: Cut, Crossfade, Fade through black, Slide or Wipe. The change is centred on the cut and takes the length you pick (0.2 to 2 s), so the video stays exactly as long as its narration. Default: Cut, 0.6 s.`,tutorial:{page:`Video-Editing`,anchor:`cuts`}},"project.video.grade":{title:`Colour grade`,body:`A colour treatment over the whole video: Warm fantasy, Cold, Desaturated or Sepia. It is applied while the video renders, so it costs no API calls, only render time. Default: None.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.vignette":{title:`Vignette`,body:`Darkens the corners of the picture to draw the eye to the middle. Subtle or Strong. Applied while the video renders, with no API cost. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.grain":{title:`Film grain`,body:`Adds moving film grain over the whole picture for an older, filmic feel. Subtle or Strong. Applied while the video renders, with no API cost. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.atmosphere":{title:`Atmosphere`,body:`An overlay Slopify draws itself: rising embers, drifting dust, or low fog along the bottom of the frame. No footage is downloaded and no API is called; it only adds render time. Default: None.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.chapter-cards":{title:`Chapter cards`,body:`Shows each chapter's title in the middle of the picture for 2.5 seconds as the chapter starts, in the caption font. Chapters come from the YouTube description when that step runs, otherwise from the article's headings. Needs narration. Default: off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.animate":{title:`Animate images`,body:`Turns some images into 5-second moving clips with an image-to-video model on your image provider (fal.ai or Replicate). Chapter openers animates the first image of each chapter; Every Nth image animates every 2nd to 10th. Each clip is one paid call, shown in the estimate. An image that cannot be animated stays still. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.pause.sentence":{title:`Pause between sentences`,body:`The least quiet after each sentence, in seconds. Some voices barely breathe between sentences; this adds silence where the pause is shorter, never shortening one or cutting a word, and the captions follow. About 0.25 s is brisk, 0.35 to 0.45 natural or documentary, 0.5 to 0.8 an audiobook's relaxed pace, 0.8 and up sleep content. Default: 0.4; 0 keeps the voice's own.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.pause.paragraph":{title:`Pause between paragraphs`,body:`The least quiet at the end of a paragraph, in seconds, when you want more than between sentences. Usually the narration prompt and the voice pace paragraphs well already, so it is 0 by default: paragraphs get the sentence pause. Try 0.8 to 1.2 for a slower read. A speaker's turn gap is set under Speakers instead. Runs on this computer.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness":{title:`Level the volume`,body:`Brings every narration piece (each chunk, and each speaker's turn) to one loudness before they are joined, so the voice stops jumping between quiet and loud. Then the video, the shorts and the audio files are each set to a finished loudness. Runs on this computer, no API calls; turning it on remakes the levelled narration and the exports, never the speech. Default: on for new runs.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness.video":{title:`Video volume`,body:`How loud the finished video and shorts are, in dB from the recommended level. LUFS is how loud a file sounds on average (the scale YouTube and Spotify use); YouTube and Spotify play everything at about -14 LUFS, so 0 dB here is -14 LUFS. -6 dB is about half as loud (50%), +4 dB about 158%. Peaks always stay under -1.5 dBTP.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness.audio-files":{title:`Audio files volume`,body:`How loud the audio-only WAV and an audiobook's MP3 and M4B are, in dB from -18 LUFS, the level audiobook shops such as ACX ask for (-18 to -23 LUFS). LUFS is how loud a file sounds on average. Type dB or a percentage of the recommended level; peaks always stay under -3 dBTP, which those shops require.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.ambient.source":{title:`Ambient sound`,body:`Rain, a fireplace or wind made on this computer, or your own audio file, played quietly under the whole narration of the long video. It dips while the narrator speaks. Costs no API calls. Shorts never get it. Changing it remakes only the video. Default: None, or the channel's bed.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.level":{title:`Ambient level`,body:`How loud the ambient sound plays under the voice, in decibels from -40 (barely there) to -6 (close to the voice). Whole numbers only. Default: -18 dB.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.fade-in":{title:`Ambient fade in`,body:`How many seconds the ambient sound takes to rise from silence at the start of the video, 0 to 30 in half-second steps. Default: 3 seconds.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.tail":{title:`Ambient tail`,body:`How long the ambient sound keeps playing, fading out, after the narration ends: 0 to 30 seconds in half-second steps. A tail longer than the silence at the end makes the video that much longer. Default: 6 seconds.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.subtitles.mode":{title:`Subtitles`,body:`Off makes none. Subtitle files gives you .srt and .vtt files to upload beside the video. Burn into video draws the captions into the picture and also makes the files; it needs Video on. Captions are timed from your narration on this computer, with no paid API; the first use downloads a speech model of about 95 MB. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.font":{title:`Subtitle font`,body:`The typeface of burned-in captions and chapter cards. Pick a bundled font or one you uploaded (.ttf or .otf); uploaded fonts stay available to every project. Subtitle files carry no font, since players style them. Changing it remakes only the video. Default: the bundled font.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.size":{title:`Subtitle font size`,body:`How big burned-in captions are, from 16 to 120. Larger is easier to read on phones but covers more of the picture. Default: 48.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.position":{title:`Subtitle position`,body:`Where burned-in captions sit on the frame: Top, Upper-middle, Center, Lower-middle or Bottom. Move them up when the pictures have important detail near the bottom. Subtitle files ignore it. Default: Bottom.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.video.style-preview":{title:`Style preview`,body:`Six seconds of the sample project's narration and images, rendered on this computer by the real video renderer with your captions, Look and motion, on the establishing image or a cast picture when there is one. The captions follow the narration word by word. It renders again by itself a moment after you change a setting. It costs no API calls, only a few seconds of your computer's time. Render again forces a fresh one.`,tutorial:{page:`Video-Editing`,anchor:`style-preview`}},"project.edit.article-text":{title:`Article text`,body:`The script the narrator reads, in Markdown. Your edits are kept when other settings change and are saved as a new revision; the narration, images and video made from the old text turn outdated and are remade when you choose. Headings become chapters.`,tutorial:{page:`Editing-a-Project`,anchor:`change-the-article-text`}},"project.edit.regenerate-article":{title:`Regenerate article after review`,body:`Marks the article to be written again by the text model, which is one or more paid text calls. Nothing runs yet: the rebuild review lists it with the narration, images and video it outdates, and you start it there. It replaces any edits you made to the article.`,tutorial:{page:`Editing-a-Project`,anchor:`regenerate-the-article`}},"project.saved-revision":{title:`Saved revision`,body:`Every save of Edit project is a revision: a snapshot of the settings and content. Continuing a run always uses the current one. Saving never starts work; outputs the change affects turn outdated and keep their old version until remade. Remaking is offered as the next action, and History lets you go back.`,tutorial:{page:`Editing-a-Project`,anchor:`history-and-saved-revisions`}},"project.choose-remake":{title:`Choose what to remake`,body:`Opens the rebuild review for every outdated or failed output: what will be made again, kept or skipped, what it costs, and which inputs changed. Nothing runs until you press Remake there, and Keep things as they are closes it with nothing spent.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.prompts.template":{title:`Use saved template`,body:`Copies a prompt from your Library into this project, replacing the raw prompt below. The project keeps its own copy, so later Library edits reach it only when you pick it again or press Use the Library version. Outputs made from the old wording turn outdated; nothing is remade until you choose.`,tutorial:{page:`Editing-a-Project`,anchor:`prompts`}},"project.prompts.raw":{title:`Raw prompt`,body:`This project's own copy of the prompt, with keywords still in double braces such as {{Topic}}. Edit it to change what the model is asked for this project only; the Library prompt is untouched. Saving fills the keywords in again, and what was made from the old wording turns outdated.`,tutorial:{page:`Editing-a-Project`,anchor:`prompts`}},"project.edit.rewrite-description":{title:`Write the description again`,body:`Marks the YouTube description to be written again by the text model, one paid text call. Nothing runs yet: save, and it is remade when you continue the run or start the rebuild review. The description you have now is replaced.`,tutorial:{page:`YouTube-Description`,anchor:`write-it-again-or-turn-it-on-later`}},"project.shorts.clips":{title:`Picked clips`,body:`The moments the text model picked for your shorts, each shown by its first and last sentence. Earlier and Later move a clip's start or end by one sentence; Use my own range picks both from lists. Moving a clip costs no calls and keeps its images where the sentences stay the same. Changes apply when you save and continue the run.`,tutorial:{page:`Shorts`,anchor:`change-the-picked-moments`}},"project.shorts.range":{title:`Clip range`,body:`The first and last sentence of this short, from the narration's timed sentences. The clip must stay between the shortest and longest length you set for shorts and must not overlap another clip; the line under the clip says what to change. Back to the AI's choice restores its pick.`,tutorial:{page:`Shorts`,anchor:`change-the-picked-moments`}},"project.shorts.pick-again":{title:`Pick different moments`,body:`Asks the text model to pick new moments when you save and continue the run, one text call. Ranges you set by hand are dropped. A new clip on the same sentences as an old one keeps its images; any other clip gets new images, one image call each, and is rendered again.`,tutorial:{page:`Shorts`,anchor:`pick-new-moments-or-remake-one-short`}},"project.shorts.remake":{title:`Make this short again`,body:`Makes this one short again when you save and continue the run: its image prompts are written again, its images are drawn again (one image call each) and it is rendered again. Its moment, title and the other shorts stay as they are.`,tutorial:{page:`Shorts`,anchor:`pick-new-moments-or-remake-one-short`}},"project.images.editor":{title:`Edit images`,body:`Every image of the video in the order it is shown. You can edit a drawn image's prompt, replace any image with your own file, move it earlier or later, delete it, or add a drawn image, your own picture or a video clip. A clip plays muted in an image's place, trimmed, slowed or looped to fit. Changes apply after you save.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.images.prompt":{title:`Image prompt`,body:`The words this one image is drawn from, with keywords in double braces filled in from the project. Editing it outdates only this image and the video; it is drawn again, one image call, when you remake outdated outputs. Use saved wording as template copies the prompt as sent so you can edit it.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.images.regenerate":{title:`Regenerate image`,body:`Marks this image to be drawn again from its prompt, one paid image call, with a new result. Nothing runs yet: the image says it is marked, and Keep takes the mark off. Press Save changes, and the rebuild review lists it with the video it outdates. The current image stays until the new one is made.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.narration.editor":{title:`Edit narration`,body:`The narration split into the chunks it was spoken in. Edit a chunk's text, replace its audio with your own file, or have it spoken again. Only the chunks you touch are made again, paid per character, and the video is rendered again with them. Changes apply after you save.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.narration.chunk-text":{title:`Narration chunk text`,body:`What the narrator says in this chunk. Editing it has this chunk spoken again by your voice provider, paid per character of the chunk, when you remake outdated outputs; the other chunks keep their audio. Captions and the video follow. It does not change the article.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.narration.regenerate":{title:`Regenerate narration chunk after review`,body:`Marks this chunk to be spoken again with the same text and voice, paid per character of the chunk, for a new take when a word came out wrong. Nothing runs yet: save, and it is made again when you continue the run. The current audio stays until then.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.captions.editor":{title:`Caption text and timing`,body:`Each caption's words and when it shows, in seconds from the start of the narration. Fix a misheard word or move a caption a little earlier or later; captions must not overlap and must end after they start. Edits cost nothing and only the subtitle files and the video are made again. The narration is not changed.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-captions`}},"project.captions.apply":{title:`Apply caption edits to draft`,body:`Checks every caption (text present, times in order, inside the narration) and puts your edits into the project draft. Nothing is saved until you press Save changes, and the video is rendered again only when you remake outdated outputs.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-captions`}},"project.youtube.summary":{title:`Summary`,body:`The opening of the YouTube description, written by the text model from the article. Edit changes it in place and keeps your text as yours: when the description is written again, your summary stays and the new one waits beside it with Use it, Keep mine and View diff. Use generated goes back to the model's text.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.chapters":{title:`Chapters`,body:`Timestamped chapter lines at the narration's real times, which YouTube turns into chapters. YouTube needs the first at 0:00, at least three, each at least 10 seconds long. Edit changes them in place and your edit survives the next rewrite; Use generated goes back.`,tutorial:{page:`YouTube-Description`,anchor:`chapters-follow-youtubes-rules`}},"project.youtube.hashtags":{title:`Hashtags`,body:`The hashtags at the end of the description; YouTube shows the first three above the title. Edit changes them in place and your edit survives the next rewrite, with the new ones offered beside it. Use generated goes back to the model's.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.tags":{title:`Tags`,body:`Search tags for YouTube's Tags field, which allows 500 characters in all, commas included. They are not shown to viewers. Edit changes them in place and your edit survives the next rewrite; Copy gives them comma-separated, ready to paste.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.pinned-comment":{title:`Pinned comment`,body:`A comment to pin under the video, written with the description: a line or two asking viewers a question about the subject and what to cover next. Your Description prompt can shape it. YouTube pins comments only on a published video: post it from your channel, then choose Pin in its menu. Your edits survive the next rewrite.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.titles":{title:`Other titles`,body:`Two more titles for this video, written with the description, each a different angle. YouTube's A/B Testing, beside the title in Studio, shows up to three titles to viewers and keeps the one watched most. Edit them one per line; your edits survive the next rewrite.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.previous-video":{title:`Previous video for this project`,body:`The link that {{Previous video}} fills in this project's description, ahead of the one on its channel's Brand tab. Paste the video this one follows on from. It changes only what is shown and copied, with no text call. Save links keeps it.`,tutorial:{page:`YouTube-Description`,anchor:`previous-video`}},"project.live.writing":{title:`Live writing`,body:`The text model's words as they arrive, so you can see the article or research taking shape. When a stage makes several calls, the list picks which one to watch. Follow output keeps the newest text in view; untick it to read back. Watching costs nothing extra; the full text is saved when the stage finishes.`,tutorial:{page:`Project-Page`,anchor:`live`}},"project.checkpoints.choices":{title:`Checkpoint choices`,body:`A checkpoint holds the run before a step so you can check and edit what came before it. Tick a step that has not started to add one; untick to remove it, and work already admitted for that step carries on when ready. Pausing the project still applies. Only generated steps can have one. Save checkpoints applies the change.`,tutorial:{page:`Project-Page`,anchor:`checkpoints`}},"project.rebuild.keep-provided":{title:`Keep the provided content`,body:`This output uses a file or text you supplied, and something it depends on, such as the narration, has changed since. Tick to confirm it still fits and keep it as it is. To use something else, cancel and replace the file in Edit project first. Remake stays off until you tick it.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.rebuild.unknown-costs":{title:`Unknown cost estimates`,body:`Some steps use a model with no published price, so their cost cannot be estimated and is left out of the total shown. Tick to start anyway; the real cost is recorded under Cost once they run. Remake stays off until you tick it.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.cost.by-stage":{title:`Cost by stage`,body:`What each stage of this project has cost so far, from every provider call it made, retries and remakes included, priced from the model catalogue when each call finished. Failed calls are not charged here, and taxes and included credits are not counted. Working time is how long the stage's steps were running, over every run.`,tutorial:{page:`Costs-and-Run-Cost`,anchor:`after-a-run-the-run-cost-tab`}},"project.cost.by-model":{title:`Cost by model`,body:`The same spending split by provider and model. Cost is what you paid the provider. Calls through a signed-in command-line tool such as Claude Code or Codex cost $0 on your plan; Via API shows what the same work would cost through the provider's API, for comparison only.`,tutorial:{page:`Costs-and-Run-Cost`,anchor:`after-a-run-the-run-cost-tab`}},"project.upload.item":{title:`What to upload`,body:`Switches the list between the long video and each short, since each is uploaded to YouTube on its own with its own title, description and tags. The ticks and the Fill in YouTube Studio button follow the one you pick.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.real-footage":{title:`Real footage`,body:`Turn this on when the video clips you uploaded are filmed footage, not made by AI. The AI use answer then checks them: laying a Look atmosphere such as fog over real footage makes it Yes, while colour, vignette or grain count as minor edits and keep it No. It is saved with the project and changes nothing in the video.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`ai-use-disclosure`}},"project.upload.slot":{title:`Release time`,body:`When this video goes out. It takes the next free time of a posting-plan line for its series (Settings → YouTube Studio); each short follows at its own times. Pick another free time, or Not scheduled to set it in Studio yourself. Calendar → Releases shows and moves every time. Upload it before its upload-by time so YouTube's checks finish while it is private.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.steps":{title:`Upload steps`,body:`Everything YouTube Studio asks for, in the order it asks: file, title, description, thumbnail, playlist, audience, AI use, tags and the schedule. Copy puts each value on the clipboard. The tick box beside each step is only a note to yourself, remembered in this browser; it changes nothing in the project.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.fill-studio":{title:`Fill in YouTube Studio`,body:`Opens Studio's upload page and adds this item to what waits for the Slopify Studio extension, which must be installed and paired (Settings, YouTube Studio). Each upload dialog you start is filled with the first waiting item. If Studio's dialog lacks a field, nothing is filled and the whole pack is copied instead. You check it and press Publish; Slopify never uploads or publishes.`,tutorial:{page:`Studio-Extension`,anchor:`fill-in-an-upload`}},"project.upload.queue":{title:`Waiting for Studio`,body:`The videos and shorts Fill in YouTube Studio added, oldest first, from every project. Each new upload dialog in Studio is filled with the first, which then leaves the list. It survives restarting Slopify; an item waits up to 24 hours, and a new pairing token clears the list. Remove takes an item out without filling it.`,tutorial:{page:`Studio-Extension`,anchor:`upload-several-one-after-another`}},"project.free-space":{title:`Free space`,body:`Once a project has finished, it can drop the working files it was made from (images, narration parts, subtitle timing, render settings) and keep what gets published: the video, shorts, thumbnail, article, description, document and anything you uploaded. The button says how much space that frees. Changing the project later makes those files again first, which takes time and provider credits. Settings → Storage offers the same for every project.`,tutorial:{page:`Project-Page`,anchor:`free-space`}},"project.mark-uploaded":{title:`Mark uploaded`,body:`Records that you uploaded this finished video to YouTube yourself, so it leaves the ready-to-upload lists on Home and here and shows an Uploaded badge. Slopify does not upload anything or check YouTube. Undo takes the mark off.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`mark-a-video-uploaded`}},"project.edit.update-glossary":{title:`Update from other projects`,body:`Copies your other projects' Pronunciation Glossary terms into this project again, picking up any added since the last copy. The project keeps its own copy, so nothing changes until you press this. After you save, only the narration chunks whose words those terms change are spoken again, paid per character.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"project.edit.show-figures":{title:`Show tables and figures on screen`,body:`Shows each described table, figure, equation and code block in the video while its description is spoken, as the article's picture or a card drawn on this computer at no cost. Turning it on or off renders the video again, and any Shorts that include a card; the narration is kept. The cards appear under Images, From the article, and can be made again there.`,tutorial:{page:`Play-Outputs`,anchor:`show-tables-and-figures-on-screen`}},"project.edit.describe-figures":{title:`Describe tables and figures`,body:`The text model writes a short spoken passage for each table, figure, equation and code block, said in its place. Turning it on costs one text-model call per block, and after you save, the narration chunks that contain a block are spoken again, paid per character (the whole narration when Chunking is the whole article). Other chunks keep their audio; captions and timing are redone to match.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"project.edit.update-aliases":{title:`Update from Library`,body:`Copies Library, Aliases into this project again, picking up aliases added or changed since the last copy. The project keeps its own copy, so a Library edit reaches it only when you press this. After you save, only the narration chunks the changed aliases touch are spoken again, paid per character.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`use-aliases-in-a-video`}}},Ite={"settings.diagnostics":{title:`Download diagnostics`,body:`Saves slopify-diagnostics.json: the Slopify version, your system and Node version, which providers are set up or found, the project count and the model catalogue's state. It never holds your keys, prompts or project content. Attach it to a bug report so the problem can be found faster.`,tutorial:{page:`Troubleshooting`,anchor:`download-diagnostics`}},"settings.autostart":{title:`Start Slopify when you log in`,body:`Slopify starts in the background when you log in to this computer, without opening a browser tab; open it from your bookmark. It uses your account's own start-up list, so no administrator password is needed, and turning it off removes exactly what it added. Default: off. In Docker, Slopify starts whenever Docker does, so this only shows Docker's own setting.`,tutorial:{page:`Start-at-Login`,anchor:`turn-it-on`}},"settings.providers.api-key":{title:`API key`,body:`The key that lets Slopify call this provider on your account; the provider bills you for what it makes. It is stored on this computer only, sent only to that provider, and never put in a backup or export. Paste a new key and Save to replace the old one.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-key`}},"settings.providers.test-key":{title:`Test`,body:`Asks the provider whether the key works, with the cheapest harmless call it allows. A key pasted in the field is tested before you save it; with the field empty, the saved key is. Nothing is generated, billed or stored. When it fails, the answer says why: a rejected key, missing permission, no credit, or the provider being down.`,tutorial:{page:`Providers-and-Keys`,anchor:`test-a-key`}},"settings.provider.openrouter":{title:`OpenRouter`,body:`Writes the text (research, script, article, titles, descriptions) with hundreds of models from many companies through one key. Each call is charged per token from the credit you buy on OpenRouter; prices follow the model catalogue. Choose it when you want a model the command-line tools do not offer.`,tutorial:{page:`Providers-and-Keys`,anchor:`openrouter`}},"settings.provider.claude-code":{title:`Claude Code CLI`,body:`Writes the text with the Claude Code command-line tool on this computer, using your own Claude sign-in, so no API key is needed and calls count toward your Claude plan's limits instead of costing per call. Sign in first by running claude auth login in a terminal. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.codex":{title:`Codex CLI`,body:`Writes the text with the Codex command-line tool on this computer, using your own ChatGPT sign-in, so no API key is needed and calls count toward your plan's limits instead of costing per call. Sign in first by running codex login in a terminal. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.gemini":{title:`Gemini CLI`,body:`Writes the text with the Gemini command-line tool on this computer, using your own Google sign-in, so no API key is needed. Sign in first by running gemini in a terminal and following its login steps. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.codex-image":{title:`Codex CLI images`,body:`Draws the images with the Codex command-line tool, using your ChatGPT sign-in instead of an API key, so images count toward your plan's limits rather than costing per image. It shares its executable path and sign-in with Codex text. Slopify draws up to 4 images at once.`,tutorial:{page:`AI-CLIs`,anchor:`codex-images`}},"settings.provider.elevenlabs":{title:`ElevenLabs`,body:`Narrates the script with ElevenLabs voices, including voices you added to your ElevenLabs account. It is billed in characters of narration from your ElevenLabs plan. A restricted key needs Text to Speech and Models read access.`,tutorial:{page:`Providers-and-Keys`,anchor:`elevenlabs`}},"settings.provider.openai-tts":{title:`OpenAI speech`,body:`Narrates the script with OpenAI's text-to-speech voices. It is billed per character or per audio minute, depending on the model, from prepaid credit on your OpenAI platform account; new accounts need at least $5 of credit before any call works.`,tutorial:{page:`Providers-and-Keys`,anchor:`openai-speech`}},"settings.provider.cartesia":{title:`Cartesia`,body:`Narrates the script with Cartesia voices, billed in characters from your Cartesia plan. The free plan needs no card, so it is an easy way to try narration.`,tutorial:{page:`Providers-and-Keys`,anchor:`cartesia`}},"settings.provider.inworld":{title:`Inworld`,body:`Narrates the script with Inworld voices, billed per character from your Inworld account. Paste the Base64 credentials of a Standard key exactly as shown; Realtime-only keys do not work.`,tutorial:{page:`Providers-and-Keys`,anchor:`inworld`}},"settings.provider.system-voice":{title:`System voice`,body:`Narrates with the speech your computer already has: macOS voices, Windows voices, or on Linux Piper, SVOX Pico or eSpeak NG. No key, no account and no charge, but it sounds robotic next to ElevenLabs or OpenAI. On Linux, install espeak-ng if nothing is found. Its models are the speech programs Slopify found; add one of their voices in Settings → Voices.`,tutorial:{page:`Providers-and-Keys`,anchor:`the-system-voice`}},"settings.provider.google-tts":{title:`Google Gemini voices`,body:`Narrates with Gemini's 30 prebuilt voices, billed to your Gemini API key per text and audio token. It uses the key saved for Google images unless you save one here. Two speakers' consecutive turns can go in one request (see Speakers on Play).`,tutorial:{page:`Providers-and-Keys`,anchor:`google-gemini-speech`}},"settings.provider.fal":{title:`fal.ai`,body:`Draws the images and thumbnails with the image models fal.ai hosts, charged per image from prepaid credit. fal.ai locks the account when the balance runs out, so a run stops at the images step until you add credit.`,tutorial:{page:`Providers-and-Keys`,anchor:`falai`}},"settings.provider.replicate":{title:`Replicate`,body:`Draws the images and thumbnails with the image models Replicate hosts, charged per image or per second of compute from credit you buy up front.`,tutorial:{page:`Providers-and-Keys`,anchor:`replicate`}},"settings.provider.openai-image":{title:`OpenAI images`,body:`Draws the images and thumbnails with OpenAI's GPT Image models, charged per image from prepaid credit on your OpenAI platform account. GPT Image may also need Verify Organization on the OpenAI platform before it works.`,tutorial:{page:`Providers-and-Keys`,anchor:`openai-images`}},"settings.provider.google-image":{title:`Google images`,body:`Draws the images and thumbnails with Google's Gemini image models, charged per image. Use a key made in Google AI Studio on a project with billing set up; Gemini image models are not on the free tier.`,tutorial:{page:`Providers-and-Keys`,anchor:`google`}},"settings.cli.path":{title:`Executable path`,body:`Where the command-line tool is on this computer. Leave it blank and Slopify finds it on PATH, the list of folders your terminal searches. Set an absolute path, without quotes or arguments, when the tool is installed somewhere else or you have more than one copy. Save checks the tool answers.`,tutorial:{page:`AI-CLIs`,anchor:`set-the-executable-path`}},"settings.cli.managed-on-host":{title:`Managed on host`,body:`Slopify runs in Docker, so this tool runs on your computer outside the container, with the sign-in it already has there. Its path cannot be changed here. After you install, update or remove a command-line tool, run the Docker launcher again so Slopify sees the change.`,tutorial:{page:`AI-CLIs`,anchor:`in-docker-the-host-helper`}},"settings.health":{title:`Health check`,body:`Asks each command-line tool whether it is signed in, makes the cheapest harmless call each saved key allows (nothing is generated or billed), and checks that the models your templates, schedules, drafts and projects use are still offered and answer for your key. Run it after changing a key or when a run stops at a provider; Check again on a provider's row checks that one alone.`,tutorial:{page:`Providers-and-Keys`,anchor:`check-all-providers`}},"settings.models.catalogue":{title:`Model catalogue`,body:`The list of models, prices and retirements the pickers and cost estimates use. Slopify checks the published catalogue and OpenRouter's live list when it starts and once a day; Check now does it at once. New models appear and prices update; nothing you made changes. Your own edits to the local file are kept.`,tutorial:{page:`Models`,anchor:`what-the-catalogue-covers`}},"settings.models.replace":{title:`Replace with published file`,body:`Overwrites the local catalogue file with the published one, dropping any edits you made to it. The previous file is saved beside it first, so you can copy your edits back. Use it when the local file is broken or you want the published list exactly.`,tutorial:{page:`Models`,anchor:`replace-the-local-file-with-the-published-one`}},"settings.models.retired":{title:`Retired models in use`,body:`Templates, schedules, drafts and projects with steps still to run that pick a model the provider no longer offers. A run that reaches one stops and says so. Switch replaces only that one model choice with the suggestion shown; Switch all does every one that has a suggestion.`,tutorial:{page:`Models`,anchor:`switch-away-from-a-retired-model`}},"settings.playback.silence-gap":{title:`Silence between segments`,body:`Seconds of quiet between the intro and the narration, and between the narration and the outro, in every new video, unless Play sets a different gap for one video. It only matters when an intro or outro is set; 0 runs them together. Default: 3 seconds, from 0 to 30. Videos already started keep their own gap.`,tutorial:{page:`Settings-Reference`,anchor:`silence-between-segments`}},"settings.loudness":{title:`Level the volume for new runs`,body:`Whether a new run on Play (and a template or quick short) starts with Level the volume on, and at which volumes. On evens out every narration piece and sets the video to about -14 LUFS, the loudness YouTube plays at, and the audio files to -18 LUFS. A project keeps what it started with; change it there in Edit project. Default: on.`,tutorial:{page:`Settings-Reference`,anchor:`level-the-volume-for-new-runs`}},"settings.appearance":{title:`Appearance`,body:`Light or dark colours for Slopify on this computer. System follows your operating system's setting and changes with it. Default: System. It changes at once and does not affect your videos.`,tutorial:{page:`Settings-Reference`,anchor:`appearance`}},"settings.notifications":{title:`Notifications`,body:`Slopify tells you when a run finishes, fails, or stops to wait for your review, and when an automatic review kept an item flagged and needs your decision. The message holds the project title, what happened and a link to the project, never your keys. Browser notifications need a Slopify tab open; a Notification URL works with none open.`,tutorial:{page:`Notifications`,anchor:`when-slopify-notifies-you`}},"settings.notifications.sounds":{title:`Run sounds`,body:`Plays a chime when a run starts and a different, longer one when it finishes, fails or stops to wait for you, while any Slopify tab is open. Only one tab plays each. Needs no permission, but the browser stays silent until the page has been clicked once. This browser only. Default: on.`,tutorial:{page:`Notifications`,anchor:`run-sounds`}},"settings.notifications.browser":{title:`Browser notifications`,body:`Shows a notification from this browser while any Slopify tab is open, even in the background. Turning it on asks the browser's permission. It applies to this browser only, so turn it on in each browser you use. Default: off.`,tutorial:{page:`Notifications`,anchor:`turn-on-browser-notifications`}},"settings.notifications.url":{title:`Notification URL`,body:`An address Slopify POSTs a short plain-text message to, with no tab open. For your phone, install the ntfy app, subscribe to a topic with a long random name, and paste https://ntfy.sh/that-topic. Any address that accepts a POST works. Each message is sent once, with a 5 second timeout. Leave it empty to turn it off.`,tutorial:{page:`Notifications`,anchor:`get-notifications-on-your-phone-notification-url`}},"settings.studio.extension":{title:`Upload pack and extension`,body:`Slopify never uploads or publishes. A finished project's Prepare upload lists everything Studio asks for, with Copy buttons. The optional Slopify Studio browser extension fills Studio's upload dialog from that pack; you still press Publish. Install it from Install the Studio extension below: Download, three steps, then pair it with the token.`,tutorial:{page:`Studio-Extension`,anchor:`get-the-extension`}},"settings.studio.playlist":{title:`Playlists`,body:`The YouTube playlists upload packs offer, typed exactly as Studio names them. Pick Every channel for the default list, or a channel to give it its own. Ticked On by default means every project goes into it; Prepare upload changes the ticks for one project. The extension ticks each one in Studio. Default: none.`,tutorial:{page:`Studio-Extension`,anchor:`settings--youtube-studio`}},"settings.studio.install":{title:`Install the Studio extension`,body:`The extension comes with Slopify: Download saves it for the browser picked, nothing is fetched from a store. Chrome, Edge and Brave load the unzipped folder with Load unpacked (Developer mode); Firefox 128 or newer loads the zip as a temporary add-on, which it forgets on restart. Then pair it with the token above. A new Slopify may bring a new extension: download and load it again after updating.`,tutorial:{page:`Studio-Extension`,anchor:`get-the-extension`}},"settings.studio.pairing":{title:`Extension pairing token`,body:`A secret the Slopify Studio extension needs before it may read your upload packs, so no other page can. Copy it into the extension's options and press Pair. New pairing token makes a fresh one and unpairs the extension until you paste the new token.`,tutorial:{page:`Studio-Extension`,anchor:`pair-it-with-slopify`}},"settings.storage.export":{title:`Export and import`,body:`Export everything saves every project with its files and history, your library, templates, schedules, Play drafts, fonts, settings and usage in one .tar file; never provider keys. Import adds to this install and replaces nothing: projects already here are skipped, taken names arrive as “(imported)” and schedules arrive paused. Running projects must finish or pause first.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`export-and-import`}},"settings.storage.clean":{title:`Clean orphan files`,body:`Deletes files in the projects folder that no project records any more, and uploaded files that no draft, template or project uses. Your projects, outputs and library are never touched. Slopify also does this each time it starts; use it after a crash or to free space now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`clean-orphan-files`}},"settings.storage.disk":{title:`Disk space`,body:`What Slopify stores on this computer: project files (outputs plus the working files they were made from), staged uploads, and deleted projects still in the trash. Deleted projects free their space when the trash removes them after 30 days, or when you choose Delete now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`disk-space`}},"settings.storage.keep-outputs":{title:`Keep outputs only`,body:`On a finished project, deletes the working files it was made from (images, narration parts, subtitle timing, render settings) and keeps the video, shorts, thumbnail, article, description, document and your uploads. Changing the project later makes those files again first, which takes time and provider credits.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`keep-outputs-only`}},"settings.sample.restore":{title:`Sample projects`,body:`The finished examples that come with Slopify: a narrated video, an audiobook and a podcast, which you can look through without spending anything. Restore samples adds back any that were deleted and replaces the others with the originals. Your own copies of them are not touched.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`sample-projects`}},"settings.files":{title:`Your files`,body:`Your projects, automatic backups and exports live here; new installs use Documents/Slopify. The database, settings, keys and logs stay in Slopify's hidden data folder. Moving copies every file, checks each copy by size and checksum, then switches, and keeps the old folder until you delete it. It takes as long as copying your projects and cannot start while a project is being made.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`see-your-files`}},"settings.files.docker":{title:`Your files`,body:`Your projects and backups are in the folders Docker shares with this computer. The container cannot move its own folders, so run the command shown on the computer running Docker: the installer waits for running work, copies your projects, checks the copy and remounts the new folder.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`see-your-files`}},"settings.files.new-folder":{title:`New folder`,body:`The full path of the folder your files move to, on another disk or a synced folder for example. Slopify makes Projects and Backups inside it. It must be empty or not exist yet. The move needs as much free space there as your projects take now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`move-your-files-to-another-folder`}},"settings.backups":{title:`Daily backup`,body:`Once a day Slopify writes the file Export everything makes into the backup folder and deletes its own oldest backups beyond the number you keep. Nothing else there is touched. A backup waits while projects are being made; if Slopify was off at the time, it backs up a couple of minutes after it starts. Each backup can be many gigabytes.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.auto":{title:`Back up automatically`,body:`Turns the daily backup on or off. Default: off, because each backup holds every project's video and can fill a disk. Back up now works either way. Press Save after changing it.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.time":{title:`Time of day`,body:`When the daily backup runs, in this browser's time zone. Pick a time the computer is usually on and idle; a backup waits for running projects. Default: 03:00.`,tutorial:{page:`Backups`,anchor:`when-the-daily-backup-runs`}},"settings.backups.keep":{title:`Keep last`,body:`How many of Slopify's own backups stay in the folder; after a new one is written, the oldest beyond this number are deleted. Each holds everything, so disk use grows with this number. Default: 5, from 1 to 30.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.folder":{title:`Backup folder`,body:`Where backups are written. Leave it empty to use the Backups folder beside your projects (Documents/Slopify/Backups on a new install), which moves with them. Point it at another disk or a synced folder to keep copies away from this disk. Slopify only ever deletes its own backup files there.`,tutorial:{page:`Backups`,anchor:`where-the-files-go-and-what-they-are-called`}},"settings.trash":{title:`Trash`,body:`Deleted projects, prompts, intros and outros, templates and schedules stay here for 30 days, then are removed for good along with a project's files. Restore puts one back; if its name was taken meanwhile it comes back renamed, and a schedule comes back paused. Delete now frees the space at once.`,tutorial:{page:`Trash`}},"settings.patch-notes":{title:`Patch notes`,body:`What changed in each version of Slopify. The newest notes are open here; older versions are folded under Earlier versions, and each opens when you pick it. They ship with the app, so they work offline. After an update, the new version's notes open by themselves once; a fresh install skips that. On a major update the What's new tour shows instead and links here.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`read-the-patch-notes`}},"settings.whats-new":{title:`What's new in this version`,body:`Opens the patch notes for the version you are running, in Settings, Patch notes. When this version has no notes of its own, it opens the newest ones instead.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`whats-new-tour-on-a-major-update`}},"settings.updates":{title:`Updates`,body:`The circular-arrows button at the foot of the sidebar (at the top on a phone) checks for a newer Slopify and installs it. A dot on it means an update is ready. If a video is being made, the update waits until it finishes, and you can cancel it meanwhile. Slopify restarts itself and this page reconnects.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`update-from-the-app`}},"home.channel":{title:`Channel`,body:`Shows Home and the other screens for one channel, or for all of them. It only filters what you see: projects, schedules and costs of other channels keep running. Slopify remembers the choice in this browser.`,tutorial:{page:`Channels`,anchor:`show-one-channels-work`}},"home.needs-you":{title:`Needs you`,body:`Runs held at a review before a step, topics a schedule suggested for you to accept or reject, and runs that failed with the fix to try. Nothing here moves on until you act; approving a review from here lets that run continue.`,tutorial:{page:`Home-and-Projects`,anchor:`needs-you`}},"home.running":{title:`Running now`,body:`Videos being made or paused, with the step each is on and how long it has taken. Up to 3 show here; Projects lists them all. Open one to follow it live, pause it or cancel it.`,tutorial:{page:`Home-and-Projects`,anchor:`running-now`}},"home.coming-up":{title:`Coming up`,body:`The schedule runs due in the next 7 days, with the template and topic each will use. Paused schedules show too. Plan or move runs on the calendar.`,tutorial:{page:`Home-and-Projects`,anchor:`coming-up`}},"home.ready":{title:`Ready to upload`,body:`Finished videos you have not marked uploaded. Prepare upload lists everything YouTube Studio asks for, with Copy buttons; Slopify never uploads for you. Mark uploaded takes the video off this list; Projects still has it.`,tutorial:{page:`Home-and-Projects`,anchor:`ready-to-upload`}},"home.this-week":{title:`This week`,body:`Videos made since Monday and what their provider calls cost. Calls billed to a command-line plan cost nothing per call, so the API figure says what they would have cost with API keys. The bars show how much of each plan's weekly limit is used, from the tool's last reading.`,tutorial:{page:`Home-and-Projects`,anchor:`this-week`}},"welcome.samples":{title:`Samples`,body:`Finished projects that come with Slopify: a narrated video, an audiobook and a podcast. They are read-only, so nothing you try on them costs anything; Make my own copy on a sample's page gives you one to edit.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`explore-the-samples`}},"welcome.found":{title:`Found on this computer`,body:`Claude Code, Codex and Gemini CLI write the text with your own sign-in, so no API key is needed for it, and Codex also draws the images. The narration uses a voice key (OpenAI, ElevenLabs, Cartesia or Inworld) when one is saved in Settings → Providers, and otherwise your computer's built-in voice, so no key is needed to start.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`found-on-this-computer`}},"welcome.voice":{title:`Narration voice`,body:`Who reads the script aloud. With a voice key saved (OpenAI, ElevenLabs, Cartesia or Inworld), that provider narrates. Without one, your computer's own speech does it for free: macOS or Windows voices, or eSpeak NG on Linux. It sounds robotic, so add a key in Settings → Providers when you want a better voice.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`narration-voice`}},"welcome.short":{title:`Make a 60-second short`,body:`Slopify writes a script of about 150 words, narrates it, draws four vertical images and renders a captioned 9:16 short, usually in about five minutes with the command-line tools. The narration uses your voice provider's credit, or nothing with the built-in voice; text and images through a command-line tool count toward its plan.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-3-make-a-60-second-short`}},"welcome.topic":{title:`Topic`,body:`What the short is about, in a few words or a question, up to 200 characters. Slopify writes the script from it without a research step, to keep the first short quick, so a specific topic gives a sharper short than a broad one.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-3-make-a-60-second-short`}},"welcome.pack":{title:`Style`,body:`The starter pack whose prompts, voice and art direction the short uses. General is a neutral explainer style. Making the short with a pack adds its prompts and suggested voice to your library; Add to library also adds its template for Play.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-2-pick-a-style`}},"welcome.packs":{title:`Starter packs`,body:`Each pack adds prompts, a suggested voice and a Play template for one kind of channel, so you can pick the template on Play, type a topic and go. Adding a pack twice changes nothing, and it never replaces a prompt or template of yours with the same name.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`starter-packs`}}},Lte={...Pte,...Fte,...Mte,...Nte,...Ite};function nb(e,t){let n=Lte[e];if(t===void 0)return n;let r=e=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e);return{...n,title:r(n.title),body:r(n.body)}}function Rte(e){return e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/`([^`]*)`/g,`$1`).replace(/(\*\*|__)(.+?)\1/g,`$2`).replace(/(^|[^\p{L}\p{N}])[*_]([^*_]+)[*_](?![\p{L}\p{N}])/gu,`$1$2`).replace(/<[^>]+>/g,``).trim()}function rb(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\p{M} _-]/gu,``).replace(/ /g,`-`)}var zte=`/help/tutorials`;function ib(e,t){return`${zte}/${encodeURIComponent(e)}${t?`#${t}`:``}`}function Bte(e,t,n){return e.replace(/\]\(([A-Za-z0-9][A-Za-z0-9-]*)?(?:#([^)\s]*))?\)/g,(e,r,i)=>{if(r===void 0&&i===void 0)return e;let a=r??n;return t.has(a)?`](${ib(a,i)})`:e})}function Vte(e){let t=/^\s*#\s+(.+?)\s*#*\s*(?:\n|$)/.exec(e);return t===null?{title:void 0,body:e}:{title:t[1],body:e.slice(t[0].length)}}function Hte(e){let t=/^\/help\/tutorials\/([^/#?]+)(?:#(.*))?$/.exec(e);if(t===null)return;let n=t[2];return{page:decodeURIComponent(t[1]??``),anchor:n===void 0||n===``?void 0:decodeURIComponent(n)}}function Ute(e,t,n=[]){let r=new Map;for(let e of n){let t=rb(Rte(e));r.set(t,(r.get(t)??0)+1)}for(let n of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=rb((n.textContent??``).trim()),i=r.get(e)??0;if(r.set(e,i+1),(i===0?e:`${e}-${String(i)}`)===t)return n}}var ab=Cte,ob=Tte,Wte=wte,Gte=Ote;function sb({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,h.jsx)(Ete,{children:(0,h.jsx)(Dte,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:12,className:I(`z-50 w-[min(340px,calc(100vw-24px))] rounded-control border border-line bg-raised p-3 text-small text-ink-2`,`shadow-[var(--shadow-pop)] outline-hidden`,e),...r})})}function B({id:e,label:t,vars:n,className:r}){let i=nb(e,n);return(0,h.jsxs)(ab,{children:[(0,h.jsx)(ob,{type:`button`,"aria-label":`About ${t??i.title}`,"data-help-id":e,className:I(`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-raised hover:text-ink`,r),children:(0,h.jsx)(Ic,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.jsxs)(sb,{className:`space-y-2 leading-[1.45]`,children:[(0,h.jsx)(`p`,{className:`m-0 font-semibold text-ink`,children:i.title}),i.body.split(`
|
|
50
|
+
`},fm=0,pm=[];function mm(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(fm++)[0],a=m.useState(Ip)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fp([e.lockRef.current],(e.shards||[]).map(lm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sm(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=em(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=em(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return om(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(pm.length&&pm[pm.length-1]===a){var r=`deltaY`in n?cm(n):sm(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&um(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(lm).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:hm(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=sm(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,cm(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,sm(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return pm.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Yp),document.addEventListener(`touchmove`,c,Yp),document.addEventListener(`touchstart`,u,Yp),function(){pm=pm.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Yp),document.removeEventListener(`touchmove`,c,Yp),document.removeEventListener(`touchstart`,u,Yp)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:dm(i)}):null,p?m.createElement(Kp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hm(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gm=Ep(Dp,mm),_m=m.forwardRef(function(e,t){return m.createElement(kp,up({},e,{ref:t,sideCar:gm}))});_m.classNames=kp.classNames;var vm=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},ym=new WeakMap,bm=new WeakMap,xm={},Sm=0,Cm=function(e){return e&&(e.host||Cm(e.parentNode))},eee=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Cm(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},tee=function(e,t,n,r){var i=eee(t,Array.isArray(e)?e:[e]);xm[n]||(xm[n]=new WeakMap);var a=xm[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(ym.get(e)||0)+1,l=(a.get(e)||0)+1;ym.set(e,c),a.set(e,l),o.push(e),c===1&&i&&bm.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Sm++,function(){o.forEach(function(e){var t=ym.get(e)-1,i=a.get(e)-1;ym.set(e,t),a.set(e,i),t||(bm.has(e)||e.removeAttribute(r),bm.delete(e)),i||e.removeAttribute(n)}),Sm--,Sm||(ym=new WeakMap,ym=new WeakMap,bm=new WeakMap,xm={})}},wm=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||vm(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),tee(r,i,n,`aria-hidden`)):function(){return null}},nee=Object.defineProperty,Tm=(e,t)=>nee(e,`name`,{value:t,configurable:!0}),Em=`Dialog`,[Dm,ree]=yd(Em),[iee,Om]=Dm(Em),km=Tm(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=Zd({prop:r,defaultProp:i??!1,onChange:a,caller:Em}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(iee,{scope:t,triggerRef:s,contentRef:c,contentId:gf(),titleId:gf(),descriptionId:gf(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:g,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Am=`DialogPortal`,[aee,jm]=Dm(Am,{forceMount:void 0}),Mm=Tm(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Om(Am,t);return(0,h.jsx)(aee,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(of,{present:n||a.open,children:(0,h.jsx)(np,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Nm=`DialogOverlay`,Pm=m.forwardRef(Tm(function(e,t){let n=jm(Nm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Om(Nm,e.__scopeDialog);return a.modal?(0,h.jsx)(of,{present:r||a.open,children:(0,h.jsx)(Fm,{...i,ref:t})}):null},`DialogOverlay`)),oee=Zu(`DialogOverlay.RemoveScroll`),Fm=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,...r}=e,i=Om(Nm,n),a=Ju(t,Mf());return(0,h.jsx)(_m,{as:oee,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(md.div,{"data-state":Gm(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Im=`DialogContent`,Lm=m.forwardRef(Tm(function(e,t){let n=jm(Im,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Om(Im,e.__scopeDialog);return(0,h.jsx)(of,{present:r||a.open,children:a.modal?(0,h.jsx)(Rm,{...i,ref:t}):(0,h.jsx)(zm,{...i,ref:t})})},`DialogContent`)),Rm=m.forwardRef(Tm(function(e,t){let n=Om(Im,e.__scopeDialog),r=m.useRef(null),i=Ju(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return wm(e)},[]),(0,h.jsx)(Bm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ld(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ld(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Ld(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),zm=m.forwardRef(Tm(function(e,t){let n=Om(Im,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(Bm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Bm=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Om(Im,n);return cp(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(Uf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(jf,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Gm(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Vm=`DialogTitle`,Hm=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,...r}=e,i=Om(Vm,n),{setTitleCount:a}=i;return Hd(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(md.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Um=`DialogDescription`,see=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,...r}=e,i=Om(Um,n),{setDescriptionCount:a}=i;return Hd(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(md.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),cee=`DialogClose`,Wm=m.forwardRef(Tm(function(e,t){let{__scopeDialog:n,...r}=e,i=Om(cee,n);return(0,h.jsx)(md.button,{type:`button`,...r,ref:t,onClick:Ld(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Gm(e){return e?`open`:`closed`}Tm(Gm,`getState`);var Km=Object.defineProperty,qm=(e,t)=>Km(e,`name`,{value:t,configurable:!0});function Jm(e){let[t,n]=m.useState(void 0);return Hd(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}qm(Jm,`useSize`);var Ym=[`top`,`right`,`bottom`,`left`],Xm=Math.min,Zm=Math.max,Qm=Math.round,$m=Math.floor,eh=e=>({x:e,y:e}),th={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function nh(e,t,n){return Zm(e,Xm(t,n))}function rh(e,t){return typeof e==`function`?e(t):e}function ih(e){return e.split(`-`)[0]}function ah(e){return e.split(`-`)[1]}function oh(e){return e===`x`?`y`:`x`}function sh(e){return e===`y`?`height`:`width`}function ch(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function lh(e){return oh(ch(e))}function uh(e,t,n){n===void 0&&(n=!1);let r=ah(e),i=lh(e),a=sh(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=hh(o)),[o,hh(o)]}function dh(e){let t=hh(e);return[fh(e),t,fh(t)]}function fh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ph=[`left`,`right`],mh=[`right`,`left`],lee=[`top`,`bottom`],uee=[`bottom`,`top`];function dee(e,t,n){switch(e){case`top`:case`bottom`:return n?t?mh:ph:t?ph:mh;case`left`:case`right`:return t?lee:uee;default:return[]}}function fee(e,t,n,r){let i=ah(e),a=dee(ih(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(fh)))),a}function hh(e){let t=ih(e);return th[t]+e.slice(t.length)}function pee(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function gh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:pee(e)}function _h(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function vh(e,t,n){let{reference:r,floating:i}=e,a=ch(t),o=lh(t),s=sh(o),c=ih(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=ah(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function mee(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=rh(t,e),p=gh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_h(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=_h(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var hee=50,gee=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mee},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=vh(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<hee&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=vh(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},yh=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=rh(e,t)||{};if(l==null)return{};let d=gh(u),f={x:n,y:r},p=lh(i),m=sh(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Xm(d[_],T),D=Xm(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=nh(E,k,O),ee=!c.arrow&&ah(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,te=ee?k<E?k-E:k-O:0;return{[p]:f[p]+te,data:{[p]:A,centerOffset:k-A-te,...ee&&{alignmentOffset:te}},reset:ee}}}),bh=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=rh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ih(r),_=ch(o),v=ih(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[hh(o)]:dh(o)),x=p!==`none`;!d&&x&&b.push(...fee(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=uh(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===ch(t)||T.every(e=>ch(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=ch(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function xh(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Sh(e){return Ym.some(t=>e[t]>=0)}var Ch=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=rh(e,t);switch(i){case`referenceHidden`:{let e=xh(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Sh(e)}}}case`escaped`:{let e=xh(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Sh(e)}}}default:return{}}}}},wh=new Set([`left`,`top`]);async function Th(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ih(n),s=ah(n),c=ch(n)===`y`,l=wh.has(o)?-1:1,u=a&&c?-1:1,d=rh(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Eh=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Th(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Dh=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=rh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ch(i),p=oh(f),m=u[p],h=u[f],g=(e,t)=>nh(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Oh=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=rh(e,t),u={x:n,y:r},d=ch(i),f=oh(d),p=u[f],m=u[d],h=rh(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=wh.has(ih(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},kh=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=rh(e,t),c=await i.detectOverflow(t,s),l=ih(n),u=ah(n),d=ch(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Xm(p-c[m],g),y=Xm(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Zm(c.left,c.right):S=p-2*Zm(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ah(){return typeof window<`u`}function jh(e){return Ph(e)?(e.nodeName||``).toLowerCase():`#document`}function Mh(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nh(e){return((Ph(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ph(e){return Ah()?e instanceof Node||e instanceof Mh(e).Node:!1}function Fh(e){return Ah()?e instanceof Element||e instanceof Mh(e).Element:!1}function Ih(e){return Ah()?e instanceof HTMLElement||e instanceof Mh(e).HTMLElement:!1}function Lh(e){return!Ah()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Mh(e).ShadowRoot}function Rh(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Yh(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function zh(e){return/^(table|td|th)$/.test(jh(e))}function Bh(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Vh=/transform|translate|scale|rotate|perspective|filter/,Hh=/paint|layout|strict|content/,Uh=e=>!!e&&e!==`none`,Wh;function Gh(e){let t=Fh(e)?Yh(e):e;return Uh(t.transform)||Uh(t.translate)||Uh(t.scale)||Uh(t.rotate)||Uh(t.perspective)||!qh()&&(Uh(t.backdropFilter)||Uh(t.filter))||Vh.test(t.willChange||``)||Hh.test(t.contain||``)}function Kh(e){let t=Zh(e);for(;Ih(t)&&!Jh(t);){if(Gh(t))return t;if(Bh(t))return null;t=Zh(t)}return null}function qh(){return Wh??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Wh}function Jh(e){return/^(html|body|#document)$/.test(jh(e))}function Yh(e){return Mh(e).getComputedStyle(e)}function Xh(e){return Fh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zh(e){if(jh(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Lh(e)&&e.host||Nh(e);return Lh(t)?t.host:t}function Qh(e){let t=Zh(e);return Jh(t)?(e.ownerDocument||e).body:Ih(t)&&Rh(t)?t:Qh(t)}function $h(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Qh(e),i=r===e.ownerDocument?.body,a=Mh(r);if(i){let e=eg(a);return t.concat(a,a.visualViewport||[],Rh(r)?r:[],e&&n?$h(e):[])}return t.concat(r,$h(r,[],n))}function eg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tg(e){let t=Yh(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ih(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Qm(n)!==a||Qm(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ng(e){return Fh(e)?e:e.contextElement}function rg(e){let t=ng(e);if(!Ih(t))return eh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=tg(t),o=(a?Qm(n.width):n.width)/r,s=(a?Qm(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ig=eh(0);function ag(e){let t=Mh(e);return!qh()||!t.visualViewport?ig:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function og(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Mh(e)}function sg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ng(e),o=eh(1);t&&(r?Fh(r)&&(o=rg(r)):o=rg(e));let s=og(a,n,r)?ag(a):eh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Mh(a),t=Fh(r)?Mh(r):r,n=e,i=eg(n);for(;i&&t!==n;){let e=rg(i),t=i.getBoundingClientRect(),r=Yh(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Mh(i),i=eg(n)}}return _h({width:u,height:d,x:c,y:l})}function cg(e,t){let n=Xh(e).scrollLeft;return t?t.left+n:sg(Nh(e)).left+n}function lg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-cg(e,n),y:n.top+t.scrollTop}}function ug(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Nh(r),s=t?Bh(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=eh(1),u=eh(0),d=Ih(r);if((d||!a)&&((jh(r)!==`body`||Rh(o))&&(c=Xh(r)),d)){let e=sg(r);l=rg(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?lg(o,c):eh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function dg(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function fg(e){let t=Xh(e),n=e.ownerDocument.body,r=Zm(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Zm(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+cg(e),o=-t.scrollTop;return Yh(n).direction===`rtl`&&(a+=Zm(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var pg=25;function mg(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Mh(e),a=Nh(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!qh()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(cg(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=pg&&(s-=o)}return{width:s,height:c,x:l,y:u}}function hg(e,t){let n=sg(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=rg(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function gg(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=mg(e,n,t);else if(t===`document`)r=fg(Nh(e));else if(Fh(t))r=hg(t,n);else{let n=ag(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _h(r)}function _g(e,t){let n=t.get(e);if(n)return n;let r=$h(e,[],!1).filter(e=>Fh(e)&&jh(e)!==`body`),i=null,a=Yh(e).position===`fixed`,o=a?Zh(e):e;for(;Fh(o)&&!Jh(o);){let e=Yh(o),t=Gh(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Zh(o)}return t.set(e,r),r}function vg(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Bh(t)?[]:_g(t,this._c):[].concat(n),r],o=gg(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=gg(t,a[e],i);s=Zm(n.top,s),c=Xm(n.right,c),l=Xm(n.bottom,l),u=Zm(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function yg(e){let{width:t,height:n}=tg(e);return{width:t,height:n}}function bg(e,t,n){let r=Ih(t),i=Nh(t),a=n===`fixed`,o=sg(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=eh(0);if((r||!a)&&((jh(t)!==`body`||Rh(i))&&(s=Xh(t)),r)){let e=sg(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=cg(i));let l=i&&!r&&!a?lg(i,s):eh(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function xg(e){return Yh(e).position===`static`}function Sg(e,t){if(!Ih(e)||Yh(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Nh(e)===n&&(n=n.ownerDocument.body),n}function Cg(e,t){let n=Mh(e);if(Bh(e))return n;if(!Ih(e)){let t=Zh(e);for(;t&&!Jh(t);){if(Fh(t)&&!xg(t))return t;t=Zh(t)}return n}let r=Sg(e,t);for(;r&&zh(r)&&xg(r);)r=Sg(r,t);return r&&Jh(r)&&xg(r)&&!Gh(r)?n:r||Kh(e)||n}var wg=async function(e){let t=this.getOffsetParent||Cg,n=this.getDimensions,r=await n(e.floating);return{reference:bg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tg(e){return Yh(e).direction===`rtl`}var Eg={convertOffsetParentRelativeRectToViewportRelativeRect:ug,getDocumentElement:Nh,getClippingRect:vg,getOffsetParent:Cg,getElementRects:wg,getClientRects:dg,getDimensions:yg,getScale:rg,isElement:Fh,isRTL:Tg};function Dg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Og(e,t,n){let r=null,i,a=Nh(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=$m(d),h=$m(a.clientWidth-(u+f)),g=$m(a.clientHeight-(d+p)),_=$m(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Zm(0,Xm(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Dg(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Mh(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function kg(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ng(e),u=i||a?[...l?$h(l):[],...t?$h(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Og(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?sg(e):null;c&&g();function g(){let t=sg(e);h&&!Dg(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ag=Eh,jg=Dh,Mg=bh,Ng=kh,Pg=Ch,Fg=yh,Ig=Oh,Lg=(e,t,n)=>{let r=new Map,i=n??{},a={...Eg,...i.platform,_c:r};return gee(e,t,{...i,platform:a})},Rg=typeof document<`u`?m.useLayoutEffect:function(){};function zg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!zg(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!zg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Bg(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vg(e,t){let n=Bg(e);return Math.round(t*n)/n}function Hg(e){let t=m.useRef(e);return Rg(()=>{t.current=e}),t}function Ug(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);zg(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=Hg(c),O=Hg(i),k=Hg(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Lg(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};ee.current&&!zg(T.current,t)&&(T.current=t,dd.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Rg(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ee=m.useRef(!1);Rg(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Rg(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let te=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),ne=m.useMemo(()=>({reference:x,floating:S}),[x,S]),j=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!ne.floating)return e;let t=Vg(ne.floating,u.x),r=Vg(ne.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Bg(ne.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ne.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:te,elements:ne,floatingStyles:j}),[u,A,te,ne,j])}var Wg=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Fg({element:r.current,padding:i}).fn(n):r?Fg({element:r,padding:i}).fn(n):{}}}},Gg=(e,t)=>{let n=Ag(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kg=(e,t)=>{let n=jg(e);return{name:n.name,fn:n.fn,options:[e,t]}},qg=(e,t)=>({fn:Ig(e).fn,options:[e,t]}),Jg=(e,t)=>{let n=Mg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yg=(e,t)=>{let n=Ng(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xg=(e,t)=>{let n=Pg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zg=(e,t)=>{let n=Wg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qg=Object.defineProperty,$g=(e,t)=>Qg(e,`name`,{value:t,configurable:!0}),e_=`Popper`,[t_,n_]=yd(e_),[_ee,r_]=t_(e_),vee=$g(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(_ee,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),yee=`PopperAnchor`,bee=m.forwardRef($g(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=r_(yee,n),o=m.useRef(null),s=a.onAnchorChange,c=Ju(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&o_(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(md.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),i_=`PopperContent`,[xee,See]=t_(i_),Cee=m.forwardRef($g(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:g,..._}=e,v=r_(i_,n),[y,b]=m.useState(null),x=Ju(t,b),[S,C]=m.useState(null),w=Jm(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,ee={padding:O,boundary:k.filter(a_),altBoundary:A},{refs:te,floatingStyles:ne,placement:j,isPositioned:re,middlewareData:M}=Ug({strategy:`fixed`,placement:D,whileElementsMounted:$g((...e)=>kg(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[Gg({mainAxis:i+E,alignmentAxis:o}),c&&Kg({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?qg():void 0,...ee}),c&&Jg({...ee}),Yg({...ee,apply:$g(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&Zg({element:S,padding:s}),wee({arrowWidth:T,arrowHeight:E}),f&&Xg({strategy:`referenceHidden`,...ee,boundary:A?ee.boundary:void 0})]}),ie=v.setPlacementState;Hd(()=>(ie(j),()=>{ie(void 0)}),[j,ie]);let[ae,oe]=o_(j),se=Cf(g);Hd(()=>{re&&se?.()},[re,se]);let ce=M.arrow?.x,le=M.arrow?.y,ue=M.arrow?.centerOffset!==0,[de,fe]=m.useState();return Hd(()=>{y&&fe(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:re?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(xee,{scope:n,placedSide:ae,placedAlign:oe,onArrowChange:C,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,h.jsx)(md.div,{"data-side":ae,"data-align":oe,..._,ref:x,style:{..._.style,animation:re?_.style?.animation:`none`}})})})},`PopperContent`));function a_(e){return e!==null}$g(a_,`isNotNull`);var wee=$g(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=o_(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function o_(e){let[t,n=`center`]=e.split(`-`);return[t,n]}$g(o_,`getSideAndAlignFromPlacement`);var s_=vee,c_=bee,l_=Cee,Tee=Object.defineProperty,u_=(e,t)=>Tee(e,`name`,{value:t,configurable:!0}),d_=!1;function f_(){let[e,t]=m.useState(d_);return m.useEffect(()=>{d_||(d_=!0,t(!0))},[]),e}u_(f_,`useIsHydrated`);var p_=m.useSyncExternalStore;function m_(){return()=>{}}u_(m_,`subscribe`);function h_(){return p_(m_,()=>!0,()=>!1)}u_(h_,`useIsHydratedModern`);var Eee=typeof p_==`function`?h_:f_,Dee=Object.defineProperty,g_=(e,t)=>Dee(e,`name`,{value:t,configurable:!0}),__=`rovingFocusGroup.onEntryFocus`,Oee={bubbles:!1,cancelable:!0},v_=`RovingFocusGroup`,[y_,b_,kee]=Cd(v_),[Aee,x_]=yd(v_,[kee]),[jee,Mee]=Aee(v_),Nee=m.forwardRef(g_(function(e,t){return(0,h.jsx)(y_.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(y_.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Pee,{...e,ref:t})})})},`RovingFocusGroup`)),Pee=m.forwardRef(g_(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=Ju(t,f),g=bf(a),[_,v]=Zd({prop:o,defaultProp:s??null,onChange:c,caller:v_}),[y,b]=m.useState(!1),x=Cf(l),S=b_(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(__,x),()=>e.removeEventListener(__,x)},[x]),(0,h.jsx)(jee,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:m.useCallback(e=>v(e),[v]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>T(e=>e-1),[]),children:(0,h.jsx)(md.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Ld(e.onMouseDown,()=>{C.current=!0}),onFocus:Ld(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(__,Oee);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);w_([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:Ld(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Fee=`RovingFocusGroupItem`,Iee=m.forwardRef(g_(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=gf(),l=a||c,u=Mee(Fee,n),d=u.currentTabStopId===l,f=b_(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=Eee();return Hd(()=>{if(v&&r)return p(),()=>g()},[v,r,p,g]),m.useEffect(()=>{if(!v&&r)return p(),()=>g()},[v,r,p,g]),(0,h.jsx)(y_.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(md.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Ld(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Ld(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Ld(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=C_(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?T_(n,r+1):n.slice(r+1)}setTimeout(()=>w_(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Lee={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function S_(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}g_(S_,`getDirectionAwareKey`);function C_(e,t,n){let r=S_(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Lee[r]}g_(C_,`getFocusIntent`);function w_(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}g_(w_,`focusFirst`);function T_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}g_(T_,`wrapArray`);var E_=Nee,D_=Iee,Ree=Object.defineProperty,O_=(e,t)=>Ree(e,`name`,{value:t,configurable:!0}),k_=[`Enter`,` `],zee=[`ArrowDown`,`PageUp`,`Home`],A_=[`ArrowUp`,`PageDown`,`End`],Bee=[...zee,...A_];[...k_],[...k_];var j_=`Menu`,[M_,Vee,Hee]=Cd(j_),[N_,P_]=yd(j_,[Hee,n_,x_]),F_=n_(),I_=x_(),[Uee,L_]=N_(j_),[Wee,R_]=N_(j_),Gee=O_(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=F_(t),[c,l]=m.useState(null),u=m.useRef(!1),d=Cf(a),f=bf(i);return m.useEffect(()=>{let e=O_(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=O_(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;let e=O_(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,h.jsx)(s_,{...s,children:(0,h.jsx)(Uee,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(Wee,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Kee=m.forwardRef(O_(function(e,t){let{__scopeMenu:n,...r}=e,i=F_(n);return(0,h.jsx)(c_,{...i,...r,ref:t})},`MenuAnchor`)),z_=`MenuPortal`,[qee,Jee]=N_(z_,{forceMount:void 0}),Yee=O_(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=L_(z_,t);return(0,h.jsx)(qee,{scope:t,forceMount:n,children:(0,h.jsx)(of,{present:n||a.open,children:(0,h.jsx)(np,{asChild:!0,container:i,children:r})})})},`MenuPortal`),B_=`MenuContent`,[Xee,V_]=N_(B_),Zee=m.forwardRef(O_(function(e,t){let n=Jee(B_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=L_(B_,e.__scopeMenu),o=R_(B_,e.__scopeMenu);return(0,h.jsx)(M_.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(of,{present:r||a.open,children:(0,h.jsx)(M_.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(Qee,{...i,ref:t}):(0,h.jsx)(H_,{...i,ref:t})})})})},`MenuContent`)),Qee=m.forwardRef(O_(function(e,t){let n=L_(B_,e.__scopeMenu),r=m.useRef(null),i=Ju(t,r);return m.useEffect(()=>{let e=r.current;if(e)return wm(e)},[]),(0,h.jsx)(W_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ld(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),H_=m.forwardRef(O_(function(e,t){let n=L_(B_,e.__scopeMenu);return(0,h.jsx)(W_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),U_=Zu(`MenuContent.ScrollLock`),W_=m.forwardRef(O_(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,..._}=e,v=L_(B_,n),y=R_(B_,n),b=F_(n),x=I_(n),S=Vee(n),[C,w]=m.useState(null),T=m.useRef(null),E=Ju(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),A=m.useRef(null),ee=m.useRef(`right`),te=m.useRef(0),ne=g?_m:m.Fragment,j=g?{as:U_,allowPinchZoom:!0}:void 0,re=O_(e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Q_(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;O_((function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);m.useEffect(()=>()=>window.clearTimeout(D.current),[]),cp();let M=m.useCallback(e=>ee.current===A.current?.side&&ev(e,A.current?.area),[]);return(0,h.jsx)(Xee,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:m.useCallback(e=>{M(e)||(T.current?.focus(),w(null))},[M]),onTriggerLeave:m.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{A.current=e},[]),children:(0,h.jsx)(ne,{...j,children:(0,h.jsx)(Uf,{asChild:!0,trapped:i,onMountAutoFocus:Ld(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(jf,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)(E_,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:Ld(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(l_,{role:`menu`,"aria-orientation":`vertical`,"data-state":J_(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:Ld(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&re(e.key));let i=T.current;if(e.target!==i||!Bee.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);A_.includes(e.key)&&a.reverse(),X_(a)}),onBlur:Ld(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:Ld(e.onPointerMove,tv(e=>{let t=e.target,n=te.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>te.current?`right`:`left`;ee.current=t,te.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),G_=`MenuItem`,K_=`menu.itemSelect`,$ee=m.forwardRef(O_(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=R_(G_,e.__scopeMenu),s=V_(G_,e.__scopeMenu),c=Ju(t,a),l=m.useRef(!1),u=O_(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(K_,{bubbles:!0,cancelable:!0});e.addEventListener(K_,e=>r?.(e),{once:!0}),hd(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(ete,{...i,ref:c,disabled:n,onClick:Ld(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Ld(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Ld(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&k_.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),ete=m.forwardRef(O_(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=V_(G_,n),s=I_(n),c=m.useRef(null),l=Ju(t,c),[u,d]=m.useState(!1),[f,p]=m.useState(``);return m.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,h.jsx)(M_.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(D_,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(md.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Ld(e.onPointerMove,tv(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ld(e.onPointerLeave,tv(e=>o.onItemLeave(e))),onFocus:Ld(e.onFocus,()=>d(!0)),onBlur:Ld(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[tte,nte]=N_(`MenuRadioGroup`,{value:void 0,onValueChange:O_(()=>{},`onValueChange`)}),[rte,ite]=N_(`MenuItemIndicator`,{checked:!1}),q_=m.forwardRef(O_(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(md.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[ate,ote]=N_(`MenuSub`);function J_(e){return e?`open`:`closed`}O_(J_,`getOpenState`);function Y_(e){return e===`indeterminate`}O_(Y_,`isIndeterminate`);function ste(e){return Y_(e)?`indeterminate`:e?`checked`:`unchecked`}O_(ste,`getCheckedState`);function X_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}O_(X_,`focusFirst`);function Z_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}O_(Z_,`wrapArray`);function Q_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Z_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}O_(Q_,`getNextMatch`);function $_(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}O_($_,`isPointInPolygon`);function ev(e,t){return t?$_({x:e.clientX,y:e.clientY},t):!1}O_(ev,`isPointerInGraceArea`);function tv(e){return t=>t.pointerType===`mouse`?e(t):void 0}O_(tv,`whenMouse`);var nv=Gee,rv=Kee,iv=Yee,av=Zee,ov=$ee,sv=q_,cv=Object.defineProperty,lv=(e,t)=>cv(e,`name`,{value:t,configurable:!0}),uv=`DropdownMenu`,[dv,cte]=yd(uv,[P_]),fv=P_(),[pv,mv]=dv(uv),hv=lv(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=fv(t),l=m.useRef(null),[u,d]=Zd({prop:i,defaultProp:a??!1,onChange:o,caller:uv});return(0,h.jsx)(pv,{scope:t,triggerId:gf(),triggerRef:l,contentId:gf(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(nv,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),gv=`DropdownMenuTrigger`,_v=m.forwardRef(lv(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=mv(gv,n),o=fv(n),s=Ju(t,a.triggerRef);return(0,h.jsx)(rv,{asChild:!0,...o,children:(0,h.jsx)(md.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:Ld(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Ld(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),vv=lv(e=>{let{__scopeDropdownMenu:t,...n}=e,r=fv(t);return(0,h.jsx)(iv,{...r,...n})},`DropdownMenuPortal`),yv=`DropdownMenuContent`,bv=m.forwardRef(lv(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=mv(yv,n),a=fv(n),o=m.useRef(!1);return(0,h.jsx)(av,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Ld(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Ld(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),xv=m.forwardRef(lv(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=fv(n);return(0,h.jsx)(ov,{...i,...r,ref:t})},`DropdownMenuItem`)),Sv=m.forwardRef(lv(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=fv(n);return(0,h.jsx)(sv,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Cv=hv,wv=_v,Tv=vv,Ev=bv,Dv=xv,Ov=Sv,kv=Object.defineProperty,Av=m.forwardRef(((e,t)=>kv(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,h.jsx)(md.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),jv=Object.defineProperty,Mv=(e,t)=>jv(e,`name`,{value:t,configurable:!0}),Nv=`Popover`,[Pv,lte]=yd(Nv,[n_]),Fv=n_(),[Iv,Lv]=Pv(Nv),Rv=Mv(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Fv(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=Zd({prop:r,defaultProp:i??!1,onChange:a,caller:Nv});return(0,h.jsx)(s_,{...s,children:(0,h.jsx)(Iv,{scope:t,contentId:gf(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),ute=`PopoverAnchor`,dte=m.forwardRef(Mv(function(e,t){let{__scopePopover:n,...r}=e,i=Lv(ute,n),a=Fv(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(o(),()=>s()),[o,s]),(0,h.jsx)(c_,{...a,...r,ref:t})},`PopoverAnchor`)),fte=`PopoverTrigger`,pte=m.forwardRef(Mv(function(e,t){let{__scopePopover:n,...r}=e,i=Lv(fte,n),a=Fv(n),o=Ju(t,i.triggerRef),s=(0,h.jsx)(md.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Hv(i.open),...r,ref:o,onClick:Ld(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(c_,{asChild:!0,...a,children:s})},`PopoverTrigger`)),zv=`PopoverPortal`,[mte,hte]=Pv(zv,{forceMount:void 0}),gte=Mv(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Lv(zv,t);return(0,h.jsx)(mte,{scope:t,forceMount:n,children:(0,h.jsx)(of,{present:n||a.open,children:(0,h.jsx)(np,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Bv=`PopoverContent`,_te=m.forwardRef(Mv(function(e,t){let n=hte(Bv,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Lv(Bv,e.__scopePopover);return(0,h.jsx)(of,{present:r||a.open,children:a.modal?(0,h.jsx)(yte,{...i,ref:t}):(0,h.jsx)(bte,{...i,ref:t})})},`PopoverContent`)),vte=Zu(`PopoverContent.RemoveScroll`),yte=m.forwardRef(Mv(function(e,t){let n=Lv(Bv,e.__scopePopover),r=m.useRef(null),i=Ju(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return wm(e)},[]),(0,h.jsx)(_m,{as:vte,allowPinchZoom:!0,children:(0,h.jsx)(Vv,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ld(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ld(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Ld(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),bte=m.forwardRef(Mv(function(e,t){let n=Lv(Bv,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(Vv,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Vv=m.forwardRef(Mv(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Lv(Bv,n),p=Fv(n);return cp(),(0,h.jsx)(Uf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(jf,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(l_,{"data-state":Hv(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`)),xte=`PopoverClose`,Ste=m.forwardRef(Mv(function(e,t){let{__scopePopover:n,...r}=e,i=Lv(xte,n);return(0,h.jsx)(md.button,{type:`button`,...r,ref:t,onClick:Ld(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function Hv(e){return e?`open`:`closed`}Mv(Hv,`getState`);var Cte=Rv,wte=dte,Tte=pte,Ete=gte,Dte=_te,Ote=Ste,kte=Object.defineProperty,Uv=(e,t)=>kte(e,`name`,{value:t,configurable:!0}),Wv=`Toggle`,Gv=m.forwardRef(Uv(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=Zd({prop:n,onChange:i,defaultProp:r??!1,caller:Wv});return(0,h.jsx)(md.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:Ld(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Kv=Object.defineProperty,qv=(e,t)=>Kv(e,`name`,{value:t,configurable:!0}),Jv=`ToggleGroup`,[Yv,Ate]=yd(Jv,[x_]),Xv=x_(),Zv=m.forwardRef(qv(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(ey,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(ty,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${Jv}\``)},`ToggleGroup`)),[Qv,$v]=Yv(Jv),ey=m.forwardRef(qv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=qv(()=>{},`onValueChange`),...a}=e,[o,s]=Zd({prop:n,defaultProp:r??``,onChange:i,caller:Jv});return(0,h.jsx)(Qv,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(iy,{...a,ref:t})})},`ToggleGroupImplSingle`)),ty=m.forwardRef(qv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=qv(()=>{},`onValueChange`),...a}=e,[o,s]=Zd({prop:n,defaultProp:r??[],onChange:i,caller:Jv}),c=m.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=m.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,h.jsx)(Qv,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,h.jsx)(iy,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[ny,ry]=Yv(Jv),iy=m.forwardRef(qv(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=Xv(n),u=bf(o),d={dir:u,...c};return(0,h.jsx)(ny,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)(E_,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,h.jsx)(md.div,{...d,ref:t})}):(0,h.jsx)(md.div,{...d,ref:t})})},`ToggleGroupImpl`)),ay=`ToggleGroupItem`,oy=m.forwardRef(qv(function(e,t){let n=$v(ay,e.__scopeToggleGroup),r=ry(ay,e.__scopeToggleGroup),i=Xv(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=m.useRef(null);return r.rovingFocus?(0,h.jsx)(D_,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(sy,{...s,ref:t})}):(0,h.jsx)(sy,{...s,ref:t})},`ToggleGroupItem`)),sy=m.forwardRef(qv(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=$v(ay,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,h.jsx)(Gv,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`));function cy({variant:e=`secondary`,size:t=`default`}={}){return I(`sl-btn`,`sl-btn--${e}`,t===`small`&&`sl-btn--small`)}function L({variant:e=`secondary`,size:t=`default`,disabledReason:n,className:r,type:i,title:a,...o}){return(0,h.jsx)(`button`,{"data-slot":`button`,"data-variant":e,type:i??`button`,title:o.disabled&&n!==void 0?n:a,className:I(cy({variant:e,size:t}),r),...o})}function ly({label:e,tip:t,title:n,children:r,...i}){let a=t===void 0||t===!1?void 0:t===!0?e:t;return(0,h.jsx)(L,{variant:`icon`,"aria-label":e,...a===void 0?{title:n??e}:{"data-tip":a},...i,children:r})}function uy({className:e,asChild:t=!1,type:n,...r}){let i=t?Qu:`button`;return(0,h.jsx)(i,{"data-slot":`play-key`,...t?{}:{type:n??`button`},className:I(`sl-key`,e),...r})}function dy({className:e,...t}){return(0,h.jsx)(`div`,{className:I(`sl-btn-row`,e),...t})}var fy=4e3,py=8e3,my=(0,m.createContext)(void 0);function hy({children:e}){let[t,n]=(0,m.useState)([]),r=(0,m.useRef)(0),i=(0,m.useRef)(new Map),a=(0,m.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t!==void 0&&clearTimeout(t),i.current.delete(e)},[]),o=(0,m.useCallback)((e,t=`info`,o)=>{r.current+=1;let s=r.current;n(n=>[...n.filter(t=>t.message!==e).slice(-2),{id:s,message:e,tone:t,action:o}]),i.current.set(s,setTimeout(()=>a(s),o===void 0?fy:py))},[a]);(0,m.useEffect)(()=>{let e=i.current;return()=>{for(let t of e.values())clearTimeout(t)}},[]);let s=(0,m.useMemo)(()=>o,[o]);return(0,h.jsxs)(my.Provider,{value:s,children:[e,(0,h.jsx)(`section`,{"aria-label":`Notifications`,className:`sl-toasts`,children:t.map(e=>(0,h.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"data-tone":e.tone,className:I(`sl-toast sl-enter`,e.tone===`error`&&`sl-toast--failed`,e.tone===`success`&&`sl-toast--done`),children:[e.tone===`error`?(0,h.jsx)(el,{"aria-hidden":`true`,strokeWidth:1.75}):e.tone===`success`?(0,h.jsx)(Sc,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(Ic,{"aria-hidden":`true`,strokeWidth:1.75,className:`text-ink-2`}),(0,h.jsx)(`p`,{className:`sl-toast__text m-0 min-w-0 break-words`,children:e.message}),e.action===void 0?null:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:()=>{a(e.id),e.action?.run()},children:e.action.label}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Dismiss notification`,onClick:()=>a(e.id),className:`sl-btn sl-btn--icon sl-btn--small -mr-1 w-[30px]`,children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]},e.id))})]})}function gy(){return(0,m.useContext)(my)??_y}function _y(){}var vy=(0,m.createContext)(void 0);function yy({deps:e,children:t}){return(0,h.jsx)(vy.Provider,{value:e,children:(0,h.jsx)(hy,{children:t})})}function R(){let e=(0,m.useContext)(vy);if(e===void 0)throw Error(`useApp was called outside AppProvider`);return e}var by=km,xy=Mm;function Sy({className:e,...t}){return(0,h.jsx)(Pm,{"data-slot":`dialog-overlay`,className:I(`fixed inset-0 z-40 bg-scrim`,e),...t})}function Cy({className:e,children:t,...n}){return(0,h.jsxs)(xy,{children:[(0,h.jsx)(Sy,{}),(0,h.jsx)(Lm,{"data-slot":`dialog-content`,className:I(`sl-dialog fixed top-1/2 left-1/2 z-50 max-h-[calc(100vh-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`data-[state=open]:animate-dialog-in motion-reduce:animate-none`,e),...n,children:t})]})}function wy({className:e,...t}){return(0,h.jsx)(Hm,{"data-slot":`dialog-title`,className:I(`sl-dialog__title text-ink`,e),...t})}function Ty({className:e,...t}){return(0,h.jsx)(see,{"data-slot":`dialog-description`,className:I(`m-0 text-body text-ink-2`,e),...t})}function Ey({open:e,onOpenChange:t,title:n,description:r,footer:i,children:a,className:o,dismissible:s=!0}){return(0,h.jsx)(by,{open:e,...t===void 0?{}:{onOpenChange:t},children:(0,h.jsxs)(Cy,{className:o,...s?{}:{onEscapeKeyDown:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()},...r===void 0?{"aria-describedby":void 0}:{},children:[(0,h.jsx)(wy,{children:n}),r===void 0?null:(0,h.jsx)(Ty,{children:r}),a,i===void 0?null:(0,h.jsx)(`div`,{className:`sl-dialog__foot`,children:i})]})})}function Dy({open:e,title:t,consequence:n,confirmLabel:r,cancelLabel:i=`Cancel`,tone:a=`destructive`,pending:o=!1,onConfirm:s,onCancel:c}){return(0,h.jsx)(Ey,{open:e,onOpenChange:e=>{e||c()},title:t,description:n,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`secondary`,autoFocus:!0,onClick:c,children:i}),(0,h.jsx)(L,{variant:a,disabled:o,disabledReason:`Working on it`,onClick:s,children:r})]})})}var Oy=[`onboarding`],ky=[`onboarding`,`sample`],Ay=(e,t)=>[`narration-peaks`,e,t],jy=(e,t,n)=>e.fetch(`${e.origin}/api/onboarding${t}`,{method:`POST`,...n===void 0?{}:{headers:{"content-type":`application/json`},body:JSON.stringify(n)}});async function My(e){return F(await e.fetch(`${e.origin}/api/onboarding`))}async function Ny(e){await F(await jy(e,`/dismiss`))}async function Py(e,t){return F(await jy(e,`/packs/${encodeURIComponent(t)}`))}async function Fy(e,t){return F(await jy(e,`/short`,t))}async function Iy(e,t){return F(await jy(e,`/full-video`,t))}async function Ly(e){return F(await e.fetch(`${e.origin}/api/onboarding/sample`))}function Ry(e,t){return e!==void 0&&Object.values(e.samples).includes(t)}async function zy(e){return F(await jy(e,`/sample/restore`))}async function By(e,t=Vy()){return F(await jy(e,`/sample/copy`,t===void 0?void 0:{projectId:t}))}function Vy(){if(typeof window>`u`)return;let e=/\/projects\/([^/?#]+)/.exec(window.location.pathname);return e?.[1]===void 0?void 0:decodeURIComponent(e[1])}async function Hy(e,t){return F(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/narration/peaks`))}var z={projects:[`projects`],revisions:e=>[`project`,e,`revisions`],revision:(e,t)=>[`project`,e,`revision`,t],revisionFile:(e,t,n)=>[`revision-file`,e,t,n],project:e=>[`project`,e],runCost:e=>[`project`,e,`run-cost`],article:(e,t=null)=>[`project`,e,`article`,t],audioPreview:(e,t)=>[`audio-preview`,e,t],file:(e,t)=>[`file`,e,t],staging:[`staging`],notice:[`notice`],usage:[`usage`],providers:[`providers`],voices:[`voices`],prompts:[`prompts`],entries:[`entries`],documentThemes:[`document-themes`],narrationAliases:[`narration-aliases`],settings:[`settings`],youtubeEdits:e=>[`project`,e,`youtube-edits`],channelLinks:[`channel-links`],projectChannelLinks:e=>[`channel-links`,`project`,e]},Uy=15e3,Wy=new Set([`running`,`pending`]);function Gy(e){return ct({queryKey:z.projects,queryFn:()=>jo(e),refetchInterval:e=>e.state.data?.projects.some(e=>Wy.has(e.status))===!0&&Uy})}function Ky(e,t){return ct({queryKey:z.project(t),queryFn:()=>Mo(e,t),refetchInterval:e=>e.state.data!==void 0&&Wy.has(e.state.data.project.status)?Uy:!1})}function qy(e,t){return ct({queryKey:z.runCost(t),queryFn:()=>No(e,t)})}function Jy(e){return ct({queryKey:z.notice,queryFn:()=>Go(e)})}function Yy(e){return ct({queryKey:z.usage,queryFn:()=>Wo(e)})}function Xy(e){return ct({queryKey:z.providers,queryFn:()=>Jo(e)})}function Zy(e){return ct({queryKey:z.voices,queryFn:()=>Es(e)})}function Qy(e){return ct({queryKey:z.prompts,queryFn:()=>Ns(e)})}function $y(e){return ct({queryKey:z.entries,queryFn:()=>Gs(e)})}function eb(e){return ct({queryKey:z.documentThemes,queryFn:()=>qs(e)})}function jte(e){return ct({queryKey:z.narrationAliases,queryFn:()=>Qs(e)})}function tb(e){return ct({queryKey:z.settings,queryFn:()=>Qo(e)})}var Mte={"library.prompt.kind":{title:`Prompt kind`,body:`What the prompt is for, which decides where Play offers it. Article writes the video's text, Image and Thumbnail describe pictures, Narration Preparation adds delivery cues, YouTube Description writes the description, Shorts picks the short clips, Review checks a finished stage, Script writes speaker turns for several voices.`,tutorial:{page:`Prompts`,anchor:`prompt-kinds`}},"library.prompt.name":{title:`Prompt name`,body:`What Play and Edit project list this prompt by. Up to 200 characters, and unique within its kind. Templates remember a prompt by name, so after a rename they use the copy saved with them until you pick it again.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.article":{title:`Article prompt`,body:`The instruction the text model gets to write the video's article, which becomes the narration. Each {{keyword}} becomes a field on Play. One call on the project's LLM, plus up to 3 more when the answer runs out of room; research notes go first when research ran. The answer's sources and pronunciation sections are never narrated.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.image":{title:`Image prompt`,body:`Sent as written to the image model, with the keywords filled in; no text model rewrites it. Play sets how many pictures each prompt makes (1 to 20, at most 60 a run), and each picture is one image call. Pictures show for 15 s each by default and repeat until the video ends.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.thumbnail":{title:`Thumbnail prompt`,body:`Sent to the image model to draw the thumbnail. With Thumbnail set to Prompt by LLM, the text model first turns it into a picture prompt using the title and article, one extra call. 1 thumbnail by default, or 3: the second a close-up, the third a wider shot, each one image call.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.narration":{title:`Narration Preparation prompt`,body:`Tells the text model how the narration should be delivered. It only adds cues, such as a short speaking direction or a laugh or sigh, and never rewrites the words. One call each for the body, the intro and the outro. Works only with the Inworld TTS-2 voice model. With several speakers, each speaker on TTS-2 gets cues suited to their role.`,tutorial:{page:`Play-Narration`,anchor:`narration-preparation`}},"library.prompt.body.description":{title:`YouTube Description prompt`,body:`Tells the text model how to write the video's YouTube description, chapters, hashtags and tags from the timestamped transcript. One call per video. Each {{keyword}} becomes a field on Play. A project that picks none uses the Built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.shorts":{title:`Shorts prompt`,body:`Tells the text model which moments of the video to cut into vertical shorts (3 of 60 to 120 s by default). One call picks them, then one call per short writes its picture prompts, and each picture is one image call. A project that picks none uses the Built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.review":{title:`Review prompt`,body:`Tells the reviewer what to check in a finished article, set of images, narration, thumbnail or shorts, and when to flag or redo it. One reviewer call per item checked; pictures can only be judged by the Claude Code and Codex reviewers. A stage with none picked uses its own built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.script":{title:`Script prompt`,body:`Used in place of an Article prompt when a run has several voices and writes a script. The text model answers with # section headings and Name: words turns, one speaker per paragraph; text in [square brackets] is not spoken. One call on the project's LLM.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.starter":{title:`Starter text`,body:`Fills the body with ready-made text to start from: the documentary delivery cues for Narration Preparation, or the Built-in wording YouTube Description and Shorts use when no prompt is picked. When the body already has text you confirm first. Nothing is saved until you choose Save.`,tutorial:{page:`Prompts`,anchor:`start-from-ready-made-text`}},"library.prompt.photorealistic":{title:`Draws photorealistic pictures`,body:`Turn on when this prompt's style looks like real photos or film. Prepare upload then answers Yes to YouTube's AI use question (a realistic-looking scene that didn't happen) for videos and shorts drawn with it. Leave off for painterly or illustrated styles. Applies at once, apart from Save; a channel's Always Yes or Always No wins. Default: off.`,tutorial:{page:`Prompts`,anchor:`mark-an-image-prompt-as-photorealistic`}},"library.slots":{title:`Detected slots`,body:`Every {{keyword}} in the body, listed as you type. Each becomes one field on Play, typed once and filled into every prompt that names it. Names are case-sensitive, so {{Topic}} and {{topic}} are two fields. A keyword the project title also names is typed per video and saved empty in templates.`,tutorial:{page:`Prompts`,anchor:`keywords-slots`}},"library.used-by":{title:`Used by`,body:`The templates, schedules and projects that name this item, matched by name within its kind. For a project it says how many of its revisions used it and whether the current one does. Projects keep their own text, so editing here changes only runs started later.`,tutorial:{page:`Prompts`,anchor:`used-by`}},"library.history":{title:`History`,body:`Every save that changes the name or text adds a version, and every version is kept. Here you see the latest change with the changed words marked. Compare versions opens them all side by side, with Restore for an older one.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.history.compare":{title:`Compare versions`,body:`Pick any two saved versions to see them side by side, with the words that changed marked. Older and Newer can be any versions; a rename between them is said above the text.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.history.versions":{title:`Versions`,body:`Every saved version, newest first. Restore saves an older version again as a new version, so nothing after it is lost and History notes where it came from. Projects already made keep their text.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.entry.category":{title:`Intro or outro`,body:`An intro is narrated before the body of the video, an outro after it, in the same voice. Play offers each in its own picker. A name only needs to be unique within its category.`,tutorial:{page:`Intros-and-Outros`,anchor:`text-or-llm`}},"library.inline-rename":{title:`Rename in the list`,body:`Changes only the name, right in the list; the text stays as it is. Enter saves, Escape keeps the old name, and Undo on the notice renames it back. A prompt or intro/outro keeps the rename in History; templates that picked the old name use the copy saved with them until you pick it again. A template saves a new version; schedules keep the version they were made from.`,tutorial:{page:`Library-Overview`,anchor:`rename-in-the-row`}},"library.entry.name":{title:`Entry name`,body:`What Play and Edit project list this intro or outro by. Up to 200 characters, and unique within its category.`,tutorial:{page:`Intros-and-Outros`,anchor:`write-an-intro-or-outro`}},"library.entry.mode":{title:`Mode`,body:`Text is narrated as written, with the keywords filled in and no extra call. LLM sends the body as an instruction to the project's text model, with the title, keyword values and article, and narrates the answer: one call per entry, and the run then needs an LLM. Default: Text.`,tutorial:{page:`Intros-and-Outros`,anchor:`text-or-llm`}},"library.entry.body":{title:`Entry body`,body:`In Text mode, the words the narrator says; in LLM mode, the instruction whose answer is said. Each {{keyword}} becomes a field on Play. It is narrated as its own audio file with the run's voice, one voice request each.`,tutorial:{page:`Intros-and-Outros`,anchor:`write-an-intro-or-outro`}},"library.aliases":{title:`Narration aliases`,body:`Words the narrator says differently from how they are written, such as Dr. as Doctor. Only what the voice and Narration Preparation receive changes; the article and captions keep the written words. A project copies this list when it starts and uses it while Use narration aliases is on. Up to 1000 aliases, saved as a whole.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`narration-aliases`}},"library.aliases.written":{title:`Written`,body:`The word or phrase as it appears in the article, up to 200 characters. Spaces inside it match any spacing. Two aliases can't share a written form; where two overlap, the one starting first wins, then the longer.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.spoken":{title:`Say it as`,body:`What the narrator says instead, spelled the way it sounds, up to 500 characters. Only the audio changes. An alias wins over a Pronunciation Glossary entry for the same words.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.whole-word":{title:`Whole word`,body:`On: matches only where the written form stands as a word of its own, so it never fires inside a longer word. Off: matches inside other words too. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.match-case":{title:`Match case`,body:`On: matches only with the same capital letters, so US is not us. Off: capitals are ignored. Default: off.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"templates.show-channel":{title:`Show templates of`,body:`Shows only the templates of one channel, or of all. A template's channel is the one a draft made from it runs in. Choosing here changes nothing about the templates.`,tutorial:{page:`Templates`,anchor:`filter-by-channel`}},"templates.apply":{title:`Use in Play`,body:`Makes a new Play draft from the template and opens it in Play for you to review; nothing starts. Keywords the project title names start empty for this video's topic, and uploaded files keep their names but must be attached again. The template itself is unchanged.`,tutorial:{page:`Templates`,anchor:`use-a-template`}},"templates.save":{title:`Save a setup`,body:`Keeps a saved Play draft as a reusable template: every setting and checkpoint choice, plus a copy of each picked prompt and intro or outro. Keywords the project title names, like {{Topic}}, are saved empty; other keywords keep their values. Queued extra videos and uploaded fonts are left out.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.save.draft":{title:`Saved Play draft`,body:`The Play draft whose setup the template keeps. Only drafts saved in Play are listed; open Play to prepare one first. The draft itself stays as it is.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.save.name":{title:`Template name`,body:`What the template is called in this list and wherever you pick a template, such as a schedule. Up to 120 characters.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.edit":{title:`Edit a template`,body:`Shows the keywords the template fills and what each feeds. The pencil beside its name renames it; every save adds a version that History keeps. To change its settings, use it in Play, change the draft, then Save a setup.`,tutorial:{page:`Templates`,anchor:`see-a-templates-keywords`}},"templates.history":{title:`Template versions`,body:`Every saved version of the template, newest first. Pick one to compare its setup with the current one. Restore saves the older setup again as a new version, so nothing is lost. Drafts and projects made from it keep their setup.`,tutorial:{page:`Templates`,anchor:`history`}},"templates.save.channel":{title:`Template channel`,body:`The channel the template belongs to, and the one a draft made from it runs in. Default: the draft's own channel, or its template's channel when it has none.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"library.themes.yours":{title:`Your themes`,body:`Themes you made or copied from a built-in. Pick one on the Document row in Play or in Edit project. A project keeps its own copy of the settings, so editing or deleting a theme here never changes a PDF already made or queued.`,tutorial:{page:`Document-Themes`,anchor:`built-in-and-your-own-themes`}},"library.themes.built-in":{title:`Built-in themes`,body:`Looks that ship with Slopify and can't be changed. Plain is an unbranded flat page and what a new project gets. Copy one to make a theme of your own you can edit.`,tutorial:{page:`Document-Themes`,anchor:`built-in-and-your-own-themes`}},"library.theme.name":{title:`Theme name`,body:`What the theme is called on the Document row in Play and in Edit project. Up to 80 characters.`,tutorial:{page:`Document-Themes`,anchor:`make-a-theme`}},"library.theme.preview":{title:`Preview`,body:`A sample article laid out with this theme by the same renderer that makes a project's PDF, redrawn about half a second after you stop typing. It runs on your computer and costs nothing. Your projects use their own text and thumbnail.`,tutorial:{page:`Document-Themes`,anchor:`make-a-theme`}},"library.theme.page.format":{title:`Paper size`,body:`The page size of the PDF. A4 (210 × 297 mm) is used in most of the world; US Letter (216 × 279 mm) in the US and Canada. Pick the one your readers print on. Default: A4.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.page.margin":{title:`Margins`,body:`Blank space kept on every edge of each page, in millimetres. Wider margins mean shorter lines and more pages. From 5 to 60 mm. Default: 22 mm.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.page.content-top":{title:`Text starts at`,body:`How far from the top of the page the text begins on pages that carry the running header, in millimetres. Raise it when text crowds the header. From 5 to 80 mm. Default: 32 mm.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.background.image":{title:`Background`,body:`Parchment texture stretches an aged-paper picture over every page. Flat colour fills each page with the Page colour, drawn slightly darker at the edges. Default: Flat colour.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.background.color":{title:`Page colour`,body:`The colour of every page when Background is Flat colour; ignored with the parchment texture. Type a hex code like #fdfaf3 or use the picker. Default: #fdfaf3, a warm off-white.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.colors.heading":{title:`Heading colour`,body:`The colour of headings, drop caps, the brand name and links. Type a hex code like #1f3a5f or use the picker. Default: #1f3a5f, a dark blue.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.text":{title:`Body text colour`,body:`The colour of paragraphs, lists and bold or italic text. Keep it dark against the page colour so it reads and prints well. Default: #1a1a1a, near black.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.muted":{title:`Muted colour`,body:`The colour of dates, bullets, quotes and the dotted lines on the contents page. Default: #555555, a mid grey.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.faint":{title:`Faint colour`,body:`The colour of the running header and the page numbers, kept light so they stay out of the way. Default: #888888, a light grey.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.fonts.body":{title:`Body font`,body:`The font of paragraphs and lists. The first box picks the family, the second its weight or italic, the number adds space between letters in millimetres (-0.5 to 2). Cinzel is bundled and has no italics; Times, Helvetica and Courier are built into every PDF reader. Default: Cinzel Regular, 0.01 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.strong":{title:`Bold text font`,body:`The font of bold words inside paragraphs. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Bold, 0.02 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.emphasis":{title:`Italic text font`,body:`The font of italic words inside paragraphs. Cinzel has no italics, so the default borrows Times. Family, style and letter spacing in millimetres, as for Body. Default: Times Italic, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.heading":{title:`Heading font`,body:`The font of the article's headings and of the contents, sources and closing page titles. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Bold, 0.02 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.dramatic":{title:`Chapter numbers and brand font`,body:`The font of the big number in a heading like "Chapter 3:" and of the brand name on the title page. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Black, 0.03 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.decorative":{title:`Tagline and link font`,body:`The font of the tagline and the linked line on the title page, and of the link and closing line on the closing page. Default: Cinzel Medium, 0.015 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.drop-cap":{title:`Drop cap font`,body:`The font of the large first letter that starts a paragraph after a heading, when drop caps are on. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Black, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.footer":{title:`Header and page number font`,body:`The font of the running header and the page numbers. Family, style and letter spacing in millimetres, as for Body. Default: Times Regular, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.sizes.title":{title:`Title size`,body:`The size of the article's title on the title page, in points (1 pt is about 0.35 mm). From 6 to 72 pt. Default: 22 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.brand":{title:`Brand size`,body:`The size of the brand name on the title page, in points. Shown only when Branding has a brand name. From 6 to 72 pt. Default: 31 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.section":{title:`Top-level heading size`,body:`The size of top-level headings and of the contents, sources and closing page titles, in points. From 6 to 72 pt. Default: 19 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.heading":{title:`Second-level heading size`,body:`The size of second-level headings, the ones inside a top-level section, in points. From 6 to 72 pt. Default: 17 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.subheading":{title:`Third-level heading size`,body:`The size of third-level and deeper headings, in points. From 6 to 72 pt. Default: 13 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.body":{title:`Body size`,body:`The size of paragraphs, lists and the closing page text, in points. Bigger text means more pages. From 6 to 24 pt. Default: 10.5 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.meta":{title:`Date and word count size`,body:`The size of the date, word count and link lines under the title on the title page, in points. From 5 to 24 pt. Default: 10 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.footer":{title:`Header and page number size`,body:`The size of the running header and the page numbers, in points. From 5 to 24 pt. Default: 9 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.spacing.body-line":{title:`Body line height`,body:`The distance from one line of body text to the next, in millimetres. Raise it for airier pages, lower it to fit more on each page. From 3 to 20 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.heading-line":{title:`Heading line height`,body:`The distance between the lines of a top- or second-level heading that wraps, in millimetres. From 3 to 30 mm. Default: 11 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.subheading-line":{title:`Subheading line height`,body:`The distance between the lines of a third-level heading that wraps, in millimetres. From 3 to 30 mm. Default: 9 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.paragraph-gap":{title:`After a paragraph`,body:`Extra space after each paragraph, as a share of a body line: 0.5 is half a line. From 0 to 3. Default: 0.5.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.heading-gap":{title:`Before a heading`,body:`Extra space above each heading, as a share of a body line: 1 is one full line. From 0 to 5. Default: 1.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.item-gap":{title:`After a list item`,body:`Extra space after each bulleted or numbered item, as a share of a body line. From 0 to 3. Default: 0.2.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.list-indent":{title:`List indent`,body:`How far bulleted and numbered lists are pushed in from the left margin, in millimetres. From 0 to 30 mm. Default: 6 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.quote-indent":{title:`Quote indent`,body:`How far quotes are pushed in from the left margin, in millimetres. From 0 to 40 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.rule-width":{title:`Divider width`,body:`The width of the short centred line a --- in the article becomes, in millimetres. From 0 to 150 mm. Default: 30 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.drop-cap.enabled":{title:`Drop caps`,body:`Starts the first paragraph after each heading with a large first letter that spans several lines, as in printed books. Turn it off for a plainer page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.lines":{title:`Drop cap lines tall`,body:`How many lines of body text the large first letter spans. Default: 3 lines.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.scale":{title:`Drop cap letter size`,body:`The size of the large first letter, as a multiple of the height of the lines it spans. From 1 to 5. Default: 3.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.gap":{title:`Gap beside the drop cap`,body:`The space between the large first letter and the text beside it, in millimetres. From 0 to 20 mm. Default: 4 mm.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.min-length":{title:`Shortest paragraph`,body:`A paragraph shorter than this many characters starts plainly, so a one-line paragraph never gets a huge letter. From 0 to 2000. Default: 50.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.min-room":{title:`Room needed`,body:`With less than this share of the page left, a paragraph that starts with a drop cap moves to the next page. 0.25 is a quarter of the page. From 0 to 1. Default: 0.25.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.title-page.brand-y":{title:`Brand from top`,body:`Where the brand name sits on the title page, measured from the top edge of the page in millimetres. From 10 to 200 mm. Default: 60 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.tagline-offset":{title:`Tagline below brand`,body:`The distance from the brand name down to the tagline, in millimetres. From 0 to 60 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.title-y":{title:`Title from top`,body:`Where the article's title sits on the title page, measured from the top edge of the page in millimetres. From 10 to 250 mm. Default: 80 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.title-line":{title:`Title line height`,body:`The distance between the lines of a title that wraps, in millimetres. From 3 to 40 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.meta-offset":{title:`Details below title`,body:`The distance from the title down to the date and word count, in millimetres, when there is no cover picture. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.meta-line":{title:`Details line height`,body:`The distance between the date, word count and link lines on the title page, in millimetres. From 3 to 30 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.show-date":{title:`Show the date`,body:`Prints "Written on" and the date the PDF was made under the title on the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.show-word-count":{title:`Show the word count`,body:`Prints the article's word count under the title on the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover":{title:`Thumbnail as cover`,body:`Puts the project's thumbnail on the title page, between the title and the date, when the project has one. Without a thumbnail the page is laid out as if this were off. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover-gap":{title:`Space around cover`,body:`The space above and below the cover picture on the title page, in millimetres. From 0 to 40 mm. Default: 6 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover-height":{title:`Cover height at most`,body:`The tallest the cover picture may be, in millimetres. It keeps its shape and shrinks further when the page has less room. From 20 to 200 mm. Default: 110 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.brand.name":{title:`Brand name`,body:`Your channel or brand, printed large at the top of the title page and before the title in the running header ("Brand | Title"). Leave it empty to show no brand. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.tagline":{title:`Tagline`,body:`A short line under the brand name on the title page. Leave it empty to hide it. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.url":{title:`Website`,body:`The web address the brand name and the title-page link open when clicked in the PDF. Leave it empty for no link. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.link-label":{title:`Link text`,body:`The words of a linked line under the word count on the title page; it opens Website. Leave it empty to hide the line. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.contents.enabled":{title:`Contents page`,body:`Adds a table of contents after the title page, listing the article's headings with their page numbers. Each entry is a link to its page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.title":{title:`Contents page title`,body:`The heading at the top of the contents page. Up to 300 characters. Default: Table of Contents.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.depth":{title:`Lists headings down to`,body:`Which headings the contents page lists: only top-level ones, down to second-level, or down to third-level. Deeper lists take more room and can add a page. Default: Second level.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.title-offset":{title:`Contents title position`,body:`The distance from the top margin down to the contents page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.first-entry-offset":{title:`First entry position`,body:`The distance from the top margin down to the first entry of the contents, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.line":{title:`Contents line height`,body:`The distance from one contents entry to the next, in millimetres. From 3 to 30 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.indent":{title:`Indent per level`,body:`How much further in each deeper heading level is listed on the contents page, in millimetres. From 0 to 30 mm. Default: 5 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.header.enabled":{title:`Running header`,body:`Prints the brand and the article title ("Brand | Title") at the top of every page after the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.header.top":{title:`Header from top`,body:`The distance from the top edge of the page to the running header, in millimetres. From 3 to 60 mm. Default: 15 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.header.max-title":{title:`Header title at most`,body:`A title longer than this many characters is cut short in the running header so it fits on one line. From 5 to 200. Default: 35.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.enabled":{title:`Page numbers`,body:`Prints a page number at the bottom of every page after the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.text":{title:`Page number text`,body:`The words around the page number; {page} becomes the number, so "Page {page}" prints "Page 4". Default: Page {page}.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.bottom":{title:`Page number from the bottom`,body:`The distance from the bottom edge of the page to the page number, in millimetres. From 3 to 60 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.reserve":{title:`Space kept above page number`,body:`Space kept free above the page number, so body text always stops short of it, in millimetres. From 0 to 60 mm. Default: 15 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.sources.enabled":{title:`Sources page`,body:`Adds a page listing the web links the article and its research used, each one clickable. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.title":{title:`Sources page title`,body:`The heading at the top of the sources page. Up to 300 characters. Default: Sources Consulted.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.title-offset":{title:`Sources title position`,body:`The distance from the top margin down to the sources page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.body-offset":{title:`Sources list position`,body:`The distance from the top margin down to the first source, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.line":{title:`Sources line height`,body:`The distance between the lines of one source, in millimetres. From 3 to 30 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.gap":{title:`Gap between sources`,body:`Extra space between one source and the next, in millimetres. From 0 to 20 mm. Default: 2 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.end-page.enabled":{title:`Closing page`,body:`Adds a last page with your own text, such as an about section, a thank-you or a link to your site. Default: off.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.title":{title:`Closing page title`,body:`The heading at the top of the closing page. Up to 300 characters. Default: About.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.lines":{title:`Closing page text`,body:`The closing page text, one line per row, up to 60 lines of 300 characters. A line starting with "•" becomes a muted bullet, one ending with ":" a bold label, an empty line a gap. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.details":{title:`Add date, word and page counts`,body:`Adds a Document Details list under your text: the date written, the total words and the total pages. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.link":{title:`Closing page link`,body:`Adds a clickable line after your text: the words to show and the web address it opens. Leave the address empty to show the words without a link. Default: off.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.closing":{title:`Closing line`,body:`A last line after the text and the link, such as a sign-off, in the decorative font. Leave it empty to leave it out. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.title-offset":{title:`Closing title position`,body:`The distance from the top margin down to the closing page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.body-offset":{title:`Closing text position`,body:`The distance from the top margin down to the first line of the closing text, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.metadata.author":{title:`PDF author`,body:`The author a PDF reader shows in the document properties; it is not printed on the pages. {title} becomes the article title. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.subject":{title:`PDF subject`,body:`The subject a PDF reader shows in the document properties. {title} becomes the article title. Default: {title}.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.keywords":{title:`PDF keywords`,body:`Search words a PDF reader shows in the document properties, usually separated by commas. Up to 1000 characters. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.creator":{title:`PDF creator`,body:`The app or person a PDF reader shows as the creator in the document properties. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}}},Nte={"planning.schedules":{title:`Schedules`,body:`A schedule starts a new project from a saved template at a local time, while Slopify is open on this machine. Each run makes a fresh project, so changing the template later never rewrites an old run. It uses the template version you picked and never includes uploaded media. Each run costs what that template's project costs.`,tutorial:{page:`Schedules`}},"planning.schedule.name":{title:`Schedule name`,body:`A name to tell this schedule apart in the list, on the calendar and on the channel page. It never appears in the videos. Up to 200 characters.`,tutorial:{page:`Schedules`,anchor:`create-a-schedule`}},"planning.schedule.template":{title:`Template`,body:`The saved template each run starts from, with its version. The schedule keeps this version when you save the template again; pick the template again here to use the newer one. The template decides the providers, and so what each run costs. Save templates from Play; they are listed in Library → Templates.`,tutorial:{page:`Schedules`,anchor:`create-a-schedule`}},"planning.schedule.cadence":{title:`Cadence`,body:`How often the schedule runs. Every day runs once a day at the local time. Selected weekdays runs on the days you tick. One time runs once at a date and time, then completes. Each run starts one project. Default: Every day at 09:00.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.time":{title:`Local time`,body:`The clock time each run starts, read in the timezone below. Default: 09:00. A run only starts while Slopify is open; Missed run decides what happens when it was closed.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.once-at":{title:`Run at`,body:`The date and time of the single run, read in the timezone below. After that run starts, the schedule shows as completed.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.weekdays":{title:`Weekdays`,body:`The days a Selected weekdays schedule runs, each at the local time. Tick at least one; each ticked day is one project a week. Default: Mon, Wed and Fri.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.timezone":{title:`Timezone`,body:`The IANA zone the run time is read in, such as Europe/Tirane or America/New_York. Default: this computer's zone. When clocks go back, a repeated time uses the earlier one; a time skipped when clocks go forward moves forward by the gap.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.timezone-once":{title:`Timezone`,body:`The IANA zone the one-off date and time are read in, such as Europe/Tirane or America/New_York. Default: this computer's zone. When clocks go back, a repeated time uses the earlier one; nonexistent spring-forward times are refused, so pick another.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.missed":{title:`Missed run`,body:`What happens to a run that came due while Slopify was closed or asleep. Skip drops it when it is more than 1 minute late and waits for the next time. Run once when Slopify reopens starts one catch-up run, however many were missed. Default: Skip.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.spend":{title:`Spend ceiling`,body:`The most one run may cost, in US cents: 500 is $5.00. Before each run Slopify estimates the project's cost; when the high estimate is over this, or a cost can't be estimated, the run fails instead of starting. Leave it empty for no ceiling. Default: empty.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.topics":{title:`Topics`,body:`Each run takes the first topic, starts one project with it and removes it from the list. The schedule completes when the list is empty, unless topic generation is on. With no topics and generation off, every run uses the template as saved. Up to 500 topics.`,tutorial:{page:`Schedules`,anchor:`topics`}},"planning.schedule.inline-topics":{title:`Queued topics`,body:`Change the queue right here: type a topic and press Enter to add it, edit one in its field and press Enter to rename it, use the arrows to move it and the cross to remove it. Each change saves at once and changes only the queue; Undo on the notice puts it back. For a topic's own keyword values, press Edit.`,tutorial:{page:`Schedules`,anchor:`edit-the-queued-topics-in-place`}},"planning.schedule.topic-format":{title:`How to write the topics`,body:`Three ways to write the same list; switching keeps everything. One per line fills only the topic keyword. Table adds a column for each keyword a topic sets itself, such as its word count. YAML / JSON holds the same as text, for pasting or keeping in a file.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-lines":{title:`Topics, one per line`,body:`Type or paste one topic per line; blank lines are skipped. Each topic fills the keyword under Each topic fills, and the first line is the next run. Every other keyword uses its every-run value.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-yaml":{title:`Topics as YAML or JSON`,body:`A list such as "- Cleopatra", or one map per topic such as "- Topic: Cleopatra" with a line for each keyword it sets, like "Min. Word Count: 12000". A JSON array works too. A keyword a topic leaves out uses its every-run value. The schedule saves only once the list reads.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-table":{title:`Topic table`,body:`One row per run, in order. The first column fills the topic keyword; each extra column sets that keyword for that topic's run only, and a blank cell uses the every-run value. Set a keyword per topic adds a column; the x in a column's header drops it. Project title shows the result.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-keyword":{title:`Each topic fills`,body:`The template keyword, such as {{Topic}}, that each queued topic replaces. Default: the keyword the template's project title uses, else the first one. When the title doesn't use it, every project gets the same title.`,tutorial:{page:`Schedules`,anchor:`which-keyword-a-topic-fills`}},"planning.schedule.every-run":{title:`Every-run value`,body:`The value this keyword gets on every run, such as a word count. Default: the template's own value. A topic that sets the keyword itself, in Table or YAML / JSON, overrides it for that one run.`,tutorial:{page:`Schedules`,anchor:`which-keyword-a-topic-fills`}},"planning.schedule.generation":{title:`Topic generation`,body:`When the queue holds fewer topics than you ask for, Slopify asks an LLM for more: one call for what is missing plus 5 spare, at most 50. It sends the series brief and every title this schedule, your projects and the channel's existing videos already have, and drops near duplicates.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.brief":{title:`Series brief`,body:`What the series covers, its style and what makes a topic worth a video. Only topic generation reads it. Leave it empty to use the channel's series brief from the channel's Brand tab. Up to 4,000 characters.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.new-topics":{title:`New topics`,body:`Off: you add every topic yourself. Generate and queue directly: new topics join the end of the list. Generate and hold for approval: they wait under Topics waiting, and beside the calendar, until you approve them. Each generation is one LLM call. Default: Off.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.keep-count":{title:`Keep at least this many queued`,body:`Slopify asks for new topics whenever the queue, plus the topics waiting for approval when holding, drops below this number. A higher number keeps more topics lined up ahead of the runs, for you to review. From 1 to 100. Default: 10.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.generation-llm":{title:`Topic generation LLM`,body:`The text model that suggests topics. Ticked, it uses the provider and model the template writes with. Untick to pick another, such as a cheaper model. Either way each generation is one call on that provider. Default: the template's LLM.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.generate-now":{title:`Generate topics now`,body:`Asks the LLM for new topics right away, at least 5, even when the queue is full and even during the 5 minutes Slopify waits after a failed try. One LLM call. When holding for approval they wait for you; otherwise they join the queue.`,tutorial:{page:`Schedules`,anchor:`generate-topics-now`}},"planning.schedule.held-keywords":{title:`Keywords of a waiting topic`,body:`The template's other keywords, set for this one topic's run, the same as a column in the queue's table. Leave one empty to use the schedule's every-run value (shown greyed). They go with the topic into the queue when you approve it.`,tutorial:{page:`Schedules`,anchor:`approve-held-topics`}},"planning.schedule.held":{title:`Topics waiting`,body:`Topics the LLM suggested, waiting for you. Approve adds one to the end of the queue; Edit changes its words first; Reject drops it for good, so it is never suggested again. Approve all queues every one in order. Waiting topics count toward Keep at least.`,tutorial:{page:`Schedules`,anchor:`approve-held-topics`}},"planning.calendar.view":{title:`Calendar view`,body:`Weeks shows the coming 4 weeks as a grid: drag a topic to another day or onto another schedule's run, or focus it and press Alt+arrow keys. List shows the same runs day by day, with buttons to move each topic. This browser remembers your choice.`,tutorial:{page:`Calendar`,anchor:`switch-between-weeks-and-a-list`}},"planning.calendar.move":{title:`Moving topics`,body:`Earlier and later swap a topic with its neighbour in the same schedule's queue, so it takes the other's run. Move to puts it at the end of another schedule's queue, so it takes that schedule's next free run. No schedule runs outside its own times.`,tutorial:{page:`Calendar`,anchor:`move-a-topic-to-another-day`}},"planning.calendar.add-schedule":{title:`Schedule`,body:`The schedule the topics join. They go to the end of its queue, after the topics already there (the count beside each name), so they take its next free runs. Only active and paused schedules are listed.`,tutorial:{page:`Calendar`,anchor:`add-topics`}},"planning.calendar.add-topics":{title:`Topics, one per line`,body:`Each line becomes one topic, in order; blank lines are skipped. A topic fills the schedule's topic keyword, and every other keyword keeps its every-run value. To give topics their own values, edit the schedule's topics as a table under Schedules.`,tutorial:{page:`Calendar`,anchor:`add-topics`}},"planning.channels":{title:`Channels`,body:`A channel is one series: its brand kit, series brief, cast, templates and schedules. Every template belongs to one channel, and each run from it uses that channel's look and cast. The default channel holds everything made before channels and can't be deleted.`,tutorial:{page:`Channels`,anchor:`the-channels-page`}},"planning.channel.current":{title:`Current channel`,body:`Home, Projects and the calendar show only this channel's work. All channels shows everything. It only filters what you see; every project and schedule keeps its own channel. This browser remembers your choice.`,tutorial:{page:`Channels`,anchor:`show-one-channels-work`}},"planning.channel.name":{title:`Channel name`,body:`The name you see in the channel picker, on Play and on the calendar. It stays inside Slopify and doesn't have to match your YouTube channel. Up to 200 characters.`,tutorial:{page:`Channels`,anchor:`create-a-channel`}},"planning.channel.brief":{title:`Series brief`,body:`What the channel covers, its style and what makes a topic worth a video. Topic generation reads it for every schedule of this channel that has no brief of its own. It doesn't change how videos are written. Up to 10,000 characters.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.ai-disclosure":{title:`YouTube AI disclosure`,body:`Studio's AI use answer for this channel's videos and Shorts, given by Prepare upload and the Studio extension. Automatic says Yes only for YouTube's three cases: a voice marked as imitating a real person, real footage altered, or photorealistic AI pictures from a marked Image prompt. Saves as you pick. Default: Automatic.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`override-per-channel`}},"planning.channel.language":{title:`Language of new projects`,body:`The language this channel's new projects are written and narrated in when Play or the template picks none. It applies with the brand kit off too, since it is not styling. Pick voices that speak it. Not set means English. Projects already made keep their language.`,tutorial:{page:`Other-Languages`,anchor:`set-a-channels-language`}},"planning.channel.brand-kit":{title:`Brand kit`,body:`The look every template of this channel gets unless it sets its own: fonts, colours, end screen, intro, outro, document theme and ambient sound. It fills only what a template leaves at its default, and a blank field adds nothing. Turn it off for one video on Play or in Edit project.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-font":{title:`Caption font`,body:`The subtitle font for this channel's videos whose template leaves the font at Default. Not set leaves the template's font alone. Fonts you upload in the subtitle font picker on Play appear here.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-colour":{title:`Caption colour`,body:`The subtitle text colour, as # and six hex digits such as #FFFFFF, for videos whose template sets no colour of its own. Blank leaves the template's colour alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-outline":{title:`Caption outline`,body:`The colour of the line around each subtitle letter, as # and six hex digits such as #000000, for videos whose template sets none. A dark outline keeps light captions readable on bright pictures. Blank leaves the template's outline alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.font":{title:`Title font`,body:`The font of chapter cards and the end screen for videos whose template sets no title style. Not set leaves the template's font alone. Fonts you upload in the subtitle font picker on Play appear here.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.title-colour":{title:`Title colour`,body:`The text colour of chapter cards and the end screen, as # and six hex digits such as #FFD700, for videos whose template sets no title style. Blank leaves the template's colour alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.end-screen":{title:`End screen text`,body:`A line shown over the last 5 seconds of every video of this channel whose template sets no end screen, such as Subscribe for more. Up to 200 characters. Blank shows no end screen text.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.intro":{title:`Intro`,body:`An entry from Library → Intros & Outros, narrated before every video of this channel whose template has no intro. Not set adds none. It adds its own length to each video and costs one voice request, since it is narrated.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.outro":{title:`Outro`,body:`An entry from Library → Intros & Outros, narrated after every video of this channel whose template has no outro. Not set adds none. It adds its own length to each video and costs one voice request, since it is narrated.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.document-theme":{title:`Document theme`,body:`The look of the PDF document for videos of this channel whose template picks no theme: a built-in theme or one you saved. Not set leaves the template's choice alone. A saved theme that was deleted is skipped.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.template-move":{title:`Move a template`,body:`Moves a template, and every schedule that runs it, to another channel. Their next runs use that channel's brand kit, cast and series brief. Projects already made keep what they were made with.`,tutorial:{page:`Channels`,anchor:`templates`}},"planning.channel.episode-memory":{title:`Episode memory`,body:`When a video of this channel finishes, one short call to its text model writes a summary of up to 150 words. A new episode about the same cast or title words gets up to 5 related summaries in its writing prompt, so it agrees with them. Videos already made never change. Default: on for new channels.`,tutorial:{page:`Channels`,anchor:`episodes-episode-memory`}},"planning.channel.episode-summary":{title:`Episode summary`,body:`What the text model wrote this episode covered. Related new episodes read it before they are written. Edit it to correct a fact; your text is kept even if the video finishes again.`,tutorial:{page:`Channels`,anchor:`episodes-episode-memory`}},"planning.channel.videos-paste":{title:`Existing video titles`,body:`Titles of videos this channel made before Slopify, one per line. Topic generation and its duplicate checks skip them, as they skip the videos made here. Titles already listed are skipped, whatever their case.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-csv":{title:`Import a YouTube Studio CSV`,body:`In YouTube Studio open Analytics → Content → Advanced mode and export the table as a CSV. Slopify reads its titles on this machine and lists them with ticks first, so you keep only this channel's videos.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-filter":{title:`Keep only titles containing`,body:`Ticks only the titles containing this text, in any case, such as "Egypt" or "History at Bedtime"; empty ticks them all. Use it when one Studio export holds several series. Remembered for this channel's next import.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-ticks":{title:`Titles in the CSV`,body:`Only ticked titles are added when you press Add. Untick videos of other series in the same export, or type in Keep only titles containing to tick by text.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.cast.kind":{title:`Kind`,body:`Character, creature, place or object. A generated reference picture of a character or creature is portrait (9:16), of a place or object landscape (16:9), and its starting prompt asks for the whole figure, place or object in view. It doesn't change how the member is matched.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.name":{title:`Name`,body:`The name matched against video titles and image briefs, as whole words, ignoring case. When it is found, this member's pictures go with that image as references. Add other spellings and plurals as aliases. Up to 200 characters.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.aliases":{title:`Aliases`,body:`Other names that count as this member, matched as whole words, ignoring case: Cleopatra is found in Cleopatra's palace but not in Cleopatraic. Add plurals and titles such as the Last Pharaoh. Up to 20.`,tutorial:{page:`Cast-Library`,anchor:`how-names-are-matched`}},"planning.cast.description":{title:`Description for the image model`,body:`What the member looks like, in a sentence. It goes to the image model with the member's reference pictures for every image that names it, and starts the prompt of a generated picture. Up to 2,000 characters.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.voice":{title:`Cast voice`,body:`How this member speaks in multi-voice runs: pick them under Speakers on Play and they read with this voice, model and pace in every episode. The list shows voices that speak the channel's language. Leave the provider empty for no voice. A run keeps the voice it started with.`,tutorial:{page:`Cast-Library`,anchor:`give-a-cast-member-a-voice`}},"planning.cast.host":{title:`Channel host`,body:`A recurring voice of this channel. When you pick Podcast or Interview on Play, the draft starts with the channel's hosts that have a voice as its hosts, so you don't add them every episode. You can still remove or add speakers on the draft. Projects already made are unchanged.`,tutorial:{page:`Cast-Library`,anchor:`make-a-member-one-of-the-channels-hosts`}},"planning.cast.pictures":{title:`Reference pictures`,body:`Up to 4 pictures per member, sent with every image whose brief, or the video's title, names it, so it looks the same each time. Upload a PNG or JPEG up to 10 MB, or generate one below. Videos already made keep the pictures they started with.`,tutorial:{page:`Cast-Library`,anchor:`add-reference-pictures`}},"planning.cast.generate":{title:`Make a reference picture`,body:`Pick an image provider and model, describe the picture, then press Generate a picture. Each press is one image call on that provider, billed at its price for one image. A plain background with the whole figure in view makes the best reference.`,tutorial:{page:`Cast-Library`,anchor:`generate-a-picture`}},"planning.cast.picture-prompt":{title:`Picture to make`,body:`The prompt for the generated reference picture. It starts from the name, the description and a request for a plain background; edit it as you like. Up to 4,000 characters.`,tutorial:{page:`Cast-Library`,anchor:`generate-a-picture`}},"planning.links.named":{title:`Named links`,body:`Write {{Name}} in a YouTube description, or ask for it in a Description prompt, and it becomes the link of that name when the description is shown, copied or downloaded, such as {{Patreon}} or {{Discord}}. Each channel keeps its own list on its Brand tab, so a project fills from its channel's links; its own {{Previous video}} wins over the channel's. A name with no link stays as typed. Save channel keeps the list.`,tutorial:{page:`YouTube-Description`,anchor:`links-in-the-description`}}},Pte={"play.template":{title:`Template`,body:`Starts this video from a saved setup: prompts, voice, images, style, outputs and reviews. Picking one opens a fresh draft made from it and carries the topic you typed. No template starts from the default setup. Save a setup you like with Save as template in the right rail.`,tutorial:{page:`Play-Overview`,anchor:`template`}},"play.title":{title:`Title`,body:`The video's name, shown on the project and in Projects. Write a keyword in double braces, like {{Topic}}, and the title becomes a pattern: you type the topic per video, and Add topic queues more videos from the same setup. Up to 200 characters.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.title-pattern":{title:`Title pattern`,body:`The title with its keywords in double braces, like History: {{Topic}}. Each keyword in it is a topic you type at the top of Play, once per video, and templates save it empty. Change the pattern here; the topic values stay at the top.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.topic":{title:`Topic`,body:`What this video is about. The title names this keyword, so its value fills the title and every prompt that names it. Each video from this setup gets its own value, and a template leaves it empty. Up to 200 characters.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.keyword":{title:`Keyword`,body:`A value a picked prompt or the title asks for with {{name}}. You type it once and it fills every place that names it; the line under it lists where. Up to 200 characters. A keyword the title does not name is saved with a template.`,tutorial:{page:`Play-Overview`,anchor:`keywords`}},"play.more-videos":{title:`More videos from the same setup`,body:`Add topic queues another video with everything else the same: only its title and keywords differ. Press a chip to change that video's keywords. Start queues all of them, and they run one at a time. One Start queues at most 50 videos.`,tutorial:{page:`Play-Overview`,anchor:`more-videos-from-the-same-setup`}},"play.drafts":{title:`Drafts`,body:`Play saves every change to this draft on its own; nothing starts until you press the Play key. Drafts lists your saved setups to open again or discard. New draft starts an empty one and keeps this one in the list.`,tutorial:{page:`Play-Overview`,anchor:`drafts`}},"play.draft-conflict":{title:`Changed elsewhere`,body:`This draft was saved from another tab or window since you opened it. Reload saved draft shows that version and drops your unsaved change. Save as a new draft keeps your version as a separate draft and leaves the other one alone.`,tutorial:{page:`Play-Overview`,anchor:`when-a-draft-was-changed-elsewhere`}},"play.source.research":{title:`Research source`,body:`Generate has the text model plan chapters, research each one on the web and combine the notes before the article is written: one call to plan, one per chapter and one to combine. Provide uses notes you paste. Off, the default, writes from the prompt alone.`,tutorial:{page:`Play-Title-and-Article`,anchor:`research`}},"play.source.article":{title:`Article source`,body:`Generate has the text model write the article from the article prompt, one call. Provide narrates text you paste, word for word, with no text-model cost. The article is what the narration reads and the PDF lays out. Default: Generate.`,tutorial:{page:`Play-Title-and-Article`,anchor:`choose-where-the-article-comes-from`}},"play.source.audio":{title:`Narration source`,body:`Generate reads the article aloud with a text-to-speech voice, charged by the provider per character. Provide uses an audio file you upload, as it is. Off makes a silent video with no captions, YouTube description or shorts. Default: Generate.`,tutorial:{page:`Play-Narration`,anchor:`choose-where-the-narration-comes-from`}},"play.source.images":{title:`Images source`,body:`Generate draws images from the ticked image prompts, one image-model call each. Provide uses your own PNG, JPEG or WebP files in the order you pick them. Off turns off the video too. Default: Generate.`,tutorial:{page:`Play-Images`,anchor:`choose-where-the-images-come-from`}},"play.source.thumbnail":{title:`Thumbnail source`,body:`From prompt draws the thumbnail straight from the thumbnail prompt, one image call. Prompt by LLM first has the text model write the image prompt from yours, the title and the article, then draws it. Provide uses your own image. Default: Off.`,tutorial:{page:`Play-Outputs`,anchor:`thumbnail`}},"play.source.video":{title:`Video source`,body:`Generate renders the slideshow video on this computer from the images and narration; it costs no provider money, only time. Off leaves each finished stage to download on its own. It needs images, so it is Off while Images is Off. Default: Generate.`,tutorial:{page:`Play-Video-and-Style`,anchor:`choose-whether-to-render-a-video`}},"play.source.document":{title:`Document source`,body:`Generate lays out a PDF of the article and title on this computer, in the theme you pick. It needs no provider and costs nothing. Default: Off.`,tutorial:{page:`PDF-Documents`,anchor:`make-a-pdf`}},"play.article-prompt":{title:`Article prompt`,body:`The Library prompt the text model is sent to write the article, with its keywords filled in. A Script prompt, used when several speakers read, asks for speaker turns instead. Write or change prompts on Prompts; View prompt shows the text.`,tutorial:{page:`Play-Title-and-Article`,anchor:`generate-an-article-from-a-prompt`}},"play.provided.article":{title:`Article text`,body:`The article you paste is narrated word for word, and no text model writes one. Include everything that should be read, headings too. The count under it helps you judge the length: about 150 words is one minute of narration.`,tutorial:{page:`Play-Title-and-Article`,anchor:`paste-your-own-article`}},"play.provided.research":{title:`Research notes`,body:`Notes you paste are given to the text model with the article prompt, in place of web research. Paste facts, sources and quotes the article should draw on. Nothing is looked up.`,tutorial:{page:`Play-Title-and-Article`,anchor:`give-your-own-research-notes`}},"play.text-generation":{title:`Text generation`,body:`One text model writes everything this run needs in words: the article, research, the thumbnail's image prompt, entries set to LLM, Narration Preparation, the YouTube description and picking shorts. Each is a separate call, counted in usage. Set the default under Settings.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.provider":{title:`LLM`,body:`Who runs the text model: a command-line tool you are signed in to, such as Claude Code or Codex, or a keyed service such as OpenRouter, billed per token. A greyed provider says why it cannot be used; fix it under Settings.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.model":{title:`Text model`,body:`The model the provider runs for every text step. Bigger models write better and cost more per token. Refresh asks the provider for its current list; Custom ID lets you type a model the list does not show.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.thinking":{title:`Thinking`,body:`How long the model reasons before it answers, for models that offer it. Higher levels can write more carefully but take longer and use more tokens. Model default leaves it to the provider.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.tts.provider":{title:`TTS`,body:`The text-to-speech service that reads the narration, charged by the provider per character of text. A greyed provider says why it cannot be used; add its key under Settings. Changing it clears the model and voice.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.tts.model":{title:`TTS model`,body:`The provider's speech model. Models differ in quality, languages, speed and price per character. Some features need a particular model: Narration Preparation needs Inworld TTS-2. Refresh asks the provider for its current list.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.voice":{title:`Voice`,body:`Who reads the narration. The list holds the voices you added under Settings → Voices for this provider, filtered to the project's language. With several speakers, this voice reads the intro and outro.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.show-all-voices":{title:`Show all voices`,body:`The voice list hides voices listed for other languages than the project's. Tick this to pick one anyway, for example a multilingual voice whose languages are listed wrong. A voice with unknown languages is always shown.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.intro":{title:`Intro`,body:`A Library entry read before the article. A text entry is read as written; an LLM entry is written by the text model for each video, one extra call. Off reads no intro. Write entries in Library → Intros & Outros.`,tutorial:{page:`Play-Narration`,anchor:`intro-and-outro`}},"play.outro":{title:`Outro`,body:`A Library entry read after the article, such as a sign-off. A text entry is read as written; an LLM entry is written by the text model for each video, one extra call. Off reads no outro.`,tutorial:{page:`Play-Narration`,anchor:`intro-and-outro`}},"play.chunking":{title:`Chunking`,body:`How the narration is split into text-to-speech requests. Whole sends it in one request; Paragraph sends one per paragraph; Every N words or characters ends each at a sentence end. Split when a provider refuses long text. Default: Whole. It changes the number of requests, not the characters charged.`,tutorial:{page:`Play-Narration`,anchor:`chunking`}},"play.chunking.count":{title:`Chunk size`,body:`How long each text-to-speech request may be. Each request ends at the last whole sentence that fits, so a single longer sentence stays whole. Defaults: 500 words or 3000 characters, spaces included.`,tutorial:{page:`Play-Narration`,anchor:`chunking`}},"play.narration-preparation":{title:`Narration Preparation`,body:`Has the text model add delivery directions and sounds, such as a sigh or a laugh, following the Library narration prompt you pick. One text-model call per narration chunk and per entry. Needs Inworld TTS-2. The article and captions stay unchanged. Default: Off.`,tutorial:{page:`Play-Narration`,anchor:`narration-preparation`}},"play.pronunciation-glossary":{title:`Pronunciation Glossary`,body:`Reads names with the IPA in the article's Pronunciation Glossary, such as Arda: /ˈɑɹdə/, with no extra text-model call. In your article prompt, ask for a glossary in slash-delimited standard-English IPA (Term: /IPA/), with an English approximation for foreign names; a line with sounds English lacks is read as plain text. Works with Inworld TTS-2 and TTS-2 Flash. The written text stays unchanged. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"play.share-glossary":{title:`Pronunciations from other projects`,body:`Adds every term from your other projects' glossaries, copied when this project starts. This project's own glossary wins where they differ. Turn it off to use only this article's glossary. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"play.describe-figures":{title:`Describe tables and figures`,body:`Instead of skipping tables, pictures, equations and code or reading them cell by cell, the text model writes a short spoken passage for each (a table's pattern, what a figure or equation means, what code does) and the narration says it in its place. One extra text-model call per block, in the estimate, kept for reuse. The article and PDF keep the real table; captions show what is said. Needs a text model. Default: on.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"play.show-figures":{title:`Show tables and figures on screen`,body:`Each table, figure, equation and code block the narration describes is also shown in the video while it is described: the article's own picture for a figure, a card drawn in your brand kit's title font and colour for the rest. The images take turns around them, and Shorts that include one show it upright. Drawn on this computer at no cost. Needs Describe tables and figures. Default: on.`,tutorial:{page:`Play-Outputs`,anchor:`show-tables-and-figures-on-screen`}},"play.skip-code":{title:`Leave code out`,body:`Drops code blocks from the narration instead of summarising each in a sentence or two. Tables, figures and equations are still described. Default: off.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"play.narration-aliases":{title:`Narration aliases`,body:`Says the words listed in Library → Aliases the way they are written there, such as Dr. as Doctor, with any generated voice. They are copied when the project starts. The article and captions keep the written words. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`use-aliases-in-a-video`}},"play.speakers.format":{title:`Speakers format`,body:`Narration uses one voice. Audiobook, Podcast, Radio drama and Interview give lines to several speakers, each with a voice. Several speakers need the text model to write or split the script. A new Podcast or Interview starts with the channel's hosts (cast members marked as hosts, with a voice).`,tutorial:{page:`Multiple-Voices`,anchor:`formats`}},"play.speakers.script":{title:`Script`,body:`Write a script has the text model write speaker turns from a Script prompt, one Name: words paragraph each. Split the article keeps the article as written and has the text model hand its narration and dialogue to the speakers, one extra call.`,tutorial:{page:`Multiple-Voices`,anchor:`the-script`}},"play.speakers.add-from-cast":{title:`Add from the cast`,body:`Adds a member of this channel's cast as a speaker, with their name and voice. Only members with a voice are listed. Edit the cast on the channel's page.`,tutorial:{page:`Multiple-Voices`,anchor:`speakers-from-a-channels-cast`}},"play.speakers.book":{title:`A chapter of a book`,body:`Makes this audiobook one chapter of a book. The MP3 and M4B are tagged with the book as their album and the chapter as their track, so a player keeps the chapters together and in order. When the chapter is done, Make the next chapter on its project page starts the next one with the same speakers and settings.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.book-title":{title:`Book title`,body:`The book this chapter belongs to, the same for every chapter. It becomes the album of the MP3 and M4B files.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.book-chapter":{title:`Chapter`,body:`This chapter's number in the book, from 1 to 9999. It becomes the track number of the MP3 and M4B files.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.turn-gap":{title:`Gap between turns`,body:`The pause between one speaker's turn and the next, from 0 to 1.2 seconds. Longer feels calmer; shorter feels like a lively talk. Default: 0.35 s.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.name-tags":{title:`Speaker names on captions`,body:`Puts the speaker's name before their captions, like Ada: and their words, so viewers know who is talking. On by default for a podcast or interview.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.native-dialogue":{title:`One request for consecutive turns`,body:`Sends back-to-back turns as one multi-speaker request where the provider has one (ElevenLabs v3 with up to 10 voices, Gemini TTS with 2), so the voices react to each other. Fewer requests, same characters charged. Other providers read each turn on its own.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.audio-files":{title:`MP3 and M4B files`,body:`Also saves the narration as an MP3 and an M4B audiobook file with a chapter marker at each chapter, beside the video. Made on this computer at no provider cost.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speaker.name":{title:`Speaker name`,body:`The name the script uses for this speaker's turns (Name: words) and the one captions and the speaker panel show. Up to 40 characters.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.role":{title:`Role`,body:`What this speaker does in the format: narrator, host, guest or character. The text model is told each speaker's role when it writes or splits the script.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.provider":{title:`Voice provider`,body:`The text-to-speech service for this speaker, charged per character of their lines. Speakers may use different providers. Changing it clears the model and voice.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.model":{title:`Voice model`,body:`The provider's speech model for this speaker. Models differ in quality, languages and price per character. Pronunciations need an Inworld TTS-2 model.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.voice":{title:`Speaker voice`,body:`This speaker's voice, from the voices you added under Settings → Voices for their provider, filtered to the project's language. Press Audition to hear it read their first line.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.pace":{title:`Pace`,body:`How fast this speaker talks, from 0.8× to 1.2× of the voice's own speed. Default: Normal.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.pronunciations":{title:`Speaker pronunciations`,body:`One Term: /IPA/ per line, like the article's Pronunciation Glossary, for this speaker only. Used on Inworld TTS-2 voices, ahead of the glossary. A line with sounds the language does not use is skipped and read as ordinary text.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.audition":{title:`Audition`,body:`Speaks this speaker's first line in their voice so you can hear it before the run. It is one real text-to-speech request, charged by the provider at about the price shown on the button.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.images.provider":{title:`Image provider`,body:`Who draws the images, the thumbnail and the shorts' pictures: a keyed service such as fal.ai, billed per image, or a command-line tool you are signed in to. A greyed provider says why it cannot be used; fix it under Settings.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-provider-and-model`}},"play.images.model":{title:`Image model`,body:`The provider's image model. Models differ in quality, speed and price per image; the estimate in the right rail shows what this run costs. Refresh asks the provider for its current list.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-provider-and-model`}},"play.images.effort":{title:`Effort`,body:`How long an image agent, such as the Codex CLI, reasons before it draws. Higher effort can follow the prompt more closely but takes longer and uses more tokens. Model default leaves it to the provider.`,tutorial:{page:`Play-Images`,anchor:`drawing-with-the-codex-cli`}},"play.image-prompts":{title:`Image prompts`,body:`Tick the Library prompts that draw the video's images, and give each a number: how many images it makes, 1 to 20. A run makes at most 60 this way. Each image is one image-model call. The images play in the order you ticked the prompts.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-prompts`}},"play.reference":{title:`Establishing image`,body:`Made first and never shown in the video. Every other image, the shorts' and, if ticked, the thumbnail is drawn with it as a reference, so characters, style and palette stay the same. From a prompt costs one more image; Upload uses yours. Changing it marks those images outdated. Default: Off.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.reference.prompt":{title:`Establishing prompt`,body:`The Library image prompt that draws the establishing image, its keywords filled like the others. Describe the characters, setting and style every other image should share.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.reference.thumbnail":{title:`Thumbnail from the establishing image`,body:`Draws the thumbnail with the establishing image as a reference too, so it matches the video. Untick it for a thumbnail drawn on its own. Default: on.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.image-scale":{title:`More images for long videos`,body:`Adds images as the narration gets longer, planned from the expected length when the run starts. The extra images are shared among the ticked prompts in order, up to 240 in all; each is one more image call. The line under it shows the count. Turning it on switches Motion from Zoom to Mix of both.`,tutorial:{page:`Play-Images`,anchor:`more-images-for-long-videos`}},"play.batch-queue":{title:`Queue`,body:`With more than one video on the page: on, they run one after another, each starting when the one before finishes (Calendar → Batch queue shows the order); off, they all start at once. At once finishes sooner when the steps wait on providers, but the video renders share your computer's processor and plan limits are reached sooner. Default: on.`,tutorial:{page:`Play-Overview`,anchor:`queue-or-all-at-once`}},"play.image-scenes":{title:`Scenes from the article`,body:`Gives every image its own moment. The project's AI model reads the article once and writes a scene per image, from the opening to the ending in slideshow order. The scene goes where a prompt has {{Scene}}, or after its first paragraph. A thumbnail prompt with {{Scene}} gets a scene too: the article's most striking moment, a different one per thumbnail. Off, a {{Scene}} line is left out. One more AI call per run.`,tutorial:{page:`Play-Images`,anchor:`scenes-from-the-article`}},"play.image-scale.rate":{title:`Image rate`,body:`Give the rate as one image every N minutes of narration (0.25 to 60) or as N images per hour (1 to 240); switching keeps the same rate. Narration runs about 150 words a minute. Starts at one image every 2 minutes.`,tutorial:{page:`Play-Images`,anchor:`more-images-for-long-videos`}},"play.image-seconds":{title:`Seconds per image`,body:`How long each image stays on screen, 1 to 600 seconds. When cuts follow the narration, it is the target and a cut waits for a sentence end. When images run out they start again. Default: 15.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.zoom":{title:`Zoom`,body:`How far each image zooms in or out over its time on screen, 0 to 50 percent. 0 keeps images still. Default: 22.5 percent.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.motion":{title:`Motion`,body:`How each image moves while on screen: Zoom in and out, Pan across, a Mix of both by turns, or Still. A mix keeps a long video watchable. Default: Zoom in and out.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.edge-silence":{title:`Silence at start and end`,body:`Quiet time before the narration starts and after it ends, 0 to 30 seconds. Default: 2.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.silence-gap":{title:`Silence between segments`,body:`Seconds of quiet between the intro and the narration, and between the narration and the outro, 0 to 30. It only matters when an intro or outro is set. Leave it empty to use the gap set in Settings, 3 seconds unless you changed it.`,tutorial:{page:`Play-Narration`,anchor:`silence-at-the-edges-and-between-segments`}},"play.format":{title:`Frame format`,body:`16:9 is a landscape video for YouTube and screens. 9:16 is a portrait video for phones. 1:1 is square, for posts and feeds. Images are drawn in this shape and captions are placed for it; shorts stay 9:16 and the thumbnail stays 16:9 for YouTube. Default: 16:9.`,tutorial:{page:`Play-Video-and-Style`,anchor:`frame-format`}},"play.preview-text":{title:`Preview text`,body:`The sample sentence the style preview shows in your caption font, size and position. It is only for the preview and never reaches the video; real captions come from the narration.`,tutorial:{page:`Play-Video-and-Style`,anchor:`style-preview`}},"play.thumbnail-prompt":{title:`Thumbnail prompt`,body:`The Library thumbnail prompt, keywords filled in. From prompt sends it to the image model as it is; Prompt by LLM gives it to the text model with the title and article to write the image prompt. Write prompts on Prompts.`,tutorial:{page:`Play-Outputs`,anchor:`thumbnail`}},"play.thumbnail-count":{title:`Thumbnails`,body:`Three makes two more thumbnails from the same prompt with different compositions, for YouTube's Test & compare. Each costs one more image, so 3 thumbnails are 3 image calls. You can remake each on its own on the project page. Default: 1.`,tutorial:{page:`Play-Outputs`,anchor:`make-three-thumbnails-for-test--compare`}},"play.youtube-description":{title:`YouTube description`,body:`After subtitle timing, the text model writes a description with chapters at the narration's real times, hashtags at the end, and a separate list of tags, ready to copy. One text-model call. It runs beside the render. Needs narration. Default: off.`,tutorial:{page:`YouTube-Description`,anchor:`turn-it-on`}},"play.description-prompt":{title:`Description prompt`,body:`The Library prompt the description is written from. Built-in asks for a short summary, 5 to 12 chapters, 3 to 5 hashtags and 15 to 25 tags. Write your own description prompt on Prompts to change the tone or add links.`,tutorial:{page:`YouTube-Description`,anchor:`turn-it-on`}},"play.shorts":{title:`Shorts`,body:`After subtitle timing, the text model picks the best self-contained moments of the narration. Each becomes a vertical 1080×1920 clip with new images, big word-by-word captions and its own title, description and hashtags. It runs beside the render; its images are charged like any other. Needs narration. Default: off.`,tutorial:{page:`Shorts`,anchor:`turn-on-shorts`}},"play.shorts.count":{title:`How many shorts`,body:`How many shorts to cut from this video, 1 to 10. Each needs its own new images, so more shorts cost more image calls and render time. Default: 3.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.length":{title:`Short length`,body:`The shortest and longest a short may run, in seconds, between 15 and 180. The text model picks moments within these bounds. Default: 60 to 120.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.prompt":{title:`Shorts prompt`,body:`The Library prompt the text model follows to pick the moments and write each short's title, description and hashtags. Built-in picks moments that make sense alone and open on a hook.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.image-style":{title:`Image style`,body:`The Library image prompt the shorts' new vertical images are drawn from. Built-in draws cinematic, uncluttered images with the subject centred. Pick one of your image prompts to match the long video.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.title-on-screen":{title:`Title on screen`,body:`Keeps the short's title at the top for the whole clip, large and bold in the caption font, below where the apps draw their own buttons. Default: on.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.preview":{title:`Shorts preview`,body:`A few seconds of the sample project's narration and images as a short: vertical, through the same renderer your shorts use, with the big word-by-word captions in your caption font, the title on screen when it is on, and the speed you chose. It renders again by itself a moment after you change a setting, costs no API calls, and Render again forces a fresh one.`,tutorial:{page:`Shorts`,anchor:`shorts-preview`}},"play.shorts.speed":{title:`Speed`,body:`Plays each short faster than the narration, 1.00× to 1.25× in steps of 0.05, with the pitch kept. A little faster suits short-form viewers. Default: 1.00×.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.music-volume":{title:`Music volume`,body:`How loud the background music plays under every short, 0 to 100 percent; it dips while the narrator speaks. Only used when you add a music file below. Default: 15.`,tutorial:{page:`Shorts`,anchor:`add-background-music`}},"play.shorts.full-video-link":{title:`Full video link`,body:`Each short's description ends with a line pointing to the full video. Paste the video's link here; without it the line says [PASTE THE FULL VIDEO LINK HERE] for you to fill in.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.document-theme":{title:`Theme`,body:`How the PDF looks: a built-in theme or one of yours from Library → Documents. A theme of yours is copied into the project, so editing it later leaves this project alone until you pick it again. Edit themes opens the list.`,tutorial:{page:`PDF-Documents`,anchor:`options`}},"play.checkpoints":{title:`Review checkpoints`,body:`Holds the run before a step so you can check and edit what came before it. Steps that do not depend on it carry on. Approve each checkpoint on the project page to continue. A step must be generated to have a checkpoint.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`add-a-checkpoint-on-play`}},"play.reviews":{title:`Automatic reviews`,body:`A reviewer model checks each finished item and saves its verdict and reasons on the project page. Flag only marks a failed item; Flag and redo makes it again, up to the redos per item, then keeps and flags it. Each review is a text-model call, counted in usage. Default: Off.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.provider":{title:`Reviewer`,body:`Who runs the review model. Picture reviews, for images, the thumbnail and shorts, need Claude Code or Codex, which can look at images; other providers review text only.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.model":{title:`Reviewer model`,body:`The model that judges each item. A stronger model catches more but costs more per review. It can differ from the model that wrote the text.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.retries":{title:`Redos per item`,body:`How many times Flag and redo makes a failed item again before it keeps the last one and flags it, 0 to 5. Each redo costs the item again plus one more review. Default: 2.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.channel":{title:`Channel`,body:`The channel this video belongs to. Its brand kit fills what this setup leaves at its default, and its cast of characters goes with the images. A draft that picks none runs in its template's channel, or the default one.`,tutorial:{page:`Play-Overview`,anchor:`channel-row`}},"play.brand-kit":{title:`Channel's brand kit`,body:`Fills what this setup leaves at its default from the channel: the caption font, intro, outro, document theme and ambient sound. What you set here wins. Turn it off to take none of it; the cast and language still apply. Default: on.`,tutorial:{page:`Play-Overview`,anchor:`channel-row`}},"play.language":{title:`Language`,body:`The language the article, narration, YouTube description and shorts titles are written in. Pick a voice that speaks it. Outside English, captions are timed with a free 248 MB model, downloaded once, where one exists. On Play, blank uses the channel's language.`,tutorial:{page:`Other-Languages`,anchor:`pick-a-language-for-one-video`}},"play.estimate":{title:`Estimated cost`,body:`What the providers are likely to charge for this run, in US dollars, from their published prices. Actual usage can differ, and the estimate does not cap spending.`,tutorial:{page:`Play-Overview`,anchor:`estimated-cost`}},"play.expected-words":{title:`Expected article words`,body:`How long you expect each generated article to be. It drives the cost estimate and how many images More images for long videos adds; the article's real length is used once it is written. About 150 words is one minute. Default: 1500.`,tutorial:{page:`Play-Overview`,anchor:`expected-article-words-per-video`}},"play.refresh-review":{title:`Refresh review`,body:`Asks the server to check the setup again and recalculate the estimate now, instead of waiting for you to pause typing. Use it after changing a prompt in the Library.`,tutorial:{page:`Play-Overview`,anchor:`review-the-whole-setup`}},"play.template-name":{title:`Template name`,body:`The name the template is listed under on Play and Templates. The template keeps this setup's settings; the topic you typed and any extra videos are left out, as the list below says.`,tutorial:{page:`Play-Overview`,anchor:`save-as-template`}},"play.queue":{title:`Video queue`,body:`Videos started together run one at a time, in this order. Pausing a project holds the queue; when one fails or is cancelled, the next one starts.`,tutorial:{page:`Play-Overview`,anchor:`the-video-queue`}},"play.voices.name":{title:`Voice name`,body:`The name you pick this voice by on Play and in Edit project. Only you see it.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.provider":{title:`Voice provider`,body:`The text-to-speech service the voice ID belongs to. Only providers set up under Settings are listed.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.voice-id":{title:`Voice ID`,body:`The provider's own id for the voice, copied from its voice library. It is not checked now; a wrong id fails when a run's narration uses it. For Google Gemini, pick one of its 30 prebuilt voices instead.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.languages":{title:`Voice languages`,body:`The languages the voice speaks, as codes such as es, de. Play lists the voice only for projects in these languages. Blank asks the provider when it can say; a voice with unknown languages is offered for every language.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.real-person":{title:`Real person`,body:`Turn this on for a voice cloned from, or made to sound like, a real person. Prepare upload then answers Yes to YouTube's AI use question for videos it narrates. An AI voice that imitates no one stays off.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}}},Fte={"project.next-chapter":{title:`Make the next chapter`,body:`Opens a new draft on Play for this book's next chapter: the same speakers and voices, channel and cast, prompts and settings, with the chapter number one higher. Write or paste the new chapter's text there, then start it. The MP3 and M4B carry the book as their album and the chapter as their track. An audiobook that is not a book yet becomes one, named after it, starting at chapter 2.`,tutorial:{page:`Multiple-Voices`,anchor:`make-the-next-chapter`}},"project.video.cuts":{title:`Cuts`,body:`Every N seconds holds each image for Seconds per image. Follow the narration cuts in the pause after a sentence, as close to that length as the sentences allow (never under 40% of it), and starts a new image at every chapter. It needs word timing, so it works in English and the languages that have it. New projects default to Follow the narration.`,tutorial:{page:`Video-Editing`,anchor:`cuts`}},"project.video.transition":{title:`Transition`,body:`How one image hands over to the next: Cut, Crossfade, Fade through black, Slide or Wipe. The change is centred on the cut and takes the length you pick (0.2 to 2 s), so the video stays exactly as long as its narration. Default: Cut, 0.6 s.`,tutorial:{page:`Video-Editing`,anchor:`cuts`}},"project.video.grade":{title:`Colour grade`,body:`A colour treatment over the whole video: Warm fantasy, Cold, Desaturated or Sepia. It is applied while the video renders, so it costs no API calls, only render time. Default: None.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.vignette":{title:`Vignette`,body:`Darkens the corners of the picture to draw the eye to the middle. Subtle or Strong. Applied while the video renders, with no API cost. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.grain":{title:`Film grain`,body:`Adds moving film grain over the whole picture for an older, filmic feel. Subtle or Strong. Applied while the video renders, with no API cost. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.atmosphere":{title:`Atmosphere`,body:`An overlay Slopify draws itself: rising embers, drifting dust, or low fog along the bottom of the frame. No footage is downloaded and no API is called; it only adds render time. Default: None.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.chapter-cards":{title:`Chapter cards`,body:`Shows each chapter's title in the middle of the picture for 2.5 seconds as the chapter starts, in the caption font. Chapters come from the YouTube description when that step runs, otherwise from the article's headings. Needs narration. Default: off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.animate":{title:`Animate images`,body:`Turns some images into 5-second moving clips with an image-to-video model on your image provider (fal.ai or Replicate). Chapter openers animates the first image of each chapter; Every Nth image animates every 2nd to 10th. Each clip is one paid call, shown in the estimate. An image that cannot be animated stays still. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.pause.sentence":{title:`Pause between sentences`,body:`The least quiet after each sentence, in seconds. Some voices barely breathe between sentences; this adds silence where the pause is shorter, never shortening one or cutting a word, and the captions follow. About 0.25 s is brisk, 0.35 to 0.45 natural or documentary, 0.5 to 0.8 an audiobook's relaxed pace, 0.8 and up sleep content. Default: 0.4; 0 keeps the voice's own.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.pause.paragraph":{title:`Pause between paragraphs`,body:`The least quiet at the end of a paragraph, in seconds, when you want more than between sentences. Usually the narration prompt and the voice pace paragraphs well already, so it is 0 by default: paragraphs get the sentence pause. Try 0.8 to 1.2 for a slower read. A speaker's turn gap is set under Speakers instead. Runs on this computer.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness":{title:`Level the volume`,body:`Brings every narration piece (each chunk, and each speaker's turn) to one loudness before they are joined, so the voice stops jumping between quiet and loud. Then the video, the shorts and the audio files are each set to a finished loudness. Runs on this computer, no API calls; turning it on remakes the levelled narration and the exports, never the speech. Default: on for new runs.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness.video":{title:`Video volume`,body:`How loud the finished video and shorts are, in dB from the recommended level. LUFS is how loud a file sounds on average (the scale YouTube and Spotify use); YouTube and Spotify play everything at about -14 LUFS, so 0 dB here is -14 LUFS. -6 dB is about half as loud (50%), +4 dB about 158%. Peaks always stay under -1.5 dBTP.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness.audio-files":{title:`Audio files volume`,body:`How loud the audio-only WAV and an audiobook's MP3 and M4B are, in dB from -18 LUFS, the level audiobook shops such as ACX ask for (-18 to -23 LUFS). LUFS is how loud a file sounds on average. Type dB or a percentage of the recommended level; peaks always stay under -3 dBTP, which those shops require.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.ambient.source":{title:`Ambient sound`,body:`Rain, a fireplace or wind made on this computer, or your own audio file, played quietly under the whole narration of the long video. It dips while the narrator speaks. Costs no API calls. Shorts never get it. Changing it remakes only the video. Default: None, or the channel's bed.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.level":{title:`Ambient level`,body:`How loud the ambient sound plays under the voice, in decibels from -40 (barely there) to -6 (close to the voice). Whole numbers only. Default: -18 dB.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.fade-in":{title:`Ambient fade in`,body:`How many seconds the ambient sound takes to rise from silence at the start of the video, 0 to 30 in half-second steps. Default: 3 seconds.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.tail":{title:`Ambient tail`,body:`How long the ambient sound keeps playing, fading out, after the narration ends: 0 to 30 seconds in half-second steps. A tail longer than the silence at the end makes the video that much longer. Default: 6 seconds.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.subtitles.mode":{title:`Subtitles`,body:`Off makes none. Subtitle files gives you .srt and .vtt files to upload beside the video. Burn into video draws the captions into the picture and also makes the files; it needs Video on. Captions are timed from your narration on this computer, with no paid API; the first use downloads a speech model of about 95 MB. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.font":{title:`Subtitle font`,body:`The typeface of burned-in captions and chapter cards. Pick a bundled font or one you uploaded (.ttf or .otf); uploaded fonts stay available to every project. Subtitle files carry no font, since players style them. Changing it remakes only the video. Default: the bundled font.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.size":{title:`Subtitle font size`,body:`How big burned-in captions are, from 16 to 120. Larger is easier to read on phones but covers more of the picture. Default: 48.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.position":{title:`Subtitle position`,body:`Where burned-in captions sit on the frame: Top, Upper-middle, Center, Lower-middle or Bottom. Move them up when the pictures have important detail near the bottom. Subtitle files ignore it. Default: Bottom.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.video.style-preview":{title:`Style preview`,body:`Six seconds of the sample project's narration and images, rendered on this computer by the real video renderer with your captions, Look and motion, on the establishing image or a cast picture when there is one. The captions follow the narration word by word. It renders again by itself a moment after you change a setting. It costs no API calls, only a few seconds of your computer's time. Render again forces a fresh one.`,tutorial:{page:`Video-Editing`,anchor:`style-preview`}},"project.edit.article-text":{title:`Article text`,body:`The script the narrator reads, in Markdown. Your edits are kept when other settings change and are saved as a new revision; the narration, images and video made from the old text turn outdated and are remade when you choose. Headings become chapters.`,tutorial:{page:`Editing-a-Project`,anchor:`change-the-article-text`}},"project.edit.regenerate-article":{title:`Regenerate article after review`,body:`Marks the article to be written again by the text model, which is one or more paid text calls. Nothing runs yet: the rebuild review lists it with the narration, images and video it outdates, and you start it there. It replaces any edits you made to the article.`,tutorial:{page:`Editing-a-Project`,anchor:`regenerate-the-article`}},"project.saved-revision":{title:`Saved revision`,body:`Every save of Edit project is a revision: a snapshot of the settings and content. Continuing a run always uses the current one. Saving never starts work; outputs the change affects turn outdated and keep their old version until remade. Remaking is offered as the next action, and History lets you go back.`,tutorial:{page:`Editing-a-Project`,anchor:`history-and-saved-revisions`}},"project.choose-remake":{title:`Choose what to remake`,body:`Opens the rebuild review for every outdated or failed output: what will be made again, kept or skipped, what it costs, and which inputs changed. Nothing runs until you press Remake there, and Keep things as they are closes it with nothing spent.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.prompts.template":{title:`Use saved template`,body:`Copies a prompt from your Library into this project, replacing the raw prompt below. The project keeps its own copy, so later Library edits reach it only when you pick it again or press Use the Library version. Outputs made from the old wording turn outdated; nothing is remade until you choose.`,tutorial:{page:`Editing-a-Project`,anchor:`prompts`}},"project.prompts.raw":{title:`Raw prompt`,body:`This project's own copy of the prompt, with keywords still in double braces such as {{Topic}}. Edit it to change what the model is asked for this project only; the Library prompt is untouched. Saving fills the keywords in again, and what was made from the old wording turns outdated.`,tutorial:{page:`Editing-a-Project`,anchor:`prompts`}},"project.edit.rewrite-description":{title:`Write the description again`,body:`Marks the YouTube description to be written again by the text model, one paid text call. Nothing runs yet: save, and it is remade when you continue the run or start the rebuild review. The description you have now is replaced.`,tutorial:{page:`YouTube-Description`,anchor:`write-it-again-or-turn-it-on-later`}},"project.shorts.clips":{title:`Picked clips`,body:`The moments the text model picked for your shorts, each shown by its first and last sentence. Earlier and Later move a clip's start or end by one sentence; Use my own range picks both from lists. Moving a clip costs no calls and keeps its images where the sentences stay the same. Changes apply when you save and continue the run.`,tutorial:{page:`Shorts`,anchor:`change-the-picked-moments`}},"project.shorts.range":{title:`Clip range`,body:`The first and last sentence of this short, from the narration's timed sentences. The clip must stay between the shortest and longest length you set for shorts and must not overlap another clip; the line under the clip says what to change. Back to the AI's choice restores its pick.`,tutorial:{page:`Shorts`,anchor:`change-the-picked-moments`}},"project.shorts.pick-again":{title:`Pick different moments`,body:`Asks the text model to pick new moments when you save and continue the run, one text call. Ranges you set by hand are dropped. A new clip on the same sentences as an old one keeps its images; any other clip gets new images, one image call each, and is rendered again.`,tutorial:{page:`Shorts`,anchor:`pick-new-moments-or-remake-one-short`}},"project.shorts.remake":{title:`Make this short again`,body:`Makes this one short again when you save and continue the run: its image prompts are written again, its images are drawn again (one image call each) and it is rendered again. Its moment, title and the other shorts stay as they are.`,tutorial:{page:`Shorts`,anchor:`pick-new-moments-or-remake-one-short`}},"project.images.editor":{title:`Edit images`,body:`Every image of the video in the order it is shown. You can edit a drawn image's prompt, replace any image with your own file, move it earlier or later, delete it, or add a drawn image, your own picture or a video clip. A clip plays muted in an image's place, trimmed, slowed or looped to fit. Changes apply after you save.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.images.prompt":{title:`Image prompt`,body:`The words this one image is drawn from, with keywords in double braces filled in from the project. Editing it outdates only this image and the video; it is drawn again, one image call, when you remake outdated outputs. Use saved wording as template copies the prompt as sent so you can edit it.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.images.regenerate":{title:`Regenerate image`,body:`Marks this image to be drawn again from its prompt, one paid image call, with a new result. Nothing runs yet: the image says it is marked, and Keep takes the mark off. Press Save changes, and the rebuild review lists it with the video it outdates. The current image stays until the new one is made.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.narration.editor":{title:`Edit narration`,body:`The narration split into the chunks it was spoken in. Edit a chunk's text, replace its audio with your own file, or have it spoken again. Only the chunks you touch are made again, paid per character, and the video is rendered again with them. Changes apply after you save.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.narration.chunk-text":{title:`Narration chunk text`,body:`What the narrator says in this chunk. Editing it has this chunk spoken again by your voice provider, paid per character of the chunk, when you remake outdated outputs; the other chunks keep their audio. Captions and the video follow. It does not change the article.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.narration.regenerate":{title:`Regenerate narration chunk after review`,body:`Marks this chunk to be spoken again with the same text and voice, paid per character of the chunk, for a new take when a word came out wrong. Nothing runs yet: save, and it is made again when you continue the run. The current audio stays until then.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.captions.editor":{title:`Caption text and timing`,body:`Each caption's words and when it shows, in seconds from the start of the narration. Fix a misheard word or move a caption a little earlier or later; captions must not overlap and must end after they start. Edits cost nothing and only the subtitle files and the video are made again. The narration is not changed.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-captions`}},"project.captions.apply":{title:`Apply caption edits to draft`,body:`Checks every caption (text present, times in order, inside the narration) and puts your edits into the project draft. Nothing is saved until you press Save changes, and the video is rendered again only when you remake outdated outputs.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-captions`}},"project.youtube.summary":{title:`Summary`,body:`The opening of the YouTube description, written by the text model from the article. Edit changes it in place and keeps your text as yours: when the description is written again, your summary stays and the new one waits beside it with Use it, Keep mine and View diff. Use generated goes back to the model's text.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.chapters":{title:`Chapters`,body:`Timestamped chapter lines at the narration's real times, which YouTube turns into chapters. YouTube needs the first at 0:00, at least three, each at least 10 seconds long. Edit changes them in place and your edit survives the next rewrite; Use generated goes back.`,tutorial:{page:`YouTube-Description`,anchor:`chapters-follow-youtubes-rules`}},"project.youtube.hashtags":{title:`Hashtags`,body:`The hashtags at the end of the description; YouTube shows the first three above the title. Edit changes them in place and your edit survives the next rewrite, with the new ones offered beside it. Use generated goes back to the model's.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.tags":{title:`Tags`,body:`Search tags for YouTube's Tags field, which allows 500 characters in all, commas included. They are not shown to viewers. Edit changes them in place and your edit survives the next rewrite; Copy gives them comma-separated, ready to paste.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.pinned-comment":{title:`Pinned comment`,body:`A comment to pin under the video, written with the description: a line or two asking viewers a question about the subject and what to cover next. Your Description prompt can shape it. YouTube pins comments only on a published video: post it from your channel, then choose Pin in its menu. Your edits survive the next rewrite.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.titles":{title:`Other titles`,body:`Two more titles for this video, written with the description, each a different angle. YouTube's A/B Testing, beside the title in Studio, shows up to three titles to viewers and keeps the one watched most. Edit them one per line; your edits survive the next rewrite.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.previous-video":{title:`Previous video for this project`,body:`The link that {{Previous video}} fills in this project's description, ahead of the one on its channel's Brand tab. Paste the video this one follows on from. It changes only what is shown and copied, with no text call. Save links keeps it.`,tutorial:{page:`YouTube-Description`,anchor:`previous-video`}},"project.live.writing":{title:`Live writing`,body:`The text model's words as they arrive, so you can see the article or research taking shape. When a stage makes several calls, the list picks which one to watch. Follow output keeps the newest text in view; untick it to read back. Watching costs nothing extra; the full text is saved when the stage finishes.`,tutorial:{page:`Project-Page`,anchor:`live`}},"project.checkpoints.choices":{title:`Checkpoint choices`,body:`A checkpoint holds the run before a step so you can check and edit what came before it. Tick a step that has not started to add one; untick to remove it, and work already admitted for that step carries on when ready. Pausing the project still applies. Only generated steps can have one. Save checkpoints applies the change.`,tutorial:{page:`Project-Page`,anchor:`checkpoints`}},"project.rebuild.keep-provided":{title:`Keep the provided content`,body:`This output uses a file or text you supplied, and something it depends on, such as the narration, has changed since. Tick to confirm it still fits and keep it as it is. To use something else, cancel and replace the file in Edit project first. Remake stays off until you tick it.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.rebuild.unknown-costs":{title:`Unknown cost estimates`,body:`Some steps use a model with no published price, so their cost cannot be estimated and is left out of the total shown. Tick to start anyway; the real cost is recorded under Cost once they run. Remake stays off until you tick it.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.cost.by-stage":{title:`Cost by stage`,body:`What each stage of this project has cost so far, from every provider call it made, retries and remakes included, priced from the model catalogue when each call finished. Failed calls are not charged here, and taxes and included credits are not counted. Working time is how long the stage's steps were running, over every run.`,tutorial:{page:`Costs-and-Run-Cost`,anchor:`after-a-run-the-run-cost-tab`}},"project.cost.by-model":{title:`Cost by model`,body:`The same spending split by provider and model. Cost is what you paid the provider. Calls through a signed-in command-line tool such as Claude Code or Codex cost $0 on your plan; Via API shows what the same work would cost through the provider's API, for comparison only.`,tutorial:{page:`Costs-and-Run-Cost`,anchor:`after-a-run-the-run-cost-tab`}},"project.upload.item":{title:`What to upload`,body:`Switches the list between the long video and each short, since each is uploaded to YouTube on its own with its own title, description and tags. The ticks and the Fill in YouTube Studio button follow the one you pick.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.real-footage":{title:`Real footage`,body:`Turn this on when the video clips you uploaded are filmed footage, not made by AI. The AI use answer then checks them: laying a Look atmosphere such as fog over real footage makes it Yes, while colour, vignette or grain count as minor edits and keep it No. It is saved with the project and changes nothing in the video.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`ai-use-disclosure`}},"project.upload.slot":{title:`Release time`,body:`When this video goes out. It takes the next free time of a posting-plan line for its series (Settings → YouTube Studio); each short follows at its own times. Pick another free time, or Not scheduled to set it in Studio yourself. Calendar → Releases shows and moves every time. Upload it before its upload-by time so YouTube's checks finish while it is private.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.steps":{title:`Upload steps`,body:`Everything YouTube Studio asks for, in the order it asks: file, title, description, thumbnail, playlist, audience, AI use, tags and the schedule. Copy puts each value on the clipboard. The tick box beside each step is only a note to yourself, remembered in this browser; it changes nothing in the project.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.fill-studio":{title:`Fill in YouTube Studio`,body:`Opens Studio's upload page and adds this item to what waits for the Slopify Studio extension, which must be installed and paired (Settings, YouTube Studio). Each upload dialog you start is filled with the first waiting item. If Studio's dialog lacks a field, nothing is filled and the whole pack is copied instead. You check it and press Publish; Slopify never uploads or publishes.`,tutorial:{page:`Studio-Extension`,anchor:`fill-in-an-upload`}},"project.upload.queue":{title:`Waiting for Studio`,body:`The videos and shorts Fill in YouTube Studio added, oldest first, from every project. Each new upload dialog in Studio is filled with the first, which then leaves the list. It survives restarting Slopify; an item waits up to 24 hours, and a new pairing token clears the list. Remove takes an item out without filling it.`,tutorial:{page:`Studio-Extension`,anchor:`upload-several-one-after-another`}},"project.free-space":{title:`Free space`,body:`Once a project has finished, it can drop the working files it was made from (images, narration parts, subtitle timing, render settings) and keep what gets published: the video, shorts, thumbnail, article, description, document and anything you uploaded. The button says how much space that frees. Changing the project later makes those files again first, which takes time and provider credits. Settings → Storage offers the same for every project.`,tutorial:{page:`Project-Page`,anchor:`free-space`}},"project.mark-uploaded":{title:`Mark uploaded`,body:`Records that you uploaded this finished video to YouTube yourself, so it leaves the ready-to-upload lists on Home and here and shows an Uploaded badge. Slopify does not upload anything or check YouTube. Undo takes the mark off.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`mark-a-video-uploaded`}},"project.edit.update-glossary":{title:`Update from other projects`,body:`Copies your other projects' Pronunciation Glossary terms into this project again, picking up any added since the last copy. The project keeps its own copy, so nothing changes until you press this. After you save, only the narration chunks whose words those terms change are spoken again, paid per character.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"project.edit.show-figures":{title:`Show tables and figures on screen`,body:`Shows each described table, figure, equation and code block in the video while its description is spoken, as the article's picture or a card drawn on this computer at no cost. Turning it on or off renders the video again, and any Shorts that include a card; the narration is kept. The cards appear under Images, From the article, and can be made again there.`,tutorial:{page:`Play-Outputs`,anchor:`show-tables-and-figures-on-screen`}},"project.edit.describe-figures":{title:`Describe tables and figures`,body:`The text model writes a short spoken passage for each table, figure, equation and code block, said in its place. Turning it on costs one text-model call per block, and after you save, the narration chunks that contain a block are spoken again, paid per character (the whole narration when Chunking is the whole article). Other chunks keep their audio; captions and timing are redone to match.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"project.edit.update-aliases":{title:`Update from Library`,body:`Copies Library, Aliases into this project again, picking up aliases added or changed since the last copy. The project keeps its own copy, so a Library edit reaches it only when you press this. After you save, only the narration chunks the changed aliases touch are spoken again, paid per character.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`use-aliases-in-a-video`}}},Ite={"settings.diagnostics":{title:`Download diagnostics`,body:`Saves slopify-diagnostics.json: the Slopify version, your system and Node version, which providers are set up or found, the project count and the model catalogue's state. It never holds your keys, prompts or project content. Attach it to a bug report so the problem can be found faster.`,tutorial:{page:`Troubleshooting`,anchor:`download-diagnostics`}},"settings.autostart":{title:`Start Slopify when you log in`,body:`Slopify starts in the background when you log in to this computer, without opening a browser tab; open it from your bookmark. It uses your account's own start-up list, so no administrator password is needed, and turning it off removes exactly what it added. Default: off. In Docker, Slopify starts whenever Docker does, so this only shows Docker's own setting.`,tutorial:{page:`Start-at-Login`,anchor:`turn-it-on`}},"settings.providers.api-key":{title:`API key`,body:`The key that lets Slopify call this provider on your account; the provider bills you for what it makes. It is stored on this computer only, sent only to that provider, and never put in a backup or export. Paste a new key and Save to replace the old one.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-key`}},"settings.providers.test-key":{title:`Test`,body:`Asks the provider whether the key works, with the cheapest harmless call it allows. A key pasted in the field is tested before you save it; with the field empty, the saved key is. Nothing is generated, billed or stored. When it fails, the answer says why: a rejected key, missing permission, no credit, or the provider being down.`,tutorial:{page:`Providers-and-Keys`,anchor:`test-a-key`}},"settings.provider.openrouter":{title:`OpenRouter`,body:`Writes the text (research, script, article, titles, descriptions) with hundreds of models from many companies through one key. Each call is charged per token from the credit you buy on OpenRouter; prices follow the model catalogue. Choose it when you want a model the command-line tools do not offer.`,tutorial:{page:`Providers-and-Keys`,anchor:`openrouter`}},"settings.provider.claude-code":{title:`Claude Code CLI`,body:`Writes the text with the Claude Code command-line tool on this computer, using your own Claude sign-in, so no API key is needed and calls count toward your Claude plan's limits instead of costing per call. Sign in first by running claude auth login in a terminal. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.codex":{title:`Codex CLI`,body:`Writes the text with the Codex command-line tool on this computer, using your own ChatGPT sign-in, so no API key is needed and calls count toward your plan's limits instead of costing per call. Sign in first by running codex login in a terminal. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.gemini":{title:`Gemini CLI`,body:`Writes the text with the Gemini command-line tool on this computer, using your own Google sign-in, so no API key is needed. Sign in first by running gemini in a terminal and following its login steps. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.codex-image":{title:`Codex CLI images`,body:`Draws the images with the Codex command-line tool, using your ChatGPT sign-in instead of an API key, so images count toward your plan's limits rather than costing per image. It shares its executable path and sign-in with Codex text. Slopify draws up to 4 images at once.`,tutorial:{page:`AI-CLIs`,anchor:`codex-images`}},"settings.provider.elevenlabs":{title:`ElevenLabs`,body:`Narrates the script with ElevenLabs voices, including voices you added to your ElevenLabs account. It is billed in characters of narration from your ElevenLabs plan. A restricted key needs Text to Speech and Models read access.`,tutorial:{page:`Providers-and-Keys`,anchor:`elevenlabs`}},"settings.provider.openai-tts":{title:`OpenAI speech`,body:`Narrates the script with OpenAI's text-to-speech voices. It is billed per character or per audio minute, depending on the model, from prepaid credit on your OpenAI platform account; new accounts need at least $5 of credit before any call works.`,tutorial:{page:`Providers-and-Keys`,anchor:`openai-speech`}},"settings.provider.cartesia":{title:`Cartesia`,body:`Narrates the script with Cartesia voices, billed in characters from your Cartesia plan. The free plan needs no card, so it is an easy way to try narration.`,tutorial:{page:`Providers-and-Keys`,anchor:`cartesia`}},"settings.provider.inworld":{title:`Inworld`,body:`Narrates the script with Inworld voices, billed per character from your Inworld account. Paste the Base64 credentials of a Standard key exactly as shown; Realtime-only keys do not work.`,tutorial:{page:`Providers-and-Keys`,anchor:`inworld`}},"settings.provider.system-voice":{title:`System voice`,body:`Narrates with the speech your computer already has: macOS voices, Windows voices, or on Linux Piper, SVOX Pico or eSpeak NG. No key, no account and no charge, but it sounds robotic next to ElevenLabs or OpenAI. On Linux, install espeak-ng if nothing is found. Its models are the speech programs Slopify found; add one of their voices in Settings → Voices.`,tutorial:{page:`Providers-and-Keys`,anchor:`the-system-voice`}},"settings.provider.google-tts":{title:`Google Gemini voices`,body:`Narrates with Gemini's 30 prebuilt voices, billed to your Gemini API key per text and audio token. It uses the key saved for Google images unless you save one here. Two speakers' consecutive turns can go in one request (see Speakers on Play).`,tutorial:{page:`Providers-and-Keys`,anchor:`google-gemini-speech`}},"settings.provider.fal":{title:`fal.ai`,body:`Draws the images and thumbnails with the image models fal.ai hosts, charged per image from prepaid credit. fal.ai locks the account when the balance runs out, so a run stops at the images step until you add credit.`,tutorial:{page:`Providers-and-Keys`,anchor:`falai`}},"settings.provider.replicate":{title:`Replicate`,body:`Draws the images and thumbnails with the image models Replicate hosts, charged per image or per second of compute from credit you buy up front.`,tutorial:{page:`Providers-and-Keys`,anchor:`replicate`}},"settings.provider.openai-image":{title:`OpenAI images`,body:`Draws the images and thumbnails with OpenAI's GPT Image models, charged per image from prepaid credit on your OpenAI platform account. GPT Image may also need Verify Organization on the OpenAI platform before it works.`,tutorial:{page:`Providers-and-Keys`,anchor:`openai-images`}},"settings.provider.google-image":{title:`Google images`,body:`Draws the images and thumbnails with Google's Gemini image models, charged per image. Use a key made in Google AI Studio on a project with billing set up; Gemini image models are not on the free tier.`,tutorial:{page:`Providers-and-Keys`,anchor:`google`}},"settings.cli.path":{title:`Executable path`,body:`Where the command-line tool is on this computer. Leave it blank and Slopify finds it on PATH, the list of folders your terminal searches. Set an absolute path, without quotes or arguments, when the tool is installed somewhere else or you have more than one copy. Save checks the tool answers.`,tutorial:{page:`AI-CLIs`,anchor:`set-the-executable-path`}},"settings.cli.managed-on-host":{title:`Managed on host`,body:`Slopify runs in Docker, so this tool runs on your computer outside the container, with the sign-in it already has there. Its path cannot be changed here. After you install, update or remove a command-line tool, run the Docker launcher again so Slopify sees the change.`,tutorial:{page:`AI-CLIs`,anchor:`in-docker-the-host-helper`}},"settings.health":{title:`Health check`,body:`Asks each command-line tool whether it is signed in, makes the cheapest harmless call each saved key allows (nothing is generated or billed), and checks that the models your templates, schedules, drafts and projects use are still offered and answer for your key. Run it after changing a key or when a run stops at a provider; Check again on a provider's row checks that one alone.`,tutorial:{page:`Providers-and-Keys`,anchor:`check-all-providers`}},"settings.models.catalogue":{title:`Model catalogue`,body:`The list of models, prices and retirements the pickers and cost estimates use. Slopify checks the published catalogue and OpenRouter's live list when it starts and once a day; Check now does it at once. New models appear and prices update; nothing you made changes. Your own edits to the local file are kept.`,tutorial:{page:`Models`,anchor:`what-the-catalogue-covers`}},"settings.models.replace":{title:`Replace with published file`,body:`Overwrites the local catalogue file with the published one, dropping any edits you made to it. The previous file is saved beside it first, so you can copy your edits back. Use it when the local file is broken or you want the published list exactly.`,tutorial:{page:`Models`,anchor:`replace-the-local-file-with-the-published-one`}},"settings.models.retired":{title:`Retired models in use`,body:`Templates, schedules, drafts and projects with steps still to run that pick a model the provider no longer offers. A run that reaches one stops and says so. Switch replaces only that one model choice with the suggestion shown; Switch all does every one that has a suggestion.`,tutorial:{page:`Models`,anchor:`switch-away-from-a-retired-model`}},"settings.playback.silence-gap":{title:`Silence between segments`,body:`Seconds of quiet between the intro and the narration, and between the narration and the outro, in every new video, unless Play sets a different gap for one video. It only matters when an intro or outro is set; 0 runs them together. Default: 3 seconds, from 0 to 30. Videos already started keep their own gap.`,tutorial:{page:`Settings-Reference`,anchor:`silence-between-segments`}},"settings.loudness":{title:`Level the volume for new runs`,body:`Whether a new run on Play (and a template or quick short) starts with Level the volume on, and at which volumes. On evens out every narration piece and sets the video to about -14 LUFS, the loudness YouTube plays at, and the audio files to -18 LUFS. A project keeps what it started with; change it there in Edit project. Default: on.`,tutorial:{page:`Settings-Reference`,anchor:`level-the-volume-for-new-runs`}},"settings.appearance":{title:`Appearance`,body:`Light or dark colours for Slopify on this computer. System follows your operating system's setting and changes with it. Default: System. It changes at once and does not affect your videos.`,tutorial:{page:`Settings-Reference`,anchor:`appearance`}},"settings.notifications":{title:`Notifications`,body:`Slopify tells you when a run finishes, fails, or stops to wait for your review, and when an automatic review kept an item flagged and needs your decision. The message holds the project title, what happened and a link to the project, never your keys. Browser notifications need a Slopify tab open; a Notification URL works with none open.`,tutorial:{page:`Notifications`,anchor:`when-slopify-notifies-you`}},"settings.notifications.sounds":{title:`Run sounds`,body:`Plays a chime when a run starts and a different, longer one when it finishes, fails or stops to wait for you, while any Slopify tab is open. Only one tab plays each. Needs no permission, but the browser stays silent until the page has been clicked once. This browser only. Default: on.`,tutorial:{page:`Notifications`,anchor:`run-sounds`}},"settings.notifications.browser":{title:`Browser notifications`,body:`Shows a notification from this browser while any Slopify tab is open, even in the background. Turning it on asks the browser's permission. It applies to this browser only, so turn it on in each browser you use. Default: off.`,tutorial:{page:`Notifications`,anchor:`turn-on-browser-notifications`}},"settings.notifications.url":{title:`Notification URL`,body:`An address Slopify POSTs a short plain-text message to, with no tab open. For your phone, install the ntfy app, subscribe to a topic with a long random name, and paste https://ntfy.sh/that-topic. Any address that accepts a POST works. Each message is sent once, with a 5 second timeout. Leave it empty to turn it off.`,tutorial:{page:`Notifications`,anchor:`get-notifications-on-your-phone-notification-url`}},"settings.studio.extension":{title:`Upload pack and extension`,body:`Slopify never uploads or publishes. A finished project's Prepare upload lists everything Studio asks for, with Copy buttons. The optional Slopify Studio browser extension fills Studio's upload dialog from that pack; you still press Publish. Install it from Install the Studio extension below: Download, three steps, then pair it with the token.`,tutorial:{page:`Studio-Extension`,anchor:`get-the-extension`}},"settings.studio.playlist":{title:`Playlists`,body:`The YouTube playlists upload packs offer, typed exactly as Studio names them. Pick Every channel for the default list, or a channel to give it its own. Ticked On by default means every project goes into it; Prepare upload changes the ticks for one project. The extension ticks each one in Studio. Default: none.`,tutorial:{page:`Studio-Extension`,anchor:`settings--youtube-studio`}},"settings.studio.install":{title:`Install the Studio extension`,body:`The extension comes with Slopify: Download saves it for the browser picked, nothing is fetched from a store. Chrome, Edge and Brave load the unzipped folder with Load unpacked (Developer mode); Firefox 128 or newer loads the zip as a temporary add-on, which it forgets on restart. Then pair it with the token above. A new Slopify may bring a new extension: download and load it again after updating.`,tutorial:{page:`Studio-Extension`,anchor:`get-the-extension`}},"settings.studio.pairing":{title:`Extension pairing token`,body:`A secret the Slopify Studio extension needs before it may read your upload packs, so no other page can. Copy it into the extension's options and press Pair. New pairing token makes a fresh one and unpairs the extension until you paste the new token.`,tutorial:{page:`Studio-Extension`,anchor:`pair-it-with-slopify`}},"settings.storage.export":{title:`Export and import`,body:`Export everything saves every project with its files and history, your library, templates, schedules, Play drafts, fonts, settings and usage in one .tar file; never provider keys. Import adds to this install and replaces nothing: projects already here are skipped, taken names arrive as “(imported)” and schedules arrive paused. Running projects must finish or pause first.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`export-and-import`}},"settings.storage.clean":{title:`Clean orphan files`,body:`Deletes files in the projects folder that no project records any more, and uploaded files that no draft, template or project uses. Your projects, outputs and library are never touched. Slopify also does this each time it starts; use it after a crash or to free space now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`clean-orphan-files`}},"settings.storage.disk":{title:`Disk space`,body:`What Slopify stores on this computer: project files (outputs plus the working files they were made from), staged uploads, and deleted projects still in the trash. Deleted projects free their space when the trash removes them after 30 days, or when you choose Delete now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`disk-space`}},"settings.storage.keep-outputs":{title:`Keep outputs only`,body:`On a finished project, deletes the working files it was made from (images, narration parts, subtitle timing, render settings) and keeps the video, shorts, thumbnail, article, description, document and your uploads. Changing the project later makes those files again first, which takes time and provider credits.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`keep-outputs-only`}},"settings.sample.restore":{title:`Sample projects`,body:`The finished examples that come with Slopify: a narrated video, an audiobook and a podcast, which you can look through without spending anything. Restore samples adds back any that were deleted and replaces the others with the originals. Your own copies of them are not touched.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`sample-projects`}},"settings.files":{title:`Your files`,body:`Your projects, automatic backups and exports live here; new installs use Documents/Slopify. The database, settings, keys and logs stay in Slopify's hidden data folder. Moving copies every file, checks each copy by size and checksum, then switches, and keeps the old folder until you delete it. It takes as long as copying your projects and cannot start while a project is being made.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`see-your-files`}},"settings.files.docker":{title:`Your files`,body:`Your projects and backups are in the folders Docker shares with this computer. The container cannot move its own folders, so run the command shown on the computer running Docker: the installer waits for running work, copies your projects, checks the copy and remounts the new folder.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`see-your-files`}},"settings.files.new-folder":{title:`New folder`,body:`The full path of the folder your files move to, on another disk or a synced folder for example. Slopify makes Projects and Backups inside it. It must be empty or not exist yet. The move needs as much free space there as your projects take now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`move-your-files-to-another-folder`}},"settings.backups":{title:`Daily backup`,body:`Once a day Slopify writes the file Export everything makes into the backup folder and deletes its own oldest backups beyond the number you keep. Nothing else there is touched. A backup waits while projects are being made; if Slopify was off at the time, it backs up a couple of minutes after it starts. Each backup can be many gigabytes.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.auto":{title:`Back up automatically`,body:`Turns the daily backup on or off. Default: off, because each backup holds every project's video and can fill a disk. Back up now works either way. Press Save after changing it.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.time":{title:`Time of day`,body:`When the daily backup runs, in this browser's time zone. Pick a time the computer is usually on and idle; a backup waits for running projects. Default: 03:00.`,tutorial:{page:`Backups`,anchor:`when-the-daily-backup-runs`}},"settings.backups.keep":{title:`Keep last`,body:`How many of Slopify's own backups stay in the folder; after a new one is written, the oldest beyond this number are deleted. Each holds everything, so disk use grows with this number. Default: 5, from 1 to 30.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.folder":{title:`Backup folder`,body:`Where backups are written. Leave it empty to use the Backups folder beside your projects (Documents/Slopify/Backups on a new install), which moves with them. Point it at another disk or a synced folder to keep copies away from this disk. Slopify only ever deletes its own backup files there.`,tutorial:{page:`Backups`,anchor:`where-the-files-go-and-what-they-are-called`}},"settings.trash":{title:`Trash`,body:`Deleted projects, prompts, intros and outros, templates and schedules stay here for 30 days, then are removed for good along with a project's files. Restore puts one back; if its name was taken meanwhile it comes back renamed, and a schedule comes back paused. Delete now frees the space at once.`,tutorial:{page:`Trash`}},"settings.patch-notes":{title:`Patch notes`,body:`What changed in each version of Slopify. The newest notes are open here; older versions are folded under Earlier versions, and each opens when you pick it. They ship with the app, so they work offline. After an update, the new version's notes open by themselves once; a fresh install skips that. On a major update the What's new tour shows instead and links here.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`read-the-patch-notes`}},"settings.whats-new":{title:`What's new in this version`,body:`Opens the patch notes for the version you are running, in Settings, Patch notes. When this version has no notes of its own, it opens the newest ones instead.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`whats-new-tour-on-a-major-update`}},"settings.updates":{title:`Updates`,body:`The circular-arrows button at the foot of the sidebar (at the top on a phone) checks for a newer Slopify and installs it. A dot on it means an update is ready. If a video is being made, the update waits until it finishes, and you can cancel it meanwhile. Slopify restarts itself and this page reconnects.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`update-from-the-app`}},"home.channel":{title:`Channel`,body:`Shows Home and the other screens for one channel, or for all of them. It only filters what you see: projects, schedules and costs of other channels keep running. Slopify remembers the choice in this browser.`,tutorial:{page:`Channels`,anchor:`show-one-channels-work`}},"home.needs-you":{title:`Needs you`,body:`Runs held at a review before a step, topics a schedule suggested for you to accept or reject, and runs that failed with the fix to try. Nothing here moves on until you act; approving a review from here lets that run continue.`,tutorial:{page:`Home-and-Projects`,anchor:`needs-you`}},"home.running":{title:`Running now`,body:`Videos being made or paused, with the step each is on and how long it has taken. Up to 3 show here; Projects lists them all. Open one to follow it live, pause it or cancel it.`,tutorial:{page:`Home-and-Projects`,anchor:`running-now`}},"home.coming-up":{title:`Coming up`,body:`The schedule runs due in the next 7 days, with the template and topic each will use. Paused schedules show too. Plan or move runs on the calendar.`,tutorial:{page:`Home-and-Projects`,anchor:`coming-up`}},"home.ready":{title:`Ready to upload`,body:`Finished videos you have not marked uploaded. Prepare upload lists everything YouTube Studio asks for, with Copy buttons; Slopify never uploads for you. Mark uploaded takes the video off this list; Projects still has it.`,tutorial:{page:`Home-and-Projects`,anchor:`ready-to-upload`}},"home.this-week":{title:`This week`,body:`Videos made since Monday and what their provider calls cost. Calls billed to a command-line plan cost nothing per call, so the API figure says what they would have cost with API keys. The bars show how much of each plan's weekly limit is used, from the tool's last reading.`,tutorial:{page:`Home-and-Projects`,anchor:`this-week`}},"welcome.samples":{title:`Samples`,body:`Finished projects that come with Slopify: a narrated video, an audiobook and a podcast. They are read-only, so nothing you try on them costs anything; Make my own copy on a sample's page gives you one to edit.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`explore-the-samples`}},"welcome.found":{title:`Found on this computer`,body:`Claude Code, Codex and Gemini CLI write the text with your own sign-in, so no API key is needed for it, and Codex also draws the images. The narration uses a voice key (OpenAI, ElevenLabs, Cartesia or Inworld) when one is saved in Settings → Providers, and otherwise your computer's built-in voice, so no key is needed to start.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`found-on-this-computer`}},"welcome.voice":{title:`Narration voice`,body:`Who reads the script aloud. With a voice key saved (OpenAI, ElevenLabs, Cartesia or Inworld), that provider narrates. Without one, your computer's own speech does it for free: macOS or Windows voices, or eSpeak NG on Linux. It sounds robotic, so add a key in Settings → Providers when you want a better voice.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`narration-voice`}},"welcome.short":{title:`Make a 60-second short`,body:`Slopify writes a script of about 150 words, narrates it, draws four vertical images and renders a captioned 9:16 short, usually in about five minutes with the command-line tools. The narration uses your voice provider's credit, or nothing with the built-in voice; text and images through a command-line tool count toward its plan.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-3-make-a-60-second-short`}},"welcome.topic":{title:`Topic`,body:`What the short is about, in a few words or a question, up to 200 characters. Slopify writes the script from it without a research step, to keep the first short quick, so a specific topic gives a sharper short than a broad one.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-3-make-a-60-second-short`}},"welcome.pack":{title:`Style`,body:`The starter pack whose prompts, voice and art direction the short uses. General is a neutral explainer style. Making the short with a pack adds its prompts and suggested voice to your library; Add to library also adds its template for Play.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-2-pick-a-style`}},"welcome.packs":{title:`Starter packs`,body:`Each pack adds prompts, a suggested voice and a Play template for one kind of channel, so you can pick the template on Play, type a topic and go. Adding a pack twice changes nothing, and it never replaces a prompt or template of yours with the same name.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`starter-packs`}}},Lte={...Pte,...Fte,...Mte,...Nte,...Ite};function nb(e,t){let n=Lte[e];if(t===void 0)return n;let r=e=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e);return{...n,title:r(n.title),body:r(n.body)}}function Rte(e){return e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/`([^`]*)`/g,`$1`).replace(/(\*\*|__)(.+?)\1/g,`$2`).replace(/(^|[^\p{L}\p{N}])[*_]([^*_]+)[*_](?![\p{L}\p{N}])/gu,`$1$2`).replace(/<[^>]+>/g,``).trim()}function rb(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\p{M} _-]/gu,``).replace(/ /g,`-`)}var zte=`/help/tutorials`;function ib(e,t){return`${zte}/${encodeURIComponent(e)}${t?`#${t}`:``}`}function Bte(e,t,n){return e.replace(/\]\(([A-Za-z0-9][A-Za-z0-9-]*)?(?:#([^)\s]*))?\)/g,(e,r,i)=>{if(r===void 0&&i===void 0)return e;let a=r??n;return t.has(a)?`](${ib(a,i)})`:e})}function Vte(e){let t=/^\s*#\s+(.+?)\s*#*\s*(?:\n|$)/.exec(e);return t===null?{title:void 0,body:e}:{title:t[1],body:e.slice(t[0].length)}}function Hte(e){let t=/^\/help\/tutorials\/([^/#?]+)(?:#(.*))?$/.exec(e);if(t===null)return;let n=t[2];return{page:decodeURIComponent(t[1]??``),anchor:n===void 0||n===``?void 0:decodeURIComponent(n)}}function Ute(e,t,n=[]){let r=new Map;for(let e of n){let t=rb(Rte(e));r.set(t,(r.get(t)??0)+1)}for(let n of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=rb((n.textContent??``).trim()),i=r.get(e)??0;if(r.set(e,i+1),(i===0?e:`${e}-${String(i)}`)===t)return n}}var ab=Cte,ob=Tte,Wte=wte,Gte=Ote;function sb({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,h.jsx)(Ete,{children:(0,h.jsx)(Dte,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:12,className:I(`z-50 w-[min(340px,calc(100vw-24px))] rounded-control border border-line bg-raised p-3 text-small text-ink-2`,`shadow-[var(--shadow-pop)] outline-hidden`,e),...r})})}function B({id:e,label:t,vars:n,className:r}){let i=nb(e,n);return(0,h.jsxs)(ab,{children:[(0,h.jsx)(ob,{type:`button`,"aria-label":`About ${t??i.title}`,"data-help-id":e,className:I(`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-raised hover:text-ink`,r),children:(0,h.jsx)(Ic,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.jsxs)(sb,{className:`space-y-2 leading-[1.45]`,children:[(0,h.jsx)(`p`,{className:`m-0 font-semibold text-ink`,children:i.title}),i.body.split(`
|
|
51
51
|
|
|
52
|
-
`).map(e=>(0,h.jsx)(`p`,{className:`m-0`,children:e},e)),i.tutorial===void 0?null:(0,h.jsx)(Kte,{tutorial:i.tutorial})]})]})}function Kte({tutorial:e}){let t=_i({warn:!1}),n=`sl-link inline-flex items-center gap-1 text-small`,r=(0,h.jsxs)(h.Fragment,{children:[`Learn more`,(0,h.jsx)(gc,{"aria-hidden":`true`,className:`size-[13px]`})]});return t?(0,h.jsx)(Gte,{asChild:!0,children:(0,h.jsx)(ha,{to:`/help/tutorials/$page`,params:{page:e.page},...e.anchor===void 0?{}:{hash:e.anchor},className:n,children:r})}):(0,h.jsx)(`a`,{href:ib(e.page,e.anchor),className:n,children:r})}var cb={"data-help-scope":``};function V({title:e,kicker:t,meta:n,info:r,infoLabel:i=e,as:a=`h2`,size:o=a===`h3`?`small`:`default`,id:s,status:c,row:l=!1,className:u,children:d}){return(0,h.jsxs)(`div`,{className:I(`sl-section-head`,u),"data-slot":`section-head`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[t===void 0?null:(0,h.jsx)(`div`,{className:`sl-kicker`,children:t}),(0,h.jsxs)(`div`,{className:I(`flex items-center gap-2`,l&&`flex-wrap items-baseline gap-x-3 gap-y-0`),children:[(0,h.jsx)(a,{id:s,className:I(`sl-section-head__title`,o===`small`&&`text-title-3`),children:e}),r===void 0?null:(0,h.jsx)(B,{id:r,label:i}),c,l&&n!==void 0?(0,h.jsx)(`p`,{className:`sl-section-head__meta m-0 min-w-0`,children:n}):null]}),l||n===void 0?null:(0,h.jsx)(`p`,{className:`sl-section-head__meta`,children:n})]}),d===void 0?null:(0,h.jsx)(`div`,{className:`sl-btn-row min-w-0 shrink-0 justify-end max-md:shrink max-md:justify-start`,children:d})]})}function lb({checked:e,onChange:t,label:n,disabled:r,className:i,describedBy:a,tip:o,tipLabel:s}){let c=(0,h.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-describedby":a,disabled:r,onClick:()=>t(!e),className:I(`sl-switch`,i),children:[(0,h.jsx)(`span`,{className:`sl-switch__track`,"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:n})]});return o===void 0?c:(0,h.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,...cb,children:[c,(0,h.jsx)(B,{id:o,label:s??(typeof n==`string`?n:void 0)})]})}function ub({value:e,options:t,onChange:n,label:r,className:i,tip:a}){let o=(0,m.useRef)(null),s=(0,h.jsx)(`div`,{ref:o,role:`group`,"aria-label":r,onKeyDown:r=>{if(r.key!==`ArrowRight`&&r.key!==`ArrowLeft`)return;let i=t.filter(e=>!e.disabled),a=i[(i.findIndex(t=>t.value===e)+(r.key===`ArrowRight`?1:-1)+i.length)%i.length];a!==void 0&&(r.preventDefault(),n(a.value),o.current?.querySelector(`[data-value="${CSS.escape(a.value)}"]`)?.focus())},className:I(`sl-seg`,i),children:t.map(t=>(0,h.jsx)(`button`,{type:`button`,"data-value":t.value,"aria-pressed":t.value===e,tabIndex:t.value===e?0:-1,disabled:t.disabled,onClick:()=>n(t.value),className:`sl-seg__opt`,children:t.label},t.value))});return a===void 0?s:(0,h.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,...cb,children:[s,(0,h.jsx)(B,{id:a,label:r})]})}var db=[`settings`,`autostart`],fb=(e,t=``)=>`${e.origin}/api/settings/autostart${t}`;async function pb(e){return F(await e.fetch(fb(e)))}async function qte(e,t){return F(await e.fetch(fb(e),{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:t})}))}async function Jte(e){return F(await e.fetch(fb(e,`/answer`),{method:`POST`}))}var mb=`Start Slopify when I log in`;function Yte(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function hb(){let{api:e}=R(),t=_();return{view:N({queryKey:db,queryFn:()=>pb(e)}),turn:P({mutationFn:t=>qte(e,t),onSuccess:e=>t.setQueryData(db,e)}),decline:P({mutationFn:()=>Jte(e),onSuccess:e=>t.setQueryData(db,e)})}}function Xte(){let{view:e,turn:t}=hb(),n=e.data;return(0,h.jsxs)(`div`,{...cb,children:[(0,h.jsx)(V,{title:mb,info:`settings.autostart`}),e.error===null?null:(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 mb-3 text-body text-danger`,children:[`Starting at login couldn't be checked: `,e.error.message]}),n===void 0?e.error===null?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:`Checking…`}):null:n.kind===`docker`?(0,h.jsx)(gb,{view:n}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(lb,{label:mb,checked:n.enabled===!0,disabled:!n.available||t.isPending,describedBy:`autostart-summary`,onChange:e=>t.mutate(e)}),(0,h.jsxs)(`p`,{id:`autostart-summary`,className:`m-0 text-small text-ink-2`,children:[n.summary,n.enabled===!0&&n.where!==null?` Login entry: ${n.where}`:``]}),t.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:t.error.message})]})]})}function gb({view:e}){return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`p`,{className:`m-0 text-body`,children:(0,h.jsx)(`span`,{className:`font-semibold`,children:e.enabled===!0?`Starts with Docker: yes`:e.enabled===!1?`Starts with Docker: no`:`Starts with Docker: unknown`})}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.summary}),e.howTo===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.howTo}),e.checkedAt===null?null:(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Checked by the installer on `,Yte(e.checkedAt),`.`]})]})}function Zte(){let{view:e,turn:t,decline:n}=hb();if(t.isSuccess&&e.data?.enabled===!0)return(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`Slopify now starts when you log in. Change it any time in Settings → General.`});if(e.data?.kind===`docker`)return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V,{title:mb,info:`settings.autostart`}),(0,h.jsx)(`div`,{className:`mb-6`,children:(0,h.jsx)(gb,{view:e.data})})]});if(e.data?.offer!==!0)return null;let r=t.error??n.error;return(0,h.jsxs)(`section`,{children:[(0,h.jsx)(V,{title:mb,info:`settings.autostart`}),(0,h.jsx)(`p`,{className:`m-0 mb-3 text-small text-ink-2`,children:`Have Slopify ready whenever you open your bookmark, without starting it from a terminal.`}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,h.jsx)(L,{variant:`primary`,disabled:t.isPending||n.isPending,onClick:()=>t.mutate(!0),children:`Start when I log in`}),(0,h.jsx)(L,{variant:`quiet`,disabled:t.isPending||n.isPending,onClick:()=>n.mutate(),children:`No thanks`})]}),r===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-3 text-small text-danger`,children:r.message})]})}function Qte(){let{api:e}=R(),t=Ha({select:e=>e.pathname}),{view:n,turn:r,decline:i}=hb(),a=N(Jy(e)),o=N({queryKey:Oy,queryFn:()=>My(e)}),s=n.data?.offer===!0&&a.data?.seen===!0&&o.data?.show===!1&&t!==`/welcome`,c=r.isPending||i.isPending,l=r.error??i.error;return(0,h.jsx)(Ey,{open:s,onOpenChange:e=>{!e&&!c&&i.mutate()},title:`Start Slopify when you log in?`,description:`Have Slopify ready whenever you open your bookmark, without starting it from a terminal. Change it any time in Settings → General.`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`secondary`,disabled:c,onClick:()=>i.mutate(),children:`No thanks`}),(0,h.jsx)(L,{variant:`primary`,autoFocus:!0,disabled:c,onClick:()=>r.mutate(!0),children:`Start when I log in`})]}),children:l===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:l.message})})}function $te(){let{api:e}=R(),t=N({queryKey:db,queryFn:()=>pb(e),retry:!1,staleTime:1/0}).data?.kind;(0,m.useEffect)(()=>{t!==void 0&&_o(t)},[t])}var _b=`00000000-0000-4000-8000-000000000001`,vb=[`character`,`creature`,`place`,`object`],yb={character:`Character`,creature:`Creature`,place:`Place`,object:`Object`},bb=[`channels`],xb=e=>[`channels`,e],Sb=e=>`${e.origin}/api/channels`,Cb=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});function wb(e){return ct({queryKey:bb,queryFn:async()=>(await F(await e.fetch(Sb(e)))).channels})}function Tb(e,t){return ct({queryKey:xb(t),queryFn:async()=>F(await e.fetch(`${Sb(e)}/${t}`)),refetchInterval:e=>e.state.data?.cast.some(e=>e.images.some(e=>e.state===`generating`))?3e3:!1})}async function Eb(e,t,n){return F(await e.fetch(Sb(e),Cb(`POST`,{id:t,name:n})))}async function Db(e,t,n){return F(await e.fetch(`${Sb(e)}/${t}`,Cb(`PUT`,n)))}async function Ob(e,t){let n=await e.fetch(`${Sb(e)}/${t}`,{method:`DELETE`});n.ok||await F(n)}async function kb(e,t,n,r){return F(await e.fetch(`${Sb(e)}/${t}/cast`,Cb(`POST`,{id:n,...r})))}async function Ab(e,t,n){return F(await e.fetch(`${Sb(e)}/cast/${t}`,Cb(`PUT`,n)))}async function jb(e,t){let n=await e.fetch(`${Sb(e)}/cast/${t}`,{method:`DELETE`});n.ok||await F(n)}async function Mb(e,t,n){return F(await e.fetch(`${Sb(e)}/cast/${t}/images`,{method:`POST`,headers:{"content-type":n.type||`application/octet-stream`},body:n}))}async function Nb(e,t,n){return F(await e.fetch(`${Sb(e)}/cast/${t}/generate`,Cb(`POST`,n)))}async function Pb(e,t,n){let r=await e.fetch(`${Sb(e)}/cast/${t}/images/${n}`,{method:`DELETE`});r.ok||await F(r)}async function Fb(e,t,n){await F(await e.fetch(`${Sb(e)}/templates/${t}`,Cb(`PUT`,{channelId:n})))}async function Ib(e,t,n){return F(await e.fetch(`${Sb(e)}/${t}/ai-disclosure`,Cb(`PUT`,{aiDisclosure:n})))}function Lb(e,t){return`${Sb(e)}/pictures/${t}`}var Rb=`slopify.channel`,zb=(0,m.createContext)(void 0);function Bb(){try{let e=window.localStorage.getItem(Rb);return e===null||e===``?null:e}catch{return null}}function Vb({children:e}){let{api:t}=R(),n=N(wb(t)),[r,i]=(0,m.useState)(Bb),a=n.data??[],o=r!==null&&n.data!==void 0&&!a.some(e=>e.id===r)?null:r,s=(0,m.useCallback)(e=>{i(e);try{e===null?window.localStorage.removeItem(Rb):window.localStorage.setItem(Rb,e)}catch{}},[]),c=(0,m.useMemo)(()=>({channelId:o,channel:a.find(e=>e.id===o),channels:a,setChannelId:s,includes:e=>o===null||e===o}),[o,a,s]);return(0,h.jsx)(zb,{value:c,children:e})}var Hb={channelId:null,channel:void 0,channels:[],setChannelId:()=>{},includes:()=>!0};function Ub(){return(0,m.useContext)(zb)??Hb}function Wb({className:e}){let t=Ub(),n=(0,m.useId)();return(0,h.jsxs)(`div`,{className:I(`flex flex-col gap-1`,e),...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1 px-2`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`sl-kicker`,children:`Channel`}),(0,h.jsx)(B,{id:`planning.channel.current`,className:`-my-1`})]}),(0,h.jsxs)(`select`,{id:n,className:`sl-select`,value:t.channelId??``,onChange:e=>t.setChannelId(e.target.value===``?null:e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`All channels`}),t.channels.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}var Gb=class{commands=new Map;listeners=new Set;version=0;snapshot=[];register(e){return this.commands.set(e.id,e),this.changed(),()=>{this.commands.get(e.id)===e&&(this.commands.delete(e.id),this.changed())}}list(){return this.snapshot}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.version;changed(){this.version+=1,this.snapshot=[...this.commands.values()];for(let e of this.listeners)e()}},Kb=(0,m.createContext)(void 0);function qb(e){let t=(0,m.useContext)(Kb),n=(0,m.useRef)(e);n.current=e;let{id:r,title:i,group:a,context:o,searchOnly:s}=e,c=e.keywords?.join(`\0`),l=e.shortcut?.join(`\0`),u=e.numbered!==void 0,d=t?.registry;(0,m.useEffect)(()=>{if(d===void 0)return;let{icon:e}=n.current;return d.register({id:r,title:i,group:a,...o===void 0?{}:{context:o},...c===void 0?{}:{keywords:c.split(`\0`)},...e===void 0?{}:{icon:e},...l===void 0?{}:{shortcut:l.split(`\0`)},...u?{numbered:e=>n.current.numbered?.(e)??i}:{},...s===!0?{searchOnly:!0}:{},run:e=>n.current.run(e)})},[d,r,i,a,o,c,l,u,s])}function Jb(e,t){let n=[`/`];return qb({id:`list.search`,title:`Search ${t}`,group:`This page`,keywords:[`find`,`filter`],shortcut:n,run:()=>{e.current?.focus(),e.current?.select()}}),n}function Yb(){return(0,m.useContext)(Kb)??{open:!1,setOpen:Xb}}function Xb(){}function Zb(e,t){let n=e.trim().toLowerCase();if(n===``)return 0;let r=t.toLowerCase(),i=0,a=0,o=-2;for(let e of n){if(e===` `)continue;let t=r.indexOf(e,a);if(t===-1)return null;i+=1,t===o+1&&(i+=3),(t===0||/[\s\-_:/.]/.test(r[t-1]??``))&&(i+=4),i-=Math.min(t-a,5)*.1,o=t,a=t+1}return r.startsWith(n)||r.includes(` ${n}`)?i+=6:r.includes(n)&&(i+=3),i}function Qb(e){return[{text:e.title,bonus:2},...e.context===void 0?[]:[{text:e.context,bonus:1}],...(e.keywords??[]).map(e=>({text:e,bonus:0})),{text:e.group,bonus:0}]}function $b(e,t,n){let r=null;for(let i of t){let t=Zb(e,i.text);if(t===null)continue;let a=n&&i.text.toLowerCase().split(/[\s\-_:/.,&]+/).includes(e)?4:0,o=t+i.bonus+a;(r===null||o>r)&&(r=o)}return r}function ex(e,t){if(e.length===0)return 0;let n=$b(e.join(` `),t,!1);if(e.length===1)return n;let r=0;for(let i of e){let e=$b(i,t,!0);if(e===null)return n;r+=e}return n===null?r:Math.max(n,r)}function tx(e,t){let n=t.trim()===``,r=t.trim().toLowerCase().split(/\s+/).filter(Boolean),i=r.find(e=>/^\d+$/.test(e)),a=[];return e.forEach((e,t)=>{if(n&&e.searchOnly===!0)return;let o=e.numbered;if(o!==void 0&&i!==void 0){let n=Number(i),s=r.indexOf(i),c=ex([...r.slice(0,s),...r.slice(s+1)],Qb(e));c!==null&&a.push({command:{...e,title:o(n),run:()=>e.run(n)},score:c,order:t});return}let s=ex(r,Qb(e));s!==null&&a.push({command:e,score:s,order:t})}),a.sort((e,t)=>{let r=Number(t.command.context!==void 0)-Number(e.command.context!==void 0);return n?r===0?e.order-t.order:r:t.score-e.score||r||e.order-t.order}),a.map(e=>e.command)}var nx=new Set([`Ctrl`,`Alt`,`Shift`]);function rx(e){return{mod:e.includes(`Ctrl`),alt:e.includes(`Alt`),shift:e.includes(`Shift`),keys:e.filter(e=>!nx.has(e)).map(e=>e.toLowerCase())}}var ix=e=>!e.mod&&!e.alt&&!e.shift&&e.keys.length>1;function ax(e){if(e===void 0)return;let t=rx(e);if(ix(t)||t.keys.length!==1)return;let n=e.at(-1)??``,r=[...t.alt?[`Alt`]:[],...t.shift?[`Shift`]:[],n].join(`+`);return t.mod?`Control+${r} Meta+${r}`:r}function ox(e,t,n){return e.mod!==(n.ctrlKey||n.metaKey)||e.alt!==n.altKey||/^[a-z0-9]$/.test(t)&&e.shift!==n.shiftKey?!1:n.key.toLowerCase()===t}function sx(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?!0:e instanceof HTMLInputElement&&![`checkbox`,`radio`,`button`,`submit`,`reset`,`range`,`color`,`file`].includes(e.type):!1}var cx=()=>document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"]`)!==null;function lx(e){return e.map((e,t)=>({command:e,order:t})).filter(e=>e.command.shortcut!==void 0).sort((e,t)=>Number(t.command.context!==void 0)-Number(e.command.context!==void 0)||t.order-e.order).map(e=>e.command)}var ux=1500;function dx({children:e,registry:t}){let[n]=(0,m.useState)(()=>t??new Gb),[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(!1),s=(0,m.useRef)(!1);s.current=r,(0,m.useEffect)(()=>n.register({id:`help.shortcuts`,title:`Show keyboard shortcuts`,group:`Help`,keywords:[`keys`,`keyboard`,`hotkeys`,`help`],shortcut:[`?`],run:()=>o(!0)}),[n]),(0,m.useEffect)(()=>{let e,t=t=>{if((t.ctrlKey||t.metaKey)&&!t.altKey&&t.key.toLowerCase()===`k`){t.preventDefault(),i(e=>!e);return}if(t.defaultPrevented||t.isComposing||s.current||cx())return;let r=sx(t.target),a=lx(n.list()),o=t.key.toLowerCase(),c=!t.ctrlKey&&!t.metaKey&&!t.altKey,l=n=>{t.preventDefault(),e=void 0,n.run()};if(e!==void 0&&c&&!r&&t.timeStamp-e.at<ux){let t=e.key,n=a.find(e=>{let n=rx(e.shortcut??[]);return ix(n)&&n.keys[0]===t&&n.keys[1]===o});if(n!==void 0)return l(n)}e=void 0;let u=a.find(e=>{let n=rx(e.shortcut??[]);return ix(n)||n.keys.length!==1||r&&!n.mod?!1:ox(n,n.keys[0]??``,t)});if(u!==void 0)return l(u);c&&!r&&!t.shiftKey&&a.some(e=>{let t=rx(e.shortcut??[]);return ix(t)&&t.keys[0]===o})&&(e={key:o,at:t.timeStamp})};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[n]);let c=(0,m.useMemo)(()=>({registry:n,open:r,setOpen:i}),[n,r]);return(0,h.jsxs)(Kb.Provider,{value:c,children:[e,(0,h.jsx)(mx,{}),(0,h.jsx)(px,{registry:n,open:a,onOpenChange:o})]})}function fx({shortcut:e}){let t=ix(rx(e));return(0,h.jsx)(`span`,{className:`sl-kbd`,children:e.map((e,n)=>(0,h.jsxs)(m.Fragment,{children:[t&&n>0?(0,h.jsx)(`span`,{className:`text-caption text-ink-3`,children:`then`}):null,(0,h.jsx)(`kbd`,{children:e})]},e))})}function px({registry:e,open:t,onOpenChange:n}){(0,m.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);let r=new Set,i=lx(e.list()).filter(e=>{let t=e.shortcut?.join(`+`)??``;return!r.has(t)&&(r.add(t),!0)}).toSorted((e,t)=>e.group.localeCompare(t.group)||e.title.localeCompare(t.title));return(0,h.jsx)(Ey,{open:t,onOpenChange:n,title:`Keyboard shortcuts`,description:`Ctrl works as Cmd on a Mac. Keys without Ctrl wait while you type in a field. A screen's own shortcuts are listed while it is open.`,children:(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] items-center gap-x-4 gap-y-2 text-small`,children:[{keys:[`Ctrl`,`K`],title:`Search or run a command`},{keys:[`Esc`],title:`Close a dialog, a drawer or the palette`},...i.map(e=>({keys:e.shortcut??[],title:e.title}))].map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(`dt`,{children:(0,h.jsx)(fx,{shortcut:e.keys})}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0`,children:e.title})]},e.keys.join(`+`)))})})}function mx(){let e=(0,m.useContext)(Kb);return e===void 0?null:(0,h.jsx)(km,{open:e.open,onOpenChange:e.setOpen,children:(0,h.jsxs)(Mm,{children:[(0,h.jsx)(Pm,{className:`sl-overlay`}),(0,h.jsxs)(Lm,{className:`sl-overlay-content sl-palette sl-enter`,"aria-describedby":void 0,children:[(0,h.jsx)(Hm,{className:`sr-only`,children:`Command palette`}),(0,h.jsx)(hx,{registry:e.registry,close:()=>e.setOpen(!1)})]})]})})}function hx({registry:e,close:t}){(0,m.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);let n=e.list(),[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)(0),s=(0,m.useId)(),c=(0,m.useMemo)(()=>tx(n,r),[n,r]),l=Math.min(a,Math.max(0,c.length-1)),u=(0,m.useRef)(null),d=(0,m.useMemo)(()=>{let e=new Map;return c.forEach((t,n)=>{let r=e.get(t.group)??[];r.push({command:t,index:n}),e.set(t.group,r)}),[...e.entries()]},[c]),f=e=>`${s}-option-${String(e)}`;(0,m.useEffect)(()=>{u.current?.querySelector(`[data-index="${String(l)}"]`)?.scrollIntoView?.({block:`nearest`})},[l]);let p=(0,m.useCallback)(e=>{e!==void 0&&(t(),e.run())},[t]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`sl-palette__input`,children:[(0,h.jsx)(Yc,{"aria-hidden":`true`,strokeWidth:1.75}),(0,h.jsx)(`input`,{autoFocus:!0,role:`combobox`,"aria-expanded":`true`,"aria-controls":s,"aria-autocomplete":`list`,"aria-activedescendant":c.length===0?void 0:f(l),"aria-label":`Search or run a command`,placeholder:`Search or run a command`,value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),o(c.length===0?0:(l+1)%c.length)):e.key===`ArrowUp`?(e.preventDefault(),o(c.length===0?0:(l-1+c.length)%c.length)):e.key===`Home`?(e.preventDefault(),o(0)):e.key===`End`?(e.preventDefault(),o(Math.max(0,c.length-1))):e.key===`Enter`&&(e.preventDefault(),p(c[l]))}}),(0,h.jsx)(`span`,{className:`sl-kbd`,"aria-hidden":`true`,children:(0,h.jsx)(`kbd`,{children:`Esc`})})]}),(0,h.jsx)(`div`,{ref:u,id:s,role:`listbox`,"aria-label":`Commands`,className:`sl-palette__list`,children:c.length===0?(0,h.jsx)(`p`,{className:`sl-palette__empty`,children:n.length===0?`No commands here yet.`:`Nothing matches "${r.trim()}". Try fewer letters or another word.`}):d.map(([e,t])=>(0,h.jsxs)(`div`,{role:`group`,"aria-label":e,className:`sl-palette__group`,children:[(0,h.jsx)(`div`,{className:`sl-kicker px-[10px] pb-1`,"aria-hidden":`true`,children:e}),t.map(({command:e,index:t})=>(0,h.jsxs)(`div`,{id:f(t),"data-index":t,role:`option`,tabIndex:-1,"aria-selected":t===l,className:`sl-palette__item`,onMouseMove:()=>{t!==l&&o(t)},onClick:()=>p(e),children:[e.icon,(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title}),e.context===void 0?null:(0,h.jsx)(`span`,{className:`sl-palette__meta`,children:e.context}),e.shortcut===void 0?null:(0,h.jsx)(fx,{shortcut:e.shortcut})]},e.id))]},e))})]})}var gx=1e4,_x={newSchedule:`schedules.new`,addToCalendar:`calendar.add`,showImages:e=>`project.${e}.show-images`,regenerateImage:e=>`project.${e}.regenerate-image`},vx=new Map,yx=new Set;function bx(e,t){vx.set(e,{value:t,at:Date.now()});for(let e of yx)e()}function xx(e){let t=vx.get(e);return vx.delete(e),t===void 0||Date.now()-t.at>gx?void 0:t}function Sx(e,t,n=!0){let r=(0,m.useRef)(t);r.current=t,(0,m.useEffect)(()=>{if(!n)return;let t=()=>{if(!vx.has(e))return;let t=xx(e);t!==void 0&&r.current(t.value)};return t(),yx.add(t),()=>{yx.delete(t)}},[e,n])}function Cx(){let{api:e}=R(),t=N(Gy(e)),n=Ha({select:e=>e.pathname}),r=Ha({select:e=>e.pathname===`/calendar`&&e.search.tab===`schedules`}),i=/^\/projects\/([^/]+)/.exec(n)?.[1];return(0,h.jsxs)(h.Fragment,{children:[r?null:(0,h.jsx)(wx,{}),n===`/calendar`?null:(0,h.jsx)(Tx,{}),(t.data?.projects??[]).filter(e=>e.id!==i).map(e=>(0,h.jsx)(Ex,{project:e},e.id))]})}function wx(){let e=Zi();return qb({id:`global.schedules.new`,title:`New schedule`,group:`Create`,keywords:[`schedule`,`recurring`,`calendar`,`plan`],searchOnly:!0,run:()=>{bx(_x.newSchedule),e({to:`/calendar`,search:{tab:`schedules`}})}}),null}function Tx(){let e=Zi();return qb({id:`global.calendar.add`,title:`Add to calendar`,group:`Create`,keywords:[`schedule`,`topics`,`batch`,`queue`,`plan`],searchOnly:!0,run:()=>{bx(_x.addToCalendar),e({to:`/calendar`})}}),null}function Ex({project:e}){let t=Zi(),n=()=>{t({to:`/projects/$projectId`,params:{projectId:e.id}})};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Dx,{project:e,open:n}),e.config.sources.images===`off`?null:(0,h.jsx)(Ox,{project:e,open:n})]})}function Dx({project:e,open:t}){return qb({id:`index.open.${e.id}`,title:`Open ${e.title}`,group:`Projects`,keywords:[`project`,`go`],searchOnly:!0,run:t}),null}function Ox({project:e,open:t}){return qb({id:`index.image.${e.id}`,title:`Regenerate an image in ${e.title}`,numbered:t=>`Regenerate image ${String(t)} in ${e.title}`,group:`Projects`,keywords:[`image`,`picture`,`redraw`,`remake`],searchOnly:!0,run:n=>{bx(_x.showImages(e.id)),n!==void 0&&bx(_x.regenerateImage(e.id),n),t()}}),null}var kx=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Buy%20Me%20a%20Coffee'%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='M3.4%207.6h13.1v2.1a3.9%203.9%200%200%201%200%207.6v.2a3.6%203.6%200%200%201-3.6%203.6H7a3.6%203.6%200%200%201-3.6-3.6zm13.1%204.3v3.2a1.7%201.7%200%200%200%200-3.2zM6.2%202.1a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200zm3.6%200a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200zm3.6%200a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200z'/%3e%3c/svg%3e`,Ax=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='GitHub'%3e%3cpath%20d='M15%2022v-4a4.8%204.8%200%200%200-1-3.5c3%200%206-2%206-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35%200-3.5%200%200-1%200-3%201.5-2.64-.5-5.36-.5-8%200C6%202%205%202%205%202c-.3%201.15-.3%202.35%200%203.5A5.403%205.403%200%200%200%204%209c0%203.5%203%205.5%206%205.5-.39.49-.68%201.05-.85%201.65-.17.6-.22%201.23-.15%201.85v4'/%3e%3cpath%20d='M9%2018c-4.51%202-5-2-7-2'/%3e%3c/svg%3e`,jx=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Patreon'%3e%3cpath%20fill='currentColor'%20d='M2.5%202.2h4.3v19.6H2.5z'/%3e%3ccircle%20fill='currentColor'%20cx='15.2'%20cy='9.4'%20r='6.9'/%3e%3c/svg%3e`,Mx={research:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='research'%3e%3ccircle%20cx='10.5'%20cy='10.5'%20r='6.5'/%3e%3cpath%20d='M15.5%2015.5%2021%2021'/%3e%3c/svg%3e`,article:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='article'%3e%3cpath%20d='M6%203h8l4%204v14H6z'/%3e%3cpath%20d='M14%203v4h4'/%3e%3cpath%20d='M9%2011h6'/%3e%3cpath%20d='M9%2014h6'/%3e%3cpath%20d='M9%2017h4'/%3e%3c/svg%3e`,audio:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='audio'%3e%3cpath%20d='M4%2010v4'/%3e%3cpath%20d='M8%207v10'/%3e%3cpath%20d='M12%204v16'/%3e%3cpath%20d='M16%208v8'/%3e%3cpath%20d='M20%2011v2'/%3e%3c/svg%3e`,images:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='images'%3e%3crect%20x='3'%20y='4'%20width='18'%20height='16'%20rx='2'/%3e%3ccircle%20cx='8.5'%20cy='9'%20r='1.5'/%3e%3cpath%20d='M21%2016l-4.5-4.5L7%2020'/%3e%3c/svg%3e`,thumbnail:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='thumbnail'%3e%3crect%20x='3'%20y='4'%20width='18'%20height='16'%20rx='2'/%3e%3cpath%20d='M10%209v6l5-3z'/%3e%3c/svg%3e`,video:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='video'%3e%3crect%20x='3'%20y='5'%20width='18'%20height='14'%20rx='2'/%3e%3cpath%20d='M7%205v14'/%3e%3cpath%20d='M17%205v14'/%3e%3cpath%20d='M3%209.5h4M3%2014.5h4M17%209.5h4M17%2014.5h4'/%3e%3c/svg%3e`,document:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='document'%3e%3cpath%20d='M8%203h7l4%204v11H8z'/%3e%3cpath%20d='M15%203v4h4'/%3e%3cpath%20d='M5%207v14h11'/%3e%3cpath%20d='M11%2012h5'/%3e%3cpath%20d='M11%2015h3'/%3e%3c/svg%3e`};function Nx(e){return{maskImage:`url("${e}")`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}}function Px({kind:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:I(`block size-[22px] shrink-0 bg-current`,t),style:Nx(Mx[e])})}var Fx={github:Ax,patreon:jx,coffee:kx};function Ix({name:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:I(`block size-[14px] shrink-0 bg-current`,t),style:Nx(Fx[e])})}function Lx({variant:e=`secondary`,size:t=`default`,className:n,...r}){return(0,h.jsx)(`a`,{"data-slot":`button-link`,className:I(cy({variant:e,size:t}),n),...r})}function Rx({className:e,...t}){return(0,h.jsx)(`a`,{"data-slot":`text-link`,className:I(`sl-link`,e),...t})}var zx=ma(Lx),Bx=ma(Rx);function Vx({href:e,...t}){return(0,h.jsx)(Lx,{href:e,...t})}function Hx({href:e,label:t,tip:n,...r}){return(0,h.jsx)(Lx,{href:e,variant:`icon`,"aria-label":t,"data-tip":n??t,...r})}function Ux({tone:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-tone":e,className:I(`sl-lamp`,e!==`off`&&`sl-lamp--${e}`,t)})}function Wx({tone:e,children:t,className:n}){let r=e===`done`?`running`:e;return(0,h.jsxs)(`span`,{"data-slot":`status`,className:I(`sl-status`,r!==`off`&&`sl-status--${r}`,n),children:[(0,h.jsx)(Ux,{tone:e}),t]})}function Gx({tone:e=`neutral`,className:t,...n}){return(0,h.jsx)(`span`,{"data-slot":`badge`,className:I(`sl-badge`,e!==`neutral`&&`sl-badge--${e}`,t),...n})}function Kx({children:e,onRemove:t,removeLabel:n,className:r}){return(0,h.jsxs)(`span`,{"data-slot":`chip`,className:I(`sl-chip`,r),children:[e,t===void 0?null:(0,h.jsx)(`button`,{type:`button`,"aria-label":n??`Remove`,onClick:t,className:`-mr-1 inline-flex size-5 items-center justify-center rounded-control text-ink-2 hover:bg-raised hover:text-ink`,children:(0,h.jsx)(il,{"aria-hidden":`true`,className:`size-[14px]`,strokeWidth:1.75})})]})}function qx({className:e}){return(0,h.jsx)(`svg`,{viewBox:`0 0 256 256`,"aria-hidden":`true`,focusable:`false`,className:e,children:(0,h.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M 62 28 C 100 46, 118 60, 140 66 C 150 68, 152 80, 164 84 L 232 120 L 216 132 C 214.0 134.3, 208.3 141.7, 204.0 146.0 C 199.7 150.3, 194.0 154.7, 190.0 158.0 C 186.0 161.3, 182.3 162.3, 180.0 166.0 C 177.7 169.7, 176.3 175.0, 176.0 180.0 C 175.7 185.0, 179.0 191.0, 178.0 196.0 C 177.0 201.0, 174.0 207.3, 170.0 210.0 C 166.0 212.7, 158.0 213.7, 154.0 212.0 C 150.0 210.3, 147.3 204.3, 146.0 200.0 C 144.7 195.7, 147.0 189.7, 146.0 186.0 C 145.0 182.3, 143.0 178.7, 140.0 178.0 C 137.0 177.3, 131.3 179.0, 128.0 182.0 C 124.7 185.0, 121.3 190.7, 120.0 196.0 C 118.7 201.3, 121.3 208.0, 120.0 214.0 C 118.7 220.0, 115.7 228.3, 112.0 232.0 C 108.3 235.7, 102.3 237.0, 98.0 236.0 C 93.7 235.0, 88.3 230.7, 86.0 226.0 C 83.7 221.3, 84.0 213.3, 84.0 208.0 C 84.0 202.7, 86.7 197.3, 86.0 194.0 C 85.3 190.7, 82.7 187.7, 80.0 188.0 C 77.3 188.3, 72.7 193.3, 70.0 196.0 C 67.3 198.7, 65.3 202.3, 64.0 204.0 C 62.7 205.7, 62.3 205.7, 62.0 206.0 Q 56 118, 62 28 Z M 100 84 L 170 122 L 100 160 Z`})})}var Jx=[`Tokens in and out per stage, with provider and model`,`Audio seconds per segment`,`Images made`,`Thumbnails made`,`Videos rendered`,`PDF documents made`,`YouTube descriptions written`,`Shorts made`,`Projects created`,`That this machine installed Slopify`,`The time each of those happened`],Yx=[`API keys`,`Prompt bodies`,`Keyword values`,`Titles`,`Article or research text`,`Files and filenames`,`OS, locale, hardware`];function Xx(){let{api:e}=R(),t=_(),n=N(Jy(e)),r=P({mutationFn:()=>Ko(e),onSuccess:e=>{t.setQueryData(z.notice,e)}}),i=n.data?.seen===!1,a=n.data?.appVersion;return(0,h.jsxs)(Ey,{open:i,dismissible:!1,title:`Anonymous usage stats`,description:`These numbers power the live counters on slopify.stream.`,footer:(0,h.jsx)(L,{autoFocus:!0,variant:`primary`,disabled:r.isPending,onClick:()=>{r.mutate()},children:`Got it`}),children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,h.jsx)(Zx,{heading:`Tracked`,items:Jx}),(0,h.jsx)(Zx,{heading:`Never tracked`,items:Yx})]}),(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`Every event carries a random ID of its own and this machine's random ID, and nothing else. Nothing you write, upload, or paste ever leaves your machine.`}),a===void 0?null:(0,h.jsx)(`p`,{className:`engraved text-ink-3`,children:`Slopify ${a} · this version is included in each report`}),r.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:r.error.message})]})}function Zx({heading:e,items:t}){let n=`notice-${e.replace(/\s+/g,`-`).toLowerCase()}`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`p`,{id:n,className:`engraved border-b border-line pb-1 text-ink-3`,children:e}),(0,h.jsx)(`ul`,{"aria-labelledby":n,className:`m-0 flex list-none flex-col gap-2 p-0 text-small`,children:t.map(e=>(0,h.jsx)(`li`,{children:e},e))})]})}function Qx(e,t){if(t===`system`){e.removeAttribute(`data-theme`);return}e.setAttribute(`data-theme`,t)}function $x(){let{api:e}=R(),t=N(tb(e)).data?.appearance??`system`;return(0,m.useEffect)(()=>{Qx(document.documentElement,t)},[t]),null}function eS({reload:e}){let{version:t}=R(),n=(0,m.useSyncExternalStore)(t.subscribe,t.staleAt,t.staleAt);return(0,h.jsx)(Ey,{open:n!==void 0,dismissible:!1,title:`Slopify was updated`,description:`This tab was loaded before the update. Version ${n??``} is running now; reload to catch up.`,footer:(0,h.jsx)(L,{autoFocus:!0,variant:`primary`,onClick:e,children:`Reload`})})}var tS=[`stage.state`,`stage.progress`,`article.delta`,`llm.preview`,`image.landed`,`narration.piece`,`project.state`,`project.updated`,`review.flagged`],nS=[`running.count`,`staging.progress`,`staging.failed`,`project.updated`,`project.state`,`schedule.topics`,`review.flagged`,`stage.state`,`stage.progress`];function rS(e,t,n){return aS(e,t,tS,n.refetch,e=>{if(n.accept?.(e)!==!1){if(e.type===`llm.preview`){n.previewWriting?.(e);return}if(e.type===`narration.piece`){n.narrationPiece?.();return}if(e.type===`article.delta`){n.appendArticle(e.text);return}if(e.type===`image.landed`||e.type===`project.updated`||e.type===`review.flagged`){n.refetch();return}n.patch(e),e.type===`stage.state`&&n.refetch()}})}function iS(e,t,n){return aS(e,t,nS,n.refetch,e=>{if(e.type===`running.count`){n.tally(e.count);return}if(e.type===`project.updated`||e.type===`project.state`||e.type===`stage.state`||e.type===`stage.progress`){e.type===`project.state`&&n.projectState?.(e),n.refetch(e.projectId);return}if(e.type===`schedule.topics`){n.scheduleTopics?.(e);return}if(e.type===`review.flagged`){n.reviewFlagged?.(e),n.refetch(e.projectId);return}n.stagingChanged()})}function aS(e,t,n,r,i){let a=e(t),o=!1;a.addEventListener(`open`,()=>{o&&r(),o=!0});for(let e of n)a.addEventListener(e,t=>{let n=oS(t.data);n.type===e&&i(n)});return()=>{a.close()}}function oS(e){return JSON.parse(e)}var sS=[`16:9`,`9:16`],cS=[`research`,`article`,`audio`,`images`,`thumbnail`,`video`,`document`],lS=[`running`,`paused`,`canceled`,`failed`,`partial`,`done`,`pending`],uS=[`generate`,`provide`,`off`,`from_prompt`,`prompt_by_llm`];function dS(e,t){return e[t]??`off`}var fS=[`zoom`,`pan`,`mixed`,`still`],pS=[`text`,`llm`];function mS(e){return e.thumbnailCount===3&&(e.sources.thumbnail===`from_prompt`||e.sources.thumbnail===`prompt_by_llm`)?3:1}var hS=[`prompt`,`provide`],gS=[`video`,`short`],_S=[`plain`],vS=`dicemaster`,yS=[..._S,vS],bS={plain:`Plain`,dicemaster:`DiceMaster`};function xS(e){return e?.theme??`dicemaster`}function SS(e){return e?.theme??`plain`}function CS(e){return e?.custom?.name??bS[xS(e)]}function wS(e){let t=e.trim();return t===``?[{field:`name`,message:`Give the theme a name.`}]:t.length>80?[{field:`name`,message:`Keep the name under 80 characters.`}]:[]}function TS(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ES(e,t=`|`){return e.map(e=>GS(e)).join(t)}function DS(e,t){return typeof t==`bigint`?t.toString():t}function OS(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function kS(e){return e==null}function AS(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function jS(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function MS(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function NS(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function PS(e){return JSON.stringify(e)}function FS(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var IS=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function LS(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var RS=OS(()=>{if(AC.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function zS(e){if(LS(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return LS(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function BS(e){return zS(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var VS=new Set([`string`,`number`,`symbol`]);function HS(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function US(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function WS(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function GS(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function KS(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var qS={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function JS(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return US(e,NS(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&MS(e,r,n.shape[r])}return MS(this,`shape`,e),e},checks:[]}))}function YS(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return US(e,NS(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return MS(this,`shape`,r),r},checks:[]}))}function XS(e,t){if(!zS(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return US(e,NS(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return MS(this,`shape`,n),n}}))}function ZS(e,t){if(!zS(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return US(e,NS(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return MS(this,`shape`,n),n}}))}function QS(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return US(e,NS(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return MS(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $S(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return US(t,NS(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return MS(this,`shape`,i),i},checks:[]}))}function eC(e,t,n){return US(t,NS(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return MS(this,`shape`,i),i}}))}function tC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rC(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function iC(e){return typeof e==`string`?e:e?.message}function aC(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function oC(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:iC(e.inst?._zod.def?.error?.(e))??iC(a?.(e))??iC(t?.error?.(e))??iC(n.customError?.(e))??iC(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}var sC=/[\uD800-\uDBFF]/;function cC(e){let t=e.length;if(!sC.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function lC(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function uC(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function dC(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function fC(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):hC(e,n,r.value)}}function pC(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function mC(e,t,n){return pC(e,t,n,!1)}function hC(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:pC(this,t,n.bind(this))},set(e){pC(this,t,e)}})}function gC(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var _C,vC=!1,yC={configurable:!0,get(){vC=!0}};function bC(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&_C!==e._zod){_C=void 0;return}_C=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,yC);let e=vC;vC=!1;try{let r=n(this);return vC?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),vC||=e,r}catch(n){throw delete this[t],vC||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function xC(e,t,n,r){let i=gC(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var SC=`~constantCatch`;function CC(e){let t=()=>e;return t[SC]=!0,t}var wC,TC={value:void 0,enumerable:!1},EC=`captureStackTrace`in Error?Error:null;function DC(e){let t=EC;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return EC=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function H(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){TC.value=new a(r);try{Object.defineProperty(n,"_zod",TC)}finally{TC.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),fC(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?DC(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var OC=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},kC=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(wC=globalThis).__zod_globalConfig??(wC.__zod_globalConfig={});var AC=globalThis.__zod_globalConfig;function jC(e){return e&&Object.assign(AC,e),AC}function MC(){let e=this._zod;return e.message??=JSON.stringify(e.def,DS,2),e.message}function NC(e){this._zod.message=e}var PC={get:MC,set:NC,enumerable:!0,configurable:!0},FC={value:void 0,enumerable:!1},IC={value:void 0,enumerable:!1},LC=new WeakSet([Object.prototype,Error.prototype]),RC=(e,t)=>{e.name=`$ZodError`,FC.value=e._zod,Object.defineProperty(e,"_zod",FC),IC.value=t,Object.defineProperty(e,"issues",IC),FC.value=void 0,IC.value=void 0,Object.defineProperty(e,"message",PC);let n=Object.getPrototypeOf(e);LC.has(n)||(LC.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},zC=H(`$ZodError`,RC),BC=H(`$ZodError`,RC,void 0,{Parent:Error});function VC(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function HC(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?VC(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function UC(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function WC(e,t){return{callee:t?.callee??e,Err:t?.Err}}var GC=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new OC;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>oC(e,o,jC())));throw IS(n,a?.callee??t),n}return s.value};return t},KC=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>oC(e,o,jC())));throw IS(n,a?.callee??t),n}return s.value};return t},qC=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new OC;return a.issues.length?{success:!1,error:new(e??zC)(a.issues.map(e=>oC(e,i,jC())))}:{success:!0,data:a.value}},JC=qC(BC),YC=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>oC(e,i,jC())))}:{success:!0,data:a.value}},XC=YC(BC),ZC=e=>{let t=GC(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,WC(n,a))};return n},QC=e=>{let t=GC(e),n=(e,r,i,a)=>t(e,r,i,WC(n,a));return n},$C=e=>{let t=KC(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,WC(n,a))};return n},ew=e=>{let t=KC(e),n=async(e,r,i,a)=>await t(e,r,i,WC(n,a));return n},tw=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qC(e)(t,n,i)},nw=e=>(t,n,r)=>qC(e)(t,n,r),rw=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return YC(e)(t,n,i)},iw=e=>async(t,n,r)=>YC(e)(t,n,r),aw=/^[cC][0-9a-z]{6,}$/,ow=/^[0-9a-z]+$/,sw=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,cw=/^[0-9a-vA-V]{20}$/,lw=/^[A-Za-z0-9]{27}$/,uw=/^[a-zA-Z0-9_-]{21}$/;function dw(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var fw=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pw=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mw=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,hw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gw=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function _w(){return new RegExp(gw,`u`)}var vw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,yw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,bw=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,xw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cw=/^[A-Za-z0-9_-]*$/,ww=/^https?$/,Tw=/^\+[1-9]\d{6,14}$/,Ew=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Dw(e){return RegExp(`^${e}$`)}var Ow=Dw(Ew);function kw(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Aw(e){return RegExp(`^${kw(e)}$`)}function jw(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${kw({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${kw({precision:e.precision})}`:n;return RegExp(`^${Ew}T(?:${r})$`)}var Mw=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Nw=/^-?\d+$/,Pw=/^-?\d+(?:\.\d+)?$/,Fw=/^(?:true|false)$/i,Iw=/^null$/i,Lw=/^[^A-Z]*$/,Rw=/^[^a-z]*$/,zw=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Bw=e=>{let t=e.value;return!kS(t)&&t.length!==void 0},Vw={number:`number`,bigint:`bigint`,object:`date`},Hw=H(`$ZodCheckLessThan`,(e,t)=>{zw.init(e,t);let n=Vw[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Vw[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Uw=H(`$ZodCheckGreaterThan`,(e,t)=>{zw.init(e,t);let n=Vw[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Vw[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ww=H(`$ZodCheckMultipleOf`,(e,t)=>{zw.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):jS(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Gw=H(`$ZodCheckNumberFormat`,(e,t)=>{zw.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=qS[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Nw)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Kw=H(`$ZodCheckMaxLength`,(e,t)=>{var n;zw.init(e,t),(n=e._zod.def).when??(n.when=Bw),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?cC(r):i)<=t.maximum)return;let a=lC(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qw=H(`$ZodCheckMinLength`,(e,t)=>{var n;zw.init(e,t),(n=e._zod.def).when??(n.when=Bw),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?cC(r):i)>=t.minimum)return;let a=lC(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jw=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;zw.init(e,t),(n=e._zod.def).when??(n.when=Bw),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?cC(r):i;if(a===t.length)return;let o=lC(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Yw=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;zw.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Xw=H(`$ZodCheckRegex`,(e,t)=>{Yw.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Zw=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Lw,Yw.init(e,t)}),Qw=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Rw,Yw.init(e,t)}),$w=H(`$ZodCheckIncludes`,(e,t)=>{zw.init(e,t);let n=HS(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),eT=H(`$ZodCheckStartsWith`,(e,t)=>{zw.init(e,t);let n=RegExp(`^${HS(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),tT=H(`$ZodCheckEndsWith`,(e,t)=>{zw.init(e,t);let n=RegExp(`.*${HS(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),nT=H(`$ZodCheckOverwrite`,(e,t)=>{zw.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),rT=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
52
|
+
`).map(e=>(0,h.jsx)(`p`,{className:`m-0`,children:e},e)),i.tutorial===void 0?null:(0,h.jsx)(Kte,{tutorial:i.tutorial})]})]})}function Kte({tutorial:e}){let t=_i({warn:!1}),n=`sl-link inline-flex items-center gap-1 text-small`,r=(0,h.jsxs)(h.Fragment,{children:[`Learn more`,(0,h.jsx)(gc,{"aria-hidden":`true`,className:`size-[13px]`})]});return t?(0,h.jsx)(Gte,{asChild:!0,children:(0,h.jsx)(ha,{to:`/help/tutorials/$page`,params:{page:e.page},...e.anchor===void 0?{}:{hash:e.anchor},className:n,children:r})}):(0,h.jsx)(`a`,{href:ib(e.page,e.anchor),className:n,children:r})}var cb={"data-help-scope":``};function V({title:e,kicker:t,meta:n,info:r,infoLabel:i=e,as:a=`h2`,size:o=a===`h3`?`small`:`default`,id:s,status:c,row:l=!1,className:u,children:d}){return(0,h.jsxs)(`div`,{className:I(`sl-section-head`,u),"data-slot":`section-head`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[t===void 0?null:(0,h.jsx)(`div`,{className:`sl-kicker`,children:t}),(0,h.jsxs)(`div`,{className:I(`flex items-center gap-2`,l&&`flex-wrap items-baseline gap-x-3 gap-y-0`),children:[(0,h.jsx)(a,{id:s,className:I(`sl-section-head__title`,o===`small`&&`text-title-3`),children:e}),r===void 0?null:(0,h.jsx)(B,{id:r,label:i}),c,l&&n!==void 0?(0,h.jsx)(`p`,{className:`sl-section-head__meta m-0 min-w-0`,children:n}):null]}),l||n===void 0?null:(0,h.jsx)(`p`,{className:`sl-section-head__meta`,children:n})]}),d===void 0?null:(0,h.jsx)(`div`,{className:`sl-btn-row min-w-0 shrink-0 justify-end max-md:shrink max-md:justify-start`,children:d})]})}function lb({checked:e,onChange:t,label:n,disabled:r,className:i,describedBy:a,tip:o,tipLabel:s}){let c=(0,h.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-describedby":a,disabled:r,onClick:()=>t(!e),className:I(`sl-switch`,i),children:[(0,h.jsx)(`span`,{className:`sl-switch__track`,"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:n})]});return o===void 0?c:(0,h.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,...cb,children:[c,(0,h.jsx)(B,{id:o,label:s??(typeof n==`string`?n:void 0)})]})}function ub({value:e,options:t,onChange:n,label:r,className:i,tip:a}){let o=(0,m.useRef)(null),s=(0,h.jsx)(`div`,{ref:o,role:`group`,"aria-label":r,onKeyDown:r=>{if(r.key!==`ArrowRight`&&r.key!==`ArrowLeft`)return;let i=t.filter(e=>!e.disabled),a=i[(i.findIndex(t=>t.value===e)+(r.key===`ArrowRight`?1:-1)+i.length)%i.length];a!==void 0&&(r.preventDefault(),n(a.value),o.current?.querySelector(`[data-value="${CSS.escape(a.value)}"]`)?.focus())},className:I(`sl-seg`,i),children:t.map(t=>(0,h.jsx)(`button`,{type:`button`,"data-value":t.value,"aria-pressed":t.value===e,tabIndex:t.value===e?0:-1,disabled:t.disabled,onClick:()=>n(t.value),className:`sl-seg__opt`,children:t.label},t.value))});return a===void 0?s:(0,h.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,...cb,children:[s,(0,h.jsx)(B,{id:a,label:r})]})}var db=[`settings`,`autostart`],fb=(e,t=``)=>`${e.origin}/api/settings/autostart${t}`;async function pb(e){return F(await e.fetch(fb(e)))}async function qte(e,t){return F(await e.fetch(fb(e),{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:t})}))}async function Jte(e){return F(await e.fetch(fb(e,`/answer`),{method:`POST`}))}var mb=`Start Slopify when I log in`;function Yte(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function hb(){let{api:e}=R(),t=_();return{view:N({queryKey:db,queryFn:()=>pb(e)}),turn:P({mutationFn:t=>qte(e,t),onSuccess:e=>t.setQueryData(db,e)}),decline:P({mutationFn:()=>Jte(e),onSuccess:e=>t.setQueryData(db,e)})}}function Xte(){let{view:e,turn:t}=hb(),n=e.data;return(0,h.jsxs)(`div`,{...cb,children:[(0,h.jsx)(V,{title:mb,info:`settings.autostart`}),e.error===null?null:(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 mb-3 text-body text-danger`,children:[`Starting at login couldn't be checked: `,e.error.message]}),n===void 0?e.error===null?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:`Checking…`}):null:n.kind===`docker`?(0,h.jsx)(gb,{view:n}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(lb,{label:mb,checked:n.enabled===!0,disabled:!n.available||t.isPending,describedBy:`autostart-summary`,onChange:e=>t.mutate(e)}),(0,h.jsxs)(`p`,{id:`autostart-summary`,className:`m-0 text-small text-ink-2`,children:[n.summary,n.enabled===!0&&n.where!==null?` Login entry: ${n.where}`:``]}),t.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:t.error.message})]})]})}function gb({view:e}){return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`p`,{className:`m-0 text-body`,children:(0,h.jsx)(`span`,{className:`font-semibold`,children:e.enabled===!0?`Starts with Docker: yes`:e.enabled===!1?`Starts with Docker: no`:`Starts with Docker: unknown`})}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.summary}),e.howTo===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.howTo}),e.checkedAt===null?null:(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Checked by the installer on `,Yte(e.checkedAt),`.`]})]})}function Zte(){let{view:e,turn:t,decline:n}=hb();if(t.isSuccess&&e.data?.enabled===!0)return(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`Slopify now starts when you log in. Change it any time in Settings → General.`});if(e.data?.kind===`docker`)return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V,{title:mb,info:`settings.autostart`}),(0,h.jsx)(`div`,{className:`mb-6`,children:(0,h.jsx)(gb,{view:e.data})})]});if(e.data?.offer!==!0)return null;let r=t.error??n.error;return(0,h.jsxs)(`section`,{children:[(0,h.jsx)(V,{title:mb,info:`settings.autostart`}),(0,h.jsx)(`p`,{className:`m-0 mb-3 text-small text-ink-2`,children:`Have Slopify ready whenever you open your bookmark, without starting it from a terminal.`}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,h.jsx)(L,{variant:`primary`,disabled:t.isPending||n.isPending,onClick:()=>t.mutate(!0),children:`Start when I log in`}),(0,h.jsx)(L,{variant:`quiet`,disabled:t.isPending||n.isPending,onClick:()=>n.mutate(),children:`No thanks`})]}),r===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-3 text-small text-danger`,children:r.message})]})}function Qte(){let{api:e}=R(),t=Ha({select:e=>e.pathname}),{view:n,turn:r,decline:i}=hb(),a=N(Jy(e)),o=N({queryKey:Oy,queryFn:()=>My(e)}),s=n.data?.offer===!0&&a.data?.seen===!0&&o.data?.show===!1&&t!==`/welcome`,c=r.isPending||i.isPending,l=r.error??i.error;return(0,h.jsx)(Ey,{open:s,onOpenChange:e=>{!e&&!c&&i.mutate()},title:`Start Slopify when you log in?`,description:`Have Slopify ready whenever you open your bookmark, without starting it from a terminal. Change it any time in Settings → General.`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`secondary`,disabled:c,onClick:()=>i.mutate(),children:`No thanks`}),(0,h.jsx)(L,{variant:`primary`,autoFocus:!0,disabled:c,onClick:()=>r.mutate(!0),children:`Start when I log in`})]}),children:l===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:l.message})})}function $te(){let{api:e}=R(),t=N({queryKey:db,queryFn:()=>pb(e),retry:!1,staleTime:1/0}).data?.kind;(0,m.useEffect)(()=>{t!==void 0&&_o(t)},[t])}var _b=`00000000-0000-4000-8000-000000000001`,vb=[`character`,`creature`,`place`,`object`],yb={character:`Character`,creature:`Creature`,place:`Place`,object:`Object`},bb=[`channels`],xb=e=>[`channels`,e],Sb=e=>`${e.origin}/api/channels`,Cb=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});function wb(e){return ct({queryKey:bb,queryFn:async()=>(await F(await e.fetch(Sb(e)))).channels})}function Tb(e,t){return ct({queryKey:xb(t),queryFn:async()=>F(await e.fetch(`${Sb(e)}/${t}`)),refetchInterval:e=>e.state.data?.cast.some(e=>e.images.some(e=>e.state===`generating`))?3e3:!1})}async function Eb(e,t,n){return F(await e.fetch(Sb(e),Cb(`POST`,{id:t,name:n})))}async function Db(e,t,n){return F(await e.fetch(`${Sb(e)}/${t}`,Cb(`PUT`,n)))}async function Ob(e,t){let n=await e.fetch(`${Sb(e)}/${t}`,{method:`DELETE`});n.ok||await F(n)}async function kb(e,t,n,r){return F(await e.fetch(`${Sb(e)}/${t}/cast`,Cb(`POST`,{id:n,...r})))}async function Ab(e,t,n){return F(await e.fetch(`${Sb(e)}/cast/${t}`,Cb(`PUT`,n)))}async function jb(e,t){let n=await e.fetch(`${Sb(e)}/cast/${t}`,{method:`DELETE`});n.ok||await F(n)}async function Mb(e,t,n){return F(await e.fetch(`${Sb(e)}/cast/${t}/images`,{method:`POST`,headers:{"content-type":n.type||`application/octet-stream`},body:n}))}async function Nb(e,t,n){return F(await e.fetch(`${Sb(e)}/cast/${t}/generate`,Cb(`POST`,n)))}async function Pb(e,t,n){let r=await e.fetch(`${Sb(e)}/cast/${t}/images/${n}`,{method:`DELETE`});r.ok||await F(r)}async function Fb(e,t,n){await F(await e.fetch(`${Sb(e)}/templates/${t}`,Cb(`PUT`,{channelId:n})))}async function Ib(e,t,n){return F(await e.fetch(`${Sb(e)}/${t}/ai-disclosure`,Cb(`PUT`,{aiDisclosure:n})))}function Lb(e,t){return`${Sb(e)}/pictures/${t}`}var Rb=`slopify.channel`,zb=(0,m.createContext)(void 0);function Bb(){try{let e=window.localStorage.getItem(Rb);return e===null||e===``?null:e}catch{return null}}function Vb({children:e}){let{api:t}=R(),n=N(wb(t)),[r,i]=(0,m.useState)(Bb),a=n.data??[],o=r!==null&&n.data!==void 0&&!a.some(e=>e.id===r)?null:r,s=(0,m.useCallback)(e=>{i(e);try{e===null?window.localStorage.removeItem(Rb):window.localStorage.setItem(Rb,e)}catch{}},[]),c=(0,m.useMemo)(()=>({channelId:o,channel:a.find(e=>e.id===o),channels:a,setChannelId:s,includes:e=>o===null||e===o}),[o,a,s]);return(0,h.jsx)(zb,{value:c,children:e})}var Hb={channelId:null,channel:void 0,channels:[],setChannelId:()=>{},includes:()=>!0};function Ub(){return(0,m.useContext)(zb)??Hb}function Wb({className:e}){let t=Ub(),n=(0,m.useId)();return(0,h.jsxs)(`div`,{className:I(`flex flex-col gap-1`,e),...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1 px-2`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`sl-kicker`,children:`Channel`}),(0,h.jsx)(B,{id:`planning.channel.current`,className:`-my-1`})]}),(0,h.jsxs)(`select`,{id:n,className:`sl-select`,value:t.channelId??``,onChange:e=>t.setChannelId(e.target.value===``?null:e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`All channels`}),t.channels.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}var Gb=class{commands=new Map;listeners=new Set;version=0;snapshot=[];register(e){return this.commands.set(e.id,e),this.changed(),()=>{this.commands.get(e.id)===e&&(this.commands.delete(e.id),this.changed())}}list(){return this.snapshot}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.version;changed(){this.version+=1,this.snapshot=[...this.commands.values()];for(let e of this.listeners)e()}},Kb=(0,m.createContext)(void 0);function qb(e){let t=(0,m.useContext)(Kb),n=(0,m.useRef)(e);n.current=e;let{id:r,title:i,group:a,context:o,searchOnly:s}=e,c=e.keywords?.join(`\0`),l=e.shortcut?.join(`\0`),u=e.numbered!==void 0,d=t?.registry;(0,m.useEffect)(()=>{if(d===void 0)return;let{icon:e}=n.current;return d.register({id:r,title:i,group:a,...o===void 0?{}:{context:o},...c===void 0?{}:{keywords:c.split(`\0`)},...e===void 0?{}:{icon:e},...l===void 0?{}:{shortcut:l.split(`\0`)},...u?{numbered:e=>n.current.numbered?.(e)??i}:{},...s===!0?{searchOnly:!0}:{},run:e=>n.current.run(e)})},[d,r,i,a,o,c,l,u,s])}function Jb(e,t){let n=[`/`];return qb({id:`list.search`,title:`Search ${t}`,group:`This page`,keywords:[`find`,`filter`],shortcut:n,run:()=>{e.current?.focus(),e.current?.select()}}),n}function Yb(){return(0,m.useContext)(Kb)??{open:!1,setOpen:Xb}}function Xb(){}function Zb(e,t){let n=e.trim().toLowerCase();if(n===``)return 0;let r=t.toLowerCase(),i=0,a=0,o=-2;for(let e of n){if(e===` `)continue;let t=r.indexOf(e,a);if(t===-1)return null;i+=1,t===o+1&&(i+=3),(t===0||/[\s\-_:/.]/.test(r[t-1]??``))&&(i+=4),i-=Math.min(t-a,5)*.1,o=t,a=t+1}return r.startsWith(n)||r.includes(` ${n}`)?i+=6:r.includes(n)&&(i+=3),i}function Qb(e){return[{text:e.title,bonus:2},...e.context===void 0?[]:[{text:e.context,bonus:1}],...(e.keywords??[]).map(e=>({text:e,bonus:0})),{text:e.group,bonus:0}]}function $b(e,t,n){let r=null;for(let i of t){let t=Zb(e,i.text);if(t===null)continue;let a=n&&i.text.toLowerCase().split(/[\s\-_:/.,&]+/).includes(e)?4:0,o=t+i.bonus+a;(r===null||o>r)&&(r=o)}return r}function ex(e,t){if(e.length===0)return 0;let n=$b(e.join(` `),t,!1);if(e.length===1)return n;let r=0;for(let i of e){let e=$b(i,t,!0);if(e===null)return n;r+=e}return n===null?r:Math.max(n,r)}function tx(e,t){let n=t.trim()===``,r=t.trim().toLowerCase().split(/\s+/).filter(Boolean),i=r.find(e=>/^\d+$/.test(e)),a=[];return e.forEach((e,t)=>{if(n&&e.searchOnly===!0)return;let o=e.numbered;if(o!==void 0&&i!==void 0){let n=Number(i),s=r.indexOf(i),c=ex([...r.slice(0,s),...r.slice(s+1)],Qb(e));c!==null&&a.push({command:{...e,title:o(n),run:()=>e.run(n)},score:c,order:t});return}let s=ex(r,Qb(e));s!==null&&a.push({command:e,score:s,order:t})}),a.sort((e,t)=>{let r=Number(t.command.context!==void 0)-Number(e.command.context!==void 0);return n?r===0?e.order-t.order:r:t.score-e.score||r||e.order-t.order}),a.map(e=>e.command)}var nx=new Set([`Ctrl`,`Alt`,`Shift`]);function rx(e){return{mod:e.includes(`Ctrl`),alt:e.includes(`Alt`),shift:e.includes(`Shift`),keys:e.filter(e=>!nx.has(e)).map(e=>e.toLowerCase())}}var ix=e=>!e.mod&&!e.alt&&!e.shift&&e.keys.length>1;function ax(e){if(e===void 0)return;let t=rx(e);if(ix(t)||t.keys.length!==1)return;let n=e.at(-1)??``,r=[...t.alt?[`Alt`]:[],...t.shift?[`Shift`]:[],n].join(`+`);return t.mod?`Control+${r} Meta+${r}`:r}function ox(e,t,n){return e.mod!==(n.ctrlKey||n.metaKey)||e.alt!==n.altKey||/^[a-z0-9]$/.test(t)&&e.shift!==n.shiftKey?!1:n.key.toLowerCase()===t}function sx(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?!0:e instanceof HTMLInputElement&&![`checkbox`,`radio`,`button`,`submit`,`reset`,`range`,`color`,`file`].includes(e.type):!1}var cx=()=>document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"]`)!==null;function lx(e){return e.map((e,t)=>({command:e,order:t})).filter(e=>e.command.shortcut!==void 0).sort((e,t)=>Number(t.command.context!==void 0)-Number(e.command.context!==void 0)||t.order-e.order).map(e=>e.command)}var ux=1500;function dx({children:e,registry:t}){let[n]=(0,m.useState)(()=>t??new Gb),[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(!1),s=(0,m.useRef)(!1);s.current=r,(0,m.useEffect)(()=>n.register({id:`help.shortcuts`,title:`Show keyboard shortcuts`,group:`Help`,keywords:[`keys`,`keyboard`,`hotkeys`,`help`],shortcut:[`?`],run:()=>o(!0)}),[n]),(0,m.useEffect)(()=>{let e,t=t=>{if((t.ctrlKey||t.metaKey)&&!t.altKey&&t.key.toLowerCase()===`k`){t.preventDefault(),i(e=>!e);return}if(t.defaultPrevented||t.isComposing||s.current||cx())return;let r=sx(t.target),a=lx(n.list()),o=t.key.toLowerCase(),c=!t.ctrlKey&&!t.metaKey&&!t.altKey,l=n=>{t.preventDefault(),e=void 0,n.run()};if(e!==void 0&&c&&!r&&t.timeStamp-e.at<ux){let t=e.key,n=a.find(e=>{let n=rx(e.shortcut??[]);return ix(n)&&n.keys[0]===t&&n.keys[1]===o});if(n!==void 0)return l(n)}e=void 0;let u=a.find(e=>{let n=rx(e.shortcut??[]);return ix(n)||n.keys.length!==1||r&&!n.mod?!1:ox(n,n.keys[0]??``,t)});if(u!==void 0)return l(u);c&&!r&&!t.shiftKey&&a.some(e=>{let t=rx(e.shortcut??[]);return ix(t)&&t.keys[0]===o})&&(e={key:o,at:t.timeStamp})};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[n]);let c=(0,m.useMemo)(()=>({registry:n,open:r,setOpen:i}),[n,r]);return(0,h.jsxs)(Kb.Provider,{value:c,children:[e,(0,h.jsx)(mx,{}),(0,h.jsx)(px,{registry:n,open:a,onOpenChange:o})]})}function fx({shortcut:e}){let t=ix(rx(e));return(0,h.jsx)(`span`,{className:`sl-kbd`,children:e.map((e,n)=>(0,h.jsxs)(m.Fragment,{children:[t&&n>0?(0,h.jsx)(`span`,{className:`text-caption text-ink-3`,children:`then`}):null,(0,h.jsx)(`kbd`,{children:e})]},e))})}function px({registry:e,open:t,onOpenChange:n}){(0,m.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);let r=new Set,i=lx(e.list()).filter(e=>{let t=e.shortcut?.join(`+`)??``;return!r.has(t)&&(r.add(t),!0)}).toSorted((e,t)=>e.group.localeCompare(t.group)||e.title.localeCompare(t.title));return(0,h.jsx)(Ey,{open:t,onOpenChange:n,title:`Keyboard shortcuts`,description:`Ctrl works as Cmd on a Mac. Keys without Ctrl wait while you type in a field. A screen's own shortcuts are listed while it is open.`,children:(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] items-center gap-x-4 gap-y-2 text-small`,children:[{keys:[`Ctrl`,`K`],title:`Search or run a command`},{keys:[`Esc`],title:`Close a dialog, a drawer or the palette`},...i.map(e=>({keys:e.shortcut??[],title:e.title}))].map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(`dt`,{children:(0,h.jsx)(fx,{shortcut:e.keys})}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0`,children:e.title})]},e.keys.join(`+`)))})})}function mx(){let e=(0,m.useContext)(Kb);return e===void 0?null:(0,h.jsx)(km,{open:e.open,onOpenChange:e.setOpen,children:(0,h.jsxs)(Mm,{children:[(0,h.jsx)(Pm,{className:`sl-overlay`}),(0,h.jsxs)(Lm,{className:`sl-overlay-content sl-palette sl-enter`,"aria-describedby":void 0,children:[(0,h.jsx)(Hm,{className:`sr-only`,children:`Command palette`}),(0,h.jsx)(hx,{registry:e.registry,close:()=>e.setOpen(!1)})]})]})})}function hx({registry:e,close:t}){(0,m.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);let n=e.list(),[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)(0),s=(0,m.useId)(),c=(0,m.useMemo)(()=>tx(n,r),[n,r]),l=Math.min(a,Math.max(0,c.length-1)),u=(0,m.useRef)(null),d=(0,m.useMemo)(()=>{let e=new Map;return c.forEach((t,n)=>{let r=e.get(t.group)??[];r.push({command:t,index:n}),e.set(t.group,r)}),[...e.entries()]},[c]),f=e=>`${s}-option-${String(e)}`;(0,m.useEffect)(()=>{u.current?.querySelector(`[data-index="${String(l)}"]`)?.scrollIntoView?.({block:`nearest`})},[l]);let p=(0,m.useCallback)(e=>{e!==void 0&&(t(),e.run())},[t]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`sl-palette__input`,children:[(0,h.jsx)(Yc,{"aria-hidden":`true`,strokeWidth:1.75}),(0,h.jsx)(`input`,{autoFocus:!0,role:`combobox`,"aria-expanded":`true`,"aria-controls":s,"aria-autocomplete":`list`,"aria-activedescendant":c.length===0?void 0:f(l),"aria-label":`Search or run a command`,placeholder:`Search or run a command`,value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),o(c.length===0?0:(l+1)%c.length)):e.key===`ArrowUp`?(e.preventDefault(),o(c.length===0?0:(l-1+c.length)%c.length)):e.key===`Home`?(e.preventDefault(),o(0)):e.key===`End`?(e.preventDefault(),o(Math.max(0,c.length-1))):e.key===`Enter`&&(e.preventDefault(),p(c[l]))}}),(0,h.jsx)(`span`,{className:`sl-kbd`,"aria-hidden":`true`,children:(0,h.jsx)(`kbd`,{children:`Esc`})})]}),(0,h.jsx)(`div`,{ref:u,id:s,role:`listbox`,"aria-label":`Commands`,className:`sl-palette__list`,children:c.length===0?(0,h.jsx)(`p`,{className:`sl-palette__empty`,children:n.length===0?`No commands here yet.`:`Nothing matches "${r.trim()}". Try fewer letters or another word.`}):d.map(([e,t])=>(0,h.jsxs)(`div`,{role:`group`,"aria-label":e,className:`sl-palette__group`,children:[(0,h.jsx)(`div`,{className:`sl-kicker px-[10px] pb-1`,"aria-hidden":`true`,children:e}),t.map(({command:e,index:t})=>(0,h.jsxs)(`div`,{id:f(t),"data-index":t,role:`option`,tabIndex:-1,"aria-selected":t===l,className:`sl-palette__item`,onMouseMove:()=>{t!==l&&o(t)},onClick:()=>p(e),children:[e.icon,(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title}),e.context===void 0?null:(0,h.jsx)(`span`,{className:`sl-palette__meta`,children:e.context}),e.shortcut===void 0?null:(0,h.jsx)(fx,{shortcut:e.shortcut})]},e.id))]},e))})]})}var gx=1e4,_x={newSchedule:`schedules.new`,addToCalendar:`calendar.add`,showImages:e=>`project.${e}.show-images`,regenerateImage:e=>`project.${e}.regenerate-image`},vx=new Map,yx=new Set;function bx(e,t){vx.set(e,{value:t,at:Date.now()});for(let e of yx)e()}function xx(e){let t=vx.get(e);return vx.delete(e),t===void 0||Date.now()-t.at>gx?void 0:t}function Sx(e,t,n=!0){let r=(0,m.useRef)(t);r.current=t,(0,m.useEffect)(()=>{if(!n)return;let t=()=>{if(!vx.has(e))return;let t=xx(e);t!==void 0&&r.current(t.value)};return t(),yx.add(t),()=>{yx.delete(t)}},[e,n])}function Cx(){let{api:e}=R(),t=N(Gy(e)),n=Ha({select:e=>e.pathname}),r=Ha({select:e=>e.pathname===`/calendar`&&e.search.tab===`schedules`}),i=/^\/projects\/([^/]+)/.exec(n)?.[1];return(0,h.jsxs)(h.Fragment,{children:[r?null:(0,h.jsx)(wx,{}),n===`/calendar`?null:(0,h.jsx)(Tx,{}),(t.data?.projects??[]).filter(e=>e.id!==i).map(e=>(0,h.jsx)(Ex,{project:e},e.id))]})}function wx(){let e=Zi();return qb({id:`global.schedules.new`,title:`New schedule`,group:`Create`,keywords:[`schedule`,`recurring`,`calendar`,`plan`],searchOnly:!0,run:()=>{bx(_x.newSchedule),e({to:`/calendar`,search:{tab:`schedules`}})}}),null}function Tx(){let e=Zi();return qb({id:`global.calendar.add`,title:`Add to calendar`,group:`Create`,keywords:[`schedule`,`topics`,`batch`,`queue`,`plan`],searchOnly:!0,run:()=>{bx(_x.addToCalendar),e({to:`/calendar`})}}),null}function Ex({project:e}){let t=Zi(),n=()=>{t({to:`/projects/$projectId`,params:{projectId:e.id}})};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Dx,{project:e,open:n}),e.config.sources.images===`off`?null:(0,h.jsx)(Ox,{project:e,open:n})]})}function Dx({project:e,open:t}){return qb({id:`index.open.${e.id}`,title:`Open ${e.title}`,group:`Projects`,keywords:[`project`,`go`],searchOnly:!0,run:t}),null}function Ox({project:e,open:t}){return qb({id:`index.image.${e.id}`,title:`Regenerate an image in ${e.title}`,numbered:t=>`Regenerate image ${String(t)} in ${e.title}`,group:`Projects`,keywords:[`image`,`picture`,`redraw`,`remake`],searchOnly:!0,run:n=>{bx(_x.showImages(e.id)),n!==void 0&&bx(_x.regenerateImage(e.id),n),t()}}),null}var kx=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Buy%20Me%20a%20Coffee'%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='M3.4%207.6h13.1v2.1a3.9%203.9%200%200%201%200%207.6v.2a3.6%203.6%200%200%201-3.6%203.6H7a3.6%203.6%200%200%201-3.6-3.6zm13.1%204.3v3.2a1.7%201.7%200%200%200%200-3.2zM6.2%202.1a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200zm3.6%200a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200zm3.6%200a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200z'/%3e%3c/svg%3e`,Ax=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='GitHub'%3e%3cpath%20d='M15%2022v-4a4.8%204.8%200%200%200-1-3.5c3%200%206-2%206-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35%200-3.5%200%200-1%200-3%201.5-2.64-.5-5.36-.5-8%200C6%202%205%202%205%202c-.3%201.15-.3%202.35%200%203.5A5.403%205.403%200%200%200%204%209c0%203.5%203%205.5%206%205.5-.39.49-.68%201.05-.85%201.65-.17.6-.22%201.23-.15%201.85v4'/%3e%3cpath%20d='M9%2018c-4.51%202-5-2-7-2'/%3e%3c/svg%3e`,jx=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Patreon'%3e%3cpath%20fill='currentColor'%20d='M2.5%202.2h4.3v19.6H2.5z'/%3e%3ccircle%20fill='currentColor'%20cx='15.2'%20cy='9.4'%20r='6.9'/%3e%3c/svg%3e`,Mx={research:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='research'%3e%3ccircle%20cx='10.5'%20cy='10.5'%20r='6.5'/%3e%3cpath%20d='M15.5%2015.5%2021%2021'/%3e%3c/svg%3e`,article:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='article'%3e%3cpath%20d='M6%203h8l4%204v14H6z'/%3e%3cpath%20d='M14%203v4h4'/%3e%3cpath%20d='M9%2011h6'/%3e%3cpath%20d='M9%2014h6'/%3e%3cpath%20d='M9%2017h4'/%3e%3c/svg%3e`,audio:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='audio'%3e%3cpath%20d='M4%2010v4'/%3e%3cpath%20d='M8%207v10'/%3e%3cpath%20d='M12%204v16'/%3e%3cpath%20d='M16%208v8'/%3e%3cpath%20d='M20%2011v2'/%3e%3c/svg%3e`,images:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='images'%3e%3crect%20x='3'%20y='4'%20width='18'%20height='16'%20rx='2'/%3e%3ccircle%20cx='8.5'%20cy='9'%20r='1.5'/%3e%3cpath%20d='M21%2016l-4.5-4.5L7%2020'/%3e%3c/svg%3e`,thumbnail:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='thumbnail'%3e%3crect%20x='3'%20y='4'%20width='18'%20height='16'%20rx='2'/%3e%3cpath%20d='M10%209v6l5-3z'/%3e%3c/svg%3e`,video:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='video'%3e%3crect%20x='3'%20y='5'%20width='18'%20height='14'%20rx='2'/%3e%3cpath%20d='M7%205v14'/%3e%3cpath%20d='M17%205v14'/%3e%3cpath%20d='M3%209.5h4M3%2014.5h4M17%209.5h4M17%2014.5h4'/%3e%3c/svg%3e`,document:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='document'%3e%3cpath%20d='M8%203h7l4%204v11H8z'/%3e%3cpath%20d='M15%203v4h4'/%3e%3cpath%20d='M5%207v14h11'/%3e%3cpath%20d='M11%2012h5'/%3e%3cpath%20d='M11%2015h3'/%3e%3c/svg%3e`};function Nx(e){return{maskImage:`url("${e}")`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}}function Px({kind:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:I(`block size-[22px] shrink-0 bg-current`,t),style:Nx(Mx[e])})}var Fx={github:Ax,patreon:jx,coffee:kx};function Ix({name:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:I(`block size-[14px] shrink-0 bg-current`,t),style:Nx(Fx[e])})}function Lx({variant:e=`secondary`,size:t=`default`,className:n,...r}){return(0,h.jsx)(`a`,{"data-slot":`button-link`,className:I(cy({variant:e,size:t}),n),...r})}function Rx({className:e,...t}){return(0,h.jsx)(`a`,{"data-slot":`text-link`,className:I(`sl-link`,e),...t})}var zx=ma(Lx),Bx=ma(Rx);function Vx({href:e,...t}){return(0,h.jsx)(Lx,{href:e,...t})}function Hx({href:e,label:t,tip:n,...r}){return(0,h.jsx)(Lx,{href:e,variant:`icon`,"aria-label":t,"data-tip":n??t,...r})}function Ux({tone:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-tone":e,className:I(`sl-lamp`,e!==`off`&&`sl-lamp--${e}`,t)})}function Wx({tone:e,children:t,className:n}){let r=e===`done`?`running`:e;return(0,h.jsxs)(`span`,{"data-slot":`status`,className:I(`sl-status`,r!==`off`&&`sl-status--${r}`,n),children:[(0,h.jsx)(Ux,{tone:e}),t]})}function Gx({tone:e=`neutral`,className:t,...n}){return(0,h.jsx)(`span`,{"data-slot":`badge`,className:I(`sl-badge`,e!==`neutral`&&`sl-badge--${e}`,t),...n})}function Kx({children:e,onRemove:t,removeLabel:n,className:r}){return(0,h.jsxs)(`span`,{"data-slot":`chip`,className:I(`sl-chip`,r),children:[e,t===void 0?null:(0,h.jsx)(`button`,{type:`button`,"aria-label":n??`Remove`,onClick:t,className:`-mr-1 inline-flex size-5 items-center justify-center rounded-control text-ink-2 hover:bg-raised hover:text-ink`,children:(0,h.jsx)(il,{"aria-hidden":`true`,className:`size-[14px]`,strokeWidth:1.75})})]})}function qx({className:e}){return(0,h.jsx)(`svg`,{viewBox:`0 0 256 256`,"aria-hidden":`true`,focusable:`false`,className:e,children:(0,h.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M 62 28 C 100 46, 118 60, 140 66 C 150 68, 152 80, 164 84 L 232 120 L 216 132 C 214.0 134.3, 208.3 141.7, 204.0 146.0 C 199.7 150.3, 194.0 154.7, 190.0 158.0 C 186.0 161.3, 182.3 162.3, 180.0 166.0 C 177.7 169.7, 176.3 175.0, 176.0 180.0 C 175.7 185.0, 179.0 191.0, 178.0 196.0 C 177.0 201.0, 174.0 207.3, 170.0 210.0 C 166.0 212.7, 158.0 213.7, 154.0 212.0 C 150.0 210.3, 147.3 204.3, 146.0 200.0 C 144.7 195.7, 147.0 189.7, 146.0 186.0 C 145.0 182.3, 143.0 178.7, 140.0 178.0 C 137.0 177.3, 131.3 179.0, 128.0 182.0 C 124.7 185.0, 121.3 190.7, 120.0 196.0 C 118.7 201.3, 121.3 208.0, 120.0 214.0 C 118.7 220.0, 115.7 228.3, 112.0 232.0 C 108.3 235.7, 102.3 237.0, 98.0 236.0 C 93.7 235.0, 88.3 230.7, 86.0 226.0 C 83.7 221.3, 84.0 213.3, 84.0 208.0 C 84.0 202.7, 86.7 197.3, 86.0 194.0 C 85.3 190.7, 82.7 187.7, 80.0 188.0 C 77.3 188.3, 72.7 193.3, 70.0 196.0 C 67.3 198.7, 65.3 202.3, 64.0 204.0 C 62.7 205.7, 62.3 205.7, 62.0 206.0 Q 56 118, 62 28 Z M 100 84 L 170 122 L 100 160 Z`})})}var Jx=[`Tokens in and out per stage, with provider and model`,`Audio seconds per segment`,`Images made`,`Thumbnails made`,`Videos rendered`,`PDF documents made`,`YouTube descriptions written`,`Shorts made`,`Projects created`,`That this machine installed Slopify`,`The time each of those happened`],Yx=[`API keys`,`Prompt bodies`,`Keyword values`,`Titles`,`Article or research text`,`Files and filenames`,`OS, locale, hardware`];function Xx(){let{api:e}=R(),t=_(),n=N(Jy(e)),r=P({mutationFn:()=>Ko(e),onSuccess:e=>{t.setQueryData(z.notice,e)}}),i=n.data?.seen===!1,a=n.data?.appVersion;return(0,h.jsxs)(Ey,{open:i,dismissible:!1,title:`Anonymous usage stats`,description:`These numbers power the live counters on slopify.stream.`,footer:(0,h.jsx)(L,{autoFocus:!0,variant:`primary`,disabled:r.isPending,onClick:()=>{r.mutate()},children:`Got it`}),children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,h.jsx)(Zx,{heading:`Tracked`,items:Jx}),(0,h.jsx)(Zx,{heading:`Never tracked`,items:Yx})]}),(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`Every event carries a random ID of its own and this machine's random ID, and nothing else. Nothing you write, upload, or paste ever leaves your machine.`}),a===void 0?null:(0,h.jsx)(`p`,{className:`engraved text-ink-3`,children:`Slopify ${a} · this version is included in each report`}),r.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:r.error.message})]})}function Zx({heading:e,items:t}){let n=`notice-${e.replace(/\s+/g,`-`).toLowerCase()}`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`p`,{id:n,className:`engraved border-b border-line pb-1 text-ink-3`,children:e}),(0,h.jsx)(`ul`,{"aria-labelledby":n,className:`m-0 flex list-none flex-col gap-2 p-0 text-small`,children:t.map(e=>(0,h.jsx)(`li`,{children:e},e))})]})}function Qx(e,t){if(t===`system`){e.removeAttribute(`data-theme`);return}e.setAttribute(`data-theme`,t)}function $x(){let{api:e}=R(),t=N(tb(e)).data?.appearance??`system`;return(0,m.useEffect)(()=>{Qx(document.documentElement,t)},[t]),null}function eS({reload:e}){let{version:t}=R(),n=(0,m.useSyncExternalStore)(t.subscribe,t.staleAt,t.staleAt);return(0,h.jsx)(Ey,{open:n!==void 0,dismissible:!1,title:`Slopify was updated`,description:`This tab was loaded before the update. Version ${n??``} is running now; reload to catch up.`,footer:(0,h.jsx)(L,{autoFocus:!0,variant:`primary`,onClick:e,children:`Reload`})})}var tS=[`stage.state`,`stage.progress`,`article.delta`,`llm.preview`,`image.landed`,`narration.piece`,`project.state`,`project.updated`,`review.flagged`],nS=[`running.count`,`staging.progress`,`staging.failed`,`project.updated`,`project.state`,`schedule.topics`,`review.flagged`,`stage.state`,`stage.progress`];function rS(e,t,n){return aS(e,t,tS,n.refetch,e=>{if(n.accept?.(e)!==!1){if(e.type===`llm.preview`){n.previewWriting?.(e);return}if(e.type===`narration.piece`){n.narrationPiece?.();return}if(e.type===`article.delta`){n.appendArticle(e.text);return}if(e.type===`image.landed`||e.type===`project.updated`||e.type===`review.flagged`){n.refetch();return}n.patch(e),e.type===`stage.state`&&n.refetch()}})}function iS(e,t,n){return aS(e,t,nS,n.refetch,e=>{if(e.type===`running.count`){n.tally(e.count);return}if(e.type===`project.updated`||e.type===`project.state`||e.type===`stage.state`||e.type===`stage.progress`){e.type===`project.state`&&n.projectState?.(e),n.refetch(e.projectId);return}if(e.type===`schedule.topics`){n.scheduleTopics?.(e);return}if(e.type===`review.flagged`){n.reviewFlagged?.(e),n.refetch(e.projectId);return}n.stagingChanged()})}function aS(e,t,n,r,i){let a=e(t),o=!1;a.addEventListener(`open`,()=>{o&&r(),o=!0});for(let e of n)a.addEventListener(e,t=>{let n=oS(t.data);n.type===e&&i(n)});return()=>{a.close()}}function oS(e){return JSON.parse(e)}var sS=[`16:9`,`9:16`,`1:1`],cS=[`research`,`article`,`audio`,`images`,`thumbnail`,`video`,`document`],lS=[`running`,`paused`,`canceled`,`failed`,`partial`,`done`,`pending`],uS=[`generate`,`provide`,`off`,`from_prompt`,`prompt_by_llm`];function dS(e,t){return e[t]??`off`}var fS=[`zoom`,`pan`,`mixed`,`still`],pS=[`text`,`llm`];function mS(e){return e.thumbnailCount===3&&(e.sources.thumbnail===`from_prompt`||e.sources.thumbnail===`prompt_by_llm`)?3:1}var hS=[`prompt`,`provide`],gS=[`video`,`short`],_S=[`plain`],vS=`dicemaster`,yS=[..._S,vS],bS={plain:`Plain`,dicemaster:`DiceMaster`};function xS(e){return e?.theme??`dicemaster`}function SS(e){return e?.theme??`plain`}function CS(e){return e?.custom?.name??bS[xS(e)]}function wS(e){let t=e.trim();return t===``?[{field:`name`,message:`Give the theme a name.`}]:t.length>80?[{field:`name`,message:`Keep the name under 80 characters.`}]:[]}function TS(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ES(e,t=`|`){return e.map(e=>GS(e)).join(t)}function DS(e,t){return typeof t==`bigint`?t.toString():t}function OS(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function kS(e){return e==null}function AS(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function jS(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function MS(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function NS(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function PS(e){return JSON.stringify(e)}function FS(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var IS=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function LS(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var RS=OS(()=>{if(AC.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function zS(e){if(LS(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return LS(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function BS(e){return zS(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var VS=new Set([`string`,`number`,`symbol`]);function HS(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function US(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function WS(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function GS(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function KS(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var qS={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function JS(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return US(e,NS(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&MS(e,r,n.shape[r])}return MS(this,`shape`,e),e},checks:[]}))}function YS(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return US(e,NS(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return MS(this,`shape`,r),r},checks:[]}))}function XS(e,t){if(!zS(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return US(e,NS(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return MS(this,`shape`,n),n}}))}function ZS(e,t){if(!zS(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return US(e,NS(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return MS(this,`shape`,n),n}}))}function QS(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return US(e,NS(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return MS(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $S(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return US(t,NS(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return MS(this,`shape`,i),i},checks:[]}))}function eC(e,t,n){return US(t,NS(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return MS(this,`shape`,i),i}}))}function tC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rC(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function iC(e){return typeof e==`string`?e:e?.message}function aC(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function oC(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:iC(e.inst?._zod.def?.error?.(e))??iC(a?.(e))??iC(t?.error?.(e))??iC(n.customError?.(e))??iC(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}var sC=/[\uD800-\uDBFF]/;function cC(e){let t=e.length;if(!sC.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function lC(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function uC(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function dC(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function fC(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):hC(e,n,r.value)}}function pC(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function mC(e,t,n){return pC(e,t,n,!1)}function hC(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:pC(this,t,n.bind(this))},set(e){pC(this,t,e)}})}function gC(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var _C,vC=!1,yC={configurable:!0,get(){vC=!0}};function bC(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&_C!==e._zod){_C=void 0;return}_C=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,yC);let e=vC;vC=!1;try{let r=n(this);return vC?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),vC||=e,r}catch(n){throw delete this[t],vC||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function xC(e,t,n,r){let i=gC(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var SC=`~constantCatch`;function CC(e){let t=()=>e;return t[SC]=!0,t}var wC,TC={value:void 0,enumerable:!1},EC=`captureStackTrace`in Error?Error:null;function DC(e){let t=EC;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return EC=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function H(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){TC.value=new a(r);try{Object.defineProperty(n,"_zod",TC)}finally{TC.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),fC(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?DC(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var OC=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},kC=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(wC=globalThis).__zod_globalConfig??(wC.__zod_globalConfig={});var AC=globalThis.__zod_globalConfig;function jC(e){return e&&Object.assign(AC,e),AC}function MC(){let e=this._zod;return e.message??=JSON.stringify(e.def,DS,2),e.message}function NC(e){this._zod.message=e}var PC={get:MC,set:NC,enumerable:!0,configurable:!0},FC={value:void 0,enumerable:!1},IC={value:void 0,enumerable:!1},LC=new WeakSet([Object.prototype,Error.prototype]),RC=(e,t)=>{e.name=`$ZodError`,FC.value=e._zod,Object.defineProperty(e,"_zod",FC),IC.value=t,Object.defineProperty(e,"issues",IC),FC.value=void 0,IC.value=void 0,Object.defineProperty(e,"message",PC);let n=Object.getPrototypeOf(e);LC.has(n)||(LC.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},zC=H(`$ZodError`,RC),BC=H(`$ZodError`,RC,void 0,{Parent:Error});function VC(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function HC(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?VC(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function UC(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function WC(e,t){return{callee:t?.callee??e,Err:t?.Err}}var GC=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new OC;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>oC(e,o,jC())));throw IS(n,a?.callee??t),n}return s.value};return t},KC=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>oC(e,o,jC())));throw IS(n,a?.callee??t),n}return s.value};return t},qC=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new OC;return a.issues.length?{success:!1,error:new(e??zC)(a.issues.map(e=>oC(e,i,jC())))}:{success:!0,data:a.value}},JC=qC(BC),YC=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>oC(e,i,jC())))}:{success:!0,data:a.value}},XC=YC(BC),ZC=e=>{let t=GC(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,WC(n,a))};return n},QC=e=>{let t=GC(e),n=(e,r,i,a)=>t(e,r,i,WC(n,a));return n},$C=e=>{let t=KC(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,WC(n,a))};return n},ew=e=>{let t=KC(e),n=async(e,r,i,a)=>await t(e,r,i,WC(n,a));return n},tw=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qC(e)(t,n,i)},nw=e=>(t,n,r)=>qC(e)(t,n,r),rw=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return YC(e)(t,n,i)},iw=e=>async(t,n,r)=>YC(e)(t,n,r),aw=/^[cC][0-9a-z]{6,}$/,ow=/^[0-9a-z]+$/,sw=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,cw=/^[0-9a-vA-V]{20}$/,lw=/^[A-Za-z0-9]{27}$/,uw=/^[a-zA-Z0-9_-]{21}$/;function dw(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var fw=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pw=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mw=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,hw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gw=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function _w(){return new RegExp(gw,`u`)}var vw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,yw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,bw=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,xw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cw=/^[A-Za-z0-9_-]*$/,ww=/^https?$/,Tw=/^\+[1-9]\d{6,14}$/,Ew=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Dw(e){return RegExp(`^${e}$`)}var Ow=Dw(Ew);function kw(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Aw(e){return RegExp(`^${kw(e)}$`)}function jw(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${kw({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${kw({precision:e.precision})}`:n;return RegExp(`^${Ew}T(?:${r})$`)}var Mw=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Nw=/^-?\d+$/,Pw=/^-?\d+(?:\.\d+)?$/,Fw=/^(?:true|false)$/i,Iw=/^null$/i,Lw=/^[^A-Z]*$/,Rw=/^[^a-z]*$/,zw=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Bw=e=>{let t=e.value;return!kS(t)&&t.length!==void 0},Vw={number:`number`,bigint:`bigint`,object:`date`},Hw=H(`$ZodCheckLessThan`,(e,t)=>{zw.init(e,t);let n=Vw[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Vw[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Uw=H(`$ZodCheckGreaterThan`,(e,t)=>{zw.init(e,t);let n=Vw[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Vw[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ww=H(`$ZodCheckMultipleOf`,(e,t)=>{zw.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):jS(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Gw=H(`$ZodCheckNumberFormat`,(e,t)=>{zw.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=qS[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Nw)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Kw=H(`$ZodCheckMaxLength`,(e,t)=>{var n;zw.init(e,t),(n=e._zod.def).when??(n.when=Bw),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?cC(r):i)<=t.maximum)return;let a=lC(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qw=H(`$ZodCheckMinLength`,(e,t)=>{var n;zw.init(e,t),(n=e._zod.def).when??(n.when=Bw),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?cC(r):i)>=t.minimum)return;let a=lC(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jw=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;zw.init(e,t),(n=e._zod.def).when??(n.when=Bw),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?cC(r):i;if(a===t.length)return;let o=lC(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Yw=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;zw.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Xw=H(`$ZodCheckRegex`,(e,t)=>{Yw.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Zw=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Lw,Yw.init(e,t)}),Qw=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Rw,Yw.init(e,t)}),$w=H(`$ZodCheckIncludes`,(e,t)=>{zw.init(e,t);let n=HS(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),eT=H(`$ZodCheckStartsWith`,(e,t)=>{zw.init(e,t);let n=RegExp(`^${HS(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),tT=H(`$ZodCheckEndsWith`,(e,t)=>{zw.init(e,t);let n=RegExp(`.*${HS(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),nT=H(`$ZodCheckOverwrite`,(e,t)=>{zw.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),rT=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
53
53
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
54
54
|
`)}\n};`)(...Object.values(this.closed))}},iT={major:4,minor:5,patch:4},aT=H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=iT;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=tC(t),a;for(let o of n){if(o._zod.def.when){if(nC(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new OC;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(aC(t.issues,n,e),i||=tC(t,n))});else{if(t.issues.length===n)continue;aC(t.issues,n,e),i||=tC(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(tC(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new OC;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new OC;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return mC(this,`~standard`,sT(this))},set"~standard"(e){pC(this,`~standard`,e)}}),oT=e=>e.success?{value:e.data}:{issues:e.error?.issues};function sT(e){return{validate:t=>{try{return oT(JC(e,t))}catch{return XC(e,t).then(oT)}},vendor:`zod`,version:1}}var cT=H(`$ZodString`,(e,t)=>{aT.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Mw(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),lT=H(`$ZodStringFormat`,(e,t)=>{Yw.init(e,t),cT.init(e,t)}),uT=H(`$ZodGUID`,(e,t)=>{t.pattern??=pw,lT.init(e,t)}),dT=H(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=mw(e)}else t.pattern??=mw();lT.init(e,t)}),fT=H(`$ZodEmail`,(e,t)=>{t.pattern??=hw,lT.init(e,t)});function pT(e,t){if(!t.normalize&&t.protocol?.source===ww.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}var mT=/[\t\n\r]/g;function hT(e){return e.replace(mT,``)}function gT(e,t){return t.lastIndex=0,t.test(e.hostname)}function _T(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var vT=H(`$ZodURL`,(e,t)=>{lT.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=pT(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!gT(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!_T(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:hT(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),yT=H(`$ZodEmoji`,(e,t)=>{t.pattern??=_w(),lT.init(e,t)}),bT=H(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?uw:dw(t.length),lT.init(e,t)}),xT=H(`$ZodCUID`,(e,t)=>{t.pattern??=aw,lT.init(e,t)}),ST=H(`$ZodCUID2`,(e,t)=>{t.pattern??=ow,lT.init(e,t)}),CT=H(`$ZodULID`,(e,t)=>{t.pattern??=sw,lT.init(e,t)}),wT=H(`$ZodXID`,(e,t)=>{t.pattern??=cw,lT.init(e,t)}),TT=H(`$ZodKSUID`,(e,t)=>{t.pattern??=lw,lT.init(e,t)}),ET=H(`$ZodISODateTime`,(e,t)=>{t.pattern??=jw(t),lT.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),DT=H(`$ZodISODate`,(e,t)=>{t.pattern??=Ow,lT.init(e,t)}),OT=H(`$ZodISOTime`,(e,t)=>{t.pattern??=Aw(t),lT.init(e,t)}),kT=H(`$ZodISODuration`,(e,t)=>{t.pattern??=fw,lT.init(e,t)}),AT=H(`$ZodIPv4`,(e,t)=>{t.pattern??=vw,lT.init(e,t),e._zod.bag.format=`ipv4`}),jT=/^[0-9a-fA-F:.]+$/;function MT(e){if(!jT.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var NT=H(`$ZodIPv6`,(e,t)=>{t.pattern??=yw,lT.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{MT(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),PT=H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=bw,lT.init(e,t)});function FT(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:MT(n)}var IT=H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=xw,lT.init(e,t),e._zod.check=n=>{FT(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function LT(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var RT=H(`$ZodBase64`,(e,t)=>{t.pattern??=Sw,lT.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{LT(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function zT(e){if(!Cw.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return LT(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var BT=H(`$ZodBase64URL`,(e,t)=>{t.pattern??=Cw,lT.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{zT(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),VT=H(`$ZodE164`,(e,t)=>{t.pattern??=Tw,lT.init(e,t)});function HT(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var UT=H(`$ZodJWT`,(e,t)=>{lT.init(e,t),e._zod.check=n=>{HT(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),WT=H(`$ZodNumber`,(e,t)=>{aT.init(e,t),e._zod.pattern=e._zod.bag.pattern??Pw,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),GT=H(`$ZodNumberFormat`,(e,t)=>{Gw.init(e,t),WT.init(e,t)}),KT=H(`$ZodBoolean`,(e,t)=>{aT.init(e,t),e._zod.pattern=Fw,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),qT=H(`$ZodNull`,(e,t)=>{aT.init(e,t),e._zod.pattern=Iw,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),JT=H(`$ZodUnknown`,(e,t)=>{aT.init(e,t),e._zod.parse=e=>e}),YT=H(`$ZodNever`,(e,t)=>{aT.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function XT(e,t,n){e.issues.length&&t.issues.push(...rC(n,e.issues)),t.value[n]=e.value}var ZT=H(`$ZodArray`,(e,t)=>{aT.init(e,t);let n=AC.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>XT(t,r,e))):XT(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function QT(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...rC(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}var $T=[];function eE(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:$T,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=KS(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function tE(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>QT(e,n,i,t,u,d))):QT(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var nE=new WeakMap,rE=H(`$ZodObject`,(e,t)=>{if(aT.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;nE.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),nE.set(t,n),n}})}let n=OS(()=>eE(t));bC(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||MS(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=LS,i=t.catchall,a,o=AC.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>QT(n,t,e,c,r,i))):QT(a,t,e,c,r,i)}return i?tE(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),iE=H(`$ZodObjectJIT`,(e,t)=>{rE.init(e,t);let n=e._zod.parse,r=OS(()=>eE(t)),i=AC.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new rT([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
55
55
|
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
@@ -268,9 +268,9 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
268
268
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function f(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function p(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(m=function(){return!!e})()}function h(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function g(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
269
269
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return i(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function y(e,t){return r(e)||h(e,t)||C(e,t)||g()}function b(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function x(e){var t=b(e,`string`);return typeof t==`symbol`?t:t+``}function S(e){"@babel/helpers - typeof";return S=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S(e)}function C(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function w(e){var t=typeof Map==`function`?new Map:void 0;return w=function(e){function n(){return s(e,arguments,d(this).constructor)}if(e===null||!p(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,e)},w(e)}var T=function(e){var t=Math.abs,n=Math.max,r=Math.floor;function i(e,t){var n;if(o(this,i),n=a(this,i,[e]),n.sign=t,Object.setPrototypeOf(n,i.prototype),e>i.__kMaxLength)throw RangeError(`Maximum BigInt size exceeded`);return n}return f(i,e),l(i,[{key:`toDebugString`,value:function(){var e,t=[`BigInt[`],n=u(this);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push((r&&(r>>>0).toString(16))+`, `)}}catch(e){n.e(e)}finally{n.f()}return t.push(`]`),t.join(``)}},{key:`toString`,value:function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:10;if(2>e||36<e)throw RangeError(`toString() radix argument must be between 2 and 36`);return this.length===0?`0`:e&e-1?i.__toStringGeneric(this,e,!1):i.__toStringBasePowerOfTwo(this,e)}},{key:`valueOf`,value:function(){throw Error("Convert JSBI instances to native numbers using `toNumber`.")}},{key:`__copy`,value:function(){for(var e=new i(this.length,this.sign),t=0;t<this.length;t++)e[t]=this[t];return e}},{key:`__trim`,value:function(){for(var e=this.length,t=this[e-1];t===0;)e--,t=this[e-1],this.pop();return e===0&&(this.sign=!1),this}},{key:`__initializeDigits`,value:function(){for(var e=0;e<this.length;e++)this[e]=0}},{key:`__clzmsd`,value:function(){return i.__clz30(this.__digit(this.length-1))}},{key:`__inplaceMultiplyAdd`,value:function(e,t,n){n>this.length&&(n=this.length);for(var r=32767&e,a=e>>>15,o=0,s=t,c=0;c<n;c++){var l=this.__digit(c),u=32767&l,d=l>>>15,f=i.__imul(u,r),p=i.__imul(u,a),m=i.__imul(d,r),h=i.__imul(d,a),g=s+f+o;o=g>>>30,g&=1073741823,g+=((32767&p)<<15)+((32767&m)<<15),o+=g>>>30,s=h+(p>>>15)+(m>>>15),this.__setDigit(c,1073741823&g)}if(o!==0||s!==0)throw Error(`implementation bug`)}},{key:`__inplaceAdd`,value:function(e,t,n){for(var r,i=0,a=0;a<n;a++)r=this.__halfDigit(t+a)+e.__halfDigit(a)+i,i=r>>>15,this.__setHalfDigit(t+a,32767&r);return i}},{key:`__inplaceSub`,value:function(e,t,n){var r=n-1>>>1,i=0;if(1&t){t>>=1;for(var a=this.__digit(t),o=32767&a,s=0;s<r;s++){var c=e.__digit(s),l=(a>>>15)-(32767&c)-i;i=1&l>>>15,this.__setDigit(t+s,(32767&l)<<15|32767&o),a=this.__digit(t+s+1),o=(32767&a)-(c>>>15)-i,i=1&o>>>15}var u=e.__digit(s),d=(a>>>15)-(32767&u)-i;i=1&d>>>15,this.__setDigit(t+s,(32767&d)<<15|32767&o);var f=u>>>15;if(t+s+1>=this.length)throw RangeError(`out of bounds`);!(1&n)&&(a=this.__digit(t+s+1),o=(32767&a)-f-i,i=1&o>>>15,this.__setDigit(t+e.length,1073709056&a|32767&o))}else{t>>=1;for(var p=0;p<e.length-1;p++){var m=this.__digit(t+p),h=e.__digit(p),g=(32767&m)-(32767&h)-i;i=1&g>>>15;var _=(m>>>15)-(h>>>15)-i;i=1&_>>>15,this.__setDigit(t+p,(32767&_)<<15|32767&g)}var v=this.__digit(t+p),y=e.__digit(p),b=(32767&v)-(32767&y)-i;i=1&b>>>15;var x=0;!(1&n)&&(x=(v>>>15)-(y>>>15)-i,i=1&x>>>15),this.__setDigit(t+p,(32767&x)<<15|32767&b)}return i}},{key:`__inplaceRightShift`,value:function(e){if(e!==0){for(var t,n=this.__digit(0)>>>e,r=this.length-1,i=0;i<r;i++)t=this.__digit(i+1),this.__setDigit(i,1073741823&t<<30-e|n),n=t>>>e;this.__setDigit(r,n)}}},{key:`__digit`,value:function(e){return this[e]}},{key:`__unsignedDigit`,value:function(e){return this[e]>>>0}},{key:`__setDigit`,value:function(e,t){this[e]=0|t}},{key:`__setDigitGrow`,value:function(e,t){this[e]=0|t}},{key:`__halfDigitLength`,value:function(){var e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}},{key:`__halfDigit`,value:function(e){return 32767&this[e>>>1]>>>15*(1&e)}},{key:`__setHalfDigit`,value:function(e,t){var n=e>>>1,r=this.__digit(n),i=1&e?32767&r|t<<15:1073709056&r|32767&t;this.__setDigit(n,i)}}],[{key:`BigInt`,value:function(e){var t=Number.isFinite;if(typeof e==`number`){if(e===0)return i.__zero();if(i.__isOneDigitInt(e))return 0>e?i.__oneDigit(-e,!0):i.__oneDigit(e,!1);if(!t(e)||r(e)!==e)throw RangeError(`The number `+e+` cannot be converted to BigInt because it is not an integer`);return i.__fromDouble(e)}if(typeof e==`string`){var n=i.__fromString(e);if(n===null)throw SyntaxError(`Cannot convert `+e+` to a BigInt`);return n}if(typeof e==`boolean`)return!0===e?i.__oneDigit(1,!1):i.__zero();if(S(e)===`object`){if(e.constructor===i)return e;var a=i.__toPrimitive(e);return i.BigInt(a)}throw TypeError(`Cannot convert `+e+` to a BigInt`)}},{key:`toNumber`,value:function(e){var t=e.length;if(t===0)return 0;if(t===1){var n=e.__unsignedDigit(0);return e.sign?-n:n}var r=e.__digit(t-1),a=i.__clz30(r),o=30*t-a;if(1024<o)return e.sign?-1/0:1/0;var s=o-1,c=r,l=t-1,u=a+3,d=u===32?0:c<<u;d>>>=12;var f=u-12,p=12<=u?0:c<<20+u,m=20+u;for(0<f&&0<l&&(l--,c=e.__digit(l),d|=c>>>30-f,p=c<<f+2,m=f+2);0<m&&0<l;)l--,c=e.__digit(l),p|=30<=m?c<<m-30:c>>>30-m,m-=30;var h=i.__decideRounding(e,m,l,c);if((h===1||h===0&&(1&p)==1)&&(p=p+1>>>0,p===0&&(d++,d>>>20&&(d=0,s++,1023<s))))return e.sign?-1/0:1/0;var g=e.sign?-2147483648:0;return s=s+1023<<20,i.__kBitConversionInts[i.__kBitConversionIntHigh]=g|s|d,i.__kBitConversionInts[i.__kBitConversionIntLow]=p,i.__kBitConversionDouble[0]}},{key:`unaryMinus`,value:function(e){if(e.length===0)return e;var t=e.__copy();return t.sign=!e.sign,t}},{key:`bitwiseNot`,value:function(e){return e.sign?i.__absoluteSubOne(e).__trim():i.__absoluteAddOne(e,!0)}},{key:`exponentiate`,value:function(e,t){if(t.sign)throw RangeError(`Exponent must be positive`);if(t.length===0)return i.__oneDigit(1,!1);if(e.length===0)return e;if(e.length===1&&e.__digit(0)===1)return e.sign&&!(1&t.__digit(0))?i.unaryMinus(e):e;if(1<t.length)throw RangeError(`BigInt too big`);var n=t.__unsignedDigit(0);if(n===1)return e;if(n>=i.__kMaxLengthBits)throw RangeError(`BigInt too big`);if(e.length===1&&e.__digit(0)===2){var r=1+(0|n/30),a=new i(r,e.sign&&!!(1&n));a.__initializeDigits();var o=1<<n%30;return a.__setDigit(r-1,o),a}var s=null,c=e;for(1&n&&(s=e),n>>=1;n!==0;n>>=1)c=i.multiply(c,c),1&n&&(s=s===null?c:i.multiply(s,c));return s}},{key:`multiply`,value:function(e,t){if(e.length===0)return e;if(t.length===0)return t;var n=e.length+t.length;30<=e.__clzmsd()+t.__clzmsd()&&n--;var r=new i(n,e.sign!==t.sign);r.__initializeDigits();for(var a=0;a<e.length;a++)i.__multiplyAccumulate(t,e.__digit(a),r,a);return r.__trim()}},{key:`divide`,value:function(e,t){if(t.length===0)throw RangeError(`Division by zero`);if(0>i.__absoluteCompare(e,t))return i.__zero();var n,r=e.sign!==t.sign,a=t.__unsignedDigit(0);if(t.length===1&&32767>=a){if(a===1)return r===e.sign?e:i.unaryMinus(e);n=i.__absoluteDivSmall(e,a,null)}else n=i.__absoluteDivLarge(e,t,!0,!1);return n.sign=r,n.__trim()}},{key:`remainder`,value:function(e,t){if(t.length===0)throw RangeError(`Division by zero`);if(0>i.__absoluteCompare(e,t))return e;var n=t.__unsignedDigit(0);if(t.length===1&&32767>=n){if(n===1)return i.__zero();var r=i.__absoluteModSmall(e,n);return r===0?i.__zero():i.__oneDigit(r,e.sign)}var a=i.__absoluteDivLarge(e,t,!1,!0);return a.sign=e.sign,a.__trim()}},{key:`add`,value:function(e,t){var n=e.sign;return n===t.sign?i.__absoluteAdd(e,t,n):0<=i.__absoluteCompare(e,t)?i.__absoluteSub(e,t,n):i.__absoluteSub(t,e,!n)}},{key:`subtract`,value:function(e,t){var n=e.sign;return n===t.sign?0<=i.__absoluteCompare(e,t)?i.__absoluteSub(e,t,n):i.__absoluteSub(t,e,!n):i.__absoluteAdd(e,t,n)}},{key:`leftShift`,value:function(e,t){return t.length===0||e.length===0?e:t.sign?i.__rightShiftByAbsolute(e,t):i.__leftShiftByAbsolute(e,t)}},{key:`signedRightShift`,value:function(e,t){return t.length===0||e.length===0?e:t.sign?i.__leftShiftByAbsolute(e,t):i.__rightShiftByAbsolute(e,t)}},{key:`unsignedRightShift`,value:function(){throw TypeError(`BigInts have no unsigned right shift; use >> instead`)}},{key:`lessThan`,value:function(e,t){return 0>i.__compareToBigInt(e,t)}},{key:`lessThanOrEqual`,value:function(e,t){return 0>=i.__compareToBigInt(e,t)}},{key:`greaterThan`,value:function(e,t){return 0<i.__compareToBigInt(e,t)}},{key:`greaterThanOrEqual`,value:function(e,t){return 0<=i.__compareToBigInt(e,t)}},{key:`equal`,value:function(e,t){if(e.sign!==t.sign||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e.__digit(n)!==t.__digit(n))return!1;return!0}},{key:`notEqual`,value:function(e,t){return!i.equal(e,t)}},{key:`bitwiseAnd`,value:function(e,t){if(!e.sign&&!t.sign)return i.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){var r=n(e.length,t.length)+1,a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return a=i.__absoluteOr(a,o,a),i.__absoluteAddOne(a,!0,a).__trim()}if(e.sign){var s=[t,e];e=s[0],t=s[1]}return i.__absoluteAndNot(e,i.__absoluteSubOne(t)).__trim()}},{key:`bitwiseXor`,value:function(e,t){if(!e.sign&&!t.sign)return i.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){var r=n(e.length,t.length),a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return i.__absoluteXor(a,o,a).__trim()}var s=n(e.length,t.length)+1;if(e.sign){var c=[t,e];e=c[0],t=c[1]}var l=i.__absoluteSubOne(t,s);return l=i.__absoluteXor(l,e,l),i.__absoluteAddOne(l,!0,l).__trim()}},{key:`bitwiseOr`,value:function(e,t){var r=n(e.length,t.length);if(!e.sign&&!t.sign)return i.__absoluteOr(e,t).__trim();if(e.sign&&t.sign){var a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return a=i.__absoluteAnd(a,o,a),i.__absoluteAddOne(a,!0,a).__trim()}if(e.sign){var s=[t,e];e=s[0],t=s[1]}var c=i.__absoluteSubOne(t,r);return c=i.__absoluteAndNot(c,e,c),i.__absoluteAddOne(c,!0,c).__trim()}},{key:`asIntN`,value:function(e,t){if(t.length===0)return t;if(e=r(e),0>e)throw RangeError(`Invalid value: not (convertible to) a safe integer`);if(e===0)return i.__zero();if(e>=i.__kMaxLengthBits)return t;var n=0|(e+29)/30;if(t.length<n)return t;var a=t.__unsignedDigit(n-1),o=1<<(e-1)%30;if(t.length===n&&a<o)return t;if((a&o)!==o)return i.__truncateToNBits(e,t);if(!t.sign)return i.__truncateAndSubFromPowerOfTwo(e,t,!0);if(!(a&o-1)){for(var s=n-2;0<=s;s--)if(t.__digit(s)!==0)return i.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===n&&a===o?t:i.__truncateToNBits(e,t)}return i.__truncateAndSubFromPowerOfTwo(e,t,!1)}},{key:`asUintN`,value:function(e,t){if(t.length===0)return t;if(e=r(e),0>e)throw RangeError(`Invalid value: not (convertible to) a safe integer`);if(e===0)return i.__zero();if(t.sign){if(e>i.__kMaxLengthBits)throw RangeError(`BigInt too big`);return i.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=i.__kMaxLengthBits)return t;var n=0|(e+29)/30;if(t.length<n)return t;var a=e%30;return t.length==n&&(a===0||!(t.__digit(n-1)>>>a))?t:i.__truncateToNBits(e,t)}},{key:`ADD`,value:function(e,t){if(e=i.__toPrimitive(e),t=i.__toPrimitive(t),typeof e==`string`)return typeof t!=`string`&&(t=t.toString()),e+t;if(typeof t==`string`)return e.toString()+t;if(e=i.__toNumeric(e),t=i.__toNumeric(t),i.__isBigInt(e)&&i.__isBigInt(t))return i.add(e,t);if(typeof e==`number`&&typeof t==`number`)return e+t;throw TypeError(`Cannot mix BigInt and other types, use explicit conversions`)}},{key:`LT`,value:function(e,t){return i.__compare(e,t,0)}},{key:`LE`,value:function(e,t){return i.__compare(e,t,1)}},{key:`GT`,value:function(e,t){return i.__compare(e,t,2)}},{key:`GE`,value:function(e,t){return i.__compare(e,t,3)}},{key:`EQ`,value:function(e,t){for(;;){if(i.__isBigInt(e))return i.__isBigInt(t)?i.equal(e,t):i.EQ(t,e);if(typeof e==`number`){if(i.__isBigInt(t))return i.__equalToNumber(t,e);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(typeof e==`string`){if(i.__isBigInt(t))return e=i.__fromString(e),e!==null&&i.equal(e,t);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(typeof e==`boolean`){if(i.__isBigInt(t))return i.__equalToNumber(t,+e);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(S(e)===`symbol`){if(i.__isBigInt(t))return!1;if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(S(e)===`object`){if(S(t)===`object`&&t.constructor!==i)return e==t;e=i.__toPrimitive(e)}else return e==t}}},{key:`NE`,value:function(e,t){return!i.EQ(e,t)}},{key:`DataViewGetBigInt64`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return i.asIntN(64,i.DataViewGetBigUint64(e,t,n))}},{key:`DataViewGetBigUint64`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0&&arguments[2],r=y(n?[4,0]:[0,4],2),a=r[0],o=r[1],s=e.getUint32(t+a,n),c=e.getUint32(t+o,n),l=new i(3,!1);return l.__setDigit(0,1073741823&c),l.__setDigit(1,(268435455&s)<<2|c>>>30),l.__setDigit(2,s>>>28),l.__trim()}},{key:`DataViewSetBigInt64`,value:function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0&&arguments[3];i.DataViewSetBigUint64(e,t,n,r)}},{key:`DataViewSetBigUint64`,value:function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0&&arguments[3];n=i.asUintN(64,n);var a=0,o=0;if(0<n.length&&(o=n.__digit(0),1<n.length)){var s=n.__digit(1);o|=s<<30,a=s>>>2,2<n.length&&(a|=n.__digit(2)<<28)}var c=y(r?[4,0]:[0,4],2),l=c[0],u=c[1];e.setUint32(t+l,a,r),e.setUint32(t+u,o,r)}},{key:`__zero`,value:function(){return new i(0,!1)}},{key:`__oneDigit`,value:function(e,t){var n=new i(1,t);return n.__setDigit(0,e),n}},{key:`__decideRounding`,value:function(e,t,n,r){if(0<t)return-1;var i;if(0>t)i=-t-1;else{if(n===0)return-1;n--,r=e.__digit(n),i=29}var a=1<<i;if((r&a)==0)return-1;if(--a,(r&a)!=0)return 1;for(;0<n;)if(n--,e.__digit(n)!==0)return 1;return 0}},{key:`__fromDouble`,value:function(e){var t=0>e;i.__kBitConversionDouble[0]=e;var n,r=(2047&i.__kBitConversionInts[i.__kBitConversionIntHigh]>>>20)-1023,a=(0|r/30)+1,o=new i(a,t),s=1048575&i.__kBitConversionInts[i.__kBitConversionIntHigh]|1048576,c=i.__kBitConversionInts[i.__kBitConversionIntLow],l=20,u=r%30,d=0;if(u<l){var f=l-u;d=f+32,n=s>>>f,s=s<<32-f|c>>>f,c<<=32-f}else if(u===l)d=32,n=s,s=c,c=0;else{var p=u-l;d=32-p,n=s<<p|c>>>32-p,s=c<<p,c=0}o.__setDigit(a-1,n);for(var m=a-2;0<=m;m--)0<d?(d-=30,n=s>>>2,s=s<<30|c>>>2,c<<=30):n=0,o.__setDigit(m,n);return o.__trim()}},{key:`__isWhitespace`,value:function(e){return 13>=e&&9<=e||(159>=e?e==32:131071>=e?e==160||e==5760:196607>=e?(e&=131071,10>=e||e==40||e==41||e==47||e==95||e==4096):e==65279)}},{key:`__fromString`,value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,n=0,r=e.length,a=0;if(a===r)return i.__zero();for(var o=e.charCodeAt(a);i.__isWhitespace(o);){if(++a===r)return i.__zero();o=e.charCodeAt(a)}if(o===43){if(++a===r)return null;o=e.charCodeAt(a),n=1}else if(o===45){if(++a===r)return null;o=e.charCodeAt(a),n=-1}if(t===0){if(t=10,o===48){if(++a===r)return i.__zero();if(o=e.charCodeAt(a),o===88||o===120){if(t=16,++a===r)return null;o=e.charCodeAt(a)}else if(o===79||o===111){if(t=8,++a===r)return null;o=e.charCodeAt(a)}else if(o===66||o===98){if(t=2,++a===r)return null;o=e.charCodeAt(a)}}}else if(t===16&&o===48){if(++a===r)return i.__zero();if(o=e.charCodeAt(a),o===88||o===120){if(++a===r)return null;o=e.charCodeAt(a)}}if(n!==0&&t!==10)return null;for(;o===48;){if(++a===r)return i.__zero();o=e.charCodeAt(a)}var s=r-a,c=i.__kMaxBitsPerChar[t],l=i.__kBitsPerCharTableMultiplier-1;if(s>1073741824/c)return null;var u=new i(0|((c*s+l>>>i.__kBitsPerCharTableShift)+29)/30,!1),d=10>t?t:10,f=10<t?t-10:0;if(t&t-1){u.__initializeDigits();var p=!1,m=0;do{for(var h,g=0,_=1;;){if(h=void 0,o-48>>>0<d)h=o-48;else if((32|o)-97>>>0<f)h=(32|o)-87;else{p=!0;break}var v=_*t;if(1073741823<v)break;if(_=v,g=g*t+h,m++,++a===r){p=!0;break}o=e.charCodeAt(a)}l=30*i.__kBitsPerCharTableMultiplier-1;var y=0|(c*m+l>>>i.__kBitsPerCharTableShift)/30;u.__inplaceMultiplyAdd(_,g,y)}while(!p)}else{c>>=i.__kBitsPerCharTableShift;var b=[],x=[],S=!1;do{for(var C,w=0,T=0;;){if(C=void 0,o-48>>>0<d)C=o-48;else if((32|o)-97>>>0<f)C=(32|o)-87;else{S=!0;break}if(T+=c,w=w<<c|C,++a===r){S=!0;break}if(o=e.charCodeAt(a),30<T+c)break}b.push(w),x.push(T)}while(!S);i.__fillFromParts(u,b,x)}if(a!==r){if(!i.__isWhitespace(o))return null;for(a++;a<r;a++)if(o=e.charCodeAt(a),!i.__isWhitespace(o))return null}return u.sign=n===-1,u.__trim()}},{key:`__fillFromParts`,value:function(e,t,n){for(var r=0,i=0,a=0,o=t.length-1;0<=o;o--){var s=t[o],c=n[o];i|=s<<a,a+=c,a===30?(e.__setDigit(r++,i),a=0,i=0):30<a&&(e.__setDigit(r++,1073741823&i),a-=30,i=s>>>c-a)}if(i!==0){if(r>=e.length)throw Error(`implementation bug`);e.__setDigit(r++,i)}for(;r<e.length;r++)e.__setDigit(r,0)}},{key:`__toStringBasePowerOfTwo`,value:function(e,t){var n=e.length,r=t-1;r=(85&r>>>1)+(85&r),r=(51&r>>>2)+(51&r),r=(15&r>>>4)+(15&r);var a=r,o=t-1,s=e.__digit(n-1),c=i.__clz30(s),l=0|(30*n-c+a-1)/a;if(e.sign&&l++,268435456<l)throw Error(`string too long`);for(var u=Array(l),d=l-1,f=0,p=0,m=0;m<n-1;m++){var h=e.__digit(m),g=(f|h<<p)&o;u[d--]=i.__kConversionChars[g];var _=a-p;for(f=h>>>_,p=30-_;p>=a;)u[d--]=i.__kConversionChars[f&o],f>>>=a,p-=a}var v=(f|s<<p)&o;for(u[d--]=i.__kConversionChars[v],f=s>>>a-p;f!==0;)u[d--]=i.__kConversionChars[f&o],f>>>=a;if(e.sign&&(u[d--]=`-`),d!==-1)throw Error(`implementation bug`);return u.join(``)}},{key:`__toStringGeneric`,value:function(e,t,n){var r=e.length;if(r===0)return``;if(r===1){var a=e.__unsignedDigit(0).toString(t);return!1===n&&e.sign&&(a=`-`+a),a}var o=30*r-i.__clz30(e.__digit(r-1)),s=i.__kMaxBitsPerChar[t]-1,c=o*i.__kBitsPerCharTableMultiplier;c+=s-1,c=0|c/s;var l,u,d=c+1>>1,f=i.exponentiate(i.__oneDigit(t,!1),i.__oneDigit(d,!1)),p=f.__unsignedDigit(0);if(f.length===1&&32767>=p){l=new i(e.length,!1),l.__initializeDigits();for(var m,h=0,g=2*e.length-1;0<=g;g--)m=h<<15|e.__halfDigit(g),l.__setHalfDigit(g,0|m/p),h=0|m%p;u=h.toString(t)}else{var _=i.__absoluteDivLarge(e,f,!0,!0);l=_.quotient;var v=_.remainder.__trim();u=i.__toStringGeneric(v,t,!0)}l.__trim();for(var y=i.__toStringGeneric(l,t,!0);u.length<d;)u=`0`+u;return!1===n&&e.sign&&(y=`-`+y),y+u}},{key:`__unequalSign`,value:function(e){return e?-1:1}},{key:`__absoluteGreater`,value:function(e){return e?-1:1}},{key:`__absoluteLess`,value:function(e){return e?1:-1}},{key:`__compareToBigInt`,value:function(e,t){var n=e.sign;if(n!==t.sign)return i.__unequalSign(n);var r=i.__absoluteCompare(e,t);return 0<r?i.__absoluteGreater(n):0>r?i.__absoluteLess(n):0}},{key:`__compareToNumber`,value:function(e,n){if(i.__isOneDigitInt(n)){var r=e.sign,a=0>n;if(r!==a)return i.__unequalSign(r);if(e.length===0){if(a)throw Error(`implementation bug`);return n===0?0:-1}if(1<e.length)return i.__absoluteGreater(r);var o=t(n),s=e.__unsignedDigit(0);return s>o?i.__absoluteGreater(r):s<o?i.__absoluteLess(r):0}return i.__compareToDouble(e,n)}},{key:`__compareToDouble`,value:function(e,t){if(t!==t)return t;if(t===1/0)return-1;if(t===-1/0)return 1;var n=e.sign;if(n!==0>t)return i.__unequalSign(n);if(t===0)throw Error(`implementation bug: should be handled elsewhere`);if(e.length===0)return-1;i.__kBitConversionDouble[0]=t;var r=2047&i.__kBitConversionInts[i.__kBitConversionIntHigh]>>>20;if(r==2047)throw Error(`implementation bug: handled elsewhere`);var a=r-1023;if(0>a)return i.__absoluteGreater(n);var o=e.length,s=e.__digit(o-1),c=i.__clz30(s),l=30*o-c,u=a+1;if(l<u)return i.__absoluteLess(n);if(l>u)return i.__absoluteGreater(n);var d=1048576|1048575&i.__kBitConversionInts[i.__kBitConversionIntHigh],f=i.__kBitConversionInts[i.__kBitConversionIntLow],p=20,m=29-c;if(m!==(0|(l-1)%30))throw Error(`implementation bug`);var h,g=0;if(m<p){var _=p-m;g=_+32,h=d>>>_,d=d<<32-_|f>>>_,f<<=32-_}else if(m===p)g=32,h=d,d=f,f=0;else{var v=m-p;g=32-v,h=d<<v|f>>>32-v,d=f<<v,f=0}if(s>>>=0,h>>>=0,s>h)return i.__absoluteGreater(n);if(s<h)return i.__absoluteLess(n);for(var y=o-2;0<=y;y--){0<g?(g-=30,h=d>>>2,d=d<<30|f>>>2,f<<=30):h=0;var b=e.__unsignedDigit(y);if(b>h)return i.__absoluteGreater(n);if(b<h)return i.__absoluteLess(n)}if(d!==0||f!==0){if(g===0)throw Error(`implementation bug`);return i.__absoluteLess(n)}return 0}},{key:`__equalToNumber`,value:function(e,n){return i.__isOneDigitInt(n)?n===0?e.length===0:e.length===1&&e.sign===0>n&&e.__unsignedDigit(0)===t(n):i.__compareToDouble(e,n)===0}},{key:`__comparisonResultToBool`,value:function(e,t){return t===0?0>e:t===1?0>=e:t===2?0<e:t===3?0<=e:void 0}},{key:`__compare`,value:function(e,t,n){if(e=i.__toPrimitive(e),t=i.__toPrimitive(t),typeof e==`string`&&typeof t==`string`)switch(n){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(i.__isBigInt(e)&&typeof t==`string`)return t=i.__fromString(t),t!==null&&i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(typeof e==`string`&&i.__isBigInt(t))return e=i.__fromString(e),e!==null&&i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(e=i.__toNumeric(e),t=i.__toNumeric(t),i.__isBigInt(e)){if(i.__isBigInt(t))return i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(typeof t!=`number`)throw Error(`implementation bug`);return i.__comparisonResultToBool(i.__compareToNumber(e,t),n)}if(typeof e!=`number`)throw Error(`implementation bug`);if(i.__isBigInt(t))return i.__comparisonResultToBool(i.__compareToNumber(t,e),2^n);if(typeof t!=`number`)throw Error(`implementation bug`);return n===0?e<t:n===1?e<=t:n===2?e>t:n===3?e>=t:void 0}},{key:`__absoluteAdd`,value:function(e,t,n){if(e.length<t.length)return i.__absoluteAdd(t,e,n);if(e.length===0)return e;if(t.length===0)return e.sign===n?e:i.unaryMinus(e);var r=e.length;(e.__clzmsd()===0||t.length===e.length&&t.__clzmsd()===0)&&r++;for(var a,o=new i(r,n),s=0,c=0;c<t.length;c++)a=e.__digit(c)+t.__digit(c)+s,s=a>>>30,o.__setDigit(c,1073741823&a);for(;c<e.length;c++){var l=e.__digit(c)+s;s=l>>>30,o.__setDigit(c,1073741823&l)}return c<o.length&&o.__setDigit(c,s),o.__trim()}},{key:`__absoluteSub`,value:function(e,t,n){if(e.length===0)return e;if(t.length===0)return e.sign===n?e:i.unaryMinus(e);for(var r,a=new i(e.length,n),o=0,s=0;s<t.length;s++)r=e.__digit(s)-t.__digit(s)-o,o=1&r>>>30,a.__setDigit(s,1073741823&r);for(;s<e.length;s++){var c=e.__digit(s)-o;o=1&c>>>30,a.__setDigit(s,1073741823&c)}return a.__trim()}},{key:`__absoluteAddOne`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length;n===null?n=new i(r,t):n.sign=t;for(var a,o=1,s=0;s<r;s++)a=e.__digit(s)+o,o=a>>>30,n.__setDigit(s,1073741823&a);return o!==0&&n.__setDigitGrow(r,1),n}},{key:`__absoluteSubOne`,value:function(e,t){var n=e.length;t||=n;for(var r,a=new i(t,!1),o=1,s=0;s<n;s++)r=e.__digit(s)-o,o=1&r>>>30,a.__setDigit(s,1073741823&r);if(o!==0)throw Error(`implementation bug`);for(var c=n;c<t;c++)a.__setDigit(c,0);return a}},{key:`__absoluteAnd`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=o;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)&t.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteAndNot`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;r<a&&(o=r);var s=r;n===null?n=new i(s,!1):s=n.length;for(var c=0;c<o;c++)n.__setDigit(c,e.__digit(c)&~t.__digit(c));for(;c<r;c++)n.__setDigit(c,e.__digit(c));for(;c<s;c++)n.__setDigit(c,0);return n}},{key:`__absoluteOr`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=r;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)|t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteXor`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=r;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)^t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteCompare`,value:function(e,t){var n=e.length-t.length;if(n!=0)return n;for(var r=e.length-1;0<=r&&e.__digit(r)===t.__digit(r);)r--;return 0>r?0:e.__unsignedDigit(r)>t.__unsignedDigit(r)?1:-1}},{key:`__multiplyAccumulate`,value:function(e,t,n,r){if(t!==0){for(var a=32767&t,o=t>>>15,s=0,c=0,l=0;l<e.length;l++,r++){var u=n.__digit(r),d=e.__digit(l),f=32767&d,p=d>>>15,m=i.__imul(f,a),h=i.__imul(f,o),g=i.__imul(p,a),_=i.__imul(p,o);u+=c+m+s,s=u>>>30,u&=1073741823,u+=((32767&h)<<15)+((32767&g)<<15),s+=u>>>30,c=_+(h>>>15)+(g>>>15),n.__setDigit(r,1073741823&u)}for(;s!==0||c!==0;r++){var v=n.__digit(r);v+=s+c,c=0,s=v>>>30,n.__setDigit(r,1073741823&v)}}}},{key:`__internalMultiplyAdd`,value:function(e,t,n,r,a){for(var o=n,s=0,c=0;c<r;c++){var l=e.__digit(c),u=i.__imul(32767&l,t),d=i.__imul(l>>>15,t),f=u+((32767&d)<<15)+s+o;o=f>>>30,s=d>>>15,a.__setDigit(c,1073741823&f)}if(a.length>r)for(a.__setDigit(r++,o+s);r<a.length;)a.__setDigit(r++,0);else if(o+s!==0)throw Error(`implementation bug`)}},{key:`__absoluteDivSmall`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;n===null&&(n=new i(e.length,!1));for(var r=0,a=2*e.length-1;0<=a;a-=2){var o=(r<<15|e.__halfDigit(a))>>>0,s=0|o/t;r=0|o%t,o=(r<<15|e.__halfDigit(a-1))>>>0;var c=0|o/t;r=0|o%t,n.__setDigit(a>>>1,s<<15|c)}return n}},{key:`__absoluteModSmall`,value:function(e,t){for(var n,r=0,i=2*e.length-1;0<=i;i--)n=(r<<15|e.__halfDigit(i))>>>0,r=0|n%t;return r}},{key:`__absoluteDivLarge`,value:function(e,t,n,r){var a=t.__halfDigitLength(),o=t.length,s=e.__halfDigitLength()-a,c=null;n&&(c=new i(s+2>>>1,!1),c.__initializeDigits());var l=new i(a+2>>>1,!1);l.__initializeDigits();var u=i.__clz15(t.__halfDigit(a-1));0<u&&(t=i.__specialLeftShift(t,u,0));for(var d=i.__specialLeftShift(e,u,1),f=t.__halfDigit(a-1),p=0,m=s;0<=m;m--){var h=32767,g=d.__halfDigit(m+a);if(g!==f){var _=(g<<15|d.__halfDigit(m+a-1))>>>0;h=0|_/f;for(var v=0|_%f,y=t.__halfDigit(a-2),b=d.__halfDigit(m+a-2);i.__imul(h,y)>>>0>(v<<16|b)>>>0&&(h--,v+=f,!(32767<v)););}i.__internalMultiplyAdd(t,h,0,o,l);var x=d.__inplaceSub(l,m,a+1);x!==0&&(x=d.__inplaceAdd(t,m,a),d.__setHalfDigit(m+a,32767&d.__halfDigit(m+a)+x),h--),n&&(1&m?p=h<<15:c.__setDigit(m>>>1,p|h))}if(r)return d.__inplaceRightShift(u),n?{quotient:c,remainder:d}:d;if(n)return c;throw Error(`unreachable`)}},{key:`__clz15`,value:function(e){return i.__clz30(e)-15}},{key:`__specialLeftShift`,value:function(e,t,n){var r=e.length,a=new i(r+n,!1);if(t===0){for(var o=0;o<r;o++)a.__setDigit(o,e.__digit(o));return 0<n&&a.__setDigit(r,0),a}for(var s,c=0,l=0;l<r;l++)s=e.__digit(l),a.__setDigit(l,1073741823&s<<t|c),c=s>>>30-t;return 0<n&&a.__setDigit(r,c),a}},{key:`__leftShiftByAbsolute`,value:function(e,t){var n=i.__toShiftAmount(t);if(0>n)throw RangeError(`BigInt too big`);var r=0|n/30,a=n%30,o=e.length,s=a!==0&&!!(e.__digit(o-1)>>>30-a),c=o+r+ +!!s,l=new i(c,e.sign);if(a===0){for(var u=0;u<r;u++)l.__setDigit(u,0);for(;u<c;u++)l.__setDigit(u,e.__digit(u-r))}else{for(var d=0,f=0;f<r;f++)l.__setDigit(f,0);for(var p,m=0;m<o;m++)p=e.__digit(m),l.__setDigit(m+r,1073741823&p<<a|d),d=p>>>30-a;if(s)l.__setDigit(o+r,d);else if(d!==0)throw Error(`implementation bug`)}return l.__trim()}},{key:`__rightShiftByAbsolute`,value:function(e,t){var n=e.length,r=e.sign,a=i.__toShiftAmount(t);if(0>a)return i.__rightShiftByMaximum(r);var o=0|a/30,s=a%30,c=n-o;if(0>=c)return i.__rightShiftByMaximum(r);var l=!1;if(r){var u=(1<<s)-1;if((e.__digit(o)&u)!=0)l=!0;else for(var d=0;d<o;d++)if(e.__digit(d)!==0){l=!0;break}}l&&s===0&&~e.__digit(n-1)==0&&c++;var f=new i(c,r);if(s===0){f.__setDigit(c-1,0);for(var p=o;p<n;p++)f.__setDigit(p-o,e.__digit(p))}else{for(var m,h=e.__digit(o)>>>s,g=n-o-1,_=0;_<g;_++)m=e.__digit(_+o+1),f.__setDigit(_,1073741823&m<<30-s|h),h=m>>>s;f.__setDigit(g,h)}return l&&(f=i.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:`__rightShiftByMaximum`,value:function(e){return e?i.__oneDigit(1,!0):i.__zero()}},{key:`__toShiftAmount`,value:function(e){if(1<e.length)return-1;var t=e.__unsignedDigit(0);return t>i.__kMaxLengthBits?-1:t}},{key:`__toPrimitive`,value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:`default`;if(S(e)!==`object`||e.constructor===i)return e;if(typeof Symbol<`u`&&S(Symbol.toPrimitive)===`symbol`&&e[Symbol.toPrimitive]){var n=e[Symbol.toPrimitive](t);if(S(n)!==`object`)return n;throw TypeError(`Cannot convert object to primitive value`)}var r=e.valueOf;if(r){var a=r.call(e);if(S(a)!==`object`)return a}var o=e.toString;if(o){var s=o.call(e);if(S(s)!==`object`)return s}throw TypeError(`Cannot convert object to primitive value`)}},{key:`__toNumeric`,value:function(e){return i.__isBigInt(e)?e:+e}},{key:`__isBigInt`,value:function(e){return S(e)===`object`&&e!==null&&e.constructor===i}},{key:`__truncateToNBits`,value:function(e,t){for(var n=0|(e+29)/30,r=new i(n,t.sign),a=n-1,o=0;o<a;o++)r.__setDigit(o,t.__digit(o));var s=t.__digit(a);if(e%30!=0){var c=32-e%30;s=s<<c>>>c}return r.__setDigit(a,s),r.__trim()}},{key:`__truncateAndSubFromPowerOfTwo`,value:function(e,t,n){for(var r=Math.min,a,o=0|(e+29)/30,s=new i(o,n),c=0,l=o-1,u=0,d=r(l,t.length);c<d;c++)a=0-t.__digit(c)-u,u=1&a>>>30,s.__setDigit(c,1073741823&a);for(;c<l;c++)s.__setDigit(c,0|1073741823&-u);var f,p=l<t.length?t.__digit(l):0,m=e%30;if(m===0)f=0-p-u,f&=1073741823;else{var h=32-m;p=p<<h>>>h;var g=1<<32-h;f=g-p-u,f&=g-1}return s.__setDigit(l,f),s.__trim()}},{key:`__digitPow`,value:function(e,t){for(var n=1;0<t;)1&t&&(n*=e),t>>>=1,e*=e;return n}},{key:`__detectBigEndian`,value:function(){return i.__kBitConversionDouble[0]=-0,i.__kBitConversionInts[0]!==0}},{key:`__isOneDigitInt`,value:function(e){return(1073741823&e)===e}}])}(w(Array));return T.__kMaxLength=33554432,T.__kMaxLengthBits=T.__kMaxLength<<5,T.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],T.__kBitsPerCharTableShift=5,T.__kBitsPerCharTableMultiplier=1<<T.__kBitsPerCharTableShift,T.__kConversionChars=`0123456789abcdefghijklmnopqrstuvwxyz`.split(``),T.__kBitConversionBuffer=new ArrayBuffer(8),T.__kBitConversionDouble=new Float64Array(T.__kBitConversionBuffer),T.__kBitConversionInts=new Int32Array(T.__kBitConversionBuffer),T.__kBitConversionIntHigh=+!T.__detectBigEndian(),T.__kBitConversionIntLow=+!!T.__detectBigEndian(),T.__clz30=t?function(e){return t(e)-2}:function(e){var t=Math.LN2,n=Math.log;return e===0?30:0|29-(0|n(e>>>0)/t)},T.__imul=e||function(e,t){return 0|e*t},T})}))(),1),Hq=X.default.BigInt(0),Uq=X.default.BigInt(1),Wq=X.default.BigInt(2),Gq=X.default.BigInt(10),Kq=X.default.BigInt(24),qq=X.default.BigInt(60),Jq=X.default.BigInt(1e3),Yq=X.default.BigInt(1e6),Xq=X.default.BigInt(1e9),Zq=X.default.multiply(X.default.BigInt(3600),Xq),Qq=X.default.multiply(qq,Xq),$q=X.default.multiply(Zq,Kq);function eJ(e){return typeof e==`bigint`?X.default.BigInt(e.toString(10)):e}function tJ(e){return X.default.equal(X.default.remainder(e,Wq),Hq)}function nJ(e){return X.default.lessThan(e,Hq)?X.default.unaryMinus(e):e}function rJ(e,t){return X.default.lessThan(e,t)?-1:+!!X.default.greaterThan(e,t)}function iJ(e,t){return{quotient:X.default.divide(e,t),remainder:X.default.remainder(e,t)}}var aJ,oJ,sJ=`slot-epochNanoSeconds`,cJ=`slot-iso-date`,lJ=`slot-iso-date-time`,uJ=`slot-time`,Z=`slot-calendar`,dJ=`slot-date-brand`,fJ=`slot-year-month-brand`,pJ=`slot-month-day-brand`,mJ=`slot-time-zone`,hJ=`slot-years`,gJ=`slot-months`,_J=`slot-weeks`,vJ=`slot-days`,yJ=`slot-hours`,bJ=`slot-minutes`,xJ=`slot-seconds`,SJ=`slot-milliseconds`,CJ=`slot-microseconds`,wJ=`slot-nanoseconds`,TJ=`date`,EJ=`ym`,DJ=`md`,OJ=`time`,kJ=`datetime`,AJ=`instant`,jJ=`original`,MJ=`timezone-canonical`,NJ=`timezone-original`,PJ=`calendar-id`,FJ=`locale`,IJ=`options`,LJ=new WeakMap,RJ=Symbol.for(`@@Temporal__GetSlots`);(aJ=globalThis)[RJ]||(aJ[RJ]=function(e){return LJ.get(e)});var zJ=globalThis[RJ],BJ=Symbol.for(`@@Temporal__CreateSlots`);(oJ=globalThis)[BJ]||(oJ[BJ]=function(e){LJ.set(e,Object.create(null))});var VJ=globalThis[BJ];function HJ(e,...t){if(!e||typeof e!=`object`)return!1;let n=zJ(e);return!!n&&t.every((e=>e in n))}function Q(e,t){let n=zJ(e)?.[t];if(n===void 0)throw TypeError(`Missing internal slot ${t}`);return n}function UJ(e,t,n){let r=zJ(e);if(r===void 0)throw TypeError(`Missing slots for the given container`);if(r[t])throw TypeError(`${t} already has set`);r[t]=n}var WJ={};function GJ(e,t){Object.defineProperty(e.prototype,Symbol.toStringTag,{value:t,writable:!1,enumerable:!1,configurable:!0});let n=Object.getOwnPropertyNames(e);for(let t=0;t<n.length;t++){let r=n[t],i=Object.getOwnPropertyDescriptor(e,r);i.configurable&&i.enumerable&&(i.enumerable=!1,Object.defineProperty(e,r,i))}let r=Object.getOwnPropertyNames(e.prototype);for(let t=0;t<r.length;t++){let n=r[t],i=Object.getOwnPropertyDescriptor(e.prototype,n);i.configurable&&i.enumerable&&(i.enumerable=!1,Object.defineProperty(e.prototype,n,i))}KJ(t,e),KJ(`${t}.prototype`,e.prototype)}function KJ(e,t){let n=`%${e}%`;if(WJ[n]!==void 0)throw Error(`intrinsic ${e} already exists`);WJ[n]=t}function qJ(e){return WJ[e]}function JJ(e,t){let n=e;if(n===0)return{div:n,mod:n};let r=Math.sign(n);n=Math.abs(n);let i=Math.trunc(1+Math.log10(n));if(t>=i)return{div:0*r,mod:r*n};if(t===0)return{div:r*n,mod:0*r};let a=n.toPrecision(i);return{div:r*Number.parseInt(a.slice(0,i-t),10),mod:r*Number.parseInt(a.slice(i-t),10)}}function YJ(e,t,n){let r=e,i=n;if(r===0)return i;let a=Math.sign(r)||Math.sign(i);r=Math.abs(r),i=Math.abs(i);let o=r.toPrecision(Math.trunc(1+Math.log10(r)));if(i===0)return a*Number.parseInt(o+`0`.repeat(t),10);let s=o+i.toPrecision(Math.trunc(1+Math.log10(i))).padStart(t,`0`);return a*Number.parseInt(s,10)}function XJ(e,t){let n=t===`negative`;switch(e){case`ceil`:return n?`zero`:`infinity`;case`floor`:return n?`infinity`:`zero`;case`expand`:return`infinity`;case`trunc`:return`zero`;case`halfCeil`:return n?`half-zero`:`half-infinity`;case`halfFloor`:return n?`half-infinity`:`half-zero`;case`halfExpand`:return`half-infinity`;case`halfTrunc`:return`half-zero`;case`halfEven`:return`half-even`}}function ZJ(e,t,n,r,i){return i===`zero`?e:i===`infinity`?t:n<0?e:n>0?t:i===`half-zero`?e:i===`half-infinity`?t:r?e:t}var QJ=class e{constructor(e){this.totalNs=eJ(e),this.sec=X.default.toNumber(X.default.divide(this.totalNs,Xq)),this.subsec=X.default.toNumber(X.default.remainder(this.totalNs,Xq))}static validateNew(t,n){if(X.default.greaterThan(nJ(t),e.MAX))throw RangeError(`${n} of duration time units cannot exceed ${e.MAX} s`);return new e(t)}static fromEpochNsDiff(t,n){let r=X.default.subtract(eJ(t),eJ(n));return new e(r)}static fromComponents(t,n,r,i,a,o){let s=X.default.add(X.default.add(X.default.add(X.default.add(X.default.add(X.default.BigInt(o),X.default.multiply(X.default.BigInt(a),Jq)),X.default.multiply(X.default.BigInt(i),Yq)),X.default.multiply(X.default.BigInt(r),Xq)),X.default.multiply(X.default.BigInt(n),Qq)),X.default.multiply(X.default.BigInt(t),Zq));return e.validateNew(s,`total`)}abs(){return new e(nJ(this.totalNs))}add(t){return e.validateNew(X.default.add(this.totalNs,t.totalNs),`sum`)}add24HourDays(t){return e.validateNew(X.default.add(this.totalNs,X.default.multiply(X.default.BigInt(t),$q)),`sum`)}addToEpochNs(e){return X.default.add(eJ(e),this.totalNs)}cmp(e){return rJ(this.totalNs,e.totalNs)}divmod(t){let{quotient:n,remainder:r}=iJ(this.totalNs,X.default.BigInt(t));return{quotient:X.default.toNumber(n),remainder:new e(r)}}fdiv(e){let t=eJ(e),n=X.default.BigInt(t),{quotient:r,remainder:i}=iJ(this.totalNs,n),a=[],o,s=(X.default.lessThan(this.totalNs,Hq)?-1:1)*Math.sign(X.default.toNumber(t));for(;!X.default.equal(i,Hq)&&a.length<50;)i=X.default.multiply(i,Gq),{quotient:o,remainder:i}=iJ(i,n),a.push(Math.abs(X.default.toNumber(o)));return s*Number(nJ(r).toString()+`.`+a.join(``))}isZero(){return X.default.equal(this.totalNs,Hq)}round(t,n){let r=eJ(t);if(X.default.equal(r,Uq))return this;let{quotient:i,remainder:a}=iJ(this.totalNs,r),o=X.default.lessThan(this.totalNs,Hq)?`negative`:`positive`,s=X.default.multiply(nJ(i),r),c=X.default.add(s,r),l=rJ(nJ(X.default.multiply(a,Wq)),r),u=XJ(n,o),d=X.default.equal(nJ(this.totalNs),s)?s:ZJ(s,c,l,tJ(i),u),f=o===`positive`?d:X.default.unaryMinus(d);return e.validateNew(f,`rounding`)}sign(){return this.cmp(new e(Hq))}subtract(t){return e.validateNew(X.default.subtract(this.totalNs,t.totalNs),`difference`)}};QJ.MAX=X.default.BigInt(`9007199254740991999999999`),QJ.ZERO=new QJ(Hq);var $J=/[A-Za-z._][A-Za-z._0-9+-]*/,eY=RegExp(`(?:(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)|(?:${$J.source})(?:\\/(?:${$J.source}))*)`),tY=/(?:[+-]\d{6}|\d{4})/,nY=/(?:0[1-9]|1[0-2])/,rY=/(?:0[1-9]|[12]\d|3[01])/,iY=RegExp(`(${tY.source})(?:-(${nY.source})-(${rY.source})|(${nY.source})(${rY.source}))`),aY=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,oY=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,sY=RegExp(`([zZ])|${oY.source}?`),cY=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,lY=new RegExp([`^${iY.source}`,`(?:(?:[tT]|\\s+)${aY.source}(?:${sY.source})?)?`,`(?:\\[!?(${eY.source})\\])?`,`((?:${cY.source})*)$`].join(``)),uY=new RegExp([`^[tT]?${aY.source}`,`(?:${sY.source})?`,`(?:\\[!?${eY.source}\\])?`,`((?:${cY.source})*)$`].join(``)),dY=RegExp(`^(${tY.source})-?(${nY.source})(?:\\[!?${eY.source}\\])?((?:${cY.source})*)$`),fY=RegExp(`^(?:--)?(${nY.source})-?(${rY.source})(?:\\[!?${eY.source}\\])?((?:${cY.source})*)$`),pY=/(\d+)(?:[.,](\d{1,9}))?/,mY=RegExp(`(?:${pY.source}H)?(?:${pY.source}M)?(?:${pY.source}S)?`),hY=RegExp(`^([+-])?P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?!$)${mY.source})?$`,`i`),gY=864e5,_Y=1e6*gY,vY=6e10,yY=1e8*gY,bY=v$(yY),xY=X.default.unaryMinus(bY),SY=X.default.add(X.default.subtract(xY,$q),Uq),CY=X.default.subtract(X.default.add(bY,$q),Uq),wY=146097*gY,TY=-271821,EY=275760,DY=Date.UTC(1847,0,1),OY=[`iso8601`,`hebrew`,`islamic`,`islamic-umalqura`,`islamic-tbla`,`islamic-civil`,`islamic-rgsa`,`islamicc`,`persian`,`ethiopic`,`ethioaa`,`ethiopic-amete-alem`,`coptic`,`chinese`,`dangi`,`roc`,`indian`,`buddhist`,`japanese`,`gregory`],kY=new Set([`ACT`,`AET`,`AGT`,`ART`,`AST`,`BET`,`BST`,`CAT`,`CNT`,`CST`,`CTT`,`EAT`,`ECT`,`IET`,`IST`,`JST`,`MIT`,`NET`,`NST`,`PLT`,`PNT`,`PRT`,`PST`,`SST`,`VST`]);function AY(e){return typeof e==`object`&&!!e||typeof e==`function`}function jY(e){if(typeof e==`bigint`)throw TypeError(`Cannot convert BigInt to number`);return Number(e)}function MY(e){if(typeof e==`symbol`)throw TypeError(`Cannot convert a Symbol value to a String`);return String(e)}function NY(e){let t=jY(e);if(t===0)return 0;if(Number.isNaN(t)||t===1/0||t===-1/0)throw RangeError(`invalid number value`);let n=Math.trunc(t);return n===0?0:n}function PY(e,t){let n=NY(e);if(n<=0)throw RangeError(t===void 0?`Cannot convert a number less than one to a positive integer`:`property '${t}' cannot be a a number less than one`);return n}function FY(e){let t=jY(e);if(Number.isNaN(t))throw RangeError(`not a number`);if(t===1/0||t===-1/0)throw RangeError(`infinity is out of range`);if(!function(e){if(typeof e!=`number`||Number.isNaN(e)||e===1/0||e===-1/0)return!1;let t=Math.abs(e);return Math.floor(t)===t}(t))throw RangeError(`unsupported fractional value ${e}`);return t===0?0:t}function IY(e,t){return String(e).padStart(t,`0`)}function LY(e){if(typeof e!=`string`)throw TypeError(`expected a string, not ${String(e)}`);return e}function RY(e,t){if(AY(e)){let t=e?.toString();if(typeof t==`string`||typeof t==`number`)return t;throw TypeError(`Cannot convert object to primitive value`)}return e}var zY=[`era`,`eraYear`,`year`,`month`,`monthCode`,`day`,`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],BY={era:MY,eraYear:NY,year:NY,month:PY,monthCode:function(e){let t=LY(RY(e));if(t.length<3||t.length>4||t[0]!==`M`||`0123456789`.indexOf(t[1])===-1||`0123456789`.indexOf(t[2])===-1||t[1]+t[2]===`00`&&t[3]!==`L`||t[3]!==`L`&&t[3]!==void 0)throw RangeError(`bad month code ${t}; must match M01-M99 or M00L-M99L`);return t},day:PY,hour:NY,minute:NY,second:NY,millisecond:NY,microsecond:NY,nanosecond:NY,offset:function(e){let t=LY(RY(e));return GZ(t),t},timeZone:CZ},VY={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},HY=[[`years`,`year`,`date`],[`months`,`month`,`date`],[`weeks`,`week`,`date`],[`days`,`day`,`date`],[`hours`,`hour`,`time`],[`minutes`,`minute`,`time`],[`seconds`,`second`,`time`],[`milliseconds`,`millisecond`,`time`],[`microseconds`,`microsecond`,`time`],[`nanoseconds`,`nanosecond`,`time`]],UY=Object.fromEntries(HY.map((e=>[e[0],e[1]]))),WY=Object.fromEntries(HY.map((([e,t])=>[t,e]))),GY=HY.map((([,e])=>e)),KY={day:_Y,hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},qY=[`days`,`hours`,`microseconds`,`milliseconds`,`minutes`,`months`,`nanoseconds`,`seconds`,`weeks`,`years`],JY=Intl.DateTimeFormat,YY=new Map;function XY(e){let t=D$(e),n=YY.get(t);return n===void 0&&(n=new JY(`en-us`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),YY.set(t,n)),n}function ZY(e){return HJ(e,sJ)&&!HJ(e,mJ,Z)}function QY(e){return HJ(e,hJ,gJ,vJ,yJ,bJ,xJ,SJ,CJ,wJ)}function $Y(e){return HJ(e,dJ)}function eX(e){return HJ(e,uJ)}function tX(e){return HJ(e,lJ)}function nX(e){return HJ(e,fJ)}function rX(e){return HJ(e,pJ)}function iX(e){return HJ(e,sJ,mJ,Z)}function $(e,t){if(!t(e))throw TypeError(`invalid receiver: method called with the wrong type of this-object`)}function aX(e){if(HJ(e,Z)||HJ(e,mJ))throw TypeError(`with() does not support a calendar or timeZone property`);if(eX(e))throw TypeError(`with() does not accept Temporal.PlainTime, use withPlainTime() instead`);if(e.calendar!==void 0)throw TypeError(`with() does not support a calendar property`);if(e.timeZone!==void 0)throw TypeError(`with() does not support a timeZone property`)}function oX(e,t){return t===`never`||t===`auto`&&e===`iso8601`?``:`[${t===`critical`?`!`:``}u-ca=${e}]`}function sX(e){let t,n,r=!1;for(cY.lastIndex=0;n=cY.exec(e);){let{1:i,2:a,3:o}=n;if(a===`u-ca`){if(t===void 0)t=o,r=i===`!`;else if(i===`!`||r)throw RangeError(`Invalid annotations in ${e}: more than one u-ca present with critical flag`)}else if(i===`!`)throw RangeError(`Unrecognized annotation: !${a}=${o}`)}return t}function cX(e){let t=lY.exec(e);if(!t)throw RangeError(`invalid RFC 9557 string: ${e}`);let n=sX(t[16]),r=t[1];if(r===`-000000`)throw RangeError(`invalid RFC 9557 string: ${e}`);let i=+r,a=+(t[2]??t[4]??1),o=+(t[3]??t[5]??1),s=t[6]!==void 0,c=+(t[6]??0),l=+(t[7]??t[10]??0),u=+(t[8]??t[11]??0);u===60&&(u=59);let d=(t[9]??t[12]??``)+`000000000`,f=+d.slice(0,3),p=+d.slice(3,6),m=+d.slice(6,9),h,g=!1;t[13]?(h=void 0,g=!0):t[14]&&(h=t[14]);let _=t[15];return SQ(i,a,o,c,l,u,f,p,m),{year:i,month:a,day:o,time:s?{hour:c,minute:l,second:u,millisecond:f,microsecond:p,nanosecond:m}:`start-of-day`,tzAnnotation:_,offset:h,z:g,calendar:n}}function lX(e){let t=uY.exec(e),n,r,i,a,o,s,c;if(t){c=sX(t[10]),n=+(t[1]??0),r=+(t[2]??t[5]??0),i=+(t[3]??t[6]??0),i===60&&(i=59);let e=(t[4]??t[7]??``)+`000000000`;if(a=+e.slice(0,3),o=+e.slice(3,6),s=+e.slice(6,9),t[8])throw RangeError(`Z designator not supported for PlainTime`)}else{let t,l;if({time:t,z:l,calendar:c}=cX(e),t===`start-of-day`)throw RangeError(`time is missing in string: ${e}`);if(l)throw RangeError(`Z designator not supported for PlainTime`);({hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s}=t)}if(xQ(n,r,i,a,o,s),/[tT ][0-9][0-9]/.test(e))return{hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s,calendar:c};try{let{month:t,day:n}=dX(e);yQ(1972,t,n)}catch{try{let{year:t,month:n}=uX(e);yQ(t,n,1)}catch{return{hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s,calendar:c}}}throw RangeError(`invalid RFC 9557 time-only string ${e}; may need a T prefix`)}function uX(e){let t=dY.exec(e),n,r,i,a;if(t){i=sX(t[3]);let o=t[1];if(o===`-000000`)throw RangeError(`invalid RFC 9557 string: ${e}`);if(n=+o,r=+t[2],a=1,i!==void 0&&i!==`iso8601`)throw RangeError(`YYYY-MM format is only valid with iso8601 calendar`)}else{let t;if({year:n,month:r,calendar:i,day:a,z:t}=cX(e),t)throw RangeError(`Z designator not supported for PlainYearMonth`)}return{year:n,month:r,calendar:i,referenceISODay:a}}function dX(e){let t=fY.exec(e),n,r,i,a;if(t){if(i=sX(t[3]),n=+t[1],r=+t[2],i!==void 0&&i!==`iso8601`)throw RangeError(`MM-DD format is only valid with iso8601 calendar`)}else{let t;if({month:n,day:r,calendar:i,year:a,z:t}=cX(e),t)throw RangeError(`Z designator not supported for PlainMonthDay`)}return{month:n,day:r,calendar:i,referenceISOYear:a}}var fX=RegExp(`^${eY.source}$`,`i`),pX=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?$`);function mX(e){let t=Iue.test(e)?`Seconds not allowed in offset time zone`:`Invalid time zone`;throw RangeError(`${t}: ${e}`)}function hX(e){return fX.test(e)||mX(e),pX.test(e)?{offsetMinutes:GZ(e)/6e10}:{tzName:e}}function gX(e,t,n,r){let i=e,a=t,o=n;switch(r){case`reject`:yQ(i,a,o);break;case`constrain`:({year:i,month:a,day:o}=_Q(i,a,o))}return{year:i,month:a,day:o}}function _X(e,t,n,r,i,a,o){let s=e,c=t,l=n,u=r,d=i,f=a;switch(o){case`reject`:xQ(s,c,l,u,d,f);break;case`constrain`:s=gQ(s,0,23),c=gQ(c,0,59),l=gQ(l,0,59),u=gQ(u,0,999),d=gQ(d,0,999),f=gQ(f,0,999)}return{hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}function vX(e){if(!AY(e))throw TypeError(`invalid duration-like`);let t={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},n=!1;for(let r=0;r<qY.length;r++){let i=qY[r],a=e[i];a!==void 0&&(n=!0,t[i]=FY(a))}if(!n)throw TypeError(`invalid duration-like`);return t}function yX({years:e,months:t,weeks:n,days:r},i,a,o){return{years:e,months:o??t,weeks:a??n,days:i??r}}function bX(e,t){return{isoDate:e,time:t}}function xX(e){return T$(e,`overflow`,[`constrain`,`reject`],`constrain`)}function SX(e){return T$(e,`disambiguation`,[`compatible`,`earlier`,`later`,`reject`],`compatible`)}function CX(e,t){return T$(e,`roundingMode`,[`ceil`,`floor`,`expand`,`trunc`,`halfCeil`,`halfFloor`,`halfExpand`,`halfTrunc`,`halfEven`],t)}function wX(e,t){return T$(e,`offset`,[`prefer`,`use`,`ignore`,`reject`],t)}function TX(e){return T$(e,`calendarName`,[`auto`,`always`,`never`,`critical`],`auto`)}function EX(e){let t=e.roundingIncrement;if(t===void 0)return 1;let n=NY(t);if(n<1||n>1e9)throw RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${t}`);return n}function DX(e,t,n){let r=n?t:t-1;if(e>r)throw RangeError(`roundingIncrement must be at least 1 and less than ${r}, not ${e}`);if(t%e!=0)throw RangeError(`Rounding increment must divide evenly into ${t}`)}function OX(e){let t=e.fractionalSecondDigits;if(t===void 0)return`auto`;if(typeof t!=`number`){if(MY(t)!==`auto`)throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return`auto`}let n=Math.floor(t);if(!Number.isFinite(n)||n<0||n>9)throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return n}function kX(e,t){switch(e){case`minute`:return{precision:`minute`,unit:`minute`,increment:1};case`second`:return{precision:0,unit:`second`,increment:1};case`millisecond`:return{precision:3,unit:`millisecond`,increment:1};case`microsecond`:return{precision:6,unit:`microsecond`,increment:1};case`nanosecond`:return{precision:9,unit:`nanosecond`,increment:1}}switch(t){case`auto`:return{precision:t,unit:`nanosecond`,increment:1};case 0:return{precision:t,unit:`second`,increment:1};case 1:case 2:case 3:return{precision:t,unit:`millisecond`,increment:10**(3-t)};case 4:case 5:case 6:return{precision:t,unit:`microsecond`,increment:10**(6-t)};case 7:case 8:case 9:return{precision:t,unit:`nanosecond`,increment:10**(9-t)};default:throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`)}}var AX=Symbol(`~required~`);function jX(e,t,n,r,i=[]){let a=[];for(let e=0;e<HY.length;e++){let t=HY[e],r=t[1],i=t[2];n!==`datetime`&&n!==i||a.push(r)}a=a.concat(i);let o=r;o===AX?o=void 0:o!==void 0&&a.push(o);let s=[];s=s.concat(a);for(let e=0;e<a.length;e++){let t=WY[a[e]];t!==void 0&&s.push(t)}let c=T$(e,t,s,o);if(c===void 0&&r===AX)throw RangeError(`${t} is required`);return c&&c in UY?UY[c]:c}function MX(e){let t=e.relativeTo;if(t===void 0)return{};let n,r,i,a,o,s=`option`,c=!1;if(AY(t)){if(iX(t))return{zonedRelativeTo:t};if($Y(t))return{plainRelativeTo:t};if(tX(t))return{plainRelativeTo:eZ(Q(t,lJ).isoDate,Q(t,Z))};i=vZ(t);let e=BX(i,t,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],[]);({isoDate:n,time:r}=UX(i,e,`constrain`)),{offset:o,timeZone:a}=e,o===void 0&&(s=`wall`)}else{let e,l,u,d,f;if({year:u,month:d,day:f,time:r,calendar:i,tzAnnotation:e,offset:o,z:l}=cX(LY(t)),e)a=CZ(e),l?s=`exact`:o||(s=`wall`),c=!0;else if(l)throw RangeError(`Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone`);i||=`iso8601`,i=E$(i),n={year:u,month:d,day:f}}return a===void 0?{plainRelativeTo:eZ(n,i)}:{zonedRelativeTo:fZ(ZX(n,r,s,s===`option`?GZ(o):0,a,`compatible`,`reject`,c),a,i)}}function NX(e){return Q(e,hJ)===0?Q(e,gJ)===0?Q(e,_J)===0?Q(e,vJ)===0?Q(e,yJ)===0?Q(e,bJ)===0?Q(e,xJ)===0?Q(e,SJ)===0?Q(e,CJ)===0?`nanosecond`:`microsecond`:`millisecond`:`second`:`minute`:`hour`:`day`:`week`:`month`:`year`}function PX(e,t){return GY.indexOf(e)>GY.indexOf(t)?t:e}function FX(e){return e===`year`||e===`month`||e===`week`}function IX(e){return FX(e)||e===`day`?`date`:`time`}function LX(e){return qJ(`%calendarImpl%`)(e)}function RX(e){return qJ(`%calendarImpl%`)(Q(e,Z))}function zX(e,t,n=`date`){let r=Object.create(null),i=LX(e).isoToDate(t,{year:!0,monthCode:!0,day:!0});return r.monthCode=i.monthCode,n!==`month-day`&&n!==`date`||(r.day=i.day),n!==`year-month`&&n!==`date`||(r.year=i.year),r}function BX(e,t,n,r,i){let a=LX(e).extraFields(n),o=n.concat(r,a),s=Object.create(null),c=!1;o.sort();for(let e=0;e<o.length;e++){let n=o[e],r=t[n];if(r!==void 0)c=!0,s[n]=(0,BY[n])(r);else if(i!==`partial`){if(i.includes(n))throw TypeError(`required property '${n}' missing or undefined`);s[n]=VY[n]}}if(i===`partial`&&!c)throw TypeError(`no supported properties found`);return s}function VX(e,t=`complete`){let n=[`hour`,`microsecond`,`millisecond`,`minute`,`nanosecond`,`second`],r=!1,i=Object.create(null);for(let a=0;a<n.length;a++){let o=n[a],s=e[o];s===void 0?t===`complete`&&(i[o]=0):(i[o]=NY(s),r=!0)}if(!r)throw TypeError(`invalid time-like`);return i}function HX(e,t){if(AY(e)){if($Y(e))return xX(C$(t)),eZ(Q(e,cJ),Q(e,Z));if(iX(e)){let n=DZ(Q(e,mJ),Q(e,sJ));return xX(C$(t)),eZ(n.isoDate,Q(e,Z))}if(tX(e))return xX(C$(t)),eZ(Q(e,lJ).isoDate,Q(e,Z));let n=vZ(e);return eZ(bZ(n,BX(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),xX(C$(t))),n)}let{year:n,month:r,day:i,calendar:a,z:o}=cX(LY(e));if(o)throw RangeError(`Z designator not supported for PlainDate`);return a||=`iso8601`,a=E$(a),xX(C$(t)),eZ({year:n,month:r,day:i},a)}function UX(e,t,n){return bX(bZ(e,t,n),_X(t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond,n))}function WX(e,t){let n,r,i;if(AY(e)){if(tX(e))return xX(C$(t)),nZ(Q(e,lJ),Q(e,Z));if(iX(e)){let n=DZ(Q(e,mJ),Q(e,sJ));return xX(C$(t)),nZ(n,Q(e,Z))}if($Y(e))return xX(C$(t)),nZ(bX(Q(e,cJ),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),Q(e,Z));i=vZ(e);let a=BX(i,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],[]),o=xX(C$(t));({isoDate:n,time:r}=UX(i,a,o))}else{let a,o,s,c;if({year:o,month:s,day:c,time:r,calendar:i,z:a}=cX(LY(e)),a)throw RangeError(`Z designator not supported for PlainDateTime`);r===`start-of-day`&&(r={deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),SQ(o,s,c,r.hour,r.minute,r.second,r.millisecond,r.microsecond,r.nanosecond),i||=`iso8601`,i=E$(i),xX(C$(t)),n={year:o,month:s,day:c}}return nZ(bX(n,r),i)}function GX(e){let t=qJ(`%Temporal.Duration%`);if(QY(e))return new t(Q(e,hJ),Q(e,gJ),Q(e,_J),Q(e,vJ),Q(e,yJ),Q(e,bJ),Q(e,xJ),Q(e,SJ),Q(e,CJ),Q(e,wJ));if(!AY(e))return function(e){let{years:t,months:n,weeks:r,days:i,hours:a,minutes:o,seconds:s,milliseconds:c,microseconds:l,nanoseconds:u}=function(e){let t=hY.exec(e);if(!t||t.every(((e,t)=>t<2||e===void 0)))throw RangeError(`invalid duration: ${e}`);let n=t[1]===`-`?-1:1,r=t[2]===void 0?0:NY(t[2])*n,i=t[3]===void 0?0:NY(t[3])*n,a=t[4]===void 0?0:NY(t[4])*n,o=t[5]===void 0?0:NY(t[5])*n,s=t[6]===void 0?0:NY(t[6])*n,c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=0,m=0,h=0;if(c!==void 0){if(l??u??d??f)throw RangeError(`only the smallest unit can be fractional`);h=3600*NY((c+`000000000`).slice(0,9))*n}else if(p=l===void 0?0:NY(l)*n,u!==void 0){if(d??f)throw RangeError(`only the smallest unit can be fractional`);h=60*NY((u+`000000000`).slice(0,9))*n}else m=d===void 0?0:NY(d)*n,f!==void 0&&(h=NY((f+`000000000`).slice(0,9))*n);let g=h%1e3,_=Math.trunc(h/1e3)%1e3,v=Math.trunc(h/1e6)%1e3;return m+=Math.trunc(h/1e9)%60,p+=Math.trunc(h/6e10),DQ(r,i,a,o,s,p,m,v,_,g),{years:r,months:i,weeks:a,days:o,hours:s,minutes:p,seconds:m,milliseconds:v,microseconds:_,nanoseconds:g}}(e);return new(qJ(`%Temporal.Duration%`))(t,n,r,i,a,o,s,c,l,u)}(LY(e));let n={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},r=vX(e);for(let e=0;e<qY.length;e++){let t=qY[e],i=r[t];i!==void 0&&(n[t]=i)}return new t(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function KX(e){let t;if(AY(e)){if(ZY(e)||iX(e))return uZ(Q(e,sJ));t=RY(e)}else t=e;let{year:n,month:r,day:i,time:a,offset:o,z:s}=function(e){let t=cX(e);if(!t.z&&!t.offset)throw RangeError(`Temporal.Instant requires a time zone offset`);return t}(LY(t)),{hour:c=0,minute:l=0,second:u=0,millisecond:d=0,microsecond:f=0,nanosecond:p=0}=a===`start-of-day`?{}:a,m=fQ(n,r,i,c,l,u,d,f,p-(s?0:GZ(o)));return PQ(m.isoDate),uZ(eQ(m))}function qX(e,t){if(AY(e)){if(rX(e))return xX(C$(t)),iZ(Q(e,cJ),Q(e,Z));let n;return HJ(e,Z)?n=Q(e,Z):(n=e.calendar,n===void 0&&(n=`iso8601`),n=_Z(n)),iZ(SZ(n,BX(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),xX(C$(t))),n)}let{month:n,day:r,referenceISOYear:i,calendar:a}=dX(LY(e));if(a===void 0&&(a=`iso8601`),a=E$(a),xX(C$(t)),a===`iso8601`)return iZ({year:1972,month:n,day:r},a);let o={year:i,month:n,day:r};return bQ(o),o=SZ(a,zX(a,o,`month-day`),`constrain`),iZ(o,a)}function JX(e,t){let n;if(AY(e)){if(eX(e))return xX(C$(t)),oZ(Q(e,uJ));if(tX(e))return xX(C$(t)),oZ(Q(e,lJ).time);if(iX(e)){let n=DZ(Q(e,mJ),Q(e,sJ));return xX(C$(t)),oZ(n.time)}let{hour:r,minute:i,second:a,millisecond:o,microsecond:s,nanosecond:c}=VX(e);n=_X(r,i,a,o,s,c,xX(C$(t)))}else n=lX(LY(e)),xX(C$(t));return oZ(n)}function YX(e){return e===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:Q(JX(e),uJ)}function XX(e,t){if(AY(e)){if(nX(e))return xX(C$(t)),cZ(Q(e,cJ),Q(e,Z));let n=vZ(e);return cZ(xZ(n,BX(n,e,[`year`,`month`,`monthCode`],[],[]),xX(C$(t))),n)}let{year:n,month:r,referenceISODay:i,calendar:a}=uX(LY(e));a===void 0&&(a=`iso8601`),a=E$(a),xX(C$(t));let o={year:n,month:r,day:i};return EQ(o),o=xZ(a,zX(a,o,`year-month`),`constrain`),cZ(o,a)}function ZX(e,t,n,r,i,a,o,s){if(t===`start-of-day`)return jZ(i,e);let c=bX(e,t);if(n===`wall`||o===`ignore`)return OZ(i,c,a);if(n===`exact`||o===`use`){let n=fQ(e.year,e.month,e.day,t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond-r);PQ(n.isoDate);let i=eQ(n);return TQ(i),i}PQ(e);let l=eQ(c),u=AZ(i,c);for(let e=0;e<u.length;e++){let t=u[e],n=X.default.toNumber(X.default.subtract(l,t)),i=s$(n,6e10,`halfExpand`);if(n===r||s&&i===r)return t}if(o===`reject`){let e=EZ(r),t=BZ(c,`iso8601`,`auto`);throw RangeError(`Offset ${e} is invalid for ${t} in ${i}`)}return kZ(u,i,c,a)}function QX(e,t){let n,r,i,a,o,s,c,l=!1,u=`option`;if(AY(e)){if(iX(e)){let n=C$(t);return SX(n),wX(n,`reject`),xX(n),fZ(Q(e,sJ),Q(e,mJ),Q(e,Z))}o=vZ(e);let l=BX(o,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],[`timeZone`]);({offset:a,timeZone:i}=l),a===void 0&&(u=`wall`);let d=C$(t);s=SX(d),c=wX(d,`reject`);let f=xX(d);({isoDate:n,time:r}=UX(o,l,f))}else{let d,f,p,m,h;({year:p,month:m,day:h,time:r,tzAnnotation:d,offset:a,z:f,calendar:o}=function(e){let t=cX(e);if(!t.tzAnnotation)throw RangeError(`Temporal.ZonedDateTime requires a time zone ID in brackets`);return t}(LY(e))),i=CZ(d),f?u=`exact`:a||(u=`wall`),o||=`iso8601`,o=E$(o),l=!0;let g=C$(t);s=SX(g),c=wX(g,`reject`),xX(g),n={year:p,month:m,day:h}}let d=0;return u===`option`&&(d=GZ(a)),fZ(ZX(n,r,u,d,i,s,c,l),i,o)}function $X(e,t,n){bQ(t),VJ(e),UJ(e,cJ,t),UJ(e,Z,n),UJ(e,dJ,!0)}function eZ(e,t){let n=qJ(`%Temporal.PlainDate%`),r=Object.create(n.prototype);return $X(r,e,t),r}function tZ(e,t,n){CQ(t),VJ(e),UJ(e,lJ,t),UJ(e,Z,n)}function nZ(e,t){let n=qJ(`%Temporal.PlainDateTime%`),r=Object.create(n.prototype);return tZ(r,e,t),r}function rZ(e,t,n){bQ(t),VJ(e),UJ(e,cJ,t),UJ(e,Z,n),UJ(e,pJ,!0)}function iZ(e,t){let n=qJ(`%Temporal.PlainMonthDay%`),r=Object.create(n.prototype);return rZ(r,e,t),r}function aZ(e,t){VJ(e),UJ(e,uJ,t)}function oZ(e){let t=qJ(`%Temporal.PlainTime%`),n=Object.create(t.prototype);return aZ(n,e),n}function sZ(e,t,n){EQ(t),VJ(e),UJ(e,cJ,t),UJ(e,Z,n),UJ(e,fJ,!0)}function cZ(e,t){let n=qJ(`%Temporal.PlainYearMonth%`),r=Object.create(n.prototype);return sZ(r,e,t),r}function lZ(e,t){TQ(t),VJ(e),UJ(e,sJ,t)}function uZ(e){let t=qJ(`%Temporal.Instant%`),n=Object.create(t.prototype);return lZ(n,e),n}function dZ(e,t,n,r){TQ(t),VJ(e),UJ(e,sJ,t),UJ(e,mJ,n),UJ(e,Z,r)}function fZ(e,t,n=`iso8601`){let r=qJ(`%Temporal.ZonedDateTime%`),i=Object.create(r.prototype);return dZ(i,e,t,n),i}function pZ(e){return zY.filter((t=>e[t]!==void 0))}function mZ(e,t,n){let r=pZ(n),i=LX(e).fieldKeysToIgnore(r),a=Object.create(null),o=pZ(t);for(let e=0;e<zY.length;e++){let s,c=zY[e];o.includes(c)&&!i.includes(c)&&(s=t[c]),r.includes(c)&&(s=n[c]),s!==void 0&&(a[c]=s)}return a}function hZ(e,t,n,r){let i=LX(e).dateAdd(t,n,r);return bQ(i),i}function gZ(e,t,n,r){return LX(e).dateUntil(t,n,r)}function _Z(e){if(AY(e)&&HJ(e,Z))return Q(e,Z);let t=LY(e);try{return E$(t)}catch{}let n;try{({calendar:n}=cX(t))}catch{try{({calendar:n}=lX(t))}catch{try{({calendar:n}=uX(t))}catch{({calendar:n}=dX(t))}}}return n||=`iso8601`,E$(n)}function vZ(e){if(HJ(e,Z))return Q(e,Z);let{calendar:t}=e;return t===void 0?`iso8601`:_Z(t)}function yZ(e,t){return E$(e)===E$(t)}function bZ(e,t,n){let r=LX(e);r.resolveFields(t,`date`);let i=r.dateToISO(t,n);return bQ(i),i}function xZ(e,t,n){let r=LX(e);r.resolveFields(t,`year-month`),t.day=1;let i=r.dateToISO(t,n);return EQ(i),i}function SZ(e,t,n){let r=LX(e);r.resolveFields(t,`month-day`);let i=r.monthDayToISOReferenceDate(t,n);return bQ(i),i}function CZ(e){if(AY(e)&&iX(e))return Q(e,mJ);let t=LY(e);if(t===`UTC`)return`UTC`;let{tzName:n,offsetMinutes:r}=function(e){let{tzAnnotation:t,offset:n,z:r}=function(e){if(fX.test(e))return{tzAnnotation:e,offset:void 0,z:!1};try{let{tzAnnotation:t,offset:n,z:r}=cX(e);if(r||t||n)return{tzAnnotation:t,offset:n,z:r}}catch{}mX(e)}(e);return t?hX(t):r?hX(`UTC`):n?hX(n):void 0}(t);if(r!==void 0)return ZZ(r);let i=JZ(n);if(!i)throw RangeError(`Unrecognized time zone ${n}`);return i.identifier}function wZ(e,t){if(e===t)return!0;let n=hX(e).offsetMinutes,r=hX(t).offsetMinutes;if(n===void 0&&r===void 0){let n=JZ(t);if(!n)return!1;let r=JZ(e);return!!r&&r.primaryIdentifier===n.primaryIdentifier}return n===r}function TZ(e,t){let n=hX(e).offsetMinutes;return n===void 0?XZ(e,t):6e10*n}function EZ(e){let t=e<0?`-`:`+`,n=Math.abs(e),r=Math.floor(n/36e11),i=Math.floor(n/6e10)%60,a=Math.floor(n/1e9)%60,o=n%1e9;return`${t}${FZ(r,i,a,o,a===0&&o===0?`minute`:`auto`)}`}function DZ(e,t){let n=TZ(e,t),{isoDate:{year:r,month:i,day:a},time:{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d}}=tQ(t);return fQ(r,i,a,o,s,c,l,u,d+n)}function OZ(e,t,n){return kZ(AZ(e,t),e,t,n)}function kZ(e,t,n,r){let i=e.length;if(i===1)return e[0];if(i)switch(r){case`compatible`:case`earlier`:return e[0];case`later`:return e[i-1];case`reject`:throw RangeError(`multiple instants found`)}if(r===`reject`)throw RangeError(`multiple instants found`);let a=eQ(n),o=X.default.subtract(a,$q);TQ(o);let s=TZ(t,o),c=X.default.add(a,$q);TQ(c);let l=TZ(t,c)-s;switch(r){case`earlier`:{let e=QJ.fromComponents(0,0,0,0,0,-l),r=ZQ(n.time,e);return AZ(t,bX(dQ(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r))[0]}case`compatible`:case`later`:{let e=QJ.fromComponents(0,0,0,0,0,l),r=ZQ(n.time,e),i=AZ(t,bX(dQ(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r));return i[i.length-1]}}}function AZ(e,t){if(e===`UTC`)return PQ(t.isoDate),[eQ(t)];let n=hX(e).offsetMinutes;if(n!==void 0){let e=fQ(t.isoDate.year,t.isoDate.month,t.isoDate.day,t.time.hour,t.time.minute-n,t.time.second,t.time.millisecond,t.time.microsecond,t.time.nanosecond);PQ(e.isoDate);let r=eQ(e);return TQ(r),[r]}return PQ(t.isoDate),function(e,t){let n=eQ(t),r=X.default.subtract(n,$q);X.default.lessThan(r,xY)&&(r=n);let i=X.default.add(n,$q);X.default.greaterThan(i,bY)&&(i=n);let a=XZ(e,r),o=XZ(e,i);return(a===o?[a]:[a,o]).map((r=>{let i=X.default.subtract(n,X.default.BigInt(r));if(h$(t,function(e,t){let{epochMilliseconds:n,time:{millisecond:r,microsecond:i,nanosecond:a}}=tQ(t),{year:o,month:s,day:c,hour:l,minute:u,second:d}=iQ(e,n);return fQ(o,s,c,l,u,d,r,i,a)}(e,i))===0)return TQ(i),i})).filter((e=>e!==void 0))}(e,t)}function jZ(e,t){let n=bX(t,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),r=AZ(e,n);if(r.length)return r[0];let i=eQ(n),a=X.default.subtract(i,$q);return TQ(a),nQ(e,a)}function MZ(e){let t;return t=e<0||e>9999?(e<0?`-`:`+`)+IY(Math.abs(e),6):IY(e,4),t}function NZ(e){return IY(e,2)}function PZ(e,t){let n;if(t===`auto`){if(e===0)return``;n=IY(e,9).replace(/0+$/,``)}else{if(t===0)return``;n=IY(e,9).slice(0,t)}return`.${n}`}function FZ(e,t,n,r,i){let a=`${NZ(e)}:${NZ(t)}`;return i===`minute`||(a+=`:${NZ(n)}`,a+=PZ(r,i)),a}function IZ(e,t,n){let r=t;r===void 0&&(r=`UTC`);let i=Q(e,sJ),a=BZ(DZ(r,i),`iso8601`,n,`never`),o=`Z`;return t!==void 0&&(o=QZ(TZ(r,i))),`${a}${o}`}function LZ(e,t){let n=Q(e,hJ),r=Q(e,gJ),i=Q(e,_J),a=Q(e,vJ),o=Q(e,yJ),s=Q(e,bJ),c=sQ(e),l=``;n!==0&&(l+=`${Math.abs(n)}Y`),r!==0&&(l+=`${Math.abs(r)}M`),i!==0&&(l+=`${Math.abs(i)}W`),a!==0&&(l+=`${Math.abs(a)}D`);let u=``;o!==0&&(u+=`${Math.abs(o)}H`),s!==0&&(u+=`${Math.abs(s)}M`);let d=QJ.fromComponents(0,0,Q(e,xJ),Q(e,SJ),Q(e,CJ),Q(e,wJ));d.isZero()&&![`second`,`millisecond`,`microsecond`,`nanosecond`].includes(NX(e))&&t===`auto`||(u+=`${Math.abs(d.sec)}${PZ(Math.abs(d.subsec),t)}S`);let f=`${c<0?`-`:``}P${l}`;return u&&(f=`${f}T${u}`),f}function RZ(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,cJ);return`${MZ(n)}-${NZ(r)}-${NZ(i)}${oX(Q(e,Z),t)}`}function zZ({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o){return FZ(e,t,n,1e6*r+1e3*i+a,o)}function BZ(e,t,n,r=`auto`){let{isoDate:{year:i,month:a,day:o},time:{hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}=e;return`${MZ(i)}-${NZ(a)}-${NZ(o)}T${FZ(s,c,l,1e6*u+1e3*d+f,n)}${oX(t,r)}`}function VZ(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,cJ),a=`${NZ(r)}-${NZ(i)}`,o=Q(e,Z);t!==`always`&&t!==`critical`&&o===`iso8601`||(a=`${MZ(n)}-${a}`);let s=oX(o,t);return s&&(a+=s),a}function HZ(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,cJ),a=`${MZ(n)}-${NZ(r)}`,o=Q(e,Z);t!==`always`&&t!==`critical`&&o===`iso8601`||(a+=`-${NZ(i)}`);let s=oX(o,t);return s&&(a+=s),a}function UZ(e,t,n=`auto`,r=`auto`,i=`auto`,a=void 0){let o=Q(e,sJ);if(a){let{unit:e,increment:t,roundingMode:n}=a;o=c$(o,t,e,n)}let s=Q(e,mJ),c=TZ(s,o),l=BZ(DZ(s,o),`iso8601`,t,`never`);return i!==`never`&&(l+=QZ(c)),r!==`never`&&(l+=`[${r===`critical`?`!`:``}${s}]`),l+=oX(Q(e,Z),n),l}function WZ(e){return pX.test(e)}function GZ(e){let t=Lue.exec(e);if(!t)throw RangeError(`invalid time zone offset: ${e}; must match ±HH:MM[:SS.SSSSSSSSS]`);return(t[1]===`-`?-1:1)*(1e9*(60*(60*t[2]+ +(t[3]||0))+ +(t[4]||0))+ +((t[5]||0)+`000000000`).slice(0,9))}var KZ,qZ=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function JZ(e){if(KZ===void 0){let e=Intl.supportedValuesOf?.(`timeZone`);if(e){KZ=new Map;for(let t=0;t<e.length;t++){let n=e[t];KZ.set(D$(n),n)}}else KZ=null}let t=D$(e),n=KZ?.get(t);if(n)return{identifier:n,primaryIdentifier:n};try{n=XY(e).resolvedOptions().timeZone}catch{return}if(t===`antarctica/south_pole`&&(n=`Antarctica/McMurdo`),kY.has(e))throw RangeError(`${e} is a legacy time zone identifier from ICU. Use ${n} instead`);let r=[...t].map(((e,n)=>n===0||qZ[t[n-1]]?e.toUpperCase():e)).join(``).split(`/`);if(r.length===1)return t===`gb-eire`?{identifier:`GB-Eire`,primaryIdentifier:n}:{identifier:t.length<=3||/[-0-9]/.test(t)?t.toUpperCase():r[0],primaryIdentifier:n};if(r[0]===`Etc`)return{identifier:`Etc/${[`Zulu`,`Greenwich`,`Universal`].includes(r[1])?r[1]:r[1].toUpperCase()}`,primaryIdentifier:n};if(r[0]===`Us`)return{identifier:`US/${r[1]}`,primaryIdentifier:n};let i=new Map([[`Act`,`ACT`],[`Lhi`,`LHI`],[`Nsw`,`NSW`],[`Dar_Es_Salaam`,`Dar_es_Salaam`],[`Port_Of_Spain`,`Port_of_Spain`],[`Port-Au-Prince`,`Port-au-Prince`],[`Isle_Of_Man`,`Isle_of_Man`],[`Comodrivadavia`,`ComodRivadavia`],[`Knox_In`,`Knox_IN`],[`Dumontdurville`,`DumontDUrville`],[`Mcmurdo`,`McMurdo`],[`Denoronha`,`DeNoronha`],[`Easterisland`,`EasterIsland`],[`Bajanorte`,`BajaNorte`],[`Bajasur`,`BajaSur`]]);return r[1]=i.get(r[1])??r[1],r.length>2&&(r[2]=i.get(r[2])??r[2]),{identifier:r.join(`/`),primaryIdentifier:n}}function YZ(e,t){let{year:n,month:r,day:i,hour:a,minute:o,second:s}=iQ(e,t),c=t%1e3;return c<0&&(c+=1e3),1e6*($Z({isoDate:{year:n,month:r,day:i},time:{hour:a,minute:o,second:s,millisecond:c}})-t)}function XZ(e,t){return YZ(e,_$(t,`floor`))}function ZZ(e){let t=e<0?`-`:`+`,n=Math.abs(e);return`${t}${FZ(Math.floor(n/60),n%60,0,0,`minute`)}`}function QZ(e){return ZZ(s$(e,vY,`halfExpand`)/6e10)}function $Z({isoDate:{year:e,month:t,day:n},time:{hour:r,minute:i,second:a,millisecond:o}}){let s=e%400,c=(e-s)/400,l=new Date;return l.setUTCHours(r,i,a,o),l.setUTCFullYear(s,t-1,n),l.getTime()+wY*c}function eQ(e){let t=$Z(e),n=1e3*e.time.microsecond+e.time.nanosecond;return X.default.add(v$(t),X.default.BigInt(n))}function tQ(e){let t=_$(e,`trunc`),n=X.default.toNumber(X.default.remainder(e,Yq));n<0&&(n+=1e6,--t);let r=Math.floor(n/1e3)%1e3,i=n%1e3,a=new Date(t);return{epochMilliseconds:t,isoDate:{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate()},time:{hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.getUTCMilliseconds(),microsecond:r,nanosecond:i}}}function nQ(e,t){if(e===`UTC`)return null;let n=_$(t,`floor`);if(n<DY)return nQ(e,v$(DY));let r=Math.max(n,Date.now())+366*gY*3,i=n,a=YZ(e,i),o=i,s=a;for(;a===s&&i<r;){if(o=i+2*gY*7,o>yY)return null;s=YZ(e,o),a===s&&(i=o)}return a===s?null:v$(k$((t=>YZ(e,t)),i,o,a,s))}function rQ(e,t){if(e===`UTC`)return null;let n=_$(t,`ceil`),r=Date.now(),i=r+366*gY*3;if(n>i){let t=rQ(e,v$(i));if(t===null||X.default.lessThan(t,v$(r)))return t}if(e===`Africa/Casablanca`||e===`Africa/El_Aaiun`){let t=Date.UTC(2088,0,1);if(t<n)return rQ(e,v$(t))}let a=n-1;if(a<DY)return null;let o=YZ(e,a),s=a,c=o;for(;o===c&&a>DY;){if(s=a-2*gY*7,s<DY)return null;c=YZ(e,s),o===c&&(a=s)}return o===c?null:v$(k$((t=>YZ(e,t)),s,a,c,o))}function iQ(e,t){return function(e){let t=e.split(/[^\w]+/);if(t.length!==7)throw RangeError(`expected 7 parts in "${e}`);let n=+t[0],r=+t[1],i=+t[2],a=t[3];if(a[0]===`b`||a[0]===`B`)i=1-i;else if(a[0]!==`a`&&a[0]!==`A`)throw RangeError(`Unknown era ${a} in "${e}`);let o=t[4]===`24`?0:+t[4],s=+t[5],c=+t[6];if(!(Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(s)&&Number.isFinite(c)))throw RangeError(`Invalid number in "${e}`);return{year:i,month:n,day:r,hour:o,minute:s,second:c}}(XY(e).format(t))}function aQ(e){return e!==void 0&&!(e%4!=0||e%100==0&&e%400!=0)}function oQ(e,t){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[aQ(e)?`leapyear`:`standard`][t-1]}function sQ(e){let t=[Q(e,hJ),Q(e,gJ),Q(e,_J),Q(e,vJ),Q(e,yJ),Q(e,bJ),Q(e,xJ),Q(e,SJ),Q(e,CJ),Q(e,wJ)];for(let e=0;e<t.length;e++){let n=t[e];if(n!==0)return n<0?-1:1}return 0}function cQ(e){let t=[`years`,`months`,`weeks`,`days`];for(let n=0;n<t.length;n++){let r=e[t[n]];if(r!==0)return r<0?-1:1}return 0}function lQ(e){let t=cQ(e.date);return t===0?e.time.sign():t}function uQ(e,t){let n=e,r=t;if(!Number.isFinite(n)||!Number.isFinite(r))throw RangeError(`infinity is out of range`);return--r,n+=Math.floor(r/12),r%=12,r<0&&(r+=12),r+=1,{year:n,month:r}}function dQ(e,t,n){let r=e,i=t,a=n;if(!Number.isFinite(a))throw RangeError(`infinity is out of range`);({year:r,month:i}=uQ(r,i));let o=146097;if(Math.abs(a)>o){let e=Math.trunc(a/o);r+=400*e,a-=e*o}let s=0,c=i>2?r:r-1;for(;s=aQ(c)?366:365,a<-s;)--r,--c,a+=s;for(c+=1;s=aQ(c)?366:365,a>s;)r+=1,c+=1,a-=s;for(;a<1;)({year:r,month:i}=uQ(r,i-1)),a+=oQ(r,i);for(;a>oQ(r,i);)a-=oQ(r,i),{year:r,month:i}=uQ(r,i+1);return{year:r,month:i,day:a}}function fQ(e,t,n,r,i,a,o,s,c){let l=pQ(r,i,a,o,s,c);return bX(dQ(e,t,n+l.deltaDays),l)}function pQ(e,t,n,r,i,a){let o,s=e,c=t,l=n,u=r,d=i,f=a;({div:o,mod:f}=JJ(f,3)),d+=o,f<0&&(--d,f+=1e3),{div:o,mod:d}=JJ(d,3),u+=o,d<0&&(--u,d+=1e3),l+=Math.trunc(u/1e3),u%=1e3,u<0&&(--l,u+=1e3),c+=Math.trunc(l/60),l%=60,l<0&&(--c,l+=60),s+=Math.trunc(c/60),c%=60,c<0&&(--s,c+=60);let p=Math.trunc(s/24);return s%=24,s<0&&(--p,s+=24),p+=0,s+=0,c+=0,l+=0,u+=0,d+=0,f+=0,{deltaDays:p,hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}function mQ(e,t){let n=yX(e,0);if(cQ(n)===0)return e.days;let r=Q(t,cJ),i=hZ(Q(t,Z),r,n,`constrain`),a=NQ(r.year,r.month-1,r.day),o=NQ(i.year,i.month-1,i.day)-a;return e.days+o}function hQ(e){return new(qJ(`%Temporal.Duration%`))(-Q(e,hJ),-Q(e,gJ),-Q(e,_J),-Q(e,vJ),-Q(e,yJ),-Q(e,bJ),-Q(e,xJ),-Q(e,SJ),-Q(e,CJ),-Q(e,wJ))}function gQ(e,t,n){return Math.min(n,Math.max(t,e))}function _Q(e,t,n){let r=gQ(t,1,12);return{year:e,month:r,day:gQ(n,1,oQ(e,r))}}function vQ(e,t,n){if(e<t||e>n)throw RangeError(`value out of range: ${t} <= ${e} <= ${n}`)}function yQ(e,t,n){vQ(t,1,12),vQ(n,1,oQ(e,t))}function bQ(e){CQ(bX(e,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function xQ(e,t,n,r,i,a){vQ(e,0,23),vQ(t,0,59),vQ(n,0,59),vQ(r,0,999),vQ(i,0,999),vQ(a,0,999)}function SQ(e,t,n,r,i,a,o,s,c){yQ(e,t,n),xQ(r,i,a,o,s,c)}function CQ(e){let t=eQ(e);(X.default.lessThan(t,SY)||X.default.greaterThan(t,CY))&&TQ(t)}function wQ(e){eQ(e)}function TQ(e){if(X.default.lessThan(e,xY)||X.default.greaterThan(e,bY))throw RangeError(`date/time value is outside of supported range`)}function EQ({year:e,month:t}){vQ(e,TY,EY),e===TY?vQ(t,4,12):e===EY&&vQ(t,1,9)}function DQ(e,t,n,r,i,a,o,s,c,l){let u=0,d=[e,t,n,r,i,a,o,s,c,l];for(let e=0;e<d.length;e++){let t=d[e];if(t===1/0||t===-1/0)throw RangeError(`infinite values not allowed as duration fields`);if(t!==0){let e=t<0?-1:1;if(u!==0&&e!==u)throw RangeError(`mixed-sign values not allowed as duration fields`);u=e}}if(Math.abs(e)>=2**32||Math.abs(t)>=2**32||Math.abs(n)>=2**32)throw RangeError(`years, months, and weeks must be < 2³²`);let f=JJ(s,3),p=JJ(c,6),m=JJ(l,9),h=JJ(1e6*f.mod+1e3*p.mod+m.mod,9).div,g=86400*r+3600*i+60*a+o+f.div+p.div+m.div+h;if(!Number.isSafeInteger(g))throw RangeError(`total of duration time units cannot exceed 9007199254740991.999999999 s`)}function OQ(e){return{date:{years:Q(e,hJ),months:Q(e,gJ),weeks:Q(e,_J),days:Q(e,vJ)},time:QJ.fromComponents(Q(e,yJ),Q(e,bJ),Q(e,xJ),Q(e,SJ),Q(e,CJ),Q(e,wJ))}}function kQ(e){let t=QJ.fromComponents(Q(e,yJ),Q(e,bJ),Q(e,xJ),Q(e,SJ),Q(e,CJ),Q(e,wJ)).add24HourDays(Q(e,vJ));return{date:{years:Q(e,hJ),months:Q(e,gJ),weeks:Q(e,_J),days:0},time:t}}function AQ(e){let t=kQ(e),n=Math.trunc(t.time.sec/86400);return DQ(t.date.years,t.date.months,t.date.weeks,n,0,0,0,0,0,0),{...t.date,days:n}}function jQ(e,t){let n=e.time.sign(),r=e.time.abs().subsec,i=0,a=0,o=e.time.abs().sec,s=0,c=0,l=0;switch(t){case`year`:case`month`:case`week`:case`day`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60,c=Math.trunc(s/60),s%=60,l=Math.trunc(c/24),c%=24;break;case`hour`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60,c=Math.trunc(s/60),s%=60;break;case`minute`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60;break;case`second`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3;break;case`millisecond`:i=Math.trunc(r/1e3),r%=1e3,a=YJ(o,3,Math.trunc(i/1e3)),i%=1e3,o=0;break;case`microsecond`:i=YJ(o,6,Math.trunc(r/1e3)),r%=1e3,o=0;break;case`nanosecond`:r=YJ(o,9,r),o=0}return new(qJ(`%Temporal.Duration%`))(e.date.years,e.date.months,e.date.weeks,e.date.days+n*l,n*c,n*s,n*o,n*a,n*i,n*r)}function MQ(e,t){return cQ(e),t.sign(),{date:e,time:t}}function NQ(e,t,n){return $Z({isoDate:{year:e,month:t+1,day:n},time:{hour:0,minute:0,second:0,millisecond:0}})/gY}function PQ({year:e,month:t,day:n}){if(Math.abs(NQ(e,t-1,n))>1e8)throw RangeError(`date/time value is outside the supported range`)}function FQ(e,t){let n=t.hour-e.hour,r=t.minute-e.minute,i=t.second-e.second,a=t.millisecond-e.millisecond,o=t.microsecond-e.microsecond,s=t.nanosecond-e.nanosecond;return QJ.fromComponents(n,r,i,a,o,s)}function IQ(e,t,n,r,i){let a=QJ.fromEpochNsDiff(t,e);return a=d$(a,n,r,i),MQ({years:0,months:0,weeks:0,days:0},a)}function LQ(e,t,n,r){wQ(e),wQ(t);let i=FQ(e.time,t.time),a=i.sign(),o=p$(e.isoDate,t.isoDate),s=t.isoDate;o===a&&(s=dQ(s.year,s.month,s.day+a),i=i.add24HourDays(-a));let c=PX(`day`,r),l=gZ(n,e.isoDate,s,c);return r!==c&&(i=i.add24HourDays(l.days),l.days=0),MQ(l,i)}function RQ(e,t,n,r,i){let a=X.default.subtract(t,e);if(X.default.equal(a,Hq))return{date:{years:0,months:0,weeks:0,days:0},time:QJ.ZERO};let o=X.default.lessThan(a,Hq)?-1:1,s=DZ(n,e),c=DZ(n,t),l,u=0,d=o===1?2:1,f=FQ(s.time,c.time);for(f.sign()===-o&&u++;u<=d;u++){l=bX(dQ(c.isoDate.year,c.isoDate.month,c.isoDate.day-u*o),s.time);let e=OZ(n,l,`compatible`);if(f=QJ.fromEpochNsDiff(t,e),f.sign()!==-o)break}let p=PX(`day`,i);return MQ(gZ(r,s.isoDate,l.isoDate,p),f)}function zQ(e,t,n,r,i,a,o,s,c){let l,u,d,f,p=t;switch(s){case`year`:{let t=s$(p.date.years,o,`trunc`);l=t,u=t+o*e,d={years:l,months:0,weeks:0,days:0},f={...d,years:u};break}case`month`:{let t=s$(p.date.months,o,`trunc`);l=t,u=t+o*e,d=yX(p.date,0,0,l),f=yX(p.date,0,0,u);break}case`week`:{let t=yX(p.date,0,0),n=hZ(a,r.isoDate,t,`constrain`),i=gZ(a,n,dQ(n.year,n.month,n.day+p.date.days),`week`),s=s$(p.date.weeks+i.weeks,o,`trunc`);l=s,u=s+o*e,d=yX(p.date,0,l),f=yX(p.date,0,u);break}case`day`:{let t=s$(p.date.days,o,`trunc`);l=t,u=t+o*e,d=yX(p.date,l),f=yX(p.date,u);break}}let m=hZ(a,r.isoDate,d,`constrain`),h=hZ(a,r.isoDate,f,`constrain`),g,_,v=bX(m,r.time),y=bX(h,r.time);i?(g=OZ(i,v,`compatible`),_=OZ(i,y,`compatible`)):(g=eQ(v),_=eQ(y));let b=QJ.fromEpochNsDiff(n,g),x=QJ.fromEpochNsDiff(_,g),S=XJ(c,e<0?`negative`:`positive`),C=b.add(b).abs().subtract(x.abs()).sign(),w=Math.abs(l)/o%2==0,T=b.isZero()?Math.abs(l):b.cmp(x)?ZJ(Math.abs(l),Math.abs(u),C,w,S):Math.abs(u),E=new QJ(X.default.add(X.default.multiply(x.totalNs,X.default.BigInt(l)),X.default.multiply(b.totalNs,X.default.BigInt(o*e)))).fdiv(x.totalNs),D=T===Math.abs(u);return p={date:D?f:d,time:QJ.ZERO},{nudgeResult:{duration:p,nudgedEpochNs:D?_:g,didExpandCalendarUnit:D},total:E}}function BQ(e,t,n,r,i,a,o,s,c){let l=e,u=FX(s)||r&&s===`day`,d=lQ(l)<0?-1:1,f;return u?{nudgeResult:f}=zQ(d,l,t,n,r,i,o,s,c):f=r?function(e,t,n,r,i,a,o,s){let c=t,l=hZ(i,n.isoDate,c.date,`constrain`),u=bX(l,n.time),d=bX(dQ(l.year,l.month,l.day+e),n.time),f=OZ(r,u,`compatible`),p=OZ(r,d,`compatible`),m=QJ.fromEpochNsDiff(p,f);if(m.sign()!==e)throw RangeError(`time zone returned inconsistent Instants`);let h=X.default.BigInt(KY[o]*a),g=c.time.round(h,s),_=g.subtract(m),v=_.sign()!==-e,y,b;return v?(y=e,g=_.round(h,s),b=g.addToEpochNs(p)):(y=0,b=g.addToEpochNs(f)),{duration:MQ(yX(c.date,c.date.days+y),g),nudgedEpochNs:b,didExpandCalendarUnit:v}}(d,l,n,r,i,o,s,c):function(e,t,n,r,i,a){let o=e,s=o.time.add24HourDays(o.date.days),c=s.round(X.default.BigInt(r*KY[i]),a),l=c.subtract(s),{quotient:u}=s.divmod(_Y),{quotient:d}=c.divmod(_Y),f=Math.sign(d-u)===s.sign(),p=l.addToEpochNs(t),m=0,h=c;return IX(n)===`date`&&(m=d,h=c.add(QJ.fromComponents(24*-d,0,0,0,0,0))),{duration:{date:yX(o.date,m),time:h},nudgedEpochNs:p,didExpandCalendarUnit:f}}(l,t,a,o,s,c),l=f.duration,f.didExpandCalendarUnit&&s!==`week`&&(l=function(e,t,n,r,i,a,o,s){let c=t;if(s===o)return c;let l=GY.indexOf(o);for(let t=GY.indexOf(s)-1;t>=l;t--){let s=GY[t];if(s===`week`&&o!==`week`)continue;let l;switch(s){case`year`:l={years:c.date.years+e,months:0,weeks:0,days:0};break;case`month`:{let t=c.date.months+e;l=yX(c.date,0,0,t);break}case`week`:{let t=c.date.weeks+e;l=yX(c.date,0,t);break}}let u=bX(hZ(a,r.isoDate,l,`constrain`),r.time),d;if(d=i?OZ(i,u,`compatible`):eQ(u),rJ(n,d)===-e)break;c={date:l,time:QJ.ZERO}}return c}(d,l,f.nudgedEpochNs,n,r,i,a,PX(s,`day`))),l}function VQ(e,t,n,r,i,a){return FX(a)||r&&a===`day`?zQ(lQ(e)<0?-1:1,e,t,n,r,i,1,a,`trunc`).total:f$(e.time.add24HourDays(e.date.days),a)}function HQ(e,t,n,r,i,a,o){if(h$(e,t)==0)return{date:{years:0,months:0,weeks:0,days:0},time:QJ.ZERO};CQ(e),CQ(t);let s=LQ(e,t,n,r);return a===`nanosecond`&&i===1?s:BQ(s,eQ(t),e,null,n,r,i,a,o)}function UQ(e,t,n,r,i,a,o,s){if(IX(i)===`time`)return IQ(e,t,a,o,s);let c=RQ(e,t,n,r,i);return o===`nanosecond`&&a===1?c:BQ(c,t,DZ(n,e),n,r,i,a,o,s)}function WQ(e,t,n,r,i,a){let o=HY.reduce(((e,t)=>{let i=t[0],a=t[1],o=t[2];return n!==`datetime`&&o!==n||r.includes(a)||e.push(a,i),e}),[]),s=jX(t,`largestUnit`,n,`auto`);if(r.includes(s))throw RangeError(`largestUnit must be one of ${o.join(`, `)}, not ${s}`);let c=EX(t),l=CX(t,`trunc`);e===`since`&&(l=function(e){switch(e){case`ceil`:return`floor`;case`floor`:return`ceil`;case`halfCeil`:return`halfFloor`;case`halfFloor`:return`halfCeil`;default:return e}}(l));let u=jX(t,`smallestUnit`,n,i);if(r.includes(u))throw RangeError(`smallestUnit must be one of ${o.join(`, `)}, not ${u}`);let d=PX(a,u);if(s===`auto`&&(s=d),PX(s,u)!==s)throw RangeError(`largestUnit ${s} cannot be smaller than smallestUnit ${u}`);let f={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[u];return f!==void 0&&DX(c,f,!1),{largestUnit:s,roundingIncrement:c,roundingMode:l,smallestUnit:u}}function GQ(e,t,n,r){let i=KX(n),a=WQ(e,C$(r),`time`,[],`nanosecond`,`second`),o=jQ(IQ(Q(t,sJ),Q(i,sJ),a.roundingIncrement,a.smallestUnit,a.roundingMode),a.largestUnit);return e===`since`&&(o=hQ(o)),o}function KQ(e,t,n,r){let i=HX(n),a=Q(t,Z),o=Q(i,Z);if(!yZ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=WQ(e,C$(r),`date`,[],`day`,`day`),c=qJ(`%Temporal.Duration%`),l=Q(t,cJ),u=Q(i,cJ);if(p$(l,u)===0)return new c;let d={date:gZ(a,l,u,s.largestUnit),time:QJ.ZERO};if(s.smallestUnit!==`day`||s.roundingIncrement!==1){let e=bX(l,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});d=BQ(d,eQ(bX(u,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),e,null,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode)}let f=jQ(d,`day`);return e===`since`&&(f=hQ(f)),f}function qQ(e,t,n,r){let i=WX(n),a=Q(t,Z),o=Q(i,Z);if(!yZ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=WQ(e,C$(r),`datetime`,[],`nanosecond`,`day`),c=qJ(`%Temporal.Duration%`),l=Q(t,lJ),u=Q(i,lJ);if(h$(l,u)===0)return new c;let d=jQ(HQ(l,u,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);return e===`since`&&(d=hQ(d)),d}function JQ(e,t,n,r){let i=JX(n),a=WQ(e,C$(r),`time`,[],`nanosecond`,`hour`),o=FQ(Q(t,uJ),Q(i,uJ));o=d$(o,a.roundingIncrement,a.smallestUnit,a.roundingMode);let s=jQ(MQ({years:0,months:0,weeks:0,days:0},o),a.largestUnit);return e===`since`&&(s=hQ(s)),s}function YQ(e,t,n,r){let i=XX(n),a=Q(t,Z),o=Q(i,Z);if(!yZ(a,o))throw RangeError(`cannot compute difference between months of ${a} and ${o} calendars`);let s=WQ(e,C$(r),`date`,[`week`,`day`],`month`,`year`),c=qJ(`%Temporal.Duration%`);if(p$(Q(t,cJ),Q(i,cJ))==0)return new c;let l=zX(a,Q(t,cJ),`year-month`);l.day=1;let u=bZ(a,l,`constrain`),d=zX(a,Q(i,cJ),`year-month`);d.day=1;let f=bZ(a,d,`constrain`),p={date:yX(gZ(a,u,f,s.largestUnit),0,0),time:QJ.ZERO};if(s.smallestUnit!==`month`||s.roundingIncrement!==1){let e=bX(u,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});p=BQ(p,eQ(bX(f,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),e,null,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode)}let m=jQ(p,`day`);return e===`since`&&(m=hQ(m)),m}function XQ(e,t,n,r){let i=QX(n),a=Q(t,Z),o=Q(i,Z);if(!yZ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=WQ(e,C$(r),`datetime`,[],`nanosecond`,`hour`),c=Q(t,sJ),l=Q(i,sJ),u=qJ(`%Temporal.Duration%`),d;if(IX(s.largestUnit)!==`date`)d=jQ(IQ(c,l,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);else{let e=Q(t,mJ);if(!wZ(e,Q(i,mJ)))throw RangeError(`When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.`);if(X.default.equal(c,l))return new u;d=jQ(UQ(c,l,e,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),`hour`)}return e===`since`&&(d=hQ(d)),d}function ZQ({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o){let s=n,c=a;return s+=o.sec,c+=o.subsec,pQ(e,t,s,r,i,c)}function QQ(e,t){let n=t.addToEpochNs(e);return TQ(n),n}function $Q(e,t,n,r,i=`constrain`){if(cQ(r.date)===0)return QQ(e,r.time);let a=DZ(t,e);return QQ(OZ(t,bX(hZ(n,a.isoDate,r.date,i),a.time),`compatible`),r.time)}function e$(e,t,n){let r=GX(n);e===`subtract`&&(r=hQ(r));let i=PX(NX(t),NX(r));if(FX(i))throw RangeError(`For years, months, or weeks arithmetic, use date arithmetic relative to a starting point`);let a=kQ(t),o=kQ(r);return jQ(MQ({years:0,months:0,weeks:0,days:0},a.time.add(o.time)),i)}function t$(e,t,n){let r=GX(n);e===`subtract`&&(r=hQ(r));let i=NX(r);if(IX(i)===`date`)throw RangeError(`Duration field ${i} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let a=kQ(r);return uZ(QQ(Q(t,sJ),a.time))}function n$(e,t,n,r){let i=Q(t,Z),a=GX(n);e===`subtract`&&(a=hQ(a));let o=AQ(a),s=xX(C$(r));return eZ(hZ(i,Q(t,cJ),o,s),i)}function r$(e,t,n,r){let i=GX(n);e===`subtract`&&(i=hQ(i));let a=xX(C$(r)),o=Q(t,Z),s=kQ(i),c=Q(t,lJ),l=ZQ(c.time,s.time),u=yX(s.date,l.deltaDays);return DQ(u.years,u.months,u.weeks,u.days,0,0,0,0,0,0),nZ(bX(hZ(o,c.isoDate,u,a),l),o)}function i$(e,t,n){let r=GX(n);e===`subtract`&&(r=hQ(r));let i=kQ(r),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=ZQ(Q(t,uJ),i.time);return oZ(_X(a,o,s,c,l,u,`reject`))}function a$(e,t,n,r){let i=GX(n);e===`subtract`&&(i=hQ(i));let a=xX(C$(r)),o=sQ(i),s=Q(t,Z),c=zX(s,Q(t,cJ),`year-month`);c.day=1;let l=bZ(s,c,`constrain`);if(o<0){let e=hZ(s,l,{months:1},`constrain`);l=dQ(e.year,e.month,e.day-1)}let u=AQ(i);return bQ(l),cZ(xZ(s,zX(s,hZ(s,l,u,a),`year-month`),a),s)}function o$(e,t,n,r){let i=GX(n);e===`subtract`&&(i=hQ(i));let a=xX(C$(r)),o=Q(t,mJ),s=Q(t,Z),c=OQ(i);return fZ($Q(Q(t,sJ),o,s,c,a),o,s)}function s$(e,t,n){let r=Math.trunc(e/t),i=e%t,a=e<0?`negative`:`positive`,o=Math.abs(r),s=o+1,c=S$(Math.abs(2*i)-t),l=o%2==0,u=XJ(n,a),d=i===0?o:ZJ(o,s,c,l,u);return t*(a===`positive`?d:-d)}function c$(e,t,n,r){let i=KY[n]*t;return function(e,t,n){let r=eJ(e),i=eJ(t),a=X.default.divide(r,i),o=X.default.remainder(r,i),s=XJ(n,`positive`),c,l;X.default.lessThan(r,Hq)?(c=X.default.subtract(a,Uq),l=a):(c=a,l=X.default.add(a,Uq));let u=rJ(nJ(X.default.multiply(o,Wq)),i)*(X.default.lessThan(r,Hq)?-1:1)+0,d=X.default.equal(o,Hq)?a:ZJ(c,l,u,tJ(c),s);return X.default.multiply(d,i)}(e,X.default.BigInt(i),r)}function l$(e,t,n,r){wQ(e);let{year:i,month:a,day:o}=e.isoDate,s=u$(e.time,t,n,r);return bX(dQ(i,a,o+s.deltaDays),s)}function u$({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o,s,c){let l;switch(s){case`day`:case`hour`:l=1e3*(1e3*(1e3*(60*(60*e+t)+n)+r)+i)+a;break;case`minute`:l=1e3*(1e3*(1e3*(60*t+n)+r)+i)+a;break;case`second`:l=1e3*(1e3*(1e3*n+r)+i)+a;break;case`millisecond`:l=1e3*(1e3*r+i)+a;break;case`microsecond`:l=1e3*i+a;break;case`nanosecond`:l=a}let u=KY[s],d=s$(l,u*o,c)/u;switch(s){case`day`:return{deltaDays:d,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case`hour`:return pQ(d,0,0,0,0,0);case`minute`:return pQ(e,d,0,0,0,0);case`second`:return pQ(e,t,d,0,0,0);case`millisecond`:return pQ(e,t,n,d,0,0);case`microsecond`:return pQ(e,t,n,r,d,0);case`nanosecond`:return pQ(e,t,n,r,i,d);default:throw Error(`Invalid unit ${s}`)}}function d$(e,t,n,r){let i=KY[n];return e.round(X.default.BigInt(i*t),r)}function f$(e,t){let n=KY[t];return e.fdiv(X.default.BigInt(n))}function p$(e,t){return e.year===t.year?e.month===t.month?e.day===t.day?0:S$(e.day-t.day):S$(e.month-t.month):S$(e.year-t.year)}function m$(e,t){return e.hour===t.hour?e.minute===t.minute?e.second===t.second?e.millisecond===t.millisecond?e.microsecond===t.microsecond?e.nanosecond===t.nanosecond?0:S$(e.nanosecond-t.nanosecond):S$(e.microsecond-t.microsecond):S$(e.millisecond-t.millisecond):S$(e.second-t.second):S$(e.minute-t.minute):S$(e.hour-t.hour)}function h$(e,t){let n=p$(e.isoDate,t.isoDate);return n===0?m$(e.time,t.time):n}function g$(e){let t=y$(e);return globalThis.BigInt===void 0?t:globalThis.BigInt(t.toString(10))}function _$(e,t){let{quotient:n,remainder:r}=iJ(eJ(e),Yq),i=X.default.toNumber(n);return t===`floor`&&X.default.toNumber(r)<0&&--i,t===`ceil`&&X.default.toNumber(r)>0&&(i+=1),i}function v$(e){if(!Number.isInteger(e))throw RangeError(`epoch milliseconds must be an integer`);return X.default.multiply(X.default.BigInt(e),Yq)}function y$(e){let t=e;if(typeof e==`object`){let n=e[Symbol.toPrimitive];n&&typeof n==`function`&&(t=n.call(e,`number`))}if(typeof t==`number`)throw TypeError(`cannot convert number to bigint`);return typeof t==`bigint`?X.default.BigInt(t.toString(10)):X.default.BigInt(t)}var b$=(()=>{let e=X.default.BigInt(Date.now()%1e6);return()=>{let t=Date.now(),n=X.default.BigInt(t),r=X.default.add(v$(t),e);return e=X.default.remainder(n,Yq),X.default.greaterThan(r,bY)?bY:X.default.lessThan(r,xY)?xY:r}})();function x$(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function S$(e){return e<0?-1:e>0?1:e}function C$(e){if(e===void 0)return Object.create(null);if(AY(e)&&e!==null)return e;throw TypeError(`Options parameter must be an object, not `+(e===null?`null`:typeof e))}function w$(e,t){let n=Object.create(null);return n[e]=t,n}function T$(e,t,n,r){let i=e[t];if(i!==void 0){if(i=MY(i),!n.includes(i))throw RangeError(`${t} must be one of ${n.join(`, `)}, not ${i}`);return i}if(r===AX)throw RangeError(`${t} option is required`);return r}function E$(e){let t=D$(e);if(!OY.includes(D$(t)))throw RangeError(`invalid calendar identifier ${t}`);switch(t){case`ethiopic-amete-alem`:return`ethioaa`;case`islamicc`:return`islamic-civil`}return t}function D$(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t+=r>=65&&r<=90?String.fromCharCode(r+32):String.fromCharCode(r)}return t}function O$(e){throw TypeError(`Do not use built-in arithmetic operators with Temporal objects. When comparing, use ${e===`PlainMonthDay`?`Temporal.PlainDate.compare(obj1.toPlainDate(year), obj2.toPlainDate(year))`:`Temporal.${e}.compare(obj1, obj2)`}, not obj1 > obj2. When coercing to strings, use \`\${obj}\` or String(obj), not '' + obj. When coercing to numbers, use properties or methods of the object, not \`+obj\`. When concatenating with strings, use \`\${str}\${obj}\` or str.concat(obj), not str + obj. In React, coerce to a string before rendering a Temporal object.`)}var Iue=RegExp(`^${oY.source}$`),Lue=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\\d{1,9}))?)?)?$`);function k$(e,t,n,r=e(t),i=e(n)){let a=t,o=n,s=r,c=i;for(;o-a>1;){let t=Math.trunc((a+o)/2),n=e(t);n===s?(a=t,s=n):n===c&&(o=t,c=n)}return o}function A$(e){return[...e]}function j$(e,t){if(e!==`gregory`&&e!==`iso8601`)return;let n=N$[e],r=t.year,{dayOfWeek:i,dayOfYear:a,daysInYear:o}=n.isoToDate(t,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),s=n.getFirstDayOfWeek(),c=n.getMinimalDaysInFirstWeek(),l=(i+7-s)%7,u=(i-a+7001-s)%7,d=Math.floor((a-1+u)/7);if(7-u>=c&&++d,d==0)d=function(e,t,n,r){let i=(r-e-n+1)%7;i<0&&(i+=7);let a=Math.floor((n+i-1)/7);return 7-i>=t&&++a,a}(s,c,a+n.isoToDate(n.dateAdd(t,{years:-1},`constrain`),{daysInYear:!0}).daysInYear,i),r--;else if(a>=o-5){let e=(l+o-a)%7;e<0&&(e+=7),6-e>=c&&a+7-l>o&&(d=1,r++)}return{week:d,year:r}}function M$(e,t,n,r,i){if(t!==i.year){if(e*(t-i.year)>0)return!0}else if(n!==i.month){if(e*(n-i.month)>0)return!0}else if(r!==i.day&&e*(r-i.day)>0)return!0;return!1}var N$={};function P$(e){if(!e.startsWith(`M`))throw RangeError(`Invalid month code: ${e}. Month codes must start with M.`);let t=+e.slice(1);if(Number.isNaN(t))throw RangeError(`Invalid month code: ${e}`);return t}function F$(e,t=!1){return`M${`${e}`.padStart(2,`0`)}${t?`L`:``}`}function I$(e,t=void 0,n=12){let{month:r,monthCode:i}=e;if(i===void 0){if(r===void 0)throw TypeError(`Either month or monthCode are required`);t===`reject`&&vQ(r,1,n),t===`constrain`&&(r=gQ(r,1,n)),i=F$(r)}else{let e=P$(i);if(i!==F$(e))throw RangeError(`Invalid month code: ${i}`);if(r!==void 0&&r!==e)throw RangeError(`monthCode ${i} and month ${r} must match if both are present`);if(r=e,r<1||r>n)throw RangeError(`Invalid monthCode: ${i}`)}return{...e,month:r,monthCode:i}}N$.iso8601={resolveFields(e,t){if((t===`date`||t===`year-month`)&&e.year===void 0)throw TypeError(`year is required`);if((t===`date`||t===`month-day`)&&e.day===void 0)throw TypeError(`day is required`);Object.assign(e,I$(e))},dateToISO:(e,t)=>gX(e.year,e.month,e.day,t),monthDayToISOReferenceDate(e,t){let{month:n,day:r}=gX(e.year??1972,e.month,e.day,t);return{month:n,day:r,year:1972}},extraFields:()=>[],fieldKeysToIgnore(e){let t=new Set;for(let n=0;n<e.length;n++){let r=e[n];t.add(r),r===`month`?t.add(`monthCode`):r===`monthCode`&&t.add(`month`)}return A$(t)},dateAdd(e,{years:t=0,months:n=0,weeks:r=0,days:i=0},a){let{year:o,month:s,day:c}=e;return o+=t,s+=n,{year:o,month:s}=uQ(o,s),{year:o,month:s,day:c}=gX(o,s,c,a),c+=i+7*r,dQ(o,s,c)},dateUntil(e,t,n){let r=-p$(e,t);if(r===0)return{years:0,months:0,weeks:0,days:0};let i,a=0,o=0;if(n===`year`||n===`month`){let s=t.year-e.year;for(s!==0&&(s-=r);!M$(r,e.year+s,e.month,e.day,t);)a=s,s+=r;let c=r;for(i=uQ(e.year+a,e.month+c);!M$(r,i.year,i.month,e.day,t);)o=c,c+=r,i=uQ(i.year,i.month+r);n===`month`&&(o+=12*a,a=0)}i=uQ(e.year+a,e.month+o);let s=_Q(i.year,i.month,e.day),c=0,l=NQ(t.year,t.month-1,t.day)-NQ(s.year,s.month-1,s.day);return n===`week`&&(c=Math.trunc(l/7),l%=7),{years:a,months:o,weeks:c,days:l}},isoToDate({year:e,month:t,day:n},r){let i={era:void 0,eraYear:void 0,year:e,month:t,day:n,daysInWeek:7,monthsInYear:12};if(r.monthCode&&(i.monthCode=F$(t)),r.dayOfWeek){let r=t+(t<3?10:-2),a=e-+(t<3),o=Math.floor(a/100),s=a-100*o,c=(n+Math.floor(2.6*r-.2)+(s+Math.floor(s/4))+(Math.floor(o/4)-2*o))%7;i.dayOfWeek=c+(c<=0?7:0)}if(r.dayOfYear){let r=n;for(let n=t-1;n>0;n--)r+=oQ(e,n);i.dayOfYear=r}return r.weekOfYear&&(i.weekOfYear=j$(`iso8601`,{year:e,month:t,day:n})),r.daysInMonth&&(i.daysInMonth=oQ(e,t)),(r.daysInYear||r.inLeapYear)&&(i.inLeapYear=aQ(e),i.daysInYear=i.inLeapYear?366:365),i},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};var L$=class e{constructor(t){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,t!==void 0){let n=0;for(let r of t.map.entries()){if(++n>e.MAX_CACHE_ENTRIES)break;this.map.set(...r)}}}get(e){let t=this.map.get(e);return t&&(this.hits++,this.report()),this.calls++,t}set(e,t){this.map.set(e,t),this.misses++,this.report()}report(){}setObject(t){if(e.objectMap.get(t))throw RangeError(`object already cached`);e.objectMap.set(t,this),this.report()}static getCacheForObject(t){let n=e.objectMap.get(t);return n||(n=new e,e.objectMap.set(t,n)),n}};function R$({isoYear:e,isoMonth:t,isoDay:n}){return`${MZ(e)}-${NZ(t)}-${NZ(n)}T00:00Z`}function z$(e,t){return{years:e.year-t.year,months:e.month-t.month,days:e.day-t.day}}L$.objectMap=new WeakMap,L$.MAX_CACHE_ENTRIES=1e3;var B$=class{constructor(){this.eras=[],this.hasEra=!1,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new Intl.DateTimeFormat(`en-US-u-ca-${this.id}`,{day:`numeric`,month:`numeric`,year:`numeric`,era:`short`,timeZone:`UTC`})),this.formatter}getCalendarParts(e){let t=this.getFormatter(),n=new Date(e);if(e===`-271821-04-19T00:00Z`){let e=t.resolvedOptions();t=new Intl.DateTimeFormat(e.locale,{...e,timeZone:`Etc/GMT+1`}),n=new Date(`-271821-04-20T00:00Z`)}try{return t.formatToParts(n)}catch{throw RangeError(`Invalid ISO date: ${e}`)}}isoToCalendarDate(e,t){let{year:n,month:r,day:i}=e,a=JSON.stringify({func:`isoToCalendarDate`,isoYear:n,isoMonth:r,isoDay:i,id:this.id}),o=t.get(a);if(o)return o;let s=R$({isoYear:n,isoMonth:r,isoDay:i}),c=this.getCalendarParts(s),l={};for(let e=0;e<c.length;e++){let{type:t,value:n}=c[e];if(t!==`year`&&t!==`relatedYear`||(this.hasEra?l.eraYear=+n:l.year=+n),t===`month`){let e=/^([0-9]*)(.*?)$/.exec(n);if(!e||e.length!=3||!e[1]&&!e[2])throw RangeError(`Unexpected month: ${n}`);if(l.month=e[1]?+e[1]:1,l.month<1)throw RangeError(`Invalid month ${n} from ${s}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(l.month>13)throw RangeError(`Invalid month ${n} from ${s}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);e[2]&&(l.monthExtra=e[2])}t===`day`&&(l.day=+n),this.hasEra&&t===`era`&&n!=null&&n!==``&&(l.era=n.split(` (`)[0].normalize(`NFD`).replace(/[^-0-9 \p{L}]/gu,``).replace(/ /g,`-`).toLowerCase())}if(this.hasEra&&l.eraYear===void 0)throw RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.hasEra){let e=this.eras.find((e=>l.era===e.genericName));e&&(l.era=e.code)}if(this.reviseIntlEra){let{era:t,eraYear:n}=this.reviseIntlEra(l,e);l.era=t,l.eraYear=n}this.checkIcuBugs&&this.checkIcuBugs(e);let u=this.adjustCalendarDate(l,t,`constrain`,!0);if(u.year===void 0)throw RangeError(`Missing year converting ${JSON.stringify(e)}`);if(u.month===void 0)throw RangeError(`Missing month converting ${JSON.stringify(e)}`);if(u.day===void 0)throw RangeError(`Missing day converting ${JSON.stringify(e)}`);return t.set(a,u),[`constrain`,`reject`].forEach((n=>{let r=JSON.stringify({func:`calendarToIsoDate`,year:u.year,month:u.month,day:u.day,overflow:n,id:this.id});t.set(r,e)})),u}validateCalendarDate(e){let{month:t,year:n,day:r,eraYear:i,monthCode:a,monthExtra:o}=e;if(o!==void 0)throw RangeError("Unexpected `monthExtra` value");if(n===void 0&&i===void 0)throw TypeError(`year or eraYear is required`);if(t===void 0&&a===void 0)throw TypeError(`month or monthCode is required`);if(r===void 0)throw RangeError(`Missing day`);if(a!==void 0){if(typeof a!=`string`)throw RangeError(`monthCode must be a string, not `+typeof a);if(!/^M([01]?\d)(L?)$/.test(a))throw RangeError(`Invalid monthCode: ${a}`)}if(this.hasEra&&e.era===void 0!=(e.eraYear===void 0))throw TypeError(`properties era and eraYear must be provided together`)}adjustCalendarDate(e,t=void 0,n=`constrain`,r=!1){if(this.calendarType===`lunisolar`)throw RangeError(`Override required for lunisolar calendars`);let i=e;this.validateCalendarDate(i);let a=this.monthsInYear(i,t),{month:o,monthCode:s}=i;return{month:o,monthCode:s}=I$(i,n,a),{...i,month:o,monthCode:s}}regulateMonthDayNaive(e,t,n){let r=this.monthsInYear(e,n),{month:i,day:a}=e;return t===`reject`?(vQ(i,1,r),vQ(a,1,this.maximumMonthLength(e))):(i=gQ(i,1,r),a=gQ(a,1,this.maximumMonthLength({...e,month:i}))),{...e,month:i,day:a}}calendarToIsoDate(e,t=`constrain`,n){let r=e,i=this.adjustCalendarDate(e,n,t,!1);i=this.regulateMonthDayNaive(i,t,n);let{year:a,month:o,day:s}=i,c=JSON.stringify({func:`calendarToIsoDate`,year:a,month:o,day:s,overflow:t,id:this.id}),l,u=n.get(c);if(u||r.year!==void 0&&r.month!==void 0&&r.day!==void 0&&(r.year!==i.year||r.month!==i.month||r.day!==i.day)&&(l=JSON.stringify({func:`calendarToIsoDate`,year:r.year,month:r.month,day:r.day,overflow:t,id:this.id}),u=n.get(l),u))return u;let d=this.estimateIsoDate({year:a,month:o,day:s}),f=e=>{let r=this.addDaysIso(d,e);if(i.day>this.minimumMonthLength(i)){let e=this.isoToCalendarDate(r,n);for(;e.month!==o||e.year!==a;){if(t===`reject`)throw RangeError(`day ${s} does not exist in month ${o} of year ${a}`);r=this.addDaysIso(r,-1),e=this.isoToCalendarDate(r,n)}}return r},p=0,m=this.isoToCalendarDate(d,n),h=z$(i,m);if(h.years!==0||h.months!==0||h.days!==0){let e=365*h.years+30*h.months+h.days;d=this.addDaysIso(d,e),m=this.isoToCalendarDate(d,n),h=z$(i,m),h.years===0&&h.months===0?d=f(h.days):p=this.compareCalendarDates(i,m)}let g=8;for(;p;){d=this.addDaysIso(d,p*g);let e=m;m=this.isoToCalendarDate(d,n);let a=p;if(p=this.compareCalendarDates(i,m),p){if(h=z$(i,m),h.years===0&&h.months===0)d=f(h.days),p=0;else if(a&&p!==a){if(g>1)g/=2;else{if(t===`reject`)throw RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...r})}`);this.compareCalendarDates(m,e)>0&&(d=this.addDaysIso(d,-1)),p=0}}}}if(n.set(c,d),l&&n.set(l,d),i.year===void 0||i.month===void 0||i.day===void 0||i.monthCode===void 0||this.hasEra&&(i.era===void 0||i.eraYear===void 0))throw RangeError(`Unexpected missing property`);return d}compareCalendarDates(e,t){return e.year===t.year?e.month===t.month?e.day===t.day?0:S$(e.day-t.day):S$(e.month-t.month):S$(e.year-t.year)}regulateDate(e,t=`constrain`,n){let r=this.calendarToIsoDate(e,t,n);return this.isoToCalendarDate(r,n)}addDaysIso(e,t){return dQ(e.year,e.month,e.day+t)}addDaysCalendar(e,t,n){let r=this.calendarToIsoDate(e,`constrain`,n),i=this.addDaysIso(r,t);return this.isoToCalendarDate(i,n)}addMonthsCalendar(e,t,n,r){let i=e,{day:a}=i;for(let e=0,n=Math.abs(t);e<n;e++){let{month:e}=i,n=i,o=t<0?-Math.max(a,this.daysInPreviousMonth(i,r)):this.daysInMonth(i,r),s=this.calendarToIsoDate(i,`constrain`,r),c=this.addDaysIso(s,o);if(i=this.isoToCalendarDate(c,r),t>0){let t=this.monthsInYear(n,r);for(;i.month-1!=e%t;)c=this.addDaysIso(c,-1),i=this.isoToCalendarDate(c,r)}i.day!==a&&(i=this.regulateDate({...i,day:a},`constrain`,r))}if(n===`reject`&&i.day!==a)throw RangeError(`Day ${a} does not exist in resulting calendar month`);return i}addCalendar(e,{years:t=0,months:n=0,weeks:r=0,days:i=0},a,o){let{year:s,day:c,monthCode:l}=e,u=this.adjustCalendarDate({year:s+t,monthCode:l,day:c},o),d=this.addMonthsCalendar(u,n,a,o),f=i+7*r;return this.addDaysCalendar(d,f,o)}untilCalendar(e,t,n,r){let i=0,a=0,o=0,s=0;switch(n){case`day`:i=this.calendarDaysUntil(e,t,r);break;case`week`:{let n=this.calendarDaysUntil(e,t,r);i=n%7,a=(n-i)/7;break}case`month`:case`year`:{let a=this.compareCalendarDates(t,e);if(!a)return{years:0,months:0,weeks:0,days:0};let c=t.year-e.year,l=t.day-e.day;if(n===`year`&&c){let n=0;t.monthCode>e.monthCode&&(n=1),t.monthCode<e.monthCode&&(n=-1),n||=Math.sign(l),s=n*a<0?c-a:c}let u,d=s?this.addCalendar(e,{years:s},`constrain`,r):e;do o+=a,u=d,d=this.addMonthsCalendar(u,a,`constrain`,r),d.day!==e.day&&(d=this.regulateDate({...d,day:e.day},`constrain`,r));while(this.compareCalendarDates(t,d)*a>=0);o-=a,i=this.calendarDaysUntil(u,t,r);break}}return{years:s,months:o,weeks:a,days:i}}daysInMonth(e,t){let{day:n}=e,r=this.maximumMonthLength(e),i=this.minimumMonthLength(e);if(i===r)return i;let a=n<=r-i?r:i,o=this.calendarToIsoDate(e,`constrain`,t),s=this.addDaysIso(o,a),c=this.isoToCalendarDate(s,t),l=this.addDaysIso(s,-c.day);return this.isoToCalendarDate(l,t).day}daysInPreviousMonth(e,t){let{day:n,month:r,year:i}=e,a={year:r>1?i:i-1,month:r,day:1},o=r>1?r-1:this.monthsInYear(a,t);a={...a,month:o};let s=this.minimumMonthLength(a),c=this.maximumMonthLength(a);if(s===c)return c;let l=this.calendarToIsoDate(e,`constrain`,t),u=this.addDaysIso(l,-n);return this.isoToCalendarDate(u,t).day}startOfCalendarYear(e){return{year:e.year,month:1,monthCode:`M01`,day:1}}startOfCalendarMonth(e){return{year:e.year,month:e.month,day:1}}calendarDaysUntil(e,t,n){let r=this.calendarToIsoDate(e,`constrain`,n),i=this.calendarToIsoDate(t,`constrain`,n);return NQ(i.year,i.month-1,i.day)-NQ(r.year,r.month-1,r.day)}monthDaySearchStartYear(e,t){return 1972}monthDayFromFields(e,t,n){let r,i,a,o,s,{era:c,eraYear:l,year:u,month:d,monthCode:f,day:p}=e;if(d!==void 0&&u===void 0&&(!this.hasEra||c===void 0||l===void 0))throw TypeError(`when month is present, year (or era and eraYear) are required`);(f===void 0||u!==void 0||this.hasEra&&l!==void 0)&&({monthCode:f,day:p}=this.isoToCalendarDate(this.calendarToIsoDate(e,t,n),n));let m={year:this.monthDaySearchStartYear(f,p),month:12,day:31},h=this.isoToCalendarDate(m,n),g=h.monthCode>f||h.monthCode===f&&h.day>=p?h.year:h.year-1;for(let e=0;e<20;e++){let c=this.adjustCalendarDate({day:p,monthCode:f,year:g-e},n),l=this.calendarToIsoDate(c,`constrain`,n),u=this.isoToCalendarDate(l,n);if({year:r,month:i,day:a}=l,u.monthCode===f&&u.day===p)return{month:i,day:a,year:r};if(t===`constrain`){let e=this.maxLengthOfMonthCodeInAnyYear(u.monthCode);if(u.monthCode===f&&u.day===e&&p>e)return{month:i,day:a,year:r};(o===void 0||u.monthCode===o.monthCode&&u.day>o.day)&&(o=u,s=l)}}if(t===`constrain`&&s!==void 0)return s;throw RangeError(`No recent ${this.id} year with monthCode ${f} and day ${p}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}},Rue=class extends B${constructor(){super(...arguments),this.id=`hebrew`,this.calendarType=`lunisolar`,this.months={Tishri:{leap:1,regular:1,monthCode:`M01`,days:30},Heshvan:{leap:2,regular:2,monthCode:`M02`,days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:`M03`,days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:`M04`,days:29},Shevat:{leap:5,regular:5,monthCode:`M05`,days:30},Adar:{leap:void 0,regular:6,monthCode:`M06`,days:29},"Adar I":{leap:6,regular:void 0,monthCode:`M05L`,days:30},"Adar II":{leap:7,regular:void 0,monthCode:`M06`,days:29},Nisan:{leap:8,regular:7,monthCode:`M07`,days:30},Iyar:{leap:9,regular:8,monthCode:`M08`,days:29},Sivan:{leap:10,regular:9,monthCode:`M09`,days:30},Tamuz:{leap:11,regular:10,monthCode:`M10`,days:29},Av:{leap:12,regular:11,monthCode:`M11`,days:30},Elul:{leap:13,regular:12,monthCode:`M12`,days:29}}}inLeapYear(e){let{year:t}=e;return(7*t+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,`min`)}maximumMonthLength(e){return this.minMaxMonthLength(e,`max`)}minMaxMonthLength(e,t){let{month:n,year:r}=e,i=this.getMonthCode(r,n),a=Object.entries(this.months).find((e=>e[1].monthCode===i));if(a===void 0)throw RangeError(`unmatched Hebrew month: ${n}`);let o=a[1].days;return typeof o==`number`?o:o[t]}maxLengthOfMonthCodeInAnyYear(e){return[`M04`,`M06`,`M08`,`M10`,`M12`].includes(e)?29:30}estimateIsoDate(e){let{year:t}=e;return{year:t-3760,month:1,day:1}}getMonthCode(e,t){return this.inLeapYear({year:e})?t===6?F$(5,!0):F$(t<6?t:t-1):F$(t)}adjustCalendarDate(e,t,n=`constrain`,r=!1){let{year:i,month:a,monthCode:o,day:s,monthExtra:c}=e;if(i===void 0)throw TypeError(`Missing property: year`);if(r){if(c){let e=this.months[c];if(!e)throw RangeError(`Unrecognized month from formatToParts: ${c}`);a=this.inLeapYear({year:i})?e.leap:e.regular}return o=this.getMonthCode(i,a),{year:i,month:a,day:s,monthCode:o}}if(this.validateCalendarDate(e),a===void 0){if(o.endsWith(`L`)){if(o!==`M05L`)throw RangeError(`Hebrew leap month must have monthCode M05L, not ${o}`);if(a=6,!this.inLeapYear({year:i})){if(n===`reject`)throw RangeError(`Hebrew monthCode M05L is invalid in year ${i} which is not a leap year`);a=6,o=`M06`}}else{a=P$(o),this.inLeapYear({year:i})&&a>=6&&a++;let e=this.monthsInYear({year:i});if(a<1||a>e)throw RangeError(`Invalid monthCode: ${o}`)}}else if(n===`reject`?(vQ(a,1,this.monthsInYear({year:i})),vQ(s,1,this.maximumMonthLength({year:i,month:a}))):(a=gQ(a,1,this.monthsInYear({year:i})),s=gQ(s,1,this.maximumMonthLength({year:i,month:a}))),o===void 0)o=this.getMonthCode(i,a);else if(this.getMonthCode(i,a)!==o)throw RangeError(`monthCode ${o} doesn't correspond to month ${a} in Hebrew year ${i}`);return{...e,day:s,month:a,monthCode:o,year:i}}},V$=class extends B${constructor(){super(...arguments),this.calendarType=`lunar`,this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear(e,t){let n={year:e.year,month:1,monthCode:`M01`,day:1},r={year:e.year+1,month:1,monthCode:`M01`,day:1};return this.calendarDaysUntil(n,r,t)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate(e){let{year:t}=this.adjustCalendarDate(e);return{year:Math.floor(t*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}},zue=class extends V${constructor(){super(...arguments),this.id=`islamic`}},Bue=class extends V${constructor(){super(...arguments),this.id=`islamic-umalqura`}},Vue=class extends V${constructor(){super(...arguments),this.id=`islamic-tbla`}},Hue=class extends V${constructor(){super(...arguments),this.id=`islamic-civil`}},Uue=class extends V${constructor(){super(...arguments),this.id=`islamic-rgsa`}},Wue=class extends V${constructor(){super(...arguments),this.id=`islamicc`}},Gue=class extends B${constructor(){super(...arguments),this.id=`persian`,this.calendarType=`solar`}inLeapYear(e,t){return this.daysInMonth({year:e.year,month:12,day:1},t)===30}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===12?29:t<=6?31:30}maximumMonthLength(e){let{month:t}=e;return t===12?30:t<=6?31:30}maxLengthOfMonthCodeInAnyYear(e){return P$(e)<=6?31:30}estimateIsoDate(e){let{year:t}=this.adjustCalendarDate(e);return{year:t+621,month:1,day:1}}},Kue=class extends B${constructor(){super(...arguments),this.id=`indian`,this.calendarType=`solar`,this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date(`0000-01-01T00:00Z`).toLocaleDateString(`en-US-u-ca-indian`,{timeZone:`UTC`})!==`10/11/-79 Saka`}inLeapYear(e){return H$(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}maxLengthOfMonthCodeInAnyYear(e){let t=P$(e),n=this.months[t];return n=n.leap??n,n.length}getMonthInfo(e){let{month:t}=e,n=this.months[t];if(n===void 0)throw RangeError(`Invalid month: ${t}`);return this.inLeapYear(e)&&n.leap&&(n=n.leap),n}estimateIsoDate(e){let t=this.adjustCalendarDate(e),n=this.getMonthInfo(t);return dQ(t.year+78+ +!!n.nextYear,n.month,n.day+t.day-1)}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}};function H$(e){return e%4==0&&(e%100!=0||e%400==0)}var U$=class extends B${constructor(e,t){super(),this.calendarType=`solar`,this.id=e,this.isoEpoch=t}inLeapYear(e){let{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return H$(t)}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}maxLengthOfMonthCodeInAnyYear(e){return[31,29,31,30,31,30,31,31,30,31,30,31][P$(e)-1]}estimateIsoDate(e){let t=this.adjustCalendarDate(e);return gX(t.year+this.isoEpoch.year,t.month+this.isoEpoch.month,t.day+this.isoEpoch.day,`constrain`)}},W$=class extends B${constructor(e,t){super(),this.hasEra=!0,this.calendarType=`solar`,this.id=e;let{eras:n,anchorEra:r}=function(e){let t,n=e;if(n.length===0)throw RangeError(`Invalid era data: eras are required`);if(n.length===1&&n[0].reverseOf)throw RangeError(`Invalid era data: anchor era cannot count years backwards`);if(n.length===1&&!n[0].code)throw RangeError(`Invalid era data: at least one named era is required`);if(n.filter((e=>e.reverseOf!=null)).length>1)throw RangeError(`Invalid era data: only one era can count years backwards`);n.forEach((e=>{if(e.isAnchor||!e.anchorEpoch&&!e.reverseOf){if(t)throw RangeError(`Invalid era data: cannot have multiple anchor eras`);t=e,e.anchorEpoch={year:+!e.hasYearZero}}else if(!e.code)throw RangeError(`If era name is blank, it must be the anchor era`)})),n=n.filter((e=>e.code)),n.forEach((e=>{let{reverseOf:t}=e;if(t){let r=n.find((e=>e.code===t));if(r===void 0)throw RangeError(`Invalid era data: unmatched reverseOf era: ${t}`);e.reverseOf=r,e.anchorEpoch=r.anchorEpoch,e.isoEpoch=r.isoEpoch}e.anchorEpoch.month===void 0&&(e.anchorEpoch.month=1),e.anchorEpoch.day===void 0&&(e.anchorEpoch.day=1)})),n.sort(((e,t)=>{if(e.reverseOf)return 1;if(t.reverseOf)return-1;if(!e.isoEpoch||!t.isoEpoch)throw RangeError(`Invalid era data: missing ISO epoch`);return t.isoEpoch.year-e.isoEpoch.year}));let r=n[n.length-1].reverseOf;if(r&&r!==n[n.length-2])throw RangeError(`Invalid era data: invalid reverse-sign era`);return n.forEach(((e,t)=>{e.genericName=`era`+(n.length-1-t)})),{eras:n,anchorEra:t||n[0]}}(t);this.anchorEra=r,this.eras=n}inLeapYear(e){let{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return H$(t)}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}maxLengthOfMonthCodeInAnyYear(e){return[31,29,31,30,31,30,31,31,30,31,30,31][P$(e)-1]}completeEraYear(e){let t=(t,n,r)=>{let i=e[t];if(i!=null&&i!=n&&!(r||[]).includes(i)){let e=r?.[0];throw RangeError(`Input ${t} ${i} doesn't match calculated value ${e?`${n} (also called ${e})`:n}`)}},n=t=>{let n,r={...e,year:t},i=this.eras.find(((e,i)=>{if(i===this.eras.length-1){if(e.reverseOf){if(t>0)throw RangeError(`Signed year ${t} is invalid for era ${e.code}`);return n=e.anchorEpoch.year-t,!0}return n=t-e.anchorEpoch.year+ +!e.hasYearZero,!0}return this.compareCalendarDates(r,e.anchorEpoch)>=0&&(n=t-e.anchorEpoch.year+ +!e.hasYearZero,!0)}));if(!i)throw RangeError(`Year ${t} was not matched by any era`);return{eraYear:n,era:i.code,eraNames:i.names}},{year:r,eraYear:i,era:a}=e;if(r!=null){let e=n(r);({eraYear:i,era:a}=e),t(`era`,a,e?.eraNames),t(`eraYear`,i)}else{if(i==null)throw RangeError(`Either year or eraYear and era are required`);{if(a===void 0)throw RangeError(`era and eraYear must be provided together`);let e=this.eras.find((({code:e,names:t=[]})=>e===a||t.includes(a)));if(!e)throw RangeError(`Era ${a} (ISO year ${i}) was not matched by any era`);r=e.reverseOf?e.anchorEpoch.year-i:i+e.anchorEpoch.year-+!e.hasYearZero,t(`year`,r),{eraYear:i,era:a}=n(r)}}return{...e,year:r,eraYear:i,era:a}}adjustCalendarDate(e,t,n=`constrain`){let r=e,{month:i,monthCode:a}=r;return i===void 0&&(r={...r,month:P$(a)}),this.validateCalendarDate(r),r=this.completeEraYear(r),super.adjustCalendarDate(r,t,n)}estimateIsoDate(e){let{year:t,month:n,day:r}=this.adjustCalendarDate(e),{anchorEra:i}=this;return gX(t+i.isoEpoch.year-+!i.hasYearZero,n,r,`constrain`)}},G$=class extends W${constructor(e,t){super(e,t)}isoToCalendarDate(e){let{year:t,month:n,day:r}=e,i=F$(n),a=t-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:a,month:n,monthCode:i,day:r})}},K$={inLeapYear(e){let{year:t}=e;return(t+1)%4==0},monthsInYear:()=>13,minimumMonthLength(e){let{month:t}=e;return t===13?this.inLeapYear(e)?6:5:30},maximumMonthLength(e){return this.minimumMonthLength(e)},maxLengthOfMonthCodeInAnyYear:e=>e===`M13`?6:30},que=class extends U${constructor(e,t){super(e,t),this.inLeapYear=K$.inLeapYear,this.monthsInYear=K$.monthsInYear,this.minimumMonthLength=K$.minimumMonthLength,this.maximumMonthLength=K$.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=K$.maxLengthOfMonthCodeInAnyYear}},q$=class extends W${constructor(e,t){super(e,t),this.inLeapYear=K$.inLeapYear,this.monthsInYear=K$.monthsInYear,this.minimumMonthLength=K$.minimumMonthLength,this.maximumMonthLength=K$.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=K$.maxLengthOfMonthCodeInAnyYear}},Jue=class extends que{constructor(){super(`ethioaa`,{year:-5492,month:7,day:17})}},Yue=class extends q${constructor(){super(`coptic`,[{code:`coptic`,isoEpoch:{year:284,month:8,day:29}},{code:`coptic-inverse`,reverseOf:`coptic`}])}},Xue=class extends q${constructor(){super(`ethiopic`,[{code:`ethioaa`,names:[`ethiopic-amete-alem`,`mundi`],isoEpoch:{year:-5492,month:7,day:17}},{code:`ethiopic`,names:[`incar`],isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}},Zue=class extends G${constructor(){super(`roc`,[{code:`roc`,names:[`minguo`],isoEpoch:{year:1912,month:1,day:1}},{code:`roc-inverse`,names:[`before-roc`],reverseOf:`roc`}])}},Que=class extends U${constructor(){super(`buddhist`,{year:-543,month:1,day:1})}},$ue=class extends G${constructor(){super(`gregory`,[{code:`gregory`,names:[`ad`,`ce`],isoEpoch:{year:1,month:1,day:1}},{code:`gregory-inverse`,names:[`be`,`bce`],reverseOf:`gregory`}])}reviseIntlEra(e){let{era:t,eraYear:n}=e;return t===`b`&&(t=`gregory-inverse`),t===`a`&&(t=`gregory`),{era:t,eraYear:n}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}},ede=class extends G${constructor(){super(`japanese`,[{code:`reiwa`,isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{code:`heisei`,isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{code:`showa`,isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{code:`taisho`,isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{code:`meiji`,isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{code:`japanese`,names:[`japanese`,`gregory`,`ad`,`ce`],isoEpoch:{year:1,month:1,day:1}},{code:`japanese-inverse`,names:[`japanese-inverse`,`gregory-inverse`,`bc`,`bce`],reverseOf:`japanese`}]),this.erasBeginMidYear=!0}reviseIntlEra(e,t){let{era:n,eraYear:r}=e,{year:i}=t;return this.eras.find((e=>e.code===n))?{era:n,eraYear:r}:i<1?{era:`japanese-inverse`,eraYear:1-i}:{era:`japanese`,eraYear:i}}},J$=class extends B${constructor(){super(...arguments),this.calendarType=`lunisolar`}inLeapYear(e,t){let n=this.getMonthList(e.year,t);return Object.entries(n).length===13}monthsInYear(e,t){return this.inLeapYear(e,t)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(e){return[`M01L`,`M09L`,`M10L`,`M11L`,`M12L`].includes(e)?29:30}monthDaySearchStartYear(e,t){let n={M01L:[1651,1651],M02L:[1947,1765],M03L:[1966,1955],M04L:[1963,1944],M05L:[1971,1952],M06L:[1960,1941],M07L:[1968,1938],M08L:[1957,1718],M09L:[1832,1832],M10L:[1870,1870],M11L:[1814,1814],M12L:[1890,1890]}[e]??[1972,1972];return t<30?n[0]:n[1]}getMonthList(e,t){if(e===void 0)throw TypeError(`Missing year`);let n=JSON.stringify({func:`getMonthList`,calendarYear:e,id:this.id}),r=t.get(n);if(r)return r;let i=this.getFormatter(),a=(e,t)=>{let n=R$({isoYear:e,isoMonth:2,isoDay:1}),r=new Date(n);r.setUTCDate(t+1);let a=i.formatToParts(r),o=a.find((e=>e.type===`month`)).value,s=+a.find((e=>e.type===`day`)).value,c=a.find((e=>e.type===`relatedYear`)),l;if(c===void 0)throw RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return l=+c.value,{calendarMonthString:o,calendarDay:s,calendarYearToVerify:l}},o=17,{calendarMonthString:s,calendarDay:c,calendarYearToVerify:l}=a(e,o);s!==`1`&&(o+=29,{calendarMonthString:s,calendarDay:c}=a(e,o)),o-=c-5;let u={},d,f,p=1,m=!1;do({calendarMonthString:s,calendarDay:c,calendarYearToVerify:l}=a(e,o)),d&&(u[f].daysInMonth=d+30-c),l===e?(u[s]={monthIndex:p++},o+=30):m=!0,d=c,f=s;while(!m);return u[f].daysInMonth=d+30-c,t.set(n,u),u}estimateIsoDate(e){let{year:t,month:n}=e;return{year:t,month:n>=12?12:n+1,day:1}}adjustCalendarDate(e,t,n=`constrain`,r=!1){let{year:i,month:a,monthExtra:o,day:s,monthCode:c}=e;if(i===void 0)throw TypeError(`Missing property: year`);if(r){if(o&&o!==`bis`)throw RangeError(`Unexpected leap month suffix: ${o}`);let e=F$(a,o!==void 0),n=`${a}${o||``}`,r=this.getMonthList(i,t)[n];if(r===void 0)throw RangeError(`Unmatched month ${n} in Chinese year ${i}`);return a=r.monthIndex,{year:i,month:a,day:s,monthCode:e}}if(this.validateCalendarDate(e),a===void 0){let e=this.getMonthList(i,t),r=c.replace(/^M|L$/g,(e=>e===`L`?`bis`:``));r[0]===`0`&&(r=r.slice(1));let o=e[r];if(a=o&&o.monthIndex,a===void 0&&c.endsWith(`L`)&&c!=`M13L`&&n===`constrain`){let t=+c.replace(/^M0?|L$/g,``);o=e[t],o&&(a=o.monthIndex,c=F$(t))}if(a===void 0)throw RangeError(`Unmatched month ${c} in Chinese year ${i}`)}else if(c===void 0){let e=this.getMonthList(i,t),r=Object.entries(e),o=r.length;n===`reject`?(vQ(a,1,o),vQ(s,1,this.maximumMonthLength())):(a=gQ(a,1,o),s=gQ(s,1,this.maximumMonthLength()));let l=r.find((e=>e[1].monthIndex===a));if(l===void 0)throw RangeError(`Invalid month ${a} in Chinese year ${i}`);c=F$(+l[0].replace(`bis`,``),l[0].indexOf(`bis`)!==-1)}else{let e=this.getMonthList(i,t),n=c.replace(/^M|L$/g,(e=>e===`L`?`bis`:``));n[0]===`0`&&(n=n.slice(1));let r=e[n];if(!r)throw RangeError(`Unmatched monthCode ${c} in Chinese year ${i}`);if(a!==r.monthIndex)throw RangeError(`monthCode ${c} doesn't correspond to month ${a} in Chinese year ${i}`)}return{...e,year:i,month:a,monthCode:c,day:s}}},tde=class extends J${constructor(){super(...arguments),this.id=`chinese`}},nde=class extends J${constructor(){super(...arguments),this.id=`dangi`}},rde=class{constructor(e){this.helper=e}extraFields(e){return this.helper.hasEra&&e.includes(`year`)?[`era`,`eraYear`]:[]}resolveFields(e){if(this.helper.calendarType!==`lunisolar`){let t=new L$;I$(e,void 0,this.helper.monthsInYear({year:e.year??1972},t))}}dateToISO(e,t){let n=new L$,r=this.helper.calendarToIsoDate(e,t,n);return n.setObject(r),r}monthDayToISOReferenceDate(e,t){let n=new L$,r=this.helper.monthDayFromFields(e,t,n);return n.setObject(r),r}fieldKeysToIgnore(e){let t=new Set;for(let n=0;n<e.length;n++){let r=e[n];switch(t.add(r),r){case`era`:t.add(`eraYear`),t.add(`year`);break;case`eraYear`:t.add(`era`),t.add(`year`);break;case`year`:t.add(`era`),t.add(`eraYear`);break;case`month`:t.add(`monthCode`),this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`));break;case`monthCode`:t.add(`month`),this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`));break;case`day`:this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`))}}return A$(t)}dateAdd(e,{years:t,months:n,weeks:r,days:i},a){let o=L$.getCacheForObject(e),s=this.helper.isoToCalendarDate(e,o),c=this.helper.addCalendar(s,{years:t,months:n,weeks:r,days:i},a,o),l=this.helper.calendarToIsoDate(c,`constrain`,o);return L$.getCacheForObject(l)||new L$(o).setObject(l),l}dateUntil(e,t,n){let r=L$.getCacheForObject(e),i=L$.getCacheForObject(t),a=this.helper.isoToCalendarDate(e,r),o=this.helper.isoToCalendarDate(t,i);return this.helper.untilCalendar(a,o,n,r)}isoToDate(e,t){let n=L$.getCacheForObject(e),r=this.helper.isoToCalendarDate(e,n);if(t.dayOfWeek&&(r.dayOfWeek=N$.iso8601.isoToDate(e,{dayOfWeek:!0}).dayOfWeek),t.dayOfYear){let e=this.helper.startOfCalendarYear(r);r.dayOfYear=this.helper.calendarDaysUntil(e,r,n)+1}if(t.weekOfYear&&(r.weekOfYear=j$(this.helper.id,e)),r.daysInWeek=7,t.daysInMonth&&(r.daysInMonth=this.helper.daysInMonth(r,n)),t.daysInYear){let e=this.helper.startOfCalendarYear(r),t=this.helper.addCalendar(e,{years:1},`constrain`,n);r.daysInYear=this.helper.calendarDaysUntil(e,t,n)}return t.monthsInYear&&(r.monthsInYear=this.helper.monthsInYear(r,n)),t.inLeapYear&&(r.inLeapYear=this.helper.inLeapYear(r,n)),r}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}};for(let e of[Rue,Gue,Xue,Jue,Yue,tde,nde,Zue,Kue,Que,$ue,ede,zue,Bue,Vue,Hue,Uue,Wue]){let t=new e;N$[t.id]=new rde(t)}KJ(`calendarImpl`,(function(e){return N$[e]}));var Y$=Intl.DateTimeFormat;function X$(e,t){let n=Q(e,t);return typeof n==`function`&&(n=new Y$(Q(e,FJ),n(Q(e,IJ))),function(e,t,n){let r=zJ(e);if(r===void 0)throw TypeError(`Missing slots for the given container`);if(r[t]===void 0)throw TypeError(`tried to reset ${t} which was not set`);r[t]=n}(e,t,n)),n}function Z$(e){return HJ(e,jJ)}var Q$=class{constructor(e=void 0,t=void 0){(function(e,t,n){let r=n!==void 0,i;if(r){let e=[`localeMatcher`,`calendar`,`numberingSystem`,`hour12`,`hourCycle`,`timeZone`,`weekday`,`era`,`year`,`month`,`day`,`dayPeriod`,`hour`,`minute`,`second`,`fractionalSecondDigits`,`timeZoneName`,`formatMatcher`,`dateStyle`,`timeStyle`];i=function(e){if(e==null)throw TypeError(`Expected object not ${e}`);return Object(e)}(n);let t=Object.create(null);for(let n=0;n<e.length;n++){let r=e[n];Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}i=t}else i=Object.create(null);let a=new Y$(t,i),o=a.resolvedOptions();if(VJ(e),r){let t=Object.assign(Object.create(null),o);for(let e in t)Object.prototype.hasOwnProperty.call(i,e)||delete t[e];t.hour12=i.hour12,t.hourCycle=i.hourCycle,UJ(e,IJ,t)}else UJ(e,IJ,i);UJ(e,FJ,o.locale),UJ(e,jJ,a),UJ(e,MJ,o.timeZone),UJ(e,PJ,o.calendar),UJ(e,TJ,fde),UJ(e,EJ,ude),UJ(e,DJ,dde),UJ(e,OJ,lde),UJ(e,kJ,pde),UJ(e,AJ,mde);let s=r?i.timeZone:void 0;if(s===void 0)UJ(e,NJ,o.timeZone);else{let t=MY(s);if(t.startsWith(`−`))throw RangeError(`Unicode minus (U+2212) is not supported in time zone offsets`);UJ(e,NJ,CZ(t))}})(this,e,t)}get format(){$(this,Z$);let e=ade.bind(this);return Object.defineProperties(e,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:``,enumerable:!1,writable:!1,configurable:!0}}),e}formatRange(e,t){return $(this,Z$),sde.call(this,e,t)}formatToParts(e,...t){return $(this,Z$),ode.call(this,e,...t)}formatRangeToParts(e,t){return $(this,Z$),cde.call(this,e,t)}resolvedOptions(){return $(this,Z$),ide.call(this)}};`formatToParts`in Y$.prototype||delete Q$.prototype.formatToParts,`formatRangeToParts`in Y$.prototype||delete Q$.prototype.formatRangeToParts;var $$=function(e=void 0,t=void 0){return new Q$(e,t)};function ide(){let e=Q(this,jJ).resolvedOptions();return e.timeZone=Q(this,NJ),e}function ade(e,...t){let n,r,i=s1(e,this);return i.formatter?(n=i.formatter,r=[_$(i.epochNs,`floor`)]):(n=Q(this,jJ),r=[e,...t]),n.format(...r)}function ode(e,...t){let n,r,i=s1(e,this);return i.formatter?(n=i.formatter,r=[_$(i.epochNs,`floor`)]):(n=Q(this,jJ),r=[e,...t]),n.formatToParts(...r)}function sde(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=a1(e),r=a1(t),i,a=[n,r];if(i1(n)!==i1(r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);if(i1(n)){if(!o1(n,r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);let{epochNs:e,formatter:t}=s1(n,this),{epochNs:o,formatter:s}=s1(r,this);t&&(i=t,a=[_$(e,`floor`),_$(o,`floor`)])}return i||=Q(this,jJ),i.formatRange(...a)}function cde(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=a1(e),r=a1(t),i,a=[n,r];if(i1(n)!==i1(r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);if(i1(n)){if(!o1(n,r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);let{epochNs:e,formatter:t}=s1(n,this),{epochNs:o,formatter:s}=s1(r,this);t&&(i=t,a=[_$(e,`floor`),_$(o,`floor`)])}return i||=Q(this,jJ),i.formatRangeToParts(...a)}function e1(e={},t={}){let n=Object.assign({},e),r=[`year`,`month`,`day`,`hour`,`minute`,`second`,`weekday`,`dayPeriod`,`timeZoneName`,`dateStyle`,`timeStyle`];for(let e=0;e<r.length;e++){let i=r[e];n[i]=i in t?t[i]:n[i],!1!==n[i]&&n[i]!==void 0||delete n[i]}return n}function lde(e){let t=e1(e,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(t.timeStyle!==`long`&&t.timeStyle!==`full`||(delete t.timeStyle,Object.assign(t,{hour:`numeric`,minute:`2-digit`,second:`2-digit`})),!n1(t)){if(r1(e))throw TypeError(`cannot format Temporal.PlainTime with options [${Object.keys(e)}]`);Object.assign(t,{hour:`numeric`,minute:`numeric`,second:`numeric`})}return t}function ude(e){let t={short:{year:`2-digit`,month:`numeric`},medium:{year:`numeric`,month:`short`},long:{year:`numeric`,month:`long`},full:{year:`numeric`,month:`long`}},n=e1(e,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(`dateStyle`in n&&n.dateStyle){let e=n.dateStyle;delete n.dateStyle,Object.assign(n,t[e])}if(!(`year`in n||`month`in n||`era`in n)){if(r1(e))throw TypeError(`cannot format PlainYearMonth with options [${Object.keys(e)}]`);Object.assign(n,{year:`numeric`,month:`numeric`})}return n}function dde(e){let t={short:{month:`numeric`,day:`numeric`},medium:{month:`short`,day:`numeric`},long:{month:`long`,day:`numeric`},full:{month:`long`,day:`numeric`}},n=e1(e,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(`dateStyle`in n&&n.dateStyle){let e=n.dateStyle;delete n.dateStyle,Object.assign(n,t[e])}if(!(`month`in n)&&!(`day`in n)){if(r1(e))throw TypeError(`cannot format PlainMonthDay with options [${Object.keys(e)}]`);Object.assign(n,{month:`numeric`,day:`numeric`})}return n}function fde(e){let t=e1(e,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!t1(t)){if(r1(e))throw TypeError(`cannot format PlainDate with options [${Object.keys(e)}]`);Object.assign(t,{year:`numeric`,month:`numeric`,day:`numeric`})}return t}function pde(e){let t=e1(e,{timeZoneName:!1});if((t.timeStyle===`long`||t.timeStyle===`full`)&&(delete t.timeStyle,Object.assign(t,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}),t.dateStyle)&&(Object.assign(t,{short:{year:`numeric`,month:`numeric`,day:`numeric`},medium:{year:`numeric`,month:`short`,day:`numeric`},long:{year:`numeric`,month:`long`,day:`numeric`},full:{year:`numeric`,month:`long`,day:`numeric`,weekday:`long`}}[t.dateStyle]),delete t.dateStyle),!n1(t)&&!t1(t)){if(r1(e))throw TypeError(`cannot format PlainDateTime with options [${Object.keys(e)}]`);Object.assign(t,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`})}return t}function mde(e){let t=e;return n1(t)||t1(t)||(t=Object.assign({},t,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`})),t}function t1(e){return`year`in e||`month`in e||`day`in e||`weekday`in e||`dateStyle`in e||`era`in e}function n1(e){return`hour`in e||`minute`in e||`second`in e||`timeStyle`in e||`dayPeriod`in e||`fractionalSecondDigits`in e}function r1(e){return t1(e)||n1(e)||`dateStyle`in e||`timeStyle`in e||`timeZoneName`in e}function i1(e){return $Y(e)||eX(e)||tX(e)||iX(e)||nX(e)||rX(e)||ZY(e)}function a1(e){return i1(e)?e:jY(e)}function o1(e,t){return!(!i1(e)||!i1(t)||eX(e)&&!eX(t)||$Y(e)&&!$Y(t)||tX(e)&&!tX(t)||iX(e)&&!iX(t)||nX(e)&&!nX(t)||rX(e)&&!rX(t)||ZY(e)&&!ZY(t))}function s1(e,t){if(eX(e)){let n={isoDate:{year:1970,month:1,day:1},time:Q(e,uJ)};return{epochNs:OZ(Q(t,MJ),n,`compatible`),formatter:X$(t,OJ)}}if(nX(e)){let n=Q(e,Z),r=Q(t,PJ);if(n!==r)throw RangeError(`cannot format PlainYearMonth with calendar ${n} in locale with calendar ${r}`);let i=bX(Q(e,cJ),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:OZ(Q(t,MJ),i,`compatible`),formatter:X$(t,EJ)}}if(rX(e)){let n=Q(e,Z),r=Q(t,PJ);if(n!==r)throw RangeError(`cannot format PlainMonthDay with calendar ${n} in locale with calendar ${r}`);let i=bX(Q(e,cJ),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:OZ(Q(t,MJ),i,`compatible`),formatter:X$(t,DJ)}}if($Y(e)){let n=Q(e,Z),r=Q(t,PJ);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDate with calendar ${n} in locale with calendar ${r}`);let i=bX(Q(e,cJ),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:OZ(Q(t,MJ),i,`compatible`),formatter:X$(t,TJ)}}if(tX(e)){let n=Q(e,Z),r=Q(t,PJ);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDateTime with calendar ${n} in locale with calendar ${r}`);let i=Q(e,lJ);return{epochNs:OZ(Q(t,MJ),i,`compatible`),formatter:X$(t,kJ)}}if(iX(e))throw TypeError(`Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.`);return ZY(e)?{epochNs:Q(e,sJ),formatter:X$(t,AJ)}:{}}function c1(e){let t=Object.create(null);return t.years=Q(e,hJ),t.months=Q(e,gJ),t.weeks=Q(e,_J),t.days=Q(e,vJ),t.hours=Q(e,yJ),t.minutes=Q(e,bJ),t.seconds=Q(e,xJ),t.milliseconds=Q(e,SJ),t.microseconds=Q(e,CJ),t.nanoseconds=Q(e,wJ),t}Q$.prototype.constructor=$$,Object.defineProperty($$,"prototype",{value:Q$.prototype,writable:!1,enumerable:!1,configurable:!1}),$$.supportedLocalesOf=Y$.supportedLocalesOf,GJ($$,`Intl.DateTimeFormat`);var{format:hde,formatToParts:gde}=Intl.DurationFormat?.prototype??Object.create(null);function l1(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=c1(GX(e));return hde.call(this,t)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=l1,Intl.DurationFormat.prototype.formatToParts=function(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=c1(GX(e));return gde.call(this,t)}),Object.freeze({__proto__:null,DateTimeFormat:$$,ModifiedIntlDurationFormatPrototypeFormat:l1});var u1=class{constructor(e){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);lZ(this,y$(e))}get epochMilliseconds(){return $(this,ZY),_$(Q(this,sJ),`floor`)}get epochNanoseconds(){return $(this,ZY),g$(X.default.BigInt(Q(this,sJ)))}add(e){return $(this,ZY),t$(`add`,this,e)}subtract(e){return $(this,ZY),t$(`subtract`,this,e)}until(e,t=void 0){return $(this,ZY),GQ(`until`,this,e,t)}since(e,t=void 0){return $(this,ZY),GQ(`since`,this,e,t)}round(e){if($(this,ZY),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?w$(`smallestUnit`,e):C$(e),n=EX(t),r=CX(t,`halfExpand`),i=jX(t,`smallestUnit`,`time`,AX);return DX(n,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[i],!0),uZ(c$(Q(this,sJ),n,i,r))}equals(e){$(this,ZY);let t=KX(e),n=Q(this,sJ),r=Q(t,sJ);return X.default.equal(X.default.BigInt(n),X.default.BigInt(r))}toString(e=void 0){$(this,ZY);let t=C$(e),n=OX(t),r=CX(t,`trunc`),i=jX(t,`smallestUnit`,`time`,void 0);if(i===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let a=t.timeZone;a!==void 0&&(a=CZ(a));let{precision:o,unit:s,increment:c}=kX(i,n);return IZ(uZ(c$(Q(this,sJ),c,s,r)),a,o)}toJSON(){return $(this,ZY),IZ(this,void 0,`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,ZY),new $$(e,t).format(this)}valueOf(){O$(`Instant`)}toZonedDateTimeISO(e){$(this,ZY);let t=CZ(e);return fZ(Q(this,sJ),t,`iso8601`)}static fromEpochMilliseconds(e){return uZ(v$(jY(e)))}static fromEpochNanoseconds(e){return uZ(y$(e))}static from(e){return KX(e)}static compare(e,t){let n=KX(e),r=KX(t),i=Q(n,sJ),a=Q(r,sJ);return X.default.lessThan(i,a)?-1:+!!X.default.greaterThan(i,a)}};GJ(u1,`Temporal.Instant`);var d1=class{constructor(e,t,n,r=`iso8601`){let i=NY(e),a=NY(t),o=NY(n),s=E$(r===void 0?`iso8601`:LY(r));yQ(i,a,o),$X(this,{year:i,month:a,day:o},s)}get calendarId(){return $(this,$Y),Q(this,Z)}get era(){return f1(this,`era`)}get eraYear(){return f1(this,`eraYear`)}get year(){return f1(this,`year`)}get month(){return f1(this,`month`)}get monthCode(){return f1(this,`monthCode`)}get day(){return f1(this,`day`)}get dayOfWeek(){return f1(this,`dayOfWeek`)}get dayOfYear(){return f1(this,`dayOfYear`)}get weekOfYear(){return f1(this,`weekOfYear`)?.week}get yearOfWeek(){return f1(this,`weekOfYear`)?.year}get daysInWeek(){return f1(this,`daysInWeek`)}get daysInMonth(){return f1(this,`daysInMonth`)}get daysInYear(){return f1(this,`daysInYear`)}get monthsInYear(){return f1(this,`monthsInYear`)}get inLeapYear(){return f1(this,`inLeapYear`)}with(e,t=void 0){if($(this,$Y),!AY(e))throw TypeError(`invalid argument`);aX(e);let n=Q(this,Z),r=zX(n,Q(this,cJ));return r=mZ(n,r,BX(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),eZ(bZ(n,r,xX(C$(t))),n)}withCalendar(e){$(this,$Y);let t=_Z(e);return eZ(Q(this,cJ),t)}add(e,t=void 0){return $(this,$Y),n$(`add`,this,e,t)}subtract(e,t=void 0){return $(this,$Y),n$(`subtract`,this,e,t)}until(e,t=void 0){return $(this,$Y),KQ(`until`,this,e,t)}since(e,t=void 0){return $(this,$Y),KQ(`since`,this,e,t)}equals(e){$(this,$Y);let t=HX(e);return p$(Q(this,cJ),Q(t,cJ))===0&&yZ(Q(this,Z),Q(t,Z))}toString(e=void 0){return $(this,$Y),RZ(this,TX(C$(e)))}toJSON(){return $(this,$Y),RZ(this)}toLocaleString(e=void 0,t=void 0){return $(this,$Y),new $$(e,t).format(this)}valueOf(){O$(`PlainDate`)}toPlainDateTime(e=void 0){$(this,$Y);let t=YX(e);return nZ(bX(Q(this,cJ),t),Q(this,Z))}toZonedDateTime(e){let t,n;if($(this,$Y),AY(e)){let r=e.timeZone;r===void 0?t=CZ(e):(t=CZ(r),n=e.plainTime)}else t=CZ(e);let r=Q(this,cJ),i;return n===void 0?i=jZ(t,r):(n=JX(n),i=OZ(t,bX(r,Q(n,uJ)),`compatible`)),fZ(i,t,Q(this,Z))}toPlainYearMonth(){$(this,$Y);let e=Q(this,Z);return cZ(xZ(e,zX(e,Q(this,cJ)),`constrain`),e)}toPlainMonthDay(){$(this,$Y);let e=Q(this,Z);return iZ(SZ(e,zX(e,Q(this,cJ)),`constrain`),e)}static from(e,t=void 0){return HX(e,t)}static compare(e,t){let n=HX(e),r=HX(t);return p$(Q(n,cJ),Q(r,cJ))}};function f1(e,t){$(e,$Y);let n=Q(e,cJ);return RX(e).isoToDate(n,{[t]:!0})[t]}GJ(d1,`Temporal.PlainDate`);var p1=class{constructor(e,t,n,r=0,i=0,a=0,o=0,s=0,c=0,l=`iso8601`){let u=NY(e),d=NY(t),f=NY(n),p=r===void 0?0:NY(r),m=i===void 0?0:NY(i),h=a===void 0?0:NY(a),g=o===void 0?0:NY(o),_=s===void 0?0:NY(s),v=c===void 0?0:NY(c),y=E$(l===void 0?`iso8601`:LY(l));SQ(u,d,f,p,m,h,g,_,v),tZ(this,{isoDate:{year:u,month:d,day:f},time:{hour:p,minute:m,second:h,millisecond:g,microsecond:_,nanosecond:v}},y)}get calendarId(){return $(this,tX),Q(this,Z)}get year(){return m1(this,`year`)}get month(){return m1(this,`month`)}get monthCode(){return m1(this,`monthCode`)}get day(){return m1(this,`day`)}get hour(){return h1(this,`hour`)}get minute(){return h1(this,`minute`)}get second(){return h1(this,`second`)}get millisecond(){return h1(this,`millisecond`)}get microsecond(){return h1(this,`microsecond`)}get nanosecond(){return h1(this,`nanosecond`)}get era(){return m1(this,`era`)}get eraYear(){return m1(this,`eraYear`)}get dayOfWeek(){return m1(this,`dayOfWeek`)}get dayOfYear(){return m1(this,`dayOfYear`)}get weekOfYear(){return m1(this,`weekOfYear`)?.week}get yearOfWeek(){return m1(this,`weekOfYear`)?.year}get daysInWeek(){return m1(this,`daysInWeek`)}get daysInYear(){return m1(this,`daysInYear`)}get daysInMonth(){return m1(this,`daysInMonth`)}get monthsInYear(){return m1(this,`monthsInYear`)}get inLeapYear(){return m1(this,`inLeapYear`)}with(e,t=void 0){if($(this,tX),!AY(e))throw TypeError(`invalid argument`);aX(e);let n=Q(this,Z),r=Q(this,lJ),i={...zX(n,r.isoDate),...r.time};return i=mZ(n,i,BX(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],`partial`)),nZ(UX(n,i,xX(C$(t))),n)}withPlainTime(e=void 0){$(this,tX);let t=YX(e);return nZ(bX(Q(this,lJ).isoDate,t),Q(this,Z))}withCalendar(e){$(this,tX);let t=_Z(e);return nZ(Q(this,lJ),t)}add(e,t=void 0){return $(this,tX),r$(`add`,this,e,t)}subtract(e,t=void 0){return $(this,tX),r$(`subtract`,this,e,t)}until(e,t=void 0){return $(this,tX),qQ(`until`,this,e,t)}since(e,t=void 0){return $(this,tX),qQ(`since`,this,e,t)}round(e){if($(this,tX),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?w$(`smallestUnit`,e):C$(e),n=EX(t),r=CX(t,`halfExpand`),i=jX(t,`smallestUnit`,`time`,AX,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];DX(n,a,a===1);let o=Q(this,lJ);return nZ(n===1&&i===`nanosecond`?o:l$(o,n,i,r),Q(this,Z))}equals(e){$(this,tX);let t=WX(e);return h$(Q(this,lJ),Q(t,lJ))===0&&yZ(Q(this,Z),Q(t,Z))}toString(e=void 0){$(this,tX);let t=C$(e),n=TX(t),r=OX(t),i=CX(t,`trunc`),a=jX(t,`smallestUnit`,`time`,void 0);if(a===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let{precision:o,unit:s,increment:c}=kX(a,r),l=l$(Q(this,lJ),c,s,i);return CQ(l),BZ(l,Q(this,Z),o,n)}toJSON(){return $(this,tX),BZ(Q(this,lJ),Q(this,Z),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,tX),new $$(e,t).format(this)}valueOf(){O$(`PlainDateTime`)}toZonedDateTime(e,t=void 0){$(this,tX);let n=CZ(e),r=SX(C$(t));return fZ(OZ(n,Q(this,lJ),r),n,Q(this,Z))}toPlainDate(){return $(this,tX),eZ(Q(this,lJ).isoDate,Q(this,Z))}toPlainTime(){return $(this,tX),oZ(Q(this,lJ).time)}static from(e,t=void 0){return WX(e,t)}static compare(e,t){let n=WX(e),r=WX(t);return h$(Q(n,lJ),Q(r,lJ))}};function m1(e,t){$(e,tX);let n=Q(e,lJ).isoDate;return RX(e).isoToDate(n,{[t]:!0})[t]}function h1(e,t){return $(e,tX),Q(e,lJ).time[t]}GJ(p1,`Temporal.PlainDateTime`);var g1=class e{constructor(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0){let u=e===void 0?0:FY(e),d=t===void 0?0:FY(t),f=n===void 0?0:FY(n),p=r===void 0?0:FY(r),m=i===void 0?0:FY(i),h=a===void 0?0:FY(a),g=o===void 0?0:FY(o),_=s===void 0?0:FY(s),v=c===void 0?0:FY(c),y=l===void 0?0:FY(l);DQ(u,d,f,p,m,h,g,_,v,y),VJ(this),UJ(this,hJ,u),UJ(this,gJ,d),UJ(this,_J,f),UJ(this,vJ,p),UJ(this,yJ,m),UJ(this,bJ,h),UJ(this,xJ,g),UJ(this,SJ,_),UJ(this,CJ,v),UJ(this,wJ,y)}get years(){return $(this,QY),Q(this,hJ)}get months(){return $(this,QY),Q(this,gJ)}get weeks(){return $(this,QY),Q(this,_J)}get days(){return $(this,QY),Q(this,vJ)}get hours(){return $(this,QY),Q(this,yJ)}get minutes(){return $(this,QY),Q(this,bJ)}get seconds(){return $(this,QY),Q(this,xJ)}get milliseconds(){return $(this,QY),Q(this,SJ)}get microseconds(){return $(this,QY),Q(this,CJ)}get nanoseconds(){return $(this,QY),Q(this,wJ)}get sign(){return $(this,QY),sQ(this)}get blank(){return $(this,QY),sQ(this)===0}with(t){$(this,QY);let{years:n=Q(this,hJ),months:r=Q(this,gJ),weeks:i=Q(this,_J),days:a=Q(this,vJ),hours:o=Q(this,yJ),minutes:s=Q(this,bJ),seconds:c=Q(this,xJ),milliseconds:l=Q(this,SJ),microseconds:u=Q(this,CJ),nanoseconds:d=Q(this,wJ)}=vX(t);return new e(n,r,i,a,o,s,c,l,u,d)}negated(){return $(this,QY),hQ(this)}abs(){return $(this,QY),new e(Math.abs(Q(this,hJ)),Math.abs(Q(this,gJ)),Math.abs(Q(this,_J)),Math.abs(Q(this,vJ)),Math.abs(Q(this,yJ)),Math.abs(Q(this,bJ)),Math.abs(Q(this,xJ)),Math.abs(Q(this,SJ)),Math.abs(Q(this,CJ)),Math.abs(Q(this,wJ)))}add(e){return $(this,QY),e$(`add`,this,e)}subtract(e){return $(this,QY),e$(`subtract`,this,e)}round(e){if($(this,QY),e===void 0)throw TypeError(`options parameter is required`);let t=NX(this),n=typeof e==`string`?w$(`smallestUnit`,e):C$(e),r=jX(n,`largestUnit`,`datetime`,void 0,[`auto`]),{plainRelativeTo:i,zonedRelativeTo:a}=MX(n),o=EX(n),s=CX(n,`halfExpand`),c=jX(n,`smallestUnit`,`datetime`,void 0),l=!0;c||=(l=!1,`nanosecond`);let u=PX(t,c),d=!0;if(r||=(d=!1,u),r===`auto`&&(r=u),!l&&!d)throw RangeError(`at least one of smallestUnit or largestUnit is required`);if(PX(r,c)!==r)throw RangeError(`largestUnit ${r} cannot be smaller than smallestUnit ${c}`);let f={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[c];if(f!==void 0&&DX(o,f,!1),o>1&&IX(c)===`date`&&r!==c)throw RangeError(`For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit`);if(a){let e=OQ(this),t=Q(a,mJ),n=Q(a,Z),i=Q(a,sJ);return e=UQ(i,$Q(i,t,n,e),t,n,r,o,c,s),IX(r)===`date`&&(r=`hour`),jQ(e,r)}if(i){let e=kQ(this),t=ZQ({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),n=Q(i,cJ),a=Q(i,Z),l=hZ(a,n,yX(e.date,t.deltaDays),`constrain`);return e=HQ(bX(n,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),bX(l,t),a,r,o,c,s),jQ(e,r)}if(FX(t))throw RangeError(`a starting point is required for ${t}s balancing`);if(FX(r))throw RangeError(`a starting point is required for ${r}s balancing`);let p=kQ(this);if(c===`day`){let{quotient:e,remainder:t}=p.time.divmod(_Y),n=p.date.days+e+f$(t,`day`);n=s$(n,o,s),p=MQ({years:0,months:0,weeks:0,days:n},QJ.ZERO)}else p=MQ({years:0,months:0,weeks:0,days:0},d$(p.time,o,c,s));return jQ(p,r)}total(e){if($(this,QY),e===void 0)throw TypeError(`options argument is required`);let t=typeof e==`string`?w$(`unit`,e):C$(e),{plainRelativeTo:n,zonedRelativeTo:r}=MX(t),i=jX(t,`unit`,`datetime`,AX);if(r){let e=OQ(this),t=Q(r,mJ),n=Q(r,Z),a=Q(r,sJ);return function(e,t,n,r,i){return IX(i)===`time`?f$(QJ.fromEpochNsDiff(t,e),i):VQ(RQ(e,t,n,r,i),t,DZ(n,e),n,r,i)}(a,$Q(a,t,n,e),t,n,i)}if(n){let e=kQ(this),t=ZQ({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),r=Q(n,cJ),a=Q(n,Z),o=hZ(a,r,yX(e.date,t.deltaDays),`constrain`);return function(e,t,n,r){if(h$(e,t)==0)return 0;CQ(e),CQ(t);let i=LQ(e,t,n,r);return r===`nanosecond`?X.default.toNumber(i.time.totalNs):VQ(i,eQ(t),e,null,n,r)}(bX(r,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),bX(o,t),a,i)}let a=NX(this);if(FX(a))throw RangeError(`a starting point is required for ${a}s total`);if(FX(i))throw RangeError(`a starting point is required for ${i}s total`);return f$(kQ(this).time,i)}toString(e=void 0){$(this,QY);let t=C$(e),n=OX(t),r=CX(t,`trunc`),i=jX(t,`smallestUnit`,`time`,void 0);if(i===`hour`||i===`minute`)throw RangeError(`smallestUnit must be a time unit other than "hours" or "minutes"`);let{precision:a,unit:o,increment:s}=kX(i,n);if(o===`nanosecond`&&s===1)return LZ(this,a);let c=NX(this),l=OQ(this),u=d$(l.time,s,o,r);return l=MQ(l.date,u),LZ(jQ(l,PX(c,`second`)),a)}toJSON(){return $(this,QY),LZ(this,`auto`)}toLocaleString(e=void 0,t=void 0){if($(this,QY),typeof Intl.DurationFormat==`function`){let n=new Intl.DurationFormat(e,t);return l1.call(n,this)}return console.warn(`Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat.`),LZ(this,`auto`)}valueOf(){O$(`Duration`)}static from(e){return GX(e)}static compare(e,t,n=void 0){let r=GX(e),i=GX(t),{plainRelativeTo:a,zonedRelativeTo:o}=MX(C$(n));if(Q(r,hJ)===Q(i,hJ)&&Q(r,gJ)===Q(i,gJ)&&Q(r,_J)===Q(i,_J)&&Q(r,vJ)===Q(i,vJ)&&Q(r,yJ)===Q(i,yJ)&&Q(r,bJ)===Q(i,bJ)&&Q(r,xJ)===Q(i,xJ)&&Q(r,SJ)===Q(i,SJ)&&Q(r,CJ)===Q(i,CJ)&&Q(r,wJ)===Q(i,wJ))return 0;let s=NX(r),c=NX(i),l=OQ(r),u=OQ(i);if(o&&(IX(s)===`date`||IX(c)===`date`)){let e=Q(o,mJ),t=Q(o,Z),n=Q(o,sJ),r=$Q(n,e,t,l),i=$Q(n,e,t,u);return S$(X.default.toNumber(X.default.subtract(r,i)))}let d=l.date.days,f=u.date.days;if(FX(s)||FX(c)){if(!a)throw RangeError(`A starting point is required for years, months, or weeks comparison`);d=mQ(l.date,a),f=mQ(u.date,a)}let p=l.time.add24HourDays(d),m=u.time.add24HourDays(f);return p.cmp(m)}};GJ(g1,`Temporal.Duration`);var _1=class{constructor(e,t,n=`iso8601`,r=1972){let i=NY(e),a=NY(t),o=E$(n===void 0?`iso8601`:LY(n)),s=NY(r);yQ(s,i,a),rZ(this,{year:s,month:i,day:a},o)}get monthCode(){return v1(this,`monthCode`)}get day(){return v1(this,`day`)}get calendarId(){return $(this,rX),Q(this,Z)}with(e,t=void 0){if($(this,rX),!AY(e))throw TypeError(`invalid argument`);aX(e);let n=Q(this,Z),r=zX(n,Q(this,cJ),`month-day`);return r=mZ(n,r,BX(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),iZ(SZ(n,r,xX(C$(t))),n)}equals(e){$(this,rX);let t=qX(e);return p$(Q(this,cJ),Q(t,cJ))===0&&yZ(Q(this,Z),Q(t,Z))}toString(e=void 0){return $(this,rX),VZ(this,TX(C$(e)))}toJSON(){return $(this,rX),VZ(this)}toLocaleString(e=void 0,t=void 0){return $(this,rX),new $$(e,t).format(this)}valueOf(){O$(`PlainMonthDay`)}toPlainDate(e){if($(this,rX),!AY(e))throw TypeError(`argument should be an object`);let t=Q(this,Z);return eZ(bZ(t,mZ(t,zX(t,Q(this,cJ),`month-day`),BX(t,e,[`year`],[],[])),`constrain`),t)}static from(e,t=void 0){return qX(e,t)}};function v1(e,t){$(e,rX);let n=Q(e,cJ);return RX(e).isoToDate(n,{[t]:!0})[t]}function y1(e){return DZ(e,b$())}GJ(_1,`Temporal.PlainMonthDay`);var b1={instant:()=>uZ(b$()),plainDateTimeISO:(e=x$())=>nZ(y1(CZ(e)),`iso8601`),plainDateISO:(e=x$())=>eZ(y1(CZ(e)).isoDate,`iso8601`),plainTimeISO:(e=x$())=>oZ(y1(CZ(e)).time),timeZoneId:()=>x$(),zonedDateTimeISO:(e=x$())=>{let t=CZ(e);return fZ(b$(),t,`iso8601`)},[Symbol.toStringTag]:`Temporal.Now`};Object.defineProperty(b1,Symbol.toStringTag,{value:`Temporal.Now`,writable:!1,enumerable:!1,configurable:!0});var x1=class e{constructor(e=0,t=0,n=0,r=0,i=0,a=0){let o=e===void 0?0:NY(e),s=t===void 0?0:NY(t),c=n===void 0?0:NY(n),l=r===void 0?0:NY(r),u=i===void 0?0:NY(i),d=a===void 0?0:NY(a);xQ(o,s,c,l,u,d),aZ(this,{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d})}get hour(){return $(this,eX),Q(this,uJ).hour}get minute(){return $(this,eX),Q(this,uJ).minute}get second(){return $(this,eX),Q(this,uJ).second}get millisecond(){return $(this,eX),Q(this,uJ).millisecond}get microsecond(){return $(this,eX),Q(this,uJ).microsecond}get nanosecond(){return $(this,eX),Q(this,uJ).nanosecond}with(t,n=void 0){if($(this,eX),!AY(t))throw TypeError(`invalid argument`);aX(t);let r=VX(t,`partial`),i=VX(this),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Object.assign(i,r),d=xX(C$(n));return{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=_X(a,o,s,c,l,u,d),new e(a,o,s,c,l,u)}add(e){return $(this,eX),i$(`add`,this,e)}subtract(e){return $(this,eX),i$(`subtract`,this,e)}until(e,t=void 0){return $(this,eX),JQ(`until`,this,e,t)}since(e,t=void 0){return $(this,eX),JQ(`since`,this,e,t)}round(e){if($(this,eX),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?w$(`smallestUnit`,e):C$(e),n=EX(t),r=CX(t,`halfExpand`),i=jX(t,`smallestUnit`,`time`,AX);return DX(n,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i],!1),oZ(u$(Q(this,uJ),n,i,r))}equals(e){$(this,eX);let t=JX(e);return m$(Q(this,uJ),Q(t,uJ))===0}toString(e=void 0){$(this,eX);let t=C$(e),n=OX(t),r=CX(t,`trunc`),i=jX(t,`smallestUnit`,`time`,void 0);if(i===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let{precision:a,unit:o,increment:s}=kX(i,n);return zZ(u$(Q(this,uJ),s,o,r),a)}toJSON(){return $(this,eX),zZ(Q(this,uJ),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,eX),new $$(e,t).format(this)}valueOf(){O$(`PlainTime`)}static from(e,t=void 0){return JX(e,t)}static compare(e,t){let n=JX(e),r=JX(t);return m$(Q(n,uJ),Q(r,uJ))}};GJ(x1,`Temporal.PlainTime`);var S1=class{constructor(e,t,n=`iso8601`,r=1){let i=NY(e),a=NY(t),o=E$(n===void 0?`iso8601`:LY(n)),s=NY(r);yQ(i,a,s),sZ(this,{year:i,month:a,day:s},o)}get year(){return C1(this,`year`)}get month(){return C1(this,`month`)}get monthCode(){return C1(this,`monthCode`)}get calendarId(){return $(this,nX),Q(this,Z)}get era(){return C1(this,`era`)}get eraYear(){return C1(this,`eraYear`)}get daysInMonth(){return C1(this,`daysInMonth`)}get daysInYear(){return C1(this,`daysInYear`)}get monthsInYear(){return C1(this,`monthsInYear`)}get inLeapYear(){return C1(this,`inLeapYear`)}with(e,t=void 0){if($(this,nX),!AY(e))throw TypeError(`invalid argument`);aX(e);let n=Q(this,Z),r=zX(n,Q(this,cJ),`year-month`);return r=mZ(n,r,BX(n,e,[`year`,`month`,`monthCode`],[],`partial`)),cZ(xZ(n,r,xX(C$(t))),n)}add(e,t=void 0){return $(this,nX),a$(`add`,this,e,t)}subtract(e,t=void 0){return $(this,nX),a$(`subtract`,this,e,t)}until(e,t=void 0){return $(this,nX),YQ(`until`,this,e,t)}since(e,t=void 0){return $(this,nX),YQ(`since`,this,e,t)}equals(e){$(this,nX);let t=XX(e);return p$(Q(this,cJ),Q(t,cJ))===0&&yZ(Q(this,Z),Q(t,Z))}toString(e=void 0){return $(this,nX),HZ(this,TX(C$(e)))}toJSON(){return $(this,nX),HZ(this)}toLocaleString(e=void 0,t=void 0){return $(this,nX),new $$(e,t).format(this)}valueOf(){O$(`PlainYearMonth`)}toPlainDate(e){if($(this,nX),!AY(e))throw TypeError(`argument should be an object`);let t=Q(this,Z);return eZ(bZ(t,mZ(t,zX(t,Q(this,cJ),`year-month`),BX(t,e,[`day`],[],[])),`constrain`),t)}static from(e,t=void 0){return XX(e,t)}static compare(e,t){let n=XX(e),r=XX(t);return p$(Q(n,cJ),Q(r,cJ))}};function C1(e,t){$(e,nX);let n=Q(e,cJ);return RX(e).isoToDate(n,{[t]:!0})[t]}GJ(S1,`Temporal.PlainYearMonth`);var _de=$$.prototype.resolvedOptions,w1=class{constructor(e,t,n=`iso8601`){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);let r=y$(e),i=LY(t),{tzName:a,offsetMinutes:o}=hX(i);if(o===void 0){let e=JZ(a);if(!e)throw RangeError(`unknown time zone ${a}`);i=e.identifier}else i=ZZ(o);dZ(this,r,i,E$(n===void 0?`iso8601`:LY(n)))}get calendarId(){return $(this,iX),Q(this,Z)}get timeZoneId(){return $(this,iX),Q(this,mJ)}get year(){return E1(this,`year`)}get month(){return E1(this,`month`)}get monthCode(){return E1(this,`monthCode`)}get day(){return E1(this,`day`)}get hour(){return D1(this,`hour`)}get minute(){return D1(this,`minute`)}get second(){return D1(this,`second`)}get millisecond(){return D1(this,`millisecond`)}get microsecond(){return D1(this,`microsecond`)}get nanosecond(){return D1(this,`nanosecond`)}get era(){return E1(this,`era`)}get eraYear(){return E1(this,`eraYear`)}get epochMilliseconds(){return $(this,iX),_$(Q(this,sJ),`floor`)}get epochNanoseconds(){return $(this,iX),g$(Q(this,sJ))}get dayOfWeek(){return E1(this,`dayOfWeek`)}get dayOfYear(){return E1(this,`dayOfYear`)}get weekOfYear(){return E1(this,`weekOfYear`)?.week}get yearOfWeek(){return E1(this,`weekOfYear`)?.year}get hoursInDay(){$(this,iX);let e=Q(this,mJ),t=T1(this).isoDate,n=dQ(t.year,t.month,t.day+1),r=jZ(e,t),i=jZ(e,n);return f$(QJ.fromEpochNsDiff(i,r),`hour`)}get daysInWeek(){return E1(this,`daysInWeek`)}get daysInMonth(){return E1(this,`daysInMonth`)}get daysInYear(){return E1(this,`daysInYear`)}get monthsInYear(){return E1(this,`monthsInYear`)}get inLeapYear(){return E1(this,`inLeapYear`)}get offset(){return $(this,iX),EZ(TZ(Q(this,mJ),Q(this,sJ)))}get offsetNanoseconds(){return $(this,iX),TZ(Q(this,mJ),Q(this,sJ))}with(e,t=void 0){if($(this,iX),!AY(e))throw TypeError(`invalid zoned-date-time-like`);aX(e);let n=Q(this,Z),r=Q(this,mJ),i=TZ(r,Q(this,sJ)),a=T1(this),o={...zX(n,a.isoDate),...a.time,offset:EZ(i)};o=mZ(n,o,BX(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`],`partial`));let s=C$(t),c=SX(s),l=wX(s,`prefer`),u=UX(n,o,xX(s)),d=GZ(o.offset);return fZ(ZX(u.isoDate,u.time,`option`,d,r,c,l,!1),r,n)}withPlainTime(e=void 0){$(this,iX);let t=Q(this,mJ),n=Q(this,Z),r=T1(this).isoDate,i;return i=e===void 0?jZ(t,r):OZ(t,bX(r,Q(JX(e),uJ)),`compatible`),fZ(i,t,n)}withTimeZone(e){$(this,iX);let t=CZ(e);return fZ(Q(this,sJ),t,Q(this,Z))}withCalendar(e){$(this,iX);let t=_Z(e);return fZ(Q(this,sJ),Q(this,mJ),t)}add(e,t=void 0){return $(this,iX),o$(`add`,this,e,t)}subtract(e,t=void 0){return $(this,iX),o$(`subtract`,this,e,t)}until(e,t=void 0){return $(this,iX),XQ(`until`,this,e,t)}since(e,t=void 0){return $(this,iX),XQ(`since`,this,e,t)}round(e){if($(this,iX),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?w$(`smallestUnit`,e):C$(e),n=EX(t),r=CX(t,`halfExpand`),i=jX(t,`smallestUnit`,`time`,AX,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];if(DX(n,a,a===1),i===`nanosecond`&&n===1)return fZ(Q(this,sJ),Q(this,mJ),Q(this,Z));let o=Q(this,mJ),s=Q(this,sJ),c=T1(this),l;if(i===`day`){let e=c.isoDate,t=dQ(e.year,e.month,e.day+1),n=jZ(o,e),i=jZ(o,t),a=X.default.subtract(i,n);l=QJ.fromEpochNsDiff(s,n).round(a,r).addToEpochNs(n)}else{let e=l$(c,n,i,r),t=TZ(o,s);l=ZX(e.isoDate,e.time,`option`,t,o,`compatible`,`prefer`,!1)}return fZ(l,o,Q(this,Z))}equals(e){$(this,iX);let t=QX(e),n=Q(this,sJ),r=Q(t,sJ);return!!X.default.equal(X.default.BigInt(n),X.default.BigInt(r))&&!!wZ(Q(this,mJ),Q(t,mJ))&&yZ(Q(this,Z),Q(t,Z))}toString(e=void 0){$(this,iX);let t=C$(e),n=TX(t),r=OX(t),i=function(e){return T$(e,`offset`,[`auto`,`never`],`auto`)}(t),a=CX(t,`trunc`),o=jX(t,`smallestUnit`,`time`,void 0);if(o===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let s=function(e){return T$(e,`timeZoneName`,[`auto`,`never`,`critical`],`auto`)}(t),{precision:c,unit:l,increment:u}=kX(o,r);return UZ(this,c,n,s,i,{unit:l,increment:u,roundingMode:a})}toLocaleString(e=void 0,t=void 0){$(this,iX);let n=C$(t),r=Object.create(null);if(function(e,t,n,r){if(t==null)return;let i=Reflect.ownKeys(t);for(let r=0;r<i.length;r++){let a=i[r];!n.some((e=>Object.is(e,a)))&&Object.prototype.propertyIsEnumerable.call(t,a)&&(e[a]=t[a])}}(r,n,[`timeZone`]),n.timeZone!==void 0)throw TypeError(`ZonedDateTime toLocaleString does not accept a timeZone option`);if(r.year===void 0&&r.month===void 0&&r.day===void 0&&r.era===void 0&&r.weekday===void 0&&r.dateStyle===void 0&&r.hour===void 0&&r.minute===void 0&&r.second===void 0&&r.fractionalSecondDigits===void 0&&r.timeStyle===void 0&&r.dayPeriod===void 0&&r.timeZoneName===void 0&&(r.timeZoneName=`short`),r.timeZone=Q(this,mJ),WZ(r.timeZone))throw RangeError(`toLocaleString does not currently support offset time zones`);let i=new $$(e,r),a=_de.call(i).calendar,o=Q(this,Z);if(o!==`iso8601`&&a!==`iso8601`&&!yZ(a,o))throw RangeError(`cannot format ZonedDateTime with calendar ${o} in locale with calendar ${a}`);return i.format(uZ(Q(this,sJ)))}toJSON(){return $(this,iX),UZ(this,`auto`)}valueOf(){O$(`ZonedDateTime`)}startOfDay(){$(this,iX);let e=Q(this,mJ);return fZ(jZ(e,T1(this).isoDate),e,Q(this,Z))}getTimeZoneTransition(e){$(this,iX);let t=Q(this,mJ);if(e===void 0)throw TypeError(`options parameter is required`);let n=T$(typeof e==`string`?w$(`direction`,e):C$(e),`direction`,[`next`,`previous`],AX);if(n===void 0)throw TypeError(`direction option is required`);if(WZ(t)||t===`UTC`)return null;let r=Q(this,sJ),i=n===`next`?nQ(t,r):rQ(t,r);return i===null?null:fZ(i,t,Q(this,Z))}toInstant(){return $(this,iX),uZ(Q(this,sJ))}toPlainDate(){return $(this,iX),eZ(T1(this).isoDate,Q(this,Z))}toPlainTime(){return $(this,iX),oZ(T1(this).time)}toPlainDateTime(){return $(this,iX),nZ(T1(this),Q(this,Z))}static from(e,t=void 0){return QX(e,t)}static compare(e,t){let n=QX(e),r=QX(t),i=Q(n,sJ),a=Q(r,sJ);return X.default.lessThan(X.default.BigInt(i),X.default.BigInt(a))?-1:+!!X.default.greaterThan(X.default.BigInt(i),X.default.BigInt(a))}};function T1(e){return DZ(Q(e,mJ),Q(e,sJ))}function E1(e,t){$(e,iX);let n=T1(e).isoDate;return RX(e).isoToDate(n,{[t]:!0})[t]}function D1(e,t){return $(e,iX),T1(e).time[t]}GJ(w1,`Temporal.ZonedDateTime`);var vde=Object.freeze({__proto__:null,Duration:g1,Instant:u1,Now:b1,PlainDate:d1,PlainDateTime:p1,PlainMonthDay:_1,PlainTime:x1,PlainYearMonth:S1,ZonedDateTime:w1});(class{toTemporalInstant(){return uZ(v$(Date.prototype.valueOf.call(this)))}}).prototype.toTemporalInstant;var yde=[u1,d1,p1,g1,_1,x1,S1,w1];for(let e of yde){let t=Object.getOwnPropertyDescriptor(e,`prototype`);(t.configurable||t.enumerable||t.writable)&&(t.configurable=!1,t.enumerable=!1,t.writable=!1,Object.defineProperty(e,"prototype",t))}function bde(e,t){let n=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).formatToParts(e),r=e=>{let t=n.find(t=>t.type===e);if(!t)throw Error(`This timezone isn't recognised. Enter a timezone name like Europe/Tirane.`);return t.value};return`${r(`year`)}-${r(`month`)}-${r(`day`)}T${r(`hour`)}:${r(`minute`)}`}function xde(e,t){return bde(new Date(e),t)}function Sde(e,t){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(e))throw Error(`Pick a date and time for the one-off run.`);let n=vde.PlainDateTime.from(e,{overflow:`reject`}),r=n.toZonedDateTime(t,{disambiguation:`compatible`});if(!n.equals(r.toPlainDateTime()))throw Error(`That time is skipped in this timezone (a clock change). Choose another time.`);return r.toInstant().toString({smallestUnit:`millisecond`})}function O1(e,t){return new Intl.DateTimeFormat(void 0,{timeZone:t,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}var k1={"claude-code":{name:`Claude Code`,command:`claude auth login`},codex:{name:`Codex`,command:`codex login`},gemini:{name:`Gemini`,command:`gemini`}},Cde=/not signed in|sign-in has expired|not logged in|run\s+"?(?:codex login|claude auth login)|authentication required/i,wde=/ENOSPC|no space left on device|disk (?:is )?full|not enough (?:free )?(?:disk )?space/i,Tde=/refused to make|content (?:rules|policy|filter)|safety (?:system|filter)|flagged|moderation/i,Ede=/\bunknown model\b|\bmodel\b[^\n]{0,80}?\b(?:not found|does not exist|retired|deprecated|decommissioned|no longer (?:available|supported)|is not available)/i,Dde=/did not accept the API key|API key is saved|invalid api key|key may be wrong/i,Ode=[`images`,`thumbnail`],kde=/^Short \d+ image \d+:/;function A1(e){let t=e.reason??``,n=Ade(e.provider,t);if(n!==void 0&&(Cde.test(t)||e.kind===`auth`))return{kind:`sign-in`,label:`Sign in to ${k1[n].name}`,cli:n,command:k1[n].command};if(wde.test(t))return{kind:`free-space`,label:`Free space`};if(e.kind===`refusal`||Tde.test(t))return Ode.includes(e.stage)||e.stage===`video`&&kde.test(t)?{kind:`refused`,label:`Soften and retry`,soften:!0}:{kind:`refused`,label:`Edit the prompt`,soften:!1};if(Ede.test(t))return{kind:`switch-model`,label:`Switch model`};if(e.kind===`auth`||e.kind===`missing_key`||Dde.test(t)){let t=jde(e.provider);return{kind:`provider-settings`,label:t===void 0?`Open Settings → Providers`:`Open Settings → Providers → ${t}`,provider:e.provider??``}}}function Ade(e,t){if(e===`claude-code`||e===`gemini`)return e;if(e===`codex`||e===`codex-image`||/Codex CLI/.test(t))return`codex`;if(/Claude Code CLI/.test(t))return`claude-code`;if(/Gemini CLI/.test(t))return`gemini`}function jde(e){return NN.find(t=>t.id===e)?.displayName}function Mde(e,t){switch(t){case`audio`:return e.audio?.provider;case`images`:case`thumbnail`:return e.images?.provider;case`research`:case`article`:return e.llm?.provider;default:return}}var j1={catalogue:[`catalogue`],retired:[`catalogue`,`retired`],firstRun:[`first-run`]},M1={method:`POST`};async function Nde(e,t,n){return F(await e.fetch(`${e.origin}/api/providers/${t}/key/test`,n===void 0?M1:{...M1,headers:{"content-type":`application/json`},body:JSON.stringify({key:n})}))}async function N1(e,t){let n=t===void 0?``:`?provider=${encodeURIComponent(t)}`;return F(await e.fetch(`${e.origin}/api/providers/health${n}`,M1))}async function Pde(e){return F(await e.fetch(`${e.origin}/api/providers/catalogue`))}async function Fde(e){return F(await e.fetch(`${e.origin}/api/providers/catalogue/check`,M1))}async function Ide(e){return F(await e.fetch(`${e.origin}/api/providers/catalogue/refresh`,M1))}async function P1(e){return(await F(await e.fetch(`${e.origin}/api/providers/catalogue/retired`))).usages}async function F1(e,t){await F(await e.fetch(`${e.origin}/api/providers/catalogue/retired/switch`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:t.kind,id:t.id,slot:t.slot,from:{provider:t.provider,model:t.model},to:t.replacement?.id??``})}))}async function Lde(e){return F(await e.fetch(`${e.origin}/api/providers/catalogue/retired/switch-all`,M1))}async function Rde(e){return F(await e.fetch(`${e.origin}/api/providers/first-run`))}async function zde(e){let t=await e.fetch(`${e.origin}/api/providers/first-run/dismiss`,M1);t.ok||await F(t)}function Bde(e,t){let n=e.providers.find(e=>e.id===t.cli)?.checks.find(e=>e.label===`Signed in`);return n?.state===`ok`?`signed-in`:n?.state===`problem`?`signed-out`:`unknown`}function Vde(e){return e.label.replace(/^Sign in to /,``)}async function I1(e){if(!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function L1({fix:e,retry:t,variant:n=`primary`,size:r=`default`}){let{api:i}=R(),a=gy(),o=Vde(e),s=P({mutationFn:async()=>Bde(await N1(i,e.cli),e),onSuccess:n=>{if(n===`signed-out`){a(`${o} is still signed out. Run ${e.command} in a terminal on the computer running Slopify, sign in, then press Check again.`,`error`);return}if(t===void 0){a(n===`signed-in`?`${o} is signed in.`:`Slopify couldn't tell whether ${o} is signed in. If ${e.command} finished without an error, try the step again.`,n===`signed-in`?`success`:`info`);return}a(`${o} is signed in. Trying again.`,`success`),t.run()},onError:e=>a(`Slopify couldn't check ${o}'s sign-in: ${e.message} Press Check again in a moment, or use Check all in Settings → Providers.`,`error`)}),c=async()=>{let t=await I1(e.command);a(t?`Copied ${e.command}. Paste it in a terminal on the computer running Slopify and sign in, then press Check again.`:`Couldn't copy: the browser blocked the clipboard. Type ${e.command} in a terminal on the computer running Slopify, sign in, then press Check again.`,t?`success`:`error`)};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:n,size:r,onClick:()=>void c(),children:`Copy sign-in command`}),(0,h.jsx)(L,{variant:`secondary`,size:r,disabled:s.isPending||t?.busy===!0,disabledReason:`Checking the sign-in…`,onClick:()=>s.mutate(),children:s.isPending?`Checking…`:`Check again`})]})}function R1({fix:e,retry:t,edit:n,variant:r=`primary`,size:i=`default`}){switch(e.kind){case`sign-in`:return(0,h.jsx)(L1,{fix:e,retry:t,variant:r,size:i});case`provider-settings`:return(0,h.jsx)(zx,{to:`/settings`,search:{section:`providers`},variant:r,size:i,children:e.label});case`free-space`:return(0,h.jsx)(zx,{to:`/settings`,search:{section:`storage`},variant:r,size:i,children:e.label});case`refused`:case`switch-model`:return n??null}}function Hde(e){let t=e.topics.error;if(t!==null)return A1({stage:`article`,reason:t,provider:e.topicGeneration.llm?.provider})}function z1({schedule:e,title:t,retry:n,className:r}){if(e.topics.error===null)return null;let i=Hde(e);return(0,h.jsx)(pP,{tone:`danger`,title:t,...r===void 0?{}:{className:r},...i===void 0?{}:{actions:(0,h.jsx)(R1,{fix:i,retry:n,variant:`secondary`,size:`small`})},children:e.topics.error})}function B1(e){let t=Object.entries(e);return t.length===0?void 0:t.map(([e,t])=>`${e}: ${t}`).join(` · `)}function Ude({schedule:e}){let{api:t}=R(),n=_(),[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(null),s=e.deletedAt===null&&(e.status===`active`||e.status===`paused`),c=N({queryKey:[...wH(e.id),e.topics.held,e.topics.generatedAt],enabled:s&&e.topicGeneration.mode===`hold`,queryFn:async()=>{let n=await TH(t,e.id);if(!n.ok)throw Error(n.message);return n.value}}),l=N({queryKey:[`project-template`,e.templateId],enabled:s&&e.topicGeneration.mode===`hold`,queryFn:async()=>{let n=await Pq(t,e.templateId);if(!n.ok)throw Error(n.message);return n.value}}).data?.document.form,u=(l===void 0?[]:cq(l)).filter(t=>t!==e.topicKeyword),d=t=>e.values[t]??l?.values[t]??``,f=P({mutationFn:e=>e(),onSuccess:e=>{i(e.ok?null:e.message),e.ok&&o(null)},onError:e=>i(e.message),onSettled:async()=>{await Promise.all([n.invalidateQueries({queryKey:gH}),n.invalidateQueries({queryKey:wH(e.id)}),n.invalidateQueries({queryKey:IH})])}});if(!s||e.topicGeneration.mode===`off`)return null;let{topics:p}=e,g=f.isPending,v=c.data??[];return(0,h.jsxs)(`section`,{"aria-label":`Topic generation`,children:[(0,h.jsx)(Cq,{className:`my-6`}),(0,h.jsxs)(V,{as:`h3`,title:`Topic generation`,meta:`${p.generatingSince===null?p.generatedAt===null?`No topics generated yet.`:`Topics last generated ${O1(p.generatedAt,e.timezone)}.`:`Generating topics now…`} Keeps at least ${String(e.topicGeneration.keepAtLeast)} ${e.topicGeneration.mode===`hold`?`queued or waiting`:`queued`}.`,children:[(0,h.jsx)(B,{id:`planning.schedule.generate-now`}),(0,h.jsx)(L,{disabled:g||p.generatingSince!==null,disabledReason:`Topics are being generated now`,onClick:()=>f.mutate(()=>DH(t,e.id)),children:`Generate topics now`})]}),(0,h.jsx)(z1,{schedule:e,title:`The last topic generation failed.`,className:`mt-3`,retry:{run:()=>f.mutate(()=>DH(t,e.id)),busy:g||p.generatingSince!==null}}),r===null?null:(0,h.jsx)(pP,{tone:`danger`,title:`That didn't work.`,className:`mt-3`,children:r}),e.topicGeneration.mode===`hold`?(0,h.jsxs)(`div`,{className:`mt-4`,...cb,children:[(0,h.jsx)(V,{as:`h3`,title:`Topics waiting · ${String(v.length)}`,info:`planning.schedule.held`,children:(0,h.jsx)(L,{variant:`primary`,disabled:g||v.length===0,disabledReason:`Nothing is waiting`,onClick:()=>f.mutate(()=>AH(t,e.id)),children:`Approve all`})}),c.error?(0,h.jsx)(`p`,{className:`m-0 mt-2 text-small text-danger`,children:`The waiting topics couldn't be loaded: ${c.error.message} Reload the page to try again.`}):v.length===0?(0,h.jsx)(`p`,{className:`m-0 mt-2 text-small text-ink-3`,children:`Nothing is waiting. New topics appear here for you to approve.`}):(0,h.jsx)(iU,{label:`Topics waiting`,className:`mt-2 [&_.sl-row__actions]:flex-wrap`,children:v.map(n=>(0,h.jsx)(aU,{title:a?.id===n.id?(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(Y,{"aria-label":`Edit ${n.title}`,className:`w-full`,maxLength:200,value:a.title,onChange:e=>o({...a,title:e.target.value})}),u.length===0?null:(0,h.jsx)(`div`,{className:`grid grid-cols-1 gap-2 min-[600px]:grid-cols-2`,children:u.map(e=>(0,h.jsx)(uV,{label:e,tip:`planning.schedule.held-keywords`,children:(0,h.jsx)(Y,{maxLength:2e3,placeholder:d(e)||`Not set`,value:a.values[e]??``,onChange:t=>o({...a,values:{...a.values,[e]:t.target.value}})})},e))})]}):n.title,meta:a?.id===n.id?void 0:B1(n.values),actions:a?.id===n.id?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{size:`small`,disabled:g||a.title.trim()===``,onClick:()=>f.mutate(()=>MH(t,e.id,n.id,a.title.trim(),Object.fromEntries(Object.entries(a.values).filter(([,e])=>e.trim()!==``)))),children:`Save`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:()=>o(null),children:`Cancel`})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{size:`small`,disabled:g,onClick:()=>f.mutate(()=>kH(t,e.id,n.id)),children:`Approve`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,disabled:g,onClick:()=>o({id:n.id,title:n.title,values:n.values}),children:`Edit`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,disabled:g,onClick:()=>f.mutate(()=>jH(t,e.id,n.id)),children:`Reject`})]})},n.id))})]}):null]})}function Wde({schedules:e}){let t=e.filter(e=>e.deletedAt===null&&e.topicGeneration.mode!==`off`&&(e.status===`active`||e.status===`paused`));return(0,h.jsx)(`div`,{className:`flex flex-col gap-6`,children:t.length===0?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V,{title:`Suggested topics`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No schedule suggests its own topics yet. Turn on topic generation in a schedule and its suggestions wait here for you.`}),(0,h.jsx)(`div`,{children:(0,h.jsx)(Bx,{to:`/calendar`,search:{tab:`schedules`},children:`Open schedules`})})]}):t.map((e,t)=>(0,h.jsx)(Gde,{schedule:e,first:t===0},e.id))})}function Gde({schedule:e,first:t}){let{api:n}=R(),r=_(),i=gy(),a=N({queryKey:[...wH(e.id),e.topics.held,e.version],queryFn:async()=>{let t=await TH(n,e.id);if(!t.ok)throw Error(t.message);return t.value},enabled:e.topics.held>0}),o=P({mutationFn:e=>e(),onSuccess:e=>{e.ok||i(e.message,`error`)},onError:e=>i(`The topics weren't changed: ${e.message} Try again in a moment.`,`error`),onSettled:async()=>{await Promise.all([r.invalidateQueries({queryKey:gH}),r.invalidateQueries({queryKey:IH}),r.invalidateQueries({queryKey:wH(e.id)})])}}),s=e.topics.held>0?a.data??[]:[],c=()=>o.mutate(()=>AH(n,e.id));qb({id:`calendar.approve-all.${e.id}`,title:`Queue all suggested topics`,group:`Calendar`,context:e.name,keywords:[`approve`,`suggestions`,`topics`],run:c});let l=e.topics.generatingSince!==null,u=e.topicGeneration.mode===`hold`;return(0,h.jsxs)(`section`,{"aria-label":`Suggested topics for ${e.name}`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(V,{title:t?`Suggested topics`:e.name,kicker:t?e.name:void 0,meta:`From the series brief · not made or queued before`,info:`planning.schedule.held`,children:s.length>0?(0,h.jsx)(L,{size:`small`,variant:`secondary`,disabled:o.isPending,onClick:c,children:`Queue all ${String(s.length)}`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{id:`planning.schedule.generate-now`,label:`Suggest topics now`}),(0,h.jsx)(L,{size:`small`,variant:`quiet`,disabled:o.isPending||l,disabledReason:l?`Slopify is suggesting topics now.`:`Working…`,onClick:()=>o.mutate(()=>DH(n,e.id)),children:l?`Suggesting…`:`Suggest topics now`})]})}),(0,h.jsx)(z1,{schedule:e,title:`The last suggestion failed.`,retry:{run:()=>o.mutate(()=>DH(n,e.id)),busy:o.isPending||l}}),a.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`The suggestions didn't load: ${a.error.message} Reload the page to try again.`}),s.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:l?`Slopify is asking for new topics. They appear here when it finishes.`:`No suggestions are waiting.`}):(0,h.jsx)(iU,{label:`Suggestions for ${e.name}`,children:s.map(t=>(0,h.jsx)(aU,{title:t.title,meta:B1(t.values),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{size:`small`,variant:`quiet`,disabled:o.isPending,onClick:()=>o.mutate(()=>kH(n,e.id,t.id)),"aria-label":`Queue ${t.title}`,children:`Queue`}),(0,h.jsx)(ly,{size:`small`,label:`Reject ${t.title}`,disabled:o.isPending,onClick:()=>o.mutate(()=>jH(n,e.id,t.id)),children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]})},t.id))}),(0,h.jsx)(pP,{title:`Keeps at least ${String(e.topicGeneration.keepAtLeast)} ${e.topicGeneration.keepAtLeast===1?`topic`:`topics`} queued.`,children:u?`New suggestions wait here for you. Change this under Schedules → Edit.`:`New suggestions join the queue straight away. Change this under Schedules → Edit.`})]})}var Kde={info:`text-ink-2`,error:`text-danger`,warning:`text-waiting`,success:`text-accent-ink`};function V1({children:e,tone:t=`info`,className:n,id:r}){let i=typeof e==`string`?e:void 0;return(0,h.jsx)(`div`,{id:r,"data-slot":`status-slot`,role:t===`error`?`alert`:`status`,title:i,className:I(`flex min-h-8 min-w-0 flex-1 items-center gap-2 overflow-hidden text-small`,Kde[t],n),children:e==null||e===!1?null:i===void 0?e:(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:i})})}function H1({status:e,children:t,className:n}){return(0,h.jsxs)(`div`,{"data-slot":`action-bar`,className:I(`sticky bottom-0 z-20 -mx-4 mt-6 flex min-h-14 flex-wrap items-center gap-x-3 gap-y-2 border-t border-line bg-surface px-4 py-2 pb-[max(8px,env(safe-area-inset-bottom))] max-md:bottom-[calc(48px+max(12px,env(safe-area-inset-bottom)))] md:-mx-10 md:px-10`,n),children:[(0,h.jsx)(`div`,{className:`flex w-full min-w-0 sm:w-auto sm:flex-1`,children:e??(0,h.jsx)(V1,{})}),(0,h.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:t})]})}function U1({split:e=`main-side`,className:t,children:n}){return(0,h.jsx)(`div`,{"data-slot":`board`,className:I(`sl-board`,`sl-board--${e}`,t),children:n})}function W1({as:e=`div`,label:t,className:n,children:r}){let i=I(`sl-board__column`,n);return e===`aside`?(0,h.jsx)(`aside`,{"aria-label":t,className:i,children:r}):t===void 0?(0,h.jsx)(`div`,{className:i,children:r}):(0,h.jsx)(`section`,{"aria-label":t,className:i,children:r})}var G1=`sl-tab inline-flex items-center gap-[6px]`;function K1({items:e,value:t,onChange:n,label:r,idPrefix:i,trailing:a,className:o}){let s=(0,m.useRef)(null);return(0,h.jsxs)(`div`,{className:I(`flex min-w-0 items-end gap-3 border-b border-line`,o),"data-slot":`tabs`,children:[(0,h.jsx)(`div`,{ref:s,role:`tablist`,"aria-label":r,onKeyDown:r=>{let a=e.filter(e=>!e.disabled),o=a.findIndex(e=>e.id===t),c=r.key===`ArrowRight`?a[(o+1)%a.length]:r.key===`ArrowLeft`?a[(o-1+a.length)%a.length]:r.key===`Home`?a[0]:r.key===`End`?a[a.length-1]:void 0;c&&(r.preventDefault(),n(c.id),s.current?.querySelector(`#${i}-tab-${c.id}`)?.focus())},className:`sl-tabs min-w-0 flex-1 border-b-0`,children:e.map(e=>(0,h.jsxs)(`button`,{id:`${i}-tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":e.id===t,"aria-controls":`${i}-panel-${e.id}`,tabIndex:e.id===t?0:-1,disabled:e.disabled,onClick:()=>n(e.id),className:G1,children:[e.label,e.badge===void 0?null:(0,h.jsx)(`span`,{className:`sl-tab__count ml-0`,children:e.badge})]},e.id))}),a?(0,h.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 pb-1`,children:a}):null]})}function qde({items:e,label:t,className:n}){return(0,h.jsx)(`nav`,{"aria-label":t,className:I(`sl-tabs min-w-0`,n),children:e.map(e=>(0,h.jsx)(ha,{to:e.to,...e.search?{search:e.search}:{},activeOptions:{exact:!1,includeSearch:!1},className:G1,activeProps:{"aria-current":`page`},children:e.label},e.to))})}function q1({idPrefix:e,id:t,active:n,children:r,className:i}){return(0,h.jsx)(`div`,{id:`${e}-panel-${t}`,role:`tabpanel`,"aria-labelledby":`${e}-tab-${t}`,hidden:!n,className:i,children:r})}function J1({title:e,children:t,actions:n,className:r}){return(0,h.jsxs)(`div`,{className:I(`sl-empty`,r),"data-slot":`empty-state`,children:[(0,h.jsx)(`h2`,{className:`sl-section-head__title`,children:e}),t===void 0?null:(0,h.jsx)(`p`,{children:t}),n===void 0?null:(0,h.jsx)(`div`,{className:`sl-btn-row`,children:n})]})}function Y1(e){return e.channelId??`00000000-0000-4000-8000-000000000001`}function Jde({channelId:e}){let{api:t}=R(),n=_(),r=N(Nq(t)),i=N(wb(t)),a=P({mutationFn:e=>Fb(t,e.templateId,e.channelId),onSettled:()=>Promise.all([n.invalidateQueries({queryKey:Oq}),n.invalidateQueries({queryKey:bb})])}),o=(r.data??[]).filter(t=>Y1(t)===e);return(0,h.jsxs)(`div`,{...cb,children:[(0,h.jsxs)(`p`,{className:`m-0 mb-4 max-w-[68ch] text-small text-ink-2`,children:[`Runs from these templates use this channel's brand kit and cast. Save new ones from Play in`,` `,(0,h.jsx)(ha,{to:`/templates`,className:`underline`,children:`Library → Templates`}),`. Move to sends a template and its schedules to another channel.`,` `,(0,h.jsx)(B,{id:`planning.channel.template-move`,className:`-my-1 align-middle`})]}),(0,h.jsx)(V1,{tone:a.error||r.error?`error`:`info`,className:`mb-2`,children:a.error?.message??r.error?.message}),r.data&&o.length===0?(0,h.jsx)(J1,{title:`No templates in this channel`,children:`Pick this channel on Play, then save the setup as a template, or move one here from another channel.`}):null,o.length>0?(0,h.jsx)(iU,{label:`Channel templates`,className:`[&_.sl-row__actions]:flex-wrap`,children:o.map(t=>(0,h.jsx)(aU,{title:t.name,meta:`Version ${String(t.version)}`,actions:(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-small text-ink-2`,children:[`Move to`,(0,h.jsx)(pV,{"aria-label":`Channel of ${t.name}`,value:e,disabled:a.isPending,onChange:e=>a.mutate({templateId:t.id,channelId:e.target.value}),options:(i.data??[]).map(e=>({value:e.id,label:e.name}))})]})},t.id))}):null]})}var Yde={active:`Active`,paused:`Paused`,completed:`Completed`,canceled:`Canceled`},Xde={active:`running`,paused:`waiting`,completed:`done`,canceled:`off`};function Zde({channelId:e}){let{api:t}=R(),n=N(Nq(t)),r=N(_H(t)),i=new Set((n.data??[]).filter(t=>Y1(t)===e).map(e=>e.id)),a=(r.data??[]).filter(e=>e.deletedAt===null&&i.has(e.templateId));return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`p`,{className:`m-0 mb-4 max-w-[68ch] text-small text-ink-2`,children:[`A schedule belongs to the channel of the template it runs. Create and change schedules in`,` `,(0,h.jsx)(ha,{to:`/calendar`,search:{tab:`schedules`},className:`underline`,children:`Calendar → Schedules`}),`.`]}),(0,h.jsx)(V1,{tone:r.error?`error`:`info`,className:`mb-2`,children:r.error?.message}),r.data&&a.length===0?(0,h.jsx)(J1,{title:`No schedules run this channel's templates`,children:`Make one in Calendar → Schedules from one of this channel's templates.`}):null,a.length>0?(0,h.jsx)(iU,{label:`Channel schedules`,children:a.map(e=>(0,h.jsx)(aU,{title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Wx,{tone:Xde[e.status],children:Yde[e.status]}),` · ${e.nextRunAt===null?`No next run`:`Next run ${O1(e.nextRunAt,e.timezone)}`} · ${String(e.items.length)} queued`]})},e.id))}):null]})}var X1={llm:`Text model`,audio:`Voice model`,images:`Image model`,animate:`Animation model`};function Z1({kind:e,id:t,name:n}){let{api:r}=R(),i=_(),a=N({queryKey:j1.retired,queryFn:()=>P1(r)}),o=P({mutationFn:e=>F1(r,e),onSuccess:()=>Promise.all([i.invalidateQueries({queryKey:j1.retired}),i.invalidateQueries({queryKey:Oq}),i.invalidateQueries({queryKey:gH})])}),s=(a.data??[]).filter(n=>n.kind===e&&n.id===t);return s.length===0?null:(0,h.jsxs)(`li`,{"aria-label":`Retired models in ${n}`,className:`flex flex-col gap-2 px-3 pb-3`,children:[s.map(t=>(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-small`,children:[(0,h.jsxs)(`span`,{className:`text-waiting`,children:[`${X1[t.slot]} ${t.model} is ${t.why===`retired`?`retired`:`no longer listed`}.`,t.blocked===null?``:` ${t.blocked}`,t.replacement===null&&t.blocked===null?` No replacement is suggested: choose another model in Settings → Models, or edit the ${e}.`:``]}),t.replacement===null?null:(0,h.jsx)(L,{size:`small`,disabled:t.blocked!==null||o.isPending,disabledReason:t.blocked??`Switching…`,onClick:()=>o.mutate(t),children:`Switch to ${t.replacement.name}`})]},t.key)),o.error?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`The model wasn't switched: ${o.error.message}`}):null]})}function Q1(e){return jk(e)?`script`:`article`}function Qde(e){let{form:t}=e,n=[],r=[];if(r0(n,t.title),Uk(t)&&r0(n,t0(e.prompts,`narration`,t.narrationPrompt??``)),t.sources.article===`generate`&&r0(n,t0(e.prompts,Q1(t),t.articlePrompt)),t.sources.audio===`generate`&&(r0(n,n0(e.entries,`intro`,t.intro)),r0(n,n0(e.entries,`outro`,t.outro))),Kk(t)&&r0(n,t0(e.prompts,`description`,t.descriptionPrompt??``)),aM(t)&&(r0(n,t0(e.prompts,`shorts`,t.shorts?.prompt??``)),r0(r,t0(e.prompts,`image`,t.shorts?.imagePrompt??``))),t.sources.images===`generate`){for(let n of t.imagePrompts)r0(r,t0(e.prompts,`image`,n.name));t.reference?.source===`prompt`&&r0(r,t0(e.prompts,`image`,t.reference.prompt))}return(t.sources.thumbnail===`from_prompt`||t.sources.thumbnail===`prompt_by_llm`)&&r0(r,t0(e.prompts,`thumbnail`,t.thumbnailPrompt)),iq(n,r)}function $de(e){let t=Qde(e),n={form:e.form,entries:e.entries,slots:t.map(e=>e.name),silenceGapSeconds:e.silenceGapSeconds},r=dM(n),i=mae({draft:r,staged:Eae(e.form.provided),requiredSlots:n.slots}),a=rM(r.subtitles??e.form.subtitles)?i:{ok:!1,fields:[...i.ok?[]:i.fields,{field:`subtitles.fontSize`,message:`Choose a whole subtitle font size from 16 to 120.`}]};return{fields:t,draft:r,result:a,blocker:efe(e.form,a)}}var $1=`sources,provided.research,articlePrompt,provided.article,audio,provided.audio,voices,narrationPrompt,imagePrompts,images,provided.images,reference,provided.reference,thumbnailPrompt,provided.thumbnail,subtitles,title,intro,outro,llm,values,silenceGapSeconds,edgeSilenceSeconds,imageSeconds,zoomPercent,motionStyle,youtubeDescription,descriptionPrompt,shorts.enabled,shorts.count,shorts.minSeconds,shorts.maxSeconds,shorts.prompt,shorts.imagePrompt,shorts.speed,shorts.musicVolume,shorts.music,shorts.fullVideoLink,videoEdit.transitionSeconds,videoEdit.chapterCards,videoEdit.animate,videoEdit.animateEvery,videoEdit.animateModel,ambientBed,sentencePauseSeconds,paragraphPauseSeconds,loudness.videoLufs,loudness.audioFilesLufs`.split(`,`);function efe(e,t){let n=tfe(e);if(n!==void 0)return n;if(t.ok)return;let r=[...t.fields].sort((e,t)=>e0(e.field)-e0(t.field))[0];return r===void 0?void 0:{field:r.field,hint:nfe(e,r)}}function tfe(e){let{sources:t,provided:n}=e,r=[];if(t.audio===`provide`&&n.audio!==void 0&&r.push(n.audio),t.images===`provide`&&r.push(...n.images),t.thumbnail===`provide`&&n.thumbnail!==void 0&&r.push(n.thumbnail),t.images===`generate`&&e.reference?.source===`provide`&&n.reference!==void 0&&r.push(n.reference),aM(e)&&n.shortsMusic!==void 0&&r.push(n.shortsMusic),oM(e)&&n.ambientBed!==void 0&&r.push(n.ambientBed),r.some(e=>e.error!==void 0))return{field:`provided`,hint:`Remove the upload that failed to play`};if(r.some(e=>e.file===void 0))return{field:`provided`,hint:`Wait for the uploads to finish to play`}}function e0(e){let t=$1.length;for(let[n,r]of $1.entries())(e===r||e.startsWith(`${r}.`))&&n<t&&(t=n);return t}function nfe(e,t){if(t.field.startsWith(`values.`))return`Fill ${t.field.slice(7)} to play`;if(t.field.startsWith(`imagePrompts.`))return t.field.endsWith(`.number`)?`Set a Number between 1 and 20 to play`:`Pick an image prompt to play`;switch(t.field){case`title`:return e.title.trim()===``?`Name the video to play`:`Shorten the title to 200 characters to play`;case`imagePrompts`:return e.imagePrompts.length===0?`Tick an image prompt to play`:`Lower the Numbers to play: a run makes at most 60 images`;case`llm`:return`Pick an LLM provider and model to play`;case`articlePrompt`:return Q1(e)===`script`?`Pick a script prompt to play`:`Pick an article prompt to play`;case`audio`:return`Pick a narration provider to play`;case`audio.voice`:return`Pick a voice to play`;case`images`:return`Pick an image provider and model to play`;case`thumbnailPrompt`:return`Pick a thumbnail prompt to play`;case`youtubeDescription`:return`Turn narration on, or the YouTube description off, to play`;case`shorts.enabled`:return`Turn narration on, or Shorts off, to play`;case`shorts.count`:return`Set how many shorts to make to play`;case`shorts.minSeconds`:case`shorts.maxSeconds`:return`Set the shorts' length to play`;case`shorts.speed`:return`Choose the shorts' speed to play`;case`shorts.musicVolume`:return`Set the shorts' music volume to play`;case`shorts.music`:return`Attach the shorts' background music again, or remove it, to play`;case`shorts.fullVideoLink`:return`Fix the full video link to play`;case`provided.research`:return`Paste the research notes to play`;case`provided.article`:return`Paste the article to play`;case`provided.audio`:return`Attach the narration audio to play`;case`provided.images`:return e.provided.images.length>60?`Remove images to play: a run holds at most 60`:`Attach at least one image to play`;case`provided.thumbnail`:return`Attach the thumbnail image to play`;case`reference.prompt`:return`Pick the establishing image's prompt to play`;case`provided.reference`:return`Attach the establishing image to play`;default:return t.message}}function t0(e,t,n){if(n!==``)return e.find(e=>e.kind===t&&e.name===n)?.body}function n0(e,t,n){if(n!==``)return e.find(e=>e.category===t&&e.name===n)?.body}function r0(e,t){t!==void 0&&e.push(t)}function i0(e){let t=new Map,n=(e,n)=>{if(e)for(let r of nq(e).names){let e=t.get(r)??[];e.includes(n)||e.push(n),t.set(r,e)}},{form:r,prompts:i,entries:a}=e;if(n(r.title,`Project title`),Uk(r)&&n(t0(i,`narration`,r.narrationPrompt??``),`Narration Preparation`),r.sources.article===`generate`&&n(t0(i,Q1(r),r.articlePrompt),`Article`),r.sources.images===`generate`){for(let e of r.imagePrompts)n(t0(i,`image`,e.name),`Image: ${e.name}`);r.reference?.source===`prompt`&&n(t0(i,`image`,r.reference.prompt),`Establishing image`)}if((r.sources.thumbnail===`from_prompt`||r.sources.thumbnail===`prompt_by_llm`)&&n(t0(i,`thumbnail`,r.thumbnailPrompt),`Thumbnail`),r.sources.audio===`generate`)for(let e of[`intro`,`outro`])n(n0(a,e,r[e]),e===`intro`?`Intro`:`Outro`);return Kk(r)&&n(t0(i,`description`,r.descriptionPrompt??``),`YouTube description`),aM(r)&&(n(t0(i,`shorts`,r.shorts?.prompt??``),`Shorts`),n(t0(i,`image`,r.shorts?.imagePrompt??``),`Shorts images`)),t}function a0(e){let t=[e.feeds.length===0?`Not used by any picked prompt`:`Feeds ${e.feeds.join(` · `)}`,...e.topic?[`left empty in templates`]:[]].join(` · `);return e.note===void 0?t:`${t}. ${e.note}`}function o0({keywords:e,onChange:t,problem:n,fieldPrefix:r=`values`,empty:i,label:a=e=>e,inputLabel:o,tip:s=`play.keyword`,maxLength:c=200}){if(e.length===0)return i===void 0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i});let l=a0;return t===void 0?(0,h.jsx)(iU,{label:`Keywords`,children:e.map(e=>(0,h.jsx)(aU,{title:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`code`,{className:`sl-code`,children:`{{${e.name}}}`}),` `,e.value===``?(0,h.jsx)(`span`,{className:`text-ink-3`,children:e.topic?`the topic`:`empty`}):e.value]}),meta:l(e)},e.name))}):(0,h.jsx)(`div`,{"data-tour":`play-keywords`,className:`grid min-w-0 grid-cols-1 gap-4 min-[700px]:grid-cols-2`,children:e.map(e=>(0,h.jsx)(uV,{label:a(e.name),tip:s,help:l(e),error:n?.(`${r}.${e.name}`),children:(0,h.jsx)(Y,{"data-play-field":`${r}.${e.name}`,value:e.value,maxLength:c,...o===void 0?{}:{"aria-label":o(e.name)},spellCheck:!1,"aria-invalid":n?.(`${r}.${e.name}`)!==void 0,onChange:n=>t(e.name,n.target.value)})},e.name))})}var s0={lines:`One per line`,table:`Table`,yaml:`YAML / JSON`};function c0(e){return{mode:`lines`,rows:e,lines:_q(e),base:e,yaml:``,columns:l0(e,[])}}function l0(e,t){return[...new Set([...t,...e.flatMap(e=>Object.keys(e.values))])]}function u0(e){return e.keywords.filter(t=>t!==e.topicKeyword&&(e.everyRun[t]??``).trim()===``)}function d0(e,t){if(t.form===void 0)return{rows:e.rows,problems:[]};if(e.mode===`yaml`){let n=vq(e.yaml,{keywords:t.keywords,topicKeyword:t.topicKeyword,required:u0(t)});return n.ok?{rows:n.rows,problems:[]}:{rows:[],problems:n.problems}}let n=e.rows.map(e=>({title:e.title.trim(),values:Object.fromEntries(Object.entries(e.values).filter(([,e])=>e!==``))}));return{rows:n,problems:mq(n,{keywords:t.keywords,topicKeyword:t.topicKeyword,...e.mode===`table`?{required:u0(t)}:{},kept:t.kept})}}function rfe(e,t,n){if(t===e.mode)return{queue:e,problems:[]};let r=e.rows;if(e.mode===`yaml`){let t=vq(e.yaml,{keywords:n.keywords.length===0?Object.keys(n.everyRun):n.keywords,topicKeyword:n.topicKeyword});if(!t.ok)return{queue:e,problems:t.problems};r=t.rows}return{queue:{...e,mode:t,rows:r,lines:t===`lines`?_q(r):e.lines,base:t===`lines`?r:e.base,yaml:t===`yaml`?yq(r,n.topicKeyword):e.yaml,columns:l0(r,e.columns)},problems:[]}}function ife({queue:e,onQueue:t,context:n,onKeyword:r,onValue:i,loading:a,exportName:o}){let[s,c]=(0,m.useState)([]),[l,u]=(0,m.useState)(null),{keywords:d,topicKeyword:f,form:p,everyRun:g}=n,_=e=>n.origins?.get(e)??[],v=d0(e,n),y=e.mode===`yaml`?v.rows:e.rows,b=e=>p===void 0?void 0:uq(p,{topicKeyword:f,values:g},e),x=y[0],S=x===void 0?void 0:b(x),C=f!==null&&p?.title.includes(`{{${f}}}`)===!0,w=()=>yq(d0(e,n).rows,f),T=()=>{let e=w();if(!navigator.clipboard){u(`Couldn't copy the list. Switch to YAML / JSON, select the text and copy it.`);return}navigator.clipboard.writeText(e).then(()=>u(`Copied ${String(y.length)} topics as YAML.`),()=>u(`Couldn't copy the list. Switch to YAML / JSON, select the text and copy it.`))},E=()=>{let e=URL.createObjectURL(new Blob([w()],{type:`application/yaml`})),t=document.createElement(`a`);t.href=e,t.download=`${(o.trim()||`schedule`).replace(/[^\w.-]+/g,`-`)}-topics.yaml`,t.click(),URL.revokeObjectURL(e),u(`Downloaded ${String(y.length)} topics as YAML.`)},D=(n,r)=>t({...e,rows:e.rows.map((e,t)=>t===n?r:e)}),O=d.filter(t=>t!==f&&!e.columns.includes(t)),k=[...s,...v.problems];return(0,h.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-3 border-0 border-t border-line p-0 pt-5 min-[700px]:col-span-2`,children:[(0,h.jsxs)(`legend`,{className:`float-left mb-1 flex w-full items-center gap-1 text-title-3 font-semibold`,children:[`Topics (optional)`,(0,h.jsx)(B,{id:`planning.schedule.topics`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(ub,{label:`How to write the topics`,tip:`planning.schedule.topic-format`,value:e.mode,options:Object.keys(s0).map(e=>({value:e,label:s0[e]})),onChange:r=>{let i=rfe(e,r,n);c(i.problems),t(i.queue)}}),(0,h.jsxs)(L,{variant:`quiet`,size:`small`,disabled:y.length===0||v.problems.length>0,disabledReason:`Add topics, and fix the problems below, first`,onClick:T,children:[(0,h.jsx)(kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Copy as YAML`]}),(0,h.jsxs)(L,{variant:`quiet`,size:`small`,disabled:y.length===0||v.problems.length>0,disabledReason:`Add topics, and fix the problems below, first`,onClick:E,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Export as YAML`]}),l===null?null:(0,h.jsx)(`span`,{role:`status`,className:`text-small text-ink-2`,children:l})]}),e.mode===`lines`?(0,h.jsx)(uV,{id:`schedule-topics`,tip:`planning.schedule.topic-lines`,tipLabel:`Topics, one per line`,label:y.length===0?`One per line`:`${String(y.length)} ${y.length===1?`topic`:`topics`} · next: ${x?.title??``}`,children:(0,h.jsx)(fV,{rows:6,value:e.lines,onChange:n=>t({...e,lines:n.target.value,rows:gq(n.target.value,e.base)}),placeholder:`Pyramids
|
|
270
270
|
Sphinxes
|
|
271
|
-
Obelisks`})}):e.mode===`yaml`?(0,h.jsx)(uV,{id:`schedule-topics-yaml`,label:`Topics as YAML or JSON`,tip:`planning.schedule.topic-yaml`,children:(0,h.jsx)(fV,{rows:10,className:`font-mono`,spellCheck:!1,value:e.yaml,onChange:n=>t({...e,yaml:n.target.value}),placeholder:`- ${f??`Topic`}: Cleopatra\n ${d.find(e=>e!==f)??`Min. Word Count`}: 12000\n- Hypatia`})}):(0,h.jsx)(afe,{queue:e,onQueue:t,keyword:f,addable:O,setRow:D,titleOf:b}),k.length===0?null:(0,h.jsx)(pP,{tone:`danger`,title:`These topics can't be saved yet.`,children:(0,h.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[k.slice(0,8).map(e=>(0,h.jsx)(`li`,{children:e},e)),k.length>8?(0,h.jsx)(`li`,{children:`And ${String(k.length-8)} more.`}):null]})}),e.mode===`yaml`&&v.rows.length>0?(0,h.jsxs)(`section`,{"aria-label":`Project titles`,children:[(0,h.jsx)(`p`,{className:`m-0 mb-1 text-small text-ink-2`,children:`Project titles, in order:`}),(0,h.jsxs)(`ol`,{className:`m-0 flex flex-col gap-1 pl-5 text-small`,children:[v.rows.slice(0,20).map((e,t)=>(0,h.jsx)(`li`,{children:b(e)},t)),v.rows.length>20?(0,h.jsx)(`li`,{className:`list-none text-ink-3`,children:`And ${String(v.rows.length-20)} more.`}):null]})]}):null,a?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Reading the template's keywords…`}):d.length===0?(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-3`,children:[`This template has no keywords such as `,`{{Topic}}`,`, so each topic becomes the project's title.`]}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:(0,h.jsx)(uV,{label:`Each topic fills`,id:`schedule-topic-keyword`,tip:`planning.schedule.topic-keyword`,...f===null?{}:{help:a0({feeds:_(f)})},children:(0,h.jsx)(pV,{value:f??``,onChange:e=>r(e.target.value),children:d.map(e=>(0,h.jsx)(`option`,{value:e,children:`{{${e}}}`},e))})})}),(0,h.jsx)(o0,{keywords:d.filter(e=>e!==f).map(t=>({name:t,value:g[t]??``,feeds:_(t),...e.columns.includes(t)?{note:`Unless a topic sets its own.`}:{}})),onChange:i,fieldPrefix:`everyRun`,label:e=>`${e} (every run)`,inputLabel:e=>`${e} for every run`,tip:`planning.schedule.every-run`,maxLength:1e4})]}),e.mode===`lines`&&S!==void 0&&x!==void 0?(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Next project: `,(0,h.jsx)(`span`,{className:`font-semibold text-ink`,children:S}),f===null||C?null:(0,h.jsxs)(`span`,{className:`block text-ink-3`,children:[`The template's project title does not use `,`{{${f}}}`,`, so every project gets this title. Edit the template's title to include it.`]})]}):null]})}function afe({queue:e,onQueue:t,keyword:n,addable:r,setRow:i,titleOf:a}){let o=n===null?`Title`:`{{${n}}}`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...cb,children:[(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsxs)(`table`,{className:`sl-table`,"aria-label":`Topics`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{scope:`col`,children:`#`}),(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[o,(0,h.jsx)(B,{id:`planning.schedule.topic-table`,className:`-my-1`})]})}),e.columns.map(n=>(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`{{${n}}}`,(0,h.jsx)(ly,{label:`Use the every-run ${n} for all topics`,size:`small`,onClick:()=>t({...e,columns:e.columns.filter(e=>e!==n),rows:e.rows.map(e=>({title:e.title,values:Object.fromEntries(Object.entries(e.values).filter(([e])=>e!==n))}))}),children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]})},n)),(0,h.jsx)(`th`,{scope:`col`,children:`Project title`}),(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Remove`})})]})}),(0,h.jsx)(`tbody`,{children:e.rows.map((n,r)=>(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{className:`num`,children:r+1}),(0,h.jsx)(`td`,{children:(0,h.jsx)(Y,{"aria-label":`Topic ${String(r+1)} ${o}`,maxLength:200,value:n.title,onChange:e=>i(r,{...n,title:e.target.value})})}),e.columns.map(e=>(0,h.jsx)(`td`,{children:(0,h.jsx)(Y,{"aria-label":`Topic ${String(r+1)} ${e}`,maxLength:sq,placeholder:`Every-run value`,value:n.values[e]??``,onChange:t=>i(r,{...n,values:{...n.values,[e]:t.target.value}})})},e)),(0,h.jsx)(`td`,{className:`min-w-[180px] text-small text-ink-2`,children:a(n)??`—`}),(0,h.jsx)(`td`,{children:(0,h.jsx)(ly,{label:`Remove topic ${String(r+1)}`,size:`small`,onClick:()=>t({...e,rows:e.rows.filter((e,t)=>t!==r)}),children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})})]},r))})]})}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(L,{size:`small`,onClick:()=>t({...e,rows:[...e.rows,{title:``,values:{}}]}),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add topic`]}),r.length===0?null:(0,h.jsxs)(pV,{"aria-label":`Set a keyword per topic`,value:``,className:`w-auto`,onChange:n=>{let r=n.target.value;r!==``&&t({...e,columns:[...e.columns,r]})},children:[(0,h.jsx)(`option`,{value:``,children:`Set a keyword per topic…`}),r.map(e=>(0,h.jsx)(`option`,{value:e,children:e},e))]})]})]})}var ofe=[[1,`Mon`],[2,`Tue`],[3,`Wed`],[4,`Thu`],[5,`Fri`],[6,`Sat`],[0,`Sun`]];function sfe({templates:e,pending:t,onCreated:n,onError:r,editing:i,onCancel:a,error:o,onBusy:s}){let{api:c}=R(),[l,u]=(0,m.useState)(i?.name??``),[d,f]=(0,m.useState)(i?.templateId??``),[p,g]=(0,m.useState)(i?.cadence.kind??`daily`),[_,v]=(0,m.useState)(i?.cadence.kind===`once`?xde(i.cadence.at,i.timezone):``),[y,b]=(0,m.useState)(i&&i.cadence.kind!==`once`?i.cadence.time:`09:00`),[x,S]=(0,m.useState)(i?.cadence.kind===`weekly`?i.cadence.days:[1,3,5]),[C,w]=(0,m.useState)(()=>i?.timezone??(Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`)),[T,E]=(0,m.useState)(i?.missedPolicy??`skip`),[D,O]=(0,m.useState)(i?.spendLimitCents?.toString()??``),[k,A]=(0,m.useState)(()=>c0(i?.items??[])),[ee,te]=(0,m.useState)(i?.topicKeyword??null),[ne,j]=(0,m.useState)(i?.values??{}),[re,M]=(0,m.useState)(i?.brief??``),[ie,ae]=(0,m.useState)(i?.topicGeneration??eH),[oe,se]=(0,m.useState)(!1),[ce,le]=(0,m.useState)(!1),ue=(0,m.useRef)(!1),de=(0,m.useRef)(null),fe=i&&!e.some(e=>e.id===i.templateId)?[...e,{id:i.templateId,version:i.templateVersion,name:`Saved template`}]:e,pe=fe.find(e=>e.id===d),me=N({queryKey:[`project-template`,d],enabled:d!==``,queryFn:async()=>{let e=await Pq(c,d);if(!e.ok)throw Error(e.message);return e.value}}),he=me.data?.document.form,ge=he===void 0?void 0:i0({form:he,prompts:me.data?.document.librarySnapshot?.prompts??[],entries:me.data?.document.librarySnapshot?.entries??[]}),_e=he===void 0?[]:cq(he),ve=ee!==null&&_e.includes(ee)?ee:_e.find(e=>he?.title.includes(`{{${e}}}`))??_e[0]??null,ye=Object.fromEntries(_e.filter(e=>e!==ve).map(e=>[e,ne[e]??he?.values[e]??``])),be={keywords:_e,topicKeyword:ve,everyRun:ye,form:he,kept:i?.items??[],...ge===void 0?{}:{origins:ge}},xe=d0(k,be);async function Se(e){if(e.preventDefault(),!(ue.current||t)){if(!pe&&!de.current){r(`Choose a template before saving the schedule.`);return}if(!de.current&&xe.problems.length>0){r(`Fix the topics first. ${xe.problems.slice(0,3).join(` `)}`);return}if(xe.rows.length>500){r(`Keep the list to 500 topics or fewer.`);return}if(re.trim().length>4e3){r(`Keep the series brief to ${String(QV)} characters or fewer.`);return}if(ie.llm!==null&&(ie.llm.provider===``||ie.llm.model===``)){r(`Pick both a provider and a model for topic generation, or choose Use the template's LLM.`);return}if(p===`weekly`&&x.length===0){r(`Choose at least one weekday for a weekly schedule.`);return}ue.current=!0,se(!0),s(!0);try{if(!de.current){if(!pe)throw Error(`Choose a template before saving the schedule.`);let e=C.trim();if(!WV(e))throw Error(`Enter a timezone name like Europe/Tirane or America/New_York.`);let t=p===`once`?{kind:p,at:Sde(_,e)}:p===`weekly`?{kind:p,time:y,days:x}:{kind:p,time:y},n=D.trim()===``?null:Number(D);if(n!==null&&(!Number.isInteger(n)||n<0))throw Error(`Enter the spend limit as a whole number of cents, 0 or more (500 is $5.00), or leave it empty.`);let r={id:i?.id??crypto.randomUUID(),name:l.trim(),templateId:pe.id,templateVersion:pe.version,cadence:t,timezone:e,missedPolicy:T,overlapPolicy:`skip`,spendLimitCents:n,items:xe.rows,topicKeyword:ve,values:ye,brief:re.trim()===``?null:re.trim(),topicGeneration:ie};de.current=i?{...r,baseVersion:i.version,mutationId:crypto.randomUUID()}:r}let e=de.current,{id:t,...a}=e,o=`mutationId`in a?await bH(c,t,a):await yH(c,e);if(!o.ok){de.current=null,le(!1),r(o.reason===`conflict`?`${o.message} Your inputs are kept here. To load the latest saved version, cancel editing and press Edit again.`:o.message);return}de.current=null,le(!1),u(``),A(c0([])),n()}catch(e){le(de.current!==null),r(e instanceof Error?e.message:`The schedule wasn't saved. Try again.`)}finally{ue.current=!1,se(!1),s(de.current!==null)}}}return(0,h.jsxs)(`section`,{"aria-label":i?`Edit schedule`:`New schedule`,children:[o?(0,h.jsx)(pP,{tone:`danger`,title:`The schedule wasn't saved.`,className:`mb-4`,children:o}):null,(0,h.jsxs)(`form`,{onSubmit:e=>void Se(e),children:[(0,h.jsxs)(`fieldset`,{disabled:oe||ce||t,className:`m-0 grid min-w-0 gap-4 border-0 p-0 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(uV,{label:`Name`,id:`schedule-name`,tip:`planning.schedule.name`,children:(0,h.jsx)(Y,{required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`Monday morning stories`})}),(0,h.jsx)(uV,{label:`Template`,id:`schedule-template`,tip:`planning.schedule.template`,children:(0,h.jsxs)(pV,{required:!0,value:d,onChange:e=>f(e.target.value),disabled:fe.length===0,children:[(0,h.jsx)(`option`,{value:``,children:`Choose a template`}),fe.map(e=>(0,h.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.version]},e.id))]})}),(0,h.jsx)(uV,{label:`Cadence`,id:`schedule-cadence`,tip:`planning.schedule.cadence`,children:(0,h.jsxs)(pV,{value:p,onChange:e=>g(e.target.value===`once`?`once`:e.target.value===`weekly`?`weekly`:`daily`),children:[(0,h.jsx)(`option`,{value:`daily`,children:`Every day`}),(0,h.jsx)(`option`,{value:`weekly`,children:`Selected weekdays`}),(0,h.jsx)(`option`,{value:`once`,children:`One time`})]})}),p===`once`?(0,h.jsx)(uV,{label:`Run at`,id:`schedule-once`,tip:`planning.schedule.once-at`,children:(0,h.jsx)(Y,{required:!0,type:`datetime-local`,value:_,onChange:e=>v(e.target.value)})}):(0,h.jsx)(uV,{label:`Local time`,id:`schedule-time`,tip:`planning.schedule.time`,children:(0,h.jsx)(Y,{required:!0,type:`time`,value:y,onChange:e=>b(e.target.value)})}),p===`weekly`?(0,h.jsxs)(`fieldset`,{className:`m-0 min-w-0 border-0 p-0`,...cb,children:[(0,h.jsxs)(`legend`,{className:`sl-field__label mb-2 flex items-center gap-1`,children:[`Weekdays`,(0,h.jsx)(B,{id:`planning.schedule.weekdays`,className:`-my-1`})]}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:ofe.map(([e,t])=>(0,h.jsxs)(`label`,{className:`inline-flex items-center gap-1 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:x.includes(e),onChange:t=>S(n=>t.target.checked?[...n,e]:n.filter(t=>t!==e))}),t]},e))})]}):(0,h.jsx)(`div`,{}),(0,h.jsx)(uV,{label:`Timezone`,id:`schedule-timezone`,tip:p===`once`?`planning.schedule.timezone-once`:`planning.schedule.timezone`,children:(0,h.jsx)(Y,{value:C,onChange:e=>w(e.target.value),placeholder:`Europe/Tirane`})}),(0,h.jsx)(uV,{label:`Missed run`,id:`schedule-missed`,tip:`planning.schedule.missed`,children:(0,h.jsxs)(pV,{value:T,onChange:e=>E(e.target.value===`run-once`?`run-once`:`skip`),children:[(0,h.jsx)(`option`,{value:`skip`,children:`Skip if Slopify was closed`}),(0,h.jsx)(`option`,{value:`run-once`,children:`Run once when Slopify reopens`})]})}),(0,h.jsx)(uV,{label:`Spend ceiling (cents, optional)`,id:`schedule-spend`,tip:`planning.schedule.spend`,tipLabel:`Spend ceiling`,children:(0,h.jsx)(Y,{inputMode:`numeric`,value:D,onChange:e=>O(e.target.value),placeholder:`1000`})}),(0,h.jsx)(ife,{queue:k,onQueue:A,context:be,onKeyword:te,onValue:(e,t)=>j(n=>({...n,[e]:t})),loading:d!==``&&me.isPending,exportName:l}),(0,h.jsx)(cfe,{brief:re,onBrief:M,generation:ie,onGeneration:ae,templateLlm:he?.llm})]}),(0,h.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-6 flex flex-wrap gap-2 border-t border-line bg-ground py-3 max-md:bottom-[68px]`,children:[(0,h.jsx)(L,{type:`submit`,variant:`primary`,disabled:t||oe||fe.length===0&&!ce,children:oe?`Saving…`:ce?`Retry save`:i?`Save changes`:`Save schedule`}),(0,h.jsx)(L,{variant:`quiet`,disabled:oe||ce,onClick:a,children:i?`Cancel editing`:`Cancel`})]})]})]})}function cfe({brief:e,onBrief:t,generation:n,onGeneration:r,templateLlm:i}){let{api:a}=R(),o=N({...Xy(a),enabled:n.mode!==`off`}),s=n.llm;return(0,h.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-3 border-0 border-t border-line p-0 pt-5 min-[700px]:col-span-2`,children:[(0,h.jsxs)(`legend`,{className:`float-left mb-1 flex w-full items-center gap-1 text-title-3 font-semibold`,children:[`Topic generation`,(0,h.jsx)(B,{id:`planning.schedule.generation`})]}),(0,h.jsx)(uV,{label:`Series brief (optional)`,id:`schedule-brief`,tip:`planning.schedule.brief`,tipLabel:`Series brief`,children:(0,h.jsx)(fV,{rows:3,maxLength:QV,value:e,onChange:e=>t(e.target.value),placeholder:`Ancient history, documentary style. Famous rulers and places first.`})}),(0,h.jsxs)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(uV,{label:`New topics`,id:`schedule-generation`,tip:`planning.schedule.new-topics`,children:(0,h.jsxs)(pV,{value:n.mode,onChange:e=>{let t=e.target.value;r({...n,mode:t===`queue`||t===`hold`?t:`off`})},children:[(0,h.jsx)(`option`,{value:`off`,children:`Off: add topics yourself`}),(0,h.jsx)(`option`,{value:`queue`,children:`Generate and queue directly`}),(0,h.jsx)(`option`,{value:`hold`,children:`Generate and hold for approval`})]})}),n.mode===`off`?null:(0,h.jsx)(uV,{label:`Keep at least this many queued`,id:`schedule-keep`,tip:`planning.schedule.keep-count`,children:(0,h.jsx)(Y,{type:`number`,min:1,max:100,value:String(n.keepAtLeast),onChange:e=>{let t=Math.round(Number(e.target.value));r({...n,keepAtLeast:Number.isFinite(t)?Math.min(100,Math.max(1,t)):1})}})})]}),n.mode===`off`?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...cb,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:s===null,onChange:e=>r({...n,llm:e.target.checked?null:{provider:i?.provider??``,model:i?.model??``}})}),`Use the template's LLM`,s===null&&i!==void 0&&i.provider!==``?` (${i.provider} · ${i.model})`:``]}),(0,h.jsx)(B,{id:`planning.schedule.generation-llm`,className:`-my-1`})]}),s===null?null:(0,h.jsxs)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(EV,{label:`Provider`,family:`llm`,providers:o.data?.providers??[],value:s.provider,problem:o.error?.message,onPick:e=>r({...n,llm:{provider:e,model:``}})}),(0,h.jsx)(DV,{label:`Model`,provider:s.provider,value:s.model,problem:void 0,onPick:e=>r({...n,llm:{...s,model:e}})})]})]})]})}function lfe({schedule:e}){let{api:t}=R(),n=_(),r=gy(),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(!1),c=(0,m.useRef)(!1),[l,u]=(0,m.useState)(``),d=(0,m.useRef)(e);e.version>d.current.version&&(d.current=e);let f=d.current.items,p=e.topicKeyword===null?`title`:`{{${e.topicKeyword}}}`,g=async(e,i,o)=>{if(c.current)return!1;c.current=!0;let l=d.current;s(!0),a(null);try{let s=await PH(t,l.id,{baseVersion:l.version,items:e});return s.ok?(d.current=s.value,n.setQueryData(gH,e=>e?.map(e=>e.id===s.value.id?s.value:e)),n.invalidateQueries({queryKey:IH}),r(i,`success`,o?{label:`Undo`,run:()=>void g(l.items,`Put the topics back as they were.`,!1)}:void 0),!0):(a(s.reason===`conflict`?`The topics weren't saved: this schedule changed since the page loaded, possibly because a run just took a topic. The list now shows the latest; make your change again.`:`The topics weren't saved: ${s.message}`),await n.invalidateQueries({queryKey:gH}),!1)}catch(e){return a(`The topics weren't saved: ${e instanceof Error?e.message:`Slopify didn't answer.`} Check that Slopify is running, then try again.`),!1}finally{c.current=!1,s(!1)}},v=async e=>{e.preventDefault();let t=l.trim();if(t===``){a(`Write the new topic's ${p} first, then press Add topic.`);return}await g([...f,{title:t,values:{}}],`Added “${t}”.`,!0)&&u(``)},y=(e,t)=>{let n=f[e];if(n!==void 0&&t.trim()!==n.title){if(t.trim()===``){a(`Topic ${String(e+1)} needs a ${p}. Write one, or press its Remove button.`);return}g(f.map((n,r)=>r===e?{...n,title:t.trim()}:n),`Renamed to “${t.trim()}”.`,!0)}},b=(e,t)=>{let n=f[e];if(n===void 0)return;let r=[...f];r.splice(e,1),r.splice(e+t,0,n),g(r,`Moved “${n.title}” ${t===-1?`up`:`down`}.`,!0)},x=e=>{let t=f[e];t!==void 0&&g(f.filter((t,n)=>n!==e),`Removed “${t.title}”.`,!0)};return(0,h.jsxs)(`section`,{"aria-label":`Queued topics`,className:`mt-6`,...cb,children:[(0,h.jsx)(V,{as:`h3`,title:`Queued topics · ${String(f.length)}`,info:`planning.schedule.inline-topics`,meta:e.topicKeyword===null?`Each topic becomes the next project's title.`:`Each topic fills ${p}; the next run takes the first.`}),i===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:i}),f.length===0?null:(0,h.jsx)(iU,{label:`Topics of ${e.name}`,className:`mt-2`,children:f.map((e,t)=>(0,h.jsx)(ufe,{index:t,title:e.title,count:f.length,busy:o,onRename:e=>y(t,e),onMove:e=>b(t,e),onRemove:()=>x(t)},`${String(t)}:${e.title}`))}),(0,h.jsxs)(`form`,{className:`mt-3 flex flex-wrap items-center gap-2`,onSubmit:e=>void v(e),children:[(0,h.jsx)(Y,{"aria-label":`New topic`,placeholder:e.topicKeyword===null?`New topic`:`New ${p}`,maxLength:200,value:l,className:`min-w-0 flex-1`,onChange:e=>u(e.target.value)}),(0,h.jsxs)(L,{type:`submit`,size:`small`,disabled:o||f.length>=500,disabledReason:o?`Saving the last change`:`A queue holds at most 500 topics`,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add topic`]})]})]})}function ufe({index:e,title:t,count:n,busy:r,onRename:i,onMove:a,onRemove:o}){let[s,c]=(0,m.useState)(t);(0,m.useEffect)(()=>c(t),[t]);let l=`Topic ${String(e+1)}`;return(0,h.jsx)(aU,{lead:(0,h.jsx)(`span`,{className:`w-6 text-small text-ink-3 tabular-nums`,children:e+1}),title:(0,h.jsx)(Y,{"aria-label":l,maxLength:200,value:s,onChange:e=>c(e.target.value),onBlur:()=>i(s),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i(s)):e.key===`Escape`&&c(t)}}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ly,{size:`small`,label:`Move ${t} up`,disabled:r||e===0,onClick:()=>a(-1),children:(0,h.jsx)(_c,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(ly,{size:`small`,label:`Move ${t} down`,disabled:r||e===n-1,onClick:()=>a(1),children:(0,h.jsx)(mc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(ly,{size:`small`,label:`Remove ${t}`,disabled:r,onClick:o,children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]})})}function dfe({pickedId:e,onPick:t}={}){let{api:n}=R(),r=_(),i=N(_H(n)),a=N(Nq(n)),[o,s]=(0,m.useState)(null),c=gy(),[l,u]=(0,m.useState)(null),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)(!1),[v,y]=(0,m.useState)(null),b=t===void 0?v:e??null,x=e=>{t===void 0?y(e):t(e)},[S,C]=(0,m.useState)(null),w=(0,m.useRef)(!1),T=N(wb(n)),[E]=(0,m.useState)(()=>{let e=new Date;return{from:e.toISOString(),to:new Date(e.valueOf()+79488e5).toISOString()}}),D=N(LH(n,E.from,E.to)),O=new Map;for(let e of D.data?.runs??[])e.renderedTitle!==null&&!O.has(e.scheduleId)&&O.set(e.scheduleId,e.renderedTitle);let[k,A]=(0,m.useState)(``),ee=e=>{if(k===``)return!0;let t=a.data?.find(t=>t.id===e.templateId);return(t?Y1(t):_b)===k},te=i.data?.filter(e=>e.deletedAt===null&&ee(e))??[],ne=i.data?.filter(e=>e.deletedAt!==null)??[],j=i.data?.find(e=>e.id===b)??te[0]??null,re=P({onError:e=>s(e.message),onSettled:async()=>{w.current=!1,await r.invalidateQueries({queryKey:gH})},mutationFn:async e=>e(),onSuccess:async e=>{if(!e.ok){s(e.message);return}s(null)}}),M=e=>{w.current||(w.current=!0,s(null),re.mutate(e))},ie=d||l!==null,ae=()=>{u(null),f(!1),s(null)},oe=a.data?.length===0,se=()=>{ie||oe||(u(null),f(!0),s(null))},ce=e=>{f(!1),x(e.id),u(e),s(null)};qb({id:`schedules.new`,title:`New schedule`,group:`Schedules`,keywords:[`calendar`,`recurring`],run:se}),Sx(_x.newSchedule,()=>{oe?c(`A schedule runs a project template, and there is none yet. Open a project, choose Save as template, then run New schedule again.`,`error`):se()},a.data!==void 0);let le=o?{tone:`error`,text:o}:i.error?{tone:`error`,text:`The schedules couldn't be loaded: ${i.error.message} Reload the page to try again.`}:a.error?{tone:`error`,text:`The templates couldn't be loaded: ${a.error.message} Reload the page to try again.`}:void 0,ue=re.isPending||p||ie;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0 min-w-0 text-small text-ink-2`,children:oe?(0,h.jsxs)(h.Fragment,{children:[`Save a template in`,` `,(0,h.jsx)(ha,{className:`underline`,to:`/templates`,children:`Library → Templates`}),` `,`before creating a schedule.`]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Runs a saved template on this machine at a local time.`,(0,h.jsx)(B,{id:`planning.schedules`})]})}),(0,h.jsxs)(dy,{children:[(0,h.jsxs)(pV,{"aria-label":`Filter schedules by channel`,value:k,className:`w-auto min-w-[160px]`,onChange:e=>A(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`All channels`}),(T.data??[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,h.jsxs)(L,{variant:`primary`,onClick:se,disabled:ie||oe,disabledReason:oe?`Save a template in Library → Templates first`:`Finish or cancel the open form first`,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New schedule`]})]})]}),(0,h.jsx)(V1,{tone:ie?`info`:le?.tone??`info`,className:`mb-2`,children:ie?void 0:le?.text}),(0,h.jsx)(Sq,{className:`min-[768px]:grid-cols-[minmax(320px,460px)_minmax(0,1fr)]`,list:(0,h.jsxs)(h.Fragment,{children:[i.data&&te.length===0?(0,h.jsx)(J1,{title:k===``?ne.length===0?`No schedules yet`:`No active schedules`:`No schedules run this channel's templates`,children:k===``?ne.length===0?`Your first one can be a one-off run or a recurring series. Press New schedule.`:`Create one with New schedule, or review deleted history below.`:`Pick All channels to see the others, or make one from this channel's templates.`}):null,te.length>0?(0,h.jsx)(iU,{label:`Saved schedules`,className:`[&_.sl-row__actions]:flex-wrap`,children:te.map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(p0,{schedule:e,nextTitle:O.get(e.id),selected:!ie&&j?.id===e.id,pending:ue,onSelect:()=>x(e.id),onEdit:()=>ce(e),onAction:M,onConfirm:t=>C({kind:t,schedule:e})}),(0,h.jsx)(Z1,{kind:`schedule`,id:e.id,name:e.name})]},e.id))}):null,ne.length>0?(0,h.jsxs)(`details`,{className:`mt-6`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer text-small font-semibold text-ink-2`,children:[`Deleted schedules · `,ne.length]}),(0,h.jsx)(`p`,{className:`m-0 mt-2 mb-2 text-small text-ink-2`,children:`Deleted schedules stay in Settings → Trash for 30 days, where Restore brings one back paused. Pick one to see its run history.`}),(0,h.jsx)(iU,{label:`Deleted schedules`,children:ne.map(e=>(0,h.jsx)(p0,{schedule:e,nextTitle:void 0,selected:!ie&&j?.id===e.id,pending:!1,onSelect:()=>x(e.id),onEdit:()=>void 0,onAction:M,onConfirm:()=>void 0},e.id))})]}):null]}),detail:ie?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(V,{kicker:l?l.name:void 0,title:l?`Edit schedule`:`New schedule`,className:`mb-4`}),(0,h.jsx)(sfe,{onBusy:g,editing:l,onCancel:()=>{p||ae()},templates:a.data??[],pending:re.isPending,error:o,onCreated:()=>{c(l?`Schedule updated.`:`Schedule saved. It will run automatically while Slopify is open.`,`success`),ae(),r.invalidateQueries({queryKey:gH})},onError:e=>{s(e),r.invalidateQueries({queryKey:gH})}},l?.id??`new`)]}):j?(0,h.jsx)(hfe,{schedule:j,pending:ue,onAction:M,onConfirm:e=>C({kind:e,schedule:j})},j.id):null}),(0,h.jsx)(Dy,{open:S!==null,title:S?.kind===`delete`?`Delete schedule?`:`Cancel schedule?`,consequence:(S?.kind===`delete`?`Moves this schedule to the trash for 30 days (Settings → Trash). Its run history is kept.`:`Stops future scheduled runs. Existing projects and run history are kept.`)+(o?` ${o}`:``),confirmLabel:S?.kind===`delete`?`Delete schedule`:`Cancel schedule`,cancelLabel:`Keep schedule`,pending:re.isPending,onCancel:()=>{re.isPending||C(null)},onConfirm:()=>{if(!S)return;let{kind:e,schedule:t}=S;M(async()=>{let r=e===`delete`?await SH(n,t.id,t.version):await xH(n,t.id,`cancel`,t.version);return r.ok&&C(null),r})}})]})}function ffe(e){return e.cadence.kind===`once`?`One time`:e.cadence.kind===`daily`?`Daily at ${e.cadence.time}`:`Weekly at ${e.cadence.time}`}var pfe={active:`Active`,paused:`Paused`,completed:`Completed`,canceled:`Canceled`},mfe={active:`running`,paused:`waiting`,completed:`done`,canceled:`off`};function f0({schedule:e}){return e.deletedAt===null?(0,h.jsx)(Wx,{tone:mfe[e.status],children:pfe[e.status]}):(0,h.jsx)(Wx,{tone:`off`,children:`Deleted`})}function p0({schedule:e,nextTitle:t,selected:n,pending:r,onSelect:i,onEdit:a,onAction:o,onConfirm:s}){let{api:c}=R(),l=e.deletedAt===null,u=l&&(e.status===`active`||e.status===`paused`),d=e.status===`canceled`||e.status===`completed`;return(0,h.jsx)(aU,{selected:n,onSelect:i,title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(f0,{schedule:e}),` · ${ffe(e)} · ${e.deletedAt===null?e.nextRunAt===null?`No future run`:`Next: ${O1(e.nextRunAt,e.timezone)}${t===void 0?``:` · “${t}”`}`:`Deleted: ${O1(e.deletedAt,e.timezone)}`}${e.topics.held>0?` · ${String(e.topics.held)} waiting for you`:``}`]}),actions:l?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Edit ${e.name}`,disabled:r||!u,disabledReason:u?`Finish or cancel the open form first`:`Only a live schedule can change`,onClick:a,children:`Edit`}),e.status===`paused`?(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Resume ${e.name}`,disabled:r,onClick:()=>o(()=>xH(c,e.id,`resume`,e.version)),children:`Resume`}):(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Pause ${e.name}`,disabled:r||e.status!==`active`,disabledReason:`Only an active schedule can pause`,onClick:()=>o(()=>xH(c,e.id,`pause`,e.version)),children:`Pause`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Delete ${e.name}`,disabled:r||!d,disabledReason:`Cancel the schedule first; a completed or canceled one can be deleted`,onClick:()=>s(`delete`),children:`Delete`})]}):void 0})}function hfe({schedule:e,pending:t,onAction:n,onConfirm:r}){let{api:i}=R(),a=N({queryKey:[`schedule`,e.id],queryFn:async()=>{let t=await vH(i,e.id);if(!t.ok)throw Error(t.message);return t.value},refetchInterval:3e4}),o=e.deletedAt===null,s=o&&(e.status===`active`||e.status===`paused`),c=e.status===`paused`,l=[[`When`,e.cadence.kind===`once`?`Once, ${O1(e.cadence.at,e.timezone)}`:e.cadence.kind===`daily`?`Every day at ${e.cadence.time}`:`Selected weekdays at ${e.cadence.time}`],[`Timezone`,e.timezone],[`Next run`,e.deletedAt!==null||e.nextRunAt===null?`None`:O1(e.nextRunAt,e.timezone)],[`Topics`,e.items.length===0?e.topicGeneration.mode===`off`?`Template as saved`:`No topics queued`:`${String(e.items.length)} ${e.items.length===1?`topic`:`topics`} left`],[`Missed runs`,e.missedPolicy===`skip`?`Skip`:`Run once on reopening`],[`Overlap`,`Skip`],[`Spend ceiling`,e.spendLimitCents===null?`Not set`:`${String(e.spendLimitCents)} cents`]];return(0,h.jsxs)(`section`,{"aria-label":`${e.name} detail`,children:[o&&s?(0,h.jsx)(gfe,{schedule:e,paused:c,onAction:n}):null,(0,h.jsx)(V,{kicker:(0,h.jsx)(f0,{schedule:e}),title:e.name,meta:e.topics.held>0?`${String(e.topics.held)} topics waiting for you`:void 0,children:o?(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Cancel ${e.name}`,disabled:t||!s,disabledReason:`Only an active or paused schedule can be canceled`,onClick:()=>r(`cancel`),children:`Cancel schedule`}):null}),(0,h.jsx)(`dl`,{className:`m-0 mt-4 grid grid-cols-1 gap-x-6 gap-y-3 text-small min-[600px]:grid-cols-2`,children:l.map(([e,t])=>(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`dt`,{className:`sl-kicker`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 break-words text-ink`,children:t})]},e))}),s?(0,h.jsx)(lfe,{schedule:e}):null,(0,h.jsx)(Ude,{schedule:e}),(0,h.jsx)(Cq,{className:`my-6`}),(0,h.jsx)(V,{as:`h3`,title:`Run history`}),(0,h.jsx)(`div`,{className:`mt-3`,children:a.isPending?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Loading history…`}):a.error?(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`The run history couldn't be loaded: ${a.error.message} It tries again every 30 seconds.`}):a.data.runs.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`No runs yet.`}):(0,h.jsx)(iU,{label:`Runs of ${e.name}`,children:a.data.runs.map(t=>(0,h.jsx)(aU,{title:(0,h.jsx)(`span`,{className:`capitalize`,children:`${t.status} · ${O1(t.scheduledFor,e.timezone)}`}),meta:t.error?t.error:t.projectIds.length>0?(0,h.jsx)(`span`,{className:`inline-flex flex-wrap gap-x-3`,children:t.projectIds.map((e,t)=>(0,h.jsxs)(ha,{className:`underline hover:text-ink`,to:`/projects/$projectId`,params:{projectId:e},children:[`Project `,t+1]},e))}):`No projects`},t.id))})})]})}function gfe({schedule:e,paused:t,onAction:n}){let{api:r}=R();return qb({id:`schedules.pause-resume`,title:t?`Resume schedule`:`Pause schedule`,group:`Schedules`,context:e.name,run:()=>n(()=>xH(r,e.id,t?`resume`:`pause`,e.version))}),null}var m0=`https://www.youtube.com/upload`,_fe=[`video`,`title`,`description`,`thumbnails`,`playlist`,`audience`,`altered`,`tags`,`schedule`];function vfe(e){return e.join(`, `)}var h0=[.75,1,1.25,1.5,1.75,2];function g0(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${String(n)}:${String(r).padStart(2,`0`)}:${i}`:`${String(r)}:${i}`}function _0(e){return`${String(e)}×`}function yfe(e,t){return e.filter(e=>e.start<=t).at(-1)}function v0(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}var y0=(e,t,n)=>Math.min(n,Math.max(t,e));function b0(){let e=(0,m.useRef)(null),t=(0,m.useId)(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(0),[c,l]=(0,m.useState)(0),[u,d]=(0,m.useState)(1),[f,p]=(0,m.useState)(!1),[h,g]=(0,m.useState)(1),[_,v]=(0,m.useState)(!1),[y,b]=(0,m.useState)(null),[x,S]=(0,m.useState)(!1),C=Number.isFinite(o)&&o>0,w=()=>{let t=e.current;t!==null&&(t.paused||t.ended?t.play()?.catch(()=>void 0):t.pause())},T=t=>{let n=e.current;if(n===null||!C)return;let r=y0(t,0,o);n.currentTime=r,a(r)},E=t=>T((e.current?.currentTime??i)+t),D=t=>{let n=e.current;if(n===null)return;let r=y0(Math.round(t*100)/100,0,1);n.volume=r,n.muted=r===0,d(r),p(r===0)},O=()=>{let t=e.current;t!==null&&(t.muted=!t.muted,p(t.muted))};return{media:e,menuId:t,playing:n,current:i,duration:o,buffered:c,known:C,volume:u,muted:f,rate:h,menu:_,setMenu:v,hover:y,setHover:b,seeking:x,setSeeking:S,toggle:w,seekTo:T,jump:E,setLevel:D,toggleMute:O,pickRate:n=>{let r=e.current;r!==null&&(r.playbackRate=n),g(n),v(!1),document.getElementById(`${t}-button`)?.focus()},keyAction:e=>{let t=e.length===1?e.toLowerCase():e;if(t===` `||t===`k`)return w;if(t===`j`)return()=>E(-10);if(t===`l`)return()=>E(10);if(t===`ArrowLeft`)return()=>E(-5);if(t===`ArrowRight`)return()=>E(5);if(t===`m`)return O;if(/^[0-9]$/.test(t))return()=>T(Number(t)/10*o)},events:{onPlay:()=>r(!0),onPause:()=>r(!1),onEnded:()=>r(!1),onTimeUpdate:e=>{x||a(e.currentTarget.currentTime)},onDurationChange:e=>s(e.currentTarget.duration),onLoadedMetadata:e=>s(e.currentTarget.duration),onProgress:e=>{let t=e.currentTarget.buffered;l(t.length>0?t.end(t.length-1):0)},onVolumeChange:e=>{d(e.currentTarget.volume),p(e.currentTarget.muted)},onRateChange:e=>g(e.currentTarget.playbackRate)}}}function x0(e,t){let n=e?.getBoundingClientRect();return n===void 0||n.width===0?0:y0((t-n.left)/n.width,0,1)}function S0(e,t){t!==void 0&&(e.preventDefault(),e.stopPropagation(),t())}function C0({controls:e,className:t}){return(0,h.jsx)(ly,{size:`small`,label:e.playing?`Pause`:`Play`,className:t,onClick:e.toggle,children:e.playing?(0,h.jsx)(Hc,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(Gc,{"aria-hidden":`true`,strokeWidth:1.75})})}function w0({controls:e}){return(0,h.jsxs)(`span`,{className:`sl-player__time`,children:[(0,h.jsx)(`span`,{className:`sl-player__now`,children:g0(e.current)}),(0,h.jsx)(`span`,{className:`sl-player__total`,children:` / ${e.known?g0(e.duration):`-:--`}`})]})}function T0({controls:e,chapters:t=[],waveform:n}){let r=(0,m.useRef)(null),{known:i,duration:a,current:o,buffered:s,seeking:c,hover:l}=e,u=Sfe(r),d=n===void 0?void 0:xfe(n,u),f=i?t.filter(e=>e.start>0&&e.start<a):[],p=t=>{i&&(t.currentTarget.setPointerCapture?.(t.pointerId),e.setSeeking(!0),e.seekTo(x0(r.current,t.clientX)*a))},g=t=>{let n=x0(r.current,t.clientX);e.setHover(n),c&&e.seekTo(n*a)},_=t=>{t.currentTarget.releasePointerCapture?.(t.pointerId),e.setSeeking(!1)},v=t=>{S0(t,{ArrowLeft:()=>e.jump(-5),ArrowDown:()=>e.jump(-5),ArrowRight:()=>e.jump(5),ArrowUp:()=>e.jump(5),PageDown:()=>e.jump(-10),PageUp:()=>e.jump(10),Home:()=>e.seekTo(0),End:()=>e.seekTo(a)}[t.key])},y=i?o/a*100:0,b=i?s/a*100:0,x=l===null||!i?void 0:l*a,S=x===void 0?void 0:yfe(t,x);return(0,h.jsxs)(`div`,{ref:r,role:`slider`,tabIndex:0,"aria-label":`Seek`,"aria-valuemin":0,"aria-valuemax":i?Math.floor(a):0,"aria-valuenow":Math.floor(o),"aria-valuetext":`${g0(o)} of ${i?g0(a):`unknown length`}`,"aria-disabled":!i,className:`sl-player__track`,onPointerDown:p,onPointerMove:g,onPointerUp:_,onPointerCancel:_,onPointerLeave:()=>e.setHover(null),onKeyDown:v,children:[d===void 0||d.length===0?(0,h.jsxs)(`span`,{className:`sl-player__rail`,children:[(0,h.jsx)(`span`,{className:`sl-player__buffered`,style:{width:`${String(b)}%`}}),(0,h.jsx)(`span`,{className:`sl-player__played`,style:{width:`${String(y)}%`}})]}):(0,h.jsx)(`span`,{className:`sl-player__wave`,"data-slot":`waveform`,"aria-hidden":`true`,children:d.map((e,t)=>(0,h.jsx)(`span`,{className:`sl-player__peak`,"data-played":(t+.5)/d.length*100<=y?``:void 0,style:{height:`${String(Math.max(12,Math.round(e*100)))}%`}},t))}),f.map(e=>(0,h.jsx)(`span`,{className:`sl-player__mark`,"data-chapter":e.title,title:e.title,style:{left:`${String(e.start/a*100)}%`}},`${String(e.start)}-${e.title}`)),(0,h.jsx)(`span`,{className:`sl-player__knob`,style:{left:`${String(y)}%`}}),x===void 0||l===null?null:(0,h.jsxs)(`span`,{className:`sl-player__tip`,"aria-hidden":`true`,style:{left:`${String(l*100)}%`},children:[S===void 0?null:(0,h.jsx)(`span`,{className:`sl-player__tip-title`,children:S.title}),g0(x)]})]})}function E0({controls:e}){let t=(0,m.useRef)(null),{muted:n,volume:r}=e,i=n?0:r;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ly,{size:`small`,label:n?`Unmute`:`Mute`,"aria-pressed":n,className:`sl-player__mute`,onClick:e.toggleMute,children:n||r===0?(0,h.jsx)(rl,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(nl,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(`div`,{ref:t,role:`slider`,tabIndex:0,"aria-label":`Volume`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i*100),"aria-valuetext":n?`Muted`:`${String(Math.round(i*100))}%`,className:`sl-player__volume`,onPointerDown:n=>{n.currentTarget.setPointerCapture?.(n.pointerId),e.setLevel(x0(t.current,n.clientX))},onPointerMove:n=>{n.buttons===1&&e.setLevel(x0(t.current,n.clientX))},onKeyDown:t=>{let n={ArrowLeft:i-.05,ArrowDown:i-.05,ArrowRight:i+.05,ArrowUp:i+.05,Home:0,End:1}[t.key];S0(t,n===void 0?void 0:()=>e.setLevel(n))},children:(0,h.jsx)(`span`,{className:`sl-player__rail`,children:(0,h.jsx)(`span`,{className:`sl-player__played`,style:{width:`${String(i*100)}%`}})})})]})}function D0({controls:e}){let{menuId:t,menu:n,rate:r}=e;return(0,h.jsxs)(`span`,{className:`sl-player__speed`,children:[(0,h.jsx)(L,{id:`${t}-button`,variant:`quiet`,size:`small`,className:`sl-player__rate`,"aria-label":`Playback speed, ${_0(r)}`,"aria-haspopup":`menu`,"aria-expanded":n,"aria-controls":n?`${t}-menu`:void 0,onClick:()=>e.setMenu(e=>!e),children:_0(r)}),n?(0,h.jsx)(`div`,{id:`${t}-menu`,role:`menu`,"aria-label":`Playback speed`,className:`sl-player__menu`,onKeyDown:n=>{if(n.key===`Escape`){S0(n,()=>{e.setMenu(!1),document.getElementById(`${t}-button`)?.focus()});return}if(n.key!==`ArrowDown`&&n.key!==`ArrowUp`)return;let r=[...n.currentTarget.querySelectorAll(`[role=menuitemradio]`)],i=r[(r.indexOf(document.activeElement)+(n.key===`ArrowDown`?1:-1)+r.length)%r.length];S0(n,()=>i?.focus())},children:h0.map(t=>(0,h.jsx)(L,{variant:`quiet`,size:`small`,role:`menuitemradio`,"aria-checked":t===r,className:I(`sl-player__option`),autoFocus:t===r,onClick:()=>e.pickRate(t),children:t===1?`Normal`:_0(t)},t))}):null]})}var bfe=4;function xfe(e,t){let n=Math.floor(t/bfe);if(n<=0||e.length<=n)return e;let r=[];for(let t=0;t<n;t+=1){let i=Math.floor(t*e.length/n),a=Math.max(i+1,Math.floor((t+1)*e.length/n));r.push(Math.max(...e.slice(i,a)))}return r}function Sfe(e){let[t,n]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let t=e.current;if(t===null||(n(t.clientWidth),typeof ResizeObserver>`u`))return;let r=new ResizeObserver(()=>n(t.clientWidth));return r.observe(t),()=>r.disconnect()},[e]),t}var Cfe=2500;function O0({src:e,poster:t,label:n,portrait:r=!1,captions:i,chapters:a=[],ref:o,className:s,children:c}){let l=b0(),u=l.media,d=(0,m.useRef)(null),f=(0,m.useRef)(void 0),[p,g]=(0,m.useState)(!1),[_,v]=(0,m.useState)(!1),[y,b]=(0,m.useState)(0),[x,S]=(0,m.useState)(!1),[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)(!1),[D,O]=(0,m.useState)(!0),{playing:k,menu:A,seeking:ee,hover:te,events:ne}=l,j=i!==void 0||y>0,re=typeof document<`u`&&`pictureInPictureEnabled`in document&&document.pictureInPictureEnabled===!0,M=(0,m.useCallback)(()=>{O(!0),clearTimeout(f.current),f.current=setTimeout(()=>O(!1),Cfe)},[]);(0,m.useEffect)(()=>()=>clearTimeout(f.current),[]);let ie=k&&!D&&!A&&!T&&!ee&&te===null;(0,m.useEffect)(()=>{let e=()=>S(document.fullscreenElement===d.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,m.useEffect)(()=>{let e=u.current;if(e===null)return;let t=()=>w(!0),n=()=>w(!1);return e.addEventListener(`enterpictureinpicture`,t),e.addEventListener(`leavepictureinpicture`,n),()=>{e.removeEventListener(`enterpictureinpicture`,t),e.removeEventListener(`leavepictureinpicture`,n)}},[u]),(0,m.useEffect)(()=>{let e=u.current?.textTracks;if(e!==void 0)for(let t=0;t<e.length;t+=1){let n=e[t];n!==void 0&&(n.mode=_&&t===0?`showing`:`hidden`)}},[_,u]);let ae=()=>{let e=u.current;e!==null&&(e.paused||e.ended)&&g(!0),l.toggle()},oe=()=>{let e=d.current;e!==null&&(document.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.()?.catch(()=>void 0))},se=()=>{let e=u.current;e!==null&&(document.pictureInPictureElement===e?document.exitPictureInPicture?.().catch(()=>void 0):e.requestPictureInPicture?.().catch(()=>void 0))};return(0,h.jsxs)(`div`,{ref:d,"data-slot":`player`,"data-state":k?`playing`:`paused`,className:I(`sl-player`,r&&`sl-player--portrait`,ie&&`sl-player--bare`,x&&`sl-player--full`,s),onKeyDown:e=>{if(e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.closest(`button`)!==null,n=e.key.length===1?e.key.toLowerCase():e.key,r=n===` `&&t?void 0:n===` `||n===`k`?ae:n===`f`?oe:n===`c`?j?()=>v(e=>!e):void 0:l.keyAction(n);r!==void 0&&(e.preventDefault(),e.stopPropagation(),M(),r())},onPointerMove:M,onPointerDown:M,onFocus:()=>E(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(E(!1),l.setMenu(!1))},children:[(0,h.jsxs)(`video`,{ref:v0(u,o),src:e,poster:t,preload:`metadata`,playsInline:!0,"aria-label":n,onClick:ae,...ne,onPlay:e=>{ne.onPlay(e),g(!0),M()},onPause:e=>{ne.onPause(e),O(!0)},onEnded:e=>{ne.onEnded(e),O(!0)},onLoadedMetadata:e=>{ne.onLoadedMetadata(e),b(e.currentTarget.textTracks?.length??0)},children:[i===void 0?null:(0,h.jsx)(`track`,{kind:`captions`,src:i.src,srcLang:i.lang,label:i.label}),c]}),p?null:(0,h.jsx)(ly,{label:`Play ${n}`,className:`sl-player__big`,onClick:ae,children:(0,h.jsx)(Gc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsxs)(`div`,{className:`sl-player__bar`,role:`group`,"aria-label":`${n} controls`,children:[(0,h.jsx)(C0,{controls:{...l,toggle:ae}}),(0,h.jsx)(w0,{controls:l}),(0,h.jsx)(T0,{controls:l,chapters:a}),(0,h.jsx)(E0,{controls:l}),(0,h.jsx)(D0,{controls:l}),j?(0,h.jsx)(ly,{size:`small`,label:`Captions`,"aria-pressed":_,onClick:()=>v(e=>!e),children:(0,h.jsx)(xc,{"aria-hidden":`true`,strokeWidth:1.75})}):null,re?(0,h.jsx)(ly,{size:`small`,label:`Picture in picture`,"aria-pressed":C,className:`sl-player__pip`,onClick:se,children:(0,h.jsx)(Wc,{"aria-hidden":`true`,strokeWidth:1.75})}):null,(0,h.jsx)(ly,{size:`small`,label:x?`Exit full screen`:`Full screen`,"aria-pressed":x,onClick:oe,children:x?(0,h.jsx)(Vc,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(Bc,{"aria-hidden":`true`,strokeWidth:1.75})})]})]})}var wfe={landscape:void 0,portrait:`sl-media__frame--portrait`,square:`sl-media__frame--square`};function k0({src:e,alt:t,kind:n=`image`,poster:r,aspect:i=`landscape`,title:a,meta:o,badge:s,actions:c,actionsShown:l=!1,generating:u,onOpen:d,openLabel:f,className:p}){let m=u==null||u===!1;return(0,h.jsxs)(`figure`,{className:I(`sl-media m-0`,p),"data-slot":`media-frame`,children:[(0,h.jsxs)(`div`,{className:I(`sl-media__frame`,wfe[i]),children:[m&&e!==void 0?n===`video`?(0,h.jsx)(`video`,{src:e,poster:r,muted:!0,preload:`metadata`,"aria-label":t}):(0,h.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`}):null,m?null:(0,h.jsxs)(`div`,{className:`sl-media__generating`,role:`status`,children:[(0,h.jsx)(Ux,{tone:`running`}),(0,h.jsx)(`span`,{children:u})]}),s===void 0?null:(0,h.jsx)(`span`,{className:`sl-media__badge`,children:s}),c===void 0?null:(0,h.jsx)(`div`,{className:I(`sl-media__actions`,l&&`sl-media__actions--shown`),children:c})]}),d!==void 0&&m&&e!==void 0?(0,h.jsx)(`button`,{type:`button`,className:`sl-media__open`,"aria-label":f??`Open ${t} full size`,onClick:d}):null,a===void 0&&o===void 0?null:(0,h.jsxs)(`figcaption`,{className:`sl-media__caption`,children:[a===void 0?(0,h.jsx)(`span`,{}):(0,h.jsx)(`strong`,{className:`min-w-0 truncate`,children:a}),o===void 0?null:(0,h.jsx)(`span`,{className:`shrink-0`,children:o})]})]})}function A0({shorts:e=!1,density:t=`default`,list:n=!1,className:r,children:i,label:a}){let o=I(`sl-grid`,e&&`sl-grid--shorts`,t===`compact`&&`sl-grid--compact`,n&&`m-0 list-none p-0`,r);return n?(0,h.jsx)(`ul`,{"aria-label":a,className:o,"data-slot":`media-grid`,children:i}):(0,h.jsx)(`section`,{"aria-label":a,className:o,"data-slot":`media-grid`,children:i})}function j0({items:e,index:t,onIndex:n,onClose:r,actions:i}){let a=t===null?void 0:e[t],o=e.length,s=e=>{t!==null&&o!==0&&n((t+e+o)%o)};return(0,h.jsx)(km,{open:a!==void 0,onOpenChange:e=>{e||r()},children:(0,h.jsx)(Mm,{children:(0,h.jsx)(Lm,{className:`sl-lightbox sl-enter`,onKeyDown:e=>{e.key===`ArrowRight`?(e.preventDefault(),s(1)):e.key===`ArrowLeft`&&(e.preventDefault(),s(-1))},"aria-describedby":void 0,children:a===void 0||t===null?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`sl-lightbox__bar`,children:[(0,h.jsx)(Hm,{className:`m-0 text-small font-semibold`,children:`${String(t+1)} of ${String(o)} · ${a.alt}`}),(0,h.jsxs)(`div`,{className:`sl-btn-row`,children:[i?.(a,t),(0,h.jsx)(ly,{label:`Previous`,onClick:()=>s(-1),disabled:o<2,children:(0,h.jsx)(wc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(ly,{label:`Next`,onClick:()=>s(1),disabled:o<2,children:(0,h.jsx)(Tc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Wm,{asChild:!0,children:(0,h.jsx)(ly,{label:`Close`,children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})})]})]}),(0,h.jsx)(`div`,{className:`sl-lightbox__stage`,children:a.kind===`video`?(0,h.jsx)(O0,{src:a.src,label:a.alt,className:`sl-lightbox__player`,...a.poster===void 0?{}:{poster:a.poster}},a.src):(0,h.jsx)(`img`,{src:a.src,alt:a.alt},a.src)}),a.caption===void 0?(0,h.jsx)(`span`,{}):(0,h.jsx)(`p`,{className:`sl-lightbox__caption`,children:a.caption})]})})})})}var M0={location:fO(`docker-host`),path:U().min(1)},N0=oO([K({opened:fO(!0)}).strict(),K({opened:fO(!0),...M0}).strict(),K({opened:fO(!1),...M0}).strict()]),P0=sO(`kind`,[K({kind:fO(`allAffected`)}).strict(),K({kind:fO(`selected`),workKeys:G(U().min(1).max(200)).min(1).max(1e4)}).strict()]),F0=U().min(1).max(64),Tfe=K({baseRevisionId:F0,request:P0}).strict(),Efe=K({baseRevisionId:F0,idempotencyKey:eO(),previewId:U().min(1).max(64),acknowledgeUnknownCosts:rO(),confirmedProvidedWorkKeys:G(U().min(1).max(200)).max(1e4)}).strict(),Dfe=K({stage:U(),low:W().finite().nonnegative().nullable(),high:W().finite().nonnegative().nullable(),detail:U(),onPlan:rO().optional(),apiLow:W().finite().nonnegative().nullable().optional(),apiHigh:W().finite().nonnegative().nullable().optional()}),Ofe=K({currency:fO(`USD`),rows:G(Dfe),low:W().finite().nonnegative(),high:W().finite().nonnegative(),unknown:W().int().nonnegative(),apiLow:W().finite().nonnegative().optional(),apiHigh:W().finite().nonnegative().optional(),apiUnknown:W().int().nonnegative().optional(),expectedWords:W().finite().nonnegative(),catalogueDate:U().nullable(),assumptions:G(U())}),I0=K({revisionId:F0,admissionId:U().min(1).max(64),workIds:G(U().min(1).max(64)),replayed:rO()}),kfe=K({id:U().min(1).max(64),projectId:U().min(1).max(64),baseRevisionId:F0,planFingerprint:U().min(1),selection:P0,changedInputs:G(K({path:U(),before:U().nullable(),after:U().nullable()})),work:G(K({key:U(),stage:q(cS),kind:q([`provider`,`local`,`provided`]),disposition:q([`reuse`,`generate`,`local`,`review`,`blocked`]),requestFingerprint:U(),fingerprint:U(),dependsOn:G(U()),reason:U(),inflight:rO(),pieceIds:G(U())})),retained:G(K({slot:U(),outputId:U(),assetId:U(),state:q([`ready`,`outdated`,`review`])})),providedReuseRequired:G(U()),costs:Ofe,wholeRequestNotice:U().nullable(),warnings:G(U()),review:K({inputChanges:G(K({label:U(),before:U().nullable(),after:U().nullable()})),requests:G(K({key:U(),label:U(),text:U().nullable(),settings:U().nullable()}))}).optional()}),L0=[`chapter`,`chunk`,`segment`,`image`,`prompt_written`,`article_written`],R0=[`pending`,`running`,`done`,`failed`];K({id:U(),stage_id:U(),kind:q(L0),idx:W(),state:q(R0),payload:U().nullable()});var Afe=`notes.article_md.article_txt.narration_txt.tts_script.sources.glossary.audio_body.audio_intro.audio_outro.audio_export.image.thumbnail.video.render_params.subtitles_srt.subtitles_vtt.subtitle_words.subtitle_ass.subtitle_font.instructions.document_pdf.youtube_description.youtube_tags.youtube_pinned_comment.youtube_titles.shorts.short_image.short_video.animated_image.figure_card.reference.script_md.audio_mp3.audio_m4b.audio_levelled`.split(`.`),jfe=[`copying`,`staged`],Mfe=K({segment:q([`body`,`intro`,`outro`]).optional(),subtitleOmissions:G(K({start:W().finite().nonnegative(),text:U()})).optional(),subtitlesMode:q([`off`,`files`,`burn-in`]).optional(),promptName:U().optional(),prompt:U().optional(),index:W().optional(),short:W().optional(),format:q([`16:9`,`9:16`]).optional(),sentences:Qre([W(),W()]).optional(),warnings:G(U()).optional(),provider:U().optional(),model:U().optional(),voice:U().optional(),loudness:K({pieces:W(),skipped:W(),spreadBefore:W(),spreadAfter:W(),target:W()}).optional(),master:K({target:W(),integrated:W(),truePeak:W()}).optional()}),Nfe=K({id:U(),projectId:U(),stageKind:q(cS),role:q(Afe),path:U(),originalFilename:U().nullable(),bytes:W().nonnegative(),durationMs:W().nonnegative().nullable(),meta:Mfe,createdAt:U()});K({id:U(),stageKind:q(cS),path:U(),originalFilename:U(),bytes:W().nonnegative(),state:q(jfe),createdAt:U()});var z0=U().min(1).max(64).regex(/^[0-9A-Za-z_-]+$/),B0=U().min(1).max(256),Pfe=lO(B0,z0),Ffe=K({id:z0,text:U().trim().min(1).max(1e4),start:W().finite().nonnegative(),end:W().finite().positive(),speaker:U().min(1).max(60).regex(/^[a-z0-9-]+$/).optional()}).strict().refine(e=>e.end>e.start,{path:[`end`],message:`The end time must be after the start time.`}),V0=K({articleMarkdown:U().max(5e5).optional(),articleEdited:rO().default(!1),provided:K({research:z0.optional(),article:z0.optional(),audio:z0.optional(),thumbnail:z0.optional(),reference:z0.optional()}).strict(),imageOrder:G(z0).max(240),imageDefinitions:lO(z0,K({source:q([`generate`,`provide`]),assetId:z0.nullable(),prompt:U().max(5e5).nullable(),templateKey:U().min(1).max(256).nullable().optional()}).strict()),narrationOverrides:lO(B0,sO(`kind`,[K({kind:fO(`asset`),assetId:z0}).strict(),K({kind:fO(`text`),text:U().trim().min(1).max(5e5),direction:U().trim().min(1).max(2e4).optional()}).strict()])),narrationSources:lO(B0,K({text:U().min(1).max(5e5),start:W().int().nonnegative().max(5e5),bodyFingerprint:U().regex(/^[0-9a-f]{64}$/u),chunkingFingerprint:U().regex(/^[0-9a-f]{64}$/u)}).strict()).refine(e=>Object.keys(e).length<=1e4&&Object.values(e).reduce((e,t)=>e+t.text.length,0)<=5e5,`Narration source bindings exceed the article limit.`).optional(),subtitleCues:K({audioFingerprint:U().min(1),cues:G(Ffe)}).strict().optional(),regenerationTokens:Pfe,promptTemplates:lO(U().min(1),U().max(5e5).nullable()),shortsMusic:z0.optional(),shortsRanges:lO(U().regex(/^[1-9]\d?$/u),K({first:W().int().positive(),last:W().int().positive(),pick:U().min(1).max(128)}).strict()).optional(),ambientBed:z0.optional()}).strict(),Ife=K({baseRevisionId:z0,idempotencyKey:z0,edit:K({config:YA.strict(),content:V0,regenerate:G(B0).optional(),uploads:G(K({stagedFileId:z0,destination:sO(`kind`,[K({kind:fO(`provided`),stage:q([`audio`,`thumbnail`,`reference`])}).strict(),K({kind:fO(`image`),imageKey:z0}).strict(),K({kind:fO(`narration`),key:B0}).strict(),K({kind:fO(`shortsMusic`)}).strict()])}).strict()).max(1e4).optional()}).strict()}).strict(),Lfe=K({baseRevisionId:z0,idempotencyKey:z0,targetRevisionId:z0}).strict(),Rfe=K({id:z0,projectId:z0,parentId:z0.nullable(),restoredFromId:z0.nullable(),config:YA,content:V0,fingerprints:lO(B0,U()),createdAt:U()}),zfe=K({id:z0,stageId:z0,kind:q(L0),idx:W().int(),state:q(R0),payload:U().nullable()}),Bfe=K({slot:U(),workKey:B0,assetId:z0,output:Nfe,fingerprint:U(),state:q([`ready`,`outdated`,`review`])}),Vfe=K({key:B0,stageKind:q(cS),piece:zfe,assetId:z0.nullable(),fingerprint:U()}),H0={recordId:z0,publicationId:z0.nullable(),selected:rO(),available:rO()},U0=K({articleMarkdown:U().nullable(),revision:Rfe,outputs:G(Bfe.extend(H0)),pieces:G(Vfe.extend(H0)),current:rO()}),Hfe=K({id:z0,parentId:z0.nullable(),restoredFromId:z0.nullable(),title:U(),createdAt:U(),current:rO()}),W0=K({ok:fO(!0),view:U0,duplicate:rO()}),Ufe=K({ok:fO(!0),view:U0,created:rO()}),Wfe=K({title:U(),status:W(),detail:U().optional(),reason:U().optional(),currentRevisionId:U().nullable().optional(),fields:G(K({field:U(),message:U()})).optional(),errors:G(K({path:U(),message:U()})).optional()});async function G0(e,t){let n;try{n=await e.json()}catch{throw mo(e,void 0)}if(e.ok)return{ok:!0,value:Co(t,n)};let r=Wfe.safeParse(n);if(!r.success)throw mo(e,void 0);let i=r.data;if(![400,404,409].includes(e.status))throw mo(e,{title:i.title,status:i.status,...i.detail===void 0?{}:{detail:i.detail},...i.fields===void 0?{}:{fields:i.fields}});return{ok:!1,reason:i.reason??`invalid-request`,message:i.detail??i.title,currentRevisionId:i.currentRevisionId??null,fields:i.fields??i.errors?.map(e=>({field:e.path,message:e.message}))??[]}}async function K0(e,t,n,r,i){return G0(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}${n}`,i===void 0?{method:`GET`}:{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(i)}),r)}function q0(e,t){return K0(e,t,`/revisions/prepare`,Ufe,{})}function J0(e,t,n){return K0(e,t,`/revisions`,W0,Ife.parse(n))}function Gfe(e,t,n){return K0(e,t,`/revisions/restore`,W0,Lfe.parse(n))}function Kfe(e,t){return K0(e,t,`/revisions`,K({revisions:G(Hfe)}))}function Y0(e,t,n){return K0(e,t,`/revisions/${encodeURIComponent(n)}`,K({view:U0}))}var X0=G(U()).readonly();function qfe(e,t,n){return K0(e,t,`/revisions/${encodeURIComponent(n)}/narration-chunks`,K({chunks:K({intro:X0.optional(),body:X0.optional(),outro:X0.optional()}).nullable()}))}function Jfe(e,t,n){return K0(e,t,`/rebuild/preview`,K({ok:fO(!0),value:kfe}),Tfe.parse(n))}function Yfe(e,t,n){return K0(e,t,`/rebuild`,K({ok:fO(!0),value:I0}),Efe.parse(n))}function Z0(e,t,n,r){return`${e.origin}/files/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}`}async function Xfe(e,t,n,r){let i=await G0(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}/open-folder`,{method:`POST`}),N0);if(!i.ok)throw Error(i.message);return i.value}function Zfe(e,t,n){return Z0(e,t,n,`images.zip`)}async function Q0(e,{projectId:t,asset:n,folder:r=null}){if(r)return Xfe(e,t,r.revisionId,r.recordId);let i=await e.client.projects[`:id`][`open-folder`].$post({param:{id:t},json:{asset:n}});if(!i.ok)throw mo(i,await ho(i));return N0.parse(await i.json())}var $0=`Slopify runs in Docker, which can't open windows on your desktop. Copy this path into your file manager. To have Open folder open it directly, run the Docker launcher again (npx @gentbajko/slopify@latest --docker) so it sets up the host helper.`;function e2(e){return(0,h.jsx)(Qfe,{...e},JSON.stringify([e.projectId,e.asset,e.folder?.revisionId,e.folder?.recordId]))}function Qfe(e){let{api:t}=R(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(),[o,s]=(0,m.useState)();async function c(){r(!0),a(void 0),s(void 0);try{let n=await Q0(t,e);n.opened||s(n.path)}catch(e){a(e instanceof Error?e.message:`The folder couldn't be opened. Press Open folder to try again.`)}finally{r(!1)}}return(0,h.jsxs)(ab,{open:o!==void 0||i!==void 0,onOpenChange:e=>{e||(s(void 0),a(void 0))},children:[(0,h.jsx)(Wte,{asChild:!0,children:(0,h.jsxs)(L,{variant:`secondary`,size:e.size??`default`,disabled:n,onClick:()=>void c(),title:`Locate the saved output folder on the machine running Slopify`,children:[(0,h.jsx)(Pc,{"aria-hidden":`true`,strokeWidth:1.75}),n?`Locating…`:o?`Locate folder`:`Open folder`]})}),(0,h.jsxs)(sb,{className:`flex flex-col gap-2`,children:[o===void 0?null:(0,h.jsxs)(`div`,{role:`status`,className:`flex min-w-0 flex-col gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:$0}),(0,h.jsx)(`input`,{"aria-label":`Saved folder path`,readOnly:!0,value:o,onFocus:e=>e.currentTarget.select(),className:`sl-input w-full min-w-0 font-mono text-small`})]}),i===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:i})]})]})}var $fe={chrome:`Chrome, Edge, Brave`,firefox:`Firefox`};function epe(){return typeof navigator<`u`&&/firefox/i.test(navigator.userAgent)?`firefox`:`chrome`}function t2(){let{api:e}=R(),[t,n]=(0,m.useState)(epe),r=`slopify-studio-${t}.zip`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(ub,{label:`Browser`,value:t,onChange:n,tip:`settings.studio.install`,options:[`chrome`,`firefox`].map(e=>({value:e,label:$fe[e]}))}),(0,h.jsxs)(Vx,{href:_s(e,t),download:r,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Download for ${t===`chrome`?`Chrome`:`Firefox`}`]})]}),(0,h.jsxs)(`ol`,{"aria-label":`Install steps`,className:`m-0 flex list-decimal flex-col gap-1 pl-5`,children:[t===`chrome`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`li`,{children:[`Press Download for Chrome, then unzip `,(0,h.jsx)(mV,{children:r}),` into a folder you keep: the browser loads the extension from there.`]}),(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(mV,{children:`chrome://extensions`}),` (Edge: `,(0,h.jsx)(mV,{children:`edge://extensions`}),`), turn on Developer mode, press Load unpacked and pick that folder.`]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`li`,{children:`Press Download for Firefox. It needs Firefox 128 or newer; keep the zip, you pick it in the next step.`}),(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(mV,{children:`about:debugging#/runtime/this-firefox`}),`, press Load Temporary Add-on and pick `,(0,h.jsx)(mV,{children:r}),`. Firefox removes it when it restarts; load it again then.`]})]}),(0,h.jsx)(`li`,{children:`Pair it: press Copy beside the pairing token in Settings → YouTube Studio, click the Slopify extension's toolbar button, paste the token and press Pair.`})]})]})}var tpe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],n2=K({day:W().int().min(0).max(6),time:U().regex(/^([01]\d|2[0-3]):[0-5]\d$/)}),npe=K({name:U().trim().min(1).max(20),series:U().trim().max(100).default(``),long:n2,shorts:G(n2).max(10)});K({timeZone:U().min(1).max(100),rows:G(npe).max(14)});var r2=[`studio`,`plan`],rpe=[`America/New_York`,`America/Los_Angeles`,`Europe/London`,`UTC`];function i2({slot:e,label:t,onChange:n}){return(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(pV,{"aria-label":`${t}: day`,className:`w-[92px]`,value:String(e.day),onChange:t=>n({...e,day:Number(t.currentTarget.value)}),options:tpe.map((e,t)=>({value:String(t),label:e}))}),(0,h.jsx)(Y,{"aria-label":`${t}: time`,type:`time`,className:`w-[132px]`,value:e.time,onChange:t=>n({...e,time:t.currentTarget.value||e.time})})]})}function ipe({autoComment:e}){let{api:t}=R(),n=_(),r=gy(),i=N({queryKey:r2,queryFn:()=>cs(t)}),[a,o]=(0,m.useState)(),s=a??i.data?.plan,c=P({mutationFn:e=>ls(t,e),onSuccess:e=>{n.setQueryData(r2,e),o(void 0),r(`Saved the posting plan.`,`success`)},onError:e=>r(`The posting plan wasn't saved: ${e.message}`,`error`)}),l=P({mutationFn:e=>us(t,e),onSuccess:e=>{n.setQueryData(r2,e),n.invalidateQueries({queryKey:[`studio`,`releases`]}),r(`Each upload is now due ${String(e.leadHours)} hours before its release.`,`success`)},onError:e=>r(`The lead time wasn't saved: ${e.message}`,`error`)}),u=P({mutationFn:e=>ps(t,e),onSuccess:()=>n.invalidateQueries({queryKey:[`studio`,`settings`]}),onError:e=>r(`Not saved: ${e.message}`,`error`)});if(s===void 0)return(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the posting plan…`});let d=e=>o(e),f=(e,t)=>d({...s,rows:s.rows.map((n,r)=>r===e?t:n)}),p=()=>{let e=new Set(s.rows.map(e=>e.name));for(let t=1;;t++)if(!e.has(String(t)))return String(t)},g=[...new Set([s.timeZone,...rpe])];return(0,h.jsxs)(`section`,{"aria-label":`Posting plan`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(V,{as:`h3`,title:`Posting plan`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`One line per long video you post each week, with its series and its shorts. A finished project takes the next free time of a line that takes its series (from its titles, the part after "|"); each short goes out the first time its day and hour come round after its own video, never in the same hour as another release. See and move them in Calendar → Releases.`}),s.rows.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`No posting plan yet, so nothing is scheduled. Press Add a long video to start.`}):(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-3 p-0`,children:s.rows.map((e,t)=>(0,h.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line pb-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold`,children:`Long video ${String(t+1)}`}),(0,h.jsx)(i2,{slot:e.long,label:`Long video ${String(t+1)}`,onChange:n=>f(t,{...e,long:n})})]}),(0,h.jsx)(pV,{"aria-label":`Long video ${String(t+1)}: series`,className:`w-[220px]`,value:e.series,onChange:n=>f(t,{...e,series:n.currentTarget.value}),options:[{value:``,label:`Any series`},...[...new Set([...i.data?.series??[],e.series])].filter(e=>e!==``).map(e=>({value:e,label:e}))]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(ly,{label:`Remove long video ${String(t+1)}`,onClick:()=>d({...s,rows:s.rows.filter((e,n)=>n!==t)}),children:(0,h.jsx)($c,{"aria-hidden":`true`,strokeWidth:1.75})})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-4`,children:[e.shorts.length===0?(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:`No shorts`}):null,e.shorts.map((t,n)=>({short:t,at:n,key:`${e.name}-${String(n+1)}`})).map(({short:n,at:r,key:i})=>(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:`Short ${String(r+1)}`}),(0,h.jsx)(i2,{slot:n,label:`Long video ${String(t+1)}, short ${String(r+1)}`,onChange:n=>f(t,{...e,shorts:e.shorts.map((e,t)=>t===r?n:e)})}),(0,h.jsx)(ly,{label:`Remove short ${String(r+1)} of long video ${String(t+1)}`,onClick:()=>f(t,{...e,shorts:e.shorts.filter((e,t)=>t!==r)}),children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]},i)),(0,h.jsxs)(L,{type:`button`,variant:`quiet`,disabled:e.shorts.length>=10,onClick:()=>f(t,{...e,shorts:[...e.shorts,e.shorts.at(-1)??{...e.long}]}),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Short`]})]})]},e.name))}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsxs)(L,{type:`button`,variant:`quiet`,disabled:s.rows.length>=14,onClick:()=>d({...s,rows:[...s.rows,{name:p(),series:s.rows.at(-1)?.series??``,long:s.rows.at(-1)?.long??{day:0,time:`20:00`},shorts:[]}]}),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Add a long video`]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-small text-ink-2`,children:[`Times are in`,(0,h.jsx)(pV,{"aria-label":`The plan's time zone`,value:s.timeZone,onChange:e=>d({...s,timeZone:e.currentTarget.value}),options:g.map(e=>({value:e,label:e.replace(/_/g,` `)}))})]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(L,{type:`button`,disabled:a===void 0||c.isPending,onClick:()=>c.mutate(s),children:`Save posting plan`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-small text-ink-2`,children:[`Upload and schedule each video and short at least`,(0,h.jsx)(Y,{"aria-label":`Hours before release`,type:`number`,min:1,max:168,className:`w-[72px]`,defaultValue:i.data?.leadHours??24,onBlur:e=>{let t=Number(e.currentTarget.value);Number.isInteger(t)&&t>=1&&t<=168&&t!==i.data?.leadHours&&l.mutate(t)}},i.data?.leadHours??24),`hours before its release, so YouTube's copyright and ad checks finish while it is private.`]}),(0,h.jsx)(lb,{checked:e===!0,disabled:u.isPending||e===void 0,onChange:e=>u.mutate(e),label:`Post and pin each video's comment once it is public (the extension posts it in your name)`})]})}var a2=[`studio`,`settings`];function ape(){let{api:e}=R(),t=N({queryKey:a2,queryFn:()=>is(e)});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(V,{title:`Upload pack and extension`,info:`settings.studio.extension`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsx)(ope,{}),(0,h.jsx)(ipe,{autoComment:t.data?.autoComment??!1}),(0,h.jsx)(cpe,{}),(0,h.jsxs)(`section`,{"aria-label":`Install the Studio extension`,children:[(0,h.jsx)(V,{as:`h3`,title:`Install the Studio extension`,className:`mb-3`}),(0,h.jsx)(t2,{})]})]})]})}var o2=``;function ope(){let{api:e}=R(),t=_(),n=gy(),r=(0,m.useId)(),i=N({queryKey:a2,queryFn:()=>is(e)}),a=N(wb(e)),o=(0,m.useId)(),[s,c]=(0,m.useState)(o2),[l,u]=(0,m.useState)(void 0),d=i.data?.playlists??[],f=s===o2?void 0:i.data?.channelPlaylists[s],p=l??(s===o2?d:f??[]),g=spe(p),v=P({mutationFn:t=>as(e,t,s===o2?void 0:s),onSuccess:()=>{u(void 0),t.invalidateQueries({queryKey:a2}),n(`Playlists saved.`,`success`)}}),y=e=>{v.reset(),u(e)},b=g??v.error?.message,x=[{value:o2,label:`Every channel (default)`},...(a.data??[]).map(e=>({value:e.id,label:e.name}))];return(0,h.jsxs)(uV,{label:`Playlists`,tip:`settings.studio.playlist`,help:s===o2?`The playlists upload packs offer, for every channel without its own. Ticked ones are on for every project; Prepare upload changes them for one project.`:f===void 0&&d.length>0?`This channel uses the default list (${(e=>e.map(e=>e.name).join(`, `))(d)}) until you add its own.`:`This channel's own playlists. Ticked ones are on for every project; Prepare upload changes them for one project.`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(pV,{id:o,"aria-label":`Channel`,value:s,options:x,onChange:e=>{v.reset(),u(void 0),c(e.currentTarget.value)},className:`max-w-[260px]`}),p.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(Y,{autoComplete:`off`,"aria-label":`Playlist ${String(t+1)} name`,placeholder:`The playlist's name in Studio`,className:`min-w-0 flex-1 basis-[220px]`,value:e.name,disabled:i.data===void 0,"aria-invalid":e.name.trim().length>150,"aria-describedby":b===void 0?void 0:r,onChange:e=>y(p.map((n,r)=>r===t?{...n,name:e.target.value}:n))}),(0,h.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-accent)]`,checked:e.byDefault,onChange:e=>{let n=e.currentTarget.checked;y(p.map((e,r)=>r===t?{...e,byDefault:n}:e))}}),`On by default`]}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Remove ${e.name.trim()||`playlist ${String(t+1)}`}`,onClick:()=>y(p.filter((e,n)=>n!==t)),children:`Remove`})]},t)),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(L,{variant:`secondary`,disabled:i.data===void 0||p.length>=20,onClick:()=>y([...p,{name:``,byDefault:p.length===0}]),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Add playlist`]}),(0,h.jsx)(L,{variant:`primary`,disabled:v.isPending||l===void 0||g!==void 0,onClick:()=>v.mutate(p),children:`Save playlists`})]})]}),b===void 0?null:(0,h.jsx)(`p`,{id:r,role:`alert`,className:`m-0 text-small text-danger`,children:b})]})}function spe(e){if(e.find(e=>e.name.trim().length>150)!==void 0)return`A playlist name is longer than YouTube allows (150 characters). Shorten it.`;let t=new Set;for(let n of e){let e=n.name.trim().toLowerCase();if(e!==``){if(t.has(e))return`"${n.name.trim()}" is listed twice. Remove one.`;t.add(e)}}}function cpe(){let{api:e}=R(),t=_(),n=gy(),r=N({queryKey:a2,queryFn:()=>is(e)}),i=P({mutationFn:()=>bs(e),onSuccess:()=>{t.invalidateQueries({queryKey:a2}),n(`New pairing token made. Pair the extension again with it.`,`success`)}}),a=r.data?.pairing;return(0,h.jsxs)(`div`,{className:`sl-field`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`sl-field__label`,children:`Extension pairing token`}),(0,h.jsx)(B,{id:`settings.studio.pairing`,className:`-my-1`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`code`,{className:`sl-code min-w-0 flex-1 basis-[220px] truncate py-2 select-all`,children:a?.token??`…`}),(0,h.jsxs)(L,{variant:`quiet`,disabled:a===void 0,onClick:()=>{if(a!==void 0){if(!navigator.clipboard){n(`Couldn't copy the token. Select it and copy it.`,`error`);return}navigator.clipboard.writeText(a.token).then(()=>n(`Pairing token copied. Paste it into the extension's options.`,`success`),()=>n(`Couldn't copy the token. Select it and copy it.`,`error`))}},children:[(0,h.jsx)(kc,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Copy`]}),(0,h.jsx)(L,{variant:`quiet`,disabled:i.isPending||a===void 0,onClick:()=>i.mutate(),children:`New pairing token`})]}),(0,h.jsx)(`p`,{className:`sl-field__help m-0`,children:a?.origin==null?`No extension is paired. Paste this token into the Slopify Studio extension's options and press Pair.`:`Paired with the extension at ${a.origin}. A new token unpairs it.`}),i.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:i.error.message})]})}var s2=[`studio`,`queue`];function c2({projectId:e,ready:t,variant:n=`secondary`,size:r=`default`}){let[i,a]=(0,m.useState)(!1);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:n,size:r,disabled:!t,disabledReason:`Available once the video has been made`,onClick:()=>a(!0),children:`Prepare upload`}),i?(0,h.jsx)(f2,{projectId:e,onClose:()=>a(!1)}):null]})}var l2={video:`Video file`,title:`Title`,description:`Description`,thumbnails:`Thumbnail`,playlist:`Playlist`,audience:`Audience`,altered:`AI use (under Show more)`,tags:`Tags (under Show more)`,schedule:`Schedule (Visibility)`};function u2(e){return new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}function d2(e){return e.kind===`video`?`video`:`short-${String(e.short)}`}function f2({projectId:e,onClose:t}){let{api:n}=R(),r=_(),i=[`studio`,`pack`,e],a=N({queryKey:i,queryFn:()=>xs(n,e)}),[o,s]=(0,m.useState)(`video`),[c,l]=(0,m.useState)(),u=a.data?.items??[],d=u.find(e=>d2(e)===o)??u[0],f=N({queryKey:a2,queryFn:()=>is(n)}),p=f.data===void 0?void 0:f.data.pairing.origin!==null,g=N({queryKey:s2,queryFn:()=>vs(n)}),v=P({mutationFn:t=>Cs(n,e,t.short),onSuccess:e=>{r.setQueryData(s2,e),l({text:e.length>1?`Added; ${String(e.length)} uploads are waiting. Studio is opening: each upload you start there is filled with the next one, in the order under Waiting for Studio. Check everything and publish yourself.`:`Studio is opening. The Slopify Studio extension puts the video into its upload dialog and fills in the details. Check everything and publish yourself.`,tone:`success`})},onError:e=>l({text:`Couldn't hand this to the extension: ${e.message}`,tone:`error`})}),y=P({mutationFn:e=>ys(n,e.projectId,e.short),onSuccess:e=>r.setQueryData(s2,e),onError:e=>l({text:`Couldn't remove it from Waiting for Studio: ${e.message} Press Remove again.`,tone:`error`})}),b=P({mutationFn:t=>Ss(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved. The AI use answer is updated.`,tone:`success`})},onError:e=>l({text:`Couldn't save whether the clips are real footage: ${e.message} Press the switch again.`,tone:`error`})}),x=P({mutationFn:t=>os(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved this project's playlists.`,tone:`success`})},onError:e=>l({text:`Couldn't save the playlists: ${e.message} Tick the playlist again.`,tone:`error`})}),S=P({mutationFn:t=>ms(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved when this project goes out.`,tone:`success`})},onError:e=>l({text:`Couldn't change the slot: ${e.message} Choose it again.`,tone:`error`})}),C=P({mutationFn:t=>ss(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved what the upload uses.`,tone:`success`})},onError:e=>l({text:`Couldn't save the choice: ${e.message} Choose it again.`,tone:`error`})});return(0,h.jsxs)(UM,{open:!0,title:`Prepare upload`,onClose:t,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V1,{tone:c?.tone??`info`,children:c?.text}),p===!1?(0,h.jsx)(Vx,{href:m0,target:`_blank`,rel:`noopener noreferrer`,variant:`secondary`,children:`Open YouTube Studio`}):null,(0,h.jsx)(L,{variant:`primary`,disabled:d===void 0||v.isPending||p!==!0,disabledReason:p===!1?`Install and pair the Slopify Studio extension first (steps above)`:f.error===null?`Wait for the upload pack to load`:`Couldn't check whether the extension is paired: ${f.error.message} Close Prepare upload and open it again.`,onClick:()=>{d!==void 0&&(window.open(m0,`_blank`,`noopener`),v.mutate(d))},children:`Fill in YouTube Studio`}),(0,h.jsx)(B,{id:`project.upload.fill-studio`})]}),children:[a.error===null?null:(0,h.jsx)(pP,{tone:`danger`,title:`The upload pack couldn't be read.`,children:`${a.error.message} Close Prepare upload and open it again.`}),a.data===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[p===!1?(0,h.jsx)(pP,{tone:`waiting`,title:`The Slopify Studio extension isn't paired.`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:`Without it, the steps below are the upload pack: copy each into Studio's upload dialog. To have Studio filled in for you, install the extension:`}),(0,h.jsx)(t2,{})]})}):null,u.length>1?(0,h.jsx)(ub,{label:`What to upload`,value:d===void 0?``:d2(d),onChange:s,tip:`project.upload.item`,options:u.map(e=>({value:d2(e),label:e.kind===`video`?`Video`:`Short ${String(e.short)}`})),className:`self-start`}):null,a.data.missing.length===0?null:(0,h.jsx)(pP,{tone:`waiting`,title:`Some of it isn't made yet.`,children:(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.data.missing.map(e=>(0,h.jsx)(`li`,{children:e},e))})}),d===void 0?null:(0,h.jsx)(upe,{projectId:e,item:d,footageSwitch:d.kind===`video`&&a.data.footage!==void 0?(0,h.jsx)(lb,{checked:b.isPending?b.variables:a.data.footage.real,disabled:b.isPending,onChange:e=>b.mutate(e),tip:`project.upload.real-footage`,label:`The ${a.data.footage.clips===1?`uploaded clip is`:`${String(a.data.footage.clips)} uploaded clips are`} real footage (filmed, not made by AI)`}):void 0,playlistPicker:a.data.playlistChoices.length>1?(0,h.jsx)(`span`,{className:`flex flex-col gap-1`,children:a.data.playlistChoices.map(e=>(0,h.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-accent)]`,checked:e.chosen,disabled:x.isPending,onChange:t=>{let n=t.currentTarget.checked;x.mutate(a.data.playlistChoices.filter(t=>t.name===e.name?n:t.chosen).map(e=>e.name))}}),e.name]},e.name))}):void 0,copy:(e,t)=>{if(!navigator.clipboard){l({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`});return}navigator.clipboard.writeText(e).then(()=>l({text:`Copied the ${t}.`,tone:`success`}),()=>l({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`}))},onPick:e=>C.mutate(e),slotPicker:d.kind===`video`?(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,...cb,children:[(0,h.jsx)(pV,{"aria-label":`Posting plan slot`,value:a.data.schedule===void 0?``:`${a.data.schedule.row}|${a.data.schedule.longAt}`,disabled:S.isPending,onChange:e=>{let[t,n]=e.currentTarget.value.split(`|`);S.mutate(t===void 0||n===void 0?null:{row:t,longAt:n})},options:[{value:``,label:`Not scheduled (set it in Studio yourself)`},...a.data.schedule===void 0?[]:[{value:`${a.data.schedule.row}|${a.data.schedule.longAt}`,label:u2(a.data.schedule.longAt)}],...(a.data.slotChoices??[]).map(e=>({value:`${e.row}|${e.longAt}`,label:u2(e.longAt)}))]}),(0,h.jsx)(B,{id:`project.upload.slot`})]}):void 0,picking:C.isPending,doneKey:`slopify.upload.${e}.${d2(d)}`},d2(d)),(g.data??[]).length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Waiting for Studio`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:`Waiting for Studio`}),(0,h.jsx)(B,{id:`project.upload.queue`,className:`-my-1`})]}),(0,h.jsx)(iU,{label:`Waiting to be filled`,children:(g.data??[]).map((e,t)=>{let n=e.short===null?`Video`:`Short ${String(e.short)}`;return(0,h.jsx)(aU,{title:`${e.projectTitle} · ${n}`,meta:t===0?`Next: filled in the next upload dialog you open in Studio.`:`Filled after ${String(t)} more upload${t===1?``:`s`}.`,actions:(0,h.jsx)(L,{variant:`quiet`,size:`small`,disabled:y.isPending,"aria-label":`Remove ${e.projectTitle} ${n.toLowerCase()} from Waiting for Studio`,onClick:()=>y.mutate(e),children:`Remove`})},`${e.projectId}-${String(e.short)}`)})})]}),(0,h.jsx)(pP,{title:`Slopify never publishes.`,children:p===!1?`Copy each step into Studio's upload dialog (Open YouTube Studio), check it and press Publish yourself.`:`Fill in YouTube Studio hands this to the Slopify Studio extension, which puts the video into Studio's upload dialog and fills in the details. You check it and press Publish.`})]})]})}function lpe(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function p2({href:e,filename:t}){return(0,h.jsxs)(Vx,{href:e,download:t,"aria-label":`Download ${t}`,variant:`secondary`,size:`small`,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Download`]})}function upe({projectId:e,item:t,footageSwitch:n,playlistPicker:r,copy:i,onPick:a,picking:o,slotPicker:s,doneKey:c}){let{api:l}=R(),[u,d]=(0,m.useState)(()=>lpe(c)),[f,p]=(0,m.useState)(null),g=e=>{d(e);try{localStorage.setItem(c,JSON.stringify(e))}catch{}},_=(e,t)=>g(t?[...u,e]:u.filter(t=>t!==e)),v=_fe.filter(e=>e!==`thumbnails`||t.kind===`video`),y=v.filter(e=>u.includes(e)).length,b=e=>{let n=h2(t,e);return(0,h.jsxs)(L,{variant:`quiet`,size:`small`,disabled:n===``,disabledReason:`Nothing to copy yet`,"aria-label":`Copy ${l2[e].toLowerCase()}`,onClick:()=>i(n,l2[e].toLowerCase()),children:[(0,h.jsx)(kc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Copy`]})},x=c=>{switch(c){case`video`:return t.video===null?{value:(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not made yet.`})}:{value:t.video.filename,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p2,{href:`${l.origin}${t.video.url}`,filename:t.video.filename}),(0,h.jsx)(e2,{projectId:e,asset:t.video.asset,size:`small`})]})};case`thumbnails`:return t.thumbnails.length===0?{value:(0,h.jsx)(`span`,{className:`text-ink-3`,children:`None made.`})}:{value:t.thumbnails.length>1?`${m2(t.pickable?.thumbnail??0)} under Thumbnail (choose below). The A/B test tries all ${String(t.thumbnails.length)} once the video is public.`:t.thumbnails[0]?.filename??``,actions:(0,h.jsx)(e2,{projectId:e,asset:t.thumbnails[0]?.asset??`thumbnail`,size:`small`})};case`audience`:return{value:`No, it's not made for kids`};case`altered`:return{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:t.alteredContent.altered?`Yes`:`No`}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:t.alteredContent.why}),n]})};case`description`:return{value:t.chapterNotice===void 0?h2(t,c)||(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not written yet.`}):(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{children:t.description}),(0,h.jsx)(`span`,{className:`text-waiting`,children:t.chapterNotice})]}),actions:b(c)};case`title`:return t.titles.length===0||t.pickable===void 0?{value:h2(t,c),actions:b(c)}:{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{role:`radiogroup`,"aria-label":`Title the upload uses`,className:`flex flex-col gap-1`,children:t.pickable.titles.map((n,r)=>(0,h.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`radio`,name:`upload-title-${e}`,className:`size-4 accent-[var(--color-accent)]`,checked:r===t.pickable?.title,disabled:o,onChange:()=>a({title:r,thumbnail:t.pickable?.thumbnail??0})}),n]},n))}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:`The upload uses the chosen title; the A/B test tries the others beside it once the video is public.`})]}),actions:(0,h.jsxs)(h.Fragment,{children:[b(c),(0,h.jsxs)(L,{variant:`quiet`,size:`small`,"aria-label":`Copy the other titles`,onClick:()=>i(t.titles.join(`
|
|
271
|
+
Obelisks`})}):e.mode===`yaml`?(0,h.jsx)(uV,{id:`schedule-topics-yaml`,label:`Topics as YAML or JSON`,tip:`planning.schedule.topic-yaml`,children:(0,h.jsx)(fV,{rows:10,className:`font-mono`,spellCheck:!1,value:e.yaml,onChange:n=>t({...e,yaml:n.target.value}),placeholder:`- ${f??`Topic`}: Cleopatra\n ${d.find(e=>e!==f)??`Min. Word Count`}: 12000\n- Hypatia`})}):(0,h.jsx)(afe,{queue:e,onQueue:t,keyword:f,addable:O,setRow:D,titleOf:b}),k.length===0?null:(0,h.jsx)(pP,{tone:`danger`,title:`These topics can't be saved yet.`,children:(0,h.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[k.slice(0,8).map(e=>(0,h.jsx)(`li`,{children:e},e)),k.length>8?(0,h.jsx)(`li`,{children:`And ${String(k.length-8)} more.`}):null]})}),e.mode===`yaml`&&v.rows.length>0?(0,h.jsxs)(`section`,{"aria-label":`Project titles`,children:[(0,h.jsx)(`p`,{className:`m-0 mb-1 text-small text-ink-2`,children:`Project titles, in order:`}),(0,h.jsxs)(`ol`,{className:`m-0 flex flex-col gap-1 pl-5 text-small`,children:[v.rows.slice(0,20).map((e,t)=>(0,h.jsx)(`li`,{children:b(e)},t)),v.rows.length>20?(0,h.jsx)(`li`,{className:`list-none text-ink-3`,children:`And ${String(v.rows.length-20)} more.`}):null]})]}):null,a?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Reading the template's keywords…`}):d.length===0?(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-3`,children:[`This template has no keywords such as `,`{{Topic}}`,`, so each topic becomes the project's title.`]}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:(0,h.jsx)(uV,{label:`Each topic fills`,id:`schedule-topic-keyword`,tip:`planning.schedule.topic-keyword`,...f===null?{}:{help:a0({feeds:_(f)})},children:(0,h.jsx)(pV,{value:f??``,onChange:e=>r(e.target.value),children:d.map(e=>(0,h.jsx)(`option`,{value:e,children:`{{${e}}}`},e))})})}),(0,h.jsx)(o0,{keywords:d.filter(e=>e!==f).map(t=>({name:t,value:g[t]??``,feeds:_(t),...e.columns.includes(t)?{note:`Unless a topic sets its own.`}:{}})),onChange:i,fieldPrefix:`everyRun`,label:e=>`${e} (every run)`,inputLabel:e=>`${e} for every run`,tip:`planning.schedule.every-run`,maxLength:1e4})]}),e.mode===`lines`&&S!==void 0&&x!==void 0?(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Next project: `,(0,h.jsx)(`span`,{className:`font-semibold text-ink`,children:S}),f===null||C?null:(0,h.jsxs)(`span`,{className:`block text-ink-3`,children:[`The template's project title does not use `,`{{${f}}}`,`, so every project gets this title. Edit the template's title to include it.`]})]}):null]})}function afe({queue:e,onQueue:t,keyword:n,addable:r,setRow:i,titleOf:a}){let o=n===null?`Title`:`{{${n}}}`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...cb,children:[(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsxs)(`table`,{className:`sl-table`,"aria-label":`Topics`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{scope:`col`,children:`#`}),(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[o,(0,h.jsx)(B,{id:`planning.schedule.topic-table`,className:`-my-1`})]})}),e.columns.map(n=>(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`{{${n}}}`,(0,h.jsx)(ly,{label:`Use the every-run ${n} for all topics`,size:`small`,onClick:()=>t({...e,columns:e.columns.filter(e=>e!==n),rows:e.rows.map(e=>({title:e.title,values:Object.fromEntries(Object.entries(e.values).filter(([e])=>e!==n))}))}),children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]})},n)),(0,h.jsx)(`th`,{scope:`col`,children:`Project title`}),(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Remove`})})]})}),(0,h.jsx)(`tbody`,{children:e.rows.map((n,r)=>(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{className:`num`,children:r+1}),(0,h.jsx)(`td`,{children:(0,h.jsx)(Y,{"aria-label":`Topic ${String(r+1)} ${o}`,maxLength:200,value:n.title,onChange:e=>i(r,{...n,title:e.target.value})})}),e.columns.map(e=>(0,h.jsx)(`td`,{children:(0,h.jsx)(Y,{"aria-label":`Topic ${String(r+1)} ${e}`,maxLength:sq,placeholder:`Every-run value`,value:n.values[e]??``,onChange:t=>i(r,{...n,values:{...n.values,[e]:t.target.value}})})},e)),(0,h.jsx)(`td`,{className:`min-w-[180px] text-small text-ink-2`,children:a(n)??`—`}),(0,h.jsx)(`td`,{children:(0,h.jsx)(ly,{label:`Remove topic ${String(r+1)}`,size:`small`,onClick:()=>t({...e,rows:e.rows.filter((e,t)=>t!==r)}),children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})})]},r))})]})}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(L,{size:`small`,onClick:()=>t({...e,rows:[...e.rows,{title:``,values:{}}]}),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add topic`]}),r.length===0?null:(0,h.jsxs)(pV,{"aria-label":`Set a keyword per topic`,value:``,className:`w-auto`,onChange:n=>{let r=n.target.value;r!==``&&t({...e,columns:[...e.columns,r]})},children:[(0,h.jsx)(`option`,{value:``,children:`Set a keyword per topic…`}),r.map(e=>(0,h.jsx)(`option`,{value:e,children:e},e))]})]})]})}var ofe=[[1,`Mon`],[2,`Tue`],[3,`Wed`],[4,`Thu`],[5,`Fri`],[6,`Sat`],[0,`Sun`]];function sfe({templates:e,pending:t,onCreated:n,onError:r,editing:i,onCancel:a,error:o,onBusy:s}){let{api:c}=R(),[l,u]=(0,m.useState)(i?.name??``),[d,f]=(0,m.useState)(i?.templateId??``),[p,g]=(0,m.useState)(i?.cadence.kind??`daily`),[_,v]=(0,m.useState)(i?.cadence.kind===`once`?xde(i.cadence.at,i.timezone):``),[y,b]=(0,m.useState)(i&&i.cadence.kind!==`once`?i.cadence.time:`09:00`),[x,S]=(0,m.useState)(i?.cadence.kind===`weekly`?i.cadence.days:[1,3,5]),[C,w]=(0,m.useState)(()=>i?.timezone??(Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`)),[T,E]=(0,m.useState)(i?.missedPolicy??`skip`),[D,O]=(0,m.useState)(i?.spendLimitCents?.toString()??``),[k,A]=(0,m.useState)(()=>c0(i?.items??[])),[ee,te]=(0,m.useState)(i?.topicKeyword??null),[ne,j]=(0,m.useState)(i?.values??{}),[re,M]=(0,m.useState)(i?.brief??``),[ie,ae]=(0,m.useState)(i?.topicGeneration??eH),[oe,se]=(0,m.useState)(!1),[ce,le]=(0,m.useState)(!1),ue=(0,m.useRef)(!1),de=(0,m.useRef)(null),fe=i&&!e.some(e=>e.id===i.templateId)?[...e,{id:i.templateId,version:i.templateVersion,name:`Saved template`}]:e,pe=fe.find(e=>e.id===d),me=N({queryKey:[`project-template`,d],enabled:d!==``,queryFn:async()=>{let e=await Pq(c,d);if(!e.ok)throw Error(e.message);return e.value}}),he=me.data?.document.form,ge=he===void 0?void 0:i0({form:he,prompts:me.data?.document.librarySnapshot?.prompts??[],entries:me.data?.document.librarySnapshot?.entries??[]}),_e=he===void 0?[]:cq(he),ve=ee!==null&&_e.includes(ee)?ee:_e.find(e=>he?.title.includes(`{{${e}}}`))??_e[0]??null,ye=Object.fromEntries(_e.filter(e=>e!==ve).map(e=>[e,ne[e]??he?.values[e]??``])),be={keywords:_e,topicKeyword:ve,everyRun:ye,form:he,kept:i?.items??[],...ge===void 0?{}:{origins:ge}},xe=d0(k,be);async function Se(e){if(e.preventDefault(),!(ue.current||t)){if(!pe&&!de.current){r(`Choose a template before saving the schedule.`);return}if(!de.current&&xe.problems.length>0){r(`Fix the topics first. ${xe.problems.slice(0,3).join(` `)}`);return}if(xe.rows.length>500){r(`Keep the list to 500 topics or fewer.`);return}if(re.trim().length>4e3){r(`Keep the series brief to ${String(QV)} characters or fewer.`);return}if(ie.llm!==null&&(ie.llm.provider===``||ie.llm.model===``)){r(`Pick both a provider and a model for topic generation, or choose Use the template's LLM.`);return}if(p===`weekly`&&x.length===0){r(`Choose at least one weekday for a weekly schedule.`);return}ue.current=!0,se(!0),s(!0);try{if(!de.current){if(!pe)throw Error(`Choose a template before saving the schedule.`);let e=C.trim();if(!WV(e))throw Error(`Enter a timezone name like Europe/Tirane or America/New_York.`);let t=p===`once`?{kind:p,at:Sde(_,e)}:p===`weekly`?{kind:p,time:y,days:x}:{kind:p,time:y},n=D.trim()===``?null:Number(D);if(n!==null&&(!Number.isInteger(n)||n<0))throw Error(`Enter the spend limit as a whole number of cents, 0 or more (500 is $5.00), or leave it empty.`);let r={id:i?.id??crypto.randomUUID(),name:l.trim(),templateId:pe.id,templateVersion:pe.version,cadence:t,timezone:e,missedPolicy:T,overlapPolicy:`skip`,spendLimitCents:n,items:xe.rows,topicKeyword:ve,values:ye,brief:re.trim()===``?null:re.trim(),topicGeneration:ie};de.current=i?{...r,baseVersion:i.version,mutationId:crypto.randomUUID()}:r}let e=de.current,{id:t,...a}=e,o=`mutationId`in a?await bH(c,t,a):await yH(c,e);if(!o.ok){de.current=null,le(!1),r(o.reason===`conflict`?`${o.message} Your inputs are kept here. To load the latest saved version, cancel editing and press Edit again.`:o.message);return}de.current=null,le(!1),u(``),A(c0([])),n()}catch(e){le(de.current!==null),r(e instanceof Error?e.message:`The schedule wasn't saved. Try again.`)}finally{ue.current=!1,se(!1),s(de.current!==null)}}}return(0,h.jsxs)(`section`,{"aria-label":i?`Edit schedule`:`New schedule`,children:[o?(0,h.jsx)(pP,{tone:`danger`,title:`The schedule wasn't saved.`,className:`mb-4`,children:o}):null,(0,h.jsxs)(`form`,{onSubmit:e=>void Se(e),children:[(0,h.jsxs)(`fieldset`,{disabled:oe||ce||t,className:`m-0 grid min-w-0 gap-4 border-0 p-0 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(uV,{label:`Name`,id:`schedule-name`,tip:`planning.schedule.name`,children:(0,h.jsx)(Y,{required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`Monday morning stories`})}),(0,h.jsx)(uV,{label:`Template`,id:`schedule-template`,tip:`planning.schedule.template`,children:(0,h.jsxs)(pV,{required:!0,value:d,onChange:e=>f(e.target.value),disabled:fe.length===0,children:[(0,h.jsx)(`option`,{value:``,children:`Choose a template`}),fe.map(e=>(0,h.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.version]},e.id))]})}),(0,h.jsx)(uV,{label:`Cadence`,id:`schedule-cadence`,tip:`planning.schedule.cadence`,children:(0,h.jsxs)(pV,{value:p,onChange:e=>g(e.target.value===`once`?`once`:e.target.value===`weekly`?`weekly`:`daily`),children:[(0,h.jsx)(`option`,{value:`daily`,children:`Every day`}),(0,h.jsx)(`option`,{value:`weekly`,children:`Selected weekdays`}),(0,h.jsx)(`option`,{value:`once`,children:`One time`})]})}),p===`once`?(0,h.jsx)(uV,{label:`Run at`,id:`schedule-once`,tip:`planning.schedule.once-at`,children:(0,h.jsx)(Y,{required:!0,type:`datetime-local`,value:_,onChange:e=>v(e.target.value)})}):(0,h.jsx)(uV,{label:`Local time`,id:`schedule-time`,tip:`planning.schedule.time`,children:(0,h.jsx)(Y,{required:!0,type:`time`,value:y,onChange:e=>b(e.target.value)})}),p===`weekly`?(0,h.jsxs)(`fieldset`,{className:`m-0 min-w-0 border-0 p-0`,...cb,children:[(0,h.jsxs)(`legend`,{className:`sl-field__label mb-2 flex items-center gap-1`,children:[`Weekdays`,(0,h.jsx)(B,{id:`planning.schedule.weekdays`,className:`-my-1`})]}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:ofe.map(([e,t])=>(0,h.jsxs)(`label`,{className:`inline-flex items-center gap-1 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:x.includes(e),onChange:t=>S(n=>t.target.checked?[...n,e]:n.filter(t=>t!==e))}),t]},e))})]}):(0,h.jsx)(`div`,{}),(0,h.jsx)(uV,{label:`Timezone`,id:`schedule-timezone`,tip:p===`once`?`planning.schedule.timezone-once`:`planning.schedule.timezone`,children:(0,h.jsx)(Y,{value:C,onChange:e=>w(e.target.value),placeholder:`Europe/Tirane`})}),(0,h.jsx)(uV,{label:`Missed run`,id:`schedule-missed`,tip:`planning.schedule.missed`,children:(0,h.jsxs)(pV,{value:T,onChange:e=>E(e.target.value===`run-once`?`run-once`:`skip`),children:[(0,h.jsx)(`option`,{value:`skip`,children:`Skip if Slopify was closed`}),(0,h.jsx)(`option`,{value:`run-once`,children:`Run once when Slopify reopens`})]})}),(0,h.jsx)(uV,{label:`Spend ceiling (cents, optional)`,id:`schedule-spend`,tip:`planning.schedule.spend`,tipLabel:`Spend ceiling`,children:(0,h.jsx)(Y,{inputMode:`numeric`,value:D,onChange:e=>O(e.target.value),placeholder:`1000`})}),(0,h.jsx)(ife,{queue:k,onQueue:A,context:be,onKeyword:te,onValue:(e,t)=>j(n=>({...n,[e]:t})),loading:d!==``&&me.isPending,exportName:l}),(0,h.jsx)(cfe,{brief:re,onBrief:M,generation:ie,onGeneration:ae,templateLlm:he?.llm})]}),(0,h.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-6 flex flex-wrap gap-2 border-t border-line bg-ground py-3 max-md:bottom-[68px]`,children:[(0,h.jsx)(L,{type:`submit`,variant:`primary`,disabled:t||oe||fe.length===0&&!ce,children:oe?`Saving…`:ce?`Retry save`:i?`Save changes`:`Save schedule`}),(0,h.jsx)(L,{variant:`quiet`,disabled:oe||ce,onClick:a,children:i?`Cancel editing`:`Cancel`})]})]})]})}function cfe({brief:e,onBrief:t,generation:n,onGeneration:r,templateLlm:i}){let{api:a}=R(),o=N({...Xy(a),enabled:n.mode!==`off`}),s=n.llm;return(0,h.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-3 border-0 border-t border-line p-0 pt-5 min-[700px]:col-span-2`,children:[(0,h.jsxs)(`legend`,{className:`float-left mb-1 flex w-full items-center gap-1 text-title-3 font-semibold`,children:[`Topic generation`,(0,h.jsx)(B,{id:`planning.schedule.generation`})]}),(0,h.jsx)(uV,{label:`Series brief (optional)`,id:`schedule-brief`,tip:`planning.schedule.brief`,tipLabel:`Series brief`,children:(0,h.jsx)(fV,{rows:3,maxLength:QV,value:e,onChange:e=>t(e.target.value),placeholder:`Ancient history, documentary style. Famous rulers and places first.`})}),(0,h.jsxs)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(uV,{label:`New topics`,id:`schedule-generation`,tip:`planning.schedule.new-topics`,children:(0,h.jsxs)(pV,{value:n.mode,onChange:e=>{let t=e.target.value;r({...n,mode:t===`queue`||t===`hold`?t:`off`})},children:[(0,h.jsx)(`option`,{value:`off`,children:`Off: add topics yourself`}),(0,h.jsx)(`option`,{value:`queue`,children:`Generate and queue directly`}),(0,h.jsx)(`option`,{value:`hold`,children:`Generate and hold for approval`})]})}),n.mode===`off`?null:(0,h.jsx)(uV,{label:`Keep at least this many queued`,id:`schedule-keep`,tip:`planning.schedule.keep-count`,children:(0,h.jsx)(Y,{type:`number`,min:1,max:100,value:String(n.keepAtLeast),onChange:e=>{let t=Math.round(Number(e.target.value));r({...n,keepAtLeast:Number.isFinite(t)?Math.min(100,Math.max(1,t)):1})}})})]}),n.mode===`off`?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...cb,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:s===null,onChange:e=>r({...n,llm:e.target.checked?null:{provider:i?.provider??``,model:i?.model??``}})}),`Use the template's LLM`,s===null&&i!==void 0&&i.provider!==``?` (${i.provider} · ${i.model})`:``]}),(0,h.jsx)(B,{id:`planning.schedule.generation-llm`,className:`-my-1`})]}),s===null?null:(0,h.jsxs)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(EV,{label:`Provider`,family:`llm`,providers:o.data?.providers??[],value:s.provider,problem:o.error?.message,onPick:e=>r({...n,llm:{provider:e,model:``}})}),(0,h.jsx)(DV,{label:`Model`,provider:s.provider,value:s.model,problem:void 0,onPick:e=>r({...n,llm:{...s,model:e}})})]})]})]})}function lfe({schedule:e}){let{api:t}=R(),n=_(),r=gy(),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(!1),c=(0,m.useRef)(!1),[l,u]=(0,m.useState)(``),d=(0,m.useRef)(e);e.version>d.current.version&&(d.current=e);let f=d.current.items,p=e.topicKeyword===null?`title`:`{{${e.topicKeyword}}}`,g=async(e,i,o)=>{if(c.current)return!1;c.current=!0;let l=d.current;s(!0),a(null);try{let s=await PH(t,l.id,{baseVersion:l.version,items:e});return s.ok?(d.current=s.value,n.setQueryData(gH,e=>e?.map(e=>e.id===s.value.id?s.value:e)),n.invalidateQueries({queryKey:IH}),r(i,`success`,o?{label:`Undo`,run:()=>void g(l.items,`Put the topics back as they were.`,!1)}:void 0),!0):(a(s.reason===`conflict`?`The topics weren't saved: this schedule changed since the page loaded, possibly because a run just took a topic. The list now shows the latest; make your change again.`:`The topics weren't saved: ${s.message}`),await n.invalidateQueries({queryKey:gH}),!1)}catch(e){return a(`The topics weren't saved: ${e instanceof Error?e.message:`Slopify didn't answer.`} Check that Slopify is running, then try again.`),!1}finally{c.current=!1,s(!1)}},v=async e=>{e.preventDefault();let t=l.trim();if(t===``){a(`Write the new topic's ${p} first, then press Add topic.`);return}await g([...f,{title:t,values:{}}],`Added “${t}”.`,!0)&&u(``)},y=(e,t)=>{let n=f[e];if(n!==void 0&&t.trim()!==n.title){if(t.trim()===``){a(`Topic ${String(e+1)} needs a ${p}. Write one, or press its Remove button.`);return}g(f.map((n,r)=>r===e?{...n,title:t.trim()}:n),`Renamed to “${t.trim()}”.`,!0)}},b=(e,t)=>{let n=f[e];if(n===void 0)return;let r=[...f];r.splice(e,1),r.splice(e+t,0,n),g(r,`Moved “${n.title}” ${t===-1?`up`:`down`}.`,!0)},x=e=>{let t=f[e];t!==void 0&&g(f.filter((t,n)=>n!==e),`Removed “${t.title}”.`,!0)};return(0,h.jsxs)(`section`,{"aria-label":`Queued topics`,className:`mt-6`,...cb,children:[(0,h.jsx)(V,{as:`h3`,title:`Queued topics · ${String(f.length)}`,info:`planning.schedule.inline-topics`,meta:e.topicKeyword===null?`Each topic becomes the next project's title.`:`Each topic fills ${p}; the next run takes the first.`}),i===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:i}),f.length===0?null:(0,h.jsx)(iU,{label:`Topics of ${e.name}`,className:`mt-2`,children:f.map((e,t)=>(0,h.jsx)(ufe,{index:t,title:e.title,count:f.length,busy:o,onRename:e=>y(t,e),onMove:e=>b(t,e),onRemove:()=>x(t)},`${String(t)}:${e.title}`))}),(0,h.jsxs)(`form`,{className:`mt-3 flex flex-wrap items-center gap-2`,onSubmit:e=>void v(e),children:[(0,h.jsx)(Y,{"aria-label":`New topic`,placeholder:e.topicKeyword===null?`New topic`:`New ${p}`,maxLength:200,value:l,className:`min-w-0 flex-1`,onChange:e=>u(e.target.value)}),(0,h.jsxs)(L,{type:`submit`,size:`small`,disabled:o||f.length>=500,disabledReason:o?`Saving the last change`:`A queue holds at most 500 topics`,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add topic`]})]})]})}function ufe({index:e,title:t,count:n,busy:r,onRename:i,onMove:a,onRemove:o}){let[s,c]=(0,m.useState)(t);(0,m.useEffect)(()=>c(t),[t]);let l=`Topic ${String(e+1)}`;return(0,h.jsx)(aU,{lead:(0,h.jsx)(`span`,{className:`w-6 text-small text-ink-3 tabular-nums`,children:e+1}),title:(0,h.jsx)(Y,{"aria-label":l,maxLength:200,value:s,onChange:e=>c(e.target.value),onBlur:()=>i(s),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i(s)):e.key===`Escape`&&c(t)}}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ly,{size:`small`,label:`Move ${t} up`,disabled:r||e===0,onClick:()=>a(-1),children:(0,h.jsx)(_c,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(ly,{size:`small`,label:`Move ${t} down`,disabled:r||e===n-1,onClick:()=>a(1),children:(0,h.jsx)(mc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(ly,{size:`small`,label:`Remove ${t}`,disabled:r,onClick:o,children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]})})}function dfe({pickedId:e,onPick:t}={}){let{api:n}=R(),r=_(),i=N(_H(n)),a=N(Nq(n)),[o,s]=(0,m.useState)(null),c=gy(),[l,u]=(0,m.useState)(null),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)(!1),[v,y]=(0,m.useState)(null),b=t===void 0?v:e??null,x=e=>{t===void 0?y(e):t(e)},[S,C]=(0,m.useState)(null),w=(0,m.useRef)(!1),T=N(wb(n)),[E]=(0,m.useState)(()=>{let e=new Date;return{from:e.toISOString(),to:new Date(e.valueOf()+79488e5).toISOString()}}),D=N(LH(n,E.from,E.to)),O=new Map;for(let e of D.data?.runs??[])e.renderedTitle!==null&&!O.has(e.scheduleId)&&O.set(e.scheduleId,e.renderedTitle);let[k,A]=(0,m.useState)(``),ee=e=>{if(k===``)return!0;let t=a.data?.find(t=>t.id===e.templateId);return(t?Y1(t):_b)===k},te=i.data?.filter(e=>e.deletedAt===null&&ee(e))??[],ne=i.data?.filter(e=>e.deletedAt!==null)??[],j=i.data?.find(e=>e.id===b)??te[0]??null,re=P({onError:e=>s(e.message),onSettled:async()=>{w.current=!1,await r.invalidateQueries({queryKey:gH})},mutationFn:async e=>e(),onSuccess:async e=>{if(!e.ok){s(e.message);return}s(null)}}),M=e=>{w.current||(w.current=!0,s(null),re.mutate(e))},ie=d||l!==null,ae=()=>{u(null),f(!1),s(null)},oe=a.data?.length===0,se=()=>{ie||oe||(u(null),f(!0),s(null))},ce=e=>{f(!1),x(e.id),u(e),s(null)};qb({id:`schedules.new`,title:`New schedule`,group:`Schedules`,keywords:[`calendar`,`recurring`],run:se}),Sx(_x.newSchedule,()=>{oe?c(`A schedule runs a project template, and there is none yet. Open a project, choose Save as template, then run New schedule again.`,`error`):se()},a.data!==void 0);let le=o?{tone:`error`,text:o}:i.error?{tone:`error`,text:`The schedules couldn't be loaded: ${i.error.message} Reload the page to try again.`}:a.error?{tone:`error`,text:`The templates couldn't be loaded: ${a.error.message} Reload the page to try again.`}:void 0,ue=re.isPending||p||ie;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0 min-w-0 text-small text-ink-2`,children:oe?(0,h.jsxs)(h.Fragment,{children:[`Save a template in`,` `,(0,h.jsx)(ha,{className:`underline`,to:`/templates`,children:`Library → Templates`}),` `,`before creating a schedule.`]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Runs a saved template on this machine at a local time.`,(0,h.jsx)(B,{id:`planning.schedules`})]})}),(0,h.jsxs)(dy,{children:[(0,h.jsxs)(pV,{"aria-label":`Filter schedules by channel`,value:k,className:`w-auto min-w-[160px]`,onChange:e=>A(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`All channels`}),(T.data??[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,h.jsxs)(L,{variant:`primary`,onClick:se,disabled:ie||oe,disabledReason:oe?`Save a template in Library → Templates first`:`Finish or cancel the open form first`,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New schedule`]})]})]}),(0,h.jsx)(V1,{tone:ie?`info`:le?.tone??`info`,className:`mb-2`,children:ie?void 0:le?.text}),(0,h.jsx)(Sq,{className:`min-[768px]:grid-cols-[minmax(320px,460px)_minmax(0,1fr)]`,list:(0,h.jsxs)(h.Fragment,{children:[i.data&&te.length===0?(0,h.jsx)(J1,{title:k===``?ne.length===0?`No schedules yet`:`No active schedules`:`No schedules run this channel's templates`,children:k===``?ne.length===0?`Your first one can be a one-off run or a recurring series. Press New schedule.`:`Create one with New schedule, or review deleted history below.`:`Pick All channels to see the others, or make one from this channel's templates.`}):null,te.length>0?(0,h.jsx)(iU,{label:`Saved schedules`,className:`[&_.sl-row__actions]:flex-wrap`,children:te.map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(p0,{schedule:e,nextTitle:O.get(e.id),selected:!ie&&j?.id===e.id,pending:ue,onSelect:()=>x(e.id),onEdit:()=>ce(e),onAction:M,onConfirm:t=>C({kind:t,schedule:e})}),(0,h.jsx)(Z1,{kind:`schedule`,id:e.id,name:e.name})]},e.id))}):null,ne.length>0?(0,h.jsxs)(`details`,{className:`mt-6`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer text-small font-semibold text-ink-2`,children:[`Deleted schedules · `,ne.length]}),(0,h.jsx)(`p`,{className:`m-0 mt-2 mb-2 text-small text-ink-2`,children:`Deleted schedules stay in Settings → Trash for 30 days, where Restore brings one back paused. Pick one to see its run history.`}),(0,h.jsx)(iU,{label:`Deleted schedules`,children:ne.map(e=>(0,h.jsx)(p0,{schedule:e,nextTitle:void 0,selected:!ie&&j?.id===e.id,pending:!1,onSelect:()=>x(e.id),onEdit:()=>void 0,onAction:M,onConfirm:()=>void 0},e.id))})]}):null]}),detail:ie?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(V,{kicker:l?l.name:void 0,title:l?`Edit schedule`:`New schedule`,className:`mb-4`}),(0,h.jsx)(sfe,{onBusy:g,editing:l,onCancel:()=>{p||ae()},templates:a.data??[],pending:re.isPending,error:o,onCreated:()=>{c(l?`Schedule updated.`:`Schedule saved. It will run automatically while Slopify is open.`,`success`),ae(),r.invalidateQueries({queryKey:gH})},onError:e=>{s(e),r.invalidateQueries({queryKey:gH})}},l?.id??`new`)]}):j?(0,h.jsx)(hfe,{schedule:j,pending:ue,onAction:M,onConfirm:e=>C({kind:e,schedule:j})},j.id):null}),(0,h.jsx)(Dy,{open:S!==null,title:S?.kind===`delete`?`Delete schedule?`:`Cancel schedule?`,consequence:(S?.kind===`delete`?`Moves this schedule to the trash for 30 days (Settings → Trash). Its run history is kept.`:`Stops future scheduled runs. Existing projects and run history are kept.`)+(o?` ${o}`:``),confirmLabel:S?.kind===`delete`?`Delete schedule`:`Cancel schedule`,cancelLabel:`Keep schedule`,pending:re.isPending,onCancel:()=>{re.isPending||C(null)},onConfirm:()=>{if(!S)return;let{kind:e,schedule:t}=S;M(async()=>{let r=e===`delete`?await SH(n,t.id,t.version):await xH(n,t.id,`cancel`,t.version);return r.ok&&C(null),r})}})]})}function ffe(e){return e.cadence.kind===`once`?`One time`:e.cadence.kind===`daily`?`Daily at ${e.cadence.time}`:`Weekly at ${e.cadence.time}`}var pfe={active:`Active`,paused:`Paused`,completed:`Completed`,canceled:`Canceled`},mfe={active:`running`,paused:`waiting`,completed:`done`,canceled:`off`};function f0({schedule:e}){return e.deletedAt===null?(0,h.jsx)(Wx,{tone:mfe[e.status],children:pfe[e.status]}):(0,h.jsx)(Wx,{tone:`off`,children:`Deleted`})}function p0({schedule:e,nextTitle:t,selected:n,pending:r,onSelect:i,onEdit:a,onAction:o,onConfirm:s}){let{api:c}=R(),l=e.deletedAt===null,u=l&&(e.status===`active`||e.status===`paused`),d=e.status===`canceled`||e.status===`completed`;return(0,h.jsx)(aU,{selected:n,onSelect:i,title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(f0,{schedule:e}),` · ${ffe(e)} · ${e.deletedAt===null?e.nextRunAt===null?`No future run`:`Next: ${O1(e.nextRunAt,e.timezone)}${t===void 0?``:` · “${t}”`}`:`Deleted: ${O1(e.deletedAt,e.timezone)}`}${e.topics.held>0?` · ${String(e.topics.held)} waiting for you`:``}`]}),actions:l?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Edit ${e.name}`,disabled:r||!u,disabledReason:u?`Finish or cancel the open form first`:`Only a live schedule can change`,onClick:a,children:`Edit`}),e.status===`paused`?(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Resume ${e.name}`,disabled:r,onClick:()=>o(()=>xH(c,e.id,`resume`,e.version)),children:`Resume`}):(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Pause ${e.name}`,disabled:r||e.status!==`active`,disabledReason:`Only an active schedule can pause`,onClick:()=>o(()=>xH(c,e.id,`pause`,e.version)),children:`Pause`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Delete ${e.name}`,disabled:r||!d,disabledReason:`Cancel the schedule first; a completed or canceled one can be deleted`,onClick:()=>s(`delete`),children:`Delete`})]}):void 0})}function hfe({schedule:e,pending:t,onAction:n,onConfirm:r}){let{api:i}=R(),a=N({queryKey:[`schedule`,e.id],queryFn:async()=>{let t=await vH(i,e.id);if(!t.ok)throw Error(t.message);return t.value},refetchInterval:3e4}),o=e.deletedAt===null,s=o&&(e.status===`active`||e.status===`paused`),c=e.status===`paused`,l=[[`When`,e.cadence.kind===`once`?`Once, ${O1(e.cadence.at,e.timezone)}`:e.cadence.kind===`daily`?`Every day at ${e.cadence.time}`:`Selected weekdays at ${e.cadence.time}`],[`Timezone`,e.timezone],[`Next run`,e.deletedAt!==null||e.nextRunAt===null?`None`:O1(e.nextRunAt,e.timezone)],[`Topics`,e.items.length===0?e.topicGeneration.mode===`off`?`Template as saved`:`No topics queued`:`${String(e.items.length)} ${e.items.length===1?`topic`:`topics`} left`],[`Missed runs`,e.missedPolicy===`skip`?`Skip`:`Run once on reopening`],[`Overlap`,`Skip`],[`Spend ceiling`,e.spendLimitCents===null?`Not set`:`${String(e.spendLimitCents)} cents`]];return(0,h.jsxs)(`section`,{"aria-label":`${e.name} detail`,children:[o&&s?(0,h.jsx)(gfe,{schedule:e,paused:c,onAction:n}):null,(0,h.jsx)(V,{kicker:(0,h.jsx)(f0,{schedule:e}),title:e.name,meta:e.topics.held>0?`${String(e.topics.held)} topics waiting for you`:void 0,children:o?(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Cancel ${e.name}`,disabled:t||!s,disabledReason:`Only an active or paused schedule can be canceled`,onClick:()=>r(`cancel`),children:`Cancel schedule`}):null}),(0,h.jsx)(`dl`,{className:`m-0 mt-4 grid grid-cols-1 gap-x-6 gap-y-3 text-small min-[600px]:grid-cols-2`,children:l.map(([e,t])=>(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`dt`,{className:`sl-kicker`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 break-words text-ink`,children:t})]},e))}),s?(0,h.jsx)(lfe,{schedule:e}):null,(0,h.jsx)(Ude,{schedule:e}),(0,h.jsx)(Cq,{className:`my-6`}),(0,h.jsx)(V,{as:`h3`,title:`Run history`}),(0,h.jsx)(`div`,{className:`mt-3`,children:a.isPending?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Loading history…`}):a.error?(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`The run history couldn't be loaded: ${a.error.message} It tries again every 30 seconds.`}):a.data.runs.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`No runs yet.`}):(0,h.jsx)(iU,{label:`Runs of ${e.name}`,children:a.data.runs.map(t=>(0,h.jsx)(aU,{title:(0,h.jsx)(`span`,{className:`capitalize`,children:`${t.status} · ${O1(t.scheduledFor,e.timezone)}`}),meta:t.error?t.error:t.projectIds.length>0?(0,h.jsx)(`span`,{className:`inline-flex flex-wrap gap-x-3`,children:t.projectIds.map((e,t)=>(0,h.jsxs)(ha,{className:`underline hover:text-ink`,to:`/projects/$projectId`,params:{projectId:e},children:[`Project `,t+1]},e))}):`No projects`},t.id))})})]})}function gfe({schedule:e,paused:t,onAction:n}){let{api:r}=R();return qb({id:`schedules.pause-resume`,title:t?`Resume schedule`:`Pause schedule`,group:`Schedules`,context:e.name,run:()=>n(()=>xH(r,e.id,t?`resume`:`pause`,e.version))}),null}var m0=`https://www.youtube.com/upload`,_fe=[`video`,`title`,`description`,`thumbnails`,`playlist`,`audience`,`altered`,`tags`,`schedule`];function vfe(e){return e.join(`, `)}var h0=[.75,1,1.25,1.5,1.75,2];function g0(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${String(n)}:${String(r).padStart(2,`0`)}:${i}`:`${String(r)}:${i}`}function _0(e){return`${String(e)}×`}function yfe(e,t){return e.filter(e=>e.start<=t).at(-1)}function v0(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}var y0=(e,t,n)=>Math.min(n,Math.max(t,e));function b0(){let e=(0,m.useRef)(null),t=(0,m.useId)(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(0),[c,l]=(0,m.useState)(0),[u,d]=(0,m.useState)(1),[f,p]=(0,m.useState)(!1),[h,g]=(0,m.useState)(1),[_,v]=(0,m.useState)(!1),[y,b]=(0,m.useState)(null),[x,S]=(0,m.useState)(!1),C=Number.isFinite(o)&&o>0,w=()=>{let t=e.current;t!==null&&(t.paused||t.ended?t.play()?.catch(()=>void 0):t.pause())},T=t=>{let n=e.current;if(n===null||!C)return;let r=y0(t,0,o);n.currentTime=r,a(r)},E=t=>T((e.current?.currentTime??i)+t),D=t=>{let n=e.current;if(n===null)return;let r=y0(Math.round(t*100)/100,0,1);n.volume=r,n.muted=r===0,d(r),p(r===0)},O=()=>{let t=e.current;t!==null&&(t.muted=!t.muted,p(t.muted))};return{media:e,menuId:t,playing:n,current:i,duration:o,buffered:c,known:C,volume:u,muted:f,rate:h,menu:_,setMenu:v,hover:y,setHover:b,seeking:x,setSeeking:S,toggle:w,seekTo:T,jump:E,setLevel:D,toggleMute:O,pickRate:n=>{let r=e.current;r!==null&&(r.playbackRate=n),g(n),v(!1),document.getElementById(`${t}-button`)?.focus()},keyAction:e=>{let t=e.length===1?e.toLowerCase():e;if(t===` `||t===`k`)return w;if(t===`j`)return()=>E(-10);if(t===`l`)return()=>E(10);if(t===`ArrowLeft`)return()=>E(-5);if(t===`ArrowRight`)return()=>E(5);if(t===`m`)return O;if(/^[0-9]$/.test(t))return()=>T(Number(t)/10*o)},events:{onPlay:()=>r(!0),onPause:()=>r(!1),onEnded:()=>r(!1),onTimeUpdate:e=>{x||a(e.currentTarget.currentTime)},onDurationChange:e=>s(e.currentTarget.duration),onLoadedMetadata:e=>s(e.currentTarget.duration),onProgress:e=>{let t=e.currentTarget.buffered;l(t.length>0?t.end(t.length-1):0)},onVolumeChange:e=>{d(e.currentTarget.volume),p(e.currentTarget.muted)},onRateChange:e=>g(e.currentTarget.playbackRate)}}}function x0(e,t){let n=e?.getBoundingClientRect();return n===void 0||n.width===0?0:y0((t-n.left)/n.width,0,1)}function S0(e,t){t!==void 0&&(e.preventDefault(),e.stopPropagation(),t())}function C0({controls:e,className:t}){return(0,h.jsx)(ly,{size:`small`,label:e.playing?`Pause`:`Play`,className:t,onClick:e.toggle,children:e.playing?(0,h.jsx)(Hc,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(Gc,{"aria-hidden":`true`,strokeWidth:1.75})})}function w0({controls:e}){return(0,h.jsxs)(`span`,{className:`sl-player__time`,children:[(0,h.jsx)(`span`,{className:`sl-player__now`,children:g0(e.current)}),(0,h.jsx)(`span`,{className:`sl-player__total`,children:` / ${e.known?g0(e.duration):`-:--`}`})]})}function T0({controls:e,chapters:t=[],waveform:n}){let r=(0,m.useRef)(null),{known:i,duration:a,current:o,buffered:s,seeking:c,hover:l}=e,u=Sfe(r),d=n===void 0?void 0:xfe(n,u),f=i?t.filter(e=>e.start>0&&e.start<a):[],p=t=>{i&&(t.currentTarget.setPointerCapture?.(t.pointerId),e.setSeeking(!0),e.seekTo(x0(r.current,t.clientX)*a))},g=t=>{let n=x0(r.current,t.clientX);e.setHover(n),c&&e.seekTo(n*a)},_=t=>{t.currentTarget.releasePointerCapture?.(t.pointerId),e.setSeeking(!1)},v=t=>{S0(t,{ArrowLeft:()=>e.jump(-5),ArrowDown:()=>e.jump(-5),ArrowRight:()=>e.jump(5),ArrowUp:()=>e.jump(5),PageDown:()=>e.jump(-10),PageUp:()=>e.jump(10),Home:()=>e.seekTo(0),End:()=>e.seekTo(a)}[t.key])},y=i?o/a*100:0,b=i?s/a*100:0,x=l===null||!i?void 0:l*a,S=x===void 0?void 0:yfe(t,x);return(0,h.jsxs)(`div`,{ref:r,role:`slider`,tabIndex:0,"aria-label":`Seek`,"aria-valuemin":0,"aria-valuemax":i?Math.floor(a):0,"aria-valuenow":Math.floor(o),"aria-valuetext":`${g0(o)} of ${i?g0(a):`unknown length`}`,"aria-disabled":!i,className:`sl-player__track`,onPointerDown:p,onPointerMove:g,onPointerUp:_,onPointerCancel:_,onPointerLeave:()=>e.setHover(null),onKeyDown:v,children:[d===void 0||d.length===0?(0,h.jsxs)(`span`,{className:`sl-player__rail`,children:[(0,h.jsx)(`span`,{className:`sl-player__buffered`,style:{width:`${String(b)}%`}}),(0,h.jsx)(`span`,{className:`sl-player__played`,style:{width:`${String(y)}%`}})]}):(0,h.jsx)(`span`,{className:`sl-player__wave`,"data-slot":`waveform`,"aria-hidden":`true`,children:d.map((e,t)=>(0,h.jsx)(`span`,{className:`sl-player__peak`,"data-played":(t+.5)/d.length*100<=y?``:void 0,style:{height:`${String(Math.max(12,Math.round(e*100)))}%`}},t))}),f.map(e=>(0,h.jsx)(`span`,{className:`sl-player__mark`,"data-chapter":e.title,title:e.title,style:{left:`${String(e.start/a*100)}%`}},`${String(e.start)}-${e.title}`)),(0,h.jsx)(`span`,{className:`sl-player__knob`,style:{left:`${String(y)}%`}}),x===void 0||l===null?null:(0,h.jsxs)(`span`,{className:`sl-player__tip`,"aria-hidden":`true`,style:{left:`${String(l*100)}%`},children:[S===void 0?null:(0,h.jsx)(`span`,{className:`sl-player__tip-title`,children:S.title}),g0(x)]})]})}function E0({controls:e}){let t=(0,m.useRef)(null),{muted:n,volume:r}=e,i=n?0:r;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ly,{size:`small`,label:n?`Unmute`:`Mute`,"aria-pressed":n,className:`sl-player__mute`,onClick:e.toggleMute,children:n||r===0?(0,h.jsx)(rl,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(nl,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(`div`,{ref:t,role:`slider`,tabIndex:0,"aria-label":`Volume`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i*100),"aria-valuetext":n?`Muted`:`${String(Math.round(i*100))}%`,className:`sl-player__volume`,onPointerDown:n=>{n.currentTarget.setPointerCapture?.(n.pointerId),e.setLevel(x0(t.current,n.clientX))},onPointerMove:n=>{n.buttons===1&&e.setLevel(x0(t.current,n.clientX))},onKeyDown:t=>{let n={ArrowLeft:i-.05,ArrowDown:i-.05,ArrowRight:i+.05,ArrowUp:i+.05,Home:0,End:1}[t.key];S0(t,n===void 0?void 0:()=>e.setLevel(n))},children:(0,h.jsx)(`span`,{className:`sl-player__rail`,children:(0,h.jsx)(`span`,{className:`sl-player__played`,style:{width:`${String(i*100)}%`}})})})]})}function D0({controls:e}){let{menuId:t,menu:n,rate:r}=e;return(0,h.jsxs)(`span`,{className:`sl-player__speed`,children:[(0,h.jsx)(L,{id:`${t}-button`,variant:`quiet`,size:`small`,className:`sl-player__rate`,"aria-label":`Playback speed, ${_0(r)}`,"aria-haspopup":`menu`,"aria-expanded":n,"aria-controls":n?`${t}-menu`:void 0,onClick:()=>e.setMenu(e=>!e),children:_0(r)}),n?(0,h.jsx)(`div`,{id:`${t}-menu`,role:`menu`,"aria-label":`Playback speed`,className:`sl-player__menu`,onKeyDown:n=>{if(n.key===`Escape`){S0(n,()=>{e.setMenu(!1),document.getElementById(`${t}-button`)?.focus()});return}if(n.key!==`ArrowDown`&&n.key!==`ArrowUp`)return;let r=[...n.currentTarget.querySelectorAll(`[role=menuitemradio]`)],i=r[(r.indexOf(document.activeElement)+(n.key===`ArrowDown`?1:-1)+r.length)%r.length];S0(n,()=>i?.focus())},children:h0.map(t=>(0,h.jsx)(L,{variant:`quiet`,size:`small`,role:`menuitemradio`,"aria-checked":t===r,className:I(`sl-player__option`),autoFocus:t===r,onClick:()=>e.pickRate(t),children:t===1?`Normal`:_0(t)},t))}):null]})}var bfe=4;function xfe(e,t){let n=Math.floor(t/bfe);if(n<=0||e.length<=n)return e;let r=[];for(let t=0;t<n;t+=1){let i=Math.floor(t*e.length/n),a=Math.max(i+1,Math.floor((t+1)*e.length/n));r.push(Math.max(...e.slice(i,a)))}return r}function Sfe(e){let[t,n]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let t=e.current;if(t===null||(n(t.clientWidth),typeof ResizeObserver>`u`))return;let r=new ResizeObserver(()=>n(t.clientWidth));return r.observe(t),()=>r.disconnect()},[e]),t}var Cfe=2500;function O0({src:e,poster:t,label:n,portrait:r=!1,square:i=!1,captions:a,chapters:o=[],ref:s,className:c,children:l}){let u=b0(),d=u.media,f=(0,m.useRef)(null),p=(0,m.useRef)(void 0),[g,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),[b,x]=(0,m.useState)(0),[S,C]=(0,m.useState)(!1),[w,T]=(0,m.useState)(!1),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(!0),{playing:A,menu:ee,seeking:te,hover:ne,events:j}=u,re=a!==void 0||b>0,M=typeof document<`u`&&`pictureInPictureEnabled`in document&&document.pictureInPictureEnabled===!0,ie=(0,m.useCallback)(()=>{k(!0),clearTimeout(p.current),p.current=setTimeout(()=>k(!1),Cfe)},[]);(0,m.useEffect)(()=>()=>clearTimeout(p.current),[]);let ae=A&&!O&&!ee&&!E&&!te&&ne===null;(0,m.useEffect)(()=>{let e=()=>C(document.fullscreenElement===f.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,m.useEffect)(()=>{let e=d.current;if(e===null)return;let t=()=>T(!0),n=()=>T(!1);return e.addEventListener(`enterpictureinpicture`,t),e.addEventListener(`leavepictureinpicture`,n),()=>{e.removeEventListener(`enterpictureinpicture`,t),e.removeEventListener(`leavepictureinpicture`,n)}},[d]),(0,m.useEffect)(()=>{let e=d.current?.textTracks;if(e!==void 0)for(let t=0;t<e.length;t+=1){let n=e[t];n!==void 0&&(n.mode=v&&t===0?`showing`:`hidden`)}},[v,d]);let oe=()=>{let e=d.current;e!==null&&(e.paused||e.ended)&&_(!0),u.toggle()},se=()=>{let e=f.current;e!==null&&(document.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.()?.catch(()=>void 0))},ce=()=>{let e=d.current;e!==null&&(document.pictureInPictureElement===e?document.exitPictureInPicture?.().catch(()=>void 0):e.requestPictureInPicture?.().catch(()=>void 0))};return(0,h.jsxs)(`div`,{ref:f,"data-slot":`player`,"data-state":A?`playing`:`paused`,className:I(`sl-player`,r&&`sl-player--portrait`,i&&`sl-player--square`,ae&&`sl-player--bare`,S&&`sl-player--full`,c),onKeyDown:e=>{if(e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.closest(`button`)!==null,n=e.key.length===1?e.key.toLowerCase():e.key,r=n===` `&&t?void 0:n===` `||n===`k`?oe:n===`f`?se:n===`c`?re?()=>y(e=>!e):void 0:u.keyAction(n);r!==void 0&&(e.preventDefault(),e.stopPropagation(),ie(),r())},onPointerMove:ie,onPointerDown:ie,onFocus:()=>D(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(D(!1),u.setMenu(!1))},children:[(0,h.jsxs)(`video`,{ref:v0(d,s),src:e,poster:t,preload:`metadata`,playsInline:!0,"aria-label":n,onClick:oe,...j,onPlay:e=>{j.onPlay(e),_(!0),ie()},onPause:e=>{j.onPause(e),k(!0)},onEnded:e=>{j.onEnded(e),k(!0)},onLoadedMetadata:e=>{j.onLoadedMetadata(e),x(e.currentTarget.textTracks?.length??0)},children:[a===void 0?null:(0,h.jsx)(`track`,{kind:`captions`,src:a.src,srcLang:a.lang,label:a.label}),l]}),g?null:(0,h.jsx)(ly,{label:`Play ${n}`,className:`sl-player__big`,onClick:oe,children:(0,h.jsx)(Gc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsxs)(`div`,{className:`sl-player__bar`,role:`group`,"aria-label":`${n} controls`,children:[(0,h.jsx)(C0,{controls:{...u,toggle:oe}}),(0,h.jsx)(w0,{controls:u}),(0,h.jsx)(T0,{controls:u,chapters:o}),(0,h.jsx)(E0,{controls:u}),(0,h.jsx)(D0,{controls:u}),re?(0,h.jsx)(ly,{size:`small`,label:`Captions`,"aria-pressed":v,onClick:()=>y(e=>!e),children:(0,h.jsx)(xc,{"aria-hidden":`true`,strokeWidth:1.75})}):null,M?(0,h.jsx)(ly,{size:`small`,label:`Picture in picture`,"aria-pressed":w,className:`sl-player__pip`,onClick:ce,children:(0,h.jsx)(Wc,{"aria-hidden":`true`,strokeWidth:1.75})}):null,(0,h.jsx)(ly,{size:`small`,label:S?`Exit full screen`:`Full screen`,"aria-pressed":S,onClick:se,children:S?(0,h.jsx)(Vc,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(Bc,{"aria-hidden":`true`,strokeWidth:1.75})})]})]})}var wfe={landscape:void 0,portrait:`sl-media__frame--portrait`,square:`sl-media__frame--square`};function k0({src:e,alt:t,kind:n=`image`,poster:r,aspect:i=`landscape`,title:a,meta:o,badge:s,actions:c,actionsShown:l=!1,generating:u,onOpen:d,openLabel:f,className:p}){let m=u==null||u===!1;return(0,h.jsxs)(`figure`,{className:I(`sl-media m-0`,p),"data-slot":`media-frame`,children:[(0,h.jsxs)(`div`,{className:I(`sl-media__frame`,wfe[i]),children:[m&&e!==void 0?n===`video`?(0,h.jsx)(`video`,{src:e,poster:r,muted:!0,preload:`metadata`,"aria-label":t}):(0,h.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`}):null,m?null:(0,h.jsxs)(`div`,{className:`sl-media__generating`,role:`status`,children:[(0,h.jsx)(Ux,{tone:`running`}),(0,h.jsx)(`span`,{children:u})]}),s===void 0?null:(0,h.jsx)(`span`,{className:`sl-media__badge`,children:s}),c===void 0?null:(0,h.jsx)(`div`,{className:I(`sl-media__actions`,l&&`sl-media__actions--shown`),children:c})]}),d!==void 0&&m&&e!==void 0?(0,h.jsx)(`button`,{type:`button`,className:`sl-media__open`,"aria-label":f??`Open ${t} full size`,onClick:d}):null,a===void 0&&o===void 0?null:(0,h.jsxs)(`figcaption`,{className:`sl-media__caption`,children:[a===void 0?(0,h.jsx)(`span`,{}):(0,h.jsx)(`strong`,{className:`min-w-0 truncate`,children:a}),o===void 0?null:(0,h.jsx)(`span`,{className:`shrink-0`,children:o})]})]})}function A0({shorts:e=!1,density:t=`default`,list:n=!1,className:r,children:i,label:a}){let o=I(`sl-grid`,e&&`sl-grid--shorts`,t===`compact`&&`sl-grid--compact`,n&&`m-0 list-none p-0`,r);return n?(0,h.jsx)(`ul`,{"aria-label":a,className:o,"data-slot":`media-grid`,children:i}):(0,h.jsx)(`section`,{"aria-label":a,className:o,"data-slot":`media-grid`,children:i})}function j0({items:e,index:t,onIndex:n,onClose:r,actions:i}){let a=t===null?void 0:e[t],o=e.length,s=e=>{t!==null&&o!==0&&n((t+e+o)%o)};return(0,h.jsx)(km,{open:a!==void 0,onOpenChange:e=>{e||r()},children:(0,h.jsx)(Mm,{children:(0,h.jsx)(Lm,{className:`sl-lightbox sl-enter`,onKeyDown:e=>{e.key===`ArrowRight`?(e.preventDefault(),s(1)):e.key===`ArrowLeft`&&(e.preventDefault(),s(-1))},"aria-describedby":void 0,children:a===void 0||t===null?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`sl-lightbox__bar`,children:[(0,h.jsx)(Hm,{className:`m-0 text-small font-semibold`,children:`${String(t+1)} of ${String(o)} · ${a.alt}`}),(0,h.jsxs)(`div`,{className:`sl-btn-row`,children:[i?.(a,t),(0,h.jsx)(ly,{label:`Previous`,onClick:()=>s(-1),disabled:o<2,children:(0,h.jsx)(wc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(ly,{label:`Next`,onClick:()=>s(1),disabled:o<2,children:(0,h.jsx)(Tc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Wm,{asChild:!0,children:(0,h.jsx)(ly,{label:`Close`,children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})})]})]}),(0,h.jsx)(`div`,{className:`sl-lightbox__stage`,children:a.kind===`video`?(0,h.jsx)(O0,{src:a.src,label:a.alt,className:`sl-lightbox__player`,...a.poster===void 0?{}:{poster:a.poster}},a.src):(0,h.jsx)(`img`,{src:a.src,alt:a.alt},a.src)}),a.caption===void 0?(0,h.jsx)(`span`,{}):(0,h.jsx)(`p`,{className:`sl-lightbox__caption`,children:a.caption})]})})})})}var M0={location:fO(`docker-host`),path:U().min(1)},N0=oO([K({opened:fO(!0)}).strict(),K({opened:fO(!0),...M0}).strict(),K({opened:fO(!1),...M0}).strict()]),P0=sO(`kind`,[K({kind:fO(`allAffected`)}).strict(),K({kind:fO(`selected`),workKeys:G(U().min(1).max(200)).min(1).max(1e4)}).strict()]),F0=U().min(1).max(64),Tfe=K({baseRevisionId:F0,request:P0}).strict(),Efe=K({baseRevisionId:F0,idempotencyKey:eO(),previewId:U().min(1).max(64),acknowledgeUnknownCosts:rO(),confirmedProvidedWorkKeys:G(U().min(1).max(200)).max(1e4)}).strict(),Dfe=K({stage:U(),low:W().finite().nonnegative().nullable(),high:W().finite().nonnegative().nullable(),detail:U(),onPlan:rO().optional(),apiLow:W().finite().nonnegative().nullable().optional(),apiHigh:W().finite().nonnegative().nullable().optional()}),Ofe=K({currency:fO(`USD`),rows:G(Dfe),low:W().finite().nonnegative(),high:W().finite().nonnegative(),unknown:W().int().nonnegative(),apiLow:W().finite().nonnegative().optional(),apiHigh:W().finite().nonnegative().optional(),apiUnknown:W().int().nonnegative().optional(),expectedWords:W().finite().nonnegative(),catalogueDate:U().nullable(),assumptions:G(U())}),I0=K({revisionId:F0,admissionId:U().min(1).max(64),workIds:G(U().min(1).max(64)),replayed:rO()}),kfe=K({id:U().min(1).max(64),projectId:U().min(1).max(64),baseRevisionId:F0,planFingerprint:U().min(1),selection:P0,changedInputs:G(K({path:U(),before:U().nullable(),after:U().nullable()})),work:G(K({key:U(),stage:q(cS),kind:q([`provider`,`local`,`provided`]),disposition:q([`reuse`,`generate`,`local`,`review`,`blocked`]),requestFingerprint:U(),fingerprint:U(),dependsOn:G(U()),reason:U(),inflight:rO(),pieceIds:G(U())})),retained:G(K({slot:U(),outputId:U(),assetId:U(),state:q([`ready`,`outdated`,`review`])})),providedReuseRequired:G(U()),costs:Ofe,wholeRequestNotice:U().nullable(),warnings:G(U()),review:K({inputChanges:G(K({label:U(),before:U().nullable(),after:U().nullable()})),requests:G(K({key:U(),label:U(),text:U().nullable(),settings:U().nullable()}))}).optional()}),L0=[`chapter`,`chunk`,`segment`,`image`,`prompt_written`,`article_written`],R0=[`pending`,`running`,`done`,`failed`];K({id:U(),stage_id:U(),kind:q(L0),idx:W(),state:q(R0),payload:U().nullable()});var Afe=`notes.article_md.article_txt.narration_txt.tts_script.sources.glossary.audio_body.audio_intro.audio_outro.audio_export.image.thumbnail.video.render_params.subtitles_srt.subtitles_vtt.subtitle_words.subtitle_ass.subtitle_font.instructions.document_pdf.youtube_description.youtube_tags.youtube_pinned_comment.youtube_titles.shorts.short_image.short_video.animated_image.figure_card.reference.script_md.audio_mp3.audio_m4b.audio_levelled`.split(`.`),jfe=[`copying`,`staged`],Mfe=K({segment:q([`body`,`intro`,`outro`]).optional(),subtitleOmissions:G(K({start:W().finite().nonnegative(),text:U()})).optional(),subtitlesMode:q([`off`,`files`,`burn-in`]).optional(),promptName:U().optional(),prompt:U().optional(),index:W().optional(),short:W().optional(),format:q([`16:9`,`9:16`,`1:1`]).optional(),sentences:Qre([W(),W()]).optional(),warnings:G(U()).optional(),provider:U().optional(),model:U().optional(),voice:U().optional(),loudness:K({pieces:W(),skipped:W(),spreadBefore:W(),spreadAfter:W(),target:W()}).optional(),master:K({target:W(),integrated:W(),truePeak:W()}).optional()}),Nfe=K({id:U(),projectId:U(),stageKind:q(cS),role:q(Afe),path:U(),originalFilename:U().nullable(),bytes:W().nonnegative(),durationMs:W().nonnegative().nullable(),meta:Mfe,createdAt:U()});K({id:U(),stageKind:q(cS),path:U(),originalFilename:U(),bytes:W().nonnegative(),state:q(jfe),createdAt:U()});var z0=U().min(1).max(64).regex(/^[0-9A-Za-z_-]+$/),B0=U().min(1).max(256),Pfe=lO(B0,z0),Ffe=K({id:z0,text:U().trim().min(1).max(1e4),start:W().finite().nonnegative(),end:W().finite().positive(),speaker:U().min(1).max(60).regex(/^[a-z0-9-]+$/).optional()}).strict().refine(e=>e.end>e.start,{path:[`end`],message:`The end time must be after the start time.`}),V0=K({articleMarkdown:U().max(5e5).optional(),articleEdited:rO().default(!1),provided:K({research:z0.optional(),article:z0.optional(),audio:z0.optional(),thumbnail:z0.optional(),reference:z0.optional()}).strict(),imageOrder:G(z0).max(240),imageDefinitions:lO(z0,K({source:q([`generate`,`provide`]),assetId:z0.nullable(),prompt:U().max(5e5).nullable(),templateKey:U().min(1).max(256).nullable().optional()}).strict()),narrationOverrides:lO(B0,sO(`kind`,[K({kind:fO(`asset`),assetId:z0}).strict(),K({kind:fO(`text`),text:U().trim().min(1).max(5e5),direction:U().trim().min(1).max(2e4).optional()}).strict()])),narrationSources:lO(B0,K({text:U().min(1).max(5e5),start:W().int().nonnegative().max(5e5),bodyFingerprint:U().regex(/^[0-9a-f]{64}$/u),chunkingFingerprint:U().regex(/^[0-9a-f]{64}$/u)}).strict()).refine(e=>Object.keys(e).length<=1e4&&Object.values(e).reduce((e,t)=>e+t.text.length,0)<=5e5,`Narration source bindings exceed the article limit.`).optional(),subtitleCues:K({audioFingerprint:U().min(1),cues:G(Ffe)}).strict().optional(),regenerationTokens:Pfe,promptTemplates:lO(U().min(1),U().max(5e5).nullable()),shortsMusic:z0.optional(),shortsRanges:lO(U().regex(/^[1-9]\d?$/u),K({first:W().int().positive(),last:W().int().positive(),pick:U().min(1).max(128)}).strict()).optional(),ambientBed:z0.optional()}).strict(),Ife=K({baseRevisionId:z0,idempotencyKey:z0,edit:K({config:YA.strict(),content:V0,regenerate:G(B0).optional(),uploads:G(K({stagedFileId:z0,destination:sO(`kind`,[K({kind:fO(`provided`),stage:q([`audio`,`thumbnail`,`reference`])}).strict(),K({kind:fO(`image`),imageKey:z0}).strict(),K({kind:fO(`narration`),key:B0}).strict(),K({kind:fO(`shortsMusic`)}).strict()])}).strict()).max(1e4).optional()}).strict()}).strict(),Lfe=K({baseRevisionId:z0,idempotencyKey:z0,targetRevisionId:z0}).strict(),Rfe=K({id:z0,projectId:z0,parentId:z0.nullable(),restoredFromId:z0.nullable(),config:YA,content:V0,fingerprints:lO(B0,U()),createdAt:U()}),zfe=K({id:z0,stageId:z0,kind:q(L0),idx:W().int(),state:q(R0),payload:U().nullable()}),Bfe=K({slot:U(),workKey:B0,assetId:z0,output:Nfe,fingerprint:U(),state:q([`ready`,`outdated`,`review`])}),Vfe=K({key:B0,stageKind:q(cS),piece:zfe,assetId:z0.nullable(),fingerprint:U()}),H0={recordId:z0,publicationId:z0.nullable(),selected:rO(),available:rO()},U0=K({articleMarkdown:U().nullable(),revision:Rfe,outputs:G(Bfe.extend(H0)),pieces:G(Vfe.extend(H0)),current:rO()}),Hfe=K({id:z0,parentId:z0.nullable(),restoredFromId:z0.nullable(),title:U(),createdAt:U(),current:rO()}),W0=K({ok:fO(!0),view:U0,duplicate:rO()}),Ufe=K({ok:fO(!0),view:U0,created:rO()}),Wfe=K({title:U(),status:W(),detail:U().optional(),reason:U().optional(),currentRevisionId:U().nullable().optional(),fields:G(K({field:U(),message:U()})).optional(),errors:G(K({path:U(),message:U()})).optional()});async function G0(e,t){let n;try{n=await e.json()}catch{throw mo(e,void 0)}if(e.ok)return{ok:!0,value:Co(t,n)};let r=Wfe.safeParse(n);if(!r.success)throw mo(e,void 0);let i=r.data;if(![400,404,409].includes(e.status))throw mo(e,{title:i.title,status:i.status,...i.detail===void 0?{}:{detail:i.detail},...i.fields===void 0?{}:{fields:i.fields}});return{ok:!1,reason:i.reason??`invalid-request`,message:i.detail??i.title,currentRevisionId:i.currentRevisionId??null,fields:i.fields??i.errors?.map(e=>({field:e.path,message:e.message}))??[]}}async function K0(e,t,n,r,i){return G0(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}${n}`,i===void 0?{method:`GET`}:{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(i)}),r)}function q0(e,t){return K0(e,t,`/revisions/prepare`,Ufe,{})}function J0(e,t,n){return K0(e,t,`/revisions`,W0,Ife.parse(n))}function Gfe(e,t,n){return K0(e,t,`/revisions/restore`,W0,Lfe.parse(n))}function Kfe(e,t){return K0(e,t,`/revisions`,K({revisions:G(Hfe)}))}function Y0(e,t,n){return K0(e,t,`/revisions/${encodeURIComponent(n)}`,K({view:U0}))}var X0=G(U()).readonly();function qfe(e,t,n){return K0(e,t,`/revisions/${encodeURIComponent(n)}/narration-chunks`,K({chunks:K({intro:X0.optional(),body:X0.optional(),outro:X0.optional()}).nullable()}))}function Jfe(e,t,n){return K0(e,t,`/rebuild/preview`,K({ok:fO(!0),value:kfe}),Tfe.parse(n))}function Yfe(e,t,n){return K0(e,t,`/rebuild`,K({ok:fO(!0),value:I0}),Efe.parse(n))}function Z0(e,t,n,r){return`${e.origin}/files/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}`}async function Xfe(e,t,n,r){let i=await G0(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}/open-folder`,{method:`POST`}),N0);if(!i.ok)throw Error(i.message);return i.value}function Zfe(e,t,n){return Z0(e,t,n,`images.zip`)}async function Q0(e,{projectId:t,asset:n,folder:r=null}){if(r)return Xfe(e,t,r.revisionId,r.recordId);let i=await e.client.projects[`:id`][`open-folder`].$post({param:{id:t},json:{asset:n}});if(!i.ok)throw mo(i,await ho(i));return N0.parse(await i.json())}var $0=`Slopify runs in Docker, which can't open windows on your desktop. Copy this path into your file manager. To have Open folder open it directly, run the Docker launcher again (npx @gentbajko/slopify@latest --docker) so it sets up the host helper.`;function e2(e){return(0,h.jsx)(Qfe,{...e},JSON.stringify([e.projectId,e.asset,e.folder?.revisionId,e.folder?.recordId]))}function Qfe(e){let{api:t}=R(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(),[o,s]=(0,m.useState)();async function c(){r(!0),a(void 0),s(void 0);try{let n=await Q0(t,e);n.opened||s(n.path)}catch(e){a(e instanceof Error?e.message:`The folder couldn't be opened. Press Open folder to try again.`)}finally{r(!1)}}return(0,h.jsxs)(ab,{open:o!==void 0||i!==void 0,onOpenChange:e=>{e||(s(void 0),a(void 0))},children:[(0,h.jsx)(Wte,{asChild:!0,children:(0,h.jsxs)(L,{variant:`secondary`,size:e.size??`default`,disabled:n,onClick:()=>void c(),title:`Locate the saved output folder on the machine running Slopify`,children:[(0,h.jsx)(Pc,{"aria-hidden":`true`,strokeWidth:1.75}),n?`Locating…`:o?`Locate folder`:`Open folder`]})}),(0,h.jsxs)(sb,{className:`flex flex-col gap-2`,children:[o===void 0?null:(0,h.jsxs)(`div`,{role:`status`,className:`flex min-w-0 flex-col gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:$0}),(0,h.jsx)(`input`,{"aria-label":`Saved folder path`,readOnly:!0,value:o,onFocus:e=>e.currentTarget.select(),className:`sl-input w-full min-w-0 font-mono text-small`})]}),i===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:i})]})]})}var $fe={chrome:`Chrome, Edge, Brave`,firefox:`Firefox`};function epe(){return typeof navigator<`u`&&/firefox/i.test(navigator.userAgent)?`firefox`:`chrome`}function t2(){let{api:e}=R(),[t,n]=(0,m.useState)(epe),r=`slopify-studio-${t}.zip`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(ub,{label:`Browser`,value:t,onChange:n,tip:`settings.studio.install`,options:[`chrome`,`firefox`].map(e=>({value:e,label:$fe[e]}))}),(0,h.jsxs)(Vx,{href:_s(e,t),download:r,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Download for ${t===`chrome`?`Chrome`:`Firefox`}`]})]}),(0,h.jsxs)(`ol`,{"aria-label":`Install steps`,className:`m-0 flex list-decimal flex-col gap-1 pl-5`,children:[t===`chrome`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`li`,{children:[`Press Download for Chrome, then unzip `,(0,h.jsx)(mV,{children:r}),` into a folder you keep: the browser loads the extension from there.`]}),(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(mV,{children:`chrome://extensions`}),` (Edge: `,(0,h.jsx)(mV,{children:`edge://extensions`}),`), turn on Developer mode, press Load unpacked and pick that folder.`]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`li`,{children:`Press Download for Firefox. It needs Firefox 128 or newer; keep the zip, you pick it in the next step.`}),(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(mV,{children:`about:debugging#/runtime/this-firefox`}),`, press Load Temporary Add-on and pick `,(0,h.jsx)(mV,{children:r}),`. Firefox removes it when it restarts; load it again then.`]})]}),(0,h.jsx)(`li`,{children:`Pair it: press Copy beside the pairing token in Settings → YouTube Studio, click the Slopify extension's toolbar button, paste the token and press Pair.`})]})]})}var tpe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],n2=K({day:W().int().min(0).max(6),time:U().regex(/^([01]\d|2[0-3]):[0-5]\d$/)}),npe=K({name:U().trim().min(1).max(20),series:U().trim().max(100).default(``),long:n2,shorts:G(n2).max(10)});K({timeZone:U().min(1).max(100),rows:G(npe).max(14)});var r2=[`studio`,`plan`],rpe=[`America/New_York`,`America/Los_Angeles`,`Europe/London`,`UTC`];function i2({slot:e,label:t,onChange:n}){return(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(pV,{"aria-label":`${t}: day`,className:`w-[92px]`,value:String(e.day),onChange:t=>n({...e,day:Number(t.currentTarget.value)}),options:tpe.map((e,t)=>({value:String(t),label:e}))}),(0,h.jsx)(Y,{"aria-label":`${t}: time`,type:`time`,className:`w-[132px]`,value:e.time,onChange:t=>n({...e,time:t.currentTarget.value||e.time})})]})}function ipe({autoComment:e}){let{api:t}=R(),n=_(),r=gy(),i=N({queryKey:r2,queryFn:()=>cs(t)}),[a,o]=(0,m.useState)(),s=a??i.data?.plan,c=P({mutationFn:e=>ls(t,e),onSuccess:e=>{n.setQueryData(r2,e),o(void 0),r(`Saved the posting plan.`,`success`)},onError:e=>r(`The posting plan wasn't saved: ${e.message}`,`error`)}),l=P({mutationFn:e=>us(t,e),onSuccess:e=>{n.setQueryData(r2,e),n.invalidateQueries({queryKey:[`studio`,`releases`]}),r(`Each upload is now due ${String(e.leadHours)} hours before its release.`,`success`)},onError:e=>r(`The lead time wasn't saved: ${e.message}`,`error`)}),u=P({mutationFn:e=>ps(t,e),onSuccess:()=>n.invalidateQueries({queryKey:[`studio`,`settings`]}),onError:e=>r(`Not saved: ${e.message}`,`error`)});if(s===void 0)return(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the posting plan…`});let d=e=>o(e),f=(e,t)=>d({...s,rows:s.rows.map((n,r)=>r===e?t:n)}),p=()=>{let e=new Set(s.rows.map(e=>e.name));for(let t=1;;t++)if(!e.has(String(t)))return String(t)},g=[...new Set([s.timeZone,...rpe])];return(0,h.jsxs)(`section`,{"aria-label":`Posting plan`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(V,{as:`h3`,title:`Posting plan`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`One line per long video you post each week, with its series and its shorts. A finished project takes the next free time of a line that takes its series (from its titles, the part after "|"); each short goes out the first time its day and hour come round after its own video, never in the same hour as another release. See and move them in Calendar → Releases.`}),s.rows.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`No posting plan yet, so nothing is scheduled. Press Add a long video to start.`}):(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-3 p-0`,children:s.rows.map((e,t)=>(0,h.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line pb-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold`,children:`Long video ${String(t+1)}`}),(0,h.jsx)(i2,{slot:e.long,label:`Long video ${String(t+1)}`,onChange:n=>f(t,{...e,long:n})})]}),(0,h.jsx)(pV,{"aria-label":`Long video ${String(t+1)}: series`,className:`w-[220px]`,value:e.series,onChange:n=>f(t,{...e,series:n.currentTarget.value}),options:[{value:``,label:`Any series`},...[...new Set([...i.data?.series??[],e.series])].filter(e=>e!==``).map(e=>({value:e,label:e}))]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(ly,{label:`Remove long video ${String(t+1)}`,onClick:()=>d({...s,rows:s.rows.filter((e,n)=>n!==t)}),children:(0,h.jsx)($c,{"aria-hidden":`true`,strokeWidth:1.75})})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-4`,children:[e.shorts.length===0?(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:`No shorts`}):null,e.shorts.map((t,n)=>({short:t,at:n,key:`${e.name}-${String(n+1)}`})).map(({short:n,at:r,key:i})=>(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:`Short ${String(r+1)}`}),(0,h.jsx)(i2,{slot:n,label:`Long video ${String(t+1)}, short ${String(r+1)}`,onChange:n=>f(t,{...e,shorts:e.shorts.map((e,t)=>t===r?n:e)})}),(0,h.jsx)(ly,{label:`Remove short ${String(r+1)} of long video ${String(t+1)}`,onClick:()=>f(t,{...e,shorts:e.shorts.filter((e,t)=>t!==r)}),children:(0,h.jsx)(il,{"aria-hidden":`true`,strokeWidth:1.75})})]},i)),(0,h.jsxs)(L,{type:`button`,variant:`quiet`,disabled:e.shorts.length>=10,onClick:()=>f(t,{...e,shorts:[...e.shorts,e.shorts.at(-1)??{...e.long}]}),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Short`]})]})]},e.name))}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsxs)(L,{type:`button`,variant:`quiet`,disabled:s.rows.length>=14,onClick:()=>d({...s,rows:[...s.rows,{name:p(),series:s.rows.at(-1)?.series??``,long:s.rows.at(-1)?.long??{day:0,time:`20:00`},shorts:[]}]}),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Add a long video`]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-small text-ink-2`,children:[`Times are in`,(0,h.jsx)(pV,{"aria-label":`The plan's time zone`,value:s.timeZone,onChange:e=>d({...s,timeZone:e.currentTarget.value}),options:g.map(e=>({value:e,label:e.replace(/_/g,` `)}))})]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(L,{type:`button`,disabled:a===void 0||c.isPending,onClick:()=>c.mutate(s),children:`Save posting plan`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-small text-ink-2`,children:[`Upload and schedule each video and short at least`,(0,h.jsx)(Y,{"aria-label":`Hours before release`,type:`number`,min:1,max:168,className:`w-[72px]`,defaultValue:i.data?.leadHours??24,onBlur:e=>{let t=Number(e.currentTarget.value);Number.isInteger(t)&&t>=1&&t<=168&&t!==i.data?.leadHours&&l.mutate(t)}},i.data?.leadHours??24),`hours before its release, so YouTube's copyright and ad checks finish while it is private.`]}),(0,h.jsx)(lb,{checked:e===!0,disabled:u.isPending||e===void 0,onChange:e=>u.mutate(e),label:`Post and pin each video's comment once it is public (the extension posts it in your name)`})]})}var a2=[`studio`,`settings`];function ape(){let{api:e}=R(),t=N({queryKey:a2,queryFn:()=>is(e)});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(V,{title:`Upload pack and extension`,info:`settings.studio.extension`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsx)(ope,{}),(0,h.jsx)(ipe,{autoComment:t.data?.autoComment??!1}),(0,h.jsx)(cpe,{}),(0,h.jsxs)(`section`,{"aria-label":`Install the Studio extension`,children:[(0,h.jsx)(V,{as:`h3`,title:`Install the Studio extension`,className:`mb-3`}),(0,h.jsx)(t2,{})]})]})]})}var o2=``;function ope(){let{api:e}=R(),t=_(),n=gy(),r=(0,m.useId)(),i=N({queryKey:a2,queryFn:()=>is(e)}),a=N(wb(e)),o=(0,m.useId)(),[s,c]=(0,m.useState)(o2),[l,u]=(0,m.useState)(void 0),d=i.data?.playlists??[],f=s===o2?void 0:i.data?.channelPlaylists[s],p=l??(s===o2?d:f??[]),g=spe(p),v=P({mutationFn:t=>as(e,t,s===o2?void 0:s),onSuccess:()=>{u(void 0),t.invalidateQueries({queryKey:a2}),n(`Playlists saved.`,`success`)}}),y=e=>{v.reset(),u(e)},b=g??v.error?.message,x=[{value:o2,label:`Every channel (default)`},...(a.data??[]).map(e=>({value:e.id,label:e.name}))];return(0,h.jsxs)(uV,{label:`Playlists`,tip:`settings.studio.playlist`,help:s===o2?`The playlists upload packs offer, for every channel without its own. Ticked ones are on for every project; Prepare upload changes them for one project.`:f===void 0&&d.length>0?`This channel uses the default list (${(e=>e.map(e=>e.name).join(`, `))(d)}) until you add its own.`:`This channel's own playlists. Ticked ones are on for every project; Prepare upload changes them for one project.`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(pV,{id:o,"aria-label":`Channel`,value:s,options:x,onChange:e=>{v.reset(),u(void 0),c(e.currentTarget.value)},className:`max-w-[260px]`}),p.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(Y,{autoComplete:`off`,"aria-label":`Playlist ${String(t+1)} name`,placeholder:`The playlist's name in Studio`,className:`min-w-0 flex-1 basis-[220px]`,value:e.name,disabled:i.data===void 0,"aria-invalid":e.name.trim().length>150,"aria-describedby":b===void 0?void 0:r,onChange:e=>y(p.map((n,r)=>r===t?{...n,name:e.target.value}:n))}),(0,h.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-accent)]`,checked:e.byDefault,onChange:e=>{let n=e.currentTarget.checked;y(p.map((e,r)=>r===t?{...e,byDefault:n}:e))}}),`On by default`]}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Remove ${e.name.trim()||`playlist ${String(t+1)}`}`,onClick:()=>y(p.filter((e,n)=>n!==t)),children:`Remove`})]},t)),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(L,{variant:`secondary`,disabled:i.data===void 0||p.length>=20,onClick:()=>y([...p,{name:``,byDefault:p.length===0}]),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Add playlist`]}),(0,h.jsx)(L,{variant:`primary`,disabled:v.isPending||l===void 0||g!==void 0,onClick:()=>v.mutate(p),children:`Save playlists`})]})]}),b===void 0?null:(0,h.jsx)(`p`,{id:r,role:`alert`,className:`m-0 text-small text-danger`,children:b})]})}function spe(e){if(e.find(e=>e.name.trim().length>150)!==void 0)return`A playlist name is longer than YouTube allows (150 characters). Shorten it.`;let t=new Set;for(let n of e){let e=n.name.trim().toLowerCase();if(e!==``){if(t.has(e))return`"${n.name.trim()}" is listed twice. Remove one.`;t.add(e)}}}function cpe(){let{api:e}=R(),t=_(),n=gy(),r=N({queryKey:a2,queryFn:()=>is(e)}),i=P({mutationFn:()=>bs(e),onSuccess:()=>{t.invalidateQueries({queryKey:a2}),n(`New pairing token made. Pair the extension again with it.`,`success`)}}),a=r.data?.pairing;return(0,h.jsxs)(`div`,{className:`sl-field`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`sl-field__label`,children:`Extension pairing token`}),(0,h.jsx)(B,{id:`settings.studio.pairing`,className:`-my-1`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`code`,{className:`sl-code min-w-0 flex-1 basis-[220px] truncate py-2 select-all`,children:a?.token??`…`}),(0,h.jsxs)(L,{variant:`quiet`,disabled:a===void 0,onClick:()=>{if(a!==void 0){if(!navigator.clipboard){n(`Couldn't copy the token. Select it and copy it.`,`error`);return}navigator.clipboard.writeText(a.token).then(()=>n(`Pairing token copied. Paste it into the extension's options.`,`success`),()=>n(`Couldn't copy the token. Select it and copy it.`,`error`))}},children:[(0,h.jsx)(kc,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Copy`]}),(0,h.jsx)(L,{variant:`quiet`,disabled:i.isPending||a===void 0,onClick:()=>i.mutate(),children:`New pairing token`})]}),(0,h.jsx)(`p`,{className:`sl-field__help m-0`,children:a?.origin==null?`No extension is paired. Paste this token into the Slopify Studio extension's options and press Pair.`:`Paired with the extension at ${a.origin}. A new token unpairs it.`}),i.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:i.error.message})]})}var s2=[`studio`,`queue`];function c2({projectId:e,ready:t,variant:n=`secondary`,size:r=`default`}){let[i,a]=(0,m.useState)(!1);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:n,size:r,disabled:!t,disabledReason:`Available once the video has been made`,onClick:()=>a(!0),children:`Prepare upload`}),i?(0,h.jsx)(f2,{projectId:e,onClose:()=>a(!1)}):null]})}var l2={video:`Video file`,title:`Title`,description:`Description`,thumbnails:`Thumbnail`,playlist:`Playlist`,audience:`Audience`,altered:`AI use (under Show more)`,tags:`Tags (under Show more)`,schedule:`Schedule (Visibility)`};function u2(e){return new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}function d2(e){return e.kind===`video`?`video`:`short-${String(e.short)}`}function f2({projectId:e,onClose:t}){let{api:n}=R(),r=_(),i=[`studio`,`pack`,e],a=N({queryKey:i,queryFn:()=>xs(n,e)}),[o,s]=(0,m.useState)(`video`),[c,l]=(0,m.useState)(),u=a.data?.items??[],d=u.find(e=>d2(e)===o)??u[0],f=N({queryKey:a2,queryFn:()=>is(n)}),p=f.data===void 0?void 0:f.data.pairing.origin!==null,g=N({queryKey:s2,queryFn:()=>vs(n)}),v=P({mutationFn:t=>Cs(n,e,t.short),onSuccess:e=>{r.setQueryData(s2,e),l({text:e.length>1?`Added; ${String(e.length)} uploads are waiting. Studio is opening: each upload you start there is filled with the next one, in the order under Waiting for Studio. Check everything and publish yourself.`:`Studio is opening. The Slopify Studio extension puts the video into its upload dialog and fills in the details. Check everything and publish yourself.`,tone:`success`})},onError:e=>l({text:`Couldn't hand this to the extension: ${e.message}`,tone:`error`})}),y=P({mutationFn:e=>ys(n,e.projectId,e.short),onSuccess:e=>r.setQueryData(s2,e),onError:e=>l({text:`Couldn't remove it from Waiting for Studio: ${e.message} Press Remove again.`,tone:`error`})}),b=P({mutationFn:t=>Ss(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved. The AI use answer is updated.`,tone:`success`})},onError:e=>l({text:`Couldn't save whether the clips are real footage: ${e.message} Press the switch again.`,tone:`error`})}),x=P({mutationFn:t=>os(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved this project's playlists.`,tone:`success`})},onError:e=>l({text:`Couldn't save the playlists: ${e.message} Tick the playlist again.`,tone:`error`})}),S=P({mutationFn:t=>ms(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved when this project goes out.`,tone:`success`})},onError:e=>l({text:`Couldn't change the slot: ${e.message} Choose it again.`,tone:`error`})}),C=P({mutationFn:t=>ss(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved what the upload uses.`,tone:`success`})},onError:e=>l({text:`Couldn't save the choice: ${e.message} Choose it again.`,tone:`error`})});return(0,h.jsxs)(UM,{open:!0,title:`Prepare upload`,onClose:t,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V1,{tone:c?.tone??`info`,children:c?.text}),p===!1?(0,h.jsx)(Vx,{href:m0,target:`_blank`,rel:`noopener noreferrer`,variant:`secondary`,children:`Open YouTube Studio`}):null,(0,h.jsx)(L,{variant:`primary`,disabled:d===void 0||v.isPending||p!==!0,disabledReason:p===!1?`Install and pair the Slopify Studio extension first (steps above)`:f.error===null?`Wait for the upload pack to load`:`Couldn't check whether the extension is paired: ${f.error.message} Close Prepare upload and open it again.`,onClick:()=>{d!==void 0&&(window.open(m0,`_blank`,`noopener`),v.mutate(d))},children:`Fill in YouTube Studio`}),(0,h.jsx)(B,{id:`project.upload.fill-studio`})]}),children:[a.error===null?null:(0,h.jsx)(pP,{tone:`danger`,title:`The upload pack couldn't be read.`,children:`${a.error.message} Close Prepare upload and open it again.`}),a.data===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[p===!1?(0,h.jsx)(pP,{tone:`waiting`,title:`The Slopify Studio extension isn't paired.`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:`Without it, the steps below are the upload pack: copy each into Studio's upload dialog. To have Studio filled in for you, install the extension:`}),(0,h.jsx)(t2,{})]})}):null,u.length>1?(0,h.jsx)(ub,{label:`What to upload`,value:d===void 0?``:d2(d),onChange:s,tip:`project.upload.item`,options:u.map(e=>({value:d2(e),label:e.kind===`video`?`Video`:`Short ${String(e.short)}`})),className:`self-start`}):null,a.data.missing.length===0?null:(0,h.jsx)(pP,{tone:`waiting`,title:`Some of it isn't made yet.`,children:(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.data.missing.map(e=>(0,h.jsx)(`li`,{children:e},e))})}),d===void 0?null:(0,h.jsx)(upe,{projectId:e,item:d,footageSwitch:d.kind===`video`&&a.data.footage!==void 0?(0,h.jsx)(lb,{checked:b.isPending?b.variables:a.data.footage.real,disabled:b.isPending,onChange:e=>b.mutate(e),tip:`project.upload.real-footage`,label:`The ${a.data.footage.clips===1?`uploaded clip is`:`${String(a.data.footage.clips)} uploaded clips are`} real footage (filmed, not made by AI)`}):void 0,playlistPicker:a.data.playlistChoices.length>1?(0,h.jsx)(`span`,{className:`flex flex-col gap-1`,children:a.data.playlistChoices.map(e=>(0,h.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-accent)]`,checked:e.chosen,disabled:x.isPending,onChange:t=>{let n=t.currentTarget.checked;x.mutate(a.data.playlistChoices.filter(t=>t.name===e.name?n:t.chosen).map(e=>e.name))}}),e.name]},e.name))}):void 0,copy:(e,t)=>{if(!navigator.clipboard){l({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`});return}navigator.clipboard.writeText(e).then(()=>l({text:`Copied the ${t}.`,tone:`success`}),()=>l({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`}))},onPick:e=>C.mutate(e),slotPicker:d.kind===`video`?(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,...cb,children:[(0,h.jsx)(pV,{"aria-label":`Posting plan slot`,value:a.data.schedule===void 0?``:`${a.data.schedule.row}|${a.data.schedule.longAt}`,disabled:S.isPending,onChange:e=>{let[t,n]=e.currentTarget.value.split(`|`);S.mutate(t===void 0||n===void 0?null:{row:t,longAt:n})},options:[{value:``,label:`Not scheduled (set it in Studio yourself)`},...a.data.schedule===void 0?[]:[{value:`${a.data.schedule.row}|${a.data.schedule.longAt}`,label:u2(a.data.schedule.longAt)}],...(a.data.slotChoices??[]).map(e=>({value:`${e.row}|${e.longAt}`,label:u2(e.longAt)}))]}),(0,h.jsx)(B,{id:`project.upload.slot`})]}):void 0,picking:C.isPending,doneKey:`slopify.upload.${e}.${d2(d)}`},d2(d)),(g.data??[]).length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Waiting for Studio`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:`Waiting for Studio`}),(0,h.jsx)(B,{id:`project.upload.queue`,className:`-my-1`})]}),(0,h.jsx)(iU,{label:`Waiting to be filled`,children:(g.data??[]).map((e,t)=>{let n=e.short===null?`Video`:`Short ${String(e.short)}`;return(0,h.jsx)(aU,{title:`${e.projectTitle} · ${n}`,meta:t===0?`Next: filled in the next upload dialog you open in Studio.`:`Filled after ${String(t)} more upload${t===1?``:`s`}.`,actions:(0,h.jsx)(L,{variant:`quiet`,size:`small`,disabled:y.isPending,"aria-label":`Remove ${e.projectTitle} ${n.toLowerCase()} from Waiting for Studio`,onClick:()=>y.mutate(e),children:`Remove`})},`${e.projectId}-${String(e.short)}`)})})]}),(0,h.jsx)(pP,{title:`Slopify never publishes.`,children:p===!1?`Copy each step into Studio's upload dialog (Open YouTube Studio), check it and press Publish yourself.`:`Fill in YouTube Studio hands this to the Slopify Studio extension, which puts the video into Studio's upload dialog and fills in the details. You check it and press Publish.`})]})]})}function lpe(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function p2({href:e,filename:t}){return(0,h.jsxs)(Vx,{href:e,download:t,"aria-label":`Download ${t}`,variant:`secondary`,size:`small`,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Download`]})}function upe({projectId:e,item:t,footageSwitch:n,playlistPicker:r,copy:i,onPick:a,picking:o,slotPicker:s,doneKey:c}){let{api:l}=R(),[u,d]=(0,m.useState)(()=>lpe(c)),[f,p]=(0,m.useState)(null),g=e=>{d(e);try{localStorage.setItem(c,JSON.stringify(e))}catch{}},_=(e,t)=>g(t?[...u,e]:u.filter(t=>t!==e)),v=_fe.filter(e=>e!==`thumbnails`||t.kind===`video`),y=v.filter(e=>u.includes(e)).length,b=e=>{let n=h2(t,e);return(0,h.jsxs)(L,{variant:`quiet`,size:`small`,disabled:n===``,disabledReason:`Nothing to copy yet`,"aria-label":`Copy ${l2[e].toLowerCase()}`,onClick:()=>i(n,l2[e].toLowerCase()),children:[(0,h.jsx)(kc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Copy`]})},x=c=>{switch(c){case`video`:return t.video===null?{value:(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not made yet.`})}:{value:t.video.filename,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p2,{href:`${l.origin}${t.video.url}`,filename:t.video.filename}),(0,h.jsx)(e2,{projectId:e,asset:t.video.asset,size:`small`})]})};case`thumbnails`:return t.thumbnails.length===0?{value:(0,h.jsx)(`span`,{className:`text-ink-3`,children:`None made.`})}:{value:t.thumbnails.length>1?`${m2(t.pickable?.thumbnail??0)} under Thumbnail (choose below). The A/B test tries all ${String(t.thumbnails.length)} once the video is public.`:t.thumbnails[0]?.filename??``,actions:(0,h.jsx)(e2,{projectId:e,asset:t.thumbnails[0]?.asset??`thumbnail`,size:`small`})};case`audience`:return{value:`No, it's not made for kids`};case`altered`:return{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:t.alteredContent.altered?`Yes`:`No`}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:t.alteredContent.why}),n]})};case`description`:return{value:t.chapterNotice===void 0?h2(t,c)||(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not written yet.`}):(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{children:t.description}),(0,h.jsx)(`span`,{className:`text-waiting`,children:t.chapterNotice})]}),actions:b(c)};case`title`:return t.titles.length===0||t.pickable===void 0?{value:h2(t,c),actions:b(c)}:{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{role:`radiogroup`,"aria-label":`Title the upload uses`,className:`flex flex-col gap-1`,children:t.pickable.titles.map((n,r)=>(0,h.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`radio`,name:`upload-title-${e}`,className:`size-4 accent-[var(--color-accent)]`,checked:r===t.pickable?.title,disabled:o,onChange:()=>a({title:r,thumbnail:t.pickable?.thumbnail??0})}),n]},n))}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:`The upload uses the chosen title; the A/B test tries the others beside it once the video is public.`})]}),actions:(0,h.jsxs)(h.Fragment,{children:[b(c),(0,h.jsxs)(L,{variant:`quiet`,size:`small`,"aria-label":`Copy the other titles`,onClick:()=>i(t.titles.join(`
|
|
272
272
|
`),`other titles`),children:[(0,h.jsx)(kc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Copy others`]})]})};case`schedule`:return{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[s,(0,h.jsx)(`span`,{className:`text-ink-2`,children:t.scheduleAt===void 0?`Not scheduled: Slopify has no slot for it. Set the date in Studio's Visibility step.`:`${u2(t.scheduleAt)}, your time. The extension types it into Studio's Visibility step; you press Schedule.`})]})};case`playlist`:return{value:r??(t.playlists.length>0?t.playlists.join(`, `):(0,h.jsx)(`span`,{className:`text-ink-3`,children:`None set (Settings → YouTube Studio).`})),actions:b(c)};default:return{value:h2(t,c)||(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not written yet.`}),actions:b(c)}}};return(0,h.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,h.jsxs)(`section`,{"aria-label":`In the order Studio asks`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:`In the order Studio asks`}),(0,h.jsx)(B,{id:`project.upload.steps`,className:`-my-1`}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsxs)(`label`,{className:`flex min-h-8 cursor-pointer items-center gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:y===v.length,ref:e=>{e!==null&&(e.indeterminate=y>0&&y<v.length)},onChange:e=>g(e.currentTarget.checked?[...v]:[]),className:`size-4 shrink-0 accent-[var(--color-accent)]`}),`Select all`]})]}),(0,h.jsx)(iU,{label:`Upload steps`,className:`[&_.sl-row__actions]:flex-wrap`,children:v.map(e=>{let{value:t,actions:n}=x(e);return(0,h.jsx)(aU,{className:`items-start`,lead:(0,h.jsx)(`input`,{type:`checkbox`,checked:u.includes(e),onChange:t=>_(e,t.currentTarget.checked),className:`mt-1 size-4 shrink-0 self-start accent-[var(--color-accent)]`,"aria-label":`${l2[e]} done`}),title:l2[e],meta:(0,h.jsx)(`span`,{className:`line-clamp-4 whitespace-pre-wrap break-words text-ink`,children:t}),actions:n},e)})})]}),t.thumbnails.length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Thumbnails`,children:[(0,h.jsx)(V,{as:`h3`,kicker:`Thumbnails · A/B Testing`,title:`${String(t.thumbnails.length)} ${t.thumbnails.length===1?`thumbnail`:`thumbnails`}`,className:`mb-3`}),(0,h.jsx)(A0,{label:`Thumbnails to upload`,density:`compact`,children:(t.pickable?.thumbnails??t.thumbnails).map((e,n)=>{let r=n===(t.pickable?.thumbnail??0);return(0,h.jsx)(k0,{src:`${l.origin}${e.url}`,alt:`Thumbnail ${m2(n)}`,title:r&&t.thumbnails.length>1?`${m2(n)} · upload`:m2(n),meta:e.filename,onOpen:()=>p(n),openLabel:`Open thumbnail ${m2(n)} full size`,actionsShown:!0,actions:(0,h.jsxs)(h.Fragment,{children:[r||t.pickable===void 0?null:(0,h.jsx)(L,{variant:`quiet`,size:`small`,disabled:o,onClick:()=>a({title:t.pickable?.title??0,thumbnail:n}),children:`Use for upload`}),(0,h.jsx)(p2,{href:`${l.origin}${e.url}`,filename:e.filename})]})},e.asset)})}),(0,h.jsx)(j0,{items:(t.pickable?.thumbnails??t.thumbnails).map((e,t)=>({src:`${l.origin}${e.url}`,alt:`Thumbnail ${String.fromCharCode(65+t)}`,caption:e.filename})),index:f,onIndex:p,onClose:()=>p(null),actions:(e,n)=>{let r=(t.pickable?.thumbnails??t.thumbnails)[n];return r===void 0?null:(0,h.jsx)(p2,{href:`${l.origin}${r.url}`,filename:r.filename})}})]})]})}function m2(e){return String.fromCharCode(65+e)}function h2(e,t){switch(t){case`title`:return e.title;case`description`:return e.description;case`tags`:return vfe(e.tags);case`playlist`:return e.playlists.join(`, `);default:return``}}var g2=[`studio`,`releases`],_2=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`}),dpe=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}),v2=e=>`${_2.format(new Date(e))}, ${dpe.format(new Date(e))}`;function fpe(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${String(t.getFullYear())}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function ppe(e){switch(e.state){case`scheduled`:return e.checks===`ok`?{tone:`neutral`,word:`✓ Scheduled · checks clear`}:e.checks===null?{tone:`info`,word:`✓ Scheduled · checks pending`}:{tone:`failed`,word:`Scheduled · ${e.checks}`};case`filled`:return{tone:`waiting`,word:`Filled in Studio, not scheduled`};case`late`:return{tone:`failed`,word:`Late · upload now`};case`not-ready`:return{tone:`neutral`,word:`Not rendered yet`};default:return{tone:`waiting`,word:e.uploadBy===null?`No time`:`Upload by ${v2(e.uploadBy)}`}}}function mpe(e,t){let n=new Date(e),r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-(n.getDay()+6)%7),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()-(t.getDay()+6)%7),a=Math.round((r.getTime()-i.getTime())/6048e5);return{key:r.toISOString(),label:a<=0?`This week`:a===1?`Next week`:`Week of ${_2.format(r)}`}}function hpe({item:e,projectId:t,onDone:n}){let{api:r}=R(),i=_(),a=gy(),[o,s]=(0,m.useState)(e.at===null?``:fpe(e.at)),c=P({mutationFn:n=>fs(r,t,{short:e.short,at:n}),onSuccess:()=>{i.invalidateQueries({queryKey:g2}),n()},onError:e=>a(`The time wasn't changed: ${e.message}`,`error`)}),l=e.short===0?`Long video`:`Short ${String(e.short)}`;return(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1`,children:[(0,h.jsx)(Y,{"aria-label":`${l}: release`,type:`datetime-local`,className:`w-[200px]`,value:o,onChange:e=>s(e.currentTarget.value)}),(0,h.jsx)(L,{type:`button`,size:`small`,disabled:o===``||c.isPending,onClick:()=>c.mutate(new Date(o).toISOString()),children:`Save`}),e.short===0?(0,h.jsx)(L,{type:`button`,size:`small`,variant:`quiet`,disabled:c.isPending,onClick:()=>c.mutate(null),children:`Not scheduled`}):null,(0,h.jsx)(L,{type:`button`,size:`small`,variant:`quiet`,onClick:n,children:`Cancel`})]})}function y2({item:e,projectId:t,editing:n,onEdit:r}){let i=ppe(e),a=n?.projectId===t&&n.short===e.short,o=e.short===0?`Long video`:`Short ${String(e.short)}`;return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:o}),e.short===0?null:(0,h.jsx)(`span`,{className:`w-full truncate text-small`,title:e.title,children:e.title}),a?(0,h.jsx)(hpe,{item:e,projectId:t,onDone:()=>r(void 0)}):(0,h.jsx)(L,{type:`button`,size:`small`,variant:`quiet`,"aria-label":`${o}: move from ${e.at===null?`no time`:v2(e.at)}`,onClick:()=>r({projectId:t,short:e.short}),children:e.at===null?`Set a time`:v2(e.at)}),(0,h.jsx)(Gx,{tone:i.tone,children:i.word})]})}function gpe({entry:e,candidates:t}){let{api:n}=R(),r=_(),i=gy(),a=t.filter(t=>e.series===``||t.series===e.series),[o,s]=(0,m.useState)(``),c=P({mutationFn:t=>fs(n,t,{short:0,at:e.at,...e.line===null?{}:{line:e.line}}),onSuccess:()=>void r.invalidateQueries({queryKey:g2}),onError:e=>i(`The project wasn't put there: ${e.message}`,`error`)});return a.length===0?(0,h.jsxs)(`span`,{className:`text-small text-ink-3`,children:[`Free · no finished project`,e.series===``?``:` of ${e.series}`,` waits for a time`]}):(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(pV,{"aria-label":`Project for ${v2(e.at)}`,className:`w-[260px]`,value:o,onChange:e=>s(e.currentTarget.value),options:[{value:``,label:`Free · pick a finished project`},...a.map(e=>({value:e.id,label:e.title}))]}),(0,h.jsx)(L,{type:`button`,size:`small`,disabled:o===``||c.isPending,onClick:()=>c.mutate(o),children:`Put it here`})]})}function _pe(){let{api:e}=R(),t=N({queryKey:g2,queryFn:()=>ds(e)}),[n,r]=(0,m.useState)();if(t.isPending)return(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the releases…`});if(t.isError)return(0,h.jsxs)(`p`,{className:`text-small text-danger`,children:[`The releases didn't load: `,t.error.message,` Reload the page to try again.`]});let i=t.data;if(i.entries.length===0)return(0,h.jsx)(J1,{title:`No releases in the next two weeks`,children:`Add your week in Settings → YouTube Studio → Posting plan: each finished project then takes its next free time, and its shorts the times after it. Or open a finished project's Prepare upload.`});let a=new Date,o=new Map;for(let e of i.entries){let t=mpe(e.at,a),n=o.get(t.key)??{label:t.label,entries:[]};n.entries.push(e),o.set(t.key,n)}return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Every video and short is due `,String(i.leadHours),` hours before its release, so YouTube's copyright and ad checks finish while it is private. Change that, or the weekly times, in`,` `,(0,h.jsx)(ha,{to:`/settings`,search:{section:`studio`},children:`Settings → YouTube Studio`}),`.`]}),[...o.values()].map(e=>(0,h.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-3`,children:[(0,h.jsx)(`h2`,{className:`sl-section-head__title m-0`,children:e.label}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.entries.map(e=>{let t=e.items.find(e=>e.short===0),a=e.items.filter(e=>e.short>0);return(0,h.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line pb-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:v2(e.at)}),e.series===``?null:(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:e.series}),e.project===null?null:(0,h.jsx)(ha,{to:`/projects/$projectId`,params:{projectId:e.project.id},children:e.project.title})]}),e.project===null?(0,h.jsx)(gpe,{entry:e,candidates:i.candidates}):(0,h.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-x-4 gap-y-3`,children:[t===void 0?null:(0,h.jsx)(y2,{item:t,projectId:e.project.id,editing:n,onEdit:r}),a.map(t=>(0,h.jsx)(y2,{item:t,projectId:e.project?.id??``,editing:n,onEdit:r},t.short))]})]},`${e.at}-${e.project?.id??`free`}`)})})]},e.label))]})}var b2=4;function vpe(e){return e===`schedules`?`schedules`:e===`releases`?`releases`:`weeks`}var x2=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`}),S2=new Intl.DateTimeFormat(void 0,{dateStyle:`full`}),C2=new Intl.DateTimeFormat(void 0,{timeStyle:`short`}),w2=`slopify.calendar.view`;function ype(){try{return window.localStorage.getItem(w2)===`list`?`list`:`weeks`}catch{return`weeks`}}function bpe({tab:e,schedule:t,onTab:n,onSchedule:r}={}){let{api:i}=R(),a=_(),o=Ub(),[s]=(0,m.useState)(()=>QH(new Date,b2)),[c,l]=(0,m.useState)(ype),[u,d]=(0,m.useState)(e??`weeks`),f=n===void 0?u:e??`weeks`,p=e=>{n===void 0?d(e):n(e)},[g,v]=(0,m.useState)(!1),y=N(LH(i,s.from,s.to)),b=N(_H(i)),x=N(Nq(i)),S=N(Gy(i)),[C,w]=(0,m.useState)(null),[T,E]=(0,m.useState)(null),D=(0,m.useMemo)(()=>new Map((x.data??[]).map(e=>[e.id,e.channelId])),[x.data]),O=(0,m.useMemo)(()=>new Map((S.data?.projects??[]).map(e=>[e.id,e.channelId])),[S.data]),k=(b.data??[]).filter(e=>o.includes(D.get(e.templateId))),A=y.data===void 0?void 0:{...y.data,runs:y.data.runs.filter(e=>o.includes(D.get(e.templateId))),projects:y.data.projects.filter(e=>o.includes(O.get(e.id)))},ee=(0,m.useMemo)(()=>A===void 0?new Map:ZH(A),[A]),te=A?.runs??[],ne=KH(A?.projects??[]),j=P({mutationFn:e=>e(),onSuccess:e=>w(e.ok?{tone:`info`,text:`Moved.`}:{tone:`error`,text:e.message}),onError:e=>w({tone:`error`,text:`The topic wasn't moved: ${e.message} Reload the calendar and try again.`}),onSettled:async()=>{await Promise.all([a.invalidateQueries({queryKey:IH}),a.invalidateQueries({queryKey:gH})])}}),re=e=>{if(e.kind!==`none`){if(e.kind===`refused`){w({tone:`error`,text:e.message});return}e.kind===`move`?j.mutate(()=>NH(i,e.scheduleId,{baseVersion:e.baseVersion,from:e.from,to:e.to})):j.mutate(()=>FH(i,e.scheduleId,{baseVersion:e.baseVersion,index:e.index,targetId:e.targetId,...e.position===void 0?{}:{position:e.position}}))}},M=(e,t)=>{let n=eU(te,e,t);if(n===void 0){w({tone:`error`,text:t===-1?`${tU(e)} is already the next topic of ${e.scheduleName}.`:`${tU(e)} is the last topic on the calendar for ${e.scheduleName}.`});return}re($H(e,n,S2.format(new Date(n.at))))},ie=e=>{l(e),f!==`weeks`&&p(`weeks`);try{window.localStorage.setItem(w2,e)}catch{}};qb({id:`calendar.add`,title:`Add to calendar`,group:`Calendar`,keywords:[`topics`,`batch`,`queue`],run:()=>v(!0)}),qb({id:`calendar.schedules`,title:`Show the schedules`,group:`Calendar`,keywords:[`edit`,`recurring`,`pause`,`resume`],run:()=>p(`schedules`)}),Sx(_x.addToCalendar,()=>v(!0)),qb({id:`calendar.weeks`,title:`Show the calendar as weeks`,group:`Calendar`,run:()=>ie(`weeks`)}),qb({id:`calendar.list`,title:`Show the calendar as a list`,group:`Calendar`,run:()=>ie(`list`)});let ae=k.reduce((e,t)=>e+(t.deletedAt===null?t.items.length:0),0),oe=C?.text??y.error?.message??b.error?.message,se=JH(new Date),ce=(b.data??[]).filter(e=>e.deletedAt===null).length;return(0,h.jsxs)(`div`,{"data-tour":`calendar`,children:[(0,h.jsx)(bq,{title:`Calendar`,meta:`${o.channel?.name??`Every channel`} · ${String(te.length)} scheduled ${te.length===1?`run`:`runs`} in the next ${String(b2)} weeks · ${String(ae)} ${ae===1?`topic`:`topics`} queued`,actions:f===`weeks`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ub,{label:`Calendar view`,tip:`planning.calendar.view`,value:c,onChange:ie,options:[{value:`weeks`,label:`Weeks`},{value:`list`,label:`List`}]}),(0,h.jsxs)(L,{variant:`primary`,onClick:()=>v(!0),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Add to calendar`]})]}):void 0}),(0,h.jsx)(K1,{items:[{id:`weeks`,label:`Coming weeks`},{id:`releases`,label:`Releases`},{id:`schedules`,label:`Schedules`,...b.data===void 0?{}:{badge:String(ce)}}],value:f,onChange:p,label:`Calendar sections`,idPrefix:`calendar`,className:`mb-6`}),(0,h.jsx)(q1,{idPrefix:`calendar`,id:`releases`,active:f===`releases`,children:f===`releases`?(0,h.jsx)(_pe,{}):null}),(0,h.jsx)(q1,{idPrefix:`calendar`,id:`schedules`,active:f===`schedules`,children:f===`schedules`?(0,h.jsx)(dfe,{pickedId:t,onPick:r}):null}),(0,h.jsxs)(q1,{idPrefix:`calendar`,id:`weeks`,active:f===`weeks`,children:[(0,h.jsx)(V1,{tone:C?.tone===`info`?`info`:oe?`error`:`info`,className:`mb-3`,children:oe}),(0,h.jsxs)(U1,{split:`aside`,className:`mb-6`,children:[(0,h.jsx)(W1,{label:`Needs you`,children:ne.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Nothing needs you right now.`}):(0,h.jsxs)(`section`,{"aria-label":`Needs you`,children:[(0,h.jsx)(V,{title:`Needs you`,meta:GH(ne)}),(0,h.jsx)(iU,{label:`Needs you`,children:ne.map(e=>(0,h.jsx)(D2,{project:e},e.id))})]})}),(0,h.jsx)(W1,{as:`aside`,label:`Suggested topics`,children:(0,h.jsx)(Wde,{schedules:k})})]}),(0,h.jsxs)(`section`,{"aria-label":`Coming weeks`,className:`flex min-w-0 flex-col gap-4`,children:[y.isPending?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Loading the calendar…`}):c===`weeks`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Drag a topic to another day to change when it runs, or onto another schedule's run to move it there. With the keyboard: focus a topic and press Alt+← or Alt+→.`}),XH(new Date(s.from),b2).map(e=>(0,h.jsx)(`div`,{className:`sl-cal-week`,children:e.map(e=>{let t=JH(e),n=ee.get(t);return(0,h.jsx)(xpe,{date:e,today:t===se,day:n,dragging:T,busy:j.isPending,onDragStart:E,onDragEnd:()=>E(null),onDrop:t=>{T!==null&&(re($H(T,t,S2.format(e))),E(null))},onStep:M},t)})},JH(e[0]??new Date)))]}):(0,h.jsx)(Cpe,{days:ee,busy:j.isPending,onStep:M,schedules:k,onTransfer:(e,t)=>{e.index!==null&&re({kind:`transfer`,scheduleId:e.scheduleId,baseVersion:e.scheduleVersion,index:e.index,targetId:t,position:void 0})}}),A!==void 0&&A.queued.length>0?(0,h.jsxs)(`section`,{"aria-label":`Batch queue`,children:[(0,h.jsx)(V,{title:`Batch queue`,meta:`${String(A.queued.length)} waiting to start`,info:`play.queue`}),(0,h.jsx)(iU,{label:`Batch queue`,children:A.queued.toSorted((e,t)=>e.position-t.position).map((e,t)=>{let n=A.projects.find(t=>t.id===e.projectId)?.state===`paused`;return(0,h.jsx)(aU,{title:(0,h.jsx)(ha,{to:`/projects/$projectId`,params:{projectId:e.projectId},children:e.title}),meta:`${String(t+1)} in line`,actions:(0,h.jsx)(Wx,{tone:n?`waiting`:e.state===`active`?`running`:`off`,children:n?`Paused`:e.state===`active`?`Running now`:`Waiting its turn`})},e.projectId)})})]}):null]})]}),(0,h.jsx)(zH,{open:g,onOpenChange:v,schedules:k})]})}function xpe({date:e,today:t,day:n,dragging:r,busy:i,onDragStart:a,onDragEnd:o,onDrop:s,onStep:c}){let[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(!1),p=n?.runs??[],g=n?.projects??[],_=d?g:g.slice(0,T2),v=()=>p.find(e=>e.scheduleId===r?.scheduleId)??p[0];return(0,h.jsxs)(`section`,{"aria-label":S2.format(e),className:I(`sl-cal-day`,t&&`sl-cal-day--today`,l&&`sl-cal-day--over`),onDragOver:e=>{r!==null&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,u(!0))},onDragLeave:()=>u(!1),onDrop:e=>{e.preventDefault(),u(!1),s(v())},children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:t?`Today · ${x2.format(e)}`:x2.format(e)}),p.map(e=>(0,h.jsx)(Spe,{run:e,busy:i,onDragStart:a,onDragEnd:o,onDrop:t=>{t.preventDefault(),t.stopPropagation(),u(!1),s(e)},onStep:c},`${e.scheduleId}-${e.at}`)),_.map(e=>{let t=WH(e);return(0,h.jsxs)(`div`,{className:`sl-cal-item sl-cal-item--project ${nU}`,children:[(0,h.jsx)(ha,{to:`/projects/$projectId`,params:{projectId:e.id},className:`text-small font-semibold ${rU}`,children:e.title}),(0,h.jsx)(Wx,{tone:t.tone,children:t.word})]},e.id)}),g.length>T2?(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-expanded":d,className:`self-start`,onClick:()=>f(e=>!e),children:d?`Show fewer`:`+${String(g.length-T2)} more`}):null]})}var T2=3;function Spe({run:e,busy:t,onDragStart:n,onDragEnd:r,onDrop:i,onStep:a}){let o=e.index!==null&&!t,s=tU(e);return(0,h.jsxs)(`article`,{tabIndex:e.index===null?void 0:0,"aria-label":`${s}, ${C2.format(new Date(e.at))}, ${e.scheduleName}${e.index===null?``:`. Alt+arrow keys move it.`}`,draggable:o,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,s),n(e)},onDragEnd:r,onDragOver:e=>e.preventDefault(),onDrop:i,onKeyDown:t=>{o&&t.altKey&&(t.key===`ArrowLeft`||t.key===`ArrowUp`?(t.preventDefault(),a(e,-1)):(t.key===`ArrowRight`||t.key===`ArrowDown`)&&(t.preventDefault(),a(e,1)))},className:I(`sl-cal-item`,o&&`sl-cal-item--movable`),children:[(0,h.jsx)(`span`,{className:`text-label text-ink-3 tabular-nums`,children:C2.format(new Date(e.at))}),(0,h.jsx)(`b`,{className:I(`text-small`,e.topic===null&&`font-normal text-ink-2`),children:s}),(0,h.jsx)(`span`,{className:`text-label text-ink-3`,children:e.scheduleName}),e.paused?(0,h.jsx)(Wx,{tone:`waiting`,children:`Paused`}):e.topicSource===`held`?(0,h.jsx)(Wx,{tone:`info`,children:`Needs a topic`}):e.prepared===null?(0,h.jsx)(Wx,{tone:`off`,children:`Queued`}):(0,h.jsx)(Wx,{tone:`info`,children:`Prepared`}),(0,h.jsx)(E2,{run:e,compact:!0})]})}function E2({run:e,compact:t=!1}){let{api:n}=R(),r=_(),[i,a]=(0,m.useState)(),o=P({mutationFn:async()=>{if(e.topic===null)throw Error(`This run has no topic to prepare yet.`);let t=await OH(n,e.scheduleId,e.topic);if(!t.ok)throw Error(t.message);return t.value},onSuccess:()=>{a(void 0),r.invalidateQueries({queryKey:IH}),r.invalidateQueries({queryKey:[`projects`]})},onError:e=>a(e.message)});return e.prepared===null?e.index===null||e.topic===null||e.topicSource!==`queued`?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{size:`small`,variant:t?`quiet`:`secondary`,disabled:o.isPending,onClick:e=>{e.stopPropagation(),o.mutate()},children:o.isPending?`Preparing…`:`Prepare`}),i===void 0?null:(0,h.jsx)(`span`,{role:`alert`,className:`text-label text-danger`,children:i})]}):(0,h.jsx)(zx,{to:`/projects/$projectId`,params:{projectId:e.prepared},size:`small`,variant:`quiet`,children:t?`Open`:`Open prepared`})}function D2({project:e}){let t=WH(e);return(0,h.jsx)(aU,{title:(0,h.jsx)(ha,{to:`/projects/$projectId`,params:{projectId:e.id},children:e.title}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Wx,{tone:t.tone,children:t.word}),t.action===void 0?null:t.action.kind===`upload`?(0,h.jsx)(c2,{projectId:e.id,ready:!0}):(0,h.jsx)(zx,{to:`/projects/$projectId`,params:{projectId:e.id},size:`small`,variant:`secondary`,children:t.action.label})]})})}function Cpe({days:e,busy:t,schedules:n,onStep:r,onTransfer:i}){let a=[...e.values()].sort((e,t)=>e.key.localeCompare(t.key));if(a.length===0)return(0,h.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Nothing is planned for the next `,b2,` weeks. Add topics with Add to calendar, or create a schedule on the`,` `,(0,h.jsx)(ha,{to:`/calendar`,search:{tab:`schedules`},children:`Schedules`}),` `,`tab.`]});let o=n.filter(e=>e.deletedAt===null&&(e.status===`active`||e.status===`paused`));return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,...cb,children:[(0,h.jsxs)(`p`,{className:`m-0 flex items-center gap-1 text-small text-ink-2`,children:[`Move a topic earlier, later or to another schedule from its row.`,(0,h.jsx)(B,{id:`planning.calendar.move`,className:`-my-1`})]}),a.map(e=>(0,h.jsxs)(`section`,{"aria-label":S2.format(e.date),children:[(0,h.jsx)(V,{title:S2.format(e.date),as:`h3`}),(0,h.jsxs)(iU,{label:`Planned on ${S2.format(e.date)}`,children:[e.runs.map(e=>{let n=tU(e),a=o.filter(t=>t.id!==e.scheduleId);return(0,h.jsx)(aU,{title:n,meta:`${C2.format(new Date(e.at))} · ${e.scheduleName}${e.templateName===null?``:` · ${e.templateName}`}${e.paused?` · Paused`:``}`,actions:e.index===null?void 0:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(E2,{run:e}),(0,h.jsx)(ly,{size:`small`,label:`Move ${n} earlier`,disabled:t,onClick:()=>r(e,-1),children:(0,h.jsx)(_c,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(ly,{size:`small`,label:`Move ${n} later`,disabled:t,onClick:()=>r(e,1),children:(0,h.jsx)(mc,{"aria-hidden":`true`,strokeWidth:1.75})}),a.length===0?null:(0,h.jsxs)(`select`,{"aria-label":`Move ${n} to another schedule`,className:`sl-select h-8 w-auto text-small`,value:``,disabled:t,onChange:t=>{t.target.value!==``&&i(e,t.target.value)},children:[(0,h.jsx)(`option`,{value:``,children:`Move to…`}),a.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})},`${e.scheduleId}-${e.at}`)}),e.projects.map(e=>(0,h.jsx)(D2,{project:e},e.id))]})]},e.key))]})}var wpe=rA.map(e=>({value:e,label:iA[e]}));function Tpe({channel:e}){let{api:t}=R(),n=_(),r=gy(),i=P({mutationFn:n=>Ib(t,e.id,n),onSuccess:async e=>{r(`YouTube AI disclosure set to ${iA[e.aiDisclosure]}.`,`success`),n.setQueryData(xb(e.id),t=>typeof t==`object`&&t&&`channel`in t?{...t,channel:{...t.channel,aiDisclosure:e.aiDisclosure}}:t),await n.invalidateQueries({queryKey:bb,exact:!0})}});return(0,h.jsxs)(`section`,{"aria-label":`YouTube AI disclosure`,className:`mb-6 max-w-3xl border-b border-line pb-5`,children:[(0,h.jsx)(uV,{label:`YouTube AI disclosure`,tip:`planning.channel.ai-disclosure`,help:`Mark voices in Settings → Voices and Image prompts in Library → Prompts.`,children:(0,h.jsx)(pV,{value:i.isPending?i.variables:e.aiDisclosure,options:wpe,disabled:i.isPending,onChange:e=>{let t=rA.find(t=>t===e.currentTarget.value);t!==void 0&&i.mutate(t)},className:`max-w-[260px]`})}),(0,h.jsx)(V1,{tone:`error`,children:i.error?`Couldn't save the YouTube AI disclosure: ${i.error.message}`:void 0})]})}function O2({value:e,onChange:t,inherited:n,label:r=`Language`,error:i,disabled:a=!1,tip:o=`play.language`}){let s=e??n?.language;return(0,h.jsx)(uV,{label:r,tip:o,help:Epe(s),error:i,children:(0,h.jsxs)(pV,{"data-play-field":`language`,value:e??(n===void 0?`en`:``),disabled:a,onChange:e=>t(e.target.value===``?void 0:xO.parse(e.target.value)),children:[n===void 0?null:(0,h.jsxs)(`option`,{value:``,children:[n.label,` (`,SO(n.language).name,`)`]}),bO.map(e=>(0,h.jsx)(`option`,{value:e.code,children:e.native===e.name?e.name:`${e.native} · ${e.name}`},e.code))]})})}function Epe(e){let t=SO(e);if(t.code===`en`)return`Everything is written and timed in English.`;let n=`The article, narration, YouTube description and Shorts titles are written in ${t.name}; pick a voice that speaks it.`,r=CO(t.code);return r===void 0?`${n} Captions are timed word by word with a free 248 MB model, downloaded the first time a ${t.name} project makes captions.`:`${n} ${r}`}function Dpe({rows:e,onChange:t}){let n=(n,r)=>t(e.map((e,t)=>t===n?{...e,...r}:e));return(0,h.jsxs)(`section`,{"aria-label":`Channel links`,...cb,children:[(0,h.jsx)(V,{title:`Channel links`,meta:`Write a link's name in braces in a description, such as {{Patreon}}.`,info:`planning.links.named`}),e.length===0?(0,h.jsx)(`p`,{className:`m-0 border-y border-line py-4 text-ink-2`,children:`No channel links yet. Add one, then write its name in braces in a description.`}):(0,h.jsx)(`ul`,{"aria-label":`Channel links`,className:`sl-list m-0 list-none p-0`,children:e.map((r,i)=>(0,h.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)] items-center gap-2 border-b border-line py-3 md:grid-cols-[220px_minmax(0,1fr)_auto]`,children:[(0,h.jsx)(Y,{"aria-label":`Name of link ${String(i+1)}`,placeholder:`Patreon`,value:r.name,onChange:e=>n(i,{name:e.currentTarget.value})}),(0,h.jsx)(Y,{"aria-label":`Address of link ${String(i+1)}`,type:`url`,placeholder:`https://`,value:r.url,onChange:e=>n(i,{url:e.currentTarget.value})}),(0,h.jsxs)(L,{variant:`quiet`,size:`small`,className:`justify-self-start`,"aria-label":`Remove link ${String(i+1)}`,onClick:()=>t(e.filter((e,t)=>t!==i)),children:[(0,h.jsx)($c,{"aria-hidden":`true`,className:`size-[14px]`}),`Remove`]})]},i))}),(0,h.jsx)(`div`,{className:`mt-3`,children:(0,h.jsxs)(L,{onClick:()=>t([...e,{name:``,url:``}]),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-[14px]`}),`Add link`]})})]})}function Ope(){return(0,h.jsxs)(`div`,{...cb,children:[(0,h.jsx)(V,{title:`Named links`,info:`planning.links.named`}),(0,h.jsx)(`p`,{className:`m-0 max-w-[60ch] text-ink-2`,children:`Each channel keeps its own links now, on its Brand tab under Channel links. Links saved here before fill the default channel's descriptions until you save its Brand tab.`}),(0,h.jsx)(`div`,{className:`mt-3`,children:(0,h.jsx)(zx,{to:`/channels/$channelId`,params:{channelId:_b},children:`Open the default channel's links`})})]})}function k2({value:e,inherit:t,sources:n,offerNone:r,problem:i,file:a,fieldPrefix:o=`ambientBed`,onChange:s}){let c=e!==void 0&&e.source!==`none`,l={level:e?.level??String(ek.levelDb),fadeIn:e?.fadeIn??String(ek.fadeInSeconds),tail:e?.tail??String(ek.tailSeconds)},u=e=>{if(e===``)s(void 0);else if(e===`none`)s({source:`none`,...l});else{let t=n.find(t=>t===e);t!==void 0&&s({source:t,...l})}},d=(t,n,r,a)=>e===void 0||!c?null:(0,h.jsx)(uV,{label:n,help:r,tip:a,error:i(t),children:(0,h.jsx)(Y,{"data-play-field":`${o}.${t}`,type:`text`,inputMode:`decimal`,className:`sl-input--number`,value:e[t],onChange:n=>s({...e,[t]:n.target.value})})});return(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(uV,{label:`Ambient sound`,tip:`project.ambient.source`,error:i(`source`),children:(0,h.jsxs)(pV,{"data-play-field":`${o}.source`,value:e?.source??``,onChange:e=>u(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:t}),r?(0,h.jsx)(`option`,{value:`none`,children:`None`}):null,n.map(e=>(0,h.jsx)(`option`,{value:e,children:Qie[e]},e))]})}),e?.source===`upload`?a:null,c?(0,h.jsxs)(`div`,{className:`contents`,children:[d(`level`,`Level (dB)`,`-40 to -6; 0 is about as loud as the voice.`,`project.ambient.level`),d(`fadeIn`,`Fade in (seconds)`,`0 to 30.`,`project.ambient.fade-in`),d(`tail`,`Tail after the narration (seconds)`,`0 to 30, fading out.`,`project.ambient.tail`)]}):null]})}function kpe({value:e,onChange:t}){let n=ik(e),r=n===void 0?[]:tk(n);return(0,h.jsx)(k2,{value:e,inherit:`Not set`,sources:QO,offerNone:!1,fieldPrefix:`brand.ambientBed`,problem:e=>r.find(t=>t.field===e)?.message,onChange:t})}function Ape(e){return e.ambientBed===void 0?void 0:rk(e.ambientBed)}function jpe(e){let t=ik(e);return t===void 0||t.source===`upload`?{brand:{},blocked:!1}:{brand:{ambientBed:{...t,source:t.source}},blocked:tk(t).length>0}}var A2=[`captionFontId`,`captionColor`,`captionOutlineColor`,`titleFontId`,`titleColor`,`intro`,`outro`,`endScreenText`,`documentTheme`,`language`];function Mpe(e){return Object.fromEntries(A2.map(t=>[t,e[t]??``]))}function Npe({channel:e}){let{api:t}=R(),n=_(),r=gy(),i=N({queryKey:Fj,queryFn:()=>Ij(t)}),a=N($y(t)),o=N(eb(t)),[s,c]=(0,m.useState)(e.name),[l,u]=(0,m.useState)(e.seriesBrief),[d,f]=(0,m.useState)(Mpe(e.brand)),[p,g]=(0,m.useState)(Ape(e.brand)),v=jpe(p),y=N({queryKey:z.channelLinks,queryFn:()=>Ls(t),enabled:e.isDefault&&e.brand.links===void 0}),[b,x]=(0,m.useState)(),S=b??e.brand.links??y.data??[],C=b!==void 0||e.brand.links!==void 0||(y.data?.length??0)>0,w=P({mutationFn:()=>Db(t,e.id,{name:s,seriesBrief:l,brand:{...Object.fromEntries(A2.flatMap(e=>d[e].trim()===``?[]:[[e,d[e].trim()]])),...v.brand,...C?{links:S}:{}},baseVersion:e.version}),onSuccess:async e=>{r(`Channel saved.`,`success`),n.setQueryData(xb(e.id),t=>typeof t==`object`&&t?{...t,channel:e}:t),await Promise.all([n.invalidateQueries({queryKey:bb}),n.invalidateQueries({queryKey:z.channelLinks})])}}),T=e=>t=>f({...d,[e]:t}),E=(i.data?.fonts??[]).map(e=>({value:e.id,label:e.name})),D=e=>(a.data?.entries??[]).filter(t=>t.category===e).map(e=>({value:e.name,label:e.name})),O=[...(o.data?.builtIns??[]).map(e=>({value:e.name,label:e.label})),...(o.data?.themes??[]).map(e=>({value:e.id,label:e.name}))];return(0,h.jsxs)(`form`,{"aria-label":`Brand kit`,onSubmit:e=>{e.preventDefault(),w.mutate()},children:[(0,h.jsxs)(`div`,{className:`grid max-w-3xl grid-cols-1 gap-5`,children:[(0,h.jsx)(uV,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(Y,{value:s,maxLength:200,required:!0,onChange:e=>c(e.target.value)})}),(0,h.jsx)(uV,{label:`Series brief`,tip:`planning.channel.brief`,help:`Topic generation reads it for this channel's schedules.`,children:(0,h.jsx)(fV,{rows:4,value:l,maxLength:1e4,onChange:e=>u(e.target.value)})}),(0,h.jsx)(V,{title:`Brand kit`,meta:`Fills what a template leaves at its default. Blank fields add nothing.`,info:`planning.channel.brand-kit`,className:`mt-2 border-t border-line pt-6`}),(0,h.jsx)(`section`,{"aria-label":`Language`,className:`max-w-md`,children:(0,h.jsx)(O2,{label:`Language of new projects`,tip:`planning.channel.language`,value:d.language===``?void 0:d.language,inherited:{label:`Not set`,language:void 0},onChange:e=>T(`language`)(e??``)})}),(0,h.jsxs)(`section`,{"aria-label":`Captions`,className:`grid grid-cols-1 gap-4 min-[700px]:grid-cols-3`,children:[(0,h.jsx)(j2,{label:`Caption font`,tip:`planning.channel.brand.caption-font`,value:d.captionFontId,options:E,onPick:T(`captionFontId`)}),(0,h.jsx)(M2,{label:`Caption colour`,tip:`planning.channel.brand.caption-colour`,value:d.captionColor,onChange:T(`captionColor`)}),(0,h.jsx)(M2,{label:`Caption outline`,tip:`planning.channel.brand.caption-outline`,value:d.captionOutlineColor,onChange:T(`captionOutlineColor`)})]}),(0,h.jsxs)(`section`,{"aria-label":`Chapter cards and end screen`,className:`grid grid-cols-1 gap-4 min-[700px]:grid-cols-3`,children:[(0,h.jsx)(j2,{label:`Title font`,tip:`planning.channel.brand.font`,value:d.titleFontId,options:E,onPick:T(`titleFontId`)}),(0,h.jsx)(M2,{label:`Title colour`,tip:`planning.channel.brand.title-colour`,value:d.titleColor,onChange:T(`titleColor`)}),(0,h.jsx)(uV,{label:`End screen text`,tip:`planning.channel.brand.end-screen`,help:`Shown over the last 5 seconds.`,children:(0,h.jsx)(Y,{value:d.endScreenText,maxLength:200,placeholder:`Subscribe for more`,onChange:e=>T(`endScreenText`)(e.target.value)})})]}),(0,h.jsxs)(`section`,{"aria-label":`Intro, outro and document`,className:`grid grid-cols-1 gap-4 min-[700px]:grid-cols-3`,children:[(0,h.jsx)(j2,{label:`Intro`,tip:`planning.channel.brand.intro`,value:d.intro,options:D(`intro`),onPick:T(`intro`)}),(0,h.jsx)(j2,{label:`Outro`,tip:`planning.channel.brand.outro`,value:d.outro,options:D(`outro`),onPick:T(`outro`)}),(0,h.jsx)(j2,{label:`Document theme`,tip:`planning.channel.brand.document-theme`,value:d.documentTheme,options:O,onPick:T(`documentTheme`)})]}),(0,h.jsx)(kpe,{value:p,onChange:g}),(0,h.jsx)(`div`,{className:`border-t border-line pt-6`,children:(0,h.jsx)(Dpe,{rows:S,onChange:x})})]}),(0,h.jsx)(H1,{status:(0,h.jsx)(V1,{tone:w.error?`error`:`info`,children:w.error?.message??(w.isPending?`Saving…`:void 0)}),children:(0,h.jsx)(L,{type:`submit`,variant:`primary`,disabled:w.isPending||s.trim()===``||v.blocked,disabledReason:s.trim()===``?`Give the channel a name`:`Fix the ambient sound settings above`,children:`Save channel`})})]})}function j2({label:e,tip:t,value:n,options:r,onPick:i}){return(0,h.jsx)(uV,{label:e,tip:t,children:(0,h.jsxs)(pV,{value:n,onChange:e=>i(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`Not set`}),n!==``&&!r.some(e=>e.value===n)?(0,h.jsxs)(`option`,{value:n,children:[n,` (no longer in the library)`]}):null,r.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))]})})}function M2({label:e,tip:t,value:n,onChange:r}){let i=/^#[0-9a-fA-F]{6}$/.test(n);return(0,h.jsx)(uV,{label:e,tip:t,...n!==``&&!i?{error:`Write the colour as # and six hex digits.`}:{},children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-6 shrink-0 rounded-control border border-line-strong`,style:{background:i?n:`transparent`}}),(0,h.jsx)(Y,{value:n,placeholder:`#FFFFFF`,maxLength:7,onChange:e=>r(e.target.value)})]})})}function N2(e,t){return e.languages===void 0||e.languages.includes(SO(t).code)}function Ppe(e,t,n,r){return n?e:e.filter(e=>N2(e,t)||e.voiceId===r)}function Fpe(e,t){if(e===void 0||N2(e,t))return;let n=SO(t).name,r=(e.languages??[]).map(e=>SO(e).code===e?SO(e).name:e);return`${e.name} is listed for ${r.join(`, `)}, not ${n}, so it may read the ${n} narration with the wrong accent. Pick a ${n} voice under Narration, or correct the voice's languages in Settings → Voices.`}function P2(e,t,n){let[r,i]=(0,m.useState)(!1),a=Ppe(e,t,r,n);return{listed:a,hidden:e.length-a.length,showAll:r,setShowAll:i}}function F2({language:e,voice:t,hidden:n,showAll:r,onShowAll:i}){let a=(0,m.useId)(),o=Fpe(t,e);return n===0&&!r&&o===void 0?null:(0,h.jsxs)(`div`,{className:`col-span-full grid gap-1`,children:[n>0||r?(0,h.jsxs)(`span`,{className:`flex min-h-8 items-center gap-1`,...cb,children:[(0,h.jsxs)(`label`,{htmlFor:a,className:`flex items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{id:a,type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),`Show all voices`,r?``:` (${String(n)} listed for other languages than ${SO(e).name})`]}),(0,h.jsx)(B,{id:`play.show-all-voices`})]}):null,o===void 0?null:(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:o})]})}function Ipe({channelId:e,member:t,open:n,onClose:r,onCreated:i}){let{api:a}=R(),o=_(),[s,c]=(0,m.useState)(t?.kind??`character`),[l,u]=(0,m.useState)(t?.name??``),[d,f]=(0,m.useState)(t?.aliases??[]),[p,g]=(0,m.useState)(``),[v,y]=(0,m.useState)(t?.description??``),[b,x]=(0,m.useState)(t?.voice),[S,C]=(0,m.useState)(t?.host===!0),w=()=>Promise.all([o.invalidateQueries({queryKey:xb(e)}),o.invalidateQueries({queryKey:bb})]),T=P({mutationFn:async()=>{let n={kind:s,name:l.trim(),aliases:d,description:v,voice:b!==void 0&&b.provider!==``&&b.model!==``&&b.voice!==``?b:null,host:S};return t===void 0?kb(a,e,crypto.randomUUID(),n):Ab(a,t.id,{...n,baseVersion:t.version})},onSuccess:async e=>{await w(),t===void 0&&i(e.id)}}),E=()=>{let e=p.trim();e===``||d.some(t=>t.toLowerCase()===e.toLowerCase())||(f([...d,e]),g(``))};return n?(0,h.jsxs)(`section`,{"aria-label":t===void 0?`Add to cast`:`Edit ${t.name}`,children:[(0,h.jsx)(V,{kicker:t===void 0?`New cast member`:yb[t.kind],title:t===void 0?`Add to cast`:t.name,meta:t===void 0?`Name it first, then give it reference pictures.`:`Used whenever a title or an image brief names it or one of its aliases.`,children:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:r,children:`Close`})}),t!==void 0&&!t.images.some(e=>e.state===`ready`)?(0,h.jsx)(`p`,{className:`m-0 mt-2 text-small text-waiting`,children:`No picture yet, so it is not sent with any image. Upload or generate one below.`}):null,(0,h.jsxs)(`form`,{id:`cast-member-form`,"aria-label":`Cast member`,className:`mt-4 flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),l.trim()!==``&&T.mutate()},children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 min-[600px]:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,h.jsx)(uV,{label:`Kind`,tip:`planning.cast.kind`,children:(0,h.jsx)(pV,{value:s,onChange:e=>c(vb.find(t=>t===e.target.value)??`character`),options:vb.map(e=>({value:e,label:yb[e]}))})}),(0,h.jsx)(uV,{label:`Name`,tip:`planning.cast.name`,children:(0,h.jsx)(Y,{value:l,maxLength:200,required:!0,onChange:e=>u(e.target.value)})})]}),(0,h.jsx)(uV,{label:`Aliases`,tip:`planning.cast.aliases`,help:`Press Enter to add each one.`,children:(0,h.jsxs)(`div`,{className:`flex gap-2`,children:[(0,h.jsx)(Y,{value:p,maxLength:200,placeholder:`Another name, such as the Last Pharaoh`,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())}}),(0,h.jsxs)(L,{onClick:E,disabled:p.trim()===``,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add alias`]})]})}),d.length>0?(0,h.jsx)(`ul`,{"aria-label":`Aliases added`,className:`m-0 flex list-none flex-wrap gap-2 p-0`,children:d.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(Kx,{removeLabel:`Remove alias ${e}`,onRemove:()=>f(d.filter(t=>t!==e)),children:e})},e))}):null,(0,h.jsx)(uV,{label:`Description for the image model`,tip:`planning.cast.description`,children:(0,h.jsx)(fV,{rows:3,value:v,maxLength:2e3,placeholder:`What they look like, in a sentence.`,onChange:e=>y(e.target.value)})}),(0,h.jsx)(Rpe,{channelId:e,value:b,onChange:x}),(0,h.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,h.jsx)(lb,{label:`One of the channel's hosts`,tip:`planning.cast.host`,checked:S,onChange:C}),S&&(b===void 0||b.voice===``)?(0,h.jsx)(`p`,{className:`m-0 text-small text-waiting`,children:`A host joins new podcasts and interviews only with a voice. Pick one under Voice above.`}):null]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(V1,{tone:T.error?`error`:`info`,children:T.error?.message??(T.isPending?`Saving…`:T.isSuccess?`Saved.`:void 0)}),(0,h.jsx)(L,{type:`submit`,form:`cast-member-form`,variant:t===void 0?`primary`:`secondary`,disabled:T.isPending||l.trim()===``,children:t===void 0?`Add to cast`:`Save`})]})]}),t===void 0?null:(0,h.jsx)(Lpe,{channelId:e,member:t})]}):null}function Lpe({channelId:e,member:t}){let{api:n}=R(),r=_(),i=N(Xy(n)),a=(0,m.useRef)(null),o=(0,m.useRef)(null),[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(``),[d,f]=(0,m.useState)(`${t.name}${t.description.trim()?`, ${t.description.trim()}`:``}. A clear reference picture on a plain background, the whole ${t.kind===`place`?`place`:t.kind===`object`?`object`:`figure`} in view.`),p=()=>Promise.all([r.invalidateQueries({queryKey:xb(e)}),r.invalidateQueries({queryKey:bb})]),g=P({mutationFn:e=>Mb(n,t.id,e),onSettled:p}),v=P({mutationFn:()=>Nb(n,t.id,{prompt:d,provider:s,model:l}),onSettled:p}),y=P({mutationFn:e=>Pb(n,t.id,e),onSettled:p}),b=g.error??v.error??y.error,x=t.images.flatMap((e,t)=>e.state===`ready`&&e.sha256!==null?[{id:e.id,number:t+1,src:Lb(n,e.sha256)}]:[]),[S,C]=(0,m.useState)(null);return(0,h.jsxs)(`section`,{"aria-label":`Reference pictures`,className:`mt-6`,children:[(0,h.jsx)(Cq,{className:`mb-6`}),(0,h.jsx)(V,{as:`h3`,title:`Reference pictures`,meta:`Sent with every image whose brief, or the video's title, names ${t.name}.`,info:`planning.cast.pictures`}),t.images.length>0?(0,h.jsx)(A0,{list:!0,density:`compact`,label:`Pictures of ${t.name}`,className:`mt-3`,children:t.images.map((e,r)=>(0,h.jsxs)(`li`,{className:`min-w-0`,children:[(0,h.jsx)(k0,{aspect:`square`,alt:`${t.name}, reference ${String(r+1)}`,...e.state===`ready`&&e.sha256!==null?{src:Lb(n,e.sha256)}:{},...e.state===`generating`?{generating:`Making the picture…`}:{},onOpen:()=>C(x.findIndex(t=>t.id===e.id)),openLabel:`Open picture ${String(r+1)} of ${t.name} full size`,...e.state===`failed`?{badge:(0,h.jsx)(Gx,{tone:`failed`,children:`Failed`})}:{},actionsShown:!0,actions:(0,h.jsx)(L,{variant:`secondary`,size:`small`,"aria-label":`Delete picture ${String(r+1)} of ${t.name}`,disabled:y.isPending||e.state===`generating`,disabledReason:`Wait until the picture is made`,onClick:()=>y.mutate(e.id),children:`Delete`})}),e.state===`failed`&&e.error?(0,h.jsx)(zpe,{error:e.error,retry:s===``||l===``||d.trim()===``?void 0:{run:()=>v.mutate(),busy:v.isPending},onReword:()=>o.current?.focus()}):null]},e.id))}):(0,h.jsx)(`p`,{className:`m-0 mt-3 text-small text-ink-3`,children:`No pictures yet.`}),(0,h.jsx)(j0,{items:x.map(e=>({src:e.src,alt:`${t.name}, reference ${String(e.number)}`})),index:S,onIndex:C,onClose:()=>C(null),actions:(e,n)=>{let r=x[n];return r===void 0?null:(0,h.jsx)(Vx,{href:r.src,download:!0,size:`small`,"aria-label":`Download picture ${String(r.number)} of ${t.name}`,children:`Download`})}}),(0,h.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(`input`,{ref:a,type:`file`,accept:`image/png,image/jpeg`,className:`sr-only`,tabIndex:-1,"aria-hidden":`true`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&g.mutate(t)}}),(0,h.jsx)(L,{disabled:g.isPending,onClick:()=>a.current?.click(),children:`Upload a picture`}),(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:`PNG or JPEG, up to 10 MB.`})]}),(0,h.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,...cb,children:[(0,h.jsxs)(`p`,{className:`sl-kicker m-0 flex items-center gap-1`,children:[`Make a picture`,(0,h.jsx)(B,{id:`planning.cast.generate`,className:`-my-1`})]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 min-[600px]:grid-cols-2`,children:[(0,h.jsx)(EV,{label:`Image provider`,family:`image`,providers:i.data?.providers??[],value:s,problem:void 0,onPick:e=>{c(e),u(``)}}),(0,h.jsx)(DV,{label:`Image model`,provider:s,value:l,problem:void 0,onPick:u})]})]}),(0,h.jsx)(uV,{label:`Picture to make`,tip:`planning.cast.picture-prompt`,children:(0,h.jsx)(fV,{ref:o,rows:3,value:d,maxLength:4e3,onChange:e=>f(e.target.value)})}),(0,h.jsx)(`div`,{children:(0,h.jsx)(L,{disabled:v.isPending||s===``||l===``||d.trim()===``,disabledReason:`Pick an image provider and model, and describe the picture`,onClick:()=>v.mutate(),children:`Generate a picture`})})]}),(0,h.jsx)(V1,{tone:b?`error`:`info`,className:`mt-2`,children:b?.message??(g.isPending?`Uploading…`:v.isSuccess?`The picture is being made; it appears here when it is ready.`:void 0)})]})}function Rpe({channelId:e,value:t,onChange:n}){let{api:r}=R(),i=N(Xy(r)),a=N(Zy(r)),o=N(Tb(r,e)).data?.channel.brand.language??`en`,s=t??{provider:``,model:``,voice:``},c=(a.data?.voices??[]).filter(e=>e.provider===s.provider),l=P2(c,o,s.voice||void 0),u=l.listed;return(0,h.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-3 border-0 border-t border-line p-0 pt-4`,...cb,children:[(0,h.jsxs)(`legend`,{className:`sl-kicker flex items-center gap-1`,children:[`Voice`,(0,h.jsx)(B,{id:`planning.cast.voice`,label:`Cast voice`,className:`-my-1`})]}),(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`For multi-voice runs: pick this member under Speakers on Play.`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 min-[600px]:grid-cols-2`,children:[(0,h.jsx)(EV,{label:`Voice provider`,family:`tts`,providers:i.data?.providers??[],value:s.provider,problem:void 0,onPick:e=>n(e===``?void 0:{provider:e,model:``,voice:``})}),(0,h.jsx)(DV,{label:`Voice model`,provider:s.provider,value:s.model,problem:void 0,onPick:e=>n({...s,model:e})}),(0,h.jsx)(CV,{label:`Voice`,value:s.voice,placeholder:u.length===0?`No voices. Add one in Settings.`:`Pick a voice`,options:u.map(e=>({value:e.voiceId,label:e.name})),problem:void 0,onPick:e=>n({...s,voice:e})}),(0,h.jsx)(F2,{language:o,voice:c.find(e=>e.voiceId===s.voice),hidden:l.hidden,showAll:l.showAll,onShowAll:l.setShowAll}),(0,h.jsx)(CV,{label:`Pace`,value:String(s.pace??1),placeholder:`Pick a pace`,options:wk.map(e=>({value:String(e),label:e===1?`Normal`:`${String(e)}×`})),problem:void 0,onPick:e=>{let{pace:t,...r}=s;n(Number(e)===1?r:{...r,pace:Number(e)})}})]}),t===void 0?null:(0,h.jsx)(L,{variant:`quiet`,onClick:()=>n(void 0),children:`Remove the voice`})]})}function zpe({error:e,retry:t,onReword:n}){let r=A1({stage:`images`,reason:e});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`m-0 mt-1 text-small text-danger`,children:e}),r===void 0?null:(0,h.jsx)(dy,{className:`mt-2`,children:(0,h.jsx)(R1,{fix:r,retry:t,variant:`secondary`,size:`small`,edit:r.kind===`refused`?(0,h.jsx)(L,{variant:`secondary`,size:`small`,onClick:n,children:`Reword the picture`}):void 0})})]})}function Bpe({channelId:e,cast:t,selected:n,onSelect:r}){let{api:i}=R(),a=_(),[o,s]=(0,m.useState)(null),c=n===void 0?o:n,l=r??s,[u,d]=(0,m.useState)(null),f=P({mutationFn:e=>jb(i,e),onSuccess:async(t,n)=>{d(null),c===n&&l(null),await Promise.all([a.invalidateQueries({queryKey:xb(e)}),a.invalidateQueries({queryKey:bb})])}}),p=t.find(e=>e.id===c),g=t.flatMap(e=>{let t=e.images.find(e=>e.state===`ready`)?.sha256;return t?[{member:e,src:Lb(i,t)}]:[]}),v=g.map(e=>({src:e.src,alt:e.member.name,caption:`${yb[e.member.kind]} · ${e.member.description||`No description yet`}`})),[y,b]=(0,m.useState)(null),x=c===`new`||p!==void 0;return(0,h.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-8 min-[1024px]:grid-cols-[minmax(0,1fr)_440px]`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`p`,{className:`m-0 mb-4 max-w-[68ch] text-small text-ink-2`,children:`When a video's title or an image's brief names a member, its pictures go with that image as references, so it looks the same in every video.`}),t.length===0?(0,h.jsx)(J1,{title:`No cast yet`,actions:(0,h.jsx)(L,{variant:`secondary`,onClick:()=>l(`new`),children:`Add to cast`}),children:`Add the characters, creatures, places and objects this channel keeps coming back to.`}):(0,h.jsx)(A0,{label:`Cast`,children:t.map(e=>{let t=e.images.filter(e=>e.state===`ready`),n=t[0]?.sha256;return(0,h.jsx)(k0,{className:I(e.id===c&&`rounded-media outline-2 outline-accent outline-offset-4 outline-solid`),...n?{src:Lb(i,n)}:{},alt:e.name,onOpen:()=>b(g.findIndex(t=>t.member.id===e.id)),openLabel:`Open ${e.name}'s picture full size`,title:e.name,meta:`${yb[e.kind]}${e.host===!0?` · Host`:``} · ${String(t.length)} ${t.length===1?`picture`:`pictures`}`,...t.length===0?{badge:(0,h.jsx)(Gx,{tone:`waiting`,children:`No picture`})}:{},actionsShown:!0,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`secondary`,size:`small`,"aria-label":`Edit ${e.name}`,"aria-pressed":e.id===c,onClick:()=>l(e.id),children:`Edit`}),(0,h.jsx)(L,{variant:`secondary`,size:`small`,"aria-label":`Delete ${e.name}`,onClick:()=>{f.reset(),d(e)},children:`Delete`})]})},e.id)})}),(0,h.jsx)(j0,{items:v,index:y,onIndex:b,onClose:()=>b(null),actions:(e,t)=>{let n=g[t];return n===void 0?null:(0,h.jsx)(L,{size:`small`,onClick:()=>{b(null),l(n.member.id)},children:`Edit ${n.member.name}`})}}),(0,h.jsx)(V1,{tone:`error`,className:`mt-2`,children:u?void 0:f.error?.message})]}),(0,h.jsx)(`aside`,{"aria-label":`Cast member editor`,className:`min-w-0`,children:x?(0,h.jsx)(Ipe,{channelId:e,member:p,open:!0,onClose:()=>l(null),onCreated:e=>l(e)},c??`closed`):t.length===0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Pick a member's Edit to change its names, description and pictures here.`})}),(0,h.jsx)(Dy,{open:u!==null,title:`Delete ${u?.name??`this cast member`}?`,consequence:f.error?.message??`New videos stop using its pictures. Videos already made keep the pictures they were started with.`,confirmLabel:`Delete from cast`,cancelLabel:`Keep it`,pending:f.isPending,onConfirm:()=>{u&&f.mutate(u.id)},onCancel:()=>d(null)})]})}var I2=e=>[`channels`,e,`episodes`],L2=e=>[`channels`,e,`videos`],R2=(e,t)=>`${e.origin}/api/channels/${t}`,z2=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});function Vpe(e,t){return ct({queryKey:I2(t),queryFn:async()=>F(await e.fetch(`${R2(e,t)}/episodes`))})}async function Hpe(e,t,n){return F(await e.fetch(`${R2(e,t)}/episodes/setting`,z2(`PUT`,{enabled:n})))}async function Upe(e,t,n,r){return F(await e.fetch(`${R2(e,t)}/episodes/${encodeURIComponent(n)}`,z2(`PUT`,{summary:r})))}async function Wpe(e,t,n){let r=await e.fetch(`${R2(e,t)}/episodes/${encodeURIComponent(n)}`,{method:`DELETE`});r.ok||await F(r)}function B2(e,t){return ct({queryKey:L2(t),queryFn:async()=>(await F(await e.fetch(`${R2(e,t)}/videos`))).videos})}async function Gpe(e,t,n){return F(await e.fetch(`${R2(e,t)}/videos`,z2(`POST`,n)))}async function Kpe(e,t,n){return F(await e.fetch(`${R2(e,t)}/videos/preview`,z2(`POST`,{format:`csv`,text:n})))}async function qpe(e,t,n){let r=await e.fetch(`${R2(e,t)}/videos/${n}`,{method:`DELETE`});r.ok||await F(r)}async function Jpe(e,t){await F(await e.fetch(`${R2(e,t)}/videos`,{method:`DELETE`}))}var Ype=e=>e.length>160?`${e.slice(0,160)}…`:e;function Xpe({channelId:e}){let{api:t}=R(),n=_(),r=N(Vpe(t,e)),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(null),c=()=>n.invalidateQueries({queryKey:I2(e)}),l=P({mutationFn:n=>Hpe(t,e,n),onSuccess:t=>n.setQueryData(I2(e),t)}),u=P({mutationFn:n=>Wpe(t,e,n),onSuccess:async()=>{s(null),await c()}}),d=r.data?.enabled??!1,f=r.data?.memories??[];return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(lb,{checked:d,disabled:r.data===void 0||l.isPending,onChange:e=>l.mutate(e),label:`Episode memory`,tip:`planning.channel.episode-memory`,describedBy:`${e}-memory-help`}),(0,h.jsx)(`p`,{id:`${e}-memory-help`,className:`mt-1 mb-3 text-small text-ink-2`,children:`Finished episodes leave a short summary that new related episodes are written with.`}),(0,h.jsx)(V1,{tone:r.error||l.error||u.error?`error`:`info`,children:r.error?.message??l.error?.message??(o?void 0:u.error?.message)??(r.isPending?`Loading the episodes…`:void 0)}),r.data&&f.length===0?(0,h.jsx)(J1,{title:`No episodes remembered yet`,children:d?`When a video on this channel finishes, its summary appears here.`:`Turn on episode memory, and the next finished video's summary appears here.`}):null,f.length>0?(0,h.jsx)(iU,{label:`Episode summaries`,children:f.map(e=>(0,h.jsx)(aU,{title:e.title,meta:(0,h.jsxs)(h.Fragment,{children:[e.source===`edited`?`Edited · `:``,e.cast.length>0?`${e.cast.join(`, `)} · `:``,Ype(e.summary)]}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{size:`small`,"aria-label":`Open the summary of ${e.title}`,onClick:()=>a(e),children:`Open`}),(0,h.jsx)(L,{size:`small`,variant:`quiet`,"aria-label":`Delete the summary of ${e.title}`,onClick:()=>{u.reset(),s(e)},children:`Delete`})]})},e.id))}):null,i?(0,h.jsx)(Zpe,{channelId:e,memory:i,onClose:()=>a(null)},i.id):null,(0,h.jsx)(Dy,{open:o!==null,title:`Delete the summary of ${o?.title??`this episode`}?`,consequence:u.error?.message??`New episodes stop being reminded of it. The video itself is not changed.`,confirmLabel:`Delete summary`,pending:u.isPending,onConfirm:()=>{o&&u.mutate(o.id)},onCancel:()=>s(null)})]})}function Zpe({channelId:e,memory:t,onClose:n}){let{api:r}=R(),i=_(),[a,o]=(0,m.useState)(t.summary),s=P({mutationFn:()=>Upe(r,e,t.id,a),onSuccess:async()=>{await i.invalidateQueries({queryKey:I2(e)}),n()}}),c=a.trim()!==t.summary.trim();return(0,h.jsx)(Ey,{open:!0,onOpenChange:e=>{e||n()},title:t.title,description:t.source===`edited`?`You edited this summary; finishing the video again keeps your text.`:`Written by the text model when the video finished. An edit here is kept.`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{onClick:n,children:`Close`}),(0,h.jsx)(L,{variant:`primary`,disabled:!c||s.isPending,onClick:()=>s.mutate(),children:`Save summary`})]}),children:(0,h.jsx)(uV,{label:`Summary`,error:s.error?.message,tip:`planning.channel.episode-summary`,children:(0,h.jsx)(fV,{rows:8,value:a,onChange:e=>o(e.target.value)})})})}var V2=(e,t,n)=>`${e.toLocaleString(`en`)} ${e===1?t:n}`;function H2(e,t){let n=t.trim().toLowerCase();return e.map(e=>n===``||e.toLowerCase().includes(n))}function Qpe({channelId:e}){let{api:t}=R(),n=_(),r=N(B2(t,e)),[i,a]=(0,m.useState)(``),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(void 0),u=(0,m.useRef)(null),d=()=>n.invalidateQueries({queryKey:L2(e)}),[f,p]=(0,m.useState)(void 0),[g,v]=(0,m.useState)(``),y=P({mutationFn:n=>Gpe(t,e,{format:`lines`,...n}),onSuccess:async(e,t)=>{t.filter===void 0?a(``):p(void 0),l(`Added ${V2(e.added,`title`,`titles`)}${e.skipped>0?`; skipped ${e.skipped.toLocaleString(`en`)} already listed`:``}.`),await d()}}),b=P({mutationFn:n=>Kpe(t,e,n),onSuccess:e=>{v(e.filter),p({titles:e.titles,ticked:H2(e.titles,e.filter)})}}),x=P({mutationFn:n=>qpe(t,e,n),onSuccess:d}),S=P({mutationFn:()=>Jpe(t,e),onSuccess:async()=>{s(!1),await d()}}),C=r.data??[],w=y.isPending||b.isPending||x.isPending||S.isPending,T=r.error??b.error??y.error??x.error;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`mb-3 text-small text-ink-2`,children:`Topic suggestions and duplicate checks skip these titles, as they skip the videos made here.`}),(0,h.jsx)(uV,{label:`Paste titles`,tip:`planning.channel.videos-paste`,help:`One title per line.`,children:(0,h.jsx)(fV,{rows:5,value:i,onChange:e=>a(e.target.value)})}),(0,h.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(L,{variant:`primary`,disabled:w||i.trim()===``,onClick:()=>{l(void 0),y.mutate({text:i})},children:`Add titles`}),(0,h.jsx)(L,{disabled:w,onClick:()=>{u.current?.click()},children:`Import a YouTube Studio CSV…`}),(0,h.jsx)(B,{id:`planning.channel.videos-csv`}),(0,h.jsx)(`input`,{ref:u,type:`file`,accept:`.csv,text/csv`,className:`hidden`,"aria-label":`YouTube Studio CSV file`,onChange:async e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&(l(void 0),y.reset(),b.mutate(await t.text()))}}),(0,h.jsx)(L,{variant:`quiet`,disabled:w||C.length===0,onClick:()=>{S.reset(),s(!0)},children:`Remove all`})]}),(0,h.jsx)(V1,{tone:T?`error`:c?`success`:`info`,className:`mt-1`,children:T?.message??c??(r.isPending?`Loading the titles…`:b.isPending?`Reading the CSV…`:void 0)}),f===void 0?null:(0,h.jsx)($pe,{preview:f,filter:g,busy:w,onFilter:e=>{v(e),p({...f,ticked:H2(f.titles,e)})},onTick:e=>p({...f,ticked:e}),onSave:()=>{l(void 0);let e=f.titles.filter((e,t)=>f.ticked[t]);y.mutate({text:e.join(`
|
|
273
|
-
`),filter:g})},onCancel:()=>{y.reset(),p(void 0)}}),r.data&&C.length===0?(0,h.jsx)(J1,{title:`No existing videos listed`,children:`In YouTube Studio open Analytics → Content → Advanced mode, export the table as a CSV, and import it here; or paste the titles above.`}):null,C.length>0?(0,h.jsx)(iU,{label:`Existing videos`,children:C.map(e=>(0,h.jsx)(aU,{title:e.title,actions:(0,h.jsx)(L,{size:`small`,variant:`quiet`,disabled:w,"aria-label":`Remove ${e.title}`,onClick:()=>x.mutate(e.id),children:`Remove`})},e.id))}):null,(0,h.jsx)(Dy,{open:o,title:`Remove all ${V2(C.length,`title`,`titles`)}?`,consequence:S.error?.message??`Topic suggestions and duplicate checks stop skipping them. Your videos on YouTube are not touched.`,confirmLabel:`Remove all`,pending:S.isPending,onConfirm:()=>S.mutate(),onCancel:()=>s(!1)})]})}function $pe({preview:e,filter:t,busy:n,onFilter:r,onTick:i,onSave:a,onCancel:o}){let s=(0,m.useId)(),c=e.ticked.filter(Boolean).length;return(0,h.jsxs)(`section`,{"aria-label":`Titles in the CSV`,className:`mt-4`,...cb,children:[(0,h.jsxs)(V,{as:`h3`,title:`Titles in the CSV`,info:`planning.channel.videos-ticks`,meta:`${c.toLocaleString(`en`)} of ${V2(e.titles.length,`title`,`titles`)} ticked`,children:[(0,h.jsxs)(L,{variant:`primary`,disabled:n||c===0,onClick:a,children:[`Add `,V2(c,`ticked title`,`ticked titles`)]}),(0,h.jsx)(L,{variant:`quiet`,disabled:n,onClick:o,children:`Cancel`})]}),(0,h.jsx)(uV,{label:`Keep only titles containing…`,tip:`planning.channel.videos-filter`,tipLabel:`Keep only titles containing`,children:(0,h.jsx)(Y,{value:t,maxLength:200,onChange:e=>r(e.target.value)})}),(0,h.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(L,{size:`small`,disabled:n,onClick:()=>i(e.titles.map(()=>!0)),children:`Tick all`}),(0,h.jsx)(L,{size:`small`,disabled:n,onClick:()=>i(e.titles.map(()=>!1)),children:`Untick all`})]}),(0,h.jsx)(iU,{label:`Titles in the CSV`,className:`mt-2`,children:e.titles.map((t,r)=>(0,h.jsx)(aU,{lead:(0,h.jsx)(`input`,{id:`${s}-${r}`,type:`checkbox`,checked:e.ticked[r]===!0,disabled:n,className:`size-4 shrink-0 accent-accent`,onChange:t=>i(e.ticked.map((e,n)=>n===r?t.target.checked:e))}),title:(0,h.jsx)(`label`,{htmlFor:`${s}-${r}`,children:t})},r))})]})}var U2=[`brand`,`cast`,`templates`,`schedules`,`episodes`,`videos`],eme={brand:`Brand`,cast:`Cast`,templates:`Templates`,schedules:`Schedules`,episodes:`Episodes`,videos:`Existing videos`};function tme(e){return U2.find(t=>t===e)??`brand`}function nme({channelId:e,tab:t,onTab:n}){let{api:r}=R(),i=_(),a=Zi(),o=N(Tb(r,e)),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(null),d=P({mutationFn:()=>Ob(r,e),onSuccess:async()=>{c(!1),await i.invalidateQueries({queryKey:bb}),await a({to:`/channels`})}}),f=o.data?.channel,p=o.data?.cast??[],g=()=>{n(`cast`),u(`new`)};return qb({id:`channel.add-to-cast`,title:`Add to cast`,group:`Channel`,...f===void 0?{}:{context:f.name},keywords:[`character`,`creature`,`place`,`object`],run:g}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(bq,{crumb:(0,h.jsx)(ha,{to:`/channels`,children:`Channels`}),title:f?.name??`Channel`,meta:f?.isDefault?`Default channel`:void 0,actions:(0,h.jsxs)(h.Fragment,{children:[t===`cast`&&f?(0,h.jsxs)(L,{variant:`primary`,onClick:g,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add to cast`]}):null,f&&!f.isDefault?(0,h.jsx)(L,{variant:`quiet`,onClick:()=>{d.reset(),c(!0)},children:`Delete channel`}):null]})}),(0,h.jsx)(K1,{items:U2.map(e=>({id:e,label:eme[e],...e===`cast`?{badge:String(p.length)}:{}})),value:t,onChange:n,label:`Channel sections`,idPrefix:`channel`,className:`mb-6`}),(0,h.jsx)(V1,{tone:o.error?`error`:`info`,className:`mb-2`,children:o.error?`The channel couldn't be loaded: ${o.error.message} Go back to Channels and open it again.`:o.isPending?`Loading the channel…`:void 0}),f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(q1,{idPrefix:`channel`,id:`brand`,active:t===`brand`,children:[(0,h.jsx)(Tpe,{channel:f}),(0,h.jsx)(Npe,{channel:f},`${f.id}:${String(f.version)}`)]}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`cast`,active:t===`cast`,children:(0,h.jsx)(Bpe,{channelId:f.id,cast:p,selected:l,onSelect:u})}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`templates`,active:t===`templates`,children:t===`templates`?(0,h.jsx)(Jde,{channelId:f.id}):null}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`schedules`,active:t===`schedules`,children:t===`schedules`?(0,h.jsx)(Zde,{channelId:f.id}):null}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`episodes`,active:t===`episodes`,children:t===`episodes`?(0,h.jsx)(Xpe,{channelId:f.id}):null}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`videos`,active:t===`videos`,children:t===`videos`?(0,h.jsx)(Qpe,{channelId:f.id}):null})]}):null,(0,h.jsx)(Dy,{open:s,title:`Delete ${f?.name??`this channel`}?`,consequence:d.error?.message??`Its cast goes with it. Its videos move to the default channel and keep what they were made with.`,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:d.isPending,onConfirm:()=>d.mutate(),onCancel:()=>c(!1)})]})}function W2({className:e,children:t}){return(0,h.jsx)(`dl`,{className:I(`sl-stats m-0`,e),children:t})}function G2({value:e,label:t,children:n}){return(0,h.jsxs)(`div`,{className:`sl-stat`,children:[(0,h.jsx)(`dt`,{className:`sl-stat__label order-2`,children:t}),(0,h.jsx)(`dd`,{className:`sl-stat__value order-1 m-0`,children:e}),n===void 0?null:(0,h.jsx)(`dd`,{className:`order-3 m-0 mt-1`,children:n})]})}function K2({value:e,label:t,valueText:n,tone:r=`accent`,className:i}){let a=Math.round(Math.min(1,Math.max(0,Number.isFinite(e)?e:0))*100);return(0,h.jsx)(`div`,{role:`meter`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,"aria-valuetext":n??`${String(a)}%`,className:I(`sl-meter`,r===`waiting`&&`sl-meter--waiting`,i),children:(0,h.jsx)(`span`,{style:{width:`${String(a)}%`}})})}function q2({columns:e,rows:t,rowKey:n,caption:r,empty:i,className:a}){return(0,h.jsxs)(`table`,{className:I(`sl-table`,a),children:[(0,h.jsx)(`caption`,{className:`sr-only`,children:r}),(0,h.jsx)(`thead`,{children:(0,h.jsx)(`tr`,{children:e.map(e=>(0,h.jsx)(`th`,{scope:`col`,className:e.numeric?`num`:void 0,children:e.header},e.id))})}),(0,h.jsx)(`tbody`,{children:t.length===0&&i!==void 0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:e.length,className:`text-ink-2`,children:i})}):t.map(t=>(0,h.jsx)(`tr`,{children:e.map(e=>(0,h.jsx)(`td`,{className:e.numeric?`num`:void 0,children:e.cell(t)},e.id))},n(t)))})]})}function rme(){let{api:e}=R(),t=_(),n=Zi(),r=N(wb(e)),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(null),f=r.data?.find(e=>e.id===u)??r.data?.[0],p=P({mutationFn:()=>Eb(e,crypto.randomUUID(),c.trim()),onSuccess:async e=>{await t.invalidateQueries({queryKey:bb}),a(null),l(``),await n({to:`/channels/$channelId`,params:{channelId:e.id}})}}),g=P({mutationFn:t=>Db(e,t.id,{name:c.trim(),brand:t.brand,seriesBrief:t.seriesBrief,baseVersion:t.version}),onSuccess:async()=>{await t.invalidateQueries({queryKey:bb}),a(null)}}),v=P({mutationFn:t=>Ob(e,t.id),onSuccess:async()=>{s(null),await t.invalidateQueries({queryKey:bb})}}),y=()=>{p.reset(),l(``),a(`new`)};qb({id:`channels.new`,title:`New channel`,group:`Channels`,run:y});let b=i===`new`?p:g,x=()=>{c.trim()!==``&&i!==null&&(i===`new`?p.mutate():g.mutate(i))};return(0,h.jsxs)(`div`,{"data-tour":`channels`,children:[(0,h.jsx)(bq,{title:`Channels`,meta:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`A channel keeps its brand kit, cast, series brief, templates and schedules together.`,(0,h.jsx)(B,{id:`planning.channels`})]}),actions:(0,h.jsxs)(L,{variant:`primary`,"aria-expanded":i===`new`,onClick:y,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New channel`]})}),(0,h.jsx)(V1,{tone:r.error||v.error?`error`:`info`,className:`mb-2`,children:r.error?`The channels couldn't be loaded: ${r.error.message} Reload the page to try again.`:o===null&&v.error?v.error.message:r.isPending?`Loading channels…`:void 0}),r.data?.length===0?(0,h.jsx)(J1,{title:`No channels yet`,actions:(0,h.jsx)(L,{variant:`primary`,onClick:y,children:`New channel`}),children:`Make one for each series you run; it keeps that series' look and cast.`}):null,r.data?.length?(0,h.jsx)(Sq,{list:(0,h.jsx)(iU,{label:`Channels`,className:`[&_.sl-row__actions]:flex-wrap`,children:r.data.map(e=>(0,h.jsx)(aU,{selected:e.id===f?.id,onSelect:()=>d(e.id),title:e.name,meta:`${e.isDefault?`Default · `:``}${String(e.templates)} ${e.templates===1?`template`:`templates`} · ${String(e.cast)} in the cast`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Bx,{to:`/channels/$channelId`,params:{channelId:e.id},"aria-label":`Open ${e.name}`,className:`px-2 text-small`,children:`Open`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Rename ${e.name}`,onClick:()=>{g.reset(),l(e.name),a(e)},children:`Rename`}),e.isDefault?null:(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Delete ${e.name}`,onClick:()=>{v.reset(),s(e)},children:`Delete`})]})},e.id))}),detail:f===void 0?null:(0,h.jsx)(ime,{channel:f})}):null,(0,h.jsx)(Ey,{open:i!==null,onOpenChange:e=>{!e&&!b.isPending&&a(null)},title:i===`new`||i===null?`New channel`:`Rename ${i.name}`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V1,{tone:b.error?`error`:`info`,children:b.error?.message??(b.isPending?`Saving…`:void 0)}),(0,h.jsx)(L,{disabled:b.isPending,onClick:()=>a(null),children:`Cancel`}),(0,h.jsx)(L,{type:`submit`,form:`channel-name-form`,variant:`primary`,disabled:b.isPending||c.trim()===``,children:i===`new`?`Create channel`:`Rename channel`})]}),children:(0,h.jsx)(`form`,{id:`channel-name-form`,"aria-label":i===`new`?`New channel`:`Rename channel`,onSubmit:e=>{e.preventDefault(),x()},children:(0,h.jsx)(uV,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(Y,{value:c,maxLength:200,required:!0,disabled:b.isPending,onChange:e=>l(e.target.value)})})})}),(0,h.jsx)(Dy,{open:o!==null,title:`Delete ${o?.name??`this channel`}?`,consequence:v.error?.message??`Its cast goes with it. Its videos move to the default channel and keep what they were made with.`,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:v.isPending,onConfirm:()=>{o&&v.mutate(o)},onCancel:()=>s(null)})]})}function ime({channel:e}){let t=e.brand,n=[[`Intro`,t.intro??`None`],[`Outro`,t.outro??`None`],[`Document theme`,t.documentTheme??`Default`],[`End screen text`,t.endScreenText??`None`]];return(0,h.jsxs)(`section`,{"aria-label":`About ${e.name}`,children:[(0,h.jsx)(V,{title:`About ${e.name}`,meta:e.isDefault?`The default channel`:void 0,children:(0,h.jsx)(zx,{to:`/channels/$channelId`,params:{channelId:e.id},children:`Open channel`})}),(0,h.jsxs)(W2,{className:`mb-6`,children:[(0,h.jsx)(G2,{value:String(e.templates),label:`Templates`}),(0,h.jsx)(G2,{value:String(e.cast),label:`In the cast`})]}),(0,h.jsx)(V,{as:`h3`,title:`Series brief`,className:`pb-2`}),(0,h.jsx)(`p`,{className:`m-0 mb-6 whitespace-pre-wrap text-body text-ink-2`,children:e.seriesBrief.trim()===``?`No series brief yet. Open the channel to say what it covers.`:e.seriesBrief}),(0,h.jsx)(V,{as:`h3`,title:`Brand kit`,className:`pb-2`}),(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-small`,children:n.map(([e,t])=>(0,h.jsxs)(`div`,{className:`contents`,children:[(0,h.jsx)(`dt`,{className:`text-ink-2`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 truncate`,children:t})]},e))})]})}var J2=2e3;function Y2(e,t){let n=(0,m.useRef)(t);(0,m.useEffect)(()=>{n.current=t}),(0,m.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{n.current()},J2);return()=>{clearTimeout(t)}},[e])}function X2(){return(0,h.jsxs)(`span`,{className:`inline-flex animate-tick-in items-center gap-1 text-label text-accent-ink motion-reduce:animate-none`,children:[(0,h.jsx)(Sc,{"aria-hidden":`true`,className:`size-[14px]`}),`Saved`]})}function Z2({onDelete:e,blocked:t,blockedId:n,pending:r,saved:i,cancel:a,errors:o,onSave:s}){let c=t!==void 0||r||i,l=gy();qb({id:`editor.save`,title:`Save`,group:`This editor`,keywords:[`save`,`keep`],shortcut:CM.save,run:()=>{c?t!==void 0&&l(`Not saved yet: ${t}`,`error`):s()}});let u=o.join(` `);return(0,h.jsxs)(`div`,{"data-slot":`editor-actions`,className:`sticky bottom-0 z-10 flex flex-wrap items-center gap-3 border-t border-line bg-ground py-3 max-md:bottom-[calc(48px+max(12px,env(safe-area-inset-bottom)))]`,children:[(0,h.jsx)(L,{variant:`destructive`,onClick:e,disabled:e===void 0,"aria-hidden":e===void 0||void 0,tabIndex:e===void 0?-1:void 0,style:e===void 0?{visibility:`hidden`}:void 0,children:`Delete`}),(0,h.jsx)(V1,{tone:u?`error`:`info`,id:u?void 0:n,children:u||(i?(0,h.jsx)(X2,{}):t)}),a,(0,h.jsx)(L,{variant:`primary`,"aria-disabled":c,"aria-describedby":t===void 0?void 0:n,"aria-keyshortcuts":ax(CM.save),onClick:()=>{c||s()},children:`Save`})]})}var ame=`rounded-media border border-line bg-surface p-4`;function Q2(){return(0,h.jsxs)(`div`,{className:`mx-auto grid max-w-[1440px] grid-cols-[minmax(0,1fr)] gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${ame} flex flex-col gap-4`,children:[(0,h.jsx)(`span`,{className:`h-8 w-64 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-[520px] rounded-control bg-sunken`})]}),(0,h.jsx)(`div`,{className:`flex flex-col gap-3 pt-1`,children:(0,h.jsx)(`span`,{className:`h-3 w-28 rounded-control bg-sunken`})})]})}var ome=`modulepreload`,sme=function(e){return`/`+e},$2={},e4=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=sme(t,n),t=s(t),t in $2)return;$2[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ome,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function cme({data:e,label:t,onDrawn:n}){let r=(0,m.useRef)(null),[i,a]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let e=r.current;if(e===null)return;let t=new ResizeObserver(([e])=>{a(Math.floor(e?.contentRect.width??0))});return t.observe(e),()=>{t.disconnect()}},[]),(0,m.useEffect)(()=>{let t=r.current;if(t===null||e===void 0||i===0)return;let a=!1;return lme(e,i).then(e=>{a||(t.replaceChildren(...e),n?.(void 0))},e=>{a||n?.(e instanceof Error?e:Error(String(e)))}),()=>{a=!0}},[e,i,n]),(0,h.jsx)(`div`,{ref:r,role:`img`,"aria-label":t,className:`flex flex-col gap-3 [&>canvas]:w-full [&>canvas]:shadow-[var(--shadow-pop)]`})}async function lme(e,t){let n=await e4(()=>import(`./pdf-Dsbuwxiz.js`),[]),r=await e4(()=>import(`./pdf.worker.min-zC6nfbxG.js`),[]);n.GlobalWorkerOptions.workerSrc=r.default;let i=n.getDocument({data:e.slice()}),a=await i.promise;try{let e=window.devicePixelRatio||1,n=[];for(let r=1;r<=a.numPages;r+=1){let i=await a.getPage(r),o=i.getViewport({scale:t*e/i.getViewport({scale:1}).width}),s=window.document.createElement(`canvas`);s.width=Math.floor(o.width),s.height=Math.floor(o.height),await i.render({canvas:s,viewport:o}).promise,n.push(s)}return n}finally{await i.destroy()}}var t4=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`mm`,step:1,...n===void 0?{}:{help:n}}),n4=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`pt`,step:.5,...n===void 0?{}:{help:n}}),r4=(e,t,n,r)=>({kind:`number`,path:e,label:t,unit:n,step:.05,...r===void 0?{}:{help:r}}),i4=(e,t,n)=>({kind:`toggle`,path:e,label:t,...n===void 0?{}:{help:n}}),a4=(e,t,n)=>({kind:`text`,path:e,label:t,...n===void 0?{}:{help:n}}),o4=(e,t,n)=>({kind:`optional-text`,path:e,label:t,...n===void 0?{}:{help:n}}),s4=(e,t,n)=>({kind:`face`,path:[`fonts`,e],label:t,...n===void 0?{}:{help:n}}),ume=[{title:`Page`,fields:[{kind:`choice`,path:[`page`,`format`],label:`Paper size`,options:[{value:`a4`,label:`A4`},{value:`letter`,label:`US Letter`}]},t4([`page`,`margin`],`Margins`),t4([`page`,`contentTop`],`Text starts at`,`From the top, on pages with the header.`),{kind:`choice`,path:[`background`,`image`],label:`Background`,options:[{value:`parchment`,label:`Parchment texture`},{value:null,label:`Flat colour`}]},{kind:`color`,path:[`background`,`color`],label:`Page colour`,help:`Used when the background is a flat colour.`}]},{title:`Colours`,fields:[{kind:`color`,path:[`colors`,`heading`],label:`Headings`,help:`Also drop caps, the brand name and links.`},{kind:`color`,path:[`colors`,`text`],label:`Body text`},{kind:`color`,path:[`colors`,`muted`],label:`Muted`,help:`Dates, bullets, quotes and the dots in the contents.`},{kind:`color`,path:[`colors`,`faint`],label:`Faint`,help:`Running header and page numbers.`}]},{title:`Fonts`,fields:[s4(`body`,`Body`),s4(`strong`,`Bold text`),s4(`emphasis`,`Italic text`),s4(`heading`,`Headings`),s4(`dramatic`,`Chapter numbers and brand`,`The big number of a "Chapter 3:" heading.`),s4(`decorative`,`Tagline and title-page link`),s4(`dropCap`,`Drop caps`),s4(`footer`,`Header and page numbers`)]},{title:`Text sizes`,fields:[n4([`sizes`,`title`],`Title`),n4([`sizes`,`brand`],`Brand`),n4([`sizes`,`section`],`Top-level headings`,`Also the titles of the contents, sources and closing pages.`),n4([`sizes`,`heading`],`Second-level headings`),n4([`sizes`,`subheading`],`Third-level headings`),n4([`sizes`,`body`],`Body`),n4([`sizes`,`meta`],`Date and word count`),n4([`sizes`,`footer`],`Header and page numbers`)]},{title:`Spacing`,fields:[t4([`spacing`,`bodyLine`],`Body line height`),t4([`spacing`,`headingLine`],`Heading line height`),t4([`spacing`,`subheadingLine`],`Subheading line height`),r4([`spacing`,`paragraphGap`],`After a paragraph`,`× line`),r4([`spacing`,`headingGap`],`Before a heading`,`× line`),r4([`spacing`,`itemGap`],`After a list item`,`× line`),t4([`spacing`,`listIndent`],`List indent`),t4([`spacing`,`quoteIndent`],`Quote indent`),t4([`spacing`,`ruleWidth`],`Divider width`,`The short centred line a --- becomes.`)]},{title:`Drop caps`,fields:[i4([`dropCap`,`enabled`],`Drop caps`,`A large first letter after each heading.`),{kind:`choice`,path:[`dropCap`,`lines`],label:`Lines tall`,options:[{value:2,label:`2 lines`},{value:3,label:`3 lines`},{value:4,label:`4 lines`}]},r4([`dropCap`,`scale`],`Letter size`,`× lines`),t4([`dropCap`,`gap`],`Gap beside it`),{kind:`number`,path:[`dropCap`,`minLength`],label:`Shortest paragraph`,unit:`chars`,step:10,help:`Shorter paragraphs start plainly.`},r4([`dropCap`,`minRoom`],`Room needed`,`of page`,`With less room left, the paragraph starts on the next page.`)]},{title:`Title page`,fields:[t4([`titlePage`,`brandY`],`Brand from top`),t4([`titlePage`,`taglineOffset`],`Tagline below brand`),t4([`titlePage`,`titleY`],`Title from top`),t4([`titlePage`,`titleLine`],`Title line height`),t4([`titlePage`,`metaOffset`],`Details below title`),t4([`titlePage`,`metaLine`],`Details line height`),i4([`titlePage`,`showDate`],`Show the date`),i4([`titlePage`,`showWordCount`],`Show the word count`),i4([`titlePage`,`cover`,`enabled`],`Thumbnail as cover`,`When the project has a thumbnail.`),t4([`titlePage`,`cover`,`gap`],`Space around cover`),t4([`titlePage`,`cover`,`maxHeight`],`Cover height at most`)]},{title:`Branding`,fields:[o4([`brand`,`name`],`Brand name`,`Leave empty to hide the brand.`),o4([`brand`,`tagline`],`Tagline`),o4([`brand`,`url`],`Website`,`Where the brand and its link go.`),o4([`brand`,`linkLabel`],`Link text`,`The linked line under the word count.`)]},{title:`Contents page`,fields:[i4([`contents`,`enabled`],`Contents page`),a4([`contents`,`title`],`Title`),{kind:`choice`,path:[`contents`,`depth`],label:`Lists headings down to`,options:[{value:1,label:`Top level`},{value:2,label:`Second level`},{value:3,label:`Third level`}]},t4([`contents`,`titleOffset`],`Title from top margin`),t4([`contents`,`firstEntryOffset`],`First entry from top margin`),t4([`contents`,`line`],`Line height`),t4([`contents`,`indent`],`Indent per level`)]},{title:`Header and footer`,fields:[i4([`header`,`enabled`],`Running header`,`The title at the top of each page.`),t4([`header`,`top`],`Header from top`),{kind:`number`,path:[`header`,`maxTitleCharacters`],label:`Header title at most`,unit:`chars`,step:1},i4([`footer`,`enabled`],`Page numbers`),a4([`footer`,`text`],`Page number text`,`{page} becomes the page number.`),t4([`footer`,`bottom`],`From the bottom`),t4([`footer`,`reserve`],`Space kept above it`)]},{title:`Sources page`,fields:[i4([`sources`,`enabled`],`Sources page`,`The links the article and research used.`),a4([`sources`,`title`],`Title`),t4([`sources`,`titleOffset`],`Title from top margin`),t4([`sources`,`bodyOffset`],`List from top margin`),t4([`sources`,`line`],`Line height`),t4([`sources`,`gap`],`Gap between sources`)]},{title:`Closing page`,fields:[i4([`endPage`,`enabled`],`Closing page`),a4([`endPage`,`title`],`Title`),{kind:`lines`,path:[`endPage`,`lines`],label:`Text`,help:`One line each. Start with "•" for a bullet, end with ":" for a bold label, leave a line empty for a gap.`},i4([`endPage`,`showDocumentDetails`],`Add date, word and page counts`),{kind:`link`,path:[`endPage`,`link`],label:`Link`},o4([`endPage`,`closing`],`Closing line`),t4([`endPage`,`titleOffset`],`Title from top margin`),t4([`endPage`,`bodyOffset`],`Text from top margin`)]},{title:`PDF details`,fields:[a4([`metadata`,`author`],`Author`,`Shown in a PDF reader's document properties. {title} becomes the title.`),a4([`metadata`,`subject`],`Subject`),a4([`metadata`,`keywords`],`Keywords`),a4([`metadata`,`creator`],`Creator`)]}],c4=DA.map(e=>({value:e,label:{Cinzel:`Cinzel`,Literata:`Literata`,times:`Times`,helvetica:`Helvetica`,courier:`Courier`}[e]}));function l4(e){let t={normal:`Regular`,medium:`Medium`,bold:`Bold`,black:`Black`,italic:`Italic`,bolditalic:`Bold italic`};return(e===`Cinzel`?[`normal`,`medium`,`bold`,`black`]:[`normal`,`bold`,`italic`,`bolditalic`]).map(e=>({value:e,label:t[e]}))}function dme(e,t){let n=e;for(let e of t)n=n?.[e];return n}function u4(e,t,n){let[r,...i]=t;if(r===void 0)return n;let a=e[r];return{...e,[r]:i.length===0?n:u4(a,i,n)}}function fme(e){let t=FA;for(let n of e)t=t?.shape?.[n];return{min:t?.minValue??0,max:t?.maxValue??1e3}}function d4(e){return`values.${e.join(`.`)}`}var f4=`pt-1`,p4=`flex min-w-0 flex-col gap-3 pt-1 lg:sticky lg:top-16`;function m4({children:e}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{children:`Library`}),(0,h.jsx)(Tc,{"aria-hidden":`true`}),e]})}function h4({children:e,back:t}){return(0,h.jsxs)(`div`,{className:`mx-auto flex max-w-[1440px] flex-col gap-3`,children:[(0,h.jsx)(pP,{tone:`danger`,title:`This can't be opened.`,children:e}),(0,h.jsx)(`p`,{className:`m-0 text-small text-accent-ink underline underline-offset-[3px]`,children:t})]})}function g4({themeId:e,from:t,onLeave:n}){let{api:r}=R(),i=_(),a=N(eb(r)),o=(0,m.useId)(),[s,c]=(0,m.useState)(void 0),[l,u]=(0,m.useState)([]),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)(!1),v=a.data,y=e===void 0?void 0:v?.themes.find(t=>t.id===e),b=e===void 0?v?.themes.find(e=>e.id===t)??v?.builtIns.find(e=>e.name===(t??`plain`))??v?.builtIns[0]:y,x=b===void 0?void 0:{name:e===void 0?`${`label`in b?b.label:b.name} copy`:b.name,values:b.values},S=s??x,C=P({mutationFn:t=>Js(r,t,e),onSuccess:async e=>{if(!e.ok){u(e.fields);return}f(!0),await i.invalidateQueries({queryKey:eb(r).queryKey})}}),w=P({mutationFn:e=>Ys(r,e),onSuccess:async()=>{g(!1),await i.invalidateQueries({queryKey:eb(r).queryKey}),n()}});Y2(d,n);let T=(0,m.useMemo)(()=>S===void 0?void 0:FA.safeParse(S.values),[S]),E=[...S===void 0||S.name.trim()===``?[]:wS(S.name),...T===void 0||T.success?[]:T.error.issues.map(e=>({field:`values.${e.path.join(`.`)}`,message:e.message})),...l];if(a.error!==null)return(0,h.jsx)(y4,{children:a.error.message});if(v===void 0)return(0,h.jsx)(Q2,{});if(S===void 0)return(0,h.jsx)(y4,{children:`That theme is gone. It may have been deleted in another tab.`});let D=(e,t)=>{c(e),u(e=>e.filter(e=>e.field!==t))},O=S.name.trim()===``?`Give the theme a name.`:E.length>0?`Fix the highlighted settings first.`:void 0,k=E.filter(e=>e.field===`name`);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(bq,{crumb:(0,h.jsx)(m4,{children:(0,h.jsx)(ha,{to:`/document-themes`,children:`Documents`})}),title:e===void 0?`New document theme`:`Edit document theme`,meta:`How a project's PDF looks`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(320px,440px)]`,children:[(0,h.jsxs)(`div`,{className:`${f4} flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(uV,{label:`Name`,tip:`library.theme.name`,...k.length===0?{}:{error:k.map(e=>e.message).join(` `)},children:(0,h.jsx)(Y,{value:S.name,onChange:e=>{D({...S,name:e.target.value},`name`)}})}),ume.map((e,t)=>(0,h.jsxs)(`details`,{open:t<2||e.fields.some(e=>_4(E,e.path)),className:`group border-t border-line`,children:[(0,h.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 py-3 text-title-3 font-semibold`,onClick:e=>{let t=e.currentTarget.parentElement;requestAnimationFrame(()=>{t instanceof HTMLDetailsElement&&t.open&&t.scrollIntoView?.({block:`nearest`,behavior:`smooth`})})},children:[(0,h.jsx)(Tc,{"aria-hidden":`true`,className:`size-[14px] text-ink-2 transition-transform group-open:rotate-90 motion-reduce:transition-none`}),e.title]}),(0,h.jsx)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-x-5 gap-y-4 pb-4 sm:grid-cols-2`,children:e.fields.map(e=>(0,h.jsx)(hme,{field:e,theme:S.values,problem:_4(E,e.path),onChange:t=>{D({...S,values:t},d4(e.path))}},e.path.join(`.`)))})]},e.title)),(0,h.jsx)(Z2,{onDelete:e===void 0?void 0:()=>{g(!0)},blocked:O,blockedId:o,pending:C.isPending,saved:d,cancel:(0,h.jsx)(zx,{to:`/document-themes`,variant:`secondary`,children:`Cancel`}),errors:[C.error,w.error].flatMap(e=>e===null?[]:[e.message]),onSave:()=>{C.mutate(S)}})]}),(0,h.jsx)(mme,{values:T?.success===!0?S.values:void 0})]}),(0,h.jsx)(Dy,{open:p,title:`Delete "${S.name}"?`,consequence:`Projects that used it keep their own copy of its settings.`,confirmLabel:`Delete theme`,pending:w.isPending,onConfirm:()=>{e!==void 0&&w.mutate(e)},onCancel:()=>{g(!1)}})]})}var pme={"values.page.format":`library.theme.page.format`,"values.page.margin":`library.theme.page.margin`,"values.page.contentTop":`library.theme.page.content-top`,"values.background.image":`library.theme.background.image`,"values.background.color":`library.theme.background.color`,"values.colors.heading":`library.theme.colors.heading`,"values.colors.text":`library.theme.colors.text`,"values.colors.muted":`library.theme.colors.muted`,"values.colors.faint":`library.theme.colors.faint`,"values.fonts.body":`library.theme.fonts.body`,"values.fonts.strong":`library.theme.fonts.strong`,"values.fonts.emphasis":`library.theme.fonts.emphasis`,"values.fonts.heading":`library.theme.fonts.heading`,"values.fonts.dramatic":`library.theme.fonts.dramatic`,"values.fonts.decorative":`library.theme.fonts.decorative`,"values.fonts.dropCap":`library.theme.fonts.drop-cap`,"values.fonts.footer":`library.theme.fonts.footer`,"values.sizes.title":`library.theme.sizes.title`,"values.sizes.brand":`library.theme.sizes.brand`,"values.sizes.section":`library.theme.sizes.section`,"values.sizes.heading":`library.theme.sizes.heading`,"values.sizes.subheading":`library.theme.sizes.subheading`,"values.sizes.body":`library.theme.sizes.body`,"values.sizes.meta":`library.theme.sizes.meta`,"values.sizes.footer":`library.theme.sizes.footer`,"values.spacing.bodyLine":`library.theme.spacing.body-line`,"values.spacing.headingLine":`library.theme.spacing.heading-line`,"values.spacing.subheadingLine":`library.theme.spacing.subheading-line`,"values.spacing.paragraphGap":`library.theme.spacing.paragraph-gap`,"values.spacing.headingGap":`library.theme.spacing.heading-gap`,"values.spacing.itemGap":`library.theme.spacing.item-gap`,"values.spacing.listIndent":`library.theme.spacing.list-indent`,"values.spacing.quoteIndent":`library.theme.spacing.quote-indent`,"values.spacing.ruleWidth":`library.theme.spacing.rule-width`,"values.dropCap.enabled":`library.theme.drop-cap.enabled`,"values.dropCap.lines":`library.theme.drop-cap.lines`,"values.dropCap.scale":`library.theme.drop-cap.scale`,"values.dropCap.gap":`library.theme.drop-cap.gap`,"values.dropCap.minLength":`library.theme.drop-cap.min-length`,"values.dropCap.minRoom":`library.theme.drop-cap.min-room`,"values.titlePage.brandY":`library.theme.title-page.brand-y`,"values.titlePage.taglineOffset":`library.theme.title-page.tagline-offset`,"values.titlePage.titleY":`library.theme.title-page.title-y`,"values.titlePage.titleLine":`library.theme.title-page.title-line`,"values.titlePage.metaOffset":`library.theme.title-page.meta-offset`,"values.titlePage.metaLine":`library.theme.title-page.meta-line`,"values.titlePage.showDate":`library.theme.title-page.show-date`,"values.titlePage.showWordCount":`library.theme.title-page.show-word-count`,"values.titlePage.cover.enabled":`library.theme.title-page.cover`,"values.titlePage.cover.gap":`library.theme.title-page.cover-gap`,"values.titlePage.cover.maxHeight":`library.theme.title-page.cover-height`,"values.brand.name":`library.theme.brand.name`,"values.brand.tagline":`library.theme.brand.tagline`,"values.brand.url":`library.theme.brand.url`,"values.brand.linkLabel":`library.theme.brand.link-label`,"values.contents.enabled":`library.theme.contents.enabled`,"values.contents.title":`library.theme.contents.title`,"values.contents.depth":`library.theme.contents.depth`,"values.contents.titleOffset":`library.theme.contents.title-offset`,"values.contents.firstEntryOffset":`library.theme.contents.first-entry-offset`,"values.contents.line":`library.theme.contents.line`,"values.contents.indent":`library.theme.contents.indent`,"values.header.enabled":`library.theme.header.enabled`,"values.header.top":`library.theme.header.top`,"values.header.maxTitleCharacters":`library.theme.header.max-title`,"values.footer.enabled":`library.theme.footer.enabled`,"values.footer.text":`library.theme.footer.text`,"values.footer.bottom":`library.theme.footer.bottom`,"values.footer.reserve":`library.theme.footer.reserve`,"values.sources.enabled":`library.theme.sources.enabled`,"values.sources.title":`library.theme.sources.title`,"values.sources.titleOffset":`library.theme.sources.title-offset`,"values.sources.bodyOffset":`library.theme.sources.body-offset`,"values.sources.line":`library.theme.sources.line`,"values.sources.gap":`library.theme.sources.gap`,"values.endPage.enabled":`library.theme.end-page.enabled`,"values.endPage.title":`library.theme.end-page.title`,"values.endPage.lines":`library.theme.end-page.lines`,"values.endPage.showDocumentDetails":`library.theme.end-page.details`,"values.endPage.link":`library.theme.end-page.link`,"values.endPage.closing":`library.theme.end-page.closing`,"values.endPage.titleOffset":`library.theme.end-page.title-offset`,"values.endPage.bodyOffset":`library.theme.end-page.body-offset`,"values.metadata.author":`library.theme.metadata.author`,"values.metadata.subject":`library.theme.metadata.subject`,"values.metadata.keywords":`library.theme.metadata.keywords`,"values.metadata.creator":`library.theme.metadata.creator`};function _4(e,t){let n=d4(t),r=e.filter(e=>e.field===n||e.field.startsWith(`${n}.`));return r.length===0?void 0:r.map(e=>e.message).join(` `)}function mme({values:e}){let{api:t}=R(),[n,r]=(0,m.useState)(),[i,a]=(0,m.useState)(`busy`),[o,s]=(0,m.useState)(void 0),c=e===void 0?void 0:JSON.stringify(e);(0,m.useEffect)(()=>{if(c===void 0)return;let e=new AbortController,n=window.setTimeout(()=>{a(`busy`),Xs(t,JSON.parse(c),e.signal).then(async e=>({bytes:new Uint8Array(await e.arrayBuffer()),blob:e})).then(({bytes:t,blob:n})=>{e.signal.aborted||r({bytes:t,url:URL.createObjectURL(n)})},t=>{e.signal.aborted||(s(t instanceof Error?t.message:String(t)),a(`failed`))})},450);return()=>{window.clearTimeout(n),e.abort()}},[t,c]),(0,m.useEffect)(()=>()=>{n!==void 0&&URL.revokeObjectURL(n.url)},[n]);let l=(0,m.useCallback)(e=>{if(e===void 0){a(`idle`);return}s(e.message),a(`failed`)},[]),u=e===void 0?`Paused until the highlighted settings are fixed.`:i===`busy`?`Updating…`:i===`failed`?`The preview couldn't be made: ${o??`unknown error`}`:`A sample article with this theme. Your projects use their own text and thumbnail.`;return(0,h.jsxs)(`div`,{className:p4,children:[(0,h.jsx)(V,{title:`Preview`,info:`library.theme.preview`,size:`small`,className:`pb-0`,children:n===void 0?null:(0,h.jsxs)(Vx,{href:n.url,target:`_blank`,rel:`noreferrer`,variant:`secondary`,size:`small`,children:[(0,h.jsx)(Mc,{"aria-hidden":`true`,strokeWidth:1.75}),`Open full size`]})}),(0,h.jsx)(`div`,{className:`max-h-[calc(100vh-220px)] min-h-[320px] overflow-y-auto rounded-media bg-sunken p-3`,children:(0,h.jsx)(cme,{data:n?.bytes,label:`The sample article laid out with this theme`,onDrawn:l})}),(0,h.jsx)(`p`,{role:`status`,className:i===`failed`?`m-0 text-small text-danger`:`m-0 text-small text-ink-2`,children:u})]})}function hme({field:e,theme:t,problem:n,onChange:r}){let i=(0,m.useId)(),a=dme(t,e.path),o=pme[d4(e.path)],s=o===void 0?null:(0,h.jsx)(B,{id:o,label:e.label,className:`-my-1`}),c=n=>{r(u4(t,e.path,n))},l=[e.help===void 0?``:`${i}-help`,n===void 0?``:`${i}-error`].filter(e=>e!==``).join(` `),u=(0,h.jsxs)(h.Fragment,{children:[e.help===void 0?null:(0,h.jsx)(`p`,{id:`${i}-help`,className:`sl-field__help m-0`,children:e.help}),n===void 0?null:(0,h.jsx)(`p`,{id:`${i}-error`,className:`sl-field__error m-0`,children:n})]}),d={id:i,"aria-invalid":n!==void 0,"aria-describedby":l===``?void 0:l};switch(e.kind){case`toggle`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:i,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{...d,type:`checkbox`,checked:a===!0,className:`size-4 accent-accent`,onChange:e=>{c(e.currentTarget.checked)}}),e.label]}),s]}),u]});case`number`:{let{min:t,max:n}=fme(e.path);return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(Y,{...d,type:`number`,inputMode:`decimal`,min:t,max:n,step:e.step,className:`w-28`,value:typeof a==`number`&&Number.isFinite(a)?a:``,onChange:e=>{c(e.target.value===``?NaN:Number(e.target.value))}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:e.unit})]})})}case`color`:{let t=typeof a==`string`?a:``,n=/^#?[0-9a-f]{6}$/i.test(t)?`#${t.replace(`#`,``)}`:/^#?[0-9a-f]{3}$/i.test(t)?`#${[...t.replace(`#`,``)].map(e=>e+e).join(``)}`:`#000000`;return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`color`,"aria-label":`${e.label} colour`,value:n,className:`h-8 w-10 cursor-pointer rounded-control border border-line-strong bg-transparent p-0.5`,onChange:e=>{c(e.target.value)}}),(0,h.jsx)(Y,{...d,className:`w-28 font-mono`,value:t,onChange:e=>{c(e.target.value)}})]})})}case`text`:return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsx)(Y,{...d,value:typeof a==`string`?a:``,onChange:e=>{c(e.target.value)}})});case`optional-text`:return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsx)(Y,{...d,value:typeof a==`string`?a:``,onChange:e=>{c(e.target.value===``?null:e.target.value)}})});case`choice`:{let t=e.options.findIndex(e=>e.value===a);return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsx)(pV,{...d,value:String(t),onChange:t=>{let n=e.options[Number(t.target.value)];n!==void 0&&c(n.value)},children:e.options.map((e,t)=>(0,h.jsx)(`option`,{value:String(t),children:e.label},e.label))})})}case`face`:{let t=a,n=l4(t.family);return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(pV,{...d,"aria-label":`${e.label} font`,value:t.family,onChange:e=>{let n=c4.find(t=>t.value===e.target.value);if(n===void 0)return;let r=l4(n.value).some(e=>e.value===t.style);c({...t,family:n.value,style:r?t.style:`normal`})},children:c4.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(pV,{"aria-label":`${e.label} style`,value:t.style,onChange:e=>{c({...t,style:e.target.value})},children:n.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(Y,{type:`number`,"aria-label":`${e.label} letter spacing in millimetres`,title:`Letter spacing (mm)`,step:.01,className:`w-20`,value:Number.isFinite(t.letterSpacing)?t.letterSpacing:``,onChange:e=>{c({...t,letterSpacing:e.target.value===``?NaN:Number(e.target.value)})}})]})})}case`lines`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:i,className:`sl-field__label`,children:e.label}),s]}),(0,h.jsx)(fV,{...d,rows:8,value:Array.isArray(a)?a.join(`
|
|
273
|
+
`),filter:g})},onCancel:()=>{y.reset(),p(void 0)}}),r.data&&C.length===0?(0,h.jsx)(J1,{title:`No existing videos listed`,children:`In YouTube Studio open Analytics → Content → Advanced mode, export the table as a CSV, and import it here; or paste the titles above.`}):null,C.length>0?(0,h.jsx)(iU,{label:`Existing videos`,children:C.map(e=>(0,h.jsx)(aU,{title:e.title,actions:(0,h.jsx)(L,{size:`small`,variant:`quiet`,disabled:w,"aria-label":`Remove ${e.title}`,onClick:()=>x.mutate(e.id),children:`Remove`})},e.id))}):null,(0,h.jsx)(Dy,{open:o,title:`Remove all ${V2(C.length,`title`,`titles`)}?`,consequence:S.error?.message??`Topic suggestions and duplicate checks stop skipping them. Your videos on YouTube are not touched.`,confirmLabel:`Remove all`,pending:S.isPending,onConfirm:()=>S.mutate(),onCancel:()=>s(!1)})]})}function $pe({preview:e,filter:t,busy:n,onFilter:r,onTick:i,onSave:a,onCancel:o}){let s=(0,m.useId)(),c=e.ticked.filter(Boolean).length;return(0,h.jsxs)(`section`,{"aria-label":`Titles in the CSV`,className:`mt-4`,...cb,children:[(0,h.jsxs)(V,{as:`h3`,title:`Titles in the CSV`,info:`planning.channel.videos-ticks`,meta:`${c.toLocaleString(`en`)} of ${V2(e.titles.length,`title`,`titles`)} ticked`,children:[(0,h.jsxs)(L,{variant:`primary`,disabled:n||c===0,onClick:a,children:[`Add `,V2(c,`ticked title`,`ticked titles`)]}),(0,h.jsx)(L,{variant:`quiet`,disabled:n,onClick:o,children:`Cancel`})]}),(0,h.jsx)(uV,{label:`Keep only titles containing…`,tip:`planning.channel.videos-filter`,tipLabel:`Keep only titles containing`,children:(0,h.jsx)(Y,{value:t,maxLength:200,onChange:e=>r(e.target.value)})}),(0,h.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(L,{size:`small`,disabled:n,onClick:()=>i(e.titles.map(()=>!0)),children:`Tick all`}),(0,h.jsx)(L,{size:`small`,disabled:n,onClick:()=>i(e.titles.map(()=>!1)),children:`Untick all`})]}),(0,h.jsx)(iU,{label:`Titles in the CSV`,className:`mt-2`,children:e.titles.map((t,r)=>(0,h.jsx)(aU,{lead:(0,h.jsx)(`input`,{id:`${s}-${r}`,type:`checkbox`,checked:e.ticked[r]===!0,disabled:n,className:`size-4 shrink-0 accent-accent`,onChange:t=>i(e.ticked.map((e,n)=>n===r?t.target.checked:e))}),title:(0,h.jsx)(`label`,{htmlFor:`${s}-${r}`,children:t})},r))})]})}var U2=[`brand`,`cast`,`templates`,`schedules`,`episodes`,`videos`],eme={brand:`Brand`,cast:`Cast`,templates:`Templates`,schedules:`Schedules`,episodes:`Episodes`,videos:`Existing videos`};function tme(e){return U2.find(t=>t===e)??`brand`}function nme({channelId:e,tab:t,onTab:n}){let{api:r}=R(),i=_(),a=Zi(),o=N(Tb(r,e)),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(null),d=P({mutationFn:()=>Ob(r,e),onSuccess:async()=>{c(!1),await i.invalidateQueries({queryKey:bb}),await a({to:`/channels`})}}),f=o.data?.channel,p=o.data?.cast??[],g=()=>{n(`cast`),u(`new`)};return qb({id:`channel.add-to-cast`,title:`Add to cast`,group:`Channel`,...f===void 0?{}:{context:f.name},keywords:[`character`,`creature`,`place`,`object`],run:g}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(bq,{crumb:(0,h.jsx)(ha,{to:`/channels`,children:`Channels`}),title:f?.name??`Channel`,meta:f?.isDefault?`Default channel`:void 0,actions:(0,h.jsxs)(h.Fragment,{children:[t===`cast`&&f?(0,h.jsxs)(L,{variant:`primary`,onClick:g,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add to cast`]}):null,f&&!f.isDefault?(0,h.jsx)(L,{variant:`quiet`,onClick:()=>{d.reset(),c(!0)},children:`Delete channel`}):null]})}),(0,h.jsx)(K1,{items:U2.map(e=>({id:e,label:eme[e],...e===`cast`?{badge:String(p.length)}:{}})),value:t,onChange:n,label:`Channel sections`,idPrefix:`channel`,className:`mb-6`}),(0,h.jsx)(V1,{tone:o.error?`error`:`info`,className:`mb-2`,children:o.error?`The channel couldn't be loaded: ${o.error.message} Go back to Channels and open it again.`:o.isPending?`Loading the channel…`:void 0}),f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(q1,{idPrefix:`channel`,id:`brand`,active:t===`brand`,children:[(0,h.jsx)(Tpe,{channel:f}),(0,h.jsx)(Npe,{channel:f},`${f.id}:${String(f.version)}`)]}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`cast`,active:t===`cast`,children:(0,h.jsx)(Bpe,{channelId:f.id,cast:p,selected:l,onSelect:u})}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`templates`,active:t===`templates`,children:t===`templates`?(0,h.jsx)(Jde,{channelId:f.id}):null}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`schedules`,active:t===`schedules`,children:t===`schedules`?(0,h.jsx)(Zde,{channelId:f.id}):null}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`episodes`,active:t===`episodes`,children:t===`episodes`?(0,h.jsx)(Xpe,{channelId:f.id}):null}),(0,h.jsx)(q1,{idPrefix:`channel`,id:`videos`,active:t===`videos`,children:t===`videos`?(0,h.jsx)(Qpe,{channelId:f.id}):null})]}):null,(0,h.jsx)(Dy,{open:s,title:`Delete ${f?.name??`this channel`}?`,consequence:d.error?.message??`Its cast goes with it. Its videos move to the default channel and keep what they were made with.`,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:d.isPending,onConfirm:()=>d.mutate(),onCancel:()=>c(!1)})]})}function W2({className:e,children:t}){return(0,h.jsx)(`dl`,{className:I(`sl-stats m-0`,e),children:t})}function G2({value:e,label:t,children:n}){return(0,h.jsxs)(`div`,{className:`sl-stat`,children:[(0,h.jsx)(`dt`,{className:`sl-stat__label order-2`,children:t}),(0,h.jsx)(`dd`,{className:`sl-stat__value order-1 m-0`,children:e}),n===void 0?null:(0,h.jsx)(`dd`,{className:`order-3 m-0 mt-1`,children:n})]})}function K2({value:e,label:t,valueText:n,tone:r=`accent`,className:i}){let a=Math.round(Math.min(1,Math.max(0,Number.isFinite(e)?e:0))*100);return(0,h.jsx)(`div`,{role:`meter`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,"aria-valuetext":n??`${String(a)}%`,className:I(`sl-meter`,r===`waiting`&&`sl-meter--waiting`,i),children:(0,h.jsx)(`span`,{style:{width:`${String(a)}%`}})})}function q2({columns:e,rows:t,rowKey:n,caption:r,empty:i,className:a}){return(0,h.jsxs)(`table`,{className:I(`sl-table`,a),children:[(0,h.jsx)(`caption`,{className:`sr-only`,children:r}),(0,h.jsx)(`thead`,{children:(0,h.jsx)(`tr`,{children:e.map(e=>(0,h.jsx)(`th`,{scope:`col`,className:e.numeric?`num`:void 0,children:e.header},e.id))})}),(0,h.jsx)(`tbody`,{children:t.length===0&&i!==void 0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:e.length,className:`text-ink-2`,children:i})}):t.map(t=>(0,h.jsx)(`tr`,{children:e.map(e=>(0,h.jsx)(`td`,{className:e.numeric?`num`:void 0,children:e.cell(t)},e.id))},n(t)))})]})}function rme(){let{api:e}=R(),t=_(),n=Zi(),r=N(wb(e)),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(null),f=r.data?.find(e=>e.id===u)??r.data?.[0],p=P({mutationFn:()=>Eb(e,crypto.randomUUID(),c.trim()),onSuccess:async e=>{await t.invalidateQueries({queryKey:bb}),a(null),l(``),await n({to:`/channels/$channelId`,params:{channelId:e.id}})}}),g=P({mutationFn:t=>Db(e,t.id,{name:c.trim(),brand:t.brand,seriesBrief:t.seriesBrief,baseVersion:t.version}),onSuccess:async()=>{await t.invalidateQueries({queryKey:bb}),a(null)}}),v=P({mutationFn:t=>Ob(e,t.id),onSuccess:async()=>{s(null),await t.invalidateQueries({queryKey:bb})}}),y=()=>{p.reset(),l(``),a(`new`)};qb({id:`channels.new`,title:`New channel`,group:`Channels`,run:y});let b=i===`new`?p:g,x=()=>{c.trim()!==``&&i!==null&&(i===`new`?p.mutate():g.mutate(i))};return(0,h.jsxs)(`div`,{"data-tour":`channels`,children:[(0,h.jsx)(bq,{title:`Channels`,meta:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`A channel keeps its brand kit, cast, series brief, templates and schedules together.`,(0,h.jsx)(B,{id:`planning.channels`})]}),actions:(0,h.jsxs)(L,{variant:`primary`,"aria-expanded":i===`new`,onClick:y,children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New channel`]})}),(0,h.jsx)(V1,{tone:r.error||v.error?`error`:`info`,className:`mb-2`,children:r.error?`The channels couldn't be loaded: ${r.error.message} Reload the page to try again.`:o===null&&v.error?v.error.message:r.isPending?`Loading channels…`:void 0}),r.data?.length===0?(0,h.jsx)(J1,{title:`No channels yet`,actions:(0,h.jsx)(L,{variant:`primary`,onClick:y,children:`New channel`}),children:`Make one for each series you run; it keeps that series' look and cast.`}):null,r.data?.length?(0,h.jsx)(Sq,{list:(0,h.jsx)(iU,{label:`Channels`,className:`[&_.sl-row__actions]:flex-wrap`,children:r.data.map(e=>(0,h.jsx)(aU,{selected:e.id===f?.id,onSelect:()=>d(e.id),title:e.name,meta:`${e.isDefault?`Default · `:``}${String(e.templates)} ${e.templates===1?`template`:`templates`} · ${String(e.cast)} in the cast`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Bx,{to:`/channels/$channelId`,params:{channelId:e.id},"aria-label":`Open ${e.name}`,className:`px-2 text-small`,children:`Open`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Rename ${e.name}`,onClick:()=>{g.reset(),l(e.name),a(e)},children:`Rename`}),e.isDefault?null:(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Delete ${e.name}`,onClick:()=>{v.reset(),s(e)},children:`Delete`})]})},e.id))}),detail:f===void 0?null:(0,h.jsx)(ime,{channel:f})}):null,(0,h.jsx)(Ey,{open:i!==null,onOpenChange:e=>{!e&&!b.isPending&&a(null)},title:i===`new`||i===null?`New channel`:`Rename ${i.name}`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V1,{tone:b.error?`error`:`info`,children:b.error?.message??(b.isPending?`Saving…`:void 0)}),(0,h.jsx)(L,{disabled:b.isPending,onClick:()=>a(null),children:`Cancel`}),(0,h.jsx)(L,{type:`submit`,form:`channel-name-form`,variant:`primary`,disabled:b.isPending||c.trim()===``,children:i===`new`?`Create channel`:`Rename channel`})]}),children:(0,h.jsx)(`form`,{id:`channel-name-form`,"aria-label":i===`new`?`New channel`:`Rename channel`,onSubmit:e=>{e.preventDefault(),x()},children:(0,h.jsx)(uV,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(Y,{value:c,maxLength:200,required:!0,disabled:b.isPending,onChange:e=>l(e.target.value)})})})}),(0,h.jsx)(Dy,{open:o!==null,title:`Delete ${o?.name??`this channel`}?`,consequence:v.error?.message??`Its cast goes with it. Its videos move to the default channel and keep what they were made with.`,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:v.isPending,onConfirm:()=>{o&&v.mutate(o)},onCancel:()=>s(null)})]})}function ime({channel:e}){let t=e.brand,n=[[`Intro`,t.intro??`None`],[`Outro`,t.outro??`None`],[`Document theme`,t.documentTheme??`Default`],[`End screen text`,t.endScreenText??`None`]];return(0,h.jsxs)(`section`,{"aria-label":`About ${e.name}`,children:[(0,h.jsx)(V,{title:`About ${e.name}`,meta:e.isDefault?`The default channel`:void 0,children:(0,h.jsx)(zx,{to:`/channels/$channelId`,params:{channelId:e.id},children:`Open channel`})}),(0,h.jsxs)(W2,{className:`mb-6`,children:[(0,h.jsx)(G2,{value:String(e.templates),label:`Templates`}),(0,h.jsx)(G2,{value:String(e.cast),label:`In the cast`})]}),(0,h.jsx)(V,{as:`h3`,title:`Series brief`,className:`pb-2`}),(0,h.jsx)(`p`,{className:`m-0 mb-6 whitespace-pre-wrap text-body text-ink-2`,children:e.seriesBrief.trim()===``?`No series brief yet. Open the channel to say what it covers.`:e.seriesBrief}),(0,h.jsx)(V,{as:`h3`,title:`Brand kit`,className:`pb-2`}),(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-small`,children:n.map(([e,t])=>(0,h.jsxs)(`div`,{className:`contents`,children:[(0,h.jsx)(`dt`,{className:`text-ink-2`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 truncate`,children:t})]},e))})]})}var J2=2e3;function Y2(e,t){let n=(0,m.useRef)(t);(0,m.useEffect)(()=>{n.current=t}),(0,m.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{n.current()},J2);return()=>{clearTimeout(t)}},[e])}function X2(){return(0,h.jsxs)(`span`,{className:`inline-flex animate-tick-in items-center gap-1 text-label text-accent-ink motion-reduce:animate-none`,children:[(0,h.jsx)(Sc,{"aria-hidden":`true`,className:`size-[14px]`}),`Saved`]})}function Z2({onDelete:e,blocked:t,blockedId:n,pending:r,saved:i,cancel:a,errors:o,onSave:s}){let c=t!==void 0||r||i,l=gy();qb({id:`editor.save`,title:`Save`,group:`This editor`,keywords:[`save`,`keep`],shortcut:CM.save,run:()=>{c?t!==void 0&&l(`Not saved yet: ${t}`,`error`):s()}});let u=o.join(` `);return(0,h.jsxs)(`div`,{"data-slot":`editor-actions`,className:`sticky bottom-0 z-10 flex flex-wrap items-center gap-3 border-t border-line bg-ground py-3 max-md:bottom-[calc(48px+max(12px,env(safe-area-inset-bottom)))]`,children:[(0,h.jsx)(L,{variant:`destructive`,onClick:e,disabled:e===void 0,"aria-hidden":e===void 0||void 0,tabIndex:e===void 0?-1:void 0,style:e===void 0?{visibility:`hidden`}:void 0,children:`Delete`}),(0,h.jsx)(V1,{tone:u?`error`:`info`,id:u?void 0:n,children:u||(i?(0,h.jsx)(X2,{}):t)}),a,(0,h.jsx)(L,{variant:`primary`,"aria-disabled":c,"aria-describedby":t===void 0?void 0:n,"aria-keyshortcuts":ax(CM.save),onClick:()=>{c||s()},children:`Save`})]})}var ame=`rounded-media border border-line bg-surface p-4`;function Q2(){return(0,h.jsxs)(`div`,{className:`mx-auto grid max-w-[1440px] grid-cols-[minmax(0,1fr)] gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${ame} flex flex-col gap-4`,children:[(0,h.jsx)(`span`,{className:`h-8 w-64 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-[520px] rounded-control bg-sunken`})]}),(0,h.jsx)(`div`,{className:`flex flex-col gap-3 pt-1`,children:(0,h.jsx)(`span`,{className:`h-3 w-28 rounded-control bg-sunken`})})]})}var ome=`modulepreload`,sme=function(e){return`/`+e},$2={},e4=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=sme(t,n),t=s(t),t in $2)return;$2[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ome,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function cme({data:e,label:t,onDrawn:n}){let r=(0,m.useRef)(null),[i,a]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let e=r.current;if(e===null)return;let t=new ResizeObserver(([e])=>{a(Math.floor(e?.contentRect.width??0))});return t.observe(e),()=>{t.disconnect()}},[]),(0,m.useEffect)(()=>{let t=r.current;if(t===null||e===void 0||i===0)return;let a=!1;return lme(e,i).then(e=>{a||(t.replaceChildren(...e),n?.(void 0))},e=>{a||n?.(e instanceof Error?e:Error(String(e)))}),()=>{a=!0}},[e,i,n]),(0,h.jsx)(`div`,{ref:r,role:`img`,"aria-label":t,className:`flex flex-col gap-3 [&>canvas]:w-full [&>canvas]:shadow-[var(--shadow-pop)]`})}async function lme(e,t){let n=await e4(()=>import(`./pdf-BinfD_My.js`),[]),r=await e4(()=>import(`./pdf.worker.min-zC6nfbxG.js`),[]);n.GlobalWorkerOptions.workerSrc=r.default;let i=n.getDocument({data:e.slice()}),a=await i.promise;try{let e=window.devicePixelRatio||1,n=[];for(let r=1;r<=a.numPages;r+=1){let i=await a.getPage(r),o=i.getViewport({scale:t*e/i.getViewport({scale:1}).width}),s=window.document.createElement(`canvas`);s.width=Math.floor(o.width),s.height=Math.floor(o.height),await i.render({canvas:s,viewport:o}).promise,n.push(s)}return n}finally{await i.destroy()}}var t4=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`mm`,step:1,...n===void 0?{}:{help:n}}),n4=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`pt`,step:.5,...n===void 0?{}:{help:n}}),r4=(e,t,n,r)=>({kind:`number`,path:e,label:t,unit:n,step:.05,...r===void 0?{}:{help:r}}),i4=(e,t,n)=>({kind:`toggle`,path:e,label:t,...n===void 0?{}:{help:n}}),a4=(e,t,n)=>({kind:`text`,path:e,label:t,...n===void 0?{}:{help:n}}),o4=(e,t,n)=>({kind:`optional-text`,path:e,label:t,...n===void 0?{}:{help:n}}),s4=(e,t,n)=>({kind:`face`,path:[`fonts`,e],label:t,...n===void 0?{}:{help:n}}),ume=[{title:`Page`,fields:[{kind:`choice`,path:[`page`,`format`],label:`Paper size`,options:[{value:`a4`,label:`A4`},{value:`letter`,label:`US Letter`}]},t4([`page`,`margin`],`Margins`),t4([`page`,`contentTop`],`Text starts at`,`From the top, on pages with the header.`),{kind:`choice`,path:[`background`,`image`],label:`Background`,options:[{value:`parchment`,label:`Parchment texture`},{value:null,label:`Flat colour`}]},{kind:`color`,path:[`background`,`color`],label:`Page colour`,help:`Used when the background is a flat colour.`}]},{title:`Colours`,fields:[{kind:`color`,path:[`colors`,`heading`],label:`Headings`,help:`Also drop caps, the brand name and links.`},{kind:`color`,path:[`colors`,`text`],label:`Body text`},{kind:`color`,path:[`colors`,`muted`],label:`Muted`,help:`Dates, bullets, quotes and the dots in the contents.`},{kind:`color`,path:[`colors`,`faint`],label:`Faint`,help:`Running header and page numbers.`}]},{title:`Fonts`,fields:[s4(`body`,`Body`),s4(`strong`,`Bold text`),s4(`emphasis`,`Italic text`),s4(`heading`,`Headings`),s4(`dramatic`,`Chapter numbers and brand`,`The big number of a "Chapter 3:" heading.`),s4(`decorative`,`Tagline and title-page link`),s4(`dropCap`,`Drop caps`),s4(`footer`,`Header and page numbers`)]},{title:`Text sizes`,fields:[n4([`sizes`,`title`],`Title`),n4([`sizes`,`brand`],`Brand`),n4([`sizes`,`section`],`Top-level headings`,`Also the titles of the contents, sources and closing pages.`),n4([`sizes`,`heading`],`Second-level headings`),n4([`sizes`,`subheading`],`Third-level headings`),n4([`sizes`,`body`],`Body`),n4([`sizes`,`meta`],`Date and word count`),n4([`sizes`,`footer`],`Header and page numbers`)]},{title:`Spacing`,fields:[t4([`spacing`,`bodyLine`],`Body line height`),t4([`spacing`,`headingLine`],`Heading line height`),t4([`spacing`,`subheadingLine`],`Subheading line height`),r4([`spacing`,`paragraphGap`],`After a paragraph`,`× line`),r4([`spacing`,`headingGap`],`Before a heading`,`× line`),r4([`spacing`,`itemGap`],`After a list item`,`× line`),t4([`spacing`,`listIndent`],`List indent`),t4([`spacing`,`quoteIndent`],`Quote indent`),t4([`spacing`,`ruleWidth`],`Divider width`,`The short centred line a --- becomes.`)]},{title:`Drop caps`,fields:[i4([`dropCap`,`enabled`],`Drop caps`,`A large first letter after each heading.`),{kind:`choice`,path:[`dropCap`,`lines`],label:`Lines tall`,options:[{value:2,label:`2 lines`},{value:3,label:`3 lines`},{value:4,label:`4 lines`}]},r4([`dropCap`,`scale`],`Letter size`,`× lines`),t4([`dropCap`,`gap`],`Gap beside it`),{kind:`number`,path:[`dropCap`,`minLength`],label:`Shortest paragraph`,unit:`chars`,step:10,help:`Shorter paragraphs start plainly.`},r4([`dropCap`,`minRoom`],`Room needed`,`of page`,`With less room left, the paragraph starts on the next page.`)]},{title:`Title page`,fields:[t4([`titlePage`,`brandY`],`Brand from top`),t4([`titlePage`,`taglineOffset`],`Tagline below brand`),t4([`titlePage`,`titleY`],`Title from top`),t4([`titlePage`,`titleLine`],`Title line height`),t4([`titlePage`,`metaOffset`],`Details below title`),t4([`titlePage`,`metaLine`],`Details line height`),i4([`titlePage`,`showDate`],`Show the date`),i4([`titlePage`,`showWordCount`],`Show the word count`),i4([`titlePage`,`cover`,`enabled`],`Thumbnail as cover`,`When the project has a thumbnail.`),t4([`titlePage`,`cover`,`gap`],`Space around cover`),t4([`titlePage`,`cover`,`maxHeight`],`Cover height at most`)]},{title:`Branding`,fields:[o4([`brand`,`name`],`Brand name`,`Leave empty to hide the brand.`),o4([`brand`,`tagline`],`Tagline`),o4([`brand`,`url`],`Website`,`Where the brand and its link go.`),o4([`brand`,`linkLabel`],`Link text`,`The linked line under the word count.`)]},{title:`Contents page`,fields:[i4([`contents`,`enabled`],`Contents page`),a4([`contents`,`title`],`Title`),{kind:`choice`,path:[`contents`,`depth`],label:`Lists headings down to`,options:[{value:1,label:`Top level`},{value:2,label:`Second level`},{value:3,label:`Third level`}]},t4([`contents`,`titleOffset`],`Title from top margin`),t4([`contents`,`firstEntryOffset`],`First entry from top margin`),t4([`contents`,`line`],`Line height`),t4([`contents`,`indent`],`Indent per level`)]},{title:`Header and footer`,fields:[i4([`header`,`enabled`],`Running header`,`The title at the top of each page.`),t4([`header`,`top`],`Header from top`),{kind:`number`,path:[`header`,`maxTitleCharacters`],label:`Header title at most`,unit:`chars`,step:1},i4([`footer`,`enabled`],`Page numbers`),a4([`footer`,`text`],`Page number text`,`{page} becomes the page number.`),t4([`footer`,`bottom`],`From the bottom`),t4([`footer`,`reserve`],`Space kept above it`)]},{title:`Sources page`,fields:[i4([`sources`,`enabled`],`Sources page`,`The links the article and research used.`),a4([`sources`,`title`],`Title`),t4([`sources`,`titleOffset`],`Title from top margin`),t4([`sources`,`bodyOffset`],`List from top margin`),t4([`sources`,`line`],`Line height`),t4([`sources`,`gap`],`Gap between sources`)]},{title:`Closing page`,fields:[i4([`endPage`,`enabled`],`Closing page`),a4([`endPage`,`title`],`Title`),{kind:`lines`,path:[`endPage`,`lines`],label:`Text`,help:`One line each. Start with "•" for a bullet, end with ":" for a bold label, leave a line empty for a gap.`},i4([`endPage`,`showDocumentDetails`],`Add date, word and page counts`),{kind:`link`,path:[`endPage`,`link`],label:`Link`},o4([`endPage`,`closing`],`Closing line`),t4([`endPage`,`titleOffset`],`Title from top margin`),t4([`endPage`,`bodyOffset`],`Text from top margin`)]},{title:`PDF details`,fields:[a4([`metadata`,`author`],`Author`,`Shown in a PDF reader's document properties. {title} becomes the title.`),a4([`metadata`,`subject`],`Subject`),a4([`metadata`,`keywords`],`Keywords`),a4([`metadata`,`creator`],`Creator`)]}],c4=DA.map(e=>({value:e,label:{Cinzel:`Cinzel`,Literata:`Literata`,times:`Times`,helvetica:`Helvetica`,courier:`Courier`}[e]}));function l4(e){let t={normal:`Regular`,medium:`Medium`,bold:`Bold`,black:`Black`,italic:`Italic`,bolditalic:`Bold italic`};return(e===`Cinzel`?[`normal`,`medium`,`bold`,`black`]:[`normal`,`bold`,`italic`,`bolditalic`]).map(e=>({value:e,label:t[e]}))}function dme(e,t){let n=e;for(let e of t)n=n?.[e];return n}function u4(e,t,n){let[r,...i]=t;if(r===void 0)return n;let a=e[r];return{...e,[r]:i.length===0?n:u4(a,i,n)}}function fme(e){let t=FA;for(let n of e)t=t?.shape?.[n];return{min:t?.minValue??0,max:t?.maxValue??1e3}}function d4(e){return`values.${e.join(`.`)}`}var f4=`pt-1`,p4=`flex min-w-0 flex-col gap-3 pt-1 lg:sticky lg:top-16`;function m4({children:e}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{children:`Library`}),(0,h.jsx)(Tc,{"aria-hidden":`true`}),e]})}function h4({children:e,back:t}){return(0,h.jsxs)(`div`,{className:`mx-auto flex max-w-[1440px] flex-col gap-3`,children:[(0,h.jsx)(pP,{tone:`danger`,title:`This can't be opened.`,children:e}),(0,h.jsx)(`p`,{className:`m-0 text-small text-accent-ink underline underline-offset-[3px]`,children:t})]})}function g4({themeId:e,from:t,onLeave:n}){let{api:r}=R(),i=_(),a=N(eb(r)),o=(0,m.useId)(),[s,c]=(0,m.useState)(void 0),[l,u]=(0,m.useState)([]),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)(!1),v=a.data,y=e===void 0?void 0:v?.themes.find(t=>t.id===e),b=e===void 0?v?.themes.find(e=>e.id===t)??v?.builtIns.find(e=>e.name===(t??`plain`))??v?.builtIns[0]:y,x=b===void 0?void 0:{name:e===void 0?`${`label`in b?b.label:b.name} copy`:b.name,values:b.values},S=s??x,C=P({mutationFn:t=>Js(r,t,e),onSuccess:async e=>{if(!e.ok){u(e.fields);return}f(!0),await i.invalidateQueries({queryKey:eb(r).queryKey})}}),w=P({mutationFn:e=>Ys(r,e),onSuccess:async()=>{g(!1),await i.invalidateQueries({queryKey:eb(r).queryKey}),n()}});Y2(d,n);let T=(0,m.useMemo)(()=>S===void 0?void 0:FA.safeParse(S.values),[S]),E=[...S===void 0||S.name.trim()===``?[]:wS(S.name),...T===void 0||T.success?[]:T.error.issues.map(e=>({field:`values.${e.path.join(`.`)}`,message:e.message})),...l];if(a.error!==null)return(0,h.jsx)(y4,{children:a.error.message});if(v===void 0)return(0,h.jsx)(Q2,{});if(S===void 0)return(0,h.jsx)(y4,{children:`That theme is gone. It may have been deleted in another tab.`});let D=(e,t)=>{c(e),u(e=>e.filter(e=>e.field!==t))},O=S.name.trim()===``?`Give the theme a name.`:E.length>0?`Fix the highlighted settings first.`:void 0,k=E.filter(e=>e.field===`name`);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(bq,{crumb:(0,h.jsx)(m4,{children:(0,h.jsx)(ha,{to:`/document-themes`,children:`Documents`})}),title:e===void 0?`New document theme`:`Edit document theme`,meta:`How a project's PDF looks`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(320px,440px)]`,children:[(0,h.jsxs)(`div`,{className:`${f4} flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(uV,{label:`Name`,tip:`library.theme.name`,...k.length===0?{}:{error:k.map(e=>e.message).join(` `)},children:(0,h.jsx)(Y,{value:S.name,onChange:e=>{D({...S,name:e.target.value},`name`)}})}),ume.map((e,t)=>(0,h.jsxs)(`details`,{open:t<2||e.fields.some(e=>_4(E,e.path)),className:`group border-t border-line`,children:[(0,h.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 py-3 text-title-3 font-semibold`,onClick:e=>{let t=e.currentTarget.parentElement;requestAnimationFrame(()=>{t instanceof HTMLDetailsElement&&t.open&&t.scrollIntoView?.({block:`nearest`,behavior:`smooth`})})},children:[(0,h.jsx)(Tc,{"aria-hidden":`true`,className:`size-[14px] text-ink-2 transition-transform group-open:rotate-90 motion-reduce:transition-none`}),e.title]}),(0,h.jsx)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-x-5 gap-y-4 pb-4 sm:grid-cols-2`,children:e.fields.map(e=>(0,h.jsx)(hme,{field:e,theme:S.values,problem:_4(E,e.path),onChange:t=>{D({...S,values:t},d4(e.path))}},e.path.join(`.`)))})]},e.title)),(0,h.jsx)(Z2,{onDelete:e===void 0?void 0:()=>{g(!0)},blocked:O,blockedId:o,pending:C.isPending,saved:d,cancel:(0,h.jsx)(zx,{to:`/document-themes`,variant:`secondary`,children:`Cancel`}),errors:[C.error,w.error].flatMap(e=>e===null?[]:[e.message]),onSave:()=>{C.mutate(S)}})]}),(0,h.jsx)(mme,{values:T?.success===!0?S.values:void 0})]}),(0,h.jsx)(Dy,{open:p,title:`Delete "${S.name}"?`,consequence:`Projects that used it keep their own copy of its settings.`,confirmLabel:`Delete theme`,pending:w.isPending,onConfirm:()=>{e!==void 0&&w.mutate(e)},onCancel:()=>{g(!1)}})]})}var pme={"values.page.format":`library.theme.page.format`,"values.page.margin":`library.theme.page.margin`,"values.page.contentTop":`library.theme.page.content-top`,"values.background.image":`library.theme.background.image`,"values.background.color":`library.theme.background.color`,"values.colors.heading":`library.theme.colors.heading`,"values.colors.text":`library.theme.colors.text`,"values.colors.muted":`library.theme.colors.muted`,"values.colors.faint":`library.theme.colors.faint`,"values.fonts.body":`library.theme.fonts.body`,"values.fonts.strong":`library.theme.fonts.strong`,"values.fonts.emphasis":`library.theme.fonts.emphasis`,"values.fonts.heading":`library.theme.fonts.heading`,"values.fonts.dramatic":`library.theme.fonts.dramatic`,"values.fonts.decorative":`library.theme.fonts.decorative`,"values.fonts.dropCap":`library.theme.fonts.drop-cap`,"values.fonts.footer":`library.theme.fonts.footer`,"values.sizes.title":`library.theme.sizes.title`,"values.sizes.brand":`library.theme.sizes.brand`,"values.sizes.section":`library.theme.sizes.section`,"values.sizes.heading":`library.theme.sizes.heading`,"values.sizes.subheading":`library.theme.sizes.subheading`,"values.sizes.body":`library.theme.sizes.body`,"values.sizes.meta":`library.theme.sizes.meta`,"values.sizes.footer":`library.theme.sizes.footer`,"values.spacing.bodyLine":`library.theme.spacing.body-line`,"values.spacing.headingLine":`library.theme.spacing.heading-line`,"values.spacing.subheadingLine":`library.theme.spacing.subheading-line`,"values.spacing.paragraphGap":`library.theme.spacing.paragraph-gap`,"values.spacing.headingGap":`library.theme.spacing.heading-gap`,"values.spacing.itemGap":`library.theme.spacing.item-gap`,"values.spacing.listIndent":`library.theme.spacing.list-indent`,"values.spacing.quoteIndent":`library.theme.spacing.quote-indent`,"values.spacing.ruleWidth":`library.theme.spacing.rule-width`,"values.dropCap.enabled":`library.theme.drop-cap.enabled`,"values.dropCap.lines":`library.theme.drop-cap.lines`,"values.dropCap.scale":`library.theme.drop-cap.scale`,"values.dropCap.gap":`library.theme.drop-cap.gap`,"values.dropCap.minLength":`library.theme.drop-cap.min-length`,"values.dropCap.minRoom":`library.theme.drop-cap.min-room`,"values.titlePage.brandY":`library.theme.title-page.brand-y`,"values.titlePage.taglineOffset":`library.theme.title-page.tagline-offset`,"values.titlePage.titleY":`library.theme.title-page.title-y`,"values.titlePage.titleLine":`library.theme.title-page.title-line`,"values.titlePage.metaOffset":`library.theme.title-page.meta-offset`,"values.titlePage.metaLine":`library.theme.title-page.meta-line`,"values.titlePage.showDate":`library.theme.title-page.show-date`,"values.titlePage.showWordCount":`library.theme.title-page.show-word-count`,"values.titlePage.cover.enabled":`library.theme.title-page.cover`,"values.titlePage.cover.gap":`library.theme.title-page.cover-gap`,"values.titlePage.cover.maxHeight":`library.theme.title-page.cover-height`,"values.brand.name":`library.theme.brand.name`,"values.brand.tagline":`library.theme.brand.tagline`,"values.brand.url":`library.theme.brand.url`,"values.brand.linkLabel":`library.theme.brand.link-label`,"values.contents.enabled":`library.theme.contents.enabled`,"values.contents.title":`library.theme.contents.title`,"values.contents.depth":`library.theme.contents.depth`,"values.contents.titleOffset":`library.theme.contents.title-offset`,"values.contents.firstEntryOffset":`library.theme.contents.first-entry-offset`,"values.contents.line":`library.theme.contents.line`,"values.contents.indent":`library.theme.contents.indent`,"values.header.enabled":`library.theme.header.enabled`,"values.header.top":`library.theme.header.top`,"values.header.maxTitleCharacters":`library.theme.header.max-title`,"values.footer.enabled":`library.theme.footer.enabled`,"values.footer.text":`library.theme.footer.text`,"values.footer.bottom":`library.theme.footer.bottom`,"values.footer.reserve":`library.theme.footer.reserve`,"values.sources.enabled":`library.theme.sources.enabled`,"values.sources.title":`library.theme.sources.title`,"values.sources.titleOffset":`library.theme.sources.title-offset`,"values.sources.bodyOffset":`library.theme.sources.body-offset`,"values.sources.line":`library.theme.sources.line`,"values.sources.gap":`library.theme.sources.gap`,"values.endPage.enabled":`library.theme.end-page.enabled`,"values.endPage.title":`library.theme.end-page.title`,"values.endPage.lines":`library.theme.end-page.lines`,"values.endPage.showDocumentDetails":`library.theme.end-page.details`,"values.endPage.link":`library.theme.end-page.link`,"values.endPage.closing":`library.theme.end-page.closing`,"values.endPage.titleOffset":`library.theme.end-page.title-offset`,"values.endPage.bodyOffset":`library.theme.end-page.body-offset`,"values.metadata.author":`library.theme.metadata.author`,"values.metadata.subject":`library.theme.metadata.subject`,"values.metadata.keywords":`library.theme.metadata.keywords`,"values.metadata.creator":`library.theme.metadata.creator`};function _4(e,t){let n=d4(t),r=e.filter(e=>e.field===n||e.field.startsWith(`${n}.`));return r.length===0?void 0:r.map(e=>e.message).join(` `)}function mme({values:e}){let{api:t}=R(),[n,r]=(0,m.useState)(),[i,a]=(0,m.useState)(`busy`),[o,s]=(0,m.useState)(void 0),c=e===void 0?void 0:JSON.stringify(e);(0,m.useEffect)(()=>{if(c===void 0)return;let e=new AbortController,n=window.setTimeout(()=>{a(`busy`),Xs(t,JSON.parse(c),e.signal).then(async e=>({bytes:new Uint8Array(await e.arrayBuffer()),blob:e})).then(({bytes:t,blob:n})=>{e.signal.aborted||r({bytes:t,url:URL.createObjectURL(n)})},t=>{e.signal.aborted||(s(t instanceof Error?t.message:String(t)),a(`failed`))})},450);return()=>{window.clearTimeout(n),e.abort()}},[t,c]),(0,m.useEffect)(()=>()=>{n!==void 0&&URL.revokeObjectURL(n.url)},[n]);let l=(0,m.useCallback)(e=>{if(e===void 0){a(`idle`);return}s(e.message),a(`failed`)},[]),u=e===void 0?`Paused until the highlighted settings are fixed.`:i===`busy`?`Updating…`:i===`failed`?`The preview couldn't be made: ${o??`unknown error`}`:`A sample article with this theme. Your projects use their own text and thumbnail.`;return(0,h.jsxs)(`div`,{className:p4,children:[(0,h.jsx)(V,{title:`Preview`,info:`library.theme.preview`,size:`small`,className:`pb-0`,children:n===void 0?null:(0,h.jsxs)(Vx,{href:n.url,target:`_blank`,rel:`noreferrer`,variant:`secondary`,size:`small`,children:[(0,h.jsx)(Mc,{"aria-hidden":`true`,strokeWidth:1.75}),`Open full size`]})}),(0,h.jsx)(`div`,{className:`max-h-[calc(100vh-220px)] min-h-[320px] overflow-y-auto rounded-media bg-sunken p-3`,children:(0,h.jsx)(cme,{data:n?.bytes,label:`The sample article laid out with this theme`,onDrawn:l})}),(0,h.jsx)(`p`,{role:`status`,className:i===`failed`?`m-0 text-small text-danger`:`m-0 text-small text-ink-2`,children:u})]})}function hme({field:e,theme:t,problem:n,onChange:r}){let i=(0,m.useId)(),a=dme(t,e.path),o=pme[d4(e.path)],s=o===void 0?null:(0,h.jsx)(B,{id:o,label:e.label,className:`-my-1`}),c=n=>{r(u4(t,e.path,n))},l=[e.help===void 0?``:`${i}-help`,n===void 0?``:`${i}-error`].filter(e=>e!==``).join(` `),u=(0,h.jsxs)(h.Fragment,{children:[e.help===void 0?null:(0,h.jsx)(`p`,{id:`${i}-help`,className:`sl-field__help m-0`,children:e.help}),n===void 0?null:(0,h.jsx)(`p`,{id:`${i}-error`,className:`sl-field__error m-0`,children:n})]}),d={id:i,"aria-invalid":n!==void 0,"aria-describedby":l===``?void 0:l};switch(e.kind){case`toggle`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:i,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{...d,type:`checkbox`,checked:a===!0,className:`size-4 accent-accent`,onChange:e=>{c(e.currentTarget.checked)}}),e.label]}),s]}),u]});case`number`:{let{min:t,max:n}=fme(e.path);return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(Y,{...d,type:`number`,inputMode:`decimal`,min:t,max:n,step:e.step,className:`w-28`,value:typeof a==`number`&&Number.isFinite(a)?a:``,onChange:e=>{c(e.target.value===``?NaN:Number(e.target.value))}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:e.unit})]})})}case`color`:{let t=typeof a==`string`?a:``,n=/^#?[0-9a-f]{6}$/i.test(t)?`#${t.replace(`#`,``)}`:/^#?[0-9a-f]{3}$/i.test(t)?`#${[...t.replace(`#`,``)].map(e=>e+e).join(``)}`:`#000000`;return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`color`,"aria-label":`${e.label} colour`,value:n,className:`h-8 w-10 cursor-pointer rounded-control border border-line-strong bg-transparent p-0.5`,onChange:e=>{c(e.target.value)}}),(0,h.jsx)(Y,{...d,className:`w-28 font-mono`,value:t,onChange:e=>{c(e.target.value)}})]})})}case`text`:return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsx)(Y,{...d,value:typeof a==`string`?a:``,onChange:e=>{c(e.target.value)}})});case`optional-text`:return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsx)(Y,{...d,value:typeof a==`string`?a:``,onChange:e=>{c(e.target.value===``?null:e.target.value)}})});case`choice`:{let t=e.options.findIndex(e=>e.value===a);return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsx)(pV,{...d,value:String(t),onChange:t=>{let n=e.options[Number(t.target.value)];n!==void 0&&c(n.value)},children:e.options.map((e,t)=>(0,h.jsx)(`option`,{value:String(t),children:e.label},e.label))})})}case`face`:{let t=a,n=l4(t.family);return(0,h.jsx)(v4,{id:i,label:e.label,notes:u,info:s,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(pV,{...d,"aria-label":`${e.label} font`,value:t.family,onChange:e=>{let n=c4.find(t=>t.value===e.target.value);if(n===void 0)return;let r=l4(n.value).some(e=>e.value===t.style);c({...t,family:n.value,style:r?t.style:`normal`})},children:c4.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(pV,{"aria-label":`${e.label} style`,value:t.style,onChange:e=>{c({...t,style:e.target.value})},children:n.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(Y,{type:`number`,"aria-label":`${e.label} letter spacing in millimetres`,title:`Letter spacing (mm)`,step:.01,className:`w-20`,value:Number.isFinite(t.letterSpacing)?t.letterSpacing:``,onChange:e=>{c({...t,letterSpacing:e.target.value===``?NaN:Number(e.target.value)})}})]})})}case`lines`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:i,className:`sl-field__label`,children:e.label}),s]}),(0,h.jsx)(fV,{...d,rows:8,value:Array.isArray(a)?a.join(`
|
|
274
274
|
`):``,onChange:e=>{c(e.target.value.split(`
|
|
275
275
|
`))}}),u]});case`link`:{let t=a;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:i,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{id:i,type:`checkbox`,checked:t!==null,className:`size-4 accent-accent`,onChange:e=>{c(e.currentTarget.checked?{text:`Visit the website`,url:null}:null)}}),e.label]}),s]}),t===null?null:(0,h.jsxs)(`span`,{className:`grid grid-cols-[minmax(0,1fr)] gap-2 sm:grid-cols-2`,children:[(0,h.jsx)(Y,{"aria-label":`Link text`,placeholder:`Link text`,value:t.text,onChange:e=>{c({...t,text:e.target.value})}}),(0,h.jsx)(Y,{"aria-label":`Link address`,placeholder:`https://`,value:t.url??``,onChange:e=>{c({...t,url:e.target.value===``?null:e.target.value})}})]}),u]})}}}function v4({id:e,label:t,notes:n,info:r,children:i}){return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:e,className:`sl-field__label`,children:t}),r]}),i,n]})}function y4({children:e}){return(0,h.jsx)(h4,{back:(0,h.jsx)(ha,{to:`/document-themes`,children:`Back to Documents`}),children:e})}var gme=4e3;function b4(e){return e.match(/\s+|[^\s]+/gu)??[]}function _me(e,t){let n=b4(e),r=b4(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i+=1;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a+=1;let o=[];S4(o,`same`,n.slice(0,i).join(``));let s=n.slice(i,n.length-a),c=r.slice(i,r.length-a);for(let e of yme(s,c))S4(o,e.op,e.text);return S4(o,`same`,n.slice(n.length-a).join(``)),o}function x4(e,t){let n=t===`before`?`added`:`removed`;return e.filter(e=>e.op!==n)}function vme(e){let t=t=>e.filter(e=>e.op===t).reduce((e,t)=>e+b4(t.text).filter(e=>e.trim()!==``).length,0);return{added:t(`added`),removed:t(`removed`)}}function S4(e,t,n){if(n===``)return;let r=e.at(-1);r!==void 0&&r.op===t?e[e.length-1]={op:t,text:r.text+n}:e.push({op:t,text:n})}function yme(e,t){if(e.length===0&&t.length===0)return[];if(e.length===0)return[{op:`added`,text:t.join(``)}];if(t.length===0)return[{op:`removed`,text:e.join(``)}];let n=e.length,r=t.length,i=Math.min(n+r,gme),a=i+1,o=new Int32Array(2*i+3),s=[],c=!1;for(let l=0;l<=i&&!c;l+=1){s.push(o.slice());let i=o.slice();for(let s=-l;s<=l;s+=2){let u=s===-l||s!==l&&(o[a+s-1]??0)<(o[a+s+1]??0)?o[a+s+1]??0:(o[a+s-1]??0)+1,d=u-s;for(;u<n&&d<r&&e[u]===t[d];)u+=1,d+=1;if(i[a+s]=u,u>=n&&d>=r){c=!0;break}}o=i}if(!c)return[{op:`removed`,text:e.join(``)},{op:`added`,text:t.join(``)}];let l=[],u=n,d=r;for(let n=s.length-1;n>=0;--n){let r=s[n]??new Int32Array,i=u-d,o=i===-n||i!==n&&(r[a+i-1]??0)<(r[a+i+1]??0),c=o?i+1:i-1,f=r[a+c]??0,p=f-c;for(;u>f&&d>p;)l.push({op:`same`,text:e[u-1]??``}),--u,--d;n>0&&(o?l.push({op:`added`,text:t[d-1]??``}):l.push({op:`removed`,text:e[u-1]??``}),u=f,d=p)}let f=[];for(let e of l.reverse())S4(f,e.op,e.text);return f}function C4({before:e,after:t,beforeLabel:n,afterLabel:r}){let i=(0,m.useMemo)(()=>_me(e,t),[e,t]),a=vme(i);return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:a.added===0&&a.removed===0?`The two texts are the same.`:`${String(a.added)} ${a.added===1?`word`:`words`} added, ${String(a.removed)} removed.`}),(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,h.jsx)(w4,{label:n,parts:x4(i,`before`)}),(0,h.jsx)(w4,{label:r,parts:x4(i,`after`)})]})]})}function w4({label:e,parts:t}){return(0,h.jsxs)(`section`,{"aria-label":e,className:`flex min-w-0 flex-col gap-1`,children:[(0,h.jsx)(`h4`,{className:`sl-kicker m-0`,children:e}),(0,h.jsx)(`div`,{className:`min-w-0 whitespace-pre-wrap break-words border-l-2 border-line pl-3 text-small leading-relaxed text-ink`,children:bme(t).map(({key:e,part:t})=>t.op===`removed`?(0,h.jsx)(`del`,{className:`rounded-[2px] bg-danger-tint text-danger line-through`,children:t.text},e):t.op===`added`?(0,h.jsx)(`ins`,{className:`rounded-[2px] bg-accent-tint text-accent-ink no-underline`,children:t.text},e):(0,h.jsx)(`span`,{children:t.text},e))})]})}function bme(e){let t=0;return e.map(e=>{let n=`${e.op}-${String(t)}`;return t+=e.text.length,{key:n,part:e}})}var T4={versions:(e,t)=>[`library-history`,e,t],usedBy:(e,t)=>[`library-used-by`,e,t]};function E4(e,t){let{api:n}=R();return N({queryKey:T4.versions(e,t),queryFn:()=>Hs(n,e,t)})}function xme(e,t){let{api:n}=R();return N({queryKey:T4.usedBy(e,t),queryFn:()=>Us(n,e,t)})}function D4({item:e,id:t,name:n,onClose:r}){let{api:i}=R(),a=_(),o=E4(e,t),s=o.data?.versions??[],[c,l]=(0,m.useState)({}),u=c.after??s[0]?.version,d=c.before??s[1]?.version??u,f=s.find(e=>e.version===d),p=s.find(e=>e.version===u),[g,v]=(0,m.useState)(),y=P({mutationFn:n=>Ws(i,e,t,n),onSuccess:async(n,r)=>{v(`Restored version ${String(r)} as a new version.`),l({}),await Promise.all([a.invalidateQueries({queryKey:T4.versions(e,t)}),a.invalidateQueries({queryKey:e===`prompt`?z.prompts:z.entries})])},onError:()=>v(void 0)}),b=s[0]?.version;return(0,h.jsx)(UM,{open:!0,title:`History of ${n}`,onClose:r,className:`sm:w-[min(1080px,100vw)]`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[o.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-body text-danger`,children:`The history couldn't be read: ${o.error.message}`}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(V,{title:`Compare`,as:`h3`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,h.jsx)(uV,{label:`Older`,tip:`library.history.compare`,children:(0,h.jsx)(pV,{value:d===void 0?``:String(d),disabled:s.length===0,onChange:e=>l(t=>({...t,before:Number(e.currentTarget.value)})),children:s.map(e=>(0,h.jsx)(`option`,{value:e.version,children:k4(e,b)},e.version))})}),(0,h.jsx)(uV,{label:`Newer`,tip:`library.history.compare`,children:(0,h.jsx)(pV,{value:u===void 0?``:String(u),disabled:s.length===0,onChange:e=>l(t=>({...t,after:Number(e.currentTarget.value)})),children:s.map(e=>(0,h.jsx)(`option`,{value:e.version,children:k4(e,b)},e.version))})})]}),f===void 0||p===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:o.isPending?`Loading the versions…`:`No versions to compare.`}):(0,h.jsxs)(h.Fragment,{children:[f.name===p.name?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Renamed from "${f.name}" to "${p.name}".`}),(0,h.jsx)(C4,{before:f.body,after:p.body,beforeLabel:`Version ${String(f.version)}`,afterLabel:`Version ${String(p.version)}`})]})]}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(V,{title:`Versions`,as:`h3`,info:`library.history.versions`}),(0,h.jsx)(iU,{label:`Versions of ${n}`,children:s.map(e=>(0,h.jsx)(aU,{title:`Version ${String(e.version)}`,meta:O4(e),actions:e.version===b?(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Current`}):(0,h.jsx)(L,{size:`small`,"aria-label":`Restore version ${String(e.version)}`,disabled:y.isPending,disabledReason:`Restoring a version`,onClick:()=>{v(void 0),y.mutate(e.version)},children:`Restore`})},e.version))}),(0,h.jsx)(V1,{tone:y.error===null?`success`:`error`,children:y.error?.message??g})]})]})})}function O4(e){return`${e.author} · ${A4(e.createdAt)}${e.restoredFrom===null?``:` · restored from version ${String(e.restoredFrom)}`}`}function k4(e,t){return`Version ${String(e.version)}${e.version===t?` (current)`:``} · ${A4(e.createdAt)}`}function A4(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function j4({item:e,id:t,name:n,kicker:r,meta:i,body:a,slots:o,actions:s,onOpenHistory:c}){return(0,h.jsxs)(`section`,{"aria-label":`${n} details`,className:`flex min-w-0 flex-col gap-6`,children:[(0,h.jsx)(V,{title:n,kicker:r,meta:i,className:`pb-0`,children:s}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`div`,{className:`m-0 max-h-[420px] min-w-0 overflow-y-auto whitespace-pre-wrap break-words rounded-media bg-sunken p-4 font-mono text-small text-ink-2`,children:a}),o.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No keywords. It runs as written.`}):(0,h.jsx)(`ul`,{"aria-label":`Keywords`,className:`m-0 flex list-none flex-wrap gap-2 p-0`,children:o.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(mV,{children:`{{${e}}}`})},e))})]}),(0,h.jsx)(Sme,{item:e,id:t}),(0,h.jsx)(Cme,{item:e,id:t,name:n,onOpenHistory:c})]})}function Sme({item:e,id:t}){let n=xme(e,t),r=n.data;return(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(V,{title:`Used by`,as:`h3`,className:`pb-0`,info:`library.used-by`,...r===void 0?{}:{meta:wme(r)}}),n.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`What uses it couldn't be read: ${n.error.message}`}),r===void 0?null:r.templates.length+r.schedules.length+r.projects.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Nothing uses it yet.`}):(0,h.jsxs)(iU,{label:`Used by`,children:[r.templates.map(e=>(0,h.jsx)(aU,{title:(0,h.jsx)(ha,{to:`/templates`,children:e.name}),meta:`Template`},`t-${e.id}`)),r.schedules.map(e=>(0,h.jsx)(aU,{title:(0,h.jsx)(ha,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:e.name}),meta:e.status===`paused`?`Schedule · paused`:`Schedule`},`s-${e.id}`)),r.projects.map(e=>(0,h.jsx)(aU,{title:(0,h.jsx)(ha,{to:`/projects/$projectId`,params:{projectId:e.id},children:e.title}),meta:`Project${e.totalRevisions===0?``:` · ${String(e.revisions)} of ${String(e.totalRevisions)} ${e.totalRevisions===1?`revision`:`revisions`}${e.current?`, including the current one`:`, not the current one`}`}`},`p-${e.id}`))]})]})}function Cme({item:e,id:t,name:n,onOpenHistory:r}){let i=E4(e,t),a=i.data?.versions??[],[o,s]=a;return(0,h.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(V,{title:`History`,as:`h3`,className:`pb-0`,info:`library.history`,...o===void 0?{}:{meta:`${M4(a.length,`version`)} · latest ${O4(o)}`},children:(0,h.jsx)(L,{size:`small`,"aria-label":`Compare versions of ${n}`,onClick:r,children:`Compare versions`})}),i.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`The history couldn't be read: ${i.error.message}`}),o===void 0?null:s===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Only one version so far.`}):(0,h.jsx)(C4,{before:s.body,after:o.body,beforeLabel:`Version ${String(s.version)}`,afterLabel:`Version ${String(o.version)}`})]})}function wme(e){return[M4(e.templates.length,`template`),M4(e.schedules.length,`schedule`),M4(e.projects.length,`project`)].join(`, `)}function M4(e,t){return`${String(e)} ${t}${e===1?``:`s`}`}function N4(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{dateStyle:`medium`})}var P4=`min-[1180px]:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,F4=`grid-cols-1 2xl:grid-cols-[minmax(0,1fr)_auto]`;function I4({label:e}){return(0,h.jsx)(`ul`,{"aria-label":`${e}, loading`,"aria-busy":`true`,className:`sl-list m-0 list-none p-0`,children:[0,1,2].map(e=>(0,h.jsx)(`li`,{className:`sl-row`,"aria-hidden":`true`,children:(0,h.jsxs)(`span`,{className:`flex flex-col gap-2 py-0.5`,children:[(0,h.jsx)(`span`,{className:`h-3 w-40 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-3 w-56 rounded-control bg-sunken`})]})},e))})}function L4({what:e,message:t,onRetry:n}){return(0,h.jsx)(pP,{tone:`danger`,title:`The ${e} couldn't be loaded.`,actions:(0,h.jsx)(L,{size:`small`,onClick:n,children:`Try again`}),children:t})}function R4({name:e,edit:t,duplicate:n,play:r,onHistory:i,onDelete:a,className:o}){return(0,h.jsxs)(`div`,{role:`group`,"aria-label":`Actions for ${e}`,className:I(`flex flex-wrap items-center gap-0.5`,o),children:[t,n,r===void 0?null:(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-label":`Use ${e} in Play`,title:r.blocked,disabled:r.run===void 0||r.blocked!==void 0,onClick:r.run,children:`Use in Play`}),i===void 0?null:(0,h.jsx)(ly,{size:`small`,label:`History of ${e}`,onClick:i,children:(0,h.jsx)(Jc,{"aria-hidden":`true`})}),(0,h.jsx)(ly,{size:`small`,label:`Delete ${e}`,onClick:a,children:(0,h.jsx)($c,{"aria-hidden":`true`})})]})}var Tme=[{to:`/prompts`,label:`Prompts`},{to:`/entries`,label:`Intros & Outros`},{to:`/templates`,label:`Templates`},{to:`/document-themes`,label:`Documents`},{to:`/narration-aliases`,label:`Aliases`},{to:`/ab-results`,label:`A/B results`}];function Eme(){return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(bq,{title:`Library`,meta:`Prompts, intros and outros, templates, document themes, narration aliases and A/B results`}),(0,h.jsx)(qde,{items:Tme,label:`Library sections`,className:`mb-6`}),(0,h.jsx)(Dme,{}),(0,h.jsx)(ja,{})]})}function Dme(){let e=Zi(),t=Va({select:e=>e.location}),n=t.search,r=sV(t.pathname===`/prompts`?n.kind:void 0),i=iV(t.pathname===`/entries`?n.category:void 0);return qb({id:`library.new-prompt`,title:`New prompt`,group:`Library`,keywords:[`create`,`article`,`image`,`thumbnail`],run:()=>{e({to:`/prompts/new`,search:{kind:r}})}}),qb({id:`library.new-entry`,title:`New intro or outro`,group:`Library`,keywords:[`create`,`entry`],run:()=>{e({to:`/entries/new`,search:{category:i}})}}),qb({id:`library.new-document-theme`,title:`New document theme`,group:`Library`,keywords:[`create`,`pdf`,`theme`],run:()=>{e({to:`/document-themes/new`,search:{from:`plain`}})}}),qb({id:`library.open-prompts`,title:`Open prompts`,group:`Library`,run:()=>{e({to:`/prompts`,search:{kind:`article`}})}}),qb({id:`library.open-entries`,title:`Open intros and outros`,group:`Library`,keywords:[`entries`],run:()=>{e({to:`/entries`,search:{category:`intro`}})}}),qb({id:`library.open-templates`,title:`Open templates`,group:`Library`,keywords:[`setups`],run:()=>{e({to:`/templates`})}}),qb({id:`library.open-document-themes`,title:`Open document themes`,group:`Library`,keywords:[`pdf`,`documents`],run:()=>{e({to:`/document-themes`})}}),null}function z4({children:e,action:t,className:n}){return(0,h.jsxs)(`div`,{"data-slot":`library-toolbar`,className:I(`mb-5 flex min-h-9 flex-wrap items-center gap-x-4 gap-y-3`,n),children:[(0,h.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-3`,children:e}),t===void 0?null:(0,h.jsx)(dy,{className:`ml-auto shrink-0`,children:t})]})}function Ome(){let{api:e}=R(),t=_(),n=N(eb(e)),[r,i]=(0,m.useState)(void 0),[a,o]=(0,m.useState)(void 0),s=P({mutationFn:t=>Ys(e,t),onSettled:async()=>{o(void 0),await t.invalidateQueries({queryKey:z.documentThemes})}}),c=n.data,l=r!==void 0&&`saved`in r?c?.themes.find(e=>e.id===r.saved):void 0,u=r!==void 0&&`builtIn`in r?c?.builtIns.find(e=>e.name===r.builtIn):void 0,d=l===void 0&&u===void 0?c?.themes[0]:void 0,f=l??d,p=f===void 0?u??c?.builtIns[0]:void 0;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(z4,{action:(0,h.jsx)(zx,{to:`/document-themes/new`,search:{from:`plain`},variant:`primary`,children:`New theme`}),children:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`How a project's PDF looks. Pick one on the Document row in Play or in Edit project.`})}),n.error===null?null:(0,h.jsx)(L4,{what:`document themes`,message:n.error.message,onRetry:()=>void n.refetch()}),c===void 0?n.error===null?(0,h.jsx)(I4,{label:`Document themes`}):null:(0,h.jsx)(Sq,{className:P4,list:(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(V,{title:`Your themes`,as:`h3`,className:`pb-0`,info:`library.themes.yours`}),c.themes.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No themes of your own yet. Copy a built-in below to start one.`}):(0,h.jsx)(iU,{label:`Your themes`,children:c.themes.map(e=>(0,h.jsx)(aU,{className:F4,lead:(0,h.jsx)(G4,{colors:e.values.colors}),title:e.name,meta:`${B4(e.values)} · updated ${N4(e.updatedAt)}`,selected:e.id===f?.id,onSelect:()=>i({saved:e.id}),actions:(0,h.jsx)(R4,{name:e.name,edit:(0,h.jsx)(zx,{to:`/document-themes/$themeId`,params:{themeId:e.id},"aria-label":`Edit ${e.name}`,variant:`quiet`,size:`small`,children:`Edit`}),duplicate:(0,h.jsx)(zx,{to:`/document-themes/new`,search:{from:e.id},"aria-label":`Duplicate ${e.name}`,variant:`quiet`,size:`small`,children:`Duplicate`}),onDelete:()=>o(e)})},e.id))})]}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(V,{title:`Built in`,as:`h3`,className:`pb-0`,info:`library.themes.built-in`}),(0,h.jsx)(iU,{label:`Built-in themes`,children:c.builtIns.map(e=>(0,h.jsx)(aU,{className:F4,lead:(0,h.jsx)(G4,{colors:e.values.colors}),title:e.label,meta:B4(e.values),selected:e.name===p?.name,onSelect:()=>i({builtIn:e.name}),actions:(0,h.jsx)(zx,{to:`/document-themes/new`,search:{from:e.name},"aria-label":`Copy ${e.label}`,variant:`quiet`,size:`small`,children:`Copy`})},e.name))})]})]}),detail:f===void 0?p===void 0?null:(0,h.jsx)(U4,{name:p.label,kicker:`Built in`,meta:`Built-in themes can't be changed. Copy one to make it yours.`,values:p.values,action:(0,h.jsx)(zx,{to:`/document-themes/new`,search:{from:p.name},size:`small`,children:`Copy theme`})}):(0,h.jsx)(U4,{name:f.name,kicker:`Your theme`,meta:`Updated ${N4(f.updatedAt)}`,values:f.values,action:(0,h.jsx)(zx,{to:`/document-themes/$themeId`,params:{themeId:f.id},size:`small`,children:`Edit theme`})})}),s.error===null?null:(0,h.jsx)(pP,{tone:`danger`,title:`The theme wasn't deleted.`,className:`mt-4`,children:s.error.message}),(0,h.jsx)(Dy,{open:a!==void 0,title:`Delete "${a?.name??``}"?`,consequence:`Projects that used it keep their own copy of its settings.`,confirmLabel:`Delete theme`,pending:s.isPending,onConfirm:()=>{a!==void 0&&s.mutate(a.id)},onCancel:()=>o(void 0)})]})}function B4(e){return`${e.page.format===`a4`?`A4`:`Letter`} · ${V4(e.fonts.body.family)} body`}function V4(e){return c4.find(t=>t.value===e)?.label??e}function H4(e){return e.startsWith(`#`)?e:`#${e}`}function U4({name:e,kicker:t,meta:n,values:r,action:i}){let a=[[`Headings`,r.colors.heading],[`Text`,r.colors.text],[`Muted`,r.colors.muted],[`Header and page numbers`,r.colors.faint]],o=[[`Body`,r.fonts.body],[`Headings`,r.fonts.heading],[`Drop cap`,r.fonts.dropCap]];return(0,h.jsxs)(`section`,{"aria-label":`${e} details`,className:`flex min-w-0 flex-col gap-6`,children:[(0,h.jsx)(V,{title:e,kicker:t,meta:n,className:`pb-0`,children:i}),(0,h.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-[max-content_minmax(0,1fr)]`,children:[a.map(([e,t])=>(0,h.jsx)(W4,{label:e,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 rounded-full border border-line`,style:{backgroundColor:H4(t)}}),(0,h.jsx)(`span`,{className:`font-mono text-small`,children:H4(t)})]})},e)),o.map(([e,t])=>(0,h.jsx)(W4,{label:`${e} font`,children:`${V4(t.family)}, ${t.style}`},`font-${e}`)),(0,h.jsx)(W4,{label:`Page`,children:`${r.page.format===`a4`?`A4`:`Letter`}, ${r.background.image===`parchment`?`parchment`:`flat ${H4(r.background.color)}`} background`})]})]})}function W4({label:e,children:t}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`text-small text-ink-2`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0 text-body text-ink`,children:t})]})}function G4({colors:e}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`flex shrink-0 gap-1`,children:[e.heading,e.text,e.muted].map((e,t)=>(0,h.jsx)(`span`,{className:`size-3 rounded-full border border-line`,style:{backgroundColor:H4(e)}},t))})}function K4(e){let t=e.map(e=>e.message).join(` `);return`The name wasn't saved. ${t===``?`Pick another name and press Save name again.`:t}`}function q4({name:e,onSelect:t,onRename:n,tip:r=`library.inline-rename`,maxLength:i=200}){let a=gy(),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(e),[u,d]=(0,m.useState)(null),[f,p]=(0,m.useState)(!1),g=(0,m.useRef)(!1),_=async e=>{try{return await n(e)}catch(e){return`The name wasn't saved: ${e instanceof Error?e.message:`Slopify didn't answer.`} Check that Slopify is running, then press Save name again.`}},v=async()=>{let t=c.trim();if(t===e){s(!1),d(null);return}if(t===``){d(`Write a name first, or press Cancel to keep the old one.`);return}if(g.current)return;g.current=!0,p(!0);let n=await _(t);if(g.current=!1,p(!1),n!==null){d(n);return}s(!1),d(null),a(`Renamed “${e}” to “${t}”.`,`success`,{label:`Undo`,run:()=>void _(e).then(t=>{t===null?a(`Renamed back to “${e}”.`,`success`):a(t,`error`)})})},y=()=>{s(!1),l(e),d(null)};return o?(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,h.jsx)(Y,{autoFocus:!0,"aria-label":`New name for ${e}`,"aria-invalid":u!==null,maxLength:i,value:c,className:`min-w-0 flex-1`,onChange:e=>{l(e.target.value),d(null)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),v()):e.key===`Escape`&&(e.preventDefault(),y())}}),(0,h.jsx)(L,{size:`small`,variant:`primary`,disabled:f,onClick:()=>void v(),children:f?`Saving…`:`Save name`}),(0,h.jsx)(L,{size:`small`,variant:`quiet`,disabled:f,onClick:y,children:`Cancel`}),(0,h.jsx)(B,{id:r,label:`Rename`})]}),u===null?null:(0,h.jsx)(`span`,{role:`alert`,className:`text-small font-normal text-danger`,children:u})]}):(0,h.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[t===void 0?(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:e}):(0,h.jsx)(oU,{onSelect:t,className:`min-w-0`,children:e}),(0,h.jsx)(ly,{size:`small`,label:`Rename ${e}`,onClick:()=>{l(e),s(!0)},children:(0,h.jsx)(Uc,{"aria-hidden":`true`,strokeWidth:1.75})})]})}function kme({category:e,onCategory:t,onUseInPlay:n,playBlocked:r}){let{api:i}=R(),a=_(),o=N($y(i)),[s,c]=(0,m.useState)(``),l=(0,m.useRef)(null),u=Jb(l,`intros and outros`),[d,f]=(0,m.useState)(void 0),[p,g]=(0,m.useState)(void 0),[v,y]=(0,m.useState)(void 0),b=P({mutationFn:e=>ec(i,e),onSettled:async()=>{g(void 0),await a.invalidateQueries({queryKey:z.entries})}}),x=async(e,t)=>{let n=await Ks(i,{category:e.category,mode:e.mode,name:t,body:e.body},e.id);return await a.invalidateQueries({queryKey:z.entries}),n.ok?null:K4(n.fields)},S=o.data?.entries.filter(t=>t.category===e),C=s.trim().toLowerCase(),w=C===``?S:S?.filter(e=>e.name.toLowerCase().includes(C)||e.body.toLowerCase().includes(C)),T=w?.find(e=>e.id===d)??w?.[0];return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(z4,{action:(0,h.jsx)(zx,{to:`/entries/new`,search:{category:e},variant:`primary`,children:`New intro or outro`}),children:[(0,h.jsx)(Y,{type:`search`,ref:l,"aria-label":`Search intros and outros`,"aria-keyshortcuts":ax(u),placeholder:`Search intros and outros`,value:s,className:`w-full min-w-0 sm:w-64`,onChange:e=>c(e.target.value)}),(0,h.jsx)(ub,{label:`Entry category`,value:e,options:QB.map(e=>({...e,label:`${e.label}s`})),onChange:t,tip:`library.entry.category`})]}),o.error===null?null:(0,h.jsx)(L4,{what:`intros and outros`,message:o.error.message,onRetry:()=>void o.refetch()}),w===void 0||S===void 0?o.error===null?(0,h.jsx)(I4,{label:`Intros and outros`}):null:S.length===0?(0,h.jsx)(jme,{category:e}):(0,h.jsx)(Sq,{className:P4,list:w.length===0?(0,h.jsx)(`p`,{className:`m-0 py-3 text-small text-ink-2`,children:`No ${e}s match "${s.trim()}".`}):(0,h.jsx)(iU,{label:`${eV(e)}s`,children:w.map(e=>(0,h.jsx)(aU,{className:F4,title:(0,h.jsx)(q4,{name:e.name,onSelect:()=>f(e.id),onRename:t=>x(e,t)}),meta:Ame(e),selected:e.id===T?.id,actions:(0,h.jsx)(R4,{name:e.name,edit:(0,h.jsx)(zx,{to:`/entries/$entryId`,params:{entryId:e.id},"aria-label":`Edit ${e.name}`,variant:`quiet`,size:`small`,children:`Edit`}),duplicate:(0,h.jsx)(zx,{to:`/entries/new`,search:{category:e.category,from:e.id},"aria-label":`Duplicate ${e.name}`,variant:`quiet`,size:`small`,children:`Duplicate`}),play:{run:n===void 0?void 0:()=>n(e),blocked:r},onHistory:()=>y(e),onDelete:()=>g(e)})},e.id))}),detail:T===void 0?null:(0,h.jsx)(j4,{item:`entry`,id:T.id,name:T.name,kicker:`${eV(T.category)} · ${tV(T.mode)}`,meta:`Updated ${N4(T.updatedAt)}`,body:T.body,slots:T.slots,actions:(0,h.jsx)(zx,{to:`/entries/$entryId`,params:{entryId:T.id},size:`small`,children:`Edit ${T.category}`}),onOpenHistory:()=>y(T)},T.id)}),b.error===null?null:(0,h.jsx)(pP,{tone:`danger`,title:`The ${e} wasn't deleted.`,className:`mt-4`,children:b.error.message}),v===void 0?null:(0,h.jsx)(D4,{item:`entry`,id:v.id,name:v.name,onClose:()=>y(void 0)},v.id),(0,h.jsx)(Dy,{open:p!==void 0,title:p===void 0?``:`Delete "${p.name}"?`,consequence:`Moves it to the trash for 30 days (Settings → Trash). Projects that used it keep their text.`,confirmLabel:`Delete ${p?.category??e}`,pending:b.isPending,onConfirm:()=>{p!==void 0&&b.mutate(p.id)},onCancel:()=>g(void 0)})]})}function Ame(e){return`${tV(e.mode)} · ${M4(e.slots.length,`keyword`)} · updated ${N4(e.updatedAt)}`}function jme({category:e}){let t=e===`intro`?`before`:`after`;return(0,h.jsx)(J1,{title:`No ${e}s yet`,children:`An ${e} is narrated ${t} the body in the run's voice.`})}function Mme({name:e,className:t}){return(0,h.jsx)(`span`,{"data-slot-chip":e,className:I(`animate-tick-in rounded-control border border-line-strong bg-sunken px-2 py-0.5 font-mono text-label text-ink-2 motion-reduce:animate-none`,t),children:e})}function J4({slots:e,body:t,lint:n,lintId:r,noSlots:i=`No slots. This prompt runs as written.`}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V,{title:`Detected slots`,info:`library.slots`,size:`small`,className:`pb-0`}),e.length>0?(0,h.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,h.jsx)(Mme,{name:e,className:`px-2 py-1`},e))}):t.trim()===``?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Slots appear here as you type {{name}}.`}):(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i}),n.length===0?null:(0,h.jsxs)(`div`,{id:r,className:`flex flex-col gap-2 border-t border-line pt-3`,children:[(0,h.jsx)(`span`,{className:`sl-kicker text-danger`,children:n.length===1?`1 slot error`:`${String(n.length)} slot errors`}),n.map(e=>(0,h.jsx)(`span`,{className:`text-small text-danger`,children:e.message},e.message))]})]})}function Y4({className:e,...t}){return(0,h.jsx)(Av,{"data-slot":`label`,className:I(`engraved block select-none text-ink-3`,e),...t})}function X4({className:e,...t}){return(0,h.jsx)(Zv,{"data-slot":`toggle-group`,className:I(`inline-flex w-fit items-stretch overflow-hidden rounded-control border border-line-strong`,e),...t})}function Z4({className:e,...t}){return(0,h.jsx)(oy,{"data-slot":`toggle-group-item`,className:I(`min-h-8 shrink-0 border-r border-line-strong px-3 py-1 text-label text-ink-2 last:border-r-0`,`transition-colors duration-150 ease-out motion-reduce:transition-none hover:bg-raised hover:text-ink`,`data-[state=on]:bg-raised data-[state=on]:text-ink data-[state=on]:shadow-[inset_0_-2px_0_var(--color-accent)]`,`disabled:cursor-not-allowed disabled:opacity-40`,e),...t})}function Q4({label:e,value:t,options:n,describedBy:r,tip:i,onPick:a}){let o=(0,m.useId)();return(0,h.jsxs)(`div`,{...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{id:o,children:e}),i===void 0?null:(0,h.jsx)(B,{id:i,label:e,className:`-my-1`})]}),(0,h.jsx)(X4,{type:`single`,value:t,"aria-labelledby":o,"aria-describedby":r,onValueChange:e=>{let t=n.find(t=>t.value===e);t!==void 0&&a(t.value)},children:n.map(e=>(0,h.jsx)(Z4,{value:e.value,children:e.label},e.value))})]})}function Nme(e){return $4(e.name,e.body)}function Pme(e){return $4(e.name,e.body)}function $4(e,t){let n=[],r=e.trim();if(r===``?n.push({field:`name`,message:`Enter a name.`}):r.length>200&&n.push({field:`name`,message:`Keep the name to 200 characters or fewer.`}),t.trim()===``)return n.push({field:`body`,message:`Enter the text.`}),n;if(t.length>1e5)return n.push({field:`body`,message:`The text is too long. Keep it to ${String(QA)} characters or fewer.`}),n;for(let e of nq(t).errors)n.push({field:`body`,message:Fme(e,t)});return n}function Fme(e,t){let n=Ime(t,e.at);switch(e.kind){case`unclosed`:return`The \`{{\` at ${n} is never closed. Add \`}}\` after the keyword name.`;case`empty`:return`The keyword at ${n} has no name. Write a name between \`{{\` and \`}}\`.`;case`nested`:return`The keyword at ${n} contains a brace. Keywords cannot be placed inside other keywords.`}}function Ime(e,t){let n=e.slice(0,t),r=n.lastIndexOf(`
|
|
276
276
|
`),i=n.split(`
|
|
@@ -280,7 +280,7 @@ Obelisks`})}):e.mode===`yaml`?(0,h.jsx)(uV,{id:`schedule-topics-yaml`,label:`Top
|
|
|
280
280
|
`).split(`
|
|
281
281
|
`).entries()){let e=n.trim(),c=t+1;if(e===``){s=!1;continue}let l=Ghe.exec(e);if(l!==null){o.push({title:u6(l[1]??``),firstTurn:a.length+1}),s=!1;continue}if(/^([-*_=~])\1{2,}$/.test(e)){s=!1;continue}let u=Khe.exec(e),d=u===null?void 0:r.get((u[1]??``).trim().toLowerCase());if(u!==null&&d!==void 0){a.push({speaker:d.id,lines:[u[2]??``],section:o.length-1}),s=!0;continue}let f=a.at(-1);if(s&&f!==void 0){f.lines.push(e);continue}return{ok:!1,reason:u===null?`Line ${String(c)} of the script is not a turn. Start every turn with a speaker's name and a colon (${i}), one turn per paragraph.`:`Line ${String(c)} of the script is spoken by "${(u[1]??``).trim()}", who is not one of the speakers (${i}). Use only these names, or add the speaker under Speakers (Play → Narration, or Edit project → Providers).`}}let c=[];for(let e of a){let t=u6(e.lines.join(` `));t!==``&&c.push({index:c.length+1,speaker:e.speaker,text:t,section:e.section,...n?{markdown:e.lines.join(`
|
|
282
282
|
`)}:{}})}if(c.length===0)return{ok:!1,reason:`The script has no spoken turns. Write each turn as a speaker's name, a colon and their words (${i}).`};let l=[],u=new Map;for(let[e,t]of o.entries()){let n=c.find(t=>t.section===e);n!==void 0&&t.title!==``&&(u.set(e,l.length),l.push({title:t.title,firstTurn:n.index}))}return{ok:!0,script:{turns:c.map(e=>({...e,section:u.get(e.section)??-1})),sections:l}}}function u6(e){return e.replace(/\[[^\]]*\]\([^)]*\)/g,e=>e.slice(1,e.indexOf(`]`))).replace(/\[[^\]]*\]/g,` `).replace(/(\*{1,3}|_{1,3})(\S(?:.*?\S)?)\1/g,`$2`).replace(/`/g,``).replace(/\s+/g,` `).trim()}var qhe={narrator:`Narrator`,host:`Host`,guest:`Guest`,character:`Character`};function d6({value:e,onChange:t,providers:n,voices:r,script:i,problem:a,cast:o=[],language:s}){let c=(0,m.useMemo)(()=>{if(e===void 0||i===void 0||i.trim()===``)return;let t=l6(i,e.speakers);return t.ok?t.script:void 0},[i,e]),l=n=>{if(n===``){t(void 0);return}let r=xk.find(e=>e===n);r!==void 0&&t(e===void 0?kk(r,Vhe(o)):{...e,format:r,source:r===`audiobook`?e.source:`script`})},u=n=>{e!==void 0&&t({...e,...n})},d=o.filter(t=>t.voice!==void 0&&!(e?.speakers??[]).some(e=>e.castId===t.id)),f=(t,n)=>{e!==void 0&&u({speakers:e.speakers.map((e,r)=>r===t?n:e)})};return(0,h.jsxs)(`div`,{className:`col-span-full min-w-0 space-y-3`,"data-play-field":`voices`,children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(CV,{field:`voices.format`,label:`Format`,tip:`play.speakers.format`,value:e?.format??``,placeholder:`Narration (one voice)`,options:xk.map(e=>({value:e,label:Sk[e]})),problem:a?.(`voices.format`),onPick:l}),e?.format===`audiobook`?(0,h.jsx)(CV,{field:`voices.source`,label:`Script`,tip:`play.speakers.script`,value:e.source,placeholder:`Pick where the script comes from`,options:[{value:`script`,label:`Write a script (Script prompt)`},{value:`attribute`,label:`Split the article into speakers`}],problem:a?.(`voices.source`),onPick:e=>u({source:e===`attribute`?`attribute`:`script`})}):null]}),e===void 0?(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`One voice reads the article. Pick a format for an audiobook, podcast, radio drama or interview with several speakers.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:e.source===`script`?"The article prompt must be a Script prompt: the text model writes speaker turns, one `Name: words` paragraph each.":`The article is written or pasted as usual; the text model then hands its narration and dialogue to the speakers.`}),a?.(`voices.speakers`)===void 0?null:(0,h.jsx)(`p`,{className:`text-label text-danger`,children:a(`voices.speakers`)}),(0,h.jsx)(`ol`,{"aria-label":`Speakers`,className:`divide-y divide-line border-y border-line`,children:e.speakers.map((t,i)=>(0,h.jsx)(Zhe,{index:i,speaker:t,line:zhe(t,c),providers:n,voices:r,language:s,problem:a,onChange:e=>f(i,e),onRemove:e.speakers.length>1?()=>u({speakers:e.speakers.filter((e,t)=>t!==i)}):void 0},t.id))}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,h.jsx)(L,{type:`button`,disabled:e.speakers.length>=10,onClick:()=>u({speakers:[...e.speakers,Xhe(e.speakers)]}),children:`Add speaker`}),(0,h.jsx)(CV,{label:`Add from the cast`,tip:`play.speakers.add-from-cast`,value:``,placeholder:d.length===0?`No cast member has a voice yet`:`Pick one of ${String(d.length)}`,options:d.map(e=>({value:e.id,label:e.name})),disabled:d.length===0||e.speakers.length>=10,problem:void 0,onPick:t=>{let n=d.find(e=>e.id===t);n!==void 0&&u({speakers:[...e.speakers,c6(n,Yhe(e))]})}}),(0,h.jsx)(CV,{field:`voices.turnGapSeconds`,label:`Gap between turns`,tip:`play.speakers.turn-gap`,value:String(e.turnGapSeconds),placeholder:`Pick a gap`,options:Tk.map(e=>({value:String(e),label:`${e} s`})),problem:a?.(`voices.turnGapSeconds`),onPick:e=>u({turnGapSeconds:Number(e)})})]}),(0,h.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,h.jsx)(lb,{label:`Speaker names on captions`,tip:`play.speakers.name-tags`,checked:e.nameTags,onChange:e=>u({nameTags:e})}),(0,h.jsx)(lb,{label:`One request for consecutive turns where the voice provider can (ElevenLabs v3, Gemini)`,tip:`play.speakers.native-dialogue`,checked:e.nativeDialogue,onChange:e=>u({nativeDialogue:e})}),(0,h.jsx)(lb,{label:`Also make MP3 and M4B files with chapter markers`,tip:`play.speakers.audio-files`,checked:e.audioFiles,onChange:e=>u({audioFiles:e})})]}),e.format===`audiobook`?(0,h.jsx)(Jhe,{value:e,onChange:t,problem:a}):null,e.format===`podcast`||e.format===`interview`?(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`The speaker panel (a tile per speaker, the one talking lit, their name below) is drawn with the captions: set Captions to Burn in under Style to see it in the video.`}):null]})]})}function Jhe({value:e,onChange:t,problem:n}){let r=e.book,i=n=>t({...e,...n});return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(lb,{label:`A chapter of a book`,tip:`play.speakers.book`,checked:r!==void 0,onChange:n=>{if(n)i({book:{title:``,chapter:1}});else{let{book:n,...r}=e;t(r)}}}),r===void 0?null:(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 min-[700px]:grid-cols-[minmax(0,1fr)_160px]`,children:[(0,h.jsx)(uV,{label:`Book title`,tip:`play.speakers.book-title`,error:n?.(`voices.book.title`),children:(0,h.jsx)(Y,{value:r.title,maxLength:200,onChange:e=>i({book:{...r,title:e.target.value}})})}),(0,h.jsx)(uV,{label:`Chapter`,tip:`play.speakers.book-chapter`,error:n?.(`voices.book.chapter`),children:(0,h.jsx)(Y,{type:`number`,min:1,max:Ek,step:1,value:r.chapter===0?``:String(r.chapter),onChange:e=>i({book:{...r,chapter:Number(e.target.value)||0}})})})]})]})}function Yhe(e){return e.format===`podcast`?`host`:e.format===`interview`?e.speakers.some(e=>e.role===`host`)?`guest`:`host`:e.speakers.some(e=>e.role===`narrator`)?`character`:`narrator`}function Xhe(e){let t=e.length+1;for(;e.some(e=>e.id===`speaker-${String(t)}`);)t+=1;return{id:`speaker-${String(t)}`,name:`Speaker ${String(t)}`,role:`character`,voice:{provider:``,model:``,voice:``}}}function Zhe({index:e,speaker:t,line:n,providers:r,voices:i,language:a,problem:o,onChange:s,onRemove:c}){let l=`voices.speakers.${String(e)}`,u=t.voice,d=i.filter(e=>e.provider===u.provider),f=P2(d,a,u.voice||void 0),p=a===void 0?d:f.listed,g=t.name.trim()||`this speaker`,_=(0,m.useMemo)(()=>Rhe([t],a??`und`)[0]?.skipped??[],[t,a]);return(0,h.jsxs)(`li`,{className:`grid grid-cols-1 gap-3 py-3 min-[700px]:grid-cols-2`,"data-play-field":l,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`mb-2 size-3 shrink-0 rounded-full`,style:{background:`var(--color-speaker-${String(e%6+1)})`}}),(0,h.jsx)(uV,{label:`Speaker name`,tip:`play.speaker.name`,error:o?.(`${l}.name`),className:`min-w-0 flex-1`,children:(0,h.jsx)(Y,{value:t.name,maxLength:40,onChange:e=>s({...t,name:e.target.value})})})]}),(0,h.jsx)(CV,{label:`Role`,tip:`play.speaker.role`,value:t.role,placeholder:`Pick a role`,options:Ck.map(e=>({value:e,label:qhe[e]})),problem:void 0,onPick:e=>{let n=Ck.find(t=>t===e);n!==void 0&&s({...t,role:n})}}),(0,h.jsx)(EV,{field:`${l}.voice`,label:`Voice provider`,tip:`play.speaker.provider`,family:`tts`,providers:r,value:u.provider,problem:o?.(`${l}.voice`),onPick:e=>s({...t,voice:{provider:e,model:``,voice:``}})}),(0,h.jsx)(DV,{label:`Voice model`,tip:`play.speaker.model`,provider:u.provider,value:u.model,problem:void 0,onPick:e=>s({...t,voice:{...u,model:e}})}),(0,h.jsx)(CV,{field:`${l}.voice.voice`,label:`Voice`,tip:`play.speaker.voice`,value:u.voice,placeholder:p.length===0?`No voices. Add one in Settings.`:`Pick a voice`,options:p.map(e=>({value:e.voiceId,label:e.name})),problem:o?.(`${l}.voice.voice`),onPick:e=>s({...t,voice:{...u,voice:e}})}),a===void 0?null:(0,h.jsx)(F2,{language:a,voice:d.find(e=>e.voiceId===u.voice),hidden:f.hidden,showAll:f.showAll,onShowAll:f.setShowAll}),(0,h.jsx)(CV,{field:`${l}.pace`,label:`Pace`,tip:`play.speaker.pace`,value:String(t.pace??1),placeholder:`Pick a pace`,options:wk.map(e=>({value:String(e),label:e===1?`Normal`:`${String(e)}×`})),problem:o?.(`${l}.pace`),onPick:e=>{let{pace:n,...r}=t;s(Number(e)===1?r:{...r,pace:Number(e)})}}),(0,h.jsxs)(`details`,{className:`col-span-full text-small`,...cb,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer items-center gap-2 text-ink-2`,children:[`Pronunciations for `,t.name.trim()||`this speaker`,t.pronunciations?.trim()?` · set`:``,(0,h.jsx)(B,{id:`play.speaker.pronunciations`})]}),(0,h.jsx)(fV,{rows:3,"aria-label":`Pronunciations for ${t.name.trim()||`this speaker`}`,value:t.pronunciations??``,placeholder:`Arda: /ˈɑɹdə/`,onChange:e=>{let{pronunciations:n,...r}=t;s(e.target.value===``?r:{...r,pronunciations:e.target.value})}})]}),_.length===0?null:(0,h.jsxs)(pP,{tone:`waiting`,className:`col-span-full`,title:`${String(_.length)} ${_.length===1?`pronunciation`:`pronunciations`} for ${g} ${_.length===1?`is`:`are`} skipped`,children:[(0,h.jsx)(`ul`,{children:_.map(e=>(0,h.jsxs)(`li`,{children:[`Entry `,e.row,`: `,e.reason,`.`]},e.row))}),(0,h.jsxs)(`p`,{children:[`Those words are read as ordinary text; the other entries are used. Fix them in Pronunciations for `,g,` above: one `,(0,h.jsx)(`code`,{children:`Term: /IPA/`}),` per line.`]})]}),(0,h.jsxs)(`div`,{className:`col-span-full flex flex-wrap items-center gap-3`,children:[(0,h.jsx)($he,{speaker:t,line:n}),(0,h.jsx)(`span`,{className:`flex-1`}),c===void 0?null:(0,h.jsxs)(L,{type:`button`,variant:`quiet`,onClick:c,children:[`Remove `,t.name.trim()||`speaker`]})]})]})}var Qhe=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,maximumFractionDigits:4});function $he({speaker:e,line:t}){let{api:n}=R(),{provider:r,model:i,voice:a}=e.voice,o=r!==``&&i!==``&&a!==``,s=N({queryKey:[`audition-quote`,r,i,t],queryFn:()=>nc(n,[{speaker:e.name.trim()||`Speaker`,provider:r,model:i,text:t}]),enabled:o,staleTime:6e4}),[c,l]=(0,m.useState)(void 0);(0,m.useEffect)(()=>()=>{c!==void 0&&URL.revokeObjectURL(c)},[c]);let u=P({mutationFn:()=>rc(n,{provider:r,model:i,voice:a,text:t}),onSuccess:e=>{let t=URL.createObjectURL(e);l(t),new Audio(t).play().catch(()=>{})}}),d=s.data?.estimate,f=d==null?void 0:d.unknown>0?`price unknown`:`about ${Qhe.format(d.high)}`;return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(L,{type:`button`,disabled:!o||u.isPending,onClick:()=>u.mutate(),title:`Reads: ${t}`,children:u.isPending?`Speaking…`:`Audition${f===void 0?``:` · ${f}`}`}),(0,h.jsx)(B,{id:`play.speaker.audition`})]}),(0,h.jsx)(`span`,{className:`min-h-5 text-label text-ink-2`,"aria-live":`polite`,children:o?u.error===null?c===void 0?`Reads their first line: “${t.length>60?`${t.slice(0,60)}…`:t}”`:`Playing the audition.`:u.error.message:`Pick a provider, model and voice to audition.`})]})}function ege(e){return e===void 0?`Narration`:Sk[e]}function f6({value:e,skipCode:t,onChange:n,tip:r=`play.describe-figures`}){let i=(0,m.useId)(),a=e===!0;return(0,h.jsxs)(`div`,{className:`col-span-full min-w-0 space-y-1`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,...cb,children:[(0,h.jsxs)(`label`,{htmlFor:i,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:i,type:`checkbox`,"data-play-field":`audio.describeFigures`,checked:a,className:`size-4 accent-accent`,onChange:e=>n({describeFigures:e.currentTarget.checked,skipCode:t===!0})}),`Describe tables and figures in the narration`]}),(0,h.jsx)(B,{id:r})]}),a?(0,h.jsxs)(`span`,{className:`flex items-center gap-1 pl-7`,...cb,children:[(0,h.jsxs)(`label`,{htmlFor:`${i}-code`,className:`flex min-h-10 items-center gap-3 text-small max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:`${i}-code`,type:`checkbox`,"data-play-field":`audio.skipCode`,checked:t===!0,className:`size-4 accent-accent`,onChange:e=>n({describeFigures:!0,skipCode:e.currentTarget.checked})}),`Leave code out`]}),(0,h.jsx)(B,{id:`play.skip-code`})]}):null]})}function p6({value:e,onChange:t,tip:n=`play.show-figures`}){let r=(0,m.useId)();return(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,...cb,children:[(0,h.jsxs)(`label`,{htmlFor:r,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:r,type:`checkbox`,"data-play-field":`showFigures`,checked:e===!0,className:`size-4 accent-accent`,onChange:e=>t(e.currentTarget.checked)}),`Show tables and figures on screen`]}),(0,h.jsx)(B,{id:n})]})}function m6({value:e,onChange:t,note:n}){let r=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`col-span-full min-w-0 space-y-1`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:r,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:r,type:`checkbox`,"data-play-field":`audio.useNarrationAliases`,checked:e===!0,className:`size-4 accent-accent`,onChange:e=>t(e.currentTarget.checked)}),`Use narration aliases`]}),(0,h.jsx)(B,{id:`play.narration-aliases`})]}),n===void 0?null:(0,h.jsx)(`div`,{className:`pl-7`,children:n})]})}function h6({value:e,prompts:t,supported:n,error:r,libraryLinks:i=!0,onChange:a}){let o=(0,m.useId)(),s=t.filter(e=>e.kind===`narration`),c=s.find(t=>t.name===e),l=r??(e!==``&&!n?`Choose Inworld TTS-2 or turn preparation Off.`:void 0);return(0,h.jsxs)(`div`,{className:`col-span-full min-w-0 space-y-2`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:o,className:`text-small font-semibold`,children:`Narration Preparation`}),(0,h.jsx)(B,{id:`play.narration-preparation`})]}),(0,h.jsxs)(hV,{id:o,"data-play-field":`narrationPrompt`,value:e,"aria-describedby":l?`${o}-error`:void 0,"aria-invalid":l!==void 0||void 0,onChange:e=>a(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`Off`}),e!==``&&c===void 0?(0,h.jsxs)(`option`,{value:e,children:[e,` (saved selection)`]}):null,s.map(e=>(0,h.jsx)(`option`,{value:e.name,children:e.name},e.id))]}),l?(0,h.jsx)(`p`,{id:`${o}-error`,className:`text-small text-danger`,children:l}):null,i?(0,h.jsxs)(`div`,{className:`flex gap-4 text-small`,children:[(0,h.jsx)(ha,{to:`/prompts/new`,search:{kind:`narration`},children:`Create prompt`}),c?(0,h.jsx)(ha,{to:`/prompts/$promptId`,params:{promptId:c.id},children:`View prompt`}):null]}):null]})}function g6({value:e,supported:t,onChange:n,shared:r}){let i=(0,m.useId)(),a=t&&e===!0;return(0,h.jsxs)(`div`,{className:`col-span-full min-w-0 space-y-2`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,...cb,children:[(0,h.jsxs)(`label`,{htmlFor:i,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:i,type:`checkbox`,"data-play-field":`audio.usePronunciationGlossary`,checked:e===!0,disabled:!t,"aria-describedby":t?void 0:`${i}-support`,className:`size-4 accent-accent`,onChange:e=>n(e.currentTarget.checked)}),`Use Pronunciation Glossary`]}),(0,h.jsx)(B,{id:`play.pronunciation-glossary`})]}),r===void 0?null:(0,h.jsxs)(`div`,{className:`space-y-1 pl-7`,...cb,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:`${i}-shared`,className:`flex min-h-8 items-center gap-3 text-small max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:`${i}-shared`,type:`checkbox`,"data-play-field":`audio.shareGlossary`,checked:r.value===!0,disabled:!a,className:`size-4 accent-accent`,onChange:e=>r.onChange(e.currentTarget.checked)}),`Also use pronunciations from my other projects`]}),(0,h.jsx)(B,{id:`play.share-glossary`})]}),r.note===void 0?null:r.note]}),t?null:(0,h.jsx)(`p`,{id:`${i}-support`,className:`text-label text-ink-3`,children:`Unavailable for this provider or model. Your saved preference is retained.`})]})}var _6={source:`off`,prompt:``,thumbnail:!0},tge=[{value:`prompt`,label:`From a prompt`},{value:`provide`,label:`Upload`}];function v6({value:e,prompts:t,problem:n,upload:r,prompt:i,onChange:a}){let o=(0,m.useId)(),s=e.source===`off`,c=t.filter(e=>e.kind===`image`).map(e=>({value:e.name,label:e.name}));return(0,h.jsxs)(`div`,{className:`col-span-full sl-fields`,children:[(0,h.jsx)(`div`,{className:`min-w-0`,children:(0,h.jsx)(CV,{field:`reference.source`,label:`Establishing image`,tip:`play.reference`,value:s?``:e.source,placeholder:`Off`,options:tge,problem:n?.(`reference.source`),onPick:t=>a({...e,source:t===`prompt`||t===`provide`?t:`off`})})}),e.source===`provide`?(0,h.jsx)(`div`,{className:`min-w-0`,children:r}):i??(0,h.jsx)(CV,{field:`reference.prompt`,label:`Establishing prompt`,tip:`play.reference.prompt`,value:e.prompt,placeholder:s?`Off`:`Pick an image prompt`,options:c,disabled:s,problem:n?.(`reference.prompt`),onPick:t=>a({...e,prompt:t})}),(0,h.jsxs)(`div`,{className:`col-span-full flex min-h-9 items-center gap-1`,...cb,children:[(0,h.jsxs)(`label`,{htmlFor:o,className:`flex cursor-pointer items-center gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`input`,{id:o,type:`checkbox`,"data-play-field":`reference.thumbnail`,checked:e.thumbnail,disabled:s,onChange:t=>a({...e,thumbnail:t.target.checked})}),`Draw the thumbnail from it too`]}),(0,h.jsx)(B,{id:`play.reference.thumbnail`})]})]})}function y6({choice:e,onChange:t,field:n=`llm.thinking`,label:r=`Thinking`,tip:i=`play.llm.thinking`,problem:a}){let{api:o}=R(),s=N(vV(o,e.provider)).data?.models.find(t=>t.id===e.model)?.thinkingModes??[];if(!s.length&&!e.thinking)return null;let c=r===`Thinking`?`thinking level`:r.toLowerCase();return(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(CV,{field:n,label:r,tip:i,value:e.thinking??`default`,placeholder:`Model default`,problem:e.thinking&&!s.includes(e.thinking)?`Choose a supported ${c}.`:a,options:[{value:`default`,label:`Model default`},...e.thinking&&!s.includes(e.thinking)?[{value:e.thinking,label:`${e.thinking} (saved level)`}]:[],...s.map(e=>({value:e,label:e===`off`?`Off`:e.charAt(0).toUpperCase()+e.slice(1)}))],onPick:n=>{let r=s.find(e=>e===n),{thinking:i,...a}=e;t(r===void 0?a:{...a,thinking:r})}}),r===`Thinking`&&s.length&&!s.includes(`off`)?(0,h.jsx)(`p`,{className:`mt-1 text-small text-ink-3`,children:`This model does not support turning thinking off.`}):null]})}function nge({form:e,prompts:t,providers:n,voices:r,problem:i,update:a,onPickFiles:o,onRemoveFile:s,onReattachFile:c,rawCounts:l,advanced:u,cast:d,language:f,titled:p}){let g=r.filter(t=>t.provider===e.audio.provider),_=P2(g,f??`en`,e.audio.voice||void 0),v=f===void 0?g:_.listed,y=e.voices?.speakers.find(e=>e.voice.provider&&e.voice.model&&e.voice.voice)?.voice,b=e.intro!==``||e.outro!==``,x=e.voices!==void 0&&!b&&y!==void 0;(0,m.useEffect)(()=>{if(!x||y===void 0)return;let t=e.audio;(t.provider!==y.provider||t.model!==y.model||t.voice!==y.voice)&&a({audio:{...t,provider:y.provider,model:y.model,voice:y.voice}})},[x,y,e.audio,a]);let S=e.voices!==void 0,C=[e.chunking.mode,e.intro?`intro ${e.intro}`:void 0,e.outro?`outro ${e.outro}`:void 0,e.narrationPrompt?`preparation on`:void 0,e.audio.usePronunciationGlossary?`glossary on`:void 0].filter(e=>e!==void 0).join(` · `);return(0,h.jsxs)($3,{kind:`audio`,name:`Audio`,dim:e.sources.audio===`off`,titled:p,children:[(0,h.jsx)(e6,{kind:`audio`,form:e,update:a}),(0,h.jsx)(`div`,{className:Z3,children:e.sources.audio===`generate`?(0,h.jsxs)(h.Fragment,{children:[x?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(EV,{field:`audio.provider`,label:S?`Intro and outro TTS`:`TTS`,tip:`play.tts.provider`,family:`tts`,providers:n,value:e.audio.provider,problem:i(`audio`),onPick:t=>{a({audio:{...e.audio,provider:t,model:``,voice:``}})}}),(0,h.jsx)(DV,{field:`audio.model`,label:`TTS model`,tip:`play.tts.model`,provider:e.audio.provider,value:e.audio.model,problem:i(`audio.model`),onPick:t=>a({audio:{...e.audio,model:t}})}),(0,h.jsx)(CV,{field:`audio.voice`,label:S?`Intro and outro voice`:`Voice`,tip:`play.voice`,value:e.audio.voice,placeholder:v.length===0?`No voices. Add one in Settings.`:`Pick a voice`,options:v.map(e=>({value:e.voiceId,label:e.name})),problem:i(`audio.voice`),onPick:t=>{a({audio:{...e.audio,voice:t}})}}),f===void 0?null:(0,h.jsx)(F2,{language:f,voice:g.find(t=>t.voiceId===e.audio.voice),hidden:_.hidden,showAll:_.showAll,onShowAll:_.setShowAll}),S?(0,h.jsx)(`p`,{className:`col-span-full m-0 text-small text-ink-2`,children:`This voice reads only the intro and outro. Each speaker's voice is set under Speakers.`}):null]}),(0,h.jsxs)(`details`,{className:`col-span-full rounded-control border border-line px-3`,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer items-center text-small text-ink-2`,children:[`Speakers ·`,` `,e.voices===void 0?`Narration, one voice`:`${ege(e.voices.format)}, ${String(e.voices.speakers.length)} ${e.voices.speakers.length===1?`speaker`:`speakers`}`]}),(0,h.jsx)(`div`,{className:`pt-2 pb-3`,children:(0,h.jsx)(d6,{value:e.voices,providers:n,voices:r,script:e.sources.article===`provide`?e.provided.article:void 0,problem:i,cast:d,language:f,onChange:e=>a({voices:e})})})]}),(0,h.jsxs)(`details`,{className:`col-span-full rounded-control border border-line px-3`,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer items-center text-small text-ink-2`,children:[`Audio Advanced · `,C]}),(0,h.jsxs)(`div`,{className:`sl-fields pt-2 pb-3`,children:[(0,h.jsx)(`div`,{className:`col-span-full`,children:(0,h.jsx)(K3,{...l?{rawCounts:l}:{},value:e.chunking,onPick:e=>{a({chunking:e})}})}),u,(0,h.jsx)(h6,{value:e.narrationPrompt??``,prompts:t,supported:e.audio.provider===`inworld`&&e.audio.model===`inworld-tts-2`,error:i(`narrationPrompt`),onChange:e=>a({narrationPrompt:e})}),(0,h.jsx)(g6,{value:e.audio.usePronunciationGlossary,supported:tA({sources:e.sources,audio:{...e.audio,usePronunciationGlossary:!0}}),onChange:t=>a({audio:{...e.audio,usePronunciationGlossary:t}}),shared:{value:e.audio.shareGlossary??!0,onChange:t=>a({audio:{...e.audio,shareGlossary:t}})}}),(0,h.jsx)(m6,{value:e.audio.useNarrationAliases,onChange:t=>a({audio:{...e.audio,useNarrationAliases:t}})}),(0,h.jsx)(f6,{value:e.audio.describeFigures,skipCode:e.audio.skipCode,onChange:t=>a({audio:{...e.audio,...t}})})]})]})]}):null}),e.sources.audio===`provide`?(0,h.jsxs)(`div`,{className:Q3,children:[(0,h.jsx)(X3,{field:`provided.audio`,label:`Narration file`,accept:`audio/*`,uploads:e.provided.audio===void 0?[]:[e.provided.audio],problem:i(`provided.audio`),onPick:e=>{o(`audio`,e)},onReattach:c?(e,t)=>c(`audio`,e,t):void 0,onRemove:e=>{s(`audio`,e)}}),(0,h.jsx)(`p`,{className:`mt-2 text-small text-ink-2`,children:`Uploaded narration is used as-is; include any intro and outro in that file.`})]}):null]})}function rge({form:e,providers:t,prompts:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s,rawNumbers:c,more:l,titled:u}){return(0,h.jsxs)($3,{kind:`images`,name:`Images`,dim:e.sources.images===`off`,titled:u,children:[(0,h.jsx)(e6,{kind:`images`,form:e,update:i}),(0,h.jsx)(`div`,{className:Z3,children:e.sources.images===`generate`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(b6,{form:e,providers:t,problem:r,update:i}),(0,h.jsx)(J3,{prompts:n.filter(e=>e.kind===`image`),...c?{rawNumbers:c}:{},picked:e.imagePrompts,problem:r,onPick:e=>{i({imagePrompts:e})}}),(0,h.jsx)(ige,{form:e,prompts:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,...s?{onReattachFile:s}:{}}),l]}):null}),e.sources.images===`provide`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(X3,{field:`provided.images`,label:`Slideshow images`,accept:`image/png,image/jpeg,image/webp`,multiple:!0,numbered:!0,uploads:e.provided.images,problem:r(`provided.images`),onPick:e=>{a(`images`,e)},onReattach:s?(e,t)=>s(`images`,e,t):void 0,onRemove:e=>{o(`images`,e)}})}):null]})}function b6({form:e,providers:t,problem:n,update:r}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(EV,{field:`images.provider`,label:`Provider`,tip:`play.images.provider`,family:`image`,providers:t,value:e.images.provider,problem:n(`images`),onPick:e=>r({images:{provider:e,model:``}})}),(0,h.jsx)(DV,{field:`images.model`,label:`Model`,tip:`play.images.model`,provider:e.images.provider,value:e.images.model,problem:n(`images.model`),onPick:t=>r({images:{...e.images,model:t}})}),(0,h.jsx)(y6,{field:`images.thinking`,label:`Effort`,tip:`play.images.effort`,choice:e.images,problem:n(`images.thinking`),onChange:e=>r({images:e})})]})}function ige({form:e,prompts:t,problem:n,update:r,onPickFiles:i,onRemoveFile:a,onReattachFile:o}){return(0,h.jsx)(v6,{value:e.reference??_6,prompts:t,problem:n,onChange:e=>r({reference:e}),upload:(0,h.jsx)(X3,{field:`provided.reference`,label:`Establishing image file`,accept:`image/png,image/jpeg`,uploads:e.provided.reference===void 0?[]:[e.provided.reference],problem:n(`provided.reference`),onPick:e=>{i(`reference`,e)},onReattach:o?(e,t)=>o(`reference`,e,t):void 0,onRemove:e=>{a(`reference`,e)}})})}var x6=5e3,age=[`Write a YouTube description for this video.`,``,`- Summary: a 2-3 sentence hook that says what the viewer gets from watching, in plain words, without clickbait.`,`- Chapters: split the video where the topic changes, 5-12 chapters for a long video and fewer for a short one. Chapter titles are 2-6 words, in title case, and name what that part covers.`,`- Hashtags: 3-5 hashtags about the subject, most specific last.`,`- Tags: 15-25 search terms a viewer might type to find this video, from broad to specific.`].join(`
|
|
283
|
-
`),oge=`Built-in`;function S6({enabled:e,prompt:t,prompts:n,narrated:r,problem:i,onChange:a}){let o=(0,m.useId)(),s=n.filter(e=>e.kind===`description`),c=t!==``&&!s.some(e=>e.name===t),l=i?.(`youtubeDescription`)??i?.(`descriptionPrompt`);return(0,h.jsxs)(`div`,{className:`col-span-full sl-fields`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1 self-end`,...cb,children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-switch`,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:`${o}-switch`,type:`checkbox`,"data-play-field":`youtubeDescription`,checked:e,disabled:!r&&!e,"aria-describedby":l?`${o}-error`:void 0,className:`size-4 accent-accent`,onChange:e=>a({youtubeDescription:e.currentTarget.checked,descriptionPrompt:t})}),`YouTube description`]}),(0,h.jsx)(B,{id:`play.youtube-description`})]}),(0,h.jsx)(MV,{htmlFor:`${o}-prompt`,label:`Description prompt`,tip:`play.description-prompt`,children:(0,h.jsxs)(hV,{id:`${o}-prompt`,"data-play-field":`descriptionPrompt`,value:t,disabled:!e,onChange:t=>a({youtubeDescription:e,descriptionPrompt:t.target.value}),children:[(0,h.jsx)(`option`,{value:``,children:oge}),c?(0,h.jsxs)(`option`,{value:t,children:[t,` (saved choice)`]}):null,s.map(e=>(0,h.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}),l?(0,h.jsx)(`p`,{id:`${o}-error`,className:`sl-fields__wide m-0 text-small text-danger`,children:l}):r?null:(0,h.jsx)(`p`,{className:`sl-fields__wide m-0 text-label text-ink-3`,children:`Needs narration.`})]})}function C6({value:e,narrated:t,imageProvider:n,problem:r,onChange:i,fieldPrefix:a=`videoEdit`,language:o}){let s=(0,m.useId)(),c=e??dk,l=e=>i({...c,...e}),{api:u}=R(),d=N(yV(u,n,c.animate!==`off`)),f=e=>r?.(`${a}.${e}`),p=[c.transition===`cut`?void 0:`${pk[c.transition]} ${String(c.transitionSeconds)} s`,c.grade===`none`?void 0:hk[c.grade],c.atmosphere===`none`?void 0:gk[c.atmosphere],c.vignette===`off`?void 0:`Vignette`,c.grain===`off`?void 0:`Grain`,c.chapterCards?`Chapter cards`:void 0,c.animate===`off`?void 0:`Animated images`].filter(e=>e!==void 0),g=[`transition`,`transitionSeconds`,`chapterCards`,`animate`,`animateEvery`,`animateModel`].map(f).filter(e=>e!==void 0),_=d.data?.models??[],v=c.animateModel!==``&&!_.some(e=>e.id===c.animateModel),y=CO(o);return{cuts:(0,h.jsxs)(w6,{id:`${s}-cuts`,label:`Cuts`,tip:`project.video.cuts`,children:[(0,h.jsx)(hV,{id:`${s}-cuts`,"data-play-field":`${a}.cuts`,className:`min-w-0`,value:y===void 0?c.cuts:`interval`,disabled:y!==void 0,"aria-describedby":y===void 0?void 0:`${s}-cuts-note`,onChange:e=>l({cuts:e.target.value}),children:ak.map(e=>(0,h.jsx)(`option`,{value:e,children:fk[e]},e))}),y===void 0?null:(0,h.jsx)(`p`,{id:`${s}-cuts-note`,className:`m-0 basis-full text-small text-ink-3`,children:y})]}),look:(0,h.jsxs)(`details`,{className:`group min-w-0 rounded-control border border-line-strong`,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-10 cursor-pointer items-center gap-3 px-3 text-small max-[1099px]:min-h-11`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:`Look`}),(0,h.jsx)(`span`,{className:`min-w-0 truncate text-ink-3`,children:p.length===0?`Plain cuts, no effects`:p.join(` · `)})]}),(0,h.jsxs)(`div`,{className:`sl-fields border-line-strong border-t p-3`,children:[(0,h.jsxs)(w6,{id:`${s}-transition`,label:`Transition`,tip:`project.video.transition`,children:[(0,h.jsx)(hV,{id:`${s}-transition`,"data-play-field":`${a}.transition`,className:`min-w-0`,value:c.transition,onChange:e=>l({transition:e.target.value}),children:ok.map(e=>(0,h.jsx)(`option`,{value:e,children:pk[e]},e))}),(0,h.jsx)(hV,{"aria-label":`Transition length`,"data-play-field":`${a}.transitionSeconds`,"aria-invalid":f(`transitionSeconds`)!==void 0,className:`w-24 flex-none`,disabled:c.transition===`cut`,value:String(c.transitionSeconds),onChange:e=>l({transitionSeconds:Number(e.target.value)}),children:nae.map(e=>(0,h.jsxs)(`option`,{value:String(e),children:[e,` s`]},e))})]}),(0,h.jsx)(w6,{id:`${s}-grade`,label:`Colour grade`,tip:`project.video.grade`,children:(0,h.jsx)(T6,{id:`${s}-grade`,field:`${a}.grade`,value:c.grade,options:ck,labels:hk,onChange:e=>l({grade:e})})}),(0,h.jsx)(w6,{id:`${s}-vignette`,label:`Vignette`,tip:`project.video.vignette`,children:(0,h.jsx)(T6,{id:`${s}-vignette`,field:`${a}.vignette`,value:c.vignette,options:sk,labels:mk,onChange:e=>l({vignette:e})})}),(0,h.jsx)(w6,{id:`${s}-grain`,label:`Film grain`,tip:`project.video.grain`,children:(0,h.jsx)(T6,{id:`${s}-grain`,field:`${a}.grain`,value:c.grain,options:sk,labels:mk,onChange:e=>l({grain:e})})}),(0,h.jsx)(w6,{id:`${s}-atmosphere`,label:`Atmosphere`,tip:`project.video.atmosphere`,children:(0,h.jsx)(T6,{id:`${s}-atmosphere`,field:`${a}.atmosphere`,value:c.atmosphere,options:lk,labels:gk,onChange:e=>l({atmosphere:e})})}),(0,h.jsx)(w6,{id:`${s}-cards`,label:`Chapter cards`,tip:`project.video.chapter-cards`,children:(0,h.jsx)(`input`,{id:`${s}-cards`,type:`checkbox`,"data-play-field":`${a}.chapterCards`,className:`size-4 accent-accent`,checked:c.chapterCards,disabled:!t&&!c.chapterCards,onChange:e=>l({chapterCards:e.currentTarget.checked})})}),(0,h.jsxs)(w6,{id:`${s}-animate`,label:`Animate images`,tip:`project.video.animate`,wide:!0,children:[(0,h.jsx)(hV,{id:`${s}-animate`,"data-play-field":`${a}.animate`,"aria-invalid":f(`animate`)!==void 0,className:`min-w-0`,value:c.animate,onChange:e=>l({animate:e.target.value}),children:uk.map(e=>(0,h.jsx)(`option`,{value:e,disabled:e===`chapters`&&!t,children:_k[e]},e))}),(0,h.jsx)(hV,{"aria-label":`Animate every how many images`,"data-play-field":`${a}.animateEvery`,"aria-invalid":f(`animateEvery`)!==void 0,className:`w-24 flex-none`,disabled:c.animate!==`every`,value:String(c.animateEvery),onChange:e=>l({animateEvery:Number(e.target.value)}),children:Array.from({length:9},(e,t)=>t+2).map(e=>(0,h.jsxs)(`option`,{value:String(e),children:[`every `,e]},e))}),(0,h.jsxs)(hV,{"aria-label":`Image-to-video model`,"data-play-field":`${a}.animateModel`,"aria-invalid":f(`animateModel`)!==void 0,className:`min-w-0`,disabled:c.animate===`off`,value:c.animateModel,onChange:e=>l({animateModel:e.target.value}),children:[(0,h.jsx)(`option`,{value:``,children:`Choose a model`}),v?(0,h.jsxs)(`option`,{value:c.animateModel,children:[c.animateModel,` (saved choice)`]}):null,_.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),g.length>0?(0,h.jsx)(`p`,{className:`col-span-full text-small text-danger`,children:g[0]}):c.animate!==`off`&&d.isSuccess&&_.length===0?(0,h.jsx)(`p`,{className:`col-span-full text-label text-ink-3`,children:`This image provider has no image-to-video models. Choose fal.ai or Replicate for images to animate them.`}):null]})]})}}function w6({id:e,label:t,tip:n,wide:r=!1,children:i}){return(0,h.jsxs)(`div`,{className:I(`sl-field`,r&&`sl-fields__wide`),...cb,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:e,className:`sl-field__label`,children:t}),(0,h.jsx)(B,{id:n,label:t.toLowerCase()})]}),(0,h.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-2 [&>select]:min-w-0 [&>select]:flex-1`,children:i})]})}function T6({id:e,field:t,value:n,options:r,labels:i,onChange:a}){return(0,h.jsx)(hV,{id:e,"data-play-field":t,className:`min-w-0`,value:n,onChange:e=>a(e.target.value),children:r.map(e=>(0,h.jsx)(`option`,{value:e,children:i[e]},e))})}var sge=sO(`kind`,[K({kind:fO(`upload`),stagedFileId:U().regex(/^[A-Za-z0-9_-]{1,64}$/)}),K({kind:fO(`output`),outputId:U().regex(/^[A-Za-z0-9_-]{1,64}$/)}),K({kind:fO(`picture`),sha256:U().regex(/^[a-f0-9]{64}$/)})]),E6=K({format:q(sS),subtitles:K({mode:q(BA),fontId:U().max(160).regex(/^[A-Za-z0-9_-]+$/),fontSize:W().finite().min(16).max(120),position:q(VA)}),videoEdit:qA.optional(),previewText:U().max(200).optional(),image:sge.optional(),shorts:K({titleOnScreen:rO(),speed:W().finite().min(1).max(1.25).optional(),title:U().max(100).optional()}).optional(),force:rO().optional()}),cge=K({hash:U().regex(/^[a-f0-9]{64}$/),url:U().min(1),cached:rO(),seconds:W().positive()});async function lge(e,t,n){let r=await e.fetch(`${e.origin}/api/style-preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),...n===void 0?{}:{signal:n}});if(!r.ok)throw await po(r);let i=Co(cge,await r.json());return{...i,src:`${e.origin}${i.url}`}}var uge=600;function D6({settings:e,label:t,drawnOn:n,poster:r}){let{api:i}=R(),a=N({queryKey:Fj,queryFn:()=>Ij(i),staleTime:6e4}),{format:o,subtitles:s,videoEdit:c,previewText:l,image:u,shorts:d}=e,f=r??(u?.kind===`picture`?Lb(i,u.sha256):void 0),p=u===void 0?``:JSON.stringify(u),g=d===void 0?``:JSON.stringify(d),_=(0,m.useMemo)(()=>JSON.stringify({format:o,subtitles:{mode:s.mode,fontId:s.fontId,fontSize:s.fontSize,position:s.position},...c===void 0?{}:{videoEdit:c},...l===void 0||l.trim()===``?{}:{previewText:l},...p===``?{}:{image:JSON.parse(p)},...g===``?{}:{shorts:JSON.parse(g)}}),[o,s.mode,s.fontId,s.fontSize,s.position,c,l,p,g]),v=(0,m.useMemo)(()=>E6.safeParse(JSON.parse(_)).success,[_]),[y,b]=(0,m.useState)({kind:`idle`}),[x,S]=(0,m.useState)(void 0),C=(0,m.useRef)(void 0),w=(0,m.useCallback)(async e=>{C.current?.abort();let t=new AbortController;C.current=t,b({kind:`pending`});try{let n=await lge(i,{...E6.parse(JSON.parse(_)),...e?{force:e}:{}},t.signal);if(C.current!==t)return;S(n.src),b({kind:`ready`,src:n.src})}catch(e){if(C.current!==t||t.signal.aborted)return;b({kind:`failed`,message:e instanceof Error&&e.message!==``?e.message:`The style preview couldn't render. Press Render again.`})}},[i,_]);(0,m.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>{w(!1)},uge);return()=>clearTimeout(e)},[w,v]),(0,m.useEffect)(()=>()=>C.current?.abort(),[]);let T=a.data?.fonts.find(e=>e.id===s.fontId)?.name??(s.fontId==="default"?`Barlow`:`Chosen font`),E=d===void 0?s.mode===`burn-in`?`Captions: ${T} ${String(s.fontSize)} · ${dge(s.position)}`:s.mode===`files`?`Captions: a separate file, which players show in their own style`:`Captions: off`:[`Captions: ${T}, word by word`,d.titleOnScreen?`Title on screen`:`No title on screen`,d.speed===void 0||d.speed===1?void 0:`${d.speed.toFixed(2)}×`].filter(e=>e!==void 0).join(` · `),D=d===void 0?`Style preview`:`Shorts preview`,O=o===`9:16`||d!==void 0;return(0,h.jsxs)(`section`,{"aria-label":D,className:`min-w-0 space-y-3`,children:[(0,h.jsx)(V,{as:`h3`,title:D,meta:d===void 0?`6 seconds of the sample, rendered with your settings`:`A few seconds of the sample as a short, rendered with your settings`,info:d===void 0?`project.video.style-preview`:`play.shorts.preview`,children:(0,h.jsxs)(L,{variant:`quiet`,size:`small`,disabled:!v||y.kind===`pending`,disabledReason:v?`Rendering the preview…`:`Fix the caption settings to render the preview.`,onClick:()=>{w(!0)},children:[(0,h.jsx)(qc,{"aria-hidden":`true`,size:16,strokeWidth:1.75}),`Render again`]})}),x===void 0?null:(0,h.jsx)(O0,{src:x,label:t??D,...f===void 0?{}:{poster:f},portrait:O,className:O?`max-w-[270px]`:`max-w-[480px]`}),y.kind===`pending`?(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink-2`,children:`Rendering the preview…`}):null,y.kind===`failed`?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:y.message}):null,v?null:(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`The preview renders again once the caption size is between 16 and 120.`}),(0,h.jsxs)(`p`,{className:`text-small text-ink-2`,children:[E,u===void 0||n===void 0?``:` · Drawn on ${n}`]})]})}function dge(e){let t=e.replace(/-/g,` `);return`${t[0]?.toUpperCase()??``}${t.slice(1)}`}function fge({form:e,problem:t,update:n,onPickFiles:r,onRemoveFile:i,onReattachFile:a}){let o=e.provided.ambientBed;return(0,h.jsx)(k2,{value:e.ambientBed,inherit:`The channel's (brand kit)`,sources:$O,offerNone:!0,problem:e=>t(`ambientBed.${e}`),file:(0,h.jsx)(X3,{field:`ambientBed.file`,label:`Ambient sound file: an audio file, looped if shorter than the video`,accept:`audio/*`,uploads:o===void 0?[]:[o],problem:t(`ambientBed.file`),onPick:e=>r(`ambientBed`,e),onReattach:a?(e,t)=>a(`ambientBed`,e,t):void 0,onRemove:e=>i(`ambientBed`,e)}),onChange:e=>n({ambientBed:e})})}function O6({value:e,onChange:t,problem:n,switchTip:r=`project.loudness`,switchLabel:i=`Level the volume`}){return(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-3`,children:[(0,h.jsx)(lb,{checked:e.enabled,label:i,tip:r,onChange:n=>t({...e,enabled:n})}),e.enabled?(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(A6,{target:`video`,label:`Video volume`,tip:`project.loudness.video`,lufs:e.videoLufs,error:n?.(`videoLufs`),onChange:n=>t({...e,videoLufs:n})}),(0,h.jsx)(A6,{target:`audioFiles`,label:`Audio files volume`,tip:`project.loudness.audio-files`,lufs:e.audioFilesLufs,error:n?.(`audioFilesLufs`),onChange:n=>t({...e,audioFilesLufs:n})})]}):null]})}var pge=`Enter a volume between ${j6(-10)} dB and ${j6(4)} dB (${String(PO(-10))}% to ${String(PO(4))}%).`;function k6(e,t){let n=e.trim().replace(`−`,`-`).replace(`,`,`.`);if(n===``)return;let r=Number(n.replace(/(dB|%)$/i,``).trim());if(!Number.isFinite(r)||t===`percent`&&r<=0)return;let i=t===`db`?r:Die(r);if(!(i<-10.25||i>4.25))return Oie(i)}function A6({target:e,label:t,tip:n,lufs:r,error:i,onChange:a}){let o=(0,m.useId)(),s=Tie(r,e),[c,l]=(0,m.useState)(),u=c===void 0||k6(c.text,c.unit)!==void 0,d=(t,n)=>{l({unit:t,text:n});let r=k6(n,t);r!==void 0&&a(Eie(r,e))},f=c?.unit===`db`?c.text:j6(s),p=c?.unit===`percent`?c.text:String(PO(s));return(0,h.jsx)(uV,{label:t,tip:n,help:`0 dB is the recommended ${M6(NO(e))} LUFS; this is ${M6(r)} LUFS. Peaks stay under ${M6(wie(e))} dBTP.`,error:u?i:pge,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-small`,children:[(0,h.jsx)(Y,{type:`text`,inputMode:`decimal`,className:`sl-input--number`,"data-play-field":`loudness.${e===`video`?`videoLufs`:`audioFilesLufs`}`,value:f,onChange:e=>d(`db`,e.target.value),onBlur:()=>l(void 0)}),(0,h.jsx)(`span`,{children:`dB`}),(0,h.jsx)(Y,{id:`${o}-percent`,"aria-label":`${t} as a percentage of the recommended level`,type:`text`,inputMode:`decimal`,className:`sl-input--number`,value:p,onChange:e=>d(`percent`,e.target.value),onBlur:()=>l(void 0)}),(0,h.jsx)(`span`,{children:`%`})]})})}function j6(e){return e>0?`+${String(e)}`:M6(e)}function M6(e){return String(e).replace(`-`,`−`)}function N6({sentence:e,paragraph:t,problem:n,onChange:r}){let i=`0 to 2 in steps of ${String(BO)}`;return(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(uV,{label:`Pause between sentences (seconds)`,tip:`project.pause.sentence`,help:`${i}; ${String(zO)} is the default. 0 leaves the voice's own.`,error:n(`sentencePauseSeconds`),children:(0,h.jsx)(Y,{type:`text`,inputMode:`decimal`,className:`sl-input--number`,"data-play-field":`sentencePauseSeconds`,value:e,onChange:e=>r(`sentencePauseSeconds`,e.target.value)})}),(0,h.jsx)(uV,{label:`Pause between paragraphs (seconds)`,tip:`project.pause.paragraph`,help:`${i}; 0 (the default) keeps the sentence pause.`,error:n(`paragraphPauseSeconds`),children:(0,h.jsx)(Y,{type:`text`,inputMode:`decimal`,className:`sl-input--number`,"data-play-field":`paragraphPauseSeconds`,value:t,onChange:e=>r(`paragraphPauseSeconds`,e.target.value)})})]})}function P6(e){let t=e.trim().replace(`,`,`.`);if(t===``)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function mge({form:e,problem:t,update:n}){let{api:r}=R(),i=N(tb(r)).data?.loudness??jO,a=e.loudness;return(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-3`,children:[e.sources.audio===`generate`?(0,h.jsx)(N6,{sentence:e.sentencePause??`0.4`,paragraph:e.paragraphPause??`0`,problem:t,onChange:(e,t)=>n(e===`sentencePauseSeconds`?{sentencePause:t}:{paragraphPause:t})}):null,(0,h.jsx)(O6,{value:{enabled:a?.enabled??i.enabled,videoLufs:a?.videoLufs??i.videoLufs,audioFilesLufs:a?.audioFilesLufs??i.audioFilesLufs},problem:e=>t(`loudness.${e}`),onChange:e=>n({loudness:e})})]})}function F6({value:e,onPick:t,disabled:n=!1}){let r=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,...cb,children:[(0,h.jsx)(Y4,{id:r,className:`shrink-0`,children:`Thumbnails`}),(0,h.jsxs)(X4,{type:`single`,value:String(e),"aria-labelledby":r,disabled:n,"data-play-field":`thumbnailCount`,onValueChange:e=>{(e===`1`||e===`3`)&&t(e===`3`?3:1)},children:[(0,h.jsx)(Z4,{value:`1`,children:`1`}),(0,h.jsx)(Z4,{value:`3`,children:`3`})]}),(0,h.jsx)(B,{id:`play.thumbnail-count`})]})}function hge({form:e,problem:t,update:n}){return(0,h.jsxs)($3,{kind:`research`,name:`Research`,dim:e.sources.research===`off`,children:[(0,h.jsx)(e6,{kind:`research`,form:e,update:n}),(0,h.jsx)(`div`,{className:Z3,children:e.sources.research===`generate`?(0,h.jsx)(`span`,{className:`engraved text-ink-3`,children:`Runs through the LLM, one agent per chapter`}):null}),e.sources.research===`provide`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(Y3,{field:`provided.research`,label:`Research notes`,tip:`play.provided.research`,value:e.provided.research,placeholder:`Paste the notes the article will be written from.`,problem:t(`provided.research`),onChange:t=>{n({provided:{...e.provided,research:t}})}})}):null]})}function gge({form:e,prompts:t,problem:n,update:r,titled:i}){return(0,h.jsxs)($3,{kind:`article`,name:`Article`,dim:!1,titled:i,children:[(0,h.jsx)(e6,{kind:`article`,form:e,update:r}),(0,h.jsx)(`div`,{className:`${Q3} grid gap-4`,children:e.sources.article===`generate`?(0,h.jsx)(CV,{field:`articlePrompt`,label:jk(e)?`Script prompt`:`Article prompt`,tip:`play.article-prompt`,value:e.articlePrompt,placeholder:`Pick a prompt`,options:t6(t,Q1(e)),problem:n(`articlePrompt`),onPick:e=>{r({articlePrompt:e})}}):null}),e.sources.article===`provide`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(Y3,{field:`provided.article`,label:`Article text`,tip:`play.provided.article`,value:e.provided.article,placeholder:`Paste the article that will be narrated.`,problem:n(`provided.article`),onChange:t=>{r({provided:{...e.provided,article:t}})}})}):null]})}function _ge({form:e,providers:t,prompts:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s}){let c=e.sources.thumbnail===`from_prompt`||e.sources.thumbnail===`prompt_by_llm`;return(0,h.jsxs)($3,{kind:`thumbnail`,name:`Thumbnail`,dim:e.sources.thumbnail===`off`,children:[(0,h.jsx)(e6,{kind:`thumbnail`,form:e,update:i}),(0,h.jsxs)(`div`,{className:Z3,children:[c&&e.sources.images!==`generate`?(0,h.jsx)(b6,{form:e,providers:t,problem:r,update:i}):null,c?(0,h.jsx)(CV,{field:`thumbnailPrompt`,label:`Thumbnail prompt`,tip:`play.thumbnail-prompt`,value:e.thumbnailPrompt,placeholder:`Pick a prompt`,options:t6(n,`thumbnail`),problem:r(`thumbnailPrompt`),onPick:e=>{i({thumbnailPrompt:e})}}):null,c?(0,h.jsx)(F6,{value:e.thumbnailCount===3?3:1,onPick:e=>{i({thumbnailCount:e})}}):null]}),e.sources.thumbnail===`provide`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(X3,{field:`provided.thumbnail`,label:`Thumbnail image`,accept:`image/png,image/jpeg,image/webp`,uploads:e.provided.thumbnail===void 0?[]:[e.provided.thumbnail],problem:r(`provided.thumbnail`),onPick:e=>{a(`thumbnail`,e)},onReattach:s?(e,t)=>s(`thumbnail`,e,t):void 0,onRemove:e=>{o(`thumbnail`,e)}})}):null]})}function vge({form:e,prompts:t,silenceGapSeconds:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s,rawTiming:c,extras:l=!0,language:u,titled:d}){let f=e.sources.video===`generate`?e.sources.audio===`off`?`Silent video · each image shown once`:`Images and narration · ${String(n)} s segment gaps`:e.sources.audio===`off`?`Download each enabled stage separately`:`Combined WAV export with narration and segment gaps`,p=t=>({value:c?c[t]:Number.isFinite(e[t])?String(e[t]):``,onChange:e=>{c?c.onChange(t,e):i({[t]:e.trim()===``?NaN:Number(e)})}}),m=C6({value:e.videoEdit,narrated:e.sources.audio!==`off`,imageProvider:e.images.provider,problem:r,language:u??e.language,onChange:e=>i({videoEdit:e})});return(0,h.jsxs)($3,{kind:`video`,name:`Export`,dim:e.sources.video===`off`,titled:d,children:[(0,h.jsx)(e6,{kind:`video`,form:e,update:i}),(0,h.jsx)(`span`,{className:Z3,children:(0,h.jsx)(`span`,{className:`engraved text-ink-3`,children:f})}),e.sources.video===`generate`||e.sources.audio!==`off`?(0,h.jsxs)(`div`,{className:Z3,children:[e.sources.video===`generate`?(0,h.jsx)(L6,{field:`imageSeconds`,label:`Seconds per image`,tip:`play.image-seconds`,step:1,problem:r(`imageSeconds`),...p(`imageSeconds`)}):null,e.sources.video===`generate`?(0,h.jsx)(L6,{field:`zoomPercent`,label:`Zoom (%)`,tip:`play.zoom`,step:.5,problem:r(`zoomPercent`),...p(`zoomPercent`)}):null,e.sources.video===`generate`?(0,h.jsx)(SV,{label:`Motion`,tip:`play.motion`,problem:void 0,children:({id:t})=>(0,h.jsx)(hV,{id:t,"data-play-field":`motionStyle`,className:`w-full`,value:e.motionStyle,onChange:e=>i({motionStyle:e.target.value}),children:fS.map(e=>(0,h.jsx)(`option`,{value:e,children:Fk[e]},e))})}):null,e.sources.video===`generate`?m.cuts:null,e.sources.audio===`off`?null:(0,h.jsx)(L6,{field:`edgeSilenceSeconds`,label:`Silence at start and end (seconds)`,tip:`play.edge-silence`,step:.5,problem:r(`edgeSilenceSeconds`),...p(`edgeSilenceSeconds`)})]}):null,e.sources.video===`generate`?(0,h.jsx)(`div`,{className:Q3,children:m.look}):null,e.sources.video===`generate`&&e.sources.audio!==`off`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(fge,{form:e,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s})}):null,e.sources.audio===`off`?null:(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(mge,{form:e,problem:r,update:i})}),l?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(I6,{form:e,prompts:t,problem:r,update:i,onPickFiles:a,onRemoveFile:o,...s===void 0?{}:{onReattachFile:s}})}):null,e.sources.images===`off`?(0,h.jsx)(`p`,{className:`${Q3} text-small text-ink-2`,children:`Video is Off because Images is Off. Generate or provide images to enable video.`}):null]})}function I6({form:e,prompts:t,problem:n,update:r,onPickFiles:i,onRemoveFile:a,onReattachFile:o}){return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[e.sources.audio===`generate`&&e.audio.describeFigures===!0?(0,h.jsx)(p6,{value:e.showFigures,onChange:e=>r({showFigures:e})}):null,e.sources.article===`off`?null:(0,h.jsx)(`div`,{children:(0,h.jsx)(S6,{enabled:e.youtubeDescription===!0,prompt:e.descriptionPrompt??``,prompts:t,narrated:e.sources.audio!==`off`,problem:n,onChange:e=>r(e)})}),e.sources.article===`off`?null:(0,h.jsx)(`div`,{children:(0,h.jsx)(LV,{value:e.shorts??NV,prompts:t,narrated:e.sources.audio!==`off`,problem:n,musicName:e.provided.shortsMusic?.name,music:(0,h.jsxs)(`div`,{className:`basis-full`,children:[(0,h.jsx)(X3,{field:`shorts.music`,label:`Background music (optional): an audio file, looped if shorter than a short`,accept:`audio/*`,disabled:!aM(e),uploads:e.provided.shortsMusic===void 0?[]:[e.provided.shortsMusic],problem:n(`shorts.music`),onPick:e=>i(`shortsMusic`,e),onReattach:o?(e,t)=>o(`shortsMusic`,e,t):void 0,onRemove:e=>a(`shortsMusic`,e)}),(0,h.jsx)(`p`,{className:`mt-1 text-label text-ink-3`,children:`Plays at the volume above under every short and dips while the narrator speaks.`})]}),preview:(0,h.jsx)(D6,{settings:PV(e.shorts??NV,e.subtitles.fontId)}),onChange:e=>r({shorts:e})})})]})}function L6({field:e,label:t,tip:n,placeholder:r,step:i,problem:a,value:o,onChange:s}){return(0,h.jsx)(SV,{label:t,tip:n,problem:a,children:({id:t,describedBy:n})=>(0,h.jsx)(Y,{id:t,"data-play-field":e,type:`text`,inputMode:i<1?`decimal`:`numeric`,className:`sl-input--number`,"aria-invalid":a!==void 0,"aria-describedby":n,placeholder:r,value:o,onChange:e=>s(e.target.value)})})}function yge({form:e,update:t}){let n=e.sources.document===`off`;return(0,h.jsxs)($3,{kind:`document`,name:`Document`,dim:n,children:[(0,h.jsx)(e6,{kind:`document`,form:e,update:t}),(0,h.jsx)(`div`,{className:Z3,children:(0,h.jsx)(SV,{label:`Theme`,tip:`play.document-theme`,problem:void 0,children:({id:r})=>(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(W3,{id:r,field:`document.theme`,className:`w-auto min-w-[120px]`,disabled:n,value:e.document,onChange:e=>{t({document:e})}}),(0,h.jsx)(ha,{to:`/document-themes`,className:`text-small text-accent-ink underline`,children:`Edit themes`})]})})})]})}function bge({form:e,providers:t,problem:n,update:r,uses:i,onSettings:a}){let o=[...new Set(i.map(e=>e.label))],s=o.length<=1?o[0]??``:`${o.slice(0,-1).join(`, `)} and ${o.at(-1)??``}`;return(0,h.jsxs)(`section`,{"aria-label":`Text generation`,className:`border-y border-line py-4`,children:[(0,h.jsx)(V,{as:`h3`,title:`Text generation`,meta:`Used for ${s}.`,info:`play.text-generation`,className:`pb-3`,children:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:a,children:`Settings`})}),(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(EV,{field:`llm.provider`,label:`LLM`,tip:`play.llm.provider`,family:`llm`,providers:t,value:e.llm.provider,problem:n(`llm.provider`)??(e.llm.provider===``?n(`llm`):void 0),onPick:e=>r({llm:{provider:e,model:``}})}),(0,h.jsx)(DV,{field:`llm.model`,label:`Text model`,tip:`play.llm.model`,provider:e.llm.provider,value:e.llm.model,problem:n(`llm.model`)??(e.llm.provider!==``&&n(`llm`)?`Pick a text model.`:void 0),onPick:t=>r({llm:{...e.llm,model:t}})}),(0,h.jsx)(y6,{choice:e.llm,onChange:e=>r({llm:e})})]})]})}function R6({section:e,entries:t,...n}){let r=uM(n.form,t);return r[0]?.section===e?(0,h.jsx)(bge,{...n,uses:r}):null}function xge(e){let{form:t,onLibrary:n}=e,r=e.prompts.find(e=>e.kind===Q1(t)&&e.name===t.articlePrompt);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(gge,{...e,titled:!1}),t.sources.article===`generate`?(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 py-3`,children:[r?(0,h.jsxs)(`details`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`summary`,{"data-play-field":`articlePrompt.preview`,className:`cursor-pointer py-2 text-small text-accent-ink`,children:`View prompt`}),(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-words py-3 font-sans text-body text-ink-2`,children:r.body})]}):(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:e.prompts.some(e=>e.kind===Q1(t))?`Choose a saved ${Q1(t)} prompt.`:`No ${Q1(t)} prompts saved. Create a prompt to begin.`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:()=>n(`/prompts`),children:`Create prompt`})]}):(0,h.jsxs)(`p`,{className:`py-3 text-small text-ink-3`,children:[t.provided.article.trim()?t.provided.article.trim().split(/\s+/).length:0,` `,`words · `,t.provided.article.length,` characters`]}),(0,h.jsx)(R6,{...e,section:`article`,onSettings:()=>n(`/settings`)}),t.sources.article===`off`?(0,h.jsx)(`p`,{className:`py-4 text-small text-ink-3`,children:`No article: for a project of images or a thumbnail made from prompts. Narration, the PDF and anything else that reads the article stay off.`}):t.sources.article===`provide`?(0,h.jsx)(`p`,{className:`py-4 text-small text-ink-3`,children:`Research is Off because the article is provided.`}):(0,h.jsx)(hge,{...e})]})}function Sge(){let{api:e}=R(),t=bM(),n=_(),[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)(!1),l=gy(),u=N({queryKey:[`play-drafts`],queryFn:async()=>{let t=await Tj(e);if(!t.ok)throw Error(t.message);return t.value.drafts}}),d=async()=>{if(!r||s)return;let e=r.id;c(!0),o(null);try{await t.discard({id:r.id,version:r.version}),i(null),await n.cancelQueries({queryKey:[`play-drafts`]}),n.setQueryData([`play-drafts`],t=>t?.filter(t=>t.id!==e))}catch(e){let t=e instanceof Error?e.message:`The draft wasn't discarded. Try again.`;o(t),l(t,`error`)}finally{c(!1)}};return(0,h.jsxs)(`section`,{"aria-label":`Drafts`,className:`flex min-w-0 flex-wrap items-center gap-2 text-small`,children:[(0,h.jsx)(`p`,{role:`status`,className:I(`engraved min-w-[112px] text-right`,t.status===`saved`?`text-accent-ink`:t.status===`error`||t.status===`conflict`?`text-danger`:`text-ink-3`),children:{unsaved:`Unsaved`,saving:`Saving…`,saved:`Saved`,error:`Couldn't save`,conflict:`Changed elsewhere`}[t.status]}),t.status===`error`?(0,h.jsx)(L,{variant:`quiet`,onClick:()=>{!t.view&&t.activeId&&t.edited===0?t.open(t.activeId):t.flush()},children:`Retry`}):null,t.status===`conflict`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`quiet`,onClick:()=>{t.activeId&&t.open(t.activeId)},children:`Reload saved draft`}),(0,h.jsx)(L,{variant:`quiet`,onClick:()=>void t.saveAsNew(),children:`Save as a new draft`}),(0,h.jsx)(B,{id:`play.draft-conflict`})]}):null,(0,h.jsxs)(ab,{children:[(0,h.jsx)(ob,{asChild:!0,children:(0,h.jsxs)(L,{variant:`quiet`,children:[`Drafts`,(0,h.jsx)(Cc,{"aria-hidden":`true`,className:`size-4`})]})}),(0,h.jsxs)(sb,{align:`end`,className:`w-[340px] p-0`,"aria-label":`Saved drafts`,children:[u.isPending?(0,h.jsx)(`p`,{role:`status`,className:`px-3 py-2`,children:`Loading drafts…`}):null,u.error?(0,h.jsxs)(`p`,{role:`alert`,className:`px-3 py-2 text-danger`,children:[u.error.message,` `,(0,h.jsx)(L,{variant:`quiet`,onClick:()=>void u.refetch(),children:`Retry`})]}):null,u.data?.length===0?(0,h.jsx)(`p`,{className:`px-3 py-2`,children:`No saved drafts`}):null,a?(0,h.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-danger`,children:a}):null,u.data?.length?(0,h.jsx)(iU,{label:`Saved drafts`,className:`max-h-72 overflow-y-auto border-t-0`,children:u.data.map(e=>(0,h.jsx)(aU,{title:e.title||`Untitled draft`,onSelect:()=>void t.open(e.id),meta:(0,h.jsxs)(`time`,{dateTime:e.updatedAt,children:[`Last edited `,Uu(e.updatedAt)]}),actions:(0,h.jsx)(ly,{size:`small`,label:`Discard ${e.title||`Untitled draft`}`,onClick:()=>{i(e),o(null)},children:(0,h.jsx)($c,{"aria-hidden":`true`})}),children:e.readable?null:(0,h.jsx)(`p`,{className:`m-0 text-label text-waiting`,children:`Unsupported or corrupt draft. Try opening it to recover, or discard it.`})},e.id))}):null]})]}),(0,h.jsx)(L,{onClick:()=>void t.newDraft(),children:`New draft`}),(0,h.jsx)(B,{id:`play.drafts`}),(0,h.jsx)(Dy,{open:r!==null,title:`Discard ${r?.title||`Untitled draft`}?`,consequence:`The draft is removed. This cannot be undone.`,confirmLabel:`Discard draft`,pending:s,onConfirm:()=>void d(),onCancel:()=>{s||i(null)}})]})}function z6(e,t){let n=[...e.querySelectorAll(`[data-play-field]`)].find(e=>e.dataset.playField===t);if(!n||n.hasAttribute(`disabled`))return!1;let r=n.closest(`details`);return r!==null&&!r.open&&(r.open=!0),n.focus(),n.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),document.activeElement===n}function Cge(e,t,n,r=[]){let i=e;if(e===`fontUpload`&&(i=`subtitles.fontUpload`),/^provided\.images\.\d+$/.test(e)&&(i=`provided.images`),e===`subtitles`&&(i=`subtitles.mode`),e===`chunking`&&(i=`chunking.mode`),[`audio`,`llm`,`images`].includes(e)&&(i=`${e}.provider`),e===`provided`){let e=[`audio`,`images`,`thumbnail`].find(e=>t.sources[e]===`provide`&&(e===`images`?t.provided.images:[t.provided[e]]).some(e=>e&&(e.error!==void 0||e.file===void 0))),n=t.provided.shortsMusic;i=e===void 0&&aM(t)&&n!==void 0&&(n.error!==void 0||n.file===void 0)?`shorts.music`:t.reference?.source===`provide`&&t.provided.reference!==void 0&&(t.provided.reference.error!==void 0||t.provided.reference.file===void 0)?`provided.reference`:`provided.${e??`audio`}`;let r=t.provided.ambientBed;e===void 0&&oM(t)&&r!==void 0&&(r.error!==void 0||r.file===void 0)&&(i=`ambientBed.file`)}let a=/^imagePrompts\.(\d+)\.(.+)$/.exec(e);if(a){let e=t.imagePrompts[Number(a[1])];e&&(i=`imagePrompts.${e.name}.${a[2]}`)}e===`imagePrompts`&&(i=t.imagePrompts[0]?`imagePrompts.${t.imagePrompts[0].name}.number`:`imagePrompts`);let o=/^variants\.(\d+)\.(.+)$/.exec(e);o&&(i=`items.${n[Number(o[1])]?.key??o[1]}.${o[2]}`);let s=/^items\.(\d+)\.(.+)$/.exec(e);s&&(i=Number(s[1])===0?s[2]??e:`items.${n[Number(s[1])-1]?.key??s[1]}.${s[2]}`);let c=t=>t.some(t=>e===t||e.startsWith(`${t}.`));return{section:c([`title`,`articlePrompt`,`provided.article`,`provided.research`,`sources.article`,`sources.research`,...(uM(t,r)[0]?.section??`article`)===`article`?[`llm`]:[],`values`])?`content`:c([`format`,`subtitles`,`fontUpload`])?`style`:c(`audio,narrationPrompt,voices,provided.audio,intro,outro,chunking,images,imagePrompts,imageScale,provided.images,thumbnailPrompt,provided.thumbnail,provided.reference,reference,provided,sources,imageSeconds,zoomPercent,motionStyle,edgeSilenceSeconds,document,youtubeDescription,descriptionPrompt,shorts,videoEdit,ambientBed,loudness,sentencePauseSeconds,paragraphPauseSeconds,llm`.split(`,`))?`outputs`:`review`,field:i}}function wge({fields:e,values:t,origins:n,topics:r=[],hide:i=[],problem:a,onChange:o}){let s=e.filter(e=>!i.includes(e.name));return s.length?(0,h.jsxs)(`section`,{"aria-label":`Keywords`,className:`min-w-0`,children:[(0,h.jsx)(`p`,{className:`m-0 mb-3 text-small text-ink-2`,children:`Each keyword is entered once and fills every place that names it.`}),(0,h.jsx)(o0,{keywords:s.map(e=>({name:e.name,value:Object.hasOwn(t,e.name)?t[e.name]??``:``,feeds:n?.get(e.name)??[],topic:r.includes(e.name)})),problem:a,onChange:o})]}):null}var Tge={every:`minutes`,value:`2`};function Ege({document:e,problem:t,onEdit:n}){let r=(0,m.useId)(),{form:i}=e,a=i.imageScale,o=t(`imageScale.value`)??t(`imageScale`),s=a===void 0?void 0:o===void 0?Oge(e):{text:o,problem:!0},c=t=>{let{imageScale:r,...o}=i;n({...e,form:{...o,...t===void 0?{}:{imageScale:t},...t!==void 0&&a===void 0&&i.motionStyle===`zoom`?{motionStyle:`mixed`}:{}}})};return(0,h.jsxs)(`div`,{className:`flex basis-full flex-col items-start gap-2`,children:[(0,h.jsx)(lb,{checked:a!==void 0,label:`More images for long videos`,tip:`play.image-scale`,describedBy:`${r}-line`,onChange:e=>c(e?Tge:void 0)}),a===void 0?null:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-small`,...cb,children:[(0,h.jsx)(ub,{label:`How the rate is given`,tip:`play.image-scale.rate`,value:a.every,options:[{value:`minutes`,label:`Every N minutes`},{value:`hour`,label:`N per hour`}],onChange:e=>c({every:e,value:Dge(a.value,a.every,e)})}),a.every===`minutes`?(0,h.jsx)(`span`,{children:`One image every`}):null,(0,h.jsx)(Y,{id:`${r}-value`,"data-play-field":`imageScale.value`,"aria-label":a.every===`minutes`?`Minutes per image`:`Images per hour`,inputMode:`decimal`,className:`sl-input--number`,"aria-invalid":s?.problem===!0,"aria-describedby":`${r}-line`,value:a.value,onChange:e=>c({every:a.every,value:e.target.value})}),(0,h.jsx)(`span`,{children:a.every===`minutes`?`minutes`:`images per hour`})]}),s===void 0?null:(0,h.jsx)(`p`,{id:`${r}-line`,className:s.problem?`m-0 text-label text-danger`:`m-0 text-label text-ink-3`,children:s.text})]})}function Dge(e,t,n){if(t===n)return e;let r=Number(e.trim());return e.trim()===``||!Number.isFinite(r)||r<=0?e:String(Math.round(60/r*100)/100)}function Oge(e){let{form:t}=e,n=t.imageScale;if(n===void 0)return{text:``,problem:!1};let r=Number(n.value.trim()),i=n.every===`minutes`;if(!(n.value.trim()!==``&&(i?r>=.25&&r<=60:r>=1&&r<=240)))return{text:i?`Enter a number of minutes between ${String(TO)} and 60.`:`Enter a number of images per hour between 1 and 240.`,problem:!0};let a=i?OO(r):r,o=t.sources.article===`provide`,s=Number(e.expectedWords.trim()),c=o?Math.max(1,EO(t.provided.article)):Number.isInteger(s)&&s>=1&&s<=1e5?s:vie,l=t.imagePrompts.map(e=>({name:e.name,number:Math.max(0,Number.parseInt(e.number,10)||0)})),u=l.reduce((e,t)=>e+t.number,0),d={perHour:a,words:c},f=AO({imagePrompts:l,imageScale:d,sources:t.sources}).reduce((e,t)=>e+t,0),p=`about ${String(Math.max(1,Math.round(DO(c))))} minutes (${c.toLocaleString(`en-US`)} words ${o?`in the article`:`expected, set on Review`})`;if(l.length===0)return{text:`For ${p}: tick an image prompt to see the count.`,problem:!1};let m=kO(d)>=240?` That is the most a run makes (240); the images repeat after that.`:``;return{text:f>u?`For ${p}: ${String(f)} images, ${String(f-u)} more than the prompts' ${String(u)}.${m}`:`For ${p}: the prompts' ${String(u)} images already cover it.`,problem:!1}}function kge({document:e,onEdit:t}){let{form:n}=e;return(0,h.jsx)(`div`,{className:`flex basis-full flex-col items-start gap-2`,children:(0,h.jsx)(lb,{checked:n.imageScenes===!0,label:`Scenes from the article`,tip:`play.image-scenes`,onChange:r=>{let{imageScenes:i,...a}=n;t({...e,form:{...a,...r?{imageScenes:!0}:{}}})}})})}function Age(e){return e.upload?(0,h.jsx)(B6,{value:e.value,onPick:e.onPick,upload:e.upload}):(0,h.jsx)(jge,{...e})}function jge({value:e,onPick:t,onUploading:n}){let{api:r}=R(),i=_(),a=P({mutationFn:e=>Lj(r,e),onSuccess:({font:e})=>{i.setQueryData(Fj,t=>({fonts:[...(t?.fonts??[]).filter(t=>t.id!==e.id),e]})),i.invalidateQueries({queryKey:Fj})}}),o=a.isPending,s=(0,m.useRef)(t);s.current=t;let c=(0,m.useRef)(n);return c.current=n,(0,m.useEffect)(()=>{c.current(o)},[o]),(0,m.useEffect)(()=>()=>c.current(!1),[]),(0,h.jsx)(B6,{value:e,onPick:t,upload:{pending:o,error:a.error?.message,pick:e=>a.mutate(e,{onSuccess:({font:e})=>s.current(e.id)})}})}function B6({value:e,onPick:t,upload:n}){let{api:r}=R(),i=(0,m.useId)(),a=(0,m.useId)(),o=N({queryKey:Fj,queryFn:()=>Ij(r),staleTime:6e4}),s=n.pending,c=o.data?.fonts??[],l=e!=="default"&&!c.some(t=>t.id===e);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 basis-full`,...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{htmlFor:i,children:`Subtitle font`}),(0,h.jsx)(B,{id:`project.subtitles.font`,className:`-my-1`})]}),(0,h.jsxs)(pV,{id:i,"data-play-field":`subtitles.fontId`,value:e,disabled:s,onChange:e=>t(e.target.value),className:`text-small`,children:[c.some(e=>e.id==="default")?null:(0,h.jsx)(`option`,{value:`default`,children:`Default font · bundled`}),l?(0,h.jsxs)(`option`,{value:e,children:[e,` · saved font`]}):null,c.map(e=>(0,h.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.source]},e.id))]})]}),(0,h.jsxs)(`div`,{className:`min-w-0 basis-full`,children:[(0,h.jsx)(Y4,{htmlFor:a,className:`mb-1`,children:`Upload font (.ttf or .otf)`}),(0,h.jsx)(`input`,{id:a,"data-play-field":`subtitles.fontUpload`,type:`file`,accept:`.ttf,.otf,font/ttf,font/otf`,disabled:s,className:`w-full text-small text-ink-2 file:mr-2 file:rounded-control file:border file:border-line-strong file:bg-sunken file:px-2 file:py-1 file:text-ink`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&n.pick(t)}})]})]}),s?(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink-2`,children:`Uploading font…`}):null,n.error?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:n.error}):null,l&&o.data?(0,h.jsx)(`p`,{role:`alert`,children:`Saved font is unavailable. Choose another font or upload it again.`}):null,o.error?(0,h.jsxs)(`p`,{role:`alert`,className:`text-small text-danger`,children:[`The font list couldn't be loaded. `,o.error.message]}):null]})}function Mge(e){return e===`9:16`?{width:1080,height:1920}:{width:1920,height:1080}}function Nge(e,t){switch(e){case`top`:return{y:60,alignment:8,translateY:0};case`upper-middle`:return{y:t/4,alignment:5,translateY:-50};case`center`:return{y:t/2,alignment:5,translateY:-50};case`lower-middle`:return{y:t*3/4,alignment:5,translateY:-50};case`bottom`:return{y:t-60,alignment:2,translateY:-100}}}function Pge({value:e,format:t,sample:n=`Every story begins with a word.`,backgroundUrl:r,showCaptions:i=!0,maxFrameHeight:a}){let{api:o}=R(),s=Rj(o,e.fontId),c=`subtitle-preview-${(0,m.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,[l,u]=(0,m.useState)(!1);(0,m.useEffect)(()=>{if(typeof FontFace>`u`||!document.fonts)return;let e=!0,t=new FontFace(c,`url(${JSON.stringify(s)})`);return u(!1),t.load().then(t=>{e&&document.fonts.add(t)}).catch(()=>{e&&u(!0)}),()=>{e=!1,document.fonts.delete(t)}},[c,s]);let d=Mge(t),f=Nge(e.position??`bottom`,d.height),p=Number.isFinite(e.fontSize)?Math.max(16,Math.min(120,e.fontSize)):48,g={position:`absolute`,left:`50%`,top:`${f.y/d.height*100}%`,width:`${(d.width-120)/d.width*100}%`,transform:`translate(-50%, ${f.translateY}%)`,fontFamily:`"${c}", sans-serif`,fontSize:`${p/d.width*100}cqw`,lineHeight:1.2,overflowWrap:`anywhere`,WebkitTextStroke:`${2.5/d.width*100}cqw #101010`,paintOrder:`stroke fill`,textShadow:`0 ${100/d.width}cqw ${100/d.width}cqw #000`};return(0,h.jsxs)(`figure`,{className:`min-w-0 self-start`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-label text-ink-2`,children:[(0,h.jsx)(`span`,{children:`Style preview`}),(0,h.jsx)(`span`,{children:t})]}),(0,h.jsxs)(`div`,{role:`img`,"aria-label":`Subtitle style preview`,"data-format":t,"data-position":e.position??`bottom`,className:`sl-media__frame mx-auto w-full text-center text-white`,style:{aspectRatio:`${d.width} / ${d.height}`,maxWidth:t===`9:16`?a?`min(240px, calc((${a}) * 9 / 16))`:240:480,containerType:`inline-size`},children:[r?(0,h.jsx)(`img`,{src:r,alt:``,className:`absolute inset-0 h-full w-full object-cover`}):null,i?(0,h.jsx)(`span`,{role:`note`,"aria-label":`Caption sample`,style:g,children:n}):null]}),(0,h.jsxs)(`figcaption`,{className:`mt-2 text-label text-ink-3`,children:[d.width,` × `,d.height,` · Preview at reduced scale.`,l?` Font preview unavailable; showing a fallback.`:``]})]})}function V6({value:e,format:t=`16:9`,audioEnabled:n,videoEnabled:r,disabled:i=!1,onChange:a,onUploading:o,problem:s,session:c,fontUpload:l,showPreview:u=!0,illustratedPositions:d=!1,rawFontSize:f}){let p=(0,m.useId)(),g=(0,m.useId)(),_=(0,m.useId)(),v=(0,m.useId)(),[y,b]=(0,m.useState)(!1),x=s?.(`subtitles.fontId`),S=s?.(`subtitles.fontSize`),C=s?.(`subtitles.mode`)??s?.(`subtitles`);return(0,h.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-3`,"aria-label":`Subtitles`,children:[(0,h.jsxs)(`fieldset`,{disabled:i||!n,className:`flex min-w-0 flex-col gap-3 disabled:opacity-60`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{htmlFor:p,children:`Subtitles`}),(0,h.jsx)(B,{id:`project.subtitles.mode`,className:`-my-1`})]}),(0,h.jsxs)(`select`,{id:p,"data-play-field":`subtitles.mode`,value:n?e.mode:`off`,disabled:l?.pending??y,"aria-describedby":_,"aria-invalid":C!==void 0,onChange:t=>a({...e,mode:t.target.value}),className:`h-8 w-full rounded-control border border-line-strong bg-raised px-3 text-small text-ink`,children:[(0,h.jsx)(`option`,{value:`off`,children:`Off`}),(0,h.jsx)(`option`,{value:`files`,children:`Subtitle files (.srt + .vtt)`}),(0,h.jsx)(`option`,{value:`burn-in`,disabled:!r,children:`Burn into video + files`})]})]}),(0,h.jsx)(`span`,{className:`pb-1 text-label text-ink-3`,children:`English · local · no paid API`})]}),e.mode!==`off`&&n?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`Timed from your narration on this computer. First use downloads an approximately 95 MB speech model. Review the subtitles before publishing.`}),(0,h.jsxs)(`div`,{className:`grid items-start gap-5`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 240px), 1fr))`},children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(Age,{...l?{upload:l}:{},value:e.fontId,onPick:t=>c?c.selectFont(t):a({...e,fontId:t}),onUploading:e=>{b(e),o?.(e)}}),(0,h.jsxs)(`div`,{className:d?`w-full`:`max-w-[180px]`,...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{htmlFor:g,children:`Subtitle font size`}),(0,h.jsx)(B,{id:`project.subtitles.size`,className:`-my-1`})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-5`,children:[d?(0,h.jsx)(`input`,{"aria-label":`Subtitle font size slider`,type:`range`,min:16,max:120,step:1,value:Math.max(16,Math.min(120,Number.isFinite(e.fontSize)?e.fontSize:48)),className:`min-w-0 flex-1 accent-accent`,onChange:t=>f?f.onChange(t.target.value):a({...e,fontSize:Number(t.target.value)})}):null,(0,h.jsx)(Y,{className:d?`w-20`:void 0,id:g,"data-play-field":`subtitles.fontSize`,type:`number`,min:16,max:120,step:1,value:f?.value??e.fontSize,"aria-invalid":!rM(e)||S!==void 0,onChange:t=>f?f.onChange(t.target.value):a({...e,fontSize:Number(t.target.value)})})]}),!rM(e)||S?(0,h.jsx)(`p`,{role:`alert`,className:`mt-1 text-label text-danger`,children:S??`Choose a whole font size from 16 to 120.`}):null]}),(0,h.jsxs)(`div`,{...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{htmlFor:d?void 0:v,id:`${v}-label`,children:`Subtitle position`}),(0,h.jsx)(B,{id:`project.subtitles.position`,className:`-my-1`})]}),d?(0,h.jsx)(X4,{type:`single`,"aria-labelledby":`${v}-label`,value:e.position??`bottom`,onValueChange:t=>{let n=VA.find(e=>e===t);n&&a({...e,position:n})},className:`grid w-full grid-cols-5 gap-2 overflow-visible border-0`,children:VA.map((t,n)=>(0,h.jsxs)(Z4,{value:t,"aria-label":t,"data-play-field":(e.position??`bottom`)===t?`subtitles.position`:void 0,className:`flex min-w-0 flex-col items-center gap-2 rounded-control border border-line-strong bg-surface px-1 py-3 text-[10px] last:border-r data-[state=on]:border-focus data-[state=on]:text-accent-ink data-[state=on]:shadow-none`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`relative block h-11 w-7 rounded-[2px] border border-current`,children:(0,h.jsx)(`span`,{className:`absolute left-1 right-1 h-[3px] bg-current`,style:{top:`${8+n*20}%`}})}),(0,h.jsxs)(`span`,{children:[t[0]?.toUpperCase(),t.slice(1)]})]},t))}):(0,h.jsx)(`select`,{id:v,"data-play-field":`subtitles.position`,value:e.position??`bottom`,onChange:t=>{let n=VA.find(e=>e===t.target.value);n&&a({...e,position:n})},className:`h-8 w-full rounded-control border border-line-strong bg-raised px-3 text-small text-ink`,children:VA.map(e=>(0,h.jsxs)(`option`,{value:e,children:[e[0]?.toUpperCase(),e.slice(1)]},e))})]})]}),u?(0,h.jsx)(Pge,{value:e,format:t,...c?{sample:c.previewText}:{}}):null]}),c?.fontUpload&&!c.fontUploading?(0,h.jsxs)(`p`,{role:`alert`,children:[`Reattach `,c.fontUpload.name,`, or select a font.`]}):null,x?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:x}):null,e.mode===`files`?(0,h.jsx)(`p`,{className:`text-label text-ink-3`,children:`Font, size and position apply to burned captions. SRT/VTT players choose their own styling.`}):null]}):null]}),c?.fontUpload&&(e.mode===`off`||!n)?(0,h.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,h.jsx)(`p`,{role:c.fontUploading?`status`:`alert`,className:`text-small text-ink-2`,children:c.fontUploading?`Uploading ${c.fontUpload.name}…`:`Unfinished font upload: ${c.fontUpload.name}`}),l?.error?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:l.error}):null,(0,h.jsx)(L,{"data-play-field":`subtitles.fontUpload`,disabled:i,onClick:()=>c.selectFont(e.fontId),children:`Keep current font`})]}):null,C?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:C}):null,(0,h.jsx)(`p`,{id:_,className:`text-small text-ink-2`,children:n?r?`Optional: download subtitles separately or keep them visible in the video.`:`Audio exports support separate subtitle files. Enable Video to burn captions into an MP4.`:`Turn Audio on to add subtitles.`})]})}function H6({value:e,onPick:t}){let n=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`w-full`,...cb,children:[(0,h.jsxs)(`span`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{id:n,children:`Frame format`}),(0,h.jsx)(B,{id:`play.format`,className:`-my-1`})]}),(0,h.jsx)(X4,{type:`single`,value:e,"aria-labelledby":n,className:`w-full max-w-[400px] gap-3 overflow-visible border-0`,onValueChange:e=>{(e===`16:9`||e===`9:16`)&&t(e)},children:[`16:9`,`9:16`].map(t=>(0,h.jsxs)(Z4,{value:t,"data-play-field":e===t?`format`:void 0,"aria-label":t,className:`flex h-28 min-w-0 flex-1 items-center justify-center gap-4 rounded-control border border-line-strong bg-surface p-3 last:border-r data-[state=on]:border-focus data-[state=on]:shadow-none`,children:[(0,h.jsx)(`span`,{className:`flex h-12 items-center justify-center`,"aria-hidden":`true`,children:(0,h.jsx)(`span`,{"data-format-shape":t,className:`block rounded-[2px] border-2 border-current`,style:{width:t===`16:9`?64:27,aspectRatio:t===`16:9`?`16 / 9`:`9 / 16`}})}),(0,h.jsxs)(`span`,{className:`text-left`,children:[(0,h.jsx)(`span`,{className:`block text-body font-semibold`,children:t}),(0,h.jsx)(`span`,{className:`text-label text-ink-3`,children:t===`16:9`?`Landscape`:`Portrait`})]})]},t))})]})}function Fge({problem:e}){let t=bM(),{document:n}=t,{form:r}=n,i=e=>t.edit({...n,form:{...r,subtitles:{...e,fontSize:r.subtitles.fontSize}}});return(0,h.jsxs)(`div`,{"data-tour":`play-subtitles`,className:`flex min-w-0 flex-col gap-4 py-4`,children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`See frame and caption changes in the preview as you go.`}),(0,h.jsx)(H6,{value:r.format,onPick:e=>t.edit({...n,form:{...r,format:e}})}),(0,h.jsx)(`div`,{className:`border-t border-line pt-4`,children:(0,h.jsx)(V6,{showPreview:!1,illustratedPositions:!0,fontUpload:t.fontUpload,session:{previewText:n.previewText,fontUploading:t.fontUploading,fontUpload:n.fontUpload,selectFont:t.selectFont,uploadSubtitleFont:t.uploadSubtitleFont},value:{...r.subtitles,fontSize:Number(r.subtitles.fontSize)},rawFontSize:{value:r.subtitles.fontSize,onChange:e=>t.edit({...n,form:{...r,subtitles:{...r.subtitles,fontSize:e}}})},format:r.format,audioEnabled:r.sources.audio!==`off`,videoEnabled:r.sources.video===`generate`&&r.sources.images!==`off`,onChange:i,problem:e})}),(0,h.jsx)(uV,{label:`Preview text`,tip:`play.preview-text`,className:`border-t border-line pt-4`,children:(0,h.jsx)(Y,{value:n.previewText,onChange:e=>t.edit({...n,previewText:e.target.value})})})]})}function Ige(e){let t=bM(),n=t.document,r=V3(),i=H3(),{form:a,entries:o,problem:s,update:c}=e;return(0,h.jsx)(nge,{...e,titled:!1,cast:r,language:i,rawCounts:{...n.form.chunking,onChange:(e,r)=>t.edit({...n,form:{...n.form,chunking:{...n.form.chunking,mode:e,...e===`words`?{words:r}:e===`characters`?{characters:r}:{}}}})},advanced:(0,h.jsxs)(h.Fragment,{children:[[`intro`,`outro`].map(e=>(0,h.jsx)(CV,{field:e,label:e===`intro`?`Intro`:`Outro`,tip:e===`intro`?`play.intro`:`play.outro`,value:a[e],placeholder:`Off`,options:o.filter(t=>t.category===e).map(e=>({value:e.name,label:e.name})),problem:s(e),onPick:t=>c({[e]:t})},e)),(0,h.jsx)(`div`,{className:`col-span-full flex flex-wrap gap-2`,children:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:e.onSettings,children:`Settings`})}),(0,h.jsx)(`div`,{className:`col-span-full empty:hidden`,children:(0,h.jsx)(R6,{...e,section:`narration`,onSettings:e.onSettings})})]})})}function Lge(e){let t=bM(),n=t.document;return(0,h.jsx)(rge,{...e,titled:!1,more:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Ege,{document:n,problem:e.problem,onEdit:t.edit}),n.form.sources.article===`off`?null:(0,h.jsx)(kge,{document:n,onEdit:t.edit})]}),rawNumbers:{values:n.form.imagePrompts,onChange:(e,r)=>t.edit({...n,form:{...n.form,imagePrompts:n.form.imagePrompts.map(t=>t.name===e?{...t,number:r}:t)}})}})}function Rge(e){let t=bM(),n=t.document,r=H3();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(vge,{...e,titled:!1,extras:!1,language:r,rawTiming:{imageSeconds:n.form.imageSeconds,zoomPercent:n.form.zoomPercent,edgeSilenceSeconds:n.form.edgeSilenceSeconds,onChange:(e,r)=>t.edit({...n,form:{...n.form,[e]:r}})}}),n.form.sources.audio===`off`?null:(0,h.jsx)(`div`,{className:`sl-fields border-b border-line py-4`,children:(0,h.jsx)(L6,{field:`silenceGapSeconds`,label:`Silence between segments (seconds)`,tip:`play.silence-gap`,placeholder:String(e.silenceGapSeconds),step:.1,problem:e.problem(`silenceGapSeconds`),value:n.form.silenceGapSeconds??``,onChange:e=>{let{silenceGapSeconds:r,...i}=n.form;t.edit({...n,form:e.trim()===``?i:{...i,silenceGapSeconds:e}})}})}),(0,h.jsx)(Fge,{problem:e.problemOf})]})}function zge(e){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(R6,{...e,section:`outputs`,onSettings:e.onSettings}),(0,h.jsx)(_ge,{...e}),(0,h.jsx)(`section`,{className:`border-b border-line py-4`,children:(0,h.jsx)(I6,{form:e.form,prompts:e.prompts,problem:e.problem,update:e.update,onPickFiles:e.onPickFiles,onRemoveFile:e.onRemoveFile,...e.onReattachFile===void 0?{}:{onReattachFile:e.onReattachFile}})}),e.form.sources.article===`off`?null:(0,h.jsx)(yge,{...e})]})}function U6(e,t){if(t===void 0||t.length===0||e.trim()===``)return[];let n=[];for(let[r,i]of t.entries()){let t=1/0;for(let n of[i.name,...i.aliases]){let r=Bge(e,n);r!==void 0&&r<t&&(t=r)}Number.isFinite(t)&&n.push({member:i,at:t,order:r})}return n.sort((e,t)=>e.at-t.at||e.order-t.order).map(e=>e.member)}function Bge(e,t){let n=t.trim().split(/\s+/u).filter(Boolean);if(n.length===0)return;let r=RegExp(`(?<![\\p{L}\\p{N}])${n.map(Vge).join(`\\s+`)}(?![\\p{L}\\p{N}])`,`iu`).exec(e);return r===null?void 0:r.index}function Vge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Hge(e,t){let n=e.provided.reference?.file;if(e.sources.images===`generate`&&e.reference?.source===`provide`&&n!==void 0)return{image:{kind:`upload`,stagedFileId:n.id},drawnOn:`the establishing image`};let r=t.flatMap(e=>{let t=e.images.find(e=>e.state===`ready`&&e.sha256!==null);return t?.sha256?[{...e,images:[t.sha256]}]:[]}),i=U6([e.title,...Object.values(e.values)].join(` `),r)[0]??r[0],a=i?.images[0];if(i!==void 0&&a!==void 0)return{image:{kind:`picture`,sha256:a},drawnOn:`${i.name}'s picture`}}function Uge({selected:e,reviewed:t}){let n=e=>U3.find(t=>t.stage===e)?.label??e;return e?.length?(0,h.jsxs)(`div`,{className:`space-y-3 text-body`,children:[t?.length?t.map(e=>(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`p`,{className:`font-medium`,children:[`Run `,e.runIndex+1,` · Before `,n(e.stage)]}),(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:e.dependents.length?`Also holds: ${e.dependents.map(n).join(`, `)}.`:`No dependent steps.`})]},`${e.runIndex}-${e.checkpointId}`)):(0,h.jsxs)(`p`,{children:[`Selected: `,e.map(e=>`Before ${n(e)}`).join(`, `),`. Refresh review to confirm dependent steps.`]}),(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`Approval required on the project page. Starting this run does not approve these checkpoints.`})]}):(0,h.jsx)(`p`,{className:`text-body text-ink-2`,children:`No review checkpoints selected.`})}function Wge({estimates:e}){let t=e.reduce((e,t)=>e+t.low,0),n=e.reduce((e,t)=>e+t.high,0),r=e.reduce((e,t)=>e+t.unknown,0),i=e[0]?.rows.map((t,n)=>({...t,low:e.some(e=>e.rows[n]?.low===null)?null:e.reduce((e,t)=>e+(t.rows[n]?.low??0),0),high:e.some(e=>e.rows[n]?.high===null)?null:e.reduce((e,t)=>e+(t.rows[n]?.high??0),0),apiLow:e.some(e=>e.rows[n]?.onPlan===!0&&e.rows[n]?.apiLow==null)?null:e.reduce((e,t)=>e+(t.rows[n]?.apiLow??0),0),apiHigh:e.some(e=>e.rows[n]?.onPlan===!0&&e.rows[n]?.apiHigh==null)?null:e.reduce((e,t)=>e+(t.rows[n]?.apiHigh??0),0)}))??[],a=e.some(e=>e.apiLow!==void 0),o=e.reduce((e,t)=>e+(t.apiLow??0),0),s=e.reduce((e,t)=>e+(t.apiHigh??0),0),c=e.reduce((e,t)=>e+(t.apiUnknown??0),0);return e.length===0?(0,h.jsx)(`div`,{}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{className:`m-0 text-title-2 font-semibold`,children:[r?`Known subtotal: `:`Estimated total: `,W6(t,n)]}),r?(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Plus `,r,` stage charge`,r===1?``:`s`,` with unavailable pricing.`]}):null,(0,h.jsxs)(`details`,{className:`rounded-control border border-line px-3`,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer items-center text-small text-ink-2`,children:[`Cost by stage · `,i.length,` `,i.length===1?`stage`:`stages`]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 pt-1 pb-3`,children:[a?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:o===0&&s===0?`CLI steps: $0 on your plan · no API price is listed for their models.`:`CLI steps: $0 on your plan · ~${W6(o,s)} via API${c?` (plus ${String(c)} with no API price)`:``}.`}):null,(0,h.jsx)(`ul`,{"aria-label":`Cost by stage`,className:`m-0 list-none divide-y divide-line p-0`,children:i.map(e=>(0,h.jsxs)(`li`,{className:`py-2`,children:[(0,h.jsxs)(`div`,{className:`flex justify-between gap-4 text-small`,children:[(0,h.jsx)(`span`,{children:e.stage}),(0,h.jsx)(`span`,{className:`text-right tabular-nums`,children:e.onPlan===!0?e.apiLow===null||e.apiHigh===null?`$0 on your plan · API price unknown`:`$0 on your plan · ~${W6(e.apiLow,e.apiHigh)} via API`:e.low===null||e.high===null?`Unknown`:W6(e.low,e.high)})]}),(0,h.jsx)(`p`,{className:`m-0 mt-0.5 text-label text-ink-3`,children:e.detail})]},e.stage))}),[...new Set(e.flatMap(e=>e.assumptions))].map(e=>(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e},e)),(0,h.jsxs)(`p`,{className:`m-0 text-label text-ink-3`,children:[`Catalogue verified `,e[0]?.catalogueDate??`date unavailable`,`. Batch rows show combined costs.`]})]})]})]})}function W6(e,t){let n=e=>e===0?`$0`:e<.01?`<$0.01`:`$${e.toFixed(2)}`;return e===t?n(e):`${n(e)} – ${n(t)}`}function G6(e){let t=bk(vk(e)),n=new Map(bk(dk)),r=t.filter(([e,t])=>e!==`Cuts`&&n.get(e)!==t).map(([e,t])=>e===`Animate images`?`Animated images: ${t} (paid)`:e===`Chapter cards`?`Chapter cards`:e===`Transition`?t:`${e}: ${t}`);return r.length===0?`Plain cuts, no effects`:r.join(` · `)}function Gge(e){return e===void 0?{ok:!1,text:`Provider status unavailable`}:e.readiness.kind===`cli`?KM(e.readiness)?{ok:!0,text:e.readiness.version===void 0?`CLI ready`:`CLI ready · ${e.readiness.version}`}:{ok:!1,text:e.readiness.issue??`CLI not found`}:e.readiness.kind===`local`?e.readiness.available?{ok:!0,text:`Built-in voice · ${e.readiness.engine??`ready`}`}:{ok:!1,text:e.readiness.issue??`No speech program found`}:e.readiness.hasKey?{ok:!0,text:`API key saved`}:{ok:!1,text:`API key missing`}}function Kge(e,t){let n=e.sources.audio===`generate`,r=[`from_prompt`,`prompt_by_llm`].includes(e.sources.thumbnail);return[...(e.sources.article===`generate`||e.sources.thumbnail===`prompt_by_llm`||Kk(e)||aM(e)||n&&[`intro`,`outro`].some(n=>t.some(t=>t.category===n&&t.name===e[n]&&t.mode===`llm`)))&&e.llm?[{field:`llm.provider`,family:`llm`,label:`Text generation`,provider:e.llm.provider,model:e.llm.model}]:[],...n&&e.audio?[{field:`audio.provider`,family:`tts`,label:`Narration`,provider:e.audio.provider,model:e.audio.model,voice:e.audio.voice}]:[],...(e.sources.images===`generate`||r||aM(e)||yk(e))&&e.images?[{field:`images.provider`,family:`image`,label:`Images`,provider:e.images.provider,model:e.images.model}]:[]]}function K6({name:e,children:t}){return(0,h.jsxs)(`section`,{"aria-label":`${e} summary`,className:`min-w-0 border-t border-line pt-5`,children:[(0,h.jsx)(`h3`,{className:`mb-4 font-semibold`,children:e}),t]})}function qge({form:e,entries:t,providers:n,voices:r,textModels:i,audioModels:a,imageModels:o,onReveal:s}){let c=Kge(e,t);if(!c.length)return(0,h.jsx)(K6,{name:`Run readiness`,children:(0,h.jsx)(`p`,{className:`text-body text-ink-2`,children:`No generated providers required. Supplied content is ready for processing.`})});let l={llm:i,tts:a,image:o};return(0,h.jsxs)(K6,{name:`Run readiness`,children:[(0,h.jsx)(`p`,{className:`mb-3 text-small text-ink-2`,children:`These checks are refreshed with Review and checked again when you start.`}),(0,h.jsx)(`ul`,{className:`divide-y divide-line`,"aria-label":`Run readiness checks`,children:c.map(e=>{let t=n?.find(t=>t.id===e.provider&&t.family===e.family),i=Gge(t),a=l[e.family],o=a?.models.find(t=>t.id===e.model),c=a===void 0?{ok:!0,text:`Model checked at Start`}:o!==void 0||a.allowsCustom?{ok:!0,text:`Model available`}:{ok:!1,text:`Model unavailable`},u=e.voice===void 0?void 0:r===void 0?{ok:!1,text:`Voice list unavailable`}:r.some(t=>t.provider===e.provider&&t.voiceId===e.voice)?{ok:!0,text:`Voice saved`}:{ok:!1,text:`Voice missing`},d=[i,c,...u?[u]:[]],f=d.every(e=>e.ok);return(0,h.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 py-3`,children:[(0,h.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,h.jsx)(`span`,{className:f?`text-lime`:`text-danger`,children:f?`Ready`:d.filter(e=>!e.ok).map(e=>e.text).join(` · `)}),f?null:(0,h.jsx)(L,{variant:`quiet`,onClick:()=>s(e.field),children:`Edit ↗`})]},`${e.family}:${e.provider}`)})})]})}function Jge({fields:e,onReveal:t,children:n}){let{document:r,review:i}=bM(),{form:a}=r,{api:o}=R(),s=_(),c=s.getQueryData(Xy(o).queryKey),l=s.getQueryData($y(o).queryKey),u=s.getQueryData(Zy(o).queryKey),d=s.getQueryData(Fj),f=s.getQueryData(gV(a.llm.provider)),p=s.getQueryData(gV(a.audio.provider)),m=s.getQueryData(gV(a.images.provider)),g=a.sources.audio===`generate`,v=[`from_prompt`,`prompt_by_llm`].includes(a.sources.thumbnail),y=a.sources.article===`generate`||a.sources.thumbnail===`prompt_by_llm`||Kk(a)||aM(a)||g&&[`intro`,`outro`].some(e=>l?.entries.some(t=>t.category===e&&t.name===a[e]&&t.mode===`llm`)),b=e=>c?.providers.find(t=>t.id===e)?.displayName??e,x=(e,n,r)=>(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[90px_minmax(0,1fr)_auto] items-start gap-x-3 py-1 sm:grid-cols-[145px_minmax(0,1fr)_auto]`,children:[(0,h.jsx)(`dt`,{className:`break-words py-2 text-ink-2`,children:e}),(0,h.jsx)(`dd`,{className:`min-w-0 whitespace-pre-wrap break-words py-2`,children:r||`Not selected`}),n?(0,h.jsx)(`dd`,{children:(0,h.jsx)(L,{variant:`quiet`,"aria-label":`Edit ${e}`,onClick:()=>t(n),children:`Edit ↗`})}):null]},n??e),S=a.chunking.mode===`words`||a.chunking.mode===`characters`?a.chunking.mode:null;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(qge,{form:a,entries:l?.entries??[],providers:c?.providers,voices:u?.voices,textModels:f,audioModels:p,imageModels:m,onReveal:t}),(0,h.jsxs)(K6,{name:`Content`,children:[(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Project`,`title`,a.title||`Untitled run`),x(`Article`,`sources.article`,cM[a.sources.article]),a.sources.article===`generate`?x(`Article prompt`,`articlePrompt`,a.articlePrompt):x(`Article text`,`provided.article`,`Your article`),a.sources.article===`generate`?x(`Research`,`sources.research`,cM[a.sources.research]):x(`Research`,null,`Off · Article is provided`),a.sources.research===`provide`&&a.sources.article===`generate`?x(`Research text`,`provided.research`,a.provided.research):null,y?(0,h.jsxs)(h.Fragment,{children:[x(`Text provider`,`llm.provider`,b(a.llm.provider)),x(`Text model`,`llm.model`,f?.models.find(e=>e.id===a.llm.model)?.name??a.llm.model),a.llm.thinking||f?.models.find(e=>e.id===a.llm.model)?.thinkingModes?.length?x(`Thinking`,`llm.thinking`,a.llm.thinking??`Model default`):null]}):null,e.map(({name:e})=>x(e,`values.${e}`,a.values[e]??``))]}),n]}),(0,h.jsx)(K6,{name:`Outputs`,children:(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Narration`,`sources.audio`,cM[a.sources.audio]),g?(0,h.jsxs)(h.Fragment,{children:[x(`Audio provider`,`audio.provider`,b(a.audio.provider)),x(`Audio model`,`audio.model`,p?.models.find(e=>e.id===a.audio.model)?.name??a.audio.model),x(`Voice`,`audio.voice`,u?.voices.find(e=>e.provider===a.audio.provider&&e.voiceId===a.audio.voice)?.name??a.audio.voice),x(`Chunking`,S?`chunking.${S}`:`chunking.mode`,S?`Every ${a.chunking[S]||`(not entered)`} ${S}`:a.chunking.mode===`whole`?`Whole text`:`Paragraph`),x(`Intro`,`intro`,a.intro||`Off`),x(`Narration Preparation`,`narrationPrompt`,a.narrationPrompt?`${a.narrationPrompt} · One LLM call per narration chunk and entry`:`Off`),x(`Outro`,`outro`,a.outro||`Off`)]}):null,a.sources.audio===`provide`?x(`Narration file`,`provided.audio`,a.provided.audio?.name):null,x(`Images`,`sources.images`,cM[a.sources.images]),a.sources.images===`generate`||v||aM(a)?(0,h.jsxs)(h.Fragment,{children:[x(`Image provider`,`images.provider`,b(a.images.provider)),x(`Image model`,`images.model`,m?.models.find(e=>e.id===a.images.model)?.name??a.images.model),a.images.thinking===void 0?null:x(`Image effort`,`images.thinking`,a.images.thinking)]}):null,a.sources.images===`generate`&&a.reference!==void 0&&a.reference.source!==`off`?x(`Establishing image`,a.reference.source===`prompt`?`reference.prompt`:`provided.reference`,`${a.reference.source===`prompt`?a.reference.prompt||`(no prompt picked)`:a.provided.reference?.name??`(no file attached)`}${a.reference.thumbnail?` · thumbnail too`:``}`):null,a.sources.images===`generate`?a.imagePrompts.length?a.imagePrompts.map((e,t)=>x(e.name,`imagePrompts.${t}.number`,`${e.name} · ${e.number||`(not entered)`} images`)):x(`Image prompts`,`imagePrompts`,`None selected`):null,a.sources.images===`provide`?x(`Image files`,`provided.images`,a.provided.images.length?(0,h.jsx)(`ol`,{className:`list-inside list-decimal`,children:a.provided.images.map(e=>(0,h.jsx)(`li`,{children:e.name},e.attachmentId))}):`No files selected`):null,x(`Thumbnail`,`sources.thumbnail`,cM[a.sources.thumbnail]),v?x(`Thumbnail prompt`,`thumbnailPrompt`,a.thumbnailPrompt):null,a.sources.thumbnail===`provide`?x(`Thumbnail file`,`provided.thumbnail`,a.provided.thumbnail?.name):null,x(`Video`,`sources.video`,cM[a.sources.video]),a.sources.video===`generate`?x(`Seconds per image`,`imageSeconds`,a.imageSeconds||`(not entered)`):null,a.sources.video===`generate`?x(`Zoom`,`zoomPercent`,a.zoomPercent?`${a.zoomPercent}%`:`(not entered)`):null,a.sources.video===`generate`?x(`Motion`,`motionStyle`,Fk[a.motionStyle]):null,a.sources.video===`generate`?x(`Cuts`,`videoEdit.cuts`,fk[vk(a).cuts]):null,a.sources.video===`generate`?x(`Look`,`videoEdit`,G6(a)):null,a.sources.audio===`off`?null:x(`Silence at start and end`,`edgeSilenceSeconds`,a.edgeSilenceSeconds?`${a.edgeSilenceSeconds} s`:`(not entered)`),a.sources.audio===`off`?null:x(`YouTube description`,`youtubeDescription`,a.youtubeDescription===!0?`${a.descriptionPrompt||`Built-in`} prompt · One LLM call after subtitle timing`:`Off`),a.sources.audio===`off`?null:x(`Shorts`,`shorts.enabled`,aM(a)&&a.shorts!==void 0?[`${a.shorts.count} shorts of ${a.shorts.minSeconds}-${a.shorts.maxSeconds} s`,`${a.shorts.prompt||`Built-in`} prompt`,`${a.shorts.imagePrompt||`Built-in`} image style`,...Yge(a.shorts,a.provided.shortsMusic?.name),`Vertical images and renders after subtitle timing`].join(` · `):`Off`),x(`Document`,`sources.document`,dS(a.sources,`document`)===`generate`?`PDF · ${CS(a.document)} theme`:cM.off)]})}),(0,h.jsxs)(K6,{name:`Checkpoints`,children:[(0,h.jsx)(Uge,{selected:a.checkpoints,reviewed:i.valid?i.receipt?.checkpointSet:void 0}),(0,h.jsx)(L,{variant:`quiet`,"aria-label":`Edit checkpoints`,onClick:()=>t(`checkpoints`),children:`Edit checkpoints ↗`})]}),(0,h.jsxs)(K6,{name:`Style`,children:[(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Frame`,`format`,a.format),a.sources.audio===`off`?x(`Subtitles`,null,`Off · Audio is Off`):x(`Subtitles`,`subtitles.mode`,a.subtitles.mode),a.sources.audio!==`off`&&a.subtitles.mode!==`off`?(0,h.jsxs)(h.Fragment,{children:[x(`Subtitle font`,`subtitles.fontId`,d?.fonts.find(e=>e.id===a.subtitles.fontId)?.name??a.subtitles.fontId),x(`Subtitle size`,`subtitles.fontSize`,`${a.subtitles.fontSize||`(not entered)`} px`),x(`Subtitle position`,`subtitles.position`,a.subtitles.position)]}):null]}),a.sources.audio!==`off`&&a.subtitles.mode===`files`?(0,h.jsx)(`p`,{className:`mt-3 text-small text-ink-2`,children:`Font, size and position apply to burned captions. SRT/VTT players choose their own styling.`}):null]})]})}function Yge(e,t){let n=ZO(e),r=n.speed,i=n.musicVolume;return[...n.titleOnScreen===!0?[`Title on screen`]:[],...r!==void 0&&r!==1?[`${r.toFixed(2)}× speed`]:[],...t===void 0?i!==void 0&&i!==15?[`Music at ${String(i)}% once added in Edit project`]:[]:[`Music: ${t} at ${String(i??15)}%`],...n.fullVideoLink===void 0?[]:[`Links ${n.fullVideoLink}`]]}function Xge({fields:e,errors:t,onReveal:n,problem:r}){let i=bM(),{document:a,review:o}=i,s=a.form;(0,m.useEffect)(()=>{i.reviewDraft()},[i.reviewDraft]);let c=o.valid?o.receipt?.runs??[]:[];return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,h.jsx)(`p`,{className:`m-0 text-body text-ink-2`,children:`Everything this run will do, the checkpoints it stops at and the reviews it runs. The estimate and the Play key stay in the right rail.`}),t.length?(0,h.jsx)(`ul`,{"aria-label":`Setup errors`,className:`text-small text-danger`,children:t.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(L,{variant:`quiet`,onClick:()=>n(e.field),children:e.message})},`${e.field}-${e.message}`))}):null,(0,h.jsx)(Ohe,{problem:r}),(0,h.jsx)(kV,{problem:r}),(0,h.jsx)(Jge,{fields:e,onReveal:n,children:(0,h.jsxs)(`details`,{className:`mt-5 border-t border-line py-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-small`,children:s.sources.article===`provide`?`Read the supplied article and resolved prompts`:`Read the resolved prompt`}),c.length?c.map((e,t)=>(0,h.jsxs)(`div`,{className:`mt-4`,children:[(0,h.jsx)(`h4`,{className:`font-medium`,children:e.draft.title}),e.draft.sources.article===`provide`?(0,h.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words text-body`,children:e.draft.provided.article}):null,Object.entries(e.rendered).map(([e,t])=>(0,h.jsxs)(`div`,{className:`mt-3`,children:[(0,h.jsx)(`h5`,{className:`text-small text-ink-2`,children:e}),(0,h.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-body`,children:t})]},e))]},a.variants[t-1]?.id??i.activeId)):(0,h.jsx)(`p`,{className:`mt-3 text-small text-ink-2`,children:`Refresh review to read the exact resolved inputs.`})]})})]})}function Zge(e,t,n){return[...R3(e).map(e=>(t[e]??``).trim()===``?`${e} is left empty in the template.`:`${e} is left empty in the template (this video's ${e}, "${t[e]}", is not saved).`),...n>0?[`The ${n===1?`other video`:`${String(n)} other videos`} queued here ${n===1?`is`:`are`} not saved.`]:[]]}function Qge({open:e,onClose:t}){let{api:n}=R(),r=_(),i=bM(),a=gy(),o=N(Nq(n)),[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(null),[d,f]=(0,m.useState)(!1),p=(0,m.useRef)(null),{document:g}=i,v=Zge(g.form.title,g.form.values,g.variants.length),y=()=>{u(null),t()},b=async()=>{let e=s.trim();if(!(e===``||d)){f(!0),u(null);try{if(!await i.flush()){u(`Your draft wasn't saved, so the template wasn't either. Press Retry beside Drafts, then Save template again.`);return}p.current?.name!==e&&(p.current={name:e,id:crypto.randomUUID()});let s=o.data?.find(e=>e.id===g.templateSource?.id),l=g.channelId??(s?Y1(s):void 0),d=whe(g),f=await Fq(n,{id:p.current.id,name:e,document:l===void 0?d:{...d,channelId:l}});if(!f.ok){p.current=null,u(`The template wasn't saved. ${f.message}`);return}p.current=null,c(``),a(`Template "${e}" saved.`,`success`),await r.invalidateQueries({queryKey:Oq}),t()}catch(e){u(`The template wasn't saved. ${e instanceof Error?e.message:`Press Save template again.`}`)}finally{f(!1)}}};return(0,h.jsx)(Ey,{open:e,onOpenChange:e=>{e||y()},title:`Save as template`,description:`Keeps this setup's prompts, voice, images, style, outputs and reviews to start the next video from.`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`secondary`,onClick:y,children:`Cancel`}),(0,h.jsx)(L,{variant:`primary`,disabled:s.trim()===``||d,disabledReason:d?`Saving the template`:`Name the template first`,onClick:()=>void b(),children:`Save template`})]}),children:(0,h.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,h.jsx)(uV,{label:`Template name`,tip:`play.template-name`,children:(0,h.jsx)(Y,{autoFocus:!0,value:s,maxLength:120,placeholder:g.form.title.replace(/\{\{[^}]*\}\}/g,``).trim()||`My setup`,onChange:e=>c(e.target.value)})}),v.length?(0,h.jsx)(`ul`,{"aria-label":`Left out of the template`,className:`m-0 flex list-none flex-col gap-1 p-0 text-small text-ink-2`,children:v.map(e=>(0,h.jsx)(`li`,{children:e},e))}):(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Every keyword keeps its value: the title names none.`}),l?(0,h.jsx)(pP,{tone:`danger`,title:l}):null]})})}var $ge=new Set([`a`,`an`,`the`,`of`,`and`,`or`,`in`,`on`,`to`,`for`,`with`,`vs`,`s`]);function q6(e){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase().replace(/&/g,` and `).replace(/[^\p{L}\p{N}]+/gu,` `).trim()}function J6(e){let t=q6(e).split(` `).filter(e=>e!==``&&!$ge.has(e)).map(e=>e.length>3&&e.endsWith(`s`)&&!e.endsWith(`ss`)?e.slice(0,-1):e);return new Set(t)}function e_e(e,t){let n=0;for(let r of e)t.has(r)&&(n+=1);return n}function t_e(e,t){let n=q6(e);if(n===q6(t))return n!==``;let r=J6(e),i=J6(t);if(r.size===0||i.size===0)return!1;let a=e_e(r,i);if(a/(r.size+i.size-a)>=.6)return!0;let o=Math.min(r.size,i.size),s=Math.max(r.size,i.size);return a===o&&o/s>=.5}function n_e(e,t,n){let r=e.map(e=>e.trim()).filter(e=>e!==``);if(r.length===0)return;let i=e=>r.some(t=>t_e(t,e)),a=t.find(i);if(a!==void 0)return{title:a,where:`project`};let o=n.find(i);return o===void 0?void 0:{title:o,where:`video`}}function r_e({topics:e}){let{api:t}=R(),n=bM(),{document:r}=n,i=B3(),a=N(Gy(t)),o=N(B2(t,i)),{form:s}=r,c=aq(s.title,s.values),l=n_e(e.length===0?[s.title]:[c,...e.map(e=>s.values[e]??``)],(a.data?.projects??[]).filter(e=>e.channelId===i).map(e=>e.title),(o.data??[]).map(e=>e.title));return l===void 0||n.review.created!==null?null:(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:l.where===`project`?`This channel already has a video on this: "${l.title}" (in Projects). Start anyway if you want another take.`:`This channel already uploaded "${l.title}" (Channel → Existing videos). Start anyway if you want another take.`})}function i_e({rows:e,open:t,onChange:n}){return(0,h.jsx)(`ul`,{"aria-label":`Setup`,className:`m-0 flex list-none flex-col border-t border-line p-0`,children:e.map(e=>{let r=t.has(e.id)&&e.editor!==void 0,i=`play-row-${e.id}`;return(0,h.jsxs)(`li`,{"data-setup-row":e.id,className:`border-b border-line`,children:[(0,h.jsx)(V,{title:e.label,size:`small`,className:`items-center py-3.5`,status:e.problem?(0,h.jsx)(Wx,{tone:`failed`,children:`Needs setup`}):void 0,meta:(0,h.jsx)(`span`,{"data-row-summary":!0,className:e.problem&&!r?`block break-words text-danger`:`block truncate text-ink-2`,title:e.problem&&!r?void 0:e.summary,children:r?e.summary:e.problem??e.summary}),children:(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-expanded":e.editor===void 0?void 0:r,"aria-controls":e.editor===void 0?void 0:i,"aria-label":`${r?`Done with`:`Change`} ${e.label.toLowerCase()}`,onClick:()=>n(e.id,!r),children:r?`Done`:`Change`})}),r?(0,h.jsx)(`section`,{id:i,"aria-label":e.label,className:`min-w-0 pb-6`,children:e.editor}):null]},e.id)})})}var Y6=[{id:`title`,label:`Title and keywords`,section:`content`},{id:`article`,label:`Article`,section:`content`},{id:`narration`,label:`Narration`,section:`outputs`},{id:`images`,label:`Images`,section:`outputs`},{id:`video`,label:`Video and style`,section:`style`},{id:`outputs`,label:`Outputs`,section:`outputs`},{id:`reviews`,label:`Reviews`,section:`review`},{id:`channel`,label:`Channel`,section:`content`}],a_e=[[`title`,[`title`,`values`]],[`article`,[`sources.article`,`sources.research`,`articlePrompt`,`provided.article`,`provided.research`,`llm`]],[`narration`,[`sources.audio`,`audio`,`voices`,`provided.audio`,`narrationPrompt`,`intro`,`outro`,`chunking`]],[`images`,[`sources.images`,`images`,`imagePrompts`,`provided.images`,`reference`,`provided.reference`]],[`video`,[`sources.video`,`imageSeconds`,`zoomPercent`,`motionStyle`,`edgeSilenceSeconds`,`silenceGapSeconds`,`sentencePauseSeconds`,`paragraphPauseSeconds`,`loudness`,`videoEdit`,`format`,`subtitles`,`fontUpload`]],[`outputs`,[`sources.thumbnail`,`thumbnailPrompt`,`provided.thumbnail`,`thumbnailCount`,`youtubeDescription`,`descriptionPrompt`,`shorts`,`sources.document`,`document`]],[`reviews`,[`checkpoints`,`reviews`]],[`channel`,[`channelId`,`useBrandKit`,`language`]]],X6=(e,t)=>e.some(e=>t===e||t.startsWith(`${e}.`));function Z6(e,t=`article`){return X6([`llm`],e)?t:a_e.find(([,t])=>X6(t,e))?.[0]}function o_e(e){switch(e){case`content`:return[`title`,`article`,`channel`];case`outputs`:return[`narration`,`images`,`video`,`outputs`];case`style`:return[`video`];case`review`:return[`reviews`]}}function Q6(e,t,n,r=`article`){return t.find(t=>Z6(t.field,r)===e?e===`title`?t.field===`title`?n.length>0:!n.some(e=>t.field===`values.${e}`):!0:!1)}function s_e(e,t,n){let r=e=>e===``?`no provider`:n.providers.find(t=>t.id===e)?.displayName??e,i=e=>e.filter(e=>typeof e==`string`&&e!==``).join(` · `);switch(e){case`title`:return i([n.topics.length?t.title:!1,n.keywords===0?`No keywords`:`${String(n.keywords)} keyword${n.keywords===1?``:`s`}`]);case`article`:return t.sources.article===`off`?`Off: no article`:t.sources.article===`provide`?`Your article`:i([t.articlePrompt||`No prompt picked`,t.llm.provider?`${r(t.llm.provider)} · ${t.llm.model||`no model`}`:!1,t.sources.research===`off`?`research off`:`research: ${cM[t.sources.research].toLowerCase()}`]);case`narration`:{if(t.sources.audio===`off`)return`Off, a silent video`;if(t.sources.audio===`provide`)return t.provided.audio?.name??`Your narration file`;let e=n.voices.find(e=>e.provider===t.audio.provider&&e.voiceId===t.audio.voice);return i([r(t.audio.provider),t.voices===void 0?e?.name??(t.audio.voice||`no voice`):`${Sk[t.voices.format]}, ${String(t.voices.speakers.length)} speakers`,t.narrationPrompt?`prepared with ${t.narrationPrompt}`:!1,t.intro?`intro ${t.intro}`:!1,t.outro?`outro ${t.outro}`:!1])}case`images`:{if(t.sources.images===`off`)return`Off`;if(t.sources.images===`provide`)return`${String(t.provided.images.length)} of your images`;let e=t.imagePrompts.map(e=>`${e.name} × ${e.number||`?`}`);return i([e.length?e.join(`, `):`No image prompts picked`,r(t.images.provider),t.images.model,t.reference!==void 0&&t.reference.source!==`off`&&`establishing image`])}case`video`:return i([t.format,t.sources.video===`off`?`no video`:fk[vk(t).cuts].toLowerCase(),t.sources.video!==`off`&&n.look,t.sources.audio!==`off`&&t.subtitles.mode!==`off`?`captions ${n.fontName??t.subtitles.fontId} ${t.subtitles.fontSize} ${t.subtitles.position}`:`no captions`]);case`outputs`:return i([t.sources.thumbnail===`off`?!1:t.sources.thumbnail===`provide`?`your thumbnail`:t.thumbnailCount===3?`3 thumbnails`:`1 thumbnail`,aM(t)&&t.shorts?`${t.shorts.count} shorts`:!1,t.youtubeDescription===!0&&t.sources.audio!==`off`&&`YouTube description`,t.sources.document===`generate`&&`PDF (${CS(t.document)})`])||`Only the video`;case`reviews`:return i([n.checkpoints===0?`No checkpoints`:`${String(n.checkpoints)} checkpoint${n.checkpoints===1?``:`s`}`,n.reviews===0?`no automatic reviews`:`${String(n.reviews)} automatic review${n.reviews===1?``:`s`}`]);case`channel`:return i([n.channel??`Default channel`,n.brandKit?`brand kit on`:`brand kit off`,t.language===void 0?void 0:SO(t.language).name])}}function c_e({review:e,blocker:t,errors:n,pendingUpload:r}){if(e.starting)return;if(e.uncertain)return{text:`Slopify didn't confirm the last start. Press Check Start result to find out before starting again.`};if(t)return{text:t.hint,field:t.field};let i=n[0];if(i)return{text:i.message,field:i.field};if(r)return{text:`Wait for uploads to finish before Start`,field:r};if(e.error)return{text:e.error};if(e.pending||!e.valid)return{text:`Checking your setup and the estimate…`}}function l_e({errors:e,blocker:t,saveProblem:n,onReveal:r,onWholeSetup:i,onSaveTemplate:a,preview:o}){let s=bM(),{document:c,review:l}=s,u=vM(c,s.view),d=l.starting||l.uncertain;(0,m.useEffect)(()=>{s.reviewDraft()},[s.reviewDraft]);let f=!l.valid&&!l.pending&&!l.starting&&!l.uncertain&&l.error===null&&e.length===0&&t===void 0&&!u&&s.activeId!==null;(0,m.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>void s.reviewDraft(),800);return()=>clearTimeout(e)},[f,c,s.reviewDraft]);let p=l.valid&&l.receipt?l.receipt.runs.length:hM(c),g=c_e({review:l,blocker:t,errors:e,pendingUpload:u}),_=l.starting||!l.uncertain&&(!l.valid||l.pending||e.length>0||!!u);return(0,h.jsxs)(h.Fragment,{children:[o,(0,h.jsxs)(`section`,{"aria-label":`Start`,className:`flex min-w-0 flex-col gap-4 border-t border-line pt-5`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,h.jsx)(`span`,{className:`text-ink-2`,children:p===1?`1 video`:`${String(p)} videos`}),p>1?(0,h.jsx)(lb,{label:`Queue`,tip:`play.batch-queue`,checked:_M(c),disabled:d,onChange:e=>s.edit({...c,queue:e})}):(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:`One run`})]}),(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(V,{title:`Estimated cost`,info:`play.estimate`,size:`small`,className:`pb-0`}),l.valid&&l.receipt?(0,h.jsx)(Wge,{estimates:l.receipt.estimates}):(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:l.pending?`Calculating the estimate…`:`The estimate appears once the setup is complete.`}),(0,h.jsx)(uV,{label:`Expected article words per video`,tip:`play.expected-words`,className:`mt-2`,children:(0,h.jsx)(Y,{"data-play-field":`expectedWords`,type:`number`,min:1,max:1e5,value:c.expectedWords,disabled:d,onChange:e=>s.edit({...c,expectedWords:e.target.value})})})]}),n?(0,h.jsx)(pP,{tone:`danger`,title:n}):null,(0,h.jsxs)(uy,{"data-tour":`play-start`,disabled:_,"aria-describedby":g?`play-start-reason`:void 0,onClick:()=>{s.startRun()},children:[(0,h.jsx)(Gc,{"aria-hidden":`true`,strokeWidth:1.75}),gM(l,c)]}),(0,h.jsx)(`div`,{id:`play-start-reason`,className:`min-h-5 text-center text-small`,children:g===void 0?(0,h.jsx)(`span`,{className:`text-ink-3`,children:p===1?`Nothing starts until you press it.`:_M(c)?`They run one after another. Nothing starts until you press it.`:`They all run at once. Nothing starts until you press it.`}):g.field===void 0?(0,h.jsx)(`span`,{role:l.error?`alert`:`status`,className:l.error?`text-danger`:`text-ink-2`,children:g.text}):(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-center gap-x-1`,children:[(0,h.jsx)(`span`,{id:`play-start-field`,className:`text-waiting`,children:g.text}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-describedby":`play-start-field`,onClick:()=>r(g.field??``),children:`Go to the field`})]})}),(0,h.jsxs)(dy,{className:`justify-center`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,h.jsx)(L,{variant:`quiet`,size:`small`,disabled:l.pending||d||!!u,onClick:()=>{s.reviewDraft()},children:`Refresh review`}),(0,h.jsx)(B,{id:`play.refresh-review`})]}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-keyshortcuts":ax(CM.reviewSetup),onClick:i,children:`Review the whole setup`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:a,children:`Save as template`})]})]})]})}function u_e(e,t,n){let r=e?.prompts??[],i=e?.entries??[];return{prompts:[...r,...t.filter(e=>!r.some(t=>t.kind===e.kind&&t.name.toLowerCase()===e.name.toLowerCase()))],entries:[...i,...n.filter(e=>!i.some(t=>t.category===e.category&&t.name.toLowerCase()===e.name.toLowerCase()))]}}function d_e({topics:e,onError:t}){let{api:n}=R(),r=_(),i=bM(),a=N(Nq(n)),o=N(wb(n)),[s,c]=(0,m.useState)(!1),l=i.review.starting||i.review.uncertain||i.review.created!==null,u=i.document.templateSource,d=a.data?.find(e=>e.id===u?.id),f=e=>o.data?.find(t=>t.id===e)?.name,p=async o=>{if(t(null),o===``){await i.newDraft();return}let s=a.data?.find(e=>e.id===o);if(s){c(!0);try{if(!await i.flush()){t(`Your draft wasn't saved, so the template wasn't applied. Press Retry beside Drafts, then pick the template again.`);return}let a=Object.fromEntries(e.map(e=>[e,i.document.form.values[e]??``]).filter(([,e])=>e.trim()!==``)),o=await Vq(n,s,crypto.randomUUID());if(!o.ok){t(`The template "${s.name}" wasn't applied. ${o.message}`);return}if(await r.invalidateQueries({queryKey:[`play-drafts`]}),!await i.open(o.value.draft.id)){t(`The draft made from "${s.name}" didn't open. Open it from Drafts.`);return}let c=o.value.draft.document,l=Object.fromEntries(Object.entries(a).filter(([e])=>(c.form.values[e]??``)===``));Object.keys(l).length>0&&i.edit({...c,form:{...c.form,values:{...c.form.values,...l}}})}catch(e){t(e instanceof Error?`The template "${s.name}" wasn't applied. ${e.message}`:`The template "${s.name}" wasn't applied. Pick it again.`)}finally{c(!1)}}},g=a.error?`Templates didn't load. ${a.error.message}`:d?[f(Y1(d)),`version ${String(d.version)}`].filter(Boolean).join(` · `):a.data?.length===0?`No templates yet. Set this video up, then Save as template.`:void 0;return(0,h.jsx)(uV,{label:`Template`,tip:`play.template`,help:g,children:(0,h.jsxs)(pV,{"data-play-field":`template`,value:d?.id??``,disabled:s||l,onChange:e=>void p(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:u&&!d?`Template no longer saved`:`No template`}),(a.data??[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})}function f_e({topics:e,problem:t}){let n=bM(),{document:r}=n,{form:i}=r,a=e=>{n.edit({...r,form:e}),n.invalidateReview(!0)};if(e.length===0)return(0,h.jsx)(uV,{label:`Title`,tip:`play.title`,error:t(`title`),children:(0,h.jsx)(Y,{"data-play-field":`title`,className:`!h-11 text-[17px]`,value:i.title,maxLength:200,placeholder:`What's the video about?`,"aria-invalid":t(`title`)!==void 0,onChange:e=>a({...i,title:e.target.value})})});let o=aq(i.title,i.values);return(0,h.jsx)(`div`,{className:`grid min-w-0 gap-4`,children:e.map((n,r)=>(0,h.jsx)(uV,{label:n,tip:`play.topic`,help:r===e.length-1?(0,h.jsxs)(h.Fragment,{children:[`Title: `,(0,h.jsx)(`b`,{className:`font-semibold text-ink`,children:o})]}):void 0,error:t(`values.${n}`)??(r===e.length-1?t(`title`):void 0),children:(0,h.jsx)(Y,{"data-play-field":`values.${n}`,className:`!h-11 text-[17px]`,value:i.values[n]??``,maxLength:200,spellCheck:!1,"aria-invalid":t(`values.${n}`)!==void 0,onChange:e=>a({...i,values:{...i.values,[n]:e.target.value}})})},n))})}function p_e({topics:e,keywordNames:t,origins:n,problem:r,adding:i,onAdding:a,open:o,onOpen:s}){let c=bM(),{document:l}=c,{form:u}=l,[d,f]=(0,m.useState)(``),p=(0,m.useId)(),g=(0,m.useRef)(null),_=c.review.starting||c.review.uncertain,v=l.variants,y=e=>{c.edit({...l,variants:e})},b=e[0],x=e=>b===void 0?e.title:e.values[b]||e.title,S=()=>{let e=d.trim();e===``||v.length>=49||(y([...v,{id:crypto.randomUUID(),title:b===void 0?e:u.title,values:b===void 0?{...u.values}:{...u.values,[b]:e}}]),f(``),g.current?.focus())},C=v.findIndex(e=>e.id===o),w=C===-1?void 0:v[C];return(0,h.jsxs)(`section`,{"aria-label":`More videos from the same setup`,className:`min-w-0`,...cb,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`sl-kicker`,children:`More videos from the same setup`}),(0,h.jsx)(B,{id:`play.more-videos`,className:`-my-1`})]}),(0,h.jsxs)(dy,{className:`flex-wrap`,children:[v.map((e,n)=>{let i=x(e)||`Video ${String(n+2)}`,a=[`items.${String(n+1)}.title`,...t.map(e=>`items.${String(n+1)}.values.${e}`)].some(e=>r(e)!==void 0);return(0,h.jsx)(Kx,{...a?{className:`border-danger`}:{},..._?{}:{onRemove:()=>y(v.filter(t=>t.id!==e.id)),removeLabel:`Remove ${i}`},children:(0,h.jsxs)(L,{variant:`quiet`,size:`small`,"data-play-field":`items.${e.id}`,className:`-my-1 -ml-1.5 h-6 px-1.5 text-ink`,"aria-label":`Change the keywords of ${i}`,onClick:()=>s(e.id),children:[i,(0,h.jsx)(Uc,{"aria-hidden":`true`,strokeWidth:1.75})]})},e.id)}),i?(0,h.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,h.jsx)(`label`,{htmlFor:p,className:`sr-only`,children:b===void 0?`Title of another video`:`${b} of another video`}),(0,h.jsx)(Y,{ref:g,id:p,autoFocus:!0,className:`!h-8 w-48`,value:d,maxLength:200,placeholder:b===void 0?`Another title`:`Another ${b}`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`&&a(!1)}}),(0,h.jsx)(L,{type:`submit`,size:`small`,disabled:d.trim()===``,children:`Add`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:()=>a(!1),children:`Done`})]}):(0,h.jsxs)(L,{variant:`quiet`,size:`small`,disabled:_||v.length>=49,disabledReason:_?`Wait for the start to finish`:`One Start queues at most 50 videos`,onClick:()=>a(!0),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Add topic`]})]}),(0,h.jsx)(UM,{open:w!==void 0,title:w?`Video ${String(C+2)}: ${x(w)||`untitled`}`:``,width:`narrow`,onClose:()=>s(null),footer:(0,h.jsx)(L,{variant:`secondary`,onClick:()=>s(null),children:`Done`}),children:w?(0,h.jsxs)(`fieldset`,{disabled:_,className:`flex min-w-0 flex-col gap-5 border-0 p-0`,children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Everything else comes from the setup of the first video.`}),(0,h.jsx)(uV,{label:`Title`,tip:`play.title`,error:r(`items.${String(C+1)}.title`),children:(0,h.jsx)(Y,{"data-play-field":`items.${w.id}.title`,value:w.title,maxLength:200,onChange:e=>y(v.map(t=>t.id===w.id?{...t,title:e.target.value}:t))})}),(0,h.jsx)(o0,{fieldPrefix:`items.${w.id}.values`,keywords:t.map(t=>({name:t,value:w.values[t]??``,feeds:n.get(t)??[],topic:e.includes(t)})),problem:e=>r(e.replace(`items.${w.id}.`,`items.${String(C+1)}.`)),onChange:(e,t)=>y(v.map(n=>n.id===w.id?{...n,values:{...n.values,[e]:t}}:n))})]}):null})]})}function m_e(){let e=Zi();return(0,h.jsx)(h_e,{onCreated:t=>{e({to:`/projects/$projectId`,params:{projectId:t}})}})}function h_e({onCreated:e}){let{api:t}=R(),n=eP(),r=N(Xy(t)),i=N(Qy(t)),a=N($y(t)),o=N(Zy(t)),s=N(tb(t)),c=N(wb(t)),l=N(Nq(t)),u=N({queryKey:Fj,queryFn:()=>Ij(t),staleTime:6e4}),[d,f]=Rae(),p=V3(),g=bM(),{document:_}=g,v=u_e(_.librarySnapshot,i.data?.prompts??[],a.data?.entries??[]),y=_.variants.map(({id:e,...t})=>({...t,key:e})),b=g.fontUploading||_.fontUpload!==null,x=g.review.fields,[S,C]=(0,m.useState)(new Set),[w,T]=(0,m.useState)(new Set),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(null),[A,ee]=(0,m.useState)(!1),[te,ne]=(0,m.useState)(null),j=(0,m.useRef)(null),re=(0,m.useRef)(null),M=(0,m.useRef)(null),ie=Zi(),ae=(0,m.useRef)(g.activeId);(0,m.useLayoutEffect)(()=>{ae.current!==g.activeId&&(ae.current=g.activeId,C(new Set),k(null))},[g.activeId]);let oe=e=>{f(t=>{let n={...t,...e};return{...n,subtitles:nM(n.subtitles,n.sources)}}),g.invalidateReview(!0)},se=s.data?.silenceGapSeconds??3,ce=_.form.silenceGapSeconds?.trim()??``,le={form:d,prompts:v.prompts,entries:v.entries,silenceGapSeconds:ce===``?se:Number(ce)},{fields:ue,result:de,blocker:fe}=$de(le),pe=i0(le),me=R3(d.title).filter(e=>ue.some(t=>t.name===e)),he=b?{field:`subtitles.fontUpload`,hint:`Wait for the subtitle font upload to finish to play`}:fe;(0,m.useEffect)(()=>{if(!g.review.created)return;let t=g.takeCreated()?.projectIds[0];t&&(n({type:`project-created`,id:t}),e(t))},[g.review.created,g.takeCreated,n,e]);let ge=de.ok?x:[...de.fields,...x],_e=(...e)=>!ge.some(t=>e.some(e=>t.field===e||t.field.startsWith(`${e}.`))),ve=(e,t)=>v.prompts.some(n=>n.kind===e&&n.name===t),ye=e=>e?.file!==void 0&&e.error===void 0;$N({playArticleReady:_e(`sources.article`,`articlePrompt`,`provided.article`)&&(d.sources.article===`provide`||ve(`article`,d.articlePrompt)),playAudioReady:d.sources.audio===`off`||_e(`sources.audio`,`audio`,`provided.audio`)&&(d.sources.audio!==`provide`||ye(d.provided.audio)),playImagesReady:d.sources.images===`off`||_e(`sources.images`,`images`,`imagePrompts`,`provided.images`)&&(d.sources.images===`provide`?d.provided.images.every(ye):d.imagePrompts.every(e=>ve(`image`,e.name))),playVideoReady:_e(`sources.video`),playSubtitlesReady:_e(`subtitles`)&&!b,playOptionsReady:_e(`title`,`format`,`llm`,`intro`,`outro`),playHasKeywords:ue.length>0,playKeywordsReady:_e(`values`),playReady:he===void 0&&!g.review.starting});let be=uM(d,v.entries)[0]?.section??`article`,xe=e=>Dhe(e,d)??Cge(e,d,y,v.entries),Se=e=>{let t=xe(e).field;return ge.find(n=>xe(n.field).field===t&&(x.includes(n)||S.has(e)||S.has(t)))?.message},Ce=e=>{let t=xe(e);C(n=>new Set([...n,e,t.field])),g.navigate(t.field.startsWith(`items.`)?`content`:t.section,t.field)},we=[r,i,a,o,s].every(e=>e.isSuccess||e.isError),Te=(0,m.useRef)(null),Ee=g.generation();(0,m.useEffect)(()=>{if(!we)return;let e=Te.current;Te.current={generation:Ee,id:g.activeId},(e===null||e.generation!==Ee||e.id!==g.activeId&&e.id!==null)&&T(new Set(Y6.map(e=>e.id).filter(e=>e!==`reviews`&&Q6(e,ge,me,be)!==void 0)))},[we,g.activeId,Ee]);let De=(0,m.useRef)(null);(0,m.useLayoutEffect)(()=>{let e=g.reveal;if(e||(De.current=null),!e||e.sequence===De.current||!j.current)return;let t=e.field,n=t?/^items\.([^.]+)(\.|$)/.exec(t)?.[1]:void 0;if(e.section===`review`){if(De.current=e.sequence,t&&z6(j.current,t))return;M.current?.focus();return}if(n!==void 0&&_.variants.some(e=>e.id===n)){if(O!==n){k(n);return}}else if(!(t&&me.some(e=>t===`values.${e}`))){let n=t?Z6(t,be):void 0,r=(n===void 0?o_e(e.section):[n]).filter(e=>!w.has(e));if((t!==`title`||me.length!==0)&&r.length>0){T(e=>new Set([...e,...r]));return}}De.current=e.sequence,!(t&&z6(j.current,t))&&re.current?.focus()},[g.reveal,w,O]);let Oe=async e=>{await g.flush()&&(e===`/prompts`?await ie({to:`/prompts/new`,search:{kind:`article`}}):await ie({to:e}))},ke=()=>{g.navigate(`review`)},Ae=(e,t)=>{g.invalidateReview(!0),g.attach(e,t)},je=(e,t)=>{f(n=>({...n,provided:e===`images`?{...n.provided,images:n.provided.images.filter(e=>e.key!==t)}:{...n.provided,[e]:void 0}}))},Me=[r,i,a,o,s].find(e=>e.error!==null)?.error?.message,Ne=g.error?`Your draft wasn't saved. ${g.error}`:Me,Pe={form:d,providers:r.data?.providers??[],prompts:v.prompts,voices:o.data?.voices??[],silenceGapSeconds:s.data?.silenceGapSeconds??3,problem:Se,update:oe,onPickFiles:Ae,onRemoveFile:je,onReattachFile:(e,t,n)=>{g.attach(e,[n],t)}},Fe=l.data?.find(e=>e.id===_.templateSource?.id),Ie=_.channelId??(Fe===void 0?`00000000-0000-4000-8000-000000000001`:Y1(Fe)),Le=Object.values(_.form.reviews?.stages??{}).filter(e=>e.mode!==`off`).length,Re={providers:r.data?.providers??[],voices:o.data?.voices??[],keywords:ue.length,topics:me,channel:c.data?.find(e=>e.id===Ie)?.name,brandKit:_.form.useBrandKit!==!1,look:G6(_.form),fontName:u.data?.fonts.find(e=>e.id===d.subtitles.fontId)?.name,checkpoints:d.checkpoints?.length??0,reviews:Le},ze={title:(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 py-4`,children:[me.length?(0,h.jsx)(uV,{label:`Title pattern`,tip:`play.title-pattern`,error:Se(`title`),children:(0,h.jsx)(Y,{"data-play-field":`title`,value:d.title,maxLength:200,"aria-invalid":Se(`title`)!==void 0,onChange:e=>oe({title:e.target.value})})}):null,(0,h.jsx)(wge,{fields:ue,origins:pe,topics:me,hide:me,values:d.values,problem:Se,onChange:(e,t)=>oe({values:{...d.values,[e]:t}})}),ue.length===me.length?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:ue.length===0?`No keywords. A prompt or the title that names {{a keyword}} adds one here.`:`The only keywords are the topic, typed at the top.`}):null]}),article:(0,h.jsx)(xge,{...Pe,entries:v.entries,onLibrary:e=>{Oe(e)}}),narration:(0,h.jsx)(Ige,{...Pe,entries:v.entries,onKeyword:Ce,onSettings:()=>{Oe(`/settings`)}}),images:(0,h.jsx)(Lge,{...Pe}),video:(0,h.jsx)(Rge,{...Pe,problemOf:Se}),outputs:(0,h.jsx)(zge,{...Pe,entries:v.entries,onSettings:()=>{Oe(`/settings`)}}),reviews:void 0,channel:(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 py-4`,children:[(0,h.jsx)(The,{}),(0,h.jsx)(Ehe,{})]})},Be=Y6.filter(e=>e.id!==`narration`||d.sources.article!==`off`),Ve=Be.map(e=>({id:e.id,label:e.label,summary:s_e(e.id,d,Re),problem:Q6(e.id,ge,me,be)?.message,editor:ze[e.id]})),He=(e,t)=>{if(e===`reviews`){ke();return}T(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},Ue=e=>{He(e,!0),requestAnimationFrame(()=>{j.current?.querySelector(`[data-setup-row="${e}"]`)?.scrollIntoView({block:`start`,behavior:`smooth`})})},We=_.variants.length+1,Ge=vM(_,g.view),Ke=!g.review.starting&&(g.review.uncertain||g.review.valid&&!g.review.pending&&ge.length===0&&!Ge);qb({id:`play.start`,title:gM(g.review,_),group:`Play`,context:d.title||`New project`,keywords:[`start`,`queue`,`run`,`play`,`go`],run:()=>{Ke?g.startRun():he?Ce(he.field):ge[0]&&Ce(ge[0].field)}}),qb({id:`play.add-topic`,title:`Add a topic for another video`,group:`Play`,context:`${String(We)} video${We===1?``:`s`}`,keywords:[`more videos`,`variation`,`batch`,`queue`],run:()=>D(!0)}),qb({id:`play.save-template`,title:`Save as template`,group:`Play`,keywords:[`template`,`setup`,`reuse`],run:()=>ee(!0)}),qb({id:`play.review`,title:`Review the whole setup`,group:`Play`,keywords:[`summary`,`checkpoints`,`prompt`],shortcut:CM.reviewSetup,run:ke}),qb({id:`play.template`,title:`Pick a template`,group:`Play`,keywords:[`template`,`setup`],run:()=>{j.current&&z6(j.current,`template`)}});let qe=d.sources.video===`generate`&&d.sources.images!==`off`,Je=Hge(d,p),Ye=qe?(0,h.jsx)(D6,{drawnOn:Je?.drawnOn,settings:{format:d.format,subtitles:{mode:d.sources.audio===`off`?`off`:d.subtitles.mode,fontId:d.subtitles.fontId,fontSize:Number(_.form.subtitles.fontSize)||d.subtitles.fontSize,position:d.subtitles.position},videoEdit:d.videoEdit,previewText:_.previewText,image:Je?.image}}):null;return(0,h.jsxs)(`div`,{ref:j,onBlurCapture:e=>{let t=e.target.dataset.playField;t&&C(e=>new Set([...e,t]))},"data-play-grid":`true`,className:`min-w-0 max-[767px]:[&_button]:min-h-11 max-[767px]:[&_input:not([type=checkbox])]:min-h-11 max-[767px]:[&_select]:min-h-11 max-[767px]:[&_summary]:min-h-11`,children:[(0,h.jsx)(bq,{crumb:`New project`,title:(0,h.jsx)(`span`,{ref:re,tabIndex:-1,children:`What's the video about?`}),meta:d.title.trim()===``?`Untitled draft`:d.title,actions:(0,h.jsx)(Sge,{})}),(0,h.jsx)(z3,{onDefaults:g.adoptDefaults}),(0,h.jsxs)(xq,{className:`sl-workspace--play`,aside:(0,h.jsx)(l_e,{errors:ge,blocker:he,saveProblem:Ne,onReveal:Ce,onWholeSetup:ke,onSaveTemplate:()=>ee(!0),preview:Ye}),asideLabel:`Review and start`,children:[(0,h.jsxs)(`div`,{"data-tour":`play-options`,className:`grid min-w-0 grid-cols-1 items-start gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(d_e,{topics:me,onError:ne}),(0,h.jsx)(f_e,{topics:me,problem:Se})]}),(0,h.jsx)(r_e,{topics:me}),te?(0,h.jsx)(pP,{tone:`danger`,title:te}):null,(0,h.jsx)(p_e,{topics:me,keywordNames:ue.map(e=>e.name),origins:pe,problem:Se,adding:E,onAdding:D,open:O,onOpen:k}),(0,h.jsx)(i_e,{rows:Ve,open:w,onChange:He})]}),(0,h.jsx)(UM,{open:g.section===`review`,title:`Review`,headingRef:M,onClose:()=>{g.navigate(`content`)},children:(0,h.jsx)(Xge,{fields:ue,errors:ge,problem:Se,onReveal:Ce})}),(0,h.jsx)(Qge,{open:A,onClose:()=>ee(!1)}),Be.map(e=>(0,h.jsx)(g_e,{id:e.id,label:e.label,onOpen:Ue},e.id))]})}function g_e({id:e,label:t,onOpen:n}){return qb({id:`play.row.${e}`,title:`Change ${t.toLowerCase()}`,group:`Play`,keywords:[`open`,`edit`,`section`,t],run:()=>n(e)}),null}function __e(){let{api:e}=R(),t=N({queryKey:[`batch-queue`],queryFn:async()=>F(await e.fetch(`${e.origin}/api/projects/queue`)),refetchInterval:2e3,retry:!1}),n=N(Gy(e)),r=t.data?.queue.length??0;return(0,h.jsxs)(ab,{children:[(0,h.jsx)(ob,{asChild:!0,children:(0,h.jsxs)(L,{variant:`quiet`,disabled:r===0,"aria-label":`Video queue: ${r} remaining`,children:[(0,h.jsx)(zc,{"aria-hidden":`true`,className:`size-4`}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[`Queue · `,r]})]})}),(0,h.jsxs)(sb,{align:`end`,className:`p-0`,children:[(0,h.jsx)(`p`,{className:`border-b border-line px-3 py-2 text-small text-ink-2`,children:nb(`play.queue`).body}),(0,h.jsx)(v_e,{queue:t.data?.queue??[],projects:n.data?.projects})]})]})}function v_e({queue:e,projects:t}){return(0,h.jsx)(`ol`,{className:`max-h-40 overflow-y-auto px-4 py-2`,children:e.map((e,n)=>{let r=t?.find(t=>t.id===e.projectId);return(0,h.jsxs)(`li`,{className:`flex justify-between gap-3 py-1 text-small`,children:[(0,h.jsxs)(ha,{className:`truncate`,to:`/projects/$projectId`,params:{projectId:e.projectId},children:[n+1,`. `,r?.title??`Video`]}),(0,h.jsx)(`span`,{className:`shrink-0 text-ink-2`,children:r?.status===`paused`?`Paused`:e.state===`active`?`Active`:`Queued`})]},e.projectId)})})}function $6({label:e,className:t,children:n}){return(0,h.jsx)(`nav`,{"aria-label":e,className:I(`sl-rail`,t),children:n})}function y_e({icon:e,meta:t,children:n}){return(0,h.jsxs)(h.Fragment,{children:[e,(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),t===void 0?null:(0,h.jsx)(`span`,{className:`sl-rail__meta`,children:t})]})}function e8({icon:e,meta:t,current:n=!1,onClick:r,className:i,children:a,"data-tour":o}){return(0,h.jsx)(`button`,{type:`button`,"data-tour":o,"aria-current":n?`true`:void 0,onClick:r,className:I(`sl-rail__item w-full border-0 bg-transparent text-left font-[inherit]`,n&&`bg-accent-tint font-semibold text-ink`,i),children:(0,h.jsx)(y_e,{icon:e,meta:t,children:a})})}var t8=/^(?:[-*+]|\d+[.)])\s+/u;function b_e(e){let t=e.split(/\r?\n/u).filter(e=>e.trim()!==``),n=[];for(let e of t.slice(1)){let t=e.trim().replace(t8,``).trim(),r=n.length-1;/^\s/u.test(e)&&!t8.test(e.trim())&&r>=0?n[r]=`${n[r]??``} ${t}`:t!==``&&n.push(t)}return n}var x_e={blockquote:a8,break:E_e,code:o8,definition:o8,delete:a8,emphasis:a8,footnoteReference:o8,footnoteDefinition:o8,heading:T_e,html:o8,image:r8,imageReference:r8,inlineCode:i8,list:a8,listItem:a8,link:a8,linkReference:a8,strong:a8,table:o8,tableCell:o8,text:i8,thematicBreak:o8,toml:o8,yaml:o8},S_e={},n8=[];function C_e(e){let t={...x_e},n=e||S_e,r=n.keep||n8,i=n.remove||n8,a=-1;for(;++a<i.length;){let e=i[a];typeof e==`string`?t[e]=o8:t[e[0]]=e[1]}let o={};if(r.length===0)o=t;else{let e;for(e in t)r.includes(e)||(o[e]=t[e]);for(a=-1;++a<r.length;)if(e=r[a],!Object.hasOwn(t,e))throw Error("Unknown node type `"+e+"` in `keep`, use a replace tuple with a handle instead: `remove: [['"+e+"', handle]]`")}return function(e){return s(e)};function s(e){let t=e.type,n=e;if(Object.hasOwn(o,t)){let e=o[t];e&&(n=e(n)||void 0)}return n=Array.isArray(n)?c(n):n,n&&`children`in n&&(n.children=c(n.children)),n}function c(e){let t=-1,n=[];for(;++t<e.length;){let r=s(e[t]);Array.isArray(r)?n.push(...c(r)):r&&n.push(r)}return w_e(n)}}function w_e(e){let t=-1,n=[],r;for(;++t<e.length;){let i=e[t];r&&i.type===r.type&&`value`in i&&`value`in r?r.value+=i.value:(n.push(i),r=i)}return n}function r8(e){let t=`title`in e?e.title:``,n=e.alt||t||``;return n?{type:`text`,value:n}:void 0}function i8(e){return{type:`text`,value:e.value}}function T_e(e){return{type:`paragraph`,children:e.children}}function a8(e){return e.children}function E_e(){return{type:`text`,value:`
|
|
283
|
+
`),oge=`Built-in`;function S6({enabled:e,prompt:t,prompts:n,narrated:r,problem:i,onChange:a}){let o=(0,m.useId)(),s=n.filter(e=>e.kind===`description`),c=t!==``&&!s.some(e=>e.name===t),l=i?.(`youtubeDescription`)??i?.(`descriptionPrompt`);return(0,h.jsxs)(`div`,{className:`col-span-full sl-fields`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1 self-end`,...cb,children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-switch`,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:`${o}-switch`,type:`checkbox`,"data-play-field":`youtubeDescription`,checked:e,disabled:!r&&!e,"aria-describedby":l?`${o}-error`:void 0,className:`size-4 accent-accent`,onChange:e=>a({youtubeDescription:e.currentTarget.checked,descriptionPrompt:t})}),`YouTube description`]}),(0,h.jsx)(B,{id:`play.youtube-description`})]}),(0,h.jsx)(MV,{htmlFor:`${o}-prompt`,label:`Description prompt`,tip:`play.description-prompt`,children:(0,h.jsxs)(hV,{id:`${o}-prompt`,"data-play-field":`descriptionPrompt`,value:t,disabled:!e,onChange:t=>a({youtubeDescription:e,descriptionPrompt:t.target.value}),children:[(0,h.jsx)(`option`,{value:``,children:oge}),c?(0,h.jsxs)(`option`,{value:t,children:[t,` (saved choice)`]}):null,s.map(e=>(0,h.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}),l?(0,h.jsx)(`p`,{id:`${o}-error`,className:`sl-fields__wide m-0 text-small text-danger`,children:l}):r?null:(0,h.jsx)(`p`,{className:`sl-fields__wide m-0 text-label text-ink-3`,children:`Needs narration.`})]})}function C6({value:e,narrated:t,imageProvider:n,problem:r,onChange:i,fieldPrefix:a=`videoEdit`,language:o}){let s=(0,m.useId)(),c=e??dk,l=e=>i({...c,...e}),{api:u}=R(),d=N(yV(u,n,c.animate!==`off`)),f=e=>r?.(`${a}.${e}`),p=[c.transition===`cut`?void 0:`${pk[c.transition]} ${String(c.transitionSeconds)} s`,c.grade===`none`?void 0:hk[c.grade],c.atmosphere===`none`?void 0:gk[c.atmosphere],c.vignette===`off`?void 0:`Vignette`,c.grain===`off`?void 0:`Grain`,c.chapterCards?`Chapter cards`:void 0,c.animate===`off`?void 0:`Animated images`].filter(e=>e!==void 0),g=[`transition`,`transitionSeconds`,`chapterCards`,`animate`,`animateEvery`,`animateModel`].map(f).filter(e=>e!==void 0),_=d.data?.models??[],v=c.animateModel!==``&&!_.some(e=>e.id===c.animateModel),y=CO(o);return{cuts:(0,h.jsxs)(w6,{id:`${s}-cuts`,label:`Cuts`,tip:`project.video.cuts`,children:[(0,h.jsx)(hV,{id:`${s}-cuts`,"data-play-field":`${a}.cuts`,className:`min-w-0`,value:y===void 0?c.cuts:`interval`,disabled:y!==void 0,"aria-describedby":y===void 0?void 0:`${s}-cuts-note`,onChange:e=>l({cuts:e.target.value}),children:ak.map(e=>(0,h.jsx)(`option`,{value:e,children:fk[e]},e))}),y===void 0?null:(0,h.jsx)(`p`,{id:`${s}-cuts-note`,className:`m-0 basis-full text-small text-ink-3`,children:y})]}),look:(0,h.jsxs)(`details`,{className:`group min-w-0 rounded-control border border-line-strong`,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-10 cursor-pointer items-center gap-3 px-3 text-small max-[1099px]:min-h-11`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:`Look`}),(0,h.jsx)(`span`,{className:`min-w-0 truncate text-ink-3`,children:p.length===0?`Plain cuts, no effects`:p.join(` · `)})]}),(0,h.jsxs)(`div`,{className:`sl-fields border-line-strong border-t p-3`,children:[(0,h.jsxs)(w6,{id:`${s}-transition`,label:`Transition`,tip:`project.video.transition`,children:[(0,h.jsx)(hV,{id:`${s}-transition`,"data-play-field":`${a}.transition`,className:`min-w-0`,value:c.transition,onChange:e=>l({transition:e.target.value}),children:ok.map(e=>(0,h.jsx)(`option`,{value:e,children:pk[e]},e))}),(0,h.jsx)(hV,{"aria-label":`Transition length`,"data-play-field":`${a}.transitionSeconds`,"aria-invalid":f(`transitionSeconds`)!==void 0,className:`w-24 flex-none`,disabled:c.transition===`cut`,value:String(c.transitionSeconds),onChange:e=>l({transitionSeconds:Number(e.target.value)}),children:nae.map(e=>(0,h.jsxs)(`option`,{value:String(e),children:[e,` s`]},e))})]}),(0,h.jsx)(w6,{id:`${s}-grade`,label:`Colour grade`,tip:`project.video.grade`,children:(0,h.jsx)(T6,{id:`${s}-grade`,field:`${a}.grade`,value:c.grade,options:ck,labels:hk,onChange:e=>l({grade:e})})}),(0,h.jsx)(w6,{id:`${s}-vignette`,label:`Vignette`,tip:`project.video.vignette`,children:(0,h.jsx)(T6,{id:`${s}-vignette`,field:`${a}.vignette`,value:c.vignette,options:sk,labels:mk,onChange:e=>l({vignette:e})})}),(0,h.jsx)(w6,{id:`${s}-grain`,label:`Film grain`,tip:`project.video.grain`,children:(0,h.jsx)(T6,{id:`${s}-grain`,field:`${a}.grain`,value:c.grain,options:sk,labels:mk,onChange:e=>l({grain:e})})}),(0,h.jsx)(w6,{id:`${s}-atmosphere`,label:`Atmosphere`,tip:`project.video.atmosphere`,children:(0,h.jsx)(T6,{id:`${s}-atmosphere`,field:`${a}.atmosphere`,value:c.atmosphere,options:lk,labels:gk,onChange:e=>l({atmosphere:e})})}),(0,h.jsx)(w6,{id:`${s}-cards`,label:`Chapter cards`,tip:`project.video.chapter-cards`,children:(0,h.jsx)(`input`,{id:`${s}-cards`,type:`checkbox`,"data-play-field":`${a}.chapterCards`,className:`size-4 accent-accent`,checked:c.chapterCards,disabled:!t&&!c.chapterCards,onChange:e=>l({chapterCards:e.currentTarget.checked})})}),(0,h.jsxs)(w6,{id:`${s}-animate`,label:`Animate images`,tip:`project.video.animate`,wide:!0,children:[(0,h.jsx)(hV,{id:`${s}-animate`,"data-play-field":`${a}.animate`,"aria-invalid":f(`animate`)!==void 0,className:`min-w-0`,value:c.animate,onChange:e=>l({animate:e.target.value}),children:uk.map(e=>(0,h.jsx)(`option`,{value:e,disabled:e===`chapters`&&!t,children:_k[e]},e))}),(0,h.jsx)(hV,{"aria-label":`Animate every how many images`,"data-play-field":`${a}.animateEvery`,"aria-invalid":f(`animateEvery`)!==void 0,className:`w-24 flex-none`,disabled:c.animate!==`every`,value:String(c.animateEvery),onChange:e=>l({animateEvery:Number(e.target.value)}),children:Array.from({length:9},(e,t)=>t+2).map(e=>(0,h.jsxs)(`option`,{value:String(e),children:[`every `,e]},e))}),(0,h.jsxs)(hV,{"aria-label":`Image-to-video model`,"data-play-field":`${a}.animateModel`,"aria-invalid":f(`animateModel`)!==void 0,className:`min-w-0`,disabled:c.animate===`off`,value:c.animateModel,onChange:e=>l({animateModel:e.target.value}),children:[(0,h.jsx)(`option`,{value:``,children:`Choose a model`}),v?(0,h.jsxs)(`option`,{value:c.animateModel,children:[c.animateModel,` (saved choice)`]}):null,_.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),g.length>0?(0,h.jsx)(`p`,{className:`col-span-full text-small text-danger`,children:g[0]}):c.animate!==`off`&&d.isSuccess&&_.length===0?(0,h.jsx)(`p`,{className:`col-span-full text-label text-ink-3`,children:`This image provider has no image-to-video models. Choose fal.ai or Replicate for images to animate them.`}):null]})]})}}function w6({id:e,label:t,tip:n,wide:r=!1,children:i}){return(0,h.jsxs)(`div`,{className:I(`sl-field`,r&&`sl-fields__wide`),...cb,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:e,className:`sl-field__label`,children:t}),(0,h.jsx)(B,{id:n,label:t.toLowerCase()})]}),(0,h.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-2 [&>select]:min-w-0 [&>select]:flex-1`,children:i})]})}function T6({id:e,field:t,value:n,options:r,labels:i,onChange:a}){return(0,h.jsx)(hV,{id:e,"data-play-field":t,className:`min-w-0`,value:n,onChange:e=>a(e.target.value),children:r.map(e=>(0,h.jsx)(`option`,{value:e,children:i[e]},e))})}var sge=sO(`kind`,[K({kind:fO(`upload`),stagedFileId:U().regex(/^[A-Za-z0-9_-]{1,64}$/)}),K({kind:fO(`output`),outputId:U().regex(/^[A-Za-z0-9_-]{1,64}$/)}),K({kind:fO(`picture`),sha256:U().regex(/^[a-f0-9]{64}$/)})]),E6=K({format:q(sS),subtitles:K({mode:q(BA),fontId:U().max(160).regex(/^[A-Za-z0-9_-]+$/),fontSize:W().finite().min(16).max(120),position:q(VA)}),videoEdit:qA.optional(),previewText:U().max(200).optional(),image:sge.optional(),shorts:K({titleOnScreen:rO(),speed:W().finite().min(1).max(1.25).optional(),title:U().max(100).optional()}).optional(),force:rO().optional()}),cge=K({hash:U().regex(/^[a-f0-9]{64}$/),url:U().min(1),cached:rO(),seconds:W().positive()});async function lge(e,t,n){let r=await e.fetch(`${e.origin}/api/style-preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),...n===void 0?{}:{signal:n}});if(!r.ok)throw await po(r);let i=Co(cge,await r.json());return{...i,src:`${e.origin}${i.url}`}}var uge=600;function D6({settings:e,label:t,drawnOn:n,poster:r}){let{api:i}=R(),a=N({queryKey:Fj,queryFn:()=>Ij(i),staleTime:6e4}),{format:o,subtitles:s,videoEdit:c,previewText:l,image:u,shorts:d}=e,f=r??(u?.kind===`picture`?Lb(i,u.sha256):void 0),p=u===void 0?``:JSON.stringify(u),g=d===void 0?``:JSON.stringify(d),_=(0,m.useMemo)(()=>JSON.stringify({format:o,subtitles:{mode:s.mode,fontId:s.fontId,fontSize:s.fontSize,position:s.position},...c===void 0?{}:{videoEdit:c},...l===void 0||l.trim()===``?{}:{previewText:l},...p===``?{}:{image:JSON.parse(p)},...g===``?{}:{shorts:JSON.parse(g)}}),[o,s.mode,s.fontId,s.fontSize,s.position,c,l,p,g]),v=(0,m.useMemo)(()=>E6.safeParse(JSON.parse(_)).success,[_]),[y,b]=(0,m.useState)({kind:`idle`}),[x,S]=(0,m.useState)(void 0),C=(0,m.useRef)(void 0),w=(0,m.useCallback)(async e=>{C.current?.abort();let t=new AbortController;C.current=t,b({kind:`pending`});try{let n=await lge(i,{...E6.parse(JSON.parse(_)),...e?{force:e}:{}},t.signal);if(C.current!==t)return;S(n.src),b({kind:`ready`,src:n.src})}catch(e){if(C.current!==t||t.signal.aborted)return;b({kind:`failed`,message:e instanceof Error&&e.message!==``?e.message:`The style preview couldn't render. Press Render again.`})}},[i,_]);(0,m.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>{w(!1)},uge);return()=>clearTimeout(e)},[w,v]),(0,m.useEffect)(()=>()=>C.current?.abort(),[]);let T=a.data?.fonts.find(e=>e.id===s.fontId)?.name??(s.fontId==="default"?`Barlow`:`Chosen font`),E=d===void 0?s.mode===`burn-in`?`Captions: ${T} ${String(s.fontSize)} · ${dge(s.position)}`:s.mode===`files`?`Captions: a separate file, which players show in their own style`:`Captions: off`:[`Captions: ${T}, word by word`,d.titleOnScreen?`Title on screen`:`No title on screen`,d.speed===void 0||d.speed===1?void 0:`${d.speed.toFixed(2)}×`].filter(e=>e!==void 0).join(` · `),D=d===void 0?`Style preview`:`Shorts preview`,O=o===`9:16`||d!==void 0;return(0,h.jsxs)(`section`,{"aria-label":D,className:`min-w-0 space-y-3`,children:[(0,h.jsx)(V,{as:`h3`,title:D,meta:d===void 0?`6 seconds of the sample, rendered with your settings`:`A few seconds of the sample as a short, rendered with your settings`,info:d===void 0?`project.video.style-preview`:`play.shorts.preview`,children:(0,h.jsxs)(L,{variant:`quiet`,size:`small`,disabled:!v||y.kind===`pending`,disabledReason:v?`Rendering the preview…`:`Fix the caption settings to render the preview.`,onClick:()=>{w(!0)},children:[(0,h.jsx)(qc,{"aria-hidden":`true`,size:16,strokeWidth:1.75}),`Render again`]})}),x===void 0?null:(0,h.jsx)(O0,{src:x,label:t??D,...f===void 0?{}:{poster:f},portrait:O,square:!O&&o===`1:1`,className:O?`max-w-[270px]`:o===`1:1`?`max-w-[360px]`:`max-w-[480px]`}),y.kind===`pending`?(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink-2`,children:`Rendering the preview…`}):null,y.kind===`failed`?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:y.message}):null,v?null:(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`The preview renders again once the caption size is between 16 and 120.`}),(0,h.jsxs)(`p`,{className:`text-small text-ink-2`,children:[E,u===void 0||n===void 0?``:` · Drawn on ${n}`]})]})}function dge(e){let t=e.replace(/-/g,` `);return`${t[0]?.toUpperCase()??``}${t.slice(1)}`}function fge({form:e,problem:t,update:n,onPickFiles:r,onRemoveFile:i,onReattachFile:a}){let o=e.provided.ambientBed;return(0,h.jsx)(k2,{value:e.ambientBed,inherit:`The channel's (brand kit)`,sources:$O,offerNone:!0,problem:e=>t(`ambientBed.${e}`),file:(0,h.jsx)(X3,{field:`ambientBed.file`,label:`Ambient sound file: an audio file, looped if shorter than the video`,accept:`audio/*`,uploads:o===void 0?[]:[o],problem:t(`ambientBed.file`),onPick:e=>r(`ambientBed`,e),onReattach:a?(e,t)=>a(`ambientBed`,e,t):void 0,onRemove:e=>i(`ambientBed`,e)}),onChange:e=>n({ambientBed:e})})}function O6({value:e,onChange:t,problem:n,switchTip:r=`project.loudness`,switchLabel:i=`Level the volume`}){return(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-3`,children:[(0,h.jsx)(lb,{checked:e.enabled,label:i,tip:r,onChange:n=>t({...e,enabled:n})}),e.enabled?(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(A6,{target:`video`,label:`Video volume`,tip:`project.loudness.video`,lufs:e.videoLufs,error:n?.(`videoLufs`),onChange:n=>t({...e,videoLufs:n})}),(0,h.jsx)(A6,{target:`audioFiles`,label:`Audio files volume`,tip:`project.loudness.audio-files`,lufs:e.audioFilesLufs,error:n?.(`audioFilesLufs`),onChange:n=>t({...e,audioFilesLufs:n})})]}):null]})}var pge=`Enter a volume between ${j6(-10)} dB and ${j6(4)} dB (${String(PO(-10))}% to ${String(PO(4))}%).`;function k6(e,t){let n=e.trim().replace(`−`,`-`).replace(`,`,`.`);if(n===``)return;let r=Number(n.replace(/(dB|%)$/i,``).trim());if(!Number.isFinite(r)||t===`percent`&&r<=0)return;let i=t===`db`?r:Die(r);if(!(i<-10.25||i>4.25))return Oie(i)}function A6({target:e,label:t,tip:n,lufs:r,error:i,onChange:a}){let o=(0,m.useId)(),s=Tie(r,e),[c,l]=(0,m.useState)(),u=c===void 0||k6(c.text,c.unit)!==void 0,d=(t,n)=>{l({unit:t,text:n});let r=k6(n,t);r!==void 0&&a(Eie(r,e))},f=c?.unit===`db`?c.text:j6(s),p=c?.unit===`percent`?c.text:String(PO(s));return(0,h.jsx)(uV,{label:t,tip:n,help:`0 dB is the recommended ${M6(NO(e))} LUFS; this is ${M6(r)} LUFS. Peaks stay under ${M6(wie(e))} dBTP.`,error:u?i:pge,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-small`,children:[(0,h.jsx)(Y,{type:`text`,inputMode:`decimal`,className:`sl-input--number`,"data-play-field":`loudness.${e===`video`?`videoLufs`:`audioFilesLufs`}`,value:f,onChange:e=>d(`db`,e.target.value),onBlur:()=>l(void 0)}),(0,h.jsx)(`span`,{children:`dB`}),(0,h.jsx)(Y,{id:`${o}-percent`,"aria-label":`${t} as a percentage of the recommended level`,type:`text`,inputMode:`decimal`,className:`sl-input--number`,value:p,onChange:e=>d(`percent`,e.target.value),onBlur:()=>l(void 0)}),(0,h.jsx)(`span`,{children:`%`})]})})}function j6(e){return e>0?`+${String(e)}`:M6(e)}function M6(e){return String(e).replace(`-`,`−`)}function N6({sentence:e,paragraph:t,problem:n,onChange:r}){let i=`0 to 2 in steps of ${String(BO)}`;return(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(uV,{label:`Pause between sentences (seconds)`,tip:`project.pause.sentence`,help:`${i}; ${String(zO)} is the default. 0 leaves the voice's own.`,error:n(`sentencePauseSeconds`),children:(0,h.jsx)(Y,{type:`text`,inputMode:`decimal`,className:`sl-input--number`,"data-play-field":`sentencePauseSeconds`,value:e,onChange:e=>r(`sentencePauseSeconds`,e.target.value)})}),(0,h.jsx)(uV,{label:`Pause between paragraphs (seconds)`,tip:`project.pause.paragraph`,help:`${i}; 0 (the default) keeps the sentence pause.`,error:n(`paragraphPauseSeconds`),children:(0,h.jsx)(Y,{type:`text`,inputMode:`decimal`,className:`sl-input--number`,"data-play-field":`paragraphPauseSeconds`,value:t,onChange:e=>r(`paragraphPauseSeconds`,e.target.value)})})]})}function P6(e){let t=e.trim().replace(`,`,`.`);if(t===``)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function mge({form:e,problem:t,update:n}){let{api:r}=R(),i=N(tb(r)).data?.loudness??jO,a=e.loudness;return(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-3`,children:[e.sources.audio===`generate`?(0,h.jsx)(N6,{sentence:e.sentencePause??`0.4`,paragraph:e.paragraphPause??`0`,problem:t,onChange:(e,t)=>n(e===`sentencePauseSeconds`?{sentencePause:t}:{paragraphPause:t})}):null,(0,h.jsx)(O6,{value:{enabled:a?.enabled??i.enabled,videoLufs:a?.videoLufs??i.videoLufs,audioFilesLufs:a?.audioFilesLufs??i.audioFilesLufs},problem:e=>t(`loudness.${e}`),onChange:e=>n({loudness:e})})]})}function F6({value:e,onPick:t,disabled:n=!1}){let r=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,...cb,children:[(0,h.jsx)(Y4,{id:r,className:`shrink-0`,children:`Thumbnails`}),(0,h.jsxs)(X4,{type:`single`,value:String(e),"aria-labelledby":r,disabled:n,"data-play-field":`thumbnailCount`,onValueChange:e=>{(e===`1`||e===`3`)&&t(e===`3`?3:1)},children:[(0,h.jsx)(Z4,{value:`1`,children:`1`}),(0,h.jsx)(Z4,{value:`3`,children:`3`})]}),(0,h.jsx)(B,{id:`play.thumbnail-count`})]})}function hge({form:e,problem:t,update:n}){return(0,h.jsxs)($3,{kind:`research`,name:`Research`,dim:e.sources.research===`off`,children:[(0,h.jsx)(e6,{kind:`research`,form:e,update:n}),(0,h.jsx)(`div`,{className:Z3,children:e.sources.research===`generate`?(0,h.jsx)(`span`,{className:`engraved text-ink-3`,children:`Runs through the LLM, one agent per chapter`}):null}),e.sources.research===`provide`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(Y3,{field:`provided.research`,label:`Research notes`,tip:`play.provided.research`,value:e.provided.research,placeholder:`Paste the notes the article will be written from.`,problem:t(`provided.research`),onChange:t=>{n({provided:{...e.provided,research:t}})}})}):null]})}function gge({form:e,prompts:t,problem:n,update:r,titled:i}){return(0,h.jsxs)($3,{kind:`article`,name:`Article`,dim:!1,titled:i,children:[(0,h.jsx)(e6,{kind:`article`,form:e,update:r}),(0,h.jsx)(`div`,{className:`${Q3} grid gap-4`,children:e.sources.article===`generate`?(0,h.jsx)(CV,{field:`articlePrompt`,label:jk(e)?`Script prompt`:`Article prompt`,tip:`play.article-prompt`,value:e.articlePrompt,placeholder:`Pick a prompt`,options:t6(t,Q1(e)),problem:n(`articlePrompt`),onPick:e=>{r({articlePrompt:e})}}):null}),e.sources.article===`provide`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(Y3,{field:`provided.article`,label:`Article text`,tip:`play.provided.article`,value:e.provided.article,placeholder:`Paste the article that will be narrated.`,problem:n(`provided.article`),onChange:t=>{r({provided:{...e.provided,article:t}})}})}):null]})}function _ge({form:e,providers:t,prompts:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s}){let c=e.sources.thumbnail===`from_prompt`||e.sources.thumbnail===`prompt_by_llm`;return(0,h.jsxs)($3,{kind:`thumbnail`,name:`Thumbnail`,dim:e.sources.thumbnail===`off`,children:[(0,h.jsx)(e6,{kind:`thumbnail`,form:e,update:i}),(0,h.jsxs)(`div`,{className:Z3,children:[c&&e.sources.images!==`generate`?(0,h.jsx)(b6,{form:e,providers:t,problem:r,update:i}):null,c?(0,h.jsx)(CV,{field:`thumbnailPrompt`,label:`Thumbnail prompt`,tip:`play.thumbnail-prompt`,value:e.thumbnailPrompt,placeholder:`Pick a prompt`,options:t6(n,`thumbnail`),problem:r(`thumbnailPrompt`),onPick:e=>{i({thumbnailPrompt:e})}}):null,c?(0,h.jsx)(F6,{value:e.thumbnailCount===3?3:1,onPick:e=>{i({thumbnailCount:e})}}):null]}),e.sources.thumbnail===`provide`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(X3,{field:`provided.thumbnail`,label:`Thumbnail image`,accept:`image/png,image/jpeg,image/webp`,uploads:e.provided.thumbnail===void 0?[]:[e.provided.thumbnail],problem:r(`provided.thumbnail`),onPick:e=>{a(`thumbnail`,e)},onReattach:s?(e,t)=>s(`thumbnail`,e,t):void 0,onRemove:e=>{o(`thumbnail`,e)}})}):null]})}function vge({form:e,prompts:t,silenceGapSeconds:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s,rawTiming:c,extras:l=!0,language:u,titled:d}){let f=e.sources.video===`generate`?e.sources.audio===`off`?`Silent video · each image shown once`:`Images and narration · ${String(n)} s segment gaps`:e.sources.audio===`off`?`Download each enabled stage separately`:`Combined WAV export with narration and segment gaps`,p=t=>({value:c?c[t]:Number.isFinite(e[t])?String(e[t]):``,onChange:e=>{c?c.onChange(t,e):i({[t]:e.trim()===``?NaN:Number(e)})}}),m=C6({value:e.videoEdit,narrated:e.sources.audio!==`off`,imageProvider:e.images.provider,problem:r,language:u??e.language,onChange:e=>i({videoEdit:e})});return(0,h.jsxs)($3,{kind:`video`,name:`Export`,dim:e.sources.video===`off`,titled:d,children:[(0,h.jsx)(e6,{kind:`video`,form:e,update:i}),(0,h.jsx)(`span`,{className:Z3,children:(0,h.jsx)(`span`,{className:`engraved text-ink-3`,children:f})}),e.sources.video===`generate`||e.sources.audio!==`off`?(0,h.jsxs)(`div`,{className:Z3,children:[e.sources.video===`generate`?(0,h.jsx)(L6,{field:`imageSeconds`,label:`Seconds per image`,tip:`play.image-seconds`,step:1,problem:r(`imageSeconds`),...p(`imageSeconds`)}):null,e.sources.video===`generate`?(0,h.jsx)(L6,{field:`zoomPercent`,label:`Zoom (%)`,tip:`play.zoom`,step:.5,problem:r(`zoomPercent`),...p(`zoomPercent`)}):null,e.sources.video===`generate`?(0,h.jsx)(SV,{label:`Motion`,tip:`play.motion`,problem:void 0,children:({id:t})=>(0,h.jsx)(hV,{id:t,"data-play-field":`motionStyle`,className:`w-full`,value:e.motionStyle,onChange:e=>i({motionStyle:e.target.value}),children:fS.map(e=>(0,h.jsx)(`option`,{value:e,children:Fk[e]},e))})}):null,e.sources.video===`generate`?m.cuts:null,e.sources.audio===`off`?null:(0,h.jsx)(L6,{field:`edgeSilenceSeconds`,label:`Silence at start and end (seconds)`,tip:`play.edge-silence`,step:.5,problem:r(`edgeSilenceSeconds`),...p(`edgeSilenceSeconds`)})]}):null,e.sources.video===`generate`?(0,h.jsx)(`div`,{className:Q3,children:m.look}):null,e.sources.video===`generate`&&e.sources.audio!==`off`?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(fge,{form:e,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s})}):null,e.sources.audio===`off`?null:(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(mge,{form:e,problem:r,update:i})}),l?(0,h.jsx)(`div`,{className:Q3,children:(0,h.jsx)(I6,{form:e,prompts:t,problem:r,update:i,onPickFiles:a,onRemoveFile:o,...s===void 0?{}:{onReattachFile:s}})}):null,e.sources.images===`off`?(0,h.jsx)(`p`,{className:`${Q3} text-small text-ink-2`,children:`Video is Off because Images is Off. Generate or provide images to enable video.`}):null]})}function I6({form:e,prompts:t,problem:n,update:r,onPickFiles:i,onRemoveFile:a,onReattachFile:o}){return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[e.sources.audio===`generate`&&e.audio.describeFigures===!0?(0,h.jsx)(p6,{value:e.showFigures,onChange:e=>r({showFigures:e})}):null,e.sources.article===`off`?null:(0,h.jsx)(`div`,{children:(0,h.jsx)(S6,{enabled:e.youtubeDescription===!0,prompt:e.descriptionPrompt??``,prompts:t,narrated:e.sources.audio!==`off`,problem:n,onChange:e=>r(e)})}),e.sources.article===`off`?null:(0,h.jsx)(`div`,{children:(0,h.jsx)(LV,{value:e.shorts??NV,prompts:t,narrated:e.sources.audio!==`off`,problem:n,musicName:e.provided.shortsMusic?.name,music:(0,h.jsxs)(`div`,{className:`basis-full`,children:[(0,h.jsx)(X3,{field:`shorts.music`,label:`Background music (optional): an audio file, looped if shorter than a short`,accept:`audio/*`,disabled:!aM(e),uploads:e.provided.shortsMusic===void 0?[]:[e.provided.shortsMusic],problem:n(`shorts.music`),onPick:e=>i(`shortsMusic`,e),onReattach:o?(e,t)=>o(`shortsMusic`,e,t):void 0,onRemove:e=>a(`shortsMusic`,e)}),(0,h.jsx)(`p`,{className:`mt-1 text-label text-ink-3`,children:`Plays at the volume above under every short and dips while the narrator speaks.`})]}),preview:(0,h.jsx)(D6,{settings:PV(e.shorts??NV,e.subtitles.fontId)}),onChange:e=>r({shorts:e})})})]})}function L6({field:e,label:t,tip:n,placeholder:r,step:i,problem:a,value:o,onChange:s}){return(0,h.jsx)(SV,{label:t,tip:n,problem:a,children:({id:t,describedBy:n})=>(0,h.jsx)(Y,{id:t,"data-play-field":e,type:`text`,inputMode:i<1?`decimal`:`numeric`,className:`sl-input--number`,"aria-invalid":a!==void 0,"aria-describedby":n,placeholder:r,value:o,onChange:e=>s(e.target.value)})})}function yge({form:e,update:t}){let n=e.sources.document===`off`;return(0,h.jsxs)($3,{kind:`document`,name:`Document`,dim:n,children:[(0,h.jsx)(e6,{kind:`document`,form:e,update:t}),(0,h.jsx)(`div`,{className:Z3,children:(0,h.jsx)(SV,{label:`Theme`,tip:`play.document-theme`,problem:void 0,children:({id:r})=>(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(W3,{id:r,field:`document.theme`,className:`w-auto min-w-[120px]`,disabled:n,value:e.document,onChange:e=>{t({document:e})}}),(0,h.jsx)(ha,{to:`/document-themes`,className:`text-small text-accent-ink underline`,children:`Edit themes`})]})})})]})}function bge({form:e,providers:t,problem:n,update:r,uses:i,onSettings:a}){let o=[...new Set(i.map(e=>e.label))],s=o.length<=1?o[0]??``:`${o.slice(0,-1).join(`, `)} and ${o.at(-1)??``}`;return(0,h.jsxs)(`section`,{"aria-label":`Text generation`,className:`border-y border-line py-4`,children:[(0,h.jsx)(V,{as:`h3`,title:`Text generation`,meta:`Used for ${s}.`,info:`play.text-generation`,className:`pb-3`,children:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:a,children:`Settings`})}),(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(EV,{field:`llm.provider`,label:`LLM`,tip:`play.llm.provider`,family:`llm`,providers:t,value:e.llm.provider,problem:n(`llm.provider`)??(e.llm.provider===``?n(`llm`):void 0),onPick:e=>r({llm:{provider:e,model:``}})}),(0,h.jsx)(DV,{field:`llm.model`,label:`Text model`,tip:`play.llm.model`,provider:e.llm.provider,value:e.llm.model,problem:n(`llm.model`)??(e.llm.provider!==``&&n(`llm`)?`Pick a text model.`:void 0),onPick:t=>r({llm:{...e.llm,model:t}})}),(0,h.jsx)(y6,{choice:e.llm,onChange:e=>r({llm:e})})]})]})}function R6({section:e,entries:t,...n}){let r=uM(n.form,t);return r[0]?.section===e?(0,h.jsx)(bge,{...n,uses:r}):null}function xge(e){let{form:t,onLibrary:n}=e,r=e.prompts.find(e=>e.kind===Q1(t)&&e.name===t.articlePrompt);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(gge,{...e,titled:!1}),t.sources.article===`generate`?(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 py-3`,children:[r?(0,h.jsxs)(`details`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`summary`,{"data-play-field":`articlePrompt.preview`,className:`cursor-pointer py-2 text-small text-accent-ink`,children:`View prompt`}),(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-words py-3 font-sans text-body text-ink-2`,children:r.body})]}):(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:e.prompts.some(e=>e.kind===Q1(t))?`Choose a saved ${Q1(t)} prompt.`:`No ${Q1(t)} prompts saved. Create a prompt to begin.`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:()=>n(`/prompts`),children:`Create prompt`})]}):(0,h.jsxs)(`p`,{className:`py-3 text-small text-ink-3`,children:[t.provided.article.trim()?t.provided.article.trim().split(/\s+/).length:0,` `,`words · `,t.provided.article.length,` characters`]}),(0,h.jsx)(R6,{...e,section:`article`,onSettings:()=>n(`/settings`)}),t.sources.article===`off`?(0,h.jsx)(`p`,{className:`py-4 text-small text-ink-3`,children:`No article: for a project of images or a thumbnail made from prompts. Narration, the PDF and anything else that reads the article stay off.`}):t.sources.article===`provide`?(0,h.jsx)(`p`,{className:`py-4 text-small text-ink-3`,children:`Research is Off because the article is provided.`}):(0,h.jsx)(hge,{...e})]})}function Sge(){let{api:e}=R(),t=bM(),n=_(),[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)(!1),l=gy(),u=N({queryKey:[`play-drafts`],queryFn:async()=>{let t=await Tj(e);if(!t.ok)throw Error(t.message);return t.value.drafts}}),d=async()=>{if(!r||s)return;let e=r.id;c(!0),o(null);try{await t.discard({id:r.id,version:r.version}),i(null),await n.cancelQueries({queryKey:[`play-drafts`]}),n.setQueryData([`play-drafts`],t=>t?.filter(t=>t.id!==e))}catch(e){let t=e instanceof Error?e.message:`The draft wasn't discarded. Try again.`;o(t),l(t,`error`)}finally{c(!1)}};return(0,h.jsxs)(`section`,{"aria-label":`Drafts`,className:`flex min-w-0 flex-wrap items-center gap-2 text-small`,children:[(0,h.jsx)(`p`,{role:`status`,className:I(`engraved min-w-[112px] text-right`,t.status===`saved`?`text-accent-ink`:t.status===`error`||t.status===`conflict`?`text-danger`:`text-ink-3`),children:{unsaved:`Unsaved`,saving:`Saving…`,saved:`Saved`,error:`Couldn't save`,conflict:`Changed elsewhere`}[t.status]}),t.status===`error`?(0,h.jsx)(L,{variant:`quiet`,onClick:()=>{!t.view&&t.activeId&&t.edited===0?t.open(t.activeId):t.flush()},children:`Retry`}):null,t.status===`conflict`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`quiet`,onClick:()=>{t.activeId&&t.open(t.activeId)},children:`Reload saved draft`}),(0,h.jsx)(L,{variant:`quiet`,onClick:()=>void t.saveAsNew(),children:`Save as a new draft`}),(0,h.jsx)(B,{id:`play.draft-conflict`})]}):null,(0,h.jsxs)(ab,{children:[(0,h.jsx)(ob,{asChild:!0,children:(0,h.jsxs)(L,{variant:`quiet`,children:[`Drafts`,(0,h.jsx)(Cc,{"aria-hidden":`true`,className:`size-4`})]})}),(0,h.jsxs)(sb,{align:`end`,className:`w-[340px] p-0`,"aria-label":`Saved drafts`,children:[u.isPending?(0,h.jsx)(`p`,{role:`status`,className:`px-3 py-2`,children:`Loading drafts…`}):null,u.error?(0,h.jsxs)(`p`,{role:`alert`,className:`px-3 py-2 text-danger`,children:[u.error.message,` `,(0,h.jsx)(L,{variant:`quiet`,onClick:()=>void u.refetch(),children:`Retry`})]}):null,u.data?.length===0?(0,h.jsx)(`p`,{className:`px-3 py-2`,children:`No saved drafts`}):null,a?(0,h.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-danger`,children:a}):null,u.data?.length?(0,h.jsx)(iU,{label:`Saved drafts`,className:`max-h-72 overflow-y-auto border-t-0`,children:u.data.map(e=>(0,h.jsx)(aU,{title:e.title||`Untitled draft`,onSelect:()=>void t.open(e.id),meta:(0,h.jsxs)(`time`,{dateTime:e.updatedAt,children:[`Last edited `,Uu(e.updatedAt)]}),actions:(0,h.jsx)(ly,{size:`small`,label:`Discard ${e.title||`Untitled draft`}`,onClick:()=>{i(e),o(null)},children:(0,h.jsx)($c,{"aria-hidden":`true`})}),children:e.readable?null:(0,h.jsx)(`p`,{className:`m-0 text-label text-waiting`,children:`Unsupported or corrupt draft. Try opening it to recover, or discard it.`})},e.id))}):null]})]}),(0,h.jsx)(L,{onClick:()=>void t.newDraft(),children:`New draft`}),(0,h.jsx)(B,{id:`play.drafts`}),(0,h.jsx)(Dy,{open:r!==null,title:`Discard ${r?.title||`Untitled draft`}?`,consequence:`The draft is removed. This cannot be undone.`,confirmLabel:`Discard draft`,pending:s,onConfirm:()=>void d(),onCancel:()=>{s||i(null)}})]})}function z6(e,t){let n=[...e.querySelectorAll(`[data-play-field]`)].find(e=>e.dataset.playField===t);if(!n||n.hasAttribute(`disabled`))return!1;let r=n.closest(`details`);return r!==null&&!r.open&&(r.open=!0),n.focus(),n.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),document.activeElement===n}function Cge(e,t,n,r=[]){let i=e;if(e===`fontUpload`&&(i=`subtitles.fontUpload`),/^provided\.images\.\d+$/.test(e)&&(i=`provided.images`),e===`subtitles`&&(i=`subtitles.mode`),e===`chunking`&&(i=`chunking.mode`),[`audio`,`llm`,`images`].includes(e)&&(i=`${e}.provider`),e===`provided`){let e=[`audio`,`images`,`thumbnail`].find(e=>t.sources[e]===`provide`&&(e===`images`?t.provided.images:[t.provided[e]]).some(e=>e&&(e.error!==void 0||e.file===void 0))),n=t.provided.shortsMusic;i=e===void 0&&aM(t)&&n!==void 0&&(n.error!==void 0||n.file===void 0)?`shorts.music`:t.reference?.source===`provide`&&t.provided.reference!==void 0&&(t.provided.reference.error!==void 0||t.provided.reference.file===void 0)?`provided.reference`:`provided.${e??`audio`}`;let r=t.provided.ambientBed;e===void 0&&oM(t)&&r!==void 0&&(r.error!==void 0||r.file===void 0)&&(i=`ambientBed.file`)}let a=/^imagePrompts\.(\d+)\.(.+)$/.exec(e);if(a){let e=t.imagePrompts[Number(a[1])];e&&(i=`imagePrompts.${e.name}.${a[2]}`)}e===`imagePrompts`&&(i=t.imagePrompts[0]?`imagePrompts.${t.imagePrompts[0].name}.number`:`imagePrompts`);let o=/^variants\.(\d+)\.(.+)$/.exec(e);o&&(i=`items.${n[Number(o[1])]?.key??o[1]}.${o[2]}`);let s=/^items\.(\d+)\.(.+)$/.exec(e);s&&(i=Number(s[1])===0?s[2]??e:`items.${n[Number(s[1])-1]?.key??s[1]}.${s[2]}`);let c=t=>t.some(t=>e===t||e.startsWith(`${t}.`));return{section:c([`title`,`articlePrompt`,`provided.article`,`provided.research`,`sources.article`,`sources.research`,...(uM(t,r)[0]?.section??`article`)===`article`?[`llm`]:[],`values`])?`content`:c([`format`,`subtitles`,`fontUpload`])?`style`:c(`audio,narrationPrompt,voices,provided.audio,intro,outro,chunking,images,imagePrompts,imageScale,provided.images,thumbnailPrompt,provided.thumbnail,provided.reference,reference,provided,sources,imageSeconds,zoomPercent,motionStyle,edgeSilenceSeconds,document,youtubeDescription,descriptionPrompt,shorts,videoEdit,ambientBed,loudness,sentencePauseSeconds,paragraphPauseSeconds,llm`.split(`,`))?`outputs`:`review`,field:i}}function wge({fields:e,values:t,origins:n,topics:r=[],hide:i=[],problem:a,onChange:o}){let s=e.filter(e=>!i.includes(e.name));return s.length?(0,h.jsxs)(`section`,{"aria-label":`Keywords`,className:`min-w-0`,children:[(0,h.jsx)(`p`,{className:`m-0 mb-3 text-small text-ink-2`,children:`Each keyword is entered once and fills every place that names it.`}),(0,h.jsx)(o0,{keywords:s.map(e=>({name:e.name,value:Object.hasOwn(t,e.name)?t[e.name]??``:``,feeds:n?.get(e.name)??[],topic:r.includes(e.name)})),problem:a,onChange:o})]}):null}var Tge={every:`minutes`,value:`2`};function Ege({document:e,problem:t,onEdit:n}){let r=(0,m.useId)(),{form:i}=e,a=i.imageScale,o=t(`imageScale.value`)??t(`imageScale`),s=a===void 0?void 0:o===void 0?Oge(e):{text:o,problem:!0},c=t=>{let{imageScale:r,...o}=i;n({...e,form:{...o,...t===void 0?{}:{imageScale:t},...t!==void 0&&a===void 0&&i.motionStyle===`zoom`?{motionStyle:`mixed`}:{}}})};return(0,h.jsxs)(`div`,{className:`flex basis-full flex-col items-start gap-2`,children:[(0,h.jsx)(lb,{checked:a!==void 0,label:`More images for long videos`,tip:`play.image-scale`,describedBy:`${r}-line`,onChange:e=>c(e?Tge:void 0)}),a===void 0?null:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-small`,...cb,children:[(0,h.jsx)(ub,{label:`How the rate is given`,tip:`play.image-scale.rate`,value:a.every,options:[{value:`minutes`,label:`Every N minutes`},{value:`hour`,label:`N per hour`}],onChange:e=>c({every:e,value:Dge(a.value,a.every,e)})}),a.every===`minutes`?(0,h.jsx)(`span`,{children:`One image every`}):null,(0,h.jsx)(Y,{id:`${r}-value`,"data-play-field":`imageScale.value`,"aria-label":a.every===`minutes`?`Minutes per image`:`Images per hour`,inputMode:`decimal`,className:`sl-input--number`,"aria-invalid":s?.problem===!0,"aria-describedby":`${r}-line`,value:a.value,onChange:e=>c({every:a.every,value:e.target.value})}),(0,h.jsx)(`span`,{children:a.every===`minutes`?`minutes`:`images per hour`})]}),s===void 0?null:(0,h.jsx)(`p`,{id:`${r}-line`,className:s.problem?`m-0 text-label text-danger`:`m-0 text-label text-ink-3`,children:s.text})]})}function Dge(e,t,n){if(t===n)return e;let r=Number(e.trim());return e.trim()===``||!Number.isFinite(r)||r<=0?e:String(Math.round(60/r*100)/100)}function Oge(e){let{form:t}=e,n=t.imageScale;if(n===void 0)return{text:``,problem:!1};let r=Number(n.value.trim()),i=n.every===`minutes`;if(!(n.value.trim()!==``&&(i?r>=.25&&r<=60:r>=1&&r<=240)))return{text:i?`Enter a number of minutes between ${String(TO)} and 60.`:`Enter a number of images per hour between 1 and 240.`,problem:!0};let a=i?OO(r):r,o=t.sources.article===`provide`,s=Number(e.expectedWords.trim()),c=o?Math.max(1,EO(t.provided.article)):Number.isInteger(s)&&s>=1&&s<=1e5?s:vie,l=t.imagePrompts.map(e=>({name:e.name,number:Math.max(0,Number.parseInt(e.number,10)||0)})),u=l.reduce((e,t)=>e+t.number,0),d={perHour:a,words:c},f=AO({imagePrompts:l,imageScale:d,sources:t.sources}).reduce((e,t)=>e+t,0),p=`about ${String(Math.max(1,Math.round(DO(c))))} minutes (${c.toLocaleString(`en-US`)} words ${o?`in the article`:`expected, set on Review`})`;if(l.length===0)return{text:`For ${p}: tick an image prompt to see the count.`,problem:!1};let m=kO(d)>=240?` That is the most a run makes (240); the images repeat after that.`:``;return{text:f>u?`For ${p}: ${String(f)} images, ${String(f-u)} more than the prompts' ${String(u)}.${m}`:`For ${p}: the prompts' ${String(u)} images already cover it.`,problem:!1}}function kge({document:e,onEdit:t}){let{form:n}=e;return(0,h.jsx)(`div`,{className:`flex basis-full flex-col items-start gap-2`,children:(0,h.jsx)(lb,{checked:n.imageScenes===!0,label:`Scenes from the article`,tip:`play.image-scenes`,onChange:r=>{let{imageScenes:i,...a}=n;t({...e,form:{...a,...r?{imageScenes:!0}:{}}})}})})}function Age(e){return e.upload?(0,h.jsx)(B6,{value:e.value,onPick:e.onPick,upload:e.upload}):(0,h.jsx)(jge,{...e})}function jge({value:e,onPick:t,onUploading:n}){let{api:r}=R(),i=_(),a=P({mutationFn:e=>Lj(r,e),onSuccess:({font:e})=>{i.setQueryData(Fj,t=>({fonts:[...(t?.fonts??[]).filter(t=>t.id!==e.id),e]})),i.invalidateQueries({queryKey:Fj})}}),o=a.isPending,s=(0,m.useRef)(t);s.current=t;let c=(0,m.useRef)(n);return c.current=n,(0,m.useEffect)(()=>{c.current(o)},[o]),(0,m.useEffect)(()=>()=>c.current(!1),[]),(0,h.jsx)(B6,{value:e,onPick:t,upload:{pending:o,error:a.error?.message,pick:e=>a.mutate(e,{onSuccess:({font:e})=>s.current(e.id)})}})}function B6({value:e,onPick:t,upload:n}){let{api:r}=R(),i=(0,m.useId)(),a=(0,m.useId)(),o=N({queryKey:Fj,queryFn:()=>Ij(r),staleTime:6e4}),s=n.pending,c=o.data?.fonts??[],l=e!=="default"&&!c.some(t=>t.id===e);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 basis-full`,...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{htmlFor:i,children:`Subtitle font`}),(0,h.jsx)(B,{id:`project.subtitles.font`,className:`-my-1`})]}),(0,h.jsxs)(pV,{id:i,"data-play-field":`subtitles.fontId`,value:e,disabled:s,onChange:e=>t(e.target.value),className:`text-small`,children:[c.some(e=>e.id==="default")?null:(0,h.jsx)(`option`,{value:`default`,children:`Default font · bundled`}),l?(0,h.jsxs)(`option`,{value:e,children:[e,` · saved font`]}):null,c.map(e=>(0,h.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.source]},e.id))]})]}),(0,h.jsxs)(`div`,{className:`min-w-0 basis-full`,children:[(0,h.jsx)(Y4,{htmlFor:a,className:`mb-1`,children:`Upload font (.ttf or .otf)`}),(0,h.jsx)(`input`,{id:a,"data-play-field":`subtitles.fontUpload`,type:`file`,accept:`.ttf,.otf,font/ttf,font/otf`,disabled:s,className:`w-full text-small text-ink-2 file:mr-2 file:rounded-control file:border file:border-line-strong file:bg-sunken file:px-2 file:py-1 file:text-ink`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&n.pick(t)}})]})]}),s?(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink-2`,children:`Uploading font…`}):null,n.error?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:n.error}):null,l&&o.data?(0,h.jsx)(`p`,{role:`alert`,children:`Saved font is unavailable. Choose another font or upload it again.`}):null,o.error?(0,h.jsxs)(`p`,{role:`alert`,className:`text-small text-danger`,children:[`The font list couldn't be loaded. `,o.error.message]}):null]})}function Mge(e){return e===`9:16`?{width:1080,height:1920}:e===`1:1`?{width:1080,height:1080}:{width:1920,height:1080}}function Nge(e,t){switch(e){case`top`:return{y:60,alignment:8,translateY:0};case`upper-middle`:return{y:t/4,alignment:5,translateY:-50};case`center`:return{y:t/2,alignment:5,translateY:-50};case`lower-middle`:return{y:t*3/4,alignment:5,translateY:-50};case`bottom`:return{y:t-60,alignment:2,translateY:-100}}}function Pge({value:e,format:t,sample:n=`Every story begins with a word.`,backgroundUrl:r,showCaptions:i=!0,maxFrameHeight:a}){let{api:o}=R(),s=Rj(o,e.fontId),c=`subtitle-preview-${(0,m.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,[l,u]=(0,m.useState)(!1);(0,m.useEffect)(()=>{if(typeof FontFace>`u`||!document.fonts)return;let e=!0,t=new FontFace(c,`url(${JSON.stringify(s)})`);return u(!1),t.load().then(t=>{e&&document.fonts.add(t)}).catch(()=>{e&&u(!0)}),()=>{e=!1,document.fonts.delete(t)}},[c,s]);let d=Mge(t),f=Nge(e.position??`bottom`,d.height),p=Number.isFinite(e.fontSize)?Math.max(16,Math.min(120,e.fontSize)):48,g={position:`absolute`,left:`50%`,top:`${f.y/d.height*100}%`,width:`${(d.width-120)/d.width*100}%`,transform:`translate(-50%, ${f.translateY}%)`,fontFamily:`"${c}", sans-serif`,fontSize:`${p/d.width*100}cqw`,lineHeight:1.2,overflowWrap:`anywhere`,WebkitTextStroke:`${2.5/d.width*100}cqw #101010`,paintOrder:`stroke fill`,textShadow:`0 ${100/d.width}cqw ${100/d.width}cqw #000`};return(0,h.jsxs)(`figure`,{className:`min-w-0 self-start`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-label text-ink-2`,children:[(0,h.jsx)(`span`,{children:`Style preview`}),(0,h.jsx)(`span`,{children:t})]}),(0,h.jsxs)(`div`,{role:`img`,"aria-label":`Subtitle style preview`,"data-format":t,"data-position":e.position??`bottom`,className:`sl-media__frame mx-auto w-full text-center text-white`,style:{aspectRatio:`${d.width} / ${d.height}`,maxWidth:t===`9:16`?a?`min(240px, calc((${a}) * 9 / 16))`:240:t===`1:1`?360:480,containerType:`inline-size`},children:[r?(0,h.jsx)(`img`,{src:r,alt:``,className:`absolute inset-0 h-full w-full object-cover`}):null,i?(0,h.jsx)(`span`,{role:`note`,"aria-label":`Caption sample`,style:g,children:n}):null]}),(0,h.jsxs)(`figcaption`,{className:`mt-2 text-label text-ink-3`,children:[d.width,` × `,d.height,` · Preview at reduced scale.`,l?` Font preview unavailable; showing a fallback.`:``]})]})}function V6({value:e,format:t=`16:9`,audioEnabled:n,videoEnabled:r,disabled:i=!1,onChange:a,onUploading:o,problem:s,session:c,fontUpload:l,showPreview:u=!0,illustratedPositions:d=!1,rawFontSize:f}){let p=(0,m.useId)(),g=(0,m.useId)(),_=(0,m.useId)(),v=(0,m.useId)(),[y,b]=(0,m.useState)(!1),x=s?.(`subtitles.fontId`),S=s?.(`subtitles.fontSize`),C=s?.(`subtitles.mode`)??s?.(`subtitles`);return(0,h.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-3`,"aria-label":`Subtitles`,children:[(0,h.jsxs)(`fieldset`,{disabled:i||!n,className:`flex min-w-0 flex-col gap-3 disabled:opacity-60`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{htmlFor:p,children:`Subtitles`}),(0,h.jsx)(B,{id:`project.subtitles.mode`,className:`-my-1`})]}),(0,h.jsxs)(`select`,{id:p,"data-play-field":`subtitles.mode`,value:n?e.mode:`off`,disabled:l?.pending??y,"aria-describedby":_,"aria-invalid":C!==void 0,onChange:t=>a({...e,mode:t.target.value}),className:`h-8 w-full rounded-control border border-line-strong bg-raised px-3 text-small text-ink`,children:[(0,h.jsx)(`option`,{value:`off`,children:`Off`}),(0,h.jsx)(`option`,{value:`files`,children:`Subtitle files (.srt + .vtt)`}),(0,h.jsx)(`option`,{value:`burn-in`,disabled:!r,children:`Burn into video + files`})]})]}),(0,h.jsx)(`span`,{className:`pb-1 text-label text-ink-3`,children:`English · local · no paid API`})]}),e.mode!==`off`&&n?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`Timed from your narration on this computer. First use downloads an approximately 95 MB speech model. Review the subtitles before publishing.`}),(0,h.jsxs)(`div`,{className:`grid items-start gap-5`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 240px), 1fr))`},children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(Age,{...l?{upload:l}:{},value:e.fontId,onPick:t=>c?c.selectFont(t):a({...e,fontId:t}),onUploading:e=>{b(e),o?.(e)}}),(0,h.jsxs)(`div`,{className:d?`w-full`:`max-w-[180px]`,...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{htmlFor:g,children:`Subtitle font size`}),(0,h.jsx)(B,{id:`project.subtitles.size`,className:`-my-1`})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-5`,children:[d?(0,h.jsx)(`input`,{"aria-label":`Subtitle font size slider`,type:`range`,min:16,max:120,step:1,value:Math.max(16,Math.min(120,Number.isFinite(e.fontSize)?e.fontSize:48)),className:`min-w-0 flex-1 accent-accent`,onChange:t=>f?f.onChange(t.target.value):a({...e,fontSize:Number(t.target.value)})}):null,(0,h.jsx)(Y,{className:d?`w-20`:void 0,id:g,"data-play-field":`subtitles.fontSize`,type:`number`,min:16,max:120,step:1,value:f?.value??e.fontSize,"aria-invalid":!rM(e)||S!==void 0,onChange:t=>f?f.onChange(t.target.value):a({...e,fontSize:Number(t.target.value)})})]}),!rM(e)||S?(0,h.jsx)(`p`,{role:`alert`,className:`mt-1 text-label text-danger`,children:S??`Choose a whole font size from 16 to 120.`}):null]}),(0,h.jsxs)(`div`,{...cb,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{htmlFor:d?void 0:v,id:`${v}-label`,children:`Subtitle position`}),(0,h.jsx)(B,{id:`project.subtitles.position`,className:`-my-1`})]}),d?(0,h.jsx)(X4,{type:`single`,"aria-labelledby":`${v}-label`,value:e.position??`bottom`,onValueChange:t=>{let n=VA.find(e=>e===t);n&&a({...e,position:n})},className:`grid w-full grid-cols-5 gap-2 overflow-visible border-0`,children:VA.map((t,n)=>(0,h.jsxs)(Z4,{value:t,"aria-label":t,"data-play-field":(e.position??`bottom`)===t?`subtitles.position`:void 0,className:`flex min-w-0 flex-col items-center gap-2 rounded-control border border-line-strong bg-surface px-1 py-3 text-[10px] last:border-r data-[state=on]:border-focus data-[state=on]:text-accent-ink data-[state=on]:shadow-none`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`relative block h-11 w-7 rounded-[2px] border border-current`,children:(0,h.jsx)(`span`,{className:`absolute left-1 right-1 h-[3px] bg-current`,style:{top:`${8+n*20}%`}})}),(0,h.jsxs)(`span`,{children:[t[0]?.toUpperCase(),t.slice(1)]})]},t))}):(0,h.jsx)(`select`,{id:v,"data-play-field":`subtitles.position`,value:e.position??`bottom`,onChange:t=>{let n=VA.find(e=>e===t.target.value);n&&a({...e,position:n})},className:`h-8 w-full rounded-control border border-line-strong bg-raised px-3 text-small text-ink`,children:VA.map(e=>(0,h.jsxs)(`option`,{value:e,children:[e[0]?.toUpperCase(),e.slice(1)]},e))})]})]}),u?(0,h.jsx)(Pge,{value:e,format:t,...c?{sample:c.previewText}:{}}):null]}),c?.fontUpload&&!c.fontUploading?(0,h.jsxs)(`p`,{role:`alert`,children:[`Reattach `,c.fontUpload.name,`, or select a font.`]}):null,x?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:x}):null,e.mode===`files`?(0,h.jsx)(`p`,{className:`text-label text-ink-3`,children:`Font, size and position apply to burned captions. SRT/VTT players choose their own styling.`}):null]}):null]}),c?.fontUpload&&(e.mode===`off`||!n)?(0,h.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,h.jsx)(`p`,{role:c.fontUploading?`status`:`alert`,className:`text-small text-ink-2`,children:c.fontUploading?`Uploading ${c.fontUpload.name}…`:`Unfinished font upload: ${c.fontUpload.name}`}),l?.error?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:l.error}):null,(0,h.jsx)(L,{"data-play-field":`subtitles.fontUpload`,disabled:i,onClick:()=>c.selectFont(e.fontId),children:`Keep current font`})]}):null,C?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:C}):null,(0,h.jsx)(`p`,{id:_,className:`text-small text-ink-2`,children:n?r?`Optional: download subtitles separately or keep them visible in the video.`:`Audio exports support separate subtitle files. Enable Video to burn captions into an MP4.`:`Turn Audio on to add subtitles.`})]})}function H6({value:e,onPick:t}){let n=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`w-full`,...cb,children:[(0,h.jsxs)(`span`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(Y4,{id:n,children:`Frame format`}),(0,h.jsx)(B,{id:`play.format`,className:`-my-1`})]}),(0,h.jsx)(X4,{type:`single`,value:e,"aria-labelledby":n,className:`w-full max-w-[560px] gap-3 overflow-visible border-0`,onValueChange:e=>{let n=sS.find(t=>t===e);n!==void 0&&t(n)},children:sS.map(t=>(0,h.jsxs)(Z4,{value:t,"data-play-field":e===t?`format`:void 0,"aria-label":t,className:`flex h-28 min-w-0 flex-1 items-center justify-center gap-4 rounded-control border border-line-strong bg-surface p-3 last:border-r data-[state=on]:border-focus data-[state=on]:shadow-none`,children:[(0,h.jsx)(`span`,{className:`flex h-12 items-center justify-center`,"aria-hidden":`true`,children:(0,h.jsx)(`span`,{"data-format-shape":t,className:`block rounded-[2px] border-2 border-current`,style:{width:t===`16:9`?64:t===`1:1`?40:27,aspectRatio:t.replace(`:`,` / `)}})}),(0,h.jsxs)(`span`,{className:`text-left`,children:[(0,h.jsx)(`span`,{className:`block text-body font-semibold`,children:t}),(0,h.jsx)(`span`,{className:`text-label text-ink-3`,children:t===`16:9`?`Landscape`:t===`1:1`?`Square`:`Portrait`})]})]},t))})]})}function Fge({problem:e}){let t=bM(),{document:n}=t,{form:r}=n,i=e=>t.edit({...n,form:{...r,subtitles:{...e,fontSize:r.subtitles.fontSize}}});return(0,h.jsxs)(`div`,{"data-tour":`play-subtitles`,className:`flex min-w-0 flex-col gap-4 py-4`,children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`See frame and caption changes in the preview as you go.`}),(0,h.jsx)(H6,{value:r.format,onPick:e=>t.edit({...n,form:{...r,format:e}})}),(0,h.jsx)(`div`,{className:`border-t border-line pt-4`,children:(0,h.jsx)(V6,{showPreview:!1,illustratedPositions:!0,fontUpload:t.fontUpload,session:{previewText:n.previewText,fontUploading:t.fontUploading,fontUpload:n.fontUpload,selectFont:t.selectFont,uploadSubtitleFont:t.uploadSubtitleFont},value:{...r.subtitles,fontSize:Number(r.subtitles.fontSize)},rawFontSize:{value:r.subtitles.fontSize,onChange:e=>t.edit({...n,form:{...r,subtitles:{...r.subtitles,fontSize:e}}})},format:r.format,audioEnabled:r.sources.audio!==`off`,videoEnabled:r.sources.video===`generate`&&r.sources.images!==`off`,onChange:i,problem:e})}),(0,h.jsx)(uV,{label:`Preview text`,tip:`play.preview-text`,className:`border-t border-line pt-4`,children:(0,h.jsx)(Y,{value:n.previewText,onChange:e=>t.edit({...n,previewText:e.target.value})})})]})}function Ige(e){let t=bM(),n=t.document,r=V3(),i=H3(),{form:a,entries:o,problem:s,update:c}=e;return(0,h.jsx)(nge,{...e,titled:!1,cast:r,language:i,rawCounts:{...n.form.chunking,onChange:(e,r)=>t.edit({...n,form:{...n.form,chunking:{...n.form.chunking,mode:e,...e===`words`?{words:r}:e===`characters`?{characters:r}:{}}}})},advanced:(0,h.jsxs)(h.Fragment,{children:[[`intro`,`outro`].map(e=>(0,h.jsx)(CV,{field:e,label:e===`intro`?`Intro`:`Outro`,tip:e===`intro`?`play.intro`:`play.outro`,value:a[e],placeholder:`Off`,options:o.filter(t=>t.category===e).map(e=>({value:e.name,label:e.name})),problem:s(e),onPick:t=>c({[e]:t})},e)),(0,h.jsx)(`div`,{className:`col-span-full flex flex-wrap gap-2`,children:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:e.onSettings,children:`Settings`})}),(0,h.jsx)(`div`,{className:`col-span-full empty:hidden`,children:(0,h.jsx)(R6,{...e,section:`narration`,onSettings:e.onSettings})})]})})}function Lge(e){let t=bM(),n=t.document;return(0,h.jsx)(rge,{...e,titled:!1,more:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Ege,{document:n,problem:e.problem,onEdit:t.edit}),n.form.sources.article===`off`?null:(0,h.jsx)(kge,{document:n,onEdit:t.edit})]}),rawNumbers:{values:n.form.imagePrompts,onChange:(e,r)=>t.edit({...n,form:{...n.form,imagePrompts:n.form.imagePrompts.map(t=>t.name===e?{...t,number:r}:t)}})}})}function Rge(e){let t=bM(),n=t.document,r=H3();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(vge,{...e,titled:!1,extras:!1,language:r,rawTiming:{imageSeconds:n.form.imageSeconds,zoomPercent:n.form.zoomPercent,edgeSilenceSeconds:n.form.edgeSilenceSeconds,onChange:(e,r)=>t.edit({...n,form:{...n.form,[e]:r}})}}),n.form.sources.audio===`off`?null:(0,h.jsx)(`div`,{className:`sl-fields border-b border-line py-4`,children:(0,h.jsx)(L6,{field:`silenceGapSeconds`,label:`Silence between segments (seconds)`,tip:`play.silence-gap`,placeholder:String(e.silenceGapSeconds),step:.1,problem:e.problem(`silenceGapSeconds`),value:n.form.silenceGapSeconds??``,onChange:e=>{let{silenceGapSeconds:r,...i}=n.form;t.edit({...n,form:e.trim()===``?i:{...i,silenceGapSeconds:e}})}})}),(0,h.jsx)(Fge,{problem:e.problemOf})]})}function zge(e){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(R6,{...e,section:`outputs`,onSettings:e.onSettings}),(0,h.jsx)(_ge,{...e}),(0,h.jsx)(`section`,{className:`border-b border-line py-4`,children:(0,h.jsx)(I6,{form:e.form,prompts:e.prompts,problem:e.problem,update:e.update,onPickFiles:e.onPickFiles,onRemoveFile:e.onRemoveFile,...e.onReattachFile===void 0?{}:{onReattachFile:e.onReattachFile}})}),e.form.sources.article===`off`?null:(0,h.jsx)(yge,{...e})]})}function U6(e,t){if(t===void 0||t.length===0||e.trim()===``)return[];let n=[];for(let[r,i]of t.entries()){let t=1/0;for(let n of[i.name,...i.aliases]){let r=Bge(e,n);r!==void 0&&r<t&&(t=r)}Number.isFinite(t)&&n.push({member:i,at:t,order:r})}return n.sort((e,t)=>e.at-t.at||e.order-t.order).map(e=>e.member)}function Bge(e,t){let n=t.trim().split(/\s+/u).filter(Boolean);if(n.length===0)return;let r=RegExp(`(?<![\\p{L}\\p{N}])${n.map(Vge).join(`\\s+`)}(?![\\p{L}\\p{N}])`,`iu`).exec(e);return r===null?void 0:r.index}function Vge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Hge(e,t){let n=e.provided.reference?.file;if(e.sources.images===`generate`&&e.reference?.source===`provide`&&n!==void 0)return{image:{kind:`upload`,stagedFileId:n.id},drawnOn:`the establishing image`};let r=t.flatMap(e=>{let t=e.images.find(e=>e.state===`ready`&&e.sha256!==null);return t?.sha256?[{...e,images:[t.sha256]}]:[]}),i=U6([e.title,...Object.values(e.values)].join(` `),r)[0]??r[0],a=i?.images[0];if(i!==void 0&&a!==void 0)return{image:{kind:`picture`,sha256:a},drawnOn:`${i.name}'s picture`}}function Uge({selected:e,reviewed:t}){let n=e=>U3.find(t=>t.stage===e)?.label??e;return e?.length?(0,h.jsxs)(`div`,{className:`space-y-3 text-body`,children:[t?.length?t.map(e=>(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`p`,{className:`font-medium`,children:[`Run `,e.runIndex+1,` · Before `,n(e.stage)]}),(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:e.dependents.length?`Also holds: ${e.dependents.map(n).join(`, `)}.`:`No dependent steps.`})]},`${e.runIndex}-${e.checkpointId}`)):(0,h.jsxs)(`p`,{children:[`Selected: `,e.map(e=>`Before ${n(e)}`).join(`, `),`. Refresh review to confirm dependent steps.`]}),(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`Approval required on the project page. Starting this run does not approve these checkpoints.`})]}):(0,h.jsx)(`p`,{className:`text-body text-ink-2`,children:`No review checkpoints selected.`})}function Wge({estimates:e}){let t=e.reduce((e,t)=>e+t.low,0),n=e.reduce((e,t)=>e+t.high,0),r=e.reduce((e,t)=>e+t.unknown,0),i=e[0]?.rows.map((t,n)=>({...t,low:e.some(e=>e.rows[n]?.low===null)?null:e.reduce((e,t)=>e+(t.rows[n]?.low??0),0),high:e.some(e=>e.rows[n]?.high===null)?null:e.reduce((e,t)=>e+(t.rows[n]?.high??0),0),apiLow:e.some(e=>e.rows[n]?.onPlan===!0&&e.rows[n]?.apiLow==null)?null:e.reduce((e,t)=>e+(t.rows[n]?.apiLow??0),0),apiHigh:e.some(e=>e.rows[n]?.onPlan===!0&&e.rows[n]?.apiHigh==null)?null:e.reduce((e,t)=>e+(t.rows[n]?.apiHigh??0),0)}))??[],a=e.some(e=>e.apiLow!==void 0),o=e.reduce((e,t)=>e+(t.apiLow??0),0),s=e.reduce((e,t)=>e+(t.apiHigh??0),0),c=e.reduce((e,t)=>e+(t.apiUnknown??0),0);return e.length===0?(0,h.jsx)(`div`,{}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{className:`m-0 text-title-2 font-semibold`,children:[r?`Known subtotal: `:`Estimated total: `,W6(t,n)]}),r?(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Plus `,r,` stage charge`,r===1?``:`s`,` with unavailable pricing.`]}):null,(0,h.jsxs)(`details`,{className:`rounded-control border border-line px-3`,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer items-center text-small text-ink-2`,children:[`Cost by stage · `,i.length,` `,i.length===1?`stage`:`stages`]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 pt-1 pb-3`,children:[a?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:o===0&&s===0?`CLI steps: $0 on your plan · no API price is listed for their models.`:`CLI steps: $0 on your plan · ~${W6(o,s)} via API${c?` (plus ${String(c)} with no API price)`:``}.`}):null,(0,h.jsx)(`ul`,{"aria-label":`Cost by stage`,className:`m-0 list-none divide-y divide-line p-0`,children:i.map(e=>(0,h.jsxs)(`li`,{className:`py-2`,children:[(0,h.jsxs)(`div`,{className:`flex justify-between gap-4 text-small`,children:[(0,h.jsx)(`span`,{children:e.stage}),(0,h.jsx)(`span`,{className:`text-right tabular-nums`,children:e.onPlan===!0?e.apiLow===null||e.apiHigh===null?`$0 on your plan · API price unknown`:`$0 on your plan · ~${W6(e.apiLow,e.apiHigh)} via API`:e.low===null||e.high===null?`Unknown`:W6(e.low,e.high)})]}),(0,h.jsx)(`p`,{className:`m-0 mt-0.5 text-label text-ink-3`,children:e.detail})]},e.stage))}),[...new Set(e.flatMap(e=>e.assumptions))].map(e=>(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e},e)),(0,h.jsxs)(`p`,{className:`m-0 text-label text-ink-3`,children:[`Catalogue verified `,e[0]?.catalogueDate??`date unavailable`,`. Batch rows show combined costs.`]})]})]})]})}function W6(e,t){let n=e=>e===0?`$0`:e<.01?`<$0.01`:`$${e.toFixed(2)}`;return e===t?n(e):`${n(e)} – ${n(t)}`}function G6(e){let t=bk(vk(e)),n=new Map(bk(dk)),r=t.filter(([e,t])=>e!==`Cuts`&&n.get(e)!==t).map(([e,t])=>e===`Animate images`?`Animated images: ${t} (paid)`:e===`Chapter cards`?`Chapter cards`:e===`Transition`?t:`${e}: ${t}`);return r.length===0?`Plain cuts, no effects`:r.join(` · `)}function Gge(e){return e===void 0?{ok:!1,text:`Provider status unavailable`}:e.readiness.kind===`cli`?KM(e.readiness)?{ok:!0,text:e.readiness.version===void 0?`CLI ready`:`CLI ready · ${e.readiness.version}`}:{ok:!1,text:e.readiness.issue??`CLI not found`}:e.readiness.kind===`local`?e.readiness.available?{ok:!0,text:`Built-in voice · ${e.readiness.engine??`ready`}`}:{ok:!1,text:e.readiness.issue??`No speech program found`}:e.readiness.hasKey?{ok:!0,text:`API key saved`}:{ok:!1,text:`API key missing`}}function Kge(e,t){let n=e.sources.audio===`generate`,r=[`from_prompt`,`prompt_by_llm`].includes(e.sources.thumbnail);return[...(e.sources.article===`generate`||e.sources.thumbnail===`prompt_by_llm`||Kk(e)||aM(e)||n&&[`intro`,`outro`].some(n=>t.some(t=>t.category===n&&t.name===e[n]&&t.mode===`llm`)))&&e.llm?[{field:`llm.provider`,family:`llm`,label:`Text generation`,provider:e.llm.provider,model:e.llm.model}]:[],...n&&e.audio?[{field:`audio.provider`,family:`tts`,label:`Narration`,provider:e.audio.provider,model:e.audio.model,voice:e.audio.voice}]:[],...(e.sources.images===`generate`||r||aM(e)||yk(e))&&e.images?[{field:`images.provider`,family:`image`,label:`Images`,provider:e.images.provider,model:e.images.model}]:[]]}function K6({name:e,children:t}){return(0,h.jsxs)(`section`,{"aria-label":`${e} summary`,className:`min-w-0 border-t border-line pt-5`,children:[(0,h.jsx)(`h3`,{className:`mb-4 font-semibold`,children:e}),t]})}function qge({form:e,entries:t,providers:n,voices:r,textModels:i,audioModels:a,imageModels:o,onReveal:s}){let c=Kge(e,t);if(!c.length)return(0,h.jsx)(K6,{name:`Run readiness`,children:(0,h.jsx)(`p`,{className:`text-body text-ink-2`,children:`No generated providers required. Supplied content is ready for processing.`})});let l={llm:i,tts:a,image:o};return(0,h.jsxs)(K6,{name:`Run readiness`,children:[(0,h.jsx)(`p`,{className:`mb-3 text-small text-ink-2`,children:`These checks are refreshed with Review and checked again when you start.`}),(0,h.jsx)(`ul`,{className:`divide-y divide-line`,"aria-label":`Run readiness checks`,children:c.map(e=>{let t=n?.find(t=>t.id===e.provider&&t.family===e.family),i=Gge(t),a=l[e.family],o=a?.models.find(t=>t.id===e.model),c=a===void 0?{ok:!0,text:`Model checked at Start`}:o!==void 0||a.allowsCustom?{ok:!0,text:`Model available`}:{ok:!1,text:`Model unavailable`},u=e.voice===void 0?void 0:r===void 0?{ok:!1,text:`Voice list unavailable`}:r.some(t=>t.provider===e.provider&&t.voiceId===e.voice)?{ok:!0,text:`Voice saved`}:{ok:!1,text:`Voice missing`},d=[i,c,...u?[u]:[]],f=d.every(e=>e.ok);return(0,h.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 py-3`,children:[(0,h.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,h.jsx)(`span`,{className:f?`text-lime`:`text-danger`,children:f?`Ready`:d.filter(e=>!e.ok).map(e=>e.text).join(` · `)}),f?null:(0,h.jsx)(L,{variant:`quiet`,onClick:()=>s(e.field),children:`Edit ↗`})]},`${e.family}:${e.provider}`)})})]})}function Jge({fields:e,onReveal:t,children:n}){let{document:r,review:i}=bM(),{form:a}=r,{api:o}=R(),s=_(),c=s.getQueryData(Xy(o).queryKey),l=s.getQueryData($y(o).queryKey),u=s.getQueryData(Zy(o).queryKey),d=s.getQueryData(Fj),f=s.getQueryData(gV(a.llm.provider)),p=s.getQueryData(gV(a.audio.provider)),m=s.getQueryData(gV(a.images.provider)),g=a.sources.audio===`generate`,v=[`from_prompt`,`prompt_by_llm`].includes(a.sources.thumbnail),y=a.sources.article===`generate`||a.sources.thumbnail===`prompt_by_llm`||Kk(a)||aM(a)||g&&[`intro`,`outro`].some(e=>l?.entries.some(t=>t.category===e&&t.name===a[e]&&t.mode===`llm`)),b=e=>c?.providers.find(t=>t.id===e)?.displayName??e,x=(e,n,r)=>(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[90px_minmax(0,1fr)_auto] items-start gap-x-3 py-1 sm:grid-cols-[145px_minmax(0,1fr)_auto]`,children:[(0,h.jsx)(`dt`,{className:`break-words py-2 text-ink-2`,children:e}),(0,h.jsx)(`dd`,{className:`min-w-0 whitespace-pre-wrap break-words py-2`,children:r||`Not selected`}),n?(0,h.jsx)(`dd`,{children:(0,h.jsx)(L,{variant:`quiet`,"aria-label":`Edit ${e}`,onClick:()=>t(n),children:`Edit ↗`})}):null]},n??e),S=a.chunking.mode===`words`||a.chunking.mode===`characters`?a.chunking.mode:null;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(qge,{form:a,entries:l?.entries??[],providers:c?.providers,voices:u?.voices,textModels:f,audioModels:p,imageModels:m,onReveal:t}),(0,h.jsxs)(K6,{name:`Content`,children:[(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Project`,`title`,a.title||`Untitled run`),x(`Article`,`sources.article`,cM[a.sources.article]),a.sources.article===`generate`?x(`Article prompt`,`articlePrompt`,a.articlePrompt):x(`Article text`,`provided.article`,`Your article`),a.sources.article===`generate`?x(`Research`,`sources.research`,cM[a.sources.research]):x(`Research`,null,`Off · Article is provided`),a.sources.research===`provide`&&a.sources.article===`generate`?x(`Research text`,`provided.research`,a.provided.research):null,y?(0,h.jsxs)(h.Fragment,{children:[x(`Text provider`,`llm.provider`,b(a.llm.provider)),x(`Text model`,`llm.model`,f?.models.find(e=>e.id===a.llm.model)?.name??a.llm.model),a.llm.thinking||f?.models.find(e=>e.id===a.llm.model)?.thinkingModes?.length?x(`Thinking`,`llm.thinking`,a.llm.thinking??`Model default`):null]}):null,e.map(({name:e})=>x(e,`values.${e}`,a.values[e]??``))]}),n]}),(0,h.jsx)(K6,{name:`Outputs`,children:(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Narration`,`sources.audio`,cM[a.sources.audio]),g?(0,h.jsxs)(h.Fragment,{children:[x(`Audio provider`,`audio.provider`,b(a.audio.provider)),x(`Audio model`,`audio.model`,p?.models.find(e=>e.id===a.audio.model)?.name??a.audio.model),x(`Voice`,`audio.voice`,u?.voices.find(e=>e.provider===a.audio.provider&&e.voiceId===a.audio.voice)?.name??a.audio.voice),x(`Chunking`,S?`chunking.${S}`:`chunking.mode`,S?`Every ${a.chunking[S]||`(not entered)`} ${S}`:a.chunking.mode===`whole`?`Whole text`:`Paragraph`),x(`Intro`,`intro`,a.intro||`Off`),x(`Narration Preparation`,`narrationPrompt`,a.narrationPrompt?`${a.narrationPrompt} · One LLM call per narration chunk and entry`:`Off`),x(`Outro`,`outro`,a.outro||`Off`)]}):null,a.sources.audio===`provide`?x(`Narration file`,`provided.audio`,a.provided.audio?.name):null,x(`Images`,`sources.images`,cM[a.sources.images]),a.sources.images===`generate`||v||aM(a)?(0,h.jsxs)(h.Fragment,{children:[x(`Image provider`,`images.provider`,b(a.images.provider)),x(`Image model`,`images.model`,m?.models.find(e=>e.id===a.images.model)?.name??a.images.model),a.images.thinking===void 0?null:x(`Image effort`,`images.thinking`,a.images.thinking)]}):null,a.sources.images===`generate`&&a.reference!==void 0&&a.reference.source!==`off`?x(`Establishing image`,a.reference.source===`prompt`?`reference.prompt`:`provided.reference`,`${a.reference.source===`prompt`?a.reference.prompt||`(no prompt picked)`:a.provided.reference?.name??`(no file attached)`}${a.reference.thumbnail?` · thumbnail too`:``}`):null,a.sources.images===`generate`?a.imagePrompts.length?a.imagePrompts.map((e,t)=>x(e.name,`imagePrompts.${t}.number`,`${e.name} · ${e.number||`(not entered)`} images`)):x(`Image prompts`,`imagePrompts`,`None selected`):null,a.sources.images===`provide`?x(`Image files`,`provided.images`,a.provided.images.length?(0,h.jsx)(`ol`,{className:`list-inside list-decimal`,children:a.provided.images.map(e=>(0,h.jsx)(`li`,{children:e.name},e.attachmentId))}):`No files selected`):null,x(`Thumbnail`,`sources.thumbnail`,cM[a.sources.thumbnail]),v?x(`Thumbnail prompt`,`thumbnailPrompt`,a.thumbnailPrompt):null,a.sources.thumbnail===`provide`?x(`Thumbnail file`,`provided.thumbnail`,a.provided.thumbnail?.name):null,x(`Video`,`sources.video`,cM[a.sources.video]),a.sources.video===`generate`?x(`Seconds per image`,`imageSeconds`,a.imageSeconds||`(not entered)`):null,a.sources.video===`generate`?x(`Zoom`,`zoomPercent`,a.zoomPercent?`${a.zoomPercent}%`:`(not entered)`):null,a.sources.video===`generate`?x(`Motion`,`motionStyle`,Fk[a.motionStyle]):null,a.sources.video===`generate`?x(`Cuts`,`videoEdit.cuts`,fk[vk(a).cuts]):null,a.sources.video===`generate`?x(`Look`,`videoEdit`,G6(a)):null,a.sources.audio===`off`?null:x(`Silence at start and end`,`edgeSilenceSeconds`,a.edgeSilenceSeconds?`${a.edgeSilenceSeconds} s`:`(not entered)`),a.sources.audio===`off`?null:x(`YouTube description`,`youtubeDescription`,a.youtubeDescription===!0?`${a.descriptionPrompt||`Built-in`} prompt · One LLM call after subtitle timing`:`Off`),a.sources.audio===`off`?null:x(`Shorts`,`shorts.enabled`,aM(a)&&a.shorts!==void 0?[`${a.shorts.count} shorts of ${a.shorts.minSeconds}-${a.shorts.maxSeconds} s`,`${a.shorts.prompt||`Built-in`} prompt`,`${a.shorts.imagePrompt||`Built-in`} image style`,...Yge(a.shorts,a.provided.shortsMusic?.name),`Vertical images and renders after subtitle timing`].join(` · `):`Off`),x(`Document`,`sources.document`,dS(a.sources,`document`)===`generate`?`PDF · ${CS(a.document)} theme`:cM.off)]})}),(0,h.jsxs)(K6,{name:`Checkpoints`,children:[(0,h.jsx)(Uge,{selected:a.checkpoints,reviewed:i.valid?i.receipt?.checkpointSet:void 0}),(0,h.jsx)(L,{variant:`quiet`,"aria-label":`Edit checkpoints`,onClick:()=>t(`checkpoints`),children:`Edit checkpoints ↗`})]}),(0,h.jsxs)(K6,{name:`Style`,children:[(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Frame`,`format`,a.format),a.sources.audio===`off`?x(`Subtitles`,null,`Off · Audio is Off`):x(`Subtitles`,`subtitles.mode`,a.subtitles.mode),a.sources.audio!==`off`&&a.subtitles.mode!==`off`?(0,h.jsxs)(h.Fragment,{children:[x(`Subtitle font`,`subtitles.fontId`,d?.fonts.find(e=>e.id===a.subtitles.fontId)?.name??a.subtitles.fontId),x(`Subtitle size`,`subtitles.fontSize`,`${a.subtitles.fontSize||`(not entered)`} px`),x(`Subtitle position`,`subtitles.position`,a.subtitles.position)]}):null]}),a.sources.audio!==`off`&&a.subtitles.mode===`files`?(0,h.jsx)(`p`,{className:`mt-3 text-small text-ink-2`,children:`Font, size and position apply to burned captions. SRT/VTT players choose their own styling.`}):null]})]})}function Yge(e,t){let n=ZO(e),r=n.speed,i=n.musicVolume;return[...n.titleOnScreen===!0?[`Title on screen`]:[],...r!==void 0&&r!==1?[`${r.toFixed(2)}× speed`]:[],...t===void 0?i!==void 0&&i!==15?[`Music at ${String(i)}% once added in Edit project`]:[]:[`Music: ${t} at ${String(i??15)}%`],...n.fullVideoLink===void 0?[]:[`Links ${n.fullVideoLink}`]]}function Xge({fields:e,errors:t,onReveal:n,problem:r}){let i=bM(),{document:a,review:o}=i,s=a.form;(0,m.useEffect)(()=>{i.reviewDraft()},[i.reviewDraft]);let c=o.valid?o.receipt?.runs??[]:[];return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,h.jsx)(`p`,{className:`m-0 text-body text-ink-2`,children:`Everything this run will do, the checkpoints it stops at and the reviews it runs. The estimate and the Play key stay in the right rail.`}),t.length?(0,h.jsx)(`ul`,{"aria-label":`Setup errors`,className:`text-small text-danger`,children:t.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(L,{variant:`quiet`,onClick:()=>n(e.field),children:e.message})},`${e.field}-${e.message}`))}):null,(0,h.jsx)(Ohe,{problem:r}),(0,h.jsx)(kV,{problem:r}),(0,h.jsx)(Jge,{fields:e,onReveal:n,children:(0,h.jsxs)(`details`,{className:`mt-5 border-t border-line py-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-small`,children:s.sources.article===`provide`?`Read the supplied article and resolved prompts`:`Read the resolved prompt`}),c.length?c.map((e,t)=>(0,h.jsxs)(`div`,{className:`mt-4`,children:[(0,h.jsx)(`h4`,{className:`font-medium`,children:e.draft.title}),e.draft.sources.article===`provide`?(0,h.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words text-body`,children:e.draft.provided.article}):null,Object.entries(e.rendered).map(([e,t])=>(0,h.jsxs)(`div`,{className:`mt-3`,children:[(0,h.jsx)(`h5`,{className:`text-small text-ink-2`,children:e}),(0,h.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-body`,children:t})]},e))]},a.variants[t-1]?.id??i.activeId)):(0,h.jsx)(`p`,{className:`mt-3 text-small text-ink-2`,children:`Refresh review to read the exact resolved inputs.`})]})})]})}function Zge(e,t,n){return[...R3(e).map(e=>(t[e]??``).trim()===``?`${e} is left empty in the template.`:`${e} is left empty in the template (this video's ${e}, "${t[e]}", is not saved).`),...n>0?[`The ${n===1?`other video`:`${String(n)} other videos`} queued here ${n===1?`is`:`are`} not saved.`]:[]]}function Qge({open:e,onClose:t}){let{api:n}=R(),r=_(),i=bM(),a=gy(),o=N(Nq(n)),[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(null),[d,f]=(0,m.useState)(!1),p=(0,m.useRef)(null),{document:g}=i,v=Zge(g.form.title,g.form.values,g.variants.length),y=()=>{u(null),t()},b=async()=>{let e=s.trim();if(!(e===``||d)){f(!0),u(null);try{if(!await i.flush()){u(`Your draft wasn't saved, so the template wasn't either. Press Retry beside Drafts, then Save template again.`);return}p.current?.name!==e&&(p.current={name:e,id:crypto.randomUUID()});let s=o.data?.find(e=>e.id===g.templateSource?.id),l=g.channelId??(s?Y1(s):void 0),d=whe(g),f=await Fq(n,{id:p.current.id,name:e,document:l===void 0?d:{...d,channelId:l}});if(!f.ok){p.current=null,u(`The template wasn't saved. ${f.message}`);return}p.current=null,c(``),a(`Template "${e}" saved.`,`success`),await r.invalidateQueries({queryKey:Oq}),t()}catch(e){u(`The template wasn't saved. ${e instanceof Error?e.message:`Press Save template again.`}`)}finally{f(!1)}}};return(0,h.jsx)(Ey,{open:e,onOpenChange:e=>{e||y()},title:`Save as template`,description:`Keeps this setup's prompts, voice, images, style, outputs and reviews to start the next video from.`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:`secondary`,onClick:y,children:`Cancel`}),(0,h.jsx)(L,{variant:`primary`,disabled:s.trim()===``||d,disabledReason:d?`Saving the template`:`Name the template first`,onClick:()=>void b(),children:`Save template`})]}),children:(0,h.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,h.jsx)(uV,{label:`Template name`,tip:`play.template-name`,children:(0,h.jsx)(Y,{autoFocus:!0,value:s,maxLength:120,placeholder:g.form.title.replace(/\{\{[^}]*\}\}/g,``).trim()||`My setup`,onChange:e=>c(e.target.value)})}),v.length?(0,h.jsx)(`ul`,{"aria-label":`Left out of the template`,className:`m-0 flex list-none flex-col gap-1 p-0 text-small text-ink-2`,children:v.map(e=>(0,h.jsx)(`li`,{children:e},e))}):(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Every keyword keeps its value: the title names none.`}),l?(0,h.jsx)(pP,{tone:`danger`,title:l}):null]})})}var $ge=new Set([`a`,`an`,`the`,`of`,`and`,`or`,`in`,`on`,`to`,`for`,`with`,`vs`,`s`]);function q6(e){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase().replace(/&/g,` and `).replace(/[^\p{L}\p{N}]+/gu,` `).trim()}function J6(e){let t=q6(e).split(` `).filter(e=>e!==``&&!$ge.has(e)).map(e=>e.length>3&&e.endsWith(`s`)&&!e.endsWith(`ss`)?e.slice(0,-1):e);return new Set(t)}function e_e(e,t){let n=0;for(let r of e)t.has(r)&&(n+=1);return n}function t_e(e,t){let n=q6(e);if(n===q6(t))return n!==``;let r=J6(e),i=J6(t);if(r.size===0||i.size===0)return!1;let a=e_e(r,i);if(a/(r.size+i.size-a)>=.6)return!0;let o=Math.min(r.size,i.size),s=Math.max(r.size,i.size);return a===o&&o/s>=.5}function n_e(e,t,n){let r=e.map(e=>e.trim()).filter(e=>e!==``);if(r.length===0)return;let i=e=>r.some(t=>t_e(t,e)),a=t.find(i);if(a!==void 0)return{title:a,where:`project`};let o=n.find(i);return o===void 0?void 0:{title:o,where:`video`}}function r_e({topics:e}){let{api:t}=R(),n=bM(),{document:r}=n,i=B3(),a=N(Gy(t)),o=N(B2(t,i)),{form:s}=r,c=aq(s.title,s.values),l=n_e(e.length===0?[s.title]:[c,...e.map(e=>s.values[e]??``)],(a.data?.projects??[]).filter(e=>e.channelId===i).map(e=>e.title),(o.data??[]).map(e=>e.title));return l===void 0||n.review.created!==null?null:(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:l.where===`project`?`This channel already has a video on this: "${l.title}" (in Projects). Start anyway if you want another take.`:`This channel already uploaded "${l.title}" (Channel → Existing videos). Start anyway if you want another take.`})}function i_e({rows:e,open:t,onChange:n}){return(0,h.jsx)(`ul`,{"aria-label":`Setup`,className:`m-0 flex list-none flex-col border-t border-line p-0`,children:e.map(e=>{let r=t.has(e.id)&&e.editor!==void 0,i=`play-row-${e.id}`;return(0,h.jsxs)(`li`,{"data-setup-row":e.id,className:`border-b border-line`,children:[(0,h.jsx)(V,{title:e.label,size:`small`,className:`items-center py-3.5`,status:e.problem?(0,h.jsx)(Wx,{tone:`failed`,children:`Needs setup`}):void 0,meta:(0,h.jsx)(`span`,{"data-row-summary":!0,className:e.problem&&!r?`block break-words text-danger`:`block truncate text-ink-2`,title:e.problem&&!r?void 0:e.summary,children:r?e.summary:e.problem??e.summary}),children:(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-expanded":e.editor===void 0?void 0:r,"aria-controls":e.editor===void 0?void 0:i,"aria-label":`${r?`Done with`:`Change`} ${e.label.toLowerCase()}`,onClick:()=>n(e.id,!r),children:r?`Done`:`Change`})}),r?(0,h.jsx)(`section`,{id:i,"aria-label":e.label,className:`min-w-0 pb-6`,children:e.editor}):null]},e.id)})})}var Y6=[{id:`title`,label:`Title and keywords`,section:`content`},{id:`article`,label:`Article`,section:`content`},{id:`narration`,label:`Narration`,section:`outputs`},{id:`images`,label:`Images`,section:`outputs`},{id:`video`,label:`Video and style`,section:`style`},{id:`outputs`,label:`Outputs`,section:`outputs`},{id:`reviews`,label:`Reviews`,section:`review`},{id:`channel`,label:`Channel`,section:`content`}],a_e=[[`title`,[`title`,`values`]],[`article`,[`sources.article`,`sources.research`,`articlePrompt`,`provided.article`,`provided.research`,`llm`]],[`narration`,[`sources.audio`,`audio`,`voices`,`provided.audio`,`narrationPrompt`,`intro`,`outro`,`chunking`]],[`images`,[`sources.images`,`images`,`imagePrompts`,`provided.images`,`reference`,`provided.reference`]],[`video`,[`sources.video`,`imageSeconds`,`zoomPercent`,`motionStyle`,`edgeSilenceSeconds`,`silenceGapSeconds`,`sentencePauseSeconds`,`paragraphPauseSeconds`,`loudness`,`videoEdit`,`format`,`subtitles`,`fontUpload`]],[`outputs`,[`sources.thumbnail`,`thumbnailPrompt`,`provided.thumbnail`,`thumbnailCount`,`youtubeDescription`,`descriptionPrompt`,`shorts`,`sources.document`,`document`]],[`reviews`,[`checkpoints`,`reviews`]],[`channel`,[`channelId`,`useBrandKit`,`language`]]],X6=(e,t)=>e.some(e=>t===e||t.startsWith(`${e}.`));function Z6(e,t=`article`){return X6([`llm`],e)?t:a_e.find(([,t])=>X6(t,e))?.[0]}function o_e(e){switch(e){case`content`:return[`title`,`article`,`channel`];case`outputs`:return[`narration`,`images`,`video`,`outputs`];case`style`:return[`video`];case`review`:return[`reviews`]}}function Q6(e,t,n,r=`article`){return t.find(t=>Z6(t.field,r)===e?e===`title`?t.field===`title`?n.length>0:!n.some(e=>t.field===`values.${e}`):!0:!1)}function s_e(e,t,n){let r=e=>e===``?`no provider`:n.providers.find(t=>t.id===e)?.displayName??e,i=e=>e.filter(e=>typeof e==`string`&&e!==``).join(` · `);switch(e){case`title`:return i([n.topics.length?t.title:!1,n.keywords===0?`No keywords`:`${String(n.keywords)} keyword${n.keywords===1?``:`s`}`]);case`article`:return t.sources.article===`off`?`Off: no article`:t.sources.article===`provide`?`Your article`:i([t.articlePrompt||`No prompt picked`,t.llm.provider?`${r(t.llm.provider)} · ${t.llm.model||`no model`}`:!1,t.sources.research===`off`?`research off`:`research: ${cM[t.sources.research].toLowerCase()}`]);case`narration`:{if(t.sources.audio===`off`)return`Off, a silent video`;if(t.sources.audio===`provide`)return t.provided.audio?.name??`Your narration file`;let e=n.voices.find(e=>e.provider===t.audio.provider&&e.voiceId===t.audio.voice);return i([r(t.audio.provider),t.voices===void 0?e?.name??(t.audio.voice||`no voice`):`${Sk[t.voices.format]}, ${String(t.voices.speakers.length)} speakers`,t.narrationPrompt?`prepared with ${t.narrationPrompt}`:!1,t.intro?`intro ${t.intro}`:!1,t.outro?`outro ${t.outro}`:!1])}case`images`:{if(t.sources.images===`off`)return`Off`;if(t.sources.images===`provide`)return`${String(t.provided.images.length)} of your images`;let e=t.imagePrompts.map(e=>`${e.name} × ${e.number||`?`}`);return i([e.length?e.join(`, `):`No image prompts picked`,r(t.images.provider),t.images.model,t.reference!==void 0&&t.reference.source!==`off`&&`establishing image`])}case`video`:return i([t.format,t.sources.video===`off`?`no video`:fk[vk(t).cuts].toLowerCase(),t.sources.video!==`off`&&n.look,t.sources.audio!==`off`&&t.subtitles.mode!==`off`?`captions ${n.fontName??t.subtitles.fontId} ${t.subtitles.fontSize} ${t.subtitles.position}`:`no captions`]);case`outputs`:return i([t.sources.thumbnail===`off`?!1:t.sources.thumbnail===`provide`?`your thumbnail`:t.thumbnailCount===3?`3 thumbnails`:`1 thumbnail`,aM(t)&&t.shorts?`${t.shorts.count} shorts`:!1,t.youtubeDescription===!0&&t.sources.audio!==`off`&&`YouTube description`,t.sources.document===`generate`&&`PDF (${CS(t.document)})`])||`Only the video`;case`reviews`:return i([n.checkpoints===0?`No checkpoints`:`${String(n.checkpoints)} checkpoint${n.checkpoints===1?``:`s`}`,n.reviews===0?`no automatic reviews`:`${String(n.reviews)} automatic review${n.reviews===1?``:`s`}`]);case`channel`:return i([n.channel??`Default channel`,n.brandKit?`brand kit on`:`brand kit off`,t.language===void 0?void 0:SO(t.language).name])}}function c_e({review:e,blocker:t,errors:n,pendingUpload:r}){if(e.starting)return;if(e.uncertain)return{text:`Slopify didn't confirm the last start. Press Check Start result to find out before starting again.`};if(t)return{text:t.hint,field:t.field};let i=n[0];if(i)return{text:i.message,field:i.field};if(r)return{text:`Wait for uploads to finish before Start`,field:r};if(e.error)return{text:e.error};if(e.pending||!e.valid)return{text:`Checking your setup and the estimate…`}}function l_e({errors:e,blocker:t,saveProblem:n,onReveal:r,onWholeSetup:i,onSaveTemplate:a,preview:o}){let s=bM(),{document:c,review:l}=s,u=vM(c,s.view),d=l.starting||l.uncertain;(0,m.useEffect)(()=>{s.reviewDraft()},[s.reviewDraft]);let f=!l.valid&&!l.pending&&!l.starting&&!l.uncertain&&l.error===null&&e.length===0&&t===void 0&&!u&&s.activeId!==null;(0,m.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>void s.reviewDraft(),800);return()=>clearTimeout(e)},[f,c,s.reviewDraft]);let p=l.valid&&l.receipt?l.receipt.runs.length:hM(c),g=c_e({review:l,blocker:t,errors:e,pendingUpload:u}),_=l.starting||!l.uncertain&&(!l.valid||l.pending||e.length>0||!!u);return(0,h.jsxs)(h.Fragment,{children:[o,(0,h.jsxs)(`section`,{"aria-label":`Start`,className:`flex min-w-0 flex-col gap-4 border-t border-line pt-5`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,h.jsx)(`span`,{className:`text-ink-2`,children:p===1?`1 video`:`${String(p)} videos`}),p>1?(0,h.jsx)(lb,{label:`Queue`,tip:`play.batch-queue`,checked:_M(c),disabled:d,onChange:e=>s.edit({...c,queue:e})}):(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:`One run`})]}),(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(V,{title:`Estimated cost`,info:`play.estimate`,size:`small`,className:`pb-0`}),l.valid&&l.receipt?(0,h.jsx)(Wge,{estimates:l.receipt.estimates}):(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:l.pending?`Calculating the estimate…`:`The estimate appears once the setup is complete.`}),(0,h.jsx)(uV,{label:`Expected article words per video`,tip:`play.expected-words`,className:`mt-2`,children:(0,h.jsx)(Y,{"data-play-field":`expectedWords`,type:`number`,min:1,max:1e5,value:c.expectedWords,disabled:d,onChange:e=>s.edit({...c,expectedWords:e.target.value})})})]}),n?(0,h.jsx)(pP,{tone:`danger`,title:n}):null,(0,h.jsxs)(uy,{"data-tour":`play-start`,disabled:_,"aria-describedby":g?`play-start-reason`:void 0,onClick:()=>{s.startRun()},children:[(0,h.jsx)(Gc,{"aria-hidden":`true`,strokeWidth:1.75}),gM(l,c)]}),(0,h.jsx)(`div`,{id:`play-start-reason`,className:`min-h-5 text-center text-small`,children:g===void 0?(0,h.jsx)(`span`,{className:`text-ink-3`,children:p===1?`Nothing starts until you press it.`:_M(c)?`They run one after another. Nothing starts until you press it.`:`They all run at once. Nothing starts until you press it.`}):g.field===void 0?(0,h.jsx)(`span`,{role:l.error?`alert`:`status`,className:l.error?`text-danger`:`text-ink-2`,children:g.text}):(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-center gap-x-1`,children:[(0,h.jsx)(`span`,{id:`play-start-field`,className:`text-waiting`,children:g.text}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-describedby":`play-start-field`,onClick:()=>r(g.field??``),children:`Go to the field`})]})}),(0,h.jsxs)(dy,{className:`justify-center`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,h.jsx)(L,{variant:`quiet`,size:`small`,disabled:l.pending||d||!!u,onClick:()=>{s.reviewDraft()},children:`Refresh review`}),(0,h.jsx)(B,{id:`play.refresh-review`})]}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,"aria-keyshortcuts":ax(CM.reviewSetup),onClick:i,children:`Review the whole setup`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:a,children:`Save as template`})]})]})]})}function u_e(e,t,n){let r=e?.prompts??[],i=e?.entries??[];return{prompts:[...r,...t.filter(e=>!r.some(t=>t.kind===e.kind&&t.name.toLowerCase()===e.name.toLowerCase()))],entries:[...i,...n.filter(e=>!i.some(t=>t.category===e.category&&t.name.toLowerCase()===e.name.toLowerCase()))]}}function d_e({topics:e,onError:t}){let{api:n}=R(),r=_(),i=bM(),a=N(Nq(n)),o=N(wb(n)),[s,c]=(0,m.useState)(!1),l=i.review.starting||i.review.uncertain||i.review.created!==null,u=i.document.templateSource,d=a.data?.find(e=>e.id===u?.id),f=e=>o.data?.find(t=>t.id===e)?.name,p=async o=>{if(t(null),o===``){await i.newDraft();return}let s=a.data?.find(e=>e.id===o);if(s){c(!0);try{if(!await i.flush()){t(`Your draft wasn't saved, so the template wasn't applied. Press Retry beside Drafts, then pick the template again.`);return}let a=Object.fromEntries(e.map(e=>[e,i.document.form.values[e]??``]).filter(([,e])=>e.trim()!==``)),o=await Vq(n,s,crypto.randomUUID());if(!o.ok){t(`The template "${s.name}" wasn't applied. ${o.message}`);return}if(await r.invalidateQueries({queryKey:[`play-drafts`]}),!await i.open(o.value.draft.id)){t(`The draft made from "${s.name}" didn't open. Open it from Drafts.`);return}let c=o.value.draft.document,l=Object.fromEntries(Object.entries(a).filter(([e])=>(c.form.values[e]??``)===``));Object.keys(l).length>0&&i.edit({...c,form:{...c.form,values:{...c.form.values,...l}}})}catch(e){t(e instanceof Error?`The template "${s.name}" wasn't applied. ${e.message}`:`The template "${s.name}" wasn't applied. Pick it again.`)}finally{c(!1)}}},g=a.error?`Templates didn't load. ${a.error.message}`:d?[f(Y1(d)),`version ${String(d.version)}`].filter(Boolean).join(` · `):a.data?.length===0?`No templates yet. Set this video up, then Save as template.`:void 0;return(0,h.jsx)(uV,{label:`Template`,tip:`play.template`,help:g,children:(0,h.jsxs)(pV,{"data-play-field":`template`,value:d?.id??``,disabled:s||l,onChange:e=>void p(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:u&&!d?`Template no longer saved`:`No template`}),(a.data??[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})}function f_e({topics:e,problem:t}){let n=bM(),{document:r}=n,{form:i}=r,a=e=>{n.edit({...r,form:e}),n.invalidateReview(!0)};if(e.length===0)return(0,h.jsx)(uV,{label:`Title`,tip:`play.title`,error:t(`title`),children:(0,h.jsx)(Y,{"data-play-field":`title`,className:`!h-11 text-[17px]`,value:i.title,maxLength:200,placeholder:`What's the video about?`,"aria-invalid":t(`title`)!==void 0,onChange:e=>a({...i,title:e.target.value})})});let o=aq(i.title,i.values);return(0,h.jsx)(`div`,{className:`grid min-w-0 gap-4`,children:e.map((n,r)=>(0,h.jsx)(uV,{label:n,tip:`play.topic`,help:r===e.length-1?(0,h.jsxs)(h.Fragment,{children:[`Title: `,(0,h.jsx)(`b`,{className:`font-semibold text-ink`,children:o})]}):void 0,error:t(`values.${n}`)??(r===e.length-1?t(`title`):void 0),children:(0,h.jsx)(Y,{"data-play-field":`values.${n}`,className:`!h-11 text-[17px]`,value:i.values[n]??``,maxLength:200,spellCheck:!1,"aria-invalid":t(`values.${n}`)!==void 0,onChange:e=>a({...i,values:{...i.values,[n]:e.target.value}})})},n))})}function p_e({topics:e,keywordNames:t,origins:n,problem:r,adding:i,onAdding:a,open:o,onOpen:s}){let c=bM(),{document:l}=c,{form:u}=l,[d,f]=(0,m.useState)(``),p=(0,m.useId)(),g=(0,m.useRef)(null),_=c.review.starting||c.review.uncertain,v=l.variants,y=e=>{c.edit({...l,variants:e})},b=e[0],x=e=>b===void 0?e.title:e.values[b]||e.title,S=()=>{let e=d.trim();e===``||v.length>=49||(y([...v,{id:crypto.randomUUID(),title:b===void 0?e:u.title,values:b===void 0?{...u.values}:{...u.values,[b]:e}}]),f(``),g.current?.focus())},C=v.findIndex(e=>e.id===o),w=C===-1?void 0:v[C];return(0,h.jsxs)(`section`,{"aria-label":`More videos from the same setup`,className:`min-w-0`,...cb,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`sl-kicker`,children:`More videos from the same setup`}),(0,h.jsx)(B,{id:`play.more-videos`,className:`-my-1`})]}),(0,h.jsxs)(dy,{className:`flex-wrap`,children:[v.map((e,n)=>{let i=x(e)||`Video ${String(n+2)}`,a=[`items.${String(n+1)}.title`,...t.map(e=>`items.${String(n+1)}.values.${e}`)].some(e=>r(e)!==void 0);return(0,h.jsx)(Kx,{...a?{className:`border-danger`}:{},..._?{}:{onRemove:()=>y(v.filter(t=>t.id!==e.id)),removeLabel:`Remove ${i}`},children:(0,h.jsxs)(L,{variant:`quiet`,size:`small`,"data-play-field":`items.${e.id}`,className:`-my-1 -ml-1.5 h-6 px-1.5 text-ink`,"aria-label":`Change the keywords of ${i}`,onClick:()=>s(e.id),children:[i,(0,h.jsx)(Uc,{"aria-hidden":`true`,strokeWidth:1.75})]})},e.id)}),i?(0,h.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,h.jsx)(`label`,{htmlFor:p,className:`sr-only`,children:b===void 0?`Title of another video`:`${b} of another video`}),(0,h.jsx)(Y,{ref:g,id:p,autoFocus:!0,className:`!h-8 w-48`,value:d,maxLength:200,placeholder:b===void 0?`Another title`:`Another ${b}`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`&&a(!1)}}),(0,h.jsx)(L,{type:`submit`,size:`small`,disabled:d.trim()===``,children:`Add`}),(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:()=>a(!1),children:`Done`})]}):(0,h.jsxs)(L,{variant:`quiet`,size:`small`,disabled:_||v.length>=49,disabledReason:_?`Wait for the start to finish`:`One Start queues at most 50 videos`,onClick:()=>a(!0),children:[(0,h.jsx)(Kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Add topic`]})]}),(0,h.jsx)(UM,{open:w!==void 0,title:w?`Video ${String(C+2)}: ${x(w)||`untitled`}`:``,width:`narrow`,onClose:()=>s(null),footer:(0,h.jsx)(L,{variant:`secondary`,onClick:()=>s(null),children:`Done`}),children:w?(0,h.jsxs)(`fieldset`,{disabled:_,className:`flex min-w-0 flex-col gap-5 border-0 p-0`,children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Everything else comes from the setup of the first video.`}),(0,h.jsx)(uV,{label:`Title`,tip:`play.title`,error:r(`items.${String(C+1)}.title`),children:(0,h.jsx)(Y,{"data-play-field":`items.${w.id}.title`,value:w.title,maxLength:200,onChange:e=>y(v.map(t=>t.id===w.id?{...t,title:e.target.value}:t))})}),(0,h.jsx)(o0,{fieldPrefix:`items.${w.id}.values`,keywords:t.map(t=>({name:t,value:w.values[t]??``,feeds:n.get(t)??[],topic:e.includes(t)})),problem:e=>r(e.replace(`items.${w.id}.`,`items.${String(C+1)}.`)),onChange:(e,t)=>y(v.map(n=>n.id===w.id?{...n,values:{...n.values,[e]:t}}:n))})]}):null})]})}function m_e(){let e=Zi();return(0,h.jsx)(h_e,{onCreated:t=>{e({to:`/projects/$projectId`,params:{projectId:t}})}})}function h_e({onCreated:e}){let{api:t}=R(),n=eP(),r=N(Xy(t)),i=N(Qy(t)),a=N($y(t)),o=N(Zy(t)),s=N(tb(t)),c=N(wb(t)),l=N(Nq(t)),u=N({queryKey:Fj,queryFn:()=>Ij(t),staleTime:6e4}),[d,f]=Rae(),p=V3(),g=bM(),{document:_}=g,v=u_e(_.librarySnapshot,i.data?.prompts??[],a.data?.entries??[]),y=_.variants.map(({id:e,...t})=>({...t,key:e})),b=g.fontUploading||_.fontUpload!==null,x=g.review.fields,[S,C]=(0,m.useState)(new Set),[w,T]=(0,m.useState)(new Set),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(null),[A,ee]=(0,m.useState)(!1),[te,ne]=(0,m.useState)(null),j=(0,m.useRef)(null),re=(0,m.useRef)(null),M=(0,m.useRef)(null),ie=Zi(),ae=(0,m.useRef)(g.activeId);(0,m.useLayoutEffect)(()=>{ae.current!==g.activeId&&(ae.current=g.activeId,C(new Set),k(null))},[g.activeId]);let oe=e=>{f(t=>{let n={...t,...e};return{...n,subtitles:nM(n.subtitles,n.sources)}}),g.invalidateReview(!0)},se=s.data?.silenceGapSeconds??3,ce=_.form.silenceGapSeconds?.trim()??``,le={form:d,prompts:v.prompts,entries:v.entries,silenceGapSeconds:ce===``?se:Number(ce)},{fields:ue,result:de,blocker:fe}=$de(le),pe=i0(le),me=R3(d.title).filter(e=>ue.some(t=>t.name===e)),he=b?{field:`subtitles.fontUpload`,hint:`Wait for the subtitle font upload to finish to play`}:fe;(0,m.useEffect)(()=>{if(!g.review.created)return;let t=g.takeCreated()?.projectIds[0];t&&(n({type:`project-created`,id:t}),e(t))},[g.review.created,g.takeCreated,n,e]);let ge=de.ok?x:[...de.fields,...x],_e=(...e)=>!ge.some(t=>e.some(e=>t.field===e||t.field.startsWith(`${e}.`))),ve=(e,t)=>v.prompts.some(n=>n.kind===e&&n.name===t),ye=e=>e?.file!==void 0&&e.error===void 0;$N({playArticleReady:_e(`sources.article`,`articlePrompt`,`provided.article`)&&(d.sources.article===`provide`||ve(`article`,d.articlePrompt)),playAudioReady:d.sources.audio===`off`||_e(`sources.audio`,`audio`,`provided.audio`)&&(d.sources.audio!==`provide`||ye(d.provided.audio)),playImagesReady:d.sources.images===`off`||_e(`sources.images`,`images`,`imagePrompts`,`provided.images`)&&(d.sources.images===`provide`?d.provided.images.every(ye):d.imagePrompts.every(e=>ve(`image`,e.name))),playVideoReady:_e(`sources.video`),playSubtitlesReady:_e(`subtitles`)&&!b,playOptionsReady:_e(`title`,`format`,`llm`,`intro`,`outro`),playHasKeywords:ue.length>0,playKeywordsReady:_e(`values`),playReady:he===void 0&&!g.review.starting});let be=uM(d,v.entries)[0]?.section??`article`,xe=e=>Dhe(e,d)??Cge(e,d,y,v.entries),Se=e=>{let t=xe(e).field;return ge.find(n=>xe(n.field).field===t&&(x.includes(n)||S.has(e)||S.has(t)))?.message},Ce=e=>{let t=xe(e);C(n=>new Set([...n,e,t.field])),g.navigate(t.field.startsWith(`items.`)?`content`:t.section,t.field)},we=[r,i,a,o,s].every(e=>e.isSuccess||e.isError),Te=(0,m.useRef)(null),Ee=g.generation();(0,m.useEffect)(()=>{if(!we)return;let e=Te.current;Te.current={generation:Ee,id:g.activeId},(e===null||e.generation!==Ee||e.id!==g.activeId&&e.id!==null)&&T(new Set(Y6.map(e=>e.id).filter(e=>e!==`reviews`&&Q6(e,ge,me,be)!==void 0)))},[we,g.activeId,Ee]);let De=(0,m.useRef)(null);(0,m.useLayoutEffect)(()=>{let e=g.reveal;if(e||(De.current=null),!e||e.sequence===De.current||!j.current)return;let t=e.field,n=t?/^items\.([^.]+)(\.|$)/.exec(t)?.[1]:void 0;if(e.section===`review`){if(De.current=e.sequence,t&&z6(j.current,t))return;M.current?.focus();return}if(n!==void 0&&_.variants.some(e=>e.id===n)){if(O!==n){k(n);return}}else if(!(t&&me.some(e=>t===`values.${e}`))){let n=t?Z6(t,be):void 0,r=(n===void 0?o_e(e.section):[n]).filter(e=>!w.has(e));if((t!==`title`||me.length!==0)&&r.length>0){T(e=>new Set([...e,...r]));return}}De.current=e.sequence,!(t&&z6(j.current,t))&&re.current?.focus()},[g.reveal,w,O]);let Oe=async e=>{await g.flush()&&(e===`/prompts`?await ie({to:`/prompts/new`,search:{kind:`article`}}):await ie({to:e}))},ke=()=>{g.navigate(`review`)},Ae=(e,t)=>{g.invalidateReview(!0),g.attach(e,t)},je=(e,t)=>{f(n=>({...n,provided:e===`images`?{...n.provided,images:n.provided.images.filter(e=>e.key!==t)}:{...n.provided,[e]:void 0}}))},Me=[r,i,a,o,s].find(e=>e.error!==null)?.error?.message,Ne=g.error?`Your draft wasn't saved. ${g.error}`:Me,Pe={form:d,providers:r.data?.providers??[],prompts:v.prompts,voices:o.data?.voices??[],silenceGapSeconds:s.data?.silenceGapSeconds??3,problem:Se,update:oe,onPickFiles:Ae,onRemoveFile:je,onReattachFile:(e,t,n)=>{g.attach(e,[n],t)}},Fe=l.data?.find(e=>e.id===_.templateSource?.id),Ie=_.channelId??(Fe===void 0?`00000000-0000-4000-8000-000000000001`:Y1(Fe)),Le=Object.values(_.form.reviews?.stages??{}).filter(e=>e.mode!==`off`).length,Re={providers:r.data?.providers??[],voices:o.data?.voices??[],keywords:ue.length,topics:me,channel:c.data?.find(e=>e.id===Ie)?.name,brandKit:_.form.useBrandKit!==!1,look:G6(_.form),fontName:u.data?.fonts.find(e=>e.id===d.subtitles.fontId)?.name,checkpoints:d.checkpoints?.length??0,reviews:Le},ze={title:(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 py-4`,children:[me.length?(0,h.jsx)(uV,{label:`Title pattern`,tip:`play.title-pattern`,error:Se(`title`),children:(0,h.jsx)(Y,{"data-play-field":`title`,value:d.title,maxLength:200,"aria-invalid":Se(`title`)!==void 0,onChange:e=>oe({title:e.target.value})})}):null,(0,h.jsx)(wge,{fields:ue,origins:pe,topics:me,hide:me,values:d.values,problem:Se,onChange:(e,t)=>oe({values:{...d.values,[e]:t}})}),ue.length===me.length?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:ue.length===0?`No keywords. A prompt or the title that names {{a keyword}} adds one here.`:`The only keywords are the topic, typed at the top.`}):null]}),article:(0,h.jsx)(xge,{...Pe,entries:v.entries,onLibrary:e=>{Oe(e)}}),narration:(0,h.jsx)(Ige,{...Pe,entries:v.entries,onKeyword:Ce,onSettings:()=>{Oe(`/settings`)}}),images:(0,h.jsx)(Lge,{...Pe}),video:(0,h.jsx)(Rge,{...Pe,problemOf:Se}),outputs:(0,h.jsx)(zge,{...Pe,entries:v.entries,onSettings:()=>{Oe(`/settings`)}}),reviews:void 0,channel:(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 py-4`,children:[(0,h.jsx)(The,{}),(0,h.jsx)(Ehe,{})]})},Be=Y6.filter(e=>e.id!==`narration`||d.sources.article!==`off`),Ve=Be.map(e=>({id:e.id,label:e.label,summary:s_e(e.id,d,Re),problem:Q6(e.id,ge,me,be)?.message,editor:ze[e.id]})),He=(e,t)=>{if(e===`reviews`){ke();return}T(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},Ue=e=>{He(e,!0),requestAnimationFrame(()=>{j.current?.querySelector(`[data-setup-row="${e}"]`)?.scrollIntoView({block:`start`,behavior:`smooth`})})},We=_.variants.length+1,Ge=vM(_,g.view),Ke=!g.review.starting&&(g.review.uncertain||g.review.valid&&!g.review.pending&&ge.length===0&&!Ge);qb({id:`play.start`,title:gM(g.review,_),group:`Play`,context:d.title||`New project`,keywords:[`start`,`queue`,`run`,`play`,`go`],run:()=>{Ke?g.startRun():he?Ce(he.field):ge[0]&&Ce(ge[0].field)}}),qb({id:`play.add-topic`,title:`Add a topic for another video`,group:`Play`,context:`${String(We)} video${We===1?``:`s`}`,keywords:[`more videos`,`variation`,`batch`,`queue`],run:()=>D(!0)}),qb({id:`play.save-template`,title:`Save as template`,group:`Play`,keywords:[`template`,`setup`,`reuse`],run:()=>ee(!0)}),qb({id:`play.review`,title:`Review the whole setup`,group:`Play`,keywords:[`summary`,`checkpoints`,`prompt`],shortcut:CM.reviewSetup,run:ke}),qb({id:`play.template`,title:`Pick a template`,group:`Play`,keywords:[`template`,`setup`],run:()=>{j.current&&z6(j.current,`template`)}});let qe=d.sources.video===`generate`&&d.sources.images!==`off`,Je=Hge(d,p),Ye=qe?(0,h.jsx)(D6,{drawnOn:Je?.drawnOn,settings:{format:d.format,subtitles:{mode:d.sources.audio===`off`?`off`:d.subtitles.mode,fontId:d.subtitles.fontId,fontSize:Number(_.form.subtitles.fontSize)||d.subtitles.fontSize,position:d.subtitles.position},videoEdit:d.videoEdit,previewText:_.previewText,image:Je?.image}}):null;return(0,h.jsxs)(`div`,{ref:j,onBlurCapture:e=>{let t=e.target.dataset.playField;t&&C(e=>new Set([...e,t]))},"data-play-grid":`true`,className:`min-w-0 max-[767px]:[&_button]:min-h-11 max-[767px]:[&_input:not([type=checkbox])]:min-h-11 max-[767px]:[&_select]:min-h-11 max-[767px]:[&_summary]:min-h-11`,children:[(0,h.jsx)(bq,{crumb:`New project`,title:(0,h.jsx)(`span`,{ref:re,tabIndex:-1,children:`What's the video about?`}),meta:d.title.trim()===``?`Untitled draft`:d.title,actions:(0,h.jsx)(Sge,{})}),(0,h.jsx)(z3,{onDefaults:g.adoptDefaults}),(0,h.jsxs)(xq,{className:`sl-workspace--play`,aside:(0,h.jsx)(l_e,{errors:ge,blocker:he,saveProblem:Ne,onReveal:Ce,onWholeSetup:ke,onSaveTemplate:()=>ee(!0),preview:Ye}),asideLabel:`Review and start`,children:[(0,h.jsxs)(`div`,{"data-tour":`play-options`,className:`grid min-w-0 grid-cols-1 items-start gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(d_e,{topics:me,onError:ne}),(0,h.jsx)(f_e,{topics:me,problem:Se})]}),(0,h.jsx)(r_e,{topics:me}),te?(0,h.jsx)(pP,{tone:`danger`,title:te}):null,(0,h.jsx)(p_e,{topics:me,keywordNames:ue.map(e=>e.name),origins:pe,problem:Se,adding:E,onAdding:D,open:O,onOpen:k}),(0,h.jsx)(i_e,{rows:Ve,open:w,onChange:He})]}),(0,h.jsx)(UM,{open:g.section===`review`,title:`Review`,headingRef:M,onClose:()=>{g.navigate(`content`)},children:(0,h.jsx)(Xge,{fields:ue,errors:ge,problem:Se,onReveal:Ce})}),(0,h.jsx)(Qge,{open:A,onClose:()=>ee(!1)}),Be.map(e=>(0,h.jsx)(g_e,{id:e.id,label:e.label,onOpen:Ue},e.id))]})}function g_e({id:e,label:t,onOpen:n}){return qb({id:`play.row.${e}`,title:`Change ${t.toLowerCase()}`,group:`Play`,keywords:[`open`,`edit`,`section`,t],run:()=>n(e)}),null}function __e(){let{api:e}=R(),t=N({queryKey:[`batch-queue`],queryFn:async()=>F(await e.fetch(`${e.origin}/api/projects/queue`)),refetchInterval:2e3,retry:!1}),n=N(Gy(e)),r=t.data?.queue.length??0;return(0,h.jsxs)(ab,{children:[(0,h.jsx)(ob,{asChild:!0,children:(0,h.jsxs)(L,{variant:`quiet`,disabled:r===0,"aria-label":`Video queue: ${r} remaining`,children:[(0,h.jsx)(zc,{"aria-hidden":`true`,className:`size-4`}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[`Queue · `,r]})]})}),(0,h.jsxs)(sb,{align:`end`,className:`p-0`,children:[(0,h.jsx)(`p`,{className:`border-b border-line px-3 py-2 text-small text-ink-2`,children:nb(`play.queue`).body}),(0,h.jsx)(v_e,{queue:t.data?.queue??[],projects:n.data?.projects})]})]})}function v_e({queue:e,projects:t}){return(0,h.jsx)(`ol`,{className:`max-h-40 overflow-y-auto px-4 py-2`,children:e.map((e,n)=>{let r=t?.find(t=>t.id===e.projectId);return(0,h.jsxs)(`li`,{className:`flex justify-between gap-3 py-1 text-small`,children:[(0,h.jsxs)(ha,{className:`truncate`,to:`/projects/$projectId`,params:{projectId:e.projectId},children:[n+1,`. `,r?.title??`Video`]}),(0,h.jsx)(`span`,{className:`shrink-0 text-ink-2`,children:r?.status===`paused`?`Paused`:e.state===`active`?`Active`:`Queued`})]},e.projectId)})})}function $6({label:e,className:t,children:n}){return(0,h.jsx)(`nav`,{"aria-label":e,className:I(`sl-rail`,t),children:n})}function y_e({icon:e,meta:t,children:n}){return(0,h.jsxs)(h.Fragment,{children:[e,(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),t===void 0?null:(0,h.jsx)(`span`,{className:`sl-rail__meta`,children:t})]})}function e8({icon:e,meta:t,current:n=!1,onClick:r,className:i,children:a,"data-tour":o}){return(0,h.jsx)(`button`,{type:`button`,"data-tour":o,"aria-current":n?`true`:void 0,onClick:r,className:I(`sl-rail__item w-full border-0 bg-transparent text-left font-[inherit]`,n&&`bg-accent-tint font-semibold text-ink`,i),children:(0,h.jsx)(y_e,{icon:e,meta:t,children:a})})}var t8=/^(?:[-*+]|\d+[.)])\s+/u;function b_e(e){let t=e.split(/\r?\n/u).filter(e=>e.trim()!==``),n=[];for(let e of t.slice(1)){let t=e.trim().replace(t8,``).trim(),r=n.length-1;/^\s/u.test(e)&&!t8.test(e.trim())&&r>=0?n[r]=`${n[r]??``} ${t}`:t!==``&&n.push(t)}return n}var x_e={blockquote:a8,break:E_e,code:o8,definition:o8,delete:a8,emphasis:a8,footnoteReference:o8,footnoteDefinition:o8,heading:T_e,html:o8,image:r8,imageReference:r8,inlineCode:i8,list:a8,listItem:a8,link:a8,linkReference:a8,strong:a8,table:o8,tableCell:o8,text:i8,thematicBreak:o8,toml:o8,yaml:o8},S_e={},n8=[];function C_e(e){let t={...x_e},n=e||S_e,r=n.keep||n8,i=n.remove||n8,a=-1;for(;++a<i.length;){let e=i[a];typeof e==`string`?t[e]=o8:t[e[0]]=e[1]}let o={};if(r.length===0)o=t;else{let e;for(e in t)r.includes(e)||(o[e]=t[e]);for(a=-1;++a<r.length;)if(e=r[a],!Object.hasOwn(t,e))throw Error("Unknown node type `"+e+"` in `keep`, use a replace tuple with a handle instead: `remove: [['"+e+"', handle]]`")}return function(e){return s(e)};function s(e){let t=e.type,n=e;if(Object.hasOwn(o,t)){let e=o[t];e&&(n=e(n)||void 0)}return n=Array.isArray(n)?c(n):n,n&&`children`in n&&(n.children=c(n.children)),n}function c(e){let t=-1,n=[];for(;++t<e.length;){let r=s(e[t]);Array.isArray(r)?n.push(...c(r)):r&&n.push(r)}return w_e(n)}}function w_e(e){let t=-1,n=[],r;for(;++t<e.length;){let i=e[t];r&&i.type===r.type&&`value`in i&&`value`in r?r.value+=i.value:(n.push(i),r=i)}return n}function r8(e){let t=`title`in e?e.title:``,n=e.alt||t||``;return n?{type:`text`,value:n}:void 0}function i8(e){return{type:`text`,value:e.value}}function T_e(e){return{type:`paragraph`,children:e.children}}function a8(e){return e.children}function E_e(){return{type:`text`,value:`
|
|
284
284
|
`}}function o8(){}var D_e=64,s8=new Map;function O_e(e){let t=s8.get(e);if(t!==void 0)return t;let n=k_e(e);for(s8.set(e,n);s8.size>D_e;){let e=s8.keys().next().value;if(e===void 0)break;s8.delete(e)}return n}function k_e(e){let t=n6().use(nB).use(C_e),n=t.runSync(t.parse(e)).children.map(e=>{if(e.type!==`paragraph`)throw Error(`Slopify hit an internal error (the article couldn't be turned into plain text). Try again; if it happens again, use Download diagnostics in Settings and report it.`);return e.children.map(e=>{if(e.type!==`text`)throw Error(`Slopify hit an internal error (the article couldn't be turned into plain text). Try again; if it happens again, use Download diagnostics in Settings and report it.`);return e.value}).join(``)}).filter(e=>e.trim()!==``);return n.length===0?``:n.join(`
|
|
285
285
|
|
|
286
286
|
`)+`
|
|
@@ -288,7 +288,7 @@ Obelisks`})}):e.mode===`yaml`?(0,h.jsx)(uV,{id:`schedule-topics-yaml`,label:`Top
|
|
|
288
288
|
`)}\n`,pronunciation:`${k}\n`},le={article:`article`,script:`script`,research:`research notes`,sources:`sources`,pronunciation:`pronunciation table`},ue=(0,m.useCallback)((e,t)=>{if(!navigator.clipboard){se({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`});return}navigator.clipboard.writeText(e).then(()=>se({text:`Copied the ${t} as Markdown.`,tone:`success`}),()=>se({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`}))},[]),de=e=>ue(ce[e],le[e]);return(0,h.jsxs)(C8,{children:[(0,h.jsx)(z8,{review:F8(a,{itemKey:`article:body`}),projectId:n.id,busy:i}),(0,h.jsxs)(k8,{files:[...f===void 0?[]:[{output:f,label:`Article${N8(f)}`}],...p===void 0?[]:[{output:p,label:`Sources${N8(p)}`}],...g===void 0?[]:[{output:g,label:`Pronunciation glossary${N8(g)}`}],...u===void 0?[]:[{output:u,label:`Research notes${N8(u)}`}],...v===void 0?[]:[{output:v,label:`Script by speaker${N8(v)}`}]],children:[(ie===`research`?c?.state===`running`||d.data===void 0:w||C===``)?null:(0,h.jsxs)(L,{variant:`secondary`,onClick:()=>de(ie),children:[(0,h.jsx)(kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Copy `,le[ie]]}),ie===`research`&&c!==void 0?(0,h.jsx)(M8,{output:f8(l,`instructions`)}):(0,h.jsx)(M8,{output:f8(s,`instructions`)}),(0,h.jsx)(V1,{tone:oe?.tone??`info`,children:oe?.text})]}),b.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-body text-danger`,children:b.error.message}),te.length>1?(0,h.jsx)(K1,{items:te,value:ie,onChange:e=>{re(e),se(void 0)},label:`Article parts`,idPrefix:ae}):null,(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,h.jsx)(`h3`,{className:`m-0 text-title-3 font-semibold text-ink`,children:(0,h.jsx)(H_e,{markdown:E})}),D.body.trim()===``?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2 tabular-nums`,children:sve(D.body)})]}),(0,h.jsx)(q1,{idPrefix:ae,id:`article`,active:ie===`article`,children:w?(0,h.jsx)(`section`,{"aria-label":`Article content`,tabIndex:0,className:`sl-stage-scroll min-h-48 pr-3`,children:x?(0,h.jsx)(A3,{projectId:n.id,stage:`article`,className:``}):(0,h.jsx)(E8,{markdown:D.body})}):(0,h.jsx)(fB,{markdown:D.body,label:`Article`,regionLabel:`Article content`,anchorPrefix:`article-`,what:`article`,onCopy:ue,copyAll:!1,children:V8(e)&&f!==void 0&&b.data===void 0?(0,h.jsx)(`span`,{className:`block h-4 w-[40ch] max-w-full rounded-control bg-sunken`}):(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:V8(e)?`No article was saved.`:c===void 0?`The article will be written when its inputs are ready.`:`The article is written once the research has finished.`})})}),_===void 0||ee.trim()===``?null:(0,h.jsx)(q1,{idPrefix:ae,id:`script`,active:ie===`script`,children:(0,h.jsx)(`section`,{"aria-label":`Script by speaker`,tabIndex:0,className:`sl-stage-scroll min-h-48 pr-3`,children:(0,h.jsx)(I_e,{script:ee,voices:_})})}),c===void 0?null:(0,h.jsx)(q1,{idPrefix:ae,id:`research`,active:ie===`research`,children:(0,h.jsx)(X_e,{projectId:n.id,stage:c,notes:u,onCopy:ue})}),O.length===0?null:(0,h.jsx)(q1,{idPrefix:ae,id:`sources`,active:ie===`sources`,children:(0,h.jsx)(fB,{markdown:O.map((e,t)=>`${String(t+1)}. ${e}`).join(`
|
|
289
289
|
`),label:`Sources`,regionLabel:`Sources`,anchorPrefix:`sources-`,what:`sources`,onCopy:ue,copyAll:!1})}),k===``?null:(0,h.jsxs)(q1,{idPrefix:ae,id:`pronunciation`,active:ie===`pronunciation`,children:[A.length===0?null:(0,h.jsxs)(pP,{className:`mb-3`,title:`${A.length===1?`1 entry is`:`${A.length} entries are`} skipped by the narration and read as ordinary text`,children:[(0,h.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5`,children:A.map(e=>(0,h.jsxs)(`li`,{children:[`Entry `,e.row,`: `,e.reason,`.`]},e.row))}),(0,h.jsx)(`p`,{className:`m-0 mt-1`,children:`The other entries are used. To fix these, edit the Pronunciation Glossary at the end of the article in Edit settings → Article.`})]}),(0,h.jsx)(`div`,{className:`sl-stage-scroll pr-3`,children:(0,h.jsx)(E8,{markdown:k})})]})]})}var H8=new Intl.NumberFormat(`en`);function sve(e){let t=e.replace(/\]\([^)]*\)/g,`]`).replace(/[#*_>`[\]]/g,``).replace(/[ \t]+/g,` `).trim(),n=t.split(/\s+/).filter(e=>/[\p{L}\p{N}]/u.test(e)).length,r=t.replace(/\s*\n\s*/g,` `).length;return`${H8.format(n)} ${n===1?`word`:`words`} · ${H8.format(r)} characters`}function U8({className:e,label:t,children:n}){return(0,h.jsx)(`dl`,{"aria-label":t,className:I(`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[max-content_minmax(0,1fr)] sm:gap-y-3`,e),children:n})}function W8({label:e,children:t}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`text-small text-ink-2 max-sm:mt-2 max-sm:first:mt-0`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0 text-body text-ink`,children:t})]})}function G8({src:e,label:t,marks:n=[],waveform:r,compact:i=!1,preload:a=`metadata`,onError:o,ref:s,className:c}){let l=b0(),u=l.media;return(0,h.jsxs)(`div`,{role:`group`,"aria-label":`${t} controls`,"data-slot":`audio-player`,"data-state":l.playing?`playing`:`paused`,className:I(`sl-audio`,i&&`sl-audio--compact`,r!==void 0&&r.length>0&&`sl-audio--wave`,c),onKeyDown:e=>{if(e.metaKey||e.ctrlKey||e.altKey||e.key===` `&&e.target.closest(`button`)!==null)return;let t=l.keyAction(e.key);t!==void 0&&(e.preventDefault(),e.stopPropagation(),t())},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||l.setMenu(!1)},children:[(0,h.jsx)(`audio`,{ref:v0(u,s),src:e,preload:a,"aria-label":t,onError:o,...l.events}),(0,h.jsx)(C0,{controls:l,className:`sl-audio__key`}),(0,h.jsx)(w0,{controls:l}),(0,h.jsx)(T0,{controls:l,chapters:n,waveform:r}),(0,h.jsx)(E0,{controls:l}),(0,h.jsx)(D0,{controls:l})]})}function K8({projectId:e,revisionId:t}){let n=O3(e),r=t===void 0?n:t,{api:i}=R(),a=N({queryKey:z.audioPreview(e,r),queryFn:async()=>F(await i.client.projects[`:projectId`][`audio-preview`].$get({param:{projectId:e}})),refetchInterval:1e3,staleTime:0,gcTime:0,retry:!1}),o=(a.data?.revisionId??null)===r?a.data?.previews??[]:[];return(0,h.jsxs)(`section`,{"aria-label":`Live narration`,className:`grid gap-3 border-y border-line py-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold text-ink`,children:`Listen while it generates`}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Play any part. Each preview starts from its beginning.`})]}),a.error===null?null:(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`Live preview is temporarily unavailable. Finished audio will still appear here.`}),o.length===0&&a.error===null?(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`Waiting for the first audio bytes…`}):null,(0,h.jsx)(`div`,{className:`grid max-h-[420px] gap-3 overflow-y-auto`,children:o.map(t=>(0,h.jsx)(cve,{preview:t,url:`${i.origin}/api/projects/${encodeURIComponent(e)}/audio-preview/${t.id}`},t.id))})]})}function cve({preview:e,url:t}){let[n,r]=(0,m.useState)(!1),i=(e.state===`streaming`||e.state===`ready`)&&e.bytes>0,a=e.state===`ready`?`Ready`:e.state===`streaming`?`Generating`:`Preview stopped`;return(0,h.jsxs)(`div`,{className:`grid gap-2 text-small`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`text-ink`,children:e.label}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:a})]}),i&&!n?(0,h.jsx)(lve,{label:e.label,url:t,onError:()=>r(!0)}):(0,h.jsx)(`p`,{className:`text-ink-2`,children:e.state===`streaming`&&!n?`Waiting for audio…`:`This preview has stopped. The finished narration will be available when generation completes.`})]})}function lve({label:e,url:t,onError:n}){let r=(0,m.useRef)(null);return(0,m.useEffect)(()=>{let e=r.current;return()=>{e!==null&&(e.pause(),e.removeAttribute(`src`),e.load())}},[]),(0,h.jsx)(G8,{ref:r,compact:!0,preload:`none`,label:`Live ${e} narration`,src:t,onError:n,className:`max-w-[620px]`})}function uve({outputs:e}){let t=(0,m.useId)(),n=t=>e.find(e=>e.role===`narration_txt`&&e.meta.segment===t),r=j8(n(`intro`)).data,i=j8(n(`body`)).data,a=j8(n(`outro`)).data,[o,s]=(0,m.useState)(),c=(0,m.useCallback)((e,t)=>{if(!navigator.clipboard){s({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`});return}navigator.clipboard.writeText(e).then(()=>s({text:`Copied the ${t} as Markdown.`,tone:`success`}),()=>s({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`}))},[]),l=[[`Intro`,r],[`Body`,i],[`Outro`,a]].filter(([,e])=>e!==void 0&&e.trim()!==``);if(!e.some(e=>e.role===`narration_txt`))return null;let u=l.length===1?(l[0]?.[1]??``).trim():l.map(([e,t])=>`## ${e}\n\n${(t??``).trim()}`).join(`
|
|
290
290
|
|
|
291
|
-
`);return(0,h.jsxs)(`section`,{"aria-labelledby":`${t}-title`,className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(`h3`,{id:`${t}-title`,className:`sl-kicker text-ink-3`,children:`Narration text`}),(0,h.jsx)(fB,{markdown:u,label:`Narration text`,regionLabel:`Narration text`,anchorPrefix:`narration-`,what:`narration text`,onCopy:c,children:(0,h.jsx)(`span`,{className:`block h-4 w-[40ch] max-w-full rounded-control bg-raised`})}),(0,h.jsx)(V1,{tone:o?.tone??`info`,children:o?.text})]})}var q8=(0,m.createContext)(!1),J8=(0,m.createContext)(void 0),Y8=(0,m.createContext)(void 0);function X8(e){let t=v8();return e===void 0?!1:t?.outputs.some(t=>t.output.id===e.id&&t.state===`outdated`)??!1}function Z8(e,t,n){let[r,i]=(0,m.useState)(),a=(0,m.use)(q8),o=(0,m.use)(J8),s=(0,m.use)(Y8),c=v8(),l=e===void 0?void 0:c?.outputs.find(t=>t.output.id===e.id)?.workKey,u=a&&l!==void 0;return{act:t=>{if(e===void 0)return;if(!u||l===void 0||t===`regenerate-image`){i(t);return}if(!l.startsWith(`image:`))return;let n=l.slice(6);o?.({section:`images`,change:e=>({...e,content:{...e.content,imageOrder:e.content.imageOrder.filter(e=>e!==n),imageDefinitions:Object.fromEntries(Object.entries(e.content.imageDefinitions).filter(([e])=>e!==n))},regenerate:(e.regenerate??[]).filter(e=>e!==l)})})},asking:r,confirm:()=>{let n=r;i(void 0),n!==void 0&&e!==void 0&&(u&&l!==void 0&&n===`regenerate-image`?s?.([l]):t.run({kind:n,outputId:e.id}))},dismiss:()=>i(void 0),unavailable:e===void 0||n||t.pending||u&&(o===void 0||s===void 0),viaEdit:u,now:u,ready:!a||c!==void 0}}function dve(e,t){let[n,r]=(0,m.useState)(!1),i=(0,m.use)(q8),a=(0,m.use)(Y8),o=v8();if(!i||o===void 0)return;let s=new Set(e.map(e=>e.id)),c=o.outputs.flatMap(e=>s.has(e.output.id)&&e.workKey.startsWith(`image:`)?[e.workKey]:[]);if(c.length!==0)return{count:c.length,asking:n,act:()=>r(!0),confirm:()=>{r(!1),a?.(c)},dismiss:()=>r(!1),unavailable:t||a===void 0}}var fve=200,pve=K({seconds:W(),peaks:G(W())});function mve(e){if(e===void 0)return;let t;try{t=new URL(e,window.location.href)}catch{return}if(t.pathname.startsWith(`/files/`))return t.searchParams.set(`waveform`,String(fve)),t.toString()}function hve(e){let{api:t}=R(),n=mve(e);return N({queryKey:[`waveform`,n],enabled:n!==void 0,staleTime:1/0,retry:!1,queryFn:async()=>{if(n===void 0)return[];let e=await t.fetch(n);if(!e.ok)throw mo(e,void 0);let{peaks:r}=Co(pve,await e.json()),i=Math.max(0,...r);return i===0?[]:r.map(e=>e/i)}}).data}function Q8(e){return(0,h.jsx)(G8,{...e,waveform:hve(e.src)})}var $8=[{role:`audio_intro`,segment:`intro`,name:`Intro`},{role:`audio_body`,segment:`body`,name:`Body`},{role:`audio_outro`,segment:`outro`,name:`Outro`}];function gve({stage:e,project:t,outputs:n,busy:r}){let{api:i}=R(),a=N(Zy(i)),o=P8(t.id),s=d8(n,e),c=s.filter(e=>e.role===`audio_levelled`),l=$8.flatMap(e=>{let t=f8(s,e.role),n=c.find(t=>t.meta.segment===e.segment)??t;return n===void 0?[]:[{...e,output:n,...t===void 0||t===n?{}:{plain:t}}]}),u=$8.flatMap(e=>{let t=c.find(t=>t.meta.segment===e.segment)?.meta.loudness;return t===void 0?[]:[{name:e.name,report:t}]}),d=l.find(e=>e.output.meta.voice!==void 0)?.output.meta,f=l.length>0?d?.voice:t.config.audio?.voice,p=l.length>0?d?.provider:t.config.audio?.provider,m=a.data?.voices.find(e=>e.voiceId===f&&e.provider===p)?.name??f;return(0,h.jsxs)(C8,{children:[e.state===`running`?(0,h.jsx)(K8,{projectId:t.id}):null,l.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No narration has landed yet.`}):l.map(e=>(0,h.jsx)(_ve,{name:e.name,output:e.output,...e.plain===void 0?{}:{plain:e.plain}},e.role)),(0,h.jsx)(k8,{files:$_e(s,l,n.find(e=>e.role===`script_md`))}),u.length===0?null:(0,h.jsx)(A8,{children:u.map(({name:e,report:t})=>u.length===1?IO(t):`${e}: ${IO(t)}`).join(` `)}),(0,h.jsxs)(U8,{label:`How it was recorded`,children:[m===void 0?null:(0,h.jsx)(W8,{label:`Voice`,children:m}),(0,h.jsx)(W8,{label:`Chunking`,children:vve(yve(t.config.chunking))}),tve(s)?(0,h.jsx)(W8,{label:`Text files`,children:(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Clean narration is the spoken text used for captions. The TTS script adds delivery cues, with a blank line between requests. Uploaded audio has no TTS request.`})}):null]}),(0,h.jsx)(z8,{review:F8(o,{itemKey:`narration`}),projectId:t.id,busy:r}),(0,h.jsx)(uve,{outputs:s})]})}function _ve({name:e,output:t,plain:n}){let r=y8(t),i=X8(t),a=X8(n)||n===void 0?void 0:n,o=y8(i?a:void 0);return(0,h.jsxs)(`div`,{className:`grid grid-cols-[64px_minmax(0,1fr)] items-center gap-3 text-small`,children:[(0,h.jsx)(w8,{children:e}),(0,h.jsx)(Q8,{label:`${e} narration`,src:r?.url,className:`max-w-[640px]`}),i?(0,h.jsx)(`p`,{className:`col-start-2 m-0 text-small text-ink-2`,children:a===void 0?`Outdated: this is the narration from before your last change. The new one is made when the run carries on: press Continue the run, or Remake at the top of the page.`:`Outdated: this is the levelled narration from before your last change. The new narration is below as it was spoken; it is levelled when the run carries on: press Continue the run, or Remake at the top of the page.`}):null,i&&a!==void 0?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(w8,{children:`New`}),(0,h.jsx)(Q8,{label:`${e} narration, new, before levelling`,src:o?.url,className:`max-w-[640px]`})]}):null]})}function vve(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yve(e){return e===void 0||e.mode===`whole`?`the whole text as one request`:e.mode===`paragraph`?`one request per paragraph`:e.mode===`characters`?`every ${String(e.characters??3e3)} characters`:`every ${String(e.words??500)} words`}function bve({stage:e,project:t,outputs:n}){let r=f8(d8(n,e),`document_pdf`),i=y8(r),a=CS(t.config.document);return(0,h.jsxs)(C8,{children:[r===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.state===`running`?`The PDF will be saved when rendering finishes.`:`No PDF has been saved yet.`}):(0,h.jsx)(k8,{files:[{output:r,label:`PDF`}],label:`Download PDF`,children:i?.folder?(0,h.jsxs)(Vx,{href:`${i.url}?inline=1`,target:`_blank`,rel:`noopener`,variant:`secondary`,children:[(0,h.jsx)(Mc,{"aria-hidden":`true`,strokeWidth:1.75}),`Open PDF`]}):null}),(0,h.jsx)(U8,{label:`PDF details`,children:(0,h.jsx)(W8,{label:`Theme`,children:a})})]})}var xve={research:`Generates fresh research and affected article, narration, entries, thumbnail and exports; previous outputs stay in History.`,article:`Generates a fresh article and affected narration, entries, thumbnail and exports; previous outputs stay in History.`,audio:`Regenerates narration and affected exports, keeping compatible cue preparation; previous outputs stay in History.`,images:`Regenerates generated images and affected video, keeping supplied images and narration; previous outputs stay in History.`,thumbnail:`Regenerates the thumbnail without changing the main video; previous outputs stay in History.`,video:`Rebuilds local exports from saved media without regenerating narration or images; previous outputs stay in History.`,document:`Renders the PDF again from the saved article and title without regenerating anything else; previous outputs stay in History.`};function e5(e){switch(e.kind){case`cancel`:return{title:`Cancel this run?`,consequence:`Stops every running stage; finished outputs are kept.`,verb:`Cancel run`,dismiss:`Keep running`};case`rerun`:return{title:`Re-run this stage?`,consequence:xve[e.stage],verb:`Re-run`,dismiss:`Cancel`};case`delete-image`:return{title:`Delete this image?`,consequence:`Removes the image and re-renders video when enabled.`,verb:`Delete`,dismiss:`Cancel`};case`regenerate-image`:return e.thumbnail?{title:`Regenerate this thumbnail?`,consequence:`Makes a new thumbnail, one paid image call. The video and shorts are not touched; the PDF's cover follows the first thumbnail. The old one stays in History.`,verb:`Regenerate`,dismiss:`Cancel`}:{title:`Regenerate this image?`,consequence:e.now?`Makes a new image now, one paid image call. The video keeps the current one until you remake it; the old image stays in History.`:`Replaces the image with a new one and re-renders video when enabled.`,verb:`Regenerate`,dismiss:`Cancel`};case`save-article`:return{title:`Save the edited article?`,consequence:`Replaces the article, then updates the enabled narration and final export.`,verb:`Save & update outputs`,dismiss:`Cancel`};case`discard-article`:return{title:`Discard these edits?`,consequence:`The article goes back to the text on disk.`,verb:`Discard`,dismiss:`Keep editing`}}}function Sve(e,t){let{config:n,content:r,fingerprints:i}=e.revision;switch(t){case`research`:return n.sources.research===`generate`;case`article`:return n.sources.article===`generate`&&!r.articleEdited;case`audio`:return n.sources.audio===`generate`&&Object.keys(i).some(e=>!/^audio:(body:.+|intro|outro):[0-9]+$/.test(e)&&!/^audio:(body|intro|outro):future$/.test(e)?!1:!Object.entries(r.narrationOverrides).some(([t,n])=>n.kind===`asset`&&(e===t||e.startsWith(`${t}:`))));case`images`:return n.sources.images!==`off`&&r.imageOrder.some(e=>r.imageDefinitions[e]?.source===`generate`);case`thumbnail`:return n.sources.thumbnail===`from_prompt`||n.sources.thumbnail===`prompt_by_llm`;case`video`:return n.sources.video!==`off`||n.sources.audio!==`off`;case`document`:return dS(n.sources,`document`)===`generate`}}function t5(e){switch(e){case`research`:case`article`:return`article`;case`audio`:return`narration`;case`images`:case`thumbnail`:return`images`;case`video`:return`video`;case`document`:return`document`}}var n5={research:`Research`,article:`Article`,audio:`Narration`,images:`Images`,thumbnail:`Thumbnail`,video:`Video`,document:`PDF`},r5=e=>/^[A-Z]{2}/.test(e)?e:e.charAt(0).toLowerCase()+e.slice(1);function Cve(e){let{project:t,stages:n}=e,r=t.config,i=e=>e===`video`&&JM(r)===`audio`?`Audio export`:n5[e];if(e.sample)return{situation:`sample`,tone:`info`,status:`Sample project`,title:`This is the sample project, finished and free to explore.`,why:`It is read-only. Your own copy can be edited and made again.`,action:{label:`Make my own copy`,intent:{kind:`copy-sample`}}};if(t.status===`paused`){let t=Ove(e.outdated);return{situation:`paused`,tone:`waiting`,status:`Paused`,title:`The run is paused.`,why:t===void 0?`Everything made so far is kept. Continuing picks up where it stopped.`:`Everything made so far is kept. Still to make: ${t}. They stay outdated until you continue.`,action:{label:`Continue the run`,intent:{kind:`resume`}}}}let a=n.find(e=>e.state===`failed`&&e.retryAt===void 0);if(a!==void 0){let t=i(a.kind),n=e.fixOf(a),r={label:`Try ${r5(i5(t))} again`,intent:{kind:`retry`,stage:a.kind}},o={situation:`failed`,tone:`failed`,status:`Failed`,section:t5(a.kind),...a.failureReason===null?{}:{detail:a.failureReason}};switch(n?.kind){case`sign-in`:return{...o,title:`${n.label.replace(/^Sign in to /,``)} is signed out, so ${r5(i5(t))} stopped.`,why:`Copy the sign-in command (${n.command}), run it in a terminal on the computer running Slopify and sign in, then press Check again. Once ${n.label.replace(/^Sign in to /,``)} is signed in, Slopify tries ${r5(i5(t))} again.`,action:{label:`Copy sign-in command`,intent:{kind:`sign-in`,stage:a.kind,fix:n}}};case`refused`:return{...o,title:`A content filter refused a prompt, so ${r5(i5(t))} stopped.`,why:n.soften?`Softening rewrites each refused prompt without what the filter flagged, then draws it again.`:`Change the prompt in the project settings, then try again.`,action:n.soften?{label:n.label,intent:{kind:`soften`,stage:a.kind}}:{label:`Edit the prompt`,intent:{kind:`edit`}}};case`switch-model`:return{...o,title:`The model for ${r5(i5(t))} is no longer offered.`,why:`Pick another model in the project settings, then try again.`,action:{label:`Switch model`,intent:{kind:`edit`}}};case`provider-settings`:return{...o,title:`The provider did not accept its key, so ${r5(i5(t))} stopped.`,why:`Check the key in Settings, then try again.`,action:{label:n.label,intent:{kind:`open-settings`,section:`providers`}}};case`free-space`:return{...o,title:`The disk is full, so ${r5(i5(t))} stopped.`,why:`Storage in Settings shows what can go. Then try again.`,action:{label:n.label,intent:{kind:`open-settings`,section:`storage`}}};case void 0:return{...o,title:`${t} stopped with an error.`,why:`Trying again keeps everything already made.`,action:r}}}let o=e.held[0];if(o!==void 0){let e=i(o.stage);return{situation:`held`,tone:`waiting`,status:`Waiting for you`,title:`The ${r5(e)} ${Eve(e)} ready for your review.`,why:o.dependents.length===0?`Approving marks it reviewed.`:`Approving lets ${a5(o.dependents.map(e=>r5(i5(i(e)))))} run. Nothing after it runs until you do.`,action:{label:wve(o,i),intent:{kind:`approve`,gate:o}},section:t5(o.stage)}}let s=n.find(e=>e.state===`failed`&&e.retryAt!==void 0),c=e.waits[0];if(c!==void 0||s!==void 0){if(c!==void 0){let t=VH(e.waits);return{situation:`waiting`,tone:`waiting`,status:`Waiting for limits`,title:`${BH(e.waits,e.clock)??``}.`,why:`Nothing to do: the run carries on by itself when they reset, and work that does not need ${t} keeps going.`,section:t5(c.stage)}}if(s!==void 0)return{situation:`waiting`,tone:`waiting`,status:`Waiting to try again`,title:`${i(s.kind)} will try again by itself at ${e.clock(s.retryAt??``)}.`,why:`Nothing to do: the run carries on when it does.`,section:t5(s.kind),...s.failureReason===null?{}:{detail:s.failureReason}}}let l=n.find(e=>e.state===`running`);if(t.status===`running`||l!==void 0)return{situation:`running`,tone:`running`,status:`Running`,title:l===void 0?`The run is starting.`:`Making the ${r5(i(l.kind))}${Tve(l)}.`,why:`Pausing lets the current call finish and keeps everything made so far.`,action:{label:`Pause`,intent:{kind:`pause`}},...l===void 0?{}:{section:t5(l.kind)}};if(t.status===`pending`&&t.setAside===!0)return e.uploadReady?{situation:`done`,tone:`done`,status:`Kept as is`,title:`The video is ready; what is left won't run.`,why:`Prepare upload lays out the file, title, description, thumbnails and tags in the order YouTube Studio asks for them. Editing the project brings the rest back to Needs you.`,action:{label:`Prepare upload`,intent:{kind:`prepare-upload`}},section:`youtube`}:{situation:`done`,tone:`done`,status:`Kept as is`,title:`Kept as is: what is left won't run.`,why:`Everything made is kept. Editing the project brings the rest back to Needs you.`};if(e.resumable||t.status===`canceled`||t.status===`failed`&&a===void 0)return{situation:`stopped`,tone:`off`,status:t.status===`canceled`?`Canceled`:`Stopped`,title:`The run stopped before it finished.`,why:`Continuing makes only what is missing; everything made so far is kept.`,action:{label:`Continue the run`,intent:{kind:`resume`}}};if(t.status===`pending`)return{situation:`queued`,tone:`off`,status:`Queued`,title:`Waiting for its turn.`,why:`It starts by itself when the videos ahead of it are done.`};let u=Dve(e.outdated);if(u!==void 0)return{situation:`outdated`,tone:`info`,status:`Outdated`,title:u.count===1||u.singular?`The ${u.noun} ${u.noun.endsWith(`s`)?`are`:`is`} outdated after your edit.`:`${String(u.count)} ${u.plural} are outdated after your edit.`,why:`They keep their current version until you remake them. Nothing else is made again.`,action:{label:u.count===1||u.singular?`Remake the outdated ${u.noun}`:`Remake ${String(u.count)} outdated ${u.plural}`,intent:{kind:`remake`,workKeys:u.workKeys}},section:u.section};if(t.status===`done`&&r.mode===`short`)return{situation:`done`,tone:`done`,status:`Done`,title:`The short is ready.`,why:`Play opens set up for a long video on the same topic, with the same starter pack and providers. Nothing starts until you press Play.`,action:{label:`Make the full video on this topic`,intent:{kind:`full-video`}}};if((t.status===`done`||t.status===`partial`)&&e.uploadReady)return{situation:`done`,tone:`done`,status:`Done`,title:`The video is ready.`,why:`Prepare upload lays out the file, title, description, thumbnails and tags in the order YouTube Studio asks for them.`,action:{label:`Prepare upload`,intent:{kind:`prepare-upload`}},section:`youtube`}}function wve(e,t){if(e.dependents.includes(`video`))return`Approve and render the video`;if(e.dependents.includes(`images`))return`Approve and make the images`;if(e.dependents.includes(`audio`))return`Approve and record the narration`;let n=e.dependents[0];return n===void 0?`Approve the ${r5(t(e.stage))}`:`Approve and make the ${r5(t(n))}`}function Tve(e){let t=eN(e);return t===void 0?e.progressTotal===null||e.progressTotal<=0?``:` · ${String(Math.floor(e.progressCurrent??0))} of ${String(e.progressTotal)}`:` · ${t}`}function i5(e){return/s$/i.test(e)?e:`the ${r5(e)}`}function Eve(e){return/s$/i.test(e)?`are`:`is`}function a5(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)??``}`}var o5=[{id:`article`,noun:`article`,plural:`article files`,singular:!0,section:`article`,roles:[`notes`,`sources`,`article_md`,`article_txt`,`script_md`],counted:[`article_md`]},{id:`narration`,noun:`narration`,plural:`narration parts`,singular:!0,section:`narration`,roles:[`narration_txt`,`tts_script`,`glossary`,`audio_body`,`audio_intro`,`audio_outro`,`audio_levelled`],counted:[`audio_body`]},{id:`reference`,noun:`establishing image`,plural:`establishing images`,singular:!0,section:`images`,roles:[`reference`],counted:[`reference`]},{id:`images`,noun:`image`,plural:`images`,singular:!1,section:`images`,roles:[`image`],counted:[`image`]},{id:`animated`,noun:`animated image`,plural:`animated images`,singular:!1,section:`images`,roles:[`animated_image`],counted:[`animated_image`]},{id:`thumbnails`,noun:`thumbnail`,plural:`thumbnails`,singular:!1,section:`images`,roles:[`thumbnail`],counted:[`thumbnail`]},{id:`video`,noun:`video`,plural:`video files`,singular:!0,section:`video`,roles:[`video`,`audio_export`,`audio_mp3`,`audio_m4b`,`render_params`,`subtitles_srt`,`subtitles_vtt`,`subtitle_words`,`subtitle_ass`,`subtitle_font`],counted:[`video`,`audio_export`]},{id:`shorts`,noun:`short`,plural:`shorts`,singular:!1,section:`shorts`,roles:[`shorts`,`short_image`,`short_video`],counted:[`short_video`]},{id:`youtube`,noun:`YouTube description`,plural:`YouTube descriptions`,singular:!0,section:`youtube`,roles:[`youtube_description`,`youtube_tags`,`youtube_pinned_comment`,`youtube_titles`],counted:[`youtube_description`]},{id:`document`,noun:`PDF`,plural:`PDFs`,singular:!0,section:`document`,roles:[`document_pdf`],counted:[`document_pdf`]}];function Dve(e){for(let t of o5){let n=e.filter(e=>t.roles.includes(e.role));if(n.length===0)continue;let r=n.filter(e=>t.counted.includes(e.role)).length;return{noun:t.noun,plural:t.plural,singular:t.singular,count:Math.max(1,r),workKeys:[...new Set(n.map(e=>e.workKey))],section:t.section}}}function Ove(e){let t=o5.flatMap(t=>{let n=e.filter(e=>t.roles.includes(e.role));if(n.length===0)return[];let r=Math.max(1,n.filter(e=>t.counted.includes(e.role)).length);return[t.singular?`the ${t.noun}`:r===1?`1 ${t.noun}`:`${String(r)} ${t.plural}`]});return t.length===0?void 0:a5(t)}function kve(e){return o5.flatMap(t=>{let n=e.filter(e=>t.roles.includes(e.role));if(n.length===0)return[];let r=Math.max(1,n.filter(e=>t.counted.includes(e.role)).length);return[{label:r===1||t.singular?`Remake the outdated ${t.noun}`:`Remake ${String(r)} outdated ${t.plural}`,workKeys:[...new Set(n.map(e=>e.workKey))],section:t.section,count:r}]})}function Ave({tone:e,status:t,title:n,why:r,action:i,className:a}){return(0,h.jsxs)(`section`,{"aria-label":`Next action`,className:I(`sl-next`,a),children:[(0,h.jsx)(Wx,{tone:e,children:t}),(0,h.jsx)(`p`,{className:`sl-next__title`,children:n}),r===void 0?null:(0,h.jsx)(`p`,{className:`sl-next__why`,children:r}),i===void 0?null:(0,h.jsx)(`div`,{className:`flex flex-col [&>*]:w-full`,children:i})]})}function jve({project:e,stages:t,resumable:n,sample:r,gates:i,outdated:a,waits:o,uploadReady:s,actions:c,controller:l,openSection:u,openUpload:d}){let{api:f}=R(),p=_(),h=Zi(),[g,v]=(0,m.useState)(),y=(0,m.useRef)(new Map),b=Cve({project:e,stages:t,resumable:n,sample:r,held:i.filter(e=>(e.state===`held`||e.state===`pending-review`)&&e.fingerprint===e.currentFingerprint).map(e=>({checkpointId:e.checkpointId,stage:e.stage,dependents:e.dependents})),outdated:a,waits:o,uploadReady:s,fixOf:t=>g3(t,e),clock:rN}),x=P({mutationFn:()=>By(f,e.id),onSuccess:async({projectId:e})=>{await p.invalidateQueries({queryKey:z.projects}),await h({to:`/projects/$projectId`,params:{projectId:e}})},onError:e=>v(`${xo(e.message)} The copy was not made. Press Make my own copy to try again.`)}),S=(0,m.useRef)(null),C=Fae(),w=P({mutationFn:async()=>{if(C===null)throw Error(`Play isn't available on this page. Reload the page`);if(C.review.starting||C.review.uncertain||C.review.created!==null)throw Error(`Play is starting a run from its open draft. Wait for it to start`);if(!await C.flush())throw Error(`The draft open in Play couldn't be saved. Open Play, save or discard it`);S.current??=crypto.randomUUID();let{draft:t}=await Iy(f,{projectId:e.id,draftId:S.current});if(await p.invalidateQueries({queryKey:[`play-drafts`]}),!await C.open(t.id))throw Error(`The full video's draft was made but didn't open. Open Play and pick it`);S.current=null,await h({to:`/play`})},onError:e=>v(`${xo(e.message)} Then press Make the full video on this topic again.`)}),T=P({mutationFn:async t=>{let n=i.find(e=>e.checkpointId===t.checkpointId);if(n===void 0)throw Error(`The review changed before it was approved. Reload the page.`);let r=`${n.checkpointId}:${n.fingerprint}`,a=y.current.get(r)??crypto.randomUUID();y.current.set(r,a);let o=await m3(f,e.id,n.checkpointId,{revisionId:n.revisionId,fingerprint:n.fingerprint,idempotencyKey:a});if(y.current.delete(r),!o.ok)throw Error(o.message)},onSettled:async()=>{await p.invalidateQueries({queryKey:u3(e.id)}),await p.invalidateQueries({queryKey:z.project(e.id)}),p.invalidateQueries({queryKey:z.projects})},onError:e=>v(`${xo(e.message)} Press the approve button again to check whether it went through.`)});return{next:b,run:e=>{switch(v(void 0),e.kind){case`copy-sample`:x.mutate();return;case`resume`:case`pause`:c.run({kind:e.kind});return;case`retry`:case`soften`:c.run({kind:e.kind,stage:e.stage});return;case`sign-in`:I1(e.fix.command).then(t=>v(t?`Copied ${e.fix.command}. Run it in a terminal on the computer running Slopify, sign in, then press Check again.`:`Couldn't copy: the browser blocked the clipboard. Type ${e.fix.command} in a terminal, sign in, then press Check again.`));return;case`approve`:T.mutate(e.gate);return;case`remake`:l.review({kind:`selected`,workKeys:e.workKeys},{autoStart:!0});return;case`edit`:u(`settings`);return;case`open-settings`:h({to:`/settings`,search:{section:e.section}});return;case`prepare-upload`:d();return;case`full-video`:w.mutate();return}},pending:x.isPending||w.isPending||T.isPending||c.pending||l.pending,message:g}}function Mve(e){switch(e.kind){case`copy-sample`:return`Copying…`;case`resume`:return`Continuing…`;case`pause`:return`Pausing…`;case`approve`:return`Approving…`;case`remake`:return`Starting the remake…`;case`retry`:return`Trying again…`;case`soften`:return`Softening…`;case`full-video`:return`Opening Play…`;default:return}}function s5({state:e,variant:t,className:n}){let[r,i]=(0,m.useState)(!1),a=e.next?.action;if(a===void 0)return null;let o=a.intent;if(o.kind===`sign-in`)return(0,h.jsx)(L1,{fix:o.fix,variant:t,retry:{run:()=>e.run({kind:`retry`,stage:o.stage}),busy:e.pending}});if(o.kind===`open-settings`)return(0,h.jsx)(zx,{to:`/settings`,search:{section:o.section},variant:t,...n===void 0?{}:{className:n},children:a.label});let s=e.pending?Mve(o)??a.label:a.label;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:t,className:n,disabled:e.pending,disabledReason:`Working on the last press`,"aria-keyshortcuts":t===`primary`?ax(CM.nextAction):void 0,onClick:()=>o.kind===`soften`?i(!0):e.run(o),children:s}),o.kind===`soften`?(0,h.jsx)(Dy,{open:r,tone:`primary`,title:`Soften the refused prompt and try again?`,consequence:`Your project's AI model rewrites each refused prompt without what a content filter could flag, keeping the scene and style. The image is then drawn again from the new wording, which it keeps as its prompt. The AI call and the new image are charged like any other.`,confirmLabel:`Soften and retry`,cancelLabel:`Keep the prompt`,pending:e.pending,onConfirm:()=>{i(!1),e.run(o)},onCancel:()=>i(!1)}):null]})}function Nve({state:e,feedback:t}){let n=e.next;return n===void 0&&t===void 0&&e.message===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[n===void 0?null:(0,h.jsx)(Ave,{tone:n.tone,status:n.status,title:n.title,...n.why===void 0?{}:{why:n.why},...n.action===void 0?{}:{action:(0,h.jsx)(s5,{state:e,variant:`primary`})}}),e.message===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:e.message}),t]})}var Pve={sample:void 0,paused:void 0,stopped:void 0,queued:void 0,running:void 0,failed:`danger`,held:`waiting`,waiting:`waiting`,outdated:`info`,done:void 0};function Fve({state:e,section:t}){let n=e.next;if(n===void 0||n.section!==t)return null;let r=Pve[n.situation];return r===void 0?null:(0,h.jsx)(pP,{className:`max-[1180px]:hidden`,tone:r,title:n.title,...n.action===void 0?{}:{actions:(0,h.jsx)(s5,{state:e,variant:`secondary`})},children:n.why===void 0&&n.detail===void 0?void 0:(0,h.jsxs)(h.Fragment,{children:[n.why===void 0?null:(0,h.jsx)(`span`,{className:`block`,children:n.why}),n.detail===void 0?null:(0,h.jsxs)(`details`,{className:`mt-1`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer`,children:`Error details`}),(0,h.jsx)(`pre`,{className:`m-0 mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-small`,children:n.detail})]})]})})}var Ive={research:`Research again`,article:`Write the article again`,audio:`Record the narration again`,images:`Make all images again`,thumbnail:`Make the thumbnails again`,video:`Render the video again`,document:`Render the PDF again`};function c5(e,t){return e===`video`&&t.config.sources.video===`off`?`Export the audio again`:Ive[e]}function l5({id:e,title:t,kicker:n,stages:r,project:i,outputs:a,actions:o,next:s,active:c,meta:l,head:u=!0,extra:d,resumable:f=!1,children:p}){let m=r[0],g=r.some(e=>o.refusal?.stage===e.kind)?o.refusal?.message:void 0,_=r.filter(t=>t.state===`failed`&&t.retryAt===void 0&&(s.next?.situation!==`failed`||s.next.section!==e)),v=r.find(e=>e.state===`running`),y=v===void 0?void 0:nN(v),b=l??(m===void 0?void 0:r.filter(e=>e.state!==`skipped`).map(e=>e===m?$M(e,a,i,f):`${n5[e.kind]}: ${$M(e,a,i,f)}`).join(` · `));return(0,h.jsxs)(`section`,{hidden:!c,"aria-label":t,"data-tour":m===void 0?void 0:`project-${m.kind}`,className:`flex min-w-0 flex-col gap-5`,children:[u?(0,h.jsxs)(V,{row:!0,title:t,...n===void 0?{}:{kicker:n},...b===void 0||b===``?{}:{meta:b},children:[d,(0,h.jsx)(d5,{stages:r,project:i,actions:o})]}):null,y===void 0||v===void 0?null:(0,h.jsx)(K2,{value:y,label:`${n5[v.kind]} progress`,valueText:$M(v,a,i,f)}),(0,h.jsx)(Fve,{state:s,section:e}),_.map(e=>(0,h.jsx)(pP,{tone:`danger`,title:`${n5[e.kind]} stopped with an error.`,children:e.failureReason===null?void 0:(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{className:`cursor-pointer`,children:`Error details`}),(0,h.jsx)(`pre`,{className:`m-0 mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-small`,children:e.failureReason})]})},e.id)),g===void 0?null:(0,h.jsx)(pP,{tone:`danger`,title:g,actions:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:o.dismissRefusal,children:`Dismiss`})}),m?.state===`running`&&m.kind!==`article`&&m.kind!==`images`&&m.kind!==`video`&&m.kind!==`document`?(0,h.jsx)(A3,{projectId:i.id,stage:m.kind}):null,p]})}function u5({stage:e,project:t,name:n}){return e===void 0||e.state===`skipped`?(0,h.jsx)(J1,{title:`${n} is off for this run.`,children:`Switch it on in the project settings to make it.`}):(0,h.jsx)(J1,{title:`No ${n.toLowerCase()} yet.`,children:t.status===`paused`?`It is made once you continue the run.`:`It starts when the steps before it are done. Finished work elsewhere can be looked at meanwhile.`})}function d5({stages:e,project:t,actions:n}){let r=(0,m.useContext)(q8),i=v8(),[a,o]=(0,m.useState)(),s=e.filter(e=>e.state!==`skipped`&&e.state!==`pending`&&(!r||i!==void 0&&Sve(i,e.kind)));if(s.length===0)return null;let c=n.pending||t.status===`running`||e.some(e=>e.state===`running`),l=a===void 0?void 0:e5({kind:`rerun`,stage:a});return(0,h.jsxs)(h.Fragment,{children:[s.map(e=>(0,h.jsxs)(L,{size:`small`,disabled:c,disabledReason:`Wait until the work on this project is done`,onClick:()=>o(e.kind),children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),c5(e.kind,t)]},e.id)),(0,h.jsx)(Dy,{open:a!==void 0,title:a===void 0?``:`${c5(a,t)}?`,consequence:l?.consequence??``,confirmLabel:a===void 0?``:c5(a,t),cancelLabel:`Keep what is there`,pending:n.pending,onConfirm:()=>{let e=a;o(void 0),e!==void 0&&n.run({kind:`rerun`,stage:e})},onCancel:()=>o(void 0)})]})}function Lve({stage:e,project:t,outputs:n,actions:r,busy:i}){let a=d8(n,e),o=P8(t.id),s=mS(t.config),c=Array.from({length:s},(e,t)=>t+1).map(e=>({variant:e,output:a.find(t=>t.role===`thumbnail`&&(t.meta.index??1)===e)})),l=c.flatMap(e=>e.output===void 0?[]:[e.output]),u=b8(l),[d,f]=(0,m.useState)(null),p=l.filter(e=>u.has(e.id)),g=p.map(e=>({src:u.get(e.id)?.url??``,alt:`Thumbnail ${String(e.meta.index??1)}`})),_=t.format===`9:16`,v=({variant:n,output:a})=>(0,h.jsx)(Rve,{variant:n,count:s,output:a,review:F8(o,{outputId:a?.id}),stage:e,project:t,actions:r,busy:i,onOpen:()=>f(a===void 0?null:zve(p,a))},n);return(0,h.jsxs)(`section`,{"aria-label":s===1?`Thumbnail`:`Thumbnails`,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsxs)(V,{title:s===1?`Thumbnail`:`Thumbnails`,meta:s===1?`The picture YouTube shows before the video plays`:`${String(s)} variants for YouTube's Test & compare`,children:[(0,h.jsx)(D8,{variant:`secondary`,files:l.map(e=>({output:e,label:s===1?`Thumbnail`:`Thumbnail ${String(e.meta.index??1)}`}))}),(0,h.jsx)(O8,{output:l[0]}),(0,h.jsx)(d5,{stages:[e],project:t,actions:r})]}),c.length===1?(0,h.jsx)(`div`,{className:_?`max-w-[280px]`:`max-w-[480px]`,children:c.map(v)}):(0,h.jsx)(A0,{list:!0,label:`Thumbnail variants`,children:c.map(e=>(0,h.jsx)(`li`,{className:`min-w-0`,children:v(e)},e.variant))}),(0,h.jsx)(j0,{items:g,index:d,onIndex:f,onClose:()=>f(null),actions:(e,t)=>{let n=p[t];return n===void 0?null:(0,h.jsx)(g5,{output:n,name:s===1?`the thumbnail`:`thumbnail ${String(n.meta.index??1)}`,actions:r,busy:i},n.id)}})]})}function Rve({variant:e,count:t,output:n,review:r,stage:i,project:a,actions:o,busy:s,onOpen:c}){let l=y8(n),u=Z8(n,o,s),d=t===1?`the thumbnail`:`thumbnail ${String(e)}`;qb({id:`project.thumbnail.${String(e)}`,title:t===1?`Regenerate the thumbnail`:`Regenerate thumbnail ${String(e)}`,group:`This project`,context:a.title,keywords:[`thumbnail`,`redraw`,`remake`],run:()=>u.act(`regenerate-image`)});let f=r!==void 0&&!r.passed&&r.action===null,p=String.fromCharCode(64+e),m=u.asking===void 0||n===void 0?void 0:e5({kind:u.asking,outputId:n.id,now:u.now,thumbnail:!0});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(k0,{alt:t===1?`Thumbnail for ${a.title}`:`Thumbnail ${String(e)} for ${a.title}`,aspect:f5(a.format),...l===void 0?{}:{src:l.url},...n===void 0&&i.state===`running`?{generating:`Making the thumbnail`}:{},title:t===1?`Thumbnail`:p,...n===void 0?{meta:Bve(i)}:{},onOpen:c,openLabel:`Open ${d} full size`,...r===void 0?{}:{badge:(0,h.jsx)(B8,{review:r})},actionsShown:f,...n===void 0?{}:{actions:(0,h.jsxs)(h.Fragment,{children:[f&&r!==void 0?(0,h.jsx)(R8,{review:r,projectId:a.id,busy:s}):null,(0,h.jsxs)(L,{size:`small`,disabled:u.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>u.act(`regenerate-image`),"aria-label":`Regenerate ${d}`,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate`]}),l===void 0?null:(0,h.jsx)(_5,{href:l.url,label:`Download ${d}`})]})}}),(0,h.jsx)(Dy,{open:u.asking!==void 0,tone:`primary`,title:m?.title??``,consequence:m?.consequence??``,confirmLabel:`Regenerate the thumbnail`,cancelLabel:`Keep it`,pending:o.pending,onConfirm:u.confirm,onCancel:u.dismiss})]})}function zve(e,t){let n=e.indexOf(t);return n===-1?null:n}function Bve(e){switch(e.state){case`running`:return`Being made`;case`failed`:case`canceled`:return`Not made`;default:return`Not made yet`}}function Vve(e,t){let n=e.filter(e=>e.role===`image`),r=new Map;for(let e of n){let t=e.meta.promptName??`Images`;r.set(t,[...r.get(t)??[],e])}let i=t.filter(e=>r.has(e)),a=[...r.keys()].filter(e=>!i.includes(e)).sort();return[...i,...a].flatMap(e=>{let t=r.get(e);return t===void 0?[]:[{name:e,images:[...t].sort(Hve)}]})}function Hve(e,t){return(e.meta.index??0)-(t.meta.index??0)}function Uve(e,t,n,r,i){let a=gy(),[o,s]=(0,m.useState)(),c=(r,i)=>{let o=r===`image`?t:n,c=r===`image`?`image`:`on-screen card`;if(i===void 0){a(`Type the ${c}'s number with the command, for example "regenerate ${c} 3".`);return}let l=o.find(e=>e.meta.index===i);if(l===void 0){let t=o.flatMap(e=>e.meta.index===void 0?[]:[e.meta.index]);a(t.length===0?`${e.title} has no ${c}s yet, so there is no ${c} ${String(i)} to regenerate. They appear under Images once the run makes them.`:`${e.title} has no ${c} ${String(i)}: its ${c}s are numbered ${String(Math.min(...t))} to ${String(Math.max(...t))}. Type one of those, or press Regenerate on the ${c} in Images.`,`error`);return}s(e=>({image:l,name:`${c[0]?.toUpperCase()??``}${c.slice(1)} ${String(i)}`,nonce:(e?.nonce??0)+1}))};return qb({id:`project.image.regenerate`,title:`Regenerate an image`,numbered:e=>`Regenerate image ${String(e)}`,group:`This project`,context:e.title,keywords:[`image`,`picture`,`redraw`,`remake`],searchOnly:!0,run:e=>c(`image`,e)}),qb({id:`project.card.regenerate`,title:`Regenerate an on-screen card`,numbered:e=>`Regenerate on-screen card ${String(e)}`,group:`This project`,context:e.title,keywords:[`card`,`figure`,`table`,`redraw`,`remake`],searchOnly:!0,run:e=>c(`card`,e)}),Sx(_x.regenerateImage(e.id),e=>c(`image`,e)),o===void 0?null:(0,h.jsx)(Wve,{request:o,actions:r,busy:i},o.nonce)}function Wve({request:e,actions:t,busy:n}){let r=gy(),i=Z8(e.image,t,n),a=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!a.current&&i.ready&&(a.current=!0,i.unavailable?r(`${e.name} can't be regenerated while work on this project is running. Wait until it finishes, then run the command again or press Regenerate on it in Images.`,`error`):i.act(`regenerate-image`))},[i,r,e.name]);let o=i.asking===void 0?void 0:e5({kind:i.asking,outputId:e.image.id,now:i.now});return(0,h.jsx)(Dy,{open:i.asking!==void 0,tone:`primary`,title:o?.title??``,consequence:o?.consequence??``,confirmLabel:`Regenerate the image`,cancelLabel:`Keep it`,pending:t.pending,onConfirm:i.confirm,onCancel:i.dismiss})}function f5(e){return e===`9:16`?`portrait`:`landscape`}function Gve({stage:e,companion:t,project:n,outputs:r,actions:i,busy:a}){let o=P8(n.id),s=d8(r,e),c=Vve(s,n.config.imagePrompts?.map(e=>e.name)??[]),l=c.flatMap(e=>e.images),u=s.filter(e=>e.role===`figure_card`&&(e.meta.format??n.format)===n.format).toSorted((e,t)=>(e.meta.index??0)-(t.meta.index??0)),d=[...l,...u],f=Uve(n,l,u,i,a),p=dve(l,a),g=b8(d),[_,v]=(0,m.useState)(null),y=d.filter(e=>g.has(e.id)),b=y.map(e=>({src:g.get(e.id)?.url??``,alt:e.role===`figure_card`?`On-screen card ${String(e.meta.index??``)}`:e.meta.prompt??`Image ${String(e.meta.index??``)}`,...p5(e)?{kind:`video`}:{},caption:e.role===`figure_card`?`Shown while the narration describes it`:e.meta.prompt??e.meta.promptName??`Slideshow image`})),x=n.config.reference===void 0?null:(0,h.jsx)(Kve,{image:f8(s,`reference`),format:n.format,generated:n.config.reference.source===`prompt`,affected:l.length,actions:i,busy:a}),S=t?.kind===`thumbnail`?(0,h.jsx)(Lve,{stage:t,project:n,outputs:r,actions:i,busy:a}):null,C=e.state===`running`&&e.progressTotal!==null?Math.max(0,e.progressTotal-l.length):0,w=o.filter(e=>l.some(t=>t.id===e.outputId)),T=w.filter(e=>e.passed&&e.attempt>1).length,E=w.filter(e=>!e.passed&&e.action===null).length,D=[l.length===0?void 0:`${String(l.length)} in the video`,w.length===0?void 0:`reviewed`,T===0?void 0:`${String(T)} redone after review`,E===0?void 0:`${String(E)} flagged`].filter(e=>e!==void 0).join(` · `);return(0,h.jsxs)(h.Fragment,{children:[f,x,x===null||S===null&&e.state===`skipped`?null:(0,h.jsx)(Cq,{className:`m-0`}),S,S===null||e.state===`skipped`?null:(0,h.jsx)(Cq,{className:`m-0`}),e.state===`skipped`?null:(0,h.jsxs)(`section`,{"aria-label":`Slideshow images`,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsxs)(V,{title:`Images`,...D===``?{}:{meta:D},children:[p===void 0?null:(0,h.jsxs)(L,{size:`small`,disabled:p.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:p.act,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate all`]}),p===void 0?null:(0,h.jsx)(Dy,{open:p.asking,tone:`primary`,title:`Regenerate all ${String(p.count)} images?`,consequence:`Makes ${String(p.count)} new images now, one paid image call each. The video keeps the current ones until you remake it; the old images stay in History.`,confirmLabel:`Regenerate them`,cancelLabel:`Keep them`,pending:i.pending,onConfirm:p.confirm,onCancel:p.dismiss}),(0,h.jsx)(G_e,{projectId:n.id,asset:`images.zip`,label:`Download all`}),(0,h.jsx)(d5,{stages:[e],project:n,actions:i})]}),c.length===0&&C===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.state===`pending`?`The images are made once the narration is timed.`:`No images have landed yet.`}):null,c.map((e,t)=>(0,h.jsx)(v5,{name:e.name,count:e.images.length,showName:c.length>1,trailing:t===c.length-1&&C>0?Array.from({length:Math.min(C,3)},(e,t)=>(0,h.jsx)(k0,{alt:`An image being made`,aspect:f5(n.format),generating:t===0?`Drawing the next image`:`Waiting its turn`},t)):null,children:t=>e.images.slice(0,t).map(e=>(0,h.jsx)(y5,{image:e,projectId:n.id,review:F8(o,{outputId:e.id}),format:n.format,actions:i,busy:a,onOpen:()=>v(h5(y,e))},e.id))},e.name)),u.length===0?null:(0,h.jsx)(v5,{name:`From the article`,count:u.length,showName:!0,children:e=>u.slice(0,e).map(e=>(0,h.jsx)(y5,{image:e,projectId:n.id,review:void 0,format:n.format,actions:i,busy:a,card:!0,onOpen:()=>v(h5(y,e))},e.id))}),c.length===0&&C>0?(0,h.jsx)(A0,{label:`Images being made`,children:Array.from({length:Math.min(C,3)},(e,t)=>(0,h.jsx)(k0,{alt:`An image being made`,aspect:f5(n.format),generating:t===0?`Drawing the first image`:`Waiting its turn`},t))}):null,(0,h.jsx)(j0,{items:b,index:_,onIndex:v,onClose:()=>v(null),actions:(e,t)=>{let n=y[t];return n===void 0?null:(0,h.jsx)(g5,{output:n,name:n.role===`figure_card`?`on-screen card${m5(n)}`:`image${m5(n)}`,actions:i,busy:a},n.id)}})]})]})}var p5=e=>/\.(mp4|mov|m4v|webm|mkv)$/i.test(e.path),m5=e=>e.meta.index===void 0?``:` ${String(e.meta.index)}`;function h5(e,t){let n=e.indexOf(t);return n===-1?null:n}function g5({output:e,name:t,actions:n,busy:r}){let i=y8(e),a=Z8(e,n,r),o=a.asking===void 0?void 0:e5({kind:a.asking,outputId:e.id,now:a.now});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(L,{size:`small`,disabled:a.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>a.act(`regenerate-image`),"aria-label":`Regenerate ${t}`,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate`]}),i===void 0?null:(0,h.jsx)(_5,{href:i.url,label:`Download ${t}`}),(0,h.jsx)(Dy,{open:a.asking!==void 0,tone:`primary`,title:o?.title??``,consequence:o?.consequence??``,confirmLabel:`Regenerate it`,cancelLabel:`Keep it`,pending:n.pending,onConfirm:a.confirm,onCancel:a.dismiss})]})}function _5({href:e,label:t,text:n}){return(0,h.jsxs)(Vx,{href:e,download:!0,"aria-label":t,title:t,size:`small`,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,strokeWidth:1.75}),n]})}function Kve({image:e,format:t,generated:n,affected:r,actions:i,busy:a}){let o=y8(e),s=Z8(e,i,a),[c,l]=(0,m.useState)(null);return(0,h.jsxs)(`section`,{"aria-label":`Establishing image`,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsx)(V,{kicker:`Reference · not in the video`,title:`Establishing image`,meta:`Every image follows it for the look, palette and style`,children:e!==void 0&&n?(0,h.jsx)(L,{disabled:s.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>s.act(`regenerate-image`),children:`Make the establishing image again`}):null}),(0,h.jsx)(k0,{className:`w-full max-w-[360px]`,alt:e?.meta.prompt??`Establishing image`,aspect:f5(t),...o===void 0?{}:{src:o.url},title:`Establishing image`,...e===void 0?{meta:`Not made yet`}:{},onOpen:()=>l(0),openLabel:`Open the establishing image full size`,...e===void 0||o===void 0?{}:{actions:(0,h.jsx)(_5,{href:o.url,label:`Download the establishing image`,text:`Download`})}}),n&&r>0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Making it again marks ${String(r)} image${r===1?``:`s`} outdated. They keep their current version until you remake them.`}):null,(0,h.jsx)(j0,{items:o===void 0?[]:[{src:o.url,alt:`Establishing image`,caption:e?.meta.prompt??`The reference every image follows`}],index:c,onIndex:l,onClose:()=>l(null),actions:()=>o===void 0?null:(0,h.jsxs)(h.Fragment,{children:[n?(0,h.jsxs)(L,{size:`small`,disabled:s.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>{l(null),s.act(`regenerate-image`)},"aria-label":`Make the establishing image again`,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate`]}):null,(0,h.jsx)(_5,{href:o.url,label:`Download the establishing image`})]})}),(0,h.jsx)(Dy,{open:s.asking!==void 0,tone:`primary`,title:`Make the establishing image again?`,consequence:`A new establishing image replaces this one${r>0?`, and the ${String(r)} images drawn from it become outdated until you remake them`:``}. The old one stays in History.`,confirmLabel:`Make it again`,cancelLabel:`Keep this one`,pending:i.pending,onConfirm:s.confirm,onCancel:s.dismiss})]})}function v5({name:e,count:t,showName:n,trailing:r,children:i}){let[a,o]=(0,m.useState)(!1),s=t>12&&!a;return(0,h.jsxs)(`section`,{"aria-label":`${e} × ${String(t)}`,className:`flex flex-col gap-3`,children:[n?(0,h.jsx)(`h3`,{className:`sl-kicker m-0`,children:`${e} × ${String(t)}`}):null,(0,h.jsxs)(A0,{children:[i(s?12:t),r]}),t>12?(0,h.jsx)(L,{variant:`quiet`,"aria-expanded":a,className:`self-start`,onClick:()=>o(e=>!e),children:a?`Show fewer`:`Show all ${String(t)} images`}):null]})}function y5({image:e,projectId:t,review:n,format:r,actions:i,busy:a,card:o=!1,onOpen:s}){let c=y8(e),l=m5(e),u=o?`on-screen card${l}`:`image${l}`,d=Z8(e,i,a),f=X8(e),p=n!==void 0&&!n.passed&&n.action===null,m=d.asking===void 0?void 0:e5({kind:d.asking,outputId:e.id,now:d.now});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(k0,{alt:o?`On-screen card${l}`:e.meta.prompt??`Slideshow ${u}`,kind:p5(e)?`video`:`image`,aspect:f5(r),...c===void 0?{}:{src:c.url},title:o?`Card${l}`:e.meta.prompt??`Image${l}`,...e.meta.index===void 0?{}:{meta:`#${String(e.meta.index)}`},onOpen:s,openLabel:`Open ${u} full size`,...n===void 0&&!f?{}:{badge:(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[f?(0,h.jsx)(Gx,{tone:`info`,children:`Outdated`}):null,n===void 0?null:(0,h.jsx)(B8,{review:n})]})},actionsShown:p,actions:(0,h.jsxs)(h.Fragment,{children:[p&&n!==void 0?(0,h.jsx)(R8,{review:n,projectId:t,busy:a}):null,(0,h.jsxs)(L,{size:`small`,disabled:d.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>d.act(`regenerate-image`),"aria-label":`Regenerate ${u}`,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate`]}),c===void 0?null:(0,h.jsx)(_5,{href:c.url,label:`Download ${u}`}),o?null:(0,h.jsx)(L,{size:`small`,variant:`destructive`,disabled:d.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>d.act(`delete-image`),"aria-label":`Delete ${u}`,title:`Delete ${u}`,children:(0,h.jsx)($c,{"aria-hidden":`true`,strokeWidth:1.75})})]})}),(0,h.jsx)(Dy,{open:d.asking!==void 0,tone:d.asking===`delete-image`?`destructive`:`primary`,title:m?.title??``,consequence:m?.consequence??``,confirmLabel:d.asking===`delete-image`?`Delete the image`:`Regenerate the image`,cancelLabel:`Keep it`,pending:i.pending,onConfirm:d.confirm,onCancel:d.dismiss})]})}function b5(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${String(n)}:${String(r).padStart(2,`0`)}:${i}`:`${String(r)}:${i}`}function x5(e){let t=/^(?:(\d+):)?(\d{1,2}):(\d{2})$/.exec(e.trim());if(t===null)return;let n=Number(t[1]??`0`),r=Number(t[2]),i=Number(t[3]);if(!(i>59||t[1]!==void 0&&r>59))return n*3600+r*60+i}function qve(e){let t=e.trim(),n=/^(\S+)\s+(.+)$/u.exec(t);if(n===null)return;let r=x5(n[1]??``),i=(n[2]??``).trim();return r===void 0||i===``?void 0:{start:r,title:i}}function S5(e,t){let n=e.replace(/\r\n?/gu,`
|
|
291
|
+
`);return(0,h.jsxs)(`section`,{"aria-labelledby":`${t}-title`,className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(`h3`,{id:`${t}-title`,className:`sl-kicker text-ink-3`,children:`Narration text`}),(0,h.jsx)(fB,{markdown:u,label:`Narration text`,regionLabel:`Narration text`,anchorPrefix:`narration-`,what:`narration text`,onCopy:c,children:(0,h.jsx)(`span`,{className:`block h-4 w-[40ch] max-w-full rounded-control bg-raised`})}),(0,h.jsx)(V1,{tone:o?.tone??`info`,children:o?.text})]})}var q8=(0,m.createContext)(!1),J8=(0,m.createContext)(void 0),Y8=(0,m.createContext)(void 0);function X8(e){let t=v8();return e===void 0?!1:t?.outputs.some(t=>t.output.id===e.id&&t.state===`outdated`)??!1}function Z8(e,t,n){let[r,i]=(0,m.useState)(),a=(0,m.use)(q8),o=(0,m.use)(J8),s=(0,m.use)(Y8),c=v8(),l=e===void 0?void 0:c?.outputs.find(t=>t.output.id===e.id)?.workKey,u=a&&l!==void 0;return{act:t=>{if(e===void 0)return;if(!u||l===void 0||t===`regenerate-image`){i(t);return}if(!l.startsWith(`image:`))return;let n=l.slice(6);o?.({section:`images`,change:e=>({...e,content:{...e.content,imageOrder:e.content.imageOrder.filter(e=>e!==n),imageDefinitions:Object.fromEntries(Object.entries(e.content.imageDefinitions).filter(([e])=>e!==n))},regenerate:(e.regenerate??[]).filter(e=>e!==l)})})},asking:r,confirm:()=>{let n=r;i(void 0),n!==void 0&&e!==void 0&&(u&&l!==void 0&&n===`regenerate-image`?s?.([l]):t.run({kind:n,outputId:e.id}))},dismiss:()=>i(void 0),unavailable:e===void 0||n||t.pending||u&&(o===void 0||s===void 0),viaEdit:u,now:u,ready:!a||c!==void 0}}function dve(e,t){let[n,r]=(0,m.useState)(!1),i=(0,m.use)(q8),a=(0,m.use)(Y8),o=v8();if(!i||o===void 0)return;let s=new Set(e.map(e=>e.id)),c=o.outputs.flatMap(e=>s.has(e.output.id)&&e.workKey.startsWith(`image:`)?[e.workKey]:[]);if(c.length!==0)return{count:c.length,asking:n,act:()=>r(!0),confirm:()=>{r(!1),a?.(c)},dismiss:()=>r(!1),unavailable:t||a===void 0}}var fve=200,pve=K({seconds:W(),peaks:G(W())});function mve(e){if(e===void 0)return;let t;try{t=new URL(e,window.location.href)}catch{return}if(t.pathname.startsWith(`/files/`))return t.searchParams.set(`waveform`,String(fve)),t.toString()}function hve(e){let{api:t}=R(),n=mve(e);return N({queryKey:[`waveform`,n],enabled:n!==void 0,staleTime:1/0,retry:!1,queryFn:async()=>{if(n===void 0)return[];let e=await t.fetch(n);if(!e.ok)throw mo(e,void 0);let{peaks:r}=Co(pve,await e.json()),i=Math.max(0,...r);return i===0?[]:r.map(e=>e/i)}}).data}function Q8(e){return(0,h.jsx)(G8,{...e,waveform:hve(e.src)})}var $8=[{role:`audio_intro`,segment:`intro`,name:`Intro`},{role:`audio_body`,segment:`body`,name:`Body`},{role:`audio_outro`,segment:`outro`,name:`Outro`}];function gve({stage:e,project:t,outputs:n,busy:r}){let{api:i}=R(),a=N(Zy(i)),o=P8(t.id),s=d8(n,e),c=s.filter(e=>e.role===`audio_levelled`),l=$8.flatMap(e=>{let t=f8(s,e.role),n=c.find(t=>t.meta.segment===e.segment)??t;return n===void 0?[]:[{...e,output:n,...t===void 0||t===n?{}:{plain:t}}]}),u=$8.flatMap(e=>{let t=c.find(t=>t.meta.segment===e.segment)?.meta.loudness;return t===void 0?[]:[{name:e.name,report:t}]}),d=l.find(e=>e.output.meta.voice!==void 0)?.output.meta,f=l.length>0?d?.voice:t.config.audio?.voice,p=l.length>0?d?.provider:t.config.audio?.provider,m=a.data?.voices.find(e=>e.voiceId===f&&e.provider===p)?.name??f;return(0,h.jsxs)(C8,{children:[e.state===`running`?(0,h.jsx)(K8,{projectId:t.id}):null,l.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No narration has landed yet.`}):l.map(e=>(0,h.jsx)(_ve,{name:e.name,output:e.output,...e.plain===void 0?{}:{plain:e.plain}},e.role)),(0,h.jsx)(k8,{files:$_e(s,l,n.find(e=>e.role===`script_md`))}),u.length===0?null:(0,h.jsx)(A8,{children:u.map(({name:e,report:t})=>u.length===1?IO(t):`${e}: ${IO(t)}`).join(` `)}),(0,h.jsxs)(U8,{label:`How it was recorded`,children:[m===void 0?null:(0,h.jsx)(W8,{label:`Voice`,children:m}),(0,h.jsx)(W8,{label:`Chunking`,children:vve(yve(t.config.chunking))}),tve(s)?(0,h.jsx)(W8,{label:`Text files`,children:(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Clean narration is the spoken text used for captions. The TTS script adds delivery cues, with a blank line between requests. Uploaded audio has no TTS request.`})}):null]}),(0,h.jsx)(z8,{review:F8(o,{itemKey:`narration`}),projectId:t.id,busy:r}),(0,h.jsx)(uve,{outputs:s})]})}function _ve({name:e,output:t,plain:n}){let r=y8(t),i=X8(t),a=X8(n)||n===void 0?void 0:n,o=y8(i?a:void 0);return(0,h.jsxs)(`div`,{className:`grid grid-cols-[64px_minmax(0,1fr)] items-center gap-3 text-small`,children:[(0,h.jsx)(w8,{children:e}),(0,h.jsx)(Q8,{label:`${e} narration`,src:r?.url,className:`max-w-[640px]`}),i?(0,h.jsx)(`p`,{className:`col-start-2 m-0 text-small text-ink-2`,children:a===void 0?`Outdated: this is the narration from before your last change. The new one is made when the run carries on: press Continue the run, or Remake at the top of the page.`:`Outdated: this is the levelled narration from before your last change. The new narration is below as it was spoken; it is levelled when the run carries on: press Continue the run, or Remake at the top of the page.`}):null,i&&a!==void 0?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(w8,{children:`New`}),(0,h.jsx)(Q8,{label:`${e} narration, new, before levelling`,src:o?.url,className:`max-w-[640px]`})]}):null]})}function vve(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yve(e){return e===void 0||e.mode===`whole`?`the whole text as one request`:e.mode===`paragraph`?`one request per paragraph`:e.mode===`characters`?`every ${String(e.characters??3e3)} characters`:`every ${String(e.words??500)} words`}function bve({stage:e,project:t,outputs:n}){let r=f8(d8(n,e),`document_pdf`),i=y8(r),a=CS(t.config.document);return(0,h.jsxs)(C8,{children:[r===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.state===`running`?`The PDF will be saved when rendering finishes.`:`No PDF has been saved yet.`}):(0,h.jsx)(k8,{files:[{output:r,label:`PDF`}],label:`Download PDF`,children:i?.folder?(0,h.jsxs)(Vx,{href:`${i.url}?inline=1`,target:`_blank`,rel:`noopener`,variant:`secondary`,children:[(0,h.jsx)(Mc,{"aria-hidden":`true`,strokeWidth:1.75}),`Open PDF`]}):null}),(0,h.jsx)(U8,{label:`PDF details`,children:(0,h.jsx)(W8,{label:`Theme`,children:a})})]})}var xve={research:`Generates fresh research and affected article, narration, entries, thumbnail and exports; previous outputs stay in History.`,article:`Generates a fresh article and affected narration, entries, thumbnail and exports; previous outputs stay in History.`,audio:`Regenerates narration and affected exports, keeping compatible cue preparation; previous outputs stay in History.`,images:`Regenerates generated images and affected video, keeping supplied images and narration; previous outputs stay in History.`,thumbnail:`Regenerates the thumbnail without changing the main video; previous outputs stay in History.`,video:`Rebuilds local exports from saved media without regenerating narration or images; previous outputs stay in History.`,document:`Renders the PDF again from the saved article and title without regenerating anything else; previous outputs stay in History.`};function e5(e){switch(e.kind){case`cancel`:return{title:`Cancel this run?`,consequence:`Stops every running stage; finished outputs are kept.`,verb:`Cancel run`,dismiss:`Keep running`};case`rerun`:return{title:`Re-run this stage?`,consequence:xve[e.stage],verb:`Re-run`,dismiss:`Cancel`};case`delete-image`:return{title:`Delete this image?`,consequence:`Removes the image and re-renders video when enabled.`,verb:`Delete`,dismiss:`Cancel`};case`regenerate-image`:return e.thumbnail?{title:`Regenerate this thumbnail?`,consequence:`Makes a new thumbnail, one paid image call. The video and shorts are not touched; the PDF's cover follows the first thumbnail. The old one stays in History.`,verb:`Regenerate`,dismiss:`Cancel`}:{title:`Regenerate this image?`,consequence:e.now?`Makes a new image now, one paid image call. The video keeps the current one until you remake it; the old image stays in History.`:`Replaces the image with a new one and re-renders video when enabled.`,verb:`Regenerate`,dismiss:`Cancel`};case`save-article`:return{title:`Save the edited article?`,consequence:`Replaces the article, then updates the enabled narration and final export.`,verb:`Save & update outputs`,dismiss:`Cancel`};case`discard-article`:return{title:`Discard these edits?`,consequence:`The article goes back to the text on disk.`,verb:`Discard`,dismiss:`Keep editing`}}}function Sve(e,t){let{config:n,content:r,fingerprints:i}=e.revision;switch(t){case`research`:return n.sources.research===`generate`;case`article`:return n.sources.article===`generate`&&!r.articleEdited;case`audio`:return n.sources.audio===`generate`&&Object.keys(i).some(e=>!/^audio:(body:.+|intro|outro):[0-9]+$/.test(e)&&!/^audio:(body|intro|outro):future$/.test(e)?!1:!Object.entries(r.narrationOverrides).some(([t,n])=>n.kind===`asset`&&(e===t||e.startsWith(`${t}:`))));case`images`:return n.sources.images!==`off`&&r.imageOrder.some(e=>r.imageDefinitions[e]?.source===`generate`);case`thumbnail`:return n.sources.thumbnail===`from_prompt`||n.sources.thumbnail===`prompt_by_llm`;case`video`:return n.sources.video!==`off`||n.sources.audio!==`off`;case`document`:return dS(n.sources,`document`)===`generate`}}function t5(e){switch(e){case`research`:case`article`:return`article`;case`audio`:return`narration`;case`images`:case`thumbnail`:return`images`;case`video`:return`video`;case`document`:return`document`}}var n5={research:`Research`,article:`Article`,audio:`Narration`,images:`Images`,thumbnail:`Thumbnail`,video:`Video`,document:`PDF`},r5=e=>/^[A-Z]{2}/.test(e)?e:e.charAt(0).toLowerCase()+e.slice(1);function Cve(e){let{project:t,stages:n}=e,r=t.config,i=e=>e===`video`&&JM(r)===`audio`?`Audio export`:n5[e];if(e.sample)return{situation:`sample`,tone:`info`,status:`Sample project`,title:`This is the sample project, finished and free to explore.`,why:`It is read-only. Your own copy can be edited and made again.`,action:{label:`Make my own copy`,intent:{kind:`copy-sample`}}};if(t.status===`paused`){let t=Ove(e.outdated);return{situation:`paused`,tone:`waiting`,status:`Paused`,title:`The run is paused.`,why:t===void 0?`Everything made so far is kept. Continuing picks up where it stopped.`:`Everything made so far is kept. Still to make: ${t}. They stay outdated until you continue.`,action:{label:`Continue the run`,intent:{kind:`resume`}}}}let a=n.find(e=>e.state===`failed`&&e.retryAt===void 0);if(a!==void 0){let t=i(a.kind),n=e.fixOf(a),r={label:`Try ${r5(i5(t))} again`,intent:{kind:`retry`,stage:a.kind}},o={situation:`failed`,tone:`failed`,status:`Failed`,section:t5(a.kind),...a.failureReason===null?{}:{detail:a.failureReason}};switch(n?.kind){case`sign-in`:return{...o,title:`${n.label.replace(/^Sign in to /,``)} is signed out, so ${r5(i5(t))} stopped.`,why:`Copy the sign-in command (${n.command}), run it in a terminal on the computer running Slopify and sign in, then press Check again. Once ${n.label.replace(/^Sign in to /,``)} is signed in, Slopify tries ${r5(i5(t))} again.`,action:{label:`Copy sign-in command`,intent:{kind:`sign-in`,stage:a.kind,fix:n}}};case`refused`:return{...o,title:`A content filter refused a prompt, so ${r5(i5(t))} stopped.`,why:n.soften?`Softening rewrites each refused prompt without what the filter flagged, then draws it again.`:`Change the prompt in the project settings, then try again.`,action:n.soften?{label:n.label,intent:{kind:`soften`,stage:a.kind}}:{label:`Edit the prompt`,intent:{kind:`edit`}}};case`switch-model`:return{...o,title:`The model for ${r5(i5(t))} is no longer offered.`,why:`Pick another model in the project settings, then try again.`,action:{label:`Switch model`,intent:{kind:`edit`}}};case`provider-settings`:return{...o,title:`The provider did not accept its key, so ${r5(i5(t))} stopped.`,why:`Check the key in Settings, then try again.`,action:{label:n.label,intent:{kind:`open-settings`,section:`providers`}}};case`free-space`:return{...o,title:`The disk is full, so ${r5(i5(t))} stopped.`,why:`Storage in Settings shows what can go. Then try again.`,action:{label:n.label,intent:{kind:`open-settings`,section:`storage`}}};case void 0:return{...o,title:`${t} stopped with an error.`,why:`Trying again keeps everything already made.`,action:r}}}let o=e.held[0];if(o!==void 0){let e=i(o.stage);return{situation:`held`,tone:`waiting`,status:`Waiting for you`,title:`The ${r5(e)} ${Eve(e)} ready for your review.`,why:o.dependents.length===0?`Approving marks it reviewed.`:`Approving lets ${a5(o.dependents.map(e=>r5(i5(i(e)))))} run. Nothing after it runs until you do.`,action:{label:wve(o,i),intent:{kind:`approve`,gate:o}},section:t5(o.stage)}}let s=n.find(e=>e.state===`failed`&&e.retryAt!==void 0),c=e.waits[0];if(c!==void 0||s!==void 0){if(c!==void 0){let t=VH(e.waits);return{situation:`waiting`,tone:`waiting`,status:`Waiting for limits`,title:`${BH(e.waits,e.clock)??``}.`,why:`Nothing to do: the run carries on by itself when they reset, and work that does not need ${t} keeps going.`,section:t5(c.stage)}}if(s!==void 0)return{situation:`waiting`,tone:`waiting`,status:`Waiting to try again`,title:`${i(s.kind)} will try again by itself at ${e.clock(s.retryAt??``)}.`,why:`Nothing to do: the run carries on when it does.`,section:t5(s.kind),...s.failureReason===null?{}:{detail:s.failureReason}}}let l=n.find(e=>e.state===`running`);if(t.status===`running`||l!==void 0)return{situation:`running`,tone:`running`,status:`Running`,title:l===void 0?`The run is starting.`:`Making the ${r5(i(l.kind))}${Tve(l)}.`,why:`Pausing lets the current call finish and keeps everything made so far.`,action:{label:`Pause`,intent:{kind:`pause`}},...l===void 0?{}:{section:t5(l.kind)}};if(t.status===`pending`&&t.setAside===!0)return e.uploadReady?{situation:`done`,tone:`done`,status:`Kept as is`,title:`The video is ready; what is left won't run.`,why:`Prepare upload lays out the file, title, description, thumbnails and tags in the order YouTube Studio asks for them. Editing the project brings the rest back to Needs you.`,action:{label:`Prepare upload`,intent:{kind:`prepare-upload`}},section:`youtube`}:{situation:`done`,tone:`done`,status:`Kept as is`,title:`Kept as is: what is left won't run.`,why:`Everything made is kept. Editing the project brings the rest back to Needs you.`};if(e.resumable||t.status===`canceled`||t.status===`failed`&&a===void 0)return{situation:`stopped`,tone:`off`,status:t.status===`canceled`?`Canceled`:`Stopped`,title:`The run stopped before it finished.`,why:`Continuing makes only what is missing; everything made so far is kept.`,action:{label:`Continue the run`,intent:{kind:`resume`}}};if(t.status===`pending`)return{situation:`queued`,tone:`off`,status:`Queued`,title:`Waiting for its turn.`,why:`It starts by itself when the videos ahead of it are done.`};let u=Dve(e.outdated);if(u!==void 0)return{situation:`outdated`,tone:`info`,status:`Outdated`,title:u.count===1||u.singular?`The ${u.noun} ${u.noun.endsWith(`s`)?`are`:`is`} outdated after your edit.`:`${String(u.count)} ${u.plural} are outdated after your edit.`,why:`They keep their current version until you remake them. Nothing else is made again.`,action:{label:u.count===1||u.singular?`Remake the outdated ${u.noun}`:`Remake ${String(u.count)} outdated ${u.plural}`,intent:{kind:`remake`,workKeys:u.workKeys}},section:u.section};if(t.status===`done`&&r.mode===`short`)return{situation:`done`,tone:`done`,status:`Done`,title:`The short is ready.`,why:`Play opens set up for a long video on the same topic, with the same starter pack and providers. Nothing starts until you press Play.`,action:{label:`Make the full video on this topic`,intent:{kind:`full-video`}}};if((t.status===`done`||t.status===`partial`)&&e.uploadReady)return{situation:`done`,tone:`done`,status:`Done`,title:`The video is ready.`,why:`Prepare upload lays out the file, title, description, thumbnails and tags in the order YouTube Studio asks for them.`,action:{label:`Prepare upload`,intent:{kind:`prepare-upload`}},section:`youtube`}}function wve(e,t){if(e.dependents.includes(`video`))return`Approve and render the video`;if(e.dependents.includes(`images`))return`Approve and make the images`;if(e.dependents.includes(`audio`))return`Approve and record the narration`;let n=e.dependents[0];return n===void 0?`Approve the ${r5(t(e.stage))}`:`Approve and make the ${r5(t(n))}`}function Tve(e){let t=eN(e);return t===void 0?e.progressTotal===null||e.progressTotal<=0?``:` · ${String(Math.floor(e.progressCurrent??0))} of ${String(e.progressTotal)}`:` · ${t}`}function i5(e){return/s$/i.test(e)?e:`the ${r5(e)}`}function Eve(e){return/s$/i.test(e)?`are`:`is`}function a5(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)??``}`}var o5=[{id:`article`,noun:`article`,plural:`article files`,singular:!0,section:`article`,roles:[`notes`,`sources`,`article_md`,`article_txt`,`script_md`],counted:[`article_md`]},{id:`narration`,noun:`narration`,plural:`narration parts`,singular:!0,section:`narration`,roles:[`narration_txt`,`tts_script`,`glossary`,`audio_body`,`audio_intro`,`audio_outro`,`audio_levelled`],counted:[`audio_body`]},{id:`reference`,noun:`establishing image`,plural:`establishing images`,singular:!0,section:`images`,roles:[`reference`],counted:[`reference`]},{id:`images`,noun:`image`,plural:`images`,singular:!1,section:`images`,roles:[`image`],counted:[`image`]},{id:`animated`,noun:`animated image`,plural:`animated images`,singular:!1,section:`images`,roles:[`animated_image`],counted:[`animated_image`]},{id:`thumbnails`,noun:`thumbnail`,plural:`thumbnails`,singular:!1,section:`images`,roles:[`thumbnail`],counted:[`thumbnail`]},{id:`video`,noun:`video`,plural:`video files`,singular:!0,section:`video`,roles:[`video`,`audio_export`,`audio_mp3`,`audio_m4b`,`render_params`,`subtitles_srt`,`subtitles_vtt`,`subtitle_words`,`subtitle_ass`,`subtitle_font`],counted:[`video`,`audio_export`]},{id:`shorts`,noun:`short`,plural:`shorts`,singular:!1,section:`shorts`,roles:[`shorts`,`short_image`,`short_video`],counted:[`short_video`]},{id:`youtube`,noun:`YouTube description`,plural:`YouTube descriptions`,singular:!0,section:`youtube`,roles:[`youtube_description`,`youtube_tags`,`youtube_pinned_comment`,`youtube_titles`],counted:[`youtube_description`]},{id:`document`,noun:`PDF`,plural:`PDFs`,singular:!0,section:`document`,roles:[`document_pdf`],counted:[`document_pdf`]}];function Dve(e){for(let t of o5){let n=e.filter(e=>t.roles.includes(e.role));if(n.length===0)continue;let r=n.filter(e=>t.counted.includes(e.role)).length;return{noun:t.noun,plural:t.plural,singular:t.singular,count:Math.max(1,r),workKeys:[...new Set(n.map(e=>e.workKey))],section:t.section}}}function Ove(e){let t=o5.flatMap(t=>{let n=e.filter(e=>t.roles.includes(e.role));if(n.length===0)return[];let r=Math.max(1,n.filter(e=>t.counted.includes(e.role)).length);return[t.singular?`the ${t.noun}`:r===1?`1 ${t.noun}`:`${String(r)} ${t.plural}`]});return t.length===0?void 0:a5(t)}function kve(e){return o5.flatMap(t=>{let n=e.filter(e=>t.roles.includes(e.role));if(n.length===0)return[];let r=Math.max(1,n.filter(e=>t.counted.includes(e.role)).length);return[{label:r===1||t.singular?`Remake the outdated ${t.noun}`:`Remake ${String(r)} outdated ${t.plural}`,workKeys:[...new Set(n.map(e=>e.workKey))],section:t.section,count:r}]})}function Ave({tone:e,status:t,title:n,why:r,action:i,className:a}){return(0,h.jsxs)(`section`,{"aria-label":`Next action`,className:I(`sl-next`,a),children:[(0,h.jsx)(Wx,{tone:e,children:t}),(0,h.jsx)(`p`,{className:`sl-next__title`,children:n}),r===void 0?null:(0,h.jsx)(`p`,{className:`sl-next__why`,children:r}),i===void 0?null:(0,h.jsx)(`div`,{className:`flex flex-col [&>*]:w-full`,children:i})]})}function jve({project:e,stages:t,resumable:n,sample:r,gates:i,outdated:a,waits:o,uploadReady:s,actions:c,controller:l,openSection:u,openUpload:d}){let{api:f}=R(),p=_(),h=Zi(),[g,v]=(0,m.useState)(),y=(0,m.useRef)(new Map),b=Cve({project:e,stages:t,resumable:n,sample:r,held:i.filter(e=>(e.state===`held`||e.state===`pending-review`)&&e.fingerprint===e.currentFingerprint).map(e=>({checkpointId:e.checkpointId,stage:e.stage,dependents:e.dependents})),outdated:a,waits:o,uploadReady:s,fixOf:t=>g3(t,e),clock:rN}),x=P({mutationFn:()=>By(f,e.id),onSuccess:async({projectId:e})=>{await p.invalidateQueries({queryKey:z.projects}),await h({to:`/projects/$projectId`,params:{projectId:e}})},onError:e=>v(`${xo(e.message)} The copy was not made. Press Make my own copy to try again.`)}),S=(0,m.useRef)(null),C=Fae(),w=P({mutationFn:async()=>{if(C===null)throw Error(`Play isn't available on this page. Reload the page`);if(C.review.starting||C.review.uncertain||C.review.created!==null)throw Error(`Play is starting a run from its open draft. Wait for it to start`);if(!await C.flush())throw Error(`The draft open in Play couldn't be saved. Open Play, save or discard it`);S.current??=crypto.randomUUID();let{draft:t}=await Iy(f,{projectId:e.id,draftId:S.current});if(await p.invalidateQueries({queryKey:[`play-drafts`]}),!await C.open(t.id))throw Error(`The full video's draft was made but didn't open. Open Play and pick it`);S.current=null,await h({to:`/play`})},onError:e=>v(`${xo(e.message)} Then press Make the full video on this topic again.`)}),T=P({mutationFn:async t=>{let n=i.find(e=>e.checkpointId===t.checkpointId);if(n===void 0)throw Error(`The review changed before it was approved. Reload the page.`);let r=`${n.checkpointId}:${n.fingerprint}`,a=y.current.get(r)??crypto.randomUUID();y.current.set(r,a);let o=await m3(f,e.id,n.checkpointId,{revisionId:n.revisionId,fingerprint:n.fingerprint,idempotencyKey:a});if(y.current.delete(r),!o.ok)throw Error(o.message)},onSettled:async()=>{await p.invalidateQueries({queryKey:u3(e.id)}),await p.invalidateQueries({queryKey:z.project(e.id)}),p.invalidateQueries({queryKey:z.projects})},onError:e=>v(`${xo(e.message)} Press the approve button again to check whether it went through.`)});return{next:b,run:e=>{switch(v(void 0),e.kind){case`copy-sample`:x.mutate();return;case`resume`:case`pause`:c.run({kind:e.kind});return;case`retry`:case`soften`:c.run({kind:e.kind,stage:e.stage});return;case`sign-in`:I1(e.fix.command).then(t=>v(t?`Copied ${e.fix.command}. Run it in a terminal on the computer running Slopify, sign in, then press Check again.`:`Couldn't copy: the browser blocked the clipboard. Type ${e.fix.command} in a terminal, sign in, then press Check again.`));return;case`approve`:T.mutate(e.gate);return;case`remake`:l.review({kind:`selected`,workKeys:e.workKeys},{autoStart:!0});return;case`edit`:u(`settings`);return;case`open-settings`:h({to:`/settings`,search:{section:e.section}});return;case`prepare-upload`:d();return;case`full-video`:w.mutate();return}},pending:x.isPending||w.isPending||T.isPending||c.pending||l.pending,message:g}}function Mve(e){switch(e.kind){case`copy-sample`:return`Copying…`;case`resume`:return`Continuing…`;case`pause`:return`Pausing…`;case`approve`:return`Approving…`;case`remake`:return`Starting the remake…`;case`retry`:return`Trying again…`;case`soften`:return`Softening…`;case`full-video`:return`Opening Play…`;default:return}}function s5({state:e,variant:t,className:n}){let[r,i]=(0,m.useState)(!1),a=e.next?.action;if(a===void 0)return null;let o=a.intent;if(o.kind===`sign-in`)return(0,h.jsx)(L1,{fix:o.fix,variant:t,retry:{run:()=>e.run({kind:`retry`,stage:o.stage}),busy:e.pending}});if(o.kind===`open-settings`)return(0,h.jsx)(zx,{to:`/settings`,search:{section:o.section},variant:t,...n===void 0?{}:{className:n},children:a.label});let s=e.pending?Mve(o)??a.label:a.label;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{variant:t,className:n,disabled:e.pending,disabledReason:`Working on the last press`,"aria-keyshortcuts":t===`primary`?ax(CM.nextAction):void 0,onClick:()=>o.kind===`soften`?i(!0):e.run(o),children:s}),o.kind===`soften`?(0,h.jsx)(Dy,{open:r,tone:`primary`,title:`Soften the refused prompt and try again?`,consequence:`Your project's AI model rewrites each refused prompt without what a content filter could flag, keeping the scene and style. The image is then drawn again from the new wording, which it keeps as its prompt. The AI call and the new image are charged like any other.`,confirmLabel:`Soften and retry`,cancelLabel:`Keep the prompt`,pending:e.pending,onConfirm:()=>{i(!1),e.run(o)},onCancel:()=>i(!1)}):null]})}function Nve({state:e,feedback:t}){let n=e.next;return n===void 0&&t===void 0&&e.message===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[n===void 0?null:(0,h.jsx)(Ave,{tone:n.tone,status:n.status,title:n.title,...n.why===void 0?{}:{why:n.why},...n.action===void 0?{}:{action:(0,h.jsx)(s5,{state:e,variant:`primary`})}}),e.message===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:e.message}),t]})}var Pve={sample:void 0,paused:void 0,stopped:void 0,queued:void 0,running:void 0,failed:`danger`,held:`waiting`,waiting:`waiting`,outdated:`info`,done:void 0};function Fve({state:e,section:t}){let n=e.next;if(n===void 0||n.section!==t)return null;let r=Pve[n.situation];return r===void 0?null:(0,h.jsx)(pP,{className:`max-[1180px]:hidden`,tone:r,title:n.title,...n.action===void 0?{}:{actions:(0,h.jsx)(s5,{state:e,variant:`secondary`})},children:n.why===void 0&&n.detail===void 0?void 0:(0,h.jsxs)(h.Fragment,{children:[n.why===void 0?null:(0,h.jsx)(`span`,{className:`block`,children:n.why}),n.detail===void 0?null:(0,h.jsxs)(`details`,{className:`mt-1`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer`,children:`Error details`}),(0,h.jsx)(`pre`,{className:`m-0 mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-small`,children:n.detail})]})]})})}var Ive={research:`Research again`,article:`Write the article again`,audio:`Record the narration again`,images:`Make all images again`,thumbnail:`Make the thumbnails again`,video:`Render the video again`,document:`Render the PDF again`};function c5(e,t){return e===`video`&&t.config.sources.video===`off`?`Export the audio again`:Ive[e]}function l5({id:e,title:t,kicker:n,stages:r,project:i,outputs:a,actions:o,next:s,active:c,meta:l,head:u=!0,extra:d,resumable:f=!1,children:p}){let m=r[0],g=r.some(e=>o.refusal?.stage===e.kind)?o.refusal?.message:void 0,_=r.filter(t=>t.state===`failed`&&t.retryAt===void 0&&(s.next?.situation!==`failed`||s.next.section!==e)),v=r.find(e=>e.state===`running`),y=v===void 0?void 0:nN(v),b=l??(m===void 0?void 0:r.filter(e=>e.state!==`skipped`).map(e=>e===m?$M(e,a,i,f):`${n5[e.kind]}: ${$M(e,a,i,f)}`).join(` · `));return(0,h.jsxs)(`section`,{hidden:!c,"aria-label":t,"data-tour":m===void 0?void 0:`project-${m.kind}`,className:`flex min-w-0 flex-col gap-5`,children:[u?(0,h.jsxs)(V,{row:!0,title:t,...n===void 0?{}:{kicker:n},...b===void 0||b===``?{}:{meta:b},children:[d,(0,h.jsx)(d5,{stages:r,project:i,actions:o})]}):null,y===void 0||v===void 0?null:(0,h.jsx)(K2,{value:y,label:`${n5[v.kind]} progress`,valueText:$M(v,a,i,f)}),(0,h.jsx)(Fve,{state:s,section:e}),_.map(e=>(0,h.jsx)(pP,{tone:`danger`,title:`${n5[e.kind]} stopped with an error.`,children:e.failureReason===null?void 0:(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{className:`cursor-pointer`,children:`Error details`}),(0,h.jsx)(`pre`,{className:`m-0 mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-small`,children:e.failureReason})]})},e.id)),g===void 0?null:(0,h.jsx)(pP,{tone:`danger`,title:g,actions:(0,h.jsx)(L,{variant:`quiet`,size:`small`,onClick:o.dismissRefusal,children:`Dismiss`})}),m?.state===`running`&&m.kind!==`article`&&m.kind!==`images`&&m.kind!==`video`&&m.kind!==`document`?(0,h.jsx)(A3,{projectId:i.id,stage:m.kind}):null,p]})}function u5({stage:e,project:t,name:n}){return e===void 0||e.state===`skipped`?(0,h.jsx)(J1,{title:`${n} is off for this run.`,children:`Switch it on in the project settings to make it.`}):(0,h.jsx)(J1,{title:`No ${n.toLowerCase()} yet.`,children:t.status===`paused`?`It is made once you continue the run.`:`It starts when the steps before it are done. Finished work elsewhere can be looked at meanwhile.`})}function d5({stages:e,project:t,actions:n}){let r=(0,m.useContext)(q8),i=v8(),[a,o]=(0,m.useState)(),s=e.filter(e=>e.state!==`skipped`&&e.state!==`pending`&&(!r||i!==void 0&&Sve(i,e.kind)));if(s.length===0)return null;let c=n.pending||t.status===`running`||e.some(e=>e.state===`running`),l=a===void 0?void 0:e5({kind:`rerun`,stage:a});return(0,h.jsxs)(h.Fragment,{children:[s.map(e=>(0,h.jsxs)(L,{size:`small`,disabled:c,disabledReason:`Wait until the work on this project is done`,onClick:()=>o(e.kind),children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),c5(e.kind,t)]},e.id)),(0,h.jsx)(Dy,{open:a!==void 0,title:a===void 0?``:`${c5(a,t)}?`,consequence:l?.consequence??``,confirmLabel:a===void 0?``:c5(a,t),cancelLabel:`Keep what is there`,pending:n.pending,onConfirm:()=>{let e=a;o(void 0),e!==void 0&&n.run({kind:`rerun`,stage:e})},onCancel:()=>o(void 0)})]})}function Lve({stage:e,project:t,outputs:n,actions:r,busy:i}){let a=d8(n,e),o=P8(t.id),s=mS(t.config),c=Array.from({length:s},(e,t)=>t+1).map(e=>({variant:e,output:a.find(t=>t.role===`thumbnail`&&(t.meta.index??1)===e)})),l=c.flatMap(e=>e.output===void 0?[]:[e.output]),u=b8(l),[d,f]=(0,m.useState)(null),p=l.filter(e=>u.has(e.id)),g=p.map(e=>({src:u.get(e.id)?.url??``,alt:`Thumbnail ${String(e.meta.index??1)}`})),_=t.format===`9:16`,v=({variant:n,output:a})=>(0,h.jsx)(Rve,{variant:n,count:s,output:a,review:F8(o,{outputId:a?.id}),stage:e,project:t,actions:r,busy:i,onOpen:()=>f(a===void 0?null:zve(p,a))},n);return(0,h.jsxs)(`section`,{"aria-label":s===1?`Thumbnail`:`Thumbnails`,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsxs)(V,{title:s===1?`Thumbnail`:`Thumbnails`,meta:s===1?`The picture YouTube shows before the video plays`:`${String(s)} variants for YouTube's Test & compare`,children:[(0,h.jsx)(D8,{variant:`secondary`,files:l.map(e=>({output:e,label:s===1?`Thumbnail`:`Thumbnail ${String(e.meta.index??1)}`}))}),(0,h.jsx)(O8,{output:l[0]}),(0,h.jsx)(d5,{stages:[e],project:t,actions:r})]}),c.length===1?(0,h.jsx)(`div`,{className:_?`max-w-[280px]`:`max-w-[480px]`,children:c.map(v)}):(0,h.jsx)(A0,{list:!0,label:`Thumbnail variants`,children:c.map(e=>(0,h.jsx)(`li`,{className:`min-w-0`,children:v(e)},e.variant))}),(0,h.jsx)(j0,{items:g,index:d,onIndex:f,onClose:()=>f(null),actions:(e,t)=>{let n=p[t];return n===void 0?null:(0,h.jsx)(g5,{output:n,name:s===1?`the thumbnail`:`thumbnail ${String(n.meta.index??1)}`,actions:r,busy:i},n.id)}})]})}function Rve({variant:e,count:t,output:n,review:r,stage:i,project:a,actions:o,busy:s,onOpen:c}){let l=y8(n),u=Z8(n,o,s),d=t===1?`the thumbnail`:`thumbnail ${String(e)}`;qb({id:`project.thumbnail.${String(e)}`,title:t===1?`Regenerate the thumbnail`:`Regenerate thumbnail ${String(e)}`,group:`This project`,context:a.title,keywords:[`thumbnail`,`redraw`,`remake`],run:()=>u.act(`regenerate-image`)});let f=r!==void 0&&!r.passed&&r.action===null,p=String.fromCharCode(64+e),m=u.asking===void 0||n===void 0?void 0:e5({kind:u.asking,outputId:n.id,now:u.now,thumbnail:!0});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(k0,{alt:t===1?`Thumbnail for ${a.title}`:`Thumbnail ${String(e)} for ${a.title}`,aspect:f5(a.format),...l===void 0?{}:{src:l.url},...n===void 0&&i.state===`running`?{generating:`Making the thumbnail`}:{},title:t===1?`Thumbnail`:p,...n===void 0?{meta:Bve(i)}:{},onOpen:c,openLabel:`Open ${d} full size`,...r===void 0?{}:{badge:(0,h.jsx)(B8,{review:r})},actionsShown:f,...n===void 0?{}:{actions:(0,h.jsxs)(h.Fragment,{children:[f&&r!==void 0?(0,h.jsx)(R8,{review:r,projectId:a.id,busy:s}):null,(0,h.jsxs)(L,{size:`small`,disabled:u.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>u.act(`regenerate-image`),"aria-label":`Regenerate ${d}`,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate`]}),l===void 0?null:(0,h.jsx)(_5,{href:l.url,label:`Download ${d}`})]})}}),(0,h.jsx)(Dy,{open:u.asking!==void 0,tone:`primary`,title:m?.title??``,consequence:m?.consequence??``,confirmLabel:`Regenerate the thumbnail`,cancelLabel:`Keep it`,pending:o.pending,onConfirm:u.confirm,onCancel:u.dismiss})]})}function zve(e,t){let n=e.indexOf(t);return n===-1?null:n}function Bve(e){switch(e.state){case`running`:return`Being made`;case`failed`:case`canceled`:return`Not made`;default:return`Not made yet`}}function Vve(e,t){let n=e.filter(e=>e.role===`image`),r=new Map;for(let e of n){let t=e.meta.promptName??`Images`;r.set(t,[...r.get(t)??[],e])}let i=t.filter(e=>r.has(e)),a=[...r.keys()].filter(e=>!i.includes(e)).sort();return[...i,...a].flatMap(e=>{let t=r.get(e);return t===void 0?[]:[{name:e,images:[...t].sort(Hve)}]})}function Hve(e,t){return(e.meta.index??0)-(t.meta.index??0)}function Uve(e,t,n,r,i){let a=gy(),[o,s]=(0,m.useState)(),c=(r,i)=>{let o=r===`image`?t:n,c=r===`image`?`image`:`on-screen card`;if(i===void 0){a(`Type the ${c}'s number with the command, for example "regenerate ${c} 3".`);return}let l=o.find(e=>e.meta.index===i);if(l===void 0){let t=o.flatMap(e=>e.meta.index===void 0?[]:[e.meta.index]);a(t.length===0?`${e.title} has no ${c}s yet, so there is no ${c} ${String(i)} to regenerate. They appear under Images once the run makes them.`:`${e.title} has no ${c} ${String(i)}: its ${c}s are numbered ${String(Math.min(...t))} to ${String(Math.max(...t))}. Type one of those, or press Regenerate on the ${c} in Images.`,`error`);return}s(e=>({image:l,name:`${c[0]?.toUpperCase()??``}${c.slice(1)} ${String(i)}`,nonce:(e?.nonce??0)+1}))};return qb({id:`project.image.regenerate`,title:`Regenerate an image`,numbered:e=>`Regenerate image ${String(e)}`,group:`This project`,context:e.title,keywords:[`image`,`picture`,`redraw`,`remake`],searchOnly:!0,run:e=>c(`image`,e)}),qb({id:`project.card.regenerate`,title:`Regenerate an on-screen card`,numbered:e=>`Regenerate on-screen card ${String(e)}`,group:`This project`,context:e.title,keywords:[`card`,`figure`,`table`,`redraw`,`remake`],searchOnly:!0,run:e=>c(`card`,e)}),Sx(_x.regenerateImage(e.id),e=>c(`image`,e)),o===void 0?null:(0,h.jsx)(Wve,{request:o,actions:r,busy:i},o.nonce)}function Wve({request:e,actions:t,busy:n}){let r=gy(),i=Z8(e.image,t,n),a=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!a.current&&i.ready&&(a.current=!0,i.unavailable?r(`${e.name} can't be regenerated while work on this project is running. Wait until it finishes, then run the command again or press Regenerate on it in Images.`,`error`):i.act(`regenerate-image`))},[i,r,e.name]);let o=i.asking===void 0?void 0:e5({kind:i.asking,outputId:e.image.id,now:i.now});return(0,h.jsx)(Dy,{open:i.asking!==void 0,tone:`primary`,title:o?.title??``,consequence:o?.consequence??``,confirmLabel:`Regenerate the image`,cancelLabel:`Keep it`,pending:t.pending,onConfirm:i.confirm,onCancel:i.dismiss})}function f5(e){return e===`9:16`?`portrait`:e===`1:1`?`square`:`landscape`}function Gve({stage:e,companion:t,project:n,outputs:r,actions:i,busy:a}){let o=P8(n.id),s=d8(r,e),c=Vve(s,n.config.imagePrompts?.map(e=>e.name)??[]),l=c.flatMap(e=>e.images),u=s.filter(e=>e.role===`figure_card`&&(e.meta.format??n.format)===n.format).toSorted((e,t)=>(e.meta.index??0)-(t.meta.index??0)),d=[...l,...u],f=Uve(n,l,u,i,a),p=dve(l,a),g=b8(d),[_,v]=(0,m.useState)(null),y=d.filter(e=>g.has(e.id)),b=y.map(e=>({src:g.get(e.id)?.url??``,alt:e.role===`figure_card`?`On-screen card ${String(e.meta.index??``)}`:e.meta.prompt??`Image ${String(e.meta.index??``)}`,...p5(e)?{kind:`video`}:{},caption:e.role===`figure_card`?`Shown while the narration describes it`:e.meta.prompt??e.meta.promptName??`Slideshow image`})),x=n.config.reference===void 0?null:(0,h.jsx)(Kve,{image:f8(s,`reference`),format:n.format,generated:n.config.reference.source===`prompt`,affected:l.length,actions:i,busy:a}),S=t?.kind===`thumbnail`?(0,h.jsx)(Lve,{stage:t,project:n,outputs:r,actions:i,busy:a}):null,C=e.state===`running`&&e.progressTotal!==null?Math.max(0,e.progressTotal-l.length):0,w=o.filter(e=>l.some(t=>t.id===e.outputId)),T=w.filter(e=>e.passed&&e.attempt>1).length,E=w.filter(e=>!e.passed&&e.action===null).length,D=[l.length===0?void 0:`${String(l.length)} in the video`,w.length===0?void 0:`reviewed`,T===0?void 0:`${String(T)} redone after review`,E===0?void 0:`${String(E)} flagged`].filter(e=>e!==void 0).join(` · `);return(0,h.jsxs)(h.Fragment,{children:[f,x,x===null||S===null&&e.state===`skipped`?null:(0,h.jsx)(Cq,{className:`m-0`}),S,S===null||e.state===`skipped`?null:(0,h.jsx)(Cq,{className:`m-0`}),e.state===`skipped`?null:(0,h.jsxs)(`section`,{"aria-label":`Slideshow images`,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsxs)(V,{title:`Images`,...D===``?{}:{meta:D},children:[p===void 0?null:(0,h.jsxs)(L,{size:`small`,disabled:p.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:p.act,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate all`]}),p===void 0?null:(0,h.jsx)(Dy,{open:p.asking,tone:`primary`,title:`Regenerate all ${String(p.count)} images?`,consequence:`Makes ${String(p.count)} new images now, one paid image call each. The video keeps the current ones until you remake it; the old images stay in History.`,confirmLabel:`Regenerate them`,cancelLabel:`Keep them`,pending:i.pending,onConfirm:p.confirm,onCancel:p.dismiss}),(0,h.jsx)(G_e,{projectId:n.id,asset:`images.zip`,label:`Download all`}),(0,h.jsx)(d5,{stages:[e],project:n,actions:i})]}),c.length===0&&C===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.state===`pending`?`The images are made once the narration is timed.`:`No images have landed yet.`}):null,c.map((e,t)=>(0,h.jsx)(v5,{name:e.name,count:e.images.length,showName:c.length>1,trailing:t===c.length-1&&C>0?Array.from({length:Math.min(C,3)},(e,t)=>(0,h.jsx)(k0,{alt:`An image being made`,aspect:f5(n.format),generating:t===0?`Drawing the next image`:`Waiting its turn`},t)):null,children:t=>e.images.slice(0,t).map(e=>(0,h.jsx)(y5,{image:e,projectId:n.id,review:F8(o,{outputId:e.id}),format:n.format,actions:i,busy:a,onOpen:()=>v(h5(y,e))},e.id))},e.name)),u.length===0?null:(0,h.jsx)(v5,{name:`From the article`,count:u.length,showName:!0,children:e=>u.slice(0,e).map(e=>(0,h.jsx)(y5,{image:e,projectId:n.id,review:void 0,format:n.format,actions:i,busy:a,card:!0,onOpen:()=>v(h5(y,e))},e.id))}),c.length===0&&C>0?(0,h.jsx)(A0,{label:`Images being made`,children:Array.from({length:Math.min(C,3)},(e,t)=>(0,h.jsx)(k0,{alt:`An image being made`,aspect:f5(n.format),generating:t===0?`Drawing the first image`:`Waiting its turn`},t))}):null,(0,h.jsx)(j0,{items:b,index:_,onIndex:v,onClose:()=>v(null),actions:(e,t)=>{let n=y[t];return n===void 0?null:(0,h.jsx)(g5,{output:n,name:n.role===`figure_card`?`on-screen card${m5(n)}`:`image${m5(n)}`,actions:i,busy:a},n.id)}})]})]})}var p5=e=>/\.(mp4|mov|m4v|webm|mkv)$/i.test(e.path),m5=e=>e.meta.index===void 0?``:` ${String(e.meta.index)}`;function h5(e,t){let n=e.indexOf(t);return n===-1?null:n}function g5({output:e,name:t,actions:n,busy:r}){let i=y8(e),a=Z8(e,n,r),o=a.asking===void 0?void 0:e5({kind:a.asking,outputId:e.id,now:a.now});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(L,{size:`small`,disabled:a.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>a.act(`regenerate-image`),"aria-label":`Regenerate ${t}`,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate`]}),i===void 0?null:(0,h.jsx)(_5,{href:i.url,label:`Download ${t}`}),(0,h.jsx)(Dy,{open:a.asking!==void 0,tone:`primary`,title:o?.title??``,consequence:o?.consequence??``,confirmLabel:`Regenerate it`,cancelLabel:`Keep it`,pending:n.pending,onConfirm:a.confirm,onCancel:a.dismiss})]})}function _5({href:e,label:t,text:n}){return(0,h.jsxs)(Vx,{href:e,download:!0,"aria-label":t,title:t,size:`small`,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,strokeWidth:1.75}),n]})}function Kve({image:e,format:t,generated:n,affected:r,actions:i,busy:a}){let o=y8(e),s=Z8(e,i,a),[c,l]=(0,m.useState)(null);return(0,h.jsxs)(`section`,{"aria-label":`Establishing image`,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsx)(V,{kicker:`Reference · not in the video`,title:`Establishing image`,meta:`Every image follows it for the look, palette and style`,children:e!==void 0&&n?(0,h.jsx)(L,{disabled:s.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>s.act(`regenerate-image`),children:`Make the establishing image again`}):null}),(0,h.jsx)(k0,{className:`w-full max-w-[360px]`,alt:e?.meta.prompt??`Establishing image`,aspect:f5(t),...o===void 0?{}:{src:o.url},title:`Establishing image`,...e===void 0?{meta:`Not made yet`}:{},onOpen:()=>l(0),openLabel:`Open the establishing image full size`,...e===void 0||o===void 0?{}:{actions:(0,h.jsx)(_5,{href:o.url,label:`Download the establishing image`,text:`Download`})}}),n&&r>0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Making it again marks ${String(r)} image${r===1?``:`s`} outdated. They keep their current version until you remake them.`}):null,(0,h.jsx)(j0,{items:o===void 0?[]:[{src:o.url,alt:`Establishing image`,caption:e?.meta.prompt??`The reference every image follows`}],index:c,onIndex:l,onClose:()=>l(null),actions:()=>o===void 0?null:(0,h.jsxs)(h.Fragment,{children:[n?(0,h.jsxs)(L,{size:`small`,disabled:s.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>{l(null),s.act(`regenerate-image`)},"aria-label":`Make the establishing image again`,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate`]}):null,(0,h.jsx)(_5,{href:o.url,label:`Download the establishing image`})]})}),(0,h.jsx)(Dy,{open:s.asking!==void 0,tone:`primary`,title:`Make the establishing image again?`,consequence:`A new establishing image replaces this one${r>0?`, and the ${String(r)} images drawn from it become outdated until you remake them`:``}. The old one stays in History.`,confirmLabel:`Make it again`,cancelLabel:`Keep this one`,pending:i.pending,onConfirm:s.confirm,onCancel:s.dismiss})]})}function v5({name:e,count:t,showName:n,trailing:r,children:i}){let[a,o]=(0,m.useState)(!1),s=t>12&&!a;return(0,h.jsxs)(`section`,{"aria-label":`${e} × ${String(t)}`,className:`flex flex-col gap-3`,children:[n?(0,h.jsx)(`h3`,{className:`sl-kicker m-0`,children:`${e} × ${String(t)}`}):null,(0,h.jsxs)(A0,{children:[i(s?12:t),r]}),t>12?(0,h.jsx)(L,{variant:`quiet`,"aria-expanded":a,className:`self-start`,onClick:()=>o(e=>!e),children:a?`Show fewer`:`Show all ${String(t)} images`}):null]})}function y5({image:e,projectId:t,review:n,format:r,actions:i,busy:a,card:o=!1,onOpen:s}){let c=y8(e),l=m5(e),u=o?`on-screen card${l}`:`image${l}`,d=Z8(e,i,a),f=X8(e),p=n!==void 0&&!n.passed&&n.action===null,m=d.asking===void 0?void 0:e5({kind:d.asking,outputId:e.id,now:d.now});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(k0,{alt:o?`On-screen card${l}`:e.meta.prompt??`Slideshow ${u}`,kind:p5(e)?`video`:`image`,aspect:f5(r),...c===void 0?{}:{src:c.url},title:o?`Card${l}`:e.meta.prompt??`Image${l}`,...e.meta.index===void 0?{}:{meta:`#${String(e.meta.index)}`},onOpen:s,openLabel:`Open ${u} full size`,...n===void 0&&!f?{}:{badge:(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[f?(0,h.jsx)(Gx,{tone:`info`,children:`Outdated`}):null,n===void 0?null:(0,h.jsx)(B8,{review:n})]})},actionsShown:p,actions:(0,h.jsxs)(h.Fragment,{children:[p&&n!==void 0?(0,h.jsx)(R8,{review:n,projectId:t,busy:a}):null,(0,h.jsxs)(L,{size:`small`,disabled:d.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>d.act(`regenerate-image`),"aria-label":`Regenerate ${u}`,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Regenerate`]}),c===void 0?null:(0,h.jsx)(_5,{href:c.url,label:`Download ${u}`}),o?null:(0,h.jsx)(L,{size:`small`,variant:`destructive`,disabled:d.unavailable,disabledReason:`Wait until the work on this project is done`,onClick:()=>d.act(`delete-image`),"aria-label":`Delete ${u}`,title:`Delete ${u}`,children:(0,h.jsx)($c,{"aria-hidden":`true`,strokeWidth:1.75})})]})}),(0,h.jsx)(Dy,{open:d.asking!==void 0,tone:d.asking===`delete-image`?`destructive`:`primary`,title:m?.title??``,consequence:m?.consequence??``,confirmLabel:d.asking===`delete-image`?`Delete the image`:`Regenerate the image`,cancelLabel:`Keep it`,pending:i.pending,onConfirm:d.confirm,onCancel:d.dismiss})]})}function b5(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${String(n)}:${String(r).padStart(2,`0`)}:${i}`:`${String(r)}:${i}`}function x5(e){let t=/^(?:(\d+):)?(\d{1,2}):(\d{2})$/.exec(e.trim());if(t===null)return;let n=Number(t[1]??`0`),r=Number(t[2]),i=Number(t[3]);if(!(i>59||t[1]!==void 0&&r>59))return n*3600+r*60+i}function qve(e){let t=e.trim(),n=/^(\S+)\s+(.+)$/u.exec(t);if(n===null)return;let r=x5(n[1]??``),i=(n[2]??``).trim();return r===void 0||i===``?void 0:{start:r,title:i}}function S5(e,t){let n=e.replace(/\r\n?/gu,`
|
|
292
292
|
`).split(`
|
|
293
293
|
`),r=[],i=[];for(let[e,t]of n.entries()){let n=qve(t);n!==void 0&&(r.push(e),i.push(n))}if(i.length===0)return{text:e,adjustments:[]};let a=[],o=e=>`"${e.title}"`,s=[...i].sort((e,t)=>e.start-t.start);s.some((e,t)=>e!==i[t])&&a.push(`put the chapters in time order`);let c=[];for(let e of s){let t=c.at(-1);t!==void 0&&t.start===e.start?a.push(`merged ${o(e)} (0 s) into ${o(t)}`):c.push(e)}s=c;let l=t!==void 0&&Number.isFinite(t)&&t>0?t:void 0;if(l!==void 0){let e=s.filter((e,t)=>t>0&&e.start>=l);for(let t of e)a.push(`removed ${o(t)} (${b5(t.start)}), which starts after the video ends at ${b5(l)}`);s=s.filter(t=>!e.includes(t))}let u=s[0];u!==void 0&&u.start!==0&&(a.push(`moved the first, ${o(u)}, from ${b5(u.start)} to 0:00`),s=[{start:0,title:u.title},...s.slice(1)]);let d=e=>{let t=s[e+1],n=s[e]?.start??0;return t===void 0?l===void 0?1/0:l-n:t.start-n},f=e=>`${String(Math.max(0,Math.floor(e)))} s`;for(;s.length>1;){let e=s.findIndex((e,t)=>d(t)<10);if(e===-1)break;let t=s[e];if(t===void 0)break;let n=f(d(e));if(e===0){let e=s[1];if(e===void 0)break;a.push(`merged ${o(t)} (${n}) into ${o(e)}`),s=[{start:0,title:e.title},...s.slice(2)]}else{let r=s[e-1];if(r===void 0)break;a.push(`merged ${o(t)} (${n}) into ${o(r)}`),s=s.filter((t,n)=>n!==e)}}if(s.length<3&&(a.push(`left the chapter list out, since YouTube needs at least 3 chapters of 10 s or more and only ${String(s.length)} ${s.length===1?`is`:`are`} left`),s=[]),a.length===0)return{text:e,adjustments:a};let p=new Map(r.map((e,t)=>[e,s[t]]));return{text:n.flatMap((e,t)=>{if(!p.has(t))return[e];let n=p.get(t);return n===void 0?[]:[`${b5(n.start)} ${n.title}`]}).join(`
|
|
294
294
|
`).trim(),adjustments:a}}function Jve(e){return e.length===0?void 0:`Chapters adjusted for YouTube: ${e.join(`; `)}.`}function C5(e,t,n={}){let r=e.replace(/\r\n?/gu,`
|
|
@@ -297,7 +297,7 @@ Obelisks`})}):e.mode===`yaml`?(0,h.jsx)(uV,{id:`schedule-topics-yaml`,label:`Top
|
|
|
297
297
|
`).trim(),chapters:o.join(`
|
|
298
298
|
`),hashtags:i,tags:t.trim(),pinnedComment:(n.pinnedComment??``).trim(),titles:(n.titles??``).trim()}}function Yve(e){let[t=``,...n]=e.trim().split(/\s+/u);return x5(t)!==void 0&&n.length>0}function Xve(e){return[e.summary.trim(),e.chapters.trim(),e.hashtags.trim()].filter(e=>e!==``).join(`
|
|
299
299
|
|
|
300
|
-
`)}function Zve(e,t){return t===void 0?{text:e??``,edited:!1}:e===void 0||t.base===e?{text:t.text,edited:!0}:t.text===e?{text:e,edited:!1}:{text:t.text,edited:!0,pending:e}}function w5(e,t){let n=n=>Zve(e?.[n],t[n]);return{summary:n(`summary`),chapters:n(`chapters`),hashtags:n(`hashtags`),tags:n(`tags`),pinnedComment:n(`pinnedComment`),titles:n(`titles`)}}function T5(e){return{summary:e.summary.text,chapters:e.chapters.text,hashtags:e.hashtags.text,tags:e.tags.text,pinnedComment:e.pinnedComment.text,titles:e.titles.text}}function Qve(e,t,n,r){return`https://studio.youtube.com/video/${e}/edit#slopify-ab=${t}&p=${encodeURIComponent(n)}&s=${String(r??0)}`}var E5=e=>[`project`,e,`youtube-videos`];function D5(e){let{api:t}=R();return N({queryKey:E5(e),queryFn:()=>ws(t,e)})}function $ve(e){let t=e?.find(e=>e.short===null&&e.uploadState===`done`);return t===void 0?void 0:`https://youtu.be/${t.videoId}`}function eye(e){return e===null?`Video`:`Short ${String(e)}`}function tye(e){if(e.uploadState===`filled`)return`Filled in Studio, but not scheduled or published yet (cancelled, or left as a draft). Upload it again from the extension, or paste its link once it is up.`;let t=[`On YouTube.`];return e.finishState===`waiting`&&t.push(`Related video, end screen and captions are being set.`),e.finishState===`failed`&&t.push(`Details touches failed: ${e.finishMessage??`no reason given`}`),e.commentState===`waiting`&&t.push(`The comment is pinned once it is public.`),e.commentState===`done`&&t.push(`Comment pinned.`),e.commentState===`failed`&&t.push(`Pinning the comment failed: ${e.commentMessage??`no reason given`}`),t.join(` `)}function nye({projectId:e,shorts:t}){let n=D5(e),{api:r}=R(),i=N({queryKey:[`project`,e,`youtube-stats`],queryFn:()=>hs(r,e)}),a=[null,...Array.from({length:t},(e,t)=>t+1)];return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(`div`,{className:`sl-field__label`,children:`On YouTube`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`The extension keeps each upload's link when Studio confirms it. Paste a link for an upload made by hand. A/B test opens the video in Studio with A/B Testing set up; press Set test and Save there.`}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:a.map(t=>(0,h.jsx)(rye,{projectId:e,short:t,video:n.data?.find(e=>e.short===t),stats:i.data?.find(e=>e.short===t)},t??0))})]})}function rye({projectId:e,short:t,video:n,stats:r}){let{api:i}=R(),a=_(),o=(0,m.useId)(),s=n===void 0?``:`https://youtu.be/${n.videoId}`,[c,l]=(0,m.useState)(),u=c??s,[d,f]=(0,m.useState)(),p=P({mutationFn:()=>Ts(i,e,t,u),onSuccess:t=>{a.setQueryData(E5(e),t),l(void 0),f(void 0)},onError:e=>f(e.message)});return(0,h.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`label`,{className:`w-[64px] shrink-0 text-small text-ink-2`,htmlFor:o,children:eye(t)}),(0,h.jsx)(Y,{id:o,type:`url`,className:`min-w-[220px] flex-1 sm:max-w-[360px]`,placeholder:`https://youtu.be/…`,value:u,onChange:e=>l(e.currentTarget.value)}),u.trim()===s?null:(0,h.jsx)(L,{type:`button`,size:`small`,disabled:p.isPending,onClick:()=>p.mutate(),children:`Save link`}),n===void 0||n.uploadState!==`done`||t!==null?null:(0,h.jsxs)(p8,{children:[(0,h.jsx)(m8,{asChild:!0,children:(0,h.jsx)(L,{type:`button`,size:`small`,variant:`quiet`,children:`A/B test`})}),(0,h.jsx)(h8,{children:[[`both`,`Titles and thumbnails`],[`titles`,`Titles`],[`thumbnails`,`Thumbnails`]].map(([r,i])=>(0,h.jsx)(g8,{onSelect:()=>window.open(Qve(n.videoId,r,e,t),`_blank`,`noopener`),children:i},r))})]})]}),n===void 0&&d===void 0?null:(0,h.jsx)(`p`,{className:`m-0 pl-18 text-small ${d!==void 0||n?.finishState===`failed`||n?.commentState===`failed`?`text-danger`:`text-ink-3`}`,children:d??(n===void 0?``:tye(n))}),r===void 0?null:(0,h.jsx)(`p`,{className:`m-0 pl-18 text-small tabular-nums text-ink-2`,children:iye(r)})]})}function iye(e){let t=[];if(e.views!==null&&t.push(`${e.views.toLocaleString()} views`),e.ctr!==null&&t.push(`${String(e.ctr)}% CTR${e.impressions===null?``:` of ${e.impressions.toLocaleString()} impressions`}`),e.averageViewSeconds!==null){let n=Math.round(e.averageViewSeconds),r=n>=3600?`${String(Math.floor(n/3600))}:${String(Math.floor(n%3600/60)).padStart(2,`0`)}:${String(n%60).padStart(2,`0`)}`:`${String(Math.floor(n/60))}:${String(n%60).padStart(2,`0`)}`;t.push(`${r} average view`)}return t.push(`read ${new Date(e.readAt).toLocaleDateString(void 0,{day:`numeric`,month:`short`})}`),t.join(` · `)}var aye=K({number:W().int().positive(),first:W().int().positive(),last:W().int().positive(),start:W().finite().nonnegative(),end:W().finite().positive(),title:U(),description:U(),hashtags:G(U()),why:U(),text:U(),seed:U().nullable().optional()}),oye=.25,sye=.4;function O5(e,t,n,r){let i=e[t-1],a=e[n-1];if(i===void 0||a===void 0||t>n)return;let o=e[t-2]?.end??0,s=e[n]?.start??r,c=Math.max(0,i.start-Math.max(0,Math.min(oye,(i.start-o)/2))),l=Math.min(r,a.end+Math.max(0,Math.min(sye,(s-a.end)/2)));return{start:k5(c),end:k5(l)}}K({first:oO([W(),U()]),last:oO([W(),U()]),title:U(),description:U(),hashtags:G(U()),why:U().optional()});function k5(e){return Math.round(e*1e3)/1e3}var cye=K({shorts:G(aye),durationSeconds:W().finite().nonnegative().optional(),sentences:G(K({start:W().finite().nonnegative(),end:W().finite().nonnegative(),text:U()})).optional()});function lye(e){if(e!=null)try{let t=cye.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function uye(e,t,n,r,i,a=[]){let o=e.sentences;if(o===void 0||o.length===0)return`These shorts were picked before clips could be adjusted by hand. Use Pick different moments, then adjust the new clips.`;if(!e.shorts.some(e=>e.number===t))return`There is no short ${String(t)} any more. Reload the page and choose again.`;if(!Number.isInteger(n)||!Number.isInteger(r)||n<1||r>o.length||n>r)return`Choose a start sentence that comes before the end sentence, between 1 and ${String(o.length)}.`;let s=O5(o,n,r,dye(e));if(s===void 0)return`Choose a start and an end sentence from the transcript.`;let c=s.end-s.start;if(c<i.minSeconds-.01)return`Short ${String(t)} would last ${String(Math.round(c))} seconds, shorter than the ${String(i.minSeconds)}-second minimum. Start it earlier or end it later.`;if(c>i.maxSeconds+.01)return`Short ${String(t)} would last ${String(Math.round(c))} seconds, longer than the ${String(i.maxSeconds)}-second maximum. Start it later or end it earlier.`;let l=a.find(e=>e.number!==t&&n<=e.last&&r>=e.first);if(l!==void 0)return`Short ${String(t)} would share sentences with short ${String(l.number)} (sentences ${String(l.first)}-${String(l.last)}). Choose a range that doesn't overlap it.`}function dye(e){return e.durationSeconds??e.sentences?.at(-1)?.end??0}function A5(e){let t=Object.fromEntries(Object.entries(e.content.imageDefinitions).map(([t,n])=>{let r=n.templateKey===null||n.templateKey===void 0?null:e.content.promptTemplates[n.templateKey]??null;return[t,r===null||n.source!==`generate`?n:{...n,prompt:aq(r,e.config.values)}]}));return{...e,content:{...e.content,imageDefinitions:t},config:{...e.config,rendered:{...e.config.rendered,...Object.fromEntries(Object.entries(e.content.promptTemplates).map(([t,n])=>[t,n===null?e.config.rendered[t]??``:aq(n,e.config.values)]))}}}}function fye(e,t,n){let r=t===`article`&&n===`off`,i={...e.config.sources,[t]:n,...t===`images`&&n===`off`?{video:`off`}:{},...r?{research:`off`,audio:`off`,document:`off`,...e.config.sources.thumbnail===`prompt_by_llm`?{thumbnail:`from_prompt`}:{}}:{}},{imageScenes:a,...o}=e.config;return{...e,config:{...r?o:e.config,sources:i,subtitles:nM(e.config.subtitles,i),...r?{youtubeDescription:!1,...e.config.shorts===void 0?{}:{shorts:{...e.config.shorts,enabled:!1}}}:{}}}}function j5(e,t,n){return A5({...e,content:{...e.content,promptTemplates:{...e.content.promptTemplates,[t]:n}}})}function pye(e){return new Promise((t,n)=>{if(e.aborted){n(Error(`Upload canceled.`));return}let r=()=>{clearTimeout(i),n(Error(`Upload canceled.`))},i=setTimeout(()=>{e.removeEventListener(`abort`,r),t()},200);e.addEventListener(`abort`,r,{once:!0})})}function M5({label:e,kind:t,disabled:n=!1,onReady:r,onPending:i,accept:a}){let{api:o}=R(),s=(0,m.useId)(),[c,l]=(0,m.useState)(),[u,d]=(0,m.useState)(!1),f=(0,m.useRef)(void 0),p=(0,m.useRef)(r);p.current=r;let g=(0,m.useRef)(i);g.current=i;let _=(0,m.useRef)(!0);(0,m.useEffect)(()=>(_.current=!0,()=>{_.current=!1,f.current?.abort(),g.current(!1)}),[]);async function v(e){if(n||f.current!==void 0)return;let r=new AbortController;f.current=r,d(!0),g.current(!0),l(void 0);let i;try{let n=await Ho(o,t,e);for(i=n.id,r.signal.throwIfAborted();n.state!==`staged`;){await pye(r.signal);let e=(await Fo(o)).files.find(e=>e.id===n.id);if(r.signal.throwIfAborted(),e===void 0)throw Error(`The upload stopped before the file finished copying. Choose the file again.`);n=e}p.current(n)}catch(e){let t=r.signal.aborted?`Upload canceled.`:e instanceof Error?e.message:String(e);if(i!==void 0)try{await Uo(o,i)}catch(e){t+=` The partial upload couldn't be removed (${e instanceof Error?e.message:String(e)}); use Clean orphan files in Settings → Backup & storage to clear it.`}_.current?l(t):t.includes(`partial upload couldn't be removed`)&&console.error(t)}finally{f.current===r&&(f.current=void 0,_.current&&(d(!1),g.current(!1)))}}return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsx)(uV,{label:e,id:s,children:(0,h.jsx)(Y,{id:s,type:`file`,disabled:u||n,accept:a??(t===`audio`?`audio/*`:`image/png,image/jpeg,image/webp`),onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&v(t)}})}),u?(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink-2`,children:`Copying upload…`}),(0,h.jsx)(L,{type:`button`,onClick:()=>f.current?.abort(),children:`Cancel upload`})]}):null,c===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:c})]})}var N5=`shorts:pick`,P5=e=>`shorts:${String(e)}`;function F5(e){let{shortsRanges:t,...n}=e.content;return{...e,content:n,regenerate:[...new Set([...e.regenerate??[],N5])]}}function I5(e,t){return{...e,regenerate:[...new Set([...e.regenerate??[],P5(t)])]}}function mye(e){let t=e.pieces.find(e=>e.key===`shorts:pick`&&e.selected&&e.piece.state===`done`),n=lye(t?.piece.payload);return t===void 0||n===void 0?void 0:{fingerprint:t.fingerprint,picked:n}}function hye({edit:e,view:t,prompts:n,problem:r,onChange:i,onPending:a}){let o=e.config.shorts??YO,[s,c]=(0,m.useState)({count:String(o.count),minSeconds:String(o.minSeconds),maxSeconds:String(o.maxSeconds),...Yie(o)}),l=[...n,...L5(t,`shorts`,`shorts`,t.revision.config.shorts?.prompt,n),...L5(t,`image`,`shortsImage`,t.revision.config.shorts?.imagePrompt,n)],u={enabled:o.enabled,...s,prompt:o.prompt??``,imagePrompt:o.imagePrompt??``,...o.titleOnScreen===void 0?{}:{titleOnScreen:o.titleOnScreen}},d=e.regenerate?.includes(N5)===!0,f=mye(t);return(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsx)(LV,{value:u,prompts:l,narrated:e.config.sources.audio!==`off`,problem:r,music:(0,h.jsx)(gye,{edit:e,disabled:!o.enabled,onChange:i,onPending:a}),preview:(0,h.jsx)(D6,{settings:PV(u,e.config.subtitles?.fontId??`default`)}),onChange:t=>{c({count:t.count,minSeconds:t.minSeconds,maxSeconds:t.maxSeconds,...t.musicVolume===void 0?{}:{musicVolume:t.musicVolume},...t.speed===void 0?{}:{speed:t.speed},...t.fullVideoLink===void 0?{}:{fullVideoLink:t.fullVideoLink}});let n=e;for(let[e,r,i,a]of[[`shorts`,`shorts`,u.prompt,t.prompt],[`shortsImage`,`image`,u.imagePrompt,t.imagePrompt]]){if(i===a)continue;let t=l.find(e=>e.kind===r&&e.name===a);n=t===void 0?yye(n,e):j5(n,e,t.body)}let r=e=>{let t=Number(e);return e.trim()===``||!Number.isFinite(t)?0:t},a=ZO(t);i({...n,config:{...n.config,shorts:{enabled:t.enabled,count:r(t.count),minSeconds:r(t.minSeconds),maxSeconds:r(t.maxSeconds),...t.prompt===``?{}:{prompt:t.prompt},...t.imagePrompt===``?{}:{imagePrompt:t.imagePrompt},...a,...a.musicVolume!==void 0&&!Number.isFinite(a.musicVolume)?{musicVolume:-1}:{},...a.speed!==void 0&&!Number.isFinite(a.speed)?{speed:0}:{}}}})}}),f!==void 0&&o.enabled?(0,h.jsx)(_ye,{edit:e,view:t,pick:f,settings:o,again:d,problem:r,onChange:i}):null]})}function gye({edit:e,disabled:t,onChange:n,onPending:r}){let i=(e.uploads??[]).some(e=>e.destination.kind===`shortsMusic`),a=e.content.shortsMusic!==void 0;return(0,h.jsxs)(`div`,{className:`basis-full space-y-2`,children:[i||a?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-ink-2`,children:[i?`New background music chosen. It is mixed under every short after you save and press Remake.`:`Background music plays quietly under every short and dips while the narrator speaks.`,(0,h.jsx)(L,{type:`button`,variant:`quiet`,disabled:t,onClick:()=>{let{shortsMusic:t,...r}=e.content;n({...e,content:r,uploads:(e.uploads??[]).filter(e=>e.destination.kind!==`shortsMusic`)})},children:`Remove the music`})]}):null,(0,h.jsx)(M5,{label:i||a?`Replace the background music`:`Background music (optional): an audio file, looped if shorter than a short`,kind:`audio`,disabled:t,onPending:r,onReady:t=>n({...e,uploads:[...(e.uploads??[]).filter(e=>e.destination.kind!==`shortsMusic`),{stagedFileId:t.id,destination:{kind:`shortsMusic`}}]})})]})}function _ye({edit:e,view:t,pick:n,settings:r,again:i,problem:a,onChange:o}){let s=(0,m.useId)(),c=t.revision.config.shorts,l=i||c===void 0||c.count!==r.count||c.minSeconds!==r.minSeconds||c.maxSeconds!==r.maxSeconds||(c.prompt??``)!==(r.prompt??``),u=Object.fromEntries(Object.entries(e.content.shortsRanges??{}).filter(([,e])=>e.pick===n.fingerprint)),d=n.picked.sentences??[],f=n.picked.durationSeconds??d.at(-1)?.end??0,p=n.picked.shorts.map(e=>{let t=u[String(e.number)],n=t===void 0?void 0:O5(d,t.first,t.last,f);return t===void 0||n===void 0?e:{...e,first:t.first,last:t.last,...n}}),g=(t,r,i)=>{let a=n.picked.shorts.find(e=>e.number===t.number),{[String(t.number)]:s,...c}=u,l=a!==void 0&&a.first===r&&a.last===i?c:{...c,[String(t.number)]:{first:r,last:i,pick:n.fingerprint}},{shortsRanges:d,...f}=e.content;o({...e,content:Object.keys(l).length===0?f:{...f,shortsRanges:l}})};return(0,h.jsxs)(`section`,{"aria-labelledby":`${s}-clips`,className:`space-y-3 border-t border-line pt-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(`h4`,{id:`${s}-clips`,className:`sl-kicker m-0`,children:`Picked clips`}),(0,h.jsx)(B,{id:`project.shorts.clips`})]}),i?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-accent-ink`,children:[`The moments will be picked again after you save and press Remake; clips on the same sentences keep their images.`,(0,h.jsx)(L,{type:`button`,variant:`quiet`,onClick:()=>o({...e,regenerate:(e.regenerate??[]).filter(e=>e!==N5)}),children:`Keep the current moments`})]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(L,{type:`button`,onClick:()=>o(F5(e)),children:`Pick different moments`}),(0,h.jsx)(B,{id:`project.shorts.pick-again`})]})]}),l&&!i?(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`These settings pick the moments again after you save and press Remake, so the clips below can be adjusted once the new ones are picked.`}):null,(0,h.jsx)(`ol`,{className:`space-y-3`,children:p.map(t=>(0,h.jsx)(vye,{clip:t,picked:n.picked,adjusted:u[String(t.number)]!==void 0,locked:l,remade:e.regenerate?.includes(P5(t.number))===!0,problem:(()=>{let e=u[String(t.number)];return e===void 0?a(`content.shortsRanges.${String(t.number)}`):uye(n.picked,t.number,e.first,e.last,r,p)})(),onRange:(e,n)=>g(t,e,n),onRemake:n=>o(n?I5(e,t.number):{...e,regenerate:(e.regenerate??[]).filter(e=>e!==P5(t.number))})},t.number))})]})}function vye({clip:e,picked:t,adjusted:n,locked:r,remade:i,problem:a,onRange:o,onRemake:s}){let c=(0,m.useId)(),l=t.sentences??[],[u,d]=(0,m.useState)(!1),f=String(e.number),p=e=>l[e-1]?.text??``,g=(e,t,n,i)=>(0,h.jsx)(L,{type:`button`,variant:`quiet`,"aria-label":`${e} of short ${f}`,disabled:r||!i,onClick:()=>o(t,n),children:e.split(` `)[0]}),_=Math.round(e.end-e.start);return(0,h.jsxs)(`li`,{"aria-labelledby":`${c}-title`,className:`space-y-2 border-t border-line pt-3 first:border-t-0 first:pt-0`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,h.jsxs)(`h5`,{id:`${c}-title`,className:`min-w-0 text-small font-semibold text-ink`,children:[`Short `,f,` · `,e.title]}),(0,h.jsxs)(`span`,{className:`text-label text-ink-3`,children:[`Sentences `,String(e.first),`-`,String(e.last),` · `,String(_),` s`,n?` · set by hand`:``]})]}),l.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`These shorts were picked before clips could be moved by hand. Use Pick different moments to adjust them.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-small text-ink-2`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Starts: “`,p(e.first),`”`]}),g(`Earlier start`,e.first-1,e.last,e.first>1),g(`Later start`,e.first+1,e.last,e.first<e.last)]}),(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-small text-ink-2`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Ends: “`,p(e.last),`”`]}),g(`Earlier end`,e.first,e.last-1,e.last>e.first),g(`Later end`,e.first,e.last+1,e.last<l.length)]}),u?(0,h.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[`first`,`last`].map(t=>(0,h.jsx)(uV,{id:`${c}-${t}`,label:t===`first`?`Start sentence`:`End sentence`,tip:`project.shorts.range`,children:(0,h.jsx)(pV,{value:String(e[t]),disabled:r,onChange:n=>{let r=Number(n.target.value);o(t===`first`?r:e.first,t===`last`?r:e.last)},children:l.map((e,t)=>(0,h.jsxs)(`option`,{value:String(t+1),children:[String(t+1),`.`,` `,e.text.length>70?`${e.text.slice(0,69)}…`:e.text]},String(t+1)))})},t))}):null]}),a===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:a}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l.length===0?null:(0,h.jsx)(L,{type:`button`,variant:`quiet`,disabled:r,onClick:()=>d(!u),children:u?`Hide the sentence lists`:`Use my own range`}),n?(0,h.jsx)(L,{type:`button`,variant:`quiet`,disabled:r,onClick:()=>{let n=t.shorts.find(t=>t.number===e.number);n!==void 0&&o(n.first,n.last)},children:`Back to the AI's choice`}):null,i?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-accent-ink`,children:[`Short `,f,` will be made again, with new images, after you save and press Remake.`,(0,h.jsx)(L,{type:`button`,variant:`quiet`,onClick:()=>s(!1),children:`Keep this short`})]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(L,{type:`button`,disabled:r,onClick:()=>s(!0),children:`Make this short again`}),(0,h.jsx)(B,{id:`project.shorts.remake`})]})]})]})}function L5(e,t,n,r,i){let a=e.revision.content.promptTemplates[n]??e.revision.config.rendered[n];return!r||a==null||i.some(e=>e.kind===t&&e.name===r)?[]:[{id:`saved-${n}`,kind:t,name:r,body:a,slots:[],updatedAt:e.revision.createdAt}]}function yye(e,t){let{[t]:n,...r}=e.content.promptTemplates,{[t]:i,...a}=e.config.rendered;return A5({...e,config:{...e.config,rendered:a},content:{...e.content,promptTemplates:r}})}var bye=K({shorts:G(K({number:W(),first:W().optional(),last:W().optional(),start:W(),end:W(),title:U(),description:U(),hashtags:G(U())}))});function xye({stage:e,project:t,outputs:n}){let r=(0,m.useId)(),i=d8(n,e),a=f8(i,`shorts`),o=B5(i),s=P8(t.id),[c,l]=(0,m.useState)(),u=R5(i,`short_video`,o),d=t.config.shorts,f=D5(t.id),p=d?.fullVideoLink??$ve(f.data),g=(0,m.use)(q8),_=(0,m.use)(J8);if(d?.enabled!==!0&&a===void 0&&u.length===0)return null;let v=g&&_!==void 0&&d?.enabled===!0,y=e=>{let t=Gie(e,p),n={text:`Couldn't copy short ${String(e.number)}. Select its text and copy it.`,tone:`error`};if(!navigator.clipboard){l(n);return}navigator.clipboard.writeText(t).then(()=>l({text:`Copied short ${String(e.number)}.`,tone:`success`}),()=>l(n))};return(0,h.jsxs)(`section`,{"aria-labelledby":`${r}-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(`h3`,{id:`${r}-title`,className:`sl-kicker m-0`,children:o.length===0?`Shorts`:`${String(o.length)} short${o.length===1?``:`s`} · 9:16`}),(0,h.jsx)(k8,{files:o.map(e=>({output:u.find(t=>z5(t,e)),label:`Short ${String(e.number)}: ${e.title} (.mp4)`})),label:u.length===1?`Download the short`:`Download`,children:v&&o.length>0?(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,...cb,children:[(0,h.jsx)(L,{onClick:()=>_({section:`shorts`,change:F5}),children:`Pick different moments`}),(0,h.jsx)(B,{id:`project.shorts.pick-again`})]}):null}),o.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.state===`running`?`The clips are picked after the subtitle timing.`:`Not made yet. They are made with the video.`}):(0,h.jsx)(A0,{shorts:!0,list:!0,label:`Shorts`,className:`gap-y-7`,children:o.map(n=>(0,h.jsx)(Sye,{clip:n,projectId:t.id,review:F8(s,{itemKey:`shorts:${String(n.number)}`}),video:u.find(e=>z5(e,n)),stills:R5(i,`short_image`,o).filter(e=>z5(e,n)).toSorted((e,t)=>(e.meta.index??0)-(t.meta.index??0)),link:p,wanted:Jie(n.end-n.start,t.config.imageSeconds),state:e.state,failed:Tye(e.failureReason,n.number),ownDownload:u.length>1,onCopy:()=>y(n),...v?{onRemake:()=>_({section:`shorts`,change:e=>I5(e,n.number)})}:{}},n.number))}),(0,h.jsx)(V1,{tone:c?.tone??`info`,children:c?.text})]})}function Sye({clip:e,projectId:t,review:n,video:r,stills:i,wanted:a,state:o,failed:s,link:c,ownDownload:l,onCopy:u,onRemake:d}){let f=(0,m.useId)(),p=y8(r),g=y8(i[0]),_=i.length,v=s?`Couldn't make this short. Open Error details in the Video section to see why.`:o===`running`?_<a?`Making images · ${String(_)} of ${String(a)}`:`Rendering`:`Not made yet. It is made with the video.`;return(0,h.jsxs)(`li`,{"aria-labelledby":`${f}-title`,className:`flex min-w-0 flex-col gap-2`,children:[r!==void 0&&p!==void 0?(0,h.jsx)(O0,{src:p.url,label:`Short ${String(e.number)}`,portrait:!0,...g===void 0?{}:{poster:g.url}},r.id):s||o!==`running`?(0,h.jsx)(`div`,{className:`sl-media__frame sl-media__frame--portrait`,children:(0,h.jsx)(`p`,{className:`m-0 flex size-full items-center justify-center p-3 text-center text-small ${s?`text-danger`:`text-ink-3`}`,children:v})}):(0,h.jsx)(k0,{alt:`Short ${String(e.number)}`,aspect:`portrait`,generating:v}),(0,h.jsx)(`h4`,{id:`${f}-title`,className:`m-0 min-w-0 break-words text-small font-semibold text-ink`,children:e.title}),(0,h.jsx)(`p`,{className:`m-0 text-label text-ink-2 tabular-nums`,children:cN(r?.durationMs??Math.round((e.end-e.start)*1e3))}),(0,h.jsx)(`p`,{className:`m-0 break-words text-small text-ink-2`,children:e.description}),(0,h.jsx)(Cye,{link:c}),(0,h.jsx)(`p`,{className:`m-0 break-words text-small text-ink-2`,children:e.hashtags.join(` `)}),(0,h.jsx)(z8,{review:n,projectId:t,busy:o===`running`}),(0,h.jsxs)(dy,{className:`mt-1 flex-nowrap gap-1`,children:[l&&r!==void 0&&p!==void 0?(0,h.jsx)(Hx,{href:p.url,download:!0,size:`small`,label:`Download short ${String(e.number)}`,tip:`Download`,children:(0,h.jsx)(Ac,{"aria-hidden":`true`,strokeWidth:1.75})}):null,(0,h.jsx)(ly,{size:`small`,tip:`Copy title, description and hashtags`,label:`Copy short ${String(e.number)}'s title, description and hashtags`,onClick:u,children:(0,h.jsx)(kc,{"aria-hidden":`true`,strokeWidth:1.75})}),d===void 0?null:(0,h.jsxs)(p8,{children:[(0,h.jsx)(m8,{asChild:!0,children:(0,h.jsx)(ly,{size:`small`,tip:`More`,label:`More for short ${String(e.number)}`,children:(0,h.jsx)(jc,{"aria-hidden":`true`,strokeWidth:1.75})})}),(0,h.jsx)(h8,{align:`start`,children:(0,h.jsxs)(g8,{onSelect:d,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-4`}),`Make short `,String(e.number),` again`]})})]})]})]})}function Cye({link:e}){let t=e?.trim()??``;return(0,h.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 break-words text-small text-ink-2`,children:[(0,h.jsx)(`span`,{children:`Watch the full video:`}),t===``?(0,h.jsxs)(Gx,{tone:`waiting`,title:`No link to the full video is saved. Copy leaves a placeholder to paste it over; to fill it in for every short, add the link under Edit settings → Shorts.`,children:[(0,h.jsx)(Rc,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-3`}),`Link needed`]}):(0,h.jsx)(`span`,{className:`min-w-0 break-all text-ink`,children:t})]})}function R5(e,t,n){let r=e.find(e=>e.role===`shorts`);return e.filter(e=>e.role===t&&(r===void 0||e.createdAt>=r.createdAt||n.some(t=>z5(e,t)&&e.meta.sentences?.[0]===t.first&&e.meta.sentences?.[1]===t.last)))}function z5(e,t){return e.meta.short===t.number}function B5(e){return wye(j8(f8(e,`shorts`)).data)}function wye(e){if(e===void 0)return[];try{let t=bye.safeParse(JSON.parse(e));return t.success?t.data.shorts:[]}catch{return[]}}function Tye(e,t){return e?.startsWith(`Short ${String(t)}:`)===!0||e?.startsWith(`Short ${String(t)} `)===!0}function Eye({stage:e,project:t,outputs:n,subtitleControls:r}){let{api:i}=R(),a=gy(),o=t.config.sources.video===`off`&&t.config.sources.audio!==`off`,s=f8(d8(n,e),o?`audio_export`:`video`),c=d8(n,e),l=f8(c,`subtitles_srt`),u=f8(c,`subtitles_vtt`),d=f8(c,`youtube_description`),f=f8(c,`youtube_tags`),p=f8(c,`audio_mp3`),m=f8(c,`audio_m4b`),g=R5(c,`short_video`,B5(c)).toSorted((e,t)=>(e.meta.short??0)-(t.meta.short??0)),_=y8(s),v=y8(Dye(n)),y=Oye(t.id,d,f,s?.durationMs??null),b=y8(u),x=s?.meta.subtitlesMode??t.config.subtitles?.mode,S=e.state===`running`,C=lN(e.progressCurrent??0,e.progressTotal??0);return qb({id:`project.folder`,title:`Open the project folder`,group:`This project`,context:t.title,keywords:[`folder`,`files`,`finder`,`explorer`,`video`],run:async()=>{if(s===void 0){a(`The video has not been saved yet, so there is no folder to open.`,`info`);return}try{let e=await Q0(i,{projectId:t.id,asset:E3(s),folder:_?.folder??null});e.opened||a(`${$0} ${e.path}`,`info`)}catch(e){a(e instanceof Error?e.message:`The folder couldn't be opened. Use Open folder under the video.`,`error`)}}}),t.config.sources.video===`off`&&!o?(0,h.jsx)(C8,{children:r}):(0,h.jsxs)(C8,{className:`p-0`,children:[S?(0,h.jsx)(`p`,{className:`m-0 text-small text-accent-ink`,children:XM(e,t.config)?`Preparing subtitles · ${String(lN(e.progressCurrent??0,35))}%`:o?`Exporting combined audio`:e.activity===void 0?e.progressTotal===null?`Rendering`:`Rendering · ${String(C)}%`:tN(eN(e)??``)}):null,s===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:o?`No combined audio export has landed yet.`:`No render has landed yet.`}):o?(0,h.jsx)(Q8,{label:`Combined narration`,src:_?.url,marks:y},s.id):_===void 0?null:(0,h.jsx)(O0,{src:_.url,label:`Generated video`,...v===void 0?{}:{poster:v.url},chapters:y,portrait:t.format===`9:16`,className:t.format===`9:16`?`max-w-[360px]`:`max-w-[1100px]`,...x===`files`&&u&&b?{captions:{src:b.url,lang:`en`,label:`English`}}:{}},s.id),(0,h.jsx)(k8,{files:[{output:s,label:o?`Audio (.wav)`:`Video (.mp4)`},{output:l,label:`Subtitles (.srt)`},{output:u,label:`Subtitles (.vtt)`},{output:d,label:`YouTube description (.txt)`},{output:f,label:`YouTube tags (.txt)`},{output:p,label:`Audio with chapters (.mp3)`},{output:m,label:`Audiobook with chapters (.m4b)`},...g.map(e=>({output:e,label:`Short ${String(e.meta.short??``)} (.mp4)`}))]}),s===void 0?null:(0,h.jsx)(A8,{children:[cN(s?.durationMs??void 0),o?`WAV · stereo · 48 kHz`:t.format,s?.meta.master===void 0?void 0:jie(s.meta.master)].filter(e=>e!==void 0).join(` · `)}),s?.meta.warnings?.length?(0,h.jsx)(`ul`,{"aria-label":`Render notes`,className:`m-0 flex flex-col gap-1 pl-5 text-small text-ink-2`,children:s.meta.warnings.map(e=>(0,h.jsx)(`li`,{children:e},e))}):null,t.config.sources.audio===`off`||CO(t.config.language)===void 0?null:(0,h.jsx)(`p`,{role:`note`,className:`border-t border-line pt-3 text-small text-ink-2`,children:CO(t.config.language)}),s?.meta.subtitleOmissions?.length?(0,h.jsxs)(`details`,{className:`border-t border-line pt-3 text-small`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer font-semibold`,children:[`Subtitles recovered after missing narration (`,s.meta.subtitleOmissions.length,`)`]}),(0,h.jsx)(`p`,{className:`m-0 mt-2 text-ink-2`,children:`These transcript passages could not be matched to the audio and were left out of the captions. The audio is unchanged. Review these passages before sharing.`}),(0,h.jsx)(`ul`,{className:`m-0 mt-2 flex flex-col gap-2 pl-5`,children:s.meta.subtitleOmissions.map(e=>(0,h.jsxs)(`li`,{children:[(0,h.jsx)(`strong`,{children:new Date(e.start*1e3).toISOString().slice(11,19)}),` —`,` `,e.text]},`${e.start}-${e.text}`))})]}):null,r?(0,h.jsxs)(`details`,{className:`border-t border-line pt-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-small font-semibold`,children:`Subtitles & fonts`}),r]}):null]})}function Dye(e){return e.filter(e=>e.role===`thumbnail`).toSorted((e,t)=>(e.meta.index??1)-(t.meta.index??1))[0]}function Oye(e,t,n,r){let{api:i}=R(),a=j8(t).data,o=j8(n).data,s=N({queryKey:z.youtubeEdits(e),queryFn:()=>zs(i,e),enabled:t!==void 0});return a===void 0?[]:kye(T5(w5(C5(a,o??``),s.data?.fields??{})).chapters,r===null?void 0:r/1e3)}function kye(e,t){return S5(e,t).text.split(`
|
|
300
|
+
`)}function Zve(e,t){return t===void 0?{text:e??``,edited:!1}:e===void 0||t.base===e?{text:t.text,edited:!0}:t.text===e?{text:e,edited:!1}:{text:t.text,edited:!0,pending:e}}function w5(e,t){let n=n=>Zve(e?.[n],t[n]);return{summary:n(`summary`),chapters:n(`chapters`),hashtags:n(`hashtags`),tags:n(`tags`),pinnedComment:n(`pinnedComment`),titles:n(`titles`)}}function T5(e){return{summary:e.summary.text,chapters:e.chapters.text,hashtags:e.hashtags.text,tags:e.tags.text,pinnedComment:e.pinnedComment.text,titles:e.titles.text}}function Qve(e,t,n,r){return`https://studio.youtube.com/video/${e}/edit#slopify-ab=${t}&p=${encodeURIComponent(n)}&s=${String(r??0)}`}var E5=e=>[`project`,e,`youtube-videos`];function D5(e){let{api:t}=R();return N({queryKey:E5(e),queryFn:()=>ws(t,e)})}function $ve(e){let t=e?.find(e=>e.short===null&&e.uploadState===`done`);return t===void 0?void 0:`https://youtu.be/${t.videoId}`}function eye(e){return e===null?`Video`:`Short ${String(e)}`}function tye(e){if(e.uploadState===`filled`)return`Filled in Studio, but not scheduled or published yet (cancelled, or left as a draft). Upload it again from the extension, or paste its link once it is up.`;let t=[`On YouTube.`];return e.finishState===`waiting`&&t.push(`Related video, end screen and captions are being set.`),e.finishState===`failed`&&t.push(`Details touches failed: ${e.finishMessage??`no reason given`}`),e.commentState===`waiting`&&t.push(`The comment is pinned once it is public.`),e.commentState===`done`&&t.push(`Comment pinned.`),e.commentState===`failed`&&t.push(`Pinning the comment failed: ${e.commentMessage??`no reason given`}`),t.join(` `)}function nye({projectId:e,shorts:t}){let n=D5(e),{api:r}=R(),i=N({queryKey:[`project`,e,`youtube-stats`],queryFn:()=>hs(r,e)}),a=[null,...Array.from({length:t},(e,t)=>t+1)];return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(`div`,{className:`sl-field__label`,children:`On YouTube`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`The extension keeps each upload's link when Studio confirms it. Paste a link for an upload made by hand. A/B test opens the video in Studio with A/B Testing set up; press Set test and Save there.`}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:a.map(t=>(0,h.jsx)(rye,{projectId:e,short:t,video:n.data?.find(e=>e.short===t),stats:i.data?.find(e=>e.short===t)},t??0))})]})}function rye({projectId:e,short:t,video:n,stats:r}){let{api:i}=R(),a=_(),o=(0,m.useId)(),s=n===void 0?``:`https://youtu.be/${n.videoId}`,[c,l]=(0,m.useState)(),u=c??s,[d,f]=(0,m.useState)(),p=P({mutationFn:()=>Ts(i,e,t,u),onSuccess:t=>{a.setQueryData(E5(e),t),l(void 0),f(void 0)},onError:e=>f(e.message)});return(0,h.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`label`,{className:`w-[64px] shrink-0 text-small text-ink-2`,htmlFor:o,children:eye(t)}),(0,h.jsx)(Y,{id:o,type:`url`,className:`min-w-[220px] flex-1 sm:max-w-[360px]`,placeholder:`https://youtu.be/…`,value:u,onChange:e=>l(e.currentTarget.value)}),u.trim()===s?null:(0,h.jsx)(L,{type:`button`,size:`small`,disabled:p.isPending,onClick:()=>p.mutate(),children:`Save link`}),n===void 0||n.uploadState!==`done`||t!==null?null:(0,h.jsxs)(p8,{children:[(0,h.jsx)(m8,{asChild:!0,children:(0,h.jsx)(L,{type:`button`,size:`small`,variant:`quiet`,children:`A/B test`})}),(0,h.jsx)(h8,{children:[[`both`,`Titles and thumbnails`],[`titles`,`Titles`],[`thumbnails`,`Thumbnails`]].map(([r,i])=>(0,h.jsx)(g8,{onSelect:()=>window.open(Qve(n.videoId,r,e,t),`_blank`,`noopener`),children:i},r))})]})]}),n===void 0&&d===void 0?null:(0,h.jsx)(`p`,{className:`m-0 pl-18 text-small ${d!==void 0||n?.finishState===`failed`||n?.commentState===`failed`?`text-danger`:`text-ink-3`}`,children:d??(n===void 0?``:tye(n))}),r===void 0?null:(0,h.jsx)(`p`,{className:`m-0 pl-18 text-small tabular-nums text-ink-2`,children:iye(r)})]})}function iye(e){let t=[];if(e.views!==null&&t.push(`${e.views.toLocaleString()} views`),e.ctr!==null&&t.push(`${String(e.ctr)}% CTR${e.impressions===null?``:` of ${e.impressions.toLocaleString()} impressions`}`),e.averageViewSeconds!==null){let n=Math.round(e.averageViewSeconds),r=n>=3600?`${String(Math.floor(n/3600))}:${String(Math.floor(n%3600/60)).padStart(2,`0`)}:${String(n%60).padStart(2,`0`)}`:`${String(Math.floor(n/60))}:${String(n%60).padStart(2,`0`)}`;t.push(`${r} average view`)}return t.push(`read ${new Date(e.readAt).toLocaleDateString(void 0,{day:`numeric`,month:`short`})}`),t.join(` · `)}var aye=K({number:W().int().positive(),first:W().int().positive(),last:W().int().positive(),start:W().finite().nonnegative(),end:W().finite().positive(),title:U(),description:U(),hashtags:G(U()),why:U(),text:U(),seed:U().nullable().optional()}),oye=.25,sye=.4;function O5(e,t,n,r){let i=e[t-1],a=e[n-1];if(i===void 0||a===void 0||t>n)return;let o=e[t-2]?.end??0,s=e[n]?.start??r,c=Math.max(0,i.start-Math.max(0,Math.min(oye,(i.start-o)/2))),l=Math.min(r,a.end+Math.max(0,Math.min(sye,(s-a.end)/2)));return{start:k5(c),end:k5(l)}}K({first:oO([W(),U()]),last:oO([W(),U()]),title:U(),description:U(),hashtags:G(U()),why:U().optional()});function k5(e){return Math.round(e*1e3)/1e3}var cye=K({shorts:G(aye),durationSeconds:W().finite().nonnegative().optional(),sentences:G(K({start:W().finite().nonnegative(),end:W().finite().nonnegative(),text:U()})).optional()});function lye(e){if(e!=null)try{let t=cye.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function uye(e,t,n,r,i,a=[]){let o=e.sentences;if(o===void 0||o.length===0)return`These shorts were picked before clips could be adjusted by hand. Use Pick different moments, then adjust the new clips.`;if(!e.shorts.some(e=>e.number===t))return`There is no short ${String(t)} any more. Reload the page and choose again.`;if(!Number.isInteger(n)||!Number.isInteger(r)||n<1||r>o.length||n>r)return`Choose a start sentence that comes before the end sentence, between 1 and ${String(o.length)}.`;let s=O5(o,n,r,dye(e));if(s===void 0)return`Choose a start and an end sentence from the transcript.`;let c=s.end-s.start;if(c<i.minSeconds-.01)return`Short ${String(t)} would last ${String(Math.round(c))} seconds, shorter than the ${String(i.minSeconds)}-second minimum. Start it earlier or end it later.`;if(c>i.maxSeconds+.01)return`Short ${String(t)} would last ${String(Math.round(c))} seconds, longer than the ${String(i.maxSeconds)}-second maximum. Start it later or end it earlier.`;let l=a.find(e=>e.number!==t&&n<=e.last&&r>=e.first);if(l!==void 0)return`Short ${String(t)} would share sentences with short ${String(l.number)} (sentences ${String(l.first)}-${String(l.last)}). Choose a range that doesn't overlap it.`}function dye(e){return e.durationSeconds??e.sentences?.at(-1)?.end??0}function A5(e){let t=Object.fromEntries(Object.entries(e.content.imageDefinitions).map(([t,n])=>{let r=n.templateKey===null||n.templateKey===void 0?null:e.content.promptTemplates[n.templateKey]??null;return[t,r===null||n.source!==`generate`?n:{...n,prompt:aq(r,e.config.values)}]}));return{...e,content:{...e.content,imageDefinitions:t},config:{...e.config,rendered:{...e.config.rendered,...Object.fromEntries(Object.entries(e.content.promptTemplates).map(([t,n])=>[t,n===null?e.config.rendered[t]??``:aq(n,e.config.values)]))}}}}function fye(e,t,n){let r=t===`article`&&n===`off`,i={...e.config.sources,[t]:n,...t===`images`&&n===`off`?{video:`off`}:{},...r?{research:`off`,audio:`off`,document:`off`,...e.config.sources.thumbnail===`prompt_by_llm`?{thumbnail:`from_prompt`}:{}}:{}},{imageScenes:a,...o}=e.config;return{...e,config:{...r?o:e.config,sources:i,subtitles:nM(e.config.subtitles,i),...r?{youtubeDescription:!1,...e.config.shorts===void 0?{}:{shorts:{...e.config.shorts,enabled:!1}}}:{}}}}function j5(e,t,n){return A5({...e,content:{...e.content,promptTemplates:{...e.content.promptTemplates,[t]:n}}})}function pye(e){return new Promise((t,n)=>{if(e.aborted){n(Error(`Upload canceled.`));return}let r=()=>{clearTimeout(i),n(Error(`Upload canceled.`))},i=setTimeout(()=>{e.removeEventListener(`abort`,r),t()},200);e.addEventListener(`abort`,r,{once:!0})})}function M5({label:e,kind:t,disabled:n=!1,onReady:r,onPending:i,accept:a}){let{api:o}=R(),s=(0,m.useId)(),[c,l]=(0,m.useState)(),[u,d]=(0,m.useState)(!1),f=(0,m.useRef)(void 0),p=(0,m.useRef)(r);p.current=r;let g=(0,m.useRef)(i);g.current=i;let _=(0,m.useRef)(!0);(0,m.useEffect)(()=>(_.current=!0,()=>{_.current=!1,f.current?.abort(),g.current(!1)}),[]);async function v(e){if(n||f.current!==void 0)return;let r=new AbortController;f.current=r,d(!0),g.current(!0),l(void 0);let i;try{let n=await Ho(o,t,e);for(i=n.id,r.signal.throwIfAborted();n.state!==`staged`;){await pye(r.signal);let e=(await Fo(o)).files.find(e=>e.id===n.id);if(r.signal.throwIfAborted(),e===void 0)throw Error(`The upload stopped before the file finished copying. Choose the file again.`);n=e}p.current(n)}catch(e){let t=r.signal.aborted?`Upload canceled.`:e instanceof Error?e.message:String(e);if(i!==void 0)try{await Uo(o,i)}catch(e){t+=` The partial upload couldn't be removed (${e instanceof Error?e.message:String(e)}); use Clean orphan files in Settings → Backup & storage to clear it.`}_.current?l(t):t.includes(`partial upload couldn't be removed`)&&console.error(t)}finally{f.current===r&&(f.current=void 0,_.current&&(d(!1),g.current(!1)))}}return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsx)(uV,{label:e,id:s,children:(0,h.jsx)(Y,{id:s,type:`file`,disabled:u||n,accept:a??(t===`audio`?`audio/*`:`image/png,image/jpeg,image/webp`),onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&v(t)}})}),u?(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink-2`,children:`Copying upload…`}),(0,h.jsx)(L,{type:`button`,onClick:()=>f.current?.abort(),children:`Cancel upload`})]}):null,c===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:c})]})}var N5=`shorts:pick`,P5=e=>`shorts:${String(e)}`;function F5(e){let{shortsRanges:t,...n}=e.content;return{...e,content:n,regenerate:[...new Set([...e.regenerate??[],N5])]}}function I5(e,t){return{...e,regenerate:[...new Set([...e.regenerate??[],P5(t)])]}}function mye(e){let t=e.pieces.find(e=>e.key===`shorts:pick`&&e.selected&&e.piece.state===`done`),n=lye(t?.piece.payload);return t===void 0||n===void 0?void 0:{fingerprint:t.fingerprint,picked:n}}function hye({edit:e,view:t,prompts:n,problem:r,onChange:i,onPending:a}){let o=e.config.shorts??YO,[s,c]=(0,m.useState)({count:String(o.count),minSeconds:String(o.minSeconds),maxSeconds:String(o.maxSeconds),...Yie(o)}),l=[...n,...L5(t,`shorts`,`shorts`,t.revision.config.shorts?.prompt,n),...L5(t,`image`,`shortsImage`,t.revision.config.shorts?.imagePrompt,n)],u={enabled:o.enabled,...s,prompt:o.prompt??``,imagePrompt:o.imagePrompt??``,...o.titleOnScreen===void 0?{}:{titleOnScreen:o.titleOnScreen}},d=e.regenerate?.includes(N5)===!0,f=mye(t);return(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsx)(LV,{value:u,prompts:l,narrated:e.config.sources.audio!==`off`,problem:r,music:(0,h.jsx)(gye,{edit:e,disabled:!o.enabled,onChange:i,onPending:a}),preview:(0,h.jsx)(D6,{settings:PV(u,e.config.subtitles?.fontId??`default`)}),onChange:t=>{c({count:t.count,minSeconds:t.minSeconds,maxSeconds:t.maxSeconds,...t.musicVolume===void 0?{}:{musicVolume:t.musicVolume},...t.speed===void 0?{}:{speed:t.speed},...t.fullVideoLink===void 0?{}:{fullVideoLink:t.fullVideoLink}});let n=e;for(let[e,r,i,a]of[[`shorts`,`shorts`,u.prompt,t.prompt],[`shortsImage`,`image`,u.imagePrompt,t.imagePrompt]]){if(i===a)continue;let t=l.find(e=>e.kind===r&&e.name===a);n=t===void 0?yye(n,e):j5(n,e,t.body)}let r=e=>{let t=Number(e);return e.trim()===``||!Number.isFinite(t)?0:t},a=ZO(t);i({...n,config:{...n.config,shorts:{enabled:t.enabled,count:r(t.count),minSeconds:r(t.minSeconds),maxSeconds:r(t.maxSeconds),...t.prompt===``?{}:{prompt:t.prompt},...t.imagePrompt===``?{}:{imagePrompt:t.imagePrompt},...a,...a.musicVolume!==void 0&&!Number.isFinite(a.musicVolume)?{musicVolume:-1}:{},...a.speed!==void 0&&!Number.isFinite(a.speed)?{speed:0}:{}}}})}}),f!==void 0&&o.enabled?(0,h.jsx)(_ye,{edit:e,view:t,pick:f,settings:o,again:d,problem:r,onChange:i}):null]})}function gye({edit:e,disabled:t,onChange:n,onPending:r}){let i=(e.uploads??[]).some(e=>e.destination.kind===`shortsMusic`),a=e.content.shortsMusic!==void 0;return(0,h.jsxs)(`div`,{className:`basis-full space-y-2`,children:[i||a?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-ink-2`,children:[i?`New background music chosen. It is mixed under every short after you save and press Remake.`:`Background music plays quietly under every short and dips while the narrator speaks.`,(0,h.jsx)(L,{type:`button`,variant:`quiet`,disabled:t,onClick:()=>{let{shortsMusic:t,...r}=e.content;n({...e,content:r,uploads:(e.uploads??[]).filter(e=>e.destination.kind!==`shortsMusic`)})},children:`Remove the music`})]}):null,(0,h.jsx)(M5,{label:i||a?`Replace the background music`:`Background music (optional): an audio file, looped if shorter than a short`,kind:`audio`,disabled:t,onPending:r,onReady:t=>n({...e,uploads:[...(e.uploads??[]).filter(e=>e.destination.kind!==`shortsMusic`),{stagedFileId:t.id,destination:{kind:`shortsMusic`}}]})})]})}function _ye({edit:e,view:t,pick:n,settings:r,again:i,problem:a,onChange:o}){let s=(0,m.useId)(),c=t.revision.config.shorts,l=i||c===void 0||c.count!==r.count||c.minSeconds!==r.minSeconds||c.maxSeconds!==r.maxSeconds||(c.prompt??``)!==(r.prompt??``),u=Object.fromEntries(Object.entries(e.content.shortsRanges??{}).filter(([,e])=>e.pick===n.fingerprint)),d=n.picked.sentences??[],f=n.picked.durationSeconds??d.at(-1)?.end??0,p=n.picked.shorts.map(e=>{let t=u[String(e.number)],n=t===void 0?void 0:O5(d,t.first,t.last,f);return t===void 0||n===void 0?e:{...e,first:t.first,last:t.last,...n}}),g=(t,r,i)=>{let a=n.picked.shorts.find(e=>e.number===t.number),{[String(t.number)]:s,...c}=u,l=a!==void 0&&a.first===r&&a.last===i?c:{...c,[String(t.number)]:{first:r,last:i,pick:n.fingerprint}},{shortsRanges:d,...f}=e.content;o({...e,content:Object.keys(l).length===0?f:{...f,shortsRanges:l}})};return(0,h.jsxs)(`section`,{"aria-labelledby":`${s}-clips`,className:`space-y-3 border-t border-line pt-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(`h4`,{id:`${s}-clips`,className:`sl-kicker m-0`,children:`Picked clips`}),(0,h.jsx)(B,{id:`project.shorts.clips`})]}),i?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-accent-ink`,children:[`The moments will be picked again after you save and press Remake; clips on the same sentences keep their images.`,(0,h.jsx)(L,{type:`button`,variant:`quiet`,onClick:()=>o({...e,regenerate:(e.regenerate??[]).filter(e=>e!==N5)}),children:`Keep the current moments`})]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(L,{type:`button`,onClick:()=>o(F5(e)),children:`Pick different moments`}),(0,h.jsx)(B,{id:`project.shorts.pick-again`})]})]}),l&&!i?(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`These settings pick the moments again after you save and press Remake, so the clips below can be adjusted once the new ones are picked.`}):null,(0,h.jsx)(`ol`,{className:`space-y-3`,children:p.map(t=>(0,h.jsx)(vye,{clip:t,picked:n.picked,adjusted:u[String(t.number)]!==void 0,locked:l,remade:e.regenerate?.includes(P5(t.number))===!0,problem:(()=>{let e=u[String(t.number)];return e===void 0?a(`content.shortsRanges.${String(t.number)}`):uye(n.picked,t.number,e.first,e.last,r,p)})(),onRange:(e,n)=>g(t,e,n),onRemake:n=>o(n?I5(e,t.number):{...e,regenerate:(e.regenerate??[]).filter(e=>e!==P5(t.number))})},t.number))})]})}function vye({clip:e,picked:t,adjusted:n,locked:r,remade:i,problem:a,onRange:o,onRemake:s}){let c=(0,m.useId)(),l=t.sentences??[],[u,d]=(0,m.useState)(!1),f=String(e.number),p=e=>l[e-1]?.text??``,g=(e,t,n,i)=>(0,h.jsx)(L,{type:`button`,variant:`quiet`,"aria-label":`${e} of short ${f}`,disabled:r||!i,onClick:()=>o(t,n),children:e.split(` `)[0]}),_=Math.round(e.end-e.start);return(0,h.jsxs)(`li`,{"aria-labelledby":`${c}-title`,className:`space-y-2 border-t border-line pt-3 first:border-t-0 first:pt-0`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,h.jsxs)(`h5`,{id:`${c}-title`,className:`min-w-0 text-small font-semibold text-ink`,children:[`Short `,f,` · `,e.title]}),(0,h.jsxs)(`span`,{className:`text-label text-ink-3`,children:[`Sentences `,String(e.first),`-`,String(e.last),` · `,String(_),` s`,n?` · set by hand`:``]})]}),l.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`These shorts were picked before clips could be moved by hand. Use Pick different moments to adjust them.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-small text-ink-2`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Starts: “`,p(e.first),`”`]}),g(`Earlier start`,e.first-1,e.last,e.first>1),g(`Later start`,e.first+1,e.last,e.first<e.last)]}),(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-small text-ink-2`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Ends: “`,p(e.last),`”`]}),g(`Earlier end`,e.first,e.last-1,e.last>e.first),g(`Later end`,e.first,e.last+1,e.last<l.length)]}),u?(0,h.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[`first`,`last`].map(t=>(0,h.jsx)(uV,{id:`${c}-${t}`,label:t===`first`?`Start sentence`:`End sentence`,tip:`project.shorts.range`,children:(0,h.jsx)(pV,{value:String(e[t]),disabled:r,onChange:n=>{let r=Number(n.target.value);o(t===`first`?r:e.first,t===`last`?r:e.last)},children:l.map((e,t)=>(0,h.jsxs)(`option`,{value:String(t+1),children:[String(t+1),`.`,` `,e.text.length>70?`${e.text.slice(0,69)}…`:e.text]},String(t+1)))})},t))}):null]}),a===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-danger`,children:a}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l.length===0?null:(0,h.jsx)(L,{type:`button`,variant:`quiet`,disabled:r,onClick:()=>d(!u),children:u?`Hide the sentence lists`:`Use my own range`}),n?(0,h.jsx)(L,{type:`button`,variant:`quiet`,disabled:r,onClick:()=>{let n=t.shorts.find(t=>t.number===e.number);n!==void 0&&o(n.first,n.last)},children:`Back to the AI's choice`}):null,i?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-accent-ink`,children:[`Short `,f,` will be made again, with new images, after you save and press Remake.`,(0,h.jsx)(L,{type:`button`,variant:`quiet`,onClick:()=>s(!1),children:`Keep this short`})]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(L,{type:`button`,disabled:r,onClick:()=>s(!0),children:`Make this short again`}),(0,h.jsx)(B,{id:`project.shorts.remake`})]})]})]})}function L5(e,t,n,r,i){let a=e.revision.content.promptTemplates[n]??e.revision.config.rendered[n];return!r||a==null||i.some(e=>e.kind===t&&e.name===r)?[]:[{id:`saved-${n}`,kind:t,name:r,body:a,slots:[],updatedAt:e.revision.createdAt}]}function yye(e,t){let{[t]:n,...r}=e.content.promptTemplates,{[t]:i,...a}=e.config.rendered;return A5({...e,config:{...e.config,rendered:a},content:{...e.content,promptTemplates:r}})}var bye=K({shorts:G(K({number:W(),first:W().optional(),last:W().optional(),start:W(),end:W(),title:U(),description:U(),hashtags:G(U())}))});function xye({stage:e,project:t,outputs:n}){let r=(0,m.useId)(),i=d8(n,e),a=f8(i,`shorts`),o=B5(i),s=P8(t.id),[c,l]=(0,m.useState)(),u=R5(i,`short_video`,o),d=t.config.shorts,f=D5(t.id),p=d?.fullVideoLink??$ve(f.data),g=(0,m.use)(q8),_=(0,m.use)(J8);if(d?.enabled!==!0&&a===void 0&&u.length===0)return null;let v=g&&_!==void 0&&d?.enabled===!0,y=e=>{let t=Gie(e,p),n={text:`Couldn't copy short ${String(e.number)}. Select its text and copy it.`,tone:`error`};if(!navigator.clipboard){l(n);return}navigator.clipboard.writeText(t).then(()=>l({text:`Copied short ${String(e.number)}.`,tone:`success`}),()=>l(n))};return(0,h.jsxs)(`section`,{"aria-labelledby":`${r}-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(`h3`,{id:`${r}-title`,className:`sl-kicker m-0`,children:o.length===0?`Shorts`:`${String(o.length)} short${o.length===1?``:`s`} · 9:16`}),(0,h.jsx)(k8,{files:o.map(e=>({output:u.find(t=>z5(t,e)),label:`Short ${String(e.number)}: ${e.title} (.mp4)`})),label:u.length===1?`Download the short`:`Download`,children:v&&o.length>0?(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,...cb,children:[(0,h.jsx)(L,{onClick:()=>_({section:`shorts`,change:F5}),children:`Pick different moments`}),(0,h.jsx)(B,{id:`project.shorts.pick-again`})]}):null}),o.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.state===`running`?`The clips are picked after the subtitle timing.`:`Not made yet. They are made with the video.`}):(0,h.jsx)(A0,{shorts:!0,list:!0,label:`Shorts`,className:`gap-y-7`,children:o.map(n=>(0,h.jsx)(Sye,{clip:n,projectId:t.id,review:F8(s,{itemKey:`shorts:${String(n.number)}`}),video:u.find(e=>z5(e,n)),stills:R5(i,`short_image`,o).filter(e=>z5(e,n)).toSorted((e,t)=>(e.meta.index??0)-(t.meta.index??0)),link:p,wanted:Jie(n.end-n.start,t.config.imageSeconds),state:e.state,failed:Tye(e.failureReason,n.number),ownDownload:u.length>1,onCopy:()=>y(n),...v?{onRemake:()=>_({section:`shorts`,change:e=>I5(e,n.number)})}:{}},n.number))}),(0,h.jsx)(V1,{tone:c?.tone??`info`,children:c?.text})]})}function Sye({clip:e,projectId:t,review:n,video:r,stills:i,wanted:a,state:o,failed:s,link:c,ownDownload:l,onCopy:u,onRemake:d}){let f=(0,m.useId)(),p=y8(r),g=y8(i[0]),_=i.length,v=s?`Couldn't make this short. Open Error details in the Video section to see why.`:o===`running`?_<a?`Making images · ${String(_)} of ${String(a)}`:`Rendering`:`Not made yet. It is made with the video.`;return(0,h.jsxs)(`li`,{"aria-labelledby":`${f}-title`,className:`flex min-w-0 flex-col gap-2`,children:[r!==void 0&&p!==void 0?(0,h.jsx)(O0,{src:p.url,label:`Short ${String(e.number)}`,portrait:!0,...g===void 0?{}:{poster:g.url}},r.id):s||o!==`running`?(0,h.jsx)(`div`,{className:`sl-media__frame sl-media__frame--portrait`,children:(0,h.jsx)(`p`,{className:`m-0 flex size-full items-center justify-center p-3 text-center text-small ${s?`text-danger`:`text-ink-3`}`,children:v})}):(0,h.jsx)(k0,{alt:`Short ${String(e.number)}`,aspect:`portrait`,generating:v}),(0,h.jsx)(`h4`,{id:`${f}-title`,className:`m-0 min-w-0 break-words text-small font-semibold text-ink`,children:e.title}),(0,h.jsx)(`p`,{className:`m-0 text-label text-ink-2 tabular-nums`,children:cN(r?.durationMs??Math.round((e.end-e.start)*1e3))}),(0,h.jsx)(`p`,{className:`m-0 break-words text-small text-ink-2`,children:e.description}),(0,h.jsx)(Cye,{link:c}),(0,h.jsx)(`p`,{className:`m-0 break-words text-small text-ink-2`,children:e.hashtags.join(` `)}),(0,h.jsx)(z8,{review:n,projectId:t,busy:o===`running`}),(0,h.jsxs)(dy,{className:`mt-1 flex-nowrap gap-1`,children:[l&&r!==void 0&&p!==void 0?(0,h.jsx)(Hx,{href:p.url,download:!0,size:`small`,label:`Download short ${String(e.number)}`,tip:`Download`,children:(0,h.jsx)(Ac,{"aria-hidden":`true`,strokeWidth:1.75})}):null,(0,h.jsx)(ly,{size:`small`,tip:`Copy title, description and hashtags`,label:`Copy short ${String(e.number)}'s title, description and hashtags`,onClick:u,children:(0,h.jsx)(kc,{"aria-hidden":`true`,strokeWidth:1.75})}),d===void 0?null:(0,h.jsxs)(p8,{children:[(0,h.jsx)(m8,{asChild:!0,children:(0,h.jsx)(ly,{size:`small`,tip:`More`,label:`More for short ${String(e.number)}`,children:(0,h.jsx)(jc,{"aria-hidden":`true`,strokeWidth:1.75})})}),(0,h.jsx)(h8,{align:`start`,children:(0,h.jsxs)(g8,{onSelect:d,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-4`}),`Make short `,String(e.number),` again`]})})]})]})]})}function Cye({link:e}){let t=e?.trim()??``;return(0,h.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 break-words text-small text-ink-2`,children:[(0,h.jsx)(`span`,{children:`Watch the full video:`}),t===``?(0,h.jsxs)(Gx,{tone:`waiting`,title:`No link to the full video is saved. Copy leaves a placeholder to paste it over; to fill it in for every short, add the link under Edit settings → Shorts.`,children:[(0,h.jsx)(Rc,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-3`}),`Link needed`]}):(0,h.jsx)(`span`,{className:`min-w-0 break-all text-ink`,children:t})]})}function R5(e,t,n){let r=e.find(e=>e.role===`shorts`);return e.filter(e=>e.role===t&&(r===void 0||e.createdAt>=r.createdAt||n.some(t=>z5(e,t)&&e.meta.sentences?.[0]===t.first&&e.meta.sentences?.[1]===t.last)))}function z5(e,t){return e.meta.short===t.number}function B5(e){return wye(j8(f8(e,`shorts`)).data)}function wye(e){if(e===void 0)return[];try{let t=bye.safeParse(JSON.parse(e));return t.success?t.data.shorts:[]}catch{return[]}}function Tye(e,t){return e?.startsWith(`Short ${String(t)}:`)===!0||e?.startsWith(`Short ${String(t)} `)===!0}function Eye({stage:e,project:t,outputs:n,subtitleControls:r}){let{api:i}=R(),a=gy(),o=t.config.sources.video===`off`&&t.config.sources.audio!==`off`,s=f8(d8(n,e),o?`audio_export`:`video`),c=d8(n,e),l=f8(c,`subtitles_srt`),u=f8(c,`subtitles_vtt`),d=f8(c,`youtube_description`),f=f8(c,`youtube_tags`),p=f8(c,`audio_mp3`),m=f8(c,`audio_m4b`),g=R5(c,`short_video`,B5(c)).toSorted((e,t)=>(e.meta.short??0)-(t.meta.short??0)),_=y8(s),v=y8(Dye(n)),y=Oye(t.id,d,f,s?.durationMs??null),b=y8(u),x=s?.meta.subtitlesMode??t.config.subtitles?.mode,S=e.state===`running`,C=lN(e.progressCurrent??0,e.progressTotal??0);return qb({id:`project.folder`,title:`Open the project folder`,group:`This project`,context:t.title,keywords:[`folder`,`files`,`finder`,`explorer`,`video`],run:async()=>{if(s===void 0){a(`The video has not been saved yet, so there is no folder to open.`,`info`);return}try{let e=await Q0(i,{projectId:t.id,asset:E3(s),folder:_?.folder??null});e.opened||a(`${$0} ${e.path}`,`info`)}catch(e){a(e instanceof Error?e.message:`The folder couldn't be opened. Use Open folder under the video.`,`error`)}}}),t.config.sources.video===`off`&&!o?(0,h.jsx)(C8,{children:r}):(0,h.jsxs)(C8,{className:`p-0`,children:[S?(0,h.jsx)(`p`,{className:`m-0 text-small text-accent-ink`,children:XM(e,t.config)?`Preparing subtitles · ${String(lN(e.progressCurrent??0,35))}%`:o?`Exporting combined audio`:e.activity===void 0?e.progressTotal===null?`Rendering`:`Rendering · ${String(C)}%`:tN(eN(e)??``)}):null,s===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:o?`No combined audio export has landed yet.`:`No render has landed yet.`}):o?(0,h.jsx)(Q8,{label:`Combined narration`,src:_?.url,marks:y},s.id):_===void 0?null:(0,h.jsx)(O0,{src:_.url,label:`Generated video`,...v===void 0?{}:{poster:v.url},chapters:y,portrait:t.format===`9:16`,square:t.format===`1:1`,className:t.format===`9:16`?`max-w-[360px]`:t.format===`1:1`?`max-w-[640px]`:`max-w-[1100px]`,...x===`files`&&u&&b?{captions:{src:b.url,lang:`en`,label:`English`}}:{}},s.id),(0,h.jsx)(k8,{files:[{output:s,label:o?`Audio (.wav)`:`Video (.mp4)`},{output:l,label:`Subtitles (.srt)`},{output:u,label:`Subtitles (.vtt)`},{output:d,label:`YouTube description (.txt)`},{output:f,label:`YouTube tags (.txt)`},{output:p,label:`Audio with chapters (.mp3)`},{output:m,label:`Audiobook with chapters (.m4b)`},...g.map(e=>({output:e,label:`Short ${String(e.meta.short??``)} (.mp4)`}))]}),s===void 0?null:(0,h.jsx)(A8,{children:[cN(s?.durationMs??void 0),o?`WAV · stereo · 48 kHz`:t.format,s?.meta.master===void 0?void 0:jie(s.meta.master)].filter(e=>e!==void 0).join(` · `)}),s?.meta.warnings?.length?(0,h.jsx)(`ul`,{"aria-label":`Render notes`,className:`m-0 flex flex-col gap-1 pl-5 text-small text-ink-2`,children:s.meta.warnings.map(e=>(0,h.jsx)(`li`,{children:e},e))}):null,t.config.sources.audio===`off`||CO(t.config.language)===void 0?null:(0,h.jsx)(`p`,{role:`note`,className:`border-t border-line pt-3 text-small text-ink-2`,children:CO(t.config.language)}),s?.meta.subtitleOmissions?.length?(0,h.jsxs)(`details`,{className:`border-t border-line pt-3 text-small`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer font-semibold`,children:[`Subtitles recovered after missing narration (`,s.meta.subtitleOmissions.length,`)`]}),(0,h.jsx)(`p`,{className:`m-0 mt-2 text-ink-2`,children:`These transcript passages could not be matched to the audio and were left out of the captions. The audio is unchanged. Review these passages before sharing.`}),(0,h.jsx)(`ul`,{className:`m-0 mt-2 flex flex-col gap-2 pl-5`,children:s.meta.subtitleOmissions.map(e=>(0,h.jsxs)(`li`,{children:[(0,h.jsx)(`strong`,{children:new Date(e.start*1e3).toISOString().slice(11,19)}),` —`,` `,e.text]},`${e.start}-${e.text}`))})]}):null,r?(0,h.jsxs)(`details`,{className:`border-t border-line pt-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-small font-semibold`,children:`Subtitles & fonts`}),r]}):null]})}function Dye(e){return e.filter(e=>e.role===`thumbnail`).toSorted((e,t)=>(e.meta.index??1)-(t.meta.index??1))[0]}function Oye(e,t,n,r){let{api:i}=R(),a=j8(t).data,o=j8(n).data,s=N({queryKey:z.youtubeEdits(e),queryFn:()=>zs(i,e),enabled:t!==void 0});return a===void 0?[]:kye(T5(w5(C5(a,o??``),s.data?.fields??{})).chapters,r===null?void 0:r/1e3)}function kye(e,t){return S5(e,t).text.split(`
|
|
301
301
|
`).flatMap(e=>{let t=/^(\S+)\s+(.+)$/u.exec(e.trim()),n=t===null?void 0:x5(t[1]??``),r=t?.[2]?.trim()??``;return n===void 0||r===``?[]:[{start:n,title:r}]})}function Aye(e){switch(e.stage.kind){case`article`:return(0,h.jsx)(ove,{...e});case`audio`:return(0,h.jsx)(gve,{...e});case`images`:return(0,h.jsx)(Gve,{...e});case`video`:return(0,h.jsx)(Eye,{...e});case`document`:return(0,h.jsx)(bve,{...e});case`research`:case`thumbnail`:return null}}K({summary:U(),chapters:G(K({start:oO([U(),W()]),title:U()})),hashtags:G(U()),tags:G(U()),pinnedComment:U(),titles:G(U())});function V5(e){return e.reduce((e,t)=>e+t.length+(/\s/.test(t)?2:0),0)+Math.max(0,e.length-1)}var H5={summary:`Summary`,chapters:`Chapters`,hashtags:`Hashtags`,tags:`Tags`,pinnedComment:`Pinned comment`,titles:`Other titles`},U5={Summary:`project.youtube.summary`,Chapters:`project.youtube.chapters`,Hashtags:`project.youtube.hashtags`,Tags:`project.youtube.tags`,"Pinned comment":`project.youtube.pinned-comment`,"Other titles":`project.youtube.titles`};function jye({stage:e,project:t,outputs:n}){let r=(0,m.useId)(),{api:i}=R(),a=_(),o=d8(n,e),s=f8(o,`youtube_description`),c=f8(o,`youtube_tags`),l=f8(o,`youtube_pinned_comment`),u=f8(o,`youtube_titles`),d=j8(s).data,f=j8(c).data,p=j8(l).data,g=j8(u).data,v=(0,m.use)(Y8),[y,b]=(0,m.useState)(!1),[x,S]=(0,m.useState)(`description`),C=e=>({open:x===e,onToggle:()=>S(e)}),w=N({queryKey:z.youtubeEdits(t.id),queryFn:()=>zs(i,t.id)}),T=N({queryKey:z.projectChannelLinks(t.id),queryFn:()=>Rs(i,t.id)}),[E,D]=(0,m.useState)(),O=gy(),k=e=>a.setQueryData(z.youtubeEdits(t.id),e),A=P({mutationFn:e=>Bs(i,t.id,e.field,e.edit),onSuccess:(e,t)=>{k(e),D({text:t.done,tone:`success`})},onError:e=>D({text:`Couldn't save the change: ${e.message}`,tone:`error`})}),ee=(0,m.useRef)({});if(qb({id:`project.copy-description`,title:`Copy description`,group:`This project`,context:t.title,keywords:[`youtube`,`description`,`chapters`,`clipboard`],shortcut:CM.copyDescription,run:()=>ee.current.description===void 0?O(`The description has not been written yet.`,`info`):ee.current.description()}),qb({id:`project.copy-tags`,title:`Copy tags`,group:`This project`,context:t.title,keywords:[`youtube`,`tags`,`clipboard`],run:()=>ee.current.tags===void 0?O(`The tags have not been written yet.`,`info`):ee.current.tags()}),qb({id:`project.copy-pinned-comment`,title:`Copy pinned comment`,group:`This project`,context:t.title,keywords:[`youtube`,`comment`,`pin`,`clipboard`],run:()=>ee.current.pinnedComment===void 0?O(`The pinned comment has not been written yet.`,`info`):ee.current.pinnedComment()}),t.config.youtubeDescription!==!0&&s===void 0)return null;let te=d===void 0?void 0:C5(d,f??``,{pinnedComment:p,titles:g}),ne=w5(te,w.data?.fields??{}),j=T5(ne),re=fA(T.data?.links??[],w.data?.links??[]),M=f8(o,`video`),ie=S5(j.chapters,M?.durationMs===null||M?.durationMs===void 0?void 0:M.durationMs/1e3),ae=Jve(ie.adjustments),oe=mA(Xve({...j,chapters:ie.text}),re),se=mA(j.tags,re),ce=mA(j.pinnedComment,re),le=[...oe.unknown,...se.unknown,...ce.unknown].filter((e,t,n)=>n.findIndex(t=>dA(t)===dA(e))===t),ue=K5(se.text),de=te!==void 0,fe=ce.text.trim()!==``,pe=j.titles.split(`
|
|
302
302
|
`).map(e=>e.trim()).filter(e=>e!==``),me=de&&v!==void 0&&e.state!==`running`?()=>b(!0):void 0,he=(e,t)=>{let n=`Couldn't copy the ${t}. Select the text in the YouTube section and copy it.`;if(!navigator.clipboard){D({text:n,tone:`error`}),O(n,`error`);return}navigator.clipboard.writeText(e).then(()=>{D({text:`Copied the ${t}.`,tone:`success`}),O(`Copied the ${t}.`,`success`)},()=>{D({text:n,tone:`error`}),O(n,`error`)})};ee.current=de?{description:()=>he(oe.text,`description`),tags:()=>he(se.text,`tags`),...fe?{pinnedComment:()=>he(ce.text,`pinned comment`)}:{}}:{};let ge=e.state===`running`?`Written after the subtitle timing.`:`Not written yet. It is made with the video.`,_e=(e,t)=>(0,h.jsx)(Mye,{label:H5[e],value:ne[e],links:re,disabled:!de||A.isPending,multiline:e!==`hashtags`,placeholder:de&&e===`pinnedComment`?`Written before pinned comments existed. Use Write again to have one written, or Edit to write your own.`:de&&e===`titles`?`Written before other titles existed. Use Write again to have two written, or Edit to write your own, one per line.`:ge,render:t,onSave:t=>A.mutate({field:e,edit:{text:t,base:te?.[e]??``},done:`Saved your ${H5[e].toLowerCase()}.`}),onUseGenerated:()=>A.mutate({field:e,edit:null,done:`The ${H5[e].toLowerCase()} follows the generated text again.`}),onKeepMine:(t,n)=>A.mutate({field:e,edit:{text:t,base:n},done:`Kept your ${H5[e].toLowerCase()}.`})},e);return(0,h.jsxs)(`section`,{"aria-labelledby":`${r}-title`,className:`@container flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(`h3`,{id:`${r}-title`,className:`sr-only`,children:`YouTube`}),(0,h.jsxs)(`div`,{className:`flex min-w-0 max-w-[80ch] flex-col gap-2`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,h.jsx)(W5,{...C(`description`),id:`${r}-description`,label:`Description`,copy:de?()=>he(oe.text,`description`):void 0,keyshortcuts:ax(CM.copyDescription),count:de?`${String(oe.text.length)} / ${String(x6)} characters`:void 0,over:oe.text.length>x6,main:!0,again:me}),(0,h.jsxs)(`div`,{hidden:x!==`description`,className:`flex min-w-0 flex-col gap-3`,children:[_e(`summary`),_e(`chapters`,()=>ie.text===``?(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Left out; see the note below.`}):(0,h.jsx)(G5,{text:ie.text,links:re})),ae===void 0?null:(0,h.jsx)(`p`,{className:`text-small text-waiting`,children:ae}),_e(`hashtags`)]})]}),(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,h.jsx)(W5,{...C(`tags`),id:`${r}-tags`,label:`Tags`,copy:de?()=>he(se.text,`tags`):void 0,count:de?`${String(V5(ue))} / 500 characters`:void 0,over:V5(ue)>500}),(0,h.jsx)(`div`,{hidden:x!==`tags`,children:_e(`tags`,e=>(0,h.jsx)(Nye,{text:e,links:re}))}),(0,h.jsx)(W5,{...C(`pinned`),id:`${r}-pinned`,label:`Pinned comment`,copy:de&&fe?()=>he(ce.text,`pinned comment`):void 0,count:de&&fe?`${String(ce.text.length)} / 500 characters`:void 0,over:ce.text.length>500,again:me}),(0,h.jsxs)(`div`,{hidden:x!==`pinned`,className:`flex min-w-0 flex-col gap-3`,children:[_e(`pinnedComment`),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Post it under the video once it is published, then choose Pin in the comment's menu.`})]}),(0,h.jsx)(W5,{...C(`titles`),id:`${r}-titles`,label:`Other titles`,copy:de&&pe.length>0?()=>he(pe.join(`
|
|
303
303
|
`),`other titles`):void 0,count:de&&pe.length>0?`${String(pe.length+1)} titles to test`:void 0,over:pe.some(e=>e.length>100),again:me}),(0,h.jsxs)(`div`,{hidden:x!==`titles`,className:`flex min-w-0 flex-col gap-3`,children:[_e(`titles`),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`For YouTube's A/B Testing beside the title, with this project's own title "${t.title}". One per line.`})]})]})]}),le.length===0?null:(0,h.jsxs)(`p`,{className:`text-small text-waiting`,children:[`No link is saved for ${le.map(e=>`{{${e}}}`).join(`, `)}, so it stays as typed. Add it under Channel links on `,T.data===void 0?`the channel's Brand tab`:(0,h.jsx)(ha,{to:`/channels/$channelId`,params:{channelId:T.data.channelId},className:`underline`,children:`the channel's Brand tab`}),`${le.some(e=>dA(e)===dA(`Previous video`))?`, or set this project's Previous video below`:``}.`]}),(0,h.jsx)(nye,{projectId:t.id,shorts:n.filter(e=>e.role===`short_video`).length}),(0,h.jsx)(Pye,{projectId:t.id,edits:w.data,onSaved:e=>{k(e),D({text:`Saved this project's Previous video link.`,tone:`success`})},onError:e=>D({text:e,tone:`error`})}),(0,h.jsx)(V1,{tone:E?.tone??`info`,children:E?.text}),(0,h.jsx)(Dy,{open:y,title:`Write the description again?`,consequence:`Your text model writes a new summary, chapters, hashtags, tags, pinned comment and other titles. It is one AI call, billed like the first. A field you edited keeps your text and offers the new one beside it.`,confirmLabel:`Write again`,cancelLabel:`Keep what is there`,tone:`primary`,onConfirm:()=>{b(!1),v?.([`youtube:description`]),D({text:`Writing the description again.`,tone:`info`})},onCancel:()=>b(!1)})]})}function W5({id:e,label:t,copy:n,count:r,over:i,keyshortcuts:a,main:o=!1,again:s,open:c,onToggle:l}){return(0,h.jsxs)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-3 border-b border-line pb-2`,children:[(0,h.jsx)(`h4`,{id:e,className:`m-0 text-title-3 font-semibold text-ink`,children:l===void 0?t:(0,h.jsxs)(L,{type:`button`,variant:`quiet`,"aria-expanded":c===!0,onClick:l,className:`-ml-2 h-auto px-2 py-1 text-title-3 font-semibold text-ink`,children:[(0,h.jsx)(Tc,{"aria-hidden":`true`,strokeWidth:1.75,className:I(`size-4 transition-transform`,c===!0&&`rotate-90`)}),t]})}),r===void 0?null:(0,h.jsx)(`span`,{className:I(`text-small tabular-nums`,i?`text-danger`:`text-ink-3`),children:i?`${r}, over YouTube's limit`:r}),(0,h.jsx)(`span`,{className:`flex-1`}),s===void 0?null:(0,h.jsxs)(L,{type:`button`,variant:`secondary`,"aria-label":`Write the ${t.toLowerCase()} again`,onClick:s,children:[(0,h.jsx)(qc,{"aria-hidden":`true`,strokeWidth:1.75}),`Write again`]}),(0,h.jsxs)(L,{type:`button`,variant:o?`primary`:`secondary`,disabled:n===void 0,"aria-label":`Copy ${t.toLowerCase()}`,"aria-keyshortcuts":a,onClick:n,children:[(0,h.jsx)(kc,{"aria-hidden":`true`,strokeWidth:1.75}),`Copy`]})]})}function Mye({label:e,value:t,links:n,disabled:r,multiline:i,placeholder:a,render:o,onSave:s,onUseGenerated:c,onKeepMine:l}){let u=(0,m.useId)(),[d,f]=(0,m.useState)(),[p,g]=(0,m.useState)(!1),_=d!==void 0,v=e.toLowerCase(),y=e in U5?U5[e]:void 0;return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,...cb,children:[(0,h.jsxs)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-2`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(`h5`,{id:`${u}-label`,className:`sl-kicker text-ink-3`,children:e}),y===void 0?null:(0,h.jsx)(B,{id:y,label:v,className:`-my-1`})]}),t.edited?(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Your edit`}):null,(0,h.jsx)(`span`,{className:`flex-1`}),t.edited&&!_?(0,h.jsx)(L,{type:`button`,variant:`quiet`,size:`small`,disabled:r,"aria-label":`Use the generated ${v}`,onClick:c,children:`Use generated`}):null,(0,h.jsxs)(L,{type:`button`,variant:`quiet`,size:`small`,disabled:r||_,"aria-label":`Edit ${v}`,onClick:()=>f(t.text),children:[(0,h.jsx)(Uc,{"aria-hidden":`true`,strokeWidth:1.75}),`Edit`]})]}),t.pending===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 border-l-2 border-waiting pl-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`p`,{className:`text-small text-ink`,children:`New generated version available.`}),(0,h.jsx)(L,{type:`button`,disabled:r,"aria-label":`Use the new generated ${v}`,onClick:c,children:`Use it`}),(0,h.jsx)(L,{type:`button`,disabled:r,"aria-label":`Keep my ${v}`,onClick:()=>l(t.text,t.pending??``),children:`Keep mine`}),(0,h.jsx)(L,{type:`button`,variant:`quiet`,"aria-expanded":p,"aria-label":`${p?`Hide`:`View`} the ${v} diff`,onClick:()=>g(e=>!e),children:p?`Hide diff`:`View diff`})]}),p?(0,h.jsx)(C4,{before:t.text,after:t.pending,beforeLabel:`Yours`,afterLabel:`New generated`}):null]}),_?(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`label`,{htmlFor:`${u}-edit`,className:`sr-only`,children:e}),i?(0,h.jsx)(fV,{id:`${u}-edit`,rows:e===`Chapters`?8:5,value:d,onChange:e=>f(e.currentTarget.value)}):(0,h.jsx)(Y,{id:`${u}-edit`,value:d,onChange:e=>f(e.currentTarget.value)}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,h.jsxs)(L,{type:`button`,variant:`primary`,disabled:r,onClick:()=>{s(d),f(void 0)},children:[`Save `,v]}),(0,h.jsx)(L,{type:`button`,variant:`secondary`,onClick:()=>f(void 0),children:`Cancel`})]})]}):(0,h.jsx)(`section`,{"aria-labelledby":`${u}-label`,className:I(`min-w-0 whitespace-pre-wrap break-words text-small`,t.text===``?`text-ink-3`:`text-ink`),children:t.text===``?a:o===void 0?(0,h.jsx)(G5,{text:t.text,links:n}):o(t.text)})]})}function G5({text:e,links:t}){let n=0;return(0,h.jsx)(h.Fragment,{children:pA(e,t).map(e=>{let t=String(n);return n+=e.kind===`text`?e.text.length:e.raw.length,e.kind===`text`?(0,h.jsx)(`span`,{children:e.text},t):e.url===void 0?(0,h.jsx)(`mark`,{title:`No link named ${e.name}`,className:`rounded-[2px] bg-waiting/25 px-0.5 text-ink`,children:e.raw},t):(0,h.jsx)(`span`,{title:e.raw,className:`underline decoration-dotted underline-offset-[3px]`,children:e.url},t)})})}function K5(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``)}function Nye({text:e,links:t}){return(0,h.jsx)(`ul`,{className:`flex flex-wrap gap-2 whitespace-normal`,children:K5(e).map((e,n)=>(0,h.jsx)(`li`,{className:`rounded-full border border-line bg-raised px-2 py-0.5 text-small text-ink`,children:(0,h.jsx)(G5,{text:e,links:t})},n))})}function Pye({projectId:e,edits:t,onSaved:n,onError:r}){let{api:i}=R(),a=(0,m.useId)(),o=t?.links.find(e=>dA(e.name)===dA(`Previous video`))?.url??``,[s,c]=(0,m.useState)(),l=s??o,u=P({mutationFn:()=>{let n=(t?.links??[]).filter(e=>dA(e.name)!==dA(cA));return Vs(i,e,l.trim()===``?n:[...n,{name:cA,url:l.trim()}])},onSuccess:e=>{c(void 0),n(e)},onError:e=>r(e.message)});return(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-[260px] flex-1 flex-col gap-1 sm:max-w-[520px]`,...cb,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{className:`sl-field__label`,htmlFor:a,children:`Previous video for this project`}),(0,h.jsx)(B,{id:`project.youtube.previous-video`,className:`-my-1`})]}),(0,h.jsx)(Y,{id:a,type:`url`,placeholder:`https://youtu.be/…`,value:l,onChange:e=>c(e.currentTarget.value)})]}),(0,h.jsx)(L,{type:`button`,disabled:u.isPending||t===void 0||l.trim()===o,onClick:()=>u.mutate(),children:`Save links`})]})}var q5=[{stage:`audio`,name:`Audio`},{stage:`images`,name:`Images`},{stage:`video`,name:`Video / export`}];function Fye({projectId:e,revisionId:t,gates:n,stages:r,reload:i,saved:a}){let{api:o}=R(),[s,c]=(0,m.useState)(null),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(null),p=(0,m.useRef)(!1),g=(0,m.useRef)(!0),_=(0,m.useRef)(null),v=(0,m.useRef)(null),y=JSON.stringify([t,n.map(e=>[e.stage,e.checkpointId]).toSorted()]),b=s!==null&&s.baseIdentity!==y,x=s?.stages??n.map(e=>e.stage),S=q5.some(({stage:e})=>x.includes(e)!==n.some(t=>t.stage===e)),C=b||d!==null&&d.kind!==`success`,w=b?{kind:`refused`,message:`Checkpoint choices changed elsewhere. Press Reload checkpoint choices before saving, then make your change again.`}:d;(0,m.useEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]),(0,m.useEffect)(()=>{(d||b)&&_.current?.focus()},[d,b]);async function T(){if(!(p.current||!S||C)){p.current=!0,u(!0);try{let n=await Wme(o,e,{revisionId:t,stages:x});if(!g.current)return;n.ok?n.value.revisionId===t?(a(n.value),c(null),f({kind:`success`,message:`Checkpoint choices saved.`})):f({kind:`refused`,message:`The project was edited elsewhere. Press Reload checkpoint choices to see its current choices.`}):f({kind:`refused`,message:n.message})}catch(e){g.current&&f({kind:`transport`,message:`${xo(e instanceof Error?e.message:`Slopify didn't confirm the change`)} It may or may not have saved. Press Reload checkpoint choices before changing anything else.`})}finally{p.current=!1,g.current&&u(!1)}}}async function E(){if(!p.current){p.current=!0,u(!0);try{let e=await i();g.current&&e&&(c(null),f(null),v.current?.focus())}finally{p.current=!1,g.current&&u(!1)}}}return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsxs)(`fieldset`,{ref:v,tabIndex:-1,className:`space-y-2`,...cb,children:[(0,h.jsx)(`legend`,{className:`float-left mr-1`,children:`Checkpoint choices`}),(0,h.jsx)(B,{id:`project.checkpoints.choices`,className:`-my-1`}),(0,h.jsx)(`div`,{className:`clear-both`}),q5.map(({stage:e,name:t})=>{let n=r.find(t=>t.kind===e),i=n?.state===`pending`&&(e===`video`?n.source!==`off`||r.some(e=>e.kind===`audio`&&e.source!==`off`&&e.state!==`skipped`):(n.source??`generate`)===`generate`);return(0,h.jsxs)(`label`,{className:`flex min-h-10 items-center gap-3`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:x.includes(e),disabled:!i||l||C,onChange:t=>{c({baseIdentity:s?.baseIdentity??y,stages:t.target.checked?[...x,e]:x.filter(t=>t!==e)}),f(null)}}),`Before `,t]},e)})]}),w?(0,h.jsx)(`p`,{ref:_,tabIndex:-1,role:w.kind===`success`?`status`:`alert`,children:w.message}):null,(0,h.jsx)(L,{type:`button`,disabled:!S||l||C,onClick:()=>void T(),children:l?`Saving…`:`Save checkpoints`}),C?(0,h.jsx)(L,{type:`button`,disabled:l,onClick:()=>void E(),children:`Reload checkpoint choices`}):null]})}var J5=e=>e.charAt(0).toUpperCase()+e.slice(1);function Iye(e){return e.revisionId===null?null:(0,h.jsx)(Lye,{...e,revisionId:e.revisionId},`${e.projectId}:${e.revisionId}`)}function Lye({projectId:e,revisionId:t,paused:n,stages:r,approvedInRail:i}){let{api:a}=R(),o=_(),s=N({queryKey:d3(e,t),queryFn:()=>p3(a,e),retry:!1}),c=s.data,l=async()=>{let e=await s.refetch();return!e.isError&&e.data?.ok===!0&&e.data.value.revisionId===t?e.data.value:void 0},u=async()=>{let e=await s.refetch();return!e.isError&&e.data?.ok===!0&&e.data.value.revisionId===t};return s.isPending?null:s.error||c?.ok===!1?(0,h.jsxs)(`section`,{"aria-label":`Review checkpoints`,className:`flex flex-col items-start gap-3`,children:[(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:s.error?.message??(c?.ok===!1?c.message:`Checkpoints couldn't be loaded. Press Reload checkpoints.`)}),(0,h.jsx)(L,{onClick:()=>void u(),children:`Reload checkpoints`})]}):c?.ok?c.value.revisionId===t?(0,h.jsxs)(`section`,{"aria-label":`Review checkpoints`,className:`flex flex-col gap-5`,children:[(0,h.jsx)(V,{title:`Review checkpoints`,size:`small`,className:`pb-0`}),n?(0,h.jsx)(`p`,{className:`m-0 text-small text-waiting`,children:`The project is paused. Continue the run before approving held work.`}):null,(0,h.jsx)(Fye,{projectId:e,revisionId:t,gates:c.value.checkpoints,stages:r,reload:l,saved:n=>{o.setQueryData(d3(e,t),{ok:!0,value:n}),o.invalidateQueries({queryKey:z.project(e)}),o.invalidateQueries({queryKey:z.projects})}}),c.value.checkpoints.map(a=>(0,h.jsx)(Rye,{gate:a,disabled:n||a.projectId!==e||a.revisionId!==t||r.some(e=>e.kind===a.stage&&[`running`,`canceled`].includes(e.state)),reload:u,...a.checkpointId===i?{inRail:!0}:{}},`${a.checkpointId}:${a.fingerprint}`))]}):(0,h.jsx)(`section`,{"aria-label":`Review checkpoints`,className:`flex flex-col items-start gap-3`,children:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`The project was edited after these checkpoints loaded. Press Reload checkpoints before approving.`})}):null}function Rye({gate:e,disabled:t,reload:n,inRail:r=!1}){let{api:i}=R(),a=_(),o=(0,m.useRef)(null),s=(0,m.useRef)(!1),c=(0,m.useRef)(!0),l=(0,m.useRef)(null),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(null);(0,m.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]),(0,m.useEffect)(()=>{f!==null&&l.current?.focus()},[f]);let g=[`configured`,`pending-review`,`held`].includes(e.state)&&e.fingerprint===e.currentFingerprint;async function v(){if(!(s.current||t||!g||f?.kind===`refused`||f?.kind===`success`)){s.current=!0,d(!0),o.current??={revisionId:e.revisionId,fingerprint:e.fingerprint,idempotencyKey:crypto.randomUUID()};try{let t=await m3(i,e.projectId,e.checkpointId,o.current);o.current=null,c.current&&p(t.ok?{kind:`success`,message:t.value.replayed?`Checkpoint already approved.`:`Checkpoint approved. Work will run when its dependencies are ready.`}:{kind:`refused`,message:t.message}),a.invalidateQueries({queryKey:u3(e.projectId)}),a.invalidateQueries({queryKey:z.project(e.projectId)}),a.invalidateQueries({queryKey:z.projects})}catch(e){c.current&&p({kind:`transport`,message:`${xo(e instanceof Error?e.message:`Slopify didn't confirm the approval`)} Press Retry approval to check whether it went through.`})}finally{s.current=!1,c.current&&d(!1)}}}return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line pt-4`,children:[(0,h.jsx)(V,{as:`h3`,title:`${J5(e.stage)} checkpoint`,className:`pb-0`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.state===`released`&&e.approvedAt!==null?`Authorized for this revision. Work can run when dependencies are ready and the project is resumed.`:e.state===`satisfied`?`Checkpoint satisfied. Its reviewed work is complete.`:e.state===`invalidated`||e.fingerprint!==e.currentFingerprint?`Inputs changed. Review the current revision before approving.`:g?`${J5(e.stage)} is held for your review. Its dependent work waits for this approval; independent work can continue.`:`Checkpoint ${e.state}.`}),(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-3`,children:[`Reviewed revision: `,e.revisionId]}),e.dependents.length?(0,h.jsx)(`ul`,{"aria-label":`Dependent work`,className:`m-0 flex list-none flex-wrap gap-2 p-0`,children:e.dependents.map(e=>(0,h.jsx)(`li`,{className:`sl-chip`,children:J5(e)},e))}):(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No dependent stages.`}),f?(0,h.jsx)(`p`,{ref:l,tabIndex:-1,role:f.kind===`success`?`status`:`alert`,className:f.kind===`success`?`m-0 text-small`:`m-0 text-small text-danger`,children:f.message}):null,g&&r&&f===null?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Its approval is the project's next action, in the right rail.`}):g?(0,h.jsx)(L,{className:`self-start`,disabled:t||u||f?.kind===`refused`||f?.kind===`success`,onClick:()=>void v(),children:u?`Approving…`:f?.kind===`transport`?`Retry approval`:`Approve ${J5(e.stage)} checkpoint`}):null,f?.kind===`refused`?(0,h.jsx)(L,{className:`self-start`,onClick:async()=>{await n()&&p(null)},children:`Reload checkpoints`}):null]})}function zye({projects:e,queryKey:t}){let{api:n}=R(),r=_(),i=gy(),[a,o]=(0,m.useState)(),[s,c]=(0,m.useState)(),l=P({mutationFn:e=>Vo(n,e.id),onMutate:()=>c(void 0),onSuccess:(e,t)=>{i(e.files===0?`"${t.title}" had no working files left to remove.`:`Freed ${X5(e.bytesFreed)} from "${t.title}" (${String(e.files)} working file${e.files===1?``:`s`}).`,`success`)},onError:e=>c(e.message),onSettled:()=>r.invalidateQueries({queryKey:t})}),u=e.toSorted((e,t)=>t.bytes-e.bytes);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{className:`m-0 mb-2 flex items-center gap-1 text-small text-ink-2`,children:[`Keep outputs only frees a finished project's working files.`,(0,h.jsx)(B,{id:`settings.storage.keep-outputs`})]}),(0,h.jsx)(iU,{label:`Storage by project`,children:u.map(e=>(0,h.jsx)(aU,{title:e.title,meta:(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[X5(e.bytes),` · outputs `,X5(e.outputsBytes),` · working files `,X5(e.workingBytes)]}),actions:(0,h.jsx)(L,{variant:`quiet`,size:`small`,disabled:!e.finished||e.removableBytes===0||l.isPending,title:e.finished?e.removableBytes===0?`No working files left to remove.`:`Frees ${X5(e.removableBytes)}.`:`Available once the project has finished.`,onClick:()=>o(e),children:l.isPending&&l.variables?.id===e.id?`Removing…`:`Keep outputs only`})},e.id))}),s===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:s}),(0,h.jsx)(Dy,{open:a!==void 0,title:`Keep only the outputs of "${a?.title??``}"?`,consequence:Y5(a?.removableFiles??0,a?.removableBytes??0),confirmLabel:`Keep outputs only`,pending:l.isPending,onConfirm:()=>{let e=a;o(void 0),e!==void 0&&l.mutate(e)},onCancel:()=>o(void 0)})]})}function Y5(e,t){return`This removes ${String(e)} working file(s) and frees ${X5(t)}: the images, narration parts, subtitle timing and render settings the project was made from. The video, shorts, thumbnail, article, description and document stay, and so does anything you uploaded. If you change this project later (edit an image, a caption style or the narration, or re-render), Slopify has to make those files again first, which takes time and uses provider credits.`}function X5(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e,r=t[0]??`KB`;for(let e of t)if(n/=1024,r=e,n<1024||e===t.at(-1))break;return`${n>=10?n.toFixed(0):n.toFixed(1).replace(/\.0$/,``)} ${r}`}var Z5=e=>[`storage`,`project`,e];function Bye({projectId:e,title:t,status:n,sample:r}){let{api:i}=R(),a=_(),o=gy(),[s,c]=(0,m.useState)(!1),l=n===`done`||n===`partial`,u=N({queryKey:[...Z5(e),n],queryFn:()=>Bo(i,e),enabled:l&&!r}),d=P({mutationFn:()=>Vo(i,e),onSuccess:e=>o(e.files===0?`"${t}" had no working files left to remove.`:`Freed ${X5(e.bytesFreed)} from "${t}". The outputs are all still here.`,`success`),onError:e=>o(`The working files of "${t}" weren't removed: ${e.message}`,`error`),onSettled:async()=>{await Promise.all([a.invalidateQueries({queryKey:Z5(e)}),a.invalidateQueries({queryKey:[`storage-usage`]}),a.invalidateQueries({queryKey:z.project(e)})])}}),f=u.data;if(!l||r||f===void 0||!f.finished||f.removableBytes===0)return null;let p=X5(f.removableBytes);return(0,h.jsxs)(`section`,{"aria-label":`Free space`,className:`flex flex-col gap-2`,children:[(0,h.jsx)(V,{as:`h3`,title:`Free space`,meta:`Outputs ${X5(f.outputsBytes)} · working files ${X5(f.workingBytes)}`,info:`project.free-space`,children:(0,h.jsx)(L,{variant:`secondary`,size:`small`,"aria-label":`Free ${p}: keep the outputs, drop the working files`,disabled:d.isPending,disabledReason:`Removing the working files…`,onClick:()=>c(!0),children:d.isPending?`Removing…`:`Free ${p}`})}),(0,h.jsx)(Dy,{open:s,title:`Free ${p} from "${t}"?`,consequence:Y5(f.removableFiles,f.removableBytes),confirmLabel:`Free ${p}`,cancelLabel:`Keep the working files`,pending:d.isPending,onConfirm:()=>{c(!1),d.mutate()},onCancel:()=>c(!1)})]})}function Vye({project:e,prompts:t,editing:n,onEdit:r,more:i,nextChapter:a,clock:o}){let s=e.status===`pending`&&e.setAside===!0?{tone:`done`,word:`Kept as is`}:Wye(e.status);return(0,h.jsx)(bq,{crumb:(0,h.jsxs)(ha,{to:`/projects`,className:`inline-flex items-center gap-1 text-ink-3 hover:text-ink`,children:[(0,h.jsx)(wc,{"aria-hidden":`true`,strokeWidth:1.75}),`Projects`]}),title:e.title,row:!0,meta:(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-1`,children:[Gye(e,t),o]}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(Wx,{tone:s.tone,children:[s.word,(0,h.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:`Project: ${s.word}`})]}),a!==void 0&&Hye(e)?(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(L,{variant:`secondary`,disabled:a.pending,onClick:a.run,children:a.pending?`Making the next chapter…`:`Make the next chapter`}),(0,h.jsx)(B,{id:`project.next-chapter`}),a.error===void 0?null:(0,h.jsx)(`span`,{role:`alert`,className:`max-w-[320px] text-small text-danger`,children:a.error})]}):null,(0,h.jsxs)(L,{variant:`secondary`,"aria-pressed":n,onClick:r,children:[(0,h.jsx)(Zc,{"aria-hidden":`true`,strokeWidth:1.75}),`Edit settings`]}),(0,h.jsxs)(p8,{modal:!1,children:[(0,h.jsx)(m8,{asChild:!0,children:(0,h.jsx)(ly,{label:`More project actions`,children:(0,h.jsx)(jc,{"aria-hidden":`true`,strokeWidth:1.75})})}),(0,h.jsx)(h8,{children:i.map(e=>(0,h.jsx)(Uye,{item:e},e.id))})]})]})})}function Hye(e){return e.config.voices?.format===`audiobook`&&(e.status===`done`||e.status===`partial`)}function Uye({item:e}){return(0,h.jsxs)(h.Fragment,{children:[e.apart?(0,h.jsx)(L_e,{}):null,(0,h.jsx)(g8,{...e.disabled?{disabled:!0}:{},onSelect:()=>e.run(),children:e.label})]})}function Wye(e){switch(e){case`running`:return{tone:`running`,word:`Running`};case`paused`:return{tone:`waiting`,word:`Paused`};case`failed`:return{tone:`failed`,word:`Failed`};case`partial`:return{tone:`waiting`,word:`Done with problems`};case`done`:return{tone:`done`,word:`Done`};case`canceled`:return{tone:`off`,word:`Canceled`};case`pending`:return{tone:`off`,word:`Queued`}}}function Gye(e,t){let n=e.config.articlePrompt,r=t===void 0||t.some(e=>e.name===n),i=n===void 0||n===``?void 0:r?n:`${n} (deleted)`,a=e.config.voices?.book;return[a===void 0?void 0:Dk(a),i,e.format,`started ${Uu(e.createdAt)}`].filter(e=>e!==void 0).join(` · `)}function Kye({projectId:e}){let{api:t}=R(),n=N(qy(t,e));return n.error===null?n.data===void 0?(0,h.jsxs)(`div`,{role:`status`,"aria-label":`Loading run cost`,className:`flex flex-col gap-8`,children:[(0,h.jsx)(`span`,{className:`h-16 max-w-3xl rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-40 rounded-control bg-sunken`})]}):(0,h.jsx)(Zye,{cost:n.data}):(0,h.jsx)(pP,{tone:`danger`,title:`The run cost could not be loaded.`,children:`${n.error.message} Reload the page to try again.`})}var qye=new Set([`done`,`partial`,`failed`,`canceled`]);function Jye({cost:e,status:t,measuredAt:n}){let r=e?.run??null,i=r?.current===!0&&!qye.has(t),[a,o]=(0,m.useState)(()=>Date.now());if((0,m.useEffect)(()=>{if(!i)return;let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[i]),!i||r===null)return null;let s=s7(r.workingMs+(r.running?Math.max(0,a-n):0));return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,h.jsxs)(`span`,{role:`timer`,"aria-label":`Run time`,className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(Qc,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-3.5 shrink-0`}),r.running?`Working for ${s}`:`${s} of work so far`]})]})}var Yye=[{id:`stage`,header:`Stage`,cell:e=>(0,h.jsx)(`strong`,{children:qM[e.stage]})},{id:`cost`,header:`Cost`,numeric:!0,cell:$5},{id:`api`,header:`Via API`,numeric:!0,cell:e7},{id:`usage`,header:`Usage`,numeric:!0,cell:e=>t7(e)||`—`},{id:`time`,header:`Working time`,numeric:!0,cell:e=>e.wallMs===null?`—`:s7(e.wallMs)}],Xye=[{id:`model`,header:`Provider · model`,cell:e=>(0,h.jsx)(`strong`,{children:ebe(e)})},{id:`cost`,header:`Cost`,numeric:!0,cell:$5},{id:`api`,header:`Via API`,numeric:!0,cell:e7},{id:`usage`,header:`Usage`,numeric:!0,cell:e=>t7(e)||`—`},{id:`calls`,header:`Calls`,numeric:!0,cell:e=>n7.format(e.calls)}];function Q5(e){return e===`five_hour`?`5-hour`:e===`weekly`?`weekly`:`current`}function Zye({cost:e}){if(e.calls===0&&e.byStage.length===0)return(0,h.jsx)(`p`,{className:`m-0 text-body text-ink-2`,children:`Nothing has been spent yet. The cost of each provider call appears here as the run makes it.`});let t=e.byModel.some(e=>e.onPlan),n=e.plans.flatMap(e=>e.reported?e.windows.map(t=>({plan:e,window:t})):[]);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsxs)(`section`,{"aria-label":`Run cost summary`,className:`flex flex-col gap-3`,children:[(0,h.jsxs)(W2,{children:[(0,h.jsx)(G2,{value:o7(e.cost),label:e.unpriced>0?`known cost, paid to providers`:`paid to providers`}),e.apiEquivalent===null?null:(0,h.jsx)(G2,{value:`~${o7(e.apiEquivalent)}`,label:`same work via API`}),n.map(({plan:e,window:t})=>{let n=`${Q5(t.kind)} ${e.name} limit`,r=t.usedPercent<1?`<1%`:`${r7.format(t.usedPercent)}%`;return(0,h.jsx)(G2,{value:r,label:`of ${n}`,children:(0,h.jsx)(K2,{value:t.usedPercent/100,label:`Share of the ${n} this run used`,valueText:`${r} of your ${n}; now at ${r7.format(t.nowPercent)}%`,tone:t.nowPercent>=80?`waiting`:`accent`})},`${e.account}/${t.kind}`)}),e.run===null?null:(0,h.jsx)(G2,{value:s7(e.run.workingMs),label:`this run's working time`})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 text-small text-ink-2`,children:[e.unpriced>0?(0,h.jsx)(`p`,{className:`m-0`,children:`Plus ${a7(e.unpriced,`call`)} the model catalogue has no price for.`}):null,t?(0,h.jsx)(`p`,{className:`m-0`,children:Qye(e)}):null,e.plans.map(e=>(0,h.jsx)(`p`,{className:`m-0`,children:$ye(e)},e.account))]})]}),(0,h.jsxs)(`section`,{"aria-label":`By stage`,children:[(0,h.jsx)(V,{title:`By stage`,info:`project.cost.by-stage`,className:`mb-3`}),(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsx)(q2,{caption:`Run cost by stage`,columns:Yye,rows:e.byStage,rowKey:e=>e.stage})})]}),(0,h.jsxs)(`section`,{"aria-label":`By model`,children:[(0,h.jsx)(V,{title:`By model`,info:`project.cost.by-model`,className:`mb-3`}),(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsx)(q2,{caption:`Run cost by model`,columns:Xye,rows:e.byModel,rowKey:e=>`${e.provider}/${e.model}/${e.kind}`})})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`In total: ${t7(e.totals)||`no reported usage`} · ${s7(e.totals.wallMs)} working, over every run.`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Priced from the model catalogue${e.catalogueDate===null?``:` of ${e.catalogueDate}`} when each call finished. Retries that failed are not charged here; taxes and included credits are not counted.`})]})]})}function Qye(e){let t=e.apiEquivalent??0;if(t===0&&e.apiUnpriced>0)return`CLI calls: $0 on your plan · no API price is listed for their models.`;let n=e.apiUnpriced>0?` (plus ${a7(e.apiUnpriced,`call`)} with no API price)`:``;return`CLI calls: $0 on your plan · ~${o7(t)} via API${n}.`}function $ye(e){return e.reported?e.windows.length===0?`${e.name} reported no limit windows for this run.`:e.windows.map(t=>{let n=Q5(t.kind),r=t.usedPercent<1?`under 1%`:`~${r7.format(t.usedPercent)}%`,i=`now at ${r7.format(t.nowPercent)}%${t.resetsAt===null?``:`, resets ${nbe(t.resetsAt)}`}`;return`This run used ${r} of your ${n} ${e.name} limit (${i}).`}).join(` `):`${e.name} did not report its plan limits for this run, so the share it used is not known.`}function $5(e){return e.calls===0?`—`:`onPlan`in e&&e.onPlan?`$0 on plan`:e.unpriced>0?e.unpriced===e.calls?`Unknown`:`${o7(e.cost)} + unknown`:o7(e.cost)}function e7(e){return e.apiEquivalent===null?`—`:e.apiUnpriced>0&&e.apiEquivalent===0?`No API price`:`~${o7(e.apiEquivalent)}`}function ebe(e){let t=e.model===``?`default model`:e.model;return e.apiModel===null?`${e.provider} · ${t}`:`${e.provider} · ${t} (as ${e.apiModel})`}function t7(e){let t=[];return e.tokensIn+e.tokensOut>0&&t.push(`${i7(e.tokensIn)} in / ${i7(e.tokensOut)} out tokens${e.cachedTokens>0?` (${i7(e.cachedTokens)} cached)`:``}`),e.characters>0&&t.push(`${i7(e.characters)} characters`),e.images>0&&t.push(a7(e.images,`image`)),e.seconds>0&&t.push(`${n7.format(e.seconds)} s of video`),t.join(` · `)}var n7=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),r7=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),tbe=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1});function i7(e){return e<1e4?n7.format(e):tbe.format(e)}function a7(e,t){return`${n7.format(e)} ${t}${e===1?``:`s`}`}function o7(e){return e===0?`$0`:e<.01?`<$0.01`:`$${e.toFixed(2)}`}function s7(e){let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min ${t%60} s`:`${Math.floor(n/60)} h ${n%60} min`}function nbe(e){return new Date(e).toLocaleString(void 0,{weekday:`short`,hour:`2-digit`,minute:`2-digit`})}function rbe({project:e,revisionId:t,stages:n,outputs:r}){let i=r.filter(e=>e.role===`image`).sort((e,t)=>(e.meta.index??0)-(t.meta.index??0)),a=n.find(e=>e.kind===`article`),o=(0,m.use)(h3);return(0,h.jsx)(`div`,{className:`flex min-w-0 flex-col`,children:(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(V,{title:`Article`}),a?.state===`running`?(0,h.jsx)(A3,{projectId:e.id,stage:`article`,className:`mb-6`}):a?.state===`done`?(0,h.jsxs)(`p`,{className:`mb-6 flex flex-wrap items-center gap-3 text-small text-ink-2`,children:[`The article is written.`,o===void 0?null:(0,h.jsx)(L,{variant:`secondary`,size:`small`,onClick:()=>o(`output`),children:`Read it`})]}):(0,h.jsx)(`p`,{className:`mb-6 text-small text-ink-2`,children:a===void 0||a.state===`skipped`?`This project has no article.`:`The article appears here as it is written.`}),(0,h.jsx)(V,{title:`Narration`}),(0,h.jsx)(abe,{projectId:e.id,revisionId:t,audio:n.find(e=>e.kind===`audio`),outputs:r}),(0,h.jsx)(V,{title:`Images`}),i.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`The images appear here as each one is drawn.`}):(0,h.jsx)(A0,{list:!0,density:`compact`,label:`Images so far`,children:i.map(t=>(0,h.jsx)(ibe,{output:t,aspect:f5(e.format)},t.id))})]})})}function ibe({output:e,aspect:t}){let n=y8(e);if(n===void 0)return null;let r=e.meta.index===void 0?``:` ${String(e.meta.index)}`;return(0,h.jsx)(`li`,{className:`min-w-0`,children:(0,h.jsx)(k0,{src:n.url,alt:e.meta.prompt??`Image${r}`,aspect:t,...e.meta.index===void 0?{}:{meta:`#${String(e.meta.index)}`}})})}function abe({projectId:e,revisionId:t,audio:n,outputs:r}){let i=r.find(e=>e.role===`audio_levelled`&&e.meta.segment===`body`)??r.find(e=>e.role===`audio_body`),a=y8(n?.state===`running`?void 0:i);return n?.state===`running`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c7,{projectId:e,revisionId:t}),(0,h.jsx)(K8,{projectId:e})]}):a===void 0?(0,h.jsx)(c7,{projectId:e,revisionId:t}):(0,h.jsx)(`div`,{className:`mb-6`,children:(0,h.jsx)(Q8,{label:`Body narration`,src:a.url})})}var obe=240;function c7({projectId:e,revisionId:t}){let{api:n}=R(),r=N({queryKey:Ay(e,t),queryFn:()=>Hy(n,e),enabled:t!==null}),i=(r.data?.pieces??[]).flatMap(e=>e.peaks),a=(r.data?.pieces??[]).reduce((e,t)=>e+t.seconds,0),o=Math.max(1,Math.ceil(i.length/obe)),s=[];for(let e=0;e<i.length;e+=o)s.push(Math.max(...i.slice(e,e+o)));return(0,h.jsxs)(`div`,{className:`mb-6`,children:[(0,h.jsx)(`div`,{role:`img`,"aria-label":s.length===0?`No narration yet`:`Narration so far: ${s7(a*1e3)}`,className:`flex h-16 items-center gap-px overflow-hidden rounded-control border border-line bg-raised px-2`,children:s.map((e,t)=>(0,h.jsx)(`span`,{className:`w-[3px] shrink-0 rounded-full bg-accent`,style:{height:`${String(Math.max(4,Math.round(e*100)))}%`}},t))}),(0,h.jsx)(`p`,{className:`mt-1 text-label text-ink-3`,children:r.error?r.error.message:s.length===0?`The waveform grows as each part of the narration is spoken.`:`${s7(a*1e3)} narrated${r.data!==void 0&&`complete`in r.data&&r.data.complete?``:` so far`}`})]})}function sbe(e){let t=[],n=[],r=0,i=()=>{let e=n[0],r=n.at(-1);e!==void 0&&r!==void 0&&t.push({start:e.start,end:r.end,text:l7(n.map(e=>e.text)),...e.speaker===void 0?{}:{speaker:e.speaker}}),n=[]};for(let t of e){if(!Number.isFinite(t.start)||!Number.isFinite(t.end)||t.start<r-.001||t.end<=t.start)throw Error(`The saved caption timing is damaged. Use More → Render the video again in the Video section to time them again, then Try again.`);let e=n[0];e!==void 0&&(t.start-r>.7||t.speaker!==e.speaker||t.end-e.start>5||l7([...n.map(e=>e.text),t.text]).split(`
|